Skip to content

Commit

Permalink
fix bug #73097
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaSubbotina committed Feb 13, 2025
1 parent e484db4 commit ddd7628
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
8 changes: 4 additions & 4 deletions OdfFile/Reader/Format/calcs_styles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -118,20 +118,20 @@ 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<const style_instance *> & styleInstances)
graphic_format_properties_ptr calc_graphic_properties_content(const std::vector<const style_instance *> & styleInstances, bool noParents)
{
if (styleInstances.empty()) return graphic_format_properties_ptr();

graphic_format_properties_ptr result = boost::make_shared<graphic_format_properties>();

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;
Expand Down
4 changes: 2 additions & 2 deletions OdfFile/Reader/Format/calcs_styles.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<const style_instance *> & 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<const style_instance *> & 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<const style_instance *> & styleInstances);
Expand Down
2 changes: 1 addition & 1 deletion OdfFile/Reader/Format/draw_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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") ||
Expand Down
5 changes: 3 additions & 2 deletions OdfFile/Reader/Format/draw_frame_pptx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 *>(draw_frame_ptr.get());
if (frame)
Expand Down
2 changes: 2 additions & 0 deletions OdfFile/Reader/Format/style_graphic_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand Down Expand Up @@ -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_);
Expand Down
2 changes: 2 additions & 0 deletions OdfFile/Reader/Format/style_graphic_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down

0 comments on commit ddd7628

Please sign in to comment.