fix/bug79433

fix bug #79433 and fix 51965
This commit is contained in:
Timofey Derevyankin
2026-01-27 16:10:42 +03:00
parent 24ad4adf6f
commit 767b652ef2
4 changed files with 25 additions and 7 deletions

View File

@ -1431,6 +1431,10 @@ void docx_conversion_context::process_styles()
_Wostream << L"<w:style w:styleId=\"" << id << L"\" w:type=\"" << StyleTypeOdf2Docx(arStyles[i]->type()) << L"\"";
status_para[id] = false;
set_temp_style_name(id);
if (bDefault) // style
{
_Wostream << L" w:default=\"1\"";
@ -1484,10 +1488,9 @@ void docx_conversion_context::process_styles()
if (odf_reader::style_content * content = arStyles[i]->content())
{
get_tabs_context().clear();
calc_tab_stops(arStyles[i].get(), get_tabs_context());
calc_tab_stops(arStyles[i].get(), get_tabs_context());
get_styles_context().start_process_style(arStyles[i].get());
content->docx_convert(*this, true);
content->docx_convert(*this, true);
get_styles_context().end_process_style();
}
@ -1816,6 +1819,14 @@ int docx_conversion_context::get_page_break_before()
{
return page_break_before_;
}
void docx_conversion_context::set_temp_style_name( const std::wstring& _name )
{
temp_name = _name;
}
std::wstring docx_conversion_context::get_temp_style_name() const
{
return temp_name;
}
void docx_conversion_context::add_page_properties(const std::wstring & StyleName)
{
section_context::_section & s = section_context_.get_last();
@ -2224,7 +2235,6 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
get_section_context().dump_.clear();
}
}
output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
if (!get_text_tracked_context().dumpPPr_.empty())
@ -2236,7 +2246,7 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
serialize_list_properties(output_stream());
//if ((Attr->outline_level_) && (*Attr->outline_level_ > 0))
if (outline_level)
if ( outline_level && status_para[id] == false )
{
odf_reader::list_style_container & list_styles = root()->odf_context().listStyleContainer();
@ -2244,7 +2254,7 @@ int docx_conversion_context::process_paragraph_attr(odf_reader::text::paragraph_
{
output_stream() << L"<w:numPr>";
output_stream() << L"<w:ilvl w:val=\"" << *outline_level - 1 << L"\"/>";
output_stream() << L"<w:numId w:val=\"" << list_styles.id_by_name(id) << L"\"/>"; // check bug 51965
output_stream() << L"<w:numId w:val=\"" << list_styles.id_outline() << L"\"/>"; // check bug 51965
output_stream() << L"</w:numPr>";
}
output_stream() << L"<w:outlineLvl w:val=\"" << *outline_level << L"\"/>";

View File

@ -876,6 +876,9 @@ public:
void set_page_break (bool val);
bool get_page_break ();
void set_temp_style_name( const std::wstring& val );
std::wstring get_temp_style_name() const;
void add_page_properties (const std::wstring & StyleName);
std::wstring get_page_properties ();
@ -994,6 +997,7 @@ public:
drop_cap_context & get_drop_cap_context() { return drop_cap_context_; }
styles_map styles_map_;
std::unordered_map<std::wstring,bool> status_para{};
bool process_headers_footers_;
bool delayed_converting_;
bool convert_delayed_enabled_;
@ -1017,6 +1021,8 @@ public:
private:
std::wstring temp_name;
bool flag_implicit_end = false;
bool inside_frame = false;

View File

@ -203,6 +203,8 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
bListEnabled = false;
_pPr << L"<w:numPr>";
auto temp_name = Context.get_temp_style_name();
Context.status_para[temp_name] = true;
if (bListEnabled && level < 9 && bOutlineList)
{
_pPr << L"<w:ilvl w:val=\"" << level - 1 << L"\"/>";

View File

@ -394,7 +394,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context, _CP_OPT(std
process_list_bullet_style(Context);
int textStyle = Context.process_paragraph_attr(&attrs_);
int textStyle = Context.process_paragraph_attr(&attrs_);
Context.add_note_reference();