Commit 6778027d authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormat - small refactoring

parent daf44553
......@@ -310,33 +310,6 @@ public: CString RenderToOOX(RenderParameter oRenderParameter)
//заканчиваем Field
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 += m_oResult->RenderToOOX(oNewParametr));
//CString sFieldBegin;
//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 += _T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>");
////пишем после первого w:pPr
//CString sFindStr = _T("</w:pPr>");
//int nIndex = sResult.Find( sFindStr );
//if( nIndex >= 0 && nIndex < sResult.GetLength() )
// sResult.Inset( sFieldBegin, nIndex + sFindStr.GetLength() );
//else//пишем после первого w:p
//{
// sFindStr = _T("<w:p>");
// nIndex = sResult.Find( sFindStr );
// if( nIndex >= 0 && nIndex < sResult.GetLength() )
// sResult.Inset( sFieldBegin, nIndex + sFindStr.GetLength() );
//}
//CString sFieldEnd;
//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 += _T("<w:r><w:fldChar w:fldCharType=\"separate\"/></w:r>");
////пишем после последнего w:pPr
}
}
}
......
......@@ -250,7 +250,7 @@ public:
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
CString str = m_aArray[i]->RenderToRtf( oRenderParameter );
sResult.AppendFormat(_T("%ls\n\n"), str.GetBuffer());
sResult += str + _T("\n\n");
}
sResult += _T("}");
......
......@@ -37,16 +37,10 @@ CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter)
{
CString sResult;
sResult += _T("{\\pict");
//if(-1 != m_nShapeId)
// sResult.AppendFormat(_T("{\\*\\picprop\\shplid%d%ls}"), m_nShapeId, m_oShapeProp.RenderToRtf( oRenderParameter ) );
//else
// sResult.AppendFormat(_T("{\\*\\picprop%ls}"), m_oShapeProp.RenderToRtf( oRenderParameter ) );
////"наши" wmf не растягиваются
RENDER_RTF_INT( 100, sResult, _T("picscalex") )
RENDER_RTF_INT( 100, sResult, _T("picscaley") )
//RENDER_RTF_INT( (int)m_dScaleX, sResult, _T("picscalex") )
//RENDER_RTF_INT( (int)m_dScaleY, sResult, _T("picscaley") )
RENDER_RTF_INT( m_nCropL, sResult, _T("piccropl") )
RENDER_RTF_INT( m_nCropT, sResult, _T("piccropt") )
RENDER_RTF_INT( m_nCropR, sResult, _T("piccropr") )
......@@ -87,9 +81,12 @@ CString RtfPicture::RenderToRtf(RenderParameter oRenderParameter)
CString sResult = _T("{\\pict");
//if(-1 != m_nShapeId)
// sResult.AppendFormat(_T("{\\*\\picprop\\shplid%d%ls}"), m_nShapeId, m_oShapeProp.RenderToRtf( oRenderParameter ) );
//{
// sResult.AppendFormat(_T("{\\*\\picprop\\shplid%d"), m_nShapeId);
// sResult += m_oShapeProp.RenderToRtf( oRenderParameter ) + _T("}");
//}
//else
// sResult.AppendFormat(_T("{\\*\\picprop%ls}"), m_oShapeProp.RenderToRtf( oRenderParameter ) );
// sResult.AppendFormat(_T("{\\*\\picprop") + m_oShapeProp.RenderToRtf( oRenderParameter ) + _T("}");
RENDER_RTF_INT( (int)m_dScaleX, sResult, _T("picscalex") )
RENDER_RTF_INT( (int)m_dScaleY, sResult, _T("picscaley") )
RENDER_RTF_INT( m_nCropL, sResult, _T("piccropl") )
......@@ -137,7 +134,9 @@ CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter)
}
CString sFilenameRels;
sFilenameRels.AppendFormat( _T("Image%d.%ls"), poRtfDocument->m_oIdGenerator.Generate_ImageIndex(), sExtension.GetBuffer());
sFilenameRels.AppendFormat( _T("Image%d."), poRtfDocument->m_oIdGenerator.Generate_ImageIndex());
sFilenameRels += sExtension;
CString sFilenameFull = poOOXWriter->m_sTargetFolder + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR +_T("media");
FileSystem::Directory::CreateDirectory( sFilenameFull );
......@@ -154,8 +153,5 @@ CString RtfPicture::RenderToOOX(RenderParameter oRenderParameter)
CString srId = poRelsWriter->AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"), sFilenameRels);
//CString sResult;
//sResult.AppendFormat( _T("<v:imagedata r:id=\"%ls\""), srId );
return srId;
}
\ No newline at end of file
......@@ -146,8 +146,14 @@ CString RtfFont::RenderToOOX(RenderParameter oRenderParameter)
case ft_fdbmajor: sTag = _T("ea");break;
case ft_fbimajor: sTag = _T("cs");break;
}
if( _T("") != sTag )
sResult.AppendFormat(_T("<%ls typeface=\"%ls\"/>"), sTag.GetBuffer(), Utils::PrepareToXML( sFontName ).GetBuffer());
if( !sTag.IsEmpty() )
{
sResult += _T("<");
sResult += sTag;
sResult += _T(" typeface=\"");
sResult += Utils::PrepareToXML( sFontName );
sResult += _T("\"/>");
}
}
else if( RENDER_TO_OOX_PARAM_FONTTABLE == oRenderParameter.nType )
{
......@@ -572,7 +578,7 @@ CString RtfBorder::RenderToOOX(RenderParameter oRenderParameter)
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_COLOR_VALUE;
if( true == poRtfDocument->m_oColorTable.GetColor( m_nColor, oColor ) )
sResult.AppendFormat( _T(" w:color=\"%ls\""), oColor.RenderToOOX(oNewParam).GetBuffer() );
sResult += _T(" w:color=\"") + oColor.RenderToOOX(oNewParam) + _T("\"");
}
if( PROP_DEF != m_nWidth ) //w:sz 1/8 twips (equivalent to 1/576th of an inch)
sResult.AppendFormat( _T(" w:sz=\"%d\""), 2 * m_nWidth / 5 );
......@@ -820,26 +826,27 @@ CString RtfCharProperty::RenderToOOX(RenderParameter oRenderParameter)
}
if( uls_none != m_eUnderStyle )
{
sResult += _T("<w:u ") + sUnderColor;
switch( m_eUnderStyle )
{
case uls_Single: sResult.AppendFormat(_T("<w:u %ls w:val=\"single\"/>"),sUnderColor.GetBuffer()); break;
case uls_Dotted: sResult.AppendFormat(_T("<w:u %ls w:val=\"dotted\"/>"),sUnderColor.GetBuffer()); break;
case uls_Dashed: sResult.AppendFormat(_T("<w:u %ls w:val=\"dash\"/>"),sUnderColor.GetBuffer()); break;
case uls_Dash_dotted: sResult.AppendFormat(_T("<w:u %ls w:val=\"dotDash\"/>"),sUnderColor.GetBuffer()); break;
case uls_Dash_dot_dotted: sResult.AppendFormat(_T("<w:u %ls w:val=\"dotDotDash\"/>"),sUnderColor.GetBuffer());break;
case uls_Double: sResult.AppendFormat(_T("<w:u %ls w:val=\"double\"/>"),sUnderColor.GetBuffer()); break;
case uls_Heavy_wave: sResult.AppendFormat(_T("<w:u %ls w:val=\"wavyHeavy\"/>"),sUnderColor.GetBuffer()); break;
case uls_Long_dashe: sResult.AppendFormat(_T("<w:u %ls w:val=\"dashLong\"/>"),sUnderColor.GetBuffer()) ;break;
case uls_Stops_all: sResult.AppendFormat(_T("<w:u %ls w:val=\"single\"/>"),sUnderColor.GetBuffer()); break;//todo
case uls_Thick: sResult.AppendFormat(_T("<w:u %ls w:val=\"thick\"/>"),sUnderColor.GetBuffer()); break;
case uls_Thick_dotted: sResult.AppendFormat(_T("<w:u %ls w:val=\"dottedHeavy\"/>"),sUnderColor.GetBuffer());break;
case uls_Thick_dashed: sResult.AppendFormat(_T("<w:u %ls w:val=\"dashedHeavy\"/>"),sUnderColor.GetBuffer());break;
case uls_Thick_dash_dotted: sResult.AppendFormat(_T("<w:u %ls w:val=\"dashDotHeavy\"/>"),sUnderColor.GetBuffer());break;
case uls_Thick_dash_dot_dotted: sResult.AppendFormat(_T("<w:u %ls w:val=\"dashDotDotHeavy\"/>"),sUnderColor.GetBuffer());break;
case uls_Thick_long_dashed: sResult.AppendFormat(_T("<w:u %ls w:val=\"dashLongHeavy\"/>"),sUnderColor.GetBuffer()); break;
case uls_Double_wave: sResult.AppendFormat(_T("<w:u %ls w:val=\"wavyDouble\"/>"),sUnderColor.GetBuffer()); break;
case uls_Word: sResult.AppendFormat(_T("<w:u %ls w:val=\"words\"/>"),sUnderColor.GetBuffer()); break;
case uls_Wave: sResult.AppendFormat(_T("<w:u %ls w:val=\"wave\"/>"),sUnderColor.GetBuffer()); break;
case uls_Single: sResult += _T(" w:val=\"single\"/>"); break;
case uls_Dotted: sResult += _T(" w:val=\"dotted\"/>"); break;
case uls_Dashed: sResult += _T(" w:val=\"dash\"/>"); break;
case uls_Dash_dotted: sResult += _T(" w:val=\"dotDash\"/>"); break;
case uls_Dash_dot_dotted: sResult += _T(" w:val=\"dotDotDash\"/>"); break;
case uls_Double: sResult += _T(" w:val=\"double\"/>"); break;
case uls_Heavy_wave: sResult += _T(" w:val=\"wavyHeavy\"/>"); break;
case uls_Long_dashe: sResult += _T(" w:val=\"dashLong\"/>"); break;
case uls_Stops_all: sResult += _T(" w:val=\"single\"/>"); break;
case uls_Thick: sResult += _T(" w:val=\"thick\"/>"); break;
case uls_Thick_dotted: sResult += _T(" w:val=\"dottedHeavy\"/>"); break;
case uls_Thick_dashed: sResult += _T(" w:val=\"dashedHeavy\"/>"); break;
case uls_Thick_dash_dotted: sResult += _T(" w:val=\"dashDotHeavy\"/>"); break;
case uls_Thick_dash_dot_dotted: sResult += _T(" w:val=\"dashDotDotHeavy\"/>"); break;
case uls_Thick_long_dashed: sResult += _T(" w:val=\"dashLongHeavy\"/>"); break;
case uls_Double_wave: sResult += _T(" w:val=\"wavyDouble\"/>"); break;
case uls_Word: sResult += _T(" w:val=\"words\"/>"); break;
case uls_Wave: sResult += _T(" w:val=\"wave\"/>"); break;
}
}
......@@ -905,8 +912,8 @@ CString RtfListLevelProperty::RenderToRtf(RenderParameter oRenderParameter)
//чтобы при последующем чтении из rtf не потерялась информация о шрифте
sResult += m_oCharProp.RenderToRtf( oRenderParameter );
sResult.AppendFormat( _T("{\\leveltext %ls;}"), RtfChar::renderRtfText( m_sText, oRenderParameter.poDocument, &m_oCharProp ).GetBuffer() );
sResult.AppendFormat(_T("{\\levelnumbers %ls;}"), RtfChar::renderRtfText( m_sNumber, oRenderParameter.poDocument, &m_oCharProp ).GetBuffer() );
sResult += _T("{\\leveltext ") + RtfChar::renderRtfText( m_sText, oRenderParameter.poDocument, &m_oCharProp ) + _T(";}");
sResult += _T("{\\levelnumbers ") + RtfChar::renderRtfText( m_sNumber, oRenderParameter.poDocument, &m_oCharProp ) + _T(";}");
RENDER_RTF_INT( m_nFirstIndent, sResult, _T("fi") )
RENDER_RTF_INT( m_nIndent, sResult, _T("li") )
......@@ -1013,12 +1020,14 @@ CString RtfListProperty::RenderToRtf(RenderParameter oRenderParameter)
if( 1 == m_bListHybrid )
sResult += _T("\\listhybrid");
else if( 1 == m_nListSimple )
sResult.AppendFormat(_T("\\listsimple%d"),m_nListSimple);
sResult.AppendFormat(_T("\\listsimple%d") ,m_nListSimple);
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
sResult += m_aArray[i].RenderToRtf( oRenderParameter );
}
sResult += _T("{\\listname ") + RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument ) + _T(";}");
sResult.AppendFormat(_T("{\\listname %ls;}"), RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument ).GetBuffer());
RENDER_RTF_INT( m_nID, sResult, _T("listid") )
return sResult;
}
......@@ -1032,25 +1041,25 @@ CString RtfListProperty::RenderToOOX(RenderParameter oRenderParameter)
sResult.AppendFormat( _T("<w:abstractNum w:abstractNumId=\"%d\">"), m_nID );
if( 1 == m_bListHybrid )
sResult += _T("<w:multiLevelType w:val=\"hybridMultilevel\" />");
sResult += _T("<w:multiLevelType w:val=\"hybridMultilevel\"/>");
else if( 1 == m_nListSimple )
sResult += _T("<w:multiLevelType w:val=\"singleLevel\" />");
sResult += _T("<w:multiLevelType w:val=\"singleLevel\"/>");
else
sResult += _T("<w:multiLevelType w:val=\"multilevel\" />");
sResult += _T("<w:multiLevelType w:val=\"multilevel\"/>");
if( !m_sName.IsEmpty() )
sResult.AppendFormat(_T("<w:name w:val=\"%ls\" />"), Utils::PrepareToXML( m_sName ).GetBuffer() );
sResult += _T("<w:name w:val=\"") + Utils::PrepareToXML( m_sName ) + _T("\"/>");
//if( false == m_nStyleName )
//{
// sResult.AppendFormat(_T("<w:name w:val=\"%ls\" />"), Utils::PrepareToXML( m_sName ) );
// sResult += _T("<w:name w:val=\"") + Utils::PrepareToXML( m_sName ) + _T("\"/>");
// if( PROP_DEF != m_nStyleID)
// sResult.AppendFormat(_T("<w:styleLink w:val=\"%ls\" />"), Utils::PrepareToXML( m_sName) );
// sResult += _T("<w:styleLink w:val=\"") + Utils::PrepareToXML( m_sName ) + _T("\"/>");
//}
//else
// sResult.AppendFormat(_T("<w:numStyleLink w:val=\"%ls\" />"),Utils::PrepareToXML( m_sName) );
// sResult += _T("<w:numStyleLink w:val=\"") + Utils::PrepareToXML( m_sName) + _T(\"/>");
if( PROP_DEF != m_nTemplateId )
sResult.AppendFormat(_T("<w:tmpl w:val=\"%x\" />") ,m_nTemplateId);
sResult.AppendFormat(_T("<w:tmpl w:val=\"%x\"/>") ,m_nTemplateId);
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
......@@ -1098,19 +1107,19 @@ CString RtfStyle::RenderToOOXBegin(RenderParameter oRenderParameter)
case stSection : sType = _T("numbering"); break;
case stTable : sType = _T("table"); break;
}
sResult.AppendFormat(_T("<w:style w:type=\"%ls\" w:styleId=\"%ls\">"), sType.GetBuffer(), Utils::PrepareToXML( m_sName ).GetBuffer() );//Todo
sResult.AppendFormat(_T("<w:name w:val=\"%ls\"/>"), Utils::PrepareToXML( m_sName ).GetBuffer() );
sResult += _T("<w:style w:type=\"") + sType + _T("\" w:styleId=\"") + Utils::PrepareToXML( m_sName ) + _T("\">");
sResult += _T("<w:name w:val=\"") + Utils::PrepareToXML( m_sName ) + _T("\"/>");
if( PROP_DEF != m_nBasedOn )
{
RtfStylePtr oBaseStyle;
if( true == poDocument->m_oStyleTable.GetStyle( m_nBasedOn, oBaseStyle ) )
sResult.AppendFormat(_T("<w:basedOn w:val=\"%ls\"/>"), Utils::PrepareToXML( oBaseStyle->m_sName ).GetBuffer());//Todo
sResult += _T("<w:basedOn w:val=\"") + Utils::PrepareToXML( oBaseStyle->m_sName ) + _T("\"/>");
}
//if( PROP_DEF != m_nNext )
// sResult.AppendFormat(_T("<w:next w:val=\"%ls\"/>"), Utils::PrepareToXML( m_sName ));//Todo
// sResult += _T("<w:next w:val=\"") + Utils::PrepareToXML( m_sName ) + _T("\"/>"), );//Todo
//if( PROP_DEF != m_nLink )
// sResult.AppendFormat(_T("<w:link w:val=\"%ls\"/>"), Utils::PrepareToXML( m_sName ));//Todo
// sResult += _T("<w:link w:val=\"") + Utils::PrepareToXML( m_sName ) + _T("\"/>"), );//Todo
if( PROP_DEF != m_bHidden ) sResult += _T("<w:hidden/>");
if( PROP_DEF != m_bLocked ) sResult += _T("<w:locked/>");
if( PROP_DEF != m_bPersonal ) sResult += _T("<w:personal w:val=\"true\" />");
......@@ -1135,8 +1144,7 @@ CString RtfStyle::RenderToOOXEnd(RenderParameter oRenderParameter)
CString RtfStyle::RenderToRtfEnd( RenderParameter oRenderParameter )
{
if( false == IsValid() )
return _T("");
if( false == IsValid() ) return _T("");
CString sResult;
RENDER_RTF_INT( m_nBasedOn, sResult, _T("sbasedon") )
......@@ -1152,7 +1160,7 @@ CString RtfStyle::RenderToRtfEnd( RenderParameter oRenderParameter )
RENDER_RTF_INT( m_nPriority, sResult, _T("spriority") )
RENDER_RTF_BOOL( m_bUnhiddenWhenUse, sResult, _T("sunhideused") )
sResult.AppendFormat(_T(" %ls;}"), RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument ).GetBuffer());
sResult += _T(" ") + RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument ) + _T(";}");
return sResult;
}
CString RtfCharStyle::RenderToRtf(RenderParameter oRenderParameter)
......@@ -2301,8 +2309,8 @@ CString RtfCellProperty::RenderToOOX(RenderParameter oRenderParameter)
//RENDER_OOX_BOOL_ATTRIBUTE( m_bStyleNECell, scnfStyle, _T("w:firstRowLastColumn") )
//RENDER_OOX_BOOL_ATTRIBUTE( m_bStyleSWCell, scnfStyle, _T("w:lastRowFirstColumn") )
//RENDER_OOX_BOOL_ATTRIBUTE( m_bStyleSECell, scnfStyle, _T("w:lastRowLastColumn") )
//if( false == scnfStyle.IsEmpty() )
// sResult += _T("<w:cnfStyle %ls/>") );
//if( !scnfStyle.IsEmpty() )
// sResult += _T("<w:cnfStyle ") + scnfStyle + T("(/>");
//cellx
......@@ -2555,8 +2563,9 @@ CString RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter)
sDefCellMargins.AppendFormat( _T("<w:right w:w=\"%d\" w:type=\"dxa\"/>"), m_nDefCellMarRight );
if( PROP_DEF != m_nDefCellMarTop && 3 == m_nDefCellMarTopUnits )
sDefCellMargins.AppendFormat( _T("<w:top w:w=\"%d\" w:type=\"dxa\"/>"), m_nDefCellMarTop );
if( false == sDefCellMargins.IsEmpty() )
sResult.AppendFormat( _T("<w:tblCellMar>%ls</w:tblCellMar>"), sDefCellMargins.GetBuffer() );
if( !sDefCellMargins.IsEmpty() )
sResult += _T("<w:tblCellMar>") + sDefCellMargins + _T("</w:tblCellMar>");
if( PROP_DEF != m_nDefCellSpBottom && 3 == m_nDefCellSpBottomUnits )
sResult.AppendFormat( _T("<w:tblCellSpacing w:w=\"%d\" w:type=\"dxa\"/>"), m_nDefCellSpBottom );
......@@ -2597,7 +2606,7 @@ CString RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter)
// RENDER_OOX_BOOL_ATTRIBUTE( m_bAutoNoColBand, sTableLook, _T("w:noVBand") )
// if( false == sTableLook.IsEmpty() )
// sResult.AppendFormat( _T("<w:tblLook %ls/>"), sTableLook );
// sResult += _T("<w:tblLook ") + sTableLook + _T("/>"));
//}
if( !sResult.IsEmpty() )
......@@ -2706,8 +2715,8 @@ CString RtfRowProperty::RenderToOOX(RenderParameter oRenderParameter)
//RENDER_OOX_BOOL_ATTRIBUTE( m_bStyleNECell, scnfStyle, _T("w:firstRowLastColumn") )
//RENDER_OOX_BOOL_ATTRIBUTE( m_bStyleSWCell, scnfStyle, _T("w:lastRowFirstColumn") )
//RENDER_OOX_BOOL_ATTRIBUTE( m_bStyleSECell, scnfStyle, _T("w:lastRowLastColumn") )
//if( false == scnfStyle.IsEmpty() )
// sResult += _T("<w:cnfStyle %ls/>") );
//if(!scnfStyle.IsEmpty() )
// sResult += _T("<w:cnfStyle ") + scnfStyle + _T("/>") );
// _bstr_t hk;
return sResult;
......@@ -2839,10 +2848,10 @@ CString RtfInformation::RenderToOOX(RenderParameter oRenderParameter)
//CString sPrintTime = m_oPrintTime.RenderToOOX( oRenderParameter );
//if( _T("") != sPrintTime )
// sResult.AppendFormat( _T("<dcterms:created xsi:type=\"dcterms:W3CDTF\">%ls</dcterms:created>"), sCreateTime );
// sResult += _T("<dcterms:created xsi:type=\"dcterms:W3CDTF\">") + sCreateTime + _T("</dcterms:created>");
//CString sBackupTime = m_oBackupTime.RenderToOOX( oRenderParameter );
//if( _T("") != sBackupTime )
// sResult.AppendFormat( _T("<dcterms:created xsi:type=\"dcterms:W3CDTF\">%ls</dcterms:created>"), sCreateTime );
// sResult += _T("<dcterms:created xsi:type=\"dcterms:W3CDTF\">") + sCreateTime + _T("</dcterms:created>");
}
else if( RENDER_TO_OOX_PARAM_APP == oRenderParameter.nType )
{
......
......@@ -714,8 +714,14 @@ private:
CString sTheme;
if( true == GetStringByTheme( sTheme, m_eTheme ) )
{
sResult.AppendFormat(_T("theme%lsColor = \"%ls\" theme%lsShade = \"%d\" theme%lsTint = \"%d\""),
sParam.GetBuffer(), sTheme.GetBuffer(), sParam.GetBuffer(), m_byteShade ,sParam.GetBuffer(), m_byteTint);
sResult += _T("theme") + sParam + _T("Color");
sResult += _T("=\"") + sTheme +_T("\"");
sResult += _T(" theme") + sParam + _T("Shade");
sResult.AppendFormat(_T("=\"%d\""), m_byteShade);
sResult += _T(" theme") + sParam + _T("Tint");
sResult.AppendFormat(_T("=\"%d\""), m_byteTint);
}
}
return sResult;
......
......@@ -516,8 +516,10 @@ CString RtfSectionProperty::RenderToOOX(RenderParameter oRenderParameter)
sPaperSource.AppendFormat( _T(" w:first=\"%d\""), m_nPaperSourceFirst );
if( PROP_DEF != m_nPaperSourceFirst )
sPaperSource.AppendFormat( _T(" w:other=\"%d\""), m_nPaperSourceOther );
if( false == sPaperSource.IsEmpty() )
sResult.AppendFormat(_T("<w:paperSrc %ls/>"), sPaperSource.GetBuffer() );
if( !sPaperSource.IsEmpty() )
sResult += _T("<w:paperSrc ") + sPaperSource + _T("/>");
if( 1 == m_bRtlGutter )
sResult += _T("<w:rtlGutter/>");
......@@ -661,7 +663,7 @@ CString RtfSectionProperty::RenderToOOX(RenderParameter oRenderParameter)
case lnr_linecont: sLineNumbering += _T(" w:restart=\"continuous\""); break;
}
if( false == sLineNumbering.IsEmpty() )
sResult.AppendFormat( _T("<w:lnNumType %ls/>"), sLineNumbering.GetBuffer() );
sResult += _T("<w:lnNumType ") + sLineNumbering+ _T("/>");
//Page Information
CString sPageSize;
......@@ -672,7 +674,7 @@ CString RtfSectionProperty::RenderToOOX(RenderParameter oRenderParameter)
if( 1 == m_bLandscapeFormat )
sPageSize.Append(_T(" w:orient=\"landscape\""));
if( false == sPageSize.IsEmpty() )
sResult.AppendFormat(_T("<w:pgSz %ls/>"), sPageSize.GetBuffer() );
sResult += _T("<w:pgSz ") + sPageSize + _T("/>");
CString sMargin;
if( PROP_DEF != m_nMarginLeft )
......@@ -690,16 +692,16 @@ CString RtfSectionProperty::RenderToOOX(RenderParameter oRenderParameter)
if( PROP_DEF != m_nFooterBottom )
sMargin.AppendFormat(_T(" w:footer=\"%d\""), m_nFooterBottom);
if( false == sMargin.IsEmpty() )
sResult.AppendFormat(_T("<w:pgMar %ls/>"), sMargin.GetBuffer());
sResult += _T("<w:pgMar ") + sMargin + _T("/>");
if( 1 == m_bTitlePage )
sResult.Append(_T("<w:titlePg/>"));
sResult += _T("<w:titlePg/>");
//Page Numbers
CString sPageNumber;
if( PROP_DEF != m_nPageNumberStart )
sPageNumber.AppendFormat( _T(" w:start=\"%d\""), m_nPageNumberStart );
if( false == sPageNumber.IsEmpty() )
sResult.AppendFormat( _T("<w:pgNumType %ls/>"), sPageNumber.GetBuffer() );
sResult += _T("<w:pgNumType ") + sPageNumber + _T("/>");
//Vertical Alignment
switch( m_eVerticalAlignment )
{
......@@ -769,32 +771,32 @@ CString RtfSectionProperty::RenderToOOX(RenderParameter oRenderParameter)
if( 0 != m_oHeaderLeft )
{
CString sId = SaveFile(m_oHeaderLeft,oRenderParameter, true);
sResult.AppendFormat(_T("<w:headerReference w:type=\"even\" r:id=\"%ls\"/>"), sId.GetBuffer());
sResult += _T("<w:headerReference w:type=\"even\" r:id=\"") + sId + _T("\"/>");
}
if( 0 != m_oHeaderFirst )
{
CString sId = SaveFile(m_oHeaderFirst,oRenderParameter, true);
sResult.AppendFormat(_T("<w:headerReference w:type=\"first\" r:id=\"%ls\"/>"), sId.GetBuffer());
sResult += _T("<w:headerReference w:type=\"first\" r:id=\"") + sId + _T("\"/>");
}
if( 0 != m_oHeaderRight )
{
CString sId = SaveFile(m_oHeaderRight,oRenderParameter, true);
sResult.AppendFormat(_T("<w:headerReference w:type=\"default\" r:id=\"%ls\"/>"), sId.GetBuffer());
sResult += _T("<w:headerReference w:type=\"default\" r:id=\"") + sId + _T("\"/>");
}
if( 0 != m_oFooterLeft )
{
CString sId = SaveFile(m_oFooterLeft,oRenderParameter, false);
sResult.AppendFormat(_T("<w:footerReference w:type=\"even\" r:id=\"%ls\"/>"), sId.GetBuffer());
sResult += _T("<w:footerReference w:type=\"even\" r:id=\"") + sId + _T("\"/>");
}
if( 0 != m_oFooterFirst )
{
CString sId = SaveFile(m_oFooterFirst,oRenderParameter, false);
sResult.AppendFormat(_T("<w:footerReference w:type=\"first\" r:id=\"%ls\"/>"), sId.GetBuffer());
sResult += _T("<w:footerReference w:type=\"first\" r:id=\"") + sId + _T("\"/>");
}
if( 0 != m_oFooterRight )
{
CString sId = SaveFile(m_oFooterRight,oRenderParameter, false);
sResult.AppendFormat(_T("<w:footerReference w:type=\"default\" r:id=\"%ls\"/>"), sId.GetBuffer());
sResult += _T("<w:footerReference w:type=\"default\" r:id=\"") + sId + _T("\"/>");
}
sResult.Append(_T("</w:sectPr>"));
return sResult;
......@@ -816,8 +818,10 @@ CString RtfSectionProperty::SaveFile( TextItemContainerPtr oTarget, RenderParame
sRootName = _T("w:hdr");
else
sRootName = _T("w:ftr");
sContent.AppendFormat( _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n") );
sContent.AppendFormat( _T("<%ls xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\">"), sRootName.GetBuffer() );
sContent += _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n");
sContent += _T("<");
sContent += sRootName;
sContent += _T("xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\">");
RenderParameter oNewParameter = oRenderParameter;
OOXRelsWriterPtr oNewRelsWr = OOXRelsWriterPtr( new OOXRelsWriter( sFilename, *poRtfDocument ) );
......@@ -825,7 +829,7 @@ CString RtfSectionProperty::SaveFile( TextItemContainerPtr oTarget, RenderParame
oNewParameter.poRels = oNewRelsWr.get();
sContent += oTarget->RenderToOOX(oNewParameter);
sContent.AppendFormat( _T("</%ls>"), sRootName.GetBuffer() );
sContent += _T("</") + sRootName + _T(">");
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sContent.GetBuffer());
......
......@@ -283,10 +283,10 @@ CString RtfWriter::CreateRtfStart()
//CString sDefCharProp = m_oDocument.m_oDefaultCharProp.RenderToRtf( oRenderParameter );
//if( false == sDefCharProp.IsEmpty() )
// sResult.AppendFormat( _T("{\\*\\defchp %ls}"), sDefCharProp);
// sResult += _T("{\\*\\defchp ") + sDefCharProp + _T("}");
//CString sDefParProp = m_oDocument.m_oDefaultParagraphProp.RenderToRtf( oRenderParameter );
//if( false == sDefParProp.IsEmpty() )
// sResult.AppendFormat( _T("{\\*\\defpap %ls}"),sDefParProp );
// sResult += _T("{\\*\\defpap ") + sDefParProp+ _T("}");
//sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter ) );
sResult += m_oDocument.m_oListTabel.RenderToRtf( oRenderParameter );
......
......@@ -70,7 +70,13 @@ public:
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 += _T("<Relationship Id=\"");
sResult += m_aIDs[i];
sResult += _T("\" Type=\"");
sResult += m_aTypes[i];
sResult += _T("\" Target=\"");
sResult += m_aTargets[i];
sResult += _T("\"");
if( false == m_aModes[i] )
sResult += _T(" TargetMode=\"External\"");
sResult += _T("/>");
......
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