Commit 987839a6 authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatWriter - table cell borders from table props

parent 3aa734c7
......@@ -277,6 +277,7 @@ public:
//oOutputBorder.m_eType = RtfBorder::bt_brdrsh;
//oOutputBorder.m_eType = RtfBorder::bt_brdrhair;
default : oOutputBorder.m_eType = RtfBorder::bt_brdrs; break;
}
}
......
......@@ -148,7 +148,7 @@ public:
{
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;
otcPrReader.Parse( oParam, oNewTableStyle->m_oCellProp, style, -1, -1, -1, -1 );
......@@ -317,7 +317,7 @@ public:
{
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;
otcPrReader.Parse( oParam, oNewTableStyle->m_oCellProp, style, -1, -1, -1, -1 );
......
......@@ -42,10 +42,12 @@ class OOXTableCellReader
{
private:
OOX::Logic::CTc *m_ooxTableCell;
OOX::Logic::CTableProperty *m_ooxTableProps;
public:
OOXTableCellReader(OOX::Logic::CTc *ooxTableCell)
OOXTableCellReader(OOX::Logic::CTc *ooxTableCell, OOX::Logic::CTableProperty* ooxTableProps)
{
m_ooxTableCell = ooxTableCell;
m_ooxTableProps = ooxTableProps;
}
bool Parse( ReaderParameter oParam ,RtfTableCell& oOutputCell, CcnfStyle oConditionalTableStyle, int nCurCell, int nCellCount, int nCurRow, int nRowCount )
{
......@@ -53,7 +55,7 @@ public:
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)
}
else
......
......@@ -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]);
OOXTableRowReader oRowReader(ooxRow);
OOXTableRowReader oRowReader(ooxRow, m_ooxTable->m_oTableProperties);
oRowReader.Parse( newParam, *oNewRow, nCurRow++, nRowCount );
oOutputTable.AddItem( oNewRow );
}
......
......@@ -41,10 +41,12 @@ class OOXTableRowReader
{
private:
OOX::Logic::CTr *m_ooxRowTable;
OOX::Logic::CTableProperty *m_ooxTableProps;
public:
OOXTableRowReader(OOX::Logic::CTr *ooxRowTable)
OOXTableRowReader(OOX::Logic::CTr *ooxRowTable, OOX::Logic::CTableProperty* ooxTableProps)
{
m_ooxRowTable = ooxRowTable;
m_ooxTableProps = ooxTableProps;
}
bool Parse( ReaderParameter oParam ,RtfTableRow& oOutputRow, int nCurRow, int nRowCount)
......@@ -73,7 +75,7 @@ public:
if (nCurCell < m_ooxRowTable->m_arrItems.size())
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 );
//добавляем cell
oOutputRow.AddItem(oNewCell);
......
......@@ -38,10 +38,12 @@
class OOXtcPrReader
{
OOX::Logic::CTableCellProperties* m_ooxTableCellProps;
OOX::Logic::CTableProperty* m_ooxTableProps;
public:
OOXtcPrReader(OOX::Logic::CTableCellProperties* ooxTableCellProps)
OOXtcPrReader(OOX::Logic::CTableCellProperties* ooxTableCellProps, OOX::Logic::CTableProperty* ooxTableProps)
{
m_ooxTableCellProps = ooxTableCellProps;
m_ooxTableProps = ooxTableProps;
}
bool Parse( ReaderParameter oParam ,RtfCellProperty& oOutputProperty, CcnfStyle& oConditionalTableStyle, int nCurCell, int nCellCount, int nCurRow, int nRowCount )
{
......@@ -151,6 +153,45 @@ public:
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())
{
OOXShadingReader oShadingReader(m_ooxTableCellProps->m_oShd.GetPointer());
......@@ -170,12 +211,13 @@ public:
{
switch(m_ooxTableCellProps->m_oTextDirection->m_oVal->GetValue())
{
case SimpleTypes::textdirectionLr : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtb;
case SimpleTypes::textdirectionLrV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtbv;
case SimpleTypes::textdirectionRl : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_tbrl;
case SimpleTypes::textdirectionRlV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_tbrlv;
case SimpleTypes::textdirectionTb : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_btlr; //??
case SimpleTypes::textdirectionLr : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtb; break;
case SimpleTypes::textdirectionLrV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_lrtbv; break;
case SimpleTypes::textdirectionRl : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_tbrl; break;
case SimpleTypes::textdirectionRlV : oOutputProperty.m_oCellFlow = RtfCellProperty::cf_tbrlv; break;
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())
......
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