From 67733c1733d69cf53d2c98769145f406a288fac2 Mon Sep 17 00:00:00 2001 From: Dmitry Okunev Date: Thu, 14 May 2026 11:30:40 +0300 Subject: [PATCH 1/4] fix bug #74293 --- OdfFile/Reader/Format/draw_shapes.cpp | 42 ++++++++++++++++++++-- OdfFile/Reader/Format/draw_shapes.h | 2 ++ OdfFile/Reader/Format/draw_shapes_pptx.cpp | 3 ++ 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/OdfFile/Reader/Format/draw_shapes.cpp b/OdfFile/Reader/Format/draw_shapes.cpp index 78bb69add1..ac689b9090 100644 --- a/OdfFile/Reader/Format/draw_shapes.cpp +++ b/OdfFile/Reader/Format/draw_shapes.cpp @@ -252,6 +252,27 @@ void draw_path::add_attributes( const xml::attributes_wc_ptr & Attributes ) sub_type_ = 6; } + +std::vector transform_svg_view_box(std::wstring& svg_view_box) +{ + std::wstring::iterator it_start = svg_view_box.begin(), it_end = svg_view_box.end(); + std::vector vec_svg_view_box; + std::wstring element{}; + for(;it_start != it_end; it_start++) + { + if(std::iswspace(*it_start) && !element.empty()) + { + vec_svg_view_box.push_back(std::stod(element)); + element.clear(); + } + else if(std::isdigit(*it_start) || *it_start == L'\u002D') + element.push_back(*it_start); + } + if(!element.empty()) + vec_svg_view_box.push_back(std::stod(element)); + + return vec_svg_view_box; +} void draw_path::reset_svg_path() { if (!draw_path_attlist_.svg_d_) @@ -262,7 +283,16 @@ void draw_path::reset_svg_path() { std::vector<::svg_path::_polyline> o_Polyline_pt; std::vector<::svg_path::_polyline> o_Polyline_cm; - + std::vector svg_view_box = transform_svg_view_box(draw_path_attlist_.svg_viewbox_.get()); + + double scale_y{0.0}, scale_x{0.0}; + if(svg_view_box.size() == 4) + { + scale_y = draw_path_attlist_.svg_height_->get_value()/(svg_view_box[3]/1000.); + scale_x = draw_path_attlist_.svg_width_->get_value()/(svg_view_box[2]/1000.); + } + + bool bClosed = false, bStroked = true; bool res = ::svg_path::parseSvgD(o_Polyline_cm, draw_path_attlist_.svg_d_.get(), false, bClosed, bStroked); @@ -276,11 +306,17 @@ void draw_path::reset_svg_path() { if (poly.points[i].x) { - poly.points[i].x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu); + if(svg_view_box.size() == 4 && scale_x != 0.0) + poly.points[i].x = length((poly.points[i].x.get() - svg_view_box[0])/1000. * scale_x,length::cm).get_value_unit(length::emu); + else + poly.points[i].x = length(poly.points[i].x.get()/1000.,length::cm).get_value_unit(length::emu); } if (poly.points[i].y) { - poly.points[i].y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu); + if(svg_view_box.size() == 4 && scale_y != 0.0) + poly.points[i].y = length((poly.points[i].y.get() - svg_view_box[1])/1000. * scale_y,length::cm).get_value_unit(length::emu); + else + poly.points[i].y = length(poly.points[i].y.get()/1000.,length::cm).get_value_unit(length::emu); } } o_Polyline_pt.push_back(poly); diff --git a/OdfFile/Reader/Format/draw_shapes.h b/OdfFile/Reader/Format/draw_shapes.h index b5123deb96..1ce95288e2 100644 --- a/OdfFile/Reader/Format/draw_shapes.h +++ b/OdfFile/Reader/Format/draw_shapes.h @@ -228,6 +228,8 @@ public: virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); _CP_OPT(std::wstring) svg_d_; _CP_OPT(std::wstring) svg_viewbox_; + _CP_OPT(odf_types::length) svg_height_; + _CP_OPT(odf_types::length) svg_width_; }; ///////////////////////////////////////////////////////////////////////// diff --git a/OdfFile/Reader/Format/draw_shapes_pptx.cpp b/OdfFile/Reader/Format/draw_shapes_pptx.cpp index 59829e1797..d2219a5e56 100644 --- a/OdfFile/Reader/Format/draw_shapes_pptx.cpp +++ b/OdfFile/Reader/Format/draw_shapes_pptx.cpp @@ -233,6 +233,9 @@ void draw_line::pptx_convert(oox::pptx_conversion_context & Context) void draw_path::pptx_convert(oox::pptx_conversion_context & Context) { + draw_path_attlist_.svg_height_ = Context.get_text_context().get_svg_height(); + draw_path_attlist_.svg_width_ = Context.get_text_context().get_svg_width(); + reset_svg_path(); /////////////////////////////////////////////////////////////////////// Context.get_slide_context().start_shape(sub_type_); From 30f21fc3c79408a66b13df2c565ea78386bd02e3 Mon Sep 17 00:00:00 2001 From: Kirill Polyakov Date: Fri, 15 May 2026 17:11:44 +0300 Subject: [PATCH 2/4] Fix prev commit --- DesktopEditor/graphics/pro/js/drawingfile.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DesktopEditor/graphics/pro/js/drawingfile.json b/DesktopEditor/graphics/pro/js/drawingfile.json index 571be3aee7..1cffe21331 100644 --- a/DesktopEditor/graphics/pro/js/drawingfile.json +++ b/DesktopEditor/graphics/pro/js/drawingfile.json @@ -73,8 +73,7 @@ "freetype-2.10.4/include", "freetype-2.10.4/include/freetype", "../../../../OfficeUtils/src/zlib-1.2.11", "../../../../OfficeUtils/src/zlib-1.2.11/contrib/minizip", "../../../../OfficeUtils/src", "../../../../Common/3dParty/icu/icu/source/common", - "../../../../Common/3dParty/libxml/libxml2/include", - "../../../xml/build/qt", + "../../../xml/libxml2/include", "../../../xml/build/qt", "../../../../PdfFile/lib/goo", "../../../../PdfFile/lib/fofi", "../../../../PdfFile/lib/splash", "../../../../PdfFile/lib", "../../../raster/Jp2/openjpeg", "../../../raster/Jp2/openjpeg/openjpeg-2.4.0/src/lib/openjp2", "../../../../Common/3dParty/openssl/openssl/include", From e30a6acc877858997d7e7a288f9df17dcbcd45da Mon Sep 17 00:00:00 2001 From: Daria Ermakova Date: Sun, 17 May 2026 23:00:22 +0300 Subject: [PATCH 3/4] Fix bug 77975 --- OOXML/Base/Unit.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/OOXML/Base/Unit.cpp b/OOXML/Base/Unit.cpp index 41829156fb..7980c5662e 100644 --- a/OOXML/Base/Unit.cpp +++ b/OOXML/Base/Unit.cpp @@ -859,29 +859,31 @@ namespace XmlUtils case L'\0': default: { - if (!IsUnicodeSymbol(static_cast( data[pos]))) - { -#ifdef _WIN32 - wchar_t symbol1 = data[pos]; +#ifdef WIN32 + wchar_t symbol1 = data[pos]; #else - uint16_t symbol1 = static_cast(data[pos]); + uint16_t symbol1 = static_cast(data[pos]); #endif + if (!IsUnicodeSymbol(static_cast( symbol1))) + { + if(0xD800 <= symbol1 && symbol1 <= 0xDFFF && pos + 1 < data.size()) { -#ifdef _WIN32 + +#ifdef WIN32 wchar_t symbol2 = data[pos+1]; #else uint16_t symbol2 = static_cast(data[pos+1]); #endif + if (symbol1 < 0xDC00 && symbol2 >= 0xDC00 && symbol2 <= 0xDFFF) { -#ifdef _WIN32 - buffer.append(&data[pos], 2); -#else + uint32_t codepoint = 0x10000 + ((symbol1 - 0xD800) << 10) + (symbol2 - 0xDC00); - buffer += static_cast(codepoint); -#endif + wchar_t hexBuf[20]; + swprintf(hexBuf, 20, L"&#x%X;", codepoint); + buffer.append(hexBuf); pos++; } else From 073f100fe01b80d274b22b0bef467771e76f045c Mon Sep 17 00:00:00 2001 From: Daria Ermakova Date: Mon, 18 May 2026 10:11:07 +0300 Subject: [PATCH 4/4] Fix prev --- OOXML/Base/Unit.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OOXML/Base/Unit.cpp b/OOXML/Base/Unit.cpp index 7980c5662e..e3fc66221e 100644 --- a/OOXML/Base/Unit.cpp +++ b/OOXML/Base/Unit.cpp @@ -859,7 +859,7 @@ namespace XmlUtils case L'\0': default: { -#ifdef WIN32 +#if defined(_WIN32) || defined(_WIN64) wchar_t symbol1 = data[pos]; #else uint16_t symbol1 = static_cast(data[pos]); @@ -871,7 +871,7 @@ namespace XmlUtils if(0xD800 <= symbol1 && symbol1 <= 0xDFFF && pos + 1 < data.size()) { -#ifdef WIN32 +#if defined(_WIN32) || defined(_WIN64) wchar_t symbol2 = data[pos+1]; #else uint16_t symbol2 = static_cast(data[pos+1]);