Compare commits

..

3 Commits

Author SHA1 Message Date
7908abacf6 fix/bug79610
fix bug #79610
2026-02-18 20:08:01 +03:00
dfe7a64e1a fix/bug79610 2026-02-18 16:33:49 +03:00
65f89c1e4b fix/bug79610
fix bug #79610
2026-02-18 16:32:15 +03:00
7 changed files with 96 additions and 54 deletions

View File

@ -42,7 +42,7 @@ namespace DocFileFormat
{
ShapeConcentricFill = true;
Joins = round;
Path = L"wr-21600,,21600,43200,,,21600,21600nfe";
Path = L"wr-21600,,21600,43200,,,21600,21600nfewr-21600,,21600,43200,,,21600,21600l,21600nsxe";
Formulas.push_back( L"val #2");
Formulas.push_back( L"val #3");

View File

@ -1068,44 +1068,50 @@ public:
{
case ODRAW::rtLineTo:
{
if (valuePointer + 1 > m_arPoints.size())
{
break;
for (_UINT16 j = 0; j < m_arSegments[i].m_nCount; ++j)
{
if (valuePointer + 1 > m_arPoints.size())
{
break;
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[0].x);
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[0].y);
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[0].x);
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[0].y);
++valuePointer;
}
else
{
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].y );
++valuePointer;
}
else
{
strVmlPath += L"l";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].y );
++valuePointer;
}
++valuePointer;
}
}
}break;
case ODRAW::rtCurveTo:
{
if (valuePointer + 3 > m_arPoints.size())
break;
strVmlPath += L"c";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].y );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 1].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 1].y );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 2].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 2].y );
valuePointer += 3;
for (_UINT16 j = 0; j < m_arSegments[i].m_nCount; ++j)
{
if (valuePointer + 3 > m_arPoints.size())
break;
strVmlPath += L"c";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer].y );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 1].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 1].y );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 2].x );
strVmlPath += L",";
strVmlPath += std::to_wstring(m_arPoints[valuePointer + 2].y );
valuePointer += 3;
}
}break;
case ODRAW::rtMoveTo:
{
@ -1120,16 +1126,6 @@ public:
}
}
break;
case ODRAW::rtNoFill:
{
strVmlPath += L"nf";
}
break;
case ODRAW::rtNoStroke:
{
strVmlPath += L"ns";
}
break;
case ODRAW::rtClose:
{
strVmlPath += L"x";

View File

@ -2848,5 +2848,14 @@ const double docx_conversion_context::get_current_fontSize_from_default_style()
return 0.0;
}
int docx_conversion_context::get_pages_count_coefficient()
{
auto pages_count = *root()->odf_context().DocProps().page_count_;
if( pages_count > 0 && pages_count < 10 ) return 1;
else if ( pages_count > 9 && pages_count < 100 ) return 2;
else if ( pages_count > 99 && pages_count < 1000 ) return 3;
}
}
}

View File

@ -1028,6 +1028,8 @@ public:
const double get_current_fontSize_from_default_style();
int get_pages_count_coefficient();
private:
std::wstring temp_name;

View File

@ -538,6 +538,13 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val, oox::docx_con
{
double fontSize = 0.0;
int page_count = Context.get_pages_count_coefficient();
if( page_count <= 1 )
{
page_count = 2; // default
}
std::wstring fontName = Context.get_current_fontName();
if( Context.get_current_fontSize() > 0 )
@ -565,8 +572,21 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val, oox::docx_con
std::pair<double, double> maxDigitSize_ = utils::GetMaxDigitSizePixels(fontName, fontSize, 96., 0, Context.get_mediaitems()->applicationFonts());
double cx = get_value_emu(convert_symbol_size(1.76 * Context.get_math_context().width, maxDigitSize_.first, false));
double cy = get_value_emu(convert_symbol_size(1.76 * Context.get_math_context().height, maxDigitSize_.second, false));
double cx, cy;
double mathHeight = Context.get_math_context().height;
double mathWidth = Context.get_math_context().width;
if( mathHeight <= 0 || mathWidth <= 0)
{
cx = get_value_emu(convert_symbol_size(1.76 * page_count, maxDigitSize_.first, false));
cy = get_value_emu(convert_symbol_size(1.76, maxDigitSize_.second, false));
}
else
{
cx = get_value_emu(convert_symbol_size(1.76 * mathWidth, maxDigitSize_.first, false));
cy = get_value_emu(convert_symbol_size(1.76 * mathHeight, maxDigitSize_.second, false));
}
if (cx > val.cx)
val.cx = cx;
@ -660,6 +680,13 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val, oox::docx_con
{
double fontSize = 0.0;
int page_count = Context.get_pages_count_coefficient();
if( page_count <= 1 )
{
page_count = 2; // default
}
std::wstring fontName = Context.get_current_fontName();
if( Context.get_current_fontSize() > 0 )
@ -687,8 +714,21 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val, oox::docx_con
std::pair<double, double> maxDigitSize_ = utils::GetMaxDigitSizePixels(fontName, fontSize, 96., 0, Context.get_mediaitems()->applicationFonts());
double cx = get_value_emu(convert_symbol_size(1.76 * Context.get_math_context().width, maxDigitSize_.first, false));
double cy = get_value_emu(convert_symbol_size(1.76 * Context.get_math_context().height, maxDigitSize_.second, false));
double cx, cy;
double mathHeight = Context.get_math_context().height;
double mathWidth = Context.get_math_context().width;
if( mathHeight <= 0 || mathWidth <= 0)
{
cx = get_value_emu(convert_symbol_size(1.76 * page_count, maxDigitSize_.first, false));
cy = get_value_emu(convert_symbol_size(1.76, maxDigitSize_.second, false));
}
else
{
cx = get_value_emu(convert_symbol_size(1.76 * mathWidth, maxDigitSize_.first, false));
cy = get_value_emu(convert_symbol_size(1.76 * mathHeight, maxDigitSize_.second, false));
}
if (cx > val.cx)
val.cx = cx;

View File

@ -704,7 +704,7 @@ void text_format_properties::docx_serialize(std::wostream & _rPr, fonts_containe
if (text_display_)
{
if (text_display_->get_type() == text_display::None)
_rPr << L"<w:vanish w:val=\"true\"/>";
_rPr << L"<w:vanish />";
}
// underline
{
@ -1149,7 +1149,7 @@ void text_format_properties::docx_convert(oox::docx_conversion_context & Context
if (text_display_)
{
if (text_display_->get_type() == text_display::None)
_rPr << L"<w:vanish w:val=\"true\"/>";
_rPr << L"<w:vanish/>";
}
// underline
{

View File

@ -1181,11 +1181,6 @@ bool OOXShapeReader::ParseShape( ReaderParameter oParam, RtfShapePtr& pOutput)
PPTX::Logic::CustGeom& geometry = ooxShape->spPr.Geometry.as<PPTX::Logic::CustGeom>();
pOutput->m_nShapeType = SimpleTypes::Vml::sptNotPrimitive;
strXml = geometry.toXML();
size_t pos = strXml.find(L'>');
if (pos != std::wstring::npos)
{
strXml.insert(pos, L" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"");
}
}
if (ooxShape->spPr.Geometry.getType() == OOX::et_a_prstGeom)
{