Commit c880c3d1 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

RtfFormatWriter - fix styled tables

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@67841 954022d7-b5bf-4e40-9824-e11837661b57
parent 59c16015
......@@ -43,22 +43,11 @@ public:
if (m_ooxBorder)
{
if ((m_ooxBorder->m_oColor.IsInit()) && (m_ooxBorder->m_oColor->GetValue() == SimpleTypes::hexcolorRGB))
{
RtfColor oColor(m_ooxBorder->m_oColor->Get_R(), m_ooxBorder->m_oColor->Get_G(), m_ooxBorder->m_oColor->Get_B());
oOutputBorder.m_nColor = oParam.oRtf->m_oColorTable.AddItem( oColor );
}
if (m_ooxBorder->m_oSpace.IsInit())
{
oOutputBorder.m_nSpace = RtfUtility::pt2Twip(m_ooxBorder->m_oSpace->ToPoints());
}
if (m_ooxBorder->m_oSz.IsInit())
{
oOutputBorder.m_nWidth = RtfUtility::pt2Twip(m_ooxBorder->m_oSz->ToPoints());// = 5 * nSize / 2;//w:sz 1/8 twips (equivalent to 1/576th of an inch)
}
if (m_ooxBorder->m_oVal.IsInit())
{
if (m_ooxBorder->m_oVal->GetValue() == SimpleTypes::bordervalueNone ) return true;
// это отсутствие свойства а не бордера (Nil)
switch(m_ooxBorder->m_oVal->GetValue())
{
//case SimpleTypes::bordervalueApples : return _T("apples");
......@@ -252,12 +241,27 @@ public:
//case SimpleTypes::bordervalueWoodwork : return _T("woodwork");
//case SimpleTypes::bordervalueXIllusions : return _T("xIllusions");
//case SimpleTypes::bordervalueZanyTriangles : return _T("zanyTriangles");
}
//case SimpleTypes::bordervalueZigZag : return _T("zigZag");
//case SimpleTypes::SimpleTypes::bordervalueZigZagStitch : return _T("zigZagStitch");
//oOutputBorder.m_eType = RtfBorder::bt_brdrsh;
//oOutputBorder.m_eType = RtfBorder::bt_brdrhair;
}
}
if ((m_ooxBorder->m_oColor.IsInit()) && (m_ooxBorder->m_oColor->GetValue() == SimpleTypes::hexcolorRGB))
{
RtfColor oColor(m_ooxBorder->m_oColor->Get_R(), m_ooxBorder->m_oColor->Get_G(), m_ooxBorder->m_oColor->Get_B());
oOutputBorder.m_nColor = oParam.oRtf->m_oColorTable.AddItem( oColor );
}
if (m_ooxBorder->m_oSpace.IsInit())
{
oOutputBorder.m_nSpace = RtfUtility::pt2Twip(m_ooxBorder->m_oSpace->ToPoints());
}
if (m_ooxBorder->m_oSz.IsInit())
{
oOutputBorder.m_nWidth = RtfUtility::pt2Twip(m_ooxBorder->m_oSz->ToPoints());// = 5 * nSize / 2;//w:sz 1/8 twips (equivalent to 1/576th of an inch)
}
}
return true;
}
......
......@@ -135,7 +135,7 @@ public:
oNewSubStyle->m_sName = oNewStyle->m_sName;
if( true == oNewSubStyle->IsValid() && RtfStyle::stTable == oNewSubStyle->m_eType )
if( /*true == oNewSubStyle->IsValid() && */RtfStyle::stTable == oNewSubStyle->m_eType )
{
oNewSubStyle->m_nID = oParam.oRtf->m_oStyleTable.GetCount() + 1;
......@@ -233,7 +233,10 @@ public:
if (oox_tableStyle == NULL) return false;
if (oOutputStyle == NULL)
oOutputStyle = RtfStylePtr( new RtfTableStyle() );
{
oOutputStyle = RtfStylePtr( new RtfTableStyle() );
oOutputStyle->m_nID = oParam.oRtf->m_oStyleTable.GetCount() + 1;
}
RtfStyle::StyleType eStyleType = oOutputStyle->m_eType;//todooo проверить
if (oox_tableStyle->m_oRunPr.IsInit() &&
......
......@@ -11,7 +11,7 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
if(m_ooxTable->m_oTableProperties )
{
OOXtblPrReader otblPrReader(m_ooxTable->m_oTableProperties);
otblPrReader.Parse( oParam, oOutputTable.m_oProperty);
otblPrReader.Parse( oParam, oOutputTable.m_oProperty);
bExistTablPr = true;
}
......@@ -26,15 +26,18 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
if( RtfStyle::stTable == oResultStyle->m_eType )
{
poTableStyle = boost::static_pointer_cast<RtfTableStyle, RtfStyle>( oResultStyle );
poTableStyle->m_oTableProp = oOutputTable.m_oProperty; //TableProperty ставим как уже прочитали чтобы не терять порядок применения свойст
poTableStyle->m_oTableProp = oOutputTable.m_oProperty;
//TableProperty ставим как уже прочитали чтобы не терять порядок применения свойст
//например индент последовательно затирает друг друга в стилях, numbering, просто в свойствах
//затирает свойства и на First, Last .... todoooo
}
}
}
else if( true == bExistTablPr )
{
RtfTableStylePtr poTableStyle = RtfTableStylePtr( new RtfTableStyle() );
poTableStyle->m_oTableProp.Merge( oOutputTable.m_oProperty );
poTableStyle->m_oTableProp.Merge( oOutputTable.m_oProperty ); // будут использованы ниже
}
if( m_ooxTable->m_oTblGrid.IsInit() )
......@@ -46,13 +49,16 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
}
}
long nRowCount = m_ooxTable->m_nCountRow;
long nRowCount = m_ooxTable->m_nCountRow, nCurRow = 0;
for( int i = 0; i < m_ooxTable->m_arrItems.size(); i++ )
{
if (m_ooxTable->m_arrItems[i] == NULL) continue;
if (m_ooxTable->m_arrItems[i]->getType() != OOX::et_w_tr) continue;
ReaderParameter newParam = oParam;
newParam.poTableStyle = poTableStyle;
RtfTableRowPtr oNewRow( new RtfTableRow() );
//применяем свойства таблицы к каждому row
//т.к. в RTF нет свойств таблиц и все свойства записываются в свойства row
......@@ -61,7 +67,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);
oRowReader.Parse( oParam, *oNewRow, i, nRowCount );
oRowReader.Parse( newParam, *oNewRow, nCurRow++, nRowCount );
oOutputTable.AddItem( oNewRow );
}
oOutputTable.CalculateCellx( *oParam.oRtf );
......
......@@ -28,26 +28,26 @@ public:
otrPrReader.Parse( oParam, oOutputRow.m_oProperty, oConditionStyle);// может поменяться на любой condition(first row)
}
int nCellCount = m_ooxRowTable->m_nCountCell;
int nCellCount = m_ooxRowTable->m_nCountCell, nCurCell = 0;
for( int nCurCell = 0; nCurCell < nCellCount; nCurCell++)
for( int i = 0; i < m_ooxRowTable->m_arrItems.size(); i++)
{
if (m_ooxRowTable->m_arrItems[i] == NULL) continue;
if (m_ooxRowTable->m_arrItems[i]->getType() != OOX::et_w_tc)continue;//todooo bookmarks
RtfTableCellPtr oNewCell( new RtfTableCell() );
OOX::Logic::CTc *ooxCell = NULL;
if (nCurCell < m_ooxRowTable->m_arrItems.size())
ooxCell = dynamic_cast<OOX::Logic::CTc *>(m_ooxRowTable->m_arrItems[nCurCell]);
if (ooxCell)
{
OOXTableCellReader oCellReader(ooxCell);
oCellReader.Parse( oParam, *oNewCell, oConditionStyle, nCurCell, nCurRow, nCellCount, nRowCount );
//добавляем cell
oOutputRow.AddItem(oNewCell);
//свойства cell в row
oOutputRow.m_oProperty.AddItem( oNewCell->m_oProperty );
}
ooxCell = dynamic_cast<OOX::Logic::CTc *>(m_ooxRowTable->m_arrItems[i]);
OOXTableCellReader oCellReader(ooxCell);
oCellReader.Parse( oParam, *oNewCell, oConditionStyle, nCurCell++, nCurRow, nCellCount, nRowCount );
//добавляем cell
oOutputRow.AddItem(oNewCell);
//свойства cell в row
oOutputRow.m_oProperty.AddItem( oNewCell->m_oProperty );
}
return true;
}
......
......@@ -246,7 +246,7 @@ private:
oOutputProperty.m_oBorderLeft.Merge( oInputStyle->m_oTableProp.m_oBorderLeft );
if( nBoundRight == nCurX )
oOutputProperty.m_oBorderRight.Merge( oInputStyle->m_oTableProp.m_oBorderRight );
else
else if (oInputStyle->m_oTableProp.m_bAutoNoColBand != 1)
oOutputProperty.m_oBorderRight.Merge( oInputStyle->m_oTableProp.m_oBorderVert );
}
else if( nBoundRight == nCurX )
......@@ -265,7 +265,7 @@ private:
oOutputProperty.m_oBorderTop.Merge( oInputStyle->m_oTableProp.m_oBorderTop );
if( nBoundBottom == nCurY )
oOutputProperty.m_oBorderBottom.Merge( oInputStyle->m_oTableProp.m_oBorderBottom );
else
else if (oInputStyle->m_oTableProp.m_bAutoNoRowBand != 1)
oOutputProperty.m_oBorderBottom.Merge( oInputStyle->m_oTableProp.m_oBorderHor );
}
else if( nBoundBottom == nCurY )
......
......@@ -2,32 +2,32 @@
#include "RtfDocument.h"
CString RtfFontTable::RenderToRtf(RenderParameter oRenderParameter)
{
////записывает default charset и codepage
//RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
//if( PROP_DEF != poDocument->m_oProperty.m_nAnsiCodePage )
//{
// int nCodepage = poDocument->m_oProperty.m_nAnsiCodePage;
// int nCharset = RtfUtility::CodepageToCharset( nCodepage );
// for( int i = 0; i < (int)m_aArray.size(); i++ )
// {
// m_aArray[i].m_nCharset = nCharset;
// m_aArray[i].m_nCodePage = nCodepage;
// }
//}
CString sResult;
if( m_aArray.size() > 0 )
{
sResult.Append(_T("{\\fonttbl"));
RenderParameter oNewParameter = oRenderParameter;
oNewParameter.nType = RENDER_TO_RTF_PARAM_FONT_TBL;
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.AppendFormat(_T("%ls"),m_aArray[i].RenderToRtf( oNewParameter ).GetBuffer());
sResult.Append(_T("}"));
}
return sResult;
}
{
////записывает default charset и codepage
//RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
//if( PROP_DEF != poDocument->m_oProperty.m_nAnsiCodePage )
//{
// int nCodepage = poDocument->m_oProperty.m_nAnsiCodePage;
// int nCharset = RtfUtility::CodepageToCharset( nCodepage );
// for( int i = 0; i < (int)m_aArray.size(); i++ )
// {
// m_aArray[i].m_nCharset = nCharset;
// m_aArray[i].m_nCodePage = nCodepage;
// }
//}
CString sResult;
if( m_aArray.size() > 0 )
{
sResult.Append(_T("{\\fonttbl"));
RenderParameter oNewParameter = oRenderParameter;
oNewParameter.nType = RENDER_TO_RTF_PARAM_FONT_TBL;
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.AppendFormat(_T("%ls"),m_aArray[i].RenderToRtf( oNewParameter ).GetBuffer());
sResult.Append(_T("}"));
}
return sResult;
}
CString RtfListTable::RenderToOOX(RenderParameter oRenderParameter)
{
CString sResult;
......
......@@ -154,28 +154,29 @@ public:
{
RtfStylePtr oResultStyle;
RtfStyle::StyleType eStyleType = RtfStyle::st_none;
int nStyleId = oInputStyle->m_nID;
int nLinked = PROP_DEF;
int nBaseOn = oInputStyle->m_nBasedOn;
if( RtfStyle::stCharacter == oInputStyle->m_eType )
{
if( RtfStyle::stCharacter == oInputStyle->m_eType )
{
eStyleType = RtfStyle::stCharacter;
oResultStyle = RtfCharStylePtr( new RtfCharStyle() );
}
else if( RtfStyle::stParagraph == oInputStyle->m_eType )
{
}
else if( RtfStyle::stParagraph == oInputStyle->m_eType )
{
eStyleType = RtfStyle::stParagraph;
oResultStyle = RtfParagraphStylePtr( new RtfParagraphStyle() );
nLinked = oInputStyle->m_nLink;//linked будем смотреть только у стилей параграфа, чтобы избежать рекурсии
}
else if( RtfStyle::stTable == oInputStyle->m_eType )
{
}
else if( RtfStyle::stTable == oInputStyle->m_eType )
{
eStyleType = RtfStyle::stTable;
oResultStyle = RtfTableStylePtr( new RtfTableStyle() );
}
else
return oInputStyle;
}
else
return oInputStyle; //ОПАСНО .. потом может другим затереться todooo
RtfStylePtr oLinkedStyle;
//if( PROP_DEF != nLinked && nStyleId != nLinked)
......@@ -191,21 +192,18 @@ public:
if( true == GetStyle( nBaseOn, oTemStyle) )
oBaseStyle = GetStyleResulting( oTemStyle );
}
if( NULL == oLinkedStyle && NULL == oBaseStyle )
return oInputStyle;
else
{
//Опытным путем установлено - Base старше Link
if( NULL != oLinkedStyle )
{
oResultStyle->Merge( oLinkedStyle );
}
if( NULL != oBaseStyle )
{
oResultStyle->Merge( oBaseStyle );
}
oResultStyle->Merge( oInputStyle );
}
//Опытным путем установлено - Base старше Link
if( NULL != oLinkedStyle )
{
oResultStyle->Merge( oLinkedStyle );
}
if( NULL != oBaseStyle )
{
oResultStyle->Merge( oBaseStyle );
}
oResultStyle->Merge( oInputStyle );
return oResultStyle;
}
CString RenderToRtf(RenderParameter oRenderParameter)
......
......@@ -128,73 +128,4 @@ CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter)
//sResult.AppendFormat( _T("<v:imagedata r:id=\"%ls\""), srId );
return srId;
}
//bool RtfPicture::LoadPicture( IUnknown** piImage, CString sPath )
//{
// ImageStudio::IImageTransformsPtr piTransform = NULL;
// HRESULT hRes = piTransform.CreateInstance( ImageStudio::CLSID_ImageTransforms );
// if( FAILED(hRes) || NULL == piTransform )
// return false;
//
// VARIANT vImage;
// CString sTransformation = _T("<ImageFile-LoadImage sourcepath='") + sPath + _T("'/>");
// BSTR bstrLoad = sTransformation.AllocSysString();
// if( piTransform->SetXml(bstrLoad) )
// if(piTransform->Transform())
// piTransform->GetResult( 0, &vImage );
// (*piImage) = vImage.punkVal;
// SysFreeString( bstrLoad );
// if( NULL == (*piImage) )
// return false;
//
// //ImageFile::IImageFile3* piImageFile = NULL;
// //CoCreateInstance( __uuidof(ImageFile::ImageFile3) , NULL, CLSCTX_INPROC, __uuidof(ImageFile::IImageFile3), (void**)(&piImageFile));
// //BSTR bstrFilePath = sTempFile.AllocSysString();
// //piImageFile->SaveImage2( &m_piPicture, IMAGEFORMAT_PNG, bstrFilePath);
// //SysFreeString( bstrFilePath );
// return true;
//}
//bool RtfPicture::SavePicture( IUnknown* piImage, CString sPath, long nFormat )
//{
// if( NULL == piImage )
// return false;
// ImageStudio::IImageTransformsPtr piTransform = NULL;
// HRESULT hRes = piTransform.CreateInstance( ImageStudio::CLSID_ImageTransforms );
// if( FAILED(hRes) || NULL == piTransform )
// return false;
// CString sFormat = _T("");
// switch( nFormat )
// {
// case IMAGEFORMAT_WMF: sFormat = _T("Wmf");break;
// case IMAGEFORMAT_PNG: sFormat = _T("Png");break;
// case IMAGEFORMAT_JPE: sFormat = _T("Jpg");break;
// }
// if( _T("") == sFormat )
// return false;
//
// VARIANT vImage;
// vImage.vt = VT_UNKNOWN;
// vImage.punkVal = piImage;
// piTransform->SetSource( 0, vImage);
//
// CString sTransformation = _T("<ImageFile-SaveAs");
// sTransformation.Append( sFormat );
// sTransformation.Append( _T(" destinationpath=\"") );
// sTransformation.Append( sPath );
// sTransformation.Append( _T("\" format=\"8888\" />") );
//
// BSTR bstrLoad = sTransformation.AllocSysString();
//
// if( piTransform->SetXml(bstrLoad) )
// if(piTransform->Transform())
// piTransform->GetResult( 0, &vImage );
// RELEASEINTERFACE( vImage.punkVal );
// SysFreeString( bstrLoad );
//
// //ImageFile::IImageFile3* piImageFile = NULL;
// //CoCreateInstance( __uuidof(ImageFile::ImageFile3) , NULL, CLSCTX_INPROC, __uuidof(ImageFile::IImageFile3), (void**)(&piImageFile));
// //BSTR bstrFilePath = sTempFile.AllocSysString();
// //piImageFile->SaveImage2( &m_piPicture, IMAGEFORMAT_PNG, bstrFilePath);
// //SysFreeString( bstrFilePath );
// return true;
//}
}
\ No newline at end of file
......@@ -502,12 +502,12 @@ CString RtfBorder::RenderToRtf(RenderParameter oRenderParameter)
case bt_brdroutset: sResult = _T("\\brdroutset"); break;
case bt_brdrnone: sResult = _T("\\brdrnone"); break;
}
if( PROP_DEF != m_nWidth )
sResult.AppendFormat( _T("\\brdrw%d"),m_nWidth );
if( PROP_DEF != m_nSpace )
sResult.AppendFormat( _T("\\brsp%d"),m_nSpace );
if( PROP_DEF != m_nWidth && m_nWidth > 0)
sResult.AppendFormat( _T("\\brdrw%d"), m_nWidth );
if( PROP_DEF != m_nSpace && m_nSpace > 0)
sResult.AppendFormat( _T("\\brsp%d"), m_nSpace );
if( PROP_DEF != m_nColor )
sResult.AppendFormat( _T("\\brdrcf%d"),m_nColor );
sResult.AppendFormat( _T("\\brdrcf%d"), m_nColor );
return sResult;
}
CString RtfBorder::RenderToOOX(RenderParameter oRenderParameter)
......@@ -1624,36 +1624,41 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
if( true == m_oShading.IsValid() )
sResult.Append( m_oShading.RenderToRtf( oRenderParameter ) );
bool border_sides = false;
if( true == m_oBorderTop.IsValid() )
{
sResult.Append(_T("\\brdrt"));
sResult.Append( m_oBorderTop.RenderToRtf( oRenderParameter ) );
border_sides = true;
}
if( true == m_oBorderLeft.IsValid() )
{
sResult.Append(_T("\\brdrl"));
sResult.Append( m_oBorderLeft.RenderToRtf( oRenderParameter ) );
border_sides = true;
}
if( true == m_oBorderBottom.IsValid() )
{
sResult.Append(_T("\\brdrb"));
sResult.Append( m_oBorderBottom.RenderToRtf( oRenderParameter ) );
border_sides = true;
}
if( true == m_oBorderRight.IsValid() )
{
sResult.Append(_T("\\brdrr"));
sResult.Append( m_oBorderRight.RenderToRtf( oRenderParameter ) );
}
if( true == m_oBorderBox.IsValid() )
{
sResult.Append(_T("\\box"));
sResult.Append( m_oBorderBox.RenderToRtf( oRenderParameter ) );
border_sides = true;
}
if( true == m_oBorderBar.IsValid() )
{
sResult.Append(_T("\\brdrbar"));
sResult.Append( m_oBorderBar.RenderToRtf( oRenderParameter ) );
}
if( true == m_oBorderBox.IsValid() && !border_sides)
{
sResult.Append(_T("\\box"));
sResult.Append( m_oBorderBox.RenderToRtf( oRenderParameter ) );
}
if( true == m_oFrame.IsValid() )
sResult.Append( m_oFrame.RenderToRtf( oRenderParameter ) );
......@@ -1923,8 +1928,6 @@ CString RtfCellProperty::RenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_BOOL( m_bHideMark, sResult, _T("clhidemark") )
if( true == m_oBorderDiagonalLR.IsValid() )
{
sResult.Append(_T("\\cldglu"));
......@@ -2236,12 +2239,12 @@ CString RtfTableProperty::RenderToRtf(RenderParameter oRenderParameter)
sResult.Append(_T("\\trbrdrb"));
sResult.Append(m_oBorderBottom.RenderToRtf( oRenderParameter ) );
}
if( m_oBorderVert.IsValid() == true )
if( m_oBorderVert.IsValid() == true && m_bAutoNoColBand != 1)
{
sResult.Append(_T("\\trbrdrv"));
sResult.Append(m_oBorderVert.RenderToRtf( oRenderParameter ) );
}
if( m_oBorderHor.IsValid() == true )
if( m_oBorderHor.IsValid() == true && m_bAutoNoRowBand != 1)
{
sResult.Append(_T("\\trbrdrh"));
sResult.Append(m_oBorderHor.RenderToRtf( oRenderParameter ) );
......@@ -2903,85 +2906,88 @@ else if( TYPE_RTF_PROPERTY_STYLE_TABLE == oStyle->GetType() )
}
void RtfTableStyle::Merge( RtfStylePtr oStyle )
{
RtfStyle::Merge( oStyle );
if( TYPE_RTF_PROPERTY_STYLE_CHAR == oStyle->GetType() )
{
RtfCharStylePtr oCharStyle = boost::static_pointer_cast<RtfCharStyle, RtfStyle>( oStyle );
m_oCharProp.Merge( oCharStyle->m_oCharProp );
}
else if( TYPE_RTF_PROPERTY_STYLE_PARAGRAPH == oStyle->GetType() )
{
RtfParagraphStylePtr oParagraphStyle = boost::static_pointer_cast<RtfParagraphStyle, RtfStyle>( oStyle );
m_oParProp.Merge( oParagraphStyle->m_oParProp );
m_oCharProp.Merge( oParagraphStyle->m_oCharProp );
}
if( TYPE_RTF_PROPERTY_STYLE_TABLE == oStyle->GetType() )
{
RtfTableStylePtr oTableStyle = boost::static_pointer_cast<RtfTableStyle, RtfStyle>( oStyle );
m_oTableProp.Merge( oTableStyle->m_oTableProp );
m_oRowProp.Merge( oTableStyle->m_oRowProp );
m_oCellProp.Merge( oTableStyle->m_oCellProp );
m_oParProp.Merge( oTableStyle->m_oParProp );
m_oCharProp.Merge( oTableStyle->m_oCharProp );
if( NULL != oTableStyle->m_oFirstRow )
{
m_oFirstRow = RtfTableStylePtr( new RtfTableStyle() );
m_oFirstRow->Merge( oTableStyle->m_oFirstRow );
}
if( NULL != oTableStyle->m_oLastRow )
{
m_oLastRow = RtfTableStylePtr( new RtfTableStyle() );
m_oLastRow->Merge( oTableStyle->m_oLastRow );
}
if( NULL != oTableStyle->m_oFirstCol )
{
m_oFirstCol = RtfTableStylePtr( new RtfTableStyle() );
m_oFirstCol->Merge( oTableStyle->m_oFirstCol );
}
if( NULL != oTableStyle->m_oLastCol )
{
m_oLastCol = RtfTableStylePtr( new RtfTableStyle() );
m_oLastCol->Merge( oTableStyle->m_oLastCol );
}
if( NULL != oTableStyle->m_oBandHorEven )
{
m_oBandHorEven = RtfTableStylePtr( new RtfTableStyle() );
m_oBandHorEven->Merge( oTableStyle->m_oBandHorEven );
}
if( NULL != oTableStyle->m_oBandVerEven )
{
m_oBandVerEven = RtfTableStylePtr( new RtfTableStyle() );
m_oBandVerEven->Merge( oTableStyle->m_oBandVerEven );
}
if( NULL != oTableStyle->m_oBandHorOdd )
{
m_oBandHorOdd = RtfTableStylePtr( new RtfTableStyle() );
m_oBandHorOdd->Merge( oTableStyle->m_oBandHorOdd );
}
if( NULL != oTableStyle->m_oBandVerOdd )
{
m_oBandVerOdd = RtfTableStylePtr( new RtfTableStyle() );
m_oBandVerOdd->Merge( oTableStyle->m_oBandVerOdd );
}
if( NULL != oTableStyle->m_oNWCell )
{
m_oNWCell = RtfTableStylePtr( new RtfTableStyle() );
m_oNWCell->Merge( oTableStyle->m_oNWCell );
}
if( NULL != oTableStyle->m_oNECell )
RtfStyle::Merge( oStyle );
if( TYPE_RTF_PROPERTY_STYLE_CHAR == oStyle->GetType() )
{
m_oNECell = RtfTableStylePtr( new RtfTableStyle() );
m_oNECell->Merge( oTableStyle->m_oNECell );
RtfCharStylePtr oCharStyle = boost::static_pointer_cast<RtfCharStyle, RtfStyle>( oStyle );
m_oCharProp.Merge( oCharStyle->m_oCharProp );
}
if( NULL != oTableStyle->m_oSWCell )
else if( TYPE_RTF_PROPERTY_STYLE_PARAGRAPH == oStyle->GetType() )
{
m_oSWCell = RtfTableStylePtr( new RtfTableStyle() );
m_oSWCell->Merge( oTableStyle->m_oSWCell );
RtfParagraphStylePtr oParagraphStyle = boost::static_pointer_cast<RtfParagraphStyle, RtfStyle>( oStyle );
m_oParProp.Merge( oParagraphStyle->m_oParProp );
m_oCharProp.Merge( oParagraphStyle->m_oCharProp );
}
if( NULL != oTableStyle->m_oSECell )
if( TYPE_RTF_PROPERTY_STYLE_TABLE == oStyle->GetType() )
{
m_oSECell = RtfTableStylePtr( new RtfTableStyle() );
m_oSECell->Merge( oTableStyle->m_oSECell );
RtfTableStylePtr oTableStyle = boost::static_pointer_cast<RtfTableStyle, RtfStyle>( oStyle );
m_oTableProp.Merge( oTableStyle->m_oTableProp );
m_oRowProp.Merge( oTableStyle->m_oRowProp );
m_oCellProp.Merge( oTableStyle->m_oCellProp );
m_oParProp.Merge( oTableStyle->m_oParProp );
m_oCharProp.Merge( oTableStyle->m_oCharProp );
if( NULL != oTableStyle->m_oFirstRow )
{
m_oFirstRow = RtfTableStylePtr( new RtfTableStyle() );
m_oFirstRow->Merge( oTableStyle->m_oFirstRow );
}
if( NULL != oTableStyle->m_oLastRow )
{
m_oLastRow = RtfTableStylePtr( new RtfTableStyle() );
m_oLastRow->Merge( oTableStyle->m_oLastRow );
}
if( NULL != oTableStyle->m_oFirstCol )
{
m_oFirstCol = RtfTableStylePtr( new RtfTableStyle() );
m_oFirstCol->Merge( oTableStyle->m_oFirstCol );
}
if( NULL != oTableStyle->m_oLastCol )
{
m_oLastCol = RtfTableStylePtr( new RtfTableStyle() );
m_oLastCol->Merge( oTableStyle->m_oLastCol );
}
if( NULL != oTableStyle->m_oBandHorEven )
{
m_oBandHorEven = RtfTableStylePtr( new RtfTableStyle() );
m_oBandHorEven->Merge( oTableStyle->m_oBandHorEven );
}
if( NULL != oTableStyle->m_oBandVerEven )
{
m_oBandVerEven = RtfTableStylePtr( new RtfTableStyle() );
m_oBandVerEven->Merge( oTableStyle->m_oBandVerEven );
}
if( NULL != oTableStyle->m_oBandHorOdd )
{
m_oBandHorOdd = RtfTableStylePtr( new RtfTableStyle() );
m_oBandHorOdd->Merge( oTableStyle->m_oBandHorOdd );
}
if( NULL != oTableStyle->m_oBandVerOdd )
{
m_oBandVerOdd = RtfTableStylePtr( new RtfTableStyle() );
m_oBandVerOdd->Merge( oTableStyle->m_oBandVerOdd );
}
if( NULL != oTableStyle->m_oNWCell )
{
m_oNWCell = RtfTableStylePtr( new RtfTableStyle() );
m_oNWCell->Merge( oTableStyle->m_oNWCell );
}
if( NULL != oTableStyle->m_oNECell )
{
m_oNECell = RtfTableStylePtr( new RtfTableStyle() );
m_oNECell->Merge( oTableStyle->m_oNECell );
}
if( NULL != oTableStyle->m_oSWCell )
{
m_oSWCell = RtfTableStylePtr( new RtfTableStyle() );
m_oSWCell->Merge( oTableStyle->m_oSWCell );
}
if( NULL != oTableStyle->m_oSECell )
{
m_oSECell = RtfTableStylePtr( new RtfTableStyle() );
m_oSECell->Merge( oTableStyle->m_oSECell );
}
}
}
}
......@@ -2322,6 +2322,7 @@ public:
m_oBorderBottom.Merge( oCellPr.m_oBorderBottom );
m_oBorderInsideH.Merge( oCellPr.m_oBorderInsideH );
m_oBorderInsideV.Merge( oCellPr.m_oBorderInsideV );
m_oShading.Merge( oCellPr.m_oShading );
MERGE_PROPERTY_DEF( m_eAlign, oCellPr, ca_none )
......@@ -2908,102 +2909,43 @@ public:
SetDefault();
m_eType = stCharacter;
}
int GetType()
{
return TYPE_RTF_PROPERTY_STYLE_CHAR;
}
void Merge( RtfStylePtr oStyle );
CString RenderToRtf(RenderParameter oRenderParameter);
CString RenderToOOX(RenderParameter oRenderParameter);
int GetType()
{
return TYPE_RTF_PROPERTY_STYLE_CHAR;
}
void Merge( RtfStylePtr oStyle );
CString RenderToRtf(RenderParameter oRenderParameter);
CString RenderToOOX(RenderParameter oRenderParameter);
};
class RtfParagraphStyle: public RtfCharStyle
{
public: RtfParagraphProperty m_oParProp;
public:RtfParagraphStyle()
{
SetDefault();
m_eType = stParagraph;
}
int GetType()
{
return TYPE_RTF_PROPERTY_STYLE_PARAGRAPH;
}
void Merge( RtfStylePtr oStyle );
CString RenderToRtf(RenderParameter oRenderParameter);
CString RenderToOOX(RenderParameter oRenderParameter);
public:
RtfParagraphProperty m_oParProp;
RtfParagraphStyle()
{
SetDefault();
m_eType = stParagraph;
}
int GetType()
{
return TYPE_RTF_PROPERTY_STYLE_PARAGRAPH;
}
void Merge( RtfStylePtr oStyle );
CString RenderToRtf(RenderParameter oRenderParameter);
CString RenderToOOX(RenderParameter oRenderParameter);
};
//class RtfTableStyleProperty : public IRenderableProperty
//{
//public: typedef enum{ av_none,
// av_tsvertalt, //\tsvertalt Top vertical alignment of cell
// av_tsvertalc, //\tsvertalc Center vertical alignment of cell
// av_tsvertalb //\tsvertalb Bottom vertical alignment of cell
// }AlignVertical;
// int m_nPaddingLeft; //\tscellpaddlN Left padding value.
// int m_nIsPaddingLeft; //\tscellpaddflN Units for \tscellpaddlN
// int m_nPaddingRight; //\tscellpaddrN Right padding value
// int m_nIsPaddingRight; //\tscellpaddfrN Units for \tscellpaddrN
// int m_nPaddingTop; //\tscellpaddtN Top padding value.
// int m_nIsPaddingTop; //\tscellpaddftN Units for \tscellpaddtN
// int m_nPaddingBottom; //\tscellpaddbN Bottom padding value
// int m_nIsPaddingBottom; //\tscellpaddfbN Units for \tscellpaddbN
//
// AlignVertical m_eAlign;
// int m_bNoCellWrap;//\tsnowrap No cell wrapping
//
// RtfShadingTableStyle m_oShading;
//
//
// RtfBorder m_oCellTopBorder; //\tsbrdrt Top border for cell
// RtfBorder m_oCellBottomBorder; //\tsbrdrb Bottom border for cell
// RtfBorder m_oCellLeftBorder; //\tsbrdrl Left border for cell
// RtfBorder m_oCellRightBorder; //\tsbrdrr Right border for cell
// RtfBorder m_oCellHorBorder; //\tsbrdrh Horizontal (inside) border for cell
// RtfBorder m_oCellVerBorder; //\tsbrdrv Vertical (inside) border for cell
// int m_nRowBandNumber; //\tscbandshN Count of rows in a row band
// int m_nCellBandNumber; //\tscbandsvN Count of cells in a cell band
//
// RtfTableStyleProperty()
// {
// SetDefault();
// }
// void SetDefault()
// {
// DEFAULT_PROPERTY( m_nPaddingLeft )
// DEFAULT_PROPERTY( m_nIsPaddingLeft )
// DEFAULT_PROPERTY( m_nPaddingRight )
// DEFAULT_PROPERTY( m_nIsPaddingRight )
// DEFAULT_PROPERTY( m_nPaddingTop )
// DEFAULT_PROPERTY( m_nIsPaddingTop )
// DEFAULT_PROPERTY( m_nPaddingBottom )
// DEFAULT_PROPERTY( m_nIsPaddingBottom )
// m_eAlign = av_none;
// DEFAULT_PROPERTY( m_bNoCellWrap )
// DEFAULT_PROPERTY( m_nRowBandNumber )
// DEFAULT_PROPERTY( m_nCellBandNumber )
//
// m_oShading.SetDefault();
// m_oCellTopBorder.SetDefault();
// m_oCellBottomBorder.SetDefault();
// m_oCellLeftBorder.SetDefault();
// m_oCellRightBorder.SetDefault();
// m_oCellHorBorder.SetDefault();
// m_oCellVerBorder.SetDefault();
// }
// CString RenderToRtf(RenderParameter oRenderParameter);
// CString RenderToOOX(RenderParameter oRenderParameter);
//};
class RtfTableStyle;
typedef boost::shared_ptr<RtfTableStyle> RtfTableStylePtr;
class RtfTableStyle: public RtfParagraphStyle
{
public:
RtfTableProperty m_oTableProp;
RtfRowProperty m_oRowProp;
RtfCellProperty m_oCellProp;
RtfTableProperty m_oTableProp;
RtfRowProperty m_oRowProp;
RtfCellProperty m_oCellProp;
// RtfTableStyleProperty m_oTableStyleProperty;
RtfTableStylePtr m_oFirstRow;
RtfTableStylePtr m_oLastRow;
......@@ -3043,6 +2985,7 @@ public:
return TYPE_RTF_PROPERTY_STYLE_TABLE;
}
void Merge( RtfStylePtr oStyle );
CString RenderToRtf(RenderParameter oRenderParameter);
CString RenderToOOX(RenderParameter oRenderParameter);
};
......
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