Commit b873fe78 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@55854 954022d7-b5bf-4e40-9824-e11837661b57
parent 2c451f0a
......@@ -2557,13 +2557,13 @@ HRESULT CAVSOfficeDrawingConverter::SaveThemeXml(SAFEARRAY* pBinaryTheme, LONG l
m_oReader.Init(pData, lStart, lLength);
m_oReader.m_oRels.Clear();
m_oReader.m_oRels.StartTheme();
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartTheme();
smart_ptr<PPTX::Theme> pTheme = new PPTX::Theme();
pTheme->fromPPTY(&m_oReader);
m_oXmlWriter.ClearNoAttack();
m_oReader.m_oRels.CloseRels();
m_oReader.m_pRels->CloseRels();
CString strThemePath = (CString)bsThemePath;
......@@ -2578,7 +2578,7 @@ HRESULT CAVSOfficeDrawingConverter::SaveThemeXml(SAFEARRAY* pBinaryTheme, LONG l
else
strTemp += (strFileName + _T(".rels"));
m_oReader.m_oRels.SaveRels(strTemp);
m_oReader.m_pRels->SaveRels(strTemp);
m_oXmlWriter.ClearNoAttack();
......
......@@ -678,14 +678,43 @@ xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\
STDMETHOD(SetDstContentRels)()
{
m_oReader.m_oRels.Clear();
m_oReader.m_oRels.StartRels();
++m_oReader.m_nCurrentRelsStack;
if (0 == m_oReader.m_nCurrentRelsStack)
{
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartRels();
}
else
{
m_oReader.m_stackRels.Add(m_oReader.m_pRels);
NSBinPptxRW::CRelsGenerator* pGenerator = new NSBinPptxRW::CRelsGenerator(m_oReader.m_pRels->m_pManager);
m_oReader.m_pRels = pGenerator;
}
return S_OK;
}
STDMETHOD(SaveDstContentRels)(BSTR bsRelsPath)
{
m_oReader.m_oRels.CloseRels();
m_oReader.m_oRels.SaveRels((CString)bsRelsPath);
m_oReader.m_pRels->CloseRels();
m_oReader.m_pRels->SaveRels((CString)bsRelsPath);
--m_oReader.m_nCurrentRelsStack;
if (-1 > m_oReader.m_nCurrentRelsStack)
m_oReader.m_nCurrentRelsStack = -1;
if (-1 != m_oReader.m_nCurrentRelsStack)
{
int nIndex = m_oReader.m_stackRels.GetCount() - 1;
if (0 <= nIndex)
{
NSBinPptxRW::CRelsGenerator* pCur = m_oReader.m_pRels;
m_oReader.m_pRels = m_oReader.m_stackRels[nIndex];
m_oReader.m_stackRels.RemoveAt(nIndex);
RELEASEOBJECT(pCur);
}
}
return S_OK;
}
STDMETHOD(WriteRels)(BSTR bsType, BSTR bsTarget, BSTR bsTargetMode, LONG* lId)
......@@ -693,7 +722,7 @@ xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\
if (NULL == lId)
return S_FALSE;
*lId = m_oReader.m_oRels.WriteRels(bsType, bsTarget, bsTargetMode);
*lId = m_oReader.m_pRels->WriteRels(bsType, bsTarget, bsTargetMode);
return S_OK;
}
......@@ -708,7 +737,7 @@ xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\
CString name = (CString)ParamName;
if (name == _T("SourceFileDir"))
{
m_oReader.m_oRels.m_pManager = &m_oImageManager;
m_oReader.m_pRels->m_pManager = &m_oImageManager;
m_oImageManager.m_bIsWord = TRUE;
m_oReader.m_strFolder = CString(ParamValue.bstrVal);
}
......
......@@ -1210,7 +1210,7 @@ namespace NSBinPptxRW
LONG m_lNextId;
public:
CRelsGenerator m_oRels;
//CRelsGenerator m_oRels;
CString m_strFolder;
CString m_strFolderThemes;
......@@ -1222,6 +1222,10 @@ namespace NSBinPptxRW
LONG m_lDocumentType;
IUnknown* m_pDrawingConverter;
CRelsGenerator* m_pRels;
CAtlArray<CRelsGenerator*> m_stackRels;
int m_nCurrentRelsStack;
public:
CBinaryFileReader()
......@@ -1236,10 +1240,22 @@ namespace NSBinPptxRW
m_lDocumentType = XMLWRITER_DOC_TYPE_PPTX;
m_pDrawingConverter = NULL;
m_pRels = new CRelsGenerator();
m_nCurrentRelsStack = -1;
}
~CBinaryFileReader()
{
RELEASEINTERFACE(m_pMainDocument);
RELEASEOBJECT(m_pRels);
size_t nCountStackRels = m_stackRels.GetCount();
for (size_t i = 0; i < nCountStackRels; ++i)
{
CRelsGenerator* pCur = m_stackRels[i];
RELEASEOBJECT(pCur);
}
m_stackRels.RemoveAll();
}
AVSINLINE void SetMainDocument(IUnknown* pMainDoc)
......
......@@ -62,7 +62,7 @@ namespace NSBinPptxRW
m_oImageManager.Clear();
m_oImageManager.SetDstMedia(m_strDstFolder + _T("\\ppt\\media"));
m_oReader.m_oRels.m_pManager = &m_oImageManager;
m_oReader.m_pRels->m_pManager = &m_oImageManager;
}
void OpenPPTY(BYTE* pBuffer, int len, CString srcFolder, CString strThemesFolder)
......@@ -263,19 +263,19 @@ namespace NSBinPptxRW
m_arThemes.Add();
m_oReader.m_oRels.Clear();
m_oReader.m_oRels.StartTheme();
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartTheme();
m_arThemes[i].fromPPTY(&m_oReader);
CString strMasterXml = _T("");
strMasterXml.Format(_T("\\theme%d.xml"), i + 1);
oXmlWriter.ClearNoAttack();
m_oReader.m_oRels.CloseRels();
m_oReader.m_pRels->CloseRels();
m_arThemes[i].toXmlWriter(&oXmlWriter);
oXmlWriter.SaveToFile(strFolder + strMasterXml);
m_oReader.m_oRels.SaveRels(strFolderRels + strMasterXml + _T(".rels"));
m_oReader.m_pRels->SaveRels(strFolderRels + strMasterXml + _T(".rels"));
}
}
......@@ -298,8 +298,8 @@ namespace NSBinPptxRW
{
m_arSlideMasters.Add();
m_oReader.m_oRels.Clear();
m_oReader.m_oRels.StartMaster(i, m_arSlideMasters_Theme[i]);
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartMaster(i, m_arSlideMasters_Theme[i]);
m_arSlideMasters[i].fromPPTY(&m_oReader);
CAtlArray<PPTX::Logic::XmlId>& arrLays = m_arSlideMasters[i].sldLayoutIdLst;
......@@ -317,7 +317,7 @@ namespace NSBinPptxRW
}
__nCountLayouts += (LONG)(lLayouts + 1);
m_oReader.m_oRels.CloseRels();
m_oReader.m_pRels->CloseRels();
CString strMasterXml = _T("");
strMasterXml.Format(_T("\\slideMaster%d.xml"), i + 1);
......@@ -326,7 +326,7 @@ namespace NSBinPptxRW
m_arSlideMasters[i].toXmlWriter(&oXmlWriter);
oXmlWriter.SaveToFile(strFolder + strMasterXml);
m_oReader.m_oRels.SaveRels(strFolderRels + strMasterXml + _T(".rels"));
m_oReader.m_pRels->SaveRels(strFolderRels + strMasterXml + _T(".rels"));
}
}
......@@ -347,10 +347,10 @@ namespace NSBinPptxRW
{
m_arSlideLayouts.Add();
m_oReader.m_oRels.Clear();
m_oReader.m_oRels.StartLayout(m_arSlideLayouts_Master[i]);
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartLayout(m_arSlideLayouts_Master[i]);
m_arSlideLayouts[i].fromPPTY(&m_oReader);
m_oReader.m_oRels.CloseRels();
m_oReader.m_pRels->CloseRels();
CString strMasterXml = _T("");
strMasterXml.Format(_T("\\slideLayout%d.xml"), i + 1);
......@@ -359,7 +359,7 @@ namespace NSBinPptxRW
m_arSlideLayouts[i].toXmlWriter(&oXmlWriter);
oXmlWriter.SaveToFile(strFolder + strMasterXml);
m_oReader.m_oRels.SaveRels(strFolderRels + strMasterXml + _T(".rels"));
m_oReader.m_pRels->SaveRels(strFolderRels + strMasterXml + _T(".rels"));
}
}
......@@ -381,13 +381,13 @@ namespace NSBinPptxRW
{
m_arSlides.Add();
m_oReader.m_oRels.Clear();
m_oReader.m_oRels.StartSlide(i, m_arSlides_Layout[i]);
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartSlide(i, m_arSlides_Layout[i]);
m_arSlides[i].fromPPTY(&m_oReader);
if (m_arSlides[i].comments.is_init())
{
m_oReader.m_oRels.WriteSlideComments(nComment);
m_oReader.m_pRels->WriteSlideComments(nComment);
if (1 == nComment)
{
CDirectory::CreateDirectory(m_strDstFolder + _T("\\ppt\\comments"));
......@@ -402,7 +402,7 @@ namespace NSBinPptxRW
++nComment;
}
m_oReader.m_oRels.CloseRels();
m_oReader.m_pRels->CloseRels();
CString strMasterXml = _T("");
strMasterXml.Format(_T("\\slide%d.xml"), i + 1);
......@@ -411,7 +411,7 @@ namespace NSBinPptxRW
m_arSlides[i].toXmlWriter(&oXmlWriter);
oXmlWriter.SaveToFile(strFolder + strMasterXml);
m_oReader.m_oRels.SaveRels(strFolderRels + strMasterXml + _T(".rels"));
m_oReader.m_pRels->SaveRels(strFolderRels + strMasterXml + _T(".rels"));
}
}
......@@ -460,9 +460,9 @@ namespace NSBinPptxRW
LONG lCount = (LONG)m_arSlides.GetCount();
for (LONG i = 0; i < lCount; ++i)
{
m_oReader.m_oRels.Clear();
m_oReader.m_oRels.StartNote(i);
m_oReader.m_oRels.CloseRels();
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartNote(i);
m_oReader.m_pRels->CloseRels();
CString strMasterXml = _T("");
strMasterXml.Format(_T("\\notesSlide%d.xml"), i + 1);
......@@ -471,7 +471,7 @@ namespace NSBinPptxRW
m_oDefaultNote.toXmlWriter(&oXmlWriter);
oXmlWriter.SaveToFile(strFolder + strMasterXml);
m_oReader.m_oRels.SaveRels(strFolderRels + strMasterXml + _T(".rels"));
m_oReader.m_pRels->SaveRels(strFolderRels + strMasterXml + _T(".rels"));
}
}
......@@ -553,8 +553,8 @@ namespace NSBinPptxRW
m_oViewProps.toXmlWriter(&oXmlWriter);
oXmlWriter.SaveToFile(m_strDstFolder + _T("\\ppt\\viewProps.xml"));
m_oReader.m_oRels.Clear();
m_oReader.m_oRels.StartRels();
m_oReader.m_pRels->Clear();
m_oReader.m_pRels->StartRels();
// tablestyles
oXmlWriter.ClearNoAttack();
......@@ -588,10 +588,10 @@ namespace NSBinPptxRW
nCountLayouts += (LONG)(m_arSlideMasters_Theme[i].m_arLayouts.GetCount() + 1);
}
m_oReader.m_oRels.WriteMasters(nCountMasters);
m_oReader.m_oRels.WriteThemes(nCountThemes);
m_oReader.m_pRels->WriteMasters(nCountMasters);
m_oReader.m_pRels->WriteThemes(nCountThemes);
int nCurrentRels = m_oReader.m_oRels.GetNextId();
int nCurrentRels = m_oReader.m_pRels->GetNextId();
m_oPresentation.sldIdLst.RemoveAll();
for (LONG i = 0; i < nCountSlides; ++i)
......@@ -606,21 +606,21 @@ namespace NSBinPptxRW
++nCurrentRels;
}
m_oReader.m_oRels.WriteSlides(nCountSlides);
m_oReader.m_oRels.EndPresentationRels(m_oPresentation.commentAuthors.is_init());
m_oReader.m_pRels->WriteSlides(nCountSlides);
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init());
m_oPresentation.notesMasterIdLst.RemoveAll();
m_oPresentation.notesMasterIdLst.Add();
m_oPresentation.notesMasterIdLst[0].m_name = _T("notesMasterId");
m_oPresentation.notesMasterIdLst[0].rid = (size_t)nCurrentRels;
m_oReader.m_oRels.CloseRels();
m_oReader.m_pRels->CloseRels();
oXmlWriter.ClearNoAttack();
m_oPresentation.toXmlWriter(&oXmlWriter);
oXmlWriter.SaveToFile(strFolder + _T("\\presentation.xml"));
m_oReader.m_oRels.SaveRels(strFolderRels + _T("\\presentation.xml.rels"));
m_oReader.m_pRels->SaveRels(strFolderRels + _T("\\presentation.xml.rels"));
if (m_oPresentation.commentAuthors.is_init())
{
......
......@@ -311,7 +311,7 @@ namespace PPTX
}
// -------------------
LONG lId = pReader->m_oRels.WriteImage(strUrl, strOrigBase64);
LONG lId = pReader->m_pRels->WriteImage(strUrl, strOrigBase64);
// -------------------
if (strTempFile != _T(""))
......
......@@ -142,7 +142,7 @@ namespace PPTX
id = _T("");
else
{
LONG lId = pReader->m_oRels.WriteHyperlink(strUrl, action.is_init());
LONG lId = pReader->m_pRels->WriteHyperlink(strUrl, action.is_init());
CString strRid = _T("");
strRid.Format(_T("rId%d"), lId);
......
......@@ -199,7 +199,7 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"
m_lChartNumber = pReader->m_lChartNumber;
pReader->m_lChartNumber++;
int lId = pReader->m_oRels.WriteChart(m_lChartNumber, pReader->m_lDocumentType);
int lId = pReader->m_pRels->WriteChart(m_lChartNumber, pReader->m_lDocumentType);
//
XlsxCom::IAVSOfficeXlsxSerizer* pSerializer = NULL;
......@@ -218,7 +218,7 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"
var.vt = VT_ARRAY;
NSBinPptxRW::CBinaryFileWriter oWriter;
LPSAFEARRAY pSerializeIM = oWriter.Serialize(pReader->m_oRels.m_pManager);
LPSAFEARRAY pSerializeIM = oWriter.Serialize(pReader->m_pRels->m_pManager);
var.parray = pSerializeIM;
pDrawingConverter->SetAdditionalParam(L"SerializeImageManager2", var);
......@@ -226,7 +226,7 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"
pSerializer->SetDrawingConverter((IUnknown*)pDrawingConverter);
CString strDstChart = pReader->m_oRels.m_pManager->GetDstMedia();
CString strDstChart = pReader->m_pRels->m_pManager->GetDstMedia();
int nPos = strDstChart.ReverseFind(TCHAR('m'));
if (-1 != nPos)
strDstChart = strDstChart.Mid(0, nPos);
......@@ -261,7 +261,7 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"
if (var.parray != NULL)
{
NSBinPptxRW::CBinaryFileReader oReader;
oReader.Deserialize(pReader->m_oRels.m_pManager, var.parray);
oReader.Deserialize(pReader->m_pRels->m_pManager, var.parray);
RELEASEARRAY((var.parray));
}
......
......@@ -298,7 +298,7 @@ namespace PPTX
}
// -------------------
LONG lId = pReader->m_oRels.WriteImage(strUrl, strOrigBase64);
LONG lId = pReader->m_pRels->WriteImage(strUrl, strOrigBase64);
// -------------------
if (strTempFile != _T(""))
......
......@@ -2,6 +2,6 @@
//1
//0
//0
//230
#define INTVER 1,0,0,230
#define STRVER "1,0,0,230\0"
//231
#define INTVER 1,0,0,231
#define STRVER "1,0,0,231\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