From bbf6c2d8e952d4767aa200d8ea68bd3ecd55f325 Mon Sep 17 00:00:00 2001 From: Timofey Derevyankin Date: Thu, 20 Nov 2025 23:42:25 +0300 Subject: [PATCH] fix/bug69510 fix bug #69510 --- OdfFile/Reader/Converter/docx_conversion_context.cpp | 10 ++++++++++ OdfFile/Reader/Converter/docx_conversion_context.h | 6 ++++++ .../Format/style_paragraph_properties_docx.cpp | 12 +++++++++--- OdfFile/Reader/Format/style_text_properties.cpp | 3 ++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/OdfFile/Reader/Converter/docx_conversion_context.cpp b/OdfFile/Reader/Converter/docx_conversion_context.cpp index f47679378f..2714372400 100644 --- a/OdfFile/Reader/Converter/docx_conversion_context.cpp +++ b/OdfFile/Reader/Converter/docx_conversion_context.cpp @@ -186,6 +186,16 @@ bool docx_conversion_context::get_inside_frame() const return inside_frame; } +void docx_conversion_context::set_scale( const int _scale ) +{ + scale_for_framePr = _scale; +} + +int docx_conversion_context::get_scale() const +{ + return scale_for_framePr; +} + void docx_conversion_context::set_output_document(package::docx_document * document) { output_document_ = document; diff --git a/OdfFile/Reader/Converter/docx_conversion_context.h b/OdfFile/Reader/Converter/docx_conversion_context.h index 895a4a273f..e814b5ab07 100644 --- a/OdfFile/Reader/Converter/docx_conversion_context.h +++ b/OdfFile/Reader/Converter/docx_conversion_context.h @@ -1011,12 +1011,18 @@ public: bool get_inside_frame() const; + void set_scale( const int _scale ); + + int get_scale() const; + private: bool flag_implicit_end = false; bool inside_frame = false; + int scale_for_framePr = 0; + struct _context_state { bool in_paragraph_ = false; diff --git a/OdfFile/Reader/Format/style_paragraph_properties_docx.cpp b/OdfFile/Reader/Format/style_paragraph_properties_docx.cpp index ae9882c6db..d9b4f083fc 100644 --- a/OdfFile/Reader/Format/style_paragraph_properties_docx.cpp +++ b/OdfFile/Reader/Format/style_paragraph_properties_docx.cpp @@ -266,6 +266,7 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co if (Context.get_drop_cap_context().Scale > 0) { CP_XML_ATTR(L"w:lines",Context.get_drop_cap_context().Scale); + Context.set_scale( Context.get_drop_cap_context().Scale ); } else { @@ -281,9 +282,14 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co CP_XML_ATTR(L"w:after", 0); if ( Context.get_inside_frame() ) { - int space = Context.get_drop_cap_context().Space > 0 ? Context.get_drop_cap_context().Space : 113; - _CP_LOG << "space = " << space << "\n"; - CP_XML_ATTR(L"w:line", 240 * ( Context.get_drop_cap_context().Scale ) + space); + if( Context.get_drop_cap_context().Scale < 5 ) + { + CP_XML_ATTR(L"w:line", 240 * ( Context.get_drop_cap_context().Scale )); + } + else + { + CP_XML_ATTR(L"w:line", 240 * ( Context.get_drop_cap_context().Scale ) + 2 * 240); + } } else if (Context.get_drop_cap_context().FontSize > 0) { diff --git a/OdfFile/Reader/Format/style_text_properties.cpp b/OdfFile/Reader/Format/style_text_properties.cpp index b31804b998..0e2e557ae9 100644 --- a/OdfFile/Reader/Format/style_text_properties.cpp +++ b/OdfFile/Reader/Format/style_text_properties.cpp @@ -1379,7 +1379,8 @@ void text_format_properties::docx_convert(oox::docx_conversion_context & Context if( fontSize > 0 ) { needProcessFontSize = false; - _rPr << L""; + int scale = Context.get_drop_cap_context().Scale != 1 ? Context.get_drop_cap_context().Scale : Context.get_scale(); + _rPr << L""; Context.set_inside_frame(false); } }