Commit e39beba4 authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatReader/Writer

parent 21d10ffa
......@@ -364,6 +364,10 @@
<Filter
Name="Drawing"
>
<File
RelativePath="..\source\Reader\OOXDrawingGraphicReader.cpp"
>
</File>
<File
RelativePath="..\source\Reader\OOXPictureAnchorReader.h"
>
......
......@@ -48,7 +48,599 @@ HRESULT ConvertOle1ToOle2(BYTE *pData, int nSize, std::wstring sOle2Name)
file.CloseFile();
return S_FALSE;
}
//-----------------------------------------------------------------------------------------
bool RtfDocumentCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, CString sCommand, bool hasParameter, int parameter)
{
if( _T("ansi") == sCommand )
oDocument.m_oProperty.m_eCodePage = RtfDocumentProperty::cp_ansi;
else if( _T("mac") == sCommand )
oDocument.m_oProperty.m_eCodePage = RtfDocumentProperty::cp_mac;
else if( _T("pc") == sCommand )
oDocument.m_oProperty.m_eCodePage = RtfDocumentProperty::cp_pc;
else if( _T("pca") == sCommand )
oDocument.m_oProperty.m_eCodePage = RtfDocumentProperty::cp_pca;
else if( _T("ansicpg") == sCommand )
{
oDocument.m_oProperty.m_eCodePage = RtfDocumentProperty::cp_ansi;
if( true == hasParameter )
{
oDocument.m_oProperty.m_nAnsiCodePage = parameter;
}
}
else if( _T("deff") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nDeffFont = parameter;
oReader.m_nDefFont = parameter;
}
}
COMMAND_RTF_INT( _T("themelang"), oDocument.m_oProperty.m_nThemelang, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("themelangfe"), oDocument.m_oProperty.m_nThemelangfe, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("themelangcs"), oDocument.m_oProperty.m_nThemelangcs, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("rtlgutter"), oDocument.m_oProperty.m_bRtlGutter, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("rtldoc"), oDocument.m_oProperty.m_bRtl, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("hyphcaps"), oDocument.m_oProperty.m_bHypCaps, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("hyphauto"), oDocument.m_oProperty.m_bAutoHyp, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("hyphconsec"), oDocument.m_oProperty.m_nMaxHypen, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("hyphhotz"), oDocument.m_oProperty.m_nHyphenationRight, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("deftab"), oDocument.m_oProperty.m_nTabWidth, sCommand, hasParameter, parameter )
//Page Borders
COMMAND_RTF_BOOL( _T("pgbrdrhead"), oDocument.m_oProperty.m_bDorderSurroundHeader, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("pgbrdrfoot"), oDocument.m_oProperty.m_bDorderSurroundFotter, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("pgbrdrsnap"), oDocument.m_oProperty.m_bAlignBordersAndEdges, sCommand, hasParameter, parameter )
//Page Information
else if( _T("paperw") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nPaperWidth = parameter;
oReader.m_oCurSectionProp.m_nPageWidth = parameter;
}
}
else if( _T("paperh") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nPaperHeight = parameter;
oReader.m_oCurSectionProp.m_nPageHeight = parameter;
}
}
else if( _T("margl") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nMarginLeft = parameter;
oReader.m_oCurSectionProp.m_nMarginLeft = parameter;
}
}
else if( _T("margr") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nMarginRight = parameter;
oReader.m_oCurSectionProp.m_nMarginRight = parameter;
}
}
else if( _T("margt") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nMarginTop = parameter;
oReader.m_oCurSectionProp.m_nMarginTop = parameter;
}
}
else if( _T("margb") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nMarginBottom = parameter;
oReader.m_oCurSectionProp.m_nMarginBottom = parameter;
}
}
else if( _T("facingp") == sCommand )
{
if( true == hasParameter && 0 == parameter )
{
oDocument.m_oProperty.m_bFacingPage = 0;
oReader.m_oCurSectionProp.m_bSwitchMargin = 0;
}
else
{
oDocument.m_oProperty.m_bFacingPage = 1;
oReader.m_oCurSectionProp.m_bSwitchMargin = 1;
}
}
else if( _T("gutter") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nGutterWidth = parameter;
oReader.m_oCurSectionProp.m_nGutterMarginWidth = parameter;
}
}
else if( _T("ogutter") == sCommand )
{
if( true == hasParameter )
oDocument.m_oProperty.m_nGutterWidthOutside = parameter;
}
else if( _T("margmirror") == sCommand )
{
if( true == hasParameter && 0 == parameter )
{
oDocument.m_oProperty.m_bSwitchMargins = 0;
oReader.m_oCurSectionProp.m_bLandscapeFormat = 0;
}
else
{
oDocument.m_oProperty.m_bSwitchMargins = 1;
oReader.m_oCurSectionProp.m_bLandscapeFormat = 1;
}
}
else if( _T("landscape") == sCommand )
{
if( true == hasParameter && 0 == parameter )
oDocument.m_oProperty.m_bLandScape = 0;
else
oDocument.m_oProperty.m_bLandScape = 1;
}
COMMAND_RTF_BOOL( _T("gutterprl"), oDocument.m_oProperty.m_bGutterAtTop, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("viewbksp"), oDocument.m_oProperty.m_nDisplayBackground, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("htmautsp"), oDocument.m_oProperty.m_bHtmlAutoSpace, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("useltbaln"), oDocument.m_oProperty.m_bUseTabAlignment, sCommand, hasParameter, parameter )
//Footnotes and Endnotes
COMMAND_RTF_INT( _T("endnotes"), oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_EndSection )
COMMAND_RTF_INT( _T("enddoc"), oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_EndDocument )
COMMAND_RTF_INT( _T("ftntj"), oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_BeneathText )
COMMAND_RTF_INT( _T("ftnbj"), oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_BottomPage )
COMMAND_RTF_INT( _T("aendnotes"), oDocument.m_oProperty.m_eEndnotePlacement, sCommand, true, RtfDocumentProperty::ep_EndSection )
COMMAND_RTF_INT( _T("aenddoc"), oDocument.m_oProperty.m_eEndnotePlacement, sCommand, true, RtfDocumentProperty::ep_EndDocument )
COMMAND_RTF_INT( _T("aftnbj"), oDocument.m_oProperty.m_eEndnotePlacement, sCommand, true, RtfDocumentProperty::ep_BeneathText )
COMMAND_RTF_INT( _T("aftntj"), oDocument.m_oProperty.m_eEndnotePlacement, sCommand, true, RtfDocumentProperty::ep_BottomPage )
COMMAND_RTF_INT( _T("ftnstart"), oDocument.m_oProperty.m_nFootnoteStart, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("aftnstart"), oDocument.m_oProperty.m_nEndnoteStart, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("ftnrstpg"), oDocument.m_oProperty.m_eFootnoteRestart, sCommand, true, RtfDocumentProperty::fr_EachPage )
COMMAND_RTF_INT( _T("ftnrestart"), oDocument.m_oProperty.m_eFootnoteRestart, sCommand, true, RtfDocumentProperty::fr_EachSection )
COMMAND_RTF_INT( _T("ftnrstcont"), oDocument.m_oProperty.m_eFootnoteRestart, sCommand, true, RtfDocumentProperty::fr_Continuous )
COMMAND_RTF_INT( _T("aftnrestart"), oDocument.m_oProperty.m_eEndnoteRestart, sCommand, true, RtfDocumentProperty::er_EachSection )
COMMAND_RTF_INT( _T("aftnrstcont"), oDocument.m_oProperty.m_eEndnoteRestart, sCommand, true, RtfDocumentProperty::er_Continuous )
COMMAND_RTF_INT( _T("ftnnar"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 0 )
COMMAND_RTF_INT( _T("ftnnalc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 4 )
COMMAND_RTF_INT( _T("ftnnauc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 3 )
COMMAND_RTF_INT( _T("ftnnrlc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 2 )
COMMAND_RTF_INT( _T("ftnnruc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 1 )
COMMAND_RTF_INT( _T("ftnnchi"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 70 )
COMMAND_RTF_INT( _T("ftnnchi"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 25 )
COMMAND_RTF_INT( _T("ftnncnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 18 )
COMMAND_RTF_INT( _T("ftnndbnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 10 )
COMMAND_RTF_INT( _T("ftnndbnumd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 11 )
COMMAND_RTF_INT( _T("ftnndbnumt"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 16 )
COMMAND_RTF_INT( _T("ftnndbnumk"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 17 )
COMMAND_RTF_INT( _T("ftnndbar"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 20 )
COMMAND_RTF_INT( _T("ftnnganada"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 24 )
COMMAND_RTF_INT( _T("ftnngbnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 26 )
COMMAND_RTF_INT( _T("ftnngbnumd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 27 )
COMMAND_RTF_INT( _T("ftnngbnuml"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 28 )
COMMAND_RTF_INT( _T("ftnngbnumk"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 29 )
COMMAND_RTF_INT( _T("ftnnzodiac"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 30 )
COMMAND_RTF_INT( _T("ftnnzodiacd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 31 )
COMMAND_RTF_INT( _T("ftnnzodiacl"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 32 )
COMMAND_RTF_INT( _T("aftnnar"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 0 )
COMMAND_RTF_INT( _T("aftnnalc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 4 )
COMMAND_RTF_INT( _T("aftnnauc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 3 )
COMMAND_RTF_INT( _T("aftnnrlc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 2 )
COMMAND_RTF_INT( _T("aftnnruc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 1 )
COMMAND_RTF_INT( _T("aftnnchi"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 70 )
COMMAND_RTF_INT( _T("aftnnchi"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 25 )
COMMAND_RTF_INT( _T("aftnncnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 18 )
COMMAND_RTF_INT( _T("aftnndbnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 10 )
COMMAND_RTF_INT( _T("aftnndbnumd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 11 )
COMMAND_RTF_INT( _T("aftnndbnumt"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 16 )
COMMAND_RTF_INT( _T("aftnndbnumk"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 17 )
COMMAND_RTF_INT( _T("aftnndbar"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 20 )
COMMAND_RTF_INT( _T("aftnnganada"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 24 )
COMMAND_RTF_INT( _T("aftnngbnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 26 )
COMMAND_RTF_INT( _T("aftnngbnumd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 27 )
COMMAND_RTF_INT( _T("aftnngbnuml"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 28 )
COMMAND_RTF_INT( _T("aftnngbnumk"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 29 )
COMMAND_RTF_INT( _T("aftnnzodiac"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 30 )
COMMAND_RTF_INT( _T("aftnnzodiacd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 31 )
COMMAND_RTF_INT( _T("aftnnzodiacl"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 32 )
else
return false;
return true;
}
bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader, CString sCommand, bool hasParameter, int parameter )
{
if( _T("colortbl") == sCommand )
{
RtfColorTableReader oColorTableReader;
return StartSubReader( oColorTableReader, oDocument, oReader );
}
else if( _T("fonttbl") == sCommand )
{
RtfFontTableReader oFontTableReader;
return StartSubReader( oFontTableReader, oDocument, oReader );
}
else if( _T("stylesheet") == sCommand )
{
StyleTableReader oStyleReader;
return StartSubReader( oStyleReader, oDocument, oReader );
}
//else if( _T("latentstyles") == sCommand )
//{
// LatentstyleTableReader oLatentstyleReader;
// return StartSubReader( oLatentstyleReader, oDocument, oReader );
//}
else if( _T("listtable") == sCommand )
{
ListTableReader oListTableReader;
return StartSubReader( oListTableReader, oDocument, oReader );
}
else if( _T("listoverridetable") == sCommand )
{
ListOverrideTableReader oListOverrideReader;
return StartSubReader( oListOverrideReader, oDocument, oReader );
}
else if( _T("info") == sCommand )
{
RtfInfoReader oInfoReader;
return StartSubReader( oInfoReader, oDocument, oReader );
}
//else if( _T("colorschememapping") == sCommand )
//{
// RtfColorSchemeReader oSchemeReader;
// return StartSubReader( oSchemeReader, oDocument, oReader );
//}
//else if( _T("themedata") == sCommand )
//{
// RtfThemeDataReader oThemeDataReader;
// return StartSubReader( oThemeDataReader, oDocument, oReader );
//}
//else if( _T("defchp") == sCommand )
//{
// RtfDefCharPropReader oDefCharPropReader( oDocument.m_oDefaultCharProp );
// return StartSubReader( oDefCharPropReader, oDocument, oReader ); }
//else if( _T("defpap") == sCommand )
//{
// RtfDefParPropReader oDefParPropReader;
// return StartSubReader( oDefParPropReader, oDocument, oReader );
//}
else if( _T("mmathPr") == sCommand )
{
RtfMathReader oMathPropReader(oDocument.m_oMathProp);
return StartSubReader( oMathPropReader, oDocument, oReader );
}
else if( _T("ftnsep") == sCommand || _T("ftnsepc") == sCommand ||
_T("aftnsep")== sCommand || _T("aftnsepc") == sCommand )
{
ParagraphReader oParagraphReader(sCommand, oReader);
StartSubReader( oParagraphReader, oDocument, oReader );
if( _T("ftnsep") == sCommand )
{
oDocument.m_oFootnoteSep = oParagraphReader.m_oParPropDest.m_oTextItems;
oDocument.m_oProperty.m_aSpecialFootnotes.push_back( 0 );
}
else if( _T("ftnsepc") == sCommand )
{
oDocument.m_oFootnoteCon = oParagraphReader.m_oParPropDest.m_oTextItems;
oDocument.m_oProperty.m_aSpecialFootnotes.push_back( 1 );
}
else if( _T("aftnsep") == sCommand )
{
oDocument.m_oEndnoteSep = oParagraphReader.m_oParPropDest.m_oTextItems;
oDocument.m_oProperty.m_aSpecialEndnotes.push_back( 0 );
}
else if( _T("aftnsepc") == sCommand )
{
oDocument.m_oEndnoteCon = oParagraphReader.m_oParPropDest.m_oTextItems;
oDocument.m_oProperty.m_aSpecialEndnotes.push_back( 1 );
}
}
else if( _T("sect") == sCommand )
{
RtfSectionPtr oCurSection;
if(true == oDocument.GetItem( oCurSection ) )
{
oCurSection->m_oProperty = oReader.m_oCurSectionProp;
oCurSection->m_bFinalize = true;
}
oParagraphReaderDestination.Finalize( oReader/* , oCurSection*/);
RtfSectionPtr oNewSection = RtfSectionPtr( new RtfSection() );
oParagraphReaderDestination.m_oTextItems = oNewSection;
oDocument.AddItem( oNewSection );
//вручную обнуляем footer, т.к. sectd может встретиться и после field
///?????
oReader.m_oCurSectionProp.m_oHeaderLeft = TextItemContainerPtr();
oReader.m_oCurSectionProp.m_oHeaderFirst = TextItemContainerPtr();
oReader.m_oCurSectionProp.m_oHeaderRight = TextItemContainerPtr();
oReader.m_oCurSectionProp.m_oFooterLeft = TextItemContainerPtr();
oReader.m_oCurSectionProp.m_oFooterFirst = TextItemContainerPtr();
oReader.m_oCurSectionProp.m_oFooterRight = TextItemContainerPtr();
}
else if( _T("sectd") == sCommand )
{
SectDef( oDocument, oReader );
}
else
{
bool bResult = false;
bResult = oParagraphReaderDestination.ExecuteCommand( oDocument, oReader, (*this), sCommand, hasParameter, parameter );
if( true == bResult )
return true;
bResult = RtfDocumentCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter );
if( true == bResult )
return true;
bResult = oRtfSectionCommand.ExecuteCommand( oDocument, oReader, (*this),sCommand, hasParameter, parameter );
if( true == bResult )
return true;
bResult = RtfDocumentCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter );
if( true == bResult )
return true;
return false;
}
return true;
}
bool RtfSectionCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, RtfAbstractReader& oAbstrReader, CString sCommand, bool hasParameter, int parameter)
{
if( _T("11111111") == sCommand )
;
COMMAND_RTF_BOOL( _T("rtlsect"), oReader.m_oCurSectionProp.m_bBidi, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("binfsxn"), oReader.m_oCurSectionProp.m_nPaperSourceFirst, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("binsxn"), oReader.m_oCurSectionProp.m_nPaperSourceOther, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("rtlgutter"), oReader.m_oCurSectionProp.m_bRtlGutter, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("endnhere"), oReader.m_oCurSectionProp.m_bEndnotes, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("ds"), oReader.m_oCurSectionProp.m_nStyle, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("sbknone"), oReader.m_oCurSectionProp.m_eSectionBreak, sCommand, true, RtfSectionProperty::sb_sbknone)
COMMAND_RTF_INT( _T("sbkcol"), oReader.m_oCurSectionProp.m_eSectionBreak, sCommand, true, RtfSectionProperty::sb_sbkcol)
COMMAND_RTF_INT( _T("sbkpage"), oReader.m_oCurSectionProp.m_eSectionBreak, sCommand, true, RtfSectionProperty::sb_sbkpage)
COMMAND_RTF_INT( _T("sbkeven"), oReader.m_oCurSectionProp.m_eSectionBreak, sCommand, true, RtfSectionProperty::sb_sbkeven)
COMMAND_RTF_INT( _T("sbkodd"), oReader.m_oCurSectionProp.m_eSectionBreak, sCommand, true, RtfSectionProperty::sb_sbkodd)
else if( _T("cols") == sCommand )
{
if( true == hasParameter )
{
oReader.m_oCurSectionProp.m_nColumnNumber = parameter;
oReader.m_oCurSectionProp.m_oCollumnProperty.m_aCollumnProperty.resize( parameter );
}
}
COMMAND_RTF_INT( _T("colsx"), oReader.m_oCurSectionProp.m_nColumnSpace, sCommand, hasParameter, parameter)
else if( _T("colno") == sCommand )
{
if( true == hasParameter )
nCurCollumnNumber = parameter - 1;
}
else if( _T("colsr") == sCommand )
{
if( true == hasParameter )
if( nCurCollumnNumber >= 0 && nCurCollumnNumber < (int)oReader.m_oCurSectionProp.m_oCollumnProperty.m_aCollumnProperty.size() )
oReader.m_oCurSectionProp.m_oCollumnProperty.m_aCollumnProperty[ nCurCollumnNumber ].m_nColumnSpaceToRightOfCol = parameter;
}
else if( _T("colw") == sCommand )
{
if( true == hasParameter )
if( nCurCollumnNumber >= 0 && nCurCollumnNumber < (int)oReader.m_oCurSectionProp.m_oCollumnProperty.m_aCollumnProperty.size() )
oReader.m_oCurSectionProp.m_oCollumnProperty.m_aCollumnProperty[ nCurCollumnNumber ].m_nColumnWidth = parameter;
}
COMMAND_RTF_BOOL( _T("linebetcol"), oReader.m_oCurSectionProp.m_bColumnLineBetween, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("sftntj"), oReader.m_oCurSectionProp.m_eFootnotesJust, sCommand, true, RtfSectionProperty::fj_sftntj)
COMMAND_RTF_INT( _T("sftnbj"), oReader.m_oCurSectionProp.m_eFootnotesJust, sCommand, true, RtfSectionProperty::fj_sftnbj)
//Footnotes and Endnotes
COMMAND_RTF_INT( _T("sftnstart"), oReader.m_oCurSectionProp.m_nFootnotesStart, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("sftnrstpg"), oReader.m_oCurSectionProp.m_eFootnotesRestart, sCommand, true, RtfSectionProperty::fr_sftnrstpg)
COMMAND_RTF_INT( _T("sftnrestart"), oReader.m_oCurSectionProp.m_eFootnotesRestart, sCommand, true, RtfSectionProperty::fr_sftnrestart)
COMMAND_RTF_INT( _T("sftnrstcont"), oReader.m_oCurSectionProp.m_eFootnotesRestart, sCommand, true, RtfSectionProperty::fr_sftnrstcont)
COMMAND_RTF_INT( _T("sftnnar"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnar)
COMMAND_RTF_INT( _T("sftnnalc"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnalc)
COMMAND_RTF_INT( _T("sftnnauc"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnauc)
COMMAND_RTF_INT( _T("sftnnrlc"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnrlc)
COMMAND_RTF_INT( _T("sftnnruc"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnruc)
COMMAND_RTF_INT( _T("sftnnchi"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnchi)
COMMAND_RTF_INT( _T("sftnnchosung"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnchosung)
COMMAND_RTF_INT( _T("sftnncnum"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnncnum)
COMMAND_RTF_INT( _T("sftnndbnum"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnndbnum)
COMMAND_RTF_INT( _T("sftnndbnumd"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnndbnumd)
COMMAND_RTF_INT( _T("sftnndbnumt"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnndbnumt)
COMMAND_RTF_INT( _T("sftnndbnumk"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnndbnumk)
COMMAND_RTF_INT( _T("sftnndbar"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnndbar)
COMMAND_RTF_INT( _T("sftnnganada"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnganada)
COMMAND_RTF_INT( _T("sftnngbnum"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnngbnum)
COMMAND_RTF_INT( _T("sftnngbnumd"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnngbnumd)
COMMAND_RTF_INT( _T("sftnngbnuml"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnngbnuml)
COMMAND_RTF_INT( _T("sftnngbnumk"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnngbnumk)
COMMAND_RTF_INT( _T("sftnnzodiac"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnzodiac)
COMMAND_RTF_INT( _T("sftnnzodiacd"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnzodiacd)
COMMAND_RTF_INT( _T("sftnnzodiacl"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnzodiacl)
COMMAND_RTF_INT( _T("saftnstart"), oReader.m_oCurSectionProp.m_nEndnotesStart, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("saftnrestart"), oReader.m_oCurSectionProp.m_eEndnotesRestart, sCommand, true, RtfSectionProperty::er_saftnrestart)
COMMAND_RTF_INT( _T("saftnrstcont"), oReader.m_oCurSectionProp.m_eEndnotesRestart, sCommand, true, RtfSectionProperty::er_saftnrstcont)
COMMAND_RTF_INT( _T("saftnnar"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnar)
COMMAND_RTF_INT( _T("saftnnalc"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnalc)
COMMAND_RTF_INT( _T("saftnnauc"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnauc)
COMMAND_RTF_INT( _T("saftnnrlc"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnrlc)
COMMAND_RTF_INT( _T("saftnnruc"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnruc)
COMMAND_RTF_INT( _T("saftnnchi"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnchi)
COMMAND_RTF_INT( _T("saftnnchosung"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnchosung)
COMMAND_RTF_INT( _T("saftnncnum"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnncnum)
COMMAND_RTF_INT( _T("saftnndbnum"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnndbnum)
COMMAND_RTF_INT( _T("saftnndbnumd"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnndbnumd)
COMMAND_RTF_INT( _T("saftnndbnumt"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnndbnumt)
COMMAND_RTF_INT( _T("saftnndbnumk"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnndbnumk)
COMMAND_RTF_INT( _T("saftnndbar"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnndbar)
COMMAND_RTF_INT( _T("saftnnganada"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnganada)
COMMAND_RTF_INT( _T("saftnngbnum"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnngbnum)
COMMAND_RTF_INT( _T("saftnngbnumd"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnngbnumd)
COMMAND_RTF_INT( _T("saftnngbnuml"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnngbnuml)
COMMAND_RTF_INT( _T("saftnngbnumk"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnngbnumk)
COMMAND_RTF_INT( _T("saftnnzodiac"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnzodiac)
COMMAND_RTF_INT( _T("saftnnzodiacd"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnzodiacd)
COMMAND_RTF_INT( _T("saftnnzodiacl"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnzodiacl)
//Line Numbering
COMMAND_RTF_INT( _T("linemod"), oReader.m_oCurSectionProp.m_nLineModulus, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("linex"), oReader.m_oCurSectionProp.m_nLineX, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("linestarts"), oReader.m_oCurSectionProp.m_nLineStart, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("linerestart"), oReader.m_oCurSectionProp.m_eLineNumberRestart, sCommand, true, RtfSectionProperty::lnr_linerestart)
COMMAND_RTF_INT( _T("lineppage"), oReader.m_oCurSectionProp.m_eLineNumberRestart, sCommand, true, RtfSectionProperty::lnr_lineppage)
COMMAND_RTF_INT( _T("linecont"), oReader.m_oCurSectionProp.m_eLineNumberRestart, sCommand, true, RtfSectionProperty::lnr_linecont)
//Page Information
COMMAND_RTF_INT( _T("pgwsxn"), oReader.m_oCurSectionProp.m_nPageWidth, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("pghsxn"), oReader.m_oCurSectionProp.m_nPageHeight, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("marglsxn"), oReader.m_oCurSectionProp.m_nMarginLeft, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("margrsxn"), oReader.m_oCurSectionProp.m_nMarginRight, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("margtsxn"), oReader.m_oCurSectionProp.m_nMarginTop, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("margbsxn"), oReader.m_oCurSectionProp.m_nMarginBottom, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("guttersxn"), oReader.m_oCurSectionProp.m_nGutterMarginWidth, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("margmirsxn"), oReader.m_oCurSectionProp.m_bSwitchMargin, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("lndscpsxn"), oReader.m_oCurSectionProp.m_bLandscapeFormat, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("titlepg"), oReader.m_oCurSectionProp.m_bTitlePage, sCommand, hasParameter, parameter)
//else if( _T("headery") == sCommand )
//{
// static int nCount = 0;
// nCount++;
// ATLTRACE( "count %d\n", nCount );
//}
COMMAND_RTF_INT( _T("headery"), oReader.m_oCurSectionProp.m_nHeaderTop, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("footery"), oReader.m_oCurSectionProp.m_nFooterBottom, sCommand, hasParameter, parameter)
//Page Numbers
COMMAND_RTF_INT( _T("pgnstarts"), oReader.m_oCurSectionProp.m_nPageNumberStart, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("pgncont"), oReader.m_oCurSectionProp.m_bPageNumberContinuos, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("pgnrestart"), oReader.m_oCurSectionProp.m_bPageNumberRestart, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("pgnx"), oReader.m_oCurSectionProp.m_nPageNumberX, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("pgny"), oReader.m_oCurSectionProp.m_nPageNumberY, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("pgndec"), oReader.m_oCurSectionProp.m_ePageNumberFormat, sCommand, true, RtfSectionProperty::pnf_pgndec)
COMMAND_RTF_INT( _T("pgnucrm"), oReader.m_oCurSectionProp.m_ePageNumberFormat, sCommand, true, RtfSectionProperty::pnf_pgnucrm)
COMMAND_RTF_INT( _T("pgnlcrm"), oReader.m_oCurSectionProp.m_ePageNumberFormat, sCommand, true, RtfSectionProperty::pnf_pgnlcrm)
COMMAND_RTF_INT( _T("vertalt"), oReader.m_oCurSectionProp.m_eVerticalAlignment, sCommand, true, RtfSectionProperty::va_vertalt)
COMMAND_RTF_INT( _T("vertalb"), oReader.m_oCurSectionProp.m_eVerticalAlignment, sCommand, true, RtfSectionProperty::va_vertalb)
COMMAND_RTF_INT( _T("vertalc"), oReader.m_oCurSectionProp.m_eVerticalAlignment, sCommand, true, RtfSectionProperty::va_vertalc)
COMMAND_RTF_INT( _T("vertalj"), oReader.m_oCurSectionProp.m_eVerticalAlignment, sCommand, true, RtfSectionProperty::va_vertalj)
//Text Flow
COMMAND_RTF_INT( _T("stextflow"), oReader.m_oCurSectionProp.m_nTextFollow, sCommand, hasParameter, parameter)
//Page Borders
else if( _T("pgbrdrl") == sCommand )
m_eInternalState = is_border_left;
else if( _T("pgbrdrt") == sCommand )
m_eInternalState = is_border_top;
else if( _T("pgbrdrr") == sCommand )
m_eInternalState = is_border_right;
else if( _T("pgbrdrb") == sCommand )
m_eInternalState = is_border_bottom;
COMMAND_RTF_INT( _T("brdrart"), oReader.m_oCurSectionProp.m_nBorderArt, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("pgbrdropt"), oReader.m_oCurSectionProp.m_nBorderMeasure, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("pgbrdrsna"), oReader.m_oCurSectionProp.m_nBorderAlign, sCommand, hasParameter, parameter)
else if( _T("header") == sCommand || _T("footer") == sCommand || _T("headerl") == sCommand ||
_T("headerr") == sCommand || _T("headerf") == sCommand || _T("footerl") == sCommand ||
_T("footerr") == sCommand || _T("footerf") == sCommand )
{
ParagraphReader oParagraphReader(sCommand, oReader);
oAbstrReader.StartSubReader( oParagraphReader, oDocument, oReader );
oParagraphReader.m_oParPropDest.Finalize(oReader/*, RtfSectionPtr()*/);
TextItemContainerPtr oNewFooterHeader = oParagraphReader.m_oParPropDest.m_oTextItems;
if( _T("header") == sCommand )
oReader.m_oCurSectionProp.m_oHeaderRight = oNewFooterHeader;
else if( _T("footer") == sCommand )
oReader.m_oCurSectionProp.m_oFooterRight = oNewFooterHeader;
else if( _T("headerl") == sCommand )
oReader.m_oCurSectionProp.m_oHeaderLeft = oNewFooterHeader;
else if( _T("headerr") == sCommand )
oReader.m_oCurSectionProp.m_oHeaderRight = oNewFooterHeader;
else if( _T("headerf") == sCommand )
oReader.m_oCurSectionProp.m_oHeaderFirst = oNewFooterHeader;
else if( _T("footerl") == sCommand )
oReader.m_oCurSectionProp.m_oFooterLeft = oNewFooterHeader;
else if( _T("footerr") == sCommand )
oReader.m_oCurSectionProp.m_oFooterRight = oNewFooterHeader;
else if( _T("footerf") == sCommand )
oReader.m_oCurSectionProp.m_oFooterFirst = oNewFooterHeader;
}
else
{
bool bRes = false;
if( is_border_left == m_eInternalState )
bRes = RtfBorderCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, oReader.m_oCurSectionProp.m_oBorderLeft );
else if( is_border_top == m_eInternalState )
bRes = RtfBorderCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, oReader.m_oCurSectionProp.m_oBorderTop );
else if( is_border_right == m_eInternalState )
bRes = RtfBorderCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, oReader.m_oCurSectionProp.m_oBorderRight );
else if( is_border_bottom == m_eInternalState )
bRes = RtfBorderCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, oReader.m_oCurSectionProp.m_oBorderBottom );
if( true == bRes )
return true;
return false;
}
return true;
}
bool RtfShadingCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput )
{
if( _T("bghoriz") == sCommand )
oOutput.m_eType = RtfShading::st_chbghoriz;
else if( _T("bgvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgvert;
else if( _T("bgfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgfdiag;
else if( _T("bgbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgbdiag;
else if( _T("bgcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgcross;
else if( _T("bgdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdcross;
else if( _T("bgdkhoriz") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkhoriz;
else if( _T("bgdkvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkvert;
else if( _T("bgdkfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkfdiag;
else if( _T("bgdkbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkbdiag;
else if( _T("bgdkcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkcross;
else if( _T("bgdkdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkdcross;
else if( _T("cfpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nForeColor = parameter;
}
else if( _T("cbpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nBackColor = parameter;
}
else if( _T("shading") == sCommand )
{
if( true == hasParameter )
oOutput.m_nValue = parameter;
}
else
return false;
return true;
}
bool ShapeReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
{
if( _T("shp") == sCommand )
......@@ -148,6 +740,249 @@ bool ShapeReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CStr
return false;
return true;
}
bool RtfShadingCellCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput)
{
//для свойст таблицы и для стилей таблицы
if( _T("clshdrawnil") == sCommand )
oOutput.m_eType = RtfShading::st_clshdrawnil;
else if( _T("rawclbgvert") == sCommand || _T("clbgvert") == sCommand || _T("tsbgvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgvert;
else if( _T("rawclbgfdiag") == sCommand || _T("clbgfdiag") == sCommand || _T("tsbgfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgfdiag;
else if( _T("rawclbgbdiag") == sCommand || _T("clbgbdiag") == sCommand || _T("tsbgbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgbdiag;
else if( _T("rawclbgcross") == sCommand || _T("clbgcross") == sCommand || _T("tsbgcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgcross;
else if( _T("rawclbgdcross") == sCommand || _T("clbgdcross") == sCommand || _T("tsbgdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdcross;
else if( _T("rawclbgdkhor") == sCommand || _T("clbgdkhor") == sCommand || _T("tsbgdkhor") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkhoriz;
else if( _T("rawclbgdkvert") == sCommand || _T("clbgdkvert") == sCommand || _T("tsbgdkvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkvert;
else if( _T("rawclbgdkfdiag") == sCommand || _T("clbgdkfdiag") == sCommand || _T("tsbgdkfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkfdiag;
else if( _T("rawclbgdkbdiag") == sCommand || _T("clbgdkbdiag") == sCommand || _T("tsbgdkbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkbdiag;
else if( _T("rawclbgdkcross") == sCommand || _T("clbgdkcross") == sCommand || _T("tsbgdkcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkcross;
else if( _T("rawclbgdkdcross") == sCommand || _T("clbgdkdcross") == sCommand || _T("tsbgdkdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkdcross;
COMMAND_RTF_INT( _T("clcfpat"), oOutput.m_nForeColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("clcbpat"), oOutput.m_nBackColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("clcfpatraw"), oOutput.m_nForeColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("clcbpatraw"), oOutput.m_nBackColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("tscellcfpat"), oOutput.m_nForeColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("tscellcbpat"), oOutput.m_nBackColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("clshdng"), oOutput.m_nValue, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("clshdngraw"), oOutput.m_nValue, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("tscellpct"), oOutput.m_nValue, sCommand, hasParameter, parameter )
else
return false;
if (sCommand == _T("clshdng")) oReader.m_oState->m_oCellProperty.m_nShadingPctFrom = 1;
if (sCommand == _T("clshdngraw")) oReader.m_oState->m_oCellProperty.m_nShadingPctFrom = 2;
return true;
}
bool RtfShadingCharCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput )
{
if( _T("chbghoriz") == sCommand )
oOutput.m_eType = RtfShading::st_chbghoriz;
else if( _T("chbgvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgvert;
else if( _T("chbgfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgfdiag;
else if( _T("chbgbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgbdiag;
else if( _T("chbgcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgcross;
else if( _T("chbgdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdcross;
else if( _T("chbgdkhoriz") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkhoriz;
else if( _T("chbgdkvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkvert;
else if( _T("chbgdkfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkfdiag;
else if( _T("chbgdkbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkbdiag;
else if( _T("chbgdkcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkcross;
else if( _T("chbgdkdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkdcross;
else if( _T("chcfpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nForeColor = parameter;
}
else if( _T("chcbpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nBackColor = parameter;
}
else if( _T("chshdng") == sCommand )
{
if( true == hasParameter )
oOutput.m_nValue = parameter;
}
else
return false;
return true;
}
bool RtfShadingRowCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput)
{
if( _T("trbghoriz") == sCommand )
oOutput.m_eType = RtfShading::st_chbghoriz;
else if( _T("trbgvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgvert;
else if( _T("trbgfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgfdiag;
else if( _T("trbgbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgbdiag;
else if( _T("trbgcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgcross;
else if( _T("trbgdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdcross;
else if( _T("trbgdkhor") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkhoriz;
else if( _T("trbgdkvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkvert;
else if( _T("trbgdkfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkfdiag;
else if( _T("trbgdkbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkbdiag;
else if( _T("trbgdkcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkcross;
else if( _T("trbgdkdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkdcross;
else if( _T("trcfpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nForeColor = parameter;
}
else if( _T("trcbpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nBackColor = parameter;
}
else if( _T("trshdng") == sCommand )
{
if( true == hasParameter )
oOutput.m_nValue = parameter;
}
else
return false;
return true;
}
bool RtfCharPropCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfCharProperty & ChartProperty, bool bLookOnBorder)
{
if( _T("plain") == sCommand )
oReader.m_oState->m_oCharProp.SetDefaultRtf();
COMMAND_RTF_INT( _T("animtext") , ChartProperty.m_nAnimated, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("uc") , oReader.m_oState->m_nUD, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("b") , ChartProperty.m_bBold, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("caps") , ChartProperty.m_bCaps, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("charscalex"), ChartProperty.m_nScalex, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("cs") , ChartProperty.m_nCharStyle, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("down") , ChartProperty.m_nDown, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("embo") , ChartProperty.m_bEmbo, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("expndtw") , ChartProperty.m_nCharacterSpacing, sCommand, hasParameter, parameter)
else if( _T("expnd") == sCommand )
{
if( true == hasParameter )
ChartProperty.m_nCharacterSpacing = 5 * parameter; //quater -points
}
COMMAND_RTF_INT( _T("fittext") , ChartProperty.m_nFitText, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("f") , ChartProperty.m_nFont, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("fs") , ChartProperty.m_nFontSize, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("i") , ChartProperty.m_bItalic, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("impr") , ChartProperty.m_bImprint, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("kerning") , ChartProperty.m_nKerning, sCommand, hasParameter, parameter)
else if( _T("ltrch") == sCommand )
{
if( false == hasParameter || 0 != parameter )
ChartProperty.m_bRightToLeft = 0;
else
ChartProperty.m_bRightToLeft = 1;
}
COMMAND_RTF_BOOL( _T("rtlch"), ChartProperty.m_bRightToLeft, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("lang"), ChartProperty.m_nLanguage , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("cs"), ChartProperty.m_nComplexScript, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("outl"), ChartProperty.m_bOutline , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("scaps"), ChartProperty.m_bScaps , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("shad"), ChartProperty.m_bShadow , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("strike"), ChartProperty.m_bStrike , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("striked"), ChartProperty.m_nStriked , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("sub"), ChartProperty.m_bSub , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("super"), ChartProperty.m_bSuper , sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("highlight"), ChartProperty.m_nHightlited , sCommand, hasParameter, parameter)
else if( _T("cf") == sCommand )
{
if( true == hasParameter )
ChartProperty.m_nForeColor = parameter;
else
ChartProperty.m_nForeColor= PROP_DEF;
}
else if( _T("ul") == sCommand )
{
if( true == hasParameter && 0 == parameter)
ChartProperty.m_eUnderStyle = RtfCharProperty::uls_none;
else
ChartProperty.m_eUnderStyle = RtfCharProperty::uls_Single;
}
//COMMAND_RTF_BOOL( _T("ul"), ChartProperty.m_bUnderline, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("ulc"), ChartProperty.m_nUnderlineColor, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("uld"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dotted)
COMMAND_RTF_INT( _T("uldash"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dashed)
COMMAND_RTF_INT( _T("uldashd"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dash_dotted)
COMMAND_RTF_INT( _T("uldashdd"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dash_dot_dotted)
COMMAND_RTF_INT( _T("uldb"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Double)
COMMAND_RTF_INT( _T("ulhwave"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Heavy_wave)
COMMAND_RTF_INT( _T("ulldash"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Long_dashe)
COMMAND_RTF_INT( _T("ulnone"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_none)
COMMAND_RTF_INT( _T("ulth"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick)
COMMAND_RTF_INT( _T("ulthd"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dotted)
COMMAND_RTF_INT( _T("ulthdash"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dashed)
COMMAND_RTF_INT( _T("ulthdashd"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dash_dotted)
COMMAND_RTF_INT( _T("ulthdashdd"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dash_dot_dotted)
COMMAND_RTF_INT( _T("ulthldash"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_long_dashed)
COMMAND_RTF_INT( _T("ululdbwave"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Double_wave)
COMMAND_RTF_INT( _T("ulw"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Word)
COMMAND_RTF_INT( _T("ulwave"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Wave)
COMMAND_RTF_INT( _T("up"), ChartProperty.m_nUp, sCommand, hasParameter, parameter)
else if( _T("nosupersub") == sCommand )
{
ChartProperty.m_bSub = 0;
ChartProperty.m_bSuper = 0;
}
else if( _T("nosectexpand") == sCommand )
{
ChartProperty.m_nCharacterSpacing = PROP_DEF;
}
else
{
bool bResult ;
bResult = RtfShadingCharCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, ChartProperty.m_poShading);
if( true == bResult )
return true;
if( true == bLookOnBorder )
{
bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, ChartProperty.m_poBorder);
if( true == bResult )
return true;
}
return false;
}
return true;
}
bool PictureReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
{
if( _T("pict") == sCommand )
......@@ -162,7 +997,7 @@ bool PictureReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CS
else if( _T("pngblip") == sCommand )
m_oShape.m_oPicture->eDataType = RtfPicture::dt_png;
else if( _T("jpegblip") == sCommand )
m_oShape.m_oPicture->eDataType = RtfPicture::dt_png;
m_oShape.m_oPicture->eDataType = RtfPicture::dt_jpg;
else if( _T("wmetafile") == sCommand )
{
if( true == hasParameter && 8 == parameter )
......@@ -354,6 +1189,54 @@ bool OleReader::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CStrin
return true;
}
bool RtfOldListReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader, CString sKey, bool bHasPar, int nPar )
{
if( _T("pn") == sKey )
return true;
else if( _T("pnlvlblt") == sKey )
{
m_oTarget.m_eLevelType = RtfOldList::lt_blt;
m_oTarget.m_nIlvl = 0;
}
COMMAND_RTF_INT( _T("pnf"), oReader.m_oState->m_oCharProp.m_nFont, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnfs"), oReader.m_oState->m_oCharProp.m_nFontSize, sKey, bHasPar, nPar )
COMMAND_RTF_BOOL( _T("pnb"), oReader.m_oState->m_oCharProp.m_bBold, sKey, bHasPar, nPar )
COMMAND_RTF_BOOL( _T("pni"), oReader.m_oState->m_oCharProp.m_bItalic, sKey, bHasPar, nPar )
COMMAND_RTF_BOOL( _T("pncaps"), oReader.m_oState->m_oCharProp.m_bCaps, sKey, bHasPar, nPar )
COMMAND_RTF_BOOL( _T("pnstrike"), oReader.m_oState->m_oCharProp.m_bStrike, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnul"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Single)
COMMAND_RTF_INT( _T("pnuld"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Dashed)
COMMAND_RTF_INT( _T("pnuldash"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Dash_dotted)
COMMAND_RTF_INT( _T("pnuldashdd"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Dash_dot_dotted)
COMMAND_RTF_INT( _T("pnulth"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Thick)
COMMAND_RTF_INT( _T("pnulwave"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Wave)
COMMAND_RTF_INT( _T("pnuldb"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Double)
COMMAND_RTF_INT( _T("pnulnone"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_none)
COMMAND_RTF_INT( _T("pnulnone"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Word)
COMMAND_RTF_INT( _T("pnindent"), m_oTarget.m_oLevelText->m_oProperty.m_nIndLeft, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnsp"), m_oTarget.m_oLevelText->m_oProperty.m_nIndLeft, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnstart"), m_oTarget.m_oLevelText->m_oProperty.m_nIndLeft, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnhang"), m_oTarget.m_oLevelText->m_oProperty.m_nIndLeft, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnqc"), m_oTarget.m_eLevelJust, sKey, true, RtfOldList::lj_center )
COMMAND_RTF_INT( _T("pnql"), m_oTarget.m_eLevelJust, sKey, true, RtfOldList::lj_left )
COMMAND_RTF_INT( _T("pnqr"), m_oTarget.m_eLevelJust, sKey, true, RtfOldList::lj_right )
else if( _T("pntxtb") == sKey )
{
CString sNumberingText;
TextReader oTextReader( sNumberingText, false );
StartSubReader( oTextReader, oDocument, oReader );
RtfCharPtr oNewChar = RtfCharPtr( new RtfChar() );
oNewChar->setText( sNumberingText );
m_oTarget.m_oLevelText->AddItem( oNewChar );
}
else
return false;
return true;
}
bool ParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,RtfAbstractReader& oAbstrReader,CString sCommand, bool hasParameter, int parameter)
{
m_oReader = &oReader;
......@@ -1094,13 +1977,15 @@ bool ParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfReader&
oNewChar->m_eType = RtfCharSpecial::rsc_page;
oNewChar->m_oProperty = oReader.m_oState->m_oCharProp;
m_oCurParagraph->AddItem( oNewChar );
m_oCurParagraph->m_oProperty = oReader.m_oState->m_oParagraphProp;
m_oCurParagraph->m_oOldList = RtfOldListPtr( new RtfOldList() );
*m_oCurParagraph->m_oOldList = oReader.m_oState->m_oCurOldList;
m_oCurParagraph->m_oProperty.m_oCharProperty = oReader.m_oState->m_oCharProp;
AddItem( m_oCurParagraph, oReader, false, false );
m_oCurParagraph = RtfParagraphPtr(new RtfParagraph());
//Microsoft (Demo-Hayden-Management-v2).docx
//после разрыва могут быть и графические элементы .. их надо оставить в ЭТОМ же параграфе
//разрыв страницы со следующего параграфа ..
//m_oCurParagraph->m_oProperty = oReader.m_oState->m_oParagraphProp;
//m_oCurParagraph->m_oOldList = RtfOldListPtr( new RtfOldList() );
//*m_oCurParagraph->m_oOldList = oReader.m_oState->m_oCurOldList;
//m_oCurParagraph->m_oProperty.m_oCharProperty = oReader.m_oState->m_oCharProp;
//AddItem( m_oCurParagraph, oReader, false, false );
//m_oCurParagraph = RtfParagraphPtr(new RtfParagraph());
}
COMMAND_RTF_SPECIAL_CHAR( _T("column"), m_oCurParagraph, sCommand, hasParameter, RtfCharSpecial::rsc_column )
COMMAND_RTF_SPECIAL_CHAR( _T("line"), m_oCurParagraph, sCommand, hasParameter, RtfCharSpecial::rsc_line )
......@@ -1373,3 +2258,260 @@ void ParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oReade
oCurRowProperty = oReader.m_oState->m_oRowProperty;
}
}
void ParagraphPropDestination::Finalize( RtfReader& oReader/*, RtfSectionPtr pSection*/)
{
if( false == m_bPar )// потому что это не reader и нужно как-то загонять последний параграф
{
m_oCurParagraph->m_oProperty = oReader.m_oState->m_oParagraphProp;
//m_oCurParagraph->m_oProperty.m_pSection = pSection;
m_oCurParagraph->m_oOldList = RtfOldListPtr( new RtfOldList() );
*m_oCurParagraph->m_oOldList = oReader.m_oState->m_oCurOldList;
m_oCurParagraph->m_oProperty.m_oCharProperty = oReader.m_oState->m_oCharProp;
AddItem( m_oCurParagraph, oReader, false, false );
m_oCurParagraph = RtfParagraphPtr(new RtfParagraph());
}
else
{
//if (pSection)
// m_oCurParagraph->m_oProperty.m_pSection = pSection;
}
}
void ShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( RtfDocument& oDocument, RtfReader& oReader )
{
RtfAbstractReader::PopState( oDocument, oReader );
if( _T("") == m_sPropValue )
return;
CString sValue = m_sPropValue;
if( _T("wzName") == m_sPropName )
{
m_oShape.m_sName = sValue;
return;
}
else if( _T("pibName") == m_sPropName )
{
return;
}
else if( _T("wzDescription") == m_sPropName )
{
m_oShape.m_sDescription = sValue;
return;
}
else if( _T("gtextUNICODE") == m_sPropName )
{
m_oShape.m_sGtextUNICODE = sValue;
return;
}
else if( _T("gtextFont") == m_sPropName )
{
m_oShape.m_sGtextFont = sValue;
return;
}
//числовые
int nValue = 0;
try
{
nValue = Strings::ToInteger( sValue );
}catch(...)
{
}
if( _T("shapeType") == m_sPropName )
m_oShape.m_nShapeType = nValue;
//Position absolute
else if( _T("posh") == m_sPropName )
m_oShape.m_nPositionH = nValue;
else if( _T("posrelh") == m_sPropName )
m_oShape.m_nPositionHRelative = nValue;
else if( _T("posv") == m_sPropName )
m_oShape.m_nPositionV = nValue;
else if( _T("posrelv") == m_sPropName )
m_oShape.m_nPositionVRelative = nValue;
else if( _T("fLayoutInCell") == m_sPropName )
m_oShape.m_bLayoutInCell = nValue;
else if( _T("fAllowOverlap") == m_sPropName )
m_oShape.m_bAllowOverlap = nValue;
//Position relative
else if( _T("pctHorizPos") == m_sPropName )
m_oShape.m_nPositionHPct = nValue;
else if( _T("pctVertPos") == m_sPropName )
m_oShape.m_nPositionVPct = nValue;
else if( _T("pctHoriz") == m_sPropName )
m_oShape.m_nPctWidth = nValue;
else if( _T("pctVert") == m_sPropName )
m_oShape.m_nPctHeight = nValue;
else if( _T("sizerelh") == m_sPropName )
m_oShape.m_nPctWidthRelative = nValue;
else if( _T("sizerelv") == m_sPropName )
m_oShape.m_nPctHeightRelative = nValue;
else if( _T("colStart") == m_sPropName )
m_oShape.m_nColStart = nValue;
//Rehydration
else if( _T("metroBlob") == m_sPropName )
m_oShape.m_sMetroBlob = sValue;
//Object Type
else if( _T("fIsBullet") == m_sPropName )
m_oShape.m_bIsBullet = nValue;
else if( _T("rotation") == m_sPropName )
m_oShape.m_nRotation = nValue;
else if( _T("fFlipV") == m_sPropName )
m_oShape.m_bFlipV = nValue;
else if( _T("fFlipH") == m_sPropName )
m_oShape.m_bFlipH = nValue;
else if( _T("shapeType") == m_sPropName )
m_oShape.m_nShapeType = nValue;
else if( _T("pWrapPolygonVertices") == m_sPropName )
{
CString sWrapPair;
int nPosition = 0;
int nCount=0;
while(true)
{
sWrapPair = sValue.Tokenize(_T(";"),nPosition);
if( _T("") == sWrapPair )
break;
nCount++;
if( nCount > 2 )
{
int nSubPos = 0;
CString sWrapPoint = sWrapPair.Tokenize( _T(","), nSubPos);
sWrapPoint.Remove('(');
int nWrapPoint = Strings::ToInteger(sWrapPoint);
m_oShape.m_aWrapPoints.push_back( nWrapPoint );
sWrapPoint = sWrapPair.Tokenize( _T(","), nSubPos);
sWrapPoint.Remove(')');
nWrapPoint = Strings::ToInteger(sWrapPoint);
m_oShape.m_aWrapPoints.push_back( nWrapPoint );
}
}
}
else if( _T("dxWrapDistLeft") == m_sPropName )
m_oShape.m_nWrapDistLeft = RtfUtility::Emu2Twips( nValue );
else if( _T("dyWrapDistTop") == m_sPropName )
m_oShape.m_nWrapDistTop = RtfUtility::Emu2Twips( nValue );
else if( _T("dxWrapDistRight") == m_sPropName )
m_oShape.m_nWrapDistRight = RtfUtility::Emu2Twips( nValue );
else if( _T("dyWrapDistBottom") == m_sPropName )
m_oShape.m_nWrapDistBottom = RtfUtility::Emu2Twips( nValue );
else if( _T("fBehindDocument") == m_sPropName )
m_oShape.m_nZOrderRelative = nValue;
else if( _T("fHidden") == m_sPropName )
m_oShape.m_bHidden = nValue;
//Text box
else if( _T("dxTextLeft") == m_sPropName )
m_oShape.m_nTexpLeft = nValue;
else if( _T("dyTextTop") == m_sPropName )
m_oShape.m_nTexpTop = nValue;
else if( _T("dxTextRight") == m_sPropName )
m_oShape.m_nTexpRight = nValue;
else if( _T("dyTextBottom") == m_sPropName )
m_oShape.m_nTexpBottom = nValue;
else if( _T("anchorText") == m_sPropName )
m_oShape.m_nAnchorText = nValue;
//Geometry
else if( _T("adjustValue") == m_sPropName )
m_oShape.m_nAdjustValue = nValue;
else if( _T("adjust2Value") == m_sPropName )
m_oShape.m_nAdjustValue2 = nValue;
else if( _T("adjust3Value") == m_sPropName )
m_oShape.m_nAdjustValue3 = nValue;
else if( _T("adjust4Value") == m_sPropName )
m_oShape.m_nAdjustValue4 = nValue;
else if( _T("adjust5Value") == m_sPropName )
m_oShape.m_nAdjustValue5 = nValue;
else if( _T("adjust6Value") == m_sPropName )
m_oShape.m_nAdjustValue6 = nValue;
else if( _T("adjust7Value") == m_sPropName )
m_oShape.m_nAdjustValue7 = nValue;
else if( _T("adjust8Value") == m_sPropName )
m_oShape.m_nAdjustValue8 = nValue;
else if( _T("adjust9Value") == m_sPropName )
m_oShape.m_nAdjustValue9 = nValue;
else if( _T("adjust10Value") == m_sPropName )
m_oShape.m_nAdjustValue10 = nValue;
//WordArt Effects
else if( _T("cropFromTop") == m_sPropName )
m_oShape.m_nCropFromTop = nValue;
else if( _T("cropFromBottom") == m_sPropName )
m_oShape.m_nCropFromBottom = nValue;
else if( _T("cropFromLeft") == m_sPropName )
m_oShape.m_nCropFromRight = nValue;
else if( _T("cropFromRight") == m_sPropName )
m_oShape.m_nCropFromTop = nValue;
//Grouped Shapes
else if( _T("groupBottom") == m_sPropName )
m_oShape.m_nGroupBottom = nValue;
else if( _T("groupLeft") == m_sPropName )
m_oShape.m_nGroupLeft = nValue;
else if( _T("groupRight") == m_sPropName )
m_oShape.m_nGroupRight = nValue;
else if( _T("groupTop") == m_sPropName )
m_oShape.m_nGroupTop = nValue;
else if( _T("relBottom") == m_sPropName )
m_oShape.m_nRelBottom = nValue;
else if( _T("relLeft") == m_sPropName )
m_oShape.m_nRelLeft = nValue;
else if( _T("relRight") == m_sPropName )
m_oShape.m_nRelRight = nValue;
else if( _T("relTop") == m_sPropName )
m_oShape.m_nRelTop = nValue;
else if( _T("relRotation") == m_sPropName )
m_oShape.m_nRelRotation = nValue;
else if( _T("dhgt") == m_sPropName )
m_oShape.m_nRelZOrder = nValue;
//Fill
else if( _T("fFilled") == m_sPropName )
m_oShape.m_bFilled = (0 == nValue ? false : true );
else if( _T("fillType") == m_sPropName )
m_oShape.m_nFillType = nValue;
else if( _T("fillColor") == m_sPropName )
m_oShape.m_nFillColor = nValue;
else if( _T("fillBackColor") == m_sPropName )
m_oShape.m_nFillColor2 = nValue;
else if( _T("fillOpacity") == m_sPropName )
m_oShape.m_nFillOpacity = nValue * 100 / 65536;
else if( _T("fillAngle") == m_sPropName )
m_oShape.m_nFillAngle = nValue / 65536;
else if( _T("fillFocus") == m_sPropName )
m_oShape.m_nFillFocus = nValue;
else if( _T("fGtext") == m_sPropName )
m_oShape.m_bGtext = nValue;
else if( _T("gtextSize") == m_sPropName )
m_oShape.m_nGtextSize = nValue;
//Line
else if( _T("fLine") == m_sPropName )
m_oShape.m_bLine = ( 0 == nValue ? false : true );
else if( _T("lineStartArrowhead") == m_sPropName )
m_oShape.m_nLineStartArrow = nValue;
else if( _T("lineColor") == m_sPropName )
m_oShape.m_nLineColor = nValue;
else if( _T("lineStartArrowWidth") == m_sPropName )
m_oShape.m_nLineStartArrowWidth = nValue;
else if( _T("lineStartArrowLength") == m_sPropName )
m_oShape.m_nLineStartArrowLength = nValue;
else if( _T("lineEndArrowhead") == m_sPropName )
m_oShape.m_nLineEndArrow = nValue;
else if( _T("lineEndArrowWidth") == m_sPropName )
m_oShape.m_nLineEndArrowWidth = nValue;
else if( _T("lineEndArrowLength") == m_sPropName )
m_oShape.m_nLineEndArrowLength = nValue;
else if( _T("lineWidth") == m_sPropName )
m_oShape.m_nLineWidth = nValue;
else if( _T("lineDashing") == m_sPropName )
m_oShape.m_nLineDashing = nValue;
else
{
std::wstring name = m_sPropName.GetBuffer();
int val = nValue;
}
}
\ No newline at end of file
......@@ -168,205 +168,33 @@ public:static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CSt
class RtfShadingCommand
{
public:
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput )
{
if( _T("bghoriz") == sCommand )
oOutput.m_eType = RtfShading::st_chbghoriz;
else if( _T("bgvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgvert;
else if( _T("bgfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgfdiag;
else if( _T("bgbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgbdiag;
else if( _T("bgcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgcross;
else if( _T("bgdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdcross;
else if( _T("bgdkhoriz") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkhoriz;
else if( _T("bgdkvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkvert;
else if( _T("bgdkfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkfdiag;
else if( _T("bgdkbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkbdiag;
else if( _T("bgdkcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkcross;
else if( _T("bgdkdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkdcross;
else if( _T("cfpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nForeColor = parameter;
}
else if( _T("cbpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nBackColor = parameter;
}
else if( _T("shading") == sCommand )
{
if( true == hasParameter )
oOutput.m_nValue = parameter;
}
else
return false;
return true;
}
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput );
};
class RtfShadingCellCommand
{
public:
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput)
{
//для свойст таблицы и для стилей таблицы
if( _T("clshdrawnil") == sCommand )
oOutput.m_eType = RtfShading::st_clshdrawnil;
else if( _T("rawclbgvert") == sCommand || _T("clbgvert") == sCommand || _T("tsbgvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgvert;
else if( _T("rawclbgfdiag") == sCommand || _T("clbgfdiag") == sCommand || _T("tsbgfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgfdiag;
else if( _T("rawclbgbdiag") == sCommand || _T("clbgbdiag") == sCommand || _T("tsbgbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgbdiag;
else if( _T("rawclbgcross") == sCommand || _T("clbgcross") == sCommand || _T("tsbgcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgcross;
else if( _T("rawclbgdcross") == sCommand || _T("clbgdcross") == sCommand || _T("tsbgdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdcross;
else if( _T("rawclbgdkhor") == sCommand || _T("clbgdkhor") == sCommand || _T("tsbgdkhor") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkhoriz;
else if( _T("rawclbgdkvert") == sCommand || _T("clbgdkvert") == sCommand || _T("tsbgdkvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkvert;
else if( _T("rawclbgdkfdiag") == sCommand || _T("clbgdkfdiag") == sCommand || _T("tsbgdkfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkfdiag;
else if( _T("rawclbgdkbdiag") == sCommand || _T("clbgdkbdiag") == sCommand || _T("tsbgdkbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkbdiag;
else if( _T("rawclbgdkcross") == sCommand || _T("clbgdkcross") == sCommand || _T("tsbgdkcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkcross;
else if( _T("rawclbgdkdcross") == sCommand || _T("clbgdkdcross") == sCommand || _T("tsbgdkdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkdcross;
COMMAND_RTF_INT( _T("clcfpat"), oOutput.m_nForeColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("clcbpat"), oOutput.m_nBackColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("clcfpatraw"), oOutput.m_nForeColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("clcbpatraw"), oOutput.m_nBackColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("tscellcfpat"), oOutput.m_nForeColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("tscellcbpat"), oOutput.m_nBackColor, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("clshdng"), oOutput.m_nValue, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("clshdngraw"), oOutput.m_nValue, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("tscellpct"), oOutput.m_nValue, sCommand, hasParameter, parameter )
else
return false;
if (sCommand == _T("clshdng")) oReader.m_oState->m_oCellProperty.m_nShadingPctFrom = 1;
if (sCommand == _T("clshdngraw")) oReader.m_oState->m_oCellProperty.m_nShadingPctFrom = 2;
return true;
}
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput);
};
class RtfShadingCharCommand
{
public:
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput )
{
if( _T("chbghoriz") == sCommand )
oOutput.m_eType = RtfShading::st_chbghoriz;
else if( _T("chbgvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgvert;
else if( _T("chbgfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgfdiag;
else if( _T("chbgbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgbdiag;
else if( _T("chbgcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgcross;
else if( _T("chbgdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdcross;
else if( _T("chbgdkhoriz") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkhoriz;
else if( _T("chbgdkvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkvert;
else if( _T("chbgdkfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkfdiag;
else if( _T("chbgdkbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkbdiag;
else if( _T("chbgdkcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkcross;
else if( _T("chbgdkdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkdcross;
else if( _T("chcfpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nForeColor = parameter;
}
else if( _T("chcbpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nBackColor = parameter;
}
else if( _T("chshdng") == sCommand )
{
if( true == hasParameter )
oOutput.m_nValue = parameter;
}
else
return false;
return true;
}
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput );
};
class RtfShadingRowCommand
{
public:
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput)
{
if( _T("trbghoriz") == sCommand )
oOutput.m_eType = RtfShading::st_chbghoriz;
else if( _T("trbgvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgvert;
else if( _T("trbgfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgfdiag;
else if( _T("trbgbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgbdiag;
else if( _T("trbgcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgcross;
else if( _T("trbgdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdcross;
else if( _T("trbgdkhor") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkhoriz;
else if( _T("trbgdkvert") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkvert;
else if( _T("trbgdkfdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkfdiag;
else if( _T("trbgdkbdiag") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkbdiag;
else if( _T("trbgdkcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkcross;
else if( _T("trbgdkdcross") == sCommand )
oOutput.m_eType = RtfShading::st_chbgdkdcross;
else if( _T("trcfpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nForeColor = parameter;
}
else if( _T("trcbpat") == sCommand )
{
if( true == hasParameter )
oOutput.m_nBackColor = parameter;
}
else if( _T("trshdng") == sCommand )
{
if( true == hasParameter )
oOutput.m_nValue = parameter;
}
else
return false;
return true;
}
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfShading& oOutput);
};
class RtfFrameCommand
{
public:static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfFrame& oOutput )
{
return true;
}
public:
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfFrame& oOutput )
{
return true;
}
};
//class RtfOldList;
class TextReader: public RtfAbstractReader
......@@ -389,112 +217,7 @@ class RtfCharPropCommand
{
//bool bLookOnBorder; Надо ли читать свойства border( актуалЃEЃEдля ParagraphReader )
public:
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfCharProperty & ChartProperty, bool bLookOnBorder = true)
{
if( _T("plain") == sCommand )
oReader.m_oState->m_oCharProp.SetDefaultRtf();
COMMAND_RTF_INT( _T("animtext") , ChartProperty.m_nAnimated, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("uc") , oReader.m_oState->m_nUD, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("b") , ChartProperty.m_bBold, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("caps") , ChartProperty.m_bCaps, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("charscalex"), ChartProperty.m_nScalex, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("cs") , ChartProperty.m_nCharStyle, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("down") , ChartProperty.m_nDown, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("embo") , ChartProperty.m_bEmbo, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("expndtw") , ChartProperty.m_nCharacterSpacing, sCommand, hasParameter, parameter)
else if( _T("expnd") == sCommand )
{
if( true == hasParameter )
ChartProperty.m_nCharacterSpacing = 5 * parameter; //quater -points
}
COMMAND_RTF_INT( _T("fittext") , ChartProperty.m_nFitText, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("f") , ChartProperty.m_nFont, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("fs") , ChartProperty.m_nFontSize, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("i") , ChartProperty.m_bItalic, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("impr") , ChartProperty.m_bImprint, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("kerning") , ChartProperty.m_nKerning, sCommand, hasParameter, parameter)
else if( _T("ltrch") == sCommand )
{
if( false == hasParameter || 0 != parameter )
ChartProperty.m_bRightToLeft = 0;
else
ChartProperty.m_bRightToLeft = 1;
}
COMMAND_RTF_BOOL( _T("rtlch"), ChartProperty.m_bRightToLeft, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("lang"), ChartProperty.m_nLanguage , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("cs"), ChartProperty.m_nComplexScript, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("outl"), ChartProperty.m_bOutline , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("scaps"), ChartProperty.m_bScaps , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("shad"), ChartProperty.m_bShadow , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("strike"), ChartProperty.m_bStrike , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("striked"), ChartProperty.m_nStriked , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("sub"), ChartProperty.m_bSub , sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("super"), ChartProperty.m_bSuper , sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("highlight"), ChartProperty.m_nHightlited , sCommand, hasParameter, parameter)
else if( _T("cf") == sCommand )
{
if( true == hasParameter )
ChartProperty.m_nForeColor = parameter;
else
ChartProperty.m_nForeColor= PROP_DEF;
}
else if( _T("ul") == sCommand )
{
if( true == hasParameter && 0 == parameter)
ChartProperty.m_eUnderStyle = RtfCharProperty::uls_none;
else
ChartProperty.m_eUnderStyle = RtfCharProperty::uls_Single;
}
//COMMAND_RTF_BOOL( _T("ul"), ChartProperty.m_bUnderline, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("ulc"), ChartProperty.m_nUnderlineColor, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("uld"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dotted)
COMMAND_RTF_INT( _T("uldash"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dashed)
COMMAND_RTF_INT( _T("uldashd"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dash_dotted)
COMMAND_RTF_INT( _T("uldashdd"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Dash_dot_dotted)
COMMAND_RTF_INT( _T("uldb"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Double)
COMMAND_RTF_INT( _T("ulhwave"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Heavy_wave)
COMMAND_RTF_INT( _T("ulldash"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Long_dashe)
COMMAND_RTF_INT( _T("ulnone"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_none)
COMMAND_RTF_INT( _T("ulth"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick)
COMMAND_RTF_INT( _T("ulthd"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dotted)
COMMAND_RTF_INT( _T("ulthdash"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dashed)
COMMAND_RTF_INT( _T("ulthdashd"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dash_dotted)
COMMAND_RTF_INT( _T("ulthdashdd"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_dash_dot_dotted)
COMMAND_RTF_INT( _T("ulthldash"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Thick_long_dashed)
COMMAND_RTF_INT( _T("ululdbwave"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Double_wave)
COMMAND_RTF_INT( _T("ulw"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Word)
COMMAND_RTF_INT( _T("ulwave"), ChartProperty.m_eUnderStyle, sCommand, true, RtfCharProperty::uls_Wave)
COMMAND_RTF_INT( _T("up"), ChartProperty.m_nUp, sCommand, hasParameter, parameter)
else if( _T("nosupersub") == sCommand )
{
ChartProperty.m_bSub = 0;
ChartProperty.m_bSuper = 0;
}
else if( _T("nosectexpand") == sCommand )
{
ChartProperty.m_nCharacterSpacing = PROP_DEF;
}
else
{
bool bResult ;
bResult = RtfShadingCharCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, ChartProperty.m_poShading);
if( true == bResult )
return true;
if( true == bLookOnBorder )
{
bResult = RtfBorderCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter, ChartProperty.m_poBorder);
if( true == bResult )
return true;
}
return false;
}
return true;
}
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter, RtfCharProperty & ChartProperty, bool bLookOnBorder = true);
};
//Reader выражения в скобках
class RtfOldListReader : public RtfAbstractReader
......@@ -505,54 +228,7 @@ public:
RtfOldListReader( RtfOldList& oTarget) : m_oTarget(oTarget)
{
}
bool ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader, CString sKey, bool bHasPar, int nPar )
{
if( _T("pn") == sKey )
return true;
else if( _T("pnlvlblt") == sKey )
{
m_oTarget.m_eLevelType = RtfOldList::lt_blt;
m_oTarget.m_nIlvl = 0;
}
COMMAND_RTF_INT( _T("pnf"), oReader.m_oState->m_oCharProp.m_nFont, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnfs"), oReader.m_oState->m_oCharProp.m_nFontSize, sKey, bHasPar, nPar )
COMMAND_RTF_BOOL( _T("pnb"), oReader.m_oState->m_oCharProp.m_bBold, sKey, bHasPar, nPar )
COMMAND_RTF_BOOL( _T("pni"), oReader.m_oState->m_oCharProp.m_bItalic, sKey, bHasPar, nPar )
COMMAND_RTF_BOOL( _T("pncaps"), oReader.m_oState->m_oCharProp.m_bCaps, sKey, bHasPar, nPar )
COMMAND_RTF_BOOL( _T("pnstrike"), oReader.m_oState->m_oCharProp.m_bStrike, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnul"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Single)
COMMAND_RTF_INT( _T("pnuld"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Dashed)
COMMAND_RTF_INT( _T("pnuldash"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Dash_dotted)
COMMAND_RTF_INT( _T("pnuldashdd"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Dash_dot_dotted)
COMMAND_RTF_INT( _T("pnulth"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Thick)
COMMAND_RTF_INT( _T("pnulwave"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Wave)
COMMAND_RTF_INT( _T("pnuldb"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Double)
COMMAND_RTF_INT( _T("pnulnone"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_none)
COMMAND_RTF_INT( _T("pnulnone"), oReader.m_oState->m_oCharProp.m_eUnderStyle, sKey, true, RtfCharProperty::uls_Word)
COMMAND_RTF_INT( _T("pnindent"), m_oTarget.m_oLevelText->m_oProperty.m_nIndLeft, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnsp"), m_oTarget.m_oLevelText->m_oProperty.m_nIndLeft, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnstart"), m_oTarget.m_oLevelText->m_oProperty.m_nIndLeft, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnhang"), m_oTarget.m_oLevelText->m_oProperty.m_nIndLeft, sKey, bHasPar, nPar )
COMMAND_RTF_INT( _T("pnqc"), m_oTarget.m_eLevelJust, sKey, true, RtfOldList::lj_center )
COMMAND_RTF_INT( _T("pnql"), m_oTarget.m_eLevelJust, sKey, true, RtfOldList::lj_left )
COMMAND_RTF_INT( _T("pnqr"), m_oTarget.m_eLevelJust, sKey, true, RtfOldList::lj_right )
else if( _T("pntxtb") == sKey )
{
CString sNumberingText;
TextReader oTextReader( sNumberingText, false );
StartSubReader( oTextReader, oDocument, oReader );
RtfCharPtr oNewChar = RtfCharPtr( new RtfChar() );
oNewChar->setText( sNumberingText );
m_oTarget.m_oLevelText->AddItem( oNewChar );
}
else
return false;
return true;
}
bool ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader, CString sKey, bool bHasPar, int nPar );
void ExitReader( RtfDocument& oDocument, RtfReader& oReader )
{
m_oTarget.m_oLevelText->m_oProperty.m_oCharProperty = oReader.m_oState->m_oCharProp;
......@@ -1290,208 +966,7 @@ class ShapeReader : public RtfAbstractReader
}
return true;
}
void PopState( RtfDocument& oDocument, RtfReader& oReader )
{
RtfAbstractReader::PopState( oDocument, oReader );
if( _T("") == m_sPropValue )
return;
CString sValue = m_sPropValue;
if( _T("wzName") == m_sPropName )
{
m_oShape.m_sName = sValue;
return;
}
else if( _T("pibName") == m_sPropName )
{
return;
}
else if( _T("wzDescription") == m_sPropName )
{
m_oShape.m_sDescription = sValue;
return;
}
//числовые
int nValue = 0;
try
{
nValue = Strings::ToInteger( sValue );
}catch(...)
{
}
if( _T("shapeType") == m_sPropName )
m_oShape.m_nShapeType = nValue;
//Position absolute
else if( _T("posh") == m_sPropName )
m_oShape.m_nPositionH = nValue;
else if( _T("posrelh") == m_sPropName )
m_oShape.m_nPositionHRelative = nValue;
else if( _T("posv") == m_sPropName )
m_oShape.m_nPositionV = nValue;
else if( _T("posrelv") == m_sPropName )
m_oShape.m_nPositionVRelative = nValue;
else if( _T("fLayoutInCell") == m_sPropName )
m_oShape.m_bLayoutInCell = nValue;
else if( _T("fAllowOverlap") == m_sPropName )
m_oShape.m_bAllowOverlap = nValue;
//Position relative
else if( _T("pctHorizPos") == m_sPropName )
m_oShape.m_nPositionHPct = nValue;
else if( _T("pctVertPos") == m_sPropName )
m_oShape.m_nPositionVPct = nValue;
else if( _T("pctHoriz") == m_sPropName )
m_oShape.m_nPctWidth = nValue;
else if( _T("pctVert") == m_sPropName )
m_oShape.m_nPctHeight = nValue;
else if( _T("sizerelh") == m_sPropName )
m_oShape.m_nPctWidthRelative = nValue;
else if( _T("sizerelv") == m_sPropName )
m_oShape.m_nPctHeightRelative = nValue;
else if( _T("colStart") == m_sPropName )
m_oShape.m_nColStart = nValue;
//Rehydration
else if( _T("metroBlob") == m_sPropName )
m_oShape.m_sMetroBlob = sValue;
//Object Type
else if( _T("fIsBullet") == m_sPropName )
m_oShape.m_bIsBullet = nValue;
else if( _T("rotation") == m_sPropName )
m_oShape.m_nRotation = nValue;
else if( _T("fFlipV") == m_sPropName )
m_oShape.m_bFlipV = nValue;
else if( _T("fFlipH") == m_sPropName )
m_oShape.m_bFlipH = nValue;
else if( _T("shapeType") == m_sPropName )
m_oShape.m_nShapeType = nValue;
else if( _T("pWrapPolygonVertices") == m_sPropName )
{
CString sWrapPair;
int nPosition = 0;
int nCount=0;
while(true)
{
sWrapPair = sValue.Tokenize(_T(";"),nPosition);
if( _T("") == sWrapPair )
break;
nCount++;
if( nCount > 2 )
{
int nSubPos = 0;
CString sWrapPoint = sWrapPair.Tokenize( _T(","), nSubPos);
sWrapPoint.Remove('(');
int nWrapPoint = Strings::ToInteger(sWrapPoint);
m_oShape.m_aWrapPoints.push_back( nWrapPoint );
sWrapPoint = sWrapPair.Tokenize( _T(","), nSubPos);
sWrapPoint.Remove(')');
nWrapPoint = Strings::ToInteger(sWrapPoint);
m_oShape.m_aWrapPoints.push_back( nWrapPoint );
}
}
}
else if( _T("dxWrapDistLeft") == m_sPropName )
m_oShape.m_nWrapDistLeft = RtfUtility::Emu2Twips( nValue );
else if( _T("dyWrapDistTop") == m_sPropName )
m_oShape.m_nWrapDistTop = RtfUtility::Emu2Twips( nValue );
else if( _T("dxWrapDistRight") == m_sPropName )
m_oShape.m_nWrapDistRight = RtfUtility::Emu2Twips( nValue );
else if( _T("dyWrapDistBottom") == m_sPropName )
m_oShape.m_nWrapDistBottom = RtfUtility::Emu2Twips( nValue );
else if( _T("fBehindDocument") == m_sPropName )
m_oShape.m_nZOrderRelative = nValue;
else if( _T("fHidden") == m_sPropName )
m_oShape.m_bHidden = nValue;
//Text box
else if( _T("dxTextLeft") == m_sPropName )
m_oShape.m_nTexpLeft = nValue;
else if( _T("dyTextTop") == m_sPropName )
m_oShape.m_nTexpTop = nValue;
else if( _T("dxTextRight") == m_sPropName )
m_oShape.m_nTexpRight = nValue;
else if( _T("dyTextBottom") == m_sPropName )
m_oShape.m_nTexpBottom = nValue;
//Geometry
else if( _T("adjustValue") == m_sPropName )
m_oShape.m_nAdjustValue = nValue;
else if( _T("adjust2Value") == m_sPropName )
m_oShape.m_nAdjustValue2 = nValue;
else if( _T("adjust3Value") == m_sPropName )
m_oShape.m_nAdjustValue3 = nValue;
else if( _T("adjust4Value") == m_sPropName )
m_oShape.m_nAdjustValue4 = nValue;
else if( _T("adjust5Value") == m_sPropName )
m_oShape.m_nAdjustValue5 = nValue;
else if( _T("adjust6Value") == m_sPropName )
m_oShape.m_nAdjustValue6 = nValue;
else if( _T("adjust7Value") == m_sPropName )
m_oShape.m_nAdjustValue7 = nValue;
else if( _T("adjust8Value") == m_sPropName )
m_oShape.m_nAdjustValue8 = nValue;
else if( _T("adjust9Value") == m_sPropName )
m_oShape.m_nAdjustValue9 = nValue;
else if( _T("adjust10Value") == m_sPropName )
m_oShape.m_nAdjustValue10 = nValue;
//WordArt Effects
else if( _T("cropFromTop") == m_sPropName )
m_oShape.m_nCropFromTop = nValue;
else if( _T("cropFromBottom") == m_sPropName )
m_oShape.m_nCropFromBottom = nValue;
else if( _T("cropFromLeft") == m_sPropName )
m_oShape.m_nCropFromRight = nValue;
else if( _T("cropFromRight") == m_sPropName )
m_oShape.m_nCropFromTop = nValue;
//Grouped Shapes
else if( _T("groupBottom") == m_sPropName )
m_oShape.m_nGroupBottom = nValue;
else if( _T("groupLeft") == m_sPropName )
m_oShape.m_nGroupLeft = nValue;
else if( _T("groupRight") == m_sPropName )
m_oShape.m_nGroupRight = nValue;
else if( _T("groupTop") == m_sPropName )
m_oShape.m_nGroupTop = nValue;
else if( _T("relBottom") == m_sPropName )
m_oShape.m_nRelBottom = nValue;
else if( _T("relLeft") == m_sPropName )
m_oShape.m_nRelLeft = nValue;
else if( _T("relRight") == m_sPropName )
m_oShape.m_nRelRight = nValue;
else if( _T("relTop") == m_sPropName )
m_oShape.m_nRelTop = nValue;
else if( _T("relRotation") == m_sPropName )
m_oShape.m_nRelRotation = nValue;
else if( _T("dhgt") == m_sPropName )
m_oShape.m_nRelZOrder = nValue;
//Fill
else if( _T("fFilled") == m_sPropName )
m_oShape.m_bFilled = (0 == nValue ? false : true );
else if( _T("fillType") == m_sPropName )
m_oShape.m_nFillType = nValue;
//Line
else if( _T("fLine") == m_sPropName )
m_oShape.m_bLine = ( 0 == nValue ? false : true );
else if( _T("lineStartArrowhead") == m_sPropName )
m_oShape.m_nLineStartArrow = nValue;
else if( _T("lineStartArrowWidth") == m_sPropName )
m_oShape.m_nLineStartArrowWidth = nValue;
else if( _T("lineStartArrowLength") == m_sPropName )
m_oShape.m_nLineStartArrowLength = nValue;
else if( _T("lineEndArrowhead") == m_sPropName )
m_oShape.m_nLineEndArrow = nValue;
else if( _T("lineEndArrowWidth") == m_sPropName )
m_oShape.m_nLineEndArrowWidth = nValue;
else if( _T("lineEndArrowLength") == m_sPropName )
m_oShape.m_nLineEndArrowLength = nValue;
else if( _T("lineWidth") == m_sPropName )
m_oShape.m_nLineWidth = nValue;
else
{
int val = nValue;
std::wstring name = m_sPropName.GetBuffer();
}
}
void PopState( RtfDocument& oDocument, RtfReader& oReader );
void ExecuteText( RtfDocument& oDocument, RtfReader& oReader, CString oText )
{
CString sValue;
......@@ -2083,18 +1558,9 @@ public:
m_oCurParagraph->AddItem( oNewChar );
}
void AddItem( RtfParagraphPtr oItem, RtfReader& oReader, bool bEndCell, bool bEndRow );
void Finalize( RtfReader& oReader ) // потому что это не reader и нужно как-то загонять последний параграф
{
if( false == m_bPar )
{
m_oCurParagraph->m_oProperty = oReader.m_oState->m_oParagraphProp;
m_oCurParagraph->m_oOldList = RtfOldListPtr( new RtfOldList() );
*m_oCurParagraph->m_oOldList = oReader.m_oState->m_oCurOldList;
m_oCurParagraph->m_oProperty.m_oCharProperty = oReader.m_oState->m_oCharProp;
AddItem( m_oCurParagraph, oReader, false, false );
m_oCurParagraph = RtfParagraphPtr(new RtfParagraph());
}
}
void Finalize( RtfReader& oReader/*, RtfSectionPtr pSection*/);
void ExecuteNumberChar( RtfDocument& oDocument, RtfReader& oReader, RtfAbstractReader& oAbstrReader, int nWinChar, int nMacChar )
{
RtfFont oFont;
......@@ -2154,7 +1620,7 @@ public:
}
void ExitReader( RtfDocument& oDocument, RtfReader& oReader )
{
m_oParPropDest.Finalize( oReader );
m_oParPropDest.Finalize( oReader/*, RtfSectionPtr()*/);
m_oRtfFootnote.m_oContent = m_oParPropDest.m_oTextItems;
oReader.m_nFootnote = PROP_DEF;
}
......@@ -2300,10 +1766,10 @@ class StyleTableReader: public RtfAbstractReader
// RtfTableStyleProperty m_oTableStyleProperty;
public:
RtfStyleReader()
{
m_oCurStyle = RtfParagraphStylePtr( new RtfParagraphStyle() );
m_eInternalState = is_normal;
}
{
m_oCurStyle = RtfParagraphStylePtr( new RtfParagraphStyle() );
m_eInternalState = is_normal;
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader,CString sCommand, bool hasParameter, int parameter)
{
if( _T("s") == sCommand )
......@@ -2832,6 +2298,7 @@ public:
}
};
class ParagraphReader : public RtfAbstractReader
{
private:
......@@ -2857,642 +2324,103 @@ public:
}
void ExitReader( RtfDocument& oDocument, RtfReader& oReader )
{
m_oParPropDest.Finalize( oReader );
m_oParPropDest.Finalize( oReader /*, RtfSectionPtr()*/ );
}
};
class RtfDocumentCommand
{
public:
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, CString sCommand, bool hasParameter, int parameter)
{
if( _T("ansi") == sCommand )
oDocument.m_oProperty.m_eCodePage = RtfDocumentProperty::cp_ansi;
else if( _T("mac") == sCommand )
oDocument.m_oProperty.m_eCodePage = RtfDocumentProperty::cp_mac;
else if( _T("pc") == sCommand )
oDocument.m_oProperty.m_eCodePage = RtfDocumentProperty::cp_pc;
else if( _T("pca") == sCommand )
oDocument.m_oProperty.m_eCodePage = RtfDocumentProperty::cp_pca;
else if( _T("ansicpg") == sCommand )
{
oDocument.m_oProperty.m_eCodePage = RtfDocumentProperty::cp_ansi;
if( true == hasParameter )
{
oDocument.m_oProperty.m_nAnsiCodePage = parameter;
}
}
else if( _T("deff") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nDeffFont = parameter;
oReader.m_nDefFont = parameter;
}
}
COMMAND_RTF_INT( _T("themelang"), oDocument.m_oProperty.m_nThemelang, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("themelangfe"), oDocument.m_oProperty.m_nThemelangfe, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("themelangcs"), oDocument.m_oProperty.m_nThemelangcs, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("rtlgutter"), oDocument.m_oProperty.m_bRtlGutter, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("rtldoc"), oDocument.m_oProperty.m_bRtl, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("hyphcaps"), oDocument.m_oProperty.m_bHypCaps, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("hyphauto"), oDocument.m_oProperty.m_bAutoHyp, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("hyphconsec"), oDocument.m_oProperty.m_nMaxHypen, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("hyphhotz"), oDocument.m_oProperty.m_nHyphenationRight, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("deftab"), oDocument.m_oProperty.m_nTabWidth, sCommand, hasParameter, parameter )
//Page Borders
COMMAND_RTF_BOOL( _T("pgbrdrhead"), oDocument.m_oProperty.m_bDorderSurroundHeader, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("pgbrdrfoot"), oDocument.m_oProperty.m_bDorderSurroundFotter, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("pgbrdrsnap"), oDocument.m_oProperty.m_bAlignBordersAndEdges, sCommand, hasParameter, parameter )
//Page Information
else if( _T("paperw") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nPaperWidth = parameter;
oReader.m_oCurSectionProp.m_nPageWidth = parameter;
}
}
else if( _T("paperh") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nPaperHeight = parameter;
oReader.m_oCurSectionProp.m_nPageHeight = parameter;
}
}
else if( _T("margl") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nMarginLeft = parameter;
oReader.m_oCurSectionProp.m_nMarginLeft = parameter;
}
}
else if( _T("margr") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nMarginRight = parameter;
oReader.m_oCurSectionProp.m_nMarginRight = parameter;
}
}
else if( _T("margt") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nMarginTop = parameter;
oReader.m_oCurSectionProp.m_nMarginTop = parameter;
}
}
else if( _T("margb") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nMarginBottom = parameter;
oReader.m_oCurSectionProp.m_nMarginBottom = parameter;
}
}
else if( _T("facingp") == sCommand )
{
if( true == hasParameter && 0 == parameter )
{
oDocument.m_oProperty.m_bFacingPage = 0;
oReader.m_oCurSectionProp.m_bSwitchMargin = 0;
}
else
{
oDocument.m_oProperty.m_bFacingPage = 1;
oReader.m_oCurSectionProp.m_bSwitchMargin = 1;
}
}
else if( _T("gutter") == sCommand )
{
if( true == hasParameter )
{
oDocument.m_oProperty.m_nGutterWidth = parameter;
oReader.m_oCurSectionProp.m_nGutterMarginWidth = parameter;
}
}
else if( _T("ogutter") == sCommand )
{
if( true == hasParameter )
oDocument.m_oProperty.m_nGutterWidthOutside = parameter;
}
else if( _T("margmirror") == sCommand )
{
if( true == hasParameter && 0 == parameter )
{
oDocument.m_oProperty.m_bSwitchMargins = 0;
oReader.m_oCurSectionProp.m_bLandscapeFormat = 0;
}
else
{
oDocument.m_oProperty.m_bSwitchMargins = 1;
oReader.m_oCurSectionProp.m_bLandscapeFormat = 1;
}
}
else if( _T("landscape") == sCommand )
{
if( true == hasParameter && 0 == parameter )
oDocument.m_oProperty.m_bLandScape = 0;
else
oDocument.m_oProperty.m_bLandScape = 1;
}
COMMAND_RTF_BOOL( _T("gutterprl"), oDocument.m_oProperty.m_bGutterAtTop, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("viewbksp"), oDocument.m_oProperty.m_nDisplayBackground, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("htmautsp"), oDocument.m_oProperty.m_bHtmlAutoSpace, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( _T("useltbaln"), oDocument.m_oProperty.m_bUseTabAlignment, sCommand, hasParameter, parameter )
//Footnotes and Endnotes
COMMAND_RTF_INT( _T("endnotes"), oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_EndSection )
COMMAND_RTF_INT( _T("enddoc"), oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_EndDocument )
COMMAND_RTF_INT( _T("ftntj"), oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_BeneathText )
COMMAND_RTF_INT( _T("ftnbj"), oDocument.m_oProperty.m_eFootnotePlacement, sCommand, true, RtfDocumentProperty::fp_BottomPage )
COMMAND_RTF_INT( _T("aendnotes"), oDocument.m_oProperty.m_eEndnotePlacement, sCommand, true, RtfDocumentProperty::ep_EndSection )
COMMAND_RTF_INT( _T("aenddoc"), oDocument.m_oProperty.m_eEndnotePlacement, sCommand, true, RtfDocumentProperty::ep_EndDocument )
COMMAND_RTF_INT( _T("aftnbj"), oDocument.m_oProperty.m_eEndnotePlacement, sCommand, true, RtfDocumentProperty::ep_BeneathText )
COMMAND_RTF_INT( _T("aftntj"), oDocument.m_oProperty.m_eEndnotePlacement, sCommand, true, RtfDocumentProperty::ep_BottomPage )
COMMAND_RTF_INT( _T("ftnstart"), oDocument.m_oProperty.m_nFootnoteStart, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("aftnstart"), oDocument.m_oProperty.m_nEndnoteStart, sCommand, hasParameter, parameter )
COMMAND_RTF_INT( _T("ftnrstpg"), oDocument.m_oProperty.m_eFootnoteRestart, sCommand, true, RtfDocumentProperty::fr_EachPage )
COMMAND_RTF_INT( _T("ftnrestart"), oDocument.m_oProperty.m_eFootnoteRestart, sCommand, true, RtfDocumentProperty::fr_EachSection )
COMMAND_RTF_INT( _T("ftnrstcont"), oDocument.m_oProperty.m_eFootnoteRestart, sCommand, true, RtfDocumentProperty::fr_Continuous )
COMMAND_RTF_INT( _T("aftnrestart"), oDocument.m_oProperty.m_eEndnoteRestart, sCommand, true, RtfDocumentProperty::er_EachSection )
COMMAND_RTF_INT( _T("aftnrstcont"), oDocument.m_oProperty.m_eEndnoteRestart, sCommand, true, RtfDocumentProperty::er_Continuous )
COMMAND_RTF_INT( _T("ftnnar"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 0 )
COMMAND_RTF_INT( _T("ftnnalc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 4 )
COMMAND_RTF_INT( _T("ftnnauc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 3 )
COMMAND_RTF_INT( _T("ftnnrlc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 2 )
COMMAND_RTF_INT( _T("ftnnruc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 1 )
COMMAND_RTF_INT( _T("ftnnchi"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 70 )
COMMAND_RTF_INT( _T("ftnnchi"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 25 )
COMMAND_RTF_INT( _T("ftnncnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 18 )
COMMAND_RTF_INT( _T("ftnndbnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 10 )
COMMAND_RTF_INT( _T("ftnndbnumd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 11 )
COMMAND_RTF_INT( _T("ftnndbnumt"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 16 )
COMMAND_RTF_INT( _T("ftnndbnumk"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 17 )
COMMAND_RTF_INT( _T("ftnndbar"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 20 )
COMMAND_RTF_INT( _T("ftnnganada"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 24 )
COMMAND_RTF_INT( _T("ftnngbnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 26 )
COMMAND_RTF_INT( _T("ftnngbnumd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 27 )
COMMAND_RTF_INT( _T("ftnngbnuml"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 28 )
COMMAND_RTF_INT( _T("ftnngbnumk"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 29 )
COMMAND_RTF_INT( _T("ftnnzodiac"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 30 )
COMMAND_RTF_INT( _T("ftnnzodiacd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 31 )
COMMAND_RTF_INT( _T("ftnnzodiacl"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 32 )
COMMAND_RTF_INT( _T("aftnnar"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 0 )
COMMAND_RTF_INT( _T("aftnnalc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 4 )
COMMAND_RTF_INT( _T("aftnnauc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 3 )
COMMAND_RTF_INT( _T("aftnnrlc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 2 )
COMMAND_RTF_INT( _T("aftnnruc"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 1 )
COMMAND_RTF_INT( _T("aftnnchi"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 70 )
COMMAND_RTF_INT( _T("aftnnchi"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 25 )
COMMAND_RTF_INT( _T("aftnncnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 18 )
COMMAND_RTF_INT( _T("aftnndbnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 10 )
COMMAND_RTF_INT( _T("aftnndbnumd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 11 )
COMMAND_RTF_INT( _T("aftnndbnumt"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 16 )
COMMAND_RTF_INT( _T("aftnndbnumk"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 17 )
COMMAND_RTF_INT( _T("aftnndbar"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 20 )
COMMAND_RTF_INT( _T("aftnnganada"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 24 )
COMMAND_RTF_INT( _T("aftnngbnum"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 26 )
COMMAND_RTF_INT( _T("aftnngbnumd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 27 )
COMMAND_RTF_INT( _T("aftnngbnuml"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 28 )
COMMAND_RTF_INT( _T("aftnngbnumk"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 29 )
COMMAND_RTF_INT( _T("aftnnzodiac"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 30 )
COMMAND_RTF_INT( _T("aftnnzodiacd"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 31 )
COMMAND_RTF_INT( _T("aftnnzodiacl"), oDocument.m_oProperty.m_nFootnoteNumberingFormat, sCommand, true, 32 )
else
return false;
return true;
}
static bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, CString sCommand, bool hasParameter, int parameter);
};
class RtfSectionCommand
{
private:
typedef enum{ is_none, is_border_left, is_border_top, is_border_right, is_border_bottom }InternalState;
InternalState m_eInternalState;
int nCurCollumnNumber;
public: RtfSectionCommand()
{
m_eInternalState = is_none;
nCurCollumnNumber = PROP_DEF;
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, RtfAbstractReader& oAbstrReader, CString sCommand, bool hasParameter, int parameter)
{
if( _T("11111111") == sCommand )
;
COMMAND_RTF_BOOL( _T("rtlsect"), oReader.m_oCurSectionProp.m_bBidi, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("binfsxn"), oReader.m_oCurSectionProp.m_nPaperSourceFirst, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("binsxn"), oReader.m_oCurSectionProp.m_nPaperSourceOther, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("rtlgutter"), oReader.m_oCurSectionProp.m_bRtlGutter, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("endnhere"), oReader.m_oCurSectionProp.m_bEndnotes, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("ds"), oReader.m_oCurSectionProp.m_nStyle, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("sbknone"), oReader.m_oCurSectionProp.m_eSectionBreak, sCommand, true, RtfSectionProperty::sb_sbknone)
COMMAND_RTF_INT( _T("sbkcol"), oReader.m_oCurSectionProp.m_eSectionBreak, sCommand, true, RtfSectionProperty::sb_sbkcol)
COMMAND_RTF_INT( _T("sbkpage"), oReader.m_oCurSectionProp.m_eSectionBreak, sCommand, true, RtfSectionProperty::sb_sbkpage)
COMMAND_RTF_INT( _T("sbkeven"), oReader.m_oCurSectionProp.m_eSectionBreak, sCommand, true, RtfSectionProperty::sb_sbkeven)
COMMAND_RTF_INT( _T("sbkodd"), oReader.m_oCurSectionProp.m_eSectionBreak, sCommand, true, RtfSectionProperty::sb_sbkodd)
else if( _T("cols") == sCommand )
{
if( true == hasParameter )
{
oReader.m_oCurSectionProp.m_nColumnNumber = parameter;
oReader.m_oCurSectionProp.m_oCollumnProperty.m_aCollumnProperty.resize( parameter );
}
}
COMMAND_RTF_INT( _T("colsx"), oReader.m_oCurSectionProp.m_nColumnSpace, sCommand, hasParameter, parameter)
else if( _T("colno") == sCommand )
{
if( true == hasParameter )
nCurCollumnNumber = parameter - 1;
}
else if( _T("colsr") == sCommand )
{
if( true == hasParameter )
if( nCurCollumnNumber >= 0 && nCurCollumnNumber < (int)oReader.m_oCurSectionProp.m_oCollumnProperty.m_aCollumnProperty.size() )
oReader.m_oCurSectionProp.m_oCollumnProperty.m_aCollumnProperty[ nCurCollumnNumber ].m_nColumnSpaceToRightOfCol = parameter;
}
else if( _T("colw") == sCommand )
{
if( true == hasParameter )
if( nCurCollumnNumber >= 0 && nCurCollumnNumber < (int)oReader.m_oCurSectionProp.m_oCollumnProperty.m_aCollumnProperty.size() )
oReader.m_oCurSectionProp.m_oCollumnProperty.m_aCollumnProperty[ nCurCollumnNumber ].m_nColumnWidth = parameter;
}
COMMAND_RTF_BOOL( _T("linebetcol"), oReader.m_oCurSectionProp.m_bColumnLineBetween, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("sftntj"), oReader.m_oCurSectionProp.m_eFootnotesJust, sCommand, true, RtfSectionProperty::fj_sftntj)
COMMAND_RTF_INT( _T("sftnbj"), oReader.m_oCurSectionProp.m_eFootnotesJust, sCommand, true, RtfSectionProperty::fj_sftnbj)
//Footnotes and Endnotes
COMMAND_RTF_INT( _T("sftnstart"), oReader.m_oCurSectionProp.m_nFootnotesStart, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("sftnrstpg"), oReader.m_oCurSectionProp.m_eFootnotesRestart, sCommand, true, RtfSectionProperty::fr_sftnrstpg)
COMMAND_RTF_INT( _T("sftnrestart"), oReader.m_oCurSectionProp.m_eFootnotesRestart, sCommand, true, RtfSectionProperty::fr_sftnrestart)
COMMAND_RTF_INT( _T("sftnrstcont"), oReader.m_oCurSectionProp.m_eFootnotesRestart, sCommand, true, RtfSectionProperty::fr_sftnrstcont)
COMMAND_RTF_INT( _T("sftnnar"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnar)
COMMAND_RTF_INT( _T("sftnnalc"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnalc)
COMMAND_RTF_INT( _T("sftnnauc"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnauc)
COMMAND_RTF_INT( _T("sftnnrlc"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnrlc)
COMMAND_RTF_INT( _T("sftnnruc"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnruc)
COMMAND_RTF_INT( _T("sftnnchi"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnchi)
COMMAND_RTF_INT( _T("sftnnchosung"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnchosung)
COMMAND_RTF_INT( _T("sftnncnum"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnncnum)
COMMAND_RTF_INT( _T("sftnndbnum"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnndbnum)
COMMAND_RTF_INT( _T("sftnndbnumd"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnndbnumd)
COMMAND_RTF_INT( _T("sftnndbnumt"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnndbnumt)
COMMAND_RTF_INT( _T("sftnndbnumk"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnndbnumk)
COMMAND_RTF_INT( _T("sftnndbar"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnndbar)
COMMAND_RTF_INT( _T("sftnnganada"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnganada)
COMMAND_RTF_INT( _T("sftnngbnum"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnngbnum)
COMMAND_RTF_INT( _T("sftnngbnumd"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnngbnumd)
COMMAND_RTF_INT( _T("sftnngbnuml"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnngbnuml)
COMMAND_RTF_INT( _T("sftnngbnumk"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnngbnumk)
COMMAND_RTF_INT( _T("sftnnzodiac"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnzodiac)
COMMAND_RTF_INT( _T("sftnnzodiacd"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnzodiacd)
COMMAND_RTF_INT( _T("sftnnzodiacl"), oReader.m_oCurSectionProp.m_eFootnotesFormat, sCommand, true, RtfSectionProperty::ff_sftnnzodiacl)
COMMAND_RTF_INT( _T("saftnstart"), oReader.m_oCurSectionProp.m_nEndnotesStart, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("saftnrestart"), oReader.m_oCurSectionProp.m_eEndnotesRestart, sCommand, true, RtfSectionProperty::er_saftnrestart)
COMMAND_RTF_INT( _T("saftnrstcont"), oReader.m_oCurSectionProp.m_eEndnotesRestart, sCommand, true, RtfSectionProperty::er_saftnrstcont)
COMMAND_RTF_INT( _T("saftnnar"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnar)
COMMAND_RTF_INT( _T("saftnnalc"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnalc)
COMMAND_RTF_INT( _T("saftnnauc"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnauc)
COMMAND_RTF_INT( _T("saftnnrlc"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnrlc)
COMMAND_RTF_INT( _T("saftnnruc"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnruc)
COMMAND_RTF_INT( _T("saftnnchi"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnchi)
COMMAND_RTF_INT( _T("saftnnchosung"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnchosung)
COMMAND_RTF_INT( _T("saftnncnum"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnncnum)
COMMAND_RTF_INT( _T("saftnndbnum"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnndbnum)
COMMAND_RTF_INT( _T("saftnndbnumd"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnndbnumd)
COMMAND_RTF_INT( _T("saftnndbnumt"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnndbnumt)
COMMAND_RTF_INT( _T("saftnndbnumk"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnndbnumk)
COMMAND_RTF_INT( _T("saftnndbar"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnndbar)
COMMAND_RTF_INT( _T("saftnnganada"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnganada)
COMMAND_RTF_INT( _T("saftnngbnum"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnngbnum)
COMMAND_RTF_INT( _T("saftnngbnumd"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnngbnumd)
COMMAND_RTF_INT( _T("saftnngbnuml"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnngbnuml)
COMMAND_RTF_INT( _T("saftnngbnumk"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnngbnumk)
COMMAND_RTF_INT( _T("saftnnzodiac"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnzodiac)
COMMAND_RTF_INT( _T("saftnnzodiacd"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnzodiacd)
COMMAND_RTF_INT( _T("saftnnzodiacl"), oReader.m_oCurSectionProp.m_eEndnotesFormat, sCommand, true, RtfSectionProperty::ef_saftnnzodiacl)
//Line Numbering
COMMAND_RTF_INT( _T("linemod"), oReader.m_oCurSectionProp.m_nLineModulus, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("linex"), oReader.m_oCurSectionProp.m_nLineX, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("linestarts"), oReader.m_oCurSectionProp.m_nLineStart, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("linerestart"), oReader.m_oCurSectionProp.m_eLineNumberRestart, sCommand, true, RtfSectionProperty::lnr_linerestart)
COMMAND_RTF_INT( _T("lineppage"), oReader.m_oCurSectionProp.m_eLineNumberRestart, sCommand, true, RtfSectionProperty::lnr_lineppage)
COMMAND_RTF_INT( _T("linecont"), oReader.m_oCurSectionProp.m_eLineNumberRestart, sCommand, true, RtfSectionProperty::lnr_linecont)
//Page Information
COMMAND_RTF_INT( _T("pgwsxn"), oReader.m_oCurSectionProp.m_nPageWidth, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("pghsxn"), oReader.m_oCurSectionProp.m_nPageHeight, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("marglsxn"), oReader.m_oCurSectionProp.m_nMarginLeft, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("margrsxn"), oReader.m_oCurSectionProp.m_nMarginRight, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("margtsxn"), oReader.m_oCurSectionProp.m_nMarginTop, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("margbsxn"), oReader.m_oCurSectionProp.m_nMarginBottom, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("guttersxn"), oReader.m_oCurSectionProp.m_nGutterMarginWidth, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("margmirsxn"), oReader.m_oCurSectionProp.m_bSwitchMargin, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("lndscpsxn"), oReader.m_oCurSectionProp.m_bLandscapeFormat, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("titlepg"), oReader.m_oCurSectionProp.m_bTitlePage, sCommand, hasParameter, parameter)
//else if( _T("headery") == sCommand )
//{
// static int nCount = 0;
// nCount++;
// ATLTRACE( "count %d\n", nCount );
//}
COMMAND_RTF_INT( _T("headery"), oReader.m_oCurSectionProp.m_nHeaderTop, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("footery"), oReader.m_oCurSectionProp.m_nFooterBottom, sCommand, hasParameter, parameter)
//Page Numbers
COMMAND_RTF_INT( _T("pgnstarts"), oReader.m_oCurSectionProp.m_nPageNumberStart, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("pgncont"), oReader.m_oCurSectionProp.m_bPageNumberContinuos, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("pgnrestart"), oReader.m_oCurSectionProp.m_bPageNumberRestart, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("pgnx"), oReader.m_oCurSectionProp.m_nPageNumberX, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("pgny"), oReader.m_oCurSectionProp.m_nPageNumberY, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("pgndec"), oReader.m_oCurSectionProp.m_ePageNumberFormat, sCommand, true, RtfSectionProperty::pnf_pgndec)
COMMAND_RTF_INT( _T("pgnucrm"), oReader.m_oCurSectionProp.m_ePageNumberFormat, sCommand, true, RtfSectionProperty::pnf_pgnucrm)
COMMAND_RTF_INT( _T("pgnlcrm"), oReader.m_oCurSectionProp.m_ePageNumberFormat, sCommand, true, RtfSectionProperty::pnf_pgnlcrm)
COMMAND_RTF_INT( _T("vertalt"), oReader.m_oCurSectionProp.m_eVerticalAlignment, sCommand, true, RtfSectionProperty::va_vertalt)
COMMAND_RTF_INT( _T("vertalb"), oReader.m_oCurSectionProp.m_eVerticalAlignment, sCommand, true, RtfSectionProperty::va_vertalb)
COMMAND_RTF_INT( _T("vertalc"), oReader.m_oCurSectionProp.m_eVerticalAlignment, sCommand, true, RtfSectionProperty::va_vertalc)
COMMAND_RTF_INT( _T("vertalj"), oReader.m_oCurSectionProp.m_eVerticalAlignment, sCommand, true, RtfSectionProperty::va_vertalj)
//Text Flow
COMMAND_RTF_INT( _T("stextflow"), oReader.m_oCurSectionProp.m_nTextFollow, sCommand, hasParameter, parameter)
//Page Borders
else if( _T("pgbrdrl") == sCommand )
m_eInternalState = is_border_left;
else if( _T("pgbrdrt") == sCommand )
m_eInternalState = is_border_top;
else if( _T("pgbrdrr") == sCommand )
m_eInternalState = is_border_right;
else if( _T("pgbrdrb") == sCommand )
m_eInternalState = is_border_bottom;
COMMAND_RTF_INT( _T("brdrart"), oReader.m_oCurSectionProp.m_nBorderArt, sCommand, hasParameter, parameter)
COMMAND_RTF_INT( _T("pgbrdropt"), oReader.m_oCurSectionProp.m_nBorderMeasure, sCommand, hasParameter, parameter)
COMMAND_RTF_BOOL( _T("pgbrdrsna"), oReader.m_oCurSectionProp.m_nBorderAlign, sCommand, hasParameter, parameter)
else if( _T("header") == sCommand || _T("footer") == sCommand || _T("headerl") == sCommand ||
_T("headerr") == sCommand || _T("headerf") == sCommand || _T("footerl") == sCommand ||
_T("footerr") == sCommand || _T("footerf") == sCommand )
{
ParagraphReader oParagraphReader(sCommand, oReader);
oAbstrReader.StartSubReader( oParagraphReader, oDocument, oReader );
oParagraphReader.m_oParPropDest.Finalize(oReader);
TextItemContainerPtr oNewFooterHeader = oParagraphReader.m_oParPropDest.m_oTextItems;
if( _T("header") == sCommand )
oReader.m_oCurSectionProp.m_oHeaderRight = oNewFooterHeader;
else if( _T("footer") == sCommand )
oReader.m_oCurSectionProp.m_oFooterRight = oNewFooterHeader;
else if( _T("headerl") == sCommand )
oReader.m_oCurSectionProp.m_oHeaderLeft = oNewFooterHeader;
else if( _T("headerr") == sCommand )
oReader.m_oCurSectionProp.m_oHeaderRight = oNewFooterHeader;
else if( _T("headerf") == sCommand )
oReader.m_oCurSectionProp.m_oHeaderFirst = oNewFooterHeader;
else if( _T("footerl") == sCommand )
oReader.m_oCurSectionProp.m_oFooterLeft = oNewFooterHeader;
else if( _T("footerr") == sCommand )
oReader.m_oCurSectionProp.m_oFooterRight = oNewFooterHeader;
else if( _T("footerf") == sCommand )
oReader.m_oCurSectionProp.m_oFooterFirst = oNewFooterHeader;
}
else
{
bool bRes = false;
if( is_border_left == m_eInternalState )
bRes = RtfBorderCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, oReader.m_oCurSectionProp.m_oBorderLeft );
else if( is_border_top == m_eInternalState )
bRes = RtfBorderCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, oReader.m_oCurSectionProp.m_oBorderTop );
else if( is_border_right == m_eInternalState )
bRes = RtfBorderCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, oReader.m_oCurSectionProp.m_oBorderRight );
else if( is_border_bottom == m_eInternalState )
bRes = RtfBorderCommand::ExecuteCommand( oDocument, oReader, sCommand, hasParameter, parameter, oReader.m_oCurSectionProp.m_oBorderBottom );
if( true == bRes )
return true;
return false;
}
return true;
}
InternalState m_eInternalState;
int nCurCollumnNumber;
public:
RtfSectionCommand()
{
m_eInternalState = is_none;
nCurCollumnNumber = PROP_DEF;
}
bool ExecuteCommand(RtfDocument& oDocument, RtfReader& oReader, RtfAbstractReader& oAbstrReader, CString sCommand, bool hasParameter, int parameter);
};
class RtfNormalReader : public RtfAbstractReader
{
public:
ParagraphPropDestination oParagraphReaderDestination;
RtfSectionCommand oRtfSectionCommand;
ParagraphPropDestination oParagraphReaderDestination;
RtfSectionCommand oRtfSectionCommand;
RtfNormalReader( RtfDocument& oDocument, RtfReader& oReader )
RtfNormalReader( RtfDocument& oDocument, RtfReader& oReader )
{
RtfSectionPtr oCurSection;
SectDef( oDocument, oReader );
if(true == oDocument.GetItem( oCurSection ) )
{
RtfSectionPtr oCurSection;
SectDef( oDocument, oReader );
if(true == oDocument.GetItem( oCurSection ) )
{
oCurSection->m_oProperty = oReader.m_oCurSectionProp;
oParagraphReaderDestination.m_oTextItems = oCurSection;
}
m_nCurGroups = 0;
oCurSection->m_oProperty = oReader.m_oCurSectionProp;
oParagraphReaderDestination.m_oTextItems = oCurSection;
}
bool ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader, CString sCommand, bool hasParameter, int parameter )
{
if( _T("colortbl") == sCommand )
{
RtfColorTableReader oColorTableReader;
return StartSubReader( oColorTableReader, oDocument, oReader );
}
else if( _T("fonttbl") == sCommand )
{
RtfFontTableReader oFontTableReader;
return StartSubReader( oFontTableReader, oDocument, oReader );
}
else if( _T("stylesheet") == sCommand )
{
StyleTableReader oStyleReader;
return StartSubReader( oStyleReader, oDocument, oReader );
}
//else if( _T("latentstyles") == sCommand )
//{
// LatentstyleTableReader oLatentstyleReader;
// return StartSubReader( oLatentstyleReader, oDocument, oReader );
//}
else if( _T("listtable") == sCommand )
{
ListTableReader oListTableReader;
return StartSubReader( oListTableReader, oDocument, oReader );
m_nCurGroups = 0;
}
bool ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader, CString sCommand, bool hasParameter, int parameter );
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, CString sText)
{
oParagraphReaderDestination.ExecuteText( oDocument, oReader, sText );
}
void ExitReader(RtfDocument& oDocument, RtfReader& oReader)
{
oParagraphReaderDestination.Finalize(oReader/*, RtfSectionPtr()*/);
RtfSectionPtr oCurSection;
if(true == oDocument.GetItem( oCurSection ) )
oCurSection->m_oProperty = oReader.m_oCurSectionProp;
}
else if( _T("listoverridetable") == sCommand )
{
ListOverrideTableReader oListOverrideReader;
return StartSubReader( oListOverrideReader, oDocument, oReader );
}
else if( _T("info") == sCommand )
{
RtfInfoReader oInfoReader;
return StartSubReader( oInfoReader, oDocument, oReader );
}
//else if( _T("colorschememapping") == sCommand )
//{
// RtfColorSchemeReader oSchemeReader;
// return StartSubReader( oSchemeReader, oDocument, oReader );
//}
//else if( _T("themedata") == sCommand )
//{
// RtfThemeDataReader oThemeDataReader;
// return StartSubReader( oThemeDataReader, oDocument, oReader );
//}
//else if( _T("defchp") == sCommand )
//{
// RtfDefCharPropReader oDefCharPropReader( oDocument.m_oDefaultCharProp );
// return StartSubReader( oDefCharPropReader, oDocument, oReader ); }
//else if( _T("defpap") == sCommand )
//{
// RtfDefParPropReader oDefParPropReader;
// return StartSubReader( oDefParPropReader, oDocument, oReader );
//}
else if( _T("mmathPr") == sCommand )
{
RtfMathReader oMathPropReader(oDocument.m_oMathProp);
return StartSubReader( oMathPropReader, oDocument, oReader );
}
else if( _T("ftnsep") == sCommand || _T("ftnsepc") == sCommand ||
_T("aftnsep")== sCommand || _T("aftnsepc") == sCommand )
{
ParagraphReader oParagraphReader(sCommand, oReader);
StartSubReader( oParagraphReader, oDocument, oReader );
if( _T("ftnsep") == sCommand )
{
oDocument.m_oFootnoteSep = oParagraphReader.m_oParPropDest.m_oTextItems;
oDocument.m_oProperty.m_aSpecialFootnotes.push_back( 0 );
}
else if( _T("ftnsepc") == sCommand )
{
oDocument.m_oFootnoteCon = oParagraphReader.m_oParPropDest.m_oTextItems;
oDocument.m_oProperty.m_aSpecialFootnotes.push_back( 1 );
}
else if( _T("aftnsep") == sCommand )
{
oDocument.m_oEndnoteSep = oParagraphReader.m_oParPropDest.m_oTextItems;
oDocument.m_oProperty.m_aSpecialEndnotes.push_back( 0 );
}
else if( _T("aftnsepc") == sCommand )
{
oDocument.m_oEndnoteCon = oParagraphReader.m_oParPropDest.m_oTextItems;
oDocument.m_oProperty.m_aSpecialEndnotes.push_back( 1 );
}
}
else if( _T("sect") == sCommand )
{
//if (oParagraphReaderDestination.m_oTextItems->GetCount() > 0)
{
RtfSectionPtr oCurSection;
if(true == oDocument.GetItem( oCurSection ) )
oCurSection->m_oProperty = oReader.m_oCurSectionProp;
//вручную обнуляем footer, т.к. sectd может встретиться и после field
oReader.m_oCurSectionProp.m_oHeaderLeft = TextItemContainerPtr();
oReader.m_oCurSectionProp.m_oHeaderFirst = TextItemContainerPtr();
oReader.m_oCurSectionProp.m_oHeaderRight = TextItemContainerPtr();
oReader.m_oCurSectionProp.m_oFooterLeft = TextItemContainerPtr();
oReader.m_oCurSectionProp.m_oFooterFirst = TextItemContainerPtr();
oReader.m_oCurSectionProp.m_oFooterRight = TextItemContainerPtr();
oParagraphReaderDestination.Finalize( oReader );
RtfSectionPtr oNewSection = RtfSectionPtr( new RtfSection() );
oParagraphReaderDestination.m_oTextItems = oNewSection;
oDocument.AddItem( oNewSection );
}
}
else if( _T("sectd") == sCommand )
{
SectDef( oDocument, oReader );
}
else
{
bool bResult = false;
bResult = oParagraphReaderDestination.ExecuteCommand( oDocument, oReader, (*this), sCommand, hasParameter, parameter );
if( true == bResult )
return true;
bResult = RtfDocumentCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter );
if( true == bResult )
return true;
bResult = oRtfSectionCommand.ExecuteCommand( oDocument, oReader, (*this),sCommand, hasParameter, parameter );
if( true == bResult )
return true;
bResult = RtfDocumentCommand::ExecuteCommand( oDocument, oReader,sCommand, hasParameter, parameter );
if( true == bResult )
return true;
return false;
}
return true;
}
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, CString sText)
if( NULL == oDocument.m_oFootnoteCon )
{
oParagraphReaderDestination.ExecuteText( oDocument, oReader, sText );
oDocument.m_oFootnoteCon = TextItemContainerPtr( new TextItemContainer() );
RtfParagraphPtr oNewPar = RtfParagraphPtr( new RtfParagraph() );
RtfCharSpecialPtr oNewChar = RtfCharSpecialPtr( new RtfCharSpecial() );
oNewChar->m_eType = RtfCharSpecial::rsc_chftnsepc;
oNewPar->AddItem( oNewChar );
oDocument.m_oFootnoteCon->AddItem( oNewPar );
oDocument.m_oProperty.m_aSpecialFootnotes.push_back( 1 );
}
void ExitReader(RtfDocument& oDocument, RtfReader& oReader)
if( NULL == oDocument.m_oFootnoteSep )
{
oParagraphReaderDestination.Finalize(oReader);
RtfSectionPtr oCurSection;
if(true == oDocument.GetItem( oCurSection ) )
oCurSection->m_oProperty = oReader.m_oCurSectionProp;
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;
oNewPar->AddItem( oNewChar );
oDocument.m_oFootnoteCon->AddItem( oNewPar );
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;
oNewPar->AddItem( oNewChar );
oDocument.m_oFootnoteSep->AddItem( oNewPar );
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;
oNewPar->AddItem( oNewChar );
oDocument.m_oEndnoteCon->AddItem( oNewPar );
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;
oNewPar->AddItem( oNewChar );
oDocument.m_oEndnoteSep->AddItem( oNewPar );
oDocument.m_oProperty.m_aSpecialEndnotes.push_back( 0 );
}
oDocument.m_oFootnoteSep = TextItemContainerPtr( new TextItemContainer() );
RtfParagraphPtr oNewPar = RtfParagraphPtr( new RtfParagraph() );
RtfCharSpecialPtr oNewChar = RtfCharSpecialPtr( new RtfCharSpecial() );
oNewChar->m_eType = RtfCharSpecial::rsc_chftnsep;
oNewPar->AddItem( oNewChar );
oDocument.m_oFootnoteSep->AddItem( oNewPar );
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;
oNewPar->AddItem( oNewChar );
oDocument.m_oEndnoteCon->AddItem( oNewPar );
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;
oNewPar->AddItem( oNewChar );
oDocument.m_oEndnoteSep->AddItem( oNewPar );
oDocument.m_oProperty.m_aSpecialEndnotes.push_back( 0 );
}
}
private:
void SectDef( RtfDocument& oDocument, RtfReader& oReader )
{
......
......@@ -302,7 +302,8 @@ public:
if( m_ooxAnchor->m_oGraphic.IsInit() )
{
OOXPictureGraphicReader oGraphicReader(m_ooxAnchor->m_oGraphic.GetPointer());
oGraphicReader.Parse( oParam, *oOutput.m_oPicture );
oGraphicReader.Parse( oParam, oOutput );
}
//изменяем scale в соответсявии с выходным размером
if( PROP_DEF != nWidth && PROP_DEF != oOutput.m_oPicture->m_nWidthGoal )
......
......@@ -51,54 +51,7 @@ public:
{
m_ooxGraphic = ooxGraphic;
}
bool Parse( ReaderParameter oParam , RtfPicture& oOutput)
{
if (m_ooxGraphic == NULL) return false;
switch(m_ooxGraphic->m_eGraphicType)
{
case OOX::Drawing::graphictypePicture:
//собственно тока этот объект пока и есть (
break;
case OOX::Drawing::graphictypeLockedCanvas:
case OOX::Drawing::graphictypeChart:
case OOX::Drawing::graphictypeDiagram:
case OOX::Drawing::graphictypeShape:
case OOX::Drawing::graphictypeGroupShape:
///todooo воткнуть конвертацию pptx->ppt->vml !!!
break;
}
for (long i=0; i < m_ooxGraphic->m_arrItems.size(); i++)
{
if (m_ooxGraphic->m_arrItems[i] == NULL) continue;
if (m_ooxGraphic->m_arrItems[i]->getType() == OOX::et_pic_pic)
{
OOX::Drawing::CPicture *picture = dynamic_cast<OOX::Drawing::CPicture *>(m_ooxGraphic->m_arrItems[i]);
if ( (picture) && (picture->m_oBlipFill.m_oBlip.IsInit()))
{
CString sImageId = picture->m_oBlipFill.m_oBlip->m_oEmbed.GetValue();
if (oParam.oReader->m_currentContainer)
{
smart_ptr<OOX::File> oFile = oParam.oReader->m_currentContainer->Find(sImageId);
if ( oFile.IsInit() && (OOX::FileTypes::Image == oFile->type()))
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
CString sImagePath = pImage->filename().GetPath();
WriteDataToPicture( sImagePath, oOutput, _T("") );
}
}
}
}
}
return true;
}
bool Parse( ReaderParameter oParam , RtfShape& oOutput);
static bool WriteDataToPicture( CString sPath, RtfPicture& oOutput, CString sTempPath )
{
OOX::CPath ooxPath = sPath; //для target
......
......@@ -83,7 +83,7 @@ public:
if(m_ooxInline->m_oGraphic.IsInit())
{
OOXPictureGraphicReader oGraphicReader(m_ooxInline->m_oGraphic.GetPointer());
oGraphicReader.Parse( oParam, *oOutput.m_oPicture );
oGraphicReader.Parse( oParam, oOutput);
}
//изменяем scale в соответсявии с выходным размером
if( PROP_DEF != nWidth && PROP_DEF != oOutput.m_oPicture->m_nWidthGoal )
......
......@@ -460,6 +460,13 @@ bool OOXShapeReader::ParseStyle(RtfShape& oShape, SimpleTypes::Vml::CCssProperty
case SimpleTypes::Vml::cssptMsoPositionHorizontalRelative :
{
oShape.m_nPositionHRelative = prop->get_Value().eMsoPosHorRel;
switch(prop->get_Value().eMsoPosHorRel)
{
case SimpleTypes::Vml::cssmsoposhorrelMargin: oShape.m_eXAnchor = RtfShape::ax_margin; break;
case SimpleTypes::Vml::cssmsoposhorrelPage: oShape.m_eXAnchor = RtfShape::ax_page; break;
case SimpleTypes::Vml::cssmsoposhorrelText:
case SimpleTypes::Vml::cssmsoposhorrelChar: break;//inline
}
}break;
case SimpleTypes::Vml::cssptMsoPositionVertical:
{
......@@ -468,6 +475,13 @@ bool OOXShapeReader::ParseStyle(RtfShape& oShape, SimpleTypes::Vml::CCssProperty
case SimpleTypes::Vml::cssptMsoPositionVerticalRelative :
{
oShape.m_nPositionVRelative = prop->get_Value().eMsoPosVerRel;
switch(prop->get_Value().eMsoPosVerRel)
{
case SimpleTypes::Vml::cssmsoposverrelMargin: oShape.m_eYAnchor = RtfShape::ay_margin; break;
case SimpleTypes::Vml::cssmsoposverrelPage: oShape.m_eYAnchor = RtfShape::ay_page; break;
case SimpleTypes::Vml::cssmsoposverrelText:
case SimpleTypes::Vml::cssmsoposverrelLine: break;//inline
}
}break;
case SimpleTypes::Vml::cssptMsoWrapDistanceBottom:
{
......@@ -518,7 +532,19 @@ bool OOXShapeReader::ParseStyle(RtfShape& oShape, SimpleTypes::Vml::CCssProperty
{
oShape.m_nGtextSize = prop->get_Value().oValue.dValue;
}break;
case SimpleTypes::Vml::cssptVTextAnchor:
{
oShape.m_nAnchorText = prop->get_Value().eVTextAnchor;//совпдает
oShape.m_bFitShapeToText = 0;
}break;
case SimpleTypes::Vml::csspctMsoWidthPercent:
{
oShape.m_nPctWidth = prop->get_Value().oValue.dValue;
}break;
case SimpleTypes::Vml::csspctMsoHeightPercent:
{
oShape.m_nPctHeight = prop->get_Value().oValue.dValue;
}break;
case SimpleTypes::Vml::cssptDirection : break;
case SimpleTypes::Vml::cssptLayoutFlow : break;
case SimpleTypes::Vml::cssptMsoDirectionAlt : break;
......@@ -528,7 +554,6 @@ bool OOXShapeReader::ParseStyle(RtfShape& oShape, SimpleTypes::Vml::CCssProperty
case SimpleTypes::Vml::cssptMsoNextTextbox : break;
case SimpleTypes::Vml::cssptMsoRotate : break;
case SimpleTypes::Vml::cssptMsoTextScale : break;
case SimpleTypes::Vml::cssptVTextAnchor : break;
case SimpleTypes::Vml::cssptFont : break;
case SimpleTypes::Vml::cssptFontStyle : break;
case SimpleTypes::Vml::cssptFontVariant : break;
......@@ -544,60 +569,6 @@ bool OOXShapeReader::ParseStyle(RtfShape& oShape, SimpleTypes::Vml::CCssProperty
case SimpleTypes::Vml::cssptVTextSpacing : break;
}
//else if( _T("mso-left-percent") == sProperty )
// oShape.m_nPositionHPct = Strings::ToInteger( sValue );
//else if( _T("mso-position-horizontal-relative") == sProperty )
//{
// if( _T("page") == sValue )
// oShape.m_eXAnchor = RtfShape::ax_page;
// else if( _T("margin") == sValue )
// oShape.m_eXAnchor = RtfShape::ax_margin;
// else if( _T("text") == sValue )
// oShape.m_eXAnchor = RtfShape::ax_column;
//}
//else if( _T("mso-top-percent") == sProperty )
// oShape.m_nPositionVPct = Strings::ToInteger( sValue );
//else if( _T("mso-position-vertical-relative") == sProperty )
//{
// if( _T("page") == sValue )
// oShape.m_eYAnchor = RtfShape::ay_page;
// else if( _T("margin") == sValue )
// oShape.m_eYAnchor = RtfShape::ay_margin;
// else if( _T("text") == sValue )
// oShape.m_eYAnchor = RtfShape::ay_margin;
//}
//else if( _T("mso-width-relative") == sProperty )
//{
// if( _T("margin") == sValue )
// oShape.m_nPctWidthRelative = 0;
// else if( _T("page") == sValue )
// oShape.m_nPctWidthRelative = 1;
// else if( _T("left-margin-area") == sValue )
// oShape.m_nPctWidthRelative = 2;
// else if( _T("right-margin-area") == sValue )
// oShape.m_nPctWidthRelative = 3;
// else if( _T("inner-margin-area") == sValue )
// oShape.m_nPctWidthRelative = 4;
// else if( _T("outer-margin-area") == sValue )
// oShape.m_nPctWidthRelative = 5;
//}
//else if( _T("mso-height-relative") == sProperty )
//{
// if( _T("margin") == sValue )
// oShape.m_nPctHeightRelative = 0;
// else if( _T("page") == sValue )
// oShape.m_nPctHeightRelative = 1;
// else if( _T("top-margin-area") == sValue )
// oShape.m_nPctHeightRelative = 2;
// else if( _T("bottom-margin-area") == sValue )
// oShape.m_nPctHeightRelative = 3;
// else if( _T("inner-margin-area") == sValue )
// oShape.m_nPctHeightRelative = 4;
// else if( _T("outer-margin-area") == sValue )
// oShape.m_nPctHeightRelative = 5;
//}
return true;
}
......@@ -227,41 +227,41 @@ public:
CString sResult;
switch( m_eType )
{
case rsc_chdate: sResult.Append( _T("") );break;
case rsc_chdpl: sResult.Append( _T("") );break;
case rsc_chdpa: sResult.Append( _T("") );break;
case rsc_chtime: sResult.Append( _T("") );break;
case rsc_chpgn: sResult.Append( _T("<w:pgNum />") );break;
case rsc_sectnum: sResult.Append( _T("") );break;
case rsc_chftn: sResult.Append( _T("<w:footnoteRef/>") );break;
case rsc_chftnEnd: sResult.Append( _T("<w:endnoteRef/>") );break;
case rsc_chatn: sResult.Append( _T("<w:annotationRef />") );break;
case rsc_chftnsep: sResult.Append( _T("<w:separator />") );break;
case rsc_chftnsepc: sResult.Append( _T("<w:continuationSeparator/>") );break;
case rsc_page: sResult.Append( _T("<w:br w:type=\"page\"/>") );break;
case rsc_column: sResult.Append( _T("<w:br w:type=\"column\"/>") );break;
case rsc_chdate: sResult.Append( _T("") ); break;
case rsc_chdpl: sResult.Append( _T("") ); break;
case rsc_chdpa: sResult.Append( _T("") ); break;
case rsc_chtime: sResult.Append( _T("") ); break;
case rsc_chpgn: sResult.Append( _T("<w:pgNum />") ); break;
case rsc_sectnum: sResult.Append( _T("") ); break;
case rsc_chftn: sResult.Append( _T("<w:footnoteRef/>") ); break;
case rsc_chftnEnd: sResult.Append( _T("<w:endnoteRef/>") ); break;
case rsc_chatn: sResult.Append( _T("<w:annotationRef />") ); break;
case rsc_chftnsep: sResult.Append( _T("<w:separator />") ); break;
case rsc_chftnsepc: sResult.Append( _T("<w:continuationSeparator/>") ); break;
case rsc_page: sResult.Append( _T("<w:br w:type=\"page\"/>") ); break;
case rsc_column: sResult.Append( _T("<w:br w:type=\"column\"/>") ); break;
case rsc_line: sResult.Append( _T("<w:br w:type=\"textWrapping\" w:clear=\"none\"/>") );break;
case rsc_softpage: sResult.Append( _T("") );break;
case rsc_softcol: sResult.Append( _T("") );break;
case rsc_softline: sResult.Append( _T("") );break;
case rsc_tab: sResult.Append( _T("<w:tab/>") );break;
case rsc_emspace: sResult.Append( _T("") );break;
case rsc_qmspace: sResult.Append( _T("") );break;
case rsc_Formula: sResult.Append( _T("") );break;
case rsc_softpage: sResult.Append( _T("") ); break;
case rsc_softcol: sResult.Append( _T("") ); break;
case rsc_softline: sResult.Append( _T("") ); break;
case rsc_tab: sResult.Append( _T("<w:tab/>") ); break;
case rsc_emspace: sResult.Append( _T("") ); break;
case rsc_qmspace: sResult.Append( _T("") ); break;
case rsc_Formula: sResult.Append( _T("") ); break;
case rsc_OptHyphen: sResult.Append( _T("<w:t xml:space=\"preserve\">-</w:t>") );break;//<w:softHyphen/>
case rsc_NonBrHyphen: sResult.Append( _T("<w:t xml:space=\"preserve\">-</w:t>") );break;//<w:nonBreakHyphen/>
case rsc_NonBrSpace: sResult.Append( _T("<w:t xml:space=\"preserve\"> </w:t>") );break;
case rsc_zwbo: sResult.Append( _T("") );break;
case rsc_zwnbo: sResult.Append( _T("") );break;
case rsc_zwj: sResult.Append( _T("") );break;
case rsc_zwnj: sResult.Append( _T("") );break;
case rsc_zwbo: sResult.Append( _T("") ); break;
case rsc_zwnbo: sResult.Append( _T("") ); break;
case rsc_zwj: sResult.Append( _T("") ); break;
case rsc_zwnj: sResult.Append( _T("") ); break;
}
switch ( m_nTextWrapBreak )
{
case 0: sResult.Append( _T("<w:br w:type=\"textWrapping\" w:clear=\"none\"/>") );break;
case 1: sResult.Append( _T("<w:br w:type=\"textWrapping\" w:clear=\"left\"/>") );break;
case 2: sResult.Append( _T("<w:br w:type=\"textWrapping\" w:clear=\"right\"/>") );break;
case 3: sResult.Append( _T("<w:br w:type=\"textWrapping\" w:clear=\"all\"/>") );break;
case 0: sResult.Append( _T("<w:br w:type=\"textWrapping\" w:clear=\"none\"/>") ); break;
case 1: sResult.Append( _T("<w:br w:type=\"textWrapping\" w:clear=\"left\"/>") ); break;
case 2: sResult.Append( _T("<w:br w:type=\"textWrapping\" w:clear=\"right\"/>") ); break;
case 3: sResult.Append( _T("<w:br w:type=\"textWrapping\" w:clear=\"all\"/>") ); break;
}
return sResult;
}
......
......@@ -55,22 +55,22 @@ public:
CString RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
sResult.Append(_T("{\\field "));
sResult += _T("{\\field ");
RENDER_RTF_BOOL( m_bDirty, sResult, _T("flddirty") )
RENDER_RTF_BOOL( m_bLock, sResult, _T("fldlock") )
sResult.Append(_T("{\\*\\fldinst"));
sResult.Append( m_oCharProp.RenderToRtf(oRenderParameter) );
sResult += _T("{\\*\\fldinst");
sResult += m_oCharProp.RenderToRtf(oRenderParameter);
return sResult;
}
CString RenderToOOX(RenderParameter oRenderParameter)
{
CString sResult;
sResult.Append( _T("<w:r>") );
sResult.Append( _T("<w:fldChar w:fldCharType=\"separate\"") );
sResult += _T("<w:r>");
sResult += _T("<w:fldChar w:fldCharType=\"separate\"");
RENDER_OOX_INT_ATTRIBUTE( m_bDirty, sResult, _T("dirty") )
RENDER_OOX_INT_ATTRIBUTE( m_bLock, sResult, _T("fldLock") )
sResult.Append( _T("/>") );
sResult.Append( _T("</w:r>") );
sResult += _T("/>");
sResult += _T("</w:r>");
return sResult;
}
};
......@@ -93,13 +93,16 @@ public: CString RenderToOOX(RenderParameter oRenderParameter)
if( NULL != m_oText )
{
CString sResult;
sResult.Append( _T("<w:r>") );
sResult.Append( _T("<w:instrText>") );
sResult += _T("<w:r>");
sResult += _T("<w:instrText>");
oRenderParameter.nType = RENDER_TO_RTF_PARAM_CHAR;
oRenderParameter.nValue = RENDER_TO_RTF_PARAM_NO_PAR;
sResult.Append( m_oText->RenderToOOX( oRenderParameter ) );
sResult.Append( _T("</w:instrText>") );
sResult.Append( _T("</w:r>") );
sResult += m_oText->RenderToOOX( oRenderParameter );
sResult += _T("</w:instrText>");
sResult += _T("</w:r>");
return sResult;
}
else
......@@ -191,31 +194,35 @@ public: void SetDefault()
public: CString RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
sResult.Append(_T("{\\field "));
sResult += _T("{\\field ");
if( fm_none != m_eMode )
{
switch( m_eMode )
{
case fm_flddirty: sResult.Append(_T("{\\flddirty "));break;
case fm_fldedit: sResult.Append(_T("{\\fldedit "));break;
case fm_fldlock: sResult.Append(_T("{\\fldlock "));break;
case fm_fldpriv: sResult.Append(_T("{\\fldpriv "));break;
}
case fm_flddirty: sResult += _T("{\\flddirty "); break;
case fm_fldedit: sResult += _T("{\\fldedit "); break;
case fm_fldlock: sResult += _T("{\\fldlock "); break;
case fm_fldpriv: sResult += _T("{\\fldpriv "); break;
}
}
sResult.Append(_T("{\\*\\fldinst "));
sResult += _T("{\\*\\fldinst ");
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_RTF_PARAM_CHAR;
oNewParam.nValue = RENDER_TO_RTF_PARAM_NO_PAR;
sResult.Append( m_oInsert->RenderToRtf( oNewParam ) );
sResult += m_oInsert->RenderToRtf( oNewParam );
if( true == m_bReferenceToEndnote )
sResult.Append( _T("\\fldalt") );
sResult += _T("\\fldalt");
if( false == m_sData.IsEmpty() )
sResult.AppendFormat( _T("{\\*\\datafield %ls}"), m_sData.GetBuffer());
sResult.Append(_T("}"));
sResult += _T("}");
CString str = m_oResult->RenderToRtf( oRenderParameter ) ;
sResult.AppendFormat(_T("{\\fldrslt %ls}"), str.GetBuffer());
sResult.Append(_T("}"));
sResult += _T("}");
return sResult;
}
public: CString RenderToOOX(RenderParameter oRenderParameter)
......@@ -225,7 +232,7 @@ public: CString RenderToOOX(RenderParameter oRenderParameter)
{
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_RUN;
sResult.Append(m_oResult->RenderToOOX(oNewParam));
sResult += m_oResult->RenderToOOX(oNewParam);
}
else
{
......@@ -257,8 +264,9 @@ public: CString RenderToOOX(RenderParameter oRenderParameter)
//добавляем гиперссылку в документ
sResult.AppendFormat( _T("<w:hyperlink r:id=\"%ls\" >"), sId.GetBuffer() );
oNewParam.nType = RENDER_TO_OOX_PARAM_RUN;
sResult.Append(m_oResult->RenderToOOX(oNewParam));
sResult.Append( _T("</w:hyperlink>") );
sResult += m_oResult->RenderToOOX(oNewParam);
sResult += _T("</w:hyperlink>");
}
else
{
......@@ -267,45 +275,51 @@ public: CString RenderToOOX(RenderParameter oRenderParameter)
{
RenderParameter oNewParametr = oRenderParameter;
oNewParametr.nType = RENDER_TO_OOX_PARAM_PLAIN;
//sResult.Append(_T("<w:r>"));
//sResult += _T("<w:r>"));
CString str = Utils::PrepareToXML( m_oInsert->RenderToOOX(oNewParametr) ).Trim();
sResult.AppendFormat(_T("<w:fldSimple w:instr=\"%ls\">"), str.GetBuffer() );
sResult += _T("<w:fldSimple w:instr=\"");
sResult += str;
sResult += _T("\">");
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_RUN;
sResult.Append(m_oResult->RenderToOOX(oNewParam));
sResult += m_oResult->RenderToOOX(oNewParam);
sResult.AppendFormat(_T("</w:fldSimple>"));
//sResult.Append(_T("</w:r>"));
//sResult += _T("</w:r>"));
}
else
{
//так добавляются лишние параграфы
RenderParameter oNewParametr = oRenderParameter;
oNewParametr.nType = RENDER_TO_OOX_PARAM_PLAIN;
sResult.Append(_T("<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>"));
sResult += _T("<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>");
CString str = Utils::PrepareToXML( m_oInsert->RenderToOOX(oNewParametr) );
sResult.AppendFormat(_T("<w:r><w:instrText xml:space=\"preserve\">%ls</w:instrText></w:r>"), str.GetBuffer());
sResult.Append(_T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>"));
sResult += _T("<w:r><w:instrText xml:space=\"preserve\">");
sResult += str;
sResult += _T("</w:instrText></w:r>");
sResult += _T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>");
//заканчиваем этот параграф
sResult.Append(_T("</w:p>"));
sResult += _T("</w:p>");
//пишем параграфы содержания
oNewParametr.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
sResult.Append(m_oResult->RenderToOOX(oNewParametr));
sResult += m_oResult->RenderToOOX(oNewParametr);
//заканчиваем Field
sResult.Append(_T("<w:p>"));
sResult.Append(_T("<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>"));
sResult += _T("<w:p>");
sResult += _T("<w:r><w:fldChar w:fldCharType=\"end\"/></w:r>");
////пишем параграфы содержания
//RenderParameter oNewParametr = oRenderParameter;
//oNewParametr.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
//sResult.Append(m_oResult->RenderToOOX(oNewParametr));
//sResult += m_oResult->RenderToOOX(oNewParametr));
//CString sFieldBegin;
//sFieldBegin.Append(_T("<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>"));
//sFieldBegin += _T("<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>");
//sFieldBegin.AppendFormat(_T("<w:r><w:instrText xml:space=\"preserve\">%ls</w:instrText></w:r>"), Utils::PrepareToXML( m_oInsert->RenderToOOX(oNewParametr) ));
//sFieldBegin.Append(_T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>"));
//sFieldBegin += _T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>");
////пишем после первого w:pPr
//CString sFindStr = _T("</w:pPr>");
//int nIndex = sResult.Find( sFindStr );
......@@ -319,9 +333,9 @@ public: CString RenderToOOX(RenderParameter oRenderParameter)
// sResult.Inset( sFieldBegin, nIndex + sFindStr.GetLength() );
//}
//CString sFieldEnd;
//sFieldEnd.Append(_T("<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>"));
//sFieldEnd += _T("<w:r><w:fldChar w:fldCharType=\"begin\"/></w:r>");
//sFieldEnd.AppendFormat(_T("<w:r><w:instrText xml:space=\"preserve\">%ls</w:instrText></w:r>"), Utils::PrepareToXML( m_oInsert->RenderToOOX(oNewParametr) ));
//sFieldEnd.Append(_T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>"));
//sFieldEnd += _T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>");
////пишем после последнего w:pPr
}
}
......
......@@ -70,6 +70,7 @@ class RtfParagraph : public ITextItem, public ItemContainer< IDocumentElementPtr
public:
RtfParagraphProperty m_oProperty;
RtfOldListPtr m_oOldList;
int GetType( )
{
return TYPE_RTF_PARAGRAPH;
......@@ -102,20 +103,27 @@ public:
if( RENDER_TO_RTF_PARAM_CHAR == oRenderParameter.nType )
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append( m_aArray[i]->RenderToRtf( oRenderParameter ) );
{
sResult += m_aArray[i]->RenderToRtf( oRenderParameter );
}
}
else
{
sResult.Append(_T("\\pard\\plain"));
sResult.Append( m_oProperty.RenderToRtf( oRenderParameter ) );
sResult += _T("\\pard\\plain");
sResult += m_oProperty.RenderToRtf( oRenderParameter ) ;
if( NULL != m_oOldList )
sResult.Append( m_oOldList->RenderToRtf( oRenderParameter ) );
sResult += m_oOldList->RenderToRtf( oRenderParameter ) ;
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append( m_aArray[i]->RenderToRtf( oRenderParameter ) );
sResult.Append( m_oProperty.m_oCharProperty.RenderToRtf( oRenderParameter ) );
{
sResult += m_aArray[i]->RenderToRtf( oRenderParameter );
}
sResult += m_oProperty.m_oCharProperty.RenderToRtf( oRenderParameter );
//if( RENDER_TO_RTF_PARAM_NO_PAR != oRenderParameter.nValue )
// sResult.Append(_T("\\par"));
// sResult += T("\\par");
}
return sResult;
}
......@@ -126,25 +134,31 @@ public:
if( RENDER_TO_OOX_PARAM_PLAIN == oRenderParameter.nType )
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append( m_aArray[i]->RenderToOOX(oRenderParameter) );
{
sResult += m_aArray[i]->RenderToOOX(oRenderParameter);
}
}
else if( RENDER_TO_OOX_PARAM_RUN == oRenderParameter.nType )
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append( m_aArray[i]->RenderToOOX(oRenderParameter) );
{
sResult += m_aArray[i]->RenderToOOX(oRenderParameter);
}
}
else if( RENDER_TO_OOX_PARAM_MATH == oRenderParameter.nType )
{
if (m_aArray.size() < 1)
{
sResult.Append( _T("<w:rPr>") );
sResult.Append( m_oProperty.m_oCharProperty.RenderToOOX(oRenderParameter) );
sResult.Append( _T("</w:rPr>") );
sResult += _T("<w:rPr>");
sResult += m_oProperty.m_oCharProperty.RenderToOOX(oRenderParameter);
sResult += _T("</w:rPr>");
}
else
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append( m_aArray[i]->RenderToOOX(oRenderParameter) );
{
sResult += m_aArray[i]->RenderToOOX(oRenderParameter);
}
}
}
else
......@@ -153,17 +167,17 @@ public:
if( NULL != m_oOldList )
bCanConvertToNumbering = m_oOldList->CanConvertToNumbering();
sResult.Append( _T("<w:p>") );
sResult.Append( _T("<w:pPr>") );
sResult.Append( m_oProperty.RenderToOOX(oRenderParameter) );
sResult += _T("<w:p>");
sResult += _T("<w:pPr>");
sResult += m_oProperty.RenderToOOX(oRenderParameter);
if( NULL != m_oOldList )
{
//для OldList
if( true == bCanConvertToNumbering )
sResult.Append( m_oOldList->RenderToOOX( oRenderParameter ) );
sResult += m_oOldList->RenderToOOX( oRenderParameter );
}
sResult.Append( _T("</w:pPr>") );
sResult += _T("</w:pPr>");
if( NULL != m_oOldList )
{
......@@ -179,22 +193,25 @@ public:
for( int i = 0; i < m_oOldList->m_oText->GetCount(); i++ )
{
sResult.Append( _T("<w:r>") );
sResult.Append( _T("<w:rPr>") );
sResult.Append( oCharProp.RenderToOOX(oRenderParameter) );
sResult.Append( _T("</w:rPr>") );
sResult += _T("<w:r>");
sResult += _T("<w:rPr>");
sResult += oCharProp.RenderToOOX(oRenderParameter);
sResult += _T("</w:rPr>");
sResult.Append( m_oOldList->m_oText->m_aArray[ i ]->RenderToOOX(oNewParam) );
sResult.Append( _T("</w:r>") );
sResult += m_oOldList->m_oText->m_aArray[ i ]->RenderToOOX(oNewParam);
sResult += _T("</w:r>");
}
}
}
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_RUN;
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append( m_aArray[i]->RenderToOOX(oNewParam) );
sResult.Append( _T("</w:p>") );
{
sResult += m_aArray[i]->RenderToOOX(oNewParam);
}
sResult += _T("</w:p>");
}
return sResult;
}
......
......@@ -29,10 +29,10 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "RtfDocument.h"
#include "RtfWriter.h"
#include "Writer/OOXWriter.h"
#include "RtfProperty.h"
#include "RtfDocument.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/FileTypes.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/App.h"
......@@ -461,13 +461,13 @@ CString RtfShading::RenderToOOX(RenderParameter oRenderParameter)
{
RtfColor oForeColor;
if( true == poRtfDocument->m_oColorTable.GetColor( m_nForeColor, oForeColor ) )
sShading.AppendFormat( _T(" w:color=\"%ls\""), oForeColor.RenderToOOX(oNewParam).GetBuffer());
sShading.Append( _T(" w:color=\"") + oForeColor.RenderToOOX(oNewParam) + _T("\""));
}
if( PROP_DEF != m_nBackColor )
{
RtfColor oBackColor;
if( true == poRtfDocument->m_oColorTable.GetColor( m_nBackColor, oBackColor ) )
sShading.AppendFormat( _T(" w:fill=\"%ls\""), oBackColor.RenderToOOX(oNewParam).GetBuffer());
sShading.Append( _T(" w:fill=\"") + oBackColor.RenderToOOX(oNewParam) + _T("\""));
}
if( PROP_DEF != m_nValue )
{
......@@ -523,19 +523,19 @@ CString RtfShading::RenderToOOX(RenderParameter oRenderParameter)
{
switch( m_eType )
{
case st_clshdrawnil:sShading.Append( _T(" w:val=\"nil\"") );break;
case st_chbghoriz:sShading.Append( _T(" w:val=\"thinHorzStripehorzStripe\"") );break;
case st_chbgvert:sShading.Append( _T(" w:val=\"thinVertStripe\"") );break;
case st_chbgfdiag:sShading.Append( _T(" w:val=\"thinReverseDiagStripe\"") );break;
case st_chbgbdiag:sShading.Append( _T(" w:val=\"thinDiagStripe\"") );break;
case st_chbgcross:sShading.Append( _T(" w:val=\"thinHorzCross\"") );break;
case st_chbgdcross:sShading.Append( _T(" w:val=\"thinDiagCross\"") );break;
case st_chbgdkhoriz:sShading.Append( _T(" w:val=\"horzStripe\"") );break;
case st_chbgdkvert:sShading.Append( _T(" w:val=\"vertStripe\"") );break;
case st_chbgdkfdiag:sShading.Append( _T(" w:val=\"reverseDiagStripe\"") );break;
case st_chbgdkbdiag:sShading.Append( _T(" w:val=\"diagStripe\"") );break;
case st_chbgdkcross:sShading.Append( _T(" w:val=\"horzCross\"") );break;
case st_chbgdkdcross:sShading.Append( _T(" w:val=\"diagCross\"") );break;
case st_clshdrawnil: sShading.Append( _T(" w:val=\"nil\"") ); break;
case st_chbghoriz: sShading.Append( _T(" w:val=\"thinHorzStripehorzStripe\"") ); break;
case st_chbgvert: sShading.Append( _T(" w:val=\"thinVertStripe\"") ); break;
case st_chbgfdiag: sShading.Append( _T(" w:val=\"thinReverseDiagStripe\"") ); break;
case st_chbgbdiag: sShading.Append( _T(" w:val=\"thinDiagStripe\"") ); break;
case st_chbgcross: sShading.Append( _T(" w:val=\"thinHorzCross\"") ); break;
case st_chbgdcross: sShading.Append( _T(" w:val=\"thinDiagCross\"") ); break;
case st_chbgdkhoriz: sShading.Append( _T(" w:val=\"horzStripe\"") ); break;
case st_chbgdkvert: sShading.Append( _T(" w:val=\"vertStripe\"") ); break;
case st_chbgdkfdiag: sShading.Append( _T(" w:val=\"reverseDiagStripe\"") ); break;
case st_chbgdkbdiag: sShading.Append( _T(" w:val=\"diagStripe\"") ); break;
case st_chbgdkcross: sShading.Append( _T(" w:val=\"horzCross\"") ); break;
case st_chbgdkdcross: sShading.Append( _T(" w:val=\"diagCross\"") ); break;
}
}
if( false == sShading.IsEmpty() )
......@@ -547,33 +547,33 @@ CString RtfBorder::RenderToRtf(RenderParameter oRenderParameter)
CString sResult;
switch( m_eType )
{
case bt_brdrs: sResult = _T("\\brdrs"); break;
case bt_brdrth: sResult = _T("\\brdrth"); break;
case bt_brdrsh: sResult = _T("\\brdrsh"); break;
case bt_brdrdb: sResult = _T("\\brdrdb"); break;
case bt_brdrdot: sResult = _T("\\brdrdot"); break;
case bt_brdrdash: sResult = _T("\\brdrdash"); break;
case bt_brdrhair: sResult = _T("\\brdrhair"); break;
case bt_brdrinset: sResult = _T("\\brdrinset"); break;
case bt_brdrdashsm: sResult = _T("\\brdrdashsm"); break;
case bt_brdrdashd: sResult = _T("\\brdrdashd"); break;
case bt_brdrdashdd: sResult = _T("\\brdrdashdd"); break;
case bt_brdrdashdot: sResult = _T("\\brdrdashdot"); break;
case bt_brdrtriple: sResult = _T("\\brdrtriple"); break;
case bt_brdrtnthsg: sResult = _T("\\brdrtnthsg"); break;
case bt_brdrthtnsg: sResult = _T("\\brdrthtnsg"); break;
case bt_brdrtnthtnsg: sResult = _T("\\brdrtnthtnsg"); break;
case bt_brdrtnthtnmg: sResult = _T("\\brdrtnthtnmg"); break;
case bt_brdrtnthlg: sResult = _T("\\brdrtnthlg"); break;
case bt_brdrthtnlg: sResult = _T("\\brdrthtnlg"); break;
case bt_brdrtnthtnlg: sResult = _T("\\brdrtnthtnlg"); break;
case bt_brdrwavy: sResult = _T("\\brdrwavy"); break;
case bt_brdrwavydb: sResult = _T("\\brdrwavydb"); break;
case bt_brdrs: sResult = _T("\\brdrs"); break;
case bt_brdrth: sResult = _T("\\brdrth"); break;
case bt_brdrsh: sResult = _T("\\brdrsh"); break;
case bt_brdrdb: sResult = _T("\\brdrdb"); break;
case bt_brdrdot: sResult = _T("\\brdrdot"); break;
case bt_brdrdash: sResult = _T("\\brdrdash"); break;
case bt_brdrhair: sResult = _T("\\brdrhair"); break;
case bt_brdrinset: sResult = _T("\\brdrinset"); break;
case bt_brdrdashsm: sResult = _T("\\brdrdashsm"); break;
case bt_brdrdashd: sResult = _T("\\brdrdashd"); break;
case bt_brdrdashdd: sResult = _T("\\brdrdashdd"); break;
case bt_brdrdashdot: sResult = _T("\\brdrdashdot"); break;
case bt_brdrtriple: sResult = _T("\\brdrtriple"); break;
case bt_brdrtnthsg: sResult = _T("\\brdrtnthsg"); break;
case bt_brdrthtnsg: sResult = _T("\\brdrthtnsg"); break;
case bt_brdrtnthtnsg: sResult = _T("\\brdrtnthtnsg"); break;
case bt_brdrtnthtnmg: sResult = _T("\\brdrtnthtnmg"); break;
case bt_brdrtnthlg: sResult = _T("\\brdrtnthlg"); break;
case bt_brdrthtnlg: sResult = _T("\\brdrthtnlg"); break;
case bt_brdrtnthtnlg: sResult = _T("\\brdrtnthtnlg"); break;
case bt_brdrwavy: sResult = _T("\\brdrwavy"); break;
case bt_brdrwavydb: sResult = _T("\\brdrwavydb"); break;
case bt_brdrdashdotstr: sResult = _T("\\brdrdashdotstr"); break;
case bt_brdremboss: sResult = _T("\\brdremboss"); break;
case bt_brdrengrave: sResult = _T("\\brdrengrave"); break;
case bt_brdroutset: sResult = _T("\\brdroutset"); break;
case bt_brdrnone: sResult = _T("\\brdrnone"); break;
case bt_brdremboss: sResult = _T("\\brdremboss"); break;
case bt_brdrengrave: sResult = _T("\\brdrengrave"); break;
case bt_brdroutset: sResult = _T("\\brdroutset"); break;
case bt_brdrnone: sResult = _T("\\brdrnone"); break;
}
if( PROP_DEF != m_nWidth && m_nWidth > 0)
sResult.AppendFormat( _T("\\brdrw%d"), m_nWidth );
......@@ -602,34 +602,34 @@ CString RtfBorder::RenderToOOX(RenderParameter oRenderParameter)
switch( m_eType )
{
case bt_brdrs: sResult.Append( _T(" w:val=\"single\"") ); break;
case bt_brdrth: sResult.Append( _T(" w:val=\"thick\"") ); break;
case bt_brdrsh: sResult.Append( _T(" w:val=\"\"thin") ); break;
case bt_brdrdb: sResult.Append( _T(" w:val=\"double\"") ); break;
case bt_brdrdot: sResult.Append( _T(" w:val=\"dotted\"") ); break;
case bt_brdrdash: sResult.Append( _T(" w:val=\"dashed\"") ); break;
case bt_brdrhair: sResult.Append( _T(" w:val=\"hair\"") ); break;
case bt_brdrdashsm: sResult.Append( _T(" w:val=\"dashSmallGap\"") ); break;
case bt_brdrdashd: sResult.Append( _T(" w:val=\"dotDash\"") ); break;
case bt_brdrdashdd: sResult.Append( _T(" w:val=\"dotDotDash\"") ); break;
case bt_brdrinset: sResult.Append( _T(" w:val=\"inset\"") ); break;
case bt_brdrnone: sResult.Append( _T(" w:val=\"nil\"") ); break;
case bt_brdroutset: sResult.Append( _T(" w:val=\"outset\"") ); break;
case bt_brdrtriple: sResult.Append( _T(" w:val=\"triple\"") ); break;
case bt_brdrtnthsg: sResult.Append( _T(" w:val=\"thinThickSmallGap\"") ); break;
case bt_brdrthtnsg: sResult.Append( _T(" w:val=\"thickThinSmallGap\"") ); break;
case bt_brdrtnthtnsg: sResult.Append( _T(" w:val=\"thinThickThinSmallGap\"") ); break;
case bt_brdrtnthtnmg: sResult.Append( _T(" w:val=\"thinThickThinMediumGap\"") ); break;
case bt_brdrtnthmg: sResult.Append( _T(" w:val=\"thinThickMediumGap\"") ); break;
case bt_brdrthtnmg: sResult.Append( _T(" w:val=\"thickThinMediumGap\"") ); break;
case bt_brdrtnthlg: sResult.Append( _T(" w:val=\"thinThickLargeGap\"") ); break;
case bt_brdrthtnlg: sResult.Append( _T(" w:val=\"thickThinLargeGap\"") ); break;
case bt_brdrtnthtnlg: sResult.Append( _T(" w:val=\"thinThickThinLargeGap\"") ); break;
case bt_brdrwavy: sResult.Append( _T(" w:val=\"wave\"") ); break;
case bt_brdrwavydb: sResult.Append( _T(" w:val=\"doubleWave\"") ); break;
case bt_brdrdashdotstr: sResult.Append( _T(" w:val=\"dashDotStroked\"") ); break;
case bt_brdremboss: sResult.Append( _T(" w:val=\"threeDEmboss\"") ); break;
case bt_brdrengrave: sResult.Append( _T(" w:val=\"threeDEngrave\"") ); break;
case bt_brdrs: sResult.Append( _T(" w:val=\"single\"") ); break;
case bt_brdrth: sResult.Append( _T(" w:val=\"thick\"") ); break;
case bt_brdrsh: sResult.Append( _T(" w:val=\"\"thin") ); break;
case bt_brdrdb: sResult.Append( _T(" w:val=\"double\"") ); break;
case bt_brdrdot: sResult.Append( _T(" w:val=\"dotted\"") ); break;
case bt_brdrdash: sResult.Append( _T(" w:val=\"dashed\"") ); break;
case bt_brdrhair: sResult.Append( _T(" w:val=\"hair\"") ); break;
case bt_brdrdashsm: sResult.Append( _T(" w:val=\"dashSmallGap\"") ); break;
case bt_brdrdashd: sResult.Append( _T(" w:val=\"dotDash\"") ); break;
case bt_brdrdashdd: sResult.Append( _T(" w:val=\"dotDotDash\"") ); break;
case bt_brdrinset: sResult.Append( _T(" w:val=\"inset\"") ); break;
case bt_brdrnone: sResult.Append( _T(" w:val=\"nil\"") ); break;
case bt_brdroutset: sResult.Append( _T(" w:val=\"outset\"") ); break;
case bt_brdrtriple: sResult.Append( _T(" w:val=\"triple\"") ); break;
case bt_brdrtnthsg: sResult.Append( _T(" w:val=\"thinThickSmallGap\"") ); break;
case bt_brdrthtnsg: sResult.Append( _T(" w:val=\"thickThinSmallGap\"") ); break;
case bt_brdrtnthtnsg: sResult.Append( _T(" w:val=\"thinThickThinSmallGap\"") ); break;
case bt_brdrtnthtnmg: sResult.Append( _T(" w:val=\"thinThickThinMediumGap\"") ); break;
case bt_brdrtnthmg: sResult.Append( _T(" w:val=\"thinThickMediumGap\"") ); break;
case bt_brdrthtnmg: sResult.Append( _T(" w:val=\"thickThinMediumGap\"") ); break;
case bt_brdrtnthlg: sResult.Append( _T(" w:val=\"thinThickLargeGap\"") ); break;
case bt_brdrthtnlg: sResult.Append( _T(" w:val=\"thickThinLargeGap\"") ); break;
case bt_brdrtnthtnlg: sResult.Append( _T(" w:val=\"thinThickThinLargeGap\"") ); break;
case bt_brdrwavy: sResult.Append( _T(" w:val=\"wave\"") ); break;
case bt_brdrwavydb: sResult.Append( _T(" w:val=\"doubleWave\"") ); break;
case bt_brdrdashdotstr: sResult.Append( _T(" w:val=\"dashDotStroked\"") ); break;
case bt_brdremboss: sResult.Append( _T(" w:val=\"threeDEmboss\"") ); break;
case bt_brdrengrave: sResult.Append( _T(" w:val=\"threeDEngrave\"") ); break;
}
if( false == sResult.IsEmpty() )
{
......@@ -687,24 +687,24 @@ CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_INT( m_nForeColor, sResult, _T("cf") )
switch( m_eUnderStyle )
{
case uls_Single: sResult.Append( _T("\\ul") );break;
case uls_Dotted: sResult.Append( _T("\\uld") );break;
case uls_Dashed: sResult.Append( _T("\\uldash") );break;
case uls_Dash_dotted: sResult.Append( _T("\\uldashd") );break;
case uls_Dash_dot_dotted: sResult.Append( _T("\\uldashdd") );break;
case uls_Double: sResult.Append( _T("\\uldb") );break;
case uls_Heavy_wave: sResult.Append( _T("\\ulhwave") );break;
case uls_Long_dashe: sResult.Append( _T("\\ulldash") );break;
case uls_Stops_all: sResult.Append( _T("\\ulnone") );break;
case uls_Thick: sResult.Append( _T("\\ulth") );break;
case uls_Thick_dotted: sResult.Append( _T("\\ulthd") );break;
case uls_Thick_dashed: sResult.Append( _T("\\ulthdash") );break;
case uls_Thick_dash_dotted: sResult.Append( _T("\\ulthdashd") );break;
case uls_Single: sResult.Append( _T("\\ul") );break;
case uls_Dotted: sResult.Append( _T("\\uld") );break;
case uls_Dashed: sResult.Append( _T("\\uldash") );break;
case uls_Dash_dotted: sResult.Append( _T("\\uldashd") );break;
case uls_Dash_dot_dotted: sResult.Append( _T("\\uldashdd") );break;
case uls_Double: sResult.Append( _T("\\uldb") );break;
case uls_Heavy_wave: sResult.Append( _T("\\ulhwave") );break;
case uls_Long_dashe: sResult.Append( _T("\\ulldash") );break;
case uls_Stops_all: sResult.Append( _T("\\ulnone") );break;
case uls_Thick: sResult.Append( _T("\\ulth") );break;
case uls_Thick_dotted: sResult.Append( _T("\\ulthd") );break;
case uls_Thick_dashed: sResult.Append( _T("\\ulthdash") );break;
case uls_Thick_dash_dotted: sResult.Append( _T("\\ulthdashd") );break;
case uls_Thick_dash_dot_dotted: sResult.Append( _T("\\ulthdashdd") );break;
case uls_Thick_long_dashed: sResult.Append( _T("\\ulthldash") );break;
case uls_Double_wave: sResult.Append( _T("\\ululdbwave") );break;
case uls_Word: sResult.Append( _T("\\ulw") );break;
case uls_Wave: sResult.Append( _T("\\ulwave") );break;
case uls_Thick_long_dashed: sResult.Append( _T("\\ulthldash") );break;
case uls_Double_wave: sResult.Append( _T("\\ululdbwave") );break;
case uls_Word: sResult.Append( _T("\\ulw") );break;
case uls_Wave: sResult.Append( _T("\\ulwave") );break;
}
RENDER_RTF_INT( m_nUnderlineColor, sResult, _T("ulc") )
RENDER_RTF_INT( m_nUp, sResult, _T("up") )
......@@ -730,13 +730,13 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
switch( m_nAnimated )
{
case 0:sResult.Append(_T("<w:effect w:val=\"none\"/>"));break;
case 1:sResult.Append(_T("<w:effect w:val=\"lights\"/>"));break;
case 2:sResult.Append(_T("<w:effect w:val=\"blinkBackground\"/>"));break;
case 3:sResult.Append(_T("<w:effect w:val=\"sparkle\"/>"));break;
case 4:sResult.Append(_T("<w:effect w:val=\"antsBlack\"/>"));break;
case 5:sResult.Append(_T("<w:effect w:val=\"antsRed\"/>"));break;
case 6:sResult.Append(_T("<w:effect w:val=\"shimmer\"/>"));break;
case 0: sResult.Append(_T("<w:effect w:val=\"none\"/>")); break;
case 1: sResult.Append(_T("<w:effect w:val=\"lights\"/>")); break;
case 2: sResult.Append(_T("<w:effect w:val=\"blinkBackground\"/>"));break;
case 3: sResult.Append(_T("<w:effect w:val=\"sparkle\"/>")); break;
case 4: sResult.Append(_T("<w:effect w:val=\"antsBlack\"/>")); break;
case 5: sResult.Append(_T("<w:effect w:val=\"antsRed\"/>")); break;
case 6: sResult.Append(_T("<w:effect w:val=\"shimmer\"/>")); break;
}
RENDER_OOX_BOOL( m_bBold, sResult, _T("w:b") )
RENDER_OOX_BOOL( m_bCaps, sResult, _T("w:caps") )
......@@ -1909,7 +1909,14 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
sResult += _T("\"/>") ;
}
}
RtfSectionPtr oCurSection;
if(true == poRtfDocument->GetItem( oCurSection ) )
{
sResult += oCurSection->RenderToOOX(oRenderParameter);
oCurSection->m_bFinalize = false;
}
if( 0 == m_bAutoHyphenation )
sResult.Append( _T("<w:suppressAutoHyphens/>") );
else if( 1 == m_bAutoHyphenation )
......@@ -1950,8 +1957,8 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
}
RENDER_OOX_INT_ATTRIBUTE( m_nIndLeft, sIndent, _T("w:left") );
RENDER_OOX_INT_ATTRIBUTE( m_nIndRight, sIndent, _T("w:right") );
RENDER_OOX_INT_ATTRIBUTE( m_nIndStart, sIndent, _T("w:start") );
RENDER_OOX_INT_ATTRIBUTE( m_nIndEnd, sIndent, _T("w:end") );
//RENDER_OOX_INT_ATTRIBUTE( m_nIndStart, sIndent, _T("w:start") );
//RENDER_OOX_INT_ATTRIBUTE( m_nIndEnd, sIndent, _T("w:end") );
if( false == sIndent.IsEmpty() )
{
sResult += _T("<w:ind ");
......@@ -2296,7 +2303,7 @@ CString RtfCellProperty::RenderToOOX(RenderParameter oRenderParameter)
if( true == m_oShading.IsValid() )
{
if (PROP_DEF != m_nShadingPctFrom && PROP_DEF != m_oShading.m_nValue )
if (PROP_DEF != m_nShadingPctFrom && PROP_DEF != m_oShading.m_nValue && m_oShading.m_nValue != 0)
{
// todooo тут цвет подложки подкладывается от ячейки, таблицы или еще какой хрени
// пока берем второй цвет паттерна Romanization_Armenian.rtf
......
......@@ -120,6 +120,8 @@
sResult.AppendFormat( _T("%d"), prop );\
}
class RtfSection;
typedef boost::shared_ptr<RtfSection> RtfSectionPtr;
class RtfFont : public IRenderableProperty
{
......@@ -260,14 +262,14 @@ public:
return m_byteRed == oColor.m_byteRed && m_byteGreen == oColor.m_byteGreen && m_byteBlue == oColor.m_byteBlue &&
m_byteTint == oColor.m_byteTint && m_byteShade == oColor.m_byteShade && m_eTheme == oColor.m_eTheme;
}
void SetHEX(int color)
void SetHEX(int color)
{
SetDefault();
m_byteRed= (color&0xFF0000) >>16;
m_byteGreen = (color&0xFF00) >>4;
m_byteBlue = (color&0xFF);
m_byteRed = (color&0xFF0000) >> 16;
m_byteGreen = (color&0xFF00) >> 8;
m_byteBlue = (color&0xFF);
}
void SetRGB(BYTE red, BYTE green, BYTE blue)
void SetRGB(BYTE red, BYTE green, BYTE blue)
{
SetDefault();
m_byteRed = red;
......@@ -361,7 +363,7 @@ public:
else
SetDefault();
}
CString ToHexColor()
CString ToHexColor(bool bBGR = false)
{
BYTE byteRed = SetShade( m_byteRed );
byteRed = SetTint( byteRed );
......@@ -384,7 +386,9 @@ public:
sBlue.AppendFormat( _T("0%x"), byteBlue );
else
sBlue.AppendFormat( _T("%x"), byteBlue );
return sRed + sGreen + sBlue;
if (bBGR) return sBlue + sGreen + sRed ;
else return sRed + sGreen + sBlue ;
}
int ToInt()const
......@@ -779,10 +783,10 @@ public:
//свойство должно быть как единое целое, поэтому если oBorPr задано, то переписыватся целиком
if( st_none != oParPr.m_eType || PROP_DEF != oParPr.m_nValue || PROP_DEF != oParPr.m_nForeColor || PROP_DEF != oParPr.m_nBackColor )
{
m_eType = oParPr.m_eType;
m_nValue = oParPr.m_nValue;
m_nForeColor = oParPr.m_nForeColor;
m_nBackColor = oParPr.m_nBackColor;
m_eType = oParPr.m_eType;
m_nValue = oParPr.m_nValue;
m_nForeColor = oParPr.m_nForeColor;
m_nBackColor = oParPr.m_nBackColor;
}
}
CString RenderToOOX(RenderParameter oRenderParameter);
......@@ -2667,7 +2671,7 @@ public:
int m_bStyleSWCell;//\tscswcell SW cell.
int m_bStyleSECell;//\tscsecell SE cell.
RtfCharProperty m_oCharProperty;
RtfCharProperty m_oCharProperty;
RtfParagraphProperty()
{
......
......@@ -621,51 +621,52 @@ public:
}
CString RenderToRtf(RenderParameter oRenderParameter);
CString RenderToOOX(RenderParameter oRenderParameter);
private: CString SaveFile( TextItemContainerPtr oTarget, RenderParameter oRenderParameter, bool bHeader);
private:
CString SaveFile( TextItemContainerPtr oTarget, RenderParameter oRenderParameter, bool bHeader);
};
typedef boost::shared_ptr<RtfSectionProperty> RtfSectionPropertyPtr;
typedef boost::shared_ptr<RtfDocumentProperty> RtfDocumentPropertyPtr;
class RtfSection :public TextItemContainer
typedef boost::shared_ptr<RtfSectionProperty> RtfSectionPropertyPtr;
typedef boost::shared_ptr<RtfDocumentProperty> RtfDocumentPropertyPtr;
class RtfSection : public TextItemContainer
{
public: RtfSectionProperty m_oProperty;
public:
RtfSectionProperty m_oProperty;
RtfSection()
{
}
int GetType()
{
return TYPE_RTF_SECTION;
}
CString RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
sResult.Append( m_oProperty.RenderToRtf( oRenderParameter ) );
if( RENDER_TO_RTF_PARAM_NO_SECT != oRenderParameter.nType )
sResult.Append(_T("\\sectd"));
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append( m_aArray[i]->RenderToRtf( oRenderParameter ) );
return sResult;
}
CString RenderToOOX(RenderParameter oRenderParameter)
bool m_bFinalize;
RtfSection()
{
m_bFinalize = false;
}
int GetType()
{
return TYPE_RTF_SECTION;
}
CString RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
sResult.Append( m_oProperty.RenderToRtf( oRenderParameter ) );
if( RENDER_TO_RTF_PARAM_NO_SECT != oRenderParameter.nType )
sResult.Append(_T("\\sectd"));
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
//CString sResult;
// CString sSectProp;
// RenderParameter oNewParam = oRenderParameter;
// oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
// sSectProp.Append(m_oProperty.RenderToOOX(oNewParam));
// CString sParagraphs;
// for( int i = 0; i < (int)m_aArray.size(); i++ )
// {
// sParagraphs.Append( m_aArray[i]->RenderToOOX(oNewParam) );
// }
//if( oRenderParameter.nType == RENDER_TO_OOX_PARAM_LAST )
// return sParagraphs + sSectProp;
//else
// return _T("<w:p><w:pPr>") + sSectProp + _T("</w:pPr></w:p>") + sParagraphs;
return _T("");
sResult += m_aArray[i]->RenderToRtf( oRenderParameter );
}
return sResult;
}
CString RenderToOOX(RenderParameter oRenderParameter)
{
if (!m_bFinalize) return L"";
m_bFinalize = false; // тут .. чтобы не повторилось при конвертации колонтитулов
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
return m_oProperty.RenderToOOX(oNewParam);
}
};
typedef boost::shared_ptr<RtfSection> RtfSectionPtr;
......@@ -85,11 +85,20 @@ void RtfShape::SetDefault()
DEFAULT_PROPERTY( m_bHidden )
//Text box
DEFAULT_PROPERTY( m_nAnchorText )
DEFAULT_PROPERTY_DEF( m_nTexpLeft, 91440 )
DEFAULT_PROPERTY_DEF( m_nTexpTop, 45720 )
DEFAULT_PROPERTY_DEF( m_nTexpRight, 91440 )
DEFAULT_PROPERTY_DEF( m_nTexpBottom, 45720 )
DEFAULT_PROPERTY( m_nTexpLeft )
DEFAULT_PROPERTY( m_nTexpTop )
DEFAULT_PROPERTY( m_nTexpRight )
DEFAULT_PROPERTY( m_nTexpBottom )
DEFAULT_PROPERTY( m_bFitShapeToText )
DEFAULT_PROPERTY( m_bFitTextToShape )
DEFAULT_PROPERTY( m_nCcol )
DEFAULT_PROPERTY( m_nTxdir )
DEFAULT_PROPERTY( m_nWrapText )
//Geometry
DEFAULT_PROPERTY( m_nAdjustValue )
DEFAULT_PROPERTY( m_nAdjustValue2 )
......@@ -197,22 +206,24 @@ CString RtfShape::RenderToRtf(RenderParameter oRenderParameter)
m_oPicture->m_nHeightGoal = m_oPicture->m_nHeight;
}
if( RtfPicture::dt_wmf == m_oPicture->eDataType )
sResult.Append( m_oPicture->RenderToRtf( oRenderParameter ) );
{
sResult += m_oPicture->RenderToRtf( oRenderParameter );
}
else
{
sResult.Append( _T("{\\*\\shppict") );
sResult.Append( m_oPicture->RenderToRtf( oRenderParameter ) );
sResult.Append( _T("}") );
sResult.Append( _T("{\\nonshppict") );
sResult.Append( m_oPicture->GenerateWMF( oRenderParameter ) );
sResult += _T("{\\*\\shppict");
sResult += m_oPicture->RenderToRtf( oRenderParameter );
sResult += _T("}");
sResult += _T("{\\nonshppict");
sResult += m_oPicture->GenerateWMF( oRenderParameter );
sResult.Append( _T("}") );
sResult += _T("}");
}
}
else
{
sResult.Append(_T("{\\shp"));
sResult.Append(_T("{\\*\\shpinst"));
sResult += _T("{\\shp");
sResult += _T("{\\*\\shpinst");
RENDER_RTF_INT( m_nLeft , sResult, _T("shpleft") );
RENDER_RTF_INT( m_nTop , sResult, _T("shptop") );
RENDER_RTF_INT( m_nBottom , sResult, _T("shpbottom") );
......@@ -223,42 +234,43 @@ CString RtfShape::RenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_INT( m_nWrapSideType , sResult, _T("shpwrk") );
RENDER_RTF_BOOL( m_bLockAnchor , sResult, _T("shplockanchor") );
sResult.Append( _T("\\shpbxignore") );
sResult.Append( _T("\\shpbyignore") );
sResult += _T("\\shpbxignore");
sResult += _T("\\shpbyignore");
sResult.AppendFormat( _T("{\\sp{\\sn fUseShapeAnchor}{\\sv %d}}"), false);
sResult.AppendFormat( _T("{\\sp{\\sn fPseudoInline}{\\sv %d}}"), true);
sResult.Append( RenderToRtfShapeProperty( oRenderParameter ) );
sResult += RenderToRtfShapeProperty( oRenderParameter );
//picture
if( 0 != m_oPicture )
if( 0 != m_oPicture && m_nFillType == 1 || m_nFillType == 2 || m_nFillType == 9)
{
sResult.Append( _T("{\\sp{\\sn fillBlip}{\\sv "));
sResult.Append( m_oPicture->RenderToRtf( oRenderParameter ) );
sResult.Append( _T("}}") );
sResult += _T("{\\sp{\\sn fillBlip}{\\sv ");
sResult += m_oPicture->RenderToRtf( oRenderParameter );
sResult += _T("}}");
}
//textbox
if( 0 != m_aTextItems )
{
sResult.Append( _T("{\\shptxt ") );
sResult.Append( m_aTextItems->RenderToRtf( oRenderParameter ) );
sResult.Append( _T("}") );
sResult += _T("{\\shptxt ");
sResult += m_aTextItems->RenderToRtf( oRenderParameter );
sResult += _T("}");
}
sResult.Append(_T("}"));
if( 0 != m_oPicture )
{
sResult.Append(_T("{\\shprslt\\par\\plain"));
sResult.Append( m_oPicture->GenerateWMF( oRenderParameter ) );
sResult.Append(_T("\\par}"));
}
sResult.Append(_T("}"));
sResult += _T("}");
//if( 0 != m_oPicture )
//{
// sResult += _T("{\\shprslt\\par\\plain"));
// sResult += m_oPicture->GenerateWMF( oRenderParameter ) );
// sResult += _T("\\par}"));
//}
sResult += _T("}");
}
}
else
{
sResult.Append(_T("{\\shp"));
sResult.Append(_T("{\\*\\shpinst"));
sResult += _T("{\\shp");
sResult += _T("{\\*\\shpinst");
RENDER_RTF_INT( m_nLeft , sResult, _T("shpleft") );
RENDER_RTF_INT( m_nTop , sResult, _T("shptop") );
RENDER_RTF_INT( m_nBottom , sResult, _T("shpbottom") );
......@@ -272,54 +284,54 @@ CString RtfShape::RenderToRtf(RenderParameter oRenderParameter)
switch(m_eXAnchor)
{
case ax_page: sResult.Append( _T("\\shpbxpage") ); break;
case ax_margin: sResult.Append( _T("\\shpbxmargin") ); break;
case ax_column: sResult.Append( _T("\\shpbxcolumn") ); break;
case ax_page: sResult += _T("\\shpbxpage"); break;
case ax_margin: sResult += _T("\\shpbxmargin"); break;
case ax_column: sResult += _T("\\shpbxcolumn"); break;
}
sResult.Append( _T("\\shpbxignore") );
sResult += _T("\\shpbxignore");
switch(m_eYAnchor)
{
case ay_page: sResult.Append( _T("\\shpbypage") ); break;
case ay_margin: sResult.Append( _T("\\shpbymargin") ); break;
case ay_Para: sResult.Append( _T("\\shpbypara") ); break;
case ay_page: sResult += _T("\\shpbypage"); break;
case ay_margin: sResult += _T("\\shpbymargin"); break;
case ay_Para: sResult += _T("\\shpbypara"); break;
}
sResult.Append( _T("\\shpbyignore") );
RENDER_RTF_INT( m_nZOrderRelative, sResult, _T("shpfblwtxt") );
sResult += _T("\\shpbyignore");
RENDER_RTF_INT( m_nZOrderRelative, sResult, _T("shpfblwtxt"));
sResult.Append( RenderToRtfShapeProperty( oRenderParameter ) );
sResult += RenderToRtfShapeProperty( oRenderParameter );
//picture
if( 0 != m_oPicture)
{
if (m_nShapeType == 75)
{
sResult.Append( _T("{\\sp{\\sn pib}{\\sv ") );
sResult.Append( m_oPicture->RenderToRtf( oRenderParameter ) );
sResult.Append( _T("}}") );
sResult += _T("{\\sp{\\sn pib}{\\sv ");
sResult += m_oPicture->RenderToRtf( oRenderParameter );
sResult += _T("}}");
}
else
else if (m_nFillType == 1 || m_nFillType == 2 || m_nFillType == 9)
{
sResult.Append( _T("{\\sp{\\sn fillType}{\\sv 2}}"));
sResult.Append( _T("{\\sp{\\sn fillBlip}{\\sv "));
sResult.Append( m_oPicture->RenderToRtf( oRenderParameter ) );
sResult.Append( _T("}}") );
sResult += _T("{\\sp{\\sn fillType}{\\sv 2}}");
sResult += _T("{\\sp{\\sn fillBlip}{\\sv ");
sResult += m_oPicture->RenderToRtf( oRenderParameter );
sResult += _T("}}");
}
}
//textbox
if( 0 != m_aTextItems )
if( m_aTextItems )
{
sResult.Append( _T("{\\shptxt ") );
sResult.Append( m_aTextItems->RenderToRtf( oRenderParameter ) );
sResult.Append( _T("}") );
sResult += _T("{\\shptxt ");
sResult += m_aTextItems->RenderToRtf( oRenderParameter );
sResult += _T("}");
}
sResult.Append(_T("}"));
if( 0 != m_oPicture && m_nShapeType == 75 )
sResult += _T("}");
if( m_oPicture && m_nShapeType == 75 )
{
sResult.Append(_T("{\\shprslt\\par\\plain"));
sResult.Append( m_oPicture->GenerateWMF( oRenderParameter ) );
sResult.Append(_T("\\par}"));
sResult += _T("{\\shprslt\\par\\plain");
sResult += m_oPicture->GenerateWMF( oRenderParameter );
sResult += _T("\\par}");
}
sResult.Append(_T("}"));
sResult += _T("}");
}
//восстанавливаем координаты и если нужно поворачиваем
m_nLeft = nLeft;
......@@ -340,7 +352,7 @@ CString RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter)
{
CString sResult;
//Position absolute
//Position absolute
if( PROP_DEF != m_nPositionH )
sResult.AppendFormat( _T("{\\sp{\\sn posh}{\\sv %d}}"), m_nPositionH);
if( PROP_DEF != m_nPositionHRelative )
......@@ -355,7 +367,7 @@ CString RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter)
if( PROP_DEF != m_bAllowOverlap )
sResult.AppendFormat( _T("{\\sp{\\sn fAllowOverlap}{\\sv %d}}"), m_bAllowOverlap);
//Position relative
//Position relative
if( PROP_DEF != m_nPositionHPct )
sResult.AppendFormat( _T("{\\sp{\\sn pctHorizPos}{\\sv %d}}"), m_nPositionHPct);
if( PROP_DEF != m_nPositionVPct )
......@@ -372,11 +384,11 @@ CString RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter)
sResult.AppendFormat( _T("{\\sp{\\sn colStart}{\\sv %d}}"), m_nColStart);
if( PROP_DEF != m_nColSpan )
sResult.AppendFormat( _T("{\\sp{\\sn colSpan}{\\sv %d}}"), m_nColSpan);
//Rehydration
//Rehydration
if( _T("") != m_sMetroBlob )
sResult.AppendFormat( _T("{\\sp{\\sn metroBlob}{\\sv %d}}"), m_sMetroBlob.GetBuffer());
//Object Type
//Object Type
if( PROP_DEF != m_bIsBullet )
sResult.AppendFormat( _T("{\\sp{\\sn fIsBullet}{\\sv %d}}"), m_bIsBullet);
if( PROP_DEF != m_nRotation )
......@@ -387,19 +399,46 @@ CString RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter)
sResult.AppendFormat( _T("{\\sp{\\sn fFlipH}{\\sv %d}}"), m_bFlipH);
if( PROP_DEF != m_nShapeType )
sResult.AppendFormat( _T("{\\sp{\\sn shapeType}{\\sv %d}}"), m_nShapeType);
if( PROP_DEF != m_nWrapDistLeft )
sResult.AppendFormat( _T("{\\sp{\\sn dxWrapDistLeft}{\\sv %d}}"), RtfUtility::Twips2Emu( m_nWrapDistLeft ));
if( PROP_DEF != m_nWrapDistTop )
sResult.AppendFormat( _T("{\\sp{\\sn dyWrapDistTop}{\\sv %d}}"), RtfUtility::Twips2Emu( m_nWrapDistTop ));
if( PROP_DEF != m_nWrapDistRight )
sResult.AppendFormat( _T("{\\sp{\\sn dxWrapDistRight}{\\sv %d}}"), RtfUtility::Twips2Emu( m_nWrapDistRight ));
if( PROP_DEF != m_nWrapDistBottom )
sResult.AppendFormat( _T("{\\sp{\\sn dyWrapDistBottom}{\\sv %d}}"),RtfUtility::Twips2Emu( m_nWrapDistBottom ));
if( PROP_DEF != m_nZOrderRelative )
sResult.AppendFormat( _T("{\\sp{\\sn fBehindDocument}{\\sv %d}}"), m_nZOrderRelative);
if( PROP_DEF != m_bHidden )
sResult.AppendFormat( _T("{\\sp{\\sn fHidden}{\\sv %d}}"), m_bHidden);
//Geometry
//Text
//sResult += _T("{\\sp{\\sn fLockText}{\\sv 0}}");
if( PROP_DEF != m_nTexpLeft)
sResult.AppendFormat( _T("{\\sp{\\sn dxTextLeft}{\\sv %d}}"), m_nTexpLeft);
if( PROP_DEF != m_nTexpTop)
sResult.AppendFormat( _T("{\\sp{\\sn dyTextTop}{\\sv %d}}"), m_nTexpTop);
if( PROP_DEF != m_nTexpRight)
sResult.AppendFormat( _T("{\\sp{\\sn dxTextRight}{\\sv %d}}"), m_nTexpRight);
if( PROP_DEF != m_nTexpBottom)
sResult.AppendFormat( _T("{\\sp{\\sn dyTextBottom}{\\sv %d}}"), m_nTexpBottom);
if( PROP_DEF != m_nAnchorText )
sResult.AppendFormat( _T("{\\sp{\\sn anchorText}{\\sv %d}}"), m_nAnchorText);
//else
{
if( PROP_DEF != m_nWrapDistLeft )
sResult.AppendFormat( _T("{\\sp{\\sn dxWrapDistLeft}{\\sv %d}}"), RtfUtility::Twips2Emu( m_nWrapDistLeft ));
if( PROP_DEF != m_nWrapDistTop )
sResult.AppendFormat( _T("{\\sp{\\sn dyWrapDistTop}{\\sv %d}}"), RtfUtility::Twips2Emu( m_nWrapDistTop ));
if( PROP_DEF != m_nWrapDistRight )
sResult.AppendFormat( _T("{\\sp{\\sn dxWrapDistRight}{\\sv %d}}"), RtfUtility::Twips2Emu( m_nWrapDistRight ));
if( PROP_DEF != m_nWrapDistBottom )
sResult.AppendFormat( _T("{\\sp{\\sn dyWrapDistBottom}{\\sv %d}}"),RtfUtility::Twips2Emu( m_nWrapDistBottom ));
}
if( PROP_DEF != m_bFitShapeToText )
sResult.AppendFormat( _T("{\\sp{\\sn fFitShapeToText}{\\sv %d}}"), m_bFitShapeToText);
if( PROP_DEF != m_bFitTextToShape )
sResult.AppendFormat( _T("{\\sp{\\sn fFitTextToShape}{\\sv %d}}"), m_bFitTextToShape);
if( PROP_DEF != m_nCcol )
sResult.AppendFormat( _T("{\\sp{\\sn ccol}{\\sv %d}}"), m_nCcol);
if( PROP_DEF != m_nTxdir )
sResult.AppendFormat( _T("{\\sp{\\sn txdir}{\\sv %d}}"), m_nTxdir);
if( PROP_DEF != m_nWrapText )
sResult.AppendFormat( _T("{\\sp{\\sn WrapText}{\\sv %d}}"), m_nWrapText);
//Geometry
if( PROP_DEF != m_nAdjustValue )
sResult.AppendFormat( _T("{\\sp{\\sn adjustValue}{\\sv %d}}"), m_nAdjustValue );
if( PROP_DEF != m_nAdjustValue )
......@@ -420,12 +459,12 @@ CString RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter)
sResult.AppendFormat( _T("{\\sp{\\sn adjust9Value}{\\sv %d}}"), m_nAdjustValue9 );
if( PROP_DEF != m_nAdjustValue )
sResult.AppendFormat( _T("{\\sp{\\sn adjust10Value}{\\sv %d}}"), m_nAdjustValue10 );
//Connectors
//Connectors
if( PROP_DEF != m_nConnectionType )
sResult.AppendFormat( _T("{\\sp{\\sn cxk}{\\sv %d}}"), m_nConnectionType );
if( PROP_DEF != m_nConnectorStyle )
sResult.AppendFormat( _T("{\\sp{\\sn cxstyle}{\\sv %d}}"), m_nConnectorStyle );
//Picture Effects
//Picture Effects
if( PROP_DEF != m_nCropFromTop )
sResult.AppendFormat( _T("{\\sp{\\sn cropFromTop}{\\sv %d}}"), m_nCropFromTop );
if( PROP_DEF != m_nCropFromBottom )
......@@ -434,8 +473,7 @@ CString RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter)
sResult.AppendFormat( _T("{\\sp{\\sn cropFromLeft}{\\sv %d}}"), m_nCropFromLeft );
if( PROP_DEF != m_nCropFromRight )
sResult.AppendFormat( _T("{\\sp{\\sn cropFromRight}{\\sv %d}}"), m_nCropFromRight );
//Grouped Shapes
//Grouped Shapes
if( PROP_DEF != m_nGroupBottom )
sResult.AppendFormat( _T("{\\sp{\\sn groupBottom}{\\sv %d}}"), m_nCropFromRight );
if( PROP_DEF != m_nGroupLeft )
......@@ -458,7 +496,7 @@ CString RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter)
sResult.AppendFormat( _T("{\\sp{\\sn dhgt}{\\sv %d}}"), m_nRelZOrder );
//Fill
if( 0 == m_bFilled )
sResult.Append( _T("{\\sp{\\sn fFilled}{\\sv 0}}"));
sResult += _T("{\\sp{\\sn fFilled}{\\sv 0}}");
if( PROP_DEF != m_nFillType )
sResult.AppendFormat( _T("{\\sp{\\sn fillType}{\\sv %d}}"), m_nFillType );
if( PROP_DEF != m_nFillColor )
......@@ -473,7 +511,7 @@ CString RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter)
sResult.AppendFormat( _T("{\\sp{\\sn fillAngle}{\\sv %d}}"), m_nFillAngle * 65536 );
//Line
if( 0 == m_bLine )
sResult.Append( _T("{\\sp{\\sn fLine}{\\sv 0}}"));
sResult += _T("{\\sp{\\sn fLine}{\\sv 0}}");
if( PROP_DEF != m_nLineColor )
sResult.AppendFormat( _T("{\\sp{\\sn lineColor}{\\sv %d}}"), m_nLineColor );
if( PROP_DEF != m_nLineStartArrow )
......@@ -493,29 +531,28 @@ CString RtfShape::RenderToRtfShapeProperty(RenderParameter oRenderParameter)
if( PROP_DEF != m_nLineDashing )
sResult.AppendFormat( _T("{\\sp{\\sn lineDashing}{\\sv %d}}"), m_nLineDashing );
//pWrapPolygonVertices Points of the text wrap polygon.
//pWrapPolygonVertices Points of the text wrap polygon.
int nWrapPointCount = (int)m_aWrapPoints.size();
if( nWrapPointCount > 0 )
{
sResult.AppendFormat( _T("{\\sp{\\sn pWrapPolygonVertices}{\\sv 8;%d"), nWrapPointCount / 2 );
for( int i = 0; i < nWrapPointCount - 1; i += 2 )
sResult.AppendFormat( _T(";(%d,%d)"), m_aWrapPoints[i], m_aWrapPoints[ i + 1 ] );
sResult.Append( _T("}}") );
sResult += _T("}}");
}
//WordArt
if( PROP_DEF != m_bGtext )
{
sResult.AppendFormat( _T("{\\sp{\\sn fGtext}{\\sv %d}}"), m_bGtext );
if( !m_sGtextUNICODE.IsEmpty() )
{
sResult.Append ( _T("{\\sp{\\sn gtextUNICODE}{\\sv "));
sResult.Append ( m_sGtextUNICODE + _T("}}"));
sResult += _T("{\\sp{\\sn gtextUNICODE}{\\sv ");
sResult += m_sGtextUNICODE + _T("}}");
}
if( !m_sGtextFont.IsEmpty() )
{
sResult.Append ( _T("{\\sp{\\sn gtextFont}{\\sv "));
sResult.Append ( m_sGtextFont + _T("}}"));
sResult += _T("{\\sp{\\sn gtextFont}{\\sv ");
sResult += m_sGtextFont + _T("}}");
}
if( PROP_DEF != m_nGtextSize )
sResult.AppendFormat( _T("{\\sp{\\sn gtextSize}{\\sv %d}}"), m_nGtextSize );
......@@ -529,374 +566,6 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
RtfDocument* poDocument = static_cast<RtfDocument*>(oRenderParameter.poDocument);
if( PROP_DEF != m_nShapeType && 0 != m_nShapeType )
{
if( false && RENDER_TO_OOX_PARAM_SHAPE_WSHAPE != oRenderParameter.nType && NULL != m_oPicture ) //картинки пишем как drawing
{
if( st_inline == m_eShapeType )
{
if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nHeightGoal )
{
sResult.Append( _T("<w:r><w:drawing><wp:inline") );
int nDistLeft = 0;
int nDistTop = 0;
int nDistRight = 0;
int nDistBottom = 0;
if( PROP_DEF != m_nWrapDistLeft )
nDistLeft = RtfUtility::Twips2Emu( m_nWrapDistLeft );
if( PROP_DEF != m_nWrapDistTop )
nDistTop = RtfUtility::Twips2Emu( m_nWrapDistTop );
if( PROP_DEF != m_nWrapDistRight )
nDistRight = RtfUtility::Twips2Emu( m_nWrapDistRight );
if( PROP_DEF != m_nWrapDistBottom )
nDistBottom = RtfUtility::Twips2Emu( m_nWrapDistBottom );
RENDER_OOX_INT_ATTRIBUTE( nDistLeft, sResult, _T("distL") )
RENDER_OOX_INT_ATTRIBUTE( nDistTop, sResult, _T("distT") )
RENDER_OOX_INT_ATTRIBUTE( nDistRight, sResult, _T("distR") )
RENDER_OOX_INT_ATTRIBUTE( nDistBottom, sResult, _T("distB") )
sResult.Append( _T(">") );
if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nHeightGoal )
sResult.AppendFormat( _T("<wp:extent cx=\"%d\" cy=\"%d\"/>"), RtfUtility::Twips2Emu( m_oPicture->m_nWidthGoal ), RtfUtility::Twips2Emu( m_oPicture->m_nHeightGoal ) );
int nImageID = poDocument->m_oIdGenerator.Generate_ImagePropId();
sResult.AppendFormat( _T("<wp:docPr id=\"%d\" name=\"%ls\" descr=\"\"/>"), m_sName.GetBuffer(), nImageID );
int nCropLeft = PROP_DEF;
int nCropTop = PROP_DEF;
int nCropRight = PROP_DEF;
int nCropBottom = PROP_DEF;
if( PROP_DEF != m_nCropFromLeft )
nCropLeft = (int)( 100000.0 * m_nCropFromLeft / 65536 );
else if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nCropL )
nCropLeft = (int)( 100000.0 * m_oPicture->m_nCropL / m_oPicture->m_nWidthGoal );
if( PROP_DEF != m_nCropFromTop )
nCropTop = (int)( 100000.0 * m_nCropFromTop / 65536 );
else if( PROP_DEF != m_oPicture->m_nHeightGoal && PROP_DEF != m_oPicture->m_nCropT )
nCropTop = (int)( 100000.0 * m_oPicture->m_nCropT / m_oPicture->m_nHeightGoal );
if( PROP_DEF != m_nCropFromRight )
nCropRight = (int)( 100000.0 * m_nCropFromRight / 65536 );
else if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nCropR )
nCropRight = (int)( 100000.0 * m_oPicture->m_nCropR / m_oPicture->m_nWidthGoal );
if( PROP_DEF != m_nCropFromBottom )
nCropBottom = (int)( 100000.0 * m_nCropFromBottom / 65536 );
else if( PROP_DEF != m_oPicture->m_nHeightGoal && PROP_DEF != m_oPicture->m_nCropB )
nCropBottom = (int)( 100000.0 * m_oPicture->m_nCropB / m_oPicture->m_nHeightGoal );
sResult.Append( _T("<a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\"><pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">"));
sResult.Append( _T("<pic:nvPicPr>") );
sResult.AppendFormat( _T("<pic:cNvPr id=\"%d\" name=\"%ls\" descr=\"\"/>"), nImageID, m_sName.GetBuffer() );
if( 0 == m_bLockAnchor )
sResult.Append( _T("<pic:cNvPicPr><a:picLocks noChangeAspect=\"0\" noChangeArrowheads=\"1\"/></pic:cNvPicPr>") );
else
sResult.Append( _T("<pic:cNvPicPr><a:picLocks noChangeAspect=\"1\" noChangeArrowheads=\"1\"/></pic:cNvPicPr>") );
sResult.Append( _T("</pic:nvPicPr>") );
sResult.AppendFormat( _T("<pic:blipFill><a:blip r:embed=\"%ls\"/>"), m_oPicture->RenderToOOX(oRenderParameter).GetBuffer() );
CString sCrop;
if( PROP_DEF != nCropLeft )
sCrop.AppendFormat( _T(" l=\"%d\""), nCropLeft ); //тысячный доли процента
if( PROP_DEF != nCropTop )
sCrop.AppendFormat( _T(" t=\"%d\""), nCropTop );
if( PROP_DEF != nCropRight )
sCrop.AppendFormat( _T(" r=\"%d\""), nCropRight );
if( PROP_DEF != nCropBottom )
sCrop.AppendFormat( _T(" b=\"%d\""), nCropBottom );
if( false == sCrop.IsEmpty() )
sResult.AppendFormat( _T("<a:srcRect %ls/>"), sCrop.GetBuffer() );
sResult.Append( _T("<a:stretch><a:fillRect/></a:stretch>") );
sResult.Append( _T("</pic:blipFill>") );
if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nHeightGoal )
{
sResult.Append( _T("<pic:spPr bwMode=\"auto\">") );
sResult.Append( _T("<a:xfrm") );
int nRotation = PROP_DEF;
if( PROP_DEF != m_nRotation )
nRotation = m_nRotation;
else
nRotation = m_nRelRotation;
if( PROP_DEF != nRotation )
{
int nOOXRotation = (int)( 60000.0 * nRotation / 0x10000 );//Опытным путем 1 градус == 60000
sResult.AppendFormat( _T(" rot=\"%d\""), nOOXRotation );
}
sResult.Append( _T(">") );
sResult.AppendFormat( _T("<a:off x=\"0\" y=\"0\"/><a:ext cx=\"%d\" cy=\"%d\"/>"), m_oPicture->m_nWidthGoal, m_oPicture->m_nHeightGoal );
sResult.Append( _T("</a:xfrm>") );
sResult.Append( _T("<a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom>") );
sResult.Append( _T("</pic:spPr>") );
}
sResult.Append( _T("</pic:pic></a:graphicData></a:graphic>") );
sResult.Append( _T("</wp:inline></w:drawing></w:r>") );
}
}
else
{
if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nHeightGoal )
{
sResult.Append( _T("<w:r><w:drawing><wp:anchor") );
int nDistLeft = 0;//аттрибуты обязательные
int nDistTop = 0;
int nDistRight = 0;
int nDistBottom = 0;
int nOverlap = 1;
int nBehind = 0;
int nLayout = 1;
int nLocked = 0;
int nZIndex = 100;
if( PROP_DEF != m_nWrapDistLeft )
nDistLeft = RtfUtility::Twips2Emu( m_nWrapDistLeft );
if( PROP_DEF != m_nWrapDistTop )
nDistTop = RtfUtility::Twips2Emu( m_nWrapDistTop );
if( PROP_DEF != m_nWrapDistRight )
nDistRight = RtfUtility::Twips2Emu( m_nWrapDistRight );
if( PROP_DEF != m_nWrapDistBottom )
nDistBottom = RtfUtility::Twips2Emu( m_nWrapDistBottom );
if( PROP_DEF != m_bAllowOverlap )
nOverlap = m_bAllowOverlap;
if( PROP_DEF != m_nZOrderRelative )
nBehind = m_nZOrderRelative;
if( PROP_DEF != m_bLayoutInCell )
nLayout = m_bLayoutInCell;
if( PROP_DEF != m_bLockAnchor )
nLocked = m_bLockAnchor;
if( PROP_DEF != m_nZOrder )
nZIndex = m_nZOrder;
RENDER_OOX_INT_ATTRIBUTE( nDistLeft, sResult, _T("distL") )
RENDER_OOX_INT_ATTRIBUTE( nDistTop, sResult, _T("distT") )
RENDER_OOX_INT_ATTRIBUTE( nDistRight, sResult, _T("distR") )
RENDER_OOX_INT_ATTRIBUTE( nDistBottom, sResult, _T("distB") )
RENDER_OOX_BOOL_ATTRIBUTE( nOverlap, sResult, _T("allowOverlap") )
RENDER_OOX_BOOL_ATTRIBUTE( nBehind, sResult, _T("behindDoc") )
RENDER_OOX_BOOL_ATTRIBUTE( m_bHidden, sResult, _T("hidden") )
RENDER_OOX_BOOL_ATTRIBUTE( nLayout, sResult, _T("layoutInCell") )
RENDER_OOX_BOOL_ATTRIBUTE( nLocked, sResult, _T("locked") )
RENDER_OOX_INT_ATTRIBUTE( nZIndex, sResult, _T("relativeHeight") )
RENDER_OOX_BOOL_ATTRIBUTE( 0, sResult, _T("simplePos") )
sResult.Append( _T(">") );
if( PROP_DEF != m_nLeft && PROP_DEF != m_nTop )
sResult.AppendFormat( _T("<wp:simplePos x=\"%d\" y=\"%d\"/>"),RtfUtility::Twips2Emu(m_nLeft), RtfUtility::Twips2Emu(m_nTop) );
if( ( PROP_DEF != m_nPositionHRelative || ax_none != m_eXAnchor ) && (PROP_DEF != m_nPositionH || PROP_DEF != m_nLeft ) )
{
sResult.Append( _T("<wp:positionH") );
if( PROP_DEF != m_nPositionHRelative )
{
switch( m_nPositionHRelative )
{
case 0: sResult.Append( _T(" relativeFrom=\"margin\"") );break;
case 1: sResult.Append( _T(" relativeFrom=\"page\"") );break;
case 2: sResult.Append( _T(" relativeFrom=\"column\"") );break;
case 3: sResult.Append( _T(" relativeFrom=\"character\"") );break;
case 4: sResult.Append( _T(" relativeFrom=\"leftMargin\"") );break;
case 5: sResult.Append( _T(" relativeFrom=\"rightMargin\"") );break;
case 6: sResult.Append( _T(" relativeFrom=\"insideMargin\"") );break;
case 7: sResult.Append( _T(" relativeFrom=\"outsideMargin\"") );break;
}
}
else
{
switch( m_eXAnchor )
{
case ax_margin: sResult.Append( _T(" relativeFrom=\"margin\"") );break;
case ax_page: sResult.Append( _T(" relativeFrom=\"page\"") );break;
case ax_column: sResult.Append( _T(" relativeFrom=\"column\"") );break;
}
}
sResult.Append( _T(">") );
if( PROP_DEF != m_nPositionH )
{
switch( m_nPositionH )
{
case 1: sResult.Append( _T("<wp:align>left</wp:align>") );break;
case 2: sResult.Append( _T("<wp:align>center</wp:align>") );break;
case 3: sResult.Append( _T("<wp:align>right</wp:align>") );break;
case 4: sResult.Append( _T("<wp:align>inside</wp:align>") );break;
case 5: sResult.Append( _T("<wp:align>outside</wp:align>") );break;
}
}
else
{
sResult.AppendFormat( _T("<wp:posOffset>%d</wp:posOffset>"), RtfUtility::Twips2Emu( m_nLeft ) );
}
sResult.Append( _T("</wp:positionH>") );
}
if( ( PROP_DEF != m_nPositionVRelative || ax_none != m_eYAnchor ) && (PROP_DEF != m_nPositionV || PROP_DEF != m_nTop ) )
{
sResult.Append( _T("<wp:positionV") );
if( PROP_DEF != m_nPositionVRelative )
{
switch( m_nPositionVRelative )
{
case 0: sResult.Append( _T(" relativeFrom=\"margin\"") );break;
case 1: sResult.Append( _T(" relativeFrom=\"page\"") );break;
case 2: sResult.Append( _T(" relativeFrom=\"paragraph\"") );break;
case 3: sResult.Append( _T(" relativeFrom=\"line\"") );break;
case 4: sResult.Append( _T(" relativeFrom=\"topMargin\"") );break;
case 5: sResult.Append( _T(" relativeFrom=\"bottomMargin\"") );break;
case 6: sResult.Append( _T(" relativeFrom=\"insideMargin\"") );break;
case 7: sResult.Append( _T(" relativeFrom=\"outsideMargin\"") );break;
}
}
else
{
switch( m_eYAnchor )
{
case ay_margin: sResult.Append( _T(" relativeFrom=\"margin\"") );break;
case ay_page: sResult.Append( _T(" relativeFrom=\"page\"") );break;
case ay_Para: sResult.Append( _T(" relativeFrom=\"paragraph\"") );break;
}
}
sResult.Append( _T(">") );
if( PROP_DEF != m_nPositionV )
{
switch( m_nPositionV )
{
case 1: sResult.Append( _T("<wp:align>top</wp:align>") );break;
case 2: sResult.Append( _T("<wp:align>center</wp:align>") );break;
case 3: sResult.Append( _T("<wp:align>bottom</wp:align>") );break;
case 4: sResult.Append( _T("<wp:align>inside</wp:align>") );break;
case 5: sResult.Append( _T("<wp:align>outside</wp:align>") );break;
}
}
else
{
sResult.AppendFormat( _T("<wp:posOffset>%d</wp:posOffset>"), RtfUtility::Twips2Emu( m_nTop ) );
}
sResult.Append( _T("</wp:positionV>") );
}
int nWidth;
int nHeight;
if( PROP_DEF != m_nLeft && PROP_DEF != m_nRight && PROP_DEF != m_nTop && PROP_DEF != m_nBottom )
{
nWidth = m_nRight - m_nLeft;
nHeight = m_nBottom - m_nTop;
}
else if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nHeightGoal )
{
nWidth = m_oPicture->m_nWidthGoal;
nHeight = m_oPicture->m_nHeightGoal;
}
if( PROP_DEF != nWidth && PROP_DEF != nHeight )
sResult.AppendFormat( _T("<wp:extent cx=\"%d\" cy=\"%d\"/>"), RtfUtility::Twips2Emu( nWidth ), RtfUtility::Twips2Emu( nHeight ) );
if( PROP_DEF != m_nWrapType && 3 != m_nWrapType)
{
sResult.Append( _T("<") );
CString sTag;
switch( m_nWrapType )
{
case 1:sTag.Append( _T("wp:wrapTopAndBottom") );break;
case 2:sTag.Append( _T("wp:wrapSquare") );break;
case 3:sTag.Append( _T("wp:wrapNone") );break;
case 4:sTag.Append( _T("wp:wrapTight") );break;
case 5:sTag.Append( _T("wp:wrapThrough") );break;
}
sResult.Append( sTag );
switch( m_nWrapSideType )
{
case 0:sResult.Append( _T(" wrapText=\"bothSides\"") );break;
case 1:sResult.Append( _T(" wrapText=\"left\"") );break;
case 2:sResult.Append( _T(" wrapText=\"right\"") );break;
case 3:sResult.Append( _T(" wrapText=\"largest\"") );break;
}
if( m_aWrapPoints.size() == 0 )
sResult.Append( _T("/>") );
else
{
sResult.Append( _T(">") );
sResult.Append( _T("<wp:wrapPolygon>") );
if( m_aWrapPoints.size() > 1 )
sResult.AppendFormat( _T("<wp:start x=\"%d\" y=\"%d\" />"), m_aWrapPoints[0], m_aWrapPoints[1] );
for( int i = 2; i < (int)m_aWrapPoints.size() - 1; i+=2 )
sResult.AppendFormat( _T("<wp:lineTo x=\"%d\" y=\"%d\" />"), m_aWrapPoints[i], m_aWrapPoints[i+1] );
sResult.Append( _T("</wp:wrapPolygon>") );
sResult.AppendFormat( _T("</%ls>"), sTag.GetBuffer() );
}
}
int nImageID = poDocument->m_oIdGenerator.Generate_ImagePropId();
sResult.AppendFormat( _T("<wp:docPr id=\"%d\" name=\"%ls\" descr=\"\"/>"), nImageID, m_sName.GetBuffer() );
int nCropLeft = PROP_DEF;
int nCropTop = PROP_DEF;
int nCropRight = PROP_DEF;
int nCropBottom = PROP_DEF;
if( PROP_DEF != m_nCropFromLeft )
nCropLeft = (int)( 100000.0 * m_nCropFromLeft / 65536 );
else if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nCropL )
nCropLeft = (int)( 100000.0 * m_oPicture->m_nCropL / m_oPicture->m_nWidthGoal );
if( PROP_DEF != m_nCropFromTop )
nCropTop = (int)( 100000.0 * m_nCropFromTop / 65536 );
else if( PROP_DEF != m_oPicture->m_nHeightGoal && PROP_DEF != m_oPicture->m_nCropT )
nCropTop = (int)( 100000.0 * m_oPicture->m_nCropT / m_oPicture->m_nHeightGoal );
if( PROP_DEF != m_nCropFromRight )
nCropRight = (int)( 100000.0 * m_nCropFromRight / 65536 );
else if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nCropR )
nCropRight = (int)( 100000.0 * m_oPicture->m_nCropR / m_oPicture->m_nWidthGoal );
if( PROP_DEF != m_nCropFromBottom )
nCropBottom = (int)( 100000.0 * m_nCropFromBottom / 65536 );
else if( PROP_DEF != m_oPicture->m_nHeightGoal && PROP_DEF != m_oPicture->m_nCropB )
nCropBottom = (int)( 100000.0 * m_oPicture->m_nCropB / m_oPicture->m_nHeightGoal );
sResult.Append( _T("<a:graphic><a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\"><pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">"));
sResult.Append( _T("<pic:nvPicPr>") );
sResult.AppendFormat( _T("<pic:cNvPr id=\"%d\" name=\"%ls\" descr=\"\"/>"), nImageID, m_sName.GetBuffer() );
if( 0 == m_bLockAnchor )
sResult.Append( _T("<pic:cNvPicPr><a:picLocks noChangeAspect=\"0\" noChangeArrowheads=\"1\"/></pic:cNvPicPr>") );
else
sResult.Append( _T("<pic:cNvPicPr><a:picLocks noChangeAspect=\"1\" noChangeArrowheads=\"1\"/></pic:cNvPicPr>") );
sResult.Append( _T("</pic:nvPicPr>") );
sResult.AppendFormat( _T("<pic:blipFill><a:blip r:embed=\"%ls\"/>"), m_oPicture->RenderToOOX(oRenderParameter).GetBuffer() );
CString sCrop;
if( PROP_DEF != nCropLeft )
sCrop.AppendFormat( _T(" l=\"%d\""), nCropLeft ); //тысячный доли процента
if( PROP_DEF != nCropTop )
sCrop.AppendFormat( _T(" t=\"%d\""), nCropTop );
if( PROP_DEF != nCropRight )
sCrop.AppendFormat( _T(" r=\"%d\""), nCropRight );
if( PROP_DEF != nCropBottom )
sCrop.AppendFormat( _T(" b=\"%d\""), nCropBottom );
if( false == sCrop.IsEmpty() )
sResult.AppendFormat( _T("<a:srcRect %ls/>"), sCrop.GetBuffer() );
sResult.Append( _T("<a:stretch><a:fillRect/></a:stretch>") );
sResult.Append( _T("</pic:blipFill>") );
if( PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nHeightGoal )
{
sResult.Append( _T("<pic:spPr bwMode=\"auto\">") );
sResult.Append( _T("<a:xfrm") );
int nRotation = PROP_DEF;
if( PROP_DEF != m_nRotation )
nRotation = m_nRotation;
else
nRotation = m_nRelRotation;
if( PROP_DEF != nRotation )
{
int nOOXRotation = (int)( 60000.0 * nRotation / 65536 );//Опытным путем 1 градус == 60000
sResult.AppendFormat( _T(" rot=\"%d\""), nOOXRotation );
}
sResult.Append( _T(">") );
sResult.AppendFormat( _T("<a:off x=\"0\" y=\"0\"/><a:ext cx=\"%d\" cy=\"%d\"/>"), m_oPicture->m_nWidthGoal, m_oPicture->m_nHeightGoal );
sResult.Append( _T("</a:xfrm>") );
sResult.Append( _T("<a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom>") );
sResult.Append( _T("</pic:spPr>") );
}
sResult.Append( _T("</pic:pic></a:graphicData></a:graphic>") );
sResult.Append( _T("</wp:anchor></w:drawing></w:r>") );
}
}
}
else
{
TextItemContainerPtr aTempTextItems;
if( 75 == m_nShapeType && 0 != m_aTextItems )
......@@ -908,7 +577,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
sResult = RenderToOOXBegin(oRenderParameter);
if( _T("") != sResult )
sResult.Append( RenderToOOXEnd(oRenderParameter) );
sResult += RenderToOOXEnd(oRenderParameter);
CString sOle;
if( 0 != aTempTextItems )
......@@ -940,7 +609,7 @@ CString RtfShape::RenderToOOX(RenderParameter oRenderParameter)
RtfOlePtr poCurOle = boost::static_pointer_cast< RtfOle, IDocumentElement >( piCurIDocumentElement );
if( NULL != poCurOle )
{
sOle.Append( poCurOle->RenderToOOX( oNewParam ) );
sOle += poCurOle->RenderToOOX( oNewParam );
bBreak = true;
break;
}
......@@ -967,50 +636,73 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
CString sResult;
if( RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2 == oRenderParameter.nType )
;
else if( RENDER_TO_OOX_PARAM_SHAPE_WSHAPE == oRenderParameter.nType )
sResult.Append(_T("<w:pict>"));
sResult += _T("<w:pict>");
else
sResult.Append(_T("<w:r><w:pict>"));//работает по умолчанию
sResult += _T("<w:r><w:pict>");//работает по умолчанию
if( _T("") == oRenderParameter.sValue )
sResult.Append( _T("<v:shape") );
sResult += _T("<v:shape");
else
sResult.AppendFormat( _T("<%ls"),oRenderParameter.sValue.GetBuffer() );
sResult.AppendFormat( _T(" id=\"_x0000_s%d\""), poDocument->GetShapeId( m_nID ) );
CString strUniqId;
if (m_sName.IsEmpty())
{
m_sName.AppendFormat(L"_x0000_s%d", poDocument->GetShapeId( m_nID ));
}
sResult += _T(" id=\"") + m_sName + _T("\"");
if( PROP_DEF != m_nShapeType )
sResult.AppendFormat( _T(" type=\"#_x0000_t%d\""), m_nShapeType );
if( 0 == m_bFilled) sResult += _T(" filled=\"f\"");
else sResult += _T(" filled=\"t\"");
if( 0 == m_bLine) sResult += _T(" stroked=\"f\"");
else sResult += _T(" stroked=\"t\"");
if( PROP_DEF != m_nFillColor)
{
RtfColor color(m_nFillColor);
sResult.AppendFormat( _T(" fillcolor=\"#") + color.ToHexColor(true) + _T("\""));
}
if( PROP_DEF != m_nLineColor)
{
RtfColor color(m_nLineColor);
sResult.AppendFormat( _T(" strokecolor=\"#") + color.ToHexColor(true) + _T("\""));
}
//Connectors
switch( m_nConnectionType )
{
case 0: sResult.Append(_T(" o:connecttype=\"custom\""));break;
case 1: sResult.Append(_T(" o:connecttype=\"none\""));break;
case 2: sResult.Append(_T(" o:connecttype=\"rect\""));break;
case 3: sResult.Append(_T(" o:connecttype=\"segments\""));break;
case 0: sResult += _T(" o:connecttype=\"custom\""); break;
case 1: sResult += _T(" o:connecttype=\"none\""); break;
case 2: sResult += _T(" o:connecttype=\"rect\""); break;
case 3: sResult += _T(" o:connecttype=\"segments\""); break;
}
switch( m_nConnectorStyle )
{
case 0: sResult.Append(_T(" o:connectortype=\"straight\""));break;
case 1: sResult.Append(_T(" o:connectortype=\"elbow\""));break;
case 2: sResult.Append(_T(" o:connectortype=\"curved\""));break;
case 3: sResult.Append(_T(" o:connectortype=\"none\""));break;
case 0: sResult += _T(" o:connectortype=\"straight\""); break;
case 1: sResult += _T(" o:connectortype=\"elbow\""); break;
case 2: sResult += _T(" o:connectortype=\"curved\""); break;
case 3: sResult += _T(" o:connectortype=\"none\""); break;
}
//Connectors
//Position
//-----------------------------------------------------------------------------------------------------------------
CString sStyle ;
if( PROP_DEF != m_nLeft && PROP_DEF != m_nRight && PROP_DEF != m_nTop && PROP_DEF != m_nBottom )
{
//не пишем если inline
if( 3 != m_nPositionHRelative || 3 != m_nPositionVRelative )
{
sStyle .Append( _T("position:absolute;") );
sStyle.AppendFormat(_T("margin-left:%fpt;"), RtfUtility::Twip2pt(m_nLeft) );
sStyle.AppendFormat(_T("margin-top:%fpt;"), RtfUtility::Twip2pt(m_nTop));
sStyle.AppendFormat(_T("margin-bottom:%fpt;"), RtfUtility::Twip2pt(m_nBottom) );
sStyle.AppendFormat(_T("margin-right:%fpt;"), RtfUtility::Twip2pt(m_nRight));
sStyle .Append ( _T("position:absolute;") );
sStyle.AppendFormat ( _T("margin-left:%fpt;") , RtfUtility::Twip2pt(m_nLeft) );
sStyle.AppendFormat ( _T("margin-top:%fpt;") , RtfUtility::Twip2pt(m_nTop));
sStyle.AppendFormat ( _T("margin-bottom:%fpt;") , RtfUtility::Twip2pt(m_nBottom) );
sStyle.AppendFormat ( _T("margin-right:%fpt;") , RtfUtility::Twip2pt(m_nRight));
}
int nWidth = m_nRight - m_nLeft;
int nHeight = m_nBottom - m_nTop;
......@@ -1018,14 +710,15 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
}
else if( PROP_DEF != m_nRelLeft && PROP_DEF != m_nRelRight && PROP_DEF != m_nRelTop && PROP_DEF != m_nRelBottom )
{
int nWidth = m_nRelRight - m_nRelLeft;
int nWidth = m_nRelRight - m_nRelLeft;
int nHeight = m_nRelBottom - m_nRelTop;
sStyle .Append( _T("position:absolute;") );
sStyle.AppendFormat(_T("left:%d;"), m_nRelLeft );
sStyle.AppendFormat(_T("top:%d;"), m_nRelTop);
sStyle.AppendFormat(_T("bottom:%d;"), m_nRelBottom );
sStyle.AppendFormat(_T("right:%d;"), m_nRelRight);
sStyle.AppendFormat(_T("width:%d;height:%d;"), nWidth, nHeight);
sStyle.Append ( _T("position:absolute;") );
sStyle.AppendFormat ( _T("left:%d;") , m_nRelLeft );
sStyle.AppendFormat ( _T("top:%d;") , m_nRelTop);
sStyle.AppendFormat ( _T("bottom:%d;") , m_nRelBottom );
sStyle.AppendFormat ( _T("right:%d;") , m_nRelRight);
sStyle.AppendFormat ( _T("width:%d;height:%d;") , nWidth, nHeight);
}
else if( 0 != m_oPicture && PROP_DEF != m_oPicture->m_nWidthGoal && PROP_DEF != m_oPicture->m_nHeightGoal && PROP_DEF != (int)m_oPicture->m_dScaleX && PROP_DEF != (int)m_oPicture->m_dScaleY )
{
......@@ -1046,12 +739,12 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
switch( m_nPositionH )
{
case 0: sStyle.Append(_T("mso-position-horizontal:absolute;"));break;
case 1: sStyle.Append(_T("mso-position-horizontal:left;"));break;
case 2: sStyle.Append(_T("mso-position-horizontal:center;"));break;
case 3: sStyle.Append(_T("mso-position-horizontal:right;"));break;
case 4: sStyle.Append(_T("mso-position-horizontal:inside;"));break;
case 5: sStyle.Append(_T("mso-position-horizontal:outside;"));break;
case 0: sStyle += _T("mso-position-horizontal:absolute;"); break;
case 1: sStyle += _T("mso-position-horizontal:left;"); break;
case 2: sStyle += _T("mso-position-horizontal:center;"); break;
case 3: sStyle += _T("mso-position-horizontal:right;"); break;
case 4: sStyle += _T("mso-position-horizontal:inside;"); break;
case 5: sStyle += _T("mso-position-horizontal:outside;"); break;
}
if( PROP_DEF != m_nPositionHPct )//todo
{
......@@ -1063,34 +756,34 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
{
switch( m_nPositionHRelative )
{
case 0: sStyle.Append(_T("mso-position-horizontal-relative:margin;"));break;
case 1: sStyle.Append(_T("mso-position-horizontal-relative:page;"));break;
case 2: sStyle.Append(_T("mso-position-horizontal-relative:text;"));break;
case 3: sStyle.Append(_T("mso-position-horizontal-relative:char;"));break;
case 4: sStyle.Append(_T("mso-position-horizontal-relative:left-margin-area;"));break;
case 5: sStyle.Append(_T("mso-position-horizontal-relative:right-margin-area;"));break;
case 6: sStyle.Append(_T("mso-position-horizontal-relative:inner-margin-area;"));break;
case 7: sStyle.Append(_T("mso-position-horizontal-relative:outer-margin-area;"));break;
case 0: sStyle += _T("mso-position-horizontal-relative:margin;"); break;
case 1: sStyle += _T("mso-position-horizontal-relative:page;"); break;
case 2: sStyle += _T("mso-position-horizontal-relative:text;"); break;
case 3: sStyle += _T("mso-position-horizontal-relative:char;"); break;
case 4: sStyle += _T("mso-position-horizontal-relative:left-margin-area;"); break;
case 5: sStyle += _T("mso-position-horizontal-relative:right-margin-area;"); break;
case 6: sStyle += _T("mso-position-horizontal-relative:inner-margin-area;"); break;
case 7: sStyle += _T("mso-position-horizontal-relative:outer-margin-area;"); break;
}
}
else
{
switch( m_eXAnchor )
{
case ax_page: sStyle.Append(_T("mso-position-horizontal-relative:page;"));break;
case ax_margin: sStyle.Append(_T("mso-position-horizontal-relative:margin;"));break;
//case ax_column: sStyle.Append(_T("mso-position-horizontal-relative:text;"));break;
case ax_page: sStyle += _T("mso-position-horizontal-relative:page;"); break;
case ax_margin: sStyle += _T("mso-position-horizontal-relative:margin;"); break;
//case ax_column: sStyle += _T("mso-position-horizontal-relative:text;"));break;
}
}
switch( m_nPositionV )
{
case 0: sStyle.Append(_T("mso-position-vertical:absolute;"));break;
case 1: sStyle.Append(_T("mso-position-vertical:top;"));break;
case 2: sStyle.Append(_T("mso-position-vertical:center;"));break;
case 3: sStyle.Append(_T("mso-position-vertical:bottom;"));break;
case 4: sStyle.Append(_T("mso-position-vertical:inside;"));break;
case 5: sStyle.Append(_T("mso-position-vertical:outside;"));break;
case 0: sStyle += _T("mso-position-vertical:absolute;"); break;
case 1: sStyle += _T("mso-position-vertical:top;"); break;
case 2: sStyle += _T("mso-position-vertical:center;"); break;
case 3: sStyle += _T("mso-position-vertical:bottom;"); break;
case 4: sStyle += _T("mso-position-vertical:inside;"); break;
case 5: sStyle += _T("mso-position-vertical:outside;"); break;
}
if( PROP_DEF != m_nPositionVPct )
sStyle.AppendFormat(_T("mso-top-percent:%d;"), m_nPositionVPct);
......@@ -1101,46 +794,48 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
{
switch( m_nPositionVRelative )
{
case 0: sStyle.Append(_T("mso-position-vertical-relative:margin;"));break;
case 1: sStyle.Append(_T("mso-position-vertical-relative:page;"));break;
case 2: sStyle.Append(_T("mso-position-vertical-relative:text;"));break;
case 3: sStyle.Append(_T("mso-position-vertical-relative:line;"));break;
case 4: sStyle.Append(_T("mso-position-vertical-relative:top-margin-area;"));break;
case 5: sStyle.Append(_T("mso-position-vertical-relative:bottom-margin-area;"));break;
case 6: sStyle.Append(_T("mso-position-vertical-relative:inner-margin-area;"));break;
case 7: sStyle.Append(_T("mso-position-vertical-relative:outer-margin-area;"));break;
case 0: sStyle += _T("mso-position-vertical-relative:margin;"); break;
case 1: sStyle += _T("mso-position-vertical-relative:page;"); break;
case 2: sStyle += _T("mso-position-vertical-relative:text;"); break;
case 3: sStyle += _T("mso-position-vertical-relative:line;"); break;
case 4: sStyle += _T("mso-position-vertical-relative:top-margin-area;"); break;
case 5: sStyle += _T("mso-position-vertical-relative:bottom-margin-area;"); break;
case 6: sStyle += _T("mso-position-vertical-relative:inner-margin-area;"); break;
case 7: sStyle += _T("mso-position-vertical-relative:outer-margin-area;"); break;
}
}
else
{
switch( m_eYAnchor )
{
case ay_page: sStyle.Append(_T("mso-position-vertical-relative:page;"));break;
case ay_margin: sStyle.Append(_T("mso-position-vertical-relative:margin;"));break;
//case ay_Para: sStyle.Append(_T("mso-position-vertical-relative:text;"));break;
case ay_page: sStyle += _T("mso-position-vertical-relative:page;"); break;
case ay_margin: sStyle += _T("mso-position-vertical-relative:margin;"); break;
//case ay_Para: sStyle += _T("mso-position-vertical-relative:text;"); break;
}
}
if( PROP_DEF != m_nPctWidth )
sStyle.AppendFormat(_T("mso-width-percent:%d;"), m_nPctWidth);
switch( m_nPctWidthRelative )
{
case 0:sStyle.Append(_T("mso-width-relative:margin;"));break;
case 1:sStyle.Append(_T("mso-width-relative:page;"));break;
case 2:sStyle.Append(_T("mso-width-relative:left-margin-area;"));break;
case 3:sStyle.Append(_T("mso-width-relative:right-margin-area;"));break;
case 4:sStyle.Append(_T("mso-width-relative:inner-margin-area;"));break;
case 5:sStyle.Append(_T("mso-width-relative:outer-margin-area;"));break;
case 0: sStyle += _T("mso-width-relative:margin;"); break;
case 1: sStyle += _T("mso-width-relative:page;"); break;
case 2: sStyle += _T("mso-width-relative:left-margin-area;"); break;
case 3: sStyle += _T("mso-width-relative:right-margin-area;"); break;
case 4: sStyle += _T("mso-width-relative:inner-margin-area;"); break;
case 5: sStyle += _T("mso-width-relative:outer-margin-area;"); break;
}
if( PROP_DEF != m_nPctHeight )
sStyle.AppendFormat(_T("mso-height-percent:%d;"), m_nPctHeight);
switch( m_nPctHeightRelative )
{
case 0:sStyle.Append(_T("mso-height-relative:margin;"));break;
case 1:sStyle.Append(_T("mso-height-relative:page;"));break;
case 2:sStyle.Append(_T("mso-height-relative:top-margin-area;"));break;
case 3:sStyle.Append(_T("mso-height-relative:bottom-margin-area;"));break;
case 4:sStyle.Append(_T("mso-height-relative:inner-margin-area;"));break;
case 5:sStyle.Append(_T("mso-height-relative:outer-margin-area;"));break;
case 0: sStyle += _T("mso-height-relative:margin;"); break;
case 1: sStyle += _T("mso-height-relative:page;"); break;
case 2: sStyle += _T("mso-height-relative:top-margin-area;"); break;
case 3: sStyle += _T("mso-height-relative:bottom-margin-area;"); break;
case 4: sStyle += _T("mso-height-relative:inner-margin-area;"); break;
case 5: sStyle += _T("mso-height-relative:outer-margin-area;"); break;
}
if( PROP_DEF != m_nRotation )
......@@ -1175,25 +870,40 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
if( PROP_DEF != m_nWrapDistBottom )
sStyle.AppendFormat( _T("mso-wrap-distance-bottom:%fpt;"), RtfUtility::Twip2pt( m_nWrapDistBottom ));
switch( m_nAnchorText)
{
case 0: sStyle += _T("v-text-anchor:top;"); break;
case 1: sStyle += _T("v-text-anchor:middle;"); break;
case 2: sStyle += _T("v-text-anchor:bottom;"); break;
case 3: sStyle += _T("v-text-anchor:topcenter;"); break;
case 4: sStyle += _T("v-text-anchor:middle-center;"); break;
case 5: sStyle += _T("v-text-anchor:bottom-center;"); break;
case 6: sStyle += _T("v-text-anchor:top-baseline;"); break;
case 7: sStyle += _T("v-text-anchor:bottom-baseline;"); break;
case 8: sStyle += _T("v-text-anchor:top-center-baseline;"); break;
case 9: sStyle += _T("v-text-anchor:bottom-center-baseline;"); break;
}
//---------------------------------------------------------------------------------------------------------------------------
if( false == sStyle.IsEmpty() )
{
sStyle.Delete( sStyle.GetLength() - 1 );
sResult.AppendFormat( _T(" style=\"%ls\""),sStyle.GetBuffer() );
sResult += _T(" style=\"") + sStyle + _T("\"");
}
//----------------------------------------------------------------------------------------------------------------------------
if( PROP_DEF != m_bLayoutInCell )
{
if( 0 == m_bLayoutInCell )
sResult.Append( _T(" o:allowincell=\"false\""));
sResult += _T(" o:allowincell=\"false\"");
else
sResult.Append( _T(" o:allowincell=\"true\""));
sResult += _T(" o:allowincell=\"true\"");
}
if( PROP_DEF != m_bAllowOverlap )
{
if( 0 == m_bAllowOverlap )
sResult.Append( _T(" o:allowoverlap=\"false\""));
sResult += _T(" o:allowoverlap=\"false\"");
else
sResult.Append( _T(" o:allowoverlap=\"true\""));
sResult += _T(" o:allowoverlap=\"true\"");
}
//Position
......@@ -1243,133 +953,143 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
//Geometry
if( m_aWrapPoints.size() > 0 )
{
sResult.Append( _T(" wrapcoords=\""));
sResult += _T(" wrapcoords=\"");
sResult.AppendFormat( _T("%d"), m_aWrapPoints[0]);
for( int i = 1; i < (int)m_aWrapPoints.size(); i++ )
{
sResult.AppendFormat( _T(" %d"), m_aWrapPoints[i]);
sResult.Append( _T("\""));
}
sResult += _T("\"");
}
if( PROP_DEF != m_nGroupLeft && PROP_DEF != m_nGroupTop )
sResult.AppendFormat( _T(" coordorigin=\"%d,%d\""), m_nGroupLeft, m_nGroupTop);
if( PROP_DEF != m_nGroupLeft && PROP_DEF != m_nGroupTop && PROP_DEF != m_nGroupRight && PROP_DEF != m_nGroupBottom)
sResult.AppendFormat( _T(" coordsize=\"%d,%d\""), m_nGroupRight - m_nGroupLeft, m_nGroupBottom - m_nGroupTop );
if( true == m_bIsOle ) sResult.Append( _T(" o:ole=\"\"") );
if( true == m_bFilled ) sResult.Append( _T(" filled=\"t\"") );
else sResult.Append( _T(" filled=\"f\"") );
if( true == m_bLine ) sResult.Append( _T(" stroked=\"t\"") );
else sResult.Append( _T(" stroked=\"f\"") );
if( true == m_bIsOle ) sResult += _T(" o:ole=\"\"");
if(PROP_DEF != m_nLineWidth)
sResult.AppendFormat( _T(" strokeweight=\"%fpt\""), RtfUtility::Emu2Pt(m_nLineWidth) );
sResult.Append( _T(">") );
sResult += _T(">");
if( PROP_DEF != m_nWrapType && 3 != m_nWrapType)
{
sResult.Append( _T("<w10:wrap"));
sResult += _T("<w10:wrap");
switch( m_nWrapType )
{
case 1:sResult.Append( _T(" type=\"topAndBottom\""));break;
case 2:sResult.Append( _T(" type=\"square\""));break;
case 3:sResult.Append( _T(" type=\"none\""));break;
case 4:sResult.Append( _T(" type=\"tight\""));break;
case 5:sResult.Append( _T(" type=\"through\""));break;
case 1:sResult += _T(" type=\"topAndBottom\""); break;
case 2:sResult += _T(" type=\"square\""); break;
case 3:sResult += _T(" type=\"none\""); break;
case 4:sResult += _T(" type=\"tight\""); break;
case 5:sResult += _T(" type=\"through\""); break;
}
switch( m_nWrapSideType )
{
case 0:sResult.Append( _T(" side=\"both\""));break;
case 1:sResult.Append( _T(" side=\"left\""));break;
case 2:sResult.Append( _T(" side=\"right\""));break;
case 3:sResult.Append( _T(" side=\"largest\""));break;
case 0:sResult += _T(" side=\"both\""); break;
case 1:sResult += _T(" side=\"left\""); break;
case 2:sResult += _T(" side=\"right\""); break;
case 3:sResult += _T(" side=\"largest\""); break;
}
sResult.Append( _T("/>"));
sResult += _T("/>");
}
//Line
CString sStroke;
if( PROP_DEF != m_nLineStartArrow )
//Line
if( 0 != m_bLine)
{
CString sStroke;
switch( m_nLineDashing )
{
case 1: sStroke += _T(" dashstyle=\"shortdash\""); break;
case 2: sStroke += _T(" dashstyle=\"shortdot\""); break;
case 3: sStroke += _T(" dashstyle=\"shortdashdot\""); break;
case 4: sStroke += _T(" dashstyle=\"shortdashdotdot\"");break;
case 5: sStroke += _T(" dashstyle=\"dot\""); break;
case 6: sStroke += _T(" dashstyle=\"dash\""); break;
case 7: sStroke += _T(" dashstyle=\"longdash\""); break;
case 8: sStroke += _T(" dashstyle=\"dashdot\""); break;
case 9: sStroke += _T(" dashstyle=\"longdashdot\""); break;
case 10: sStroke += _T(" dashstyle=\"longdashdotdot\"");break;
}
switch( m_nLineStartArrow )
{
case 0: sStroke.Append( _T(" startarrow=\"none\"") ); break;
case 1: sStroke.Append( _T(" startarrow=\"block\"") ); break;
case 2: sStroke.Append( _T(" startarrow=\"classic\"") ); break;
case 3: sStroke.Append( _T(" startarrow=\"diamond\"") ); break;
case 4: sStroke.Append( _T(" startarrow=\"oval\"") ); break;
case 5: sStroke.Append( _T(" startarrow=\"open\"") ); break;
case 6: sStroke.Append( _T(" startarrow=\"block\"") ); break;
case 7: sStroke.Append( _T(" startarrow=\"block\"") ); break;
case 0: sStroke += _T(" startarrow=\"none\""); break;
case 1: sStroke += _T(" startarrow=\"block\""); break;
case 2: sStroke += _T(" startarrow=\"classic\""); break;
case 3: sStroke += _T(" startarrow=\"diamond\""); break;
case 4: sStroke += _T(" startarrow=\"oval\""); break;
case 5: sStroke += _T(" startarrow=\"open\""); break;
case 6: sStroke += _T(" startarrow=\"block\""); break;
case 7: sStroke += _T(" startarrow=\"block\""); break;
}
}
if( PROP_DEF != m_nLineStartArrowLength )
{
switch( m_nLineStartArrowLength )
{
case 0: sStroke.Append( _T(" startarrowlength=\"short\"") ); break;
case 1: sStroke.Append( _T(" startarrowlength=\"medium\"") ); break;
case 2: sStroke.Append( _T(" startarrowlength=\"long\"") ); break;
case 0: sStroke += _T(" startarrowlength=\"short\""); break;
case 1: sStroke += _T(" startarrowlength=\"medium\""); break;
case 2: sStroke += _T(" startarrowlength=\"long\""); break;
}
}
if( PROP_DEF != m_nLineStartArrowWidth )
{
switch( m_nLineStartArrowWidth )
{
case 0: sStroke.Append( _T(" startarrowwidth=\"narrow\"") ); break;
case 1: sStroke.Append( _T(" startarrowwidth=\"medium\"") ); break;
case 2: sStroke.Append( _T(" startarrowwidth=\"wide\"") ); break;
case 0: sStroke += _T(" startarrowwidth=\"narrow\""); break;
case 1: sStroke += _T(" startarrowwidth=\"medium\""); break;
case 2: sStroke += _T(" startarrowwidth=\"wide\""); break;
}
}
if( PROP_DEF != m_nLineEndArrow )
{
switch( m_nLineEndArrow )
{
case 0: sStroke.Append( _T(" endarrow=\"none\"") ); break;
case 1: sStroke.Append( _T(" endarrow=\"block\"") ); break;
case 2: sStroke.Append( _T(" endarrow=\"classic\"") ); break;
case 3: sStroke.Append( _T(" endarrow=\"diamond\"") ); break;
case 4: sStroke.Append( _T(" endarrow=\"oval\"") ); break;
case 5: sStroke.Append( _T(" endarrow=\"open\"") ); break;
case 6: sStroke.Append( _T(" endarrow=\"block\"") ); break;
case 7: sStroke.Append( _T(" endarrow=\"block\"") ); break;
case 0: sStroke += _T(" endarrow=\"none\""); break;
case 1: sStroke += _T(" endarrow=\"block\""); break;
case 2: sStroke += _T(" endarrow=\"classic\""); break;
case 3: sStroke += _T(" endarrow=\"diamond\""); break;
case 4: sStroke += _T(" endarrow=\"oval\""); break;
case 5: sStroke += _T(" endarrow=\"open\""); break;
case 6: sStroke += _T(" endarrow=\"block\""); break;
case 7: sStroke += _T(" endarrow=\"block\""); break;
}
}
if( PROP_DEF != m_nLineEndArrowLength )
{
switch( m_nLineEndArrowLength )
{
case 0: sStroke.Append( _T(" endarrowlength=\"short\"") ); break;
case 1: sStroke.Append( _T(" endarrowlength=\"medium\"") ); break;
case 2: sStroke.Append( _T(" endarrowlength=\"long\"") ); break;
case 0: sStroke += _T(" endarrowlength=\"short\""); break;
case 1: sStroke += _T(" endarrowlength=\"medium\""); break;
case 2: sStroke += _T(" endarrowlength=\"long\""); break;
}
}
if( PROP_DEF != m_nLineEndArrowWidth )
{
switch( m_nLineEndArrowWidth )
{
case 0: sStroke.Append( _T(" endarrowwidth=\"narrow\"") ); break;
case 1: sStroke.Append( _T(" endarrowwidth=\"medium\"") ); break;
case 2: sStroke.Append( _T(" endarrowwidth=\"wide\"") ); break;
case 0: sStroke += _T(" endarrowwidth=\"narrow\""); break;
case 1: sStroke += _T(" endarrowwidth=\"medium\""); break;
case 2: sStroke += _T(" endarrowwidth=\"wide\""); break;
}
if( false == sStroke.IsEmpty())
{
sResult += _T("<v:stroke ") + sStroke + _T("/>");
}
}
if( false == sStroke.IsEmpty() )
sResult.AppendFormat( _T("<v:stroke %ls/>"), sStroke.GetBuffer() );
if( 0 != m_aTextItems )
{
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
sResult.AppendFormat( _T("<v:textbox inset=\"%.2fpt,%.2fpt,%.2fpt,%.2fpt\">"), RtfUtility::Emu2Pt(m_nTexpLeft), RtfUtility::Emu2Pt(m_nTexpTop), RtfUtility::Emu2Pt(m_nTexpRight), RtfUtility::Emu2Pt(m_nTexpBottom) );
sResult.Append( _T("<w:txbxContent>") );
sResult.Append( m_aTextItems->RenderToOOX(oNewParam) );
sResult.Append( _T("</w:txbxContent>") );
sResult.Append( _T("</v:textbox>") );
sResult += _T("<v:textbox");
if (m_nTexpLeft != PROP_DEF && m_nTexpTop != PROP_DEF && m_nTexpRight != PROP_DEF && m_nTexpBottom != PROP_DEF)
{
sResult.AppendFormat( _T("< inset=\"%.2fpt,%.2fpt,%.2fpt,%.2fpt\">"),
RtfUtility::Emu2Pt(m_nTexpLeft), RtfUtility::Emu2Pt(m_nTexpTop), RtfUtility::Emu2Pt(m_nTexpRight), RtfUtility::Emu2Pt(m_nTexpBottom) );
}
else
sResult += _T(">");
sResult += _T("<w:txbxContent>");
sResult += m_aTextItems->RenderToOOX(oNewParam);
sResult += _T("</w:txbxContent>");
sResult += _T("</v:textbox>");
}
if( m_oPicture != 0)
CString sPicture;
if( m_oPicture )
{
CString sPicture = m_oPicture->RenderToOOX(oRenderParameter);
sPicture = m_oPicture->RenderToOOX(oRenderParameter);
if (m_nShapeType == PROP_DEF || m_nShapeType == 75)
{
......@@ -1398,7 +1118,8 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
else if( PROP_DEF != m_oPicture->m_nHeightGoal && PROP_DEF != m_oPicture->m_nCropB )
nCropBottom = (int)( 65536 * ( 1.0 * m_oPicture->m_nCropB / m_oPicture->m_nHeightGoal) );
sResult.AppendFormat( _T("<v:imagedata r:id=\"%ls\""), sPicture.GetBuffer() );
sResult += _T("<v:imagedata r:id=\"") + sPicture + _T("\"");
if( PROP_DEF != nCropLeft )
sResult.AppendFormat( _T(" cropleft=\"%df\""), nCropLeft );
if( PROP_DEF != nCropTop )
......@@ -1407,18 +1128,76 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
sResult.AppendFormat( _T(" cropright=\"%df\""), nCropRight );
if( PROP_DEF != nCropBottom )
sResult.AppendFormat( _T(" cropbottom=\"%df\""), nCropBottom );
sResult.Append( _T(" o:title=\"\"/>") );
sResult += _T(" o:title=\"\"/>");
}
}
//-----------------------------------------------------------------------------------------------
if( 0 != m_bFilled)
{
sResult += _T("<v:fill");
if (!sPicture.IsEmpty() && m_nShapeType != 75)
{
sResult += _T(" r:id=\"") + sPicture + _T("\"");
if( PROP_DEF == m_nFillType) m_nFillType = 2;
}
switch(m_nFillType)
{
case 1: sResult += _T(" type=\"pattern\""); break;
case 2: sResult += _T(" type=\"tile\""); break;
case 3: sResult += _T(" type=\"frame\""); break;
case 4: sResult += _T(" type=\"gradient\""); break;
case 5: sResult += _T(" type=\"gradient\""); break;
case 6: sResult += _T(" type=\"gradient\""); break;
case 7: sResult += _T(" type=\"gradient\""); break;
case 8: sResult += _T(" type=\"gradient\""); break;
case 9: sResult += _T(" type=\"gradient\""); break;
}//todooo center radial ...
if ( PROP_DEF != m_nFillOpacity)
{
CString sOpacity; sOpacity.Format(L"%d", /*100 - */m_nFillOpacity);
sResult += _T(" opacity=\"") + sOpacity +_T("%\"");
//sResult.AppendFormat( _T(" opacity=\"%df\""), m_nFillOpacity );
}
if ( PROP_DEF != m_nFillColor2)
{
RtfColor color(m_nFillColor2);
sResult += _T(" color2=\"#") + color.ToHexColor(true) + _T("\"");
}
else if (!sPicture.IsEmpty())
if ( PROP_DEF != m_nFillFocus)
{
sResult.AppendFormat( _T("<v:fill r:id=\"%ls\""), sPicture.GetBuffer() );
CString sFocus; sFocus.Format(L"%d", m_nFillFocus );
sResult += _T(" focus=\"")+ sFocus +_T("%\"");
}
if ( PROP_DEF != m_nFillAngle)
sResult.AppendFormat( _T(" angle=\"%d\""), m_nFillAngle );
if (m_nFillType == 2 )
sResult.Append( _T(" type=\"tile\""));
else
sResult.Append( _T(" type=\"frame\""));
sResult.Append( _T("/>") );
sResult += _T("/>");
}
//---------------------------------------------------------------------------------------------------------------------------
if( false == m_sGtextUNICODE.IsEmpty())
{
sResult += _T("<v:textpath");
CString sTextStyle;
if ( PROP_DEF != m_sGtextFont )
{
sTextStyle += _T("font-family:") + XmlUtils::EncodeXmlString(m_sGtextFont) + _T(";");//todooo значения как в кавычках так и без - проверить как без
}
if (!sTextStyle.IsEmpty())
sResult += _T(" style=\"") + sTextStyle + _T("\"");
if ( PROP_DEF != m_nGtextSize )
sTextStyle.AppendFormat( _T("font-size:%dpt;"), m_nGtextSize );
sResult += _T(" string=\"") + XmlUtils::EncodeXmlString(m_sGtextUNICODE) + _T("\"");
sResult += _T("/>");
}
return sResult;
}
......@@ -1426,15 +1205,15 @@ CString RtfShape::RenderToOOXEnd(RenderParameter oRenderParameter)
{
CString sResult;
if( _T("") == oRenderParameter.sValue )
sResult.Append( _T("</v:shape>") );
sResult += _T("</v:shape>");
else
sResult.AppendFormat( _T("</%ls>"), oRenderParameter.sValue.GetBuffer() );
if( RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2 == oRenderParameter.nType )
;
else if( RENDER_TO_OOX_PARAM_SHAPE_WSHAPE == oRenderParameter.nType )
sResult.Append(_T("</w:pict>"));
sResult += _T("</w:pict>");
else
sResult.Append(_T("</w:pict></w:r>"));//работает по умолчанию
sResult += _T("</w:pict></w:r>");//работает по умолчанию
return sResult;
}
CString RtfShapeGroup::RenderToRtf(RenderParameter oRenderParameter)
......@@ -1444,13 +1223,18 @@ CString RtfShapeGroup::RenderToRtf(RenderParameter oRenderParameter)
CString RtfShapeGroup::RenderToOOX(RenderParameter oRenderParameter)
{
CString sResult;
RenderParameter oNewParamGroup = oRenderParameter;
oNewParamGroup.sValue = _T("v:group");
RenderParameter oNewParamShape = oRenderParameter;
oNewParamShape.sValue = _T("v:shape");
RenderParameter oNewParamGroup = oRenderParameter;
oNewParamGroup.sValue = _T("v:group");
RenderParameter oNewParamShape = oRenderParameter;
oNewParamShape.sValue = _T("v:shape");
sResult = RenderToOOXBegin( oNewParamGroup );
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append( m_aArray[i]->RenderToOOX( oNewParamShape ) );
sResult.Append( RenderToOOXEnd( oNewParamGroup ) );
{
sResult += m_aArray[i]->RenderToOOX( oNewParamShape );
}
sResult += RenderToOOXEnd( oNewParamGroup );
return sResult;
}
......@@ -108,11 +108,16 @@ public:
int m_bHidden; //Do not display or print (only set through Visual Basic for Applications). Boolean FALSE
//Text box
int m_nAnchorText;
int m_nTexpLeft; //dxTextLeft Left internal margin of the text box. EMU 91,440
int m_nTexpTop; //
int m_nTexpRight; //
int m_nTexpBottom; //
int m_bFitShapeToText;
int m_bFitTextToShape;
int m_nCcol; //columns
int m_nTxdir; //bidi
int m_nWrapText;
//Geometry
int m_nAdjustValue; //adjustValue First adjust value from an adjust handle. The interpretation varies with the shape type. Adjust values alter the geometry of the shape in smart ways. Integer 0
int m_nAdjustValue2;
......
......@@ -184,4 +184,122 @@ CString OOXDocumentWriter::CreateXmlEnd( )
sResult.Append( _T("</w:document>") );
return sResult;
}
bool OOXDocumentWriter::SaveByItemStart( CString sFolder )
{
CString pathWord = sFolder + FILE_SEPARATOR_STR + _T("word");
FileSystem::Directory::CreateDirectory(pathWord) ;
try
{
CString sFilename = pathWord + FILE_SEPARATOR_STR + _T("document.xml");
m_oFileWriter = new NFileWriter::CBufferedFileWriter( sFilename );
}
catch(...)
{
return false;
}
m_oWriter.m_oRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"), _T("word/document.xml") );
m_oWriter.m_oContentTypes.AddContent( _T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"), _T("/word/document.xml") );
CString sXml = CreateXmlStart( );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
return true;
}
bool OOXDocumentWriter::SaveByItem()
{
if( true == m_bFirst )
m_bFirst = false;
else
{
RenderParameter oNewParam;
oNewParam.poDocument = &m_oDocument;
oNewParam.poWriter = &m_oWriter;
oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
if( m_oDocument.GetCount() > 1)//если что-то есть в следующей секции значит предудущая закончилась
{
if( m_oDocument[1]->GetCount() > 0 )
{
CString sSectPr = m_oDocument[0]->m_oProperty.RenderToOOX(oNewParam);
CString sXml = m_oDocument[1]->operator[](0)->RenderToOOX(oNewParam);
int nIndexP = sXml.Find( _T("<w:p>") );
if (nIndexP == 0) //элемент параграф
{
int nIndexpPr = sXml.Find( _T("</w:pPr>") );
if( -1 != nIndexpPr )
{
sXml.Insert( nIndexpPr, sSectPr );
}
else
{
sSectPr = _T("<w:pPr>") + sSectPr + _T("</w:pPr>");
sXml.Insert( 5, sSectPr );
}
}
else
{
sXml = _T("<w:p><w:pPr>") + sSectPr + _T("</w:pPr></w:p>") + sXml;
}
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
m_oDocument[1]->RemoveItem( 0 ); //удаляем первый параграф
m_oDocument.RemoveItem( 0 ); //удаляем секцию
}
}
else if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )//пишем параграф
{
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam);
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
if (m_oFileWriter)
{
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
}
else
{
//!!!!
m_oFileWriter = NULL;
}
m_oDocument[0]->RemoveItem( 0 );//удаляем первый параграф
}
}
return true;
}
bool OOXDocumentWriter::SaveByItemEnd()
{
RenderParameter oNewParam;
oNewParam.poDocument = &m_oDocument;
oNewParam.poWriter = &m_oWriter;
oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )//дописываем последний параграф
{
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam);
//удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
}
CString sXml = CreateXmlEnd( );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
if (m_oFileWriter)
{
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
}
RELEASEOBJECT( m_oFileWriter );
return true;
}
\ No newline at end of file
......@@ -56,117 +56,10 @@ public:
CString CreateXmlEnd( );
bool SaveByItemStart( CString sFolder )
{
CString pathWord = sFolder + FILE_SEPARATOR_STR + _T("word");
FileSystem::Directory::CreateDirectory(pathWord) ;
try
{
CString sFilename = pathWord + FILE_SEPARATOR_STR + _T("document.xml");
m_oFileWriter = new NFileWriter::CBufferedFileWriter( sFilename );
}
catch(...)
{
return false;
}
m_oWriter.m_oRels.AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"), _T("word/document.xml") );
m_oWriter.m_oContentTypes.AddContent( _T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"), _T("/word/document.xml") );
CString sXml = CreateXmlStart( );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
return true;
}
bool SaveByItem()
{
if( true == m_bFirst )
m_bFirst = false;
else
{
RenderParameter oNewParam;
oNewParam.poDocument = &m_oDocument;
oNewParam.poWriter = &m_oWriter;
oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
if( m_oDocument.GetCount() > 1 && m_oDocument[1]->GetCount() > 0 )//если что-то есть в следующей секции значит предудущая закончилась
{
if( m_oDocument[0]->GetCount() > 0 )
{
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam);
//пишем вставляем свойства секции
CString sSectPr = m_oDocument[0]->m_oProperty.RenderToOOX(oNewParam);
CString sFindStr = _T("</w:pPr>");
int nIndexpPr = sXml.Find( sFindStr );
if( -1 != nIndexpPr )
{
sXml.Insert( nIndexpPr, sSectPr );
}
else
{
sFindStr = _T("<w:p>");
int nIndexP = sXml.Find( _T("<w:p>") );
if( -1 != nIndexP )
sXml.Insert( nIndexP + sFindStr.GetLength(), _T("<w:pPr>") + sSectPr + _T("</w:pPr>") );
}
//удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
}
//удаляем секцию
m_oDocument.RemoveItem( 0 );
}
else if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )//пишем параграф
{
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam);
//удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
bool SaveByItemStart( CString sFolder );
bool SaveByItem ();
bool SaveByItemEnd ();
if (m_oFileWriter)
{
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
}
else
{
//!!!!
m_oFileWriter = NULL;
}
}
}
return true;
}
bool SaveByItemEnd()
{
RenderParameter oNewParam;
oNewParam.poDocument = &m_oDocument;
oNewParam.poWriter = &m_oWriter;
oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )//дописываем последний параграф
{
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam);
//удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
}
CString sXml = CreateXmlEnd( );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
if (m_oFileWriter)
{
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
}
RELEASEOBJECT( m_oFileWriter );
return true;
}
int GetCount()
{
int nCount = 0;
......
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