From ddd7628bbe46d60d25bc82a7a3a80e1aa39156e7 Mon Sep 17 00:00:00 2001 From: ElenaSubbotina Date: Thu, 13 Feb 2025 17:48:33 +0300 Subject: [PATCH] fix bug #73097 --- OdfFile/Reader/Format/calcs_styles.cpp | 8 ++++---- OdfFile/Reader/Format/calcs_styles.h | 4 ++-- OdfFile/Reader/Format/draw_frame.cpp | 2 +- OdfFile/Reader/Format/draw_frame_pptx.cpp | 5 +++-- OdfFile/Reader/Format/style_graphic_properties.cpp | 2 ++ OdfFile/Reader/Format/style_graphic_properties.h | 2 ++ 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/OdfFile/Reader/Format/calcs_styles.cpp b/OdfFile/Reader/Format/calcs_styles.cpp index f0b300f6dc4..ae607cbe86a 100644 --- a/OdfFile/Reader/Format/calcs_styles.cpp +++ b/OdfFile/Reader/Format/calcs_styles.cpp @@ -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) +graphic_format_properties_ptr calc_graphic_properties_content(const style_instance * styleInstance, bool noParents) { 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 = styleInstance->parent(); + styleInstance = noParents ? NULL : styleInstance->parent(); } return calc_graphic_properties_content(graphicProps); } -graphic_format_properties_ptr calc_graphic_properties_content(const std::vector & styleInstances) +graphic_format_properties_ptr calc_graphic_properties_content(const std::vector & styleInstances, bool noParents) { 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]); + graphic_format_properties_ptr f = calc_graphic_properties_content(styleInstances[i], noParents); result->apply_from(f.get()); } return result; diff --git a/OdfFile/Reader/Format/calcs_styles.h b/OdfFile/Reader/Format/calcs_styles.h index 0ff9b5ddcda..a6171f42f05 100644 --- a/OdfFile/Reader/Format/calcs_styles.h +++ b/OdfFile/Reader/Format/calcs_styles.h @@ -48,8 +48,8 @@ namespace cpdoccore } namespace odf_reader { - graphic_format_properties_ptr calc_graphic_properties_content(const style_instance * styleInstance); - graphic_format_properties_ptr calc_graphic_properties_content(const std::vector & styleInstances); + 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 & styleInstances, bool noParents = false); text_format_properties_ptr calc_text_properties_content(const style_instance * styleInstance); text_format_properties_ptr calc_text_properties_content(const std::vector & styleInstances); diff --git a/OdfFile/Reader/Format/draw_frame.cpp b/OdfFile/Reader/Format/draw_frame.cpp index ea19a7edbba..8ccaecf2bbb 100644 --- a/OdfFile/Reader/Format/draw_frame.cpp +++ b/OdfFile/Reader/Format/draw_frame.cpp @@ -268,7 +268,7 @@ void draw_frame::add_attributes( const xml::attributes_wc_ptr & Attributes ) void draw_frame::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) { if (CP_CHECK_NAME(L"draw", L"text-box") || - CP_CHECK_NAME(L"draw", L"image") ||//копия объекта в виде картинки ну.. или просто картинка + CP_CHECK_NAME(L"draw", L"image") || CP_CHECK_NAME(L"table", L"table") || CP_CHECK_NAME(L"draw", L"object-ole")|| CP_CHECK_NAME(L"draw", L"applet") || diff --git a/OdfFile/Reader/Format/draw_frame_pptx.cpp b/OdfFile/Reader/Format/draw_frame_pptx.cpp index 179d3ab8f36..7f65e5600ce 100644 --- a/OdfFile/Reader/Format/draw_frame_pptx.cpp +++ b/OdfFile/Reader/Format/draw_frame_pptx.cpp @@ -172,12 +172,13 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context) } oox::_oox_fill fill; - graphic_format_properties_ptr properties = calc_graphic_properties_content(instances); + graphic_format_properties_ptr properties = calc_graphic_properties_content(instances, is_object_); if (properties) { properties->apply_to(Context.get_slide_context().get_properties()); Compute_GraphicFill(properties->common_draw_fill_attlist_, properties->style_background_image_, Context.root(), fill); + if (properties->fo_clip_) { std::wstring strRectClip = properties->fo_clip_.get(); @@ -403,7 +404,7 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context) } void draw_object::pptx_convert(oox::pptx_conversion_context & Context) { - if (draw_frame_ptr) + if (draw_frame_ptr) { draw_frame *frame = dynamic_cast(draw_frame_ptr.get()); if (frame) diff --git a/OdfFile/Reader/Format/style_graphic_properties.cpp b/OdfFile/Reader/Format/style_graphic_properties.cpp index 485c2b29d2b..d4f50c12d93 100644 --- a/OdfFile/Reader/Format/style_graphic_properties.cpp +++ b/OdfFile/Reader/Format/style_graphic_properties.cpp @@ -55,6 +55,7 @@ void graphic_format_properties::add_attributes( const xml::attributes_wc_ptr & A CP_APPLY_ATTR(L"draw:fit-to-contour", draw_fit_to_contour_); CP_APPLY_ATTR(L"style:shrink-to-fit", style_shrink_to_fit_); CP_APPLY_ATTR(L"draw:fit-to-size", draw_fit_to_size_str_); + CP_APPLY_ATTR(L"draw:ole-draw-aspect", draw_ole_draw_aspect_); CP_APPLY_ATTR(L"draw:stroke", draw_stroke_); CP_APPLY_ATTR(L"draw:stroke-dash", draw_stroke_dash_); @@ -205,6 +206,7 @@ void graphic_format_properties::apply_from(const graphic_format_properties * Oth _CP_APPLY_PROP3(draw_fit_to_size_); _CP_APPLY_PROP3(draw_fit_to_contour_); _CP_APPLY_PROP3(style_shrink_to_fit_); + _CP_APPLY_PROP3(draw_ole_draw_aspect_); _CP_APPLY_PROP3(svg_stroke_color_); _CP_APPLY_PROP3(svg_stroke_width_); diff --git a/OdfFile/Reader/Format/style_graphic_properties.h b/OdfFile/Reader/Format/style_graphic_properties.h index 5c23a515538..7a42aa58fea 100644 --- a/OdfFile/Reader/Format/style_graphic_properties.h +++ b/OdfFile/Reader/Format/style_graphic_properties.h @@ -96,6 +96,8 @@ class graphic_format_properties _CP_OPT(bool) draw_fit_to_contour_; _CP_OPT(std::wstring) draw_wrap_influence_on_position_; + _CP_OPT(unsigned int) draw_ole_draw_aspect_; + odf_types::common_draw_rel_size_attlist common_draw_rel_size_attlist_; odf_types::common_draw_fill_attlist common_draw_fill_attlist_; odf_types::common_horizontal_margin_attlist common_horizontal_margin_attlist_;