Commit 0d8c668f authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormat, fix bug 36596 (only for onlyoffice editors)

parent 310cff0d
......@@ -103,7 +103,7 @@ public:
reset_fill(l.fill_);
//floor_.content_= l;
}
void set_legend(odf_reader::chart::simple & l)
void set_legend(odf_reader::chart::legend & l)
{
reset_fill(l.fill_);
legend_.content_= l;
......
......@@ -52,10 +52,9 @@ void oox_chart_legend::oox_serialize(std::wostream & _Wostream)
{
CP_XML_NODE(L"c:legend")
{
CP_XML_NODE(L"c:legendPos")
{
CP_XML_ATTR(L"val", "r");// "b" | "l" | "r" | "t"// == bottom left right top
CP_XML_ATTR(L"val", content_.position);
}
layout_.oox_serialize(CP_XML_STREAM());
......
......@@ -48,7 +48,7 @@ public:
void oox_serialize(std::wostream & _Wostream);
odf_reader::chart::simple content_;
odf_reader::chart::legend content_;
private:
cpdoccore::oox::oox_layout layout_; //layout (Layout) §21.2.2.88
......
......@@ -762,6 +762,28 @@ void process_build_object::visit(const chart_footer& val)
void process_build_object::visit(const chart_legend& val)
{
object_odf_context_.legend_.bEnabled = true;
object_odf_context_.legend_.position = L"r";
if (val.attlist_.chart_legend_position_)
{
std::wstring pos = val.attlist_.chart_legend_position_.get();
if ( pos == L"bottom") object_odf_context_.legend_.position = L"b";
if ( pos == L"start") object_odf_context_.legend_.position = L"l";
if ( pos == L"top") object_odf_context_.legend_.position = L"t";
if ( pos == L"top-end") object_odf_context_.legend_.position = L"tr";
if ( pos == L"top-start") object_odf_context_.legend_.position = L"tl";
if ( pos == L"bottom-start") object_odf_context_.legend_.position = L"bl";
if ( pos == L"bottom-end") object_odf_context_.legend_.position = L"br";
}
if (val.attlist_.chart_legend_align_)
{
std::wstring align = val.attlist_.chart_legend_align_.get();
//if ( pos == L"start") object_odf_context_.legend_.align = L"b";
//if ( pos == L"center") object_odf_context_.legend_.align = L"l";
//if ( pos == L"end") object_odf_context_.legend_.align = L"t";
}
ApplyChartProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.properties_);
ApplyGraphicProperties (val.attlist_.common_attlist_.chart_style_name_.get_value_or(L""), object_odf_context_.legend_.graphic_properties_,object_odf_context_.legend_.fill_);
......
......@@ -188,7 +188,7 @@ public:
office_element_ptr_array title_odf_context_;
chart::title sub_title_;
chart::simple legend_;
chart::legend legend_;
chart::plot_area plot_area_;
chart::simple wall_;
......
......@@ -76,6 +76,7 @@ namespace chart {
struct simple
{
simple() : bEnabled(false) {}
bool bEnabled;
std::vector<_property> properties_;
std::vector<_property> text_properties_;
......@@ -92,6 +93,11 @@ namespace chart {
treadline(){bEquation = false; bREquation = false;}
};
struct legend : public simple
{
std::wstring position;
std::wstring align;
};
struct plot_area : public simple
{
std::wstring cell_range_address_;
......
......@@ -72,7 +72,6 @@ class common_chart_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) chart_style_name_;
};
......@@ -117,7 +116,6 @@ class chart_title_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) table_cell_range_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
common_chart_attlist common_attlist_;
......@@ -194,13 +192,13 @@ class chart_legend_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
public:
_CP_OPT(std::wstring) chart_legend_position_;
_CP_OPT(std::wstring) chart_legend_align_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
_CP_OPT(std::wstring) style_legend_expansion_;
_CP_OPT(double) style_legend_expansion_aspect_ratio_;
common_chart_attlist common_attlist_;
odf_types::common_draw_position_attlist common_draw_position_attlist_;
common_chart_attlist common_attlist_;
};
......
......@@ -67,10 +67,11 @@ void table_format_properties::add_attributes( const xml::attributes_wc_ptr & Att
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
CP_APPLY_ATTR(L"style:may-break-between-rows", style_may_break_between_rows_);
CP_APPLY_ATTR(L"table:align", table_align_);
CP_APPLY_ATTR(L"table:border-model", table_border_model_);
CP_APPLY_ATTR(L"table:display", table_display_);
CP_APPLY_ATTR(L"tableooo:tab-color", tableooo_tab_color_);
CP_APPLY_ATTR(L"table:align", table_align_);
CP_APPLY_ATTR(L"table:border-model", table_border_model_);
CP_APPLY_ATTR(L"table:display", table_display_);
CP_APPLY_ATTR(L"tableooo:tab-color", tableooo_tab_color_);
CP_APPLY_ATTR(L"style:use-optimal-column-width",style_use_optimal_column_width_);
}
bool table_format_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name, document_context * Context)
......@@ -94,17 +95,22 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if (style_rel_width_)
{
int w_w = (int)(0.5 + 50.0 * style_rel_width_->get_value());
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\" />";
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"" << w_w << "\"/>";
}
else if (style_width_)
else if (style_use_optimal_column_width_)
{
_tblPr << L"<w:tblW w:type=\"auto\" w:w=\"0\"/>";
}
else if (style_width_)
{
int w_w = (int)(0.5 + 20.0 * style_width_->get_value_unit(length::pt));
if (w_w > 31680)w_w = 31680;
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\" />";
_tblPr << L"<w:tblW w:type=\"dxa\" w:w=\"" << w_w << "\"/>";
}
else
{
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"5000\" />";
_tblPr << L"<w:tblW w:type=\"pct\" w:w=\"5000\"/>";
}
if (common_break_attlist_.fo_break_before_)
......@@ -127,23 +133,26 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
{
odf_types::length indent = common_horizontal_margin_attlist_.fo_margin_left_->get_length();
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\" />";
_tblPr << L"<w:tblInd w:w=\"" << indent.get_value_unit(odf_types::length::pt) * 20 << "\" w:type=\"dxa\"/>";
}
}
else //if (table_align_->get_type() == table_align::Center)
w_val = boost::lexical_cast<std::wstring>(*table_align_);
_tblPr << L"<w:jc w:val=\"" << w_val << "\" />";
_tblPr << L"<w:jc w:val=\"" << w_val << "\"/>";
}
_tblPr << "<w:tblLayout w:type=\"fixed\" />";
if (!style_use_optimal_column_width_)
{
_tblPr << "<w:tblLayout w:type=\"fixed\"/>";
}
if (common_background_color_attlist_.fo_background_color_)
{
const std::wstring w_fill = (common_background_color_attlist_.fo_background_color_->get_type() == background_color::Enabled
? common_background_color_attlist_.fo_background_color_->get_color().get_hex_value() : L"auto");
_tblPr << L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" << w_fill << "\" />";
_tblPr << L"<w:shd w:val=\"clear\" w:color=\"auto\" w:fill=\"" << w_fill << "\"/>";
}
}
......
......@@ -79,7 +79,6 @@ public:
_CP_OPT(odf_types::length) style_width_;
_CP_OPT(odf_types::percent) style_rel_width_;
office_element_ptr style_background_image_;
_CP_OPT(bool) style_may_break_between_rows_;
_CP_OPT(odf_types::border_model) table_border_model_;
......@@ -87,6 +86,8 @@ public:
_CP_OPT(bool) table_display_;
_CP_OPT(odf_types::color) tableooo_tab_color_;
_CP_OPT(odf_types::Bool) style_use_optimal_column_width_; //not specification
office_element_ptr style_background_image_;
};
class style_table_properties : public office_element_impl<style_table_properties>
......
......@@ -337,23 +337,6 @@ void table_columns_and_groups::add_child_element( xml::sax * Reader, const std::
}
else
not_applicable_element(L"table-columns-and-groups", Reader, Ns, Name);
/*
if (CP_CHECK_NAME(L"table", L"table-column-group") && type_ != 1)
{
type_ = 0;
CP_CREATE_ELEMENT_SIMPLE(table_table_column_group_);
}
else if (( CP_CHECK_NAME(L"table", L"table-columns") ||
CP_CHECK_NAME(L"table", L"table-column") ||
CP_CHECK_NAME(L"table", L"table-header-columns") )
&& type_ != 0)
{
type_ = 1;
table_columns_no_group_.add_child_element(Reader, Ns, Name, Context);
}
else
not_applicable_element(L"table-columns-and-groups", Reader, Ns, Name);
*/
}
//////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -164,7 +164,6 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
if (inst && inst->content())
inst->content()->docx_convert(Context);
Context.get_styles_context().docx_serialize_table_style(_Wostream, Context.get_text_tracked_context().dumpTblPr_);
_Wostream << L"<w:tblGrid>";
......
......@@ -335,7 +335,7 @@ void odf_chart_context::start_chart(office_element_ptr & root)
root->add_child_element(chart_elm);
//////////
impl_->styles_context_->create_style(L"",style_family::Chart, true, false, -1);
impl_->styles_context_->create_style(L"", style_family::Chart, true, false, -1);
office_element_ptr & style_elm = impl_->styles_context_->last_state()->get_office_element();
......@@ -916,18 +916,19 @@ void odf_chart_context::start_text()
style *style_ = dynamic_cast<style*>(impl_->current_chart_state_.elements_.back().style_elm.get());
if (style_)
{
impl_->current_level_.back().paragraph_properties_ = style_->content_.get_style_paragraph_properties();
impl_->current_level_.back().text_properties_ = style_->content_.get_style_text_properties();
impl_->current_level_.back().paragraph_properties_ = style_->content_.get_style_paragraph_properties();
impl_->current_level_.back().text_properties_ = style_->content_.get_style_text_properties();
}
impl_->odf_context_->text_context()->set_single_object(true,impl_->current_level_.back().paragraph_properties_,impl_->current_level_.back().text_properties_);
impl_->odf_context_->text_context()->set_single_object(true, impl_->current_level_.back().paragraph_properties_, impl_->current_level_.back().text_properties_);
}
void odf_chart_context::end_text()
{
odf_text_context * text_context_ = text_context();
odf_text_context *text_context_ = text_context();
if (text_context_ == NULL || impl_->current_level_.size() <1 )return;
for (size_t i=0; i< text_context_->text_elements_list_.size(); i++)
for (size_t i = 0; i < text_context_->text_elements_list_.size(); i++)
{
if (text_context_->text_elements_list_[i].level ==0)
{
......@@ -945,6 +946,45 @@ void odf_chart_context::end_text()
impl_->odf_context_->end_text_context();
}
void odf_chart_context::set_textarea_vertical_align(int align)
{
if (!impl_->current_level_.back().chart_properties_)return;
//switch(align)
//{
//case 0://SimpleTypes::textanchoringtypeB:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Bottom); break;
//case 1://SimpleTypes::textanchoringtypeCtr:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Middle); break;
//case 2://SimpleTypes::textanchoringtypeDist:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Baseline);break;
//case 3://SimpleTypes::textanchoringtypeJust:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Justify); break;
//case 4://SimpleTypes::textanchoringtypeT:
// impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Top); break;
//}
}
void odf_chart_context::set_textarea_rotation(double val)
{
if (!impl_->current_level_.back().chart_properties_)return;
if (val < 0.001 && val > -0.001) return;
if (val < -360 || val > 360) return;
if (val < 0) val += 360;
val = 360 - val;
impl_->current_level_.back().chart_properties_->content_.common_rotation_angle_attlist_.style_rotation_angle_ = (unsigned int)val;
}
void odf_chart_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in pt
{
if (!impl_->current_level_.back().chart_properties_)return;
//if (left) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_left_ = length(*left, length::pt);
//if (top) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_top_ = length(*top, length::pt);
//if (right) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_right_ = length(*right,length::pt);
//if (bottom) impl_->current_graphic_properties->common_padding_attlist_.fo_padding_bottom_ = length(*bottom,length::pt);
}
void odf_chart_context::start_floor()
{
office_element_ptr elm;
......
......@@ -137,6 +137,10 @@ public:
void start_text();
void end_text();
void set_textarea_vertical_align(int align);
void set_textarea_padding (_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom);//in pt
void set_textarea_rotation (double val);
void add_domain(std::wstring formula);
void add_categories(std::wstring formula, office_element_ptr & axis);
......
......@@ -177,7 +177,7 @@ void odf_conversion_context::start_chart()
create_object();
create_element(L"office", L"chart", objects_.back().content, this, true);
chart_context_.set_styles_context(styles_context());
chart_context_.set_styles_context(odf_conversion_context::styles_context());
chart_context_.start_chart(get_current_object_element());
}
void odf_conversion_context::start_spreadsheet()
......
......@@ -2101,6 +2101,36 @@ void odf_drawing_context::set_line_dash_preset(int style)
impl_->current_graphic_properties->draw_stroke_=line_style(line_style::Solid); break;
}
}
void odf_drawing_context::set_paragraph_properties(style_paragraph_properties *paragraph_properties)
{
if (impl_->current_drawing_state_.elements_.empty()) return;
if (!impl_->current_paragraph_properties)
{
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (draw)
{
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
{
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
style* style_ = dynamic_cast<style*>(style_shape_elm.get());
if (style_)
{
impl_->current_paragraph_properties = style_->content_.get_style_paragraph_properties();
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_ = style_->style_name_;
}
}
else
{
//??? find by name
}
}
}
if (impl_->current_paragraph_properties)
impl_->current_paragraph_properties ->apply_from(paragraph_properties);
}
void odf_drawing_context::set_textarea_vertical_align(int align)
{
......@@ -2136,6 +2166,18 @@ void odf_drawing_context::set_textarea_fit_to_size(bool val)
impl_->current_graphic_properties->draw_fit_to_size_ = val;
}
void odf_drawing_context::set_textarea_rotation(double val)
{
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{
impl_->current_text_properties = style_state->get_text_properties();
}
if (!impl_->current_text_properties) return;
impl_->current_text_properties->content_.style_text_rotation_angle_ = (int)val;
}
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
{
......@@ -2249,36 +2291,6 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
}
}
}
void odf_drawing_context::set_paragraph_properties(style_paragraph_properties *paragraph_properties)
{
if (impl_->current_drawing_state_.elements_.empty()) return;
if (!impl_->current_paragraph_properties)
{
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (draw)
{
if(!draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_)
{
impl_->styles_context_->create_style(L"", style_family::Paragraph, true, false, -1);
office_element_ptr & style_shape_elm = impl_->styles_context_->last_state()->get_office_element();
style* style_ = dynamic_cast<style*>(style_shape_elm.get());
if (style_)
{
impl_->current_paragraph_properties = style_->content_.get_style_paragraph_properties();
draw->common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_text_style_name_ = style_->style_name_;
}
}
else
{
//??? find by name
}
}
}
if (impl_->current_paragraph_properties)
impl_->current_paragraph_properties ->apply_from(paragraph_properties);
}
void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in pt
{
if (!impl_->current_graphic_properties)return;
......
......@@ -231,6 +231,7 @@ public:
void set_textarea_fontcolor (std::wstring hexColor);
void set_textarea_font (std::wstring & latin, std::wstring & cs, std::wstring & ea);
void set_textarea_fit_to_size (bool val);
void set_textarea_rotation (double val);
void set_placeholder_id (std::wstring val);
void set_placeholder_type (int val);
......
......@@ -54,10 +54,10 @@ namespace cpdoccore {
namespace odf_writer
{
odf_text_context::odf_text_context(odf_conversion_context *odf_context)
odf_text_context::odf_text_context(odf_conversion_context *odf_context, odf_style_context *styles_context)
{
odf_context_ = odf_context;
styles_context_ = odf_context->styles_context();
styles_context_ = styles_context;
single_paragraph_ = false;
paragraph_properties_ = NULL;
......
......@@ -53,7 +53,7 @@ class style_text_properties;
class odf_text_context: boost::noncopyable
{
public:
odf_text_context (odf_conversion_context *odf_context);
odf_text_context (odf_conversion_context *odf_context, odf_style_context *styles_context);
~odf_text_context ();
public:
odf_style_context* get_styles_context();//для embedded
......
......@@ -132,8 +132,7 @@ void odp_conversion_context::end_layout_slide()
}
void odp_conversion_context::start_text_context()
{
text_context_ = new odf_text_context(this);
text_context_->set_styles_context(slide_context_.get_styles_context());
text_context_ = new odf_text_context(this, slide_context_.get_styles_context());
}
void odp_conversion_context::end_text_context()
{
......
......@@ -472,8 +472,7 @@ void ods_conversion_context::add_column(int start_column, int repeated, int leve
}
void ods_conversion_context::start_text_context()
{
current_text_context_ = new odf_text_context(this);
current_text_context_ = new odf_text_context(this, styles_context());
}
void ods_conversion_context::end_text_context()
{
......
......@@ -105,7 +105,8 @@ void odt_conversion_context::start_document()
root_document_ = get_current_object_element();
root_text_ = dynamic_cast<office_text*>(root_document_.get());
main_text_context_ = new odf_text_context(this);
main_text_context_ = new odf_text_context(this, styles_context());
page_layout_context()->set_styles_context(styles_context());
......@@ -182,7 +183,7 @@ odf_text_context* odt_conversion_context::text_context()
}
void odt_conversion_context::start_text_context()
{
odf_text_context_ptr new_text_context_ = boost::shared_ptr<odf_text_context>(new odf_text_context(this));
odf_text_context_ptr new_text_context_ = boost::shared_ptr<odf_text_context>(new odf_text_context(this, odf_conversion_context::styles_context()));
if (!new_text_context_)return;
text_context_.push_back(new_text_context_);
......
......@@ -106,15 +106,15 @@ public:
_CP_OPT(double) chart_error_margin_;
_CP_OPT(double) chart_error_upper_limit_;
_CP_OPT(odf_types::chart_interpolation) chart_interpolation_;
_CP_OPT(odf_types::chart_interpolation) chart_interpolation_;
_CP_OPT(odf_types::chart_solid_type) chart_solid_type_;
_CP_OPT(odf_types::chart_label_arrangement) chart_label_arrangement_;
_CP_OPT(odf_types::chart_label_arrangement) chart_label_arrangement_;
_CP_OPT(odf_types::direction) style_direction_;
_CP_OPT(odf_types::chart_series_source) chart_series_source_;
_CP_OPT(odf_types::chart_series_source) chart_series_source_;
_CP_OPT(odf_types::length) chart_symbol_width_;
_CP_OPT(odf_types::length) chart_symbol_height_;
_CP_OPT(odf_types::chart_regression_type) chart_regression_type_;
_CP_OPT(odf_types::chart_data_label_number) chart_data_label_number_;
_CP_OPT(odf_types::chart_data_label_number) chart_data_label_number_;
_CP_OPT(odf_types::chart_error_category) chart_error_category_;
_CP_OPT(std::wstring) chart_axis_label_position_;
......
......@@ -83,8 +83,13 @@ void table_format_properties::serialize(std::wostream & _Wostream,const wchar_t
common_keep_with_next_attlist_.serialize(CP_GET_XML_NODE());
common_border_attlist_.serialize(CP_GET_XML_NODE());
if (style_background_image_) style_background_image_->serialize(_Wostream);
CP_XML_ATTR_OPT(L"table:align", table_align_);
//not from specification !!
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
//not from specification !!
if (style_background_image_) style_background_image_->serialize(_Wostream);
}
}
}
......@@ -109,7 +114,8 @@ void table_format_properties::apply_from(const table_format_properties & Other)
common_keep_with_next_attlist_.apply_from(Other.common_keep_with_next_attlist_);
common_border_attlist_.apply_from(Other.common_border_attlist_);
style_background_image_ = Other.style_background_image_;
style_background_image_ = Other.style_background_image_;
style_use_optimal_column_width_ = Other.style_use_optimal_column_width_;
}
// style:table-properties
......@@ -145,9 +151,10 @@ void style_table_column_properties_attlist::serialize(std::wostream & _Wostream,
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"style:column-width", style_column_width_);
CP_XML_ATTR_OPT(L"style:rel-column-width", style_rel_column_width_);
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
CP_XML_ATTR_OPT(L"style:column-width", style_column_width_);
CP_XML_ATTR_OPT(L"style:rel-column-width", style_rel_column_width_);
CP_XML_ATTR_OPT(L"style:use-optimal-column-width", style_use_optimal_column_width_);
common_break_attlist_.serialize(CP_GET_XML_NODE());
}
}
......
......@@ -84,8 +84,8 @@ public:
odf_types::common_border_attlist common_border_attlist_;
office_element_ptr style_background_image_;
office_element_ptr style_background_image_;
_CP_OPT(odf_types::Bool) style_use_optimal_column_width_;
};
......
......@@ -1165,6 +1165,10 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
//+ style section
//+element text:section в котором параграфы
}
if (oox_bodyPr->rot.IsInit())
{
odf_context()->drawing_context()->set_textarea_rotation(oox_bodyPr->rot.get() / 60000);
}
switch(oox_bodyPr->Fit.type)
{
......@@ -1505,7 +1509,7 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
}
//свойства могут быть приписаны не только к параграфу, но и к самому объекту
odf_writer::style_paragraph_properties* paragraph_properties = odf_context()->text_context()->get_paragraph_properties();
odf_writer::style_text_properties* text_properties = NULL;
odf_writer::style_text_properties* text_properties = odf_context()->text_context()->get_text_properties();
if (!paragraph_properties)
{
......
......@@ -395,7 +395,6 @@ public:
void convert(PPTX::Logic::StyleRef *oox_styleRef, int type);
void convert(PPTX::Logic::Path2D *oox_path2D);
void convert(PPTX::Logic::PathBase *oox_path);
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
void convert(PPTX::Logic::UniFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::UniColor *color, DWORD & nARGB);
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0);
......@@ -420,7 +419,12 @@ public:
void convert(PPTX::Logic::Run *oox_run);
void convert(PPTX::Logic::Fld *oox_fld);
void convert(PPTX::Logic::Br *oox_br);
void convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeStyle* oox_style = NULL);
void convert_chart_text(PPTX::Logic::TxBody *oox_txBody);
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
void convert_chart_text(PPTX::Logic::BodyPr *oox_bodyPr);
void convert(PPTX::Logic::MathParaWrapper *oox_math);
void convert(PPTX::Logic::NvGraphicFramePr *oox_framePr);
void convert(PPTX::Logic::ChartRec *oox_chart);
......
......@@ -49,6 +49,61 @@
namespace Oox2Odf
{
void OoxConverter::convert_chart_text(PPTX::Logic::TxBody *oox_txBody)
{
if (!oox_txBody) return;
if (oox_txBody->Paragrs.empty()) return;
odf_context()->chart_context()->start_text();
convert(oox_txBody->lstStyle.GetPointer());
for (size_t i = 0; i < oox_txBody->Paragrs.size(); i++)
{
convert(&oox_txBody->Paragrs[i], oox_txBody->lstStyle.GetPointer());
//внешние настройки для текста
convert_chart_text(oox_txBody->bodyPr.GetPointer());
}
odf_context()->chart_context()->end_text();
}
void OoxConverter::convert_chart_text(PPTX::Logic::BodyPr *oox_bodyPr)
{
if (!oox_bodyPr) return;
if (oox_bodyPr->vert.IsInit())
{
//odf_context()->chart_context()->set_textarea_writing_mode (oox_bodyPr->vert->GetBYTECode());
}
if (oox_bodyPr->anchor.IsInit())
{
//odf_context()->chart_context()->set_textarea_vertical_align (oox_bodyPr->anchor->GetBYTECode());
}
_CP_OPT(double) lIns, tIns, rIns, bIns;
if (oox_bodyPr->lIns.IsInit()) lIns = oox_bodyPr->lIns.get() / 12700.; //pt
if (oox_bodyPr->tIns.IsInit()) tIns = oox_bodyPr->tIns.get() / 12700.;
if (oox_bodyPr->rIns.IsInit()) rIns = oox_bodyPr->rIns.get() / 12700.;
if (oox_bodyPr->bIns.IsInit()) bIns = oox_bodyPr->bIns.get() / 12700.;
//odf_context()->chart_context()->set_textarea_padding (lIns, tIns, rIns, bIns);
//if (oox_bodyPr->wrap.IsInit())
// odf_context()->chart_context()->set_textarea_wrap(oox_bodyPr->wrap->GetBYTECode());
if ((oox_bodyPr->numCol.IsInit()) && (oox_bodyPr->numCol.get() > 1))
{
//+ style section
//+element text:section в котором параграфы
}
if (oox_bodyPr->rot.IsInit())
{
odf_context()->chart_context()->set_textarea_rotation(oox_bodyPr->rot.get() / 60000);
}
}
void OoxConverter::convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart)
{
if (!oox_chart)return;
......@@ -56,7 +111,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart)
convert(oox_chart->m_externalData);
convert(oox_chart->m_oSpPr.GetPointer());
convert(oox_chart->m_oTxPr.GetPointer());
convert_chart_text(oox_chart->m_oTxPr.GetPointer());
convert(oox_chart->m_chart->m_title);
convert(oox_chart->m_chart->m_legend);
......@@ -103,7 +158,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Tx* ct_tx)
{
if (ct_tx == NULL)return;
convert(ct_tx->m_oRich.GetPointer());
convert_chart_text(ct_tx->m_oRich.GetPointer());
}
void OoxConverter::convert(OOX::Spreadsheet::CT_Layout* ct_layout)
{
......@@ -130,7 +185,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Title* ct_title)
odf_context()->chart_context()->start_title();
convert(ct_title->m_oSpPr.GetPointer());
convert(ct_title->m_layout);
convert(ct_title->m_oTxPr.GetPointer());
convert_chart_text(ct_title->m_oTxPr.GetPointer());
///////////////////////////////
convert(ct_title->m_tx);
odf_context()->chart_context()->end_element();
......@@ -145,7 +200,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_Legend* ct_legend)
if ((ct_legend->m_legendPos) && (ct_legend->m_legendPos->m_val))
odf_context()->chart_context()->set_legend_position(*ct_legend->m_legendPos->m_val);
convert(ct_legend->m_oTxPr.GetPointer());
convert_chart_text(ct_legend->m_oTxPr.GetPointer());
if (ct_legend->m_legendEntry.size() > 0)
{
convert(ct_legend->m_legendEntry[0]); // в odf_writer нет в легенде множественности стилей
......@@ -157,7 +212,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_LegendEntry* ct_legend)
{
if (ct_legend == NULL)return;
convert(ct_legend->m_oTxPr.GetPointer());
convert_chart_text(ct_legend->m_oTxPr.GetPointer());
}
void OoxConverter::convert(OOX::Spreadsheet::CT_PlotArea* ct_plotArea)
{
......@@ -222,7 +277,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_CatAx* axis)
odf_context()->chart_context()->set_axis_dimension(1);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
......@@ -249,7 +306,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_CatAx* axis)
odf_context()->chart_context()->set_axis_label_position(*axis->m_tickLblPos->m_val);
///////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
......@@ -263,7 +320,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_DateAx* axis)
odf_context()->chart_context()->set_axis_dimension(1);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
......@@ -288,7 +347,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_DateAx* axis)
if (axis->m_axPos && axis->m_axPos->m_val)
odf_context()->chart_context()->set_axis_position(*axis->m_axPos->m_val);
//////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
......@@ -302,7 +361,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerAx* axis)
odf_context()->chart_context()->set_axis_dimension(1);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
......@@ -327,7 +388,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_SerAx* axis)
if (axis->m_axPos && axis->m_axPos->m_val)
odf_context()->chart_context()->set_axis_position(*axis->m_axPos->m_val);
///////////////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
......@@ -341,7 +402,9 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ValAx* axis)
odf_context()->chart_context()->set_axis_dimension(2);
if (axis->m_axId && axis->m_axId->m_val)
odf_context()->chart_context()->set_axis_id(*axis->m_axId->m_val);
convert(axis->m_oSpPr.GetPointer());
if (axis->m_scaling)
{
if (axis->m_scaling->m_logBase)
......@@ -365,7 +428,7 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_ValAx* axis)
if (axis->m_axPos && axis->m_axPos->m_val)
odf_context()->chart_context()->set_axis_position(*axis->m_axPos->m_val);
/////////////////////////////
convert(axis->m_oTxPr.GetPointer());
convert_chart_text(axis->m_oTxPr.GetPointer());
convert(axis->m_title);
convert(axis->m_majorGridlines, 1);
convert(axis->m_minorGridlines, 2);
......
......@@ -3942,6 +3942,7 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer
{
//динамическое расширение - автоподбор по содержимому.
odt_context->table_context()->set_optimal_column_width(true);
table_properties->table_format_properties_.style_use_optimal_column_width_ = true;
}
}
}
......
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