Commit a4edf447 authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

RtfFormatWriter - конвертация формул

parent 5342f784
......@@ -353,7 +353,7 @@
Name="Math"
>
<File
RelativePath="..\source\Reader\OOXMathPropReader.h"
RelativePath="..\source\Reader\OOXMathReader.cpp"
>
</File>
<File
......@@ -695,6 +695,10 @@
RelativePath="..\source\RtfGlobalTables.h"
>
</File>
<File
RelativePath="..\source\RtfMath.cpp"
>
</File>
<File
RelativePath="..\source\RtfMath.h"
>
......
......@@ -1677,104 +1677,6 @@ public:
}
};
class RtfMathPropReader : public RtfAbstractReader
{
public:
RtfMathPropReader( )
{
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
{
if( _T("mmathPr") == sCommand )
return true;
else if( _T("mbrkBin") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mbrkBin = parameter;
}
else if( _T("mbrkBinSub") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mbrkBinSub = parameter;
}
else if( _T("mdefJc") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mdefJc = parameter;
}
else if( _T("mdispDef") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mdispDef = parameter;
}
else if( _T("minterSp") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.minterSp = parameter;
}
else if( _T("mintraSp") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mintraSp = parameter;
}
else if( _T("mlMargin") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mlMargin = parameter;
}
else if( _T("mmathFont") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mmathFont = parameter;
}
else if( _T("mnaryLim") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mnaryLim = parameter;
}
else if( _T("mpostSp") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mpostSp = parameter;
}
else if( _T("mpreSp") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mpreSp = parameter;
}
else if( _T("mrMargin") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mrMargin = parameter;
}
else if( _T("msmallFrac") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.msmallFrac = parameter;
}
else if( _T("mwrapIndent") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mwrapIndent = parameter;
}
else if( _T("mwrapRight") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mwrapRight = parameter;
}
else if( _T("mintLim") == sCommand )
{
if( true == hasParameter )
oDocument.m_oMathProp.mintLim = parameter;
}
else
{
return false;
}
return true;
}
};
class RtfMathReader: public RtfAbstractReader
{
private:
......@@ -1790,33 +1692,7 @@ public:
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
{
if( _T("mmath") == sCommand )
{//ставим выравнивание параграфа по default свойствам Math
if( PROP_DEF != oDocument.m_oMathProp.mdefJc )
{
switch( oDocument.m_oMathProp.mdefJc )
{
case 1: m_eParAlign = RtfParagraphProperty::pa_qc;break;
case 2: m_eParAlign = RtfParagraphProperty::pa_qc;break;
case 3: m_eParAlign = RtfParagraphProperty::pa_ql;break;
case 4: m_eParAlign = RtfParagraphProperty::pa_qr;break;
}
}
}
else if( _T("mjc") == sCommand )
{
if( true == hasParameter )
{
switch( parameter )
{
case 1: m_eParAlign = RtfParagraphProperty::pa_qc;break;
case 2: m_eParAlign = RtfParagraphProperty::pa_qc;break;
case 3: m_eParAlign = RtfParagraphProperty::pa_ql;break;
case 4: m_eParAlign = RtfParagraphProperty::pa_qr;break;
}
}
}
else if( _T("mmathPict") == sCommand )
if( _T("mmathPict") == sCommand )
;
else if( _T("shppict") == sCommand )
{
......@@ -1828,9 +1704,9 @@ public:
Skip( oDocument, oReader );
else
{
bool isBoolMath = RtfMath::IsRtfControlPropertyBool(sCommand);
bool isValMath = isBoolMath ? false : RtfMath::IsRtfControlProperty(sCommand);
bool isMath = (isValMath || isBoolMath) ? false : RtfMath::IsRtfControlWord(sCommand);
bool isBoolMath = m_oMath.IsRtfControlPropertyBool(sCommand);
bool isValMath = isBoolMath ? false : m_oMath.IsRtfControlProperty(sCommand);
bool isMath = (isValMath || isBoolMath) ? false : m_oMath.IsRtfControlWord(sCommand);
if( isMath || isValMath || isBoolMath)
{
......@@ -3401,11 +3277,11 @@ public:
// RtfDefParPropReader oDefParPropReader;
// return StartSubReader( oDefParPropReader, oDocument, oReader );
//}
else if( _T("mmathPr") == sCommand )
{
RtfMathPropReader oMathPropReader;
return StartSubReader( oMathPropReader, oDocument, oReader );
}
//else if( _T("mmathPr") == sCommand )
//{
// RtfMathPropReader oMathPropReader;
// return StartSubReader( oMathPropReader, oDocument, oReader );
//}
else if( _T("ftnsep") == sCommand || _T("ftnsepc") == sCommand ||
_T("aftnsep")== sCommand || _T("aftnsepc") == sCommand )
{
......
#pragma once
#include "../RtfDocument.h"
#include "../../../../Common/DocxFormat/Source/DocxFormat/Math/oMathContent.h"
class OOXMathPropReader
{
private:
OOX::Logic::CMathPr *m_ooxMathPr;
public:
OOXMathPropReader(OOX::Logic::CMathPr *ooxMathPr)
{
m_ooxMathPr = ooxMathPr;
}
bool Parse( ReaderParameter oParam )
{
if (m_ooxMathPr == NULL) return false;
for (long i = 0; i < m_ooxMathPr->m_arrItems.size(); i++)
{
if (m_ooxMathPr->m_arrItems[i] == NULL) continue;
switch(m_ooxMathPr->m_arrItems[i]->getType())
{
case OOX::et_m_mathFont:
{
OOX::Logic::CMathFont* pFont = dynamic_cast<OOX::Logic::CMathFont*>(m_ooxMathPr->m_arrItems[i]);
RtfFont oFont;
if (( pFont && pFont->m_val.IsInit()) && (true == oParam.oRtf->m_oFontTable.GetFont(pFont->m_val.get2(), oFont)))
oParam.oRtf->m_oMathProp.mmathFont = oFont.m_nID;
}break;
case OOX::et_m_brkBin:
{
OOX::Logic::CBrkBin* pBrkBin = dynamic_cast<OOX::Logic::CBrkBin*>(m_ooxMathPr->m_arrItems[i]);
if ((pBrkBin) && (pBrkBin->m_val.IsInit()))
{
switch(pBrkBin->m_val->GetValue())
{
case SimpleTypes::breakBinAfter : oParam.oRtf->m_oMathProp.mbrkBin = 1; break;
case SimpleTypes::breakBinBefore : oParam.oRtf->m_oMathProp.mbrkBin = 0; break;
case SimpleTypes::breakBinRepeat :
default : oParam.oRtf->m_oMathProp.mbrkBin = 2; break;
}
}
}break;
case OOX::et_m_brkBinSub:
{
OOX::Logic::CBrkBinSub* pBrkBinSub = dynamic_cast<OOX::Logic::CBrkBinSub*>(m_ooxMathPr->m_arrItems[i]);
if ((pBrkBinSub) && (pBrkBinSub->m_val.IsInit()))
{
switch(pBrkBinSub->m_val->GetValue())
{
case SimpleTypes::breakBinPlusMinus : oParam.oRtf->m_oMathProp.mbrkBinSub = 1; break;
case SimpleTypes::breakBinMinusPlus : oParam.oRtf->m_oMathProp.mbrkBinSub = 2; break;
case SimpleTypes::breakBinMinusMinus : oParam.oRtf->m_oMathProp.mbrkBinSub = 0; break;
}
}
}break;
case OOX::et_m_defJc:
{
OOX::Logic::CDefJc* pDefJc = dynamic_cast<OOX::Logic::CDefJc*>(m_ooxMathPr->m_arrItems[i]);
if ((pDefJc) && (pDefJc->m_val.IsInit()))
{
switch(pDefJc->m_val->GetValue())
{
case SimpleTypes::mjcCenter : oParam.oRtf->m_oMathProp.mbrkBinSub = 2; break;
case SimpleTypes::mjcLeft : oParam.oRtf->m_oMathProp.mbrkBinSub = 3; break;
case SimpleTypes::mjcRight : oParam.oRtf->m_oMathProp.mbrkBinSub = 4; break;
case SimpleTypes::mjcCenterGroup:
default : oParam.oRtf->m_oMathProp.mbrkBinSub = 1; break;
}
}
}break;
case OOX::et_m_dispDef:
{
OOX::Logic::CDispDef* pDispDef = dynamic_cast<OOX::Logic::CDispDef*>(m_ooxMathPr->m_arrItems[i]);
if ((pDispDef) && (pDispDef->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mdispDef = pDispDef->m_val->ToBool();
}break;
case OOX::et_m_interSp:
{
OOX::Logic::CInterSp* pInterSp = dynamic_cast<OOX::Logic::CInterSp*>(m_ooxMathPr->m_arrItems[i]);
if ((pInterSp) && (pInterSp->m_val.IsInit()))
oParam.oRtf->m_oMathProp.minterSp = pInterSp->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_intraSp:
{
OOX::Logic::CIntraSp* pIntraSp = dynamic_cast<OOX::Logic::CIntraSp*>(m_ooxMathPr->m_arrItems[i]);
if ((pIntraSp) && (pIntraSp->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mintraSp = pIntraSp->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_lMargin:
{
OOX::Logic::CLMargin* pMargin = dynamic_cast<OOX::Logic::CLMargin*>(m_ooxMathPr->m_arrItems[i]);
if ((pMargin) && (pMargin->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mlMargin = pMargin->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_rMargin:
{
OOX::Logic::CRMargin* pMargin = dynamic_cast<OOX::Logic::CRMargin*>(m_ooxMathPr->m_arrItems[i]);
if ((pMargin) && (pMargin->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mrMargin = pMargin->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_naryLim:
{
OOX::Logic::CNaryLim* pNaryLim = dynamic_cast<OOX::Logic::CNaryLim*>(m_ooxMathPr->m_arrItems[i]);
if ( (pNaryLim) && (pNaryLim->m_val.IsInit()) )
{
if( pNaryLim->m_val->GetValue() == SimpleTypes::limLocSubSup) oParam.oRtf->m_oMathProp.mnaryLim = 0;
else if( pNaryLim->m_val->GetValue() == SimpleTypes::limLocUndOvr) oParam.oRtf->m_oMathProp.mnaryLim = 1;
}
}break;
case OOX::et_m_postSp:
{
OOX::Logic::CPostSp* pPostSp = dynamic_cast<OOX::Logic::CPostSp*>(m_ooxMathPr->m_arrItems[i]);
if ((pPostSp) && (pPostSp->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mpostSp = pPostSp->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_preSp:
{
OOX::Logic::CPreSp* pPreSp = dynamic_cast<OOX::Logic::CPreSp*>(m_ooxMathPr->m_arrItems[i]);
if ((pPreSp) && (pPreSp->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mpreSp = pPreSp->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_smallFrac:
{
OOX::Logic::CSmallFrac* pSmallFrac = dynamic_cast<OOX::Logic::CSmallFrac*>(m_ooxMathPr->m_arrItems[i]);
if ((pSmallFrac) && (pSmallFrac->m_val.IsInit()))
oParam.oRtf->m_oMathProp.msmallFrac = pSmallFrac->m_val->ToBool();
}break;
case OOX::et_m_wrapIndent:
{
OOX::Logic::CWrapIndent* pWrapIndent = dynamic_cast<OOX::Logic::CWrapIndent*>(m_ooxMathPr->m_arrItems[i]);
if ((pWrapIndent) && (pWrapIndent->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mwrapIndent = pWrapIndent->m_val->ToTwips(); //todooo
}break;
case OOX::et_m_wrapRight:
{
OOX::Logic::CWrapRight* pWrapRight = dynamic_cast<OOX::Logic::CWrapRight*>(m_ooxMathPr->m_arrItems[i]);
if ((pWrapRight) && (pWrapRight->m_val.IsInit()))
oParam.oRtf->m_oMathProp.mwrapRight = pWrapRight->m_val->ToBool(); //todooo
}break;
}
}
return true;
}
};
This diff is collapsed.
......@@ -289,7 +289,7 @@ bool OOXParagraphReader::Parse2( ReaderParameter oParam , RtfParagraph& oOutputP
OOX::Logic::COMathPara * pMathPara = dynamic_cast<OOX::Logic::COMathPara*>(m_ooxElement->m_arrItems[i]);
RtfMathPtr oNewMath( new RtfMath() );
oNewMath->SetOOXName(_T("m:oMathPara") );
oNewMath->SetOOXType( OOX::et_m_oMathPara );
OOXMathReader oMathRreader(pMathPara);
if(true == oMathRreader.Parse( oParam, (*oNewMath) ) )
......
#pragma once
#include "OOXFontReader.h"
#include "OOXMathPropReader.h"
#include "OOXMathReader.h"
#include "../Utils.h"
class OOXSettingsReader
......@@ -16,14 +16,13 @@ public:
bool Parse( ReaderParameter oParam )
{
//oParam.oRtf->m_oColorSchemeMapping.SetDefaultOOX();
oParam.oRtf->m_oMathProp.SetDefaultOOX();
if (m_ooxSettings == NULL) return false;
if (m_ooxSettings->m_oMathPr.IsInit())
{
OOXMathPropReader oMathProp(m_ooxSettings->m_oMathPr.GetPointer());
oMathProp.Parse( oParam );
OOXMathReader oMathProp(m_ooxSettings->m_oMathPr.GetPointer());
oMathProp.Parse( oParam, oParam.oRtf->m_oMathProp );
}
if (m_ooxSettings->m_oDoNotHyphenateCaps.IsInit())
......
......@@ -3,6 +3,7 @@
#include "RtfGlobalTables.h"
#include "RtfSection.h"
#include "RtfMath.h"
class RtfDocument :public ItemContainer<RtfSectionPtr>
{
......@@ -18,7 +19,7 @@ public:
RtfParagraphProperty m_oDefaultParagraphProp;
RtfCharProperty m_oDefaultCharProp;
RtfMathProperty m_oMathProp;
RtfMath m_oMathProp;
TextItemContainerPtr m_oFootnoteSep;
TextItemContainerPtr m_oFootnoteCon;
......
#pragma once
#include "Basic.h"
#include "RtfProperty.h"
#include "RtfProperty.h"
#include "RtfParagraph.h"
#include "RtfShape.h"
class RtfMath : public IDocumentElement, public ItemContainer<IDocumentElementPtr>
{
......@@ -14,7 +16,7 @@ public:
bool m_bIsVal;
bool m_bIsBool;
RtfMathSpecProp m_oProperty;
//RtfMathSpecProp m_oProperty;
RtfParagraph m_oVal;
RtfShapePtr m_oPicture;
......@@ -49,173 +51,20 @@ public:
{
return (false == m_sRtfName.IsEmpty());
}
static bool IsRtfControlPropertyBool( CString sControlW )
{
const TCHAR* mc_aRtfControlWords[] = { L"maln", L"malnScr", L"mdegHide", L"mdiff", L"mdispDef",
L"mgrow", L"mhideBot", L"mhideLeft", L"mhideRight", L"mhideTop", L"mlit", L"mmaxDist", L"mnoBreak", L"mnor",
L"mobjDist", L"mopEmu", L"mplcHide", L"mshow", L"msmallFracN", L"mstrikeBLTR", L"mstrikeH", L"mstrikeTLBR",
L"mstrikeV", L"msubHide", L"msupHide", L"mtransp", L"mwrapRight", L"mzeroAsc", L"mzeroDesc", L"mzeroWid"};
bool IsRtfControlPropertyBool ( CString sControlW );
bool IsRtfControlProperty ( CString sControlW );
bool IsRtfControlWord ( CString sControlW );
int mc_nRtfControlWordsSize = sizeof( mc_aRtfControlWords ) / sizeof( TCHAR* );
//можно бинарный поиск вставить
for( int i = 0; i < mc_nRtfControlWordsSize; i++ )
if( mc_aRtfControlWords[ i ] == sControlW )
return true;
return false;
}
static bool IsRtfControlProperty( CString sControlW )
{
const TCHAR* mc_aRtfControlWords[] = {L"margSz", L"mbaseJc", L"mbegChr", L"mbrkBin", L"mbrkBinSub", L"mcGp",
L"mcGpRule", L"mchr", L"mcount", L"mcSp", L"mdefJc", L"mendChr", L"minterSp", L"mintLim", L"mintraSp", L"mmJc",
L"mlimLoc", L"mlMargin", L"mmcJc", L"mnaryLim", L"mpos", L"mpostSp", L"mpreSp", L"mrMargin", L"mrSp", L"mrSpRule",
L"msepChr", L"mshp", L"mtype", L"mvertJc", L"mwrapIndent", L"mmathFont"};
int mc_nRtfControlWordsSize = sizeof( mc_aRtfControlWords ) / sizeof( TCHAR* );
//можно бинарный поиск вставить
for( int i = 0; i < mc_nRtfControlWordsSize; i++ )
if( mc_aRtfControlWords[ i ] == sControlW )
return true;
return false;
}
static bool IsRtfControlWord( CString sControlW )
{
const TCHAR* mc_aRtfControlWords[] = { L"moMath", L"moMathPara", L"moMathParaPr", L"maccPr", L"macc",
L"me", L"mctrlPr", L"margPr", L"mbarPr", L"mbar", L"mborderBoxPr", L"mborderBox", L"mboxPr", L"mbox"/*, L"mbrk"*/,
L"mdPr", L"md", L"meqArrPr", L"meqArr", L"mfPr", L"mf", L"mfuncPr", L"mfunc",
L"mgroupChrPr", L"mgroupChr", L"mlimLowPr", L"mlimLow",L"mlimUppPr", L"mlimUpp", L"mmathPr", L"mmcPr", L"mmc",
L"mmcs", L"mmPr", L"mmr", L"mm", L"mnaryPr", L"mnary", L"mphantPr", L"mphant", L"mmRun", L"mmDel",
L"mmIns", L"mradPr", L"mrad", /*MRPr",*/ L"msPrePr", L"msPre", L"msSubPr", L"msSub", L"msSubSupPr",
L"msSubSup", L"msSupPr", L"msSup", L"msub", L"msup", L"mden", L"mlim", L"mnum", L"mdeg"/*mmText",*/, L"mfName" };
int mc_nRtfControlWordsSize = sizeof( mc_aRtfControlWords ) / sizeof( TCHAR* );
//можно бинарный поиск вставить
for( int i = 0; i < mc_nRtfControlWordsSize; i++ )
if( mc_aRtfControlWords[ i ] == sControlW )
return true;
return false;
}
static bool IsOOXControlWord( CString sControlW )
{
const TCHAR* mc_aOOXControlWords[] = {_T("m:acc"),_T("m:accPr"),_T("m:aln"),_T("m:alnScr"),_T("m:argPr"),_T("m:argSz"),_T("m:bar"),_T("m:barPr"),_T("m:baseJc"),_T("m:begChr"),_T("m:borderBox"),_T("m:borderBoxPr"),_T("m:box"),_T("m:boxPr"),_T("m:brkN"),_T("m:brkBinN"),_T("m:brkBinSubN"),_T("m:cGpN"),_T("m:cGpRuleN"),_T("m:chr"),_T("m:count"),_T("m:cSpN"),_T("m:ctrlPr"),_T("m:d"),_T("m:defJcN"),_T("m:deg"),_T("m:degHide"),_T("m:den"),_T("m:diff"),_T("m:diffStyN"),_T("m:dispDefN"),_T("m:dPr"),_T("m:e"),_T("m:endChr"),_T("m:eqArr"),_T("m:eqArrPr"),_T("m:f"),_T("m:fName"),_T("m:fPr"),_T("m:func"),_T("m:funcPr"),_T("m:groupChr"),_T("m:groupChrPr"),_T("m:grow"),_T("m:hideBot"),_T("m:hideLeft"),_T("m:hideRight"),_T("m:hideTop"),_T("m:interSpN"),_T("m:intLimN"),_T("m:intraSpN"),_T("m:jcN"),_T("m:lim"),_T("m:limLoc"),_T("m:limLow"),_T("m:limLowPr"),_T("m:limUpp"),_T("m:limUppPr"),_T("m:lit"),_T("m:lMarginN"),_T("m:m"),_T("m:math"),_T("m:mathFontN"),_T("m:mathPict"),_T("m:mathPr"),_T("m:maxDist"),_T("m:mc"),_T("m:mcJc"),_T("m:mcPr"),_T("m:mcs"),_T("m:mPr"),_T("m:mr"),_T("m:nary"),_T("m:naryLimN"),_T("m:naryPr"),_T("m:noBreak"),_T("m:nor"),_T("m:num"),_T("m:objDist"),_T("m:oMath"),_T("m:oMathPara"),_T("m:oMathParaPr"),_T("m:opEmu"),_T("m:phant"),_T("m:phantPr"),_T("m:plcHide"),_T("m:pos"),_T("m:postSpN"),_T("m:preSpN"),_T("m:r"),_T("m:rad"),_T("m:radPr"),_T("m:rMarginN"),_T("m:rPr"),_T("m:rSpN"),_T("m:rSpRuleN"),_T("m:scrN"),_T("m:sepChr"),_T("m:show"),_T("m:shp"),_T("m:smallFracN"),_T("m:sPre"),_T("m:sPrePr"),_T("m:sSub"),_T("m:sSubPr"),_T("m:sSubSup"),_T("m:sSubSupPr"),_T("m:sSup"),_T("m:sSupPr"),_T("m:strikeBLTR"),_T("m:strikeH"),_T("m:strikeTLBR"),_T("m:strikeV"),_T("m:styN"),_T("m:sub"),_T("m:subHide"),_T("m:sup"),_T("m:supHide"),_T("m:transp"),_T("m:type"),_T("m:vertJc"),_T("m:wrapIndentN"),_T("m:wrapRightN"),_T("m:zeroAsc"),_T("m:zeroDesc"),_T("m:zeroWid")};
int mc_nOOXControlWordsSize = sizeof( mc_aOOXControlWords ) / sizeof( TCHAR* );
//можно бинарный поиск вставить
for( int i = 0; i < mc_nOOXControlWordsSize; i++ )
if( mc_aOOXControlWords[ i ] == sControlW )
return true;
return false;
}
void SetRtfName(CString sName)
{
m_sRtfName = sName;
m_sOOXName = sName;
m_sOOXName.Insert(1, _T(":"));
}
void SetOOXName(CString sName)
{
m_sOOXName = sName;
m_sRtfName = sName;
m_sRtfName.Remove(':');
}
CString RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
if( RENDER_TO_RTF_PARAM_NESTED != oRenderParameter.nType )
sResult.Append(_T("{\\mmath"));
sResult.AppendFormat(_T("{\\%ls"), m_sRtfName.GetBuffer());
RenderParameter oNewParameter = oRenderParameter;
oNewParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
sResult.Append( m_oProperty.RenderToRtf( oNewParameter ) );
//if( _T("mr") == m_sRtfName )
//{
// oNewParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
// sResult.Append( _T(" ") );
// for( int i = 0; i < m_oVal.size(); i++ )
// sResult.Append( _T(" ") + m_oVal[i]->RenderToRtf( oNewParameter ) );
//}
//else
{
oNewParameter.nType = RENDER_TO_RTF_PARAM_CHAR;
sResult.Append( _T(" ") + m_oVal.RenderToRtf( oNewParameter ) );
}
oNewParameter.nType = RENDER_TO_RTF_PARAM_NESTED;
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append(m_aArray[i]->RenderToRtf( oNewParameter ));
sResult.Append(_T("}"));
if( RENDER_TO_RTF_PARAM_NESTED != oRenderParameter.nType )
sResult.AppendFormat(_T("}"), m_sRtfName.GetBuffer());
return sResult;
}
CString RenderToOOX(RenderParameter oRenderParameter)
{
CString sResult;
CString sContent;
CString sProp;
CString sVal;
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_TEXT;
sProp = m_oProperty.RenderToOOX( oNewParam );
//oNewParam.nType = RENDER_TO_OOX_PARAM_PLAIN;
//sVal = m_oVal.RenderToOOX( oNewParam );
if (m_bIsVal || m_bIsBool)
{
oNewParam.nType = RENDER_TO_OOX_PARAM_PLAIN;
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
sVal += m_aArray[i]->RenderToOOX(oNewParam);
}
}
else
{
oNewParam.nType = RENDER_TO_OOX_PARAM_MATH;
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
sContent += m_aArray[i]->RenderToOOX(oNewParam);
}
}
sResult.Append( _T("<") );
sResult += m_sOOXName;
if( false == sVal.IsEmpty() )
{
if (m_bIsBool)
{
if (sVal == L"on") sVal = L"1";
else sVal = L"0";
}
sResult.Append( _T(" m:val=\"") );
sResult += sVal;
sResult.Append( _T("\"") );
}
sResult.Append( _T(">") );
sResult += sProp;
sResult += sContent;
sResult.Append(_T("</") );
sResult += m_sOOXName;
sResult.Append(_T(">"));
//альтернативная картинка
// if( NULL != m_oPicture )
// sResult.Append( m_oPicture->RenderToOOX(oRenderParameter) );
return sResult;
}
void SetOOXType (int type);
CString RenderToRtf (RenderParameter oRenderParameter);
CString RenderToOOX (RenderParameter oRenderParameter);
};
typedef boost::shared_ptr<RtfMath> RtfMathPtr;
......@@ -89,7 +89,7 @@ CString OOXDocumentWriter::CreateXmlEnd( )
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
poSettingsWriter->AddContent( m_oDocument.m_oProperty.RenderToOOX(oNewParam) );
//poSettingsWriter->AddContent( m_oDocument.m_oColorSchemeMapping.RenderToOOX(oNewParam) );
poSettingsWriter->AddContent( m_oDocument.m_oMathProp.RenderToOOX(oNewParam) );
//poSettingsWriter->AddContent( m_oDocument.m_oMathProp.RenderToOOX(oNewParam) );
//numbering.xml
OOXNumberingWriter* poNumberingWriter = static_cast<OOXNumberingWriter*>( m_oWriter.m_poNumberingWriter );
......
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