This commit is contained in:
Elena Subbotina
2025-06-05 19:23:20 +03:00
parent 10427d151d
commit 7f31f40843
8 changed files with 57 additions and 18 deletions

View File

@ -384,21 +384,50 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
}
if (fill != ns + L":noFill")
{
_CP_OPT(std::wstring) strVal;
_CP_OPT(std::wstring) strVal;
if (dash_style.length() > 0 && dash_style != L"solid")
{
CP_XML_NODE(ns + L":prstDash"){CP_XML_ATTR2(ns_att + L"val", dash_style);}
CP_XML_NODE(ns + L":prstDash")
{
CP_XML_ATTR2(ns_att + L"val", dash_style);
}
}
odf_reader::GetProperty(prop,L"marker-start", strVal);
if (strVal)
{
CP_XML_NODE(ns + L":headEnd"){CP_XML_ATTR2(ns_att + L"type", strVal.get());}
CP_XML_NODE(ns + L":headEnd")
{
CP_XML_ATTR2(ns_att + L"type", strVal.get());
_CP_OPT(double) dWidth;
odf_reader::GetProperty(prop, L"marker-start-width", dWidth);
if (dWidth && dStrokeWidth)
{
double kf = *dWidth / *dStrokeWidth;
if (kf > 3.5) CP_XML_ATTR2(ns_att + L"w", L"lg");
else if (kf < 2.6) CP_XML_ATTR2(ns_att + L"w", L"sm");
else CP_XML_ATTR2(ns_att + L"w", L"med");
}
}
}
odf_reader::GetProperty(prop,L"marker-end",strVal);
odf_reader::GetProperty(prop,L"marker-end", strVal);
if (strVal)
{
CP_XML_NODE(ns + L":tailEnd"){CP_XML_ATTR2(ns_att + L"type",strVal.get());}
CP_XML_NODE(ns + L":tailEnd")
{
CP_XML_ATTR2(ns_att + L"type", strVal.get());
_CP_OPT(double) dWidth;
odf_reader::GetProperty(prop, L"marker-start-width", dWidth);
if (dWidth && dStrokeWidth)
{
double kf = *dWidth / *dStrokeWidth;
if (kf > 3.5) CP_XML_ATTR2(ns_att + L"w", L"lg");
else if (kf < 2.6) CP_XML_ATTR2(ns_att + L"w", L"sm");
else CP_XML_ATTR2(ns_att + L"w", L"med");
}
}
}
}
}

View File

@ -37,7 +37,7 @@
namespace cpdoccore {
namespace oox {
oox_bitmap_fill::oox_bitmap_fill() : name_space(L"a"), bStretch(false), bCrop(false), bTile(false), isInternal(true)
oox_bitmap_fill::oox_bitmap_fill() : name_space(L"a"), bStretch(true), bCrop(false), bTile(false), isInternal(true)
{
memset(cropRect, 0, sizeof(double)*4);
}

View File

@ -179,7 +179,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
Compute_GraphicFill(properties->common_draw_fill_attlist_, properties->style_background_image_, Context.root(), fill);
if (properties->fo_clip_)
if (properties->fo_clip_ && fill.bitmap)
{
std::wstring strRectClip = properties->fo_clip_.get();
fill.bitmap->clipping = strRectClip.length() > 6 ? strRectClip.substr(5, strRectClip.length() - 6) : L"";

View File

@ -195,7 +195,7 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
properties->apply_to(Context.get_drawing_context().get_properties());
Compute_GraphicFill(properties->common_draw_fill_attlist_, properties->style_background_image_, Context.root(), fill);
if (properties->fo_clip_)
if (properties->fo_clip_ && fill.bitmap)
{
std::wstring strRectClip = properties->fo_clip_.get();
fill.bitmap->clipping = strRectClip.length() > 6 ? strRectClip.substr(5, strRectClip.length() - 6) : L"";

View File

@ -141,7 +141,7 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
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_)
if (properties->fo_clip_ && fill.bitmap)
{
std::wstring strRectClip = properties->fo_clip_.get();
fill.bitmap->clipping = strRectClip.length() > 6 ? strRectClip.substr(5, strRectClip.length() - 6) : L"";

View File

@ -61,6 +61,8 @@ void graphic_format_properties::add_attributes( const xml::attributes_wc_ptr & A
CP_APPLY_ATTR(L"draw:stroke-dash", draw_stroke_dash_);
CP_APPLY_ATTR(L"draw:marker-start", draw_marker_start_);
CP_APPLY_ATTR(L"draw:marker-end", draw_marker_end_);
CP_APPLY_ATTR(L"draw:marker-start-width", draw_marker_start_width_);
CP_APPLY_ATTR(L"draw:marker-end-width", draw_marker_end_width_);
CP_APPLY_ATTR(L"draw:stroke-gradient-name", draw_stroke_gradient_name_);
@ -128,16 +130,18 @@ void graphic_format_properties::apply_to(std::vector<_property> & properties)
{
properties.push_back(_property(L"marker-start", draw_marker_start_->get() ));
}
if (draw_marker_start_width_)
{
properties.push_back(_property(L"marker-start-width", draw_marker_start_width_->get_value_unit(odf_types::length::pt)));
}
if (draw_marker_end_)
{
//const std::wstring style_name = draw_marker_end_->get();
//if (!style_name.empty())
////if (office_element_ptr style = styles.find_by_style_name(style_name))
//{
properties.push_back(_property(L"marker-end", draw_marker_end_->get() ));
//}
properties.push_back(_property(L"marker-end", draw_marker_end_->get() ));
}
if (draw_marker_end_width_)
{
properties.push_back(_property(L"marker-end-width", draw_marker_end_width_->get_value_unit(odf_types::length::pt)));
}
if (draw_textarea_horizontal_align_)properties.push_back(_property(L"textarea-horizontal_align",draw_textarea_horizontal_align_->get_type() ));
if (draw_textarea_vertical_align_) properties.push_back(_property(L"textarea-vertical_align", draw_textarea_vertical_align_->get_type() ));
@ -199,7 +203,9 @@ void graphic_format_properties::apply_from(const graphic_format_properties * Oth
_CP_APPLY_PROP3(draw_stroke_dash_);
_CP_APPLY_PROP3(draw_marker_start_);
_CP_APPLY_PROP3(draw_marker_end_);
_CP_APPLY_PROP3(draw_textarea_horizontal_align_);
_CP_APPLY_PROP3(draw_marker_start_width_);
_CP_APPLY_PROP3(draw_marker_end_width_);
_CP_APPLY_PROP3(draw_textarea_horizontal_align_);
_CP_APPLY_PROP3(draw_textarea_vertical_align_);
_CP_APPLY_PROP3(draw_auto_grow_height_);
_CP_APPLY_PROP3(draw_auto_grow_width_);

View File

@ -83,6 +83,8 @@ public:
_CP_OPT(odf_types::marker_style) draw_marker_end_;
_CP_OPT(odf_types::marker_style) draw_marker_start_;
_CP_OPT(odf_types::length) draw_marker_start_width_;
_CP_OPT(odf_types::length) draw_marker_end_width_;
_CP_OPT(odf_types::text_align) draw_textarea_horizontal_align_;
_CP_OPT(odf_types::vertical_align) draw_textarea_vertical_align_;

View File

@ -56,7 +56,9 @@ void graphic_format_properties::apply_from(const graphic_format_properties & Oth
_CP_APPLY_PROP2(draw_stroke_dash_);
_CP_APPLY_PROP2(draw_marker_start_);
_CP_APPLY_PROP2(draw_marker_end_);
_CP_APPLY_PROP2(draw_textarea_horizontal_align_);
_CP_APPLY_PROP2(draw_marker_start_width_);
_CP_APPLY_PROP2(draw_marker_end_width_);
_CP_APPLY_PROP2(draw_textarea_horizontal_align_);
_CP_APPLY_PROP2(draw_textarea_vertical_align_);
_CP_APPLY_PROP2(draw_auto_grow_height_);
_CP_APPLY_PROP2(draw_auto_grow_width_);