Merge branch 'develop' of https://git.onlyoffice.com/ONLYOFFICE/core into develop

This commit is contained in:
Elena Subbotina
2026-05-18 16:31:05 +03:00
5 changed files with 58 additions and 16 deletions

View File

@ -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",

View File

@ -859,29 +859,31 @@ namespace XmlUtils
case L'\0':
default:
{
if (!IsUnicodeSymbol(static_cast<unsigned int>( data[pos])))
{
#ifdef _WIN32
wchar_t symbol1 = data[pos];
#if defined(_WIN32) || defined(_WIN64)
wchar_t symbol1 = data[pos];
#else
uint16_t symbol1 = static_cast<uint16_t>(data[pos]);
uint16_t symbol1 = static_cast<uint16_t>(data[pos]);
#endif
if (!IsUnicodeSymbol(static_cast<unsigned int>( symbol1)))
{
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<uint16_t>(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<wchar_t>(codepoint);
#endif
wchar_t hexBuf[20];
swprintf(hexBuf, 20, L"&#x%X;", codepoint);
buffer.append(hexBuf);
pos++;
}
else

View File

@ -252,6 +252,27 @@ void draw_path::add_attributes( const xml::attributes_wc_ptr & Attributes )
sub_type_ = 6;
}
std::vector<double> 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<double> 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<double> 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);

View File

@ -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_;
};
/////////////////////////////////////////////////////////////////////////

View File

@ -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_);