mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
fix bug #63315
This commit is contained in:
@ -4820,6 +4820,12 @@ int Binary_DocumentTableReader::ReadDocumentContent(BYTE type, long length, void
|
||||
READ1_DEF(length, res, this->ReadDocParts, &oDocParts);
|
||||
m_oDocumentWriter.m_oContent.WriteString(L"</w:docParts>");
|
||||
}
|
||||
else if (c_oSerParType::JsaProjectExternal == type)
|
||||
{
|
||||
std::wstring filePath = m_oBufferedStream.GetString3(length);
|
||||
unsigned int lId = 0;
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::JsaProject.RelationType(), filePath, L"External", &lId);
|
||||
}
|
||||
else if(c_oSerParType::JsaProject == type)
|
||||
{
|
||||
BYTE* pData = m_oBufferedStream.GetPointer(length);
|
||||
@ -5670,7 +5676,7 @@ int Binary_DocumentTableReader::ReadHyperlink(BYTE type, long length, void* poRe
|
||||
{
|
||||
unsigned int rId;
|
||||
std::wstring sHref = XmlUtils::EncodeXmlString(pHyperlink->sLink);
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")), sHref, std::wstring(_T("External")), &rId);
|
||||
m_oFileWriter.m_pDrawingConverter->WriteRels(std::wstring(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink")), sHref, std::wstring(L"External"), &rId);
|
||||
pHyperlink->rId = L"rId" + std::to_wstring(rId);
|
||||
}
|
||||
m_pCurWriter = pPrevWriter;
|
||||
|
||||
@ -535,7 +535,8 @@ extern int g_nCurFormatVersion;
|
||||
AltChunk = 26,
|
||||
DocParts = 27,
|
||||
PermStart = 28,
|
||||
PermEnd = 29
|
||||
PermEnd = 29,
|
||||
JsaProjectExternal = 30
|
||||
};}
|
||||
namespace c_oSerGlossary {
|
||||
enum c_oSerGlossary
|
||||
|
||||
@ -3450,14 +3450,23 @@ void BinaryDocumentTableWriter::WriteDocumentContent(const std::vector<OOX::Writ
|
||||
//Write JsaProject
|
||||
if (NULL != pJsaProject)
|
||||
{
|
||||
BYTE* pData = NULL;
|
||||
DWORD nBytesCount;
|
||||
if(NSFile::CFileBinary::ReadAllBytes(pJsaProject->filename().GetPath(), &pData, nBytesCount))
|
||||
if (pJsaProject->IsExist() && !pJsaProject->IsExternal())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::JsaProject);
|
||||
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
|
||||
BYTE* pData = NULL;
|
||||
DWORD nBytesCount;
|
||||
if (NSFile::CFileBinary::ReadAllBytes(pJsaProject->filename().GetPath(), &pData, nBytesCount))
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::JsaProject);
|
||||
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
}
|
||||
if (pJsaProject->IsExternal())
|
||||
{
|
||||
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::JsaProjectExternal);
|
||||
m_oBcw.m_oStream.WriteStringW3(pJsaProject->filename().GetPath());
|
||||
m_oBcw.WriteItemEnd(nCurPos);
|
||||
RELEASEARRAYOBJECTS(pData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ namespace OOX
|
||||
else if ( oRelation.Type() == OOX::FileTypes::VbaData)
|
||||
return smart_ptr<OOX::File>(new OOX::VbaData( pMain, oRootPath, oFileName));
|
||||
else if ( oRelation.Type() == FileTypes::JsaProject)
|
||||
return smart_ptr<OOX::File>(new JsaProject( pMain, oFileName ));
|
||||
return smart_ptr<OOX::File>(new OOX::JsaProject( pMain, oFileName, oRelation.IsExternal()));
|
||||
else if ( oRelation.Type() == FileTypes::CustomXml)
|
||||
return smart_ptr<OOX::File>(new OOX::CCustomXML(pMain, oRootPath, oFileName));
|
||||
else if ( oRelation.Type() == FileTypes::CustomXmlProps)
|
||||
@ -343,7 +343,7 @@ namespace OOX
|
||||
else if ( pRelation->Type() == FileTypes::VbaData)
|
||||
return smart_ptr<OOX::File>(new OOX::VbaData( pMain, oRootPath, oFileName));
|
||||
else if ( pRelation->Type() == FileTypes::JsaProject)
|
||||
return smart_ptr<OOX::File>(new JsaProject( pMain, oFileName ));
|
||||
return smart_ptr<OOX::File>(new OOX::JsaProject( pMain, oFileName, pRelation->IsExternal()));
|
||||
else if ( pRelation->Type() == FileTypes::CustomXml)
|
||||
return smart_ptr<OOX::File>(new OOX::CCustomXML(pMain, oRootPath, oFileName));
|
||||
else if ( pRelation->Type() == FileTypes::CustomXmlProps)
|
||||
|
||||
@ -60,8 +60,9 @@ namespace OOX
|
||||
}
|
||||
}
|
||||
}
|
||||
JsaProject::JsaProject(OOX::Document *pMain, const CPath& filename) : Media(pMain)
|
||||
JsaProject::JsaProject(OOX::Document *pMain, const CPath& filename, bool bExternal) : Media(pMain)
|
||||
{
|
||||
m_bExternal = bExternal;
|
||||
OOX::CDocx* docx = dynamic_cast<OOX::CDocx*>(pMain);
|
||||
if (docx)
|
||||
{
|
||||
|
||||
@ -43,7 +43,7 @@ namespace OOX
|
||||
{
|
||||
public:
|
||||
JsaProject( OOX::Document *pMain );
|
||||
JsaProject(OOX::Document *pMain, const CPath& filename);
|
||||
JsaProject(OOX::Document *pMain, const CPath& filename, bool bExternal = false);
|
||||
virtual ~JsaProject();
|
||||
|
||||
virtual const FileType type() const;
|
||||
|
||||
@ -158,7 +158,7 @@ namespace PPTX
|
||||
else if (relation.Type() == OOX::FileTypes::VbaProject)
|
||||
return smart_ptr<OOX::File>(new OOX::VbaProject( pMain, filename, filename ));
|
||||
else if (relation.Type() == OOX::FileTypes::JsaProject)
|
||||
return smart_ptr<OOX::File>(new OOX::JsaProject( pMain, filename ));
|
||||
return smart_ptr<OOX::File>(new OOX::JsaProject( pMain, filename, relation.IsExternal()));
|
||||
else if (relation.Type() == OOX::FileTypes::CustomXml)
|
||||
return smart_ptr<OOX::File>(new OOX::CCustomXML(pMain, filename, filename));
|
||||
else if (relation.Type() == OOX::FileTypes::ActiveX_xml)
|
||||
|
||||
Reference in New Issue
Block a user