Merge remote-tracking branch 'origin/hotfix/v8.3.1' into develop

This commit is contained in:
Elena Subbotina
2025-02-24 12:14:01 +03:00
15 changed files with 202 additions and 37 deletions

View File

@ -984,6 +984,9 @@ public:
void add_alphabetical_index_text (odf_reader::office_element_ptr & elem);
void set_process_headers_footers(bool Val) { process_headers_footers_ = Val; }
void set_next_master_page_name(_CP_OPT(std::wstring) masterPageName) { next_master_page_name_ = masterPageName; }
_CP_OPT(std::wstring) get_next_master_page_name() { return next_master_page_name_; }
headers_footers & get_headers_footers() { return headers_footers_; }
header_footer_context & get_header_footer_context() { return header_footer_context_; }
@ -1095,6 +1098,8 @@ private:
std::vector<_CP_PTR(odf_reader::text_list_style)> restarted_list_styles;
std::unordered_map<std::wstring, size_t> list_styles_occurances_;
_CP_OPT(std::wstring) next_master_page_name_;
};
}

View File

@ -179,7 +179,7 @@ void _docx_drawing::serialize_text(std::wostream & strm)
CP_XML_WRITER(strm)
{
if (strTextContent)
if (strTextContent && !strTextContent->empty())
{
CP_XML_NODE(L"wps:txbx")
{

View File

@ -105,7 +105,7 @@ graphic_format_properties_ptr calc_graphic_properties_content(const std::vector<
return result;
}
graphic_format_properties_ptr calc_graphic_properties_content(const style_instance * styleInstance, bool noParents)
graphic_format_properties_ptr calc_graphic_properties_content(const style_instance * styleInstance, bool noParentStandard)
{
if (!styleInstance) return graphic_format_properties_ptr();
@ -118,12 +118,12 @@ graphic_format_properties_ptr calc_graphic_properties_content(const style_instan
graphicProps.insert(graphicProps.begin(), graphicProp);
}
styleInstance = noParents ? NULL : styleInstance->parent();
styleInstance = (noParentStandard && L"standard" == XmlUtils::GetLower(styleInstance->parent_name())) ? NULL : styleInstance->parent();
}
return calc_graphic_properties_content(graphicProps);
}
graphic_format_properties_ptr calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances, bool noParents)
graphic_format_properties_ptr calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances, bool noParentStandard)
{
if (styleInstances.empty()) return graphic_format_properties_ptr();
@ -131,7 +131,7 @@ graphic_format_properties_ptr calc_graphic_properties_content(const std::vector<
for (size_t i = 0; i < styleInstances.size(); i++)
{
graphic_format_properties_ptr f = calc_graphic_properties_content(styleInstances[i], noParents);
graphic_format_properties_ptr f = calc_graphic_properties_content(styleInstances[i], noParentStandard);
result->apply_from(f.get());
}
return result;

View File

@ -48,8 +48,8 @@ namespace cpdoccore
}
namespace odf_reader
{
graphic_format_properties_ptr calc_graphic_properties_content(const style_instance* styleInstance, bool noParents = false);
graphic_format_properties_ptr calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances, bool noParents = false);
graphic_format_properties_ptr calc_graphic_properties_content(const style_instance* styleInstance, bool noParentStandard = false);
graphic_format_properties_ptr calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances, bool noParentStandard = false);
text_format_properties_ptr calc_text_properties_content(const style_instance * styleInstance);
text_format_properties_ptr calc_text_properties_content(const std::vector<const style_instance *> & styleInstances);

View File

@ -190,6 +190,15 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_right", Compute_BorderWidth(properties, sideRight)));
Context.get_slide_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
if (properties->style_mirror_)
{
bool flipV = properties->style_mirror_->find(L"vertical") != std::wstring::npos;
bool flipH = properties->style_mirror_->find(L"horizontal") != std::wstring::npos;
Context.get_slide_context().set_property(odf_reader::_property(L"flipV", flipV));
Context.get_slide_context().set_property(odf_reader::_property(L"flipH", flipH));
}
if (properties->style_columns_)
properties->style_columns_->pptx_convert(Context);
}

View File

@ -46,6 +46,7 @@
#include "serialize_elements.h"
#include "style_graphic_properties.h"
#include "text_elements.h"
#include "odfcontext.h"
@ -130,8 +131,19 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
for (size_t i = 0; i < content_.size(); i++)
{
ElementType type = content_[i]->get_type();
if (type == typeTextP)
{
auto _p = dynamic_cast<text::p*>(content_[i].get());
if (_p)
{
if(!_p->paragraph_.content_.size() && _p->paragraph_.attrs_.text_style_name_.empty())
continue;
}
}
content_[i]->docx_convert(Context);
}
}
Context.back_context_state();

View File

@ -218,6 +218,14 @@ void office_text::docx_convert(oox::docx_conversion_context & Context)
}
}
}
_CP_OPT(std::wstring) next_master_name = Context.get_next_master_page_name();
if (next_master_name)
{
masterPageName = *next_master_name;
Context.set_next_master_page_name(boost::none);
}
if (masterPageName)
{
std::wstring masterPageNameLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_name_by_style(*masterPageName);
@ -261,6 +269,12 @@ void office_text::docx_convert(oox::docx_conversion_context & Context)
{
if (next_para_props->content_.fo_break_before_ && next_para_props->content_.fo_break_before_->get_type() == odf_types::fo_break::Page)
{
std::wstring currentMasterPageName = Context.get_master_page_name();
style_master_page* masterPage = Context.root()->odf_context().pageLayoutContainer().master_page_by_name(currentMasterPageName);
if (masterPage && masterPage->attlist_.style_next_style_name_)
Context.set_next_master_page_name(*masterPage->attlist_.style_next_style_name_);
Context.next_dump_page_properties(true);
}
}

View File

@ -152,6 +152,14 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
_tblPr << L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" << w_fill << "\"/>";
}
if (common_writing_mode_attlist_.style_writing_mode_)
{
bool rtl = common_writing_mode_attlist_.style_writing_mode_->get_type() == odf_types::writing_mode::RlTb;
if (rtl)
_tblPr << L"<w:bidiVisual/>";
}
}
// style:table-properties

View File

@ -515,6 +515,15 @@ void soft_page_break::docx_convert(oox::docx_conversion_context & Context)
{
if (Context.process_headers_footers_)
return;
std::wstring currentMasterPageName = Context.get_master_page_name();
style_master_page* masterPage = Context.root()->odf_context().pageLayoutContainer().master_page_by_name(currentMasterPageName);
if (masterPage && masterPage->attlist_.style_next_style_name_)
{
Context.set_next_master_page_name(*masterPage->attlist_.style_next_style_name_);
Context.next_dump_page_properties(true);
}
if (0 == Context.get_page_break_after() && 0 == Context.get_page_break_before())
{