fix/bug69510

fix bug #69510
This commit is contained in:
Timofey Derevyankin
2025-11-20 23:42:25 +03:00
parent 389bf976a9
commit bbf6c2d8e9
4 changed files with 27 additions and 4 deletions

View File

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

View File

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

View File

@ -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)
{

View File

@ -1379,7 +1379,8 @@ void text_format_properties::docx_convert(oox::docx_conversion_context & Context
if( fontSize > 0 )
{
needProcessFontSize = false;
_rPr << L"<w:sz w:val=\"" << fontSize * Context.get_drop_cap_context().Scale << "\"/>";
int scale = Context.get_drop_cap_context().Scale != 1 ? Context.get_drop_cap_context().Scale : Context.get_scale();
_rPr << L"<w:sz w:val=\"" << fontSize * scale + (scale < 5 ? 0: 24) << "\"/>";
Context.set_inside_frame(false);
}
}