Commit 32d90264 authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormat - review.

parent b6781c03
......@@ -724,7 +724,7 @@
>
</File>
<File
RelativePath="..\source\RtfParagraph .cpp"
RelativePath="..\source\RtfParagraph.cpp"
>
</File>
<File
......
......@@ -63,10 +63,10 @@
#define COMMAND_RTF_SPECIAL_CHAR( pattern, target, command, hasParameter, parameter )\
else if( pattern == command )\
{\
RtfCharSpecialPtr oNewChar = RtfCharSpecialPtr( new RtfCharSpecial() );\
oNewChar->m_eType = parameter;\
oNewChar->m_oProperty = oReader.m_oState->m_oCharProp;\
target->AddItem( oNewChar );\
RtfCharSpecialPtr pNewChar ( new RtfCharSpecial() );\
pNewChar->m_eType = parameter;\
pNewChar->m_oProperty = oReader.m_oState->m_oCharProp;\
target->AddItem( pNewChar );\
}
//Command не имеет состояний
#include "math.h"
......@@ -830,7 +830,7 @@ public:
return true;
else if( L"pict" == sCommand && ( L"pib" == m_sPropName || L"fillBlip" == m_sPropName))
{
m_oShape.m_oPicture = RtfPicturePtr( new RtfPicture() );
m_oShape.m_oPicture = RtfPicturePtr ( new RtfPicture() );
RtfPictureReader oPictureReader( oReader, m_oShape );
StartSubReader( oPictureReader, oDocument, oReader );
}
......@@ -965,18 +965,20 @@ public:
m_bHeader = false;
else
{
RtfShapeGroupPtr oNewShape = RtfShapeGroupPtr( new RtfShapeGroup() );
RtfShapeGroupReader oShapeGroupReader( *oNewShape );
RtfShapeGroupPtr pNewShape ( new RtfShapeGroup() );
RtfShapeGroupReader oShapeGroupReader ( *pNewShape );
StartSubReader( oShapeGroupReader, oDocument, oReader );
m_oShapeGroup.AddItem( oNewShape );
m_oShapeGroup.AddItem( pNewShape );
}
}
else if( L"shp" == sCommand )
{
RtfShapePtr oNewShape = RtfShapePtr( new RtfShape() );
RtfShapeReader oShapeReader( *oNewShape );
RtfShapePtr pNewShape ( new RtfShape() );
RtfShapeReader oShapeReader( *pNewShape );
StartSubReader( oShapeReader, oDocument, oReader );
m_oShapeGroup.AddItem( oNewShape );
m_oShapeGroup.AddItem( pNewShape );
}
else
return RtfShapeReader::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter);
......@@ -1183,7 +1185,7 @@ public:
}
else
{
RtfMathPtr oNewMath( new RtfMath() );
RtfMathPtr oNewMath ( new RtfMath() );
oNewMath->SetRtfName( sCommand );
oNewMath->m_bIsVal = isValMath;
......@@ -1194,7 +1196,7 @@ public:
if (resParseSub && L"mctrlPr" == sCommand)
{
RtfCharPropertyPtr oNewCharProp( new RtfCharProperty() );
RtfCharPropertyPtr oNewCharProp ( new RtfCharProperty() );
oNewCharProp->Merge(oSubMathReader.m_oCharProp);
oNewMath->AddItem( oNewCharProp );
}
......@@ -1226,11 +1228,11 @@ public:
}
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, CString sText)
{
RtfCharPtr oNewChar( new RtfChar() );
oNewChar->m_oProperty.Merge(m_oCharProp);
RtfCharPtr pNewChar ( new RtfChar() );
pNewChar->m_oProperty.Merge(m_oCharProp);
oNewChar->setText( sText );
m_oMath.AddItem( oNewChar );
pNewChar->setText( sText );
m_oMath.AddItem( pNewChar );
}
CString ExecuteMathProp(RtfDocument& oDocument, CString sCommand, int parameter)
{//rtf math properties (int) to oox math properties (string)
......@@ -1416,16 +1418,16 @@ private:
CString sResultSymbol = reader.ExecuteTextInternal( oDocument, oReader, sCharA, false, 0, nSkipChar );
m_oField.m_pResult = RtfFieldInstPtr ( new RtfFieldInst() );
m_oField.m_pResult = RtfFieldInstPtr ( new RtfFieldInst() );
RtfParagraphPtr oNewPar = RtfParagraphPtr ( new RtfParagraph() );
RtfCharPtr oNewChar = RtfCharPtr ( new RtfChar() );
RtfParagraphPtr pNewPar ( new RtfParagraph() );
RtfCharPtr pNewChar( new RtfChar() );
oNewChar->setText( sResultSymbol );
oNewChar->m_oProperty = oReader.m_oState->m_oCharProp;
pNewChar->setText( sResultSymbol );
pNewChar->m_oProperty = oReader.m_oState->m_oCharProp;
oNewPar->AddItem( oNewChar );
m_oField.m_pResult->m_pTextItems->AddItem( oNewPar );
pNewPar->AddItem( pNewChar );
m_oField.m_pResult->m_pTextItems->AddItem( pNewPar );
m_oField.m_bTextOnly = true;
}
};
......@@ -1511,19 +1513,19 @@ public:
{
nTargetItap = PROP_DEF;
m_bPar = false;
m_oTextItems = TextItemContainerPtr( new TextItemContainer() );
nCurItap = 0; //main document
m_eInternalState = is_normal;
m_oCurParagraph = RtfParagraphPtr(new RtfParagraph());
m_oCurParagraph = RtfParagraphPtr (new RtfParagraph());
m_oTextItems = TextItemContainerPtr ( new TextItemContainer() );
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,RtfAbstractReader& oAbstrReader,CString sCommand, bool hasParameter, int parameter);
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, CString sText)
{
m_bPar = false;
RtfCharPtr oNewChar( new RtfChar() );
oNewChar->m_oProperty = oReader.m_oState->m_oCharProp;
oNewChar->setText( sText );
m_oCurParagraph->AddItem( oNewChar );
RtfCharPtr pNewChar ( new RtfChar() );
pNewChar->m_oProperty = oReader.m_oState->m_oCharProp;
pNewChar->setText( sText );
m_oCurParagraph->AddItem( pNewChar );
}
void AddItem( RtfParagraphPtr oItem, RtfReader& oReader, bool bEndCell, bool bEndRow );
......@@ -1740,7 +1742,7 @@ class RtfStyleTableReader: public RtfAbstractReader
public:
RtfStyleReader()
{
m_oCurStyle = RtfParagraphStylePtr( new RtfParagraphStyle() );
m_oCurStyle = RtfParagraphStylePtr ( new RtfParagraphStyle() );
m_eInternalState = is_normal;
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
......@@ -1749,7 +1751,7 @@ class RtfStyleTableReader: public RtfAbstractReader
{
if( true == hasParameter )
{
m_oCurStyle = RtfParagraphStylePtr( new RtfParagraphStyle() );
m_oCurStyle = RtfParagraphStylePtr ( new RtfParagraphStyle() );
m_oCurStyle->m_nID = parameter;
}
}
......@@ -1757,7 +1759,7 @@ class RtfStyleTableReader: public RtfAbstractReader
{
if( true == hasParameter )
{
m_oCurStyle = RtfCharStylePtr( new RtfCharStyle() );
m_oCurStyle = RtfCharStylePtr ( new RtfCharStyle() );
m_oCurStyle->m_nID = parameter;
}
}
......@@ -1765,7 +1767,7 @@ class RtfStyleTableReader: public RtfAbstractReader
{
if( true == hasParameter )
{
m_oCurStyle = RtfTableStylePtr( new RtfTableStyle() );
m_oCurStyle = RtfTableStylePtr ( new RtfTableStyle() );
m_oCurStyle->m_nID = parameter;
}
}
......@@ -2141,7 +2143,7 @@ public:
}
else if( L"shppict" == sCommand )
{
RtfShapePtr oNewPicture = RtfShapePtr( new RtfShape() );
RtfShapePtr oNewPicture = RtfShapePtr ( new RtfShape() );
RtfShppictReader oShppictReader( *oNewPicture );
StartSubReader( oShppictReader, oDocument, oReader );
......@@ -2362,46 +2364,46 @@ public:
if( NULL == oDocument.m_oFootnoteCon )
{
oDocument.m_oFootnoteCon = TextItemContainerPtr( new TextItemContainer() );
RtfParagraphPtr oNewPar = RtfParagraphPtr( new RtfParagraph() );
RtfCharSpecialPtr oNewChar = RtfCharSpecialPtr( new RtfCharSpecial() );
oNewChar->m_eType = RtfCharSpecial::rsc_chftnsepc;
oDocument.m_oFootnoteCon = TextItemContainerPtr ( new TextItemContainer() );
RtfParagraphPtr pNewPar ( new RtfParagraph() );
RtfCharSpecialPtr pNewChar( new RtfCharSpecial() );
pNewChar->m_eType = RtfCharSpecial::rsc_chftnsepc;
oNewPar->AddItem( oNewChar );
oDocument.m_oFootnoteCon->AddItem( oNewPar );
pNewPar->AddItem( pNewChar );
oDocument.m_oFootnoteCon->AddItem( pNewPar );
oDocument.m_oProperty.m_aSpecialFootnotes.push_back( 1 );
}
if( NULL == oDocument.m_oFootnoteSep )
{
oDocument.m_oFootnoteSep = TextItemContainerPtr( new TextItemContainer() );
RtfParagraphPtr oNewPar = RtfParagraphPtr( new RtfParagraph() );
RtfCharSpecialPtr oNewChar = RtfCharSpecialPtr( new RtfCharSpecial() );
oNewChar->m_eType = RtfCharSpecial::rsc_chftnsep;
RtfParagraphPtr pNewPar ( new RtfParagraph() );
RtfCharSpecialPtr pNewChar( new RtfCharSpecial() );
pNewChar->m_eType = RtfCharSpecial::rsc_chftnsep;
oNewPar->AddItem( oNewChar );
oDocument.m_oFootnoteSep->AddItem( oNewPar );
pNewPar->AddItem( pNewChar );
oDocument.m_oFootnoteSep->AddItem( pNewPar );
oDocument.m_oProperty.m_aSpecialFootnotes.push_back( 0 );
}
if( NULL == oDocument.m_oEndnoteCon )
{
oDocument.m_oEndnoteCon = TextItemContainerPtr( new TextItemContainer() );
RtfParagraphPtr oNewPar = RtfParagraphPtr( new RtfParagraph() );
RtfCharSpecialPtr oNewChar = RtfCharSpecialPtr( new RtfCharSpecial() );
oNewChar->m_eType = RtfCharSpecial::rsc_chftnsepc;
RtfParagraphPtr pNewPar ( new RtfParagraph() );
RtfCharSpecialPtr pNewChar( new RtfCharSpecial() );
pNewChar->m_eType = RtfCharSpecial::rsc_chftnsepc;
oNewPar->AddItem( oNewChar );
oDocument.m_oEndnoteCon->AddItem( oNewPar );
pNewPar->AddItem( pNewChar );
oDocument.m_oEndnoteCon->AddItem( pNewPar );
oDocument.m_oProperty.m_aSpecialEndnotes.push_back( 1 );
}
if( NULL == oDocument.m_oEndnoteSep )
{
oDocument.m_oEndnoteSep = TextItemContainerPtr( new TextItemContainer() );
RtfParagraphPtr oNewPar = RtfParagraphPtr( new RtfParagraph() );
RtfCharSpecialPtr oNewChar = RtfCharSpecialPtr( new RtfCharSpecial() );
oNewChar->m_eType = RtfCharSpecial::rsc_chftnsep;
RtfParagraphPtr pNewPar ( new RtfParagraph() );
RtfCharSpecialPtr pNewChar( new RtfCharSpecial() );
pNewChar->m_eType = RtfCharSpecial::rsc_chftnsep;
oNewPar->AddItem( oNewChar );
oDocument.m_oEndnoteSep->AddItem( oNewPar );
pNewPar->AddItem( pNewChar );
oDocument.m_oEndnoteSep->AddItem( pNewPar );
oDocument.m_oProperty.m_aSpecialEndnotes.push_back( 0 );
}
}
......
......@@ -85,15 +85,15 @@ bool OOXPictureGraphicReader::Parse( ReaderParameter oParam , RtfShape& oOutput)
oOutput.m_nShapeType = 1;
oOutput.m_bFilled = 0;
oOutput.m_bLine = 1;
oOutput.m_aTextItems = TextItemContainerPtr( new TextItemContainer() );
oOutput.m_aTextItems = TextItemContainerPtr( new TextItemContainer() );
RtfParagraphPtr oParagraph( new RtfParagraph() );
RtfParagraphPtr oParagraph ( new RtfParagraph() );
oParagraph->m_oProperty = oParam.oRtf->m_oDefaultParagraphProp;
oParagraph->m_oProperty.m_oCharProperty = oParam.oRtf->m_oDefaultCharProp;
oParagraph->m_oProperty.m_nItap = 0;
RtfCharPtr oChar( new RtfChar() );
RtfCharPtr oChar ( new RtfChar() );
oChar->m_oProperty = oParam.oRtf->m_oDefaultCharProp;
oChar->setText( L"The element is not supported in RTF format." );
......
......@@ -139,7 +139,7 @@ public:
{
if( nSeparatorId == nId )
{
TextItemContainerPtr oNewTextItem( new TextItemContainer() );
TextItemContainerPtr oNewTextItem ( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
......@@ -152,7 +152,7 @@ public:
}
else if( nContinueId == nId )
{
TextItemContainerPtr oNewTextItem( new TextItemContainer() );
TextItemContainerPtr oNewTextItem ( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
......@@ -165,7 +165,7 @@ public:
}
else
{
TextItemContainerPtr oNewTextItem( new TextItemContainer() );
TextItemContainerPtr oNewTextItem ( new TextItemContainer() );
oTextItemReader.m_oTextItems = oNewTextItem;
if( true == oTextItemReader.Parse( ooxFtnEdn->m_arrItems[i], oParam ) )
......
......@@ -44,7 +44,7 @@ bool OOXHeaderReader::Parse( ReaderParameter oParam, CString sRID, TextItemConta
oParam.oReader->m_currentContainer = dynamic_cast<OOX::IFileContainer*>(pHdrFtr);
OOXTextItemReader oOOXTextItemReader;
oOutput = TextItemContainerPtr( new TextItemContainer() );
oOutput = TextItemContainerPtr ( new TextItemContainer() );
oOOXTextItemReader.m_oTextItems = oOutput;
for (long i=0; i < pHdrFtr->m_arrItems.size(); i++)
......
......@@ -41,7 +41,7 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement *
{
if (!ooxMath) return false;
rtfMath = RtfMathPtr( new RtfMath() );
if (!rtfMath) rtfMath = RtfMathPtr( new RtfMath() );
if (!rtfMath) return false;
OOX::EElementType ooxTypeElement = ooxMath->getType();
......@@ -814,20 +814,18 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement *
OOX::Logic::CCtrlPr *ooxSubMath = dynamic_cast<OOX::Logic::CCtrlPr *>(ooxMath);
if (ooxSubMath)
{
RtfCharProperty oCurrentProp;
oCurrentProp = m_oCharProperty;
RtfCharPtr oChar = RtfCharPtr(new RtfChar);
oChar->m_oProperty = oCurrentProp;
OOX::Logic::CRunProperty *ooxRPr = dynamic_cast<OOX::Logic::CRunProperty *>(ooxSubMath->m_oRPr.GetPointer());
if (ooxRPr)
{
RtfCharProperty oCurrentProp;
oCurrentProp.SetDefaultOOX();
OOXrPrReader orPrReader(ooxRPr);
orPrReader.Parse( oParam, oCurrentProp );
RtfCharPtr oChar = RtfCharPtr(new RtfChar);
oChar->m_oProperty = oCurrentProp;
rtfMath->AddItem( oChar );
}
rtfMath->AddItem( oChar );
}
}break;
case OOX::et_m_jc:
......@@ -908,28 +906,30 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement *
//----------------------------------
nullable<CString> sVal;
if ((ooxElemBool) && (ooxElemBool->m_val.IsInit())) sVal = ooxElemBool->m_val->ToString2(SimpleTypes::onofftostringOn);
else if ((ooxElemChar) && (ooxElemChar->m_val.IsInit())) sVal = ooxElemChar->m_val->GetValue();
else if ((ooxElemMeasure) && (ooxElemMeasure->m_val.IsInit())) sVal = ooxElemMeasure->m_val->ToString();
else if ((ooxElemInt255) && (ooxElemInt255->m_val.IsInit())) sVal = ooxElemInt255->m_val->ToString();
else if ((ooxElemLim) && (ooxElemLim->m_val.IsInit())) sVal = ooxElemLim->m_val->ToString();
else if ((ooxElemUnSignInt) && (ooxElemUnSignInt->m_val.IsInit())) sVal = ooxElemUnSignInt->m_val->ToString();
else if ((ooxElemTopBot) && (ooxElemTopBot->m_val.IsInit())) sVal = ooxElemTopBot->m_val->ToString();
else if ((ooxElemFType) && (ooxElemFType->m_val.IsInit())) sVal = ooxElemFType->m_val->ToString();
else if ((ooxElemStyle) && (ooxElemStyle->m_val.IsInit())) sVal = ooxElemStyle->m_val->ToString();
else if ((ooxElemShp) && (ooxElemShp->m_val.IsInit())) sVal = ooxElemShp->m_val->ToString();
else if ((ooxElemScript) && (ooxElemScript->m_val.IsInit())) sVal = ooxElemScript->m_val->ToString();
if ((ooxElemBool) && (ooxElemBool->m_val.IsInit())) sVal = ooxElemBool->m_val->ToString2(SimpleTypes::onofftostringOn);
else if ((ooxElemChar) && (ooxElemChar->m_val.IsInit())) sVal = ooxElemChar->m_val->GetValue();
else if ((ooxElemMeasure) && (ooxElemMeasure->m_val.IsInit())) sVal = ooxElemMeasure->m_val->ToString();
else if ((ooxElemInt255) && (ooxElemInt255->m_val.IsInit())) sVal = ooxElemInt255->m_val->ToString();
else if ((ooxElemLim) && (ooxElemLim->m_val.IsInit())) sVal = ooxElemLim->m_val->ToString();
else if ((ooxElemUnSignInt) && (ooxElemUnSignInt->m_val.IsInit())) sVal = ooxElemUnSignInt->m_val->ToString();
else if ((ooxElemTopBot) && (ooxElemTopBot->m_val.IsInit())) sVal = ooxElemTopBot->m_val->ToString();
else if ((ooxElemFType) && (ooxElemFType->m_val.IsInit())) sVal = ooxElemFType->m_val->ToString();
else if ((ooxElemStyle) && (ooxElemStyle->m_val.IsInit())) sVal = ooxElemStyle->m_val->ToString();
else if ((ooxElemShp) && (ooxElemShp->m_val.IsInit())) sVal = ooxElemShp->m_val->ToString();
else if ((ooxElemScript) && (ooxElemScript->m_val.IsInit())) sVal = ooxElemScript->m_val->ToString();
else if ((ooxElemSpacingRule) && (ooxElemSpacingRule->m_val.IsInit())) sVal = ooxElemSpacingRule->m_val->ToString();
else if ((ooxElemXAlign) && (ooxElemXAlign->m_val.IsInit())) sVal = ooxElemXAlign->m_val->ToString();
else if ((ooxElemInteger2) && (ooxElemInteger2->m_val.IsInit())) sVal = ooxElemInteger2->m_val->ToString();
else if ((ooxElemYAlign) && (ooxElemYAlign->m_val.IsInit())) sVal = ooxElemYAlign->m_val->ToString();
else if ((ooxElemBreakBin) && (ooxElemBreakBin->m_val.IsInit())) sVal = ooxElemBreakBin->m_val->ToString();
else if ((ooxElemXAlign) && (ooxElemXAlign->m_val.IsInit())) sVal = ooxElemXAlign->m_val->ToString();
else if ((ooxElemInteger2) && (ooxElemInteger2->m_val.IsInit())) sVal = ooxElemInteger2->m_val->ToString();
else if ((ooxElemYAlign) && (ooxElemYAlign->m_val.IsInit())) sVal = ooxElemYAlign->m_val->ToString();
else if ((ooxElemBreakBin) && (ooxElemBreakBin->m_val.IsInit())) sVal = ooxElemBreakBin->m_val->ToString();
else if ((ooxElemBreakBinSub) && (ooxElemBreakBinSub->m_val.IsInit())) sVal = ooxElemBreakBinSub->m_val->ToString();
//----------------------------------------------
if (ooxElemArray)
{
OOXMathReader oMathReader(ooxElemArray);
oMathReader.m_oCharProperty = m_oCharProperty;
bool res = oMathReader.Parse( oParam, (*rtfMath) );
}
else if (sVal.IsInit())
......
......@@ -59,10 +59,10 @@ public:
for(int i = 0; i < m_ooxElem->m_arrItems.size(); i++)
{
RtfMathPtr oNewMath;
if (ParseElement(oParam, m_ooxElem->m_arrItems[i], oNewMath))
RtfMathPtr pNewMath;
if (ParseElement(oParam, m_ooxElem->m_arrItems[i], pNewMath))
{
oOutput.AddItem( oNewMath );
oOutput.AddItem( pNewMath );
}
}
return true;
......
......@@ -57,7 +57,7 @@ public:
{
OOXShapeReader oShapeReader(m_ooxNumbering->m_arrNumPicBullet[i]->m_oVmlDrawing.GetPointer());
RtfShapePtr oNewShape( new RtfShape() );
RtfShapePtr oNewShape ( new RtfShape() );
if( true == oShapeReader.Parse( oParam, oNewShape ) )
{
oNewShape->m_eAnchorTypeShape = RtfShape::st_inline;
......
......@@ -45,7 +45,8 @@ public:
{
if (m_ooxInline == NULL) return false;
oOutput.m_oPicture = RtfPicturePtr( new RtfPicture() );
oOutput.m_oPicture = RtfPicturePtr( new RtfPicture() );
oOutput.m_eAnchorTypeShape = RtfShape::st_inline;
oOutput.m_nShapeType = 75;//NSOfficeDrawing::sptPictureFrame;
oOutput.m_nLeft = 0;
......
......@@ -769,13 +769,13 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapeGroupPtr& oOut
if (m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_group)
{
RtfShapeGroupPtr oNewShape( new RtfShapeGroup() );
RtfShapeGroupPtr pNewShape( new RtfShapeGroup() );
OOXShapeGroupReader oShapeReader(dynamic_cast<OOX::Vml::CGroup*>(m_vmlGroup->m_arrItems[i]));
oNewShape->m_bInGroup = true;
if( true == oShapeReader.Parse( oParam, oNewShape ) )
oOutput->AddItem( oNewShape );
pNewShape->m_bInGroup = true;
if( true == oShapeReader.Parse( oParam, pNewShape ) )
oOutput->AddItem( pNewShape );
}
else if ( m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_arc ||
m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_line ||
......@@ -786,13 +786,13 @@ bool OOXShapeGroupReader::Parse( ReaderParameter oParam , RtfShapeGroupPtr& oOut
m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_polyline ||
m_vmlGroup->m_arrItems[i]->getType() == OOX::et_v_shapetype)
{
RtfShapePtr oNewShape( new RtfShape() );//set type .. .todooo
RtfShapePtr pNewShape ( new RtfShape() );//set type .. .todooo
OOXShapeReader oShapeReader(dynamic_cast<OOX::Vml::CVmlCommonElements*>(m_vmlGroup->m_arrItems[i]));
oNewShape->m_bInGroup = true;
if( true == oShapeReader.Parse( oParam, oNewShape ) )
oOutput->AddItem( oNewShape );
pNewShape->m_bInGroup = true;
if( true == oShapeReader.Parse( oParam, pNewShape ) )
oOutput->AddItem( pNewShape );
}
else
{
......
......@@ -265,7 +265,7 @@ public:
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 проверить
......
......@@ -155,7 +155,7 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
}
else if( true == bExistTablPr )
{
RtfTableStylePtr poTableStyle = RtfTableStylePtr( new RtfTableStyle() );
RtfTableStylePtr poTableStyle ( new RtfTableStyle() );
poTableStyle->m_oTableProp.Merge( oOutputTable.m_oProperty ); // будут использованы ниже
}
......@@ -178,7 +178,7 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
ReaderParameter newParam = oParam;
newParam.poTableStyle = poTableStyle;
RtfTableRowPtr oNewRow( new RtfTableRow() );
RtfTableRowPtr oNewRow ( new RtfTableRow() );
//применяем свойства таблицы к каждому row
//т.к. в RTF нет свойств таблиц и все свойства записываются в свойства row
(*((RtfTableProperty*)&oNewRow->m_oProperty)).Merge( oOutputTable.m_oProperty );
......
......@@ -47,7 +47,7 @@ public:
OOXTextItemReader( )
{
m_oTextItems = TextItemContainerPtr( new TextItemContainer() );
m_oTextItems = TextItemContainerPtr ( new TextItemContainer() );
}
bool Parse( OOX::WritingElement* ooxElement, ReaderParameter oParam )
{
......@@ -58,7 +58,7 @@ public:
OOX::Logic::CParagraph * pParagraph = dynamic_cast<OOX::Logic::CParagraph*>(ooxElement);
OOXParagraphReader m_oParagraphReader(pParagraph);
RtfParagraphPtr oNewParagraph( new RtfParagraph() );
RtfParagraphPtr oNewParagraph ( new RtfParagraph() );
//применяем к новому параграфу default property
oNewParagraph->m_oProperty = oParam.oRtf->m_oDefaultParagraphProp;
oNewParagraph->m_oProperty.m_oCharProperty = oParam.oRtf->m_oDefaultCharProp;
......@@ -81,9 +81,9 @@ public:
case OOX::et_w_tbl:
{
OOX::Logic::CTbl * pTbl = dynamic_cast<OOX::Logic::CTbl*>(ooxElement);
RtfTablePtr oNewTable( new RtfTable() );
RtfTablePtr oNewTable ( new RtfTable() );
OOXTableReader oTableReader(pTbl);
OOXTableReader oTableReader(pTbl);
oParam.oReader->m_nCurItap = 1;
if( true == oTableReader.Parse( oParam, (*oNewTable)) )
{
......
......@@ -153,7 +153,9 @@ public:
{
if( NULL == oInputStyle )
return oInputStyle;
RtfTableStylePtr oOutputStyle = RtfTableStylePtr( new RtfTableStyle() );
RtfTableStylePtr oOutputStyle ( new RtfTableStyle() );
oOutputStyle->Merge( oInputStyle );
if( true == bOddVBand && NULL != oInputStyle->m_oBandVerOdd )
oOutputStyle->Merge( oInputStyle->m_oBandVerOdd );
......
......@@ -146,14 +146,16 @@ CString RtfChar::renderTextToXML( CString sParam, bool bDelete )
CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharProperty* oCharProperty )
{
RtfDocument* oDocument = static_cast<RtfDocument*>(poDocument);
CString sResult;
RtfDocument* pDocument = static_cast<RtfDocument*>(poDocument);
int iFont = 0;
if (oCharProperty) iFont = oCharProperty->m_nFont;
int nCodePage = -1;
//применяем параметры codepage от текущего шрифта todo associated fonts.
//todooo разобраться со шрифтами и их подбором
RtfFont oFont;
if( NULL != oCharProperty && true == oDocument->m_oFontTable.GetFont( oCharProperty->m_nFont, oFont ) )
if( NULL != oCharProperty && true == pDocument->m_oFontTable.GetFont( oCharProperty->m_nFont, oFont ) )
{
if( PROP_DEF != oFont.m_nCharset )
nCodePage = RtfUtility::CharsetToCodepage( oFont.m_nCharset );
......@@ -161,15 +163,24 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert
nCodePage = oFont.m_nCodePage;
}
return renderRtfText(sText, pDocument, nCodePage);
}
CString RtfChar::renderRtfText( CString& sText, void* poDocument, int nCodePage )
{
RtfDocument* pDocument = static_cast<RtfDocument*>(poDocument);
CString sResult;
//от настроек документа
if( -1 == nCodePage && RtfDocumentProperty::cp_none != oDocument->m_oProperty.m_eCodePage )
if( -1 == nCodePage && RtfDocumentProperty::cp_none != pDocument->m_oProperty.m_eCodePage )
{
switch ( oDocument->m_oProperty.m_eCodePage )
switch ( pDocument->m_oProperty.m_eCodePage )
{
case RtfDocumentProperty::cp_ansi:
{
if( PROP_DEF != oDocument->m_oProperty.m_nAnsiCodePage )
nCodePage = oDocument->m_oProperty.m_nAnsiCodePage;
if( PROP_DEF != pDocument->m_oProperty.m_nAnsiCodePage )
nCodePage = pDocument->m_oProperty.m_nAnsiCodePage;
else
nCodePage = CP_ACP;
break;
......
......@@ -209,7 +209,9 @@ public:
return m_sChars;
}
CString RenderToOOX(RenderParameter oRenderParameter);
static CString renderRtfText( CString& sText, void* poDocument, RtfCharProperty* oCharProperty = NULL );
static CString renderRtfText( CString& sText, void* poDocument, RtfCharProperty* oCharProperty = NULL );
static CString renderRtfText( CString& sText, void* poDocument, int nCodePage );
CString RenderToRtf(RenderParameter oRenderParameter);
private:
......
......@@ -94,6 +94,7 @@ public:
}
void SetOOXType (int type);
CString RenderToRtf (RenderParameter oRenderParameter);
CString RenderToOOX (RenderParameter oRenderParameter);
};
......
......@@ -725,6 +725,7 @@ CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_INT( m_nCrDate, sResult, L"crdate" )
sResult += "{\\*\\oldcprops";
sResult += L"\\plain";
sResult += m_pOldCharProp->RenderToRtf(oRenderParameter);
sResult += L"}";
}
......
......@@ -858,10 +858,11 @@ CString RtfSectionProperty::SaveFile( TextItemContainerPtr oTarget, RenderParame
sContent += sRootName;
sContent += L" xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\">";
RenderParameter oNewParameter = oRenderParameter;
OOXRelsWriterPtr oNewRelsWr = OOXRelsWriterPtr( new OOXRelsWriter( sFilename, *poRtfDocument ) );
RenderParameter oNewParameter = oRenderParameter;
OOXRelsWriterPtr oNewRelsWr ( new OOXRelsWriter( sFilename, *poRtfDocument ) );
poOOXWriter->m_oCustomRelsWriter.push_back( oNewRelsWr );
oNewParameter.poRels = oNewRelsWr.get();
oNewParameter.poRels = oNewRelsWr.get();
sContent += oTarget->RenderToOOX(oNewParameter);
sContent += L"</" + sRootName + L">";
......
......@@ -302,7 +302,7 @@ namespace OOX
if ( m_oSup.IsInit() )
sResult += m_oSup->toXML();
sResult += _T("</m:oMathPara>");
sResult += _T("</m:nary>");
return sResult;
}
......
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