From 1a2f9afac7b1ebf3f4843d06d816608ca97b0ed3 Mon Sep 17 00:00:00 2001 From: ElenaSubbotina Date: Thu, 22 Dec 2016 15:12:06 +0300 Subject: [PATCH] x2t linux build, version up --- .../DocDocxConverter/ContentTypes.h | 6 +- ASCOfficeDocFile/DocFormatLib/DocFormatLib.h | 6 +- ASCOfficeDocxFile2/BinReader/Readers.h | 10 +- .../DocWrapper/DocxSerializer.cpp | 16 +- .../DocWrapper/XlsxSerializer.cpp | 35 ++-- .../DocWrapper/XlsxSerializer.h | 16 +- .../PPTFormatLib/PPTFormatLib.cpp | 7 +- ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.h | 9 +- .../PPTFormatLib/PPTXWriter/Converter.cpp | 6 +- .../PPTFormatLib/PPTXWriter/ImageManager.h | 2 +- .../PPTFormatLib/PPTXWriter/ShapeWriter.cpp | 37 ++-- .../PPTFormatLib/PPTXWriter/ShapeWriter.h | 135 +++++++------ .../PPTFormatLib/Reader/PPTFileDefines.h | 4 +- .../PPTFormatLib/Reader/SlidePersist.h | 7 +- .../ASCOfficeDrawingConverter.cpp | 186 ++++++------------ ASCOfficePPTXFile/ASCOfficeDrawingConverter.h | 148 +++++++------- ASCOfficePPTXFile/ASCOfficePPTXFile.h | 28 ++- .../ASCOfficePPTXFileRealization.cpp | 21 +- ASCOfficePPTXFile/Editor/Drawing/Elements.h | 12 +- .../Editor/Drawing/Interactive.h | 4 +- .../PPTXFormat/Logic/Controls.cpp | 1 - .../PPTXFormat/Logic/Geometry.cpp | 6 +- .../PPTXFormat/Logic/SmartArt.cpp | 62 +++--- .../Source/Common/Encoding.cpp | 5 +- .../TxtXmlFormatLib/Source/TxtXmlFile.h | 4 +- Common/Base64.h | 4 +- .../Source/Common/SimpleTypes_Vml.h | 15 -- .../Source/DocxFormat/ContentTypes.h | 9 +- Common/DocxFormat/Source/SystemUtility/File.h | 4 +- .../Source/SystemUtility/SystemUtility.h | 88 +-------- .../Source/XlsxFormat/Chart/Chart.h | 5 +- Common/DocxFormat/Source/XlsxFormat/Xlsx.h | 7 +- DesktopEditor/common/ASCVariant.h | 66 +++---- X2tConverter/build/Qt/X2tConverter.pri | 2 +- .../Reader/ChartFromToBinary.cpp | 25 +-- XlsxSerializerCom/Writer/BinaryReader.h | 53 ++--- 36 files changed, 397 insertions(+), 654 deletions(-) diff --git a/ASCOfficeDocFile/DocDocxConverter/ContentTypes.h b/ASCOfficeDocFile/DocDocxConverter/ContentTypes.h index fd10a975b7..1ab8484730 100644 --- a/ASCOfficeDocFile/DocDocxConverter/ContentTypes.h +++ b/ASCOfficeDocFile/DocDocxConverter/ContentTypes.h @@ -33,11 +33,9 @@ #if defined(_WIN32) || defined(_WIN64) #include -#else - #include "../../DesktopEditor/common/ASCVariant.h" - #include "../../Common/DocxFormat/Source/Base/ASCString.h" #endif -#include + +#include "../../DesktopEditor/common/ASCVariant.h" namespace OpenXmlContentTypes { diff --git a/ASCOfficeDocFile/DocFormatLib/DocFormatLib.h b/ASCOfficeDocFile/DocFormatLib/DocFormatLib.h index 327446afbf..c007a3c83e 100644 --- a/ASCOfficeDocFile/DocFormatLib/DocFormatLib.h +++ b/ASCOfficeDocFile/DocFormatLib/DocFormatLib.h @@ -32,14 +32,12 @@ #ifndef DOC_FORMAT_LIB #define DOC_FORMAT_LIB -#include - #if defined(_WIN32) || defined(_WIN64) #include -#else - #include "../../DesktopEditor/common/ASCVariant.h" #endif +#include "../../DesktopEditor/common/ASCVariant.h" + struct ProgressCallback; class COfficeDocFile diff --git a/ASCOfficeDocxFile2/BinReader/Readers.h b/ASCOfficeDocxFile2/BinReader/Readers.h index d020aa95bc..a988a52b36 100644 --- a/ASCOfficeDocxFile2/BinReader/Readers.h +++ b/ASCOfficeDocxFile2/BinReader/Readers.h @@ -6316,20 +6316,14 @@ public: CString sDrawingProperty = oCDrawingProperty.Write(); if(false == sDrawingProperty.IsEmpty()) { - VARIANT var; - var.vt = VT_I4; - var.lVal = m_oFileWriter.m_oChartWriter.getChartCount(); - m_oFileWriter.m_pDrawingConverter->SetAdditionalParam(CString(_T("DocumentChartsCount")), var); + m_oFileWriter.m_pDrawingConverter->SetDocumentChartsCount(m_oFileWriter.m_oChartWriter.getChartCount()); long nCurPos = m_oBufferedStream.GetPos(); CString* bstrDrawingXml = NULL; m_oFileWriter.m_pDrawingConverter->SaveObjectEx(oCDrawingProperty.DataPos, oCDrawingProperty.DataLength, sDrawingProperty, XMLWRITER_DOC_TYPE_DOCX, &bstrDrawingXml); m_oBufferedStream.Seek(nCurPos); - VARIANT vt; - m_oFileWriter.m_pDrawingConverter->GetAdditionalParam(CString(_T("DocumentChartsCount")), &vt); - if(VT_I4 == vt.vt) - m_oFileWriter.m_oChartWriter.setChartCount(vt.lVal); + m_oFileWriter.m_oChartWriter.setChartCount(m_oFileWriter.m_pDrawingConverter->GetDocumentChartsCount()); if(NULL != bstrDrawingXml && false == bstrDrawingXml->IsEmpty()) { diff --git a/ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp b/ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp index 91751f37aa..e45d7538e9 100644 --- a/ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp +++ b/ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp @@ -286,16 +286,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName); CString sFileInDir = strFileInDir.c_str(); - VARIANT var; - var.vt = VT_BSTR; -#if defined(_WIN32) || defined (_WIN64) - var.bstrVal = sFileInDir.AllocSysString(); - oDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir"), var); - RELEASESYSSTRING(var.bstrVal); -#else - var.bstrVal = sFileInDir.GetString(); - oDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir"), var); -#endif + oDrawingConverter.SetSourceFileDir(sFileInDir); //default theme m_pCurFileWriter->m_oDefaultTheme.Write(sThemePath); @@ -332,10 +323,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const delete pCore; } ///////////////////////////////////////////////////////////////////////////////////// - VARIANT vt; - oDrawingConverter.GetAdditionalParam(CString(_T("ContentTypes")), &vt); - if(VT_BSTR == vt.vt) - m_pCurFileWriter->m_oContentTypesWriter.AddOverrideRaw(CString(vt.bstrVal)); + m_pCurFileWriter->m_oContentTypesWriter.AddOverrideRaw(oDrawingConverter.GetContentTypes()); m_pCurFileWriter->m_oCommentsWriter.Write(); m_pCurFileWriter->m_oChartWriter.Write(); diff --git a/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp b/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp index 5c88434d7f..dbfd6d07c6 100644 --- a/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp +++ b/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp @@ -54,7 +54,7 @@ namespace BinXlsxRW{ { } - void CXlsxSerializer::CreateXlsxFolders(CString& sXmlOptions, CString sDstPath, CString& sMediaPath, CString& sEmbedPath) + void CXlsxSerializer::CreateXlsxFolders(const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath) { OOX::CPath pathMediaDir = sDstPath + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + _T("media"); OOX::CPath pathEmbedDir = sDstPath + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + _T("embeddings"); @@ -83,7 +83,7 @@ namespace BinXlsxRW{ sMediaPath = pathMediaDir.GetPath(); sEmbedPath = pathEmbedDir.GetPath(); } - bool CXlsxSerializer::loadFromFile(const CString& sSrcFileName, const CString& sDstPath, const CString& sXMLOptions, const CString& sMediaDir, const CString& sEmbedDir) + bool CXlsxSerializer::loadFromFile(const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedDir) { NSBinPptxRW::CDrawingConverter oOfficeDrawingConverter; oOfficeDrawingConverter.SetMediaDstPath(sMediaDir); @@ -91,24 +91,14 @@ namespace BinXlsxRW{ //папка с бинарников std::wstring strFileInDir = NSSystemPath::GetDirectoryName(sSrcFileName); - CString sFileInDir = strFileInDir.c_str(); - VARIANT var; - var.vt = VT_BSTR; -#if defined(_WIN32) || defined (_WIN64) - var.bstrVal = sFileInDir.AllocSysString(); - oOfficeDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir2"), var); - RELEASESYSSTRING(var.bstrVal); -#else - var.bstrVal = sFileInDir.GetString(); - oOfficeDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir2"), var); -#endif + oOfficeDrawingConverter.SetSourceFileDir(strFileInDir, 2); BinXlsxRW::BinaryFileReader oBinaryFileReader; oBinaryFileReader.ReadFile(sSrcFileName, sDstPath, &oOfficeDrawingConverter, sXMLOptions); return true; } - bool CXlsxSerializer::saveToFile(const CString& sDstFileName, const CString& sSrcPath, const CString& sXMLOptions) + bool CXlsxSerializer::saveToFile(const std::wstring& sDstFileName, const std::wstring& sSrcPath, const std::wstring& sXMLOptions) { COfficeFontPicker* pFontPicker = new COfficeFontPicker(); pFontPicker->Init(m_sFontDir); @@ -149,7 +139,7 @@ namespace BinXlsxRW{ RELEASEOBJECT(pFontPicker); return true; } - bool CXlsxSerializer::loadChart(CString& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize) + bool CXlsxSerializer::loadChart(const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize) { bool bRes = false; //todo передать нормальный oRootPath @@ -174,7 +164,7 @@ namespace BinXlsxRW{ } return bRes; } - bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, CString& sFilepath, CString& sContentTypePath, CString** sContentTypeElement, const long& lChartNumber) + bool CXlsxSerializer::saveChart(NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, const std::wstring& sFilepath, const std::wstring& sContentTypePath, std::wstring** sContentTypeElement, const long& lChartNumber) { bool bRes = false; *sContentTypeElement = NULL; @@ -192,7 +182,7 @@ namespace BinXlsxRW{ nIndex = sFilenameReverse.Find(FILE_SEPARATOR_CHAR, nIndex + 1); if(-1 != nIndex) { - CString sFilepathLeft = sFilepath.Left(sFilepath.GetLength() - nIndex); + CString sFilepathLeft = sFilepath.substr(0, sFilepath.length() - nIndex); sThemePath = sFilepathLeft + L"theme"; sEmbedingPath = sFilepathLeft + L"embeddings"; } @@ -243,20 +233,21 @@ namespace BinXlsxRW{ CString sContentType(sContentTypePath); sContentType.Append(strFilename); - (*sContentTypeElement) = new CString(); - (*sContentTypeElement)->Format(_T(""), sContentType); - (*sContentTypeElement)->Append(oSaveParams.sAdditionalContentTypes); + std::wstring sContent = L""; + sContent += oSaveParams.sAdditionalContentTypes; + + (*sContentTypeElement) = new std::wstring(sContent); bRes = true; } } return bRes; } - void CXlsxSerializer::setFontDir(std::wstring& sFontDir) + void CXlsxSerializer::setFontDir(const std::wstring& sFontDir) { m_sFontDir = sFontDir; } - void CXlsxSerializer::setEmbeddedFontsDir(std::wstring& sEmbeddedFontsDir) + void CXlsxSerializer::setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir) { m_sEmbeddedFontsDir = sEmbeddedFontsDir; } diff --git a/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h b/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h index 5770060edb..467b08a1a6 100644 --- a/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h +++ b/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h @@ -60,19 +60,19 @@ namespace BinXlsxRW { CXlsxSerializer(); ~CXlsxSerializer(); - void CreateXlsxFolders(CString& sXmlOptions, CString sDstPath, CString& sMediaPath, CString& sEmbedPath); + void CreateXlsxFolders (const std::wstring& sXmlOptions, const std::wstring& sDstPath, std::wstring& sMediaPath, std::wstring& sEmbedPath); - bool loadFromFile(const CString& sSrcFileName, const CString& sDstPath, const CString& sXMLOptions, const CString& sMediaDir, const CString& sEmbedPath); - bool saveToFile(const CString& sSrcFileName, const CString& sDstPath, const CString& sXMLOptions); + bool loadFromFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions, const std::wstring& sMediaDir, const std::wstring& sEmbedPath); + bool saveToFile (const std::wstring& sSrcFileName, const std::wstring& sDstPath, const std::wstring& sXMLOptions); - bool loadChart(CString& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize); - bool saveChart(NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, CString& sFilename, CString& sContentTypePath, CString** sContentTypeElement, const long& lChartNumber); + bool loadChart (const std::wstring& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize); + bool saveChart (NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, const std::wstring& sFilename, const std::wstring& sContentTypePath, std::wstring** sContentTypeElement, const long& lChartNumber); - void setFontDir (std::wstring& sFontDir); - void setEmbeddedFontsDir(std::wstring& sEmbeddedFontsDir); + void setFontDir (const std::wstring& sFontDir); + void setEmbeddedFontsDir(const std::wstring& sEmbeddedFontsDir); void setDrawingConverter(NSBinPptxRW::CDrawingConverter* pDrawingConverter); - void writeChartXlsx(const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart); + void writeChartXlsx (const std::wstring& sDstFile ,const OOX::Spreadsheet::CChartSpace& oChart); }; } #endif // #ifndef XLSX_SERIALIZER diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp b/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp index 71f23e7e07..41671b637f 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.cpp @@ -85,6 +85,7 @@ bool COfficePPTFile::CloseFile() m_pReader = NULL; return S_OK; } + HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath) { if (m_strTempDirectory.length() < 1) @@ -112,13 +113,7 @@ HRESULT COfficePPTFile::LoadFromFile(std::wstring sSrcFileName, std::wstring sDs return S_OK; } -HRESULT COfficePPTFile::GetAdditionalParam (CString sParamName, VARIANT* ParamValue) -{ - if (NULL == ParamValue) - return S_FALSE; - return S_OK; -} CString COfficePPTFile::GetDirectory(CString strFileName) { diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.h b/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.h index b505f70ef1..9c46e9b956 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.h +++ b/ASCOfficePPTFile/PPTFormatLib/PPTFormatLib.h @@ -31,12 +31,7 @@ */ #pragma once -#if defined(_WIN32) || defined (_WIN64) -#else - #include "../../../DesktopEditor/common/ASCVariant.h" - -#endif -#include "../../../Common/DocxFormat/Source/Base/ASCString.h" +#include "../../../DesktopEditor/common/ASCVariant.h" #include @@ -78,8 +73,6 @@ public: HRESULT LoadFromFile(std::wstring sSrcFileName, std::wstring sDstPath); - - HRESULT GetAdditionalParam (CString sParamName, VARIANT* ParamValue); private: bool OpenFile(std::wstring sFileName); diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp index cfd2e277ab..dfe88ce15a 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/Converter.cpp @@ -66,7 +66,7 @@ namespace NSPresentationEditor 1\ "); } -}; +} NSPresentationEditor::CPPTXWriter::CPPTXWriter() @@ -77,7 +77,7 @@ NSPresentationEditor::CPPTXWriter::CPPTXWriter() m_pDocument = NULL; m_pUserInfo = NULL; - m_pShapeWriter = new CShapeWriter(); + m_pShapeWriter = new CShapeWriter(); } NSPresentationEditor::CPPTXWriter::~CPPTXWriter() @@ -940,4 +940,4 @@ void NSPresentationEditor::CPPTXWriter::WriteSlides() CRelsGenerator::StartNotes((int)nIndexS, m_strTempDirectory, m_pDocument->m_arSlides[nIndexS]->m_strComment); WriteSlide((int)nIndexS); } -} \ No newline at end of file +} diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ImageManager.h b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ImageManager.h index a009af85b3..a2dcaaafe5 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ImageManager.h +++ b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ImageManager.h @@ -42,7 +42,7 @@ namespace NSPresentationEditor private: std::map m_mapImages; - LONG m_lIndexNextImage; + long m_lIndexNextImage; std::wstring m_strDstMedia; public: diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp index 9836116a47..e7b357f63e 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp +++ b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.cpp @@ -70,7 +70,7 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe oWriter.WriteString(L" marL=\"" + strProp + L"\""); if (pPF->indent.is_init() == false) - pPF->indent = (LONG)0; + pPF->indent = (LONG)0; } if (pPF->indent.is_init()) { @@ -84,7 +84,7 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe } if (pPF->defaultTabSize.is_init()) { - std::wstring strProp = std::to_wstring(pPF->defaultTabSize.get()); + std::wstring strProp = std::to_wstring(pPF->defaultTabSize.get()); oWriter.WriteString(L" defTabSz=\"" + strProp + L"\""); } oWriter.WriteString(L">"); @@ -150,7 +150,7 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe double dKoef1 = 3.52777778; if (pPF->lineSpacing.is_init()) { - LONG val = pPF->lineSpacing.get(); + LONG val = pPF->lineSpacing.get(); if (val > 0) { std::wstring str = std::to_wstring( (int)(val * 0.125 * 100/*/ dKoef1*/)); @@ -164,7 +164,7 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe } if (pPF->spaceAfter.is_init()) { - LONG val = pPF->spaceAfter.get(); + LONG val = pPF->spaceAfter.get(); if (val > 0) { std::wstring str = std::to_wstring((int)(val * 0.125 * 100/*/ dKoef1*/)); @@ -178,7 +178,7 @@ void CStylesWriter::ConvertStyleLevel(NSPresentationEditor::CTextStyleLevel& oLe } if (pPF->spaceBefore.is_init()) { - LONG val = pPF->spaceBefore.get(); + LONG val = pPF->spaceBefore.get(); if (val > 0) { std::wstring str = std::to_wstring((int)(val * 0.125 * 100/*/ dKoef1*/)); @@ -1158,8 +1158,8 @@ CString NSPresentationEditor::CShapeWriter::ConvertShape() oInfo.m_bFlipH = m_pShapeElement->m_bFlipH; oInfo.m_bFlipV = m_pShapeElement->m_bFlipV; - oInfo.m_lOriginalWidth = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetWidth(); - oInfo.m_lOriginalHeight = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetHeight(); + oInfo.m_lOriginalWidth = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetWidth(); + oInfo.m_lOriginalHeight = (LONG)m_pShapeElement->m_rcBoundsOriginal.GetHeight(); m_oWriter.WriteString(std::wstring(L"")); @@ -1280,8 +1280,8 @@ CString NSPresentationEditor::CShapeWriter::ConvertImage() oInfo.m_bFlipH = m_pImageElement->m_bFlipH; oInfo.m_bFlipV = m_pImageElement->m_bFlipV; - oInfo.m_lOriginalWidth = (LONG)m_pImageElement->m_rcBoundsOriginal.GetWidth(); - oInfo.m_lOriginalHeight = (LONG)m_pImageElement->m_rcBoundsOriginal.GetHeight(); + oInfo.m_lOriginalWidth = (LONG)m_pImageElement->m_rcBoundsOriginal.GetWidth(); + oInfo.m_lOriginalHeight = (LONG)m_pImageElement->m_rcBoundsOriginal.GetHeight(); m_oWriter.WriteString(std::wstring(L"")); @@ -1432,7 +1432,7 @@ HRESULT NSPresentationEditor::CShapeWriter::get_DpiY(double* dDpiY) return S_OK; } // pen -------------------------------------------------------------------------------------- -HRESULT NSPresentationEditor::CShapeWriter::SetPen(BSTR bsXML) +HRESULT NSPresentationEditor::CShapeWriter::SetPen(std::wstring bsXML) { //m_oPen.FromXmlString((CString)bsXML); return S_OK; @@ -1550,7 +1550,7 @@ HRESULT NSPresentationEditor::CShapeWriter::PenDashPattern(double* pPattern, LON return S_OK; } // brush ------------------------------------------------------------------------------------ -HRESULT NSPresentationEditor::CShapeWriter::SetBrush(BSTR bsXML) +HRESULT NSPresentationEditor::CShapeWriter::SetBrush(std::wstring bsXML) { //m_oBrush.FromXmlString((CString)bsXML); return S_OK; @@ -1670,7 +1670,7 @@ HRESULT NSPresentationEditor::CShapeWriter::put_BrushGradientColors(LONG* lColor return S_OK; } // font ------------------------------------------------------------------------------------- -HRESULT NSPresentationEditor::CShapeWriter::SetFont(BSTR bsXML) +HRESULT NSPresentationEditor::CShapeWriter::SetFont(std::wstring bsXML) { //m_oFont.FromXmlString((CString)bsXML); return S_OK; @@ -1747,7 +1747,7 @@ HRESULT NSPresentationEditor::CShapeWriter::put_FontFaceIndex(const int& lFaceIn return S_OK; } // shadow ----------------------------------------------------------------------------------- -HRESULT NSPresentationEditor::CShapeWriter::SetShadow(BSTR bsXML) +HRESULT NSPresentationEditor::CShapeWriter::SetShadow(std::wstring bsXML) { //m_oShadow.FromXmlString((CString)bsXML); return S_OK; @@ -1813,7 +1813,7 @@ HRESULT NSPresentationEditor::CShapeWriter::put_ShadowVisible(bool val) return S_OK; } // edge ------------------------------------------------------------------------------------- -HRESULT NSPresentationEditor::CShapeWriter::SetEdgeText(BSTR bsXML) +HRESULT NSPresentationEditor::CShapeWriter::SetEdgeText(std::wstring bsXML) { //m_oEdge.FromXmlString((CString)bsXML); return S_OK; @@ -2173,13 +2173,4 @@ HRESULT NSPresentationEditor::CShapeWriter::put_ClipMode(const LONG& lMode) m_lClipMode = lMode; return S_OK; } -// additiaonal params ---------------------------------------------------------------------- -HRESULT NSPresentationEditor::CShapeWriter::SetAdditionalParam(BSTR ParamName, VARIANT ParamValue) -{ - return S_OK; -} -HRESULT NSPresentationEditor::CShapeWriter::GetAdditionalParam(BSTR ParamName, VARIANT* ParamValue) -{ - return S_OK; -} // -------------------------------------------------------------------------------------------- diff --git a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.h b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.h index 58513fc58f..69a63c7a02 100644 --- a/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.h +++ b/ASCOfficePPTFile/PPTFormatLib/PPTXWriter/ShapeWriter.h @@ -37,7 +37,7 @@ namespace NSPresentationEditor { - static inline LONG GetPPTXPlaceHolderType(const int & lType) + static inline LONG GetPPTXPlaceHolderType(const int & lType) { switch (lType) { @@ -150,7 +150,7 @@ namespace NSPresentationEditor NSPresentationEditor::CRelsGenerator* m_pRels; - LONG m_lNextShapeID; + LONG m_lNextShapeID; bool m_bWordArt; bool m_bTextBox; @@ -212,9 +212,9 @@ namespace NSPresentationEditor CString ConvertLine (CPen & pen); CString ConvertShadow (CShadow & shadow); CString ConvertBrush (CBrush & brush); - static CString ConvertColor (CColor & color, long alpha); + static CString ConvertColor (CColor & color, long alpha); // тип рендерера----------------------------------------------------------------------------- - virtual HRESULT get_Type(LONG* lType) ; + virtual HRESULT get_Type(LONG* lType) ; //-------- Функции для работы со страницей -------------------------------------------------- virtual HRESULT NewPage() ; virtual HRESULT get_Height(double* dHeight); @@ -225,10 +225,10 @@ namespace NSPresentationEditor virtual HRESULT get_DpiY(double* dDpiY) ; // pen -------------------------------------------------------------------------------------- - virtual HRESULT get_PenColor(LONG* lColor) ; - virtual HRESULT put_PenColor(const LONG& lColor); - virtual HRESULT get_PenAlpha(LONG* lAlpha) ; - virtual HRESULT put_PenAlpha(const LONG& lAlpha); + virtual HRESULT get_PenColor(LONG* lColor) ; + virtual HRESULT put_PenColor(const LONG& lColor); + virtual HRESULT get_PenAlpha(LONG* lAlpha) ; + virtual HRESULT put_PenAlpha(const LONG& lAlpha); virtual HRESULT get_PenSize(double* dSize) ; virtual HRESULT put_PenSize(const double& dSize); virtual HRESULT get_PenDashStyle(BYTE* val) ; @@ -241,35 +241,35 @@ namespace NSPresentationEditor virtual HRESULT put_PenLineJoin(const BYTE& val); virtual HRESULT get_PenDashOffset(double* dOffset); virtual HRESULT put_PenDashOffset(const double& dOffset); - virtual HRESULT get_PenAlign(LONG* lAlign) ; - virtual HRESULT put_PenAlign(const LONG& lAlign); + virtual HRESULT get_PenAlign(LONG* lAlign) ; + virtual HRESULT put_PenAlign(const LONG& lAlign); virtual HRESULT get_PenMiterLimit(double* dOffset); virtual HRESULT put_PenMiterLimit(const double& dOffset); - virtual HRESULT PenDashPattern(double* pPattern, LONG lCount); + virtual HRESULT PenDashPattern(double* pPattern, LONG lCount); // brush ------------------------------------------------------------------------------------ - virtual HRESULT get_BrushType(LONG* lType) ; - virtual HRESULT put_BrushType(const LONG& lType) ; - virtual HRESULT get_BrushColor1(LONG* lColor) ; - virtual HRESULT put_BrushColor1(const LONG& lColor) ; - virtual HRESULT get_BrushAlpha1(LONG* lAlpha) ; - virtual HRESULT put_BrushAlpha1(const LONG& lAlpha) ; - virtual HRESULT get_BrushColor2(LONG* lColor) ; - virtual HRESULT put_BrushColor2(const LONG& lColor) ; - virtual HRESULT get_BrushAlpha2(LONG* lAlpha) ; - virtual HRESULT put_BrushAlpha2(const LONG& lAlpha) ; + virtual HRESULT get_BrushType(LONG* lType) ; + virtual HRESULT put_BrushType(const LONG& lType) ; + virtual HRESULT get_BrushColor1(LONG* lColor) ; + virtual HRESULT put_BrushColor1(const LONG& lColor) ; + virtual HRESULT get_BrushAlpha1(LONG* lAlpha) ; + virtual HRESULT put_BrushAlpha1(const LONG& lAlpha) ; + virtual HRESULT get_BrushColor2(LONG* lColor) ; + virtual HRESULT put_BrushColor2(const LONG& lColor) ; + virtual HRESULT get_BrushAlpha2(LONG* lAlpha) ; + virtual HRESULT put_BrushAlpha2(const LONG& lAlpha) ; virtual HRESULT get_BrushTexturePath(std::wstring* bsPath); virtual HRESULT put_BrushTexturePath(const std::wstring& bsPath); - virtual HRESULT get_BrushTextureMode(LONG* lMode) ; - virtual HRESULT put_BrushTextureMode(const LONG& lMode) ; - virtual HRESULT get_BrushTextureAlpha(LONG* lTxAlpha) ; - virtual HRESULT put_BrushTextureAlpha(const LONG& lTxAlpha); + virtual HRESULT get_BrushTextureMode(LONG* lMode) ; + virtual HRESULT put_BrushTextureMode(const LONG& lMode) ; + virtual HRESULT get_BrushTextureAlpha(LONG* lTxAlpha) ; + virtual HRESULT put_BrushTextureAlpha(const LONG& lTxAlpha); virtual HRESULT get_BrushLinearAngle(double* dAngle) ; virtual HRESULT put_BrushLinearAngle(const double& dAngle); virtual HRESULT BrushRect(const INT& val, const double& left, const double& top, const double& width, const double& height); virtual HRESULT BrushBounds(const double& left, const double& top, const double& width, const double& height); - virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount); + virtual HRESULT put_BrushGradientColors(LONG* lColors, double* pPositions, LONG nCount); // font ------------------------------------------------------------------------------------- virtual HRESULT get_FontName(std::wstring* bsName); @@ -278,8 +278,8 @@ namespace NSPresentationEditor virtual HRESULT put_FontPath(const std::wstring& bsName); virtual HRESULT get_FontSize(double* dSize) ; virtual HRESULT put_FontSize(const double& dSize); - virtual HRESULT get_FontStyle(LONG* lStyle) ; - virtual HRESULT put_FontStyle(const LONG& lStyle); + virtual HRESULT get_FontStyle(LONG* lStyle) ; + virtual HRESULT put_FontStyle(const LONG& lStyle); virtual HRESULT get_FontStringGID(INT* bGID) ; virtual HRESULT put_FontStringGID(const INT& bGID); virtual HRESULT get_FontCharSpace(double* dSpace); @@ -307,7 +307,7 @@ namespace NSPresentationEditor virtual HRESULT PathCommandArcTo(const double& x, const double& y, const double& w, const double& h, const double& startAngle, const double& sweepAngle); virtual HRESULT PathCommandClose() ; virtual HRESULT PathCommandEnd() ; - virtual HRESULT DrawPath(const LONG& nType) ; + virtual HRESULT DrawPath(const LONG& nType) ; virtual HRESULT PathCommandStart() ; virtual HRESULT PathCommandGetCurrentPoint(double* x, double* y); @@ -329,48 +329,45 @@ namespace NSPresentationEditor virtual HRESULT ResetTransform(); // ----------------------------------------------------------------------------------------- - virtual HRESULT get_ClipMode(LONG* plMode); - virtual HRESULT put_ClipMode(const LONG& lMode) ; + virtual HRESULT get_ClipMode(LONG* plMode); + virtual HRESULT put_ClipMode(const LONG& lMode) ; // additiaonal params ---------------------------------------------------------------------- - virtual HRESULT CommandLong(const LONG& lType, const LONG& lCommand); - virtual HRESULT CommandDouble(const LONG& lType, const double& dCommand) ; - virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand); + virtual HRESULT CommandLong(const LONG& lType, const LONG& lCommand); + virtual HRESULT CommandDouble(const LONG& lType, const double& dCommand) ; + virtual HRESULT CommandString(const LONG& lType, const std::wstring& sCommand); ////////////////////////////////////////////////////////////////////////////////////////////////// - // shadow ----------------------------------------------------------------------------------- - HRESULT SetShadow (BSTR bsXML); - HRESULT get_ShadowDistanceX (double* val); - HRESULT put_ShadowDistanceX (double val); - HRESULT get_ShadowDistanceY (double* val); - HRESULT put_ShadowDistanceY (double val); - HRESULT get_ShadowBlurSize (double* val); - HRESULT put_ShadowBlurSize (double val); - HRESULT get_ShadowColor (LONG* val); - HRESULT put_ShadowColor (LONG val); - HRESULT get_ShadowAlpha (LONG* val); - HRESULT put_ShadowAlpha (LONG val); + // shadow ----------------------------------------------------------------------------------- + HRESULT SetShadow (std::wstring bsXML); + HRESULT get_ShadowDistanceX (double* val); + HRESULT put_ShadowDistanceX (double val); + HRESULT get_ShadowDistanceY (double* val); + HRESULT put_ShadowDistanceY (double val); + HRESULT get_ShadowBlurSize (double* val); + HRESULT put_ShadowBlurSize (double val); + HRESULT get_ShadowColor (LONG* val); + HRESULT put_ShadowColor (LONG val); + HRESULT get_ShadowAlpha (LONG* val); + HRESULT put_ShadowAlpha (LONG val); HRESULT get_ShadowVisible (bool* val); HRESULT put_ShadowVisible (bool val); - // edge ------------------------------------------------------------------------------------- - HRESULT SetEdgeText (BSTR bsXML); - HRESULT get_EdgeVisible (LONG* val); - HRESULT put_EdgeVisible (LONG val); - HRESULT get_EdgeColor (LONG* val); - HRESULT put_EdgeColor (LONG val); - HRESULT get_EdgeAlpha (LONG* val); - HRESULT put_EdgeAlpha (LONG val); - HRESULT get_EdgeDist (double* val); - HRESULT put_EdgeDist (double val); + // edge ------------------------------------------------------------------------------------- + HRESULT SetEdgeText (std::wstring bsXML); + HRESULT get_EdgeVisible (LONG* val); + HRESULT put_EdgeVisible (LONG val); + HRESULT get_EdgeColor (LONG* val); + HRESULT put_EdgeColor (LONG val); + HRESULT get_EdgeAlpha (LONG* val); + HRESULT put_EdgeAlpha (LONG val); + HRESULT get_EdgeDist (double* val); + HRESULT put_EdgeDist (double val); - HRESULT SetFont(BSTR bsXML); - HRESULT SetPen(BSTR bsXML); - HRESULT SetBrush(BSTR bsXML); - // additiaonal params ---------------------------------------------------------------------- - HRESULT SetAdditionalParam (BSTR ParamName, VARIANT ParamValue); - HRESULT GetAdditionalParam (BSTR ParamName, VARIANT* ParamValue); - public: - void SetRelsGenerator(CRelsGenerator* pGenerator) + HRESULT SetFont(std::wstring bsXML); + HRESULT SetPen(std::wstring bsXML); + HRESULT SetBrush(std::wstring bsXML); + public: + void SetRelsGenerator(CRelsGenerator* pGenerator) { m_pRels = pGenerator; } @@ -417,12 +414,12 @@ namespace NSPresentationEditor double m_dTransformAngle; - LONG m_lCurrentCommandType; // текущая команда + LONG m_lCurrentCommandType; // текущая команда double m_dDpiX; double m_dDpiY; - LONG m_lClipMode; + LONG m_lClipMode; CPen m_oPen; // настройки всей графики (скопирован ашник из AVSGraphics) CBrush m_oBrush; @@ -443,7 +440,7 @@ namespace NSPresentationEditor m_oFullTransform.TransformPoint(x, y); CString str = _T(""); - str.Format(_T(""), (LONG)x, (LONG)y); + str.Format(_T(""), (LONG)x, (LONG)y); m_oWriterPath.WriteString(str); } inline void LineTo(const double& dX, const double& dY) @@ -453,7 +450,7 @@ namespace NSPresentationEditor m_oFullTransform.TransformPoint(x, y); CString str = _T(""); - str.Format(_T(""), (LONG)x, (LONG)y); + str.Format(_T(""), (LONG)x, (LONG)y); m_oWriterPath.WriteString(str); } inline void CurveTo(const double& x1, const double& y1, const double& x2, const double& y2, const double& x3, const double& y3) @@ -472,7 +469,7 @@ namespace NSPresentationEditor CString str = _T(""); str.Format(_T(""), - (LONG)_x1, (LONG)_y1, (LONG)_x2, (LONG)_y2, (LONG)_x3, (LONG)_y3); + (LONG)_x1, (LONG)_y1, (LONG)_x2, (LONG)_y2, (LONG)_x3, (LONG)_y3); m_oWriterPath.WriteString(str); } void Start() diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileDefines.h b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileDefines.h index 952461b64b..cacb4a6bbf 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileDefines.h +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/PPTFileDefines.h @@ -35,10 +35,10 @@ #if defined(_WIN32) || defined (_WIN64) #include -#else - #include "../../../DesktopEditor/common/ASCVariant.h" #endif +#include "../../../DesktopEditor/common/ASCVariant.h" + typedef BYTE BOOL1; #define PSFLAG_CONTAINER 0xFF diff --git a/ASCOfficePPTFile/PPTFormatLib/Reader/SlidePersist.h b/ASCOfficePPTFile/PPTFormatLib/Reader/SlidePersist.h index 1633a59b12..0163ca20d2 100644 --- a/ASCOfficePPTFile/PPTFormatLib/Reader/SlidePersist.h +++ b/ASCOfficePPTFile/PPTFormatLib/Reader/SlidePersist.h @@ -31,12 +31,7 @@ */ #pragma once -#if defined(_WIN32) || defined (_WIN64) -#else - #include "../../../DesktopEditor/common/ASCVariant.h" -#endif - -#include "../../../Common/DocxFormat/Source/Base/ASCString.h" +#include "../../../DesktopEditor/common/ASCVariant.h" #include /************************************************************** diff --git a/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp b/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp index 57ec50ada2..3865cbe0cd 100644 --- a/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp +++ b/ASCOfficePPTXFile/ASCOfficeDrawingConverter.cpp @@ -798,21 +798,14 @@ CElementProps::~CElementProps() } void CElementProps::FinalRelease() { -#if defined(_WIN32) || defined (_WIN64) // linux: BSTR = CString - for (std::map::iterator pPair = m_Properties.begin(); pPair != m_Properties.end(); ++pPair) - { - if (pPair->second.vt == VT_BSTR) - SysFreeString(pPair->second.bstrVal); - } -#endif m_Properties.clear(); } -HRESULT CElementProps::GetProperty(LONG lId, VARIANT* pProp) +HRESULT CElementProps::GetProperty(LONG lId, ASC_VARIANT* pProp) { if (NULL == pProp) return S_FALSE; - std::map::iterator pPair = m_Properties.find(lId); + std::map::iterator pPair = m_Properties.find(lId); if (m_Properties.end() == pPair) return S_FALSE; @@ -825,26 +818,18 @@ HRESULT CElementProps::GetProperty(LONG lId, VARIANT* pProp) return S_OK; } -HRESULT CElementProps::SetProperty(LONG lId, VARIANT prop) +HRESULT CElementProps::SetProperty(LONG lId, ASC_VARIANT prop) { - VARIANT var; + ASC_VARIANT var; bool bIsSupportProp = CopyProperty(var, prop); - if (!bIsSupportProp) + + if (!bIsSupportProp) return S_FALSE; -#if defined(_WIN32) || defined (_WIN64) - std::map::iterator pPair = m_Properties.find(lId); - if (m_Properties.end() != pPair) - { - if (pPair->second.vt == VT_BSTR) - SysFreeString(pPair->second.bstrVal); - } -#endif - - m_Properties.insert(std::pair(lId, var)); + m_Properties.insert(std::pair(lId, var)); return S_OK; } -bool CElementProps::CopyProperty(VARIANT& oDst, const VARIANT& oSrc) +bool CElementProps::CopyProperty(ASC_VARIANT& oDst, const ASC_VARIANT& oSrc) { oDst.vt = oSrc.vt; switch (oDst.vt) @@ -861,11 +846,8 @@ bool CElementProps::CopyProperty(VARIANT& oDst, const VARIANT& oSrc) } case VT_BSTR: { -#if defined(_WIN32) || defined (_WIN64) - oDst.bstrVal = SysAllocString(oSrc.bstrVal); -#else - oDst.bstrVal = oSrc.bstrVal; -#endif + + oDst.strVal = oSrc.strVal; break; } default: @@ -5043,6 +5025,7 @@ HRESULT CDrawingConverter::SetFontPicker(COfficeFontPicker* pFontPicker) m_pBinaryWriter->m_pCommon->CreateFontPicker(pFontPicker); return S_OK; } + HRESULT CDrawingConverter::SetAdditionalParam(const CString& ParamName, BYTE *pArray, size_t szCount) { CString name = (CString)ParamName; @@ -5058,56 +5041,13 @@ HRESULT CDrawingConverter::SetAdditionalParam(const CString& ParamName, BYTE *pA } if (name == L"xfrm_override" && pArray) { - PPTX::Logic::Xfrm *pXfrm = (PPTX::Logic::Xfrm*)pArray; + PPTX::Logic::Xfrm *pXfrm = (PPTX::Logic::Xfrm*)pArray; - m_oxfrm_override = new PPTX::Logic::Xfrm(*pXfrm); - } + m_oxfrm_override = new PPTX::Logic::Xfrm(*pXfrm); + } return S_OK; } -HRESULT CDrawingConverter::SetAdditionalParam(const CString& ParamName, VARIANT ParamValue) -{ - CString name = (CString)ParamName; - if (name == L"SourceFileDir") - { - m_pReader->m_pRels->m_pManager = m_pImageManager; - m_pImageManager->m_bIsWord = true; - m_pReader->m_strFolder = CString(ParamValue.bstrVal); - } - else if (name == L"SourceFileDir2") - { - m_pReader->m_pRels->m_pManager = m_pImageManager; - m_pImageManager->m_bIsWord = false; - m_pReader->m_strFolder = CString(ParamValue.bstrVal); - } - else if (name == L"UseConvertion2007") - { - m_bIsUseConvertion2007 = (ParamValue.boolVal == VARIANT_TRUE) ? true : false; - } - else if (name == L"SerializeImageManager") - { - // moved to CDrawingConverter::SetAdditionalParam(const CString& ParamName, BYTE **pArray, size_t& szCount) - return S_FALSE; - //NSBinPptxRW::CBinaryFileReader oReader; - //oReader.Deserialize(m_pBinaryWriter->m_pCommon->m_pImageManager, ParamValue.parray); - } - else if (name == L"SerializeImageManager2") - { - // moved to CDrawingConverter::SetAdditionalParam(const CString& ParamName, BYTE **pArray, size_t& szCount) - return S_FALSE; - //NSBinPptxRW::CBinaryFileReader oReader; - //oReader.Deserialize(m_pImageManager, ParamValue.parray); - } - else if (name == L"DocumentChartsCount" && ParamValue.vt == VT_I4) - { - m_pReader->m_lChartNumber = ParamValue.lVal + 1; - } - else if (name == L"ObjectIdVML" && ParamValue.vt == VT_I4) - { - m_pXmlWriter->m_lObjectIdVML = ParamValue.lVal; - } - return S_OK; -} HRESULT CDrawingConverter::GetAdditionalParam(const CString& ParamName, BYTE **pArray, size_t& szCount) { CString name = (CString)ParamName; @@ -5125,64 +5065,50 @@ HRESULT CDrawingConverter::GetAdditionalParam(const CString& ParamName, BYTE **p } return S_OK; } -HRESULT CDrawingConverter::GetAdditionalParam(const CString& ParamName, VARIANT* ParamValue) +void CDrawingConverter::SetObjectIdVML(int val) { - CString name = (CString)ParamName; - - if (name == L"SerializeImageManager") - { - // moved to GetAdditionalParam(const CString& ParamName, BYTE **pArray, size_t& szCount) - return S_FALSE; - /* - NSBinPptxRW::CBinaryFileWriter oWriter; - - ParamValue->vt = VT_ARRAY; - ParamValue->parray = oWriter.Serialize(m_pBinaryWriter->m_pCommon->m_pImageManager); - */ - } - else if (name == L"SerializeImageManager2") - { - // moved to GetAdditionalParam(const CString& ParamName, BYTE **pArray, size_t& szCount) - return S_FALSE; - /* - NSBinPptxRW::CBinaryFileWriter oWriter; - - ParamValue->vt = VT_ARRAY; - ParamValue->parray = oWriter.Serialize(m_pImageManager); - */ - } - else if (name == L"DocumentChartsCount") - { - ParamValue->vt = VT_I4; - ParamValue->lVal = m_pReader->m_lChartNumber - 1; - } - else if (name == L"ObjectIdVML") - { - ParamValue->vt = VT_I4; - ParamValue->lVal = m_pXmlWriter->m_lObjectIdVML; - } - else if (name == L"OleXlsx") - { - ParamValue->vt = VT_BSTR; -#if defined(_WIN32) || defined (_WIN64) - BSTR val = SysAllocString(m_pXmlWriter->m_strOleXlsx.c_str()); - ParamValue->bstrVal = val; - SysFreeString(val); -#else - ParamValue->bstrVal = m_pXmlWriter->m_strOleXlsx; -#endif - } - else if (name == L"ContentTypes") - { - ParamValue->vt = VT_BSTR; -#if defined(_WIN32) || defined (_WIN64) - ParamValue->bstrVal = m_pReader->m_strContentTypes.AllocSysString(); -#else - ParamValue->bstrVal = m_pReader->m_strContentTypes; -#endif - } - return S_OK; + m_pXmlWriter->m_lObjectIdVML = val; } + +int CDrawingConverter::GetObjectIdVML() +{ + return m_pXmlWriter->m_lObjectIdVML; +} + +void CDrawingConverter::SetDocumentChartsCount (int val) +{ + m_pReader->m_lChartNumber = val + 1; +} +int CDrawingConverter::GetDocumentChartsCount () +{ + return m_pReader->m_lChartNumber - 1; +} + +std::wstring CDrawingConverter::GetContentTypes() +{ + return m_pReader->m_strContentTypes; +} + +std::wstring CDrawingConverter::GetOleXlsx() +{ + return m_pXmlWriter->m_strOleXlsx; +} + +void CDrawingConverter::SetSourceFileDir(std::wstring path, int type) +{ + m_pReader->m_pRels->m_pManager = m_pImageManager; + m_pReader->m_strFolder = path; + + if (type == 1) + { + m_pImageManager->m_bIsWord = true; + } + else if (type ==2) + { + m_pImageManager->m_bIsWord = false; + } +} + void CDrawingConverter::Clear() { for (std::map::iterator pPair = m_mapShapeTypes.begin(); pPair != m_mapShapeTypes.end(); ++pPair) diff --git a/ASCOfficePPTXFile/ASCOfficeDrawingConverter.h b/ASCOfficePPTXFile/ASCOfficeDrawingConverter.h index 5470e3351c..95c8c301d3 100644 --- a/ASCOfficePPTXFile/ASCOfficeDrawingConverter.h +++ b/ASCOfficePPTXFile/ASCOfficeDrawingConverter.h @@ -32,12 +32,7 @@ #ifndef ASC_OFFICE_DRAWING_CONVERTER #define ASC_OFFICE_DRAWING_CONVERTER -#include "../Common/DocxFormat/Source/Base/ASCString.h" - -#if defined(_WIN32) || defined (_WIN64) -#else - #include "../DesktopEditor/common/ASCVariant.h" -#endif +#include "../DesktopEditor/common/ASCVariant.h" #include "../Common/DocxFormat/Source/Base/Base.h" #include "../Common/DocxFormat/Source/Base/Nullable.h" @@ -89,7 +84,7 @@ namespace PPTX { public: std::vector m_arParams; - TCHAR m_Separator; + TCHAR m_Separator; public: CStringTrimmer(); @@ -104,8 +99,8 @@ namespace PPTX class CCSS { public: - std::map m_mapSettings; - CString m_strClassName; + std::map m_mapSettings; + CString m_strClassName; public: CCSS(); @@ -134,10 +129,10 @@ namespace PPTX class CSpTreeElemProps { public: - LONG X; - LONG Y; - LONG Width; - LONG Height; + long X; + long Y; + long Width; + long Height; bool IsTop; @@ -148,7 +143,7 @@ public: class CElementProps { public: - std::map m_Properties; + std::map m_Properties; public: CElementProps(); @@ -158,11 +153,11 @@ public: void FinalRelease(); public: - HRESULT(GetProperty)(LONG lId, VARIANT* pProp); - HRESULT(SetProperty)(LONG lId, VARIANT prop); + HRESULT(GetProperty)(long lId, ASC_VARIANT* pProp); + HRESULT(SetProperty)(long lId, ASC_VARIANT prop); public: - static bool CopyProperty(VARIANT& oDst, const VARIANT& oSrc); + static bool CopyProperty(ASC_VARIANT& oDst, const ASC_VARIANT& oSrc); }; @@ -186,91 +181,100 @@ namespace NSBinPptxRW }; - std::map m_mapShapeTypes; + std::map m_mapShapeTypes; std::map> m_mapRels; - CString m_strCurrentRelsPath; + CString m_strCurrentRelsPath; - NSBinPptxRW::CBinaryFileWriter* m_pBinaryWriter; - int m_lNextId; + NSBinPptxRW::CBinaryFileWriter* m_pBinaryWriter; + int m_lNextId; - int m_lCurrentObjectTop; + int m_lCurrentObjectTop; - NSBinPptxRW::CBinaryFileReader* m_pReader; - NSBinPptxRW::CImageManager2* m_pImageManager; - NSBinPptxRW::CXmlWriter* m_pXmlWriter; - int m_nCurrentIndexObject; - IRenderer* m_pOOXToVMLRenderer; - bool m_bIsUseConvertion2007; + NSBinPptxRW::CBinaryFileReader* m_pReader; + NSBinPptxRW::CImageManager2* m_pImageManager; + NSBinPptxRW::CXmlWriter* m_pXmlWriter; + int m_nCurrentIndexObject; + IRenderer* m_pOOXToVMLRenderer; + bool m_bIsUseConvertion2007; NSCommon::smart_ptr* m_pTheme; NSCommon::smart_ptr* m_pClrMap; - CString m_strFontDirectory; - public: + CString m_strFontDirectory; CDrawingConverter(); ~CDrawingConverter(); - public: - HRESULT SetMainDocument (BinDocxRW::CDocxSerializer* pDocument); - HRESULT SetRelsPath (const CString& bsRelsPath); - CString GetRelsPath(); - HRESULT SetMediaDstPath (const CString& bsMediaPath); - HRESULT SetEmbedDstPath (const CString& bsEmbedPath); - HRESULT AddShapeType(const CString& bsXml); - HRESULT AddObject(const CString& bsXml, CString** pMainProps); - HRESULT GetThemeBinary(BYTE** ppBinary, long& lBinarySize, const CString& bsThemeFilePath); + HRESULT SetMainDocument (BinDocxRW::CDocxSerializer* pDocument); + HRESULT SetRelsPath (const CString& bsRelsPath); + CString GetRelsPath (); + HRESULT SetMediaDstPath (const CString& bsMediaPath); + HRESULT SetEmbedDstPath (const CString& bsEmbedPath); - HRESULT SaveThemeXml(LONG lStart, LONG lLength, const CString& bsThemePath); - HRESULT SaveObject(LONG lStart, LONG lLength, const CString& bsMainProps, CString** bsXml); - HRESULT SaveObjectEx(LONG lStart, LONG lLength, const CString& bsMainProps, LONG lDocType, CString** bsXml); + HRESULT AddShapeType (const CString& bsXml); + HRESULT AddObject (const CString& bsXml, CString** pMainProps); + HRESULT GetThemeBinary (BYTE** ppBinary, long& lBinarySize, const CString& bsThemeFilePath); - HRESULT GetRecordBinary(LONG lRecordType, const CString& bsXml); - HRESULT GetRecordXml(LONG lStart, LONG lLength, LONG lRecType, LONG lDocType, CString** bsXml); + HRESULT SaveThemeXml (long lStart, long lLength, const CString& bsThemePath); + HRESULT SaveObject (long lStart, long lLength, const CString& bsMainProps, CString** bsXml); + HRESULT SaveObjectEx (long lStart, long lLength, const CString& bsMainProps, long lDocType, CString** bsXml); - HRESULT SetDstContentRels(); - HRESULT SaveDstContentRels(const CString& bsRelsPath); - HRESULT WriteRels (const CString& bsType, const CString& bsTarget, const CString& bsTargetMode, LONG* lId); - HRESULT LoadClrMap (const CString& bsXml); + HRESULT GetRecordBinary (long lRecordType, const CString& bsXml); + HRESULT GetRecordXml (long lStart, long lLength, long lRecType, long lDocType, CString** bsXml); - HRESULT(GetTxBodyBinary)(const CString& bsXml); - HRESULT(GetTxBodyXml)(LONG lStart, LONG lLength, CString** pbstrXml); - HRESULT(SetFontDir)(const CString& bsFontDir); + HRESULT SetDstContentRels (); + HRESULT SaveDstContentRels (const CString& bsRelsPath); + HRESULT WriteRels (const CString& bsType, const CString& bsTarget, const CString& bsTargetMode, long* lId); + HRESULT LoadClrMap (const CString& bsXml); - HRESULT SetFontPicker(COfficeFontPicker* pFontPicker); - HRESULT(SetAdditionalParam)(const CString& ParamName, BYTE *pArray, size_t szCount); - HRESULT(SetAdditionalParam)(const CString& ParamName, VARIANT ParamValue); - HRESULT(GetAdditionalParam)(const CString& ParamName, BYTE **pArray, size_t& szCount); - HRESULT(GetAdditionalParam)(const CString& ParamName, VARIANT* ParamValue); - public: - void SetFontManager(CFontManager* pFontManager); + HRESULT(GetTxBodyBinary) (const CString& bsXml); + HRESULT(GetTxBodyXml) (long lStart, long lLength, CString** pbstrXml); + HRESULT(SetFontDir) (const CString& bsFontDir); + + HRESULT SetFontPicker (COfficeFontPicker* pFontPicker); + + HRESULT SetAdditionalParam(const CString& ParamName, BYTE *pArray, size_t szCount); + HRESULT GetAdditionalParam(const CString& ParamName, BYTE **pArray, size_t& szCount); + + void SetFontManager (CFontManager* pFontManager); + + void SetDocumentChartsCount (int val); + int GetDocumentChartsCount (); + + void SetObjectIdVML (int val); + int GetObjectIdVML (); + + void SetSourceFileDir (std::wstring path, int type = 1); + + std::wstring GetContentTypes(); + std::wstring GetOleXlsx(); protected: nullable m_oxfrm_override; - bool ParceObject(const CString& strXml, CString** pMainProps); - void SendMainProps(const CString& strMainProps, CString**& pMainProps); + bool ParceObject (const CString& strXml, CString** pMainProps); + void SendMainProps (const CString& strMainProps, CString**& pMainProps); PPTX::Logic::SpTreeElem doc_LoadShape(XmlUtils::CXmlNode& oNodeShape, CString**& pMainProps, bool bIsTop = true); PPTX::Logic::SpTreeElem doc_LoadGroup(XmlUtils::CXmlNode& oNode, CString**& pMainProps, bool bIsTop = true); - CString GetVMLShapeXml(CPPTShape* pPPTShape); - CString GetVMLShapeXml(PPTX::Logic::SpTreeElem& oElem); + CString GetVMLShapeXml (CPPTShape* pPPTShape); + CString GetVMLShapeXml (PPTX::Logic::SpTreeElem& oElem); - void CheckBrushShape(PPTX::Logic::SpTreeElem& oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape); - void CheckPenShape(PPTX::Logic::SpTreeElem& oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape); + void CheckBrushShape (PPTX::Logic::SpTreeElem& oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape); + void CheckPenShape (PPTX::Logic::SpTreeElem& oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape); - void LoadCoordSize(XmlUtils::CXmlNode& oNode, ::CShape* pShape); - CString GetDrawingMainProps(XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps); + void LoadCoordSize (XmlUtils::CXmlNode& oNode, ::CShape* pShape); + CString GetDrawingMainProps (XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps); - void ConvertMainPropsToVML(const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter, PPTX::Logic::SpTreeElem& oElem); - void ConvertPicVML(PPTX::Logic::SpTreeElem& oElem, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter); - void ConvertShapeVML(PPTX::Logic::SpTreeElem& oShape, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter); - void ConvertGroupVML(PPTX::Logic::SpTreeElem& oGroup, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter); + void ConvertMainPropsToVML (const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter, PPTX::Logic::SpTreeElem& oElem); + void ConvertPicVML (PPTX::Logic::SpTreeElem& oElem, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter); + void ConvertShapeVML (PPTX::Logic::SpTreeElem& oShape, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter); + void ConvertGroupVML (PPTX::Logic::SpTreeElem& oGroup, const CString& bsMainProps, NSBinPptxRW::CXmlWriter& oWriter); - void ConvertTextVML(XmlUtils::CXmlNode &nodeTextBox, PPTX::Logic::Shape* pShape); + void ConvertTextVML (XmlUtils::CXmlNode &nodeTextBox, PPTX::Logic::Shape* pShape); - void Clear(); + void Clear(); HRESULT SetCurrentRelsPath(); }; } diff --git a/ASCOfficePPTXFile/ASCOfficePPTXFile.h b/ASCOfficePPTXFile/ASCOfficePPTXFile.h index 246c48e404..a68e728b93 100644 --- a/ASCOfficePPTXFile/ASCOfficePPTXFile.h +++ b/ASCOfficePPTXFile/ASCOfficePPTXFile.h @@ -32,13 +32,7 @@ #ifndef ASC_OFFICE_PPTX_FILE #define ASC_OFFICE_PPTX_FILE -//todo -#if defined(_WIN32) || defined (_WIN64) -#else - #include "../DesktopEditor/common/ASCVariant.h" -#endif - -#include "../Common/DocxFormat/Source/Base/ASCString.h" +#include "../DesktopEditor/common/ASCVariant.h" #include "../Common/DocxFormat/Source/Base/Base.h" #include "PPTXFormat/PPTXEvent.h" @@ -70,10 +64,10 @@ private: CString m_strFolderThemes; //load_from_resource m_fCallbackResource; - extract_to_directory m_fCallbackExtract; + extract_to_directory m_fCallbackExtract; compress_from_directory m_fCallbackCompress; - progress_operation m_fCallbackProgress; - void* m_pCallbackArg; + progress_operation m_fCallbackProgress; + void* m_pCallbackArg; public: CPPTXFile(extract_to_directory fCallbackExtract, compress_from_directory fCallbackCompress, progress_operation fCallbackProgress, void* pCallbackArg); @@ -87,20 +81,20 @@ public: HRESULT get_TempDirectory(std::wstring* pVal); HRESULT put_TempDirectory(std::wstring newVal); - HRESULT GetDVDXml(std::wstring* pbstrPTTXml); - HRESULT GetBluRayXml(std::wstring* pbstrDVDXml); + HRESULT GetDVDXml (std::wstring* pbstrPTTXml); + HRESULT GetBluRayXml (std::wstring* pbstrDVDXml); - HRESULT get_DrawingXml(std::wstring* pVal); - HRESULT SetAdditionalParam(std::wstring ParamName, VARIANT ParamValue); - HRESULT GetAdditionalParam(std::wstring ParamName, VARIANT* ParamValue); + HRESULT get_DrawingXml (std::wstring* pVal); - virtual bool Progress(long ID, long Percent); + virtual bool Progress (long ID, long Percent); + + void SetEmbeddedFontsDirectory(std::wstring val); // to PPTY HRESULT SetMediaDir (std::wstring bsMediaDir); HRESULT SetFontDir (std::wstring bsFontDir); HRESULT SetThemesDir (std::wstring bsDir); - HRESULT SetUseSystemFonts (VARIANT_BOOL useSystemFonts); + HRESULT SetUseSystemFonts (bool useSystemFonts); HRESULT OpenFileToPPTY (std::wstring bsInput, std::wstring bsOutput); HRESULT OpenDirectoryToPPTY (std::wstring bsInput, std::wstring bsOutput); HRESULT ConvertPPTYToPPTX (std::wstring bsInput, std::wstring bsOutput, std::wstring bsThemesFolder); diff --git a/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp b/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp index d8f081c7da..0b649ad02f 100644 --- a/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp +++ b/ASCOfficePPTXFile/ASCOfficePPTXFileRealization.cpp @@ -217,24 +217,11 @@ HRESULT CPPTXFile::get_DrawingXml(std::wstring* pVal) return S_OK; } -HRESULT CPPTXFile::SetAdditionalParam(std::wstring ParamName, VARIANT ParamValue) +void CPPTXFile::SetEmbeddedFontsDirectory(std::wstring val) { - CString sParamName; sParamName = ParamName; - if (_T("EmbeddedFontsDirectory") == sParamName && ParamValue.vt == VT_BSTR) - { - m_strEmbeddedFontsDirectory = ParamValue.bstrVal; - return S_OK; - } - return S_OK; + m_strEmbeddedFontsDirectory = val; } -HRESULT CPPTXFile::GetAdditionalParam(std::wstring ParamName, VARIANT* ParamValue) -{ - if (NULL == ParamValue) - return S_FALSE; - - return S_OK; -} bool CPPTXFile::Progress(long ID, long Percent) { @@ -264,9 +251,9 @@ HRESULT CPPTXFile::SetThemesDir(std::wstring bsDir) m_strFolderThemes = bsDir; return S_OK; } -HRESULT CPPTXFile::SetUseSystemFonts(VARIANT_BOOL useSystemFonts) +HRESULT CPPTXFile::SetUseSystemFonts(bool val) { - m_bIsUseSystemFonts = (VARIANT_TRUE == useSystemFonts); + m_bIsUseSystemFonts = val; return S_OK; } HRESULT CPPTXFile::OpenFileToPPTY(std::wstring bsInput, std::wstring bsOutput) diff --git a/ASCOfficePPTXFile/Editor/Drawing/Elements.h b/ASCOfficePPTXFile/Editor/Drawing/Elements.h index 84d584145b..f6d3247601 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Elements.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Elements.h @@ -1337,16 +1337,12 @@ namespace NSStrings return 0; } - AVSINLINE void SetText(BSTR& bsText) + AVSINLINE void SetText(const std::wstring& sText) { ClearNoAttack(); -#if defined(_WIN32) || defined (_WIN64) - size_t nLen = GetStringLen(bsText); - WriteString(bsText, nLen); -#else - size_t nLen = bsText.length(); - WriteString(bsText.c_str(), nLen); -#endif + + size_t nLen = sText.length(); + WriteString(sText.c_str(), nLen); for (size_t i = 0; i < nLen; ++i) { diff --git a/ASCOfficePPTXFile/Editor/Drawing/Interactive.h b/ASCOfficePPTXFile/Editor/Drawing/Interactive.h index ff3f48bb63..17750a4b3b 100644 --- a/ASCOfficePPTXFile/Editor/Drawing/Interactive.h +++ b/ASCOfficePPTXFile/Editor/Drawing/Interactive.h @@ -66,8 +66,8 @@ namespace NSPresentationEditor class CInteractiveInfo { private: - long m_lType; - VARIANT m_varParameter; + long m_lType; + ASC_VARIANT m_varParameter; public: bool m_bPresent; diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/Controls.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/Controls.cpp index c107dc79d5..ee43ce0e01 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/Controls.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/Controls.cpp @@ -114,7 +114,6 @@ namespace PPTX CString *main_props = NULL; oDrawingConverter.SetRelsPath(rels); - //oDrawingConverter.SetAdditionalParam(_T("xfrm_override"), (BYTE*)&xfrm, sizeof(xfrm)); HRESULT hRes = oDrawingConverter.AddObject(temp, &main_props); if (hRes == S_OK && oDrawingConverter.m_pBinaryWriter->GetPosition() > 10) diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/Geometry.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/Geometry.cpp index 007f0699c7..4d7cd3f3a7 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/Geometry.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/Geometry.cpp @@ -84,11 +84,9 @@ namespace PPTX NSPresentationEditor::CPath& oPath = lpShapeElement->m_oShape.m_pShape->m_oPath; - VARIANT var; - var.vt = VT_I4; - var.lVal = 0; COOXToVMLGeometry* pOOXToVMLGeometry = dynamic_cast(pOOXToVMLRenderer); - if(NULL != pOOXToVMLGeometry) + + if(NULL != pOOXToVMLGeometry) pOOXToVMLGeometry->NewShape(); NSPresentationEditor::CGraphicPath oGrPath; diff --git a/ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.cpp b/ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.cpp index 17730d07fb..78438b9686 100644 --- a/ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.cpp +++ b/ASCOfficePPTXFile/PPTXFormat/Logic/SmartArt.cpp @@ -45,7 +45,7 @@ namespace PPTX { void SmartArt::LoadDrawing(NSBinPptxRW::CBinaryFileWriter* pWriter) { - CString strDataPath = _T(""); + std::wstring strDataPath; FileContainer* pRels = NULL; if (pWriter->m_pCommonRels->is_init()) @@ -69,7 +69,7 @@ namespace PPTX } } - if (_T("") == strDataPath) + if (strDataPath.empty()) return; nullable id_drawing; @@ -77,14 +77,14 @@ namespace PPTX XmlUtils::CXmlNode oNode; if (oNode.FromXmlFile2(strDataPath) == false) return; - XmlUtils::CXmlNode oNode2 = oNode.ReadNode(_T("dgm:extLst")); + XmlUtils::CXmlNode oNode2 = oNode.ReadNode(L"dgm:extLst"); if (oNode2.IsValid()) { - XmlUtils::CXmlNode oNode3 = oNode2.ReadNode(_T("a:ext")); + XmlUtils::CXmlNode oNode3 = oNode2.ReadNode(L"a:ext"); if (oNode3.IsValid()) { //https://msdn.microsoft.com/library/documentformat.openxml.office.drawing.datamodelextensionblock.aspx - XmlUtils::CXmlNode oNode4 = oNode3.ReadNode(_T("dsp:dataModelExt")); + XmlUtils::CXmlNode oNode4 = oNode3.ReadNode(L"dsp:dataModelExt"); if (oNode4.IsValid()) { oNode4.ReadAttributeBase(L"relId", id_drawing); @@ -94,8 +94,9 @@ namespace PPTX if (id_drawing.is_init()) { - CString strDWPath = _T(""); - if(parentFileIs()) + std::wstring strDWPath; + + if(parentFileIs()) strDWPath = parentFileAs().GetMediaFullPathNameFromRId(*id_drawing); else if(parentFileIs()) strDWPath = parentFileAs().GetMediaFullPathNameFromRId(*id_drawing); @@ -111,12 +112,12 @@ namespace PPTX } - if (_T("") != strDWPath) + if (!strDWPath.empty()) { XmlUtils::CXmlNode oNodeDW; if (oNodeDW.FromXmlFile2(strDWPath)) { - XmlUtils::CXmlNode oNodeS = oNodeDW.ReadNodeNoNS(_T("spTree")); + XmlUtils::CXmlNode oNodeS = oNodeDW.ReadNodeNoNS(L"spTree"); if (oNodeS.IsValid()) { @@ -148,7 +149,7 @@ namespace PPTX XmlUtils::CXmlNode oNodeDW; if (oNodeDW.FromXmlFile2(pathDiagramDrawing.GetPath()))//todooo ... сделать отдельно .. повтор { - XmlUtils::CXmlNode oNodeS = oNodeDW.ReadNodeNoNS(_T("spTree")); + XmlUtils::CXmlNode oNodeS = oNodeDW.ReadNodeNoNS(L"spTree"); if (oNodeS.IsValid()) { @@ -190,7 +191,7 @@ namespace PPTX } } - if (_T("") == strDataPath) + if (strDataPath.empty()) return; BinXlsxRW::CXlsxSerializer oXlsxSerializer; @@ -212,8 +213,8 @@ namespace PPTX if (!id_data.is_init() || NULL == m_bData) return; - CString strData = _T("ToString() + _T("\"/>"); + std::wstring strData = L"ToString() + L"\"/>"; pWriter->WriteString(strData); } @@ -233,28 +234,25 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" NSBinPptxRW::CImageManager2* pOldImageManager = oDrawingConverter.m_pImageManager; oDrawingConverter.m_pImageManager = pReader->m_pRels->m_pManager; NSBinPptxRW::CBinaryFileReader* pOldReader = oDrawingConverter.m_pReader; - oDrawingConverter.m_pReader = pReader; + oDrawingConverter.m_pReader = pReader; oXlsxSerializer.setDrawingConverter(&oDrawingConverter); - CString strDstChart = pReader->m_pRels->m_pManager->GetDstMedia(); - int nPos = strDstChart.ReverseFind(TCHAR('m')); + std::wstring strDstChart = pReader->m_pRels->m_pManager->GetDstMedia(); + int nPos = strDstChart.rfind(TCHAR('m')); if (-1 != nPos) - strDstChart = strDstChart.Mid(0, nPos); + strDstChart = strDstChart.substr(0, nPos); - strDstChart += _T("charts"); - //на всякий случай всегда создаем, нет уверенности что 1 == m_lChartNumber для первого chart - FileSystem::Directory::CreateDirectory(strDstChart); - CString strChart = _T(""); - strChart.Format(_T("chart%d.xml"), m_lChartNumber); + strDstChart += L"charts"; + //на всякий случай всегда создаем, нет уверенности что 1 == m_lChartNumber для первого chart + FileSystem::Directory::CreateDirectory(strDstChart); - strChart = strDstChart + FILE_SEPARATOR_STR + strChart; + std::wstring* sContentTypes = NULL; - CString* sContentTypes = NULL; - - CString strWordChartFolder = _T("/word/charts/"); - CString strXlChartFolder = _T("/xl/charts/"); - CString strPptChartFolder = _T("/ppt/charts/"); + std::wstring strChart = strDstChart + FILE_SEPARATOR_STR + L"chart" + std::to_wstring(m_lChartNumber) + L".xml"; + std::wstring strWordChartFolder = L"/word/charts/"; + std::wstring strXlChartFolder = L"/xl/charts/"; + std::wstring strPptChartFolder = L"/ppt/charts/"; if (pReader->m_lDocumentType == XMLWRITER_DOC_TYPE_DOCX) oXlsxSerializer.saveChart(*pReader, lLen, strChart, strWordChartFolder, &sContentTypes, m_lChartNumber); @@ -263,9 +261,11 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" else oXlsxSerializer.saveChart(*pReader, lLen, strChart, strPptChartFolder, &sContentTypes, m_lChartNumber); - pReader->m_strContentTypes += (*sContentTypes); - RELEASEOBJECT(sContentTypes); - + if (sContentTypes) + { + pReader->m_strContentTypes += (*sContentTypes); + RELEASEOBJECT(sContentTypes); + } oDrawingConverter.m_pReader = pOldReader; oDrawingConverter.m_pImageManager = pOldImageManager; diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Encoding.cpp b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Encoding.cpp index ea14b4c26e..b5d729b4aa 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Encoding.cpp +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/Common/Encoding.cpp @@ -39,8 +39,9 @@ #include "../../../UnicodeConverter/UnicodeConverter.h" #include "../../../UnicodeConverter/UnicodeConverter_Encodings.h" -//#include -//#include +#if !defined(_WIN32) && !defined(_WIN64) + #include +#endif #include diff --git a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.h b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.h index 15ff14f23f..a5b1d0f2ce 100644 --- a/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.h +++ b/ASCOfficeTxtFile/TxtXmlFormatLib/Source/TxtXmlFile.h @@ -37,10 +37,10 @@ #if defined(_WIN32) || defined(_WIN64) #include -#else - #include "../../../DesktopEditor/common/ASCVariant.h" #endif +#include "../../../DesktopEditor/common/ASCVariant.h" + namespace Writers { class FileWriter; diff --git a/Common/Base64.h b/Common/Base64.h index c1f025c2ad..f2f83f1ab4 100644 --- a/Common/Base64.h +++ b/Common/Base64.h @@ -43,12 +43,12 @@ namespace Base64 const int B64_BASE64_FLAG_NONE = 0; const int B64_BASE64_FLAG_NOPAD = 1; const int B64_BASE64_FLAG_NOCRLF = 2; -// const int INT_MAX = 2147483647; /* maximum (signed) int value */ + const int B64_BASE64_INT_MAX = 2147483647; /* maximum (signed) int value */ inline int Base64EncodeGetRequiredLength(int nSrcLen, DWORD dwFlags = B64_BASE64_FLAG_NONE) { __int64 nSrcLen4 = static_cast<__int64>(nSrcLen)*4; - if (nSrcLen4 > INT_MAX) + if (nSrcLen4 > B64_BASE64_INT_MAX) return -1; int nRet = static_cast(nSrcLen4/3); diff --git a/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h b/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h index 214fdfeee8..b76b443874 100644 --- a/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h +++ b/Common/DocxFormat/Source/Common/SimpleTypes_Vml.h @@ -4722,11 +4722,6 @@ namespace SimpleTypes FromString( sValue ); return *this; } - const CVml_Polygon2D_Units &operator =(const BSTR &bsValue) - { - FromString( bsValue ); - return *this; - } const CVml_Polygon2D_Units &operator =(const wchar_t* cwsString) { FromString( cwsString ); @@ -4928,11 +4923,6 @@ namespace SimpleTypes ResetMatrix(); FromString( oOther.ToString() ); } - CVml_Matrix(const BSTR &bsValue)\ - { - ResetMatrix(); - FromString( bsValue ); - } CVml_Matrix(CString &sValue) { ResetMatrix(); @@ -4953,11 +4943,6 @@ namespace SimpleTypes FromString( sValue ); return *this; } - const CVml_Matrix &operator =(const BSTR &bsValue) - { - FromString( bsValue ); - return *this; - } const CVml_Matrix &operator =(const wchar_t* cwsString) { FromString( cwsString ); diff --git a/Common/DocxFormat/Source/DocxFormat/ContentTypes.h b/Common/DocxFormat/Source/DocxFormat/ContentTypes.h index c38b2cb891..3052bf1e49 100644 --- a/Common/DocxFormat/Source/DocxFormat/ContentTypes.h +++ b/Common/DocxFormat/Source/DocxFormat/ContentTypes.h @@ -305,7 +305,8 @@ namespace OOX void Registration(const CString& sType, const CPath& oDirectory, const CPath& oFilename) { OOX::CPath oFullPath = oDirectory / oFilename; - AddOverride( sType, oFullPath.m_strFilename.c_str() ); + + AddOverride( sType, oFullPath.m_strFilename ); AddDefault ( oFullPath ); } @@ -354,12 +355,12 @@ namespace OOX } return true; } - void AddOverride(const CString& sType, const CString& sPath) + void AddOverride(const CString& sType, CString sPath) { #if !defined(_WIN32) && !defined (_WIN64) - if (sPath.GetAt(0) == FILE_SEPARATOR_CHAR) + if (sPath[0] == FILE_SEPARATOR_CHAR) { - sPath.Delete(0,1); + sPath.Delete(0); } #endif ContentTypes::COverride oOverride( sType, sPath ); diff --git a/Common/DocxFormat/Source/SystemUtility/File.h b/Common/DocxFormat/Source/SystemUtility/File.h index 6b688559ad..e61958be3a 100644 --- a/Common/DocxFormat/Source/SystemUtility/File.h +++ b/Common/DocxFormat/Source/SystemUtility/File.h @@ -671,9 +671,7 @@ namespace CDirectory } static std::wstring ToString(DWORD val) { - std::wstring str = _T(""); - str.Format(_T("%d"), (LONG)val); - return str; + return std::to_wstring(val); } static bool CopyFile (std::wstring strExists, std::wstring strNew, LPVOID lpFunc = NULL, LPVOID lpData = NULL) diff --git a/Common/DocxFormat/Source/SystemUtility/SystemUtility.h b/Common/DocxFormat/Source/SystemUtility/SystemUtility.h index 71faa01dbb..1513605e06 100644 --- a/Common/DocxFormat/Source/SystemUtility/SystemUtility.h +++ b/Common/DocxFormat/Source/SystemUtility/SystemUtility.h @@ -132,90 +132,22 @@ namespace OOX } } -#if defined(_WIN32) || defined (_WIN64) AVSINLINE void Normalize() { if (0 == m_strFilename.length()) return; - const wchar_t* pData = m_strFilename.c_str(); - int nLen = (int)m_strFilename.length(); + const wchar_t* pData = m_strFilename.c_str(); + int nLen = m_strFilename.length(); - wchar_t* pDataNorm = new wchar_t[nLen + 1]; - int* pSlashPoints = new int[nLen + 1]; + wchar_t* pDataNorm = new wchar_t [nLen + 1]; + int* pSlashPoints = new int [nLen + 1]; - int nStart = 0; - int nCurrent = 0; - int nCurrentSlash = -1; - int nCurrentW = 0; - bool bIsUp = false; - - while (nCurrent < nLen) - { - if (pData[nCurrent] == (wchar_t) '\\' || pData[nCurrent] == (wchar_t)'/') - { - if (nStart < nCurrent) - { - bIsUp = false; - if ((nCurrent - nStart) == 2) - { - if (pData[nStart] == (wchar_t)'.' && pData[nStart + 1] == (wchar_t)'.') - { - if (nCurrentSlash > 0) - { - --nCurrentSlash; - nCurrentW = pSlashPoints[nCurrentSlash]; - bIsUp = true; - } - } - } - if (!bIsUp) - { - pDataNorm[nCurrentW++] = (wchar_t) FILE_SEPARATOR_CHAR; - ++nCurrentSlash; - pSlashPoints[nCurrentSlash] = nCurrentW; - } - } - nStart = nCurrent + 1; - ++nCurrent; - continue; - } - pDataNorm[nCurrentW++] = pData[nCurrent]; - ++nCurrent; - } - - pDataNorm[nCurrentW] = (wchar_t)'\0'; - - m_strFilename.clear(); - m_strFilename = std::wstring(pDataNorm, nCurrentW); - - delete []pSlashPoints; - delete []pDataNorm; - } - void CheckIsRoot() - { - if(m_strFilename.length() > 0 && ('/' == m_strFilename[0] || '\\' == m_strFilename[0])) - m_bIsRoot = true; - else - m_bIsRoot = false; - } -#else - AVSINLINE void Normalize() - { - if (0 == m_strFilename.length()) - return; - - wchar_t* pData = m_strFilename.GetBuffer(); - int nLen = m_strFilename.length(); - - wchar_t* pDataNorm = new wchar_t[nLen + 1]; - int* pSlashPoints = new int[nLen + 1]; - - int nStart = 0; - int nCurrent = 0; - int nCurrentSlash = -1; - int nCurrentW = 0; - bool bIsUp = false; + int nStart = 0; + int nCurrent = 0; + int nCurrentSlash = -1; + int nCurrentW = 0; + bool bIsUp = false; if (pData[nCurrent] == (wchar_t)'/') pDataNorm[nCurrentW++] = (wchar_t) FILE_SEPARATOR_CHAR; @@ -256,7 +188,6 @@ namespace OOX pDataNorm[nCurrentW] = (wchar_t)'\0'; - m_strFilename.ReleaseBuffer(); m_strFilename = std::wstring(pDataNorm, nCurrentW); delete []pSlashPoints; @@ -270,7 +201,6 @@ namespace OOX m_bIsRoot = false; } -#endif void SetName(std::wstring sName, bool bNormalize) { m_strFilename = sName; diff --git a/Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h b/Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h index e4a1131a80..0502680cc8 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h +++ b/Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h @@ -83,13 +83,12 @@ namespace OOX oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() ); IFileContainer::Write(oPath, oDirectory, oContent); } - virtual void write2(CString& sFilename) const + virtual void write2(const std::wstring& sFilename) const { NSStringUtils::CStringBuilder sXml; sXml.WriteString(L"\r\n"); toXML(sXml); - NSFile::CFileBinary::SaveToFile(sFilename.GetBuffer(), sXml.GetData()); - sFilename.ReleaseBuffer(); + NSFile::CFileBinary::SaveToFile(sFilename, sXml.GetData()); } void toXML(NSStringUtils::CStringBuilder& writer) const { diff --git a/Common/DocxFormat/Source/XlsxFormat/Xlsx.h b/Common/DocxFormat/Source/XlsxFormat/Xlsx.h index 3cf53ae4d2..7c620cb026 100644 --- a/Common/DocxFormat/Source/XlsxFormat/Xlsx.h +++ b/Common/DocxFormat/Source/XlsxFormat/Xlsx.h @@ -190,9 +190,10 @@ namespace OOX if(!sAdditionalContentTypes.IsEmpty()) { CString sAdditionalContentTypesWrapped; - sAdditionalContentTypesWrapped.Append(_T("")); - sAdditionalContentTypesWrapped.Append(sAdditionalContentTypes); - sAdditionalContentTypesWrapped.Append(_T("")); + + sAdditionalContentTypesWrapped += L""; + sAdditionalContentTypesWrapped += sAdditionalContentTypes; + sAdditionalContentTypesWrapped += L""; OOX::CContentTypes oTempContentTypes; oTempContentTypes.ReadFromString(sAdditionalContentTypesWrapped); diff --git a/DesktopEditor/common/ASCVariant.h b/DesktopEditor/common/ASCVariant.h index 16a398d35b..24cc2eb7da 100644 --- a/DesktopEditor/common/ASCVariant.h +++ b/DesktopEditor/common/ASCVariant.h @@ -33,30 +33,24 @@ #define _ASCVARIANT_H_ #include "Types.h" -#include "../../Common/DocxFormat/Source/Base/ASCString.h" // TODO: move ASCString to DecktopEditor/commmon directory +#include "../../Common/DocxFormat/Source/Base/ASCString.h" -// VARIANT -#if !defined(_WIN32) && !defined(_WIN64) +typedef short ASC_VARIANT_BOOL; -// 0 == FALSE, -1 == TRUE -typedef short VARIANT_BOOL; - -#define VARIANT_TRUE ((VARIANT_BOOL)-1) -#define VARIANT_FALSE ((VARIANT_BOOL)0) - -enum VARENUM - { VT_EMPTY = 0, - VT_NULL = 1, - VT_I2 = 2, - VT_I4 = 3, - VT_R4 = 4, - VT_R8 = 5, - VT_CY = 6, - VT_DATE = 7, - VT_BSTR = 8, +enum ASC_VARENUM + { + VT_EMPTY = 0, + VT_NULL = 1, + VT_I2 = 2, + VT_I4 = 3, + VT_R4 = 4, + VT_R8 = 5, + VT_CY = 6, + VT_DATE = 7, + VT_BSTR = 8, VT_DISPATCH = 9, VT_ERROR = 10, - VT_BOOL = 11, + VT_BOOL = 11, VT_VARIANT = 12, VT_UNKNOWN = 13, VT_DECIMAL = 14, @@ -99,21 +93,21 @@ enum VARENUM VT_TYPEMASK = 0xfff } ; -typedef VARIANT_BOOL _VARIANT_BOOL; -typedef unsigned short VARTYPE; +typedef unsigned short ASC_VARTYPE; -struct VARIANT +struct ASC_VARIANT { - VARTYPE vt; - LONG64 llVal;//LONGLONG llVal; - LONG lVal; - BYTE bVal; - SHORT iVal; - FLOAT fltVal; - BSTR bstrVal; - VARIANT_BOOL boolVal; - double dblVal; + ASC_VARTYPE vt; + + LONG64 llVal; + LONG lVal; + BYTE bVal; + SHORT iVal; + FLOAT fltVal; + std::wstring strVal; + bool boolVal; + double dblVal; }; /* struct tagVARIANT @@ -184,13 +178,11 @@ struct tagVARIANT } __VARIANT_NAME_1; } ; */ -typedef VARIANT *LPVARIANT; +typedef ASC_VARIANT *ASC_LPVARIANT; -typedef VARIANT VARIANTARG; +typedef ASC_VARIANT ASC_VARIANTARG; -typedef VARIANT *LPVARIANTARG; +typedef ASC_VARIANT *ASC_LPVARIANTARG; -#endif // #ifndef _WIN32 - #endif //_ASCVARIANT_H_ diff --git a/X2tConverter/build/Qt/X2tConverter.pri b/X2tConverter/build/Qt/X2tConverter.pri index 2cbbc5ced7..a0d77e6c7f 100644 --- a/X2tConverter/build/Qt/X2tConverter.pri +++ b/X2tConverter/build/Qt/X2tConverter.pri @@ -7,7 +7,7 @@ QT -= core QT -= gui -VERSION = 2.0.2.423 +VERSION = 2.0.2.424 DEFINES += INTVER=$$VERSION TARGET = x2t diff --git a/XlsxSerializerCom/Reader/ChartFromToBinary.cpp b/XlsxSerializerCom/Reader/ChartFromToBinary.cpp index a2e6d6d688..a9049fcdf5 100644 --- a/XlsxSerializerCom/Reader/ChartFromToBinary.cpp +++ b/XlsxSerializerCom/Reader/ChartFromToBinary.cpp @@ -41,8 +41,7 @@ using namespace OOX::Spreadsheet; namespace BinXlsxRW{ SaveParams::SaveParams(const CString& _sThemePath) { - sThemePath = _sThemePath; - sAdditionalContentTypes = _T(""); + sThemePath = _sThemePath; nThemeOverrideCount = 1; } @@ -981,9 +980,8 @@ namespace BinXlsxRW{ } else if(c_oserct_chartspaceTHEMEOVERRIDE == type) { - CString sThemeOverrideName; sThemeOverrideName.Format(_T("themeOverride%d.xml"), m_oSaveParams.nThemeOverrideCount++); - - CString sThemeOverrideRelsPath; sThemeOverrideRelsPath.Format(_T("../theme/%ls"), sThemeOverrideName); + std::wstring sThemeOverrideName = L"themeOverride" + std::to_wstring(m_oSaveParams.nThemeOverrideCount++) + L".xml"; + std::wstring sThemeOverrideRelsPath = L"../theme/" + sThemeOverrideName; OOX::CPath pathThemeOverrideFile = m_oSaveParams.sThemePath + FILE_SEPARATOR_STR + sThemeOverrideName; @@ -995,14 +993,19 @@ namespace BinXlsxRW{ m_pOfficeDrawingConverter->WriteRels(CString(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride")), sThemeOverrideRelsPath, CString(), &rId); CString sThemePathReverse = m_oSaveParams.sThemePath;sThemePathReverse.MakeReverse(); - CString sContentTypesPath; - int nIndex = sThemePathReverse.Find(FILE_SEPARATOR_CHAR); - nIndex = sThemePathReverse.Find(FILE_SEPARATOR_CHAR, nIndex + 1); + + int nIndex = sThemePathReverse.Find(FILE_SEPARATOR_CHAR); + nIndex = sThemePathReverse.Find(FILE_SEPARATOR_CHAR, nIndex + 1); if(-1 != nIndex) { - CString sContentTypesPath = m_oSaveParams.sThemePath.Right(nIndex); - sContentTypesPath.Replace('\\', '/'); - m_oSaveParams.sAdditionalContentTypes.AppendFormat(_T(""), (const TCHAR *) sContentTypesPath, (const TCHAR *) sThemeOverrideName); + std::wstring sContentTypesPath = m_oSaveParams.sThemePath.Right(nIndex); + boost::algorithm::replace_all(sContentTypesPath, L"\\", L"/"); + + std::wstring strType = L""; + + m_oSaveParams.sAdditionalContentTypes += strType; } } else diff --git a/XlsxSerializerCom/Writer/BinaryReader.h b/XlsxSerializerCom/Writer/BinaryReader.h index 186c72adc7..9c404ce096 100644 --- a/XlsxSerializerCom/Writer/BinaryReader.h +++ b/XlsxSerializerCom/Writer/BinaryReader.h @@ -1871,10 +1871,8 @@ namespace BinXlsxRW { m_pCurVmlDrawing = new OOX::CVmlDrawing(true); m_pCurVmlDrawing->m_lObjectIdVML = 1024 * (m_oWorkbook.m_oSheets->m_arrItems.size() + 1) + 1; - VARIANT var; - var.vt = VT_I4; - var.lVal = m_pCurVmlDrawing->m_lObjectIdVML; - m_pOfficeDrawingConverter->SetAdditionalParam(CString(_T("ObjectIdVML")), var); + + m_pOfficeDrawingConverter->SetObjectIdVML(m_pCurVmlDrawing->m_lObjectIdVML); res = Read1(length, &BinaryWorksheetsTableReader::ReadWorksheet, this, poResult); if(m_pCurSheet->m_oName.IsInit()) @@ -2593,11 +2591,8 @@ namespace BinXlsxRW { CString sOleXlsx; if(NULL != m_pCurDrawing) { - VARIANT var; - var.vt = VT_I4; - var.lVal = m_pCurDrawing->GetGlobalNumberByType(OOX::Spreadsheet::FileTypes::Charts.OverrideType()); - m_pOfficeDrawingConverter->SetAdditionalParam(CString(_T("DocumentChartsCount")), var); - } + m_pOfficeDrawingConverter->SetDocumentChartsCount(m_pCurDrawing->GetGlobalNumberByType(OOX::Spreadsheet::FileTypes::Charts.OverrideType())); + } long nCurPos = oTransport.m_nPos; CString* bstrXml = NULL; @@ -2605,16 +2600,11 @@ namespace BinXlsxRW { //m_oBufferedStream.Seek(nCurPos + oTransport.m_nLength); if(NULL != m_pCurDrawing) { - VARIANT vt; - m_pOfficeDrawingConverter->GetAdditionalParam(CString(_T("DocumentChartsCount")), &vt); - if (VT_I4 == vt.vt) - m_pCurDrawing->SetGlobalNumberByType(OOX::Spreadsheet::FileTypes::Charts.OverrideType(), vt.lVal); - m_pOfficeDrawingConverter->GetAdditionalParam(CString(_T("ObjectIdVML")), &vt); - if (VT_I4 == vt.vt) - m_pCurVmlDrawing->m_lObjectIdVML = vt.lVal; - m_pOfficeDrawingConverter->GetAdditionalParam(CString(_T("OleXlsx")), &vt); - if (VT_BSTR == vt.vt) - sOleXlsx = CString(vt.bstrVal); + + m_pCurDrawing->SetGlobalNumberByType(OOX::Spreadsheet::FileTypes::Charts.OverrideType(), m_pOfficeDrawingConverter->GetDocumentChartsCount()); + m_pCurVmlDrawing->m_lObjectIdVML = m_pOfficeDrawingConverter->GetObjectIdVML(); + + sOleXlsx = m_pOfficeDrawingConverter->GetOleXlsx(); } if(S_OK == hRes && NULL != bstrXml) { @@ -2832,12 +2822,11 @@ namespace BinXlsxRW { { std::wstring sNewImageName = NSSystemPath::GetFileName(pair->second->sPath); - long rId; - CString sNewImgRel; - sNewImgRel.Format(_T("../media/%ls"), sNewImageName.c_str()); - m_pOfficeDrawingConverter->WriteRels(CString(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image")), sNewImgRel, CString(), &rId); + CString sNewImgRel = L"../media/" + sNewImageName; + long rId; + m_pOfficeDrawingConverter->WriteRels(CString(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image")), sNewImgRel, CString(), &rId); - sRId.Format(_T("rId%d"), rId); + sRId = L"rId" + std::to_wstring(rId); pair->second->mapDrawings[m_pCurDrawing] = sRId; } else @@ -3507,14 +3496,15 @@ namespace BinXlsxRW { g_nCurFormatVersion = nVersion = nTempVersion; } } - // File Type + // File Type CString sDstPathCSV = sDstPath; BYTE fileType; UINT nCodePage; WCHAR wcDelimiter; BYTE saveFileType; + SerializeCommon::ReadFileType(sXMLOptions, fileType, nCodePage, wcDelimiter, saveFileType); - // Делаем для CSV перебивку пути, иначе создается папка с одинаковым имеем (для rels) и файл не создается. + // Делаем для CSV перебивку пути, иначе создается папка с одинаковым имеем (для rels) и файл не создается. if (BinXlsxRW::c_oFileTypes::CSV == fileType) sDstPath = NSSystemPath::GetDirectoryName(sDstPath); @@ -3525,13 +3515,12 @@ namespace BinXlsxRW { SaveParams oSaveParams(params_path.c_str()); ReadMainTable(oXlsx, oBufferedStream, OOX::CPath(sSrcFileName).GetDirectory(), sDstPath, oSaveParams, pOfficeDrawingConverter); - CString sAdditionalContentTypes = oSaveParams.sAdditionalContentTypes; - if(NULL != pOfficeDrawingConverter) + + CString sAdditionalContentTypes = oSaveParams.sAdditionalContentTypes; + + if(NULL != pOfficeDrawingConverter) { - VARIANT vt; - pOfficeDrawingConverter->GetAdditionalParam(CString(_T("ContentTypes")), &vt); - if(VT_BSTR == vt.vt) - sAdditionalContentTypes.Append(vt.bstrVal); + sAdditionalContentTypes.Append(pOfficeDrawingConverter->GetContentTypes()); } oXlsx.PrepareToWrite();