Commit 0a7bcfdd authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormat - fix bugs, small refactoring

parent d516cb2b
...@@ -118,7 +118,7 @@ namespace NSCustomVML ...@@ -118,7 +118,7 @@ namespace NSCustomVML
m_nCount = value; m_nCount = value;
break; break;
} }
return std::max(1, repeate); return (std::max)(1, repeate);
} }
void Read(POLE::Stream* pStream) void Read(POLE::Stream* pStream)
{ {
......
...@@ -241,7 +241,8 @@ public: ...@@ -241,7 +241,8 @@ public:
CString sResult; CString sResult;
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
{ {
sResult.Append( m_aArray[i]->RenderToRtf( oRenderParameter ) ); sResult += m_aArray[i]->RenderToRtf( oRenderParameter );
if( TYPE_RTF_PARAGRAPH == m_aArray[i]->GetType() && i != (int)m_aArray.size() - 1) if( TYPE_RTF_PARAGRAPH == m_aArray[i]->GetType() && i != (int)m_aArray.size() - 1)
{ {
sResult += _T("\\par") ; sResult += _T("\\par") ;
......
...@@ -818,15 +818,15 @@ class PictureReader: public RtfAbstractReader ...@@ -818,15 +818,15 @@ class PictureReader: public RtfAbstractReader
CString ToString() CString ToString()
{ {
CString sResult; CString sResult;
sResult.Append( ByteToString( (BYTE*)&Key, 4, true ) ); sResult += ByteToString( (BYTE*)&Key, 4, true );
sResult.Append( ByteToString( (BYTE*)&Handle, 2, true ) ); sResult += ByteToString( (BYTE*)&Handle, 2, true );
sResult.Append( ByteToString( (BYTE*)&Left, 2, true ) ); sResult += ByteToString( (BYTE*)&Left, 2, true );
sResult.Append( ByteToString( (BYTE*)&Top, 2, true ) ); sResult += ByteToString( (BYTE*)&Top, 2, true );
sResult.Append( ByteToString( (BYTE*)&Right, 2, true ) ); sResult += ByteToString( (BYTE*)&Right, 2, true );
sResult.Append( ByteToString( (BYTE*)&Bottom, 2, true ) ); sResult += ByteToString( (BYTE*)&Bottom, 2, true );
sResult.Append( ByteToString( (BYTE*)&Inch, 2, true ) ); sResult += ByteToString( (BYTE*)&Inch, 2, true );
sResult.Append( ByteToString( (BYTE*)&Reserved, 4, true ) ); sResult += ByteToString( (BYTE*)&Reserved, 4, true );
sResult.Append( ByteToString( (BYTE*)&Checksum, 2, true ) ); sResult += ByteToString( (BYTE*)&Checksum, 2, true );
return sResult; return sResult;
} }
CString ByteToString( BYTE* pbData, int nSize, bool bLittleEnd = true ) CString ByteToString( BYTE* pbData, int nSize, bool bLittleEnd = true )
...@@ -971,7 +971,7 @@ class ShapeReader : public RtfAbstractReader ...@@ -971,7 +971,7 @@ class ShapeReader : public RtfAbstractReader
{ {
CString sValue; CString sValue;
sValue = oText; sValue = oText;
m_sPropValue.Append( sValue ); m_sPropValue += sValue;
} }
}; };
private: private:
...@@ -1490,7 +1490,7 @@ public: ...@@ -1490,7 +1490,7 @@ public:
} }
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, CString sText) void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, CString sText)
{ {
m_oBookmarkStart.m_sName.Append( sText ); m_oBookmarkStart.m_sName += sText ;
} }
}; };
...@@ -1503,7 +1503,7 @@ public: ...@@ -1503,7 +1503,7 @@ public:
} }
void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, CString sText) void ExecuteText(RtfDocument& oDocument, RtfReader& oReader, CString sText)
{ {
m_oBookmarkEnd.m_sName.Append( sText ); m_oBookmarkEnd.m_sName += sText;
} }
}; };
......
...@@ -137,7 +137,7 @@ public: ...@@ -137,7 +137,7 @@ public:
sId.AppendFormat( _T("%d"), m_nOleId++ ); sId.AppendFormat( _T("%d"), m_nOleId++ );
CString sResult = _T("_1330071130"); CString sResult = _T("_1330071130");
sResult = sResult.Left( sResult.GetLength() - sId.GetLength() ); sResult = sResult.Left( sResult.GetLength() - sId.GetLength() );
sResult.Append( sId ); sResult += sId;
return sResult; return sResult;
} }
......
...@@ -40,15 +40,16 @@ ...@@ -40,15 +40,16 @@
CString RtfBookmarkStart::RenderToRtf(RenderParameter oRenderParameter) CString RtfBookmarkStart::RenderToRtf(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
//ATLASSERT( false == m_sName.IsEmpty() );
sResult.Append(_T("{\\*\\bkmkstart")); sResult += _T("{\\*\\bkmkstart");
if( PROP_DEF != nFirstColumn ) if( PROP_DEF != nFirstColumn )
sResult.AppendFormat(_T("\\bkmkcolf%d"), nFirstColumn); sResult.AppendFormat(_T("\\bkmkcolf%d"), nFirstColumn);
if( PROP_DEF != nLastColumn ) if( PROP_DEF != nLastColumn )
sResult.AppendFormat(_T("\\bkmkcoll%d"), nLastColumn); sResult.AppendFormat(_T("\\bkmkcoll%d"), nLastColumn);
sResult.Append(_T(" "));
sResult.Append( RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument, NULL ) ); sResult += _T(" ");
sResult.Append(_T("}")); sResult += RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument, NULL );
sResult += _T("}");
return sResult; return sResult;
} }
CString RtfBookmarkStart::RenderToOOX(RenderParameter oRenderParameter) CString RtfBookmarkStart::RenderToOOX(RenderParameter oRenderParameter)
...@@ -82,18 +83,19 @@ CString RtfBookmarkStart::RenderToOOX(RenderParameter oRenderParameter) ...@@ -82,18 +83,19 @@ CString RtfBookmarkStart::RenderToOOX(RenderParameter oRenderParameter)
CString RtfBookmarkEnd::RenderToRtf(RenderParameter oRenderParameter) CString RtfBookmarkEnd::RenderToRtf(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
//ATLASSERT( false == m_sName.IsEmpty() );
sResult.Append(_T("{\\*\\bkmkend")); sResult += _T("{\\*\\bkmkend");
sResult.Append(_T(" ")); sResult += _T(" ");
sResult.Append( RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument, NULL ) ); sResult += RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument, NULL );
sResult.Append(_T("}")); sResult += _T("}");
return sResult; return sResult;
} }
CString RtfBookmarkEnd::RenderToOOX(RenderParameter oRenderParameter) CString RtfBookmarkEnd::RenderToOOX(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
//ATLASSERT( false == m_sName.IsEmpty() );
sResult.Append(_T("<w:bookmarkEnd")); sResult += _T("<w:bookmarkEnd");
OOXWriter* poOOXWriter = static_cast<OOXWriter*>( oRenderParameter.poWriter ); OOXWriter* poOOXWriter = static_cast<OOXWriter*>( oRenderParameter.poWriter );
RtfDocument* poDocument = static_cast<RtfDocument*>(oRenderParameter.poDocument); RtfDocument* poDocument = static_cast<RtfDocument*>(oRenderParameter.poDocument);
...@@ -108,22 +110,27 @@ CString RtfBookmarkEnd::RenderToOOX(RenderParameter oRenderParameter) ...@@ -108,22 +110,27 @@ CString RtfBookmarkEnd::RenderToOOX(RenderParameter oRenderParameter)
poOOXWriter->m_aBookmarksId[m_sName] = nID; poOOXWriter->m_aBookmarksId[m_sName] = nID;
} }
sResult.AppendFormat(_T(" w:id =\"%d\""), nID); sResult.AppendFormat(_T(" w:id =\"%d\""), nID);
sResult.Append(_T("/>")); sResult += _T("/>");
return sResult; return sResult;
} }
CString RtfFootnote::RenderToRtf(RenderParameter oRenderParameter) CString RtfFootnote::RenderToRtf(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
sResult.Append(_T("{"));
sResult.Append( m_oCharProp.RenderToRtf( oRenderParameter ) ); sResult += _T("{");
sResult.Append(_T("\\chftn")); sResult += m_oCharProp.RenderToRtf( oRenderParameter );
sResult.Append(_T("{\\footnote")); sResult += _T("\\chftn");
sResult += _T("{\\footnote");
if( true == m_bEndNote ) if( true == m_bEndNote )
sResult.Append(_T("\\ftnalt")); sResult += _T("\\ftnalt");
for( int i = 0; i < m_oContent->GetCount(); i++ ) for( int i = 0; i < m_oContent->GetCount(); i++ )
sResult.Append( m_oContent->RenderToRtf( oRenderParameter ) ); sResult += m_oContent->RenderToRtf( oRenderParameter );
sResult.Append(_T("}"));
sResult.Append(_T("}")); sResult += _T("}");
sResult += _T("}");
return sResult; return sResult;
} }
CString RtfFootnote::RenderToOOX(RenderParameter oRenderParameter) CString RtfFootnote::RenderToOOX(RenderParameter oRenderParameter)
...@@ -139,16 +146,18 @@ CString RtfFootnote::RenderToOOX(RenderParameter oRenderParameter) ...@@ -139,16 +146,18 @@ CString RtfFootnote::RenderToOOX(RenderParameter oRenderParameter)
oNewParameter.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParameter.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
oNewParameter.poRels = poEndnoteWriter->m_oRelsWriter.get(); oNewParameter.poRels = poEndnoteWriter->m_oRelsWriter.get();
poEndnoteWriter->AddEndnote( _T(""), nID, m_oContent->RenderToOOX(oNewParameter) ); poEndnoteWriter->AddEndnote( _T(""), nID, m_oContent->RenderToOOX(oNewParameter) );
sResult.Append( _T("<w:r>") );
sResult += _T("<w:r>");
CString srPr = m_oCharProp.RenderToOOX( oRenderParameter ); CString srPr = m_oCharProp.RenderToOOX( oRenderParameter );
if( false == srPr.IsEmpty() ) if( false == srPr.IsEmpty() )
{ {
sResult.Append( _T("<w:rPr>") ); sResult += _T("<w:rPr>");
sResult += srPr; sResult += srPr;
sResult.Append( _T("</w:rPr>") ); sResult += _T("</w:rPr>");
} }
sResult.AppendFormat( _T("<w:endnoteReference w:id=\"%d\"/>"), nID ); sResult.AppendFormat( _T("<w:endnoteReference w:id=\"%d\"/>"), nID );
sResult.Append( _T("</w:r>") ); sResult += _T("</w:r>");
} }
else else
{ {
...@@ -158,16 +167,18 @@ CString RtfFootnote::RenderToOOX(RenderParameter oRenderParameter) ...@@ -158,16 +167,18 @@ CString RtfFootnote::RenderToOOX(RenderParameter oRenderParameter)
oNewParameter.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParameter.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
oNewParameter.poRels = poFootnoteWriter->m_oRelsWriter.get(); oNewParameter.poRels = poFootnoteWriter->m_oRelsWriter.get();
poFootnoteWriter->AddFootnote( _T(""), nID, m_oContent->RenderToOOX(oNewParameter) ); poFootnoteWriter->AddFootnote( _T(""), nID, m_oContent->RenderToOOX(oNewParameter) );
sResult.Append( _T("<w:r>") );
sResult += _T("<w:r>");
CString srPr = m_oCharProp.RenderToOOX( oRenderParameter ); CString srPr = m_oCharProp.RenderToOOX( oRenderParameter );
if( false == srPr.IsEmpty() ) if( false == srPr.IsEmpty() )
{ {
sResult.Append( _T("<w:rPr>") ); sResult += _T("<w:rPr>");
sResult += srPr; sResult += srPr;
sResult.Append( _T("</w:rPr>") ); sResult += _T("</w:rPr>");
} }
sResult.AppendFormat( _T("<w:footnoteReference w:id=\"%d\"/>"), nID ); sResult.AppendFormat( _T("<w:footnoteReference w:id=\"%d\"/>"), nID );
sResult.Append( _T("</w:r>") ); sResult += _T("</w:r>");
} }
return sResult; return sResult;
......
...@@ -84,7 +84,10 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert ...@@ -84,7 +84,10 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert
CString sTextBack = RtfUtility::convert_string(ansiStr.begin(), ansiStr.end(), nCodePage); CString sTextBack = RtfUtility::convert_string(ansiStr.begin(), ansiStr.end(), nCodePage);
//обратное преобразование чтобы понять какие символы свонвертировались неправильно //обратное преобразование чтобы понять какие символы свонвертировались неправильно
for( int i = 0; i < sText.GetLength() && i < sTextBack.GetLength() ; i++ ) while (sTextBack.GetLength() < sText.GetLength())
sTextBack += L"-";
for( int i = 0; i < sText.GetLength() ; i++ )
{ {
bool bWriteUnicode = true; bool bWriteUnicode = true;
...@@ -126,9 +129,9 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert ...@@ -126,9 +129,9 @@ CString RtfChar::renderRtfText( CString& sText, void* poDocument, RtfCharPropert
{ {
sResult.AppendFormat(_T("\\u%d*"),nUnicode); sResult.AppendFormat(_T("\\u%d*"),nUnicode);
} else if (0x8000 < nUnicode && nUnicode <= 0xffff) { } else if (0x8000 < nUnicode && nUnicode <= 0xffff) {
sResult.AppendFormat(_T("\\u%d*"),nUnicode - 0x10000); sResult.AppendFormat(_T("\\u%d*"), nUnicode - 0x10000); //??? font alt name china ALL FONTS NEW.docx (Mekanik LET)
} else { } else {
sResult.Append(_T("\\u9633*")); sResult += _T("\\u9633*");
} }
} }
......
...@@ -50,7 +50,7 @@ CString RtfFontTable::RenderToRtf(RenderParameter oRenderParameter) ...@@ -50,7 +50,7 @@ CString RtfFontTable::RenderToRtf(RenderParameter oRenderParameter)
CString sResult; CString sResult;
if( m_aArray.size() > 0 ) if( m_aArray.size() > 0 )
{ {
sResult.Append(_T("{\\fonttbl")); sResult += _T("{\\fonttbl");
RenderParameter oNewParameter = oRenderParameter; RenderParameter oNewParameter = oRenderParameter;
oNewParameter.nType = RENDER_TO_RTF_PARAM_FONT_TBL; oNewParameter.nType = RENDER_TO_RTF_PARAM_FONT_TBL;
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
...@@ -71,39 +71,44 @@ CString RtfListTable::RenderToOOX(RenderParameter oRenderParameter) ...@@ -71,39 +71,44 @@ CString RtfListTable::RenderToOOX(RenderParameter oRenderParameter)
for( int i = 0; i < (int)m_aPictureList.GetCount(); i++ ) for( int i = 0; i < (int)m_aPictureList.GetCount(); i++ )
{ {
sResult.AppendFormat(_T("<w:numPicBullet w:numPicBulletId=\"%d\">"), i ); sResult.AppendFormat(_T("<w:numPicBullet w:numPicBulletId=\"%d\">"), i );
sResult.Append( m_aPictureList[i]->RenderToOOX(oNewParam) ); sResult += m_aPictureList[i]->RenderToOOX(oNewParam);
sResult.Append(_T("</w:numPicBullet>") ); sResult += _T("</w:numPicBullet>");
} }
for( int i = 0; i < (int)m_aArray.size(); i++) for( int i = 0; i < (int)m_aArray.size(); i++)
sResult.Append( m_aArray[i].RenderToOOX(oRenderParameter) ); sResult += m_aArray[i].RenderToOOX(oRenderParameter);
} }
else else
{ {
RenderParameter oNewParam = oRenderParameter; RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_OLDLIST_ABS; oNewParam.nType = RENDER_TO_OOX_PARAM_OLDLIST_ABS;
RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument ); RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
for( int i = 0; i < (int)poDocument->m_aOldLists.size(); i++ ) for( int i = 0; i < (int)poDocument->m_aOldLists.size(); i++ )
sResult.Append( poDocument->m_aOldLists[i]->RenderToOOX( oNewParam ) ); {
sResult += poDocument->m_aOldLists[i]->RenderToOOX( oNewParam );
}
} }
return sResult; return sResult;
} }
CString RtfListOverrideTable::RenderToOOX(RenderParameter oRenderParameter) CString RtfListOverrideTable::RenderToOOX(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
if( m_aArray.size() > 0 ) if( !m_aArray.empty())
{ {
RenderParameter oNewParam = oRenderParameter; RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
for( int i = 0; i < (int)m_aArray.size(); i++) for( int i = 0; i < (int)m_aArray.size(); i++)
sResult.Append( m_aArray[i].RenderToOOX(oNewParam) ); sResult += m_aArray[i].RenderToOOX(oNewParam);
} }
else else
{ {
RenderParameter oNewParam = oRenderParameter; RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_OLDLIST_OVR; oNewParam.nType = RENDER_TO_OOX_PARAM_OLDLIST_OVR;
RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument ); RtfDocument* poDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
for( int i = 0; i < (int)poDocument->m_aOldLists.size(); i++ ) for( int i = 0; i < (int)poDocument->m_aOldLists.size(); i++ )
sResult.Append( poDocument->m_aOldLists[i]->RenderToOOX( oNewParam ) ); sResult += poDocument->m_aOldLists[i]->RenderToOOX( oNewParam );
} }
return sResult; return sResult;
} }
...@@ -65,10 +65,10 @@ public: ...@@ -65,10 +65,10 @@ public:
CString RenderToOOX(RenderParameter oRenderParameter) CString RenderToOOX(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
if( m_aArray.size() > 0 ) if( !m_aArray.empty())
{ {
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append(m_aArray[i].RenderToOOX(oRenderParameter)); sResult += m_aArray[i].RenderToOOX(oRenderParameter);
} }
return sResult; return sResult;
...@@ -143,14 +143,16 @@ public: ...@@ -143,14 +143,16 @@ public:
CString sResult; CString sResult;
if( m_aArray.size() > 0 ) if( m_aArray.size() > 0 )
{ {
sResult.Append(_T("{\\colortbl;")); sResult += _T("{\\colortbl;");
RenderParameter oNewParameter = oRenderParameter; RenderParameter oNewParameter = oRenderParameter;
oNewParameter.nType = RENDER_TO_RTF_PARAM_COLOR_TBL; oNewParameter.nType = RENDER_TO_RTF_PARAM_COLOR_TBL;
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
{ {
sResult += m_aArray[i].RenderToRtf( oNewParameter ); sResult += m_aArray[i].RenderToRtf( oNewParameter );
} }
sResult.Append(_T("}"));
sResult += _T("}");
} }
return sResult; return sResult;
} }
...@@ -243,13 +245,15 @@ public: ...@@ -243,13 +245,15 @@ public:
CString sResult; CString sResult;
if( m_aArray.size() > 0 ) if( m_aArray.size() > 0 )
{ {
sResult.Append(_T("{\\stylesheet")); sResult += _T("{\\stylesheet");
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
{ {
CString str = m_aArray[i]->RenderToRtf( oRenderParameter ); CString str = m_aArray[i]->RenderToRtf( oRenderParameter );
sResult.AppendFormat(_T("%ls\n\n"), str.GetBuffer()); sResult.AppendFormat(_T("%ls\n\n"), str.GetBuffer());
} }
sResult.Append(_T("}"));
sResult += _T("}");
} }
return sResult; return sResult;
} }
...@@ -257,7 +261,9 @@ public: ...@@ -257,7 +261,9 @@ public:
{ {
CString sResult; CString sResult;
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append(m_aArray[i]->RenderToOOX(oRenderParameter)); {
sResult += m_aArray[i]->RenderToOOX(oRenderParameter);
}
return sResult; return sResult;
} }
}; };
...@@ -293,7 +299,7 @@ public: ...@@ -293,7 +299,7 @@ public:
// CString sResult; // CString sResult;
// if( m_aArray.size() > 0 ) // if( m_aArray.size() > 0 )
// { // {
// sResult.Append(_T("{\\*\\latentstyles")); // sResult += _T("{\\*\\latentstyles"));
// if( PROP_DEF != m_nCount ) // if( PROP_DEF != m_nCount )
// sResult.AppendFormat(_T("\\lsdstimax%d"),m_nCount); // sResult.AppendFormat(_T("\\lsdstimax%d"),m_nCount);
// if( PROP_DEF != m_nLocked ) // if( PROP_DEF != m_nLocked )
...@@ -306,11 +312,11 @@ public: ...@@ -306,11 +312,11 @@ public:
// sResult.AppendFormat(_T("\\lsdqformatdef%d"),m_nQFormat); // sResult.AppendFormat(_T("\\lsdqformatdef%d"),m_nQFormat);
// if( PROP_DEF != m_nPriority ) // if( PROP_DEF != m_nPriority )
// sResult.AppendFormat(_T("\\lsdprioritydef%d"),m_nPriority); // sResult.AppendFormat(_T("\\lsdprioritydef%d"),m_nPriority);
// sResult.Append(_T("{\\lsdlockedexcept ")); // sResult += _T("{\\lsdlockedexcept "));
// for( int i = 0; i < (int)m_aArray.size(); i++ ) // for( int i = 0; i < (int)m_aArray.size(); i++ )
// sResult.Append(m_aArray[i].RenderToRtf( oRenderParameter )); // sResult += m_aArray[i].RenderToRtf( oRenderParameter ));
// sResult.Append(_T("}")); // sResult += _T("}");
// sResult.Append(_T("}")); // sResult += _T("}");
// } // }
// return sResult; // return sResult;
// } // }
...@@ -372,23 +378,23 @@ public: ...@@ -372,23 +378,23 @@ public:
CString sResult; CString sResult;
if( m_aArray.size() > 0 ) if( m_aArray.size() > 0 )
{ {
sResult.Append(_T("{\\*\\listtable ")); sResult += _T("{\\*\\listtable ");
if( m_aPictureList.GetCount() > 0 ) if( m_aPictureList.GetCount() > 0 )
{ {
sResult.Append(_T("{\\*\\listpicture") ); sResult += _T("{\\*\\listpicture");
for( int i = 0; i < (int)m_aPictureList.GetCount(); i++ ) for( int i = 0; i < (int)m_aPictureList.GetCount(); i++ )
{ {
sResult.Append( m_aPictureList[i]->RenderToRtf( oRenderParameter ) ); sResult += m_aPictureList[i]->RenderToRtf( oRenderParameter );
} }
sResult.Append(_T("}") ); sResult += _T("}");
} }
for( int i = 0; i < (int)m_aArray.size(); i++) for( int i = 0; i < (int)m_aArray.size(); i++)
{ {
sResult.Append(_T("{")); sResult += _T("{");
sResult.Append(m_aArray[i].RenderToRtf( oRenderParameter )); sResult += m_aArray[i].RenderToRtf( oRenderParameter );
sResult.Append(_T("}")); sResult += _T("}");
} }
sResult.Append(_T("}")); sResult += _T("}");
} }
return sResult; return sResult;
} }
...@@ -412,14 +418,14 @@ public: ...@@ -412,14 +418,14 @@ public:
CString sResult; CString sResult;
if( m_aArray.size() > 0 ) if( m_aArray.size() > 0 )
{ {
sResult.Append(_T("{\\*\\listoverridetable")); sResult += _T("{\\*\\listoverridetable");
for( int i = 0; i < (int)m_aArray.size(); i++) for( int i = 0; i < (int)m_aArray.size(); i++)
{ {
sResult.Append(_T("{")); sResult += _T("{");
sResult.Append(m_aArray[i].RenderToRtf( oRenderParameter )); sResult += m_aArray[i].RenderToRtf( oRenderParameter );
sResult.Append(_T("}")); sResult += _T("}");
} }
sResult.Append(_T("}")); sResult += _T("}");
} }
return sResult; return sResult;
} }
......
...@@ -107,7 +107,7 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter) ...@@ -107,7 +107,7 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter)
oNewParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN; oNewParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
for( int i = 0; i < m_oVal.GetCount(); i++ ) for( int i = 0; i < m_oVal.GetCount(); i++ )
{ {
sVal.Append( _T(" ") + m_oVal[i]->RenderToRtf( oNewParameter ) ); sVal += _T(" ") + m_oVal[i]->RenderToRtf( oNewParameter );
} }
} }
if (!sVal.IsEmpty()) if (!sVal.IsEmpty())
...@@ -118,7 +118,7 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter) ...@@ -118,7 +118,7 @@ CString RtfMath::RenderToRtf(RenderParameter oRenderParameter)
{ {
oNewParameter.nType = RENDER_TO_RTF_PARAM_NESTED; oNewParameter.nType = RENDER_TO_RTF_PARAM_NESTED;
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult.Append(m_aArray[i]->RenderToRtf( oNewParameter )); sResult += m_aArray[i]->RenderToRtf( oNewParameter );
} }
sResult += _T("}"); sResult += _T("}");
...@@ -160,7 +160,7 @@ CString RtfMath::RenderToOOX(RenderParameter oRenderParameter) ...@@ -160,7 +160,7 @@ CString RtfMath::RenderToOOX(RenderParameter oRenderParameter)
} }
} }
sResult.Append( _T("<") ); sResult += _T("<");
sResult += m_sOOXName; sResult += m_sOOXName;
if( false == sVal.IsEmpty() ) if( false == sVal.IsEmpty() )
...@@ -170,23 +170,23 @@ CString RtfMath::RenderToOOX(RenderParameter oRenderParameter) ...@@ -170,23 +170,23 @@ CString RtfMath::RenderToOOX(RenderParameter oRenderParameter)
if (sVal == L"on") sVal = L"1"; if (sVal == L"on") sVal = L"1";
else sVal = L"0"; else sVal = L"0";
} }
sResult.Append( _T(" m:val=\"") ); sResult += _T(" m:val=\"");
sResult += sVal; sResult += sVal;
sResult.Append( _T("\"") ); sResult += _T("\"");
} }
sResult.Append( _T(">") ); sResult += _T(">");
sResult += sProp; sResult += sProp;
sResult += sContent; sResult += sContent;
sResult.Append(_T("</") ); sResult += _T("</");
sResult += m_sOOXName; sResult += m_sOOXName;
sResult.Append(_T(">")); sResult += _T(">");
//альтернативная картинка //альтернативная картинка
// if( NULL != m_oPicture ) // if( NULL != m_oPicture )
// sResult.Append( m_oPicture->RenderToOOX(oRenderParameter) ); // sResult += m_oPicture->RenderToOOX(oRenderParameter);
return sResult; return sResult;
} }
......
...@@ -36,7 +36,7 @@ CString RtfOldList::RenderToRtf(RenderParameter oRenderParameter) ...@@ -36,7 +36,7 @@ CString RtfOldList::RenderToRtf(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
if( NULL != m_oText ) if( NULL != m_oText )
sResult.Append( m_oText->RenderToRtf( oRenderParameter ) ); sResult += m_oText->RenderToRtf( oRenderParameter );
return sResult; return sResult;
} }
CString RtfOldList::RenderToOOX(RenderParameter oRenderParameter) CString RtfOldList::RenderToOOX(RenderParameter oRenderParameter)
...@@ -46,8 +46,8 @@ CString RtfOldList::RenderToOOX(RenderParameter oRenderParameter) ...@@ -46,8 +46,8 @@ CString RtfOldList::RenderToOOX(RenderParameter oRenderParameter)
{//сохраняем как список {//сохраняем как список
if( RENDER_TO_OOX_PARAM_OLDLIST_ABS == oRenderParameter.nType ) if( RENDER_TO_OOX_PARAM_OLDLIST_ABS == oRenderParameter.nType )
{ {
CString sCharProp = m_oLevelText->m_oProperty.m_oCharProperty.RenderToOOX( oRenderParameter ); CString sCharProp = m_oLevelText->m_oProperty.m_oCharProperty.RenderToOOX( oRenderParameter );
CString sParProp = m_oLevelText->m_oProperty.RenderToOOX( oRenderParameter ); CString sParProp = m_oLevelText->m_oProperty.RenderToOOX( oRenderParameter );
RenderParameter oNewParameter = oRenderParameter; RenderParameter oNewParameter = oRenderParameter;
oNewParameter.nType = RENDER_TO_OOX_PARAM_PLAIN; oNewParameter.nType = RENDER_TO_OOX_PARAM_PLAIN;
...@@ -59,33 +59,37 @@ CString RtfOldList::RenderToOOX(RenderParameter oRenderParameter) ...@@ -59,33 +59,37 @@ CString RtfOldList::RenderToOOX(RenderParameter oRenderParameter)
sResult += _T("<w:numFmt w:val=\"bullet\"/>"); sResult += _T("<w:numFmt w:val=\"bullet\"/>");
if(!sText.IsEmpty() ) if(!sText.IsEmpty() )
sResult.AppendFormat(_T("<w:lvlText w:val=\"%ls\"/>"), Utils::PrepareToXML( sText ).GetBuffer() ); sResult += _T("<w:lvlText w:val=\"") + Utils::PrepareToXML( sText ) + _T("\"/>");
else else
{ {
sResult.Append(_T("<w:lvlText w:val=\"") ); sResult += _T("<w:lvlText w:val=\"");
sResult.AppendChar( 0xf0b7 ); sResult.AppendChar( 0xf0b7 );
sResult.Append(_T("\"/>") ); sResult += _T("\"/>");
} }
if( false == sParProp.IsEmpty() )
sResult.AppendFormat(_T("<w:pPr>%ls</w:pPr>"), sParProp.GetBuffer() ); if( !sParProp.IsEmpty() )
if( false == sCharProp.IsEmpty() ) sResult += _T("<w:pPr>") + sParProp + _T("</w:pPr>");
sResult.AppendFormat(_T("<w:rPr>%ls</w:rPr>"), sCharProp.GetBuffer() );
if( !sCharProp.IsEmpty() )
sResult += _T("<w:rPr>") + sCharProp + _T("</w:rPr>");
if( lj_none != m_eLevelJust ) if( lj_none != m_eLevelJust )
{ {
switch( m_eLevelJust ) switch( m_eLevelJust )
{ {
case lj_left: sResult.Append(_T("<w:lvlJc w:val=\"left\"/>"));break; case lj_left: sResult += _T("<w:lvlJc w:val=\"left\"/>"); break;
case lj_center: sResult.Append(_T("<w:lvlJc w:val=\"center\"/>"));break; case lj_center: sResult += _T("<w:lvlJc w:val=\"center\"/>"); break;
case lj_right: sResult.Append(_T("<w:lvlJc w:val=\"right\"/>"));break; case lj_right: sResult += _T("<w:lvlJc w:val=\"right\"/>"); break;
} }
} }
else else
sResult.Append(_T("<w:lvlJc w:val=\"left\"/>")); sResult += _T("<w:lvlJc w:val=\"left\"/>");
sResult.Append(_T("</w:lvl>"));
sResult.Append( _T("</w:abstractNum>") ); sResult += _T("</w:lvl>");
sResult += _T("</w:abstractNum>");
} }
else if( RENDER_TO_OOX_PARAM_OLDLIST_OVR == oRenderParameter.nType ) else if( RENDER_TO_OOX_PARAM_OLDLIST_OVR == oRenderParameter.nType )
sResult.AppendFormat(_T("<w:num w:numId=\"%d\"><w:abstractNumId w:val=\"%d\" /></w:num>"), m_nLs, m_nLs ); sResult.AppendFormat(_T("<w:num w:numId=\"%d\"><w:abstractNumId w:val=\"%d\"/></w:num>"), m_nLs, m_nLs );
else else
{ {
if( PROP_DEF != m_nLs && PROP_DEF != m_nIlvl ) if( PROP_DEF != m_nLs && PROP_DEF != m_nIlvl )
......
...@@ -43,23 +43,23 @@ CString RtfOle::RenderToOOX(RenderParameter oRenderParameter) ...@@ -43,23 +43,23 @@ CString RtfOle::RenderToOOX(RenderParameter oRenderParameter)
CString sResult; CString sResult;
if( RENDER_TO_OOX_PARAM_OLE_ONLY == oRenderParameter.nType ) if( RENDER_TO_OOX_PARAM_OLE_ONLY == oRenderParameter.nType )
{ {
sResult.Append( RenderToOOXOnlyOle(oRenderParameter) ); sResult += RenderToOOXOnlyOle(oRenderParameter);
} }
else else
{ {
sResult.Append( _T("<w:r>") ); sResult += _T("<w:r>");
sResult.AppendFormat( _T("<w:object w:dxaOrig=\"%d\" w:dyaOrig=\"%d\">"), m_nWidth, m_nHeight ); sResult.AppendFormat( _T("<w:object w:dxaOrig=\"%d\" w:dyaOrig=\"%d\">"), m_nWidth, m_nHeight );
RenderParameter oNewRenderParameter = oRenderParameter; RenderParameter oNewRenderParameter = oRenderParameter;
oNewRenderParameter.nType = RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2; oNewRenderParameter.nType = RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2;
m_oResultPic->m_bIsOle = true; m_oResultPic->m_bIsOle = true;
sResult.Append( m_oResultPic->RenderToOOX(oNewRenderParameter) ); sResult += m_oResultPic->RenderToOOX(oNewRenderParameter);
oNewRenderParameter.nValue = m_oResultPic->m_nID; oNewRenderParameter.nValue = m_oResultPic->m_nID;
sResult.Append( RenderToOOXOnlyOle(oNewRenderParameter) ); sResult += RenderToOOXOnlyOle(oNewRenderParameter);
sResult.Append( _T("</w:object>") ); sResult += _T("</w:object>");
sResult.Append( _T("</w:r>") ); sResult += _T("</w:r>");
} }
return sResult; return sResult;
} }
...@@ -71,22 +71,23 @@ CString RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter) ...@@ -71,22 +71,23 @@ CString RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter)
OOXRelsWriter* poRelsWriter = static_cast<OOXRelsWriter*>(oRenderParameter.poRels); OOXRelsWriter* poRelsWriter = static_cast<OOXRelsWriter*>(oRenderParameter.poRels);
RtfDocument* poDocument = static_cast<RtfDocument*>(oRenderParameter.poDocument); RtfDocument* poDocument = static_cast<RtfDocument*>(oRenderParameter.poDocument);
sResult.Append( _T("<o:OLEObject") ); sResult += _T("<o:OLEObject");
switch ( m_eOleType ) switch ( m_eOleType )
{ {
case ot_link: sResult.Append( _T(" Type=\"Link\"") );break; case ot_link: sResult += _T(" Type=\"Link\""); break;
default: sResult.Append( _T(" Type=\"Embed\"") );break; default: sResult += _T(" Type=\"Embed\""); break;
} }
sResult.AppendFormat( _T(" ProgID=\"%ls\""), m_sOleClass.GetBuffer() ); sResult += _T(" ProgID=\"") + m_sOleClass + _T("\"");
sResult.AppendFormat( _T(" ShapeID=\"_x0000_s%d\""), poDocument->GetShapeId( oRenderParameter.nValue ) ); sResult.AppendFormat( _T(" ShapeID=\"_x0000_s%d\""), poDocument->GetShapeId( oRenderParameter.nValue ) );
sResult.Append( _T(" DrawAspect=\"Content\"") ); sResult += _T(" DrawAspect=\"Content\"");
sResult.AppendFormat( _T(" ObjectID=\"%ls\""), poDocument->m_oIdGenerator.Generate_OleId().GetBuffer() ); sResult += _T(" ObjectID=\"") + poDocument->m_oIdGenerator.Generate_OleId() + _T("\"");
CString sExtension = _T("bin"); CString sExtension = _T("bin");
CString sMime = _T("application/vnd.openxmlformats-officedocument.oleObject"); CString sMime = _T("application/vnd.openxmlformats-officedocument.oleObject");
CString sFilenameRels; CString sFilenameRels;
sFilenameRels.AppendFormat( _T("oleObject%d.%ls"), poDocument->m_oIdGenerator.Generate_OleIndex(), sExtension.GetBuffer()); sFilenameRels.AppendFormat( _T("oleObject%d."), poDocument->m_oIdGenerator.Generate_OleIndex());
sFilenameRels += sExtension;
CString sFilenameFull = poOOXWriter->m_sTargetFolder + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("embeddings"); CString sFilenameFull = poOOXWriter->m_sTargetFolder + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("embeddings");
...@@ -99,8 +100,8 @@ CString RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter) ...@@ -99,8 +100,8 @@ CString RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter)
poOOXWriter->m_oContentTypes.AddExtension( sMime, sExtension); poOOXWriter->m_oContentTypes.AddExtension( sMime, sExtension);
CString srId = poRelsWriter->AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"), sFilenameRels); CString srId = poRelsWriter->AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"), sFilenameRels);
sResult.AppendFormat( _T(" r:id=\"%ls\""), srId.GetBuffer() ); sResult += _T(" r:id=\"") + srId + _T("\"");
sResult.Append( _T("/>") ); sResult += _T("/>");
return sResult; return sResult;
} }
......
...@@ -65,36 +65,38 @@ public: ...@@ -65,36 +65,38 @@ public:
} }
CString RenderToRtf(RenderParameter oRenderParameter) CString RenderToRtf(RenderParameter oRenderParameter)
{ {
if( false == IsValid() ) if( !IsValid() ) return _T("");
return _T("");
CString sResult; CString sResult = _T("{\\object");
sResult.Append( _T("{\\object") );
if( PROP_DEF != m_eOleType ) if( PROP_DEF != m_eOleType )
{ {
switch( m_eOleType ) switch( m_eOleType )
{ {
case ot_emb: sResult.Append( _T("\\objemb") );break; case ot_emb: sResult += _T("\\objemb"); break;
case ot_link: sResult.Append( _T("\\objlink") );break; case ot_link: sResult += _T("\\objlink"); break;
} }
} }
RENDER_RTF_INT( m_nWidth, sResult, _T("objw") ); RENDER_RTF_INT( m_nWidth, sResult, _T("objw") );
RENDER_RTF_INT( m_nHeight, sResult, _T("objh") ); RENDER_RTF_INT( m_nHeight, sResult, _T("objh") );
if( _T("") != m_sOleClass ) if( !m_sOleClass.IsEmpty() )
sResult.AppendFormat( _T("{\\*\\objclass %ls}"), m_sOleClass.GetBuffer() ); sResult += _T("{\\*\\objclass ") + m_sOleClass + _T("}");
if( _T("") != m_sOleFilename )
if( !m_sOleFilename.IsEmpty() )
{ {
CString str = RtfUtility::RtfInternalEncoder::Encode( m_sOleFilename ); CString str = RtfUtility::RtfInternalEncoder::Encode( m_sOleFilename );
sResult.AppendFormat( _T("{\\*\\objdata %ls}"), str.GetBuffer() ); sResult += _T("{\\*\\objdata ") + str + _T("}");
} }
if( NULL != m_oResultPic ) if( NULL != m_oResultPic )
{ {
CString str = m_oResultPic->RenderToRtf( oRenderParameter ); CString str = m_oResultPic->RenderToRtf( oRenderParameter );
sResult.AppendFormat( _T("{\\result \\pard\\plain%ls}"), str.GetBuffer() ); sResult += _T("{\\result \\pard\\plain") + str + _T("}");
} }
sResult.Append( _T("}") ); sResult += _T("}");
return sResult; return sResult;
} }
CString RenderToOOX(RenderParameter oRenderParameter); CString RenderToOOX(RenderParameter oRenderParameter);
void SetFilename( CString sFilename ) void SetFilename( CString sFilename )
......
...@@ -36,30 +36,30 @@ ...@@ -36,30 +36,30 @@
CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter) CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
sResult.Append(_T("{\\pict")); sResult += _T("{\\pict");
//if(-1 != m_nShapeId) //if(-1 != m_nShapeId)
// sResult.AppendFormat(_T("{\\*\\picprop\\shplid%d%ls}"), m_nShapeId, m_oShapeProp.RenderToRtf( oRenderParameter ) ); // sResult.AppendFormat(_T("{\\*\\picprop\\shplid%d%ls}"), m_nShapeId, m_oShapeProp.RenderToRtf( oRenderParameter ) );
//else //else
// sResult.AppendFormat(_T("{\\*\\picprop%ls}"), m_oShapeProp.RenderToRtf( oRenderParameter ) ); // sResult.AppendFormat(_T("{\\*\\picprop%ls}"), m_oShapeProp.RenderToRtf( oRenderParameter ) );
////"наши" wmf не растягиваются ////"наши" wmf не растягиваются
RENDER_RTF_INT( 100, sResult, _T("picscalex") ) RENDER_RTF_INT( 100, sResult, _T("picscalex") )
RENDER_RTF_INT( 100, sResult, _T("picscaley") ) RENDER_RTF_INT( 100, sResult, _T("picscaley") )
//RENDER_RTF_INT( (int)m_dScaleX, sResult, _T("picscalex") ) //RENDER_RTF_INT( (int)m_dScaleX, sResult, _T("picscalex") )
//RENDER_RTF_INT( (int)m_dScaleY, sResult, _T("picscaley") ) //RENDER_RTF_INT( (int)m_dScaleY, sResult, _T("picscaley") )
RENDER_RTF_INT( m_nCropL, sResult, _T("piccropl") ) RENDER_RTF_INT( m_nCropL, sResult, _T("piccropl") )
RENDER_RTF_INT( m_nCropT, sResult, _T("piccropt") ) RENDER_RTF_INT( m_nCropT, sResult, _T("piccropt") )
RENDER_RTF_INT( m_nCropR, sResult, _T("piccropr") ) RENDER_RTF_INT( m_nCropR, sResult, _T("piccropr") )
RENDER_RTF_INT( m_nCropB, sResult, _T("piccropb") ) RENDER_RTF_INT( m_nCropB, sResult, _T("piccropb") )
RENDER_RTF_INT( m_nWidth, sResult, _T("picw") ) RENDER_RTF_INT( m_nWidth, sResult, _T("picw") )
RENDER_RTF_INT( m_nHeight, sResult, _T("pich") ) RENDER_RTF_INT( m_nHeight, sResult, _T("pich") )
RENDER_RTF_INT( m_nWidthGoal, sResult, _T("picwgoal") ) RENDER_RTF_INT( m_nWidthGoal, sResult, _T("picwgoal") )
RENDER_RTF_INT( m_nHeightGoal, sResult, _T("pichgoal") ) RENDER_RTF_INT( m_nHeightGoal, sResult, _T("pichgoal") )
sResult.Append(_T("\\wmetafile8")); sResult += _T("\\wmetafile8");
sResult.Append( _T(" ")); sResult += _T(" ");
//сохраняем в темповую директорию и загружаем файл как текст //сохраняем в темповую директорию и загружаем файл как текст
RtfWriter * poWriter = static_cast<RtfWriter*>( oRenderParameter.poWriter ); RtfWriter * poWriter = static_cast<RtfWriter*>( oRenderParameter.poWriter );
...@@ -72,50 +72,49 @@ CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter) ...@@ -72,50 +72,49 @@ CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter)
// if( true == SavePicture( piTempPict, sTempFile, IMAGEFORMAT_WMF ) ) // if( true == SavePicture( piTempPict, sTempFile, IMAGEFORMAT_WMF ) )
// { // {
// m_aTempFiles.push_back( sTempFile ); // m_aTempFiles.push_back( sTempFile );
// sResult.Append( RtfInternalEncoder::Encode( sTempFile ) ); // sResult += RtfInternalEncoder::Encode( sTempFile );
// } // }
//} //}
//RELEASEINTERFACE( piTempPict ); //RELEASEINTERFACE( piTempPict );
sResult.Append(_T("}")); sResult += _T("}");
return sResult; return sResult;
} }
CString RtfPicture::RenderToRtf(RenderParameter oRenderParameter) CString RtfPicture::RenderToRtf(RenderParameter oRenderParameter)
{ {
if( false == IsValid() ) if( !IsValid() )return _T("");
return _T("");
CString sResult; CString sResult = _T("{\\pict");
sResult.Append(_T("{\\pict"));
//if(-1 != m_nShapeId) //if(-1 != m_nShapeId)
// sResult.AppendFormat(_T("{\\*\\picprop\\shplid%d%ls}"), m_nShapeId, m_oShapeProp.RenderToRtf( oRenderParameter ) ); // sResult.AppendFormat(_T("{\\*\\picprop\\shplid%d%ls}"), m_nShapeId, m_oShapeProp.RenderToRtf( oRenderParameter ) );
//else //else
// sResult.AppendFormat(_T("{\\*\\picprop%ls}"), m_oShapeProp.RenderToRtf( oRenderParameter ) ); // sResult.AppendFormat(_T("{\\*\\picprop%ls}"), m_oShapeProp.RenderToRtf( oRenderParameter ) );
RENDER_RTF_INT( (int)m_dScaleX, sResult, _T("picscalex") ) RENDER_RTF_INT( (int)m_dScaleX, sResult, _T("picscalex") )
RENDER_RTF_INT( (int)m_dScaleY, sResult, _T("picscaley") ) RENDER_RTF_INT( (int)m_dScaleY, sResult, _T("picscaley") )
RENDER_RTF_INT( m_nCropL, sResult, _T("piccropl") ) RENDER_RTF_INT( m_nCropL, sResult, _T("piccropl") )
RENDER_RTF_INT( m_nCropT, sResult, _T("piccropt") ) RENDER_RTF_INT( m_nCropT, sResult, _T("piccropt") )
RENDER_RTF_INT( m_nCropR, sResult, _T("piccropr") ) RENDER_RTF_INT( m_nCropR, sResult, _T("piccropr") )
RENDER_RTF_INT( m_nCropB, sResult, _T("piccropb") ) RENDER_RTF_INT( m_nCropB, sResult, _T("piccropb") )
RENDER_RTF_INT( m_nWidth, sResult, _T("picw") ) RENDER_RTF_INT( m_nWidth, sResult, _T("picw") )
RENDER_RTF_INT( m_nHeight, sResult, _T("pich") ) RENDER_RTF_INT( m_nHeight, sResult, _T("pich") )
RENDER_RTF_INT( m_nWidthGoal, sResult, _T("picwgoal") ) RENDER_RTF_INT( m_nWidthGoal, sResult, _T("picwgoal") )
RENDER_RTF_INT( m_nHeightGoal, sResult, _T("pichgoal") ) RENDER_RTF_INT( m_nHeightGoal, sResult, _T("pichgoal") )
switch( eDataType ) switch( eDataType )
{ {
case dt_emf: sResult.Append(_T("\\emfblip"));break; case dt_emf: sResult += _T("\\emfblip"); break;
case dt_wmf: sResult.Append(_T("\\wmetafile8"));break; case dt_wmf: sResult += _T("\\wmetafile8"); break;
case dt_png: sResult.Append(_T("\\pngblip"));break; case dt_png: sResult += _T("\\pngblip"); break;
case dt_jpg: sResult.Append(_T("\\jpegblip"));break; case dt_jpg: sResult += _T("\\jpegblip"); break;
//case dt_bmp: sResult.Append(_T("wbitmap8"));break; //case dt_bmp: sResult += _T("wbitmap8"); break;
} }
sResult.Append( _T(" ")); sResult += _T(" ");
sResult.Append( RtfUtility::RtfInternalEncoder::Encode( m_sPicFilename ) ); sResult += RtfUtility::RtfInternalEncoder::Encode( m_sPicFilename );
sResult.Append(_T("}")); sResult += _T("}");
return sResult; return sResult;
} }
CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter) CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -60,63 +60,63 @@ ...@@ -60,63 +60,63 @@
#define RENDER_OOX_BOOL( prop, sResult, sName)\ #define RENDER_OOX_BOOL( prop, sResult, sName)\
if( 0 == prop )\ if( 0 == prop )\
{\ {\
sResult.Append( _T("<") );\ sResult += _T("<");\
sResult.Append( sName );\ sResult += sName;\
sResult.AppendFormat( _T(" w:val=\"false\"/>"));\ sResult.AppendFormat( _T(" w:val=\"false\"/>"));\
}\ }\
else if( PROP_DEF != prop )\ else if( PROP_DEF != prop )\
{\ {\
sResult.Append( _T("<") );\ sResult += _T("<");\
sResult.Append( sName );\ sResult += sName;\
sResult.AppendFormat( _T(" w:val=\"true\"/>"));\ sResult.AppendFormat( _T(" w:val=\"true\"/>"));\
} }
#define RENDER_OOX_INT( prop, sResult, sName)\ #define RENDER_OOX_INT( prop, sResult, sName)\
if( PROP_DEF != prop )\ if( PROP_DEF != prop )\
{\ {\
sResult.Append( _T("<") );\ sResult += _T("<");\
sResult.Append( sName );\ sResult += sName;\
sResult.AppendFormat( _T(" w:val=\"%d\"/>"), prop );\ sResult.AppendFormat( _T(" w:val=\"%d\"/>"), prop );\
} }
#define RENDER_OOX_INT_ATTRIBUTE( prop, sResult, sName)\ #define RENDER_OOX_INT_ATTRIBUTE( prop, sResult, sName)\
if( PROP_DEF != prop )\ if( PROP_DEF != prop )\
{\ {\
sResult.Append( _T(" ") );\ sResult += _T(" ");\
sResult.Append( sName );\ sResult += sName;\
sResult.AppendFormat( _T("=\"%d\""), prop );\ sResult.AppendFormat( _T("=\"%d\""), prop );\
} }
#define RENDER_OOX_BOOL_ATTRIBUTE( prop, sResult, sName)\ #define RENDER_OOX_BOOL_ATTRIBUTE( prop, sResult, sName)\
if( 0 == prop )\ if( 0 == prop )\
{\ {\
sResult.Append( _T(" ") );\ sResult += _T(" ");\
sResult.Append( sName );\ sResult += sName;\
sResult.AppendFormat( _T("=\"0\""));\ sResult += _T("=\"0\"");\
}\ }\
else if( PROP_DEF != prop )\ else if( PROP_DEF != prop )\
{\ {\
sResult.Append( _T(" ") );\ sResult += _T(" ");\
sResult.Append( sName );\ sResult += sName;\
sResult.AppendFormat( _T("=\"1\""));\ sResult += _T("=\"1\"");\
} }
#define RENDER_RTF_BOOL( prop, sResult, sName)\ #define RENDER_RTF_BOOL( prop, sResult, sName)\
if( 0 == prop )\ if( 0 == prop )\
{\ {\
sResult.Append( _T("\\") );\ sResult += _T("\\");\
sResult.Append( sName );\ sResult += sName;\
sResult.Append( _T("0") );\ sResult += _T("0");\
}\ }\
else if( PROP_DEF != prop )\ else if( PROP_DEF != prop )\
{\ {\
sResult.Append( _T("\\") );\ sResult += _T("\\");\
sResult.Append( sName );\ sResult += sName;\
} }
#define RENDER_RTF_INT( prop, sResult, sName)\ #define RENDER_RTF_INT( prop, sResult, sName)\
if( PROP_DEF != prop )\ if( PROP_DEF != prop )\
{\ {\
sResult.Append( _T("\\") );\ sResult += _T("\\");\
sResult.Append( sName );\ sResult += sName;\
sResult.AppendFormat( _T("%d"), prop );\ sResult.AppendFormat( _T("%d"), prop );\
} }
...@@ -130,15 +130,15 @@ public: ...@@ -130,15 +130,15 @@ public:
typedef enum {ff_none, ff_fnil ,ff_froman ,ff_fswiss ,ff_fmodern ,ff_fscript ,ff_fdecor ,ff_ftech ,ff_fbidi} FontFamily; typedef enum {ff_none, ff_fnil ,ff_froman ,ff_fswiss ,ff_fmodern ,ff_fscript ,ff_fdecor ,ff_ftech ,ff_fbidi} FontFamily;
FontTheme m_eFontTheme; FontTheme m_eFontTheme;
FontFamily m_eFontFamily; FontFamily m_eFontFamily;
CString m_sPanose; CString m_sPanose;
int m_nID; int m_nID;
CString m_sName; CString m_sName;
CString m_sAltName; CString m_sAltName;
int m_nCharset; int m_nCharset;
int m_nCodePage; int m_nCodePage;
int m_nPitch; int m_nPitch;
RtfFont() RtfFont()
{ {
...@@ -1029,17 +1029,23 @@ public: ...@@ -1029,17 +1029,23 @@ public:
{ {
CString sResult; CString sResult;
for( int i = 0; i < (int)m_aTabs.size(); i++ ) for( int i = 0; i < (int)m_aTabs.size(); i++ )
sResult.Append( m_aTabs[i].RenderToRtf( oRenderParameter ) ); {
sResult += m_aTabs[i].RenderToRtf( oRenderParameter );
}
return sResult; return sResult;
} }
CString RenderToOOX(RenderParameter oRenderParameter) CString RenderToOOX(RenderParameter oRenderParameter)
{ {
CString sResult; CString sTabs;
CString sTabs;
for( int i = 0; i < (int)m_aTabs.size(); i++ ) for( int i = 0; i < (int)m_aTabs.size(); i++ )
sTabs.Append( m_aTabs[i].RenderToOOX( oRenderParameter ) ); {
if( false == sTabs.IsEmpty() ) sTabs += m_aTabs[i].RenderToOOX( oRenderParameter );
sResult.AppendFormat( _T("<w:tabs>%ls</w:tabs>"), sTabs.GetBuffer() ); }
CString sResult;
if( !sTabs.IsEmpty() )
sResult += _T("<w:tabs>") + sTabs + _T("</w:tabs>");
return sResult; return sResult;
} }
}; };
...@@ -1245,12 +1251,12 @@ public: ...@@ -1245,12 +1251,12 @@ public:
std::string sBullet = cBullet; std::string sBullet = cBullet;
std::wstring swBullet(sBullet.begin(), sBullet.end()); std::wstring swBullet(sBullet.begin(), sBullet.end());
sResult.Append( swBullet.c_str() ); sResult += swBullet.c_str();
//CString sOOXNumber = GetLevelTextOOX(); //CString sOOXNumber = GetLevelTextOOX();
//for( int i = 0; i < sOOXNumber.GetLength(); i++ ) //for( int i = 0; i < sOOXNumber.GetLength(); i++ )
// if( sOOXNumber[i] == '%' && i != sOOXNumber.GetLength() - 1 ) // if( sOOXNumber[i] == '%' && i != sOOXNumber.GetLength() - 1 )
// { // {
// sResult.Append( swBullet ); // sResult += swBullet;
// i++; // i++;
// } // }
// else // else
...@@ -1623,13 +1629,15 @@ public: ...@@ -1623,13 +1629,15 @@ public:
{ {
if( PROP_DEF != m_aOverrideLevels[i].m_nLevelIndex ) if( PROP_DEF != m_aOverrideLevels[i].m_nLevelIndex )
{ {
sResult.Append( _T("{\\lfolevel") ); sResult += _T("{\\lfolevel");
if( PROP_DEF != m_aOverrideLevels[i].m_nLevelIndex ) if( PROP_DEF != m_aOverrideLevels[i].m_nLevelIndex )
sResult.AppendFormat( _T("\\listoverrideformat%d"), m_aOverrideLevels[i].m_nLevelIndex ); sResult.AppendFormat( _T("\\listoverrideformat%d"), m_aOverrideLevels[i].m_nLevelIndex );
if( PROP_DEF != m_aOverrideLevels[i].m_nStart ) if( PROP_DEF != m_aOverrideLevels[i].m_nStart )
sResult.AppendFormat( _T("\\listoverridestartat%d"), m_aOverrideLevels[i].m_nStart ); sResult.AppendFormat( _T("\\listoverridestartat%d"), m_aOverrideLevels[i].m_nStart );
sResult.Append( m_aOverrideLevels[i].m_oLevel.RenderToRtf(oRenderParameter) );
sResult.Append( _T("}") ); sResult += m_aOverrideLevels[i].m_oLevel.RenderToRtf(oRenderParameter);
sResult += _T("}");
} }
} }
return sResult; return sResult;
...@@ -1645,8 +1653,8 @@ public: ...@@ -1645,8 +1653,8 @@ public:
sResult.AppendFormat( _T("<w:lvlOverride w:ilvl=\"%d\">"), OverrideLevel.m_nLevelIndex ); sResult.AppendFormat( _T("<w:lvlOverride w:ilvl=\"%d\">"), OverrideLevel.m_nLevelIndex );
if( PROP_DEF != OverrideLevel.m_nStart ) if( PROP_DEF != OverrideLevel.m_nStart )
sResult.AppendFormat( _T("<w:startOverride w:val=\"%d\"/>"), OverrideLevel.m_nStart ); sResult.AppendFormat( _T("<w:startOverride w:val=\"%d\"/>"), OverrideLevel.m_nStart );
sResult.Append( OverrideLevel.m_oLevel.RenderToOOX2(oRenderParameter, OverrideLevel.m_nLevelIndex) ); sResult += OverrideLevel.m_oLevel.RenderToOOX2(oRenderParameter, OverrideLevel.m_nLevelIndex);
sResult.Append( _T("</w:lvlOverride>") ); sResult += _T("</w:lvlOverride>");
} }
} }
return sResult; return sResult;
...@@ -2861,8 +2869,8 @@ public: ...@@ -2861,8 +2869,8 @@ public:
//public: CString RenderToRtf(RenderParameter oRenderParameter) //public: CString RenderToRtf(RenderParameter oRenderParameter)
// { // {
// CString sResult; // CString sResult;
// sResult.Append( m_oRowProperty.RenderToRtf( oRenderParameter ) ); // sResult += m_oRowProperty.RenderToRtf( oRenderParameter );
// sResult.Append(_T(" {")+RtfParagraphProperty::RenderToRtf( oRenderParameter )+_T(" }") ); // sResult += _T(" {") + RtfParagraphProperty::RenderToRtf( oRenderParameter )+_T(" }");
// return sResult; // return sResult;
// } // }
//}; //};
......
...@@ -646,15 +646,14 @@ public: ...@@ -646,15 +646,14 @@ public:
CString RenderToRtf(RenderParameter oRenderParameter) CString RenderToRtf(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult = m_oProperty.RenderToRtf( oRenderParameter );
sResult.Append( m_oProperty.RenderToRtf( oRenderParameter ) );
if( RENDER_TO_RTF_PARAM_NO_SECT != oRenderParameter.nType ) if( RENDER_TO_RTF_PARAM_NO_SECT != oRenderParameter.nType )
sResult.Append(_T("\\sectd")); sResult.Append(_T("\\sectd"));
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
{ {
sResult += m_aArray[i]->RenderToRtf( oRenderParameter ); sResult += m_aArray[i]->RenderToRtf( oRenderParameter );
} }
return sResult; return sResult;
} }
......
...@@ -59,29 +59,33 @@ public: ...@@ -59,29 +59,33 @@ public:
CString RenderToOOX(RenderParameter oRenderParameter) CString RenderToOOX(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult = _T("<w:tbl>");
sResult += m_oProperty.RenderToOOX(oRenderParameter);
sResult.Append( _T("<w:tbl>") ); sResult += _T("<w:tblGrid>");
sResult.Append(m_oProperty.RenderToOOX(oRenderParameter));
sResult.Append(_T("<w:tblGrid>")); for( int i = 0; i < (int)m_aTableGrid.size(); i++ )
for( int i = 0; i < (int)m_aTableGrid.size(); i++ ) {
sResult.AppendFormat(_T("<w:gridCol w:w=\"%d\"/>"), m_aTableGrid[i]); sResult.AppendFormat(_T("<w:gridCol w:w=\"%d\"/>"), m_aTableGrid[i]);
sResult.Append(_T("</w:tblGrid>")); }
sResult += _T("</w:tblGrid>");
for(int i = 0; i < (int)m_aArray.size(); i++) for(int i = 0; i < (int)m_aArray.size(); i++)
{ {
sResult.Append( m_aArray[i]->RenderToOOX(oRenderParameter ) ); sResult += m_aArray[i]->RenderToOOX(oRenderParameter );
} }
sResult.Append( _T("</w:tbl>") ); sResult += _T("</w:tbl>");
return sResult; return sResult;
} }
CString RenderToRtf(RenderParameter oRenderParameter) CString RenderToRtf(RenderParameter oRenderParameter)
{ {
CString result; CString result;
result.Append(_T("\n"));
result += _T("\n");
for(int i = 0 ; i < (int)m_aArray.size(); i++) for(int i = 0 ; i < (int)m_aArray.size(); i++)
result.Append( m_aArray[i]->RenderToRtf(oRenderParameter) ); {
result.Append(_T("\n")); result += m_aArray[i]->RenderToRtf( oRenderParameter );
}
result += _T("\n");
return result; return result;
} }
......
...@@ -55,43 +55,44 @@ public: ...@@ -55,43 +55,44 @@ public:
{ {
if( m_aArray[i]->GetType() == TYPE_RTF_PARAGRAPH ) if( m_aArray[i]->GetType() == TYPE_RTF_PARAGRAPH )
{ {
result.Append( m_aArray[i]->RenderToRtf( oRenderParameter ) ); result += m_aArray[i]->RenderToRtf( oRenderParameter );
if( i != m_aArray.size() - 1 ) if( i != m_aArray.size() - 1 )
result.Append( _T("\\par") ); result += _T("\\par");
} }
else else
{ {
RenderParameter oNewParameter = oRenderParameter; RenderParameter oNewParameter = oRenderParameter;
oNewParameter.nType = RENDER_TO_RTF_PARAM_NESTED; oNewParameter.nType = RENDER_TO_RTF_PARAM_NESTED;
result.Append( m_aArray[i]->RenderToRtf( oNewParameter ) );
result += m_aArray[i]->RenderToRtf( oNewParameter );
} }
} }
if( RENDER_TO_RTF_PARAM_NESTED != oRenderParameter.nType ) if( RENDER_TO_RTF_PARAM_NESTED != oRenderParameter.nType )
result.Append( _T("\\cell")); result += _T("\\cell");
else else
result.Append( _T("\\nestcell{\\nonesttables }")); //todo как бы вернуть result += _T("\\nestcell{\\nonesttables }"); //todo как бы вернуть
return result; return result;
} }
CString RenderToOOX(RenderParameter oRenderParameter) CString RenderToOOX(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult = _T("<w:tc>");
sResult.Append(_T("<w:tc>"));
CString sProp = m_oProperty.RenderToOOX( oRenderParameter ); CString sProp = m_oProperty.RenderToOOX( oRenderParameter );
if( _T("") != sProp ) if( !sProp.IsEmpty() )
{ {
sResult.Append(_T("<w:tcPr>")); sResult += _T("<w:tcPr>");
sResult.Append(sProp); sResult += sProp;
sResult.Append(_T("</w:tcPr>")); sResult += _T("</w:tcPr>");
} }
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
{ {
sResult.Append( m_aArray[i]->RenderToOOX( oRenderParameter) ); sResult += m_aArray[i]->RenderToOOX( oRenderParameter);
} }
sResult.Append(_T("</w:tc>")); sResult += _T("</w:tc>");
return sResult; return sResult;
} }
}; };
......
...@@ -48,26 +48,26 @@ public: ...@@ -48,26 +48,26 @@ public:
CString RenderToRtf(RenderParameter oRenderParameter) CString RenderToRtf(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
sResult.Append(_T("\n")); sResult += _T("\n");
if( RENDER_TO_RTF_PARAM_NESTED == oRenderParameter.nType ) if( RENDER_TO_RTF_PARAM_NESTED == oRenderParameter.nType )
{ {
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
{ {
sResult.Append( m_aArray[i]->RenderToRtf( oRenderParameter ) ); sResult += m_aArray[i]->RenderToRtf( oRenderParameter );
} }
sResult.Append(_T("{\\*\\nesttableprops")); sResult += _T("{\\*\\nesttableprops");
sResult.Append( m_oProperty.RenderToRtf( oRenderParameter ) ); sResult += m_oProperty.RenderToRtf( oRenderParameter );
sResult.Append(_T("\\nestrow}{\\nonesttables \\par}")); sResult += _T("\\nestrow}{\\nonesttables \\par}");
} }
else else
{ {
sResult.Append( m_oProperty.RenderToRtf( oRenderParameter ) ); sResult += m_oProperty.RenderToRtf( oRenderParameter );
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
{ {
sResult.Append( m_aArray[i]->RenderToRtf( oRenderParameter ) ); sResult += m_aArray[i]->RenderToRtf( oRenderParameter );
} }
sResult.Append(_T("\\row")); sResult += _T("\\row");
} }
return sResult; return sResult;
} }
...@@ -81,8 +81,7 @@ public: ...@@ -81,8 +81,7 @@ public:
CString sRowProp = m_oProperty.RenderToOOX(oNewParam); CString sRowProp = m_oProperty.RenderToOOX(oNewParam);
if( false == sRowProp.IsEmpty() ) if( false == sRowProp.IsEmpty() )
{ {
CString sXml; CString sXml = _T("<w:trPr>") + sRowProp + _T("</w:trPr>");
sXml.Format(_T("<w:trPr>%ls</w:trPr>"), sRowProp);
oXmlWriter.WriteString(sXml); oXmlWriter.WriteString(sXml);
} }
for(int i = 0 ; i < (int)m_aArray.size(); i++) for(int i = 0 ; i < (int)m_aArray.size(); i++)
......
...@@ -149,7 +149,7 @@ bool RtfWriter::SaveByItem() ...@@ -149,7 +149,7 @@ bool RtfWriter::SaveByItem()
sRtf = m_oDocument[0]->operator[](0)->RenderToRtf(oNewParam); sRtf = m_oDocument[0]->operator[](0)->RenderToRtf(oNewParam);
if( TYPE_RTF_PARAGRAPH == m_oDocument[0]->operator[](0)->GetType() && !(m_oDocument[0]->GetCount() == 0 && m_oDocument.GetCount() > 1) )//для последнего параграфа секции не пишем \par if( TYPE_RTF_PARAGRAPH == m_oDocument[0]->operator[](0)->GetType() && !(m_oDocument[0]->GetCount() == 0 && m_oDocument.GetCount() > 1) )//для последнего параграфа секции не пишем \par
{ {
sRtf.Append( _T("\\par") ); sRtf += _T("\\par");
//oNewParam.nValue = RENDER_TO_RTF_PARAM_NO_PAR; //oNewParam.nValue = RENDER_TO_RTF_PARAM_NO_PAR;
} }
RtfUtility::RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileWriter ); RtfUtility::RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileWriter );
...@@ -276,48 +276,51 @@ CString RtfWriter::CreateRtfStart() ...@@ -276,48 +276,51 @@ CString RtfWriter::CreateRtfStart()
oRenderParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN; oRenderParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
CString sResult; CString sResult;
sResult.Append( _T("{\\rtf1\\ulc1") ); sResult += _T("{\\rtf1\\ulc1");
sResult.Append( m_oDocument.m_oProperty.RenderToRtf( oRenderParameter ) ); sResult += m_oDocument.m_oProperty.RenderToRtf( oRenderParameter );
sResult.Append( m_oDocument.m_oFontTable.RenderToRtf( oRenderParameter ) ); sResult += m_oDocument.m_oFontTable.RenderToRtf( oRenderParameter );
sResult.Append( m_oDocument.m_oColorTable.RenderToRtf( oRenderParameter ) ); sResult += m_oDocument.m_oColorTable.RenderToRtf( oRenderParameter );
//CString sDefCharProp = m_oDocument.m_oDefaultCharProp.RenderToRtf( oRenderParameter ); //CString sDefCharProp = m_oDocument.m_oDefaultCharProp.RenderToRtf( oRenderParameter );
//if( false == sDefCharProp.IsEmpty() ) //if( false == sDefCharProp.IsEmpty() )
// sResult.AppendFormat( _T("{\\*\\defchp %ls}"), sDefCharProp); // sResult.AppendFormat( _T("{\\*\\defchp %ls}"), sDefCharProp);
//CString sDefParProp = m_oDocument.m_oDefaultParagraphProp.RenderToRtf( oRenderParameter ); //CString sDefParProp = m_oDocument.m_oDefaultParagraphProp.RenderToRtf( oRenderParameter );
//if( false == sDefParProp.IsEmpty() ) //if( false == sDefParProp.IsEmpty() )
// sResult.AppendFormat( _T("{\\*\\defpap %ls}"),sDefParProp ); // sResult.AppendFormat( _T("{\\*\\defpap %ls}"),sDefParProp );
//sResult.Append( m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter ) ); //sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter ) );
sResult.Append( m_oDocument.m_oListTabel.RenderToRtf( oRenderParameter ) );
sResult.Append( m_oDocument.m_oListOverrideTabel.RenderToRtf( oRenderParameter ) ); sResult += m_oDocument.m_oListTabel.RenderToRtf( oRenderParameter );
sResult.Append( m_oDocument.m_oInformation.RenderToRtf( oRenderParameter ) ); sResult += m_oDocument.m_oListOverrideTabel.RenderToRtf( oRenderParameter );
sResult.Append( _T("\\fet2") );//0 Footnotes only or nothing at all (the default). 1 Endnotes only. 2 Both footnotes and endnotes sResult += m_oDocument.m_oInformation.RenderToRtf( oRenderParameter );
sResult += _T("\\fet2");//0 Footnotes only or nothing at all (the default). 1 Endnotes only. 2 Both footnotes and endnotes
CString sFootnote; CString sFootnote;
if( NULL != m_oDocument.m_oFootnoteSep ) if( NULL != m_oDocument.m_oFootnoteSep )
{ {
sFootnote = m_oDocument.m_oFootnoteSep->RenderToRtf( oRenderParameter ); sFootnote = m_oDocument.m_oFootnoteSep->RenderToRtf( oRenderParameter );
if( _T("") != sFootnote ) if( !sFootnote.IsEmpty() )
sResult.AppendFormat( _T("{\\*\\ftnsep %ls}"), sFootnote.GetBuffer() ); sResult += _T("{\\*\\ftnsep ") + sFootnote + _T("}");
} }
if( NULL != m_oDocument.m_oFootnoteCon ) if( NULL != m_oDocument.m_oFootnoteCon )
{ {
sFootnote = m_oDocument.m_oFootnoteCon->RenderToRtf( oRenderParameter ); sFootnote = m_oDocument.m_oFootnoteCon->RenderToRtf( oRenderParameter );
if( _T("") != sFootnote ) if( !sFootnote.IsEmpty() )
sResult.AppendFormat( _T("{\\*\\ftnsepc %ls}"), sFootnote.GetBuffer() ); sResult += _T("{\\*\\ftnsepc ") + sFootnote + _T("}");
} }
if( NULL != m_oDocument.m_oEndnoteSep ) if( NULL != m_oDocument.m_oEndnoteSep )
{ {
sFootnote = m_oDocument.m_oEndnoteSep->RenderToRtf( oRenderParameter ); sFootnote = m_oDocument.m_oEndnoteSep->RenderToRtf( oRenderParameter );
if( _T("") != sFootnote ) if( !sFootnote.IsEmpty() )
sResult.AppendFormat( _T("{\\*\\aftnsep %ls}"), sFootnote.GetBuffer() ); sResult += _T("{\\*\\aftnsep ") + sFootnote + _T("}");
} }
if( NULL != m_oDocument.m_oEndnoteCon ) if( NULL != m_oDocument.m_oEndnoteCon )
{ {
sFootnote = m_oDocument.m_oEndnoteCon->RenderToRtf( oRenderParameter ); sFootnote = m_oDocument.m_oEndnoteCon->RenderToRtf( oRenderParameter );
if( _T("") != sFootnote ) if( !sFootnote.IsEmpty() )
sResult.AppendFormat( _T("{\\*\\aftnsepc %ls}"), sFootnote.GetBuffer() ); sResult += _T("{\\*\\aftnsepc ") + sFootnote + _T("}");
} }
sResult.Append(_T("\n\n")); sResult += _T("\n\n");
return sResult; return sResult;
} }
......
...@@ -56,18 +56,18 @@ CString OOXDocumentWriter::CreateXmlStart() ...@@ -56,18 +56,18 @@ CString OOXDocumentWriter::CreateXmlStart()
//пишем document.xml //пишем document.xml
CString sResult = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n"); CString sResult = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n");
sResult.Append( _T("<w:document") ); sResult += _T("<w:document");
sResult.Append( _T(" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"") ); sResult += _T(" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\"");
sResult.Append( _T(" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"") ); sResult += _T(" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"");
sResult.Append( _T(" xmlns:v=\"urn:schemas-microsoft-com:vml\"") ); sResult += _T(" xmlns:v=\"urn:schemas-microsoft-com:vml\"");
sResult.Append( _T(" xmlns:o=\"urn:schemas-microsoft-com:office:office\"") ); sResult += _T(" xmlns:o=\"urn:schemas-microsoft-com:office:office\"");
sResult.Append( _T(" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\"") ); sResult += _T(" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\"");
sResult.Append( _T(" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\"") ); sResult += _T(" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\"");
sResult.Append( _T(" xmlns:w10=\"urn:schemas-microsoft-com:office:word\"") ); sResult += _T(" xmlns:w10=\"urn:schemas-microsoft-com:office:word\"");
sResult.Append( _T(" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"") ); sResult += _T(" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"");
sResult.Append( _T(">") ); sResult += _T(">");
sResult.Append( _T("<w:body>") ); sResult += _T("<w:body>");
return sResult; return sResult;
} }
CString OOXDocumentWriter::CreateXmlEnd( ) CString OOXDocumentWriter::CreateXmlEnd( )
...@@ -76,13 +76,14 @@ CString OOXDocumentWriter::CreateXmlEnd( ) ...@@ -76,13 +76,14 @@ CString OOXDocumentWriter::CreateXmlEnd( )
//пишем все кроме document.xml //пишем все кроме document.xml
RenderParameter oNewParam; RenderParameter oNewParam;
oNewParam.poDocument = &m_oDocument; oNewParam.poDocument = &m_oDocument;
oNewParam.poWriter = &m_oWriter; oNewParam.poWriter = &m_oWriter;
oNewParam.poRels = &m_oWriter.m_oDocRels; oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
OOXEndnoteWriter* poEndnoteWriter = static_cast<OOXEndnoteWriter*>( m_oWriter.m_poEndnoteWriter ); OOXEndnoteWriter* poEndnoteWriter = static_cast<OOXEndnoteWriter*>( m_oWriter.m_poEndnoteWriter );
OOXFootnoteWriter* poFootnoteWriter = static_cast<OOXFootnoteWriter*>( m_oWriter.m_poFootnoteWriter ); OOXFootnoteWriter* poFootnoteWriter = static_cast<OOXFootnoteWriter*>( m_oWriter.m_poFootnoteWriter );
if( NULL != m_oDocument.m_oFootnoteCon ) if( NULL != m_oDocument.m_oFootnoteCon )
{ {
oNewParam.poRels = poFootnoteWriter->m_oRelsWriter.get(); oNewParam.poRels = poFootnoteWriter->m_oRelsWriter.get();
...@@ -154,7 +155,7 @@ CString OOXDocumentWriter::CreateXmlEnd( ) ...@@ -154,7 +155,7 @@ CString OOXDocumentWriter::CreateXmlEnd( )
sStyles += sTempParaDef; sStyles += sTempParaDef;
sStyles += _T("</w:pPr></w:pPrDefault>"); sStyles += _T("</w:pPr></w:pPrDefault>");
} }
sStyles.Append(_T("</w:docDefaults>")); sStyles += _T("</w:docDefaults>");
} }
sStyles += m_oDocument.m_oStyleTable.RenderToOOX(oNewParam); sStyles += m_oDocument.m_oStyleTable.RenderToOOX(oNewParam);
...@@ -178,10 +179,10 @@ CString OOXDocumentWriter::CreateXmlEnd( ) ...@@ -178,10 +179,10 @@ CString OOXDocumentWriter::CreateXmlEnd( )
oNewParam.poWriter = &m_oWriter; oNewParam.poWriter = &m_oWriter;
oNewParam.poRels = &m_oWriter.m_oDocRels; oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
sResult.Append( m_oDocument[0]->m_oProperty.RenderToOOX(oNewParam) ); sResult += m_oDocument[0]->m_oProperty.RenderToOOX(oNewParam);
sResult.Append( _T("</w:body>") ); sResult += _T("</w:body>");
sResult.Append( _T("</w:document>") ); sResult += _T("</w:document>");
return sResult; return sResult;
} }
......
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
void AddContent( CString sText ) void AddContent( CString sText )
{ {
m_sFileXml.Append( sText ); m_sFileXml += sText;
} }
bool Save( CString sFolder ) bool Save( CString sFolder )
{ {
......
...@@ -45,38 +45,38 @@ public: ...@@ -45,38 +45,38 @@ public:
void AddFootnoteBegin( CString sType, int nID, CString sText ) void AddFootnoteBegin( CString sType, int nID, CString sText )
{ {
CString sFootnote; CString sFootnote;
sFootnote.Append( _T("<w:footnote") ); sFootnote += _T("<w:footnote");
if( false == sType.IsEmpty() ) if( false == sType.IsEmpty() )
{ {
sFootnote.Append(_T(" w:type=\"") ); sFootnote += _T(" w:type=\"");
sFootnote += sType; sFootnote += sType;
sFootnote.Append(_T("\"")); sFootnote += _T("\"");
} }
if( PROP_DEF != nID ) if( PROP_DEF != nID )
sFootnote.AppendFormat( _T(" w:id=\"%d\""), nID ); sFootnote.AppendFormat( _T(" w:id=\"%d\""), nID );
sFootnote.Append( _T(">") ); sFootnote += _T(">");
sFootnote.Append( sText ); sFootnote += sText;
sFootnote.Append(_T("</w:footnote>")); sFootnote += _T("</w:footnote>");
m_sFootnotes.Insert( 0 , sFootnote ); m_sFootnotes.Insert( 0 , sFootnote );
} }
void AddFootnote( CString sType, int nID, CString sText ) void AddFootnote( CString sType, int nID, CString sText )
{ {
m_sFootnotes.Append( _T("<w:footnote") ); m_sFootnotes += _T("<w:footnote");
if( false == sType.IsEmpty() ) if( !sType.IsEmpty() )
{ {
m_sFootnotes.Append(_T(" w:type=\"") ); m_sFootnotes += _T(" w:type=\"");
m_sFootnotes += sType; m_sFootnotes += sType;
m_sFootnotes.Append(_T("\"")); m_sFootnotes += _T("\"");
} }
if( PROP_DEF != nID ) if( PROP_DEF != nID )
{ {
m_sFootnotes.AppendFormat( _T(" w:id=\"%d\""), nID ); m_sFootnotes.AppendFormat( _T(" w:id=\"%d\""), nID );
} }
m_sFootnotes.Append( _T(">") ); m_sFootnotes += _T(">");
m_sFootnotes.Append( sText ); m_sFootnotes += sText;
m_sFootnotes.Append(_T("</w:footnote>")); m_sFootnotes += _T("</w:footnote>");
} }
bool Save( CString sFolder ) bool Save( CString sFolder )
{ {
...@@ -106,11 +106,11 @@ private: ...@@ -106,11 +106,11 @@ private:
CString CreateXml() CString CreateXml()
{ {
CString sResult; CString sResult;
sResult.Append( _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>") ); sResult += _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
sResult.AppendChar('\n'); sResult.AppendChar('\n');
sResult.Append( _T("<w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2008/9/16/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2009/2/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingShape\" >") ); sResult += _T("<w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2008/9/16/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2009/2/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingShape\" >");
sResult.Append( m_sFootnotes ); sResult += m_sFootnotes;
sResult.Append( _T("</w:footnotes>") ); sResult += _T("</w:footnotes>");
return sResult; return sResult;
} }
...@@ -127,36 +127,36 @@ public: ...@@ -127,36 +127,36 @@ public:
void AddEndnoteBegin( CString sType, int nID, CString sText ) void AddEndnoteBegin( CString sType, int nID, CString sText )
{ {
CString sEndnote; CString sEndnote;
sEndnote.Append( _T("<w:endnote") ); sEndnote += _T("<w:endnote");
if( false == sType.IsEmpty() ) if( false == sType.IsEmpty() )
{ {
sEndnote.Append(_T(" w:type=\"") ); sEndnote += _T(" w:type=\"");
sEndnote += sType; sEndnote += sType;
sEndnote.Append(_T("\"")); sEndnote += _T("\"");
} }
if( -2 != nID ) if( -2 != nID )
sEndnote.AppendFormat( _T(" w:id=\"%d\""), nID ); sEndnote.AppendFormat( _T(" w:id=\"%d\""), nID );
sEndnote.Append( _T(">") ); sEndnote += _T(">");
sEndnote.Append( sText ); sEndnote += sText;
sEndnote.Append(_T("</w:endnote>") ); sEndnote += _T("</w:endnote>");
m_sEndnotes.Insert( 0 , sEndnote ); m_sEndnotes.Insert( 0 , sEndnote );
} }
void AddEndnote( CString sType, int nID, CString sText ) void AddEndnote( CString sType, int nID, CString sText )
{ {
m_sEndnotes.Append( _T("<w:endnote") ); m_sEndnotes += _T("<w:endnote");
if( false == sType.IsEmpty() ) if( false == sType.IsEmpty() )
{ {
m_sEndnotes.Append(_T(" w:type=\"") ); m_sEndnotes += _T(" w:type=\"");
m_sEndnotes += sType; m_sEndnotes += sType;
m_sEndnotes.Append(_T("\"")); m_sEndnotes += _T("\"");
} }
if( -2 != nID ) if( -2 != nID )
m_sEndnotes.AppendFormat( _T(" w:id=\"%d\""), nID ); m_sEndnotes.AppendFormat( _T(" w:id=\"%d\""), nID );
m_sEndnotes.Append( _T(">") ); m_sEndnotes += _T(">");
m_sEndnotes.Append( sText ); m_sEndnotes += sText;
m_sEndnotes.Append(_T("</w:endnote>") ); m_sEndnotes += _T("</w:endnote>");
} }
bool Save( CString sFolder ) bool Save( CString sFolder )
{ {
...@@ -182,10 +182,11 @@ private: ...@@ -182,10 +182,11 @@ private:
std::string CreateXml() std::string CreateXml()
{ {
std::wstring sResult; std::wstring sResult;
sResult.append( _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>") );
sResult.append( _T("<w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2008/9/16/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2009/2/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingShape\" >") ); sResult += _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
sResult.append( m_sEndnotes.GetBuffer() ); sResult += _T("<w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2008/9/16/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2009/2/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2008/6/28/wordprocessingShape\" >");
sResult.append( _T("</w:endnotes>") ); sResult += m_sEndnotes;
sResult += _T("</w:endnotes>");
return NSFile::CUtf8Converter::GetUtf8StringFromUnicode( sResult); return NSFile::CUtf8Converter::GetUtf8StringFromUnicode( sResult);
} }
......
...@@ -42,11 +42,11 @@ public: ...@@ -42,11 +42,11 @@ public:
{ {
m_oRelsWriter = OOXRelsWriterPtr( new OOXRelsWriter( _T("numbering.xml"), oDocument ) ); m_oRelsWriter = OOXRelsWriterPtr( new OOXRelsWriter( _T("numbering.xml"), oDocument ) );
oWriter.m_oCustomRelsWriter.push_back( m_oRelsWriter ); oWriter.m_oCustomRelsWriter.push_back( m_oRelsWriter );
//m_sFileXml.Append( oDocument.RenderToOOX(&oWriter,&oDocument,"numbering.xml","") ); //m_sFileXml += oDocument.RenderToOOX(&oWriter,&oDocument,"numbering.xml","");
} }
void AddNumbering( CString sText ) void AddNumbering( CString sText )
{ {
m_sFileXml.Append( sText ); m_sFileXml += sText;
} }
bool Save( CString sFolder ) bool Save( CString sFolder )
{ {
......
...@@ -64,18 +64,18 @@ public: ...@@ -64,18 +64,18 @@ public:
CString CreateXml() CString CreateXml()
{ {
CString sResult; CString sResult;
sResult.Append( _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>") ); sResult += _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
sResult.AppendChar('\n'); sResult.AppendChar('\n');
sResult.Append( _T("<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">") ); sResult += _T("<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
for( int i = 0; i < (int)m_aTargets.size(); i++ ) for( int i = 0; i < (int)m_aTargets.size(); i++ )
{ {
sResult.AppendFormat( _T("<Relationship Id=\"%ls\" Type=\"%ls\" Target=\"%ls\""), m_aIDs[i].GetBuffer(), m_aTypes[i].GetBuffer(), m_aTargets[i].GetBuffer()); sResult.AppendFormat( _T("<Relationship Id=\"%ls\" Type=\"%ls\" Target=\"%ls\""), m_aIDs[i].GetBuffer(), m_aTypes[i].GetBuffer(), m_aTargets[i].GetBuffer());
if( false == m_aModes[i] ) if( false == m_aModes[i] )
sResult.Append( _T(" TargetMode=\"External\"") ); sResult += _T(" TargetMode=\"External\"");
sResult.Append( _T("/>") ); sResult += _T("/>");
} }
sResult.Append( _T("</Relationships>") ); sResult += _T("</Relationships>");
return sResult; return sResult;
} }
......
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
} }
void AddContent( CString sText ) void AddContent( CString sText )
{ {
m_sFileXml.Append( sText ); m_sFileXml += sText;
} }
bool Save( CString sFolder ) bool Save( CString sFolder )
{ {
...@@ -82,7 +82,7 @@ public: ...@@ -82,7 +82,7 @@ public:
// TRUE == oXmlReader1.ReadRootNode( _T("w:settings") ) && TRUE == oXmlReader2.ReadRootNode( _T("w:settings") ) ) // TRUE == oXmlReader1.ReadRootNode( _T("w:settings") ) && TRUE == oXmlReader2.ReadRootNode( _T("w:settings") ) )
// { // {
// sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>"); // sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>");
// //sXml.Append( RtfUtility::MergeXml( oXmlReader1, oXmlReader2 ) ); // //sXml += RtfUtility::MergeXml( oXmlReader1, oXmlReader2 );
// } // }
//} //}
......
...@@ -48,7 +48,7 @@ public: ...@@ -48,7 +48,7 @@ public:
} }
void AddContent( CString sText ) void AddContent( CString sText )
{ {
m_sFileXml.Append( sText ); m_sFileXml += sText;
} }
bool Save( CString sFolder ) bool Save( CString sFolder )
{ {
......
...@@ -1051,8 +1051,8 @@ namespace OOX ...@@ -1051,8 +1051,8 @@ namespace OOX
if ( _T("mc:Fallback") == sName || _T("mc:Choice") == sName ) if ( _T("mc:Fallback") == sName || _T("mc:Choice") == sName )
{ {
CString strXml = _T("<root xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">"); CString strXml = _T("<root xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">");
strXml.Append(oReader.GetOuterXml()); strXml += oReader.GetOuterXml();
strXml.Append(_T("</root>")); strXml += _T("</root>");
XmlUtils::CXmlLiteReader oSubReader; XmlUtils::CXmlLiteReader oSubReader;
......
...@@ -457,9 +457,9 @@ namespace OOX ...@@ -457,9 +457,9 @@ namespace OOX
//альтернатива pptx //альтернатива pptx
CString sXml; //??? + ole наверно что то (лень ...) CString sXml; //??? + ole наверно что то (лень ...)
sXml.Append(_T("<root xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">")); sXml += _T("<root xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">");
sXml.Append(m_sXml.get()); sXml += m_sXml.get();
sXml.Append(_T("</root>")); sXml += _T("</root>");
XmlUtils::CXmlLiteReader oSubReader; XmlUtils::CXmlLiteReader oSubReader;
oSubReader.FromString(sXml); oSubReader.FromString(sXml);
......
...@@ -256,8 +256,8 @@ namespace OOX ...@@ -256,8 +256,8 @@ namespace OOX
m_sTextFill = oReader.GetOuterXml(); m_sTextFill = oReader.GetOuterXml();
CString strXml = _T("<xml xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" >"); CString strXml = _T("<xml xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" >");
strXml.Append(m_sTextFill.get()); strXml += m_sTextFill.get();
strXml.Append(_T("</xml>")); strXml += _T("</xml>");
XmlUtils::CXmlLiteReader oSubReader;//нам нужны xml и сами объекты XmlUtils::CXmlLiteReader oSubReader;//нам нужны xml и сами объекты
bool result = oSubReader.FromString(strXml); bool result = oSubReader.FromString(strXml);
......
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