Commit 6361ee6f authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatWriter - review

parent bf0b5a4b
...@@ -120,6 +120,8 @@ public: ...@@ -120,6 +120,8 @@ public:
} }
int Find( T piRend ) int Find( T piRend )
{ {
//todooo - add map for seach
for( int i = 0; i < (int)m_aArray.size(); i++ ) for( int i = 0; i < (int)m_aArray.size(); i++ )
if( m_aArray[i] == piRend ) if( m_aArray[i] == piRend )
return i; return i;
......
...@@ -2317,7 +2317,7 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead ...@@ -2317,7 +2317,7 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
else if ( L"pntext" == sCommand ) else if ( L"pntext" == sCommand )
{ {
//пропускаем списки office 95, если есть списки office 2007 //пропускаем списки office 95, если есть списки office 2007
if ( oDocument.m_oListTabel.GetCount() > 0 ) if ( oDocument.m_oListTable.GetCount() > 0 )
oAbstrReader.Skip( oDocument, oReader ); oAbstrReader.Skip( oDocument, oReader );
else else
{ {
...@@ -2334,7 +2334,7 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead ...@@ -2334,7 +2334,7 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
} }
else if ( L"pn" == sCommand ) else if ( L"pn" == sCommand )
{ {
if ( oDocument.m_oListTabel.GetCount() > 0 ) if ( oDocument.m_oListTable.GetCount() > 0 )
oAbstrReader.Skip( oDocument, oReader ); oAbstrReader.Skip( oDocument, oReader );
else else
{ {
......
...@@ -2146,7 +2146,7 @@ public: ...@@ -2146,7 +2146,7 @@ public:
RtfShppictReader oShppictReader( *oNewPicture ); RtfShppictReader oShppictReader( *oNewPicture );
StartSubReader( oShppictReader, oDocument, oReader ); StartSubReader( oShppictReader, oDocument, oReader );
oDocument.m_oListTabel.m_aPictureList.AddItem( oNewPicture ); oDocument.m_oListTable.m_aPictureList.AddItem( oNewPicture );
} }
else else
return false; return false;
...@@ -2168,7 +2168,7 @@ public: ...@@ -2168,7 +2168,7 @@ public:
bool bResult = StartSubReader( oListReader, oDocument, oReader ); bool bResult = StartSubReader( oListReader, oDocument, oReader );
if( true == bResult ) if( true == bResult )
{ {
oDocument.m_oListTabel.AddItem( oListProp ); oDocument.m_oListTable.AddItem( oListProp );
return true; return true;
} }
else else
...@@ -2263,7 +2263,7 @@ public: ...@@ -2263,7 +2263,7 @@ public:
bool bResult = StartSubReader( oListOverrideReader, oDocument, oReader ); bool bResult = StartSubReader( oListOverrideReader, oDocument, oReader );
if( true == bResult ) if( true == bResult )
{ {
oDocument.m_oListOverrideTabel.AddItem(oProperty); oDocument.m_oListOverrideTable.AddItem(oProperty);
return true; return true;
} }
else else
......
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
if( true == oLevelReader.Parse( oParam, oNewLevel) ) if( true == oLevelReader.Parse( oParam, oNewLevel) )
oNewList.AddItem( oNewLevel ); oNewList.AddItem( oNewLevel );
} }
oParam.oRtf->m_oListTabel.AddItem( oNewList ); oParam.oRtf->m_oListTable.AddItem( oNewList );
return true; return true;
} }
......
...@@ -90,7 +90,7 @@ public: ...@@ -90,7 +90,7 @@ public:
} }
} }
} }
//----------------------------------------------------------------------------------------------------------
_section last_section; _section last_section;
m_poDocument->GetItem(last_section); m_poDocument->GetItem(last_section);
......
...@@ -78,7 +78,7 @@ public: ...@@ -78,7 +78,7 @@ public:
oNewOverride.m_oOverrideLevels.m_aOverrideLevels.push_back( oOverrideLevel ); oNewOverride.m_oOverrideLevels.m_aOverrideLevels.push_back( oOverrideLevel );
} }
oParam.oRtf->m_oListOverrideTabel.AddItem( oNewOverride ); oParam.oRtf->m_oListOverrideTable.AddItem( oNewOverride );
return true; return true;
} }
......
...@@ -64,9 +64,9 @@ public: ...@@ -64,9 +64,9 @@ public:
oNewShape->m_nPositionHRelative = 3; oNewShape->m_nPositionHRelative = 3;
oNewShape->m_nPositionVRelative = 3; oNewShape->m_nPositionVRelative = 3;
int nIndex = oParam.oRtf->m_oListTabel.m_aPictureList.GetCount(); int nIndex = oParam.oRtf->m_oListTable.m_aPictureList.GetCount();
oParam.oReader->m_mapPictureBullet[nID] = nIndex; oParam.oReader->m_mapPictureBullet[nID] = nIndex;
oParam.oRtf->m_oListTabel.m_aPictureList.AddItem( oNewShape ); oParam.oRtf->m_oListTable.m_aPictureList.AddItem( oNewShape );
} }
} }
if (m_ooxNumbering->m_arrNumPicBullet[i]->m_oDrawing.IsInit()) if (m_ooxNumbering->m_arrNumPicBullet[i]->m_oDrawing.IsInit())
......
...@@ -1041,11 +1041,11 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP ...@@ -1041,11 +1041,11 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP
//применяем direct свойства списка к параграфу //применяем direct свойства списка к параграфу
RtfListOverrideProperty oListOverrideProperty; RtfListOverrideProperty oListOverrideProperty;
//ищем по override table //ищем по override table
if( true == oParam.oRtf->m_oListOverrideTabel.GetList( oOutputProperty.m_nListId, oListOverrideProperty ) ) if( true == oParam.oRtf->m_oListOverrideTable.GetList( oOutputProperty.m_nListId, oListOverrideProperty ) )
{ {
RtfListProperty oListProperty; RtfListProperty oListProperty;
//Ищем по List Table //Ищем по List Table
if( true == oParam.oRtf->m_oListTabel.GetList( oListOverrideProperty.m_nListID, oListProperty) ) if( true == oParam.oRtf->m_oListTable.GetList( oListOverrideProperty.m_nListID, oListProperty) )
{ {
//дописываем свойства параграфа firstIndent Indent //дописываем свойства параграфа firstIndent Indent
RtfListLevelProperty poLevelProp ; RtfListLevelProperty poLevelProp ;
...@@ -1144,6 +1144,25 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP ...@@ -1144,6 +1144,25 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP
OOXrPrReader orPrReader(m_ooxParaProps->m_oRPr.GetPointer()); OOXrPrReader orPrReader(m_ooxParaProps->m_oRPr.GetPointer());
orPrReader.Parse( oParam, oOutputProperty.m_oCharProperty ); orPrReader.Parse( oParam, oOutputProperty.m_oCharProperty );
} }
if (m_ooxParaProps->m_oPPrChange.IsInit())
{
if (m_ooxParaProps->m_oPPrChange->m_sAuthor.IsInit())
oOutputProperty.m_nPrAuth = oParam.oRtf->m_oRevisionTable.AddAuthor( m_ooxParaProps->m_oPPrChange->m_sAuthor.get2() );
if (m_ooxParaProps->m_oPPrChange->m_oDate.IsInit())
oOutputProperty.m_nPrDate = RtfUtility::convertDateTime( string2std_string(m_ooxParaProps->m_oPPrChange->m_oDate->GetValue()));
RtfParagraphPropertyPtr props = RtfParagraphPropertyPtr( new RtfParagraphProperty() );
OOXpPrReader opPrReader(m_ooxParaProps->m_oPPrChange->m_pParPr.GetPointer());
CcnfStyle style;
if (opPrReader.Parse( oParam, *props.get(), style))
{
oOutputProperty.m_pOldParagraphProp = props;
}
}
return true; return true;
} }
bool OOXrPrReader::Parse( ReaderParameter oParam ,RtfCharProperty& oOutputProperty) bool OOXrPrReader::Parse( ReaderParameter oParam ,RtfCharProperty& oOutputProperty)
...@@ -1338,6 +1357,44 @@ bool OOXrPrReader::Parse( ReaderParameter oParam ,RtfCharProperty& oOutputProper ...@@ -1338,6 +1357,44 @@ bool OOXrPrReader::Parse( ReaderParameter oParam ,RtfCharProperty& oOutputProper
//OOXShadingReader oShadingReader(m_ooxRunProps->m_oShadow.GetPointer()); //OOXShadingReader oShadingReader(m_ooxRunProps->m_oShadow.GetPointer());
//oShadingReader.Parse( oParam, oOutputProperty.m_poShading ); //oShadingReader.Parse( oParam, oOutputProperty.m_poShading );
} }
//--------------------------------------------------------------
if (m_ooxRunProps->m_oIns.IsInit())
{
oOutputProperty.m_nRevised = 1;
if (m_ooxRunProps->m_oIns->m_sAuthor.IsInit())
oOutputProperty.m_nRevauth = oParam.oRtf->m_oRevisionTable.AddAuthor( m_ooxRunProps->m_oIns->m_sAuthor.get2() );
if (m_ooxRunProps->m_oIns->m_oDate.IsInit())
oOutputProperty.m_nRevdttm = RtfUtility::convertDateTime( string2std_string(m_ooxRunProps->m_oIns->m_oDate->GetValue()) );
}
if (m_ooxRunProps->m_oDel.IsInit())
{
oOutputProperty.m_nDeleted = 1;
if (m_ooxRunProps->m_oDel->m_sAuthor.IsInit())
oOutputProperty.m_nRevauthDel = oParam.oRtf->m_oRevisionTable.AddAuthor( m_ooxRunProps->m_oDel->m_sAuthor.get2() );
if (m_ooxRunProps->m_oDel->m_oDate.IsInit())
oOutputProperty.m_nRevdttmDel = RtfUtility::convertDateTime( string2std_string(m_ooxRunProps->m_oDel->m_oDate->GetValue()) );
}
if (m_ooxRunProps->m_oRPrChange.IsInit())
{
if (m_ooxRunProps->m_oRPrChange->m_sAuthor.IsInit())
oOutputProperty.m_nCrAuth = oParam.oRtf->m_oRevisionTable.AddAuthor( m_ooxRunProps->m_oRPrChange->m_sAuthor.get2() );
if (m_ooxRunProps->m_oRPrChange->m_oDate.IsInit())
oOutputProperty.m_nCrDate = RtfUtility::convertDateTime( string2std_string(m_ooxRunProps->m_oRPrChange->m_oDate->GetValue()) );
OOXrPrReader orPrReader(m_ooxRunProps->m_oRPrChange->m_pRunPr.GetPointer());
RtfCharPropertyPtr props = RtfCharPropertyPtr( new RtfCharProperty() );
if (orPrReader.Parse( oParam, *props.get() ))
{
oOutputProperty.m_pOldCharProp = props;
}
}
return true; return true;
} }
bool OOXpPrFrameReader::Parse( ReaderParameter oParam ,RtfFrame& oOutputProperty) bool OOXpPrFrameReader::Parse( ReaderParameter oParam ,RtfFrame& oOutputProperty)
...@@ -1770,6 +1827,23 @@ bool OOXSectionPropertyReader::Parse( ReaderParameter oParam , RtfSectionPropert ...@@ -1770,6 +1827,23 @@ bool OOXSectionPropertyReader::Parse( ReaderParameter oParam , RtfSectionPropert
} }
} }
if (m_ooxSectionProperty->m_oSectPrChange.IsInit())
{
if (m_ooxSectionProperty->m_oSectPrChange->m_sAuthor.IsInit())
oOutput.m_nSrAuth = oParam.oRtf->m_oRevisionTable.AddAuthor( m_ooxSectionProperty->m_oSectPrChange->m_sAuthor.get2() );
if (m_ooxSectionProperty->m_oSectPrChange->m_oDate.IsInit())
oOutput.m_nSrDate = RtfUtility::convertDateTime( string2std_string(m_ooxSectionProperty->m_oSectPrChange->m_oDate->GetValue()));
RtfSectionPropertyPtr props = RtfSectionPropertyPtr( new RtfSectionProperty() );
OOXSectionPropertyReader opPrReader(m_ooxSectionProperty->m_oSectPrChange->m_pSecPr.GetPointer());
if (opPrReader.Parse( oParam, *props.get() ))
{
oOutput.m_pOldSectionProp = props;
}
}
return true; return true;
} }
...@@ -57,8 +57,8 @@ public: ...@@ -57,8 +57,8 @@ public:
RtfRevisionTable m_oRevisionTable; RtfRevisionTable m_oRevisionTable;
RtfInformation m_oInformation; RtfInformation m_oInformation;
RtfListTable m_oListTabel; RtfListTable m_oListTable;
RtfListOverrideTable m_oListOverrideTabel; RtfListOverrideTable m_oListOverrideTable;
RtfParagraphProperty m_oDefaultParagraphProp; RtfParagraphProperty m_oDefaultParagraphProp;
RtfCharProperty m_oDefaultCharProp; RtfCharProperty m_oDefaultCharProp;
......
...@@ -435,35 +435,42 @@ public: ...@@ -435,35 +435,42 @@ public:
class RtfRevisionTable : public IDocumentElement, public ItemContainer<CString> class RtfRevisionTable : public IDocumentElement, public ItemContainer<CString>
{ {
public: public:
ItemContainer<CString> m_aAuthorsList;
CString RenderToRtf(RenderParameter oRenderParameter) CString RenderToRtf(RenderParameter oRenderParameter)
{ {
if (m_aArray.empty()) return L"";
CString sResult; CString sResult;
if( m_aArray.size() > 0 )
{
sResult += _T("{\\*\\revtbl ");
for( int i = 0; i < (int)m_aArray.size(); i++) sResult += _T("{\\*\\revtbl ");
{
sResult += _T("{"); sResult += L"{Unknown;}";
sResult += m_aAuthorsList[i]; for( int i = 0; i < (int)m_aArray.size(); i++)
sResult += _T("}"); {
} sResult += _T("{");
sResult += m_aArray[i] + L";";
sResult += _T("}"); sResult += _T("}");
} }
sResult += _T("}");
return sResult; return sResult;
} }
CString RenderToOOX(RenderParameter oRenderParameter) CString RenderToOOX(RenderParameter oRenderParameter)
{ {
return L""; return L"";
} }
int AddAuthor(CString author)
{
int i = Find(author);
if (i < 0)
i = AddItem(author);
return i;
}
}; };
//class RtfRSIDTable : public IDocumentElement, public ItemContainer<rsidString> //class RtfRSIDTable : public IDocumentElement, public ItemContainer<rsidString>
//{ //{
//public: //public:
// ItemContainer<CString> m_aAuthorsList;
// //
// CString RenderToRtf(RenderParameter oRenderParameter) // CString RenderToRtf(RenderParameter oRenderParameter)
// { // {
...@@ -475,7 +482,7 @@ public: ...@@ -475,7 +482,7 @@ public:
// for( int i = 0; i < (int)m_aArray.size(); i++) // for( int i = 0; i < (int)m_aArray.size(); i++)
// { // {
// sResult += _T("{"); // sResult += _T("{");
// sResult += m_aAuthorsList[i]; // sResult += m_aArray[i];
// sResult += _T("}"); // sResult += _T("}");
// } // }
// sResult += _T("}"); // sResult += _T("}");
......
...@@ -630,13 +630,13 @@ CString RtfBorder::RenderToOOX(RenderParameter oRenderParameter) ...@@ -630,13 +630,13 @@ CString RtfBorder::RenderToOOX(RenderParameter oRenderParameter)
CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter) CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter)
{ {
CString sResult; CString sResult;
RENDER_RTF_INT( m_nAnimated, sResult, L"animtext" ) RENDER_RTF_INT( m_nAnimated, sResult, L"animtext" )
RENDER_RTF_BOOL( m_bBold, sResult, L"b" ) RENDER_RTF_BOOL( m_bBold, sResult, L"b" )
RENDER_RTF_BOOL( m_bCaps, sResult, L"caps" ) RENDER_RTF_BOOL( m_bCaps, sResult, L"caps" )
RENDER_RTF_INT( m_nScalex, sResult, L"charscalex" ) RENDER_RTF_INT( m_nScalex, sResult, L"charscalex" )
//RENDER_RTF_INT( m_nCharStyle, sResult, L"cs" ) //RENDER_RTF_INT( m_nCharStyle, sResult, L"cs" )
RENDER_RTF_INT( m_nDown, sResult, L"dn" ) RENDER_RTF_INT( m_nDown, sResult, L"dn" )
RENDER_RTF_BOOL( m_bEmbo, sResult, L"embo" ) RENDER_RTF_BOOL( m_bEmbo, sResult, L"embo" )
RENDER_RTF_INT( m_nCharacterSpacing, sResult, L"expndtw" ) RENDER_RTF_INT( m_nCharacterSpacing, sResult, L"expndtw" )
if( PROP_DEF != m_nCharacterSpacing ) if( PROP_DEF != m_nCharacterSpacing )
sResult.AppendFormat( L"\\expnd%d", m_nCharacterSpacing / 5 ); sResult.AppendFormat( L"\\expnd%d", m_nCharacterSpacing / 5 );
...@@ -645,10 +645,10 @@ CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter) ...@@ -645,10 +645,10 @@ CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter)
RENDER_RTF_INT( m_nFont, sResult, L"f" ) RENDER_RTF_INT( m_nFont, sResult, L"f" )
//RENDER_RTF_INT( m_nFont2, sResult, L"fittext" ) //RENDER_RTF_INT( m_nFont2, sResult, L"fittext" )
//RENDER_RTF_INT( m_nFont3, sResult, L"fittext" ) //RENDER_RTF_INT( m_nFont3, sResult, L"fittext" )
RENDER_RTF_INT( m_nFontSize, sResult, L"fs" ) RENDER_RTF_INT( m_nFontSize, sResult, L"fs" )
RENDER_RTF_BOOL( m_bItalic, sResult, L"i" ) RENDER_RTF_BOOL( m_bItalic, sResult, L"i" )
RENDER_RTF_BOOL( m_bImprint, sResult, L"impr" ) RENDER_RTF_BOOL( m_bImprint, sResult, L"impr" )
RENDER_RTF_INT( m_nKerning, sResult, L"kerning" ) RENDER_RTF_INT( m_nKerning, sResult, L"kerning" )
if (m_bRightToLeft != PROP_DEF ) if (m_bRightToLeft != PROP_DEF )
{ {
...@@ -702,6 +702,24 @@ CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter) ...@@ -702,6 +702,24 @@ CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter)
if( m_poShading.IsValid() == true ) if( m_poShading.IsValid() == true )
sResult += m_poShading.RenderToRtf( oRenderParameter ); 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_pOldCharProp)
{
sResult += "{\\*\\oldcprops";
sResult += m_pOldCharProp->RenderToRtf(oRenderParameter);
sResult += L"}";
}
return sResult; return sResult;
} }
...@@ -1891,10 +1909,10 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter) ...@@ -1891,10 +1909,10 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
RtfDocument* poRtfDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument ); RtfDocument* poRtfDocument = static_cast<RtfDocument*>( oRenderParameter.poDocument );
RtfListOverrideProperty oListOverrideProperty; RtfListOverrideProperty oListOverrideProperty;
//ищем по override table //ищем по override table
if( true == poRtfDocument->m_oListOverrideTabel.GetList( m_nListId, oListOverrideProperty ) ) if( true == poRtfDocument->m_oListOverrideTable.GetList( m_nListId, oListOverrideProperty ) )
{ {
//Ищем по List Table //Ищем по List Table
if( true == poRtfDocument->m_oListTabel.GetList( oListOverrideProperty.m_nListID, oListProperty) ) if( true == poRtfDocument->m_oListTable.GetList( oListOverrideProperty.m_nListID, oListProperty) )
{ {
//дописываем свойства параграфа firstIndent Indent //дописываем свойства параграфа firstIndent Indent
RtfListLevelProperty poLevelProp ; RtfListLevelProperty poLevelProp ;
...@@ -1911,8 +1929,8 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter) ...@@ -1911,8 +1929,8 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
{ {
int nIndex = poLevelProp.m_nPictureIndex; int nIndex = poLevelProp.m_nPictureIndex;
if( 0 < nIndex && nIndex < poRtfDocument->m_oListTabel.m_aPictureList.GetCount() ) if( 0 < nIndex && nIndex < poRtfDocument->m_oListTable.m_aPictureList.GetCount() )
sResult += poRtfDocument->m_oListTabel.m_aPictureList[nIndex]->RenderToRtf( oRenderParameter ); sResult += poRtfDocument->m_oListTable.m_aPictureList[nIndex]->RenderToRtf( oRenderParameter );
} }
//ставим tab //ставим tab
if( PROP_DEF != poLevelProp.m_nFollow ) if( PROP_DEF != poLevelProp.m_nFollow )
...@@ -1930,6 +1948,16 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter) ...@@ -1930,6 +1948,16 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter)
} }
} }
} }
RENDER_RTF_INT( m_nPrAuth, sResult, L"prauth" )
RENDER_RTF_INT( m_nPrDate, sResult, L"prdate" )
if (m_pOldParagraphProp)
{
sResult += "{\\*\\oldpprops\\pard";
sResult += m_pOldParagraphProp->RenderToRtf(oRenderParameter);
sResult += L"}";
}
return sResult; return sResult;
} }
CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter) CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
......
...@@ -292,9 +292,10 @@ CString RtfWriter::CreateRtfStart() ...@@ -292,9 +292,10 @@ CString RtfWriter::CreateRtfStart()
sResult += _T("{\\*\\defpap ") + sDefParProp+ _T("}"); sResult += _T("{\\*\\defpap ") + sDefParProp+ _T("}");
sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter ); sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter );
//---------- test //---------- test
sResult += m_oDocument.m_oListTabel.RenderToRtf( oRenderParameter ); sResult += m_oDocument.m_oListTable.RenderToRtf ( oRenderParameter );
sResult += m_oDocument.m_oListOverrideTabel.RenderToRtf( oRenderParameter ); sResult += m_oDocument.m_oListOverrideTable.RenderToRtf ( oRenderParameter );
sResult += m_oDocument.m_oInformation.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 += _T("\\fet2");//0 Footnotes only or nothing at all (the default). 1 Endnotes only. 2 Both footnotes and endnotes
CString sFootnote; CString sFootnote;
......
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
#include "iconv.h" #include "iconv.h"
#endif #endif
#include <boost/date_time.hpp>
#define BUF_SIZE 2048 #define BUF_SIZE 2048
#define ONE_INCH 2.54 #define ONE_INCH 2.54
...@@ -60,7 +62,8 @@ ...@@ -60,7 +62,8 @@
#define CP_SYMBOL 42 #define CP_SYMBOL 42
#endif #endif
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL) #define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
#define SETBITS(to , numL, numH, val) {to &= ~(((1 << (numH - numL + 1)) - 1) << numL); to |= ((val & ((1 << (numH - numL + 1)) - 1)) << numL);}
namespace Strings namespace Strings
{ {
...@@ -387,7 +390,7 @@ public: ...@@ -387,7 +390,7 @@ public:
short Month = GETBITS(dt, 16, 19); short Month = GETBITS(dt, 16, 19);
int Year = GETBITS(dt, 20, 28) + 1900; int Year = GETBITS(dt, 20, 28) + 1900;
//to 1899-12-31T05:37:46.66569 //to 1899-12-31T05:37:46.66569 - iso_extended_string
std::wstring date_str = std::to_wstring(Year) std::wstring date_str = std::to_wstring(Year)
+ L"-" + L"-"
+ (Month < 10 ? L"0": L"") + std::to_wstring(Month) + (Month < 10 ? L"0": L"") + std::to_wstring(Month)
...@@ -401,6 +404,35 @@ public: ...@@ -401,6 +404,35 @@ public:
return date_str; return date_str;
} }
static int convertDateTime (std::wstring & dt_)
{
if ( dt_.empty() ) return PROP_DEF;
std::string dt(dt_.begin(), dt_.end());
boost::posix_time::ptime date_time_;
boost::posix_time::time_input_facet *tif = new boost::posix_time::time_input_facet;
tif->set_iso_extended_format();
std::istringstream strm(dt);
strm.imbue(std::locale(std::locale::classic(), tif));
strm >> date_time_;
short Min = date_time_.time_of_day().minutes();
short Hour = date_time_.time_of_day().hours();
short Day = date_time_.date().day();
short Month = date_time_.date().month().as_number();
int Year = date_time_.date().year() - 1900;
int result = 0;
SETBITS(result, 0 , 5, Min);
SETBITS(result, 6 , 10, Hour);
SETBITS(result, 11, 15, Day);
SETBITS(result, 16, 19, Month);
SETBITS(result, 20, 28, Year);
return result;
}
//------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------
class RtfInternalEncoder class RtfInternalEncoder
{ {
......
...@@ -128,8 +128,8 @@ CString OOXDocumentWriter::CreateXmlEnd( ) ...@@ -128,8 +128,8 @@ CString OOXDocumentWriter::CreateXmlEnd( )
oNewParam.poRels = poNumberingWriter->m_oRelsWriter.get(); oNewParam.poRels = poNumberingWriter->m_oRelsWriter.get();
oNewParam.nType = RENDER_TO_OOX_PARAM_NUMBERING; oNewParam.nType = RENDER_TO_OOX_PARAM_NUMBERING;
poNumberingWriter->AddNumbering( m_oDocument.m_oListTabel.RenderToOOX(oNewParam) ); poNumberingWriter->AddNumbering( m_oDocument.m_oListTable.RenderToOOX(oNewParam) );
poNumberingWriter->AddNumbering( m_oDocument.m_oListOverrideTabel.RenderToOOX(oNewParam) ); poNumberingWriter->AddNumbering( m_oDocument.m_oListOverrideTable.RenderToOOX(oNewParam) );
//style.xml //style.xml
OOXStylesWriter* poStylesWriter = static_cast<OOXStylesWriter*>( m_oWriter.m_poStylesWriter ); OOXStylesWriter* poStylesWriter = static_cast<OOXStylesWriter*>( m_oWriter.m_poStylesWriter );
......
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