diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Basic.h b/ASCOfficeRtfFile/RtfFormatLib/source/Basic.h index 5e17fdb00a..b4f8955670 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Basic.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Basic.h @@ -120,6 +120,8 @@ public: } int Find( T piRend ) { + //todooo - add map for seach + for( int i = 0; i < (int)m_aArray.size(); i++ ) if( m_aArray[i] == piRend ) return i; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp index 94b0ae3fcc..26dde37b0e 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp @@ -2317,7 +2317,7 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead else if ( L"pntext" == sCommand ) { //пропускаем списки office 95, если есть списки office 2007 - if ( oDocument.m_oListTabel.GetCount() > 0 ) + if ( oDocument.m_oListTable.GetCount() > 0 ) oAbstrReader.Skip( oDocument, oReader ); else { @@ -2334,7 +2334,7 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead } else if ( L"pn" == sCommand ) { - if ( oDocument.m_oListTabel.GetCount() > 0 ) + if ( oDocument.m_oListTable.GetCount() > 0 ) oAbstrReader.Skip( oDocument, oReader ); else { diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h index b9062251bf..ad6b9bf871 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.h @@ -2146,7 +2146,7 @@ public: RtfShppictReader oShppictReader( *oNewPicture ); StartSubReader( oShppictReader, oDocument, oReader ); - oDocument.m_oListTabel.m_aPictureList.AddItem( oNewPicture ); + oDocument.m_oListTable.m_aPictureList.AddItem( oNewPicture ); } else return false; @@ -2168,7 +2168,7 @@ public: bool bResult = StartSubReader( oListReader, oDocument, oReader ); if( true == bResult ) { - oDocument.m_oListTabel.AddItem( oListProp ); + oDocument.m_oListTable.AddItem( oListProp ); return true; } else @@ -2263,7 +2263,7 @@ public: bool bResult = StartSubReader( oListOverrideReader, oDocument, oReader ); if( true == bResult ) { - oDocument.m_oListOverrideTabel.AddItem(oProperty); + oDocument.m_oListOverrideTable.AddItem(oProperty); return true; } else diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXAbstractNumReader.h b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXAbstractNumReader.h index 3961b9e5f1..46c2750768 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXAbstractNumReader.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXAbstractNumReader.h @@ -76,7 +76,7 @@ public: if( true == oLevelReader.Parse( oParam, oNewLevel) ) oNewList.AddItem( oNewLevel ); } - oParam.oRtf->m_oListTabel.AddItem( oNewList ); + oParam.oRtf->m_oListTable.AddItem( oNewList ); return true; } diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDocumentReader.h b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDocumentReader.h index 41069aaf49..9623308768 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDocumentReader.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXDocumentReader.h @@ -90,7 +90,7 @@ public: } } } - +//---------------------------------------------------------------------------------------------------------- _section last_section; m_poDocument->GetItem(last_section); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXNumberingMapReader.h b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXNumberingMapReader.h index ce69b6d160..c471ee406b 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXNumberingMapReader.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXNumberingMapReader.h @@ -78,7 +78,7 @@ public: oNewOverride.m_oOverrideLevels.m_aOverrideLevels.push_back( oOverrideLevel ); } - oParam.oRtf->m_oListOverrideTabel.AddItem( oNewOverride ); + oParam.oRtf->m_oListOverrideTable.AddItem( oNewOverride ); return true; } diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXNumberingReader.h b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXNumberingReader.h index d0c9d441d4..abbde75d8f 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXNumberingReader.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXNumberingReader.h @@ -64,9 +64,9 @@ public: oNewShape->m_nPositionHRelative = 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.oRtf->m_oListTabel.m_aPictureList.AddItem( oNewShape ); + oParam.oRtf->m_oListTable.m_aPictureList.AddItem( oNewShape ); } } if (m_ooxNumbering->m_arrNumPicBullet[i]->m_oDrawing.IsInit()) diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXParagraphElementReaders.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXParagraphElementReaders.cpp index adf0d9d77b..6c3828b226 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXParagraphElementReaders.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Reader/OOXParagraphElementReaders.cpp @@ -1041,11 +1041,11 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP //применяем direct свойства списка к параграфу RtfListOverrideProperty oListOverrideProperty; //ищем по 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; //Ищем по 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 RtfListLevelProperty poLevelProp ; @@ -1144,6 +1144,25 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP OOXrPrReader orPrReader(m_ooxParaProps->m_oRPr.GetPointer()); 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; } bool OOXrPrReader::Parse( ReaderParameter oParam ,RtfCharProperty& oOutputProperty) @@ -1338,6 +1357,44 @@ bool OOXrPrReader::Parse( ReaderParameter oParam ,RtfCharProperty& oOutputProper //OOXShadingReader oShadingReader(m_ooxRunProps->m_oShadow.GetPointer()); //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; } bool OOXpPrFrameReader::Parse( ReaderParameter oParam ,RtfFrame& oOutputProperty) @@ -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; } diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.h b/ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.h index 1e89ee84cf..d82805cc38 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfDocument.h @@ -57,8 +57,8 @@ public: RtfRevisionTable m_oRevisionTable; RtfInformation m_oInformation; - RtfListTable m_oListTabel; - RtfListOverrideTable m_oListOverrideTabel; + RtfListTable m_oListTable; + RtfListOverrideTable m_oListOverrideTable; RtfParagraphProperty m_oDefaultParagraphProp; RtfCharProperty m_oDefaultCharProp; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfGlobalTables.h b/ASCOfficeRtfFile/RtfFormatLib/source/RtfGlobalTables.h index 62ad6e119e..37172d1807 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfGlobalTables.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfGlobalTables.h @@ -435,35 +435,42 @@ public: class RtfRevisionTable : public IDocumentElement, public ItemContainer { public: - ItemContainer m_aAuthorsList; - CString RenderToRtf(RenderParameter oRenderParameter) { - CString sResult; - if( m_aArray.size() > 0 ) - { - sResult += _T("{\\*\\revtbl "); + if (m_aArray.empty()) return L""; - for( int i = 0; i < (int)m_aArray.size(); i++) - { - sResult += _T("{"); - sResult += m_aAuthorsList[i]; - sResult += _T("}"); - } + CString sResult; + + sResult += _T("{\\*\\revtbl "); + + sResult += L"{Unknown;}"; + for( int i = 0; i < (int)m_aArray.size(); i++) + { + sResult += _T("{"); + sResult += m_aArray[i] + L";"; sResult += _T("}"); - } + } + sResult += _T("}"); + return sResult; } CString RenderToOOX(RenderParameter oRenderParameter) { return L""; } + + int AddAuthor(CString author) + { + int i = Find(author); + if (i < 0) + i = AddItem(author); + return i; + } }; //class RtfRSIDTable : public IDocumentElement, public ItemContainer //{ //public: -// ItemContainer m_aAuthorsList; // // CString RenderToRtf(RenderParameter oRenderParameter) // { @@ -475,7 +482,7 @@ public: // for( int i = 0; i < (int)m_aArray.size(); i++) // { // sResult += _T("{"); -// sResult += m_aAuthorsList[i]; +// sResult += m_aArray[i]; // sResult += _T("}"); // } // sResult += _T("}"); diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp index e2cb32205e..7167cb6bae 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp @@ -630,13 +630,13 @@ CString RtfBorder::RenderToOOX(RenderParameter oRenderParameter) CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter) { CString sResult; - RENDER_RTF_INT( m_nAnimated, sResult, L"animtext" ) - RENDER_RTF_BOOL( m_bBold, sResult, L"b" ) - RENDER_RTF_BOOL( m_bCaps, sResult, L"caps" ) - RENDER_RTF_INT( m_nScalex, sResult, L"charscalex" ) + RENDER_RTF_INT( m_nAnimated, sResult, L"animtext" ) + RENDER_RTF_BOOL( m_bBold, sResult, L"b" ) + RENDER_RTF_BOOL( m_bCaps, sResult, L"caps" ) + RENDER_RTF_INT( m_nScalex, sResult, L"charscalex" ) //RENDER_RTF_INT( m_nCharStyle, sResult, L"cs" ) - RENDER_RTF_INT( m_nDown, sResult, L"dn" ) - RENDER_RTF_BOOL( m_bEmbo, sResult, L"embo" ) + 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 ); @@ -645,10 +645,10 @@ CString RtfCharProperty::RenderToRtf(RenderParameter oRenderParameter) 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" ) - RENDER_RTF_INT( m_nKerning, sResult, L"kerning" ) + RENDER_RTF_INT( m_nFontSize, sResult, L"fs" ) + RENDER_RTF_BOOL( m_bItalic, sResult, L"i" ) + RENDER_RTF_BOOL( m_bImprint, sResult, L"impr" ) + RENDER_RTF_INT( m_nKerning, sResult, L"kerning" ) if (m_bRightToLeft != PROP_DEF ) { @@ -702,6 +702,24 @@ 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_pOldCharProp) + { + sResult += "{\\*\\oldcprops"; + sResult += m_pOldCharProp->RenderToRtf(oRenderParameter); + sResult += L"}"; + } return sResult; } @@ -1891,10 +1909,10 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter) RtfDocument* poRtfDocument = static_cast( oRenderParameter.poDocument ); RtfListOverrideProperty oListOverrideProperty; //ищем по override table - if( true == poRtfDocument->m_oListOverrideTabel.GetList( m_nListId, oListOverrideProperty ) ) + if( true == poRtfDocument->m_oListOverrideTable.GetList( m_nListId, oListOverrideProperty ) ) { //Ищем по List Table - if( true == poRtfDocument->m_oListTabel.GetList( oListOverrideProperty.m_nListID, oListProperty) ) + if( true == poRtfDocument->m_oListTable.GetList( oListOverrideProperty.m_nListID, oListProperty) ) { //дописываем свойства параграфа firstIndent Indent RtfListLevelProperty poLevelProp ; @@ -1911,8 +1929,8 @@ CString RtfParagraphProperty::RenderToRtf(RenderParameter oRenderParameter) { int nIndex = poLevelProp.m_nPictureIndex; - if( 0 < nIndex && nIndex < poRtfDocument->m_oListTabel.m_aPictureList.GetCount() ) - sResult += poRtfDocument->m_oListTabel.m_aPictureList[nIndex]->RenderToRtf( oRenderParameter ); + if( 0 < nIndex && nIndex < poRtfDocument->m_oListTable.m_aPictureList.GetCount() ) + sResult += poRtfDocument->m_oListTable.m_aPictureList[nIndex]->RenderToRtf( oRenderParameter ); } //ставим tab if( PROP_DEF != poLevelProp.m_nFollow ) @@ -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; } CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter) diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp index ad737eec34..c767832b8f 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/RtfWriter.cpp @@ -292,9 +292,10 @@ CString RtfWriter::CreateRtfStart() sResult += _T("{\\*\\defpap ") + sDefParProp+ _T("}"); sResult += m_oDocument.m_oStyleTable.RenderToRtf( oRenderParameter ); //---------- test - sResult += m_oDocument.m_oListTabel.RenderToRtf( oRenderParameter ); - sResult += m_oDocument.m_oListOverrideTabel.RenderToRtf( oRenderParameter ); - sResult += m_oDocument.m_oInformation.RenderToRtf( oRenderParameter ); + 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 CString sFootnote; diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h b/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h index dbaa653db5..2fd9846bf7 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Utils.h @@ -45,6 +45,8 @@ #include "iconv.h" #endif +#include + #define BUF_SIZE 2048 #define ONE_INCH 2.54 @@ -60,7 +62,8 @@ #define CP_SYMBOL 42 #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 { @@ -387,7 +390,7 @@ public: short Month = GETBITS(dt, 16, 19); 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) + L"-" + (Month < 10 ? L"0": L"") + std::to_wstring(Month) @@ -401,6 +404,35 @@ public: 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 { diff --git a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp index c8c481c613..50db71130a 100644 --- a/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp +++ b/ASCOfficeRtfFile/RtfFormatLib/source/Writer/OOXDocumentWriter.cpp @@ -128,8 +128,8 @@ CString OOXDocumentWriter::CreateXmlEnd( ) oNewParam.poRels = poNumberingWriter->m_oRelsWriter.get(); oNewParam.nType = RENDER_TO_OOX_PARAM_NUMBERING; - poNumberingWriter->AddNumbering( m_oDocument.m_oListTabel.RenderToOOX(oNewParam) ); - poNumberingWriter->AddNumbering( m_oDocument.m_oListOverrideTabel.RenderToOOX(oNewParam) ); + poNumberingWriter->AddNumbering( m_oDocument.m_oListTable.RenderToOOX(oNewParam) ); + poNumberingWriter->AddNumbering( m_oDocument.m_oListOverrideTable.RenderToOOX(oNewParam) ); //style.xml OOXStylesWriter* poStylesWriter = static_cast( m_oWriter.m_poStylesWriter );