Commit 17e46a2c authored by Alexey.Musinov's avatar Alexey.Musinov

Merge branch 'develop' of https://github.com/ONLYOFFICE/core into develop

* 'develop' of https://github.com/ONLYOFFICE/core:
  OdfFormatWriter - presentation tables styled
  OdfFormatWriter - presentation tables
parents c5ffcd4b 38813fd1
......@@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_EXCEPTION_DISABLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......
......@@ -105,7 +105,7 @@ SOURCES += \
../source/OdfFormat/odp_page_state.cpp \
../source/OdfFormat/odp_slide_context.cpp \
../source/OdfFormat/office_presentation.cpp \
../source/OdfFormat/style_presentation.cpp \
../source/OdfFormat/style_presentation.cpp
}
SOURCES += \
......@@ -115,9 +115,7 @@ SOURCES += \
../source/Oox2OdfConverter/DocxConverter.cpp \
../source/Oox2OdfConverter/XlsxConverter.cpp \
../source/Oox2OdfConverter/ConvertDrawing.cpp \
../source/Oox2OdfConverter/PptxConverter.cpp \
../source/OdfFormat/anim_elements.cpp \
../source/OdfFormat/style_presentation.cpp
../source/Oox2OdfConverter/PptxConverter.cpp
HEADERS += \
../source/OdfFormat/abstract_xml.h \
......
......@@ -109,7 +109,7 @@ namespace odf_writer
struct odf_chart_level_state
{
style_text_properties *text_properties_;
style_graphic_properties *graphic_properties_;
graphic_format_properties *graphic_properties_;
style_paragraph_properties *paragraph_properties_;
style_chart_properties *chart_properties_;
......@@ -297,8 +297,8 @@ void odf_chart_context::Impl::set_default_series_color()
color col = color(default_MS_series_colors[current_series_count_]);
current_level_.back().graphic_properties_->content_.common_draw_fill_attlist_.draw_fill_color_ = col;
current_level_.back().graphic_properties_->content_.svg_stroke_color_ = col;
current_level_.back().graphic_properties_->common_draw_fill_attlist_.draw_fill_color_ = col;
current_level_.back().graphic_properties_->svg_stroke_color_ = col;
}
////////////////////////////////////////////////////////////////////////////
......@@ -641,7 +641,7 @@ void odf_chart_context::start_series(std::wstring type)
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
......@@ -968,7 +968,7 @@ void odf_chart_context::start_floor()
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
}
}
void odf_chart_context::start_wall()
......@@ -993,9 +993,9 @@ void odf_chart_context::start_wall()
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
if (impl_->current_level_.back().graphic_properties_)
impl_->current_level_.back().graphic_properties_->content_.common_draw_fill_attlist_.draw_fill_color_ = color(L"#ffffff");
impl_->current_level_.back().graphic_properties_->common_draw_fill_attlist_.draw_fill_color_ = color(L"#ffffff");
}
}
void odf_chart_context::start_legend()
......@@ -1036,7 +1036,7 @@ void odf_chart_context::start_stock_range_line()
style_name = style_->style_name_;
line->common_attlist_.chart_style_name_ = style_name;
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
start_element(elm, style_elm, style_name);
......@@ -1059,7 +1059,7 @@ void odf_chart_context::start_stock_gain_marker()
style_name = style_->style_name_;
marker->common_attlist_.chart_style_name_ = style_name;
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
start_element(elm, style_elm, style_name);
......@@ -1082,7 +1082,7 @@ void odf_chart_context::start_stock_loss_marker()
style_name = style_->style_name_;
marker->common_attlist_.chart_style_name_ = style_name;
impl_->current_level_.back().graphic_properties_ = style_->content_.get_style_graphic_properties();
impl_->current_level_.back().graphic_properties_ = style_->content_.get_graphic_properties();
impl_->set_default_series_color();
}
start_element(elm, style_elm, style_name);
......@@ -1219,7 +1219,7 @@ void odf_chart_context::set_no_fill(bool Val)
if (Val == false)return;
if (!impl_->current_level_.back().graphic_properties_)return;
impl_->current_level_.back().graphic_properties_->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::none);
impl_->current_level_.back().graphic_properties_->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::none);
}
void odf_chart_context::set_axis_tick_major(int type)
......
......@@ -264,7 +264,7 @@ public:
void create_draw_base(int type);
office_element_ptr create_draw_element(int type);
style_graphic_properties *current_graphic_properties;
graphic_format_properties *current_graphic_properties;
style_paragraph_properties *current_paragraph_properties;
style_text_properties *current_text_properties;
......@@ -325,7 +325,7 @@ void odf_drawing_context::set_background_state(bool Val)
{
impl_->is_background_ = Val;
impl_->current_graphic_properties = new style_graphic_properties();
impl_->current_graphic_properties = new graphic_format_properties();
}
void odf_drawing_context::check_anchor()
......@@ -385,24 +385,24 @@ void odf_drawing_context::start_group()
if (style_)
{
style_name = style_->style_name_;
impl_->current_graphic_properties = style_->content_.get_style_graphic_properties();
impl_->current_graphic_properties = style_->content_.get_graphic_properties();
}
group->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_style_name_attlist_.draw_style_name_ = style_ref(style_name);
impl_->current_graphic_properties->content_.style_wrap_ = impl_->anchor_settings_.style_wrap_;
impl_->current_graphic_properties->content_.style_run_through_ = impl_->anchor_settings_.run_through_;
impl_->current_graphic_properties->style_wrap_ = impl_->anchor_settings_.style_wrap_;
impl_->current_graphic_properties->style_run_through_ = impl_->anchor_settings_.run_through_;
impl_->current_graphic_properties->content_.common_vertical_pos_attlist_.style_vertical_pos_ = impl_->anchor_settings_.style_vertical_pos_;
impl_->current_graphic_properties->content_.common_horizontal_pos_attlist_.style_horizontal_pos_ = impl_->anchor_settings_.style_horizontal_pos_;
impl_->current_graphic_properties->common_vertical_pos_attlist_.style_vertical_pos_ = impl_->anchor_settings_.style_vertical_pos_;
impl_->current_graphic_properties->common_horizontal_pos_attlist_.style_horizontal_pos_ = impl_->anchor_settings_.style_horizontal_pos_;
impl_->current_graphic_properties->content_.common_vertical_rel_attlist_.style_vertical_rel_ = impl_->anchor_settings_.style_vertical_rel_;
impl_->current_graphic_properties->content_.common_horizontal_rel_attlist_.style_horizontal_rel_ = impl_->anchor_settings_.style_horizontal_rel_;
impl_->current_graphic_properties->common_vertical_rel_attlist_.style_vertical_rel_ = impl_->anchor_settings_.style_vertical_rel_;
impl_->current_graphic_properties->common_horizontal_rel_attlist_.style_horizontal_rel_ = impl_->anchor_settings_.style_horizontal_rel_;
impl_->current_graphic_properties->content_.common_horizontal_margin_attlist_.fo_margin_left_ = impl_->anchor_settings_.fo_margin_left_;
impl_->current_graphic_properties->content_.common_vertical_margin_attlist_.fo_margin_top_ = impl_->anchor_settings_.fo_margin_top_;
impl_->current_graphic_properties->content_.common_horizontal_margin_attlist_.fo_margin_right_ = impl_->anchor_settings_.fo_margin_right_;
impl_->current_graphic_properties->content_.common_vertical_margin_attlist_.fo_margin_bottom_ = impl_->anchor_settings_.fo_margin_bottom_;
impl_->current_graphic_properties->common_horizontal_margin_attlist_.fo_margin_left_ = impl_->anchor_settings_.fo_margin_left_;
impl_->current_graphic_properties->common_vertical_margin_attlist_.fo_margin_top_ = impl_->anchor_settings_.fo_margin_top_;
impl_->current_graphic_properties->common_horizontal_margin_attlist_.fo_margin_right_ = impl_->anchor_settings_.fo_margin_right_;
impl_->current_graphic_properties->common_vertical_margin_attlist_.fo_margin_bottom_ = impl_->anchor_settings_.fo_margin_bottom_;
if (group)
{
......@@ -467,7 +467,7 @@ void odf_drawing_context::end_drawing_background(odf_types::common_draw_fill_att
if (!impl_->is_background_ || !impl_->current_graphic_properties) return;
common_draw_attlist.apply_from(impl_->current_graphic_properties->content_.common_draw_fill_attlist_);
common_draw_attlist.apply_from(impl_->current_graphic_properties->common_draw_fill_attlist_);
delete impl_->current_graphic_properties;
......@@ -573,22 +573,22 @@ void odf_drawing_context::end_drawing()
}
impl_->current_graphic_properties->content_.common_vertical_pos_attlist_.style_vertical_pos_ = impl_->anchor_settings_.style_vertical_pos_;
impl_->current_graphic_properties->content_.common_horizontal_pos_attlist_.style_horizontal_pos_ = impl_->anchor_settings_.style_horizontal_pos_;
impl_->current_graphic_properties->common_vertical_pos_attlist_.style_vertical_pos_ = impl_->anchor_settings_.style_vertical_pos_;
impl_->current_graphic_properties->common_horizontal_pos_attlist_.style_horizontal_pos_ = impl_->anchor_settings_.style_horizontal_pos_;
impl_->current_graphic_properties->content_.common_vertical_rel_attlist_.style_vertical_rel_ = impl_->anchor_settings_.style_vertical_rel_;
impl_->current_graphic_properties->content_.common_horizontal_rel_attlist_.style_horizontal_rel_ = impl_->anchor_settings_.style_horizontal_rel_;
impl_->current_graphic_properties->common_vertical_rel_attlist_.style_vertical_rel_ = impl_->anchor_settings_.style_vertical_rel_;
impl_->current_graphic_properties->common_horizontal_rel_attlist_.style_horizontal_rel_ = impl_->anchor_settings_.style_horizontal_rel_;
impl_->current_graphic_properties->content_.common_horizontal_margin_attlist_.fo_margin_left_ = impl_->anchor_settings_.fo_margin_left_;
impl_->current_graphic_properties->content_.common_vertical_margin_attlist_.fo_margin_top_ = impl_->anchor_settings_.fo_margin_top_;
impl_->current_graphic_properties->content_.common_horizontal_margin_attlist_.fo_margin_right_ = impl_->anchor_settings_.fo_margin_right_;
impl_->current_graphic_properties->content_.common_vertical_margin_attlist_.fo_margin_bottom_ = impl_->anchor_settings_.fo_margin_bottom_;
impl_->current_graphic_properties->common_horizontal_margin_attlist_.fo_margin_left_ = impl_->anchor_settings_.fo_margin_left_;
impl_->current_graphic_properties->common_vertical_margin_attlist_.fo_margin_top_ = impl_->anchor_settings_.fo_margin_top_;
impl_->current_graphic_properties->common_horizontal_margin_attlist_.fo_margin_right_ = impl_->anchor_settings_.fo_margin_right_;
impl_->current_graphic_properties->common_vertical_margin_attlist_.fo_margin_bottom_ = impl_->anchor_settings_.fo_margin_bottom_;
if (draw && !impl_->current_drawing_state_.in_group)
draw->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_text_spreadsheet_shape_attlist_.common_text_anchor_attlist_.type_ = impl_->anchor_settings_.anchor_type_;
impl_->current_graphic_properties->content_.style_wrap_ = impl_->anchor_settings_.style_wrap_;
impl_->current_graphic_properties->content_.style_run_through_ = impl_->anchor_settings_.run_through_;
impl_->current_graphic_properties->style_wrap_ = impl_->anchor_settings_.style_wrap_;
impl_->current_graphic_properties->style_run_through_ = impl_->anchor_settings_.run_through_;
//if (impl_->anchor_settings_.anchor_type_ && impl_->anchor_settings_.anchor_type_->get_type()== anchor_type::AsChar)
//{
......@@ -673,7 +673,7 @@ void odf_drawing_context::Impl::create_draw_base(int type)
if (style_)
{
style_name = style_->style_name_;
current_graphic_properties = style_->content_.get_style_graphic_properties();
current_graphic_properties = style_->content_.get_graphic_properties();
}
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(style_name);
......@@ -725,7 +725,7 @@ void odf_drawing_context::start_shape(int type)
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 false;
return true;
if (impl_->current_drawing_state_.text_box_tableframe) return false;
if (impl_->current_drawing_state_.elements_.empty()) return false;
......@@ -961,18 +961,18 @@ void odf_drawing_context::corrected_line_fill()
{
if (!impl_->current_graphic_properties)return;
if ( !impl_->current_graphic_properties->content_.draw_stroke_ &&
!impl_->current_graphic_properties->content_.svg_stroke_color_ &&
!impl_->current_graphic_properties->content_.draw_stroke_dash_ &&
!impl_->current_graphic_properties->content_.svg_stroke_width_ &&
!impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ &&
!impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_color_ &&
!impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_name_ &&
!impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_hatch_name_ &&
!impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_gradient_name_)
if ( !impl_->current_graphic_properties->draw_stroke_ &&
!impl_->current_graphic_properties->svg_stroke_color_ &&
!impl_->current_graphic_properties->draw_stroke_dash_ &&
!impl_->current_graphic_properties->svg_stroke_width_ &&
!impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ &&
!impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ &&
!impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_name_ &&
!impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_hatch_name_ &&
!impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_gradient_name_)
{
impl_->current_graphic_properties->content_.svg_stroke_width_ = length(length(1. ,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill::none;;
impl_->current_graphic_properties->svg_stroke_width_ = length(length(1. ,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill::none;;
}
}
void odf_drawing_context::start_frame()
......@@ -985,7 +985,7 @@ void odf_drawing_context::start_frame()
{
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
}
impl_->current_graphic_properties->content_.common_background_color_attlist_.fo_background_color_ = odf_types::background_color(odf_types::background_color::Transparent);
impl_->current_graphic_properties->common_background_color_attlist_.fo_background_color_ = odf_types::background_color(odf_types::background_color::Transparent);
}
}
......@@ -1017,7 +1017,7 @@ void odf_drawing_context::start_element(office_element_ptr elm, office_element_p
if (style_)
{
style_name = style_->style_name_;
impl_->current_graphic_properties = style_->content_.get_style_graphic_properties();
impl_->current_graphic_properties = style_->content_.get_graphic_properties();
if (impl_->current_drawing_state_.name_.empty())
{
......@@ -1080,10 +1080,10 @@ void odf_drawing_context::set_opacity(double percent_)
switch(impl_->current_drawing_part_)
{
case Area:
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_opacity_ = percent(percent_);
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_opacity_ = percent(percent_);
break;
case Line:
impl_->current_graphic_properties->content_.svg_stroke_opacity_ = percent(percent_);
impl_->current_graphic_properties->svg_stroke_opacity_ = percent(percent_);
break;
}
}
......@@ -1094,17 +1094,17 @@ void odf_drawing_context::set_shadow(int type, std::wstring hexColor, _CP_OPT(do
int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
impl_->current_graphic_properties->content_.draw_shadow_offset_x_ = length(length(dist_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_graphic_properties->draw_shadow_offset_x_ = length(length(dist_pt,length::pt).get_value_unit(length::cm),length::cm);
if (dist_pt_y > 0)
impl_->current_graphic_properties->content_.draw_shadow_offset_y_ = length(length(dist_pt_y,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_graphic_properties->draw_shadow_offset_y_ = length(length(dist_pt_y,length::pt).get_value_unit(length::cm),length::cm);
else
impl_->current_graphic_properties->content_.draw_shadow_offset_y_ = length(length(dist_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_graphic_properties->draw_shadow_offset_y_ = length(length(dist_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_graphic_properties->content_.draw_shadow_ = shadow_type1(shadow_type1::Visible);
if (opacity) impl_->current_graphic_properties->content_.draw_shadow_opacity_ = *opacity;
impl_->current_graphic_properties->draw_shadow_ = shadow_type1(shadow_type1::Visible);
if (opacity) impl_->current_graphic_properties->draw_shadow_opacity_ = *opacity;
impl_->current_graphic_properties->content_.draw_shadow_color_ = hexColor;
impl_->current_graphic_properties->draw_shadow_color_ = hexColor;
}
void odf_drawing_context::set_layer (std::wstring val)
{
......@@ -1125,16 +1125,16 @@ void odf_drawing_context::set_no_fill()
{
case Area:
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) &&
(impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_) &&
(impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
(impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_) &&
(impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
{
}
else
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill::none;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill::none;
break;
case Line:
//impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill::none;??????
impl_->current_graphic_properties->content_.draw_stroke_ = line_style (line_style::None);
//impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill::none;??????
impl_->current_graphic_properties->draw_stroke_ = line_style (line_style::None);
break;
}
}
......@@ -1142,7 +1142,7 @@ void odf_drawing_context::set_type_fill(int type)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ = (draw_fill::type)type;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = (draw_fill::type)type;
}
void odf_drawing_context::set_fill_color(unsigned int Color)
......@@ -1154,7 +1154,10 @@ _CP_OPT(unsigned int) odf_drawing_context::get_fill_color()
{
return impl_->current_drawing_state_.fill_color_;
}
_CP_OPT(odf_types::color) odf_drawing_context::get_line_color()
{
return impl_->current_graphic_properties->svg_stroke_color_ ;
}
void odf_drawing_context::set_solid_fill(std::wstring hexColor)
{
if (!impl_->current_graphic_properties)return;
......@@ -1165,24 +1168,24 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor)
switch(impl_->current_drawing_part_)
{
case Area:
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->content_.common_background_color_attlist_.fo_background_color_ = color(hexColor);
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->common_background_color_attlist_.fo_background_color_ = color(hexColor);
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) &&
(impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_) &&
(impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
(impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_) &&
(impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
{
}
else
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill::solid;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill::solid;
break;
case Line:
impl_->current_graphic_properties->content_.svg_stroke_color_ = hexColor;
if (!impl_->current_graphic_properties->content_.draw_stroke_)
impl_->current_graphic_properties->content_.draw_stroke_=line_style(line_style::Solid);//default
if (!impl_->current_graphic_properties->content_.svg_stroke_width_)
impl_->current_graphic_properties->content_.svg_stroke_width_ = length(length(1,length::pt).get_value_unit(length::cm),length::cm);//default
impl_->current_graphic_properties->svg_stroke_color_ = hexColor;
if (!impl_->current_graphic_properties->draw_stroke_)
impl_->current_graphic_properties->draw_stroke_ = line_style(line_style::Solid);//default
if (!impl_->current_graphic_properties->svg_stroke_width_)
impl_->current_graphic_properties->svg_stroke_width_ = length(length(1, length::pt).get_value_unit(length::cm), length::cm);//default
break;
}
}
......@@ -1249,10 +1252,10 @@ void odf_drawing_context::set_flip_H(bool bVal)
if (impl_->current_graphic_properties == NULL) return;
if (bVal == false)return;
//for image
if (impl_->current_graphic_properties->content_.style_mirror_)
impl_->current_graphic_properties->content_.style_mirror_ = *impl_->current_graphic_properties->content_.style_mirror_ + std::wstring(L" horizontal");
if (impl_->current_graphic_properties->style_mirror_)
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" horizontal");
else
impl_->current_graphic_properties->content_.style_mirror_ = std::wstring(L"horizontal");
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"horizontal");
}
void odf_drawing_context::set_flip_V(bool bVal)
{
......@@ -1261,10 +1264,10 @@ void odf_drawing_context::set_flip_V(bool bVal)
if (impl_->current_graphic_properties == NULL) return;
if (bVal == false)return;
//for image
if (impl_->current_graphic_properties->content_.style_mirror_)
impl_->current_graphic_properties->content_.style_mirror_ = *impl_->current_graphic_properties->content_.style_mirror_ + std::wstring(L" vertical");
if (impl_->current_graphic_properties->style_mirror_)
impl_->current_graphic_properties->style_mirror_ = *impl_->current_graphic_properties->style_mirror_ + std::wstring(L" vertical");
else
impl_->current_graphic_properties->content_.style_mirror_ = std::wstring(L"vertical");
impl_->current_graphic_properties->style_mirror_ = std::wstring(L"vertical");
}
void odf_drawing_context::set_rotate(double dVal)
......@@ -1654,7 +1657,7 @@ void odf_drawing_context::set_size( _CP_OPT(double) & width_pt, _CP_OPT(double)
{
width_pt = *width_pt * impl_->group_list_[i]->scale_cx;
}
impl_->current_drawing_state_.svg_width_ = length(length(*width_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_drawing_state_.svg_width_ = length(length(*width_pt,length::pt).get_value_unit(length::cm), length::cm);
}
if (height_pt)
{
......@@ -1662,53 +1665,53 @@ void odf_drawing_context::set_size( _CP_OPT(double) & width_pt, _CP_OPT(double)
{
height_pt = *height_pt * impl_->group_list_[i]->scale_cy;
}
impl_->current_drawing_state_.svg_height_= length(length(*height_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_drawing_state_.svg_height_= length(length(*height_pt,length::pt).get_value_unit(length::cm), length::cm);
}
}else
{
if (!impl_->current_drawing_state_.svg_width_ && width_pt)
impl_->current_drawing_state_.svg_width_ = length(length(*width_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_drawing_state_.svg_width_ = length(length(*width_pt,length::pt).get_value_unit(length::cm), length::cm);
if (!impl_->current_drawing_state_.svg_height_ && height_pt)
impl_->current_drawing_state_.svg_height_= length(length(*height_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_drawing_state_.svg_height_= length(length(*height_pt,length::pt).get_value_unit(length::cm), length::cm);
}
}
void odf_drawing_context::set_line_width(double pt)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content_.svg_stroke_width_ = length(length(pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_graphic_properties->svg_stroke_width_ = length(length(pt,length::pt).get_value_unit(length::cm), length::cm);
}
void odf_drawing_context::set_line_tail(int type, int len, int width)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content_.draw_marker_end_ = add_marker_style(type);
impl_->current_graphic_properties->draw_marker_end_ = add_marker_style(type);
switch(width)
{
case 0://lineendwidthLarge
impl_->current_graphic_properties->content_.draw_marker_end_width_ = length(0.4,length::cm); break;
impl_->current_graphic_properties->draw_marker_end_width_ = length(0.4, length::cm); break;
case 1://lineendwidthMedium
impl_->current_graphic_properties->content_.draw_marker_end_width_ = length(0.3,length::cm); break;
impl_->current_graphic_properties->draw_marker_end_width_ = length(0.3, length::cm); break;
case 2://lineendwidthSmall
impl_->current_graphic_properties->content_.draw_marker_end_width_ = length(0.2,length::cm); break;
impl_->current_graphic_properties->draw_marker_end_width_ = length(0.2, length::cm); break;
}
}
void odf_drawing_context::set_line_head(int type, int len, int width)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content_.draw_marker_start_ = add_marker_style(type);
impl_->current_graphic_properties->draw_marker_start_ = add_marker_style(type);
switch(width)
{
case 0://lineendwidthLarge
impl_->current_graphic_properties->content_.draw_marker_start_width_ = length(0.4,length::cm); break;
impl_->current_graphic_properties->draw_marker_start_width_ = length(0.4, length::cm); break;
case 1://lineendwidthMedium
impl_->current_graphic_properties->content_.draw_marker_start_width_ = length(0.3,length::cm); break;
impl_->current_graphic_properties->draw_marker_start_width_ = length(0.3, length::cm); break;
case 2://lineendwidthSmall
impl_->current_graphic_properties->content_.draw_marker_start_width_ = length(0.2,length::cm); break;
impl_->current_graphic_properties->draw_marker_start_width_ = length(0.2, length::cm); break;
}
}
......@@ -1778,28 +1781,28 @@ void odf_drawing_context::set_line_dash_preset(int style)
{
if (!impl_->current_graphic_properties)return;
if ((impl_->current_graphic_properties->content_.draw_stroke_) &&
(impl_->current_graphic_properties->content_.draw_stroke_->get_type() == line_style::None)) return;
if ((impl_->current_graphic_properties->draw_stroke_) &&
(impl_->current_graphic_properties->draw_stroke_->get_type() == line_style::None)) return;
switch(style) //+создать стиль, привзать имена
{
case 0://presetlinedashvalDash
case 7://presetlinedashvalSysDash
impl_->current_graphic_properties->content_.draw_stroke_=line_style(line_style::Dash); break;
impl_->current_graphic_properties->draw_stroke_=line_style(line_style::Dash); break;
case 1://presetlinedashvalDashDot
case 8://presetlinedashvalSysDashDot
impl_->current_graphic_properties->content_.draw_stroke_=line_style(line_style::DotDash); break;
impl_->current_graphic_properties->draw_stroke_=line_style(line_style::DotDash); break;
case 2://presetlinedashvalDot
case 10://presetlinedashvalSysDot
impl_->current_graphic_properties->content_.draw_stroke_=line_style(line_style::Dotted); break;
impl_->current_graphic_properties->draw_stroke_=line_style(line_style::Dotted); break;
case 3://presetlinedashvalLgDash
case 4://presetlinedashvalLgDashDot
impl_->current_graphic_properties->content_.draw_stroke_=line_style(line_style::LongDash); break;
impl_->current_graphic_properties->draw_stroke_=line_style(line_style::LongDash); break;
case 5://presetlinedashvalLgDashDotDot
case 9://presetlinedashvalSysDashDotDot
impl_->current_graphic_properties->content_.draw_stroke_=line_style(line_style::DotDotDash);break;
impl_->current_graphic_properties->draw_stroke_=line_style(line_style::DotDotDash);break;
case 6://presetlinedashvalSolid
impl_->current_graphic_properties->content_.draw_stroke_=line_style(line_style::Solid); break;
impl_->current_graphic_properties->draw_stroke_=line_style(line_style::Solid); break;
}
}
......@@ -1809,15 +1812,15 @@ void odf_drawing_context::set_textarea_vertical_align(int align)
switch(align)
{
case 0://SimpleTypes::textanchoringtypeB:
impl_->current_graphic_properties->content_.draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Bottom); break;
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->content_.draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Middle); break;
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->content_.draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Baseline);break;
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->content_.draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Justify); break;
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->content_.draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Top); break;
impl_->current_graphic_properties->draw_textarea_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Top); break;
}
}
void odf_drawing_context::set_textarea_wrap(bool Val)
......@@ -1825,9 +1828,9 @@ void odf_drawing_context::set_textarea_wrap(bool Val)
if (!impl_->current_graphic_properties)return;
if (Val)
impl_->current_graphic_properties->content_.fo_wrap_option_ = wrap_option(wrap_option::Wrap);
impl_->current_graphic_properties->fo_wrap_option_ = wrap_option(wrap_option::Wrap);
else
impl_->current_graphic_properties->content_.fo_wrap_option_ = wrap_option(wrap_option::NoWrap);
impl_->current_graphic_properties->fo_wrap_option_ = wrap_option(wrap_option::NoWrap);
}
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
......@@ -1931,14 +1934,18 @@ void odf_drawing_context::set_textarea_writing_mode(int mode)
}
void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(double) & top, _CP_OPT(double) & right, _CP_OPT(double) & bottom)//in cm
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;
if (left) impl_->current_graphic_properties->content_.common_padding_attlist_.fo_padding_left_ = length(*left, length::cm);
if (top) impl_->current_graphic_properties->content_.common_padding_attlist_.fo_padding_top_ = length(*top, length::cm);
if (right) impl_->current_graphic_properties->content_.common_padding_attlist_.fo_padding_right_ = length(*right,length::cm);
if (bottom) impl_->current_graphic_properties->content_.common_padding_attlist_.fo_padding_bottom_ = length(*bottom,length::cm);
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_drawing_context::set_textarea_rotate (double dVal)
{
if (!impl_->current_graphic_properties)return;
}
......@@ -2019,9 +2026,9 @@ void odf_drawing_context::start_text_box()
//if (impl_->is_footer_ ==false && impl_->is_header_ ==false)
// set_text_box_parent_style(L"Frame");
start_area_properties();
set_no_fill();
end_area_properties();
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill::none;
//impl_->current_graphic_properties->draw_stroke_ = line_style (line_style::None);
}
void odf_drawing_context::set_text_box_min_size(bool val)
......@@ -2104,45 +2111,45 @@ void odf_drawing_context::end_text_box()
end_element();
if (impl_->current_graphic_properties->content_.svg_stroke_width_ ||
(impl_->current_graphic_properties->content_.draw_stroke_ && impl_->current_graphic_properties->content_.draw_stroke_->get_type() != line_style::None))
if (impl_->current_graphic_properties->svg_stroke_width_ ||
(impl_->current_graphic_properties->draw_stroke_ && impl_->current_graphic_properties->draw_stroke_->get_type() != line_style::None))
{
std::wstringstream ss;
ss << impl_->current_graphic_properties->content_.svg_stroke_width_->get_length();
ss << impl_->current_graphic_properties->svg_stroke_width_->get_length();
if (impl_->current_graphic_properties->content_.draw_stroke_)
ss << L" " << *impl_->current_graphic_properties->content_.draw_stroke_;
if (impl_->current_graphic_properties->draw_stroke_)
ss << L" " << *impl_->current_graphic_properties->draw_stroke_;
else ss << L" solid";
if (impl_->current_graphic_properties->content_.svg_stroke_color_)
ss << L" " << *impl_->current_graphic_properties->content_.svg_stroke_color_;
if (impl_->current_graphic_properties->svg_stroke_color_)
ss << L" " << *impl_->current_graphic_properties->svg_stroke_color_;
else ss << L" #000000";
impl_->current_graphic_properties->content_.common_border_attlist_.fo_border_ = ss.str();
impl_->current_graphic_properties->common_border_attlist_.fo_border_ = ss.str();
}
if (impl_->current_graphic_properties->content_.draw_shadow_)
if (impl_->current_graphic_properties->draw_shadow_)
{
std::wstringstream shadow_style;
if (impl_->current_graphic_properties->content_.draw_shadow_color_)
shadow_style << *impl_->current_graphic_properties->content_.draw_shadow_color_;
if (impl_->current_graphic_properties->draw_shadow_color_)
shadow_style << *impl_->current_graphic_properties->draw_shadow_color_;
else shadow_style << L"#000000";
shadow_style << L" ";
shadow_style << *impl_->current_graphic_properties->content_.draw_shadow_offset_x_;
shadow_style << *impl_->current_graphic_properties->draw_shadow_offset_x_;
shadow_style << L" ";
shadow_style << *impl_->current_graphic_properties->content_.draw_shadow_offset_y_;
shadow_style << *impl_->current_graphic_properties->draw_shadow_offset_y_;
impl_->current_graphic_properties->content_.common_shadow_attlist_.style_shadow_ = shadow_style.str();
impl_->current_graphic_properties->common_shadow_attlist_.style_shadow_ = shadow_style.str();
impl_->current_graphic_properties->content_.draw_shadow_offset_x_ = boost::none;
impl_->current_graphic_properties->content_.draw_shadow_offset_y_ = boost::none;
impl_->current_graphic_properties->content_.draw_shadow_color_ = boost::none;
impl_->current_graphic_properties->content_.draw_shadow_ = boost::none;
impl_->current_graphic_properties->draw_shadow_offset_x_ = boost::none;
impl_->current_graphic_properties->draw_shadow_offset_y_ = boost::none;
impl_->current_graphic_properties->draw_shadow_color_ = boost::none;
impl_->current_graphic_properties->draw_shadow_ = boost::none;
if (!impl_->current_graphic_properties->content_.common_border_attlist_.fo_border_)
impl_->current_graphic_properties->content_.common_border_attlist_.fo_border_ = std::wstring(L"#000000 solid 0.06pt");
if (!impl_->current_graphic_properties->common_border_attlist_.fo_border_)
impl_->current_graphic_properties->common_border_attlist_.fo_border_ = std::wstring(L"#000000 solid 0.06pt");
}
end_frame();
......@@ -2188,9 +2195,9 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
if (impl_->current_graphic_properties)
{
//автоувеличение при добавлении текста
impl_->current_graphic_properties->content_.draw_auto_grow_height_ = false;
impl_->current_graphic_properties->content_.draw_auto_grow_width_ = false;
//impl_->current_graphic_properties->content_.draw_fit_to_size_ = false;//???
impl_->current_graphic_properties->draw_auto_grow_height_ = false;
impl_->current_graphic_properties->draw_auto_grow_width_ = false;
//impl_->current_graphic_properties->draw_fit_to_size_ = false;//???
}
......@@ -2202,22 +2209,22 @@ void odf_drawing_context::set_text(odf_text_context* text_context)
if (text_properties_)
{
color color_ = text_properties_->content_.fo_color_.get_value_or(color(L"#000000"));
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_color_ = color_;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = color_;
if (text_properties_->content_.style_text_outline_)
{
//line
impl_->current_graphic_properties->content_.svg_stroke_color_ = color_;
if (!impl_->current_graphic_properties->content_.draw_stroke_)
impl_->current_graphic_properties->content_.draw_stroke_ = line_style(line_style::Solid);
if (!impl_->current_graphic_properties->content_.svg_stroke_width_)
impl_->current_graphic_properties->content_.svg_stroke_width_ = length(1,length::pt);
impl_->current_graphic_properties->svg_stroke_color_ = color_;
if (!impl_->current_graphic_properties->draw_stroke_)
impl_->current_graphic_properties->draw_stroke_ = line_style(line_style::Solid);
if (!impl_->current_graphic_properties->svg_stroke_width_)
impl_->current_graphic_properties->svg_stroke_width_ = length(1,length::pt);
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::none);
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::none);
}
else
{
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::solid);
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::solid);
}
}
//text_context->text_elements_list_[0].style_elm.get()
......@@ -2246,12 +2253,12 @@ void odf_drawing_context::start_gradient_style()
gradient->draw_name_ = impl_->styles_context_->find_free_name(style_family::Gradient);
gradient->draw_display_name_ = std::wstring(L"User") + gradient->draw_name_.get() ;
gradient->draw_start_color_ = impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_color_;
gradient->draw_start_color_ = impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_;
if (gradient->draw_start_color_) gradient->draw_start_intensity_ = 100.;
gradient->draw_border_ = 0;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
}
......@@ -2332,7 +2339,7 @@ void odf_drawing_context::start_opacity_style()
opacity->draw_name_ = impl_->styles_context_->find_free_name(style_family::Opacity);
opacity->draw_display_name_ = std::wstring(L"User") + opacity->draw_name_.get() ;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_opacity_name_ = opacity->draw_name_;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_opacity_name_ = opacity->draw_name_;
}
void odf_drawing_context::set_opacity_start(double val)
{
......@@ -2389,15 +2396,15 @@ void odf_drawing_context::start_hatch_style()
hatch->draw_name_ = impl_->styles_context_->find_free_name(style_family::Hatch);
hatch->draw_display_name_ = std::wstring(L"User") + hatch->draw_name_.get() ;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_hatch_name_ = hatch->draw_name_;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::hatch);
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_hatch_name_ = hatch->draw_name_;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::hatch);
}
void odf_drawing_context::set_hatch_line_color(std::wstring hexColor)
{
if (!impl_->current_graphic_properties)return;
//impl_->current_graphic_properties->content_.svg_stroke_color_ = color(std::wstring(L"#") + hexColor);
//impl_->current_graphic_properties->content_.draw_stroke_=line_style(line_style::Solid);//default
//impl_->current_graphic_properties->svg_stroke_color_ = color(std::wstring(L"#") + hexColor);
//impl_->current_graphic_properties->draw_stroke_=line_style(line_style::Solid);//default
draw_hatch * hatch = dynamic_cast<draw_hatch *>(impl_->styles_context_->last_state()->get_office_element().get());
if (!hatch) return;
......@@ -2414,8 +2421,8 @@ void odf_drawing_context::set_hatch_area_color(std::wstring hexColor)
int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_hatch_solid_ = true;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_color_ = hexColor;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_hatch_solid_ = true;
}
void odf_drawing_context::set_hatch_type(int type)
{
......@@ -2720,8 +2727,8 @@ void odf_drawing_context::start_bitmap_style()
fill_image->xlink_attlist_.show_ = xlink_show::Embed;
fill_image->xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_name_ = fill_image->draw_name_;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::bitmap);
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_name_ = fill_image->draw_name_;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::bitmap);
set_image_style_repeat(0);
......@@ -2735,23 +2742,23 @@ void odf_drawing_context::set_bitmap_tile_align(int align)
switch (align)
{
case 0: // rectalignmentB = 0,
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::bottom);break;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::bottom);break;
case 1: // rectalignmentBL = 1,
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::bottom_left);break;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::bottom_left);break;
case 2: // rectalignmentBR = 2,
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::bottom_right);break;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::bottom_right);break;
case 3: // rectalignmentCtr = 3,
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::center);break;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::center);break;
case 4: // rectalignmentL = 4,
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::left);break;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::left);break;
case 5: // rectalignmentR = 5,
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::right);break;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::right);break;
case 6: // rectalignmentT = 6,
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::top);break;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::top);break;
case 7: // rectalignmentTL = 7,
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::top_left);break;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::top_left);break;
case 8: // rectalignmentTR = 8,
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::top_right);break;
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_ = fill_image_ref_point(fill_image_ref_point::top_right);break;
}
}
void odf_drawing_context::set_image_style_repeat(int style)
......@@ -2759,11 +2766,11 @@ void odf_drawing_context::set_image_style_repeat(int style)
if (!impl_->current_graphic_properties) return;
if (style == 1)
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.style_repeat_ = style_repeat(style_repeat::Stretch);
impl_->current_graphic_properties->common_draw_fill_attlist_.style_repeat_ = style_repeat(style_repeat::Stretch);
else if (style ==2)
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.style_repeat_ = style_repeat(style_repeat::Repeat);
impl_->current_graphic_properties->common_draw_fill_attlist_.style_repeat_ = style_repeat(style_repeat::Repeat);
else
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.style_repeat_ = style_repeat(style_repeat::NoRepeat);//default
impl_->current_graphic_properties->common_draw_fill_attlist_.style_repeat_ = style_repeat(style_repeat::NoRepeat);//default
}
void odf_drawing_context::set_image_client_rect_pt(double l, double t, double r, double b)
{
......@@ -2777,7 +2784,7 @@ void odf_drawing_context::set_image_client_rect_pt(double l, double t, double r,
<< length(length(b, length::pt).get_value_unit(length::cm),length::cm) << std::wstring(L",")
<< length(length(l, length::pt).get_value_unit(length::cm),length::cm) << std::wstring(L")");
impl_->current_graphic_properties->content_.fo_clip_ = str_stream.str();
impl_->current_graphic_properties->fo_clip_ = str_stream.str();
}
void odf_drawing_context::set_image_client_rect_inch(double l, double t, double r, double b)
......@@ -2792,7 +2799,7 @@ void odf_drawing_context::set_image_client_rect_inch(double l, double t, double
<< b << std::wstring(L"in, ")
<< l << std::wstring(L"in)");
impl_->current_graphic_properties->content_.fo_clip_ = str_stream.str();
impl_->current_graphic_properties->fo_clip_ = str_stream.str();
}
void odf_drawing_context::set_bitmap_link(std::wstring file_path)
......@@ -2821,7 +2828,7 @@ void odf_drawing_context::set_bitmap_tile_scale_x(double scale_x)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_width_ =
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_width_ =
length(length(scale_x,length::pt).get_value_unit(length::cm),length::cm);
}
......@@ -2829,20 +2836,20 @@ void odf_drawing_context::set_bitmap_tile_scale_y(double scale_y)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_height_ =
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_height_ =
length(length(scale_y,length::pt).get_value_unit(length::cm),length::cm);
}
void odf_drawing_context::set_bitmap_tile_translate_y(double y)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_y_ = percent(y);
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_y_ = percent(y);
}
void odf_drawing_context::set_bitmap_tile_translate_x(double x)
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content_.common_draw_fill_attlist_.draw_fill_image_ref_point_x_ = percent(x);
impl_->current_graphic_properties->common_draw_fill_attlist_.draw_fill_image_ref_point_x_ = percent(x);
}
office_element_ptr & odf_drawing_context::get_root_element()
......
......@@ -121,6 +121,9 @@ public:
void start_shape (int type);
void end_shape ();
void start_frame ();
void end_frame ();
bool change_text_box_2_wordart();
void start_image (std::wstring file_path);
......@@ -171,7 +174,7 @@ public:
void set_flip_H (bool bVal);
void set_flip_V (bool bVal);
void set_rotate (double iVal);
void set_rotate (double dVal);
void set_no_fill ();
void set_type_fill (int type);//for area - temp for objects
......@@ -194,6 +197,8 @@ public:
_CP_OPT(unsigned int) get_fill_color ();
void set_fill_color (unsigned int color);
_CP_OPT(odf_types::color) get_line_color();
//void start_shadow_properties();
//void end_shadow_properties();
// пока одной функией ..
......@@ -201,11 +206,12 @@ public:
void set_text (odf_text_context* text_context);
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 cm
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_writing_mode (int mode);
void set_textarea_wrap (bool val);
void set_textarea_fontcolor (std::wstring hexColor);
void set_textarea_font (std::wstring & latin, std::wstring & cs, std::wstring & ea);
void set_textarea_rotate (double dVal);
void set_layer (std::wstring val);
//////////////////////////////////////////////////////////////////////////////////////
void start_gradient_style ();
......@@ -249,9 +255,6 @@ public:
private:
void start_frame();
void end_frame();
class Impl;
_CP_PTR(Impl) impl_;
......
......@@ -102,9 +102,9 @@ void odf_style_context::create_style(std::wstring oox_name, style_family::type f
style_state_list_.push_back( state );
///////////////////////////////////////
style_state_list_.back()->set_name(odf_name);
style_state_list_.back()->set_automatic(automatic);
style_state_list_.back()->set_root(root);
style_state_list_.back()->set_name (odf_name);
style_state_list_.back()->set_automatic (automatic);
style_state_list_.back()->set_root (root);
style_state_list_.back()->style_oox_id_ = oox_id;
......
......@@ -60,12 +60,14 @@ namespace odf_writer {
if (style_)
{
style_->style_family_ = style_family(style_family_);
style_->content_.style_family_ = style_family_;
}
default_style* default_style_ = dynamic_cast<default_style*>(elm.get());
if (default_style_)
{
default_style_->style_family_ = style_family(style_family_);
default_style_->content_.style_family_ = style_family_;
}
list_style_exist = false;
......@@ -112,6 +114,12 @@ style_family::type odf_style_state::get_family_type()
{
return style_family_;
}
void odf_style_state::set_family_type (odf_types::style_family::type type)
{
style_family_ = type;
}
void odf_style_state::set_parent_style_name(std::wstring name)
{
if (name.length() < 1) return;
......@@ -229,16 +237,17 @@ style_paragraph_properties * odf_style_state::get_paragraph_properties()
return NULL;
}
style_graphic_properties * odf_style_state::get_graphic_properties()
graphic_format_properties * odf_style_state::get_graphic_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_)return style_->content_.get_style_graphic_properties();
if (style_)return style_->content_.get_graphic_properties();
default_style* default_style_ = dynamic_cast<default_style*>(odf_style_.get());
if (default_style_)return default_style_->content_.get_style_graphic_properties();
if (default_style_)return default_style_->content_.get_graphic_properties();
return NULL;
}
style_table_properties * odf_style_state::get_table_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
......@@ -304,13 +313,14 @@ style_chart_properties * odf_style_state::get_chart_properties()
return NULL;
}
//style_drawing_page_properties * odf_style_state::get_drawing_page_properties()
//{
// style* style_ = dynamic_cast<style*>(odf_style_.get());
// if (!style_)return NULL;
//
// return style_->content_.get_style_drawing_page_properties();
//}
style_drawing_page_properties * odf_style_state::get_drawing_page_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_)return NULL;
return style_->content_.get_style_drawing_page_properties();
}
///////////////////////
......
......@@ -45,16 +45,17 @@ class style;
class odf_conversion_context;
class odf_style_context;
class graphic_format_properties;
class style_text_properties;
class style_paragraph_properties;
class style_graphic_properties;
class style_table_properties;
class style_section_properties;
class style_table_cell_properties;
class style_table_row_properties;
class style_table_column_properties;
class style_chart_properties;
//class style_drawing_page_properties;
class style_drawing_page_properties;
class odf_style_state;
typedef shared_ptr<odf_style_state>::Type odf_style_state_ptr;
......@@ -80,7 +81,8 @@ public:
void set_name(std::wstring name);
std::wstring get_name();
odf_types::style_family::type get_family_type();
odf_types::style_family::type get_family_type ();
void set_family_type (odf_types::style_family::type type);
void set_number_format(int id) {num_fmt_id_ = id;}
int get_number_format() {return num_fmt_id_;}
......@@ -91,16 +93,17 @@ public:
void set_display_name(std::wstring name);
//////////////////////////////////////////////////////////////////////////////////////////
style_text_properties * get_text_properties();
graphic_format_properties * get_graphic_properties() ;
style_text_properties * get_text_properties();
style_paragraph_properties * get_paragraph_properties() ;
style_graphic_properties * get_graphic_properties() ;
style_table_properties * get_table_properties();
style_section_properties * get_section_properties();
style_table_cell_properties * get_table_cell_properties();
style_table_row_properties * get_table_row_properties() ;
style_table_column_properties * get_table_column_properties() ;
style_chart_properties * get_chart_properties() ;
//style_drawing_page_properties* get_drawing_page_properties();
style_drawing_page_properties* get_drawing_page_properties();
bool get_list_style_exist();
int get_list_style_level();
......
......@@ -44,10 +44,10 @@
#include "table.h"
#include "style_table_properties.h"
#include "style_graphic_properties.h"
#include "style_text_properties.h"
//#include "style_text_properties.h"
//#include "style_paragraph_properties.h"
//#include "style_graphic_properties.h"
namespace cpdoccore
......@@ -151,7 +151,9 @@ void odf_table_context::start_table(office_element_ptr &elm, bool styled)
if (!table)return;
odf_table_state state;
state.table.elm = elm;
state.table.elm = elm;
state.default_cell_properties = impl_->default_cell_properties; //write in row default cell props
if (styled)
{
......@@ -160,14 +162,12 @@ void odf_table_context::start_table(office_element_ptr &elm, bool styled)
{
state.table.style_elm = style_state->get_office_element();
state.table.style_name = style_state->get_name();
table->table_table_attlist_.table_style_name_ = state.table.style_name;
}
}
state.default_cell_properties = impl_->default_cell_properties;
impl_->default_cell_properties = L"";
impl_->start_table(state);
}
void odf_table_context::end_table()
{
......@@ -196,27 +196,31 @@ void odf_table_context::start_row(office_element_ptr &elm, bool styled)
{
if (impl_->empty()) return;
table_table_row * row = dynamic_cast<table_table_row *>(elm.get());;
table_table_row * row = dynamic_cast<table_table_row *>(elm.get());
if (!row)return;
odf_element_state state;
state.elm = elm;
if (styled)
{
odf_style_state_ptr style_state = impl_->styles_context()->last_state(style_family::TableRow);
if (style_state)
{
state.style_elm = style_state->get_office_element();
state.style_name = style_state->get_name();
state.style_elm = style_state->get_office_element();
state.style_name = style_state->get_name();
row->table_table_row_attlist_.table_style_name_ = state.style_name;
}
}
if (!impl_->current_table().default_cell_properties.empty())
row->table_table_row_attlist_.table_default_cell_style_name_ = impl_->current_table().default_cell_properties;
impl_->current_table().rows.push_back(state);
impl_->current_table().current_column =0;
impl_->current_table().current_column = 0;
impl_->current_table().current_row ++;
}
......@@ -411,8 +415,9 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
{
if (impl_->empty()) return;
table_table_cell * cell = dynamic_cast<table_table_cell *>(elm.get());;
table_covered_table_cell * covered_cell = dynamic_cast<table_covered_table_cell *>(elm.get());
table_table_cell* cell = dynamic_cast<table_table_cell *>(elm.get());;
table_covered_table_cell* covered_cell = dynamic_cast<table_covered_table_cell *>(elm.get());
if (!cell && !covered_cell)return;
odf_element_state state;
......@@ -423,10 +428,32 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
odf_style_state_ptr style_state = impl_->styles_context()->last_state(style_family::TableCell);
if (style_state)
{
state.style_elm = style_state->get_office_element();
state.style_name = style_state->get_name();
state.style_elm = style_state->get_office_element();
state.style_name = style_state->get_name();
cell->table_table_cell_attlist_.table_style_name_ = state.style_name;
}
if (!impl_->current_table().default_cell_properties.empty())
{
odf_style_state_ptr default_style_state;
impl_->styles_context()->find_odf_style_state(impl_->current_table().default_cell_properties, style_family::TableCell, default_style_state);
if (default_style_state && style_state)
{
graphic_format_properties * g = style_state->get_graphic_properties() ;
style_text_properties * t = style_state->get_text_properties();
style_table_cell_properties * c = style_state->get_table_cell_properties();
graphic_format_properties * d_g = default_style_state->get_graphic_properties() ;
style_text_properties * d_t = default_style_state->get_text_properties();
style_table_cell_properties * d_c = default_style_state->get_table_cell_properties();
if (g && d_g) g->apply_from(*d_g);
if (t && d_t) t->apply_from(d_t);
if (c && d_c) c->apply_from(d_c);
}
}
}
//if (cell)
//{
......@@ -438,6 +465,7 @@ void odf_table_context::start_cell(office_element_ptr &elm, bool styled)
impl_->current_table().current_column++;
}
void odf_table_context::set_cell_column_span(int spanned)
{
if (impl_->empty()) return;
......@@ -449,16 +477,24 @@ void odf_table_context::set_cell_column_span(int spanned)
cell->table_table_cell_attlist_extra_.table_number_columns_spanned_ = spanned;
//impl_->current_table().current_column += spanned-1;
//impl_->current_table().current_column += spanned - 1;
}
void odf_table_context::set_cell_row_span()
void odf_table_context::set_cell_row_span(int spanned)
{
int col = impl_->current_table().current_column-1;
odf_column_state & state = impl_->current_table().columns[col];
if (spanned > 0)
{
table_table_cell * cell = dynamic_cast<table_table_cell *>(impl_->current_table().cells.back().elm.get());
if (cell)
cell->table_table_cell_attlist_extra_.table_number_rows_spanned_ = spanned;
}
else
{
int col = impl_->current_table().current_column - 1;
odf_column_state & state = impl_->current_table().columns[col];
state.spanned_row_cell.push_back(impl_->current_table().cells.back().elm);
state.spanned_row_cell.push_back(impl_->current_table().cells.back().elm);
}
}
void odf_table_context::set_cell_row_span_restart()
......
......@@ -85,7 +85,7 @@ public:
void start_cell(office_element_ptr &elm, bool styled = false);
void set_cell_column_span(int spanned);
void set_cell_row_span();
void set_cell_row_span(int spanned = 0);
void set_cell_row_span_restart();
void end_cell();
......
......@@ -53,8 +53,7 @@ namespace odf_writer {
odp_conversion_context::odp_conversion_context(package::odf_document * outputDocument)
: odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this)
//, current_text_context_(NULL)
: odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this), text_context_(NULL)
{
}
......@@ -102,14 +101,14 @@ void odp_conversion_context::end_slide()
void odp_conversion_context::start_text_context()
{
current_text_context_ = new odf_text_context(this);
text_context_ = new odf_text_context(this);
}
void odp_conversion_context::end_text_context()
{
if (current_text_context_)
delete current_text_context_;
current_text_context_ = NULL;
if (text_context_)
delete text_context_;
text_context_ = NULL;
}
void odp_conversion_context::start_drawings()
......
......@@ -55,15 +55,16 @@ public:
void start_master_slide(std::wstring name);
void end_master_slide();
///////////////////////////////////////////////////////
odp_page_state & current_slide() { return slide_context_.state();}
odp_page_state & current_slide() { return slide_context_.state();}
/////////////////////////////////////////////////////
virtual void start_text_context();
virtual void end_text_context();
virtual odf_drawing_context * drawing_context() {return current_slide().drawing_context();}
virtual odf_text_context * text_context() {return current_text_context_;}
virtual odf_text_context * text_context() {return text_context_; }
odp_slide_context * slide_context() {return &slide_context_;}
void start_drawings();
void end_drawings();
......@@ -72,7 +73,7 @@ public:
private:
odp_slide_context slide_context_;
odf_text_context* current_text_context_;
odf_text_context* text_context_;
office_presentation* root_presentation_;
};
......
......@@ -29,12 +29,11 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "odp_slide_context.h"
#include "logging.h"
#include "odp_conversion_context.h"
#include "logging.h"
#include "odp_slide_context.h"
#include "odf_text_context.h"
#include <iostream>
......@@ -45,7 +44,7 @@ namespace cpdoccore {
namespace odf_writer {
odp_slide_context::odp_slide_context(odp_conversion_context & Context): context_(Context)
odp_slide_context::odp_slide_context(odp_conversion_context & Context): context_(Context), table_context_(&Context), comment_context_(&Context)
{
styles_context_ = Context.styles_context();
}
......@@ -81,5 +80,172 @@ void odp_slide_context::end_page()
state().drawing_context()->finalize(state().page_elm_);
}
odf_table_context* odp_slide_context::table_context()
{
return &table_context_;
}
void odp_slide_context::start_table()
{
state().drawing_context()->start_frame();
office_element_ptr elm, style_elm, default_cell;
create_element(L"table", L"table", elm, &context_);
//--------------------------------------------------------------------
odf_style_state_ptr style_state;
//общие свойства ячеек
styles_context_->create_style(L"", odf_types::style_family::TableCell, true, false, -1);
//ради нормального задания дефолтовых свойств на cells
style_state = styles_context_->last_state(style_family::TableCell);
if (style_state)
{
default_cell = style_state->get_office_element();
table_context()->set_default_cell_properties(style_state->get_name());
}
//стиль создаем всегда
styles_context_->create_style(L"", odf_types::style_family::Table, true, false, -1);
style_state = styles_context_->last_state(style_family::Table);
if (style_state) style_elm = style_state->get_office_element();
//--------------------------------------------------------------------
table_context()->start_table(elm, true);
state().drawing_context()->start_element(elm, default_cell);
}
void odp_slide_context::start_table_columns()
{
office_element_ptr elm;
create_element(L"table", L"table-columns", elm, &context_);
state().drawing_context()->start_element(elm);
}
void odp_slide_context::add_table_column(double width)
{
office_element_ptr elm;
create_element(L"table", L"table-column", elm, &context_);
styles_context_->create_style(L"", style_family::TableColumn, true, false, -1);
//не срабатывает ..
//std::wstring parent_name = table_context()->get_default_cell_properties();
//if (parent_name.length() > 0)
//{
// odf_writer::style_table_cell_properties * props = styles_context()->last_state().get_table_cell_properties();
// style * style_ = NULL;
//
// if (styles_context()->find_odf_style(parent_name,style_family::TableCell,style_))
// {
// style_table_cell_properties * parent = style_->content_.get_style_table_cell_properties();
// props->apply_from(parent);
// }
//}
table_context()->add_column(elm, true);
table_context()->set_column_width(width);
state().drawing_context()->start_element(elm); // для связи элментов
state().drawing_context()->end_element();
}
void odp_slide_context::end_table_columns()
{
state().drawing_context()->end_element();
}
void odp_slide_context::start_table_header_rows()
{
office_element_ptr elm;
create_element(L"table", L"table-header-rows", elm, &context_);
state().drawing_context()->start_element(elm);
}
void odp_slide_context::end_table_header_rows()
{
state().drawing_context()->end_element();
}
void odp_slide_context::start_table_row (bool styled)
{
office_element_ptr elm, style_elm;
create_element(L"table", L"table-row", elm, &context_);
if (styled)
{
styles_context_->create_style(L"",odf_types::style_family::TableRow, true, false, -1);
odf_style_state_ptr style_state = styles_context_->last_state(style_family::TableRow);
if (style_state)
style_elm = style_state->get_office_element();
}
state().drawing_context()->start_element(elm, style_elm);
table_context()->start_row(elm, styled);
}
void odp_slide_context::start_table_cell(int col, bool covered, bool styled)
{
for (int i = table_context()->current_column() ; i < col; i++)
{
add_default_cell();
}
//-------------------------------------------------------
office_element_ptr elm, style_elm;
if (covered)
create_element(L"table", L"covered-table-cell", elm, &context_);
else
create_element(L"table", L"table-cell", elm, &context_);
if (styled)
{
styles_context_->create_style(L"", odf_types::style_family::TableCell, true, false, -1);
odf_style_state_ptr style_state = styles_context_->last_state(style_family::TableCell);
if (style_state)
style_elm = style_state->get_office_element();
}
table_context()->start_cell(elm, style_elm ? true : false);
state().drawing_context()->start_element(elm, style_elm);
}
void odp_slide_context::end_table_cell()
{
table_context()->end_cell();
state().drawing_context()->end_element();
}
void odp_slide_context::end_table_row()
{
for (int i = table_context()->current_column() ; i < table_context()->count_columns(); i++)
{
add_default_cell();
}
//---------------------------------------------
table_context()->end_row();
state().drawing_context()->end_element();
}
void odp_slide_context::add_default_cell()
{
office_element_ptr elm;
create_element(L"table", L"covered-table-cell", elm, &context_);
table_context()->start_cell(elm, false);
state().drawing_context()->start_element(elm);
table_context()->end_cell();
state().drawing_context()->end_element();
}
void odp_slide_context::end_table()
{
table_context()->end_table();
state().drawing_context()->end_element();
state().drawing_context()->end_frame();
}
}
}
......@@ -31,9 +31,11 @@
*/
#pragma once
#include <string>
#include "odp_page_state.h"
#include "odf_table_context.h"
#include "odf_comment_context.h"
namespace cpdoccore {
namespace odf_writer {
......@@ -55,11 +57,29 @@ public:
odp_page_state & state();
odf_comment_context * comment_context();
odf_table_context * table_context();
void start_table ();
void start_table_columns ();
void add_table_column (double width = -1);
void end_table_columns ();
void start_table_header_rows();
void end_table_header_rows ();
void start_table_row (bool styled = false);
void add_default_cell ();
void start_table_cell (int col, bool covered, bool styled = true);
void end_table_cell ();
void end_table_row ();
void end_table ();
private:
odp_conversion_context& context_;
odf_style_context* styles_context_;
odf_table_context table_context_;
odf_comment_context comment_context_;
std::list<odp_page_state> page_state_list_;
friend class odp_conversion_context;
......
......@@ -231,7 +231,6 @@ void ods_table_context::start_table(office_element_ptr & elm)
office_element_ptr & style = context_.styles_context()->add_or_find(style_name_new, style_family::Table, true);
style->create_child_element(L"style", L"table-properties");
state().set_table_style(style);
state().set_table_hidden(false);
......
......@@ -44,8 +44,8 @@ class office_text;
class odf_text_context;
typedef shared_ptr<odf_text_context>::Type odf_text_context_ptr;
typedef shared_ptr<odf_drawing_context>::Type odf_drawing_context_ptr;
typedef shared_ptr<odf_text_context>::Type odf_text_context_ptr;
typedef shared_ptr<odf_drawing_context>::Type odf_drawing_context_ptr;
struct odt_section_state
{
......
......@@ -49,6 +49,65 @@ graphic_format_properties::graphic_format_properties()
//style_mirror_ = L"none";
//common_draw_fill_attlist_.draw_fill_ = draw_fill::none;
}
void graphic_format_properties::apply_from(const graphic_format_properties & Other)
{
_CP_APPLY_PROP2(draw_stroke_);
_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_textarea_vertical_align_);
_CP_APPLY_PROP2(draw_auto_grow_height_);
_CP_APPLY_PROP2(draw_auto_grow_width_);
_CP_APPLY_PROP2(draw_fit_to_size_);
_CP_APPLY_PROP2(draw_fit_to_contour_);
_CP_APPLY_PROP2(svg_stroke_color_);
_CP_APPLY_PROP2(svg_stroke_width_);
_CP_APPLY_PROP2(svg_stroke_opacity_);
_CP_APPLY_PROP2(fo_min_width_);
_CP_APPLY_PROP2(fo_min_height_);
_CP_APPLY_PROP2(fo_max_width_);
_CP_APPLY_PROP2(fo_max_height_);
_CP_APPLY_PROP2(fo_wrap_option_);
_CP_APPLY_PROP2(style_print_content_);
_CP_APPLY_PROP2(style_protect_);
_CP_APPLY_PROP2(style_editable_);
_CP_APPLY_PROP2(style_wrap_);
_CP_APPLY_PROP2(style_wrap_dynamic_treshold_);
_CP_APPLY_PROP2(style_number_wrapped_paragraphs_);
_CP_APPLY_PROP2(style_wrap_contour_);
_CP_APPLY_PROP2(style_wrap_contour_mode_);
_CP_APPLY_PROP2(style_run_through_);
_CP_APPLY_PROP2(style_flow_with_text_);
_CP_APPLY_PROP2(style_overflow_behavior_);
_CP_APPLY_PROP2(style_mirror_);
_CP_APPLY_PROP2(fo_clip_);
_CP_APPLY_PROP2(draw_wrap_influence_on_position_);
common_draw_fill_attlist_.apply_from(Other.common_draw_fill_attlist_);
common_draw_rel_size_attlist_.apply_from(Other.common_draw_rel_size_attlist_);
common_horizontal_margin_attlist_.apply_from(Other.common_horizontal_margin_attlist_);
common_vertical_margin_attlist_.apply_from(Other.common_vertical_margin_attlist_);
common_margin_attlist_.apply_from(Other.common_margin_attlist_);
common_horizontal_pos_attlist_.apply_from(Other.common_horizontal_pos_attlist_);
common_horizontal_rel_attlist_.apply_from(Other.common_horizontal_rel_attlist_);
common_vertical_pos_attlist_.apply_from(Other.common_vertical_pos_attlist_);
common_vertical_rel_attlist_.apply_from(Other.common_vertical_rel_attlist_);
common_text_anchor_attlist_.apply_from(Other.common_text_anchor_attlist_);
common_border_attlist_.apply_from(Other.common_border_attlist_);
common_border_line_width_attlist_.apply_from(Other.common_border_line_width_attlist_);
common_padding_attlist_.apply_from(Other.common_padding_attlist_);
common_shadow_attlist_.apply_from(Other.common_shadow_attlist_);
common_background_color_attlist_.apply_from(Other.common_background_color_attlist_);
_CP_APPLY_PROP(style_background_image_, Other.style_background_image_);
}
void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar_t * ns, const wchar_t * name )
{
CP_XML_WRITER(_Wostream)
......@@ -121,8 +180,7 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar
}
}
// style:graphic-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
//------------------------------------
const wchar_t * style_graphic_properties::ns = L"style";
const wchar_t * style_graphic_properties::name = L"graphic-properties";
......@@ -131,6 +189,14 @@ void style_graphic_properties::serialize(std::wostream & strm)
content_.serialize(strm,ns,name);
}
//------------------------------------
const wchar_t * loext_graphic_properties::ns = L"loext";
const wchar_t * loext_graphic_properties::name = L"graphic-properties";
void loext_graphic_properties::serialize(std::wostream & strm)
{
content_.serialize(strm,ns,name);
}
}
}
......@@ -147,8 +147,7 @@ public:
office_element_ptr style_background_image_;
};
/// \class style_graphic_properties
/// style:graphic-properties
class style_graphic_properties : public office_element_impl<style_graphic_properties>
{
public:
......@@ -170,7 +169,26 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(style_graphic_properties);
class loext_graphic_properties : public office_element_impl<loext_graphic_properties>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleGraphicPropertis;
CPDOCCORE_DEFINE_VISITABLE()
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name){}
virtual void add_child_element( const office_element_ptr & child){}
virtual void serialize(std::wostream & strm);
graphic_format_properties content_;
};
CP_REGISTER_OFFICE_ELEMENT2(loext_graphic_properties);
}
}
......@@ -75,17 +75,33 @@ style_paragraph_properties * style_content::get_style_paragraph_properties()
return dynamic_cast<style_paragraph_properties *>(style_paragraph_properties_.get());
}
style_graphic_properties * style_content::get_style_graphic_properties()
graphic_format_properties * style_content::get_graphic_properties()
{
if (!style_graphic_properties_)
create_element(L"style", L"graphic-properties",style_graphic_properties_, Context);
if (!style_graphic_properties_)
{
if (style_family_ == odf_types::style_family::TableCell)
create_element(L"loext", L"graphic-properties", style_graphic_properties_, Context);
else
create_element(L"style", L"graphic-properties", style_graphic_properties_, Context);
}
style_graphic_properties * style_gr = dynamic_cast<style_graphic_properties *>(style_graphic_properties_.get());
loext_graphic_properties * loext_gr = dynamic_cast<loext_graphic_properties *>(style_graphic_properties_.get());
if (style_gr)
{
return &style_gr->content_;
}
else if (loext_gr)
{
return &loext_gr->content_;
}
return NULL;
return dynamic_cast<style_graphic_properties *>(style_graphic_properties_.get());
}
style_table_properties * style_content::get_style_table_properties()
{
if (!style_table_properties_)
create_element(L"style", L"table-properties",style_table_properties_, Context);
create_element(L"style", L"table-properties", style_table_properties_, Context);
return dynamic_cast<style_table_properties *>(style_table_properties_.get());
}
......
......@@ -72,9 +72,10 @@
namespace cpdoccore {
namespace odf_writer {
class graphic_format_properties;
class style_text_properties;
class style_paragraph_properties;
class style_graphic_properties;
class style_section_properties;
class style_table_cell_properties;
class style_table_row_properties;
......@@ -88,13 +89,14 @@ class style_content : noncopyable
public:
style_content(odf_conversion_context * _context){Context = _context;}
void create_child_element( const std::wstring & Ns, const std::wstring & Name);
void add_child_element( const office_element_ptr & child);
void serialize(std::wostream & strm);
void create_child_element ( const std::wstring & Ns, const std::wstring & Name);
void add_child_element ( const office_element_ptr & child);
void serialize (std::wostream & strm);
style_text_properties * get_style_text_properties();
graphic_format_properties * get_graphic_properties() ;
style_text_properties * get_style_text_properties();
style_paragraph_properties * get_style_paragraph_properties() ;
style_graphic_properties * get_style_graphic_properties() ;
style_table_properties * get_style_table_properties();
style_section_properties * get_style_section_properties();
style_table_cell_properties * get_style_table_cell_properties();
......@@ -103,9 +105,9 @@ public:
style_chart_properties * get_style_chart_properties() ;
style_drawing_page_properties* get_style_drawing_page_properties();
odf_types::style_family style_family_;
private:
odf_conversion_context * Context;
odf_types::style_family style_family_;
office_element_ptr style_text_properties_;
office_element_ptr style_paragraph_properties_;
......@@ -349,7 +351,6 @@ public:
virtual void serialize(std::wostream & strm);
// attr
std::wstring style_name_;
_CP_OPT( std::wstring ) style_display_name_;
odf_types::style_family style_family_;
......@@ -363,7 +364,6 @@ public:
_CP_OPT( std::wstring ) style_class_;
_CP_OPT(std::wstring) style_default_outline_level_;
style_content content_;
office_element_ptr_array style_map_;
......
......@@ -54,11 +54,11 @@ class table_table_attlist
public:
table_table_attlist()
{
table_print_ = true;
table_use_first_row_styles_ = false;
table_use_banding_rows_styles_ = false;
table_use_first_column_styles_ = false;
table_use_banding_columns_styles_ = false;
table_print_ = true;
table_use_first_row_styles_ = false;
table_use_banding_rows_styles_ = false;
table_use_first_column_styles_ = false;
table_use_banding_columns_styles_ = false;
}
unsigned int table_number_columns_repeated_; // default 1
......@@ -70,19 +70,20 @@ public:
_CP_OPT(std::wstring) table_print_ranges_;
_CP_OPT(odf_types::Bool) table_protected_; // default false
bool table_print_; // default true
bool table_print_; // default true
bool table_use_first_row_styles_; // default false;
bool table_use_banding_rows_styles_; //defualt false;
bool table_use_first_column_styles_;//defualt false;
bool table_use_banding_columns_styles_; //defualt false;
bool table_use_first_row_styles_; // default false;
bool table_use_banding_rows_styles_; // defualt false;
bool table_use_first_column_styles_; // defualt false;
bool table_use_banding_columns_styles_; // defualt false;
void serialize(CP_ATTR_NODE);
friend class table_table;
};
// table-table-row-attlist
//-----------------------------------------------------------------------------------------------------
class table_table_row_attlist
{
public:
......@@ -97,7 +98,7 @@ public:
void serialize(CP_ATTR_NODE);
};
// table-table-cell-attlist
//-----------------------------------------------------------------------------------------------------
class table_table_cell_attlist
{
public:
......@@ -115,12 +116,12 @@ public:
void serialize(CP_ATTR_NODE);
};
// table-table-cell-attlist-extra
//-----------------------------------------------------------------------------------------------------
class table_table_cell_attlist_extra
{
public:
_CP_OPT(unsigned int) table_number_columns_spanned_; // default 1
_CP_OPT(unsigned int) table_number_rows_spanned_; // default 1
_CP_OPT(unsigned int) table_number_columns_spanned_; // default 1
_CP_OPT(unsigned int) table_number_rows_spanned_; // default 1
_CP_OPT(unsigned int) table_number_matrix_columns_spanned_;
_CP_OPT(unsigned int) table_number_matrix_rows_spanned_;
......@@ -152,9 +153,7 @@ public:
void serialize(CP_ATTR_NODE);
};
/// \class table_table_source
/// \brief table:table-source
/// table-table-source
//-----------------------------------------------------------------------------------------------------
class table_table_source : public office_element_impl<table_table_source>
{
public:
......@@ -177,7 +176,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_source);
// table-columns
//-----------------------------------------------------------------------------------------------------
class table_columns
{
public:
......@@ -192,7 +191,7 @@ public:
};
// table-columns-no-group
//-----------------------------------------------------------------------------------------------------
class table_columns_no_group: public office_element
{
public:
......@@ -226,7 +225,7 @@ private:
};
// table-columns-and-groups
//-----------------------------------------------------------------------------------------------------
class table_columns_and_groups
{
public:
......@@ -244,7 +243,7 @@ public:
};
// table-table-column-attlist
//-----------------------------------------------------------------------------------------------------
class table_table_column_attlist
{
public:
......@@ -258,9 +257,7 @@ public:
void serialize(CP_ATTR_NODE);
};
// \class table_table_column
// table:table-column
// table-table-column
//-----------------------------------------------------------------------------------------------------
class table_table_column : public office_element_impl<table_table_column>
{
public:
......@@ -283,9 +280,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_column);
// \class table_table_columns
// table:table-columns
// table-table-columns
//-----------------------------------------------------------------------------------------------------
class table_table_columns : public office_element_impl<table_table_columns>
{
public:
......@@ -307,9 +302,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_columns);
// \class table_table_header_columns
// table:table-header-columns
// table-table-header-columns
//-----------------------------------------------------------------------------------------------------
class table_table_header_columns : public office_element_impl<table_table_header_columns>
{
public:
......@@ -369,9 +362,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_column_group);
/// \class table_table_row
/// \brief table:table-row
/// table-table-row
//-----------------------------------------------------------------------------------------------------
class table_table_row : public office_element_impl<table_table_row>
{
public:
......@@ -394,8 +385,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_row);
// \class table_table_cell_content
// table-table-cell-content
//-----------------------------------------------------------------------------------------------------
class table_table_cell_content
{
public:
......@@ -410,9 +400,7 @@ private:
office_element_ptr_array text_content_; // text-content
};
// \class table_table_cell
// table-table-cell
// table:table-cell
//-----------------------------------------------------------------------------------------------------
class table_table_cell : public office_element_impl<table_table_cell>
{
public:
......@@ -430,17 +418,15 @@ public:
virtual void serialize(std::wostream & _Wostream);
table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_attlist_extra table_table_cell_attlist_extra_;
table_table_cell_content table_table_cell_content_;
table_table_cell_attlist table_table_cell_attlist_;
table_table_cell_attlist_extra table_table_cell_attlist_extra_;
table_table_cell_content table_table_cell_content_;
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_cell);
// \class table_covered_table_cell
// table-covered-table-cell
// table:covered-table-cell
//-----------------------------------------------------------------------------------------------------
class table_covered_table_cell : public office_element_impl<table_covered_table_cell>
{
public:
......@@ -466,9 +452,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_covered_table_cell);
// \class table_table_rows
// table-table-rows
// table:table-rows
//-----------------------------------------------------------------------------------------------------
class table_table_rows : public office_element_impl<table_table_rows>
{
public:
......@@ -494,9 +478,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_rows);
// \class table_table_header_rows
// table-table-header-rows
// table:table-header-rows
//-----------------------------------------------------------------------------------------------------
class table_table_header_rows : public office_element_impl<table_table_header_rows>
{
public:
......@@ -517,9 +499,7 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(table_table_header_rows);
// \class table_rows
// table-rows
//-----------------------------------------------------------------------------------------------------
class table_rows
{
public:
......@@ -533,7 +513,7 @@ public:
};
// table-rows-no-group
//-----------------------------------------------------------------------------------------------------
class table_rows_no_group : public office_element
{
public:
......@@ -567,7 +547,7 @@ private:
};
// table-rows-and-groups
//-----------------------------------------------------------------------------------------------------
class table_rows_and_groups
{
public:
......@@ -587,15 +567,14 @@ public:
};
// table-table-row-group-attlist
//-----------------------------------------------------------------------------------------------------
class table_table_row_group_attlist
{
public:
table_table_row_group_attlist() : table_display_(true) {}
bool table_display_; // default true
};
// table:table-row-group
//-----------------------------------------------------------------------------------------------------
class table_table_row_group : public office_element_impl<table_table_row_group>
{
public:
......@@ -621,9 +600,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table_row_group);
/// \class table_table
/// \brief table:table
/// table-table
//-----------------------------------------------------------------------------------------------------
class table_table : public office_element_impl<table_table>
{
public:
......@@ -654,9 +631,7 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(table_table);
/// \class table_shapes
/// \brief table:shapes
/// table-shapes
//-----------------------------------------------------------------------------------------------------
class table_shapes : public office_element_impl<table_shapes>
{
public:
......
......@@ -29,7 +29,7 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "Converter.h"
#include "PptxConverter.h"
#include "../utils.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h"
......@@ -41,6 +41,7 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Pic.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/SpTree.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/Table.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/SrgbClr.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Colors/PrstClr.h"
......@@ -98,7 +99,9 @@ void OoxConverter::convert(PPTX::Logic::GraphicFrame *oox_graphic_frame)
}
else if ( oox_graphic_frame->table.IsInit())
{
OoxConverter::convert(oox_graphic_frame->table.GetPointer());
PptxConverter *pptx_converter = dynamic_cast<PptxConverter *>(this);
if (pptx_converter)
pptx_converter->convert(oox_graphic_frame->table.GetPointer());
}
else if ( oox_graphic_frame->element.IsInit())
{
......@@ -111,15 +114,7 @@ void OoxConverter::convert(PPTX::Logic::NvGraphicFramePr *oox_framePr)
if (oox_framePr == NULL) return;
}
void OoxConverter::convert(PPTX::Logic::Table *oox_table)
{
if (oox_table == NULL) return;
odf_context()->drawing_context()->start_shape(0);//frame
odf_context()->drawing_context()->end_shape();
}
void OoxConverter::convert(PPTX::Logic::Xfrm *oox_xfrm)
{
if (oox_xfrm == NULL) return; //CTransform2D
......@@ -129,22 +124,34 @@ void OoxConverter::convert(PPTX::Logic::Xfrm *oox_xfrm)
if (oox_xfrm->offX.IsInit()) x = Emu2Pt(*oox_xfrm->offX);
if (oox_xfrm->offY.IsInit()) y = Emu2Pt(*oox_xfrm->offY);
odf_context()->drawing_context()->set_position( x, y);
if (oox_xfrm->extX.IsInit()) width = Emu2Pt(*oox_xfrm->extX);
if (oox_xfrm->extY.IsInit()) height = Emu2Pt(*oox_xfrm->extY);
odf_context()->drawing_context()->set_position( x, y);
odf_context()->drawing_context()->set_size( width, height);
if (oox_xfrm->flipH.get_value_or(false))
odf_context()->drawing_context()->set_flip_H(true);
if (oox_xfrm->flipV.get_value_or(false))
odf_context()->drawing_context()->set_flip_V(true);
if (oox_xfrm->flipH.get_value_or(false)) odf_context()->drawing_context()->set_flip_H(true);
if (oox_xfrm->flipV.get_value_or(false)) odf_context()->drawing_context()->set_flip_V(true);
if (oox_xfrm->rot.get_value_or(0) > 0)
odf_context()->drawing_context()->set_rotate(360. - oox_xfrm->rot.get_value_or(0)/60000.);
}
void OoxConverter::convert(PPTX::Logic::Xfrm *oox_txbx, PPTX::Logic::Xfrm *oox_xfrm)
{
if (oox_txbx == NULL) return;
if (oox_xfrm == NULL) return;
if (oox_txbx->rot.IsInit() && oox_xfrm->rot.IsInit())
{
int angle1 = *oox_txbx->rot / 60000;
int angle2 = *oox_xfrm->rot / 60000;
oox_txbx->rot = (angle1 + angle2) * 60000;
}
convert(oox_txbx);
}
void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
{
if (!oox_picture)return;
......@@ -280,7 +287,21 @@ void OoxConverter::convert(PPTX::Logic::SpTree *oox_shape_tree)
convert(oox_shape_tree->SpTreeElems[i].GetElem().operator->());
}
}
void OoxConverter::convert(PPTX::Logic::CxnSp *oox_connect)
{
if (oox_connect == NULL) return;
odf_context()->drawing_context()->start_drawing();
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeLine);
convert(&oox_connect->spPr, oox_connect->style.GetPointer());
convert(&oox_connect->nvCxnSpPr);
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->end_drawing();
}
void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
{
if (oox_shape == NULL) return;
......@@ -316,11 +337,30 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
//имя, описалово, номер ...
convert(&oox_shape->nvSpPr);
convert(oox_shape->txBody.GetPointer(), oox_shape->style.GetPointer());
if (oox_shape->txXfrm.IsInit() == false)
{
convert(oox_shape->txBody.GetPointer(), oox_shape->style.GetPointer());
}
odf_context()->drawing_context()->end_shape();
odf_context()->drawing_context()->end_drawing();
if (oox_shape->txXfrm.IsInit())
{
odf_context()->drawing_context()->start_drawing();
odf_context()->drawing_context()->start_text_box();
convert(oox_shape->txXfrm.GetPointer(), oox_shape->spPr.xfrm.GetPointer());
convert(oox_shape->txBody.GetPointer(), oox_shape->style.GetPointer());
odf_context()->drawing_context()->start_line_properties();
odf_context()->drawing_context()->set_no_fill();
odf_context()->drawing_context()->end_line_properties();
odf_context()->drawing_context()->end_text_box();
odf_context()->drawing_context()->end_drawing();
}
}
void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* oox_sp_style)
{
......@@ -334,25 +374,23 @@ void OoxConverter::convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle*
convert(prstGeom);
convert(custGeom);
odf_context()->drawing_context()->start_area_properties();
bool bLine = prstGeom ? (prstGeom->prst.get() == L"line") : false;
if (!bLine)
{
if (oox_spPr->Fill.is_init())
convert(&oox_spPr->Fill);
else if (oox_sp_style)
convert(&oox_sp_style->fillRef, 1);
odf_context()->drawing_context()->start_area_properties();
{
if (oox_spPr->Fill.is_init())
convert(&oox_spPr->Fill);
else if (oox_sp_style)
convert(&oox_sp_style->fillRef, 1);
}
odf_context()->drawing_context()->end_area_properties();
}
odf_context()->drawing_context()->end_area_properties();
odf_context()->drawing_context()->start_line_properties();
{
if (oox_spPr->ln.IsInit())
{
convert(oox_spPr->ln.GetPointer()); //CLineProperties
}
else if (oox_sp_style)
{
convert(&oox_sp_style->lnRef, 2);
}
convert(oox_spPr->ln.GetPointer(), 0, oox_sp_style);
}
odf_context()->drawing_context()->end_line_properties();
//-----------------------------------------------------------------------------------------------------------------------------
......@@ -413,6 +451,64 @@ void OoxConverter::convert(PPTX::Logic::CustGeom *oox_cust_geom)
convert(&oox_cust_geom->pathLst[i]);
}
}
void OoxConverter::convert(PPTX::Logic::EffectLst *oox_effect_list)
{
if (!oox_effect_list) return;
convert(oox_effect_list->innerShdw.GetPointer());
convert(oox_effect_list->outerShdw.GetPointer());
convert(oox_effect_list->prstShdw.GetPointer());
}
void OoxConverter::convert(PPTX::Logic::InnerShdw *oox_shadow)
{
if (oox_shadow == NULL) return;
std::wstring hexColor;
_CP_OPT(double) opacity;
convert(&oox_shadow->Color, hexColor, opacity);
odf_context()->drawing_context()->set_shadow(2, hexColor, opacity, oox_shadow->dist.IsInit() ? oox_shadow->dist.get() / 12700. : 0);
}
void OoxConverter::convert(PPTX::Logic::OuterShdw *oox_shadow)
{
if (oox_shadow == NULL) return;
std::wstring hexColor;
_CP_OPT(double) opacity;
convert(&oox_shadow->Color, hexColor, opacity);
odf_context()->drawing_context()->set_shadow(1, hexColor, opacity, oox_shadow->dist.IsInit() ? oox_shadow->dist.get() / 12700. : 0);
}
void OoxConverter::convert(PPTX::Logic::PrstShdw *oox_shadow)
{
if (oox_shadow == NULL) return;
std::wstring hexColor;
_CP_OPT(double) opacity;
convert(&oox_shadow->Color, hexColor, opacity);
//odf_context()->drawing_context()->set_shadow(1, hexColor, opacity, oox_shadow->dist.IsInit() ? oox_shadow->dist.get() / 12700. : 0);
}
void OoxConverter::convert(PPTX::Logic::EffectStyle *oox_effects)
{
if (!oox_effects) return;
if (oox_effects->EffectList.is_init())
{
convert(oox_effects->EffectList.List.GetPointer());
}
if (oox_effects->scene3d.IsInit())
{
}
if (oox_effects->sp3d.IsInit())
{
}
}
void OoxConverter::convert(PPTX::Logic::Path2D *oox_geom_path)
{
if (!oox_geom_path) return;
......@@ -506,11 +602,11 @@ void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill)
// convert(oox_bitmap_fill->blip->m_arrEffects[i]);
//}
}
if (oox_bitmap_fill->srcRect.IsInit() && Width >0 && Height >0)//часть изображения
if (oox_bitmap_fill->srcRect.IsInit() && Width > 0 && Height > 0)//часть изображения
{
odf_context()->drawing_context()->set_image_client_rect_inch(
(oox_bitmap_fill->srcRect->l.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->l.get()) : 0 ) /100. * Width / currentSystemDPI,
(oox_bitmap_fill->srcRect->t.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->t.get()) : 0 ) /100. * Height/ currentSystemDPI,
(oox_bitmap_fill->srcRect->l.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->l.get()) : 0 ) /100. * Width / currentSystemDPI,
(oox_bitmap_fill->srcRect->t.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->t.get()) : 0 ) /100. * Height/ currentSystemDPI,
(oox_bitmap_fill->srcRect->r.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->r.get()) : 0 ) /100. * Width / currentSystemDPI,
(oox_bitmap_fill->srcRect->b.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->b.get()) : 0 ) /100. * Height/ currentSystemDPI);
}
......@@ -523,21 +619,21 @@ void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill)
if (oox_bitmap_fill->tile->flip.IsInit()) {}
if (oox_bitmap_fill->tile->sx.IsInit() && Width >0)
if (oox_bitmap_fill->tile->sx.IsInit() && Width > 0)
{
odf_context()->drawing_context()->set_bitmap_tile_scale_x(*oox_bitmap_fill->tile->sx / 100. * Width);
odf_context()->drawing_context()->set_bitmap_tile_scale_x(*oox_bitmap_fill->tile->sx / 100000. * Width);
}
if (oox_bitmap_fill->tile->sy.IsInit()&& Height >0)
if (oox_bitmap_fill->tile->sy.IsInit()&& Height > 0)
{
odf_context()->drawing_context()->set_bitmap_tile_scale_y(*oox_bitmap_fill->tile->sy / 100. * Height);
odf_context()->drawing_context()->set_bitmap_tile_scale_y(*oox_bitmap_fill->tile->sy / 100000. * Height);
}
if (oox_bitmap_fill->tile->tx.IsInit() && Width >0)
if (oox_bitmap_fill->tile->tx.IsInit() && Width > 0)
{
odf_context()->drawing_context()->set_bitmap_tile_translate_x(*oox_bitmap_fill->tile->tx * 100. / Width );
odf_context()->drawing_context()->set_bitmap_tile_translate_x(*oox_bitmap_fill->tile->tx * 100000. / Width );
}
if (oox_bitmap_fill->tile->ty.IsInit() && Height >0)
if (oox_bitmap_fill->tile->ty.IsInit() && Height > 0)
{
odf_context()->drawing_context()->set_bitmap_tile_translate_y(*oox_bitmap_fill->tile->ty * 100. / Height );
odf_context()->drawing_context()->set_bitmap_tile_translate_y(*oox_bitmap_fill->tile->ty * 100000. / Height );
}
}
if (oox_bitmap_fill->stretch.IsInit())
......@@ -659,20 +755,51 @@ void OoxConverter::convert(PPTX::Logic::SolidFill *oox_fill, DWORD nARGB)
odf_context()->drawing_context()->set_opacity(*opacity);
}
}
void OoxConverter::convert(PPTX::Logic::PattFill *oox_fill, DWORD nARGB)
void OoxConverter::convert(PPTX::Logic::PattFill *oox_pattern_fill, DWORD nARGB)
{
if (!oox_fill) return;
}
void OoxConverter::convert(PPTX::Logic::EffectLst *oox_effect_lst)
{
if (!oox_effect_lst) return;
if (!oox_pattern_fill) return;
odf_context()->drawing_context()->start_hatch_style();
{
if (oox_pattern_fill->prst.IsInit())
{
odf_context()->drawing_context()->set_hatch_type(oox_pattern_fill->prst->GetBYTECode());
}
if (oox_pattern_fill->fgClr.is_init())
{
std::wstring hexColor;
_CP_OPT(double) opacity;
convert(&oox_pattern_fill->fgClr, hexColor, opacity, nARGB);
odf_context()->drawing_context()->set_hatch_line_color(hexColor);
}
if (oox_pattern_fill->bgClr.is_init())
{
std::wstring hexColor;
_CP_OPT(double) opacity;
convert(&oox_pattern_fill->bgClr, hexColor, opacity, nARGB);
odf_context()->drawing_context()->set_hatch_area_color(hexColor);
}
}
odf_context()->drawing_context()->end_hatch_style();
}
void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop)
void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop, DWORD ARGB, PPTX::Logic::ShapeStyle* oox_sp_style)
{
if (oox_sp_style)
{
convert(&oox_sp_style->lnRef, 2);
}
if (!oox_line_prop) return;
convert (&oox_line_prop->Fill);
if (oox_line_prop->Fill.is_init())
{
convert (&oox_line_prop->Fill, ARGB);
}
if (oox_line_prop->w.IsInit())
{
odf_context()->drawing_context()->set_line_width(oox_line_prop->w.get() / 12700.); //pt
......@@ -736,10 +863,10 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
_CP_OPT(double) lIns, tIns, rIns, bIns;
if (oox_bodyPr->lIns.IsInit()) lIns = oox_bodyPr->lIns.get() / 12700. / 28.34467120181406; //cm
if (oox_bodyPr->tIns.IsInit()) tIns = oox_bodyPr->tIns.get() / 12700. / 28.34467120181406;
if (oox_bodyPr->rIns.IsInit()) rIns = oox_bodyPr->rIns.get() / 12700. / 28.34467120181406;
if (oox_bodyPr->bIns.IsInit()) bIns = oox_bodyPr->bIns.get() / 12700. / 28.34467120181406;
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()->drawing_context()->set_textarea_padding (lIns, tIns, rIns, bIns);
......@@ -751,12 +878,12 @@ void OoxConverter::convert(PPTX::Logic::BodyPr *oox_bodyPr)
//+ style section
//+element text:section в котором параграфы
}
//if (oox_bodyPr->spAutoFit.IsInit())
//{
// //изменяемы размеры
// odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
if (oox_bodyPr->Fit.type == PPTX::Logic::TextFit::FitSpAuto)
{
//изменяемы размеры
odf_context()->drawing_context()->set_text_box_min_size(true);//уже выставленые в min
//}
}
if (oox_bodyPr->fromWordArt.IsInit() && oox_bodyPr->prstTxWarp.IsInit())
{
for (size_t i = 0; i < oox_bodyPr->prstTxWarp->avLst.size(); i++)
......@@ -801,6 +928,20 @@ void OoxConverter::convert(PPTX::Logic::CNvSpPr *oox_cnvSpPr)
if (!oox_cnvSpPr) return;
}
void OoxConverter::convert(PPTX::Logic::CNvCxnSpPr *oox_cnvSpPr)
{
if (!oox_cnvSpPr) return;
}
void OoxConverter::convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr)
{
if (!oox_nvSpPr) return;
convert(&oox_nvSpPr->cNvPr);
convert(&oox_nvSpPr->cNvCxnSpPr);
convert(&oox_nvSpPr->nvPr);
}
void OoxConverter::convert(PPTX::Logic::NvPr *oox_nvPr)
{
if (!oox_nvPr) return;
......@@ -927,6 +1068,33 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
if (!oox_run_pr) return;
if (!text_properties) return;
PPTX::Logic::GradFill* gradFill = &oox_run_pr->Fill.as<PPTX::Logic::GradFill>();
if (gradFill)
{
if (odf_context()->drawing_context()->change_text_box_2_wordart())
{
odf_context()->drawing_context()->start_area_properties();
{
convert(gradFill);
}
odf_context()->drawing_context()->end_area_properties();
}
}
if (oox_run_pr->ln.IsInit())
{
if (odf_context()->drawing_context()->change_text_box_2_wordart())
{
odf_context()->drawing_context()->start_line_properties();
{
odf_context()->drawing_context()->set_line_dash_preset(6);
convert(oox_run_pr->ln.GetPointer());
}
odf_context()->drawing_context()->end_line_properties();
}
}
//
if (oox_run_pr->b.IsInit())
{
if (oox_run_pr->b.get() == true)
......@@ -942,7 +1110,9 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
_CP_OPT(double) opacity;
convert(&solidFill->Color, hexColor, opacity);
text_properties->content_.fo_color_ = odf_types::color(std::wstring(L"#") + hexColor);
int res = 0;
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
text_properties->content_.fo_color_ = odf_types::color(hexColor);
}
if (oox_run_pr->i.IsInit())
{
......@@ -1158,23 +1328,26 @@ void OoxConverter::convert(PPTX::Logic::Close *oox_geom_path)
void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type)
{
if (!style_ref) return;
std::wstring hexColor;
_CP_OPT(double) opacity;
convert(&style_ref->Color, hexColor, opacity);
if (type == 1)
if (style_ref->idx.IsInit() == false)
{
odf_context()->drawing_context()->set_solid_fill(hexColor);
if (opacity)
odf_context()->drawing_context()->set_opacity(*opacity);
std::wstring hexColor;
_CP_OPT(double) opacity;
convert(&style_ref->Color, hexColor, opacity);
if (type != 3) //?? todooo
{
odf_context()->drawing_context()->set_solid_fill(hexColor);
if (opacity)
odf_context()->drawing_context()->set_opacity(*opacity);
}
return;
}
if (style_ref->idx.IsInit() == false) return;
size_t index = *style_ref->idx;
int index = *style_ref->idx;
PPTX::Theme *theme = oox_theme();
if (!theme) return;
......@@ -1206,14 +1379,15 @@ void OoxConverter::convert(PPTX::Logic::StyleRef *style_ref, int type)
}
else if (type == 2)
{
//index -= 1;
index -= 1;
if ((index >= 0) || (index < theme->themeElements.fmtScheme.lnStyleLst.size()))
{
convert(&theme->themeElements.fmtScheme.lnStyleLst[index]);
convert(&theme->themeElements.fmtScheme.lnStyleLst[index], style_ref->Color.GetARGB());
}
}
else if (type == 3)
{
index -= 1;
if ((index >= 0) || (index < theme->themeElements.fmtScheme.effectStyleLst.size()))
{
convert(&theme->themeElements.fmtScheme.effectStyleLst[index]);
......@@ -1249,4 +1423,5 @@ void OoxConverter::convert(PPTX::Logic::FontRef *style_font_ref)
odf_context()->drawing_context()->set_textarea_font(style_font->latin.typeface, style_font->ea.typeface, style_font->cs.typeface);
}
}
}
......@@ -58,6 +58,7 @@
#include "../../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Shape.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/CxnSp.h"
#define PROGRESSEVENT_ID 0
......@@ -160,15 +161,17 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
case OOX::et_dsp_Shape:
case OOX::et_w_Shape:
{
PPTX::Logic::Shape* pShape = dynamic_cast<PPTX::Logic::Shape*>(oox_unknown);
convert(pShape);
convert(dynamic_cast<PPTX::Logic::Shape*>(oox_unknown));
}break;
case OOX::et_p_ShapeTree:
case OOX::et_a_GroupShape:
case OOX::et_w_GroupShape:
{
PPTX::Logic::SpTree *spTree = dynamic_cast<PPTX::Logic::SpTree *>(oox_unknown);
convert(spTree);
convert(dynamic_cast<PPTX::Logic::SpTree *>(oox_unknown));
}break;
case OOX::et_cxnSp:
{
convert(dynamic_cast<PPTX::Logic::CxnSp*>(oox_unknown));
}break;
case OOX::et_a_prstGeom:
{
......@@ -282,23 +285,23 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
}break;
case OOX::et_p_r:
{
PPTX::Logic::Run* pRun= dynamic_cast<PPTX::Logic::Run*>(oox_unknown);
convert(pRun);
convert(dynamic_cast<PPTX::Logic::Run*>(oox_unknown));
}break;
case OOX::et_p_fld:
{
PPTX::Logic::Fld* pFld= dynamic_cast<PPTX::Logic::Fld*>(oox_unknown);
convert(pFld);
convert(dynamic_cast<PPTX::Logic::Fld*>(oox_unknown));
}break;
case OOX::et_p_br:
{
PPTX::Logic::Br* pBr= dynamic_cast<PPTX::Logic::Br*>(oox_unknown);
convert(pBr);
convert(dynamic_cast<PPTX::Logic::Br*>(oox_unknown));
}break;
case OOX::et_p_MathPara:
{
PPTX::Logic::MathParaWrapper* pMathPara= dynamic_cast<PPTX::Logic::MathParaWrapper*>(oox_unknown);
convert(pMathPara);
convert(dynamic_cast<PPTX::Logic::MathParaWrapper*>(oox_unknown));
}break;
case OOX::et_a_effectStyle:
{
convert(dynamic_cast<PPTX::Logic::EffectStyle*>(oox_unknown));
}break;
default:
{
......@@ -311,118 +314,6 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
}
}
//void OoxConverter::convert(OOX::Drawing::CShape *oox_shape)
//{
// if (oox_shape == NULL)return;
// if (!oox_shape->m_oSpPr.IsInit()) return;
//
// odf_context()->drawing_context()->start_drawing();
//
// int type = -1;
// if (oox_shape->m_oSpPr->m_oCustGeom.IsInit())
// {
// type = 1000;//6???
// }
// if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
// {
// OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
// type =(geometry->m_oPrst.GetValue());
// }
// if (oox_shape->m_oNvSpPr.IsInit() && oox_shape->m_oNvSpPr->m_oCNvSpPr.IsInit() &&
// oox_shape->m_oNvSpPr->m_oCNvSpPr->m_otxBox.GetValue() == 1) type = 2000; //textBox
//
// if (type == SimpleTypes::shapetypeRect && oox_shape->m_oTxSp.IsInit() && oox_shape->m_oTxSp->m_oTxBody.IsInit()) type = 2000;
//
// if ((type == 2000 || type == SimpleTypes::shapetypeRect ) && oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr.IsInit()
// /*&& oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr->m_oPrstTxWrap.IsInit()*/)
// {
// if (oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr->m_oFromWordArt.ToBool())
// {
// int wordart_type = convert(oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr->m_oPrstTxWrap.GetPointer());
//
// if (wordart_type >0)type = wordart_type;
// }else type = 2000;
// }
//
// if (type < 0)return;
// /////////////////////////////////////////////////////////////////////////////////
// odf_context()->drawing_context()->start_shape(type);
//
// convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
// //имя, описалово, номер ...
// if (oox_shape->m_oNvSpPr.IsInit())
// convert(oox_shape->m_oNvSpPr->m_oCNvPr.GetPointer());
//
// if (oox_shape->m_oTxSp.IsInit() && oox_shape->m_oTxSp->m_oTxBody.IsInit())
// {
// odf_context()->start_text_context();
//
// convert(oox_shape->m_oTxSp->m_oTxBody->m_oBodyPr.GetPointer());
// for (size_t i=0 ; i < oox_shape->m_oTxSp->m_oTxBody->m_arrItems.size();i++)
// {
// convert(oox_shape->m_oTxSp->m_oTxBody->m_arrItems[i]);
// }
// odf_context()->drawing_context()->set_text( odf_context()->text_context());
// odf_context()->end_text_context();
// }
//
// odf_context()->drawing_context()->end_shape();
//
// odf_context()->drawing_context()->end_drawing();
//}
//
//void OoxConverter::convert(OOX::Drawing::CDiagrammParts *oox_diagramm)
//{
// if (oox_diagramm == NULL)return;
// if (oox_diagramm->.IsInit() == false) return;
//
// smart_ptr<OOX::File> oFile = find_file_by_id(oox_diagramm->m_oRId_Data->GetValue());
//
// NSCommon::nullable<std::wstring> id_drawing;
//
// if (oFile.IsInit())
// {
// OOX::CDiagramData* pDiagData = dynamic_cast<OOX::CDiagramData*>(oFile.operator->());
//
// if ((pDiagData) && (pDiagData->m_oExtLst.IsInit()))
// {
// for (size_t i = 0 ; i < pDiagData->m_oExtLst->m_arrExt.size(); i++)
// {
// if ( pDiagData->m_oExtLst->m_arrExt[i]->m_oDataModelExt.IsInit())
// {
// id_drawing = pDiagData->m_oExtLst->m_arrExt[i]->m_oDataModelExt->m_oRelId;
// break;
// }
// }
// }
// }
// if (id_drawing.is_init() == false) return;
//
// oFile = find_file_by_id( *id_drawing );
//
// if (oFile.is_init() && OOX::FileTypes::DiagDrawing == oFile->type())
// {
// _CP_OPT(double) x, y, width, height, cx, cy;
//
// odf_context()->drawing_context()->get_size (width, height);
// odf_context()->drawing_context()->get_position (x, y);
//
// OOX::CDiagramDrawing * diag_drawing = dynamic_cast<OOX::CDiagramDrawing*>(oFile.operator->());
//
// oox_current_child_document = diag_drawing;
//
// odf_context()->drawing_context()->start_group();
//
// odf_context()->drawing_context()->set_group_size (width, height, width, height);
// odf_context()->drawing_context()->set_group_position (x, y, cx, cy);
//
// convert(diag_drawing->m_oShapeTree.GetPointer());
//
// odf_context()->drawing_context()->end_group();
// oox_current_child_document = NULL;
// }
//}
//void OoxConverter::convert(OOX::Drawing::CLockedCanvas *oox_canvas)
//{
// if (oox_canvas == NULL)return;
......@@ -444,468 +335,7 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
// }
// odf_context()->drawing_context()->end_group();
//}
//void OoxConverter::convert(OOX::Drawing::CGroupShapeProperties * oox_group_spPr)
//{
// if (!oox_group_spPr) return;
//
// if (oox_group_spPr->m_oXfrm.IsInit()) //CTransform2D
// {
// if (oox_group_spPr->m_oXfrm->m_oFlipH.GetValue() == SimpleTypes::onoffTrue)
// odf_context()->drawing_context()->set_group_flip_H(true);
//
// if (oox_group_spPr->m_oXfrm->m_oFlipV.GetValue() == SimpleTypes::onoffTrue)
// odf_context()->drawing_context()->set_group_flip_V(true);
//
// if (oox_group_spPr->m_oXfrm->m_oChExt.IsInit() && oox_group_spPr->m_oXfrm->m_oExt.IsInit())
// {
// _CP_OPT(double) cx,cy,ch_cx, ch_cy;
//
// cx = oox_group_spPr->m_oXfrm->m_oExt->m_oCx.ToPoints();
// cy = oox_group_spPr->m_oXfrm->m_oExt->m_oCy.ToPoints();
//
// ch_cx = oox_group_spPr->m_oXfrm->m_oChExt->m_oCx.ToPoints();
// ch_cy = oox_group_spPr->m_oXfrm->m_oChExt->m_oCy.ToPoints();
//
// odf_context()->drawing_context()->set_group_size(cx, cy, ch_cx, ch_cy);
// }
// if (
// oox_group_spPr->m_oXfrm->m_oOff.IsInit() && oox_group_spPr->m_oXfrm->m_oChOff.IsInit())
// {
// _CP_OPT(double) x,y, ch_x, ch_y;
//
// x = oox_group_spPr->m_oXfrm->m_oOff->m_oX.ToPoints();
// y = oox_group_spPr->m_oXfrm->m_oOff->m_oY.ToPoints();
//
// ch_x = oox_group_spPr->m_oXfrm->m_oChOff->m_oX.ToPoints();
// ch_y = oox_group_spPr->m_oXfrm->m_oChOff->m_oY.ToPoints();
//
// odf_context()->drawing_context()->set_group_position( x, y, ch_x, ch_y);
// }
//
// if (oox_group_spPr->m_oXfrm->m_oRot.GetValue() > 0)
// odf_context()->drawing_context()->set_group_rotate(oox_group_spPr->m_oXfrm->m_oRot.GetValue());
// }
//}
//void OoxConverter::convert(OOX::Drawing::CNonVisualDrawingProps * oox_cnvPr)
//{
// if (!oox_cnvPr) return;
//
// if (oox_cnvPr->m_sName.IsInit())
// {
// std::wstring name = oox_cnvPr->m_sName.get();
// odf_context()->drawing_context()->set_name(name);
// }
//
// //nullable<std::wstring> m_sDescr;
// //nullable<SimpleTypes::COnOff<>> m_oHidden;
// //nullable<std::wstring> m_sTitle;
//}
//
//void OoxConverter::convert(OOX::Drawing::CCustomGeometry2D *oox_cust_geom)
//{
// if (!oox_cust_geom)return;
//
// for (size_t i = 0; i < oox_cust_geom->m_oPthLst.m_arrPath.size(); i++)
// {
// convert(oox_cust_geom->m_oPthLst.m_arrPath[i]);
// }
//}
//void OoxConverter::convert(OOX::Drawing::CLineProperties *oox_line_prop, std::wstring *change_sheme_color )
//{
// if (!oox_line_prop)return;
//
// switch (oox_line_prop->m_eFillType)
// {
// case OOX::Drawing::filltypeGradient: convert(oox_line_prop->m_oGradFill.GetPointer(), change_sheme_color);break;
// case OOX::Drawing::filltypePattern: convert(oox_line_prop->m_oPattFill.GetPointer(), change_sheme_color);break;
// case OOX::Drawing::filltypeSolid: convert(oox_line_prop->m_oSolidFill.GetPointer(), change_sheme_color);break;
// case OOX::Drawing::filltypeGroup:
// case OOX::Drawing::filltypeNo: odf_context()->drawing_context()->set_no_fill();
// break;
// }
// if (oox_line_prop->m_oW.IsInit())
// {
// odf_context()->drawing_context()->set_line_width(oox_line_prop->m_oW->ToPoints());
// }
// if (oox_line_prop->m_oHeadEnd.IsInit())
// {
// if (oox_line_prop->m_oHeadEnd->m_oLen.IsInit() || oox_line_prop->m_oHeadEnd->m_oType.IsInit() || oox_line_prop->m_oHeadEnd->m_oW.IsInit())
// {
// int type = 0, w=1, len =1;//medium arrow
// if (oox_line_prop->m_oHeadEnd->m_oLen.IsInit()) len = oox_line_prop->m_oHeadEnd->m_oLen->GetValue();
// if (oox_line_prop->m_oHeadEnd->m_oType.IsInit()) type = oox_line_prop->m_oHeadEnd->m_oType->GetValue();
// if (oox_line_prop->m_oHeadEnd->m_oW.IsInit()) w = oox_line_prop->m_oHeadEnd->m_oW->GetValue();
//
// odf_context()->drawing_context()->set_line_head(type, len, w);
// }
// }
// if (oox_line_prop->m_oTailEnd.IsInit())
// {
// if (oox_line_prop->m_oTailEnd->m_oLen.IsInit() || oox_line_prop->m_oTailEnd->m_oType.IsInit() || oox_line_prop->m_oTailEnd->m_oW.IsInit())
// {
// int type =0, w=1, len =1;//medium arrow
// if (oox_line_prop->m_oTailEnd->m_oLen.IsInit()) len = oox_line_prop->m_oTailEnd->m_oLen->GetValue();
// if (oox_line_prop->m_oTailEnd->m_oType.IsInit()) type = oox_line_prop->m_oTailEnd->m_oType->GetValue();
// if (oox_line_prop->m_oTailEnd->m_oW.IsInit()) w = oox_line_prop->m_oTailEnd->m_oW->GetValue();
//
// odf_context()->drawing_context()->set_line_tail(type, len, w);
// }
// }
//
// if (oox_line_prop->m_oCustDash.IsInit())
// {
// //через задание стиля и описание геометрии
// }
// if (oox_line_prop->m_oPrstDash.IsInit() && oox_line_prop->m_oPrstDash->m_oVal.IsInit())
// {
// odf_context()->drawing_context()->set_line_dash_preset(oox_line_prop->m_oPrstDash->m_oVal->GetValue());
// }
// //nullable<SimpleTypes::CPenAlignment<>> m_oAlgn;
// //nullable<SimpleTypes::CLineCap<>> m_oCap;
// //nullable<SimpleTypes::CCompoundLine<>> m_oCmpd;
//
//
// //ELineJoinType m_eJoinType; // Тип соединения линий
// //nullable<OOX::Drawing::CLineJoinBevel> m_oBevel;
// //nullable<OOX::Drawing::CLineJoinMiterProperties> m_oMiter;
// //nullable<OOX::Drawing::CLineJoinRound> m_oRound;
//
//}
//
//void OoxConverter::convert(OOX::Drawing::CPresetGeometry2D *oox_prst_geom)
//{
// if (!oox_prst_geom)return;
//
// if (oox_prst_geom->m_oAvLst.IsInit())
// {
// for (size_t i = 0; i < oox_prst_geom->m_oAvLst->m_arrGd.size(); i++)
// {
// if (oox_prst_geom->m_oAvLst->m_arrGd[i] == NULL) continue;
// odf_context()->drawing_context()->add_modifier(oox_prst_geom->m_oAvLst->m_arrGd[i]->m_oFmla.GetValue());
// }
// }
//}
//void OoxConverter::convert(OOX::Drawing::CPath2D *oox_geom_path)
//{
// if (!oox_geom_path) return;
//
// odf_context()->drawing_context()->set_viewBox(oox_geom_path->m_oW.GetValue(), oox_geom_path->m_oH.GetValue());
//
// for (size_t i = 0 ; i < oox_geom_path->m_arrItems.size(); i++)
// {
// convert(oox_geom_path->m_arrItems[i]);
// }
//
// odf_context()->drawing_context()->add_path_element(std::wstring(L"N"), L"");
//
//}
////-----------------------------------------------------------------------------------------------------------------
//void OoxConverter::convert(OOX::Drawing::CEffectList *oox_effect_list, std::wstring *change_sheme_color)
//{
// if (oox_effect_list == NULL) return;
//
// for (size_t i = 0; i < oox_effect_list->m_arrEffects.size(); i++)
// {
// switch(oox_effect_list->m_arrEffects[i]->getType())
// {
// case OOX::et_a_outerShdw:
// {
// OOX::Drawing::COuterShadowEffect * shadow = dynamic_cast<OOX::Drawing::COuterShadowEffect *>(oox_effect_list->m_arrEffects[i]);
// convert(shadow, change_sheme_color);
// }break;
// case OOX::et_a_innerShdw:
// {
// OOX::Drawing::CInnerShadowEffect * shadow = dynamic_cast<OOX::Drawing::CInnerShadowEffect *>(oox_effect_list->m_arrEffects[i]);
// convert(shadow, change_sheme_color);
// }break;
// case OOX::et_a_prstShdw:
// {
// OOX::Drawing::CPresetShadowEffect * shadow = dynamic_cast<OOX::Drawing::CPresetShadowEffect *>(oox_effect_list->m_arrEffects[i]);
// //convert(shadow, change_sheme_color);
// }break;
// case OOX::et_a_reflection:
// {
// OOX::Drawing::CReflectionEffect * refelection = dynamic_cast<OOX::Drawing::CReflectionEffect *>(oox_effect_list->m_arrEffects[i]);
// }
// //CGlowEffect, CBlurEffect, CFillOverlayEffect, CSoftEdgesEffect
// }
// }
//}
//void OoxConverter::convert(OOX::Drawing::COuterShadowEffect *oox_shadow, std::wstring *change_sheme_color)
//{
// if (oox_shadow == NULL) return;
//
// std::wstring hexColor;
// _CP_OPT(double) opacity;
//
// std::wstring keep_sheme_color;
// if (oox_shadow->m_eType == OOX::Drawing::colorSheme && change_sheme_color)
// {
// keep_sheme_color = oox_shadow->m_oShemeClr.m_oVal.ToString();
// oox_shadow->m_oShemeClr.m_oVal.FromString(*change_sheme_color);
// }
// convert(dynamic_cast<OOX::Drawing::CColor*>(oox_shadow), hexColor, opacity);
// if (keep_sheme_color.length() > 0) oox_shadow->m_oShemeClr.m_oVal.FromString(keep_sheme_color);
//
// odf_context()->drawing_context()->set_shadow(1, hexColor, opacity, oox_shadow->m_oDist.ToPoints());
//
// //SimpleTypes::CPositiveFixedAngle<0> m_oDir;
// //SimpleTypes::CPositiveCoordinate<0> m_oBlurRad;
////-------------
// //SimpleTypes::CRectAlignment<SimpleTypes::rectalignmentB> m_oAlgn;
// //SimpleTypes::CFixedAngle<> m_oKx;
// //SimpleTypes::CFixedAngle<> m_oKy;
// //SimpleTypes::COnOff<SimpleTypes::onoffTrue> m_oRotWithShape;
// //SimpleTypes::CPercentage m_oSx;
// //SimpleTypes::CPercentage m_oSy;
//
//}
//void OoxConverter::convert(OOX::Drawing::CInnerShadowEffect *oox_shadow, std::wstring *change_sheme_color)
//{
// if (oox_shadow == NULL) return;
//
// std::wstring hexColor;
// _CP_OPT(double) opacity;
//
// std::wstring keep_sheme_color;
// if (oox_shadow->m_eType == OOX::Drawing::colorSheme && change_sheme_color)
// {
// keep_sheme_color = oox_shadow->m_oShemeClr.m_oVal.ToString();
// oox_shadow->m_oShemeClr.m_oVal.FromString(*change_sheme_color);
// }
// convert(dynamic_cast<OOX::Drawing::CColor*>(oox_shadow), hexColor, opacity);
// if (keep_sheme_color.length() > 0) oox_shadow->m_oShemeClr.m_oVal.FromString(keep_sheme_color);
//
// odf_context()->drawing_context()->set_shadow(2, hexColor, opacity, oox_shadow->m_oDist.ToPoints());
//
//}
//-----------------------------------------------------------------------------------------------------------------
//void OoxConverter::convert(OOX::Drawing::CBlipFillProperties *oox_bitmap_fill, std::wstring *change_sheme_color)
//{
// if (oox_bitmap_fill == NULL)return;
//
// odf_context()->drawing_context()->start_bitmap_style();
// {
// double Width=0, Height = 0;
// if (oox_bitmap_fill->m_oBlip.IsInit())
// {
// std::wstring sID = oox_bitmap_fill->m_oBlip->m_oEmbed.GetValue();
// std::wstring pathImage = find_link_by_id(sID,1);
//
// if (pathImage.length() > 0)
// {
// odf_context()->drawing_context()->set_bitmap_link(pathImage);
// _graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
// }
// else
// {
// sID = oox_bitmap_fill->m_oBlip->m_oLink.GetValue();
// //...
// }
// for (size_t i = 0 ; i < oox_bitmap_fill->m_oBlip->m_arrEffects.size(); i++)
// convert(oox_bitmap_fill->m_oBlip->m_arrEffects[i]);
// }
// if (oox_bitmap_fill->m_oSrcRect.IsInit() && Width > 0 && Height > 0)//часть изображения
// {
// odf_context()->drawing_context()->set_image_client_rect_inch(
// oox_bitmap_fill->m_oSrcRect->m_oL.GetValue() /100. * Width / currentSystemDPI,
// oox_bitmap_fill->m_oSrcRect->m_oT.GetValue() /100. * Height/ currentSystemDPI,
// oox_bitmap_fill->m_oSrcRect->m_oR.GetValue() /100. * Width / currentSystemDPI,
// oox_bitmap_fill->m_oSrcRect->m_oB.GetValue() /100. * Height/ currentSystemDPI);
// }
// if (oox_bitmap_fill->m_oTile.IsInit())
// {
// odf_context()->drawing_context()->set_image_style_repeat(2);
//
// if (oox_bitmap_fill->m_oTile->m_oAlgn.IsInit())
// odf_context()->drawing_context()->set_bitmap_tile_align(oox_bitmap_fill->m_oTile->m_oAlgn->GetValue());
//
// if (oox_bitmap_fill->m_oTile->m_oFlip.IsInit()) {}
//
// if (oox_bitmap_fill->m_oTile->m_oSx.IsInit() && Width >0)
// {
// odf_context()->drawing_context()->set_bitmap_tile_scale_x(oox_bitmap_fill->m_oTile->m_oSx->GetValue() / 100. * Width);
// }
// if (oox_bitmap_fill->m_oTile->m_oSy.IsInit()&& Height >0)
// {
// odf_context()->drawing_context()->set_bitmap_tile_scale_y(oox_bitmap_fill->m_oTile->m_oSy->GetValue() / 100. * Height);
// }
// if (oox_bitmap_fill->m_oTile->m_oTx.IsInit() && Width >0)
// {
// odf_context()->drawing_context()->set_bitmap_tile_translate_x(oox_bitmap_fill->m_oTile->m_oTx->GetValue()*100. / Width );
// }
// if (oox_bitmap_fill->m_oTile->m_oTy.IsInit() && Height >0)
// {
// odf_context()->drawing_context()->set_bitmap_tile_translate_y(oox_bitmap_fill->m_oTile->m_oTy->GetValue()*100. / Height );
// }
// }
// if (oox_bitmap_fill->m_oStretch.IsInit())
// {
// odf_context()->drawing_context()->set_image_style_repeat(1);
// if (oox_bitmap_fill->m_oStretch->m_oFillRect.IsInit()){} //заполнение неполного объема
// }
// }
// odf_context()->drawing_context()->end_bitmap_style();
//}
//
//void OoxConverter::convert(OOX::Drawing::CGradientFillProperties *oox_grad_fill, std::wstring *change_sheme_color)
//{
// if (!oox_grad_fill)return;
//
// odf_context()->drawing_context()->start_gradient_style();
// {
// odf_types::gradient_style::type grad_style = odf_types::gradient_style::linear;
//
// if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypeLinear && oox_grad_fill->m_oLin->m_oAng.IsInit())
// {
// odf_context()->drawing_context()->set_gradient_angle(oox_grad_fill->m_oLin->m_oAng->GetAngle());
// }
// if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypePath && oox_grad_fill->m_oPath->m_oPath.IsInit())
// {
// switch(oox_grad_fill->m_oPath->m_oPath->GetValue())
// {
// case SimpleTypes::pathshadetypeCircle: grad_style = odf_types::gradient_style::radial; break;
// case SimpleTypes::pathshadetypeRect: grad_style = odf_types::gradient_style::rectangular; break;
// case SimpleTypes::pathshadetypeShape: grad_style = odf_types::gradient_style::square; break;
// }
// if (oox_grad_fill->m_oPath->m_oFillToRect.IsInit())
// {
// odf_context()->drawing_context()->set_gradient_rect( oox_grad_fill->m_oPath->m_oFillToRect->m_oL.GetValue(),
// oox_grad_fill->m_oPath->m_oFillToRect->m_oT.GetValue(),
// oox_grad_fill->m_oPath->m_oFillToRect->m_oR.GetValue(),
// oox_grad_fill->m_oPath->m_oFillToRect->m_oB.GetValue());
// }
// }
// odf_context()->drawing_context()->set_gradient_type(grad_style);
//
// if (oox_grad_fill->m_oGsLst.IsInit() && oox_grad_fill->m_oGsLst->m_arrGs.size()>1 && oox_grad_fill->m_oGsLst->m_arrGs[0])
// {
// std::wstring hexColorStart, hexColorEnd;
// _CP_OPT(double) opacityStart, opacityEnd;
//
// if (change_sheme_color && oox_grad_fill->m_oGsLst->m_arrGs[0]->m_eType == OOX::Drawing::colorSheme)
// {
// oox_grad_fill->m_oGsLst->m_arrGs[0]->m_oShemeClr.m_oVal.FromString(*change_sheme_color);
//
// if (oox_grad_fill->m_oGsLst->m_arrGs[oox_grad_fill->m_oGsLst->m_arrGs.size()-1])
// oox_grad_fill->m_oGsLst->m_arrGs[oox_grad_fill->m_oGsLst->m_arrGs.size()-1]->m_oShemeClr.m_oVal.FromString(*change_sheme_color);
// }
// convert((OOX::Drawing::CColor*)(oox_grad_fill->m_oGsLst->m_arrGs[oox_grad_fill->m_oGsLst->m_arrGs.size()-1]),hexColorStart, opacityStart);
//
// convert((OOX::Drawing::CColor*)(oox_grad_fill->m_oGsLst->m_arrGs[0]),hexColorEnd, opacityEnd);
//
// odf_context()->drawing_context()->set_gradient_start(hexColorStart, opacityStart);
// odf_context()->drawing_context()->set_gradient_end (hexColorEnd, opacityEnd);
//
// if (opacityStart || opacityEnd)
// {
// if (!opacityStart) opacityStart = 100;
// if (!opacityEnd) opacityEnd = 100;
//
// if (*opacityStart == *opacityEnd)
// {
// odf_context()->drawing_context()->set_opacity(*opacityStart);
// }
// else
// {
// odf_context()->drawing_context()->start_opacity_style();
// odf_context()->drawing_context()->set_opacity_type (grad_style);
// odf_context()->drawing_context()->set_opacity_start (*opacityStart);
// odf_context()->drawing_context()->set_opacity_end (*opacityEnd);
//
// if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypeLinear && oox_grad_fill->m_oLin->m_oAng.IsInit())
// {
// odf_context()->drawing_context()->set_opacity_angle(oox_grad_fill->m_oLin->m_oAng->GetAngle());
// }
// if (oox_grad_fill->m_eGradType == OOX::Drawing::gradfilltypePath && oox_grad_fill->m_oPath->m_oFillToRect.IsInit())
// {
// odf_context()->drawing_context()->set_opacity_rect (oox_grad_fill->m_oPath->m_oFillToRect->m_oL.GetValue(),
// oox_grad_fill->m_oPath->m_oFillToRect->m_oT.GetValue(),
// oox_grad_fill->m_oPath->m_oFillToRect->m_oR.GetValue(),
// oox_grad_fill->m_oPath->m_oFillToRect->m_oB.GetValue());
// }
// odf_context()->drawing_context()->end_opacity_style();
// }
// }
// }
// }
// odf_context()->drawing_context()->end_gradient_style();
//}
//void OoxConverter::convert(OOX::Drawing::CPatternFillProperties *oox_pattern_fill, std::wstring *change_sheme_color)
//{
// if (!oox_pattern_fill)return;
//
// odf_context()->drawing_context()->start_hatch_style();
// {
// if (oox_pattern_fill->m_oPrst.IsInit())
// {
// odf_context()->drawing_context()->set_hatch_type(oox_pattern_fill->m_oPrst->GetValue());
// }
// if (oox_pattern_fill->m_oFgClr.IsInit())
// {
// std::wstring hexColor;
// _CP_OPT(double) opacity;
// convert((OOX::Drawing::CColor*)oox_pattern_fill->m_oFgClr.GetPointer(),hexColor, opacity);
//
// odf_context()->drawing_context()->set_hatch_line_color(hexColor);
// }
// if (oox_pattern_fill->m_oBgClr.IsInit())
// {
// if (change_sheme_color && oox_pattern_fill->m_oBgClr.IsInit() && oox_pattern_fill->m_oBgClr->m_eType == OOX::Drawing::colorSheme)
// oox_pattern_fill->m_oBgClr->m_oShemeClr.m_oVal.FromString(*change_sheme_color);
//
// std::wstring hexColor;
// _CP_OPT(double) opacity;
// convert((OOX::Drawing::CColor*)oox_pattern_fill->m_oBgClr.GetPointer(),hexColor, opacity);
//
// odf_context()->drawing_context()->set_hatch_area_color(hexColor);
// }
// }
// odf_context()->drawing_context()->end_hatch_style();
//
//}
//void OoxConverter::convert(OOX::Drawing::CSolidColorFillProperties *oox_solid_fill, std::wstring & hexColor , _CP_OPT(double) &opacity)
//{
// switch( oox_solid_fill->m_eType )
// {
// case OOX::Drawing::colorSheme: convert(&oox_solid_fill->m_oShemeClr, hexColor, opacity); break;
// case OOX::Drawing::colorHsl: convert(&oox_solid_fill->m_oHslClr, hexColor, opacity); break;
// case OOX::Drawing::colorPrst: convert(&oox_solid_fill->m_oPrstClr, hexColor, opacity); break;
// case OOX::Drawing::colorScRgb: convert(&oox_solid_fill->m_oScrgbClr, hexColor, opacity); break;
// case OOX::Drawing::colorSRgb: convert(&oox_solid_fill->m_oSrgbClr, hexColor, opacity); break;
// case OOX::Drawing::colorSys: convert(&oox_solid_fill->m_oSysClr, hexColor, opacity); break;
// }
//}
//void OoxConverter::convert(OOX::Drawing::CColor *oox_color, std::wstring & hexColor , _CP_OPT(double) &opacity)
//{
// switch( oox_color->m_eType )
// {
// case OOX::Drawing::colorSheme: convert(&oox_color->m_oShemeClr, hexColor, opacity); break;
// case OOX::Drawing::colorHsl: convert(&oox_color->m_oHslClr, hexColor, opacity); break;
// case OOX::Drawing::colorPrst: convert(&oox_color->m_oPrstClr, hexColor, opacity); break;
// case OOX::Drawing::colorScRgb: convert(&oox_color->m_oScrgbClr, hexColor, opacity); break;
// case OOX::Drawing::colorSRgb: convert(&oox_color->m_oSrgbClr, hexColor, opacity); break;
// case OOX::Drawing::colorSys: convert(&oox_color->m_oSysClr, hexColor, opacity); break;
// }
//}
//void OoxConverter::convert(OOX::Drawing::Colors::CColorTransform *oox_Clr, std::wstring & hexString, _CP_OPT(double) &opacity)
//{
// if (!oox_Clr)return;
// BYTE ucA=0, ucG=0, ucB=0, ucR =0;
// oox_Clr->GetRGBA(ucR,ucG,ucB,ucA);
//
// SimpleTypes::CHexColor<SimpleTypes::hexcolorRGB> *oRgbColor = new SimpleTypes::CHexColor<SimpleTypes::hexcolorRGB>(ucR,ucG,ucB);
// if ((oRgbColor) && (oRgbColor->GetValue() == SimpleTypes::hexcolorRGB ))
// {
// hexString = oRgbColor->ToString().substr(2);//.Right(6);
// delete oRgbColor;
// }
// if (ucA !=255)opacity = (ucA/255.)* 100.;
//}
//
bool OoxConverter::convert(std::wstring sSchemeColor, DWORD & argb)
{
PPTX::Theme * theme= oox_theme();
......@@ -923,329 +353,7 @@ bool OoxConverter::convert(std::wstring sSchemeColor, DWORD & argb)
}
return false;
}
//void OoxConverter::convert(OOX::Drawing::CSchemeColor *oox_ShemeClr, std::wstring & hexString, _CP_OPT(double) &opacity)
//{
// if (!oox_ShemeClr)return;
//
// int theme_ind = oox_ShemeClr->m_oVal.GetValue();
//
// BYTE ucA = 0, ucG = 0, ucB = 0, ucR = 0;
// bool result = convert(theme_ind, ucA, ucG, ucB, ucR);
//
// if (result == true)
// {
// oox_ShemeClr->SetRGBA(ucR,ucG,ucB,ucA);
// oox_ShemeClr->GetRGBA(ucR,ucG,ucB,ucA);
//
// SimpleTypes::CHexColor<SimpleTypes::hexcolorRGB> *oRgbColor = new SimpleTypes::CHexColor<SimpleTypes::hexcolorRGB>(ucR,ucG,ucB);
// if (oRgbColor)
// {
// hexString = oRgbColor->ToString().substr(2);//.Right(6);
// delete oRgbColor;
// }
// if ( ucA != 0xff )opacity = (ucA / 255.) * 100.;
// }
//}
//void OoxConverter::convert(OOX::Drawing::CTextBodyProperties *oox_bodyPr)
//{
// if (!oox_bodyPr) return;
//
// odf_context()->drawing_context()->set_textarea_writing_mode (oox_bodyPr->m_oVert.GetValue());
// odf_context()->drawing_context()->set_textarea_vertical_align (oox_bodyPr->m_oAnchor.GetValue());
//
// _CP_OPT(double) lIns, tIns, rIns, bIns;
//
// lIns = oox_bodyPr->m_oLIns.ToCm();
// tIns = oox_bodyPr->m_oTIns.ToCm();
// rIns = oox_bodyPr->m_oRIns.ToCm();
// bIns = oox_bodyPr->m_oBIns.ToCm();
//
// odf_context()->drawing_context()->set_textarea_padding (lIns, tIns, rIns, bIns);
//
// odf_context()->drawing_context()->set_textarea_wrap(oox_bodyPr->m_oWrap.GetValue());
//
// if (oox_bodyPr->m_oNumCol.GetValue() > 1)
// {
// //+ 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 (size_t i = 0; i < oox_bodyPr->m_oPrstTxWrap->m_oAvLst->m_arrGd.size(); i++)
// {
// if (oox_bodyPr->m_oPrstTxWrap->m_oAvLst->m_arrGd[i] == NULL) continue;
// odf_context()->drawing_context()->add_modifier(oox_bodyPr->m_oPrstTxWrap->m_oAvLst->m_arrGd[i]->m_oFmla.GetValue());
// }
// }
//}
//
//int OoxConverter::convert(OOX::Drawing::CPresetTextShape *oox_text_preset)
//{
// if (oox_text_preset == NULL) return -1;
// if (oox_text_preset->m_oPrst.GetValue() == SimpleTypes::textshapetypeTextNoShape) return 2000;
//
// return 2001 + oox_text_preset->m_oPrst.GetValue();
//}
//void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf_writer::style_text_properties * text_properties)
//{
// if (!oox_run_pr) return;
// if (!text_properties) return;
//
// if (oox_run_pr->m_oBold.IsInit())
// {
// if (oox_run_pr->m_oBold->ToBool() == true)
// text_properties->content().fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WBold);
// else
// text_properties->content().fo_font_weight_ = odf_types::font_weight(odf_types::font_weight::WNormal);
// }
//
// if (oox_run_pr->m_oSolidFill.IsInit())
// {
// std::wstring hexColor;
// _CP_OPT(double) opacity;
// convert(oox_run_pr->m_oSolidFill.GetPointer(),hexColor,opacity);
//
// text_properties->content().fo_color_ = odf_types::color(std::wstring(L"#") + hexColor);
// }
//
// if (oox_run_pr->m_oItalic.IsInit())
// {
// if (oox_run_pr->m_oItalic->ToBool() ==true)
// text_properties->content().fo_font_style_ = odf_types::font_style(odf_types::font_style::Italic);
// else
// text_properties->content().fo_font_style_ = odf_types::font_style(odf_types::font_style::Normal);
// }
// if (oox_run_pr->m_oSz.IsInit())
// {
// convert(oox_run_pr->m_oSz->GetValue()/100., text_properties->content().fo_font_size_);
// convert(oox_run_pr->m_oSz->GetValue()/100., text_properties->content().style_font_size_asian_);
// convert(oox_run_pr->m_oSz->GetValue()/100., text_properties->content().style_font_size_complex_);
// }
// if (oox_run_pr->m_oLatinFont.IsInit())
// {
// if (oox_run_pr->m_oLatinFont->m_oTypeFace.IsInit())
// text_properties->content().fo_font_family_ = oox_run_pr->m_oLatinFont->m_oTypeFace->GetValue();
// else
// {
// text_properties->content().fo_font_family_ = L"Calibri";//default_font; ????
// }
// }
// if (oox_run_pr->m_oAsianFont.IsInit())
// {
// if (oox_run_pr->m_oAsianFont->m_oTypeFace.IsInit())
// text_properties->content().style_font_family_asian_ = oox_run_pr->m_oAsianFont->m_oTypeFace->GetValue();
// else
// {
// }
// }
// if (oox_run_pr->m_oComplexFont.IsInit())
// {
// if (oox_run_pr->m_oComplexFont->m_oTypeFace.IsInit())
// text_properties->content().style_font_family_complex_ = oox_run_pr->m_oComplexFont->m_oTypeFace->GetValue();
// else
// {
// }
// }
// if (oox_run_pr->m_oLanguage.IsInit())
// {
// std::wstring oox_language = oox_run_pr->m_oLanguage->GetValue(), oox_country;
// int res = oox_language.find(L"-");
// if (res >= 0)
// {
// oox_country = oox_language.substr(res);
// oox_language = oox_language.substr(0, res);
// }
//
// text_properties->content().fo_language_ = oox_language;
// if (oox_country.length() > 0)
// text_properties->content().fo_country_ = oox_country;
//
// }
// if (oox_run_pr->m_oSpace.IsInit())
// {
// text_properties->content().fo_letter_spacing_ = odf_types::letter_spacing(odf_types::length(oox_run_pr->m_oSpace->GetValue()/100., odf_types::length::pt));
// }
// if (oox_run_pr->m_oUnderline.IsInit())
// {
// text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Solid);
// text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Single);
//
// SimpleTypes::EUnderline type = oox_run_pr->m_oUnderline->GetValue();
// switch(type)
// {
// case SimpleTypes::underlineNone :
// text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::None);break;
// case SimpleTypes::underlineDash :
// case SimpleTypes::underlineDashedHeavy:
// text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Dash);break;
// case SimpleTypes::underlineDotDash :
// case SimpleTypes::underlineDashDotHeavy:
// text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::DotDash);break;
// case SimpleTypes::underlineDashLong:
// case SimpleTypes::underlineDashLongHeavy:
// text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::LongDash);break;
// case SimpleTypes::underlineDotDotDash:
// case SimpleTypes::underlineDashDotDotHeavy :
// text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::DotDotDash);break;
// case SimpleTypes::underlineDotted:
// case SimpleTypes::underlineDottedHeavy:
// text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Dotted);break;
// case SimpleTypes::underlineWave :
// case SimpleTypes::underlineWavyHeavy :
// text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Wave);break;
// case SimpleTypes::underlineDouble :
// case SimpleTypes::underlineThick :
// text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Double);break;
// case SimpleTypes::underlineWavyDouble :
// text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Double);
// text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Wave);break;
// }
// }
//}
//void OoxConverter::convert(OOX::Drawing::CRun *oox_run)
//{
// if (!oox_run)return;
//
// bool styled = false;
//
// if (oox_run->m_oRunProperty.IsInit())
// {
// odf_writer::style_text_properties * text_properties = odf_context()->text_context()->get_text_properties();
//
// if (!text_properties)
// {
// odf_context()->styles_context()->create_style(L"",odf_types::style_family::Text, true, false, -1);
// text_properties = odf_context()->styles_context()->last_state()->get_text_properties();
// styled = true;
// }
// convert(oox_run->m_oRunProperty.GetPointer(), text_properties);
// }
//
// odf_context()->text_context()->start_span(styled);
// if (oox_run->m_oText.IsInit())
// {
// odf_context()->text_context()->add_text_content( oox_run->m_oText->m_sText);
// }
// odf_context()->text_context()->end_span();
//}
//
//void OoxConverter::convert(OOX::Drawing::CParagraphProperty * oox_paragraph_pr, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties)
//{
// if (!oox_paragraph_pr) return;
// if (!paragraph_properties) return;
//
// if (oox_paragraph_pr->m_oLineSpacing.IsInit())
// {
// odf_types::length_or_percent length;
// convert(oox_paragraph_pr->m_oLineSpacing.GetPointer(), length);
// paragraph_properties->content().fo_line_height_ = odf_types::line_width(length);
// }
// if (oox_paragraph_pr->m_oAfterSpacing.IsInit())
// {
// odf_types::length_or_percent length;
// convert(oox_paragraph_pr->m_oAfterSpacing.GetPointer(), length);
// paragraph_properties->content().fo_margin_bottom_ = length;
// }
// if (oox_paragraph_pr->m_oBeforeSpacing.IsInit())
// {
// odf_types::length_or_percent length;
// convert(oox_paragraph_pr->m_oBeforeSpacing.GetPointer(), length);
// paragraph_properties->content().fo_margin_top_ = length;
// }
// if (oox_paragraph_pr->m_oAlgn.IsInit())
// {
// switch(oox_paragraph_pr->m_oAlgn->GetValue())
// {
// case SimpleTypes::textalignmenttypeL : paragraph_properties->content().fo_text_align_ = odf_types::text_align(odf_types::text_align::Left); break;
// case SimpleTypes::textalignmenttypeCtr : paragraph_properties->content().fo_text_align_ = odf_types::text_align(odf_types::text_align::Center); break;
// case SimpleTypes::textalignmenttypeDist : paragraph_properties->content().fo_text_align_ = odf_types::text_align(odf_types::text_align::Justify); break;
// case SimpleTypes::textalignmenttypeJust : paragraph_properties->content().fo_text_align_ = odf_types::text_align(odf_types::text_align::Justify); break;
// case SimpleTypes::textalignmenttypeR : paragraph_properties->content().fo_text_align_ = odf_types::text_align(odf_types::text_align::Right); break;
// }
// }
// if (oox_paragraph_pr->m_oMarL.IsInit())
// {
// paragraph_properties->content().fo_margin_left_ = odf_types::length_or_percent(odf_types::length(oox_paragraph_pr->m_oMarL->ToCm(),odf_types::length::cm));
// }
// if (oox_paragraph_pr->m_oMarR.IsInit())
// {
// paragraph_properties->content().fo_margin_right_ = odf_types::length_or_percent(odf_types::length(oox_paragraph_pr->m_oMarR->ToCm(),odf_types::length::cm));
// }
// if (oox_paragraph_pr->m_oIndent.IsInit())
// {
// paragraph_properties->content().fo_text_indent_ = odf_types::length_or_percent(odf_types::length(oox_paragraph_pr->m_oIndent->ToCm(),odf_types::length::cm));
// }
// if (oox_paragraph_pr->m_oRtl.IsInit())
// {
// }
// //nullable<SimpleTypes::CDecimalNumber<> > m_oLvl;
// //nullable<SimpleTypes::CCoordinate32<> > m_oDefTabSz;
// //nullable<SimpleTypes::CTextFontAlignType<>> m_oFontAlgn;
//
//
//
// if (oox_paragraph_pr->m_oDefRunProperty.IsInit())//может быть пустым !!!
// {
// odf_writer::style_text_properties * text_properties = odf_context()->text_context()->get_text_properties();
// if (text_properties)
// convert(oox_paragraph_pr->m_oDefRunProperty.GetPointer(), text_properties);
//
// //надо подумать как брать последний по family !!!
// //convert(oox_paragraph_pr->m_oDefRunProperty.GetPointer());
// //odf_context()->text_context()->set_parent_span_style(odf_context()->styles_context()->last_state().get_name());
// }
//
//}
//void OoxConverter::convert(OOX::Drawing::CLineSpacing* oox_spacing, odf_types::length_or_percent & length_or_percent)
//{
// if (!oox_spacing)return;
//
// if (oox_spacing->m_oLineSpacingPercent.IsInit() && oox_spacing->m_oLineSpacingPercent->m_oVal.IsInit())
// {
// odf_types::percent percent = odf_types::percent(oox_spacing->m_oLineSpacingPercent->m_oVal->GetValue());
// length_or_percent = odf_types::length_or_percent(percent);
// }
// if (oox_spacing->m_oLineSpacingPoints.IsInit() && oox_spacing->m_oLineSpacingPoints->m_oVal.IsInit())
// {
// odf_types::length length = odf_types::length(oox_spacing->m_oLineSpacingPoints->m_oVal->ToCm()/100.,odf_types::length::cm);
// length_or_percent = odf_types::length_or_percent(length);
// }
//}
//
//void OoxConverter::convert(OOX::Drawing::CParagraph *oox_paragraph)
//{
// if (!oox_paragraph)return;
//
// bool styled = false;
// if (oox_paragraph->m_oParagraphProperty.IsInit())
// {
// odf_writer::style_paragraph_properties * paragraph_properties = odf_context()->text_context()->get_paragraph_properties();
// //свойства могут быть приписаны не только к параграфу, но и к самому объекту
// if (!paragraph_properties)
// {
// odf_context()->styles_context()->create_style(L"",odf_types::style_family::Paragraph, true, false, -1);
// paragraph_properties = odf_context()->styles_context()->last_state()->get_paragraph_properties();
// styled = true;
// }
// convert(oox_paragraph->m_oParagraphProperty.GetPointer(), paragraph_properties);
// }
//
// odf_context()->text_context()->start_paragraph(styled);
//
// for (size_t i=0; i< oox_paragraph->m_arrItems.size();i++)
// {
// convert(oox_paragraph->m_arrItems[i]);
// }
// odf_context()->text_context()->end_paragraph();
//
//}
//
void OoxConverter::convert(double oox_font_size, _CP_OPT(odf_types::font_size) & odf_font_size)
{
_CP_OPT(odf_types::length) odf_length;
......
......@@ -268,8 +268,8 @@ namespace PPTX
class GraphicFrame;
class SpTree;
class Shape;
class CxnSp;
class Pic;
class Table;
class SmartArt;
class ChartRec;
class SpPr;
......@@ -295,6 +295,8 @@ namespace PPTX
class NvSpPr;
class CNvPr;
class CNvSpPr;
class CNvCxnSpPr;
class NvCxnSpPr;
class NvPr;
class Paragraph;
class TxBody;
......@@ -312,6 +314,10 @@ namespace PPTX
class QuadBezTo;
class CubicBezTo;
class Close;
class EffectStyle;
class InnerShdw;
class OuterShdw;
class PrstShdw;
}
}
......@@ -359,10 +365,12 @@ public:
void convert(PPTX::Logic::GraphicFrame *oox_graphicFrame);
void convert(PPTX::Logic::SpTree *oox_shape_tree);
void convert(PPTX::Logic::Shape *oox_shape);
void convert(PPTX::Logic::CxnSp *oox_connect);
void convert(PPTX::Logic::Pic *oox_pic);
void convert(PPTX::Logic::SpPr *oox_spPr, PPTX::Logic::ShapeStyle* oox_sp_style = NULL);
void convert(PPTX::Logic::TextSpacing *oox_spacing, cpdoccore::odf_types::length_or_percent & length_or_percent);
void convert(PPTX::Logic::Xfrm *oox_xfrm);
void convert(PPTX::Logic::Xfrm *oox_txbx, PPTX::Logic::Xfrm *oox_xfrm);
int convert(PPTX::Logic::PrstTxWarp *oox_text_preset);
void convert(PPTX::Logic::PrstGeom *oox_geom);
void convert(PPTX::Logic::CustGeom *oox_geom);
......@@ -370,8 +378,7 @@ public:
void convert(PPTX::Logic::GradFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::SolidFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::PattFill *oox_fill, DWORD ARGB = 0);
void convert(PPTX::Logic::EffectLst *oox_effect_lst);
void convert(PPTX::Logic::Ln *oox_line);
void convert(PPTX::Logic::Ln *oox_line, DWORD ARGB = 0, PPTX::Logic::ShapeStyle* oox_sp_style = NULL);
void convert(PPTX::Logic::FontRef *oox_fontRef);
void convert(PPTX::Logic::StyleRef *oox_styleRef, int type);
void convert(PPTX::Logic::Path2D *oox_path2D);
......@@ -381,7 +388,9 @@ public:
void convert(PPTX::Logic::UniColor *color, std::wstring & hexString, _CP_OPT(double) & opacity, DWORD ARGB = 0);
void convert(PPTX::Logic::NvSpPr *oox_nvSpPr);
void convert(PPTX::Logic::CNvPr *oox_cnvPr);
void convert(PPTX::Logic::CNvCxnSpPr *oox_cnvPr);
void convert(PPTX::Logic::CNvSpPr *oox_cnvSpPr);
void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvPr *oox_nvPr);
void convert(PPTX::Logic::Paragraph *oox_para);
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
......@@ -394,13 +403,18 @@ public:
void convert(PPTX::Logic::NvGraphicFramePr *oox_framePr);
void convert(PPTX::Logic::ChartRec *oox_chart);
void convert(PPTX::Logic::SmartArt *oox_smart_art);
void convert(PPTX::Logic::Table *oox_table);
void convert(PPTX::Logic::LineTo *oox_geom_path);
void convert(PPTX::Logic::MoveTo *oox_geom_path);
void convert(PPTX::Logic::ArcTo *oox_geom_path);
void convert(PPTX::Logic::QuadBezTo *oox_geom_path);
void convert(PPTX::Logic::CubicBezTo *oox_geom_path);
void convert(PPTX::Logic::Close *oox_geom_path);
void convert(PPTX::Logic::EffectStyle *oox_effect);
void convert(PPTX::Logic::EffectLst *oox_effect_list);
void convert(PPTX::Logic::InnerShdw *oox_effect);
void convert(PPTX::Logic::OuterShdw *oox_effect);
void convert(PPTX::Logic::PrstShdw *oox_effect);
//.chart............................................................................................................................
void convert(OOX::Spreadsheet::CT_ChartSpace *oox_chart);
void convert(OOX::Spreadsheet::CT_Title *ct_title);
......
......@@ -3011,8 +3011,8 @@ void DocxConverter::convert(OOX::CDocDefaults *def_style)
/////////////////////////////////////////////////////////////////////////////////////////////////
//зачемто ?! для OpenOffice для врезок/фреймов нужен базовый стиль - без него другой тип геометрии oO !!!
odt_context->styles_context()->create_style(L"Frame", odf_types::style_family::Graphic,false,true);
odf_writer::style_graphic_properties * graphic_properties = odt_context->styles_context()->last_state()->get_graphic_properties();
odt_context->styles_context()->create_style(L"Frame", odf_types::style_family::Graphic,false, true);
odf_writer::graphic_format_properties * graphic_properties = odt_context->styles_context()->last_state()->get_graphic_properties();
//if (graphic_properties)graphic_properties->content_.common_background_color_attlist_.fo_background_color_ = odf_types::background_color(odf_types::background_color::Transparent);
}
......@@ -3876,7 +3876,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
}
}
odt_context->start_table_cell( oox_table_cell->m_nNumCol,covered, convert(oox_table_cell->m_oTableCellProperties, oox_table_cell->m_nNumCol+1));
odt_context->start_table_cell( oox_table_cell->m_nNumCol, covered, convert(oox_table_cell->m_oTableCellProperties, oox_table_cell->m_nNumCol + 1));
if (oox_table_cell->m_oTableCellProperties)
{
......@@ -3909,7 +3909,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
if (id_change_properties >= 0)
odt_context->end_change(id_change_properties, 3);
}
bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer::style_table_properties * table_properties )
bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer::style_table_properties * table_properties )
{
if (oox_table_pr == NULL) return false;
if (table_properties == NULL) return false;
......
......@@ -35,6 +35,7 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Folder.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Presentation.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Slide.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/Table.h"
#include <boost/lexical_cast.hpp>
......@@ -80,9 +81,10 @@ PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback*
output_document = new odf_writer::package::odf_document(L"presentation");
odp_context = new odf_writer::odp_conversion_context(output_document);
current_clrMap = NULL;
current_slide = NULL;
current_theme = NULL;
current_clrMap = NULL;
current_slide = NULL;
current_theme = NULL;
current_tableStyles = NULL;
pCallBack = CallBack;
......@@ -90,10 +92,11 @@ PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback*
}
PptxConverter::~PptxConverter()
{
current_clrMap = NULL;
current_slide = NULL;
current_theme = NULL;
presentation = NULL;
current_tableStyles = NULL;
current_clrMap = NULL;
current_slide = NULL;
current_theme = NULL;
presentation = NULL;
if (odp_context) delete odp_context; odp_context = NULL;
if (pptx_document) delete pptx_document; pptx_document = NULL;
......@@ -223,15 +226,15 @@ void PptxConverter::convert_slides()
{
continue;// странное ... слайд 38 в FY10_September_Partner_Call.pptx
}
current_theme = slide->theme.operator->();
current_theme = slide->theme.operator->();
current_clrMap = NULL;
std::wstring master_style_name;
std::wstring layout_style_name;
if (slide->Master.IsInit())
{
current_clrMap = &slide->Master->clrMap;
current_clrMap = &slide->Master->clrMap;
// Master & Layout
std::wstring master_layout = slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename;
......@@ -253,6 +256,8 @@ void PptxConverter::convert_slides()
current_slide = slide->Master.operator->();
convert(&slide->Master->cSld, false);//slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true);
if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->();
convert(&slide->Layout->cSld, false);
odp_context->end_master_slide();
......@@ -260,13 +265,18 @@ void PptxConverter::convert_slides()
m_mapMasters.insert(std::make_pair(master_layout, master_style_name));
}
else
{
master_style_name = pFind->second;
}
}
current_clrMap = &slide->Master->clrMap; //after layout
if (slide->clrMapOvr.IsInit())
if (slide->clrMapOvr.IsInit() && slide->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = slide->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide.operator->();
current_tableStyles = slide->tableStyles_.operator->();
current_slide = slide.operator->();
odp_context->start_slide();
odp_context->current_slide().set_master_page(master_style_name);
......@@ -305,6 +315,465 @@ void PptxConverter::convert(OOX::WritingElement *oox_unknown)
}
}
void PptxConverter::convert(PPTX::Logic::TableProperties *oox_table_pr)
{
if (!oox_table_pr) return;
odp_context->drawing_context()->start_area_properties();
odp_context->drawing_context()->set_no_fill();
odp_context->drawing_context()->end_area_properties();
if (oox_table_pr->TableStyleId.IsInit() && current_tableStyles)
{
std::map<std::wstring, PPTX::Logic::TableStyle>::iterator pFind;
pFind = current_tableStyles->Styles.find(oox_table_pr->TableStyleId.get());
if (pFind != current_tableStyles->Styles.end())
{
PPTX::Logic::TableStyle & table_style = pFind->second;
if (table_style.tblBg.IsInit())
{
}
convert(table_style.wholeTbl.GetPointer());
}
}
if (oox_table_pr->Fill.is_init())
{
odp_context->drawing_context()->start_area_properties();
OoxConverter::convert(&oox_table_pr->Fill);
odp_context->drawing_context()->end_area_properties();
}
//EffectProperties Effects;
//nullable_bool Rtl;
//nullable_bool FirstRow;
//nullable_bool FirstCol;
//nullable_bool LastRow;
//nullable_bool LastCol;
//nullable_bool BandRow;
//nullable_bool BandCol;
}
void PptxConverter::convert(PPTX::Logic::TablePartStyle *oox_table_part_style)
{
if (!oox_table_part_style) return;
if (oox_table_part_style->tcStyle.IsInit())
{
odp_context->drawing_context()->start_area_properties();
if (oox_table_part_style->tcStyle->fill.IsInit())
OoxConverter::convert(&oox_table_part_style->tcStyle->fill->Fill);
else
OoxConverter::convert(oox_table_part_style->tcStyle->fillRef.GetPointer());
odp_context->drawing_context()->end_area_properties();
odp_context->drawing_context()->start_line_properties();
convert(oox_table_part_style->tcStyle->tcBdr.GetPointer());
odp_context->drawing_context()->end_line_properties();
}
if (oox_table_part_style->tcTxStyle.IsInit())
{
}
}
void PptxConverter::convert(PPTX::Logic::Table *oox_table)
{
if (!oox_table) return;
odp_context->slide_context()->start_table();
convert(oox_table->tableProperties.GetPointer());
odp_context->slide_context()->start_table_columns();
for (size_t i = 0; i < oox_table->TableCols.size(); i++)
{
double width = -1;
if (oox_table->TableCols[i].Width.IsInit())
width = oox_table->TableCols[i].Width.get() / 12700.;
odp_context->slide_context()->add_table_column(width);
}
odp_context->slide_context()->end_table_columns();
for (size_t i = 0; i < oox_table->TableRows.size(); i++)
{
convert(&oox_table->TableRows[i]);
}
odp_context->slide_context()->end_table();
}
void PptxConverter::convert(PPTX::Logic::TableRow *oox_table_row)
{
odp_context->slide_context()->start_table_row(oox_table_row->Height.IsInit());
if (!oox_table_row) return;
if (oox_table_row->Height.IsInit())
{
odf_writer::style_table_row_properties * table_row_properties = odp_context->styles_context()->last_state()->get_table_row_properties();
table_row_properties->style_table_row_properties_attlist_.style_row_height_ = odf_types::length(oox_table_row->Height.get() / 12700., odf_types::length::pt);
// table_row_properties->style_table_row_properties_attlist_.style_min_row_height_
}
for (size_t i = 0; i < oox_table_row->Cells.size(); i++)
{
convert(&oox_table_row->Cells[i], i);
}
odp_context->slide_context()->end_table_row();
}
void PptxConverter::convert(PPTX::Logic::TableCell *oox_table_cell, int numCol)
{
if (!oox_table_cell) return;
bool covered = false, styled = false;
if (oox_table_cell->VMerge.IsInit() || oox_table_cell->HMerge.IsInit())
covered = true;
if (oox_table_cell->CellProperties.IsInit())
styled = (oox_table_cell->CellProperties->is_empty == false);
odp_context->slide_context()->start_table_cell(numCol, covered, styled);
if (oox_table_cell->RowSpan.IsInit())
odp_context->slide_context()->table_context()->set_cell_row_span(oox_table_cell->RowSpan.get());
if (oox_table_cell->GridSpan.IsInit())
odp_context->slide_context()->table_context()->set_cell_column_span(oox_table_cell->GridSpan.get());
convert(oox_table_cell->CellProperties.GetPointer(), numCol + 1);
OoxConverter::convert(oox_table_cell->txBody.GetPointer());
//nullable_string Id;
odp_context->slide_context()->end_table_cell();
}
bool PptxConverter::convert(PPTX::Logic::TableCellProperties *oox_table_cell_pr, int col)
{
if (!oox_table_cell_pr) return false;
if (oox_table_cell_pr->is_empty) return false;
bool is_base_styled = odp_context->slide_context()->table_context()->is_styled();
if (col < 0) col = odp_context->slide_context()->table_context()->current_column() + 1;
int row = odp_context->slide_context()->table_context()->current_row();
odf_writer::style_table_cell_properties * parent_cell_properties = NULL;
std::wstring parent_name = odp_context->slide_context()->table_context()->get_default_cell_properties();
if (!parent_name.empty())
{
odf_writer::style * style_ = NULL;
if (odp_context->styles_context()->find_odf_style(parent_name, odf_types::style_family::TableCell, style_))
{
parent_cell_properties = style_->content_.get_style_table_cell_properties();
}
}
if (oox_table_cell_pr == NULL && is_base_styled == false && parent_cell_properties == NULL) return false;
odf_writer::style_table_cell_properties *cell_properties = odp_context->styles_context()->last_state()->get_table_cell_properties();
if (cell_properties == NULL) return false;
//if (is_base_styled)
//{
// odf_writer::style_text_properties * text_properties = odp_context->styles_context()->last_state()->get_text_properties();
// odf_writer::style_paragraph_properties * paragraph_properties = odp_context->styles_context()->last_state()->get_paragraph_properties();
// odf_writer::style_graphic_properties * graphic_properties = odp_context->styles_context()->last_state()->get_graphic_properties();
//
// if (col < 0)
// col = odp_context->slide_context()->table_context()->current_column() + 1;
// int row = odp_context->slide_context()->table_context()->current_row();
//
// odp_context->styles_context()->table_styles().get_table_cell_properties (col, row, cell_properties);
// odp_context->styles_context()->table_styles().get_text_properties (col, row, text_properties);
// odp_context->styles_context()->table_styles().get_paragraph_properties (col, row, paragraph_properties);
// odp_context->styles_context()->table_styles().get_graphic_properties (col, row, graphic_properties);
//}
cell_properties->apply_from(parent_cell_properties);
//check for inside cell or not
_CP_OPT(std::wstring) border_inside_v = odp_context->slide_context()->table_context()->get_table_inside_v();
_CP_OPT(std::wstring) border_inside_h = odp_context->slide_context()->table_context()->get_table_inside_h();
if ((border_inside_v || border_inside_h))
{
if (cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_)//раскидаем по сторонам
{
if (cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_->is_none() == false)
{
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_left_ =
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ =
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ =
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_top_ =
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_;
}
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_ = boost::none;
}
//если нет убрать, если да - добавить
if (border_inside_h)
{
int del_border = border_inside_h->find(L"none");
if (row != 1)
{
if (cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_top_ && del_border>=0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_top_ = boost::none;
else if (border_inside_h && del_border<0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_top_ = *border_inside_h;
}
if (row != odp_context->slide_context()->table_context()->count_rows())
{
if (cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ && del_border>=0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ = boost::none;
else if (border_inside_h && del_border<0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ = *border_inside_h;
}
}
if (border_inside_v)
{
int del_border = border_inside_v->find(L"none");
if (col != 1)
{
if (cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_left_ && del_border>=0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_left_ = boost::none;
else if (border_inside_h && del_border<0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_left_ = *border_inside_h;
}
if (col != odp_context->slide_context()->table_context()->count_columns())
{
if (cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ && del_border>=0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ = boost::none;
else if (border_inside_h && del_border<0)
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ = *border_inside_h;
}
}
}
bool res = convert(oox_table_cell_pr); //last state
return true;
}
void PptxConverter::convert(PPTX::Logic::Ln *oox_border, std::wstring & odf_border_prop)
{
odf_border_prop = L"";
if (!oox_border) return;
odp_context->drawing_context()->start_line_properties();
OoxConverter::convert(oox_border);
odp_context->drawing_context()->end_line_properties();
//-----------------------------------------------------------------------------------------------------
std::wstringstream border_style;
std::wstring border_color;
odf_types::length length = odf_types::length(oox_border->w.IsInit() ? oox_border->w.get() / 12700. : 1, odf_types::length::pt);
border_style << length;
_CP_OPT(odf_types::color) color = odp_context->drawing_context()->get_line_color();
if (oox_border->prstDash.IsInit() && oox_border->prstDash->val.IsInit())
{
switch(oox_border->prstDash->val->GetBYTECode())
{
case 0:
case 3:
case 7:
case 1: border_style << L" dashed"; break;
case 10:
case 2: border_style << L" dotted"; break;
case 4:
case 8: border_style << L" dash-dot"; break;
case 5:
case 9: border_style << L" dash-dot-dot";break;
case 6:
default: border_style << L" solid";
}
}else border_style << L" solid";
if (color) border_style << L" " << color.get();
else border_style << L" #000000";
odf_border_prop = border_style.str();
}
void PptxConverter::convert(PPTX::Logic::TcBdr *oox_table_borders)
{
if (!oox_table_borders) return;
//НИ ГРАФИКА НИ СВОЙСТВА ЯЧЕЕК .. ПАРАГРАФ блять !! - идиетский odf !!!
//odf_writer::style_table_cell_properties *odf_cell_props = odp_context->styles_context()->last_state(odf_types::style_family::TableCell)->get_table_cell_properties();
odf_writer::style_paragraph_properties *odf_para_props = odp_context->styles_context()->last_state(odf_types::style_family::TableCell)->get_paragraph_properties();
std::wstring left, right, top, bottom, other2BR, other2BL;
if (oox_table_borders->left.IsInit())
{
convert(oox_table_borders->left->ln.GetPointer(), left);
//if (left.empty())
// convert(oox_table_borders->left->lnRef.GetPointer(), left); //todooo
}
if (oox_table_borders->right.IsInit())
{
convert(oox_table_borders->right->ln.GetPointer(), right);
}
if (oox_table_borders->top.IsInit())
{
convert(oox_table_borders->top->ln.GetPointer(), top);
}
if (oox_table_borders->bottom.IsInit())
{
convert(oox_table_borders->bottom->ln.GetPointer(), bottom);
}
if (oox_table_borders->tl2br.IsInit())
{
convert(oox_table_borders->tl2br->ln.GetPointer(), other2BR);
}
if (oox_table_borders->tr2bl.IsInit())
{
convert(oox_table_borders->tr2bl->ln.GetPointer(), other2BL);
}
if (bottom == top && top == left && left== right && bottom.length() > 0)
{
odf_para_props->content_.common_border_attlist_.fo_border_ = left;
odf_para_props->content_.common_border_attlist_.fo_border_bottom_ =
odf_para_props->content_.common_border_attlist_.fo_border_top_ =
odf_para_props->content_.common_border_attlist_.fo_border_left_ =
odf_para_props->content_.common_border_attlist_.fo_border_right_ = boost::none;
}
else
{
if (odf_para_props->content_.common_border_attlist_.fo_border_)
{
odf_para_props->content_.common_border_attlist_.fo_border_bottom_ =
odf_para_props->content_.common_border_attlist_.fo_border_top_ =
odf_para_props->content_.common_border_attlist_.fo_border_left_ =
odf_para_props->content_.common_border_attlist_.fo_border_right_ = odf_para_props->content_.common_border_attlist_.fo_border_;
}
odf_para_props->content_.common_border_attlist_.fo_border_ = boost::none;
if ( !bottom.empty() ) odf_para_props->content_.common_border_attlist_.fo_border_bottom_ = bottom;
if ( !top.empty() ) odf_para_props->content_.common_border_attlist_.fo_border_top_ = top;
if ( !left.empty() ) odf_para_props->content_.common_border_attlist_.fo_border_left_ = left;
if ( !right.empty() ) odf_para_props->content_.common_border_attlist_.fo_border_right_ = right;
}
//if (other2BR.empty() == false) odf_para_props->content_.style_diagonal_tl_br_ = other2BR;
//if (other2BL.empty() == false) odf_para_props->content_.style_diagonal_bl_tr_ = other2BL;
}
bool PptxConverter::convert(PPTX::Logic::TableCellProperties *oox_table_cell_pr)
{
if (!oox_table_cell_pr) return false;
odf_writer::style_table_cell_properties *odf_cell_props = odp_context->styles_context()->last_state()->get_table_cell_properties();
odf_writer::style_paragraph_properties *odf_para_props = odp_context->styles_context()->last_state(odf_types::style_family::TableCell)->get_paragraph_properties();
if (!odf_para_props) return false;
if (oox_table_cell_pr->Fill.is_init())
{
odp_context->drawing_context()->start_area_properties();
OoxConverter::convert(&oox_table_cell_pr->Fill);
odp_context->drawing_context()->end_area_properties();
}
//if (oox_table_cell_pr->Vert.IsInit())
//{
// switch(oox_table_cell_pr->Vert->GetBYTECode())
// {
// case 1 :
// odf_para_props->content_.style_direction_ = odf_types::direction(odf_types::direction::Ltr);break;
// case 6 ://rtl vert
// break;
// default:
// odf_para_props->content_.style_direction_ = odf_types::direction(odf_types::direction::Ttb);break;
// }
//}
if (oox_table_cell_pr->MarL.IsInit())
{
odf_cell_props->style_table_cell_properties_attlist_.common_padding_attlist_.fo_padding_left_ = odf_types::length(oox_table_cell_pr->MarL.get() / 12700., odf_types::length::pt);
}
if (oox_table_cell_pr->MarR.IsInit())
{
odf_cell_props->style_table_cell_properties_attlist_.common_padding_attlist_.fo_padding_right_ = odf_types::length(oox_table_cell_pr->MarR.get() / 12700., odf_types::length::pt);
}
if (oox_table_cell_pr->MarT.IsInit())
{
odf_cell_props->style_table_cell_properties_attlist_.common_padding_attlist_.fo_padding_top_ = odf_types::length(oox_table_cell_pr->MarT.get() / 12700., odf_types::length::pt);
}
if (oox_table_cell_pr->MarB.IsInit())
{
odf_cell_props->style_table_cell_properties_attlist_.common_padding_attlist_.fo_padding_bottom_ = odf_types::length(oox_table_cell_pr->MarB.get() / 12700., odf_types::length::pt);
}
if (oox_table_cell_pr->Vert.IsInit())
{
switch(oox_table_cell_pr->Vert->GetBYTECode())
{
//case SimpleTypes::verticaljcBoth : //??????
// odf_para_props->content_.style_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Justify); break;
//case SimpleTypes::verticaljcBottom :
// odf_para_props->content_.style_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Bottom); break;
//case SimpleTypes::verticaljcCenter :
// odf_para_props->content_.style_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Middle); break;
//case SimpleTypes::verticaljcTop :
// odf_para_props->content_.style_vertical_align_ = odf_types::vertical_align(odf_types::vertical_align::Top); break;
}
}
//borders
std::wstring left, right, top, bottom, other;
convert(oox_table_cell_pr->LnB.GetPointer(), bottom);
convert(oox_table_cell_pr->LnT.GetPointer(), top);
convert(oox_table_cell_pr->LnL.GetPointer(), left);
convert(oox_table_cell_pr->LnR.GetPointer(), right);
if (bottom == top && top == left && left== right && bottom.length() > 0)
{
odf_para_props->content_.common_border_attlist_.fo_border_ = left;
odf_para_props->content_.common_border_attlist_.fo_border_bottom_ =
odf_para_props->content_.common_border_attlist_.fo_border_top_ =
odf_para_props->content_.common_border_attlist_.fo_border_left_ =
odf_para_props->content_.common_border_attlist_.fo_border_right_ = boost::none;
}
else
{
if (odf_para_props->content_.common_border_attlist_.fo_border_)
{
odf_para_props->content_.common_border_attlist_.fo_border_bottom_ =
odf_para_props->content_.common_border_attlist_.fo_border_top_ =
odf_para_props->content_.common_border_attlist_.fo_border_left_ =
odf_para_props->content_.common_border_attlist_.fo_border_right_ = odf_para_props->content_.common_border_attlist_.fo_border_;
}
odf_para_props->content_.common_border_attlist_.fo_border_ = boost::none;
if ( !bottom.empty() ) odf_para_props->content_.common_border_attlist_.fo_border_bottom_ = bottom;
if ( !top.empty() ) odf_para_props->content_.common_border_attlist_.fo_border_top_ = top;
if ( !left.empty() ) odf_para_props->content_.common_border_attlist_.fo_border_left_ = left;
if ( !right.empty() ) odf_para_props->content_.common_border_attlist_.fo_border_right_ = right;
}
//convert(oox_border->m_oTL2BR.GetPointer() , other);
//if (other.empty() == false) odf_para_props->content_.style_diagonal_tl_br_ = other;
//
//convert(oox_border->m_oTR2BL.GetPointer() , other);
//if (other.empty() == false)
//{
// odf_para_props->content_.style_diagonal_bl_tr_ = other;
//}
return true;
}
void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
{
if (!oox_background) return;
......@@ -334,6 +803,10 @@ void PptxConverter::convert(PPTX::Logic::CSld *oox_slide, bool placeholders)
{
if (oox_slide == NULL) return;
if (current_theme && current_clrMap)
current_theme->SetColorMap(*current_clrMap);
if (oox_slide->attrName.IsInit())
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
......@@ -356,7 +829,6 @@ void PptxConverter::convert(PPTX::Logic::CSld *oox_slide, bool placeholders)
//convert(oox_slide->spTree.SpTreeElems[i].GetElem().operator->());
}
convert(oox_slide->controls.GetPointer());
}
......
......@@ -46,6 +46,7 @@ namespace OOX
}
namespace PPTX
{
class TableStyles;
class Presentation;
class Folder;
......@@ -55,6 +56,13 @@ namespace PPTX
class Bg;
class Transition;
class Timing;
class TablePartStyle;
class Table;
class TableProperties;
class TableRow;
class TableCell;
class TableCellProperties;
class TcBdr;
}
}
......@@ -95,15 +103,29 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown);
void convert(PPTX::Logic::CSld *oox_slide, bool placeholders = true);
void convert(PPTX::Logic::Bg *oox_background);
private:
void convert(PPTX::Logic::CSld *oox_slide, bool placeholders = true);
void convert(PPTX::Logic::Bg *oox_background);
void convert(PPTX::Logic::Table *oox_table);
void convert(PPTX::Logic::TableRow *oox_table_row);
void convert(PPTX::Logic::TableCell *oox_table_cell, int numCol);
void convert(PPTX::Logic::TablePartStyle *oox_table_part_style);
bool convert(PPTX::Logic::TableCellProperties *oox_table_cell_pr, int col);
bool convert(PPTX::Logic::TableCellProperties *oox_table_cell_pr);
void convert(PPTX::Logic::TableProperties *oox_table_pr);
void convert(PPTX::Logic::TcBdr *oox_table_borders);
void convert(PPTX::Logic::Ln *oox_ln_border, std::wstring & odf_border);
private:
PPTX::Folder *pptx_document;
PPTX::Presentation *presentation;
cpdoccore::odf_writer::package::odf_document *output_document;
PPTX::Theme *current_theme;
PPTX::Theme *current_theme;
PPTX::TableStyles *current_tableStyles;
OOX::IFileContainer *current_slide;
PPTX::Logic::ClrMap *current_clrMap;
......
......@@ -122,8 +122,6 @@ namespace PPTX
List->toXmlWriter(pWriter);
}
//public:
private:
nullable<WrapperWritingElement> List;
protected:
virtual void FillParentPointersForChilds(){};
......
......@@ -52,6 +52,7 @@ namespace PPTX
TableCellProperties()
{
is_empty = true;
}
TableCellProperties& operator=(const TableCellProperties& oSrc)
......@@ -76,6 +77,9 @@ namespace PPTX
Anchor = oSrc.Anchor;
AnchorCtr = oSrc.AnchorCtr;
HorzOverflow = oSrc.HorzOverflow;
is_empty = oSrc.is_empty;
return *this;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
......@@ -107,9 +111,13 @@ namespace PPTX
else
Fill.fromXML(oReader);
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
is_empty = (oReader.GetAttributesCount() == 0);
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("marL"), MarL )
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("marR"), MarR )
......@@ -123,6 +131,8 @@ namespace PPTX
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
is_empty = (node.GetAttributesCount() == 0);
LnL = node.ReadNode(_T("a:lnL"));
LnR = node.ReadNode(_T("a:lnR"));
LnT = node.ReadNode(_T("a:lnT"));
......@@ -324,7 +334,6 @@ namespace PPTX
pReader->Seek(_end_rec);
}
public:
nullable<Ln> LnL;
nullable<Ln> LnR;
nullable<Ln> LnT;
......@@ -335,17 +344,22 @@ namespace PPTX
UniFill Fill;
// <xsd:element name="headers" type="CT_Headers" minOccurs="0"/>
nullable_int MarL;//default="91440"
nullable_int MarR;//default="91440"
nullable_int MarT;//default="45720"
nullable_int MarB;//default="45720"
nullable_limit<Limit::TextVerticalType> Vert;//default="horz"
nullable_limit<Limit::TextAnchor> Anchor;//default="t"
nullable_bool AnchorCtr;//default="false"
nullable_limit<Limit::HorzOverflow> HorzOverflow;//default="clip"
nullable_int MarL; //default="91440"
nullable_int MarR; //default="91440"
nullable_int MarT; //default="45720"
nullable_int MarB; //default="45720"
nullable_limit<Limit::TextVerticalType> Vert; //default="horz"
nullable_limit<Limit::TextAnchor> Anchor; //default="t"
nullable_bool AnchorCtr; //default="false"
nullable_limit<Limit::HorzOverflow> HorzOverflow; //default="clip"
bool is_empty;
protected:
virtual void FillParentPointersForChilds()
{
is_empty = is_empty & !(LnL.IsInit() || LnR.IsInit() || LnT.IsInit() || LnB.IsInit() || LnTlToBr.IsInit() || LnBlToTr.IsInit() ||
cell3D.IsInit() || Fill.is_init());
if(LnL.IsInit())
LnL->SetParentPointer(this);
if(LnR.IsInit())
......
......@@ -618,7 +618,7 @@ namespace OOX
CTableCellProperties *GetProperties()
{
for ( size_t nIndex = m_arrItems.size() - 1; nIndex >= 0; nIndex-- )
for ( int nIndex = (int)m_arrItems.size() - 1; nIndex >= 0; nIndex-- )
{
if ( m_arrItems[nIndex] && OOX::et_w_tcPr == m_arrItems[nIndex]->getType() )
{
......
......@@ -208,6 +208,8 @@ namespace XmlUtils
std::wstring ReadAttributeBase(const wchar_t* bstrName);
std::wstring ReadAttribute(const std::wstring& strAttibuteName);
int GetAttributesCount();
std::string GetAttributeA(const std::string& sName, const std::string& _default = "");
std::string GetAttributeA(const std::wstring& sName, const std::string& _default = "");
......
......@@ -434,6 +434,15 @@ namespace XmlUtils
{
return GetAttribute(std::wstring(strAttributeName), strDefaultValue);
}
int CXmlNode::GetAttributesCount()
{
if (IsValid())
{
return m_pBase->m_attributes.size();
}
else
return 0;
}
bool CXmlNode::GetAttributeIfExist(const std::wstring& sName, std::wstring& sOutput)
{
bool bRes = false;
......
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