Commit 88f85259 authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatWriter - review

parent 51caa4ec
......@@ -48,6 +48,7 @@ SOURCES += \
../source/RtfPicture.cpp \
../source/RtfOle.cpp \
../source/RtfField.cpp \
../source/RtfParagraph.cpp \
../source/RtfProperty.cpp \
../source/RtfReader.cpp \
../source/RtfSection.cpp \
......
......@@ -723,6 +723,10 @@
RelativePath="..\source\RtfOle.h"
>
</File>
<File
RelativePath="..\source\RtfParagraph .cpp"
>
</File>
<File
RelativePath="..\source\RtfParagraph.h"
>
......
......@@ -50,40 +50,76 @@ bool OOXMathReader::ParseElement(ReaderParameter oParam , OOX::WritingElement *
switch(ooxTypeElement)
{
case OOX::et_w_ins:
case OOX::et_w_del:
{
RtfCharProperty oCurrentProp = m_oCharProperty; //save to cash
OOX::Logic::CMIns * pIns = dynamic_cast<OOX::Logic::CMIns*>(ooxMath);
OOX::Logic::CMDel * pDel = dynamic_cast<OOX::Logic::CMDel*>(ooxMath);
if (pIns)
{
m_oCharProperty.m_nRevised = 1;
if (pIns->m_sAuthor.IsInit())
m_oCharProperty.m_nRevauth = oParam.oRtf->m_oRevisionTable.AddAuthor( pIns->m_sAuthor.get2() ) + 1;
if (pIns->m_oDate.IsInit())
m_oCharProperty.m_nRevdttm = RtfUtility::convertDateTime( string2std_string(pIns->m_oDate->GetValue()));
ParseElement( oParam, pIns->m_oRun.GetPointer(), rtfMath);
}
if (pDel)
{
m_oCharProperty.m_nDeleted = 1;
if (pDel->m_sAuthor.IsInit())
m_oCharProperty.m_nRevauthDel = oParam.oRtf->m_oRevisionTable.AddAuthor( pDel->m_sAuthor.get2() ) + 1;
if (pDel->m_oDate.IsInit())
m_oCharProperty.m_nRevdttmDel = RtfUtility::convertDateTime( string2std_string(pDel->m_oDate->GetValue()));
ParseElement( oParam, pDel->m_oRun.GetPointer(), rtfMath);
}
m_oCharProperty = oCurrentProp;
}break;
case OOX::et_m_r:
{
RtfCharProperty oCurrentProp;
oCurrentProp.SetDefaultOOX();
RtfCharProperty oCurrentProp = m_oCharProperty; //save to cash
OOX::Logic::CMRun *ooxRunMath = dynamic_cast<OOX::Logic::CMRun *>(ooxMath);
OOX::Logic::CRunProperty *ooxRPr = dynamic_cast<OOX::Logic::CRunProperty *>(ooxRunMath->m_oRPr.GetPointer());
OOXrPrReader orPrReader(ooxRPr);
orPrReader.Parse( oParam, oCurrentProp );
orPrReader.Parse( oParam, m_oCharProperty);
oCurrentProp = RtfCharProperty();
oCurrentProp.SetDefaultOOX();
orPrReader.Parse( oParam, oCurrentProp );
//-----------------------------------------------------------------------------------
OOX::Logic::CMText *ooxTextMath = dynamic_cast<OOX::Logic::CMText *>(ooxRunMath->m_oMText.GetPointer());
if (ooxTextMath)
{
RtfCharPtr oChar = RtfCharPtr(new RtfChar);
RtfCharPtr oChar(new RtfChar);
oChar->m_oProperty = oCurrentProp;
oChar->m_oProperty = m_oCharProperty;
oChar->setText( ooxTextMath->m_sText );
rtfMath->m_oVal.AddItem( oChar );
}
else
{
bool res = false;
if (!res) res = ParseElement(oParam, ooxRunMath->m_oIns.GetPointer(), rtfMath);
if (!res) res = ParseElement(oParam, ooxRunMath->m_oDel.GetPointer(), rtfMath);
}
m_oCharProperty = oCurrentProp;
}break;
case OOX::et_m_t:
{//??? не нужно ващето ...
{
OOX::Logic::CMText *ooxTextMath = dynamic_cast<OOX::Logic::CMText *>(ooxMath);
if (ooxTextMath)
{
RtfCharPtr oChar = RtfCharPtr(new RtfChar);
RtfCharPtr oChar(new RtfChar);
oChar->m_oProperty = m_oCharProperty;
oChar->setText( ooxTextMath->m_sText );
rtfMath->m_oVal.AddItem( oChar );
}
......
......@@ -43,9 +43,12 @@ private:
OOX::WritingElementWithChilds<OOX::WritingElement> *m_ooxElem;
public:
RtfCharProperty m_oCharProperty;
OOXMathReader(OOX::WritingElementWithChilds<OOX::WritingElement>* ooxElem)
{
m_ooxElem = ooxElem;
m_oCharProperty.SetDefault();
}
bool ParseElement(ReaderParameter oParam , OOX::WritingElement * ooxMath, RtfMathPtr & rtfMath);
......
......@@ -40,15 +40,17 @@
class OOXParagraphReader
{
private:
//OOXRunReader m_oRunReader; //????
OOX::Logic::CParagraph *m_ooxParagraph;
OOX::WritingElementWithChilds<OOX::WritingElement> *m_ooxElement;
public:
RtfCharProperty m_oCharProperty;
OOXParagraphReader (OOX::Logic::CParagraph *ooxParagraph)
{
m_ooxElement = NULL;
m_ooxParagraph = ooxParagraph;
m_oCharProperty.SetDefault();
}
OOXParagraphReader (OOX::WritingElementWithChilds<OOX::WritingElement> *ooxElement)
{
......
......@@ -44,11 +44,14 @@
class OOXRunReader
{
private:
OOX::Logic::CRun *m_ooxRun;
OOX::Logic::CRun* m_ooxRun;
public:
RtfCharProperty m_oCharProperty;
OOXRunReader(OOX::Logic::CRun *ooxRun)
{
m_ooxRun = ooxRun;
m_oCharProperty.SetDefault();
}
bool Parse( ReaderParameter oParam , RtfParagraph& oOutputParagraph, RtfStylePtr poStyle );
......
......@@ -33,6 +33,91 @@
#include "OOXTableRowReader.h"
#include "OOXTableReader.h"
bool OOXtrPrReader::Parse( ReaderParameter oParam , RtfRowProperty& oOutputProperty, CcnfStyle& oConditionalTableStyle)
{
if (m_ooxTableRowProps == NULL) return false;
//ищем cnfStyle и применяем внешний стиль
if( NULL != oParam.poTableStyle )
{
if( m_ooxTableRowProps->m_oCnfStyle.IsInit() )
{
CcnfStyle ocnfStyle;
OOXcnfStyleReader ocnfStyleReader(m_ooxTableRowProps->m_oCnfStyle.GetPointer());
ocnfStyleReader.Parse( oParam, ocnfStyle );
oConditionalTableStyle.Merge( ocnfStyle );
}
}
RtfTableStylePtr oResultStyle = oConditionalTableStyle.ApplyTableStyle( oParam.poTableStyle );
if( NULL != oResultStyle )
oOutputProperty.Merge( oResultStyle->m_oRowProp );
if (m_ooxTableRowProps->m_oTblHeader.IsInit() )
oOutputProperty.m_bIsHeader = m_ooxTableRowProps->m_oTblHeader->m_oVal.ToBool() ? 1 : 0;
//todooo непонятнка
// if (m_ooxTableRowProps->m_oCantSplit.IsInit() )
// oOutputProperty.m_bIsHeader= m_ooxTableRowProps->m_oCantSplit->m_oVal.ToBool() ? 1 : 0;
if (m_ooxTableRowProps->m_oJc.IsInit() && m_ooxTableRowProps->m_oJc->m_oVal.IsInit())
{
switch(m_ooxTableRowProps->m_oJc->m_oVal->GetValue())
{
case SimpleTypes::jctableCenter : oOutputProperty.m_eJust = RtfRowProperty::rj_trqc; break;
case SimpleTypes::jctableEnd : oOutputProperty.m_eJust = RtfRowProperty::rj_trqr; break;
case SimpleTypes::jctableStart : oOutputProperty.m_eJust = RtfRowProperty::rj_trql; break;
case SimpleTypes::jctableLeft : oOutputProperty.m_eJust = RtfRowProperty::rj_trql; break;
case SimpleTypes::jctableRight : oOutputProperty.m_eJust = RtfRowProperty::rj_trqr; break;
}
}
if( m_ooxTableRowProps->m_oTblHeight.IsInit() && m_ooxTableRowProps->m_oTblHeight->m_oVal.IsInit())
{
oOutputProperty.m_nHeight = m_ooxTableRowProps->m_oTblHeight->m_oVal->ToTwips();
if (m_ooxTableRowProps->m_oTblHeight->m_oHRule.IsInit() && m_ooxTableRowProps->m_oTblHeight->m_oHRule->GetValue() == SimpleTypes::heightruleExact)
oOutputProperty.m_nHeight = -oOutputProperty.m_nHeight;
}
if( m_ooxTableRowProps->m_oWBefore.IsInit() && m_ooxTableRowProps->m_oWBefore->m_oW.IsInit())
{
oOutputProperty.m_nWidthStartInvCell = m_ooxTableRowProps->m_oWBefore->m_oW->GetValue();
oOutputProperty.m_eMUStartInvCell = _MetricUnits::mu_Twips;
}
if( m_ooxTableRowProps->m_oWAfter.IsInit() && m_ooxTableRowProps->m_oWAfter->m_oW.IsInit())
{
oOutputProperty.m_nWidthEndInvCell = m_ooxTableRowProps->m_oWAfter->m_oW->GetValue();
oOutputProperty.m_eMUEndInvCell = _MetricUnits::mu_Twips;
}
if( m_ooxTableRowProps->m_oGridBefore.IsInit() && m_ooxTableRowProps->m_oGridBefore->m_oVal.IsInit())
oOutputProperty.m_nGridBefore = m_ooxTableRowProps->m_oGridBefore->m_oVal->GetValue();
if( m_ooxTableRowProps->m_oGridAfter.IsInit() && m_ooxTableRowProps->m_oGridAfter->m_oVal.IsInit())
oOutputProperty.m_nGridAfter = m_ooxTableRowProps->m_oGridAfter->m_oVal->GetValue();
if (m_ooxTableRowProps->m_oTrPrChange.IsInit())
{
if (m_ooxTableRowProps->m_oTrPrChange->m_sAuthor.IsInit())
oOutputProperty.m_nTrAuth = oParam.oRtf->m_oRevisionTable.AddAuthor( m_ooxTableRowProps->m_oTrPrChange->m_sAuthor.get2() ) + 1;
if (m_ooxTableRowProps->m_oTrPrChange->m_oDate.IsInit())
oOutputProperty.m_nTrDate = RtfUtility::convertDateTime( string2std_string(m_ooxTableRowProps->m_oTrPrChange->m_oDate->GetValue()));
RtfRowPropertyPtr props ( new RtfRowProperty() );
OOXtrPrReader oTrReader(m_ooxTableRowProps->m_oTrPrChange->m_pTrPr.GetPointer());
CcnfStyle style;
if (oTrReader.Parse( oParam, *props.get(), style))
{
oOutputProperty.m_pOldRowProperty = props;
}
}
return true;
}
bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
{
if (m_ooxTable == NULL) return false;
......
......@@ -46,70 +46,5 @@ public:
m_ooxTableRowProps = ooxTableRowProps;
}
bool Parse( ReaderParameter oParam , RtfRowProperty& oOutputProperty, CcnfStyle& oConditionalTableStyle)
{
if (m_ooxTableRowProps == NULL) return false;
//ищем cnfStyle и применяем внешний стиль
if( NULL != oParam.poTableStyle )
{
if( m_ooxTableRowProps->m_oCnfStyle.IsInit() )
{
CcnfStyle ocnfStyle;
OOXcnfStyleReader ocnfStyleReader(m_ooxTableRowProps->m_oCnfStyle.GetPointer());
ocnfStyleReader.Parse( oParam, ocnfStyle );
oConditionalTableStyle.Merge( ocnfStyle );
}
}
RtfTableStylePtr oResultStyle = oConditionalTableStyle.ApplyTableStyle( oParam.poTableStyle );
if( NULL != oResultStyle )
oOutputProperty.Merge( oResultStyle->m_oRowProp );
if (m_ooxTableRowProps->m_oTblHeader.IsInit() )
oOutputProperty.m_bIsHeader = m_ooxTableRowProps->m_oTblHeader->m_oVal.ToBool() ? 1 : 0;
//todooo непонятнка
// if (m_ooxTableRowProps->m_oCantSplit.IsInit() )
// oOutputProperty.m_bIsHeader= m_ooxTableRowProps->m_oCantSplit->m_oVal.ToBool() ? 1 : 0;
if (m_ooxTableRowProps->m_oJc.IsInit() && m_ooxTableRowProps->m_oJc->m_oVal.IsInit())
{
switch(m_ooxTableRowProps->m_oJc->m_oVal->GetValue())
{
case SimpleTypes::jctableCenter : oOutputProperty.m_eJust = RtfRowProperty::rj_trqc; break;
case SimpleTypes::jctableEnd : oOutputProperty.m_eJust = RtfRowProperty::rj_trqr; break;
case SimpleTypes::jctableStart : oOutputProperty.m_eJust = RtfRowProperty::rj_trql; break;
case SimpleTypes::jctableLeft : oOutputProperty.m_eJust = RtfRowProperty::rj_trql; break;
case SimpleTypes::jctableRight : oOutputProperty.m_eJust = RtfRowProperty::rj_trqr; break;
}
}
if( m_ooxTableRowProps->m_oTblHeight.IsInit() && m_ooxTableRowProps->m_oTblHeight->m_oVal.IsInit())
{
oOutputProperty.m_nHeight = m_ooxTableRowProps->m_oTblHeight->m_oVal->ToTwips();
if (m_ooxTableRowProps->m_oTblHeight->m_oHRule.IsInit() && m_ooxTableRowProps->m_oTblHeight->m_oHRule->GetValue() == SimpleTypes::heightruleExact)
oOutputProperty.m_nHeight = -oOutputProperty.m_nHeight;
}
if( m_ooxTableRowProps->m_oWBefore.IsInit() && m_ooxTableRowProps->m_oWBefore->m_oW.IsInit())
{
oOutputProperty.m_nWidthStartInvCell = m_ooxTableRowProps->m_oWBefore->m_oW->GetValue();
oOutputProperty.m_eMUStartInvCell = _MetricUnits::mu_Twips;
}
if( m_ooxTableRowProps->m_oWAfter.IsInit() && m_ooxTableRowProps->m_oWAfter->m_oW.IsInit())
{
oOutputProperty.m_nWidthEndInvCell = m_ooxTableRowProps->m_oWAfter->m_oW->GetValue();
oOutputProperty.m_eMUEndInvCell = _MetricUnits::mu_Twips;
}
if( m_ooxTableRowProps->m_oGridBefore.IsInit() && m_ooxTableRowProps->m_oGridBefore->m_oVal.IsInit())
oOutputProperty.m_nGridBefore = m_ooxTableRowProps->m_oGridBefore->m_oVal->GetValue();
if( m_ooxTableRowProps->m_oGridAfter.IsInit() && m_ooxTableRowProps->m_oGridAfter->m_oVal.IsInit())
oOutputProperty.m_nGridAfter = m_ooxTableRowProps->m_oGridAfter->m_oVal->GetValue();
return true;
}
bool Parse( ReaderParameter oParam , RtfRowProperty& oOutputProperty, CcnfStyle& oConditionalTableStyle);
};
......@@ -41,22 +41,22 @@ CString RtfBookmarkStart::RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
sResult += _T("{\\*\\bkmkstart");
sResult += L"{\\*\\bkmkstart";
if( PROP_DEF != nFirstColumn )
sResult.AppendFormat(_T("\\bkmkcolf%d"), nFirstColumn);
sResult.AppendFormat(L"\\bkmkcolf%d", nFirstColumn);
if( PROP_DEF != nLastColumn )
sResult.AppendFormat(_T("\\bkmkcoll%d"), nLastColumn);
sResult.AppendFormat(L"\\bkmkcoll%d", nLastColumn);
sResult += _T(" ");
sResult += L" ";
sResult += RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument, NULL );
sResult += _T("}");
sResult += L"}";
return sResult;
}
CString RtfBookmarkStart::RenderToOOX(RenderParameter oRenderParameter)
{
CString sResult;
//ATLASSERT( false == m_sName.IsEmpty() );
sResult += _T("<w:bookmarkStart");
sResult += L"<w:bookmarkStart";
OOXWriter * poOOXWriter = static_cast<OOXWriter*> ( oRenderParameter.poWriter );
RtfDocument * poDocument = static_cast<RtfDocument*> (oRenderParameter.poDocument);
......@@ -71,23 +71,23 @@ CString RtfBookmarkStart::RenderToOOX(RenderParameter oRenderParameter)
nID = poDocument->m_oIdGenerator.Generate_BookmarkNumber();
poOOXWriter->m_aBookmarksId[m_sName] = nID;
}
sResult.AppendFormat(_T(" w:id =\"%d\""), nID);
sResult.AppendFormat(L" w:id =\"%d\"", nID);
if( PROP_DEF != nFirstColumn )
sResult.AppendFormat(_T(" w:colFirst =\"%d\""), nID);
sResult.AppendFormat(L" w:colFirst =\"%d\"", nID);
if( PROP_DEF != nLastColumn )
sResult.AppendFormat(_T(" w:colLast =\"%d\""), nID);
sResult += _T(" w:name =\"") + Utils::PrepareToXML( m_sName ) + _T("\"");
sResult += _T("/>");
sResult.AppendFormat(L" w:colLast =\"%d\"", nID);
sResult += L" w:name =\"" + Utils::PrepareToXML( m_sName ) + L"\"";
sResult += L"/>";
return sResult;
}
CString RtfBookmarkEnd::RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
sResult += _T("{\\*\\bkmkend");
sResult += _T(" ");
sResult += L"{\\*\\bkmkend";
sResult += L" ";
sResult += RtfChar::renderRtfText( m_sName, oRenderParameter.poDocument, NULL );
sResult += _T("}");
sResult += L"}";
return sResult;
}
......@@ -95,7 +95,7 @@ CString RtfBookmarkEnd::RenderToOOX(RenderParameter oRenderParameter)
{
CString sResult;
sResult += _T("<w:bookmarkEnd");
sResult += L"<w:bookmarkEnd";
OOXWriter* poOOXWriter = static_cast<OOXWriter*>( oRenderParameter.poWriter );
RtfDocument* poDocument = static_cast<RtfDocument*>(oRenderParameter.poDocument);
......@@ -109,27 +109,27 @@ CString RtfBookmarkEnd::RenderToOOX(RenderParameter oRenderParameter)
nID = poDocument->m_oIdGenerator.Generate_BookmarkNumber();
poOOXWriter->m_aBookmarksId[m_sName] = nID;
}
sResult.AppendFormat(_T(" w:id =\"%d\""), nID);
sResult += _T("/>");
sResult.AppendFormat(L" w:id =\"%d\"", nID);
sResult += L"/>";
return sResult;
}
CString RtfFootnote::RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
sResult += _T("{");
sResult += L"{";
sResult += m_oCharProp.RenderToRtf( oRenderParameter );
sResult += _T("\\chftn");
sResult += _T("{\\footnote");
sResult += L"\\chftn";
sResult += L"{\\footnote";
if( true == m_bEndNote )
sResult += _T("\\ftnalt");
sResult += L"\\ftnalt";
for( int i = 0; i < m_oContent->GetCount(); i++ )
sResult += m_oContent->RenderToRtf( oRenderParameter );
sResult += _T("}");
sResult += _T("}");
sResult += L"}";
sResult += L"}";
return sResult;
}
......@@ -145,19 +145,19 @@ CString RtfFootnote::RenderToOOX(RenderParameter oRenderParameter)
RenderParameter oNewParameter = oRenderParameter;
oNewParameter.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
oNewParameter.poRels = poEndnoteWriter->m_oRelsWriter.get();
poEndnoteWriter->AddEndnote( _T(""), nID, m_oContent->RenderToOOX(oNewParameter) );
poEndnoteWriter->AddEndnote( L"", nID, m_oContent->RenderToOOX(oNewParameter) );
sResult += _T("<w:r>");
sResult += L"<w:r>";
CString srPr = m_oCharProp.RenderToOOX( oRenderParameter );
if( false == srPr.IsEmpty() )
{
sResult += _T("<w:rPr>");
sResult += L"<w:rPr>";
sResult += srPr;
sResult += _T("</w:rPr>");
sResult += L"</w:rPr>";
}
sResult.AppendFormat( _T("<w:endnoteReference w:id=\"%d\"/>"), nID );
sResult += _T("</w:r>");
sResult.AppendFormat( L"<w:endnoteReference w:id=\"%d\"/>", nID );
sResult += L"</w:r>";
}
else
{
......@@ -168,19 +168,19 @@ CString RtfFootnote::RenderToOOX(RenderParameter oRenderParameter)
oNewParameter.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
oNewParameter.poRels = poFootnoteWriter->m_oRelsWriter.get();
poFootnoteWriter->AddFootnote( _T(""), nID, m_oContent->RenderToOOX(oNewParameter) );
poFootnoteWriter->AddFootnote( L"", nID, m_oContent->RenderToOOX(oNewParameter) );
sResult += _T("<w:r>");
sResult += L"<w:r>";
CString srPr = m_oCharProp.RenderToOOX( oRenderParameter );
if( false == srPr.IsEmpty() )
{
sResult += _T("<w:rPr>");
sResult += L"<w:rPr>";
sResult += srPr;
sResult += _T("</w:rPr>");
sResult += L"</w:rPr>";
}
sResult.AppendFormat( _T("<w:footnoteReference w:id=\"%d\"/>"), nID );
sResult += _T("</w:r>");
sResult.AppendFormat( L"<w:footnoteReference w:id=\"%d\"/>", nID );
sResult += L"</w:r>";
}
return sResult;
......
......@@ -53,47 +53,47 @@ CString RtfOldList::RenderToOOX(RenderParameter oRenderParameter)
oNewParameter.nType = RENDER_TO_OOX_PARAM_PLAIN;
CString sText = m_oLevelText->RenderToOOX( oNewParameter );
sResult.AppendFormat( _T("<w:abstractNum w:abstractNumId=\"%d\">"), m_nLs );
sResult += _T("<w:multiLevelType w:val=\"singleLevel\" />");
sResult += _T("<w:lvl w:ilvl=\"0\">");
sResult += _T("<w:numFmt w:val=\"bullet\"/>");
sResult.AppendFormat( L"<w:abstractNum w:abstractNumId=\"%d\">", m_nLs );
sResult += L"<w:multiLevelType w:val=\"singleLevel\" />";
sResult += L"<w:lvl w:ilvl=\"0\">";
sResult += L"<w:numFmt w:val=\"bullet\"/>";
if(!sText.IsEmpty() )
sResult += _T("<w:lvlText w:val=\"") + Utils::PrepareToXML( sText ) + _T("\"/>");
sResult += L"<w:lvlText w:val=\"" + Utils::PrepareToXML( sText ) + L"\"/>";
else
{
sResult += _T("<w:lvlText w:val=\"");
sResult += L"<w:lvlText w:val=\"";
sResult.AppendChar( 0xf0b7 );
sResult += _T("\"/>");
sResult += L"\"/>";
}
if( !sParProp.IsEmpty() )
sResult += _T("<w:pPr>") + sParProp + _T("</w:pPr>");
sResult += L"<w:pPr>" + sParProp + L"</w:pPr>";
if( !sCharProp.IsEmpty() )
sResult += _T("<w:rPr>") + sCharProp + _T("</w:rPr>");
sResult += L"<w:rPr>" + sCharProp + L"</w:rPr>";
if( lj_none != m_eLevelJust )
{
switch( m_eLevelJust )
{
case lj_left: sResult += _T("<w:lvlJc w:val=\"left\"/>"); break;
case lj_center: sResult += _T("<w:lvlJc w:val=\"center\"/>"); break;
case lj_right: sResult += _T("<w:lvlJc w:val=\"right\"/>"); break;
case lj_left: sResult += L"<w:lvlJc w:val=\"left\"/>"; break;
case lj_center: sResult += L"<w:lvlJc w:val=\"center\"/>"; break;
case lj_right: sResult += L"<w:lvlJc w:val=\"right\"/>"; break;
}
}
else
sResult += _T("<w:lvlJc w:val=\"left\"/>");
sResult += L"<w:lvlJc w:val=\"left\"/>";
sResult += _T("</w:lvl>");
sResult += _T("</w:abstractNum>");
sResult += L"</w:lvl>";
sResult += L"</w:abstractNum>";
}
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(L"<w:num w:numId=\"%d\"><w:abstractNumId w:val=\"%d\"/></w:num>", m_nLs, m_nLs );
else
{
if( PROP_DEF != m_nLs && PROP_DEF != m_nIlvl )
sResult.AppendFormat(_T("<w:numPr><w:ilvl w:val=\"%d\"/><w:numId w:val=\"%d\"/></w:numPr>"), m_nIlvl, m_nLs );
sResult.AppendFormat(L"<w:numPr><w:ilvl w:val=\"%d\"/><w:numId w:val=\"%d\"/></w:numPr>", m_nIlvl, m_nLs );
}
}
return sResult;
......
......@@ -77,18 +77,18 @@ CString RtfOle::RenderToOOX(RenderParameter oRenderParameter)
pCharProps->m_nDeleted = PROP_DEF;
}
//----------
sResult += _T("<w:r>");
sResult += L"<w:r>";
CString sCharProp = pCharProps->RenderToOOX(oRenderParameter);
if (!sCharProp .IsEmpty())
{
sResult += _T("<w:rPr>");
sResult += L"<w:rPr>";
sResult += sCharProp;
sResult += _T("</w:rPr>");
sResult += L"</w:rPr>";
}
sResult.AppendFormat( _T("<w:object w:dxaOrig=\"%d\" w:dyaOrig=\"%d\">"), m_nWidth, m_nHeight );
sResult.AppendFormat( L"<w:object w:dxaOrig=\"%d\" w:dyaOrig=\"%d\">", m_nWidth, m_nHeight );
RenderParameter oNewRenderParameter = oRenderParameter;
oNewRenderParameter.nType = RENDER_TO_OOX_PARAM_SHAPE_WSHAPE2;
......@@ -98,8 +98,8 @@ CString RtfOle::RenderToOOX(RenderParameter oRenderParameter)
oNewRenderParameter.nValue = m_oResultPic->m_nID;
sResult += RenderToOOXOnlyOle(oNewRenderParameter);
sResult += _T("</w:object>");
sResult += _T("</w:r>");
sResult += L"</w:object>";
sResult += L"</w:r>";
if (bDelete)sResult += L"</w:del>";
if (bInsert)sResult += L"</w:ins>";
......@@ -114,71 +114,75 @@ CString RtfOle::RenderToOOXOnlyOle(RenderParameter oRenderParameter)
OOXRelsWriter * poRelsWriter = static_cast<OOXRelsWriter*> (oRenderParameter.poRels);
RtfDocument * poDocument = static_cast<RtfDocument*> (oRenderParameter.poDocument);
sResult += _T("<o:OLEObject");
sResult += L"<o:OLEObject";
switch ( m_eOleType )
{
case ot_link: sResult += _T(" Type=\"Link\""); break;
default: sResult += _T(" Type=\"Embed\""); break;
case ot_link: sResult += L" Type=\"Link\""; break;
default: sResult += L" Type=\"Embed\""; break;
}
sResult += _T(" ProgID=\"") + m_sOleClass + _T("\"");
sResult.AppendFormat( _T(" ShapeID=\"_x0000_s%d\""), poDocument->GetShapeId( oRenderParameter.nValue ) );
sResult += _T(" DrawAspect=\"Content\"");
sResult += _T(" ObjectID=\"") + poDocument->m_oIdGenerator.Generate_OleId() + _T("\"");
sResult += L" ProgID=\"" + m_sOleClass + L"\"";
sResult.AppendFormat( L" ShapeID=\"_x0000_s%d\"", poDocument->GetShapeId( oRenderParameter.nValue ) );
sResult += L" DrawAspect=\"Content\"";
sResult += L" ObjectID=\"" + poDocument->m_oIdGenerator.Generate_OleId() + L"\"";
CString sExtension = _T("bin");
CString sMime = _T("application/vnd.openxmlformats-officedocument.oleObject");
CString sExtension = L"bin";
CString sMime = L"application/vnd.openxmlformats-officedocument.oleObject";
CString sFilenameRels;
sFilenameRels.AppendFormat( _T("oleObject%d."), poDocument->m_oIdGenerator.Generate_OleIndex());
sFilenameRels.AppendFormat( L"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 + L"word" + FILE_SEPARATOR_STR + L"embeddings";
FileSystem::Directory::CreateDirectory( sFilenameFull );
sFilenameFull += FILE_SEPARATOR_STR + sFilenameRels;
sFilenameRels = _T("embeddings/") + sFilenameRels;
sFilenameRels = L"embeddings/" + sFilenameRels;
Utils::CopyDirOrFile( m_sOleFilename, sFilenameFull );
poOOXWriter->m_oContentTypes.AddExtension( sMime, sExtension);
CString srId = poRelsWriter->AddRelationship( _T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"), sFilenameRels);
sResult += _T(" r:id=\"") + srId + _T("\"");
sResult += _T("/>");
CString srId = poRelsWriter->AddRelationship( L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject", sFilenameRels);
sResult += L" r:id=\"" + srId + L"\"";
sResult += L"/>";
return sResult;
}
CString RtfOle::RenderToRtf(RenderParameter oRenderParameter)
{
if( !IsValid() ) return _T("");
if( !IsValid() ) return L"";
CString sResult = _T("{\\object");
CString sResult;
sResult += m_oCharProperty.RenderToRtf( oRenderParameter );
sResult += L"{\\object";
if( PROP_DEF != m_eOleType )
{
switch( m_eOleType )
{
case ot_emb: sResult += _T("\\objemb"); break;
case ot_link: sResult += _T("\\objlink"); break;
case ot_emb: sResult += L"\\objemb"; break;
case ot_link: sResult += L"\\objlink"; break;
}
}
RENDER_RTF_INT( m_nWidth, sResult, _T("objw") );
RENDER_RTF_INT( m_nHeight, sResult, _T("objh") );
RENDER_RTF_INT( m_nWidth, sResult, L"objw" );
RENDER_RTF_INT( m_nHeight, sResult, L"objh" );
if( !m_sOleClass.IsEmpty() )
sResult += _T("{\\*\\objclass ") + m_sOleClass + _T("}");
sResult += L"{\\*\\objclass " + m_sOleClass + L"}";
if( !m_sOleFilename.IsEmpty() )
{
CString str = RtfUtility::RtfInternalEncoder::Encode( m_sOleFilename );
sResult += _T("{\\*\\objdata ") + str + _T("}");
sResult += L"{\\*\\objdata " + str + L"}";
}
if( NULL != m_oResultPic )
{
CString str = m_oResultPic->RenderToRtf( oRenderParameter );
sResult += _T("{\\result \\pard\\plain") + str + _T("}");
sResult += L"{\\result \\pard\\plain" + str + L"}";
}
sResult += _T("}");
sResult += L"}";
return sResult;
}
......
......@@ -61,7 +61,7 @@ public:
}
bool IsValid()
{
return PROP_DEF != m_nWidth && PROP_DEF != m_nHeight && _T("") != m_sOleFilename;
return PROP_DEF != m_nWidth && PROP_DEF != m_nHeight && L"" != m_sOleFilename;
/*&& ::GetFileAttributes( m_sOleFilename ) != DWORD( -1 )*/
}
CString RenderToRtf(RenderParameter oRenderParameter);
......@@ -86,7 +86,7 @@ public:
RELEASEOBJECT( m_piStorage );
Utils::RemoveDirOrFile( m_sOleFilename );
m_sOleFilename = _T("");
m_sOleFilename = L"";
m_oCharProperty.SetDefault();
}
......
......@@ -32,8 +32,6 @@
#pragma once
#include "Basic.h"
#include "RtfChar.h"
#include "RtfWriter.h"
class RtfParagraph;
typedef boost::shared_ptr<RtfParagraph> RtfParagraphPtr;
......@@ -84,152 +82,7 @@ public:
RtfParagraph()
{
}
int AddItem( IDocumentElementPtr piRend )
{
if( TYPE_RTF_CHAR == piRend->GetType() )
{
if( m_aArray.size() > 0 && TYPE_RTF_CHAR == m_aArray[ m_aArray.size() - 1 ]->GetType() )//соединяем два текста с одинаковыми свойствами
{
RtfCharPtr oCurChar = boost::static_pointer_cast<RtfChar,IDocumentElement>( piRend );
RtfCharPtr oPrevChar = boost::static_pointer_cast<RtfChar,IDocumentElement>( m_aArray[ m_aArray.size() - 1 ] );
if( oCurChar->m_oProperty == oPrevChar->m_oProperty )
{
oPrevChar->AddText( oCurChar->GetText() );
return (int)m_aArray.size() - 1;
}
}
}
ItemContainer< IDocumentElementPtr >::AddItem( piRend );
return (int)m_aArray.size() - 1;
}
CString RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult ;
if( RENDER_TO_RTF_PARAM_CHAR == oRenderParameter.nType )
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
sResult += m_aArray[i]->RenderToRtf( oRenderParameter );
}
}
else
{
sResult += _T("\\pard\\plain");
sResult += m_oProperty.RenderToRtf( oRenderParameter ) ;
if( NULL != m_oOldList )
sResult += m_oOldList->RenderToRtf( oRenderParameter ) ;
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
sResult += m_aArray[i]->RenderToRtf( oRenderParameter );
}
sResult += m_oProperty.m_oCharProperty.RenderToRtf( oRenderParameter );
//if( RENDER_TO_RTF_PARAM_NO_PAR != oRenderParameter.nValue )
// sResult += T("\\par");
}
return sResult;
}
CString RenderToOOX(RenderParameter oRenderParameter)
{
CString sResult ;
if( RENDER_TO_OOX_PARAM_PLAIN == oRenderParameter.nType )
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
sResult += m_aArray[i]->RenderToOOX(oRenderParameter);
}
}
else if( RENDER_TO_OOX_PARAM_RUN == oRenderParameter.nType )
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
sResult += m_aArray[i]->RenderToOOX(oRenderParameter);
}
}
else if( RENDER_TO_OOX_PARAM_MATH == oRenderParameter.nType )
{
if (m_aArray.size() < 1)
{
sResult += _T("<w:rPr>");
sResult += m_oProperty.m_oCharProperty.RenderToOOX(oRenderParameter);
sResult += _T("</w:rPr>");
}
else
{
for( int i = 0; i < (int)m_aArray.size(); i++ )
{
sResult += m_aArray[i]->RenderToOOX(oRenderParameter);
}
}
}
else
{
RenderParameter oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_RUN;
bool bCanConvertToNumbering = false;
if( NULL != m_oOldList )
bCanConvertToNumbering = m_oOldList->CanConvertToNumbering();
sResult += _T("<w:p>");
sResult += _T("<w:pPr>");
m_oProperty.m_bOldList = (NULL != m_oOldList);
sResult += m_oProperty.RenderToOOX(oRenderParameter);
if( NULL != m_oOldList )
{
//для OldList
if( true == bCanConvertToNumbering )
sResult += m_oOldList->RenderToOOX( oRenderParameter );
}
sResult += _T("</w:pPr>");
if( NULL != m_oOldList )
{
//для OldList
if( false == bCanConvertToNumbering && NULL != m_oOldList->m_oText)
{
RtfCharProperty oCharProp = m_oProperty.m_oCharProperty;
if( NULL != m_oOldList->m_oText )
oCharProp.m_nFont = m_oOldList->m_oText->m_oProperty.m_oCharProperty.m_nFont;
oNewParam = oRenderParameter;
oNewParam.nType = RENDER_TO_OOX_PARAM_TEXT;
for( int i = 0; i < m_oOldList->m_oText->GetCount(); i++ )
{
sResult += _T("<w:r>");
sResult += _T("<w:rPr>");
sResult += oCharProp.RenderToOOX(oRenderParameter);
sResult += _T("</w:rPr>");
sResult += m_oOldList->m_oText->m_aArray[ i ]->RenderToOOX(oNewParam);
sResult += _T("</w:r>");
}
}
}
oNewParam.nType = RENDER_TO_OOX_PARAM_RUN;
CString ParagraphContent;
for( int i = 0; i < m_aArray.size(); i++)
{
ParagraphContent += m_aArray[i]->RenderToOOX(oNewParam);
}
if (!ParagraphContent.IsEmpty())
sResult += ParagraphContent;
sResult += _T("</w:p>");
}
return sResult;
}
int AddItem( IDocumentElementPtr piRend );
CString RenderToRtf(RenderParameter oRenderParameter);
CString RenderToOOX(RenderParameter oRenderParameter);
};
......@@ -31,6 +31,7 @@
*/
#include "RtfPicture.h"
#include "Writer/OOXWriter.h"
#include "RtfWriter.h"
#include "Utils.h"
CString RtfPicture::GenerateWMF(RenderParameter oRenderParameter)
......
......@@ -638,13 +638,15 @@ CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_INT( m_nDown, sResult, L"dn" )
RENDER_RTF_BOOL( m_bEmbo, sResult, L"embo" )
RENDER_RTF_INT( m_nCharacterSpacing, sResult, L"expndtw" )
if( PROP_DEF != m_nCharacterSpacing )
sResult.AppendFormat( L"\\expnd%d", m_nCharacterSpacing / 5 );
if( PROP_DEF != m_nFitText )
sResult.AppendFormat( L"\\fittext%d", m_nFitText / 5 );
RENDER_RTF_INT( m_nFont, sResult, L"f" )
//RENDER_RTF_INT( m_nFont2, sResult, L"fittext" )
//RENDER_RTF_INT( m_nFont3, sResult, L"fittext" )
RENDER_RTF_INT( m_nFont, sResult, L"f" )
//RENDER_RTF_INT( m_nFont2, sResult, L"fittext" )
//RENDER_RTF_INT( m_nFont3, sResult, L"fittext" )
RENDER_RTF_INT( m_nFontSize, sResult, L"fs" )
RENDER_RTF_BOOL( m_bItalic, sResult, L"i" )
RENDER_RTF_BOOL( m_bImprint, sResult, L"impr" )
......@@ -659,16 +661,16 @@ CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter)
if( PROP_DEF != m_nComplexScript )
sResult.AppendFormat(L"\\fcs%d", m_nComplexScript);
RENDER_RTF_BOOL( m_bOutline , sResult, L"outl" )
RENDER_RTF_BOOL( m_bScaps , sResult, L"scaps" )
RENDER_RTF_BOOL( m_bShadow , sResult, L"shad" )
RENDER_RTF_BOOL( m_bStrike , sResult, L"strike" )
RENDER_RTF_INT( m_nStriked , sResult, L"striked" )
RENDER_RTF_BOOL( m_bSub , sResult, L"sub" )
RENDER_RTF_BOOL( m_bSuper , sResult, L"super" )
RENDER_RTF_INT( m_bHidden , sResult, L"v" )
RENDER_RTF_INT( m_nHightlited, sResult, L"highlight" )
RENDER_RTF_INT( m_nForeColor, sResult, L"cf" )
RENDER_RTF_BOOL ( m_bOutline, sResult, L"outl" )
RENDER_RTF_BOOL ( m_bScaps , sResult, L"scaps" )
RENDER_RTF_BOOL ( m_bShadow , sResult, L"shad" )
RENDER_RTF_BOOL ( m_bStrike , sResult, L"strike" )
RENDER_RTF_INT ( m_nStriked, sResult, L"striked" )
RENDER_RTF_BOOL ( m_bSub , sResult, L"sub" )
RENDER_RTF_BOOL ( m_bSuper , sResult, L"super" )
RENDER_RTF_INT ( m_bHidden , sResult, L"v" )
RENDER_RTF_INT ( m_nHightlited, sResult, L"highlight" )
RENDER_RTF_INT ( m_nForeColor, sResult, L"cf" )
switch( m_eUnderStyle )
{
......@@ -702,20 +704,26 @@ CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter)
if( m_poShading.IsValid() == true )
sResult += m_poShading.RenderToRtf( oRenderParameter );
RENDER_RTF_INT( m_nCrAuth, sResult, L"crauth" )
RENDER_RTF_INT( m_nCrDate, sResult, L"crdate" )
if ( m_nRevised != PROP_DEF) sResult += L"\\revised";
RENDER_RTF_INT( m_nRevauth, sResult, L"revauth" )
RENDER_RTF_INT( m_nRevdttm, sResult, L"revdttm" )
if ( m_nDeleted != PROP_DEF) sResult += L"\\deleted";
RENDER_RTF_INT( m_nRevauthDel, sResult, L"revauthdel" )
RENDER_RTF_INT( m_nRevdttmDel, sResult, L"revdttmdel" )
if ( m_nDeleted != PROP_DEF)
{
sResult += L"\\deleted";
RENDER_RTF_INT( m_nRevauthDel, sResult, L"revauthdel" )
RENDER_RTF_INT( m_nRevdttmDel, sResult, L"revdttmdel" )
}
if ( m_nRevised != PROP_DEF)
{
sResult += L"\\revised";
RENDER_RTF_INT( m_nRevauth, sResult, L"revauth" )
RENDER_RTF_INT( m_nRevdttm, sResult, L"revdttm" )
}
if (m_pOldCharProp)
{
RENDER_RTF_INT( m_nCrAuth, sResult, L"crauth" )
RENDER_RTF_INT( m_nCrDate, sResult, L"crdate" )
sResult += "{\\*\\oldcprops";
sResult += m_pOldCharProp->RenderToRtf(oRenderParameter);
sResult += L"}";
......@@ -1948,11 +1956,14 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
}
}
}
RENDER_RTF_INT( m_nPrAuth, sResult, L"prauth" )
RENDER_RTF_INT( m_nPrDate, sResult, L"prdate" )
m_oCharProperty.RenderToRtf(oRenderParameter);
if (m_pOldParagraphProp)
{
RENDER_RTF_INT( m_nPrAuth, sResult, L"prauth" )
RENDER_RTF_INT( m_nPrDate, sResult, L"prdate" )
sResult += "{\\*\\oldpprops\\pard";
sResult += m_pOldParagraphProp->RenderToRtf(oRenderParameter);
sResult += L"}";
......@@ -2725,15 +2736,16 @@ CString RtfTableProperty::RenderToOOX(RenderParameter oRenderParameter)
CString RtfRowProperty::RenderToRtf(RenderParameter oRenderParameter)
{
CString sResult;
if( RENDER_TO_RTF_PARAM_NO_WROWD != oRenderParameter.nType )
sResult += L"\\trowd";
RENDER_RTF_INT( m_nIndex, sResult, L"irow" );
RENDER_RTF_INT( m_nBandIndex, sResult, L"irowband" );
RENDER_RTF_BOOL( m_bLastRow, sResult, L"lastrow" );
RENDER_RTF_INT( m_nAutoFit, sResult, L"trautofit" );
RENDER_RTF_BOOL( m_bIsHeader, sResult, L"trhdr" );
RENDER_RTF_BOOL( m_bKeep, sResult, L"trkeep" );
RENDER_RTF_INT ( m_nIndex, sResult, L"irow" );
RENDER_RTF_INT ( m_nBandIndex, sResult, L"irowband" );
RENDER_RTF_BOOL ( m_bLastRow, sResult, L"lastrow" );
RENDER_RTF_INT ( m_nAutoFit, sResult, L"trautofit" );
RENDER_RTF_BOOL ( m_bIsHeader, sResult, L"trhdr" );
RENDER_RTF_BOOL ( m_bKeep, sResult, L"trkeep" );
switch( m_eJust )
{
......@@ -2769,6 +2781,13 @@ CString RtfRowProperty::RenderToRtf(RenderParameter oRenderParameter)
for( int i = 0; i < (int)m_aArray.size(); i++ )
sResult += m_aArray[i].RenderToRtf( oRenderParameter );
if (m_pOldRowProperty)
{
sResult += "{\\*\\oldtprops";
sResult += m_pOldRowProperty->RenderToRtf(oRenderParameter);
sResult += L"}";
}
return sResult;
}
CString RtfRowProperty::RenderToOOX(RenderParameter oRenderParameter)
......
......@@ -511,6 +511,16 @@ CString RtfSectionProperty::RenderToRtf(RenderParameter oRenderParameter)
sResult += L"\\par";
sResult += L"}";
}
RENDER_RTF_INT( m_nSrAuth, sResult, L"srauth" )
RENDER_RTF_INT( m_nSrDate, sResult, L"srdate" )
if (m_pOldSectionProp)
{
sResult += "{\\*\\oldpprops\\pard";
sResult += m_pOldSectionProp->RenderToRtf(oRenderParameter);
sResult += L"}";
}
return sResult;
}
CString RtfSectionProperty::RenderToOOX(RenderParameter oRenderParameter)
......
......@@ -192,13 +192,15 @@ CString RtfShape::RenderToRtf(RenderParameter oRenderParameter)
int nRelRotate = m_nRelRotation;
if( PROP_DEF != m_nRotation && PROP_DEF != m_nLeft && PROP_DEF != m_nTop &&
PROP_DEF != m_nRight && PROP_DEF != m_nBottom )
PROP_DEF != m_nRight && PROP_DEF != m_nBottom )
ToRtfRotation( m_nRotation, m_nLeft, m_nTop, m_nRight, m_nBottom );
if( PROP_DEF != m_nRelRotation && PROP_DEF != m_nRelLeft && PROP_DEF != m_nRelTop &&
PROP_DEF != m_nRelRight && PROP_DEF != m_nRelBottom )
if( PROP_DEF != m_nRelRotation && PROP_DEF != m_nRelLeft && PROP_DEF != m_nRelTop &&
PROP_DEF != m_nRelRight && PROP_DEF != m_nRelBottom )
ToRtfRotation( m_nRelRotation, m_nRelLeft, m_nRelTop, m_nRelRight, m_nRelBottom );
sResult += m_oCharProperty.RenderToRtf( oRenderParameter );
if( st_inline == m_eAnchorTypeShape )
{
if( NULL != m_oPicture && m_nShapeType == NSOfficeDrawing::sptPictureFrame)
......@@ -299,16 +301,16 @@ CString RtfShape::RenderToRtf(RenderParameter oRenderParameter)
switch(m_eXAnchor)
{
case ax_page: sResult += L"\\shpbxpage"; break;
case ax_page: sResult += L"\\shpbxpage"; break;
case ax_margin: sResult += L"\\shpbxmargin"; break;
case ax_column: sResult += L"\\shpbxcolumn"; break;
}
sResult += L"\\shpbxignore";
switch(m_eYAnchor)
{
case ay_page: sResult += L"\\shpbypage"; break;
case ay_page: sResult += L"\\shpbypage"; break;
case ay_margin: sResult += L"\\shpbymargin"; break;
case ay_Para: sResult += L"\\shpbypara"; break;
case ay_Para: sResult += L"\\shpbypara"; break;
}
sResult += L"\\shpbyignore";
RENDER_RTF_INT( m_nZOrderRelative, sResult, L"shpfblwtxt");
......@@ -736,9 +738,9 @@ CString RtfShape::RenderToOOXBegin(RenderParameter oRenderParameter)
sResult += L"<w:r>";
if (!sCharProp .IsEmpty())
{
sResult += _T("<w:rPr>");
sResult += L"<w:rPr>";
sResult += sCharProp;
sResult += _T("</w:rPr>");
sResult += L"</w:rPr>";
}
sResult += L"<w:pict>";
}
......@@ -1362,6 +1364,8 @@ CString RtfShapeGroup::RenderToRtf(RenderParameter oRenderParameter)
PROP_DEF != m_nRelRight && PROP_DEF != m_nRelBottom )
ToRtfRotation( m_nRelRotation, m_nRelLeft, m_nRelTop, m_nRelRight, m_nRelBottom );
sResult += m_oCharProperty.RenderToRtf( oRenderParameter );
if( st_inline == m_eAnchorTypeShape )
{
sResult += L"{\\shpgrp";
......
......@@ -152,7 +152,7 @@ bool RtfWriter::SaveByItem()
&& !( m_oDocument[0].props->GetCount() == 0
&& m_oDocument.GetCount() > 1) )//для последнего параграфа секции не пишем \par
{
sRtf += _T("\\par");
sRtf += L"\\par";
//oNewParam.nValue = RENDER_TO_RTF_PARAM_NO_PAR;
}
RtfUtility::RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileWriter );
......@@ -279,56 +279,56 @@ CString RtfWriter::CreateRtfStart()
oRenderParameter.nType = RENDER_TO_RTF_PARAM_UNKNOWN;
CString sResult;
sResult += _T("{\\rtf1\\ulc1");
sResult += L"{\\rtf1\\ulc1";
sResult += m_oDocument.m_oProperty.RenderToRtf( oRenderParameter );
sResult += m_oDocument.m_oFontTable.RenderToRtf( oRenderParameter );
sResult += m_oDocument.m_oColorTable.RenderToRtf( oRenderParameter );
//---------- test
CString sDefCharProp = m_oDocument.m_oDefaultCharProp.RenderToRtf( oRenderParameter );
if( false == sDefCharProp.IsEmpty() )
sResult += _T("{\\*\\defchp ") + sDefCharProp + _T("}");
sResult += L"{\\*\\defchp " + sDefCharProp + L"}";
CString sDefParProp = m_oDocument.m_oDefaultParagraphProp.RenderToRtf( oRenderParameter );
if( false == sDefParProp.IsEmpty() )
sResult += _T("{\\*\\defpap ") + sDefParProp+ _T("}");
sResult += L"{\\*\\defpap " + sDefParProp+ L"}";
sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter );
//---------- test
sResult += m_oDocument.m_oListTable.RenderToRtf ( oRenderParameter );
sResult += m_oDocument.m_oListOverrideTable.RenderToRtf ( oRenderParameter );
sResult += m_oDocument.m_oRevisionTable.RenderToRtf ( oRenderParameter );
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
sResult += L"\\fet2";//0 Footnotes only or nothing at all (the default). 1 Endnotes only. 2 Both footnotes and endnotes
CString sFootnote;
if( NULL != m_oDocument.m_oFootnoteSep )
{
sFootnote = m_oDocument.m_oFootnoteSep->RenderToRtf( oRenderParameter );
if( !sFootnote.IsEmpty() )
sResult += _T("{\\*\\ftnsep ") + sFootnote + _T("}");
sResult += L"{\\*\\ftnsep " + sFootnote + L"}";
}
if( NULL != m_oDocument.m_oFootnoteCon )
{
sFootnote = m_oDocument.m_oFootnoteCon->RenderToRtf( oRenderParameter );
if( !sFootnote.IsEmpty() )
sResult += _T("{\\*\\ftnsepc ") + sFootnote + _T("}");
sResult += L"{\\*\\ftnsepc " + sFootnote + L"}";
}
if( NULL != m_oDocument.m_oEndnoteSep )
{
sFootnote = m_oDocument.m_oEndnoteSep->RenderToRtf( oRenderParameter );
if( !sFootnote.IsEmpty() )
sResult += _T("{\\*\\aftnsep ") + sFootnote + _T("}");
sResult += L"{\\*\\aftnsep " + sFootnote + L"}";
}
if( NULL != m_oDocument.m_oEndnoteCon )
{
sFootnote = m_oDocument.m_oEndnoteCon->RenderToRtf( oRenderParameter );
if( !sFootnote.IsEmpty() )
sResult += _T("{\\*\\aftnsepc ") + sFootnote + _T("}");
sResult += L"{\\*\\aftnsepc " + sFootnote + L"}";
}
sResult += _T("\n\n");
sResult += L"\n\n";
return sResult;
}
CString RtfWriter::CreateRtfEnd( )
{
return _T("\n}\n");
return L"\n}\n";
}
......@@ -80,8 +80,8 @@ OOXWriter::OOXWriter( RtfDocument& oDocument, std::wstring sPath ) :
}
if (m_poDocPropsCore)
{
((OOX::CCore*)m_poDocPropsCore)->SetCreator(_T(""));
((OOX::CCore*)m_poDocPropsCore)->SetLastModifiedBy(_T(""));
((OOX::CCore*)m_poDocPropsCore)->SetCreator(L"");
((OOX::CCore*)m_poDocPropsCore)->SetLastModifiedBy(L"");
}
}
OOXWriter::~OOXWriter()
......@@ -155,7 +155,7 @@ bool OOXWriter::SaveByItemEnd()
}
if (m_poDocPropsCore)
{
((OOX::CCore*)m_poDocPropsCore)->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), pathDocProps.GetDirectory(), oContentTypes);
((OOX::CCore*)m_poDocPropsCore)->write(pathDocProps + FILE_SEPARATOR_STR + L"core.xml", pathDocProps.GetDirectory(), oContentTypes);
m_oRels.AddRelationship( L"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties", L"docProps/core.xml" );
m_oContentTypes.AddContent( L"application/vnd.openxmlformats-package.core-properties+xml", L"/docProps/core.xml" );
......
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