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

(2.0.0.172): ASCOfficeDocxFile2

Выключены формулы на открытие.При чтение chart не выставлялся путь к Rels.Проблемы с гиперссылками в автофигурах в колонтитулах.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@56883 954022d7-b5bf-4e40-9824-e11837661b57
parent e63e6595
...@@ -8,6 +8,32 @@ ...@@ -8,6 +8,32 @@
namespace BinDocxRW namespace BinDocxRW
{ {
class ParamsWriter {
public:
Streams::CBufferedStream& m_oCBufferedStream;
DocWrapper::FontProcessor& m_oFontProcessor;
PPTXFile::IAVSOfficeDrawingConverter* m_pOfficeDrawingConverter;
NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager;
OOX::CSettings* m_oSettings;
OOX::CTheme* m_poTheme;
OOX::IFileContainer* m_pCurRels;
CString m_sCurDocumentPath;
public: ParamsWriter(Streams::CBufferedStream& oCBufferedStream, DocWrapper::FontProcessor& oFontProcessor, PPTXFile::IAVSOfficeDrawingConverter* pOfficeDrawingConverter, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):
m_oCBufferedStream(oCBufferedStream),m_oFontProcessor(oFontProcessor),m_pOfficeDrawingConverter(pOfficeDrawingConverter),m_pEmbeddedFontsManager(pEmbeddedFontsManager)
{
}
};
class ParamsDocumentWriter {
public:
OOX::IFileContainer* m_pRels;
CString m_sDocumentPath;
public:
ParamsDocumentWriter(OOX::IFileContainer* pRels, CString& sDocumentPath):m_pRels(pRels), m_sDocumentPath(sDocumentPath)
{
}
};
class FldStruct{ class FldStruct{
protected: protected:
int m_nType; int m_nType;
...@@ -24,7 +50,7 @@ namespace BinDocxRW ...@@ -24,7 +50,7 @@ namespace BinDocxRW
public: public:
NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager; NSFontCutter::CEmbeddedFontsManager* m_pEmbeddedFontsManager;
Streams::CBufferedStream &m_oStream; Streams::CBufferedStream &m_oStream;
BinaryCommonWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):m_oStream(oCBufferedStream),m_pEmbeddedFontsManager(pEmbeddedFontsManager) BinaryCommonWriter(ParamsWriter& oParamsWriter):m_oStream(oParamsWriter.m_oCBufferedStream),m_pEmbeddedFontsManager(oParamsWriter.m_pEmbeddedFontsManager)
{ {
} }
int WriteItemStart(BYTE type) int WriteItemStart(BYTE type)
...@@ -372,6 +398,7 @@ namespace BinDocxRW ...@@ -372,6 +398,7 @@ namespace BinDocxRW
class BinaryHeaderFooterTableWriter class BinaryHeaderFooterTableWriter
{ {
BinaryCommonWriter m_oBcw; BinaryCommonWriter m_oBcw;
ParamsWriter& m_oParamsWriter;
OOX::CSettings* m_oSettings; OOX::CSettings* m_oSettings;
OOX::CTheme* m_poTheme; OOX::CTheme* m_poTheme;
DocWrapper::FontProcessor& m_oFontProcessor; DocWrapper::FontProcessor& m_oFontProcessor;
...@@ -385,7 +412,7 @@ namespace BinDocxRW ...@@ -385,7 +412,7 @@ namespace BinDocxRW
CAtlArray<SimpleTypes::EHdrFtr> m_aFooterTypes; CAtlArray<SimpleTypes::EHdrFtr> m_aFooterTypes;
CAtlArray<OOX::Logic::CSectionProperty*> m_aFooterSectPrs; CAtlArray<OOX::Logic::CSectionProperty*> m_aFooterSectPrs;
public: public:
BinaryHeaderFooterTableWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::CTheme* poTheme, DocWrapper::FontProcessor& oFontProcessor, OOX::CSettings* oSettings, PPTXFile::IAVSOfficeDrawingConverter* pOfficeDrawingConverter, OOX::IFileContainer* oDocumentRels); BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRels);
void Write(); void Write();
void WriteHdrFtrContent(CAtlArray<OOX::CHdrFtr*>& aHdrFtrs, CAtlArray<SimpleTypes::EHdrFtr>& aHdrFtrTypes, CAtlArray<OOX::Logic::CSectionProperty*>& aHdrSectPrs, bool bHdr); void WriteHdrFtrContent(CAtlArray<OOX::CHdrFtr*>& aHdrFtrs, CAtlArray<SimpleTypes::EHdrFtr>& aHdrFtrTypes, CAtlArray<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);
...@@ -394,7 +421,7 @@ namespace BinDocxRW ...@@ -394,7 +421,7 @@ namespace BinDocxRW
{ {
BinaryCommonWriter m_oBcw; BinaryCommonWriter m_oBcw;
public: public:
BinarySigTableWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):m_oBcw(oCBufferedStream, pEmbeddedFontsManager) BinarySigTableWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter)
{ {
} }
void Write() void Write()
...@@ -412,7 +439,7 @@ namespace BinDocxRW ...@@ -412,7 +439,7 @@ namespace BinDocxRW
OOX::CTheme* m_poTheme; OOX::CTheme* m_poTheme;
public: public:
DocWrapper::FontProcessor& m_oFontProcessor; DocWrapper::FontProcessor& m_oFontProcessor;
public: Binary_rPrWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::CTheme* poTheme, DocWrapper::FontProcessor& oFontProcessor):m_oBcw(oCBufferedStream, pEmbeddedFontsManager),m_poTheme(poTheme),m_oFontProcessor(oFontProcessor) public: Binary_rPrWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter),m_poTheme(oParamsWriter.m_poTheme),m_oFontProcessor(oParamsWriter.m_oFontProcessor)
{ {
} }
void Write_rPr(const OOX::Logic::CRunProperty& rPr) void Write_rPr(const OOX::Logic::CRunProperty& rPr)
...@@ -718,8 +745,8 @@ namespace BinDocxRW ...@@ -718,8 +745,8 @@ namespace BinDocxRW
OOX::CSettings* m_oSettings; OOX::CSettings* m_oSettings;
public: public:
BinaryHeaderFooterTableWriter* m_oBinaryHeaderFooterTableWriter; BinaryHeaderFooterTableWriter* m_oBinaryHeaderFooterTableWriter;
public: Binary_pPrWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::CTheme* poTheme, DocWrapper::FontProcessor& oFontProcessor, OOX::CSettings* oSettings, PPTXFile::IAVSOfficeDrawingConverter* pOfficeDrawingConverter, OOX::IFileContainer* oDocumentRels, BinaryHeaderFooterTableWriter* oBinaryHeaderFooterTableWriter): public: Binary_pPrWriter(ParamsWriter& oParamsWriter, BinaryHeaderFooterTableWriter* oBinaryHeaderFooterTableWriter):
m_oBcw(oCBufferedStream, pEmbeddedFontsManager),brPrs(oCBufferedStream, pEmbeddedFontsManager, poTheme, oFontProcessor),m_oSettings(oSettings),m_oBinaryHeaderFooterTableWriter(oBinaryHeaderFooterTableWriter) m_oBcw(oParamsWriter),brPrs(oParamsWriter),m_oSettings(oParamsWriter.m_oSettings),m_oBinaryHeaderFooterTableWriter(oBinaryHeaderFooterTableWriter)
{ {
} }
void Write_pPr(const OOX::Logic::CParagraphProperty& pPr) void Write_pPr(const OOX::Logic::CParagraphProperty& pPr)
...@@ -1328,7 +1355,7 @@ namespace BinDocxRW ...@@ -1328,7 +1355,7 @@ namespace BinDocxRW
{ {
BinaryCommonWriter m_oBcw; BinaryCommonWriter m_oBcw;
public: public:
public: Binary_tblPrWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):m_oBcw(oCBufferedStream, pEmbeddedFontsManager) public: Binary_tblPrWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter)
{ {
} }
void WriteTblPr(OOX::Logic::CTableProperty* p_tblPr) void WriteTblPr(OOX::Logic::CTableProperty* p_tblPr)
...@@ -1763,8 +1790,8 @@ namespace BinDocxRW ...@@ -1763,8 +1790,8 @@ namespace BinDocxRW
Binary_tblPrWriter btblPrs; Binary_tblPrWriter btblPrs;
int m_nReaderGenName; int m_nReaderGenName;
public: public:
BinaryStyleTableWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::CTheme* poTheme, DocWrapper::FontProcessor& oFontProcessor, OOX::CSettings* oSettings, PPTXFile::IAVSOfficeDrawingConverter* pOfficeDrawingConverter): BinaryStyleTableWriter(ParamsWriter& oParamsWriter):
m_oBcw(oCBufferedStream, pEmbeddedFontsManager),bpPrs(oCBufferedStream, pEmbeddedFontsManager, poTheme, oFontProcessor, oSettings, pOfficeDrawingConverter, NULL, NULL),brPrs(oCBufferedStream, pEmbeddedFontsManager, poTheme, oFontProcessor),btblPrs(oCBufferedStream, pEmbeddedFontsManager) m_oBcw(oParamsWriter),bpPrs(oParamsWriter, NULL),brPrs(oParamsWriter),btblPrs(oParamsWriter)
{ {
m_nReaderGenName = 0; m_nReaderGenName = 0;
}; };
...@@ -2030,8 +2057,8 @@ namespace BinDocxRW ...@@ -2030,8 +2057,8 @@ namespace BinDocxRW
Binary_pPrWriter bpPrs; Binary_pPrWriter bpPrs;
Binary_rPrWriter brPrs; Binary_rPrWriter brPrs;
public: public:
BinaryNumberingTableWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::CTheme* poTheme, DocWrapper::FontProcessor& oFontProcessor, OOX::CSettings* oSettings, PPTXFile::IAVSOfficeDrawingConverter* pOfficeDrawingConverter): BinaryNumberingTableWriter(ParamsWriter& oParamsWriter):
m_oBcw(oCBufferedStream, pEmbeddedFontsManager),bpPrs(oCBufferedStream, pEmbeddedFontsManager, poTheme, oFontProcessor, oSettings, pOfficeDrawingConverter, NULL, NULL),brPrs(oCBufferedStream, pEmbeddedFontsManager, poTheme, oFontProcessor) m_oBcw(oParamsWriter),bpPrs(oParamsWriter, NULL),brPrs(oParamsWriter)
{ {
}; };
void Write(const OOX::CNumbering& numbering) void Write(const OOX::CNumbering& numbering)
...@@ -2338,7 +2365,7 @@ namespace BinDocxRW ...@@ -2338,7 +2365,7 @@ namespace BinDocxRW
BinaryCommonWriter m_oBcw; BinaryCommonWriter m_oBcw;
LPSAFEARRAY m_pTheme; LPSAFEARRAY m_pTheme;
public: public:
BinaryOtherTableWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, LPSAFEARRAY pTheme):m_oBcw(oCBufferedStream, pEmbeddedFontsManager),m_pTheme(pTheme) BinaryOtherTableWriter(ParamsWriter& oParamsWriter, LPSAFEARRAY pTheme):m_oBcw(oParamsWriter),m_pTheme(pTheme)
{ {
}; };
void Write() void Write()
...@@ -2389,6 +2416,8 @@ namespace BinDocxRW ...@@ -2389,6 +2416,8 @@ namespace BinDocxRW
}; };
class BinaryDocumentTableWriter class BinaryDocumentTableWriter
{ {
ParamsWriter& m_oParamsWriter;
ParamsDocumentWriter& m_oParamsDocumentWriter;
BinaryCommonWriter m_oBcw; BinaryCommonWriter m_oBcw;
Binary_pPrWriter bpPrs; Binary_pPrWriter bpPrs;
Binary_rPrWriter brPrs; Binary_rPrWriter brPrs;
...@@ -2401,7 +2430,6 @@ namespace BinDocxRW ...@@ -2401,7 +2430,6 @@ namespace BinDocxRW
int m_nSkipFldChar; int m_nSkipFldChar;
CString m_sFldChar; CString m_sFldChar;
SimpleTypes::EFldCharType m_eFldState; SimpleTypes::EFldCharType m_eFldState;
OOX::IFileContainer* m_oDocumentRels;
PPTXFile::IAVSOfficeDrawingConverter* m_pOfficeDrawingConverter; PPTXFile::IAVSOfficeDrawingConverter* m_pOfficeDrawingConverter;
CAtlMap<int, bool>* m_mapIgnoreComments; CAtlMap<int, bool>* m_mapIgnoreComments;
public: public:
...@@ -2409,8 +2437,8 @@ namespace BinDocxRW ...@@ -2409,8 +2437,8 @@ namespace BinDocxRW
OOX::Logic::CSectionProperty* pSectPr; OOX::Logic::CSectionProperty* pSectPr;
bool m_bWriteSectPr;// BinaryOtherTableWriter bool m_bWriteSectPr;// BinaryOtherTableWriter
public: public:
BinaryDocumentTableWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::CTheme* poTheme, OOX::CSettings* oSettings, DocWrapper::FontProcessor& oFontProcessor, OOX::IFileContainer* oDocumentRels, PPTXFile::IAVSOfficeDrawingConverter* oOfficeDrawingConverter, CAtlMap<int, bool>* mapIgnoreComments, BinaryHeaderFooterTableWriter* oBinaryHeaderFooterTableWriter): BinaryDocumentTableWriter(ParamsWriter& oParamsWriter, ParamsDocumentWriter& oParamsDocumentWriter, CAtlMap<int, bool>* mapIgnoreComments, BinaryHeaderFooterTableWriter* oBinaryHeaderFooterTableWriter):
m_oBcw(oCBufferedStream, pEmbeddedFontsManager),bpPrs(oCBufferedStream, pEmbeddedFontsManager, poTheme, oFontProcessor, oSettings, oOfficeDrawingConverter, oDocumentRels, oBinaryHeaderFooterTableWriter),brPrs(oCBufferedStream, pEmbeddedFontsManager, poTheme, oFontProcessor),m_oSettings(oSettings),m_oDocumentRels(oDocumentRels),btblPrs(oCBufferedStream, pEmbeddedFontsManager),m_pOfficeDrawingConverter(oOfficeDrawingConverter),m_mapIgnoreComments(mapIgnoreComments) m_oParamsWriter(oParamsWriter), m_oParamsDocumentWriter(oParamsDocumentWriter),m_oBcw(oParamsWriter),bpPrs(oParamsWriter, oBinaryHeaderFooterTableWriter),brPrs(oParamsWriter),btblPrs(oParamsWriter),m_oSettings(oParamsWriter.m_oSettings),m_pOfficeDrawingConverter(oParamsWriter.m_pOfficeDrawingConverter),m_mapIgnoreComments(mapIgnoreComments)
{ {
pSectPr = NULL; pSectPr = NULL;
m_bWriteSectPr = false; m_bWriteSectPr = false;
...@@ -2687,7 +2715,7 @@ namespace BinDocxRW ...@@ -2687,7 +2715,7 @@ namespace BinDocxRW
WriteComment(OOX::et_w_commentRangeEnd, pCommentRangeEnd->m_oId); WriteComment(OOX::et_w_commentRangeEnd, pCommentRangeEnd->m_oId);
break; break;
} }
case OOX::et_m_oMathPara: /*case OOX::et_m_oMathPara:
{ {
OOX::Logic::COMathPara* pOMathPara = static_cast<OOX::Logic::COMathPara*>(item); OOX::Logic::COMathPara* pOMathPara = static_cast<OOX::Logic::COMathPara*>(item);
...@@ -2706,7 +2734,7 @@ namespace BinDocxRW ...@@ -2706,7 +2734,7 @@ namespace BinDocxRW
WriteMathArgNodes( pOMath->m_arrItems ); WriteMathArgNodes( pOMath->m_arrItems );
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
break; break;
} }*/
} }
} }
}; };
...@@ -2737,16 +2765,13 @@ namespace BinDocxRW ...@@ -2737,16 +2765,13 @@ namespace BinDocxRW
if(pHyperlink->m_oId.IsInit()) if(pHyperlink->m_oId.IsInit())
{ {
OOX::Rels::CRelationShip* oRels = NULL; OOX::Rels::CRelationShip* oRels = NULL;
if(NULL != m_oDocumentRels) smart_ptr<OOX::File> pFile = m_oParamsDocumentWriter.m_pRels->Find( OOX::RId(pHyperlink->m_oId.get().GetValue()));
{
smart_ptr<OOX::File> pFile = m_oDocumentRels->Find( OOX::RId(pHyperlink->m_oId.get().GetValue()));
if (pFile.IsInit() && OOX::FileTypes::HyperLink == pFile->type()) if (pFile.IsInit() && OOX::FileTypes::HyperLink == pFile->type())
{ {
OOX::HyperLink* pHyperlinkFile = static_cast<OOX::HyperLink*>(pFile.operator ->()); OOX::HyperLink* pHyperlinkFile = static_cast<OOX::HyperLink*>(pFile.operator ->());
sLink = pHyperlinkFile->Uri().GetPath(); sLink = pHyperlinkFile->Uri().GetPath();
} }
} }
}
if(!sLink.IsEmpty()) if(!sLink.IsEmpty())
{ {
...@@ -4622,13 +4647,22 @@ namespace BinDocxRW ...@@ -4622,13 +4647,22 @@ namespace BinDocxRW
{ {
if(pChart->m_oRId.IsInit()) if(pChart->m_oRId.IsInit())
{ {
smart_ptr<OOX::File> pFile = m_oDocumentRels->Find( OOX::RId(pChart->m_oRId->GetValue())); smart_ptr<OOX::File> pFile = m_oParamsDocumentWriter.m_pRels->Find( OOX::RId(pChart->m_oRId->GetValue()));
if (pFile.IsInit() && OOX::FileTypes::Chart == pFile->type()) if (pFile.IsInit() && OOX::FileTypes::Chart == pFile->type())
{ {
OOX::Spreadsheet::CChartSpace* pChartFile = static_cast<OOX::Spreadsheet::CChartSpace*>(pFile.operator ->()); OOX::Spreadsheet::CChartSpace* pChartFile = static_cast<OOX::Spreadsheet::CChartSpace*>(pFile.operator ->());
CString sChartPath = pChartFile->GetReadPath().GetPath();
BSTR bstrChartPath = sChartPath.AllocSysString();
m_pOfficeDrawingConverter->SetRelsPath(bstrChartPath);
SysFreeString(bstrChartPath);
int nCurPos = m_oBcw.WriteItemStart(c_oSerRunType::pptxDrawing); int nCurPos = m_oBcw.WriteItemStart(c_oSerRunType::pptxDrawing);
WriteDrawing(*pChartDrawing, NULL, pChartFile); WriteDrawing(*pChartDrawing, NULL, pChartFile);
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
BSTR bstrDocumentRels = m_oParamsDocumentWriter.m_sDocumentPath.AllocSysString();
m_pOfficeDrawingConverter->SetRelsPath(bstrDocumentRels);
SysFreeString(bstrDocumentRels);
} }
} }
} }
...@@ -5451,7 +5485,7 @@ namespace BinDocxRW ...@@ -5451,7 +5485,7 @@ namespace BinDocxRW
} }
//Content //Content
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oBcw.m_oStream, m_oBcw.m_pEmbeddedFontsManager, brPrs.m_poTheme, m_oSettings, brPrs.m_oFontProcessor, m_oDocumentRels, m_pOfficeDrawingConverter, m_mapIgnoreComments, bpPrs.m_oBinaryHeaderFooterTableWriter); BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, m_oParamsDocumentWriter, m_mapIgnoreComments, bpPrs.m_oBinaryHeaderFooterTableWriter);
nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Cell_Content); nCurPos = m_oBcw.WriteItemStart(c_oSerDocTableType::Cell_Content);
oBinaryDocumentTableWriter.WriteDocumentContent(tc.m_arrItems); oBinaryDocumentTableWriter.WriteDocumentContent(tc.m_arrItems);
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
...@@ -5459,8 +5493,8 @@ namespace BinDocxRW ...@@ -5459,8 +5493,8 @@ namespace BinDocxRW
RELEASEOBJECT(pTcPr); RELEASEOBJECT(pTcPr);
}; };
}; };
BinaryHeaderFooterTableWriter::BinaryHeaderFooterTableWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, OOX::CTheme* poTheme, DocWrapper::FontProcessor& oFontProcessor, OOX::CSettings* oSettings, PPTXFile::IAVSOfficeDrawingConverter* pOfficeDrawingConverter, OOX::IFileContainer* oDocumentRels): BinaryHeaderFooterTableWriter::BinaryHeaderFooterTableWriter(ParamsWriter& oParamsWriter, OOX::IFileContainer* oDocumentRels):
m_oBcw(oCBufferedStream, pEmbeddedFontsManager), m_poTheme(poTheme), m_oFontProcessor(oFontProcessor), m_oSettings(oSettings),m_pOfficeDrawingConverter(pOfficeDrawingConverter), m_oDocumentRels(oDocumentRels) 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)
{ {
}; };
void BinaryHeaderFooterTableWriter::Write() void BinaryHeaderFooterTableWriter::Write()
...@@ -5507,8 +5541,11 @@ namespace BinDocxRW ...@@ -5507,8 +5541,11 @@ namespace BinDocxRW
{ {
int nCurPos = 0; int nCurPos = 0;
//Content //Content
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oBcw.m_oStream, m_oBcw.m_pEmbeddedFontsManager, m_poTheme, m_oSettings, m_oFontProcessor, pHdrFtr, m_pOfficeDrawingConverter, NULL, NULL); ParamsDocumentWriter oParamsDocumentWriter(pHdrFtr, pHdrFtr->m_oReadPath.GetPath());
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, pHdrFtr->m_oReadPath.GetPath(), pHdrFtr->m_arrShapeTypes); m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, NULL, NULL);
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);
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nCurPos);
...@@ -5525,7 +5562,7 @@ namespace BinDocxRW ...@@ -5525,7 +5562,7 @@ namespace BinDocxRW
}; };
BinaryCommonWriter m_oBcw; BinaryCommonWriter m_oBcw;
public: public:
BinaryCommentsTableWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):m_oBcw(oCBufferedStream, pEmbeddedFontsManager) BinaryCommentsTableWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter)
{ {
}; };
void Write(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, CAtlMap<int, bool>& mapIgnoreComments) void Write(OOX::CComments& oComments, OOX::CCommentsExt* pCommentsExt, OOX::CPeople* pPeople, CAtlMap<int, bool>& mapIgnoreComments)
...@@ -5686,7 +5723,7 @@ namespace BinDocxRW ...@@ -5686,7 +5723,7 @@ namespace BinDocxRW
{ {
BinaryCommonWriter m_oBcw; BinaryCommonWriter m_oBcw;
public: public:
BinarySettingsTableWriter(Streams::CBufferedStream &oCBufferedStream, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager):m_oBcw(oCBufferedStream, pEmbeddedFontsManager) BinarySettingsTableWriter(ParamsWriter& oParamsWriter):m_oBcw(oParamsWriter)
{ {
}; };
void Write(OOX::CSettings& oSettings) void Write(OOX::CSettings& oSettings)
...@@ -6020,15 +6057,9 @@ namespace BinDocxRW ...@@ -6020,15 +6057,9 @@ namespace BinDocxRW
int m_nRealTableCount; int m_nRealTableCount;
int m_nMainTableStart; int m_nMainTableStart;
public: public:
DocWrapper::FontProcessor& m_oFontProcessor; ParamsWriter& m_oParamsWriter;
NSFontCutter::CEmbeddedFontsManager* m_oEmbeddedFontsManager;
PPTXFile::IAVSOfficeDrawingConverter* m_pOfficeDrawingConverter;
OOX::CTheme* m_pTheme;
OOX::CSettings* m_pSettings;
OOX::IFileContainer* m_pCurRels;
public: BinaryFileWriter(Streams::CBufferedStream &oCBufferedStream, DocWrapper::FontProcessor& fp, NSFontCutter::CEmbeddedFontsManager* pEmbeddedFontsManager, PPTXFile::IAVSOfficeDrawingConverter* pOfficeDrawingConverter): public: BinaryFileWriter(ParamsWriter& oParamsWriter):m_oParamsWriter(oParamsWriter), m_oBcw(oParamsWriter)
m_oBcw(oCBufferedStream, pEmbeddedFontsManager), m_oFontProcessor(fp), m_oEmbeddedFontsManager(pEmbeddedFontsManager), m_pOfficeDrawingConverter(pOfficeDrawingConverter)
{ {
m_nLastFilePos = 0; m_nLastFilePos = 0;
m_nRealTableCount = 0; m_nRealTableCount = 0;
...@@ -6052,7 +6083,7 @@ namespace BinDocxRW ...@@ -6052,7 +6083,7 @@ namespace BinDocxRW
//BinarySigTableWriter //BinarySigTableWriter
int nCurPos = WriteTableStart(c_oSerTableTypes::Signature); int nCurPos = WriteTableStart(c_oSerTableTypes::Signature);
BinarySigTableWriter oBinarySigTableWriter(m_oBcw.m_oStream, m_oBcw.m_pEmbeddedFontsManager); BinarySigTableWriter oBinarySigTableWriter(m_oParamsWriter);
oBinarySigTableWriter.Write(); oBinarySigTableWriter.Write();
WriteTableEnd(nCurPos); WriteTableEnd(nCurPos);
} }
...@@ -6060,7 +6091,7 @@ namespace BinDocxRW ...@@ -6060,7 +6091,7 @@ namespace BinDocxRW
{ {
//OtherTable //OtherTable
int nCurPos = WriteTableStart(c_oSerTableTypes::Other); int nCurPos = WriteTableStart(c_oSerTableTypes::Other);
BinaryOtherTableWriter oBinaryOtherTableWriter(m_oBcw.m_oStream, m_oBcw.m_pEmbeddedFontsManager, pTheme); BinaryOtherTableWriter oBinaryOtherTableWriter(m_oParamsWriter, pTheme);
oBinaryOtherTableWriter.Write(); oBinaryOtherTableWriter.Write();
WriteTableEnd(nCurPos); WriteTableEnd(nCurPos);
...@@ -6100,12 +6131,11 @@ namespace BinDocxRW ...@@ -6100,12 +6131,11 @@ namespace BinDocxRW
Streams::CBufferedStream& oBufferedStream = m_oBcw.m_oStream; Streams::CBufferedStream& oBufferedStream = m_oBcw.m_oStream;
OOX::CDocx oDocx = OOX::CDocx(OOX::CPath(sDir)); OOX::CDocx oDocx = OOX::CDocx(OOX::CPath(sDir));
m_pTheme = oDocx.GetTheme(); m_oParamsWriter.m_poTheme = oDocx.GetTheme();
DocWrapper::FontProcessor& oFontProcessor = m_oFontProcessor; m_oParamsWriter.m_oSettings = oDocx.GetSettings();
OOX::CFontTable* pFontTable = oDocx.GetFontTable(); OOX::CFontTable* pFontTable = oDocx.GetFontTable();
if(NULL != pFontTable) if(NULL != pFontTable)
oFontProcessor.setFontTable(pFontTable); m_oParamsWriter.m_oFontProcessor.setFontTable(pFontTable);
m_pSettings = oDocx.GetSettings();
// SectPr pageBreak // SectPr pageBreak
OOX::CDocument* poDocument = oDocx.GetDocument(); OOX::CDocument* poDocument = oDocx.GetDocument();
...@@ -6116,10 +6146,10 @@ namespace BinDocxRW ...@@ -6116,10 +6146,10 @@ namespace BinDocxRW
int nCurPos = 0; int nCurPos = 0;
LPSAFEARRAY pThemeData = NULL; LPSAFEARRAY pThemeData = NULL;
if(NULL != m_pTheme) if(NULL != m_oParamsWriter.m_poTheme)
{ {
BSTR bstrThemePath = m_pTheme->m_oReadPath.GetPath().AllocSysString(); BSTR bstrThemePath = m_oParamsWriter.m_poTheme->m_oReadPath.GetPath().AllocSysString();
m_pOfficeDrawingConverter->GetThemeBinary(bstrThemePath, &pThemeData); m_oParamsWriter.m_pOfficeDrawingConverter->GetThemeBinary(bstrThemePath, &pThemeData);
SysFreeString(bstrThemePath); SysFreeString(bstrThemePath);
} }
...@@ -6127,7 +6157,7 @@ namespace BinDocxRW ...@@ -6127,7 +6157,7 @@ namespace BinDocxRW
OOX::CSettings* pSettings = oDocx.GetSettings(); OOX::CSettings* pSettings = oDocx.GetSettings();
if(NULL != pSettings) if(NULL != pSettings)
{ {
BinDocxRW::BinarySettingsTableWriter oBinarySettingsTableWriter(oBufferedStream, m_oEmbeddedFontsManager); BinDocxRW::BinarySettingsTableWriter oBinarySettingsTableWriter(m_oParamsWriter);
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Settings); int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Settings);
oBinarySettingsTableWriter.Write(*pSettings); oBinarySettingsTableWriter.Write(*pSettings);
this->WriteTableEnd(nCurPos); this->WriteTableEnd(nCurPos);
...@@ -6140,7 +6170,7 @@ namespace BinDocxRW ...@@ -6140,7 +6170,7 @@ namespace BinDocxRW
OOX::CPeople* pPeople = oDocx.GetPeople(); OOX::CPeople* pPeople = oDocx.GetPeople();
if(NULL != pComments) if(NULL != pComments)
{ {
BinDocxRW::BinaryCommentsTableWriter oBinaryCommentsTableWriter(oBufferedStream, m_oEmbeddedFontsManager); 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, mapIgnoreComments);
this->WriteTableEnd(nCurPos); this->WriteTableEnd(nCurPos);
...@@ -6148,7 +6178,7 @@ namespace BinDocxRW ...@@ -6148,7 +6178,7 @@ namespace BinDocxRW
//Write StyleTable //Write StyleTable
OOX::CStyles* pStyles = oDocx.GetStyles(); OOX::CStyles* pStyles = oDocx.GetStyles();
BinDocxRW::BinaryStyleTableWriter oBinaryStyleTableWriter(oBufferedStream, m_oEmbeddedFontsManager, m_pTheme, oFontProcessor, m_pSettings, m_pOfficeDrawingConverter); BinDocxRW::BinaryStyleTableWriter oBinaryStyleTableWriter(m_oParamsWriter);
if(NULL != pStyles) if(NULL != pStyles)
{ {
int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Style); int nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Style);
...@@ -6157,7 +6187,7 @@ namespace BinDocxRW ...@@ -6157,7 +6187,7 @@ namespace BinDocxRW
} }
//Write Numbering //Write Numbering
OOX::CNumbering* pNumbering = oDocx.GetNumbering(); OOX::CNumbering* pNumbering = oDocx.GetNumbering();
BinDocxRW::BinaryNumberingTableWriter oBinaryNumberingTableWriter(oBufferedStream, m_oEmbeddedFontsManager, m_pTheme, oFontProcessor, m_pSettings, m_pOfficeDrawingConverter); BinDocxRW::BinaryNumberingTableWriter oBinaryNumberingTableWriter(m_oParamsWriter);
if(NULL != pNumbering) if(NULL != pNumbering)
{ {
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Numbering); nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Numbering);
...@@ -6165,14 +6195,17 @@ namespace BinDocxRW ...@@ -6165,14 +6195,17 @@ namespace BinDocxRW
this->WriteTableEnd(nCurPos); this->WriteTableEnd(nCurPos);
} }
BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(oBufferedStream, m_oEmbeddedFontsManager, m_pTheme, oFontProcessor, m_pSettings, m_pOfficeDrawingConverter, poDocument); BinDocxRW::BinaryHeaderFooterTableWriter oBinaryHeaderFooterTableWriter(m_oParamsWriter, poDocument);
//Write DocumentTable //Write DocumentTable
m_pCurRels = poDocument; ParamsDocumentWriter oParamsDocumentWriter(poDocument, poDocument->m_oReadPath.GetPath());
m_oParamsWriter.m_pCurRels = oParamsDocumentWriter.m_pRels;
m_oParamsWriter.m_sCurDocumentPath = oParamsDocumentWriter.m_sDocumentPath;
//DocumentTable , , , Style_Add... //DocumentTable , , , Style_Add...
nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document); nCurPos = this->WriteTableStart(BinDocxRW::c_oSerTableTypes::Document);
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oBufferedStream, m_oEmbeddedFontsManager, m_pTheme, m_pSettings, oFontProcessor, poDocument, m_pOfficeDrawingConverter, &mapIgnoreComments, &oBinaryHeaderFooterTableWriter); BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(m_oParamsWriter, oParamsDocumentWriter, &mapIgnoreComments, &oBinaryHeaderFooterTableWriter);
oBinaryDocumentTableWriter.prepareOfficeDrawingConverter(m_pOfficeDrawingConverter, poDocument->m_oReadPath.GetPath(), 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;
oBinaryDocumentTableWriter.Write(poDocument->m_arrItems); oBinaryDocumentTableWriter.Write(poDocument->m_arrItems);
......
...@@ -129,7 +129,8 @@ public: ...@@ -129,7 +129,8 @@ public:
pOfficeDrawingConverter->SetMediaDstPath(bstrMediaDir); pOfficeDrawingConverter->SetMediaDstPath(bstrMediaDir);
SysFreeString(bstrMediaDir); SysFreeString(bstrMediaDir);
m_oBinaryFileWriter = new BinDocxRW::BinaryFileWriter(oBufferedStream, fp, pEmbeddedFontsManager, pOfficeDrawingConverter); BinDocxRW::ParamsWriter oParamsWriter(oBufferedStream, fp, pOfficeDrawingConverter, pEmbeddedFontsManager);
m_oBinaryFileWriter = new BinDocxRW::BinaryFileWriter(oParamsWriter);
m_oBinaryFileWriter->intoBindoc(CString(bsInputDir)); m_oBinaryFileWriter->intoBindoc(CString(bsInputDir));
BYTE* pbBinBuffer = oBufferedStream.GetBuffer(); BYTE* pbBinBuffer = oBufferedStream.GetBuffer();
...@@ -225,10 +226,16 @@ public: ...@@ -225,10 +226,16 @@ public:
OOX::Logic::CSdtContent oSdtContent; OOX::Logic::CSdtContent oSdtContent;
oSdtContent.fromXML(oReader); oSdtContent.fromXML(oReader);
BinDocxRW::ParamsWriter oCurParamsWriter(m_oBinaryFileWriter->m_oParamsWriter);
BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oBufferedStream, m_oBinaryFileWriter->m_oEmbeddedFontsManager); BinDocxRW::ParamsWriter oParamsWriter(oBufferedStream, oCurParamsWriter.m_oFontProcessor, oCurParamsWriter.m_pOfficeDrawingConverter, oCurParamsWriter.m_pEmbeddedFontsManager);
oParamsWriter.m_poTheme = oCurParamsWriter.m_poTheme;
oParamsWriter.m_oSettings = oCurParamsWriter.m_oSettings;
oParamsWriter.m_pCurRels = oCurParamsWriter.m_pCurRels;
oParamsWriter.m_sCurDocumentPath = oCurParamsWriter.m_sCurDocumentPath;
BinDocxRW::BinaryCommonWriter oBinaryCommonWriter(oParamsWriter);
int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart(); int nCurPos = oBinaryCommonWriter.WriteItemWithLengthStart();
BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oBufferedStream, m_oBinaryFileWriter->m_oEmbeddedFontsManager, m_oBinaryFileWriter->m_pTheme, m_oBinaryFileWriter->m_pSettings, m_oBinaryFileWriter->m_oFontProcessor, m_oBinaryFileWriter->m_pCurRels, m_oBinaryFileWriter->m_pOfficeDrawingConverter, NULL, NULL); BinDocxRW::BinaryDocumentTableWriter oBinaryDocumentTableWriter(oParamsWriter, BinDocxRW::ParamsDocumentWriter(oParamsWriter.m_pCurRels, oParamsWriter.m_sCurDocumentPath), NULL, NULL);
oBinaryDocumentTableWriter.WriteDocumentContent(oSdtContent.m_arrItems); oBinaryDocumentTableWriter.WriteDocumentContent(oSdtContent.m_arrItems);
oBinaryCommonWriter.WriteItemWithLengthEnd(nCurPos); oBinaryCommonWriter.WriteItemWithLengthEnd(nCurPos);
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//2 //2
//0 //0
//0 //0
//171 //172
#define INTVER 2,0,0,171 #define INTVER 2,0,0,172
#define STRVER "2,0,0,171\0" #define STRVER "2,0,0,172\0"
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