Commit a4bb32e8 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

OdtFormatWriter - преобразование градиентного текста (w14:GradFill) (нету в OpenOffice) в WordArt.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68491 954022d7-b5bf-4e40-9824-e11837661b57
parent 1e10b129
......@@ -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<draw_text_box*>(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_base*>(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<draw_base*>(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<draw_text_box*>(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);
}
}
......
......@@ -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();
......
......@@ -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++)
......
......@@ -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");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment