diff --git a/OdfFile/Reader/Converter/pptx_text_context.cpp b/OdfFile/Reader/Converter/pptx_text_context.cpp index 8b8ac9e218..9439b67c52 100644 --- a/OdfFile/Reader/Converter/pptx_text_context.cpp +++ b/OdfFile/Reader/Converter/pptx_text_context.cpp @@ -107,6 +107,11 @@ public: void set_line_break(bool& bLineBreak); + void set_svg_height_width(odf_types::length svg_height,odf_types::length svg_width); + + _CP_OPT(odf_types::length) get_svg_width(); + _CP_OPT(odf_types::length) get_svg_height(); + bool in_list_; bool process_layouts_; @@ -152,6 +157,8 @@ private: bool first_element_list_item_; _CP_OPT(odf_types::length) last_run_font_size_; + _CP_OPT(odf_types::length) svg_heightVal; + _CP_OPT(odf_types::length) svg_widthVal; int new_list_style_number_; // счетчик для нумерации имен созданных в процессе конвертации стилей @@ -162,7 +169,6 @@ private: std::wstring find_list_rename(const std::wstring & ListStyleName); std::wstring current_list_style(); /////////////////////////// - field_type field_type_; std::wstringstream field_value_; @@ -1051,6 +1057,21 @@ void pptx_text_context::set_line_break(bool& bLineBreak) impl_->set_line_break(bLineBreak); } +void pptx_text_context::set_svg_height_width(odf_types::length svg_height,odf_types::length svg_width) +{ + impl_->set_svg_height_width(svg_height,svg_width); +} + +_CP_OPT(odf_types::length) pptx_text_context::get_svg_height() +{ + return impl_->get_svg_height(); +} + +_CP_OPT(odf_types::length) pptx_text_context::get_svg_width() +{ + return impl_->get_svg_width(); +} + void pptx_text_context::Impl::set_predump(const bool& bPredump) { is_predump = bPredump; @@ -1072,5 +1093,21 @@ void pptx_text_context::Impl::set_line_break(bool& bLineBreak) is_line_break = bLineBreak; } +void pptx_text_context::Impl::set_svg_height_width(odf_types::length svg_height,odf_types::length svg_width) +{ + svg_heightVal = svg_height; + svg_widthVal = svg_width; +} + +_CP_OPT(odf_types::length) pptx_text_context::Impl::get_svg_height() +{ + return svg_heightVal; +} + +_CP_OPT(odf_types::length) pptx_text_context::Impl::get_svg_width() +{ + return svg_widthVal; +} + } } diff --git a/OdfFile/Reader/Converter/pptx_text_context.h b/OdfFile/Reader/Converter/pptx_text_context.h index df6ce88e09..809ee43ff4 100644 --- a/OdfFile/Reader/Converter/pptx_text_context.h +++ b/OdfFile/Reader/Converter/pptx_text_context.h @@ -37,6 +37,7 @@ #include "oox_conversion_context.h" #include "../../DataTypes/stylefamily.h" +#include "../DataTypes/length.h" namespace cpdoccore { namespace odf_reader @@ -119,6 +120,11 @@ public: void set_line_break(bool& bLineBreak); + void set_svg_height_width(odf_types::length svg_height,odf_types::length svg_width); + + _CP_OPT(odf_types::length) get_svg_height(); + _CP_OPT(odf_types::length) get_svg_width(); + private: class Impl; diff --git a/OdfFile/Reader/Format/draw_shapes_pptx.cpp b/OdfFile/Reader/Format/draw_shapes_pptx.cpp index fd85288c8d..c3f0fec90f 100644 --- a/OdfFile/Reader/Format/draw_shapes_pptx.cpp +++ b/OdfFile/Reader/Format/draw_shapes_pptx.cpp @@ -182,6 +182,8 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context) //set fill & stroke to text } + Context.get_text_context().set_svg_height_width(svg_heightVal.get(),svg_widthVal.get()); + for (size_t i = 0; i < content_.size(); i++) { content_[i]->pptx_convert(Context); diff --git a/OdfFile/Reader/Format/style_paragraph_properties_pptx.cpp b/OdfFile/Reader/Format/style_paragraph_properties_pptx.cpp index 5f627b2c89..b61001ecc3 100644 --- a/OdfFile/Reader/Format/style_paragraph_properties_pptx.cpp +++ b/OdfFile/Reader/Format/style_paragraph_properties_pptx.cpp @@ -284,6 +284,20 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co w_right = pptx_process_margin(fo_margin_right_, length::emu, 1.); w_firstLine = pptx_process_margin(fo_text_indent_,length::emu, 1.); + _CP_OPT(odf_types::length) svg_heightValue = Context.get_text_context().get_svg_height(); + _CP_OPT(odf_types::length) svg_widthValue = Context.get_text_context().get_svg_width(); + + std::wstring ws_svg_height,ws_svg_width; + + ws_svg_height = std::to_wstring((int)(0.5 + 1. * svg_heightValue->get_value_unit(length::emu))); + ws_svg_width = std::to_wstring((int)(0.5 + 1. * svg_widthValue->get_value_unit(length::emu))); + + if(!ws_svg_width.empty() && !w_left.empty()) + { + double d_left = std::stod(w_left),d_svg_width = std::stod(ws_svg_width); + if(d_left>d_svg_width) + w_left = L"0"; + } //if (w_left.empty()) w_left = L"0"; //if (w_right.empty()) w_right = L"0"; //if (w_firstLine.empty()) w_hanging = L"0";