Commit 9503207e authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatWriter - section (refactoring)

parent 6abc59ec
...@@ -92,10 +92,8 @@ public: ...@@ -92,10 +92,8 @@ public:
template<class T> template<class T>
class ItemContainer class ItemContainer
{ {
protected:
std::vector<T> m_aArray;
public: public:
std::vector<T> m_aArray;
ItemContainer( ) ItemContainer( )
{ {
...@@ -138,9 +136,13 @@ public: ...@@ -138,9 +136,13 @@ public:
void RemoveItem( int nIndex = -1 ) void RemoveItem( int nIndex = -1 )
{ {
if( nIndex >= 0 && nIndex < (int)m_aArray.size() ) if( nIndex >= 0 && nIndex < (int)m_aArray.size() )
{
m_aArray.erase(m_aArray.begin() + nIndex ); m_aArray.erase(m_aArray.begin() + nIndex );
}
else if( -1 == nIndex && 0 < (int)m_aArray.size() ) else if( -1 == nIndex && 0 < (int)m_aArray.size() )
{
m_aArray.pop_back(); m_aArray.pop_back();
}
} }
void RemoveAll() void RemoveAll()
...@@ -149,9 +151,9 @@ public: ...@@ -149,9 +151,9 @@ public:
} }
bool GetItem(T& oOutput,int nIndex = -1) bool GetItem(T& oOutput,int nIndex = -1)
{ {
if( -1 == nIndex && (int)m_aArray.size() > 0 ) if( -1 == nIndex && !m_aArray.empty() )
{ {
oOutput = m_aArray[m_aArray.size() - 1]; oOutput = m_aArray.back();
return true; return true;
} }
if( nIndex >= 0 && nIndex < (int)m_aArray.size()) if( nIndex >= 0 && nIndex < (int)m_aArray.size())
...@@ -159,6 +161,11 @@ public: ...@@ -159,6 +161,11 @@ public:
oOutput = m_aArray[nIndex]; oOutput = m_aArray[nIndex];
return true; return true;
} }
else if (!m_aArray.empty())
{
oOutput = m_aArray[0]; // default
return true;
}
return false; return false;
} }
void InsertItem(T& oOutput,int nIndex = -1) void InsertItem(T& oOutput,int nIndex = -1)
......
...@@ -356,16 +356,16 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader ...@@ -356,16 +356,16 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader
} }
else if( _T("sect") == sCommand ) else if( _T("sect") == sCommand )
{ {
RtfSectionPtr oCurSection; _section section;
if(true == oDocument.GetItem( oCurSection ) ) if(true == oDocument.GetItem( section ) )
{ {
oCurSection->m_oProperty = oReader.m_oCurSectionProp; section.props->m_oProperty = oReader.m_oCurSectionProp;
if (oParagraphReaderDestination.nCurItap > 0) if (oParagraphReaderDestination.nCurItap > 0)
{ {
} }
else else
{ {
oCurSection->m_bFinalize = true; section.props->m_bFinalize = true;
} }
} }
...@@ -373,7 +373,9 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader ...@@ -373,7 +373,9 @@ bool RtfNormalReader::ExecuteCommand( RtfDocument& oDocument, RtfReader& oReader
RtfSectionPtr oNewSection = RtfSectionPtr( new RtfSection() ); RtfSectionPtr oNewSection = RtfSectionPtr( new RtfSection() );
oParagraphReaderDestination.m_oTextItems = oNewSection; oParagraphReaderDestination.m_oTextItems = oNewSection;
oDocument.AddItem( oNewSection );
_section new_section(oNewSection);
oDocument.AddItem( new_section );
//вручную обнуляем footer, т.к. sectd может встретиться и после field //вручную обнуляем footer, т.к. sectd может встретиться и после field
///????? ///?????
......
...@@ -2440,12 +2440,13 @@ public: ...@@ -2440,12 +2440,13 @@ public:
RtfNormalReader( RtfDocument& oDocument, RtfReader& oReader ) RtfNormalReader( RtfDocument& oDocument, RtfReader& oReader )
{ {
RtfSectionPtr oCurSection;
SectDef( oDocument, oReader ); SectDef( oDocument, oReader );
if(true == oDocument.GetItem( oCurSection ) )
_section section;
if(true == oDocument.GetItem( section ) )
{ {
oCurSection->m_oProperty = oReader.m_oCurSectionProp; section.props->m_oProperty = oReader.m_oCurSectionProp;
oParagraphReaderDestination.m_oTextItems = oCurSection; oParagraphReaderDestination.m_oTextItems = section.props;
} }
m_nCurGroups = 0; m_nCurGroups = 0;
} }
...@@ -2457,9 +2458,12 @@ public: ...@@ -2457,9 +2458,12 @@ public:
void ExitReader(RtfDocument& oDocument, RtfReader& oReader) void ExitReader(RtfDocument& oDocument, RtfReader& oReader)
{ {
oParagraphReaderDestination.Finalize(oReader/*, RtfSectionPtr()*/); oParagraphReaderDestination.Finalize(oReader/*, RtfSectionPtr()*/);
RtfSectionPtr oCurSection;
if(true == oDocument.GetItem( oCurSection ) ) _section section;
oCurSection->m_oProperty = oReader.m_oCurSectionProp; if(true == oDocument.GetItem( section) )
{
section.props->m_oProperty = oReader.m_oCurSectionProp;
}
if( NULL == oDocument.m_oFootnoteCon ) if( NULL == oDocument.m_oFootnoteCon )
{ {
......
...@@ -59,14 +59,24 @@ public: ...@@ -59,14 +59,24 @@ public:
m_poReader = oParam.oReader; m_poReader = oParam.oReader;
m_poDocument = oParam.oRtf; m_poDocument = oParam.oRtf;
oParam.oRtf->m_oStatusSection.start_new = false; //oParam.oRtf->m_oStatusSection.start_new = false;
RtfSectionPtr oCurSection; _section first_section;
if( true == oParam.oRtf->GetItem( oCurSection ) )
//if( true == oParam.oRtf->GetItem( first_section ) )
{ {
oCurSection->m_oProperty.SetDefaultOOX(); //first_section.props->m_oProperty.SetDefaultOOX();
//сначала считаем количесво секций и заполняем их свойства .. //if (m_ooxDocument->m_oSectPr.IsInit())// свойства последней секции
//{
// OOXSectionPropertyReader oSectReader(m_ooxDocument->m_oSectPr.GetPointer());
// if (oSectReader.Parse( oParam, first_section.props->m_oProperty ))
// {
// }
//}
int last_section_start = 0;
//считаем количесво секций и заполняем их свойства ..
for (long i = 0; i < m_ooxDocument->m_arrItems.size(); i++) for (long i = 0; i < m_ooxDocument->m_arrItems.size(); i++)
{ {
if (m_ooxDocument->m_arrItems[i] == NULL) continue; if (m_ooxDocument->m_arrItems[i] == NULL) continue;
...@@ -77,35 +87,51 @@ public: ...@@ -77,35 +87,51 @@ public:
if ((para) && (para->m_oParagraphProperty)) if ((para) && (para->m_oParagraphProperty))
{ {
if (para->m_oParagraphProperty->m_oSectPr.IsInit()) if (para->m_oParagraphProperty->m_oSectPr.IsInit() )
{ {
_section section(RtfSectionPtr( new RtfSection() ), last_section_start, i + 1);
//if (i == last_section_start) section.end_para = 1;
last_section_start = i + 1;
section.props->m_oProperty.SetDefaultOOX();
OOXSectionPropertyReader oSectReader(para->m_oParagraphProperty->m_oSectPr.GetPointer()); OOXSectionPropertyReader oSectReader(para->m_oParagraphProperty->m_oSectPr.GetPointer());
if( true == oSectReader.Parse( oParam, oCurSection->m_oProperty ) ) if( true == oSectReader.Parse( oParam, section.props->m_oProperty ) )
{ {
//создаем новую секцию oParam.oRtf->AddItem( section );
oCurSection = RtfSectionPtr( new RtfSection() );
oCurSection->m_oProperty.SetDefaultOOX();
oParam.oRtf->AddItem( oCurSection );
} }
} }
} }
} }
} }
m_poDocument->RemoveItem(0);
_section last_section;
m_poDocument->GetItem(last_section);
if (last_section.end_para < m_ooxDocument->m_arrItems.size())
{
_section section(RtfSectionPtr( new RtfSection() ), last_section.end_para, m_ooxDocument->m_arrItems.size());
section.props->m_oProperty.SetDefaultOOX();
if (m_ooxDocument->m_oSectPr.IsInit())// свойства последней секции if (m_ooxDocument->m_oSectPr.IsInit())// свойства последней секции
{ {
OOXSectionPropertyReader oSectReader(m_ooxDocument->m_oSectPr.GetPointer()); OOXSectionPropertyReader oSectReader(m_ooxDocument->m_oSectPr.GetPointer());
if (oSectReader.Parse( oParam, oCurSection->m_oProperty )) if (oSectReader.Parse( oParam, section.props->m_oProperty ))
{ {
} }
} }
RtfSectionPtr oFirstSection; oParam.oRtf->AddItem( section );
if( true == m_poDocument->GetItem( oFirstSection, 0 ) ) }
for (int sect = 0 ; sect < m_poDocument->GetCount(); sect++)
{ {
m_oTextItemReader.m_oTextItems = oFirstSection; m_oTextItemReader.m_oTextItems = m_poDocument->m_aArray[sect].props;
oParam.oRtf->m_oStatusSection.number = 1;
for (long i = 0; i < m_ooxDocument->m_arrItems.size(); i++) for (long i = m_poDocument->m_aArray[sect].start_para; i < m_poDocument->m_aArray[sect].end_para; i++)
{ {
m_oTextItemReader.Parse(m_ooxDocument->m_arrItems[i], oParam ); m_oTextItemReader.Parse(m_ooxDocument->m_arrItems[i], oParam );
} }
......
...@@ -1115,11 +1115,11 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP ...@@ -1115,11 +1115,11 @@ bool OOXpPrReader::Parse( ReaderParameter oParam ,RtfParagraphProperty& oOutputP
OOXpPrTabReader oTabReader(m_ooxParaProps->m_oTabs.GetPointer()); OOXpPrTabReader oTabReader(m_ooxParaProps->m_oTabs.GetPointer());
oTabReader.Parse( oParam, oOutputProperty.m_oTabs ); oTabReader.Parse( oParam, oOutputProperty.m_oTabs );
} }
if( m_ooxParaProps->m_oSectPr.IsInit()) //if( m_ooxParaProps->m_oSectPr.IsInit())
{ //{
oParam.oRtf->m_oStatusSection.number++; // oParam.oRtf->m_oStatusSection.number++;
oParam.oRtf->m_oStatusSection.start_new = true; // oParam.oRtf->m_oStatusSection.start_new = true;
} //}
if( m_ooxParaProps->m_oRPr.IsInit() ) if( m_ooxParaProps->m_oRPr.IsInit() )
{ {
......
...@@ -67,15 +67,15 @@ public: ...@@ -67,15 +67,15 @@ public:
if( true == m_oParagraphReader.Parse( oParam, (*oNewParagraph), CcnfStyle() )) if( true == m_oParagraphReader.Parse( oParam, (*oNewParagraph), CcnfStyle() ))
{ {
m_oTextItems->AddItem( oNewParagraph ); m_oTextItems->AddItem( oNewParagraph );
if( true == oParam.oRtf->m_oStatusSection.start_new ) //if( true == oParam.oRtf->m_oStatusSection.start_new )
{ //{
RtfSectionPtr oCurSection; // RtfSectionPtr oCurSection;
if( true == oParam.oRtf->GetItem( oCurSection, oParam.oRtf->m_oStatusSection.number - 1) ) // if( true == oParam.oRtf->GetItem( oCurSection, oParam.oRtf->m_oStatusSection.number - 1) )
{ // {
m_oTextItems = oCurSection; // m_oTextItems = oCurSection;
} // }
oParam.oRtf->m_oStatusSection.start_new = false; // oParam.oRtf->m_oStatusSection.start_new = false;
} //}
} }
}break; }break;
case OOX::et_w_tbl: case OOX::et_w_tbl:
......
...@@ -41,7 +41,9 @@ ...@@ -41,7 +41,9 @@
RtfDocument::RtfDocument() RtfDocument::RtfDocument()
{ {
m_aArray.push_back( RtfSectionPtr( new RtfSection() ) ); _section section(RtfSectionPtr(new RtfSection()), 0, 0);
m_aArray.push_back( section );
m_oProperty.SetDefaultOOX(); m_oProperty.SetDefaultOOX();
m_oDefaultCharProp.SetDefaultRtf(); m_oDefaultCharProp.SetDefaultRtf();
m_oDefaultParagraphProp.SetDefaultRtf(); m_oDefaultParagraphProp.SetDefaultRtf();
......
...@@ -36,7 +36,18 @@ ...@@ -36,7 +36,18 @@
#include "RtfSection.h" #include "RtfSection.h"
#include "RtfMath.h" #include "RtfMath.h"
class RtfDocument :public ItemContainer<RtfSectionPtr> struct _section
{
_section() : start_para(0), end_para(-1) {}
_section(RtfSectionPtr &p, int start = 0, int end = -1) : props(p), start_para(start), end_para(end) {}
RtfSectionPtr props;
int start_para;
int end_para;
};
class RtfDocument : public ItemContainer<_section>
{ {
public: public:
RtfDocumentProperty m_oProperty; RtfDocumentProperty m_oProperty;
...@@ -60,14 +71,9 @@ public: ...@@ -60,14 +71,9 @@ public:
//для того чтобы конвертировать старый формат List в Numbering //для того чтобы конвертировать старый формат List в Numbering
std::vector<RtfOldListPtr> m_aOldLists; std::vector<RtfOldListPtr> m_aOldLists;
struct _status_section
{
bool start_new;
int number;
}m_oStatusSection;
private: private:
std::vector<int> m_aShapeId; std::vector<int> m_aShapeId;
public: public:
IdGenerator m_oIdGenerator; IdGenerator m_oIdGenerator;
void SetShapeId( int nShapeId ) void SetShapeId( int nShapeId )
......
...@@ -1883,11 +1883,11 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter) ...@@ -1883,11 +1883,11 @@ CString RtfParagraphProperty::RenderToOOX(RenderParameter oRenderParameter)
} }
} }
RtfSectionPtr oCurSection; _section section;
if(true == poRtfDocument->GetItem( oCurSection ) ) if(true == poRtfDocument->GetItem( section ) )
{ {
sResult += oCurSection->RenderToOOX(oRenderParameter); sResult += section.props->RenderToOOX(oRenderParameter);
oCurSection->m_bFinalize = false; section.props->m_bFinalize = false;
} }
if( 0 == m_bAutoHyphenation ) sResult += _T("<w:suppressAutoHyphens/>"); if( 0 == m_bAutoHyphenation ) sResult += _T("<w:suppressAutoHyphens/>");
......
...@@ -97,7 +97,7 @@ bool RtfWriter::SaveByItem() ...@@ -97,7 +97,7 @@ bool RtfWriter::SaveByItem()
oNewParam.poWriter = this; oNewParam.poWriter = this;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
if( m_oDocument.GetCount() > 1 && m_oDocument[0]->GetCount() == 0 ) if( m_oDocument.GetCount() > 1 && m_oDocument[0].props->GetCount() == 0 )
{ {
//пишем конец секции //пишем конец секции
CStringA sRtfExt = "\\sect"; CStringA sRtfExt = "\\sect";
...@@ -125,7 +125,7 @@ bool RtfWriter::SaveByItem() ...@@ -125,7 +125,7 @@ bool RtfWriter::SaveByItem()
m_bFirst = false; m_bFirst = false;
oNewParam.nType = RENDER_TO_OOX_PARAM_FIRST_SECTION; oNewParam.nType = RENDER_TO_OOX_PARAM_FIRST_SECTION;
} }
sRtf = m_oDocument[0]->m_oProperty.RenderToRtf(oNewParam); sRtf = m_oDocument[0].props->m_oProperty.RenderToRtf(oNewParam);
RtfUtility::RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileSectWriter ); RtfUtility::RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileSectWriter );
//дописываем в файл //дописываем в файл
RELEASEOBJECT( m_oCurTempFileSectWriter ); RELEASEOBJECT( m_oCurTempFileSectWriter );
...@@ -143,11 +143,14 @@ bool RtfWriter::SaveByItem() ...@@ -143,11 +143,14 @@ bool RtfWriter::SaveByItem()
m_oDocument.RemoveItem( 0 ); m_oDocument.RemoveItem( 0 );
} }
//пишем параграф //пишем параграф
if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 ) if( m_oDocument.GetCount() > 0 && m_oDocument[0].props->GetCount() > 0 )
{ {
CString sRtf; CString sRtf;
sRtf = m_oDocument[0]->operator[](0)->RenderToRtf(oNewParam); sRtf = m_oDocument[0].props->operator[](0)->RenderToRtf(oNewParam);
if( TYPE_RTF_PARAGRAPH == m_oDocument[0]->operator[](0)->GetType() && !(m_oDocument[0]->GetCount() == 0 && m_oDocument.GetCount() > 1) )//для последнего параграфа секции не пишем \par
if( TYPE_RTF_PARAGRAPH == m_oDocument[0].props->operator[](0)->GetType()
&& !( m_oDocument[0].props->GetCount() == 0
&& m_oDocument.GetCount() > 1) )//для последнего параграфа секции не пишем \par
{ {
sRtf += _T("\\par"); sRtf += _T("\\par");
//oNewParam.nValue = RENDER_TO_RTF_PARAM_NO_PAR; //oNewParam.nValue = RENDER_TO_RTF_PARAM_NO_PAR;
...@@ -156,7 +159,7 @@ bool RtfWriter::SaveByItem() ...@@ -156,7 +159,7 @@ bool RtfWriter::SaveByItem()
//m_oTempFileWriter->Write( (BYTE*)(LPCSTR)sRtf, sRtf.GetLength() ); //m_oTempFileWriter->Write( (BYTE*)(LPCSTR)sRtf, sRtf.GetLength() );
//удаляем элемент который только что написали //удаляем элемент который только что написали
m_oDocument[0]->RemoveItem( 0 ); m_oDocument[0].props->RemoveItem( 0 );
} }
return true; return true;
} }
...@@ -182,7 +185,7 @@ bool RtfWriter::SaveByItemEnd() ...@@ -182,7 +185,7 @@ bool RtfWriter::SaveByItemEnd()
m_bFirst = false; m_bFirst = false;
oNewParam.nType = RENDER_TO_OOX_PARAM_FIRST_SECTION; oNewParam.nType = RENDER_TO_OOX_PARAM_FIRST_SECTION;
} }
sRtf = m_oDocument[0]->m_oProperty.RenderToRtf(oNewParam); sRtf = m_oDocument[0].props->m_oProperty.RenderToRtf(oNewParam);
RtfUtility::RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileSectWriter ); RtfUtility::RtfInternalEncoder::Decode( sRtf, *m_oCurTempFileSectWriter );
//дописываем в файл //дописываем в файл
RELEASEOBJECT( m_oCurTempFileSectWriter ); RELEASEOBJECT( m_oCurTempFileSectWriter );
...@@ -265,7 +268,7 @@ int RtfWriter::GetCount() ...@@ -265,7 +268,7 @@ int RtfWriter::GetCount()
{ {
int nCount = 0; int nCount = 0;
for( int i = 0; i < m_oDocument.GetCount(); i++ ) for( int i = 0; i < m_oDocument.GetCount(); i++ )
nCount += m_oDocument[i]->GetCount(); nCount += m_oDocument[i].props->GetCount();
return nCount; return nCount;
} }
CString RtfWriter::CreateRtfStart() CString RtfWriter::CreateRtfStart()
......
...@@ -179,7 +179,8 @@ CString OOXDocumentWriter::CreateXmlEnd( ) ...@@ -179,7 +179,8 @@ CString OOXDocumentWriter::CreateXmlEnd( )
oNewParam.poWriter = &m_oWriter; oNewParam.poWriter = &m_oWriter;
oNewParam.poRels = &m_oWriter.m_oDocRels; oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
sResult += m_oDocument[0]->m_oProperty.RenderToOOX(oNewParam);
sResult += m_oDocument[0].props->m_oProperty.RenderToOOX(oNewParam);
sResult += _T("</w:body>"); sResult += _T("</w:body>");
sResult += _T("</w:document>"); sResult += _T("</w:document>");
...@@ -222,12 +223,12 @@ bool OOXDocumentWriter::SaveByItem() ...@@ -222,12 +223,12 @@ bool OOXDocumentWriter::SaveByItem()
oNewParam.poRels = &m_oWriter.m_oDocRels; oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
if( m_oDocument.GetCount() > 1)//если что-то есть в следующей секции значит предудущая закончилась if( m_oDocument.GetCount() > 1)//если что-то есть в следующей секции значит предыдущая закончилась
{ {
if( m_oDocument[1]->GetCount() > 0 ) if( m_oDocument[1].props->GetCount() > 0 )
{ {
CString sSectPr = m_oDocument[0]->m_oProperty.RenderToOOX(oNewParam); CString sSectPr = m_oDocument[0].props->m_oProperty.RenderToOOX(oNewParam);
CString sXml = m_oDocument[1]->operator[](0)->RenderToOOX(oNewParam); CString sXml = m_oDocument[1].props->operator[](0)->RenderToOOX(oNewParam);
int nIndexP = sXml.Find( _T("<w:p>") ); int nIndexP = sXml.Find( _T("<w:p>") );
...@@ -253,13 +254,13 @@ bool OOXDocumentWriter::SaveByItem() ...@@ -253,13 +254,13 @@ bool OOXDocumentWriter::SaveByItem()
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length()); m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
m_oDocument[1]->RemoveItem( 0 ); //удаляем первый параграф m_oDocument[1].props->RemoveItem( 0 ); //удаляем первый параграф
m_oDocument.RemoveItem( 0 ); //удаляем секцию m_oDocument.RemoveItem( 0 ); //удаляем секцию
} }
} }
else if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )//пишем параграф else if( m_oDocument.GetCount() > 0 && m_oDocument[0].props->GetCount() > 0 )//пишем параграф
{ {
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam); CString sXml = m_oDocument[0].props->operator[](0)->RenderToOOX(oNewParam);
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer()); std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
if (m_oFileWriter) if (m_oFileWriter)
...@@ -272,7 +273,7 @@ bool OOXDocumentWriter::SaveByItem() ...@@ -272,7 +273,7 @@ bool OOXDocumentWriter::SaveByItem()
m_oFileWriter = NULL; m_oFileWriter = NULL;
} }
m_oDocument[0]->RemoveItem( 0 );//удаляем первый параграф m_oDocument[0].props->RemoveItem( 0 );//удаляем первый параграф
} }
} }
return true; return true;
...@@ -285,11 +286,11 @@ bool OOXDocumentWriter::SaveByItemEnd() ...@@ -285,11 +286,11 @@ bool OOXDocumentWriter::SaveByItemEnd()
oNewParam.poRels = &m_oWriter.m_oDocRels; oNewParam.poRels = &m_oWriter.m_oDocRels;
oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN; oNewParam.nType = RENDER_TO_OOX_PARAM_UNKNOWN;
if( m_oDocument.GetCount() > 0 && m_oDocument[0]->GetCount() > 0 )//дописываем последний параграф if( m_oDocument.GetCount() > 0 && m_oDocument[0].props->GetCount() > 0 )//дописываем последний параграф
{ {
CString sXml = m_oDocument[0]->operator[](0)->RenderToOOX(oNewParam); CString sXml = m_oDocument[0].props->operator[](0)->RenderToOOX(oNewParam);
//удаляем первый параграф //удаляем первый параграф
m_oDocument[0]->RemoveItem( 0 ); m_oDocument[0].props->RemoveItem( 0 );
std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer()); std::string sXmlUTF = NSFile::CUtf8Converter::GetUtf8StringFromUnicode(sXml.GetBuffer());
m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length()); m_oFileWriter->Write((BYTE*)sXmlUTF.c_str(), sXmlUTF.length());
......
...@@ -64,7 +64,7 @@ public: ...@@ -64,7 +64,7 @@ public:
{ {
int nCount = 0; int nCount = 0;
for( int i = 0; i < m_oDocument.GetCount(); i++ ) for( int i = 0; i < m_oDocument.GetCount(); i++ )
nCount += m_oDocument[i]->GetCount(); nCount += m_oDocument[i].props->GetCount();
return nCount; return nCount;
} }
}; };
...@@ -343,6 +343,10 @@ ...@@ -343,6 +343,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File
RelativePath="..\..\..\ASCOfficeDocxFile2\BinWriter\BinWriters.cpp"
>
</File>
<File <File
RelativePath="..\..\..\XlsxSerializerCom\Reader\ChartFromToBinary.cpp" RelativePath="..\..\..\XlsxSerializerCom\Reader\ChartFromToBinary.cpp"
> >
......
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