Commit 69635071 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander Trofimov

Bug 26730 - Autosave: Пропадает выделение комментария в колонтитуле после сборки версии.

Bug 26166 - [Conversion] Теряется комментарий в автофигуре после конвертации в DOCX.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@59230 954022d7-b5bf-4e40-9824-e11837661b57
parent cb19b649
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
#include "CommentsWriter.h" #include "CommentsWriter.h"
#include "ChartWriter.h" #include "ChartWriter.h"
namespace BinDocxRW {
class CComments;
}
namespace Writers namespace Writers
{ {
class FileWriter class FileWriter
...@@ -30,6 +33,7 @@ namespace Writers ...@@ -30,6 +33,7 @@ namespace Writers
CommentsWriter m_oCommentsWriter; CommentsWriter m_oCommentsWriter;
ChartWriter m_oChartWriter; ChartWriter m_oChartWriter;
int m_nDocPrIndex; int m_nDocPrIndex;
BinDocxRW::CComments* m_pComments;
public: public:
FileWriter(CString sDirOutput,CString sFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, CString sThemePath): FileWriter(CString sDirOutput,CString sFontDir, int nVersion, bool bSaveChartAsImg, NSBinPptxRW::CDrawingConverter* pDrawingConverter, CString sThemePath):
m_pDrawingConverter(pDrawingConverter),m_sThemePath(sThemePath),m_bSaveChartAsImg(bSaveChartAsImg), m_pDrawingConverter(pDrawingConverter),m_sThemePath(sThemePath),m_bSaveChartAsImg(bSaveChartAsImg),
...@@ -42,7 +46,8 @@ namespace Writers ...@@ -42,7 +46,8 @@ namespace Writers
m_oSettingWriter(sDirOutput, m_oHeaderFooterWriter), m_oSettingWriter(sDirOutput, m_oHeaderFooterWriter),
m_oCommentsWriter(sDirOutput, m_oContentTypesWriter), m_oCommentsWriter(sDirOutput, m_oContentTypesWriter),
m_oChartWriter(sDirOutput, m_oContentTypesWriter), m_oChartWriter(sDirOutput, m_oContentTypesWriter),
m_nDocPrIndex(0) m_nDocPrIndex(0),
m_pComments(NULL)
{ {
} }
public: int getNextDocPr() public: int getNextDocPr()
......
...@@ -186,10 +186,11 @@ class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableRe ...@@ -186,10 +186,11 @@ class Binary_HdrFtrTableReader : public Binary_CommonReader<Binary_HdrFtrTableRe
Writers::FileWriter& m_oFileWriter; Writers::FileWriter& m_oFileWriter;
int nCurType; int nCurType;
int nCurHeaderType; int nCurHeaderType;
CComments* m_pComments;
public: public:
Writers::HeaderFooterWriter& m_oHeaderFooterWriter; Writers::HeaderFooterWriter& m_oHeaderFooterWriter;
public: public:
Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter); Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments);
int Read(); int Read();
int ReadHdrFtrContent(BYTE type, long length, void* poResult); int ReadHdrFtrContent(BYTE type, long length, void* poResult);
int ReadHdrFtrFEO(BYTE type, long length, void* poResult); int ReadHdrFtrFEO(BYTE type, long length, void* poResult);
...@@ -456,7 +457,7 @@ public: ...@@ -456,7 +457,7 @@ public:
long m_nCurLvl; long m_nCurLvl;
Binary_pPrReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter): Binary_pPrReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter):
m_oFontTableWriter(oFileWriter.m_oFontTableWriter),Binary_CommonReader(poBufferedStream),oBinary_CommonReader2(poBufferedStream),oBinary_rPrReader(poBufferedStream),oBinary_HdrFtrTableReader(poBufferedStream,oFileWriter),m_oFileWriter(oFileWriter) m_oFontTableWriter(oFileWriter.m_oFontTableWriter),Binary_CommonReader(poBufferedStream),oBinary_CommonReader2(poBufferedStream),oBinary_rPrReader(poBufferedStream),oBinary_HdrFtrTableReader(poBufferedStream,oFileWriter, oFileWriter.m_pComments),m_oFileWriter(oFileWriter)
{ {
bDoNotWriteNullProp = false; bDoNotWriteNullProp = false;
m_nCurNumId = -1; m_nCurNumId = -1;
...@@ -5884,7 +5885,7 @@ public: ...@@ -5884,7 +5885,7 @@ public:
return oBinary_pPrReader.Read_SecPr(type, length, poResult); return oBinary_pPrReader.Read_SecPr(type, length, poResult);
} }
}; };
Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter):Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_oHeaderFooterWriter(oFileWriter.m_oHeaderFooterWriter) Binary_HdrFtrTableReader::Binary_HdrFtrTableReader(NSBinPptxRW::CBinaryFileReader& poBufferedStream, Writers::FileWriter& oFileWriter, CComments* pComments):Binary_CommonReader(poBufferedStream),m_oFileWriter(oFileWriter),m_oHeaderFooterWriter(oFileWriter.m_oHeaderFooterWriter),m_pComments(pComments)
{ {
} }
int Binary_HdrFtrTableReader::Read() int Binary_HdrFtrTableReader::Read()
...@@ -5940,7 +5941,7 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes ...@@ -5940,7 +5941,7 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes
poHdrFtrItem->m_sFilename.Format(_T("footer%d.xml"), m_oHeaderFooterWriter.m_aFooters.size()); poHdrFtrItem->m_sFilename.Format(_T("footer%d.xml"), m_oHeaderFooterWriter.m_aFooters.size());
} }
m_oFileWriter.m_pDrawingConverter->SetDstContentRels(); m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, NULL); Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, m_pComments);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader); res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader);
CString sRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + _T("\\word\\_rels\\") + poHdrFtrItem->m_sFilename + _T(".rels"); CString sRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + _T("\\word\\_rels\\") + poHdrFtrItem->m_sFilename + _T(".rels");
...@@ -6009,6 +6010,10 @@ public: BinaryFileReader(CString& sFileInDir, NSBinPptxRW::CBinaryFileReader& oB ...@@ -6009,6 +6010,10 @@ public: BinaryFileReader(CString& sFileInDir, NSBinPptxRW::CBinaryFileReader& oB
{ {
nDocumentOffset = mtiOffBits; nDocumentOffset = mtiOffBits;
} }
else if(c_oSerTableTypes::Comments == mtiType)
{
nCommentsOffset = mtiOffBits;
}
else else
{ {
aTypes.push_back(mtiType); aTypes.push_back(mtiType);
...@@ -6039,16 +6044,17 @@ public: BinaryFileReader(CString& sFileInDir, NSBinPptxRW::CBinaryFileReader& oB ...@@ -6039,16 +6044,17 @@ public: BinaryFileReader(CString& sFileInDir, NSBinPptxRW::CBinaryFileReader& oB
m_oFileWriter.m_pDrawingConverter->LoadClrMap(sClrMap); m_oFileWriter.m_pDrawingConverter->LoadClrMap(sClrMap);
} }
BinaryStyleTableReader oBinaryStyleTableReader(m_oBufferedStream, m_oFileWriter); Binary_CommentsTableReader oBinary_CommentsTableReader(m_oBufferedStream, m_oFileWriter);
if(-1 != nStyleOffset) if(-1 != nCommentsOffset)
{ {
int nOldPos = m_oBufferedStream.GetPos(); int nOldPos = m_oBufferedStream.GetPos();
m_oBufferedStream.Seek(nStyleOffset); m_oBufferedStream.Seek(nCommentsOffset);
res = oBinaryStyleTableReader.Read(); res = oBinary_CommentsTableReader.Read();
m_oFileWriter.m_pComments = &oBinary_CommentsTableReader.m_oComments;
if(c_oSerConstants::ReadOk != res) if(c_oSerConstants::ReadOk != res)
return res; return res;
} }
Binary_CommentsTableReader oBinary_CommentsTableReader(m_oBufferedStream, m_oFileWriter);
for(int i = 0, length = aTypes.size(); i < length; ++i) for(int i = 0, length = aTypes.size(); i < length; ++i)
{ {
BYTE mtiType = aTypes[i]; BYTE mtiType = aTypes[i];
...@@ -6066,15 +6072,15 @@ public: BinaryFileReader(CString& sFileInDir, NSBinPptxRW::CBinaryFileReader& oB ...@@ -6066,15 +6072,15 @@ public: BinaryFileReader(CString& sFileInDir, NSBinPptxRW::CBinaryFileReader& oB
// res = Binary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_oDocumentWriter).Read(); // res = Binary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_oDocumentWriter).Read();
// break; // break;
case c_oSerTableTypes::HdrFtr: case c_oSerTableTypes::HdrFtr:
res = Binary_HdrFtrTableReader(m_oBufferedStream, m_oFileWriter).Read(); res = Binary_HdrFtrTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_pComments).Read();
break; break;
case c_oSerTableTypes::Numbering: case c_oSerTableTypes::Numbering:
res = Binary_NumberingTableReader(m_oBufferedStream, m_oFileWriter).Read(); res = Binary_NumberingTableReader(m_oBufferedStream, m_oFileWriter).Read();
break; break;
//Comments c_oSerTableTypes::Document //Comments c_oSerTableTypes::Document
case c_oSerTableTypes::Comments: //case c_oSerTableTypes::Comments:
res = oBinary_CommentsTableReader.Read(); // res = oBinary_CommentsTableReader.Read();
break; // break;
//case c_oSerTableTypes::Other: //case c_oSerTableTypes::Other:
// res = Binary_OtherTableReader(m_sFileInDir, m_oBufferedStream, m_oFileWriter).Read(); // res = Binary_OtherTableReader(m_sFileInDir, m_oBufferedStream, m_oFileWriter).Read();
// break; // break;
......
...@@ -14,8 +14,8 @@ namespace BinDocxRW ...@@ -14,8 +14,8 @@ namespace BinDocxRW
{ {
class ParamsWriter { class ParamsWriter {
public: public:
NSBinPptxRW::CBinaryFileWriter& m_oCBufferedStream; NSBinPptxRW::CBinaryFileWriter* m_pCBufferedStream;
DocWrapper::FontProcessor& m_oFontProcessor; DocWrapper::FontProcessor* m_pFontProcessor;
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter; NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager; NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager;
...@@ -24,9 +24,13 @@ namespace BinDocxRW ...@@ -24,9 +24,13 @@ namespace BinDocxRW
OOX::IFileContainer* m_pCurRels; OOX::IFileContainer* m_pCurRels;
CString m_sCurDocumentPath; CString m_sCurDocumentPath;
public: ParamsWriter(NSBinPptxRW::CBinaryFileWriter& oCBufferedStream, DocWrapper::FontProcessor& oFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager): std::map<int, bool> m_mapIgnoreComments;
m_oCBufferedStream(oCBufferedStream),m_oFontProcessor(oFontProcessor),m_pOfficeDrawingConverter(pOfficeDrawingConverter),m_pEmbeddedFontsManager(pEmbeddedFontsManager) public: ParamsWriter(NSBinPptxRW::CBinaryFileWriter* pCBufferedStream, DocWrapper::FontProcessor* pFontProcessor, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):
m_pCBufferedStream(pCBufferedStream),m_pFontProcessor(pFontProcessor),m_pOfficeDrawingConverter(pOfficeDrawingConverter),m_pEmbeddedFontsManager(pEmbeddedFontsManager)
{ {
m_oSettings = NULL;
m_poTheme = NULL;
m_pCurRels = NULL;
} }
}; };
class ParamsDocumentWriter { class ParamsDocumentWriter {
...@@ -54,7 +58,7 @@ namespace BinDocxRW ...@@ -54,7 +58,7 @@ namespace BinDocxRW
public: public:
NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager; NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager;
NSBinPptxRW::CBinaryFileWriter &m_oStream; NSBinPptxRW::CBinaryFileWriter &m_oStream;
BinaryCommonWriter(ParamsWriter& oParamsWriter):m_oStream(oParamsWriter.m_oCBufferedStream),m_pEmbeddedFontsManager(oParamsWriter.m_pEmbeddedFontsManager) BinaryCommonWriter(ParamsWriter& oParamsWriter):m_oStream(*oParamsWriter.m_pCBufferedStream),m_pEmbeddedFontsManager(oParamsWriter.m_pEmbeddedFontsManager)
{ {
} }
int WriteItemStart(BYTE type) int WriteItemStart(BYTE type)
...@@ -403,6 +407,7 @@ namespace BinDocxRW ...@@ -403,6 +407,7 @@ namespace BinDocxRW
OOX::CTheme* m_poTheme; OOX::CTheme* m_poTheme;
DocWrapper::FontProcessor& m_oFontProcessor; DocWrapper::FontProcessor& m_oFontProcessor;
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter; NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
std::map<int, bool>* m_mapIgnoreComments;
public: public:
OOX::IFileContainer* m_oDocumentRels; OOX::IFileContainer* m_oDocumentRels;
std::vector<OOX::CHdrFtr*> m_aHeaders; std::vector<OOX::CHdrFtr*> m_aHeaders;
...@@ -412,7 +417,7 @@ namespace BinDocxRW ...@@ -412,7 +417,7 @@ namespace BinDocxRW
std::vector<SimpleTypes::EHdrFtr> m_aFooterTypes; std::vector<SimpleTypes::EHdrFtr> m_aFooterTypes;
std::vector<OOX::Logic::CSectionProperty*> m_aFooterSectPrs; std::vector<OOX::Logic::CSectionProperty*> m_aFooterSectPrs;
public: public:
BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRels); BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRel, std::map<int, bool>* mapIgnoreComments);
void Write(); void Write();
void WriteHdrFtrContent(std::vector<OOX::CHdrFtr*>& aHdrFtrs, std::vector<SimpleTypes::EHdrFtr>& aHdrFtrTypes, std::vector<OOX::Logic::CSectionProperty*>& aHdrSectPrs, bool bHdr); void WriteHdrFtrContent(std::vector<OOX::CHdrFtr*>& aHdrFtrs, std::vector<SimpleTypes::EHdrFtr>& aHdrFtrTypes, std::vector<OOX::Logic::CSectionProperty*>& aHdrSectPrs, bool bHdr);
void WriteHdrFtrItem(OOX::Logic::CSectionProperty* pSectPr, OOX::CHdrFtr* pHdrFtr, bool bHdr); void WriteHdrFtrItem(OOX::Logic::CSectionProperty* pSectPr, OOX::CHdrFtr* pHdrFtr, bool bHdr);
...@@ -439,7 +444,7 @@ namespace BinDocxRW ...@@ -439,7 +444,7 @@ namespace BinDocxRW
OOX::CTheme* m_poTheme; OOX::CTheme* m_poTheme;
public: public:
DocWrapper::FontProcessor& m_oFontProcessor; DocWrapper::FontProcessor& m_oFontProcessor;
public: Binary_rPrWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter),m_poTheme(oParamsWriter.m_poTheme),m_oFontProcessor(oParamsWriter.m_oFontProcessor) public: Binary_rPrWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter),m_poTheme(oParamsWriter.m_poTheme),m_oFontProcessor(*oParamsWriter.m_pFontProcessor)
{ {
} }
void Write_rPr(const OOX::Logic::CRunProperty& rPr) void Write_rPr(const OOX::Logic::CRunProperty& rPr)
...@@ -5574,8 +5579,8 @@ namespace BinDocxRW ...@@ -5574,8 +5579,8 @@ namespace BinDocxRW
RELEASEOBJECT(pTcPr); RELEASEOBJECT(pTcPr);
}; };
}; };
BinaryHeaderFooterTableWriter::BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRels): BinaryHeaderFooterTableWriter::BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRels, std::map<int, bool>* mapIgnoreComments):
m_oBcw(oParamsWriter), m_oParamsWriter(oParamsWriter), m_poTheme(oParamsWriter.m_poTheme), m_oFontProcessor(oParamsWriter.m_oFontProcessor), m_oSettings(oParamsWriter.m_oSettings),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter), m_oDocumentRels(oDocumentRels) m_oBcw(oParamsWriter), m_oParamsWriter(oParamsWriter), m_poTheme(oParamsWriter.m_poTheme), m_oFontProcessor(*oParamsWriter.m_pFontProcessor), m_oSettings(oParamsWriter.m_oSettings),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter), m_oDocumentRels(oDocumentRels),m_mapIgnoreComments(mapIgnoreComments)
{ {
}; };
void BinaryHeaderFooterTableWriter::Write() void BinaryHeaderFooterTableWriter::Write()
...@@ -5625,7 +5630,7 @@ namespace BinDocxRW ...@@ -5625,7 +5630,7 @@ namespace BinDocxRW
ParamsDocumentWriter oParamsDocumentWriter(pHdrFtr, pHdrFtr->m_oReadPath.GetPath()); ParamsDocumentWriter oParamsDocumentWriter(pHdrFtr, pHdrFtr->m_oReadPath.GetPath());
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels; m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath; m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, NULL, NULL); BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, m_mapIgnoreComments, NULL);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, pHdrFtr->m_arrShapeTypes); oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, pHdrFtr->m_arrShapeTypes);
nCurPos = m_oBcw.WriteItemStart(c_oSerHdrFtrTypes::HdrFtr_Content); nCurPos = m_oBcw.WriteItemStart(c_oSerHdrFtrTypes::HdrFtr_Content);
oBinaryDocumentTableWriter.WriteDocumentContent(pHdrFtr->m_arrItems); oBinaryDocumentTableWriter.WriteDocumentContent(pHdrFtr->m_arrItems);
...@@ -6216,7 +6221,7 @@ namespace BinDocxRW ...@@ -6216,7 +6221,7 @@ namespace BinDocxRW
m_oParamsWriter.m_oSettings = oDocx.GetSettings(); m_oParamsWriter.m_oSettings = oDocx.GetSettings();
OOX::CFontTable* pFontTable = oDocx.GetFontTable(); OOX::CFontTable* pFontTable = oDocx.GetFontTable();
if(NULL != pFontTable) if(NULL != pFontTable)
m_oParamsWriter.m_oFontProcessor.setFontTable(pFontTable); m_oParamsWriter.m_pFontProcessor->setFontTable(pFontTable);
// SectPr pageBreak // SectPr pageBreak
OOX::CDocument* poDocument = oDocx.GetDocument(); OOX::CDocument* poDocument = oDocx.GetDocument();
...@@ -6242,7 +6247,6 @@ namespace BinDocxRW ...@@ -6242,7 +6247,6 @@ namespace BinDocxRW
} }
//Write Comments //Write Comments
std::map<int, bool> mapIgnoreComments;
OOX::CComments* pComments = oDocx.GetComments(); OOX::CComments* pComments = oDocx.GetComments();
OOX::CCommentsExt* pCommentsExt = oDocx.GetCommentsExt(); OOX::CCommentsExt* pCommentsExt = oDocx.GetCommentsExt();
OOX::CPeople* pPeople = oDocx.GetPeople(); OOX::CPeople* pPeople = oDocx.GetPeople();
...@@ -6250,7 +6254,7 @@ namespace BinDocxRW ...@@ -6250,7 +6254,7 @@ namespace BinDocxRW
{ {
BinDocxRW::BinaryCommentsTableWriter oBinaryCommentsTableWriter(m_oParamsWriter); BinDocxRW::BinaryCommentsTableWriter oBinaryCommentsTableWriter(m_oParamsWriter);
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Comments); int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Comments);
oBinaryCommentsTableWriter.Write(*pComments, pCommentsExt, pPeople, mapIgnoreComments); oBinaryCommentsTableWriter.Write(*pComments, pCommentsExt, pPeople, m_oParamsWriter.m_mapIgnoreComments);
this->WriteTableEnd(nCurPos); this->WriteTableEnd(nCurPos);
} }
...@@ -6273,7 +6277,7 @@ namespace BinDocxRW ...@@ -6273,7 +6277,7 @@ namespace BinDocxRW
this->WriteTableEnd(nCurPos); this->WriteTableEnd(nCurPos);
} }
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, poDocument); BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, poDocument, &m_oParamsWriter.m_mapIgnoreComments);
//Write DocumentTable //Write DocumentTable
ParamsDocumentWriter oParamsDocumentWriter(poDocument, poDocument->m_oReadPath.GetPath()); ParamsDocumentWriter oParamsDocumentWriter(poDocument, poDocument->m_oReadPath.GetPath());
...@@ -6282,7 +6286,7 @@ namespace BinDocxRW ...@@ -6282,7 +6286,7 @@ namespace BinDocxRW
//DocumentTable , , , Style_Add... //DocumentTable , , , Style_Add...
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document); nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &mapIgnoreComments, &oBinaryHeaderFooterTableWriter); BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &m_oParamsWriter.m_mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, poDocument->m_arrShapeTypes); oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_oParamsWriter.m_pOfficeDrawingConverter, oParamsDocumentWriter.m_sDocumentPath, poDocument->m_arrShapeTypes);
oBinaryDocumentTableWriter.pSectPr = pFirstSectPr; oBinaryDocumentTableWriter.pSectPr = pFirstSectPr;
oBinaryDocumentTableWriter.m_bWriteSectPr = true; oBinaryDocumentTableWriter.m_bWriteSectPr = true;
......
...@@ -83,7 +83,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const C ...@@ -83,7 +83,7 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const C
oDrawingConverter.SetFontPicker(pFontPicker); oDrawingConverter.SetFontPicker(pFontPicker);
oDrawingConverter.SetMainDocument(this); oDrawingConverter.SetMainDocument(this);
oDrawingConverter.SetMediaDstPath(mediaDir); oDrawingConverter.SetMediaDstPath(mediaDir);
ParamsWriter oParamsWriter(oBufferedStream, fp, &oDrawingConverter, pEmbeddedFontsManager); ParamsWriter oParamsWriter(&oBufferedStream, &fp, &oDrawingConverter, pEmbeddedFontsManager);
m_oBinaryFileWriter = new BinaryFileWriter(oParamsWriter); m_oBinaryFileWriter = new BinaryFileWriter(oParamsWriter);
m_oBinaryFileWriter->intoBindoc(sDstPath); m_oBinaryFileWriter->intoBindoc(sDstPath);
BYTE* pbBinBuffer = oBufferedStream.GetBuffer(); BYTE* pbBinBuffer = oBufferedStream.GetBuffer();
...@@ -241,7 +241,7 @@ bool BinDocxRW::CDocxSerializer::getXmlContent(NSBinPptxRW::CBinaryFileReader& o ...@@ -241,7 +241,7 @@ bool BinDocxRW::CDocxSerializer::getXmlContent(NSBinPptxRW::CBinaryFileReader& o
{ {
long nLength = oBufferedStream.GetLong(); long nLength = oBufferedStream.GetLong();
Writers::ContentWriter oTempContentWriter; Writers::ContentWriter oTempContentWriter;
BinDocxRW::Binary_DocumentTableReader oBinary_DocumentTableReader(oBufferedStream, *m_pCurFileWriter, oTempContentWriter, NULL); BinDocxRW::Binary_DocumentTableReader oBinary_DocumentTableReader(oBufferedStream, *m_pCurFileWriter, oTempContentWriter, m_pCurFileWriter->m_pComments);
int res = oBinary_DocumentTableReader.Read1(nLength, &BinDocxRW::Binary_DocumentTableReader::ReadDocumentContent, &oBinary_DocumentTableReader, NULL); int res = oBinary_DocumentTableReader.Read1(nLength, &BinDocxRW::Binary_DocumentTableReader::ReadDocumentContent, &oBinary_DocumentTableReader, NULL);
sOutputXml = oTempContentWriter.m_oContent.GetData().GetString(); sOutputXml = oTempContentWriter.m_oContent.GetData().GetString();
...@@ -262,20 +262,18 @@ bool BinDocxRW::CDocxSerializer::getBinaryContent(const CString& bsTxContent, NS ...@@ -262,20 +262,18 @@ bool BinDocxRW::CDocxSerializer::getBinaryContent(const CString& bsTxContent, NS
OOX::Logic::CSdtContent oSdtContent; OOX::Logic::CSdtContent oSdtContent;
oSdtContent.fromXML(oReader); oSdtContent.fromXML(oReader);
BinDocxRW::ParamsWriter oCurParamsWriter(m_oBinaryFileWriter->m_oParamsWriter); BinDocxRW::ParamsWriter& oParamsWriter = m_oBinaryFileWriter->m_oParamsWriter;
BinDocxRW::ParamsWriter oParamsWriter(oBufferedStream, oCurParamsWriter.m_oFontProcessor, oCurParamsWriter.m_pOfficeDrawingConverter, oCurParamsWriter.m_pEmbeddedFontsManager); NSBinPptxRW::CBinaryFileWriter* pBufferedStreamOld = oParamsWriter.m_pCBufferedStream;
oParamsWriter.m_poTheme = oCurParamsWriter.m_poTheme; oParamsWriter.m_pCBufferedStream = &oBufferedStream;
oParamsWriter.m_oSettings = oCurParamsWriter.m_oSettings;
oParamsWriter.m_pCurRels = oCurParamsWriter.m_pCurRels;
oParamsWriter.m_sCurDocumentPath = oCurParamsWriter.m_sCurDocumentPath;
BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oParamsWriter); BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oParamsWriter);
int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart(); int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart();
BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels, oParamsWriter.m_sCurDocumentPath); BinDocxRW::ParamsDocumentWriter oParams(oParamsWriter.m_pCurRels, oParamsWriter.m_sCurDocumentPath);
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oParamsWriter, oParams, NULL, NULL); BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oParamsWriter, oParams, &oParamsWriter.m_mapIgnoreComments, NULL);
oBinaryDocumentTableWriter.WriteDocumentContent(oSdtContent.m_arrItems); oBinaryDocumentTableWriter.WriteDocumentContent(oSdtContent.m_arrItems);
oBinaryCommonWriter.WriteItemWithLengthEnd(nCurPos); oBinaryCommonWriter.WriteItemWithLengthEnd(nCurPos);
oParamsWriter.m_pCBufferedStream = pBufferedStreamOld;
long nEndPos = oBufferedStream.GetPosition(); long nEndPos = oBufferedStream.GetPosition();
lDataSize = nEndPos - nStartPos; lDataSize = nEndPos - nStartPos;
return true; return true;
......
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