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

(2.0.0.186): ASCOfficeDocxFile2

зависание при сохранением в docx групп автофигур с chart

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58580 954022d7-b5bf-4e40-9824-e11837661b57
parent 6e33842f
......@@ -49,6 +49,7 @@ namespace Writers
CFile oFile;
oFile.CreateFile(sAbsPath);
oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n")));
oFile.WriteStringUTF8(elem->content);
oFile.CloseFile();
......
......@@ -4721,6 +4721,7 @@ namespace BinDocxRW
if (pFile.IsInit() && OOX::FileTypes::Chart == pFile->type())
{
OOX::Spreadsheet::CChartSpace* pChartFile = static_cast<OOX::Spreadsheet::CChartSpace*>(pFile.operator ->());
CString sOldRelsPath = m_pOfficeDrawingConverter->GetRelsPath();
CString sChartPath = pChartFile->GetReadPath().GetPath();
m_pOfficeDrawingConverter->SetRelsPath(sChartPath);
......@@ -4728,7 +4729,7 @@ namespace BinDocxRW
WriteDrawing(NULL, pChartDrawing, pChartFile);
m_oBcw.WriteItemEnd(nCurPos);
m_pOfficeDrawingConverter->SetRelsPath(m_oParamsDocumentWriter.m_sDocumentPath);
m_pOfficeDrawingConverter->SetRelsPath(sOldRelsPath);
}
}
}
......
......@@ -98,11 +98,14 @@ namespace BinXlsxRW{
long nStartPos = oBufferedStream.GetPosition();
BinXlsxRW::BinaryCommonWriter oBcw(oBufferedStream);
CString sOldRelsPath = m_pExternalDrawingConverter->GetRelsPath();
m_pExternalDrawingConverter->SetRelsPath(sChartPath);
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(oBufferedStream, m_pExternalDrawingConverter);
oBinaryChartWriter.WriteCT_ChartSpace(oChart);
m_pExternalDrawingConverter->SetRelsPath(sOldRelsPath);
long nEndPos = oBufferedStream.GetPosition();
lDataSize = nEndPos - nStartPos;
bRes = true;
......
......@@ -2,6 +2,6 @@
//2
//0
//0
//185
#define INTVER 2,0,0,185
#define STRVER "2,0,0,185\0"
//186
#define INTVER 2,0,0,186
#define STRVER "2,0,0,186\0"
......@@ -828,6 +828,10 @@ HRESULT CDrawingConverter::SetRelsPath(CString& bsRelsPath)
m_strCurrentRelsPath = bsRelsPath;
return SetCurrentRelsPath();
}
CString CDrawingConverter::GetRelsPath()
{
return m_strCurrentRelsPath;
}
HRESULT CDrawingConverter::SetMediaDstPath(CString& bsMediaPath)
{
m_pBinaryWriter->m_pCommon->m_pImageManager->m_strDstMedia = (CString)bsMediaPath;
......
......@@ -171,6 +171,7 @@ namespace NSBinPptxRW
public:
STDMETHOD(SetMainDocument)(BinDocxRW::CDocxSerializer* pDocument);
STDMETHOD(SetRelsPath)(CString& bsRelsPath);
CString GetRelsPath();
STDMETHOD(SetMediaDstPath)(CString& bsMediaPath);
STDMETHOD(AddShapeType)(CString& bsXml);
......
......@@ -126,43 +126,21 @@ namespace PPTX
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
NSBinPptxRW::CDrawingConverter oDrawingConverter;
VARIANT var;
var.vt = VT_UNKNOWN;
pWriter->m_pCommon->m_pFontPicker->QueryInterface(IID_IUnknown, (void**)&(var.punkVal));
oDrawingConverter.SetAdditionalParam(CString(L"FontPicker"), var);
RELEASEINTERFACE((var.punkVal));
var.vt = VT_ARRAY;
NSBinPptxRW::CBinaryFileWriter oWriter;
LPSAFEARRAY pSerializeIM = oWriter.Serialize(pWriter->m_pCommon->m_pImageManager);
var.parray = pSerializeIM;
oDrawingConverter.SetAdditionalParam(CString(L"SerializeImageManager"), var);
RELEASEARRAY(pSerializeIM);
NSBinPptxRW::CBinaryFileWriter* pOldWriter = oDrawingConverter.m_pBinaryWriter;
oDrawingConverter.m_pBinaryWriter = pWriter;
NSCommon::smart_ptr<PPTX::FileContainer> pOldRels = *oDrawingConverter.m_pBinaryWriter->m_pCommonRels;
oXlsxSerializer.setDrawingConverter(&oDrawingConverter);
var.parray = NULL;
oDrawingConverter.GetAdditionalParam(CString(L"SerializeImageManager"), &var);
if (var.parray != NULL)
{
NSBinPptxRW::CBinaryFileReader oReader;
oReader.Deserialize(pWriter->m_pCommon->m_pImageManager, var.parray);
RELEASEARRAY((var.parray));
}
long lDataSize = 0;
oXlsxSerializer.loadChart(strDataPath, *pWriter, lDataSize);
*oDrawingConverter.m_pBinaryWriter->m_pCommonRels = pOldRels;
oDrawingConverter.m_pBinaryWriter = pOldWriter;
}
void ChartRec::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
if (!id_data.is_init() || NULL == m_pData)
if (!id_data.is_init() || NULL == m_bData)
return;
CString strData = _T("<c:chart xmlns:c=\"http://schemas.openxmlformats.org/drawingml/2006/chart\" \
......@@ -174,7 +152,7 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"
void ChartRec::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
ULONG lLen = pReader->GetLong();
m_pData = pReader->GetArray(lLen);
m_bData = true;
m_lChartNumber = pReader->m_lChartNumber;
pReader->m_lChartNumber++;
......@@ -183,21 +161,10 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
NSBinPptxRW::CDrawingConverter oDrawingConverter;
VARIANT varDir;
varDir.vt = VT_BSTR;
varDir.bstrVal = pReader->m_strFolder.AllocSysString();
oDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir2"), varDir);
SysFreeString(varDir.bstrVal);
VARIANT var;
var.vt = VT_ARRAY;
NSBinPptxRW::CBinaryFileWriter oWriter;
LPSAFEARRAY pSerializeIM = oWriter.Serialize(pReader->m_pRels->m_pManager);
var.parray = pSerializeIM;
oDrawingConverter.SetAdditionalParam(CString(L"SerializeImageManager2"), var);
RELEASEARRAY(pSerializeIM);
NSBinPptxRW::CImageManager2* pOldImageManager = oDrawingConverter.m_pImageManager;
oDrawingConverter.m_pImageManager = pReader->m_pRels->m_pManager;
NSBinPptxRW::CBinaryFileReader* pOldReader = oDrawingConverter.m_pReader;
oDrawingConverter.m_pReader = pReader;
oXlsxSerializer.setDrawingConverter(&oDrawingConverter);
......@@ -227,16 +194,8 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"
pReader->m_strContentTypes += (*sContentTypes);
RELEASEOBJECT(sContentTypes);
var.parray = NULL;
oDrawingConverter.GetAdditionalParam(CString(L"SerializeImageManager2"), &var);
if (var.parray != NULL)
{
NSBinPptxRW::CBinaryFileReader oReader;
oReader.Deserialize(pReader->m_pRels->m_pManager, var.parray);
RELEASEARRAY((var.parray));
}
oDrawingConverter.m_pReader = pOldReader;
oDrawingConverter.m_pImageManager = pOldImageManager;
id_data = new PPTX::RId((size_t)lId);
}
......
......@@ -77,12 +77,11 @@ namespace PPTX
public:
ChartRec()
{
m_pData = NULL;
m_bData = false;
m_lChartNumber = 0;
}
virtual ~ChartRec()
{
RELEASEARRAY(m_pData);
}
explicit ChartRec(XmlUtils::CXmlNode& node)
{
......@@ -109,7 +108,7 @@ namespace PPTX
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_pData = NULL;
m_bData = false;
node.ReadAttributeBase(L"r:id", id_data);
FillParentPointersForChilds();
......@@ -131,7 +130,7 @@ namespace PPTX
nullable<PPTX::RId> id_data;
LONG m_lChartNumber;
LPSAFEARRAY m_pData;
bool m_bData;
protected:
virtual void FillParentPointersForChilds()
{
......
......@@ -1655,12 +1655,15 @@ namespace BinXlsxRW {
if (oFile.IsInit() && OOX::Spreadsheet::FileTypes::Drawings == oFile->type())
{
OOX::Spreadsheet::CDrawing* pDrawing = (OOX::Spreadsheet::CDrawing*)oFile.operator->();
CString sOldRelsPath = m_pOfficeDrawingConverter->GetRelsPath();
CString sDrawingRelsPath = pDrawing->GetReadPath().GetPath();
m_pOfficeDrawingConverter->SetRelsPath(sDrawingRelsPath);
nCurPos = m_oBcw.WriteItemStart(c_oSerWorksheetsTypes::Drawings);
WriteDrawings(pDrawing, sDrawingRelsPath);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
m_pOfficeDrawingConverter->SetRelsPath(sOldRelsPath);
}
}
//Autofilter
......@@ -2426,6 +2429,7 @@ namespace BinXlsxRW {
//
if( INVALID_FILE_ATTRIBUTES != ::GetFileAttributes( sChartPath ) )
{
CString sOldRelsPath = m_pOfficeDrawingConverter->GetRelsPath();
m_pOfficeDrawingConverter->SetRelsPath(sChartPath);
int nCurPos = m_oBcw.WriteItemStart(c_oSer_DrawingType::Chart2);
......@@ -2434,7 +2438,7 @@ namespace BinXlsxRW {
oBinaryChartWriter.WriteCT_ChartSpace(oChart);
m_oBcw.WriteItemEnd(nCurPos);
m_pOfficeDrawingConverter->SetRelsPath(sDrawingRelsPath);
m_pOfficeDrawingConverter->SetRelsPath(sOldRelsPath);
}
}
}
......
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