From 0a183f35054e13bcabb28de129b7af65bcb689f6 Mon Sep 17 00:00:00 2001 From: ElenaSubbotina Date: Wed, 1 Feb 2017 15:59:28 +0300 Subject: [PATCH] fix bug #33886 --- ASCOfficeOdfFile/OdfFileTest/OdfFile.sln | 6 +++- ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp | 27 ++++++++++------- .../OdfFileTest/OdfFileTest.vcproj | 30 +++++++++++++++++-- ASCOfficeOdfFile/src/docx/mediaitems.cpp | 2 +- ASCOfficeOdfFile/src/docx/pptx_drawing.cpp | 1 + .../src/docx/pptx_slide_context.cpp | 2 -- .../src/docx/pptx_table_context.cpp | 2 +- ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp | 11 ++----- 8 files changed, 54 insertions(+), 27 deletions(-) diff --git a/ASCOfficeOdfFile/OdfFileTest/OdfFile.sln b/ASCOfficeOdfFile/OdfFileTest/OdfFile.sln index 620dddb573..d385e9b986 100644 --- a/ASCOfficeOdfFile/OdfFileTest/OdfFile.sln +++ b/ASCOfficeOdfFile/OdfFileTest/OdfFile.sln @@ -2,6 +2,9 @@ Microsoft Visual Studio Solution File, Format Version 9.00 # Visual Studio 2005 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml_wrapper", "..\win32\cpxml.vcproj", "{41BED424-4EAF-4053-8A5F-1E2A387D53D1}" + ProjectSection(ProjectDependencies) = postProject + {21663823-DE45-479B-91D0-B4FEF4916EF0} = {21663823-DE45-479B-91D0-B4FEF4916EF0} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormatReaderLib", "..\win32\cpodf.vcproj", "{50E20601-4A8D-4AFB-8870-63828D328429}" ProjectSection(ProjectDependencies) = postProject @@ -21,7 +24,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFormulasConvert", "..\wi EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileReaderTest", "OdfFileTest.vcproj", "{C2882DDD-07E6-4314-AD4B-48F43F38D722}" ProjectSection(ProjectDependencies) = postProject + {41BED424-4EAF-4053-8A5F-1E2A387D53D1} = {41BED424-4EAF-4053-8A5F-1E2A387D53D1} {50E20601-4A8D-4AFB-8870-63828D328429} = {50E20601-4A8D-4AFB-8870-63828D328429} + {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} {94954A67-A853-43B1-A727-6EF2774C5A6A} = {94954A67-A853-43B1-A727-6EF2774C5A6A} {F8274B05-168E-4D6E-B843-AA7510725363} = {F8274B05-168E-4D6E-B843-AA7510725363} {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} = {9CAA294E-58C3-4CEB-ABA0-CB9786CA5540} @@ -30,7 +35,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OdfFileReaderTest", "OdfFil {C739151F-5384-41DF-A1A6-F089E2C1AD56} = {C739151F-5384-41DF-A1A6-F089E2C1AD56} {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} = {78B079BD-9FC7-4B9E-B4A6-96DA0F00248B} {BC52A07C-A797-423D-8C4F-8678805BBB36} = {BC52A07C-A797-423D-8C4F-8678805BBB36} - {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} = {37CA072A-5BDE-498B-B3A7-5E404F5F9BF2} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "graphics", "..\..\DesktopEditor\graphics\graphics_vs2005.vcproj", "{37CA072A-5BDE-498B-B3A7-5E404F5F9BF2}" diff --git a/ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp b/ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp index d2c0f814cc..ea3e14d23c 100644 --- a/ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp +++ b/ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp @@ -31,18 +31,23 @@ */ // OdfFileTest.cpp -#include "../../../OfficeUtils/src/OfficeUtils.h" +#include +#include -#include "../../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h" -#include "../../src/ConvertOO2OOX.h" +#include "../../OfficeUtils/src/OfficeUtils.h" +#include "../../DesktopEditor/common/Directory.h" +#include "../src/ConvertOO2OOX.h" + #if defined(_WIN64) - #pragma comment(lib, "../../../build/bin/icu/win_64/icuuc.lib") + #pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib") #elif defined (_WIN32) - #pragma comment(lib, "../../../build/bin/icu/win_32/icuuc.lib") + #pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib") #endif + + int _tmain(int argc, _TCHAR* argv[]) { if (argc < 2) return 1; @@ -50,12 +55,12 @@ int _tmain(int argc, _TCHAR* argv[]) HRESULT hr = S_OK; ////////////////////////////////////////////////////////////////////////// std::wstring srcFileName = argv[1]; - std::wstring dstPath = argc > 2 ? argv[2] : sSrcDoc + L"-my.docx"; //xlsx pptx + std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.pptx"; //xlsx pptx - std::wstring outputDir = FileSystem::Directory::GetFolderPath(dstPath); + std::wstring outputDir = NSDirectory::GetFolderPath(dstPath); - std::wstring srcTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir); - std::wstring dstTempPath = FileSystem::Directory::CreateDirectoryWithUniqueName(outputDir); + std::wstring srcTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir); + std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir); // распаковываем исходник во временную директорию COfficeUtils oCOfficeUtils(NULL); @@ -64,14 +69,14 @@ int _tmain(int argc, _TCHAR* argv[]) hr = ConvertOO2OOX(srcTempPath, dstTempPath, L"C:\\Windows\\Fonts", false, NULL); - FileSystem::Directory::DeleteDirectory(srcTempPath); + NSDirectory::DeleteDirectory(srcTempPath); if (hr != S_OK) return hr; if (S_OK != oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath.c_str(), -1)) return hr; - FileSystem::Directory::DeleteDirectory(dstTempPath); + NSDirectory::DeleteDirectory(dstTempPath); //////////////////////////////////////////////////////////////////////// return 0; diff --git a/ASCOfficeOdfFile/OdfFileTest/OdfFileTest.vcproj b/ASCOfficeOdfFile/OdfFileTest/OdfFileTest.vcproj index 569528e81f..12260896af 100644 --- a/ASCOfficeOdfFile/OdfFileTest/OdfFileTest.vcproj +++ b/ASCOfficeOdfFile/OdfFileTest/OdfFileTest.vcproj @@ -43,11 +43,11 @@ + + + + + + + + + + diff --git a/ASCOfficeOdfFile/src/docx/mediaitems.cpp b/ASCOfficeOdfFile/src/docx/mediaitems.cpp index 409c94f8b6..477ee331d1 100644 --- a/ASCOfficeOdfFile/src/docx/mediaitems.cpp +++ b/ASCOfficeOdfFile/src/docx/mediaitems.cpp @@ -58,7 +58,7 @@ bool is_internal(const std::wstring & uri, const std::wstring & packetRoot) std::wstring resultPath = packetRoot + FILE_SEPARATOR_STR + mediaPath; - return NSDirectory::Exists(resultPath) || NSDirectory::Exists(mediaPath); + return NSFile::CFileBinary::Exists(resultPath) || NSDirectory::Exists(mediaPath); } mediaitems::item::item( std::wstring const & _href, diff --git a/ASCOfficeOdfFile/src/docx/pptx_drawing.cpp b/ASCOfficeOdfFile/src/docx/pptx_drawing.cpp index 3aa2c686a6..2083100cf0 100644 --- a/ASCOfficeOdfFile/src/docx/pptx_drawing.cpp +++ b/ASCOfficeOdfFile/src/docx/pptx_drawing.cpp @@ -236,6 +236,7 @@ void pptx_serialize_table(std::wostream & strm, _pptx_drawing & val) if (strTableContent) { + std::wstring ttt = strTableContent.get(); CP_XML_STREAM() << strTableContent.get(); } } diff --git a/ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp b/ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp index e9e4e720b1..1b66a3bc5b 100644 --- a/ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp +++ b/ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp @@ -433,8 +433,6 @@ void pptx_slide_context::end_shape() void pptx_slide_context::end_table() { - impl_->objects_.push_back(impl_->object_description_); - default_set(); } bool pptx_slide_context::empty() const diff --git a/ASCOfficeOdfFile/src/docx/pptx_table_context.cpp b/ASCOfficeOdfFile/src/docx/pptx_table_context.cpp index 983e6e6683..3f7b6f18e6 100644 --- a/ASCOfficeOdfFile/src/docx/pptx_table_context.cpp +++ b/ASCOfficeOdfFile/src/docx/pptx_table_context.cpp @@ -376,7 +376,7 @@ void oox_serialize_tcPr(std::wostream & strm, std::vectorrId = Context.get_slide_context().get_mediaitems().add_or_find(fill.bitmap->xlink_href_, oox::typeImage, isMediaInternal, ref); Context.get_slide_context().add_rels(isMediaInternal, fill.bitmap->rId, ref, oox::typeImage); diff --git a/ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp b/ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp index c345135a02..34c8fa1cc8 100644 --- a/ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp +++ b/ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp @@ -71,14 +71,9 @@ namespace odf_reader { void draw_g::pptx_convert(oox::pptx_conversion_context & Context) { - int i=0; - int size = content_.size(); - while(true) - { - if (i>=size)break; - office_element_ptr const & elm = content_[i]; - elm->pptx_convert(Context); - i++; + for (size_t i = 0; i < content_.size(); i++) + { + content_[i]->pptx_convert(Context); } } void draw_frame::pptx_convert_placeHolder(oox::pptx_conversion_context & Context)