From a4bb32e8ecc3c91ba60eeadc187e7ec58bd00a7c Mon Sep 17 00:00:00 2001 From: "Elen.Subbotina" Date: Sat, 27 Feb 2016 12:16:43 +0000 Subject: [PATCH] =?UTF-8?q?OdtFormatWriter=20-=20=D0=BF=D1=80=D0=B5=D0=BE?= =?UTF-8?q?=D0=B1=D1=80=D0=B0=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B3=D1=80=D0=B0=D0=B4=D0=B8=D0=B5=D0=BD=D1=82=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D1=82=D0=B5=D0=BA=D1=81=D1=82=D0=B0=20(w14:Grad?= =?UTF-8?q?Fill)=20(=D0=BD=D0=B5=D1=82=D1=83=20=D0=B2=20OpenOffice)=20?= =?UTF-8?q?=D0=B2=20WordArt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68491 954022d7-b5bf-4e40-9824-e11837661b57 --- .../source/OdfFormat/odf_drawing_context.cpp | 65 +++++++++++++++++++ .../source/OdfFormat/odf_drawing_context.h | 2 + .../source/Oox2OdfConverter/Converter.cpp | 7 ++ .../source/Oox2OdfConverter/DocxConverter.cpp | 13 +++- 4 files changed, 86 insertions(+), 1 deletion(-) diff --git a/ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp b/ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp index e89282c255..ab3d049d7d 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp +++ b/ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp @@ -635,6 +635,55 @@ void odf_drawing_context::start_shape(int type) impl_->create_draw_base(7); } } + +bool odf_drawing_context::change_text_box_2_wordart() +{ + if (impl_->current_drawing_state_.oox_shape_preset > 2000 && impl_->current_drawing_state_.oox_shape_preset < 3000) + return true; + if (impl_->current_drawing_state_.elements_.size() < 1) return false; + + draw_text_box* t = dynamic_cast(impl_->current_drawing_state_.elements_.back().elm.get()); + if (!t) return false; +//------------------------------------------------------------------------ + office_element_ptr draw_elm = impl_->create_draw_element(7); + + draw_base* draw = dynamic_cast(draw_elm.get()); + if (draw == NULL)return false; + + int sz = impl_->current_level_.size(); + if (sz < 2) return false; + + int sz_state = impl_->current_drawing_state_.elements_.size(); + if (sz_state < 2) return false; + + if (sz > 2) // ?? + { + draw_base* draw_old = dynamic_cast(impl_->current_level_[sz-2].get()); + if (draw_old) + { + draw_old->content_[draw_old->content_.size() - 1] = draw_elm; + } + } +//---------------------------------------------- + + odf_element_state state = impl_->current_drawing_state_.elements_[sz_state - 2]; + state.elm = draw_elm; + + draw->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_style_name_attlist_.draw_style_name_ + = style_ref(state.style_name); + + impl_->current_level_.erase (impl_->current_level_.end() - 2, impl_->current_level_.end()); + impl_->current_level_.push_back(draw_elm); + + impl_->current_drawing_state_.elements_.erase(impl_->current_drawing_state_.elements_.end() - 2, impl_->current_drawing_state_.elements_.end()); + impl_->current_drawing_state_.elements_.push_back( state); + + impl_->current_drawing_state_.oox_shape_preset = 2031;//plain text + + if (sz == 2) impl_->root_element_ = draw_elm; + return true; +} + void odf_drawing_context::end_shape() { if (impl_->current_drawing_state_.elements_.size() < 1) @@ -1827,6 +1876,21 @@ void odf_drawing_context::start_text_box() set_no_fill(); end_area_properties(); } + +void odf_drawing_context::set_text_box_min_size(bool val) +{ + if (impl_->current_drawing_state_.elements_.size() < 1) return; + draw_text_box* draw = dynamic_cast(impl_->current_drawing_state_.elements_.back().elm.get()); + + if (draw) + { + if (!draw->draw_text_box_attlist_.fo_min_height_) + draw->draw_text_box_attlist_.fo_min_height_ = impl_->anchor_settings_.svg_height_; + if (!draw->draw_text_box_attlist_.fo_min_width_) + draw->draw_text_box_attlist_.fo_min_width_ = impl_->anchor_settings_.svg_width_; + } +} + void odf_drawing_context::set_text_box_min_size(double w_pt, double h_pt) { if (impl_->current_drawing_state_.elements_.size() < 1) return; @@ -1837,6 +1901,7 @@ void odf_drawing_context::set_text_box_min_size(double w_pt, double h_pt) if (h_pt >0) draw->draw_text_box_attlist_.fo_min_height_= length(length(h_pt,length::pt).get_value_unit(length::cm), length::cm); if (w_pt >0) draw->draw_text_box_attlist_.fo_min_width_= length(length(w_pt,length::pt).get_value_unit(length::cm), length::cm); + } } diff --git a/ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.h b/ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.h index ac6427857a..3e77d220ab 100644 --- a/ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.h +++ b/ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.h @@ -78,11 +78,13 @@ public: void start_shape(int type); void end_shape(); + bool change_text_box_2_wordart(); void start_image(std::wstring file_path); void end_image(); void start_text_box(); + void set_text_box_min_size(bool val); void set_text_box_min_size(double w_pt, double h_pt); void set_text_box_parent_style(std::wstring style_name); void end_text_box(); diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp index 335c01a5ad..d95382fc63 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp @@ -994,6 +994,7 @@ void OoxConverter::convert(OOX::Drawing::CSchemeColor *oox_ShemeClr, std::ws int theme_ind = oox_ShemeClr->m_oVal.GetValue(); BYTE ucA=0, ucG=0, ucB=0, ucR =0; + bool result = false; switch(theme_ind) @@ -1115,6 +1116,12 @@ void OoxConverter::convert(OOX::Drawing::CTextBodyProperties *oox_bodyPr) //+ style section //+element text:section в котором параграфы } + if (oox_bodyPr->m_oSpAutoFit.IsInit()) + { + //изменяемы размеры + odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min + + } if (oox_bodyPr->m_oFromWordArt.ToBool() && oox_bodyPr->m_oPrstTxWrap.IsInit()) { for (unsigned int i=0; i< oox_bodyPr->m_oPrstTxWrap->m_oAvLst->m_arrGd.size(); i++) diff --git a/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp b/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp index 5ac8f69466..099bdfbe35 100644 --- a/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp +++ b/ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp @@ -1572,7 +1572,18 @@ void DocxConverter::convert(OOX::Logic::CRunProperty *oox_run_pr, odf_writer::st else text_properties->content().fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WNormal); } - if (oox_run_pr->m_oColor.IsInit()) + + if (oox_run_pr->m_oGradFill.IsInit()) + { + bool res = odf_context()->drawing_context()->change_text_box_2_wordart(); + + odf_context()->drawing_context()->start_area_properties(); + { + OoxConverter::convert(oox_run_pr->m_oGradFill.GetPointer(), NULL); + } + odf_context()->drawing_context()->end_area_properties(); + } + else if (oox_run_pr->m_oColor.IsInit()) { if(oox_run_pr->m_oColor->m_oVal.IsInit() && oox_run_pr->m_oColor->m_oVal->GetValue() == SimpleTypes::hexcolorAuto) text_properties->content().fo_color_ = odf_types::color(L"#000000");