Commit 987839a6 authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatWriter - table cell borders from table props

parent 3aa734c7
...@@ -133,7 +133,7 @@ public: ...@@ -133,7 +133,7 @@ public:
//case SimpleTypes::bordervalueCup : return _T("cup"); //case SimpleTypes::bordervalueCup : return _T("cup");
//case SimpleTypes::bordervalueCustom : return _T("custom"); //case SimpleTypes::bordervalueCustom : return _T("custom");
case SimpleTypes::bordervalueDashDotStroked : oOutputBorder.m_eType = RtfBorder::bt_brdrdashdotstr; break; case SimpleTypes::bordervalueDashDotStroked : oOutputBorder.m_eType = RtfBorder::bt_brdrdashdotstr; break;
case SimpleTypes::bordervalueDashed : oOutputBorder.m_eType = RtfBorder::bt_brdrdash; break; case SimpleTypes::bordervalueDashed : oOutputBorder.m_eType = RtfBorder::bt_brdrdash; break;
case SimpleTypes::bordervalueDashSmallGap : oOutputBorder.m_eType = RtfBorder::bt_brdrdashsm; break; case SimpleTypes::bordervalueDashSmallGap : oOutputBorder.m_eType = RtfBorder::bt_brdrdashsm; break;
//case SimpleTypes::bordervalueDecoArch : return _T("decoArch"); //case SimpleTypes::bordervalueDecoArch : return _T("decoArch");
//case SimpleTypes::bordervalueDecoArchColor : return _T("decoArchColor"); //case SimpleTypes::bordervalueDecoArchColor : return _T("decoArchColor");
...@@ -189,8 +189,8 @@ public: ...@@ -189,8 +189,8 @@ public:
//case SimpleTypes::bordervalueMoons : return _T("moons"); //case SimpleTypes::bordervalueMoons : return _T("moons");
//case SimpleTypes::bordervalueMosaic : return _T("mosaic"); //case SimpleTypes::bordervalueMosaic : return _T("mosaic");
//case SimpleTypes::bordervalueMusicNotes : return _T("musicNotes"); //case SimpleTypes::bordervalueMusicNotes : return _T("musicNotes");
case SimpleTypes::bordervalueNil : oOutputBorder.m_eType = RtfBorder::bt_brdrnone; break; case SimpleTypes::bordervalueNil : oOutputBorder.m_eType = RtfBorder::bt_brdrnone; break;
case SimpleTypes::bordervalueNone : oOutputBorder.m_eType = RtfBorder::bt_brdrnone; break; case SimpleTypes::bordervalueNone : oOutputBorder.m_eType = RtfBorder::bt_brdrnone; break;
//case SimpleTypes::bordervalueNorthwest : return _T("northwest"); //case SimpleTypes::bordervalueNorthwest : return _T("northwest");
case SimpleTypes::bordervalueOutset : oOutputBorder.m_eType = RtfBorder::bt_brdroutset; break; case SimpleTypes::bordervalueOutset : oOutputBorder.m_eType = RtfBorder::bt_brdroutset; break;
//case SimpleTypes::bordervalueOvals : return _T("ovals"); //case SimpleTypes::bordervalueOvals : return _T("ovals");
...@@ -246,7 +246,7 @@ public: ...@@ -246,7 +246,7 @@ public:
case SimpleTypes::bordervalueThinThickSmallGap : oOutputBorder.m_eType = RtfBorder::bt_brdrtnthsg; break; case SimpleTypes::bordervalueThinThickSmallGap : oOutputBorder.m_eType = RtfBorder::bt_brdrtnthsg; break;
case SimpleTypes::bordervalueThinThickThinLargeGap : oOutputBorder.m_eType = RtfBorder::bt_brdrtnthtnlg; break; case SimpleTypes::bordervalueThinThickThinLargeGap : oOutputBorder.m_eType = RtfBorder::bt_brdrtnthtnlg; break;
case SimpleTypes::bordervalueThinThickThinMediumGap: oOutputBorder.m_eType = RtfBorder::bt_brdrtnthtnmg; break; case SimpleTypes::bordervalueThinThickThinMediumGap: oOutputBorder.m_eType = RtfBorder::bt_brdrtnthtnmg; break;
case SimpleTypes::bordervalueThinThickThinSmallGap : oOutputBorder.m_eType = RtfBorder::bt_brdrtnthtnsg; break; case SimpleTypes::bordervalueThinThickThinSmallGap : oOutputBorder.m_eType = RtfBorder::bt_brdrtnthtnsg; break;
case SimpleTypes::bordervalueThreeDEmboss : oOutputBorder.m_eType = RtfBorder::bt_brdremboss; break; case SimpleTypes::bordervalueThreeDEmboss : oOutputBorder.m_eType = RtfBorder::bt_brdremboss; break;
case SimpleTypes::bordervalueThreeDEngrave : oOutputBorder.m_eType = RtfBorder::bt_brdrengrave; break; case SimpleTypes::bordervalueThreeDEngrave : oOutputBorder.m_eType = RtfBorder::bt_brdrengrave; break;
//case SimpleTypes::bordervalueTornPaper : return _T("tornPaper"); //case SimpleTypes::bordervalueTornPaper : return _T("tornPaper");
...@@ -262,7 +262,7 @@ public: ...@@ -262,7 +262,7 @@ public:
//case SimpleTypes::bordervalueTwistedLines1 : return _T("twistedLines1"); //case SimpleTypes::bordervalueTwistedLines1 : return _T("twistedLines1");
//case SimpleTypes::bordervalueTwistedLines2 : return _T("twistedLines2"); //case SimpleTypes::bordervalueTwistedLines2 : return _T("twistedLines2");
//case SimpleTypes::bordervalueVine : return _T("vine"); //case SimpleTypes::bordervalueVine : return _T("vine");
case SimpleTypes::bordervalueWave : oOutputBorder.m_eType = RtfBorder::bt_brdrwavy; break; case SimpleTypes::bordervalueWave : oOutputBorder.m_eType = RtfBorder::bt_brdrwavy; break;
//case SimpleTypes::bordervalueWaveline : return _T("waveline"); //case SimpleTypes::bordervalueWaveline : return _T("waveline");
//case SimpleTypes::bordervalueWeavingAngles : return _T("weavingAngles"); //case SimpleTypes::bordervalueWeavingAngles : return _T("weavingAngles");
//case SimpleTypes::bordervalueWeavingBraid : return _T("weavingBraid"); //case SimpleTypes::bordervalueWeavingBraid : return _T("weavingBraid");
...@@ -277,6 +277,7 @@ public: ...@@ -277,6 +277,7 @@ public:
//oOutputBorder.m_eType = RtfBorder::bt_brdrsh; //oOutputBorder.m_eType = RtfBorder::bt_brdrsh;
//oOutputBorder.m_eType = RtfBorder::bt_brdrhair; //oOutputBorder.m_eType = RtfBorder::bt_brdrhair;
default : oOutputBorder.m_eType = RtfBorder::bt_brdrs; break;
} }
} }
......
...@@ -148,7 +148,7 @@ public: ...@@ -148,7 +148,7 @@ public:
{ {
RtfTableStylePtr oNewTableStyle = boost::static_pointer_cast<RtfTableStyle, RtfStyle>( oNewStyle ); RtfTableStylePtr oNewTableStyle = boost::static_pointer_cast<RtfTableStyle, RtfStyle>( oNewStyle );
OOXtcPrReader otcPrReader(m_ooxStyle->m_oTcPr.GetPointer()); OOXtcPrReader otcPrReader(m_ooxStyle->m_oTcPr.GetPointer(), m_ooxStyle->m_oTblPr.GetPointer());
CcnfStyle style; CcnfStyle style;
otcPrReader.Parse( oParam, oNewTableStyle->m_oCellProp, style, -1, -1, -1, -1 ); otcPrReader.Parse( oParam, oNewTableStyle->m_oCellProp, style, -1, -1, -1, -1 );
...@@ -317,7 +317,7 @@ public: ...@@ -317,7 +317,7 @@ public:
{ {
RtfTableStylePtr oNewTableStyle = boost::static_pointer_cast<RtfTableStyle, RtfStyle>( oOutputStyle ); RtfTableStylePtr oNewTableStyle = boost::static_pointer_cast<RtfTableStyle, RtfStyle>( oOutputStyle );
OOXtcPrReader otcPrReader(oox_tableStyle->m_oTcPr.GetPointer()); OOXtcPrReader otcPrReader(oox_tableStyle->m_oTcPr.GetPointer(), oox_tableStyle->m_oTblPr.GetPointer());
CcnfStyle style; CcnfStyle style;
otcPrReader.Parse( oParam, oNewTableStyle->m_oCellProp, style, -1, -1, -1, -1 ); otcPrReader.Parse( oParam, oNewTableStyle->m_oCellProp, style, -1, -1, -1, -1 );
......
...@@ -41,11 +41,13 @@ ...@@ -41,11 +41,13 @@
class OOXTableCellReader class OOXTableCellReader
{ {
private: private:
OOX::Logic::CTc *m_ooxTableCell; OOX::Logic::CTc *m_ooxTableCell;
OOX::Logic::CTableProperty *m_ooxTableProps;
public: public:
OOXTableCellReader(OOX::Logic::CTc *ooxTableCell) OOXTableCellReader(OOX::Logic::CTc *ooxTableCell, OOX::Logic::CTableProperty* ooxTableProps)
{ {
m_ooxTableCell = ooxTableCell; m_ooxTableCell = ooxTableCell;
m_ooxTableProps = ooxTableProps;
} }
bool Parse( ReaderParameter oParam ,RtfTableCell& oOutputCell, CcnfStyle oConditionalTableStyle, int nCurCell, int nCellCount, int nCurRow, int nRowCount ) bool Parse( ReaderParameter oParam ,RtfTableCell& oOutputCell, CcnfStyle oConditionalTableStyle, int nCurCell, int nCellCount, int nCurRow, int nRowCount )
{ {
...@@ -53,7 +55,7 @@ public: ...@@ -53,7 +55,7 @@ public:
if( m_ooxTableCell->m_oTableCellProperties ) if( m_ooxTableCell->m_oTableCellProperties )
{ {
OOXtcPrReader oCellPropReader(m_ooxTableCell->m_oTableCellProperties); OOXtcPrReader oCellPropReader(m_ooxTableCell->m_oTableCellProperties, m_ooxTableProps);
oCellPropReader.Parse( oParam, oOutputCell.m_oProperty, oConditionalTableStyle, nCurCell, nCellCount, nCurRow, nRowCount );//может поменяться на любой condition (firstRow) oCellPropReader.Parse( oParam, oOutputCell.m_oProperty, oConditionalTableStyle, nCurCell, nCellCount, nCurRow, nRowCount );//может поменяться на любой condition (firstRow)
} }
else else
......
...@@ -97,7 +97,7 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable ) ...@@ -97,7 +97,7 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
OOX::Logic::CTr *ooxRow = dynamic_cast<OOX::Logic::CTr *>(m_ooxTable->m_arrItems[i]); OOX::Logic::CTr *ooxRow = dynamic_cast<OOX::Logic::CTr *>(m_ooxTable->m_arrItems[i]);
OOXTableRowReader oRowReader(ooxRow); OOXTableRowReader oRowReader(ooxRow, m_ooxTable->m_oTableProperties);
oRowReader.Parse( newParam, *oNewRow, nCurRow++, nRowCount ); oRowReader.Parse( newParam, *oNewRow, nCurRow++, nRowCount );
oOutputTable.AddItem( oNewRow ); oOutputTable.AddItem( oNewRow );
} }
......
...@@ -40,11 +40,13 @@ ...@@ -40,11 +40,13 @@
class OOXTableRowReader class OOXTableRowReader
{ {
private: private:
OOX::Logic::CTr *m_ooxRowTable; OOX::Logic::CTr *m_ooxRowTable;
OOX::Logic::CTableProperty *m_ooxTableProps;
public: public:
OOXTableRowReader(OOX::Logic::CTr *ooxRowTable) OOXTableRowReader(OOX::Logic::CTr *ooxRowTable, OOX::Logic::CTableProperty* ooxTableProps)
{ {
m_ooxRowTable = ooxRowTable; m_ooxRowTable = ooxRowTable;
m_ooxTableProps = ooxTableProps;
} }
bool Parse( ReaderParameter oParam ,RtfTableRow& oOutputRow, int nCurRow, int nRowCount) bool Parse( ReaderParameter oParam ,RtfTableRow& oOutputRow, int nCurRow, int nRowCount)
...@@ -73,7 +75,7 @@ public: ...@@ -73,7 +75,7 @@ public:
if (nCurCell < m_ooxRowTable->m_arrItems.size()) if (nCurCell < m_ooxRowTable->m_arrItems.size())
ooxCell = dynamic_cast<OOX::Logic::CTc *>(m_ooxRowTable->m_arrItems[i]); ooxCell = dynamic_cast<OOX::Logic::CTc *>(m_ooxRowTable->m_arrItems[i]);
OOXTableCellReader oCellReader(ooxCell); OOXTableCellReader oCellReader(ooxCell, m_ooxTableProps );
oCellReader.Parse( oParam, *oNewCell, oConditionStyle, nCurCell++, nCurRow, nCellCount, nRowCount ); oCellReader.Parse( oParam, *oNewCell, oConditionStyle, nCurCell++, nCurRow, nCellCount, nRowCount );
//добавляем cell //добавляем cell
oOutputRow.AddItem(oNewCell); oOutputRow.AddItem(oNewCell);
......
...@@ -38,10 +38,12 @@ ...@@ -38,10 +38,12 @@
class OOXtcPrReader class OOXtcPrReader
{ {
OOX::Logic::CTableCellProperties* m_ooxTableCellProps; OOX::Logic::CTableCellProperties* m_ooxTableCellProps;
OOX::Logic::CTableProperty* m_ooxTableProps;
public: public:
OOXtcPrReader(OOX::Logic::CTableCellProperties* ooxTableCellProps) OOXtcPrReader(OOX::Logic::CTableCellProperties* ooxTableCellProps, OOX::Logic::CTableProperty* ooxTableProps)
{ {
m_ooxTableCellProps = ooxTableCellProps; m_ooxTableCellProps = ooxTableCellProps;
m_ooxTableProps = ooxTableProps;
} }
bool Parse( ReaderParameter oParam ,RtfCellProperty& oOutputProperty, CcnfStyle& oConditionalTableStyle, int nCurCell, int nCellCount, int nCurRow, int nRowCount ) bool Parse( ReaderParameter oParam ,RtfCellProperty& oOutputProperty, CcnfStyle& oConditionalTableStyle, int nCurCell, int nCellCount, int nCurRow, int nRowCount )
{ {
...@@ -151,6 +153,45 @@ public: ...@@ -151,6 +153,45 @@ public:
oBorderReader.Parse( oParam,oOutputProperty.m_oBorderBottom ); oBorderReader.Parse( oParam,oOutputProperty.m_oBorderBottom );
} }
} }
else if (m_ooxTableProps)
{
//from table props
//todoo last, first !!!!
//if( m_ooxTableProps->m_oTblBorders->m_oTop.IsInit() )
//{
// OOXBorderReader oBorderReader(m_ooxTableProps->m_oTblBorders->m_oTop.GetPointer());
// oBorderReader.Parse( oParam,oOutputProperty.m_oBorderTop);
//}
//if( m_ooxTableProps->m_oTblBorders->m_oStart.IsInit() )
//{
// OOXBorderReader oBorderReader(m_ooxTableProps->m_oTblBorders->m_oStart.GetPointer());
// oBorderReader.Parse(oParam,oOutputProperty.m_oBorderLeft);
//}
//if( m_ooxTableProps->m_oTblBorders->m_oBottom.IsInit())
//{
// OOXBorderReader oBorderReader(m_ooxTableProps->m_oTblBorders->m_oBottom.GetPointer());
// oBorderReader.Parse(oParam,oOutputProperty.m_oBorderBottom);
//}
//if( m_ooxTableProps->m_oTblBorders->m_oEnd.IsInit() )
//{
// OOXBorderReader oBorderReader(m_ooxTableProps->m_oTblBorders->m_oEnd.GetPointer());
// oBorderReader.Parse(oParam,oOutputProperty.m_oBorderRight);
//}
if( m_ooxTableProps->m_oTblBorders->m_oInsideH.IsInit())
{
OOXBorderReader oBorderReader(m_ooxTableProps->m_oTblBorders->m_oInsideH.GetPointer());
oBorderReader.Parse( oParam,oOutputProperty.m_oBorderTop );
oBorderReader.Parse( oParam,oOutputProperty.m_oBorderBottom );
}
if( m_ooxTableProps->m_oTblBorders->m_oInsideV.IsInit() )
{
OOXBorderReader oBorderReader(m_ooxTableProps->m_oTblBorders->m_oInsideV.GetPointer());
oBorderReader.Parse( oParam,oOutputProperty.m_oBorderLeft );
oBorderReader.Parse( oParam,oOutputProperty.m_oBorderRight );
}
}
if( m_ooxTableCellProps->m_oShd.IsInit()) if( m_ooxTableCellProps->m_oShd.IsInit())
{ {
OOXShadingReader oShadingReader(m_ooxTableCellProps->m_oShd.GetPointer()); OOXShadingReader oShadingReader(m_ooxTableCellProps->m_oShd.GetPointer());
...@@ -170,12 +211,13 @@ public: ...@@ -170,12 +211,13 @@ public:
{ {
switch(m_ooxTableCellProps->m_oTextDirection->m_oVal->GetValue()) switch(m_ooxTableCellProps->m_oTextDirection->m_oVal->GetValue())
{ {
case SimpleTypes::textdirectionLr : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtb; case SimpleTypes::textdirectionLr : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtb; break;
case SimpleTypes::textdirectionLrV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtbv; case SimpleTypes::textdirectionLrV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtbv; break;
case SimpleTypes::textdirectionRl : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_tbrl; case SimpleTypes::textdirectionRl : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_tbrl; break;
case SimpleTypes::textdirectionRlV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_tbrlv; case SimpleTypes::textdirectionRlV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_tbrlv; break;
case SimpleTypes::textdirectionTb : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_btlr; //??
case SimpleTypes::textdirectionTbV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_btlr; //?? case SimpleTypes::textdirectionTbV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_btlr; //??
case SimpleTypes::textdirectionTb : //lrTb .. default
default: break;
} }
} }
if (m_ooxTableCellProps->m_oGridSpan.IsInit() && m_ooxTableCellProps->m_oGridSpan->m_oVal.IsInit()) if (m_ooxTableCellProps->m_oGridSpan.IsInit() && m_ooxTableCellProps->m_oGridSpan->m_oVal.IsInit())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment