fix/bug56564

fix bug with uncorrected table of contents
This commit is contained in:
Timofey Derevyankin
2025-08-27 22:39:10 +03:00
parent ba63cfc622
commit 518a38e178
3 changed files with 28 additions and 8 deletions

View File

@ -112,8 +112,19 @@ void tabs_context::add(const odf_reader::office_element_ptr & element, double ma
if (tab_stop)
{
tab_stop->margin_left = margin_left;
double pos = margin_left + tab_stop->style_position_.get_value_unit(odf_types::length::pt);
auto type = tab_stop->style_type_ ? tab_stop->style_type_->get_type() : odf_types::style_type::Left;
double pos;
if( type == odf_types::style_type::Right )
{
pos = tab_stop->style_position_.get_value_unit(odf_types::length::pt);
}
else
{
pos = margin_left + tab_stop->style_position_.get_value_unit(odf_types::length::pt);
}
std::map<int, odf_reader::office_element_ptr>::iterator pFind = clear_tabs.find((int)pos);

View File

@ -215,7 +215,21 @@ void calc_tab_stops(const style_instance * styleInstance, oox::tabs_context & co
context.reset();
for (size_t j = 0; j < tab_stops->content_.size(); j++)
{
context.add(tab_stops->content_[j], margin_left);
odf_reader::style_tab_stop *tab = dynamic_cast<odf_reader::style_tab_stop*>(tab_stops->content_[j].get());
if( tab )
{
auto type = tab->style_type_ ? tab->style_type_->get_type() : odf_types::style_type::Left;
if( type == odf_types::style_type::Right )
{
context.add(tab_stops->content_[j], 0);
}
else
{
context.add(tab_stops->content_[j], margin_left);
}
}
}
}
}