Commit 72c43c3e authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

DocxFormat - write embedded docx elements to BinaryFile(doct)

parent 846caf6b
...@@ -498,7 +498,8 @@ extern int g_nCurFormatVersion; ...@@ -498,7 +498,8 @@ extern int g_nCurFormatVersion;
Chart2 = 25, Chart2 = 25,
CachedImage = 26, CachedImage = 26,
SizeRelH = 27, SizeRelH = 27,
SizeRelV = 28 SizeRelV = 28,
Embedded = 29
};} };}
namespace c_oSerEffectExtent{enum c_oSerEffectExtent namespace c_oSerEffectExtent{enum c_oSerEffectExtent
{ {
......
...@@ -4975,18 +4975,37 @@ namespace BinDocxRW ...@@ -4975,18 +4975,37 @@ namespace BinDocxRW
} }
case OOX::et_w_object: case OOX::et_w_object:
{ {
int nCurPos = m_oBcw.WriteItemStart(c_oSerRunType::object); OOX::Logic::CObject* pObject = static_cast<OOX::Logic::CObject*>(item);
//write Picture
CString* pXml = NULL; CString* pXml = pObject ? pObject->m_sXml.GetPointer() : NULL;
OOX::Logic::CObject* pObject = static_cast<OOX::Logic::CObject*>(item); CString sProgID;
pXml = pObject->m_sXml.GetPointer(); if ((pObject) && (pObject->m_oOleObject.IsInit()))
sProgID = pObject->m_oOleObject->m_sProgId.get().GetString();
//write equation int nPosObject = m_oBcw.WriteItemStart(c_oSerRunType::object);
if (pObject->m_oOleObject.IsInit())
if ( _T("Word.Document") == sProgID)
{
int nPosEmbedded = m_oBcw.WriteItemStart(c_oSerImageType2::Embedded);
OOX::Rels::CRelationShip* oRels = NULL;
smart_ptr<OOX::File> pFile = m_oParamsDocumentWriter.m_pRels->Find( OOX::RId(pObject->m_oOleObject->m_oId.get().GetValue()));
CString sLink;
if (pFile.IsInit() && OOX::FileTypes::OleObject == pFile->type())
{
OOX::HyperLink* pHyperlinkFile = static_cast<OOX::HyperLink*>(pFile.operator ->());
sLink = pHyperlinkFile->Uri().GetPath();
}
OOX::CPath path(sLink);
OOX::CDocument poDocumentEmbedded(path, path);
WriteDocumentContent(poDocumentEmbedded.m_arrItems);
m_oBcw.WriteItemEnd(nPosEmbedded);
}
else
{ {
CString sProgID = pObject->m_oOleObject->m_sProgId.get().GetString(); //write equation
if ( _T("Equation.3") == sProgID) if ( _T("Equation.3") == sProgID)
{ {
OOX::Rels::CRelationShip* oRels = NULL; OOX::Rels::CRelationShip* oRels = NULL;
...@@ -5005,12 +5024,12 @@ namespace BinDocxRW ...@@ -5005,12 +5024,12 @@ namespace BinDocxRW
oReader.Parse(); oReader.Parse();
} }
} }
//write Picture
int nCurPos1 = m_oBcw.WriteItemStart(c_oSerRunType::pptxDrawing); int nPosImageCache = m_oBcw.WriteItemStart(c_oSerRunType::pptxDrawing);
WriteDrawing(pXml, NULL, NULL); WriteDrawing(pXml, NULL, NULL);
m_oBcw.WriteItemEnd(nCurPos1); m_oBcw.WriteItemEnd(nPosImageCache);
m_oBcw.WriteItemEnd(nCurPos); m_oBcw.WriteItemEnd(nPosObject);
break; break;
} }
} }
......
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