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

(2.0.0.167): ASCOfficeDocxFile2

Синхронизация chart, создание папки theme/_rels

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@55885 954022d7-b5bf-4e40-9824-e11837661b57
parent d1115d72
......@@ -13,9 +13,10 @@ namespace Writers
int index;
};
CSimpleArray<ChartElem*> m_aCharts;
CString m_sDir;
ContentTypesWriter& m_oContentTypesWriter;
int nChartCount;
public:
CString m_sDir;
public:
ChartWriter(CString sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
{
......@@ -54,7 +55,7 @@ namespace Writers
}
}
}
void AddChart(CString& content, CString& sRelsName, int& index)
void AddChart(CString& content, CString& sRelsName, CString& sFileName, int& index)
{
ChartElem* pChartElem = new ChartElem();
pChartElem->content = content;
......@@ -62,6 +63,7 @@ namespace Writers
nChartCount++;
pChartElem->filename.Format(_T("chart%d.xml"), pChartElem->index);
sRelsName = _T("charts/") + pChartElem->filename;
sFileName = pChartElem->filename;
index = pChartElem->index;
m_aCharts.Add(pChartElem);
......
......@@ -5548,18 +5548,36 @@ public:
{
if(false == m_oFileWriter.m_bSaveChartAsImg)
{
BinXlsxRW::BinaryChartReader oBinaryChartReader(m_oBufferedStream, m_oFileWriter.m_pArray, m_oFileWriter.m_pDrawingConverter);
// rels
CString sRelsDir;
sRelsDir.Format(_T("%s\\word\\charts\\_rels"), m_oFileWriter.m_oChartWriter.m_sDir);
DWORD dwFileAttr = ::GetFileAttributes( sRelsDir );
if( dwFileAttr == INVALID_FILE_ATTRIBUTES )
OOX::CSystemUtility::CreateDirectories(sRelsDir);
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
CString sThemeDir;
int nIndex = m_oFileWriter.m_sThemePath.ReverseFind('\\');
if(-1 != nIndex)
sThemeDir = m_oFileWriter.m_sThemePath.Left(nIndex);
BinXlsxRW::SaveParams oSaveParams(sThemeDir);
BinXlsxRW::BinaryChartReader oBinaryChartReader(m_oBufferedStream, oSaveParams, m_oFileWriter.m_pArray, m_oFileWriter.m_pDrawingConverter);
OOX::Spreadsheet::CChartSpace* pChartSpace = new OOX::Spreadsheet::CChartSpace();
oBinaryChartReader.ReadCT_ChartSpace(length, &pChartSpace->m_oChartSpace);
XmlUtils::CStringWriter sw;
pChartSpace->toXML(sw);
CString sChartContent = sw.GetData();
if(false == sChartContent.IsEmpty())
{
CString sFilename;
CString sRelsName;
int nIndex;
m_oFileWriter.m_oChartWriter.AddChart(sChartContent, sRelsName, nIndex);
int nChartIndex;
m_oFileWriter.m_oChartWriter.AddChart(sChartContent, sRelsName, sFilename, nChartIndex);
m_oFileWriter.m_oContentTypesWriter.AddOverrideRaw(oSaveParams.sAdditionalContentTypes);
CString sRelsPath;sRelsPath.Format(_T("%s\\%s.rels"), sRelsDir, sFilename);
BSTR bstrRelsPath = sRelsPath.AllocSysString();
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(bstrRelsPath);
SysFreeString(bstrRelsPath);
long rId;
BSTR bstrChartRelType = OOX::Spreadsheet::FileTypes::Charts.RelationType().AllocSysString();
......@@ -5570,7 +5588,6 @@ public:
pDrawingProperty->sChartRels.Format(_T("rId%d"), rId);
}
}
else
res = c_oSerConstants::ReadUnknown;
}
......
......@@ -4704,7 +4704,7 @@ namespace BinDocxRW
int nCurPos = m_oBcw.WriteItemWithLengthStart();
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(m_oBcw.m_oStream, m_pOfficeDrawingConverter);
oBinaryChartWriter.WriteCT_ChartSpace(pChart->m_oChartSpace);
oBinaryChartWriter.WriteCT_ChartSpace(*pChart);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
......@@ -4875,7 +4875,7 @@ namespace BinDocxRW
int nCurPos = m_oBcw.WriteItemWithLengthStart();
BinXlsxRW::BinaryChartWriter oBinaryChartWriter(m_oBcw.m_oStream, m_pOfficeDrawingConverter);
oBinaryChartWriter.WriteCT_ChartSpace(pChart->m_oChartSpace);
oBinaryChartWriter.WriteCT_ChartSpace(*pChart);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
......
......@@ -440,6 +440,8 @@ private:
// theme
CString strTheme = strWord + _T("\\theme");
CreateDirectory(strTheme, NULL);
CString strThemeRels = strTheme + _T("\\_rels");
CreateDirectory(strThemeRels, NULL);
sThemePath = strTheme + _T("\\theme1.xml");
LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_DEFAULT_DOC_THEME), _T("DOCXWR"), sThemePath);
......
......@@ -2,6 +2,6 @@
//2
//0
//0
//166
#define INTVER 2,0,0,166
#define STRVER "2,0,0,166\0"
//167
#define INTVER 2,0,0,167
#define STRVER "2,0,0,167\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