Commit 4ec04c31 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormat ...

parent 8774035b
...@@ -118,21 +118,22 @@ void pptx_conversion_context::process_layouts() ...@@ -118,21 +118,22 @@ void pptx_conversion_context::process_layouts()
{ {
for (size_t i = 0; i < master->content_.size(); i++) for (size_t i = 0; i < master->content_.size(); i++)
{ {
odf_reader::office_element_ptr elm = master->content_[i]; odf_reader::draw_frame* frame = dynamic_cast<odf_reader::draw_frame*>(master->content_[i].get());
if (elm->get_type() == odf_reader::typeDrawFrame) if (frame)
{ {
odf_reader::draw_frame* frame = dynamic_cast<odf_reader::draw_frame *>(elm.get()); odf_types::common_presentation_attlist &common_presentation_attlist_= frame->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
if ((frame) && (frame->common_presentation_attlist_.presentation_class_)) if (common_presentation_attlist_.presentation_class_)
{ {
odf_types::presentation_class::type type = frame->common_presentation_attlist_.presentation_class_->get_type(); odf_types::presentation_class::type type = common_presentation_attlist_.presentation_class_->get_type();
if (type==odf_types::presentation_class::footer || if (type == odf_types::presentation_class::footer ||
type==odf_types::presentation_class::date_time || type == odf_types::presentation_class::date_time ||
type==odf_types::presentation_class::header || type == odf_types::presentation_class::header ||
type==odf_types::presentation_class::page_number) type == odf_types::presentation_class::page_number)
{ {
if (frame->idx_in_owner <0)frame->idx_in_owner = last_idx_placeHolder++; if (frame->idx_in_owner <0)
frame->idx_in_owner = last_idx_placeHolder++;
frame->pptx_convert_placeHolder(*this); frame->pptx_convert_placeHolder(*this);
} }
......
...@@ -472,115 +472,35 @@ public: ...@@ -472,115 +472,35 @@ public:
}; };
// common-draw-style-name-attlist
class common_draw_style_name_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_style_name_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(std::wstring) draw_class_names_;
_CP_OPT(std::wstring) presentation_style_name_;
_CP_OPT(std::wstring) presentation_class_names_;
};
/// common-draw-z-index-attlist
class common_draw_z_index_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_z_index_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(int) draw_z_index_;
};
/// common-draw-id-attlist
class common_draw_id_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_id_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_id_;
};
/// common-draw-layer-name-attlist
class common_draw_layer_name_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_layer_name_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_layer_;
};
/// common-draw-transform-attlist
class common_draw_transform_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_transform_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_transform_;
};
class common_draw_name_attlist
{
public:
void add_attributes (const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_draw_name_attlist & Other);
void serialize (CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_name_;
};
class common_text_spreadsheet_shape_attlist class common_shape_table_attlist
{ {
public: public:
void add_attributes (const xml::attributes_wc_ptr & Attributes ); void add_attributes (const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_text_spreadsheet_shape_attlist & Other); void apply_from (const common_shape_table_attlist & Other);
void serialize (CP_ATTR_NODE); void serialize (CP_ATTR_NODE);
_CP_OPT(std::wstring) table_end_cell_address_; _CP_OPT(std::wstring) table_end_cell_address_;
_CP_OPT(length) table_end_x_; _CP_OPT(length) table_end_x_;
_CP_OPT(length) table_end_y_; _CP_OPT(length) table_end_y_;
_CP_OPT(Bool) table_table_background_; _CP_OPT(Bool) table_table_background_;
common_text_anchor_attlist common_text_anchor_attlist_;
}; };
class common_draw_shape_with_styles_attlist class common_shape_draw_attlist
{ {
public: public:
void add_attributes (const xml::attributes_wc_ptr & Attributes ); void add_attributes (const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_draw_shape_with_styles_attlist & Other); void apply_from (const common_shape_draw_attlist & Other);
void serialize (CP_ATTR_NODE); void serialize (CP_ATTR_NODE);
common_draw_z_index_attlist common_draw_z_index_attlist_; _CP_OPT(std::wstring) draw_style_name_;
common_draw_id_attlist common_draw_id_attlist_; _CP_OPT(std::wstring) draw_text_style_name_;
common_draw_layer_name_attlist common_draw_layer_name_attlist_; _CP_OPT(std::wstring) draw_class_names_;
common_draw_style_name_attlist common_draw_style_name_attlist_; _CP_OPT(std::wstring) draw_name_;
common_draw_transform_attlist common_draw_transform_attlist_; _CP_OPT(std::wstring) draw_id_;
common_draw_name_attlist common_draw_name_attlist_; _CP_OPT(std::wstring) draw_layer_;
common_text_spreadsheet_shape_attlist common_text_spreadsheet_shape_attlist_; _CP_OPT(std::wstring) draw_transform_;
_CP_OPT(int) draw_z_index_;
};
class common_draw_text_style_name_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_text_style_name_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_text_style_name_;
}; };
class common_draw_position_attlist class common_draw_position_attlist
...@@ -595,6 +515,20 @@ public: ...@@ -595,6 +515,20 @@ public:
}; };
class common_presentation_attlist
{
public:
void add_attributes ( const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_presentation_attlist & Other);
void serialize (CP_ATTR_NODE);
_CP_OPT(presentation_class) presentation_class_;
_CP_OPT(std::wstring) presentation_class_names_;
_CP_OPT(std::wstring) presentation_style_name_;
_CP_OPT(Bool) presentation_placeholder_;
_CP_OPT(Bool) presentation_user_transformed_;
};
class common_draw_shape_with_text_and_styles_attlist class common_draw_shape_with_text_and_styles_attlist
{ {
public: public:
...@@ -602,10 +536,13 @@ public: ...@@ -602,10 +536,13 @@ public:
void apply_from(const common_draw_shape_with_text_and_styles_attlist & Other); void apply_from(const common_draw_shape_with_text_and_styles_attlist & Other);
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
common_draw_shape_with_styles_attlist common_draw_shape_with_styles_attlist_; common_shape_draw_attlist common_shape_draw_attlist_;
common_draw_text_style_name_attlist common_draw_text_style_name_attlist_; common_shape_table_attlist common_shape_table_attlist_;
};
common_text_anchor_attlist common_text_anchor_attlist_;
common_presentation_attlist common_presentation_attlist_;
};
class common_data_style_attlist class common_data_style_attlist
{ {
public: public:
...@@ -633,19 +570,6 @@ struct union_common_draw_attlists ...@@ -633,19 +570,6 @@ struct union_common_draw_attlists
void serialize(CP_ATTR_NODE); void serialize(CP_ATTR_NODE);
}; };
class common_presentation_attlist
{
public:
void add_attributes ( const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_presentation_attlist & Other);
void serialize (CP_ATTR_NODE);
_CP_OPT(presentation_class) presentation_class_;
_CP_OPT(std::wstring) style_name_;
_CP_OPT(Bool) presentation_placeholder_;
_CP_OPT(Bool) presentation_user_transformed_;
};
class common_anim_smil_attlist class common_anim_smil_attlist
{ {
public: public:
......
...@@ -166,8 +166,6 @@ void draw_frame::add_attributes( const xml::attributes_wc_ptr & Attributes ) ...@@ -166,8 +166,6 @@ void draw_frame::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ {
idx_in_owner = -1; idx_in_owner = -1;
common_presentation_attlist_.add_attributes(Attributes);
common_draw_attlists_.shape_with_text_and_styles_.add_attributes(Attributes); common_draw_attlists_.shape_with_text_and_styles_.add_attributes(Attributes);
common_draw_attlists_.position_.add_attributes(Attributes); common_draw_attlists_.position_.add_attributes(Attributes);
common_draw_attlists_.rel_size_.add_attributes(Attributes); common_draw_attlists_.rel_size_.add_attributes(Attributes);
......
...@@ -150,7 +150,7 @@ public: ...@@ -150,7 +150,7 @@ public:
static const ElementType type = typeDrawFrame; static const ElementType type = typeDrawFrame;
CPDOCCORE_DEFINE_VISITABLE(); CPDOCCORE_DEFINE_VISITABLE();
draw_frame() : oox_drawing_(NULL) {} draw_frame() : oox_drawing_(NULL), idx_in_owner(-1) {}
virtual void docx_convert(oox::docx_conversion_context & Context); virtual void docx_convert(oox::docx_conversion_context & Context);
virtual void xlsx_convert(oox::xlsx_conversion_context & Context); virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
...@@ -161,7 +161,6 @@ public: ...@@ -161,7 +161,6 @@ public:
int idx_in_owner ; int idx_in_owner ;
odf_types::common_presentation_attlist common_presentation_attlist_;
odf_types::union_common_draw_attlists common_draw_attlists_; odf_types::union_common_draw_attlists common_draw_attlists_;
draw_frame_attlist draw_frame_attlist_; draw_frame_attlist draw_frame_attlist_;
......
...@@ -180,11 +180,7 @@ int ComputeMarginX(const style_page_layout_properties * pagePropertiesNode, ...@@ -180,11 +180,7 @@ int ComputeMarginX(const style_page_layout_properties * pagePropertiesNode,
const std::vector<odf_reader::_property> & additional) const std::vector<odf_reader::_property> & additional)
{ {
const _CP_OPT(anchor_type) anchor = attlists_.shape_with_text_and_styles_. const _CP_OPT(anchor_type) anchor = attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_;
common_draw_shape_with_styles_attlist_.
common_text_spreadsheet_shape_attlist_.
common_text_anchor_attlist_.
type_;
_CP_OPT(horizontal_rel) styleHorizontalRel = graphicProperties.common_horizontal_rel_attlist_.style_horizontal_rel_; _CP_OPT(horizontal_rel) styleHorizontalRel = graphicProperties.common_horizontal_rel_attlist_.style_horizontal_rel_;
_CP_OPT(horizontal_pos) styleHorizontalPos = graphicProperties.common_horizontal_pos_attlist_.style_horizontal_pos_; _CP_OPT(horizontal_pos) styleHorizontalPos = graphicProperties.common_horizontal_pos_attlist_.style_horizontal_pos_;
...@@ -575,16 +571,12 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties, ...@@ -575,16 +571,12 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties,
// TODO : recursive result!!! // TODO : recursive result!!!
const _CP_OPT(anchor_type) anchor = const _CP_OPT(anchor_type) anchor =
attlists_.shape_with_text_and_styles_. attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.
common_text_spreadsheet_shape_attlist_.
common_text_anchor_attlist_. common_text_anchor_attlist_.
type_; type_;
//todooo пока не ясно как привязать к определеной странице в документе ... //todooo пока не ясно как привязать к определеной странице в документе ...
//const _CP_OPT(unsigned int) anchor_page_number = //const _CP_OPT(unsigned int) anchor_page_number =
// attlists_.shape_with_text_and_styles_. // attlists_.shape_with_text_and_styles_.
// common_draw_shape_with_styles_attlist_.
// common_text_spreadsheet_shape_attlist_.
// common_text_anchor_attlist_. // common_text_anchor_attlist_.
// page_number_; // page_number_;
...@@ -766,7 +758,7 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties, ...@@ -766,7 +758,7 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties,
void common_draw_docx_convert(oox::docx_conversion_context & Context, const union_common_draw_attlists & attlists_, oox::_docx_drawing *drawing) void common_draw_docx_convert(oox::docx_conversion_context & Context, const union_common_draw_attlists & attlists_, oox::_docx_drawing *drawing)
{ {
const std::wstring styleName = attlists_.shape_with_text_and_styles_. const std::wstring styleName = attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(L""); common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
std::vector<const odf_reader::style_instance *> instances; std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_); odf_reader::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_);
...@@ -811,12 +803,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio ...@@ -811,12 +803,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
drawing->styleVerticalPos = graphicProperties.common_vertical_pos_attlist_.style_vertical_pos_; drawing->styleVerticalPos = graphicProperties.common_vertical_pos_attlist_.style_vertical_pos_;
drawing->styleVerticalRel = graphicProperties.common_vertical_rel_attlist_.style_vertical_rel_; drawing->styleVerticalRel = graphicProperties.common_vertical_rel_attlist_.style_vertical_rel_;
_CP_OPT(anchor_type) anchor = _CP_OPT(anchor_type) anchor = attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_;
attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.
common_text_spreadsheet_shape_attlist_.
common_text_anchor_attlist_.
type_;
int level_drawing = Context.get_drawing_context().get_current_level(); int level_drawing = Context.get_drawing_context().get_current_level();
...@@ -824,9 +811,9 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio ...@@ -824,9 +811,9 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
{ {
drawing->isInline = true; drawing->isInline = true;
} }
if (attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_transform_attlist_.draw_transform_) if (attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_transform_)
{ {
std::wstring transformStr = attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_transform_attlist_.draw_transform_.get(); std::wstring transformStr = attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_transform_.get();
oox_convert_transforms(transformStr, drawing->additional); oox_convert_transforms(transformStr, drawing->additional);
} }
if (!drawing->isInline) if (!drawing->isInline)
...@@ -837,7 +824,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio ...@@ -837,7 +824,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
drawing->relativeHeight = L"2"; drawing->relativeHeight = L"2";
drawing->behindDoc = L"0"; drawing->behindDoc = L"0";
_CP_OPT(int) zIndex = attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_z_index_attlist_.draw_z_index_; _CP_OPT(int) zIndex = attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_;
if (zIndex)//порядок отрисовки объектов if (zIndex)//порядок отрисовки объектов
{ {
...@@ -1137,7 +1124,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context) ...@@ -1137,7 +1124,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
drawing->fill.bitmap->bStretch = true; drawing->fill.bitmap->bStretch = true;
const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_. const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(L""); common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
odf_reader::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_); odf_reader::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_);
...@@ -1273,8 +1260,7 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context) ...@@ -1273,8 +1260,7 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
const _CP_OPT(std::wstring) name = const _CP_OPT(std::wstring) name =
common_draw_attlists_.shape_with_text_and_styles_. common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_. common_shape_draw_attlist_.draw_name_;
common_draw_name_attlist_.draw_name_;
Context.get_drawing_context().add_name_object(name.get_value_or(L"Group")); Context.get_drawing_context().add_name_object(name.get_value_or(L"Group"));
...@@ -1374,8 +1360,7 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context) ...@@ -1374,8 +1360,7 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
const _CP_OPT(std::wstring) name = const _CP_OPT(std::wstring) name =
common_draw_attlists_.shape_with_text_and_styles_. common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_. common_shape_draw_attlist_.draw_name_;
common_draw_name_attlist_.draw_name_;
Context.get_drawing_context().add_name_object(name.get_value_or(L"Object")); Context.get_drawing_context().add_name_object(name.get_value_or(L"Object"));
......
...@@ -85,15 +85,12 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -85,15 +85,12 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
{ {
Context.get_slide_context().start_frame(); Context.get_slide_context().start_frame();
common_draw_shape_with_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_; common_shape_draw_attlist &common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_;
common_presentation_attlist &common_presentation_attlist_= common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
const int z_index = common_draw_attlist_.common_draw_z_index_attlist_.draw_z_index_.get_value_or(0); const int z_index = common_draw_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L""); const std::wstring textStyleName = common_draw_attlist_.draw_text_style_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_.
common_draw_text_style_name_attlist_.
draw_text_style_name_.get_value_or(L"");
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
const _CP_OPT(length) svg_widthVal = common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_; const _CP_OPT(length) svg_widthVal = common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_;
...@@ -114,26 +111,26 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -114,26 +111,26 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_rect(width_pt, height_pt, x_pt, y_pt); Context.get_slide_context().set_rect(width_pt, height_pt, x_pt, y_pt);
} }
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
if (common_draw_attlist_.common_draw_transform_attlist_.draw_transform_) if (common_draw_attlist_.draw_transform_)
{ {
std::wstring transformStr = common_draw_attlist_.common_draw_transform_attlist_.draw_transform_.get(); std::wstring transformStr = common_draw_attlist_.draw_transform_.get();
pptx_convert_transforms(transformStr,Context); pptx_convert_transforms(transformStr,Context);
} }
//////////////////////////////////////// ////////////////////////////////////////
std::wstring Anchor; std::wstring Anchor;
if (common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_) if (common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_cell_address_)
{ {
Anchor = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_.get(); Anchor = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt); const double a_x_pt = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt); const double a_y_pt = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Context.get_slide_context().set_anchor(Anchor,a_x_pt,a_y_pt); Context.get_slide_context().set_anchor(Anchor,a_x_pt,a_y_pt);
} }
////////////////////////////////////////////// //////////////////////////////////////////////
std::vector<const odf_reader::style_instance *> instances; std::vector<const odf_reader::style_instance *> instances;
const std::wstring grStyleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(L""); const std::wstring grStyleName = common_draw_attlist_.draw_style_name_.get_value_or(L"");
const std::wstring baseStyleName = common_draw_attlist_.common_draw_style_name_attlist_.presentation_style_name_.get_value_or(L""); const std::wstring baseStyleName = common_presentation_attlist_.presentation_style_name_.get_value_or(L"");
odf_reader::style_instance* grStyleInst = odf_reader::style_instance* grStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(grStyleName, odf_types::style_family::Graphic,Context.process_masters_); Context.root()->odf_context().styleContainer().style_by_name(grStyleName, odf_types::style_family::Graphic,Context.process_masters_);
...@@ -181,7 +178,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -181,7 +178,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
{ {
Context.get_slide_context().set_placeHolder_type(common_presentation_attlist_.presentation_class_->get_type_ms()); Context.get_slide_context().set_placeHolder_type(common_presentation_attlist_.presentation_class_->get_type_ms());
if (idx_in_owner >=0) if (idx_in_owner >= 0)
Context.get_slide_context().set_placeHolder_idx(idx_in_owner); Context.get_slide_context().set_placeHolder_idx(idx_in_owner);
} }
......
...@@ -69,11 +69,10 @@ namespace odf_reader { ...@@ -69,11 +69,10 @@ namespace odf_reader {
void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context) void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
common_draw_shape_with_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_; common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
const int z_index = common_draw_attlist_.common_draw_z_index_attlist_.draw_z_index_.get_value_or(0); const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_shape_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L"");
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Context.get_drawing_context().start_group( name); Context.get_drawing_context().start_group( name);
...@@ -93,12 +92,12 @@ void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -93,12 +92,12 @@ void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context)
//} //}
//////////////////////////////////////// ////////////////////////////////////////
if (common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_) if (common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_)
{ {
std::wstring Anchor = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_.get(); std::wstring Anchor = common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt); const double a_x_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt); const double a_y_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Context.get_drawing_context().set_anchor(Anchor, a_x_pt, a_y_pt, true); Context.get_drawing_context().set_anchor(Anchor, a_x_pt, a_y_pt, true);
} }
...@@ -115,16 +114,12 @@ void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -115,16 +114,12 @@ void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context)
} }
void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context) void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
common_draw_shape_with_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_; common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
const int z_index = common_draw_attlist_.common_draw_z_index_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L"");
const std::wstring styleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(L""); const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_shape_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_. const std::wstring styleName = common_draw_attlist_.common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(L""); const std::wstring textStyleName = common_draw_attlist_.common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
Context.get_drawing_context().start_drawing( name); Context.get_drawing_context().start_drawing( name);
...@@ -144,19 +139,19 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -144,19 +139,19 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_drawing_context().set_rect(width_pt, height_pt, x_pt, y_pt); Context.get_drawing_context().set_rect(width_pt, height_pt, x_pt, y_pt);
} }
/////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////
if (common_draw_attlist_.common_draw_transform_attlist_.draw_transform_) if (common_draw_attlist_.common_shape_draw_attlist_.draw_transform_)
{ {
std::wstring transformStr = common_draw_attlist_.common_draw_transform_attlist_.draw_transform_.get(); std::wstring transformStr = common_draw_attlist_.common_shape_draw_attlist_.draw_transform_.get();
xlsx_convert_transforms(transformStr,Context); xlsx_convert_transforms(transformStr,Context);
} }
//////////////////////////////////////// ////////////////////////////////////////
std::wstring Anchor; std::wstring Anchor;
if (common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_) if (common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_)
{ {
Anchor = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_.get(); Anchor = common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt); const double a_x_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt); const double a_y_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Context.get_drawing_context().set_anchor(Anchor, a_x_pt, a_y_pt); Context.get_drawing_context().set_anchor(Anchor, a_x_pt, a_y_pt);
} }
......
...@@ -79,7 +79,6 @@ void draw_shape::add_attributes( const xml::attributes_wc_ptr & Attributes ) ...@@ -79,7 +79,6 @@ void draw_shape::add_attributes( const xml::attributes_wc_ptr & Attributes )
common_draw_attlists_.shape_with_text_and_styles_.add_attributes(Attributes); common_draw_attlists_.shape_with_text_and_styles_.add_attributes(Attributes);
common_draw_attlists_.position_.add_attributes(Attributes); common_draw_attlists_.position_.add_attributes(Attributes);
common_draw_attlists_.rel_size_.add_attributes(Attributes); common_draw_attlists_.rel_size_.add_attributes(Attributes);
common_presentation_attlist_.add_attributes(Attributes);
draw_shape_attlist_.add_attributes(Attributes); draw_shape_attlist_.add_attributes(Attributes);
......
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
static const ElementType type = typeDrawShape; static const ElementType type = typeDrawShape;
static const xml::NodeType xml_type = xml::typeElement; static const xml::NodeType xml_type = xml::typeElement;
draw_shape() : bad_shape_(false), word_art_(false) {} draw_shape() : bad_shape_(false), word_art_(false), idx_in_owner(-1) {}
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes ); virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name); virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
...@@ -75,12 +75,12 @@ public: ...@@ -75,12 +75,12 @@ public:
void common_xlsx_convert(oox::xlsx_conversion_context & Context); void common_xlsx_convert(oox::xlsx_conversion_context & Context);
void common_docx_convert(oox::docx_conversion_context & Context) ; void common_docx_convert(oox::docx_conversion_context & Context) ;
void common_pptx_convert(oox::pptx_conversion_context & Context) ; void common_pptx_convert(oox::pptx_conversion_context & Context) ;
odf_types::common_xlink_attlist common_xlink_attlist_;
odf_types::common_presentation_attlist common_presentation_attlist_;
odf_types::union_common_draw_attlists common_draw_attlists_; odf_types::union_common_draw_attlists common_draw_attlists_;
draw_shape_attlist draw_shape_attlist_; draw_shape_attlist draw_shape_attlist_;
_CP_OPT(std::wstring) draw_id_;//используется для анимашек odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) draw_id_; //используется для анимашек
office_element_ptr_array content_; office_element_ptr_array content_;
...@@ -91,8 +91,7 @@ public: ...@@ -91,8 +91,7 @@ public:
bool word_art_; bool word_art_;
int sub_type_; int sub_type_;
std::vector<odf_reader::_property> additional_; std::vector<odf_reader::_property> additional_;
int idx_in_owner;
}; };
////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -67,8 +67,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context) ...@@ -67,8 +67,7 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
const _CP_OPT(std::wstring) name = const _CP_OPT(std::wstring) name =
common_draw_attlists_.shape_with_text_and_styles_. common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_. common_shape_draw_attlist_.draw_name_;
common_draw_name_attlist_.draw_name_;
Context.get_drawing_context().add_name_object(name.get_value_or(L"Shape")); Context.get_drawing_context().add_name_object(name.get_value_or(L"Shape"));
......
...@@ -65,14 +65,12 @@ namespace odf_reader { ...@@ -65,14 +65,12 @@ namespace odf_reader {
void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context) void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
{ {
common_draw_shape_with_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_; common_shape_draw_attlist &common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_;
common_presentation_attlist &common_presentation_attlist_= common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
const int z_index = common_draw_attlist_.common_draw_z_index_attlist_.draw_z_index_.get_value_or(0); const int z_index = common_draw_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L""); const std::wstring textStyleName = common_draw_attlist_.draw_text_style_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_.
common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(L"");
/////////////////////////////////////////// ///////////////////////////////////////////
Context.get_slide_context().set_name(name); Context.get_slide_context().set_name(name);
...@@ -91,27 +89,27 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context) ...@@ -91,27 +89,27 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
Context.get_slide_context().set_rect(width_pt, height_pt, x_pt, y_pt); Context.get_slide_context().set_rect(width_pt, height_pt, x_pt, y_pt);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
if (common_draw_attlist_.common_draw_transform_attlist_.draw_transform_) if (common_draw_attlist_.draw_transform_)
{ {
std::wstring transformStr = common_draw_attlist_.common_draw_transform_attlist_.draw_transform_.get(); std::wstring transformStr = common_draw_attlist_.draw_transform_.get();
pptx_convert_transforms(transformStr,Context); pptx_convert_transforms(transformStr,Context);
//oox_convert_transforms(transformStr, additional_); //oox_convert_transforms(transformStr, additional_);
} }
//////////////////////////////////////// ////////////////////////////////////////
std::wstring Anchor; std::wstring Anchor;
if (common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_) if (common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_cell_address_)
{ {
Anchor = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_.get(); Anchor = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt); const double a_x_pt = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt); const double a_y_pt = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Context.get_slide_context().set_anchor(Anchor,a_x_pt,a_y_pt); Context.get_slide_context().set_anchor(Anchor,a_x_pt,a_y_pt);
} }
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
std::vector<const odf_reader::style_instance *> instances; std::vector<const odf_reader::style_instance *> instances;
const std::wstring grStyleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(L""); const std::wstring grStyleName = common_draw_attlist_.draw_style_name_.get_value_or(L"");
const std::wstring baseStyleName = common_draw_attlist_.common_draw_style_name_attlist_.presentation_style_name_.get_value_or(L""); const std::wstring baseStyleName = common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_.presentation_style_name_.get_value_or(L"");
odf_reader::style_instance* grStyleInst = odf_reader::style_instance* grStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(grStyleName, odf_types::style_family::Graphic,Context.process_masters_); Context.root()->odf_context().styleContainer().style_by_name(grStyleName, odf_types::style_family::Graphic,Context.process_masters_);
...@@ -154,6 +152,14 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context) ...@@ -154,6 +152,14 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_, Compute_GraphicFill(properties.common_draw_fill_attlist_, properties.style_background_image_,
Context.root()->odf_context().drawStyles() ,fill); Context.root()->odf_context().drawStyles() ,fill);
Context.get_slide_context().set_fill(fill); Context.get_slide_context().set_fill(fill);
if (common_presentation_attlist_.presentation_class_)
{
Context.get_slide_context().set_placeHolder_type(common_presentation_attlist_.presentation_class_->get_type_ms());
if (idx_in_owner >= 0)
Context.get_slide_context().set_placeHolder_idx(idx_in_owner);
}
//////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////
Context.get_text_context().start_object(); Context.get_text_context().start_object();
BOOST_FOREACH(office_element_ptr const & elm, content_) BOOST_FOREACH(office_element_ptr const & elm, content_)
...@@ -244,7 +250,7 @@ void draw_custom_shape::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -244,7 +250,7 @@ void draw_custom_shape::pptx_convert(oox::pptx_conversion_context & Context)
} }
void draw_caption::pptx_convert(oox::pptx_conversion_context & Context) void draw_caption::pptx_convert(oox::pptx_conversion_context & Context)
{ {
//const std::wstring style = common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(L""); //const std::wstring style = common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
Context.get_slide_context().start_shape(sub_type_);//rect с наваротами-атрибутами .. а-ля TextBox Context.get_slide_context().start_shape(sub_type_);//rect с наваротами-атрибутами .. а-ля TextBox
......
...@@ -65,16 +65,12 @@ namespace odf_reader { ...@@ -65,16 +65,12 @@ namespace odf_reader {
void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context) void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
common_draw_shape_with_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_; common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
const int z_index = common_draw_attlist_.common_draw_z_index_attlist_.draw_z_index_.get_value_or(0); const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
const std::wstring name = common_draw_attlist_.common_shape_draw_attlist_.draw_name_.get_value_or(L"");
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_name_.get_value_or(L""); const std::wstring styleName = common_draw_attlist_.common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlist_.common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
const std::wstring styleName = common_draw_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(L"");
const std::wstring textStyleName = common_draw_attlists_.shape_with_text_and_styles_.
common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(L"");
/////////////////////////////////////////// ///////////////////////////////////////////
Context.get_drawing_context().start_drawing(name); Context.get_drawing_context().start_drawing(name);
...@@ -93,19 +89,19 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -93,19 +89,19 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
Context.get_drawing_context().set_rect(width_pt, height_pt, x_pt, y_pt); Context.get_drawing_context().set_rect(width_pt, height_pt, x_pt, y_pt);
} }
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
if (common_draw_attlist_.common_draw_transform_attlist_.draw_transform_) if (common_draw_attlist_.common_shape_draw_attlist_.draw_transform_)
{ {
std::wstring transformStr = common_draw_attlist_.common_draw_transform_attlist_.draw_transform_.get(); std::wstring transformStr = common_draw_attlist_.common_shape_draw_attlist_.draw_transform_.get();
xlsx_convert_transforms(transformStr,Context); xlsx_convert_transforms(transformStr,Context);
//oox_convert_transforms(transformStr, additional_); //oox_convert_transforms(transformStr, additional_);
} }
//////////////////////////////////////// ////////////////////////////////////////
std::wstring Anchor; std::wstring Anchor;
if (common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_) if (common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_)
{ {
Anchor = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_cell_address_.get(); Anchor = common_draw_attlist_.common_shape_table_attlist_.table_end_cell_address_.get();
const double a_x_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt); const double a_x_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
const double a_y_pt = common_draw_attlist_.common_text_spreadsheet_shape_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt); const double a_y_pt = common_draw_attlist_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
Context.get_drawing_context().set_anchor(Anchor, a_x_pt, a_y_pt); Context.get_drawing_context().set_anchor(Anchor, a_x_pt, a_y_pt);
} }
...@@ -247,7 +243,7 @@ void draw_custom_shape::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -247,7 +243,7 @@ void draw_custom_shape::xlsx_convert(oox::xlsx_conversion_context & Context)
} }
void draw_caption::xlsx_convert(oox::xlsx_conversion_context & Context) void draw_caption::xlsx_convert(oox::xlsx_conversion_context & Context)
{ {
//const std::wstring style = common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(L""); //const std::wstring style = common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
Context.get_drawing_context().start_shape(1);//rect с наваротами-атрибутами .. а-ля TextBox Context.get_drawing_context().start_shape(1);//rect с наваротами-атрибутами .. а-ля TextBox
......
...@@ -920,7 +920,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context & ...@@ -920,7 +920,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
{//взять из графических ствойст цвет текста .. {//взять из графических ствойст цвет текста ..
const std::wstring styleName = shape->common_draw_attlists_.shape_with_text_and_styles_. const std::wstring styleName = shape->common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.common_draw_style_name_attlist_.draw_style_name_.get_value_or(L""); common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
std::vector<const odf_reader::style_instance *> instances; std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_); odf_reader::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_);
......
...@@ -1417,26 +1417,40 @@ int style_master_page::find_placeHolderIndex(presentation_class::type placeHolde ...@@ -1417,26 +1417,40 @@ int style_master_page::find_placeHolderIndex(presentation_class::type placeHolde
{ {
int idx = -1; int idx = -1;
int i=0; for (size_t i = 0; i < content_.size(); i++)
int size = content_.size();
while(true)
{ {
if (i>=size)break;
if (content_[i]->get_type() == odf_reader::typeDrawFrame) if (content_[i]->get_type() == odf_reader::typeDrawFrame)
{ {
draw_frame* frame = dynamic_cast<draw_frame *>(content_[i].get()); draw_frame* frame = dynamic_cast<draw_frame *>(content_[i].get());
if (frame)
{
odf_types::common_presentation_attlist &common_presentation_attlist_ = frame->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
if (frame->idx_in_owner < 0)
frame->idx_in_owner = last_idx++;
if (frame->idx_in_owner<0)frame->idx_in_owner = last_idx++; if ((common_presentation_attlist_.presentation_class_) &&
(common_presentation_attlist_.presentation_class_->get_type()== placeHolder))
if ((frame) && (frame->common_presentation_attlist_.presentation_class_) && {
(frame->common_presentation_attlist_.presentation_class_->get_type()== placeHolder)) idx = frame->idx_in_owner;
break;
}
}
draw_shape* shape = dynamic_cast<draw_shape *>(content_[i].get());
if (shape)
{ {
idx = frame->idx_in_owner; odf_types::common_presentation_attlist &common_presentation_attlist_ = shape->common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
break; if (shape->idx_in_owner < 0)
shape->idx_in_owner = last_idx++;
if ((common_presentation_attlist_.presentation_class_) &&
(common_presentation_attlist_.presentation_class_->get_type()== placeHolder))
{
idx = shape->idx_in_owner;
break;
}
} }
} }
i++;
} }
return idx; return idx;
} }
......
...@@ -78,7 +78,6 @@ void draw_base::serialize(std::wostream & _Wostream) ...@@ -78,7 +78,6 @@ void draw_base::serialize(std::wostream & _Wostream)
void draw_base::serialize_attlist(CP_ATTR_NODE) void draw_base::serialize_attlist(CP_ATTR_NODE)
{ {
common_draw_attlists_.serialize(CP_GET_XML_NODE()); common_draw_attlists_.serialize(CP_GET_XML_NODE());
common_presentation_attlist_.serialize(CP_GET_XML_NODE());
} }
} }
......
...@@ -59,7 +59,6 @@ public: ...@@ -59,7 +59,6 @@ public:
virtual void serialize(std::wostream & _Wostream); virtual void serialize(std::wostream & _Wostream);
virtual void serialize_attlist(CP_ATTR_NODE); virtual void serialize_attlist(CP_ATTR_NODE);
odf_types::common_presentation_attlist common_presentation_attlist_;
odf_types::union_common_draw_attlists common_draw_attlists_; odf_types::union_common_draw_attlists common_draw_attlists_;
office_element_ptr_array content_; office_element_ptr_array content_;
......
...@@ -308,31 +308,43 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape) ...@@ -308,31 +308,43 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
odf_context()->drawing_context()->start_drawing(); odf_context()->drawing_context()->start_drawing();
int type = 1000; int type = 1000; //custom
PPTX::Logic::PrstGeom* prstGeom = &oox_shape->spPr.Geometry.as<PPTX::Logic::PrstGeom>(); if (oox_shape->spPr.Geometry.is_init())
if ( prstGeom )
{ {
SimpleTypes::CShapeType<> preset;
preset.FromString(prstGeom->prst.get());
type = preset.GetValue();
}
if (type == SimpleTypes::shapetypeRect && oox_shape->txBody.IsInit()) type = 2000; if ( oox_shape->spPr.Geometry.is<PPTX::Logic::PrstGeom>() )
{
const PPTX::Logic::PrstGeom& prstGeom = oox_shape->spPr.Geometry.as<PPTX::Logic::PrstGeom>();
SimpleTypes::CShapeType<> preset;
preset.FromString(prstGeom.prst.get());
type = preset.GetValue();
}
if (type == 2000 && oox_shape->txBody->bodyPr.IsInit() if (type == SimpleTypes::shapetypeRect && oox_shape->txBody.IsInit()) type = 2000;
&& oox_shape->txBody->bodyPr->fromWordArt.get_value_or(false))
{
int wordart_type = convert(oox_shape->txBody->bodyPr->prstTxWarp.GetPointer());
if (wordart_type > 0) type = wordart_type; if (type == 2000 && oox_shape->txBody->bodyPr.IsInit()
&& oox_shape->txBody->bodyPr->fromWordArt.get_value_or(false))
{
int wordart_type = convert(oox_shape->txBody->bodyPr->prstTxWarp.GetPointer());
if (wordart_type > 0) type = wordart_type;
}
}
else if (oox_shape->nvSpPr.nvPr.ph.is_init())
{
type = 2000;
} }
if (type < 0)return; if (type < 0)return;
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
odf_context()->drawing_context()->start_shape(type); odf_context()->drawing_context()->start_shape(type);
//if (oox_shape->levelUp)
//{
// convert((PPTX::Logic::SpPr *)&oox_shape->levelUp->spPr, oox_shape->levelUp->style.GetPointer());
//}
convert(&oox_shape->spPr, oox_shape->style.GetPointer()); convert(&oox_shape->spPr, oox_shape->style.GetPointer());
//имя, описалово, номер ... //имя, описалово, номер ...
convert(&oox_shape->nvSpPr); convert(&oox_shape->nvSpPr);
...@@ -957,24 +969,75 @@ void OoxConverter::convert(PPTX::Logic::NvPr *oox_nvPr) ...@@ -957,24 +969,75 @@ void OoxConverter::convert(PPTX::Logic::NvPr *oox_nvPr)
//nullable_limit<Limit::PlaceholderSize> sz; //nullable_limit<Limit::PlaceholderSize> sz;
} }
} }
void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph) void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::TextListStyle *oox_list_style)
{ {
if (!oox_paragraph)return; if (!oox_paragraph)return;
bool styled = false; bool styled = false;
bool list_present = false;
std::wstring list_style_name;
int list_level = 0;
if (oox_paragraph->pPr.IsInit()) if (oox_paragraph->pPr.IsInit())
{ {
if (oox_paragraph->pPr->lvl.IsInit() || oox_paragraph->pPr->ParagraphBullet.is_init())
{
list_present = true;
list_level = 1;
if (oox_paragraph->pPr->lvl.IsInit())
list_level = *oox_paragraph->pPr->lvl;
}
odf_writer::style_paragraph_properties * paragraph_properties = odf_context()->text_context()->get_paragraph_properties(); odf_writer::style_paragraph_properties * paragraph_properties = odf_context()->text_context()->get_paragraph_properties();
//свойства могут быть приписаны не только к параграфу, но и к самому объекту //свойства могут быть приписаны не только к параграфу, но и к самому объекту
if (!paragraph_properties) if (!paragraph_properties)
{ {
odf_context()->styles_context()->create_style(L"",odf_types::style_family::Paragraph, true, false, -1); 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(); paragraph_properties = odf_context()->styles_context()->last_state()->get_paragraph_properties();
//if(list_present && oox_list_style)
//{
// list_style_name = odf_context->styles_context()->lists_styles().get_style_name(list_style_id);
// odf_context->styles_context()->last_state()->set_list_style_name(list_style_name);
//}
styled = true; styled = true;
} }
convert(oox_list_style, list_level, paragraph_properties);
convert(oox_paragraph->pPr.GetPointer(), paragraph_properties); convert(oox_paragraph->pPr.GetPointer(), paragraph_properties);
} }
if(list_present)
{
while (odf_context()->text_context()->list_state_.levels.size() > list_level)
{
odf_context()->text_context()->end_list();
}
if (odf_context()->text_context()->list_state_.levels.size() < 1)
{
odf_context()->text_context()->list_state_.started_list = false;
odf_context()->text_context()->list_state_.style_name = L"";
}
if (odf_context()->text_context()->list_state_.started_list == false)
{
odf_context()->text_context()->start_list(list_style_name);
//text_context()->set_list_continue(true); //??? держать в памяти все списки????
}
odf_context()->text_context()->start_list_item();
if (odf_context()->text_context()->list_state_.style_name == list_style_name)
list_style_name = L"";
while (odf_context()->text_context()->list_state_.levels.size() < list_level)
{
odf_context()->text_context()->start_list(list_style_name);
odf_context()->text_context()->start_list_item();
}
}
odf_context()->text_context()->start_paragraph(styled); odf_context()->text_context()->start_paragraph(styled);
for (size_t i=0; i< oox_paragraph->RunElems.size();i++) for (size_t i=0; i< oox_paragraph->RunElems.size();i++)
...@@ -982,6 +1045,21 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph) ...@@ -982,6 +1045,21 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph)
convert(&oox_paragraph->RunElems[i].as<OOX::WritingElement>()); convert(&oox_paragraph->RunElems[i].as<OOX::WritingElement>());
} }
odf_context()->text_context()->end_paragraph(); odf_context()->text_context()->end_paragraph();
if(list_present)
{
odf_context()->text_context()->end_list_item();
}
}
void OoxConverter::convert(PPTX::Logic::TextListStyle *oox_list_style, int level, odf_writer::style_paragraph_properties * paragraph_properties)
{
if (!oox_list_style) return;
if (!paragraph_properties) return;
if (level < 0 || level > 9) return;
convert(oox_list_style->levels[level].GetPointer(), paragraph_properties);
} }
void OoxConverter::convert(PPTX::Logic::TextParagraphPr *oox_paragraph_pr, odf_writer::style_paragraph_properties * paragraph_properties) void OoxConverter::convert(PPTX::Logic::TextParagraphPr *oox_paragraph_pr, odf_writer::style_paragraph_properties * paragraph_properties)
{ {
...@@ -1252,6 +1330,7 @@ void OoxConverter::convert(PPTX::Logic::Fld *oox_fld) ...@@ -1252,6 +1330,7 @@ void OoxConverter::convert(PPTX::Logic::Fld *oox_fld)
void OoxConverter::convert(PPTX::Logic::Br *oox_br) void OoxConverter::convert(PPTX::Logic::Br *oox_br)
{ {
if (!oox_br) return; if (!oox_br) return;
odf_context()->text_context()->set_type_break(2, true);
} }
void OoxConverter::convert(PPTX::Logic::MathParaWrapper *oox_math) void OoxConverter::convert(PPTX::Logic::MathParaWrapper *oox_math)
{ {
...@@ -1273,6 +1352,7 @@ void OoxConverter::convert(PPTX::Logic::MoveTo *oox_geom_path) ...@@ -1273,6 +1352,7 @@ void OoxConverter::convert(PPTX::Logic::MoveTo *oox_geom_path)
odf_context()->drawing_context()->add_path_element(std::wstring(L"M"), path_elm); odf_context()->drawing_context()->add_path_element(std::wstring(L"M"), path_elm);
} }
void OoxConverter::convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeStyle* oox_style) void OoxConverter::convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeStyle* oox_style)
{ {
if (!oox_txBody) return; if (!oox_txBody) return;
...@@ -1280,9 +1360,9 @@ void OoxConverter::convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeSt ...@@ -1280,9 +1360,9 @@ void OoxConverter::convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeSt
odf_context()->start_text_context(); odf_context()->start_text_context();
for (size_t i = 0; i < oox_txBody->Paragrs.size();i++) for (size_t i = 0; i < oox_txBody->Paragrs.size(); i++)
{ {
convert(&oox_txBody->Paragrs[i]); convert(&oox_txBody->Paragrs[i], oox_txBody->lstStyle.GetPointer());
} }
odf_context()->drawing_context()->set_text( odf_context()->text_context()); odf_context()->drawing_context()->set_text( odf_context()->text_context());
......
...@@ -175,48 +175,58 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -175,48 +175,58 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
}break; }break;
case OOX::et_a_prstGeom: case OOX::et_a_prstGeom:
{ {
PPTX::Logic::PrstGeom* pPresetGeom = dynamic_cast<PPTX::Logic::PrstGeom*>(oox_unknown); convert(dynamic_cast<PPTX::Logic::PrstGeom*>(oox_unknown));
convert(pPresetGeom);
}break; }break;
case OOX::et_a_custGeom: case OOX::et_a_custGeom:
{ {
PPTX::Logic::CustGeom* pCustomGeom = dynamic_cast<PPTX::Logic::CustGeom*>(oox_unknown); convert(dynamic_cast<PPTX::Logic::CustGeom*>(oox_unknown));
convert(pCustomGeom);
}break; }break;
case OOX::et_a_lnTo: case OOX::et_a_lnTo:
{ {
PPTX::Logic::LineTo* pLineTo = dynamic_cast<PPTX::Logic::LineTo*>(oox_unknown); convert(dynamic_cast<PPTX::Logic::LineTo*>(oox_unknown));
convert(pLineTo);
}break; }break;
case OOX::et_a_moveTo: case OOX::et_a_moveTo:
{ {
PPTX::Logic::MoveTo* pMoveTo = dynamic_cast<PPTX::Logic::MoveTo*>(oox_unknown); convert(dynamic_cast<PPTX::Logic::MoveTo*>(oox_unknown));
convert(pMoveTo);
}break; }break;
case OOX::et_a_arcTo: case OOX::et_a_arcTo:
{ {
PPTX::Logic::ArcTo* pArcTo = dynamic_cast<PPTX::Logic::ArcTo*>(oox_unknown); convert(dynamic_cast<PPTX::Logic::ArcTo*>(oox_unknown));
convert(pArcTo);
}break; }break;
case OOX::et_a_quadBezTo: case OOX::et_a_quadBezTo:
{ {
PPTX::Logic::QuadBezTo* pQuadBezierTo = dynamic_cast<PPTX::Logic::QuadBezTo*>(oox_unknown); convert(dynamic_cast<PPTX::Logic::QuadBezTo*>(oox_unknown));
convert(pQuadBezierTo);
}break; }break;
case OOX::et_a_cubicBezTo: case OOX::et_a_cubicBezTo:
{ {
PPTX::Logic::CubicBezTo* pCubicBezierT = dynamic_cast<PPTX::Logic::CubicBezTo*>(oox_unknown); convert(dynamic_cast<PPTX::Logic::CubicBezTo*>(oox_unknown));
convert(pCubicBezierT);
}break; }break;
case OOX::et_a_close: case OOX::et_a_close:
{ {
PPTX::Logic::Close* pClose= dynamic_cast<PPTX::Logic::Close*>(oox_unknown); convert(dynamic_cast<PPTX::Logic::Close*>(oox_unknown));
convert(pClose);
}break; }break;
case OOX::et_p_r:
case OOX::et_a_r: case OOX::et_a_r:
{ {
PPTX::Logic::Run* pRun= dynamic_cast<PPTX::Logic::Run*>(oox_unknown); convert(dynamic_cast<PPTX::Logic::Run*>(oox_unknown));
convert(pRun); }break;
case OOX::et_p_br:
case OOX::et_a_br:
{
convert(dynamic_cast<PPTX::Logic::Br*>(oox_unknown));
}break;
case OOX::et_a_fld:
case OOX::et_p_fld:
{
convert(dynamic_cast<PPTX::Logic::Fld*>(oox_unknown));
}break;
case OOX::et_p_MathPara:
{
convert(dynamic_cast<PPTX::Logic::MathParaWrapper*>(oox_unknown));
}break;
case OOX::et_a_effectStyle:
{
convert(dynamic_cast<PPTX::Logic::EffectStyle*>(oox_unknown));
}break; }break;
//case OOX::et_a_alphaModFix: //case OOX::et_a_alphaModFix:
//{ //{
...@@ -228,28 +238,23 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -228,28 +238,23 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
//}break; //}break;
case OOX::et_v_imagedata: case OOX::et_v_imagedata:
{ {
OOX::Vml::CImageData *vml = dynamic_cast<OOX::Vml::CImageData*>(oox_unknown); convert(dynamic_cast<OOX::Vml::CImageData*>(oox_unknown));
convert(vml);
}break; }break;
case OOX::et_v_textbox: case OOX::et_v_textbox:
{ {
OOX::Vml::CTextbox *vml = dynamic_cast<OOX::Vml::CTextbox*>(oox_unknown); convert(dynamic_cast<OOX::Vml::CTextbox*>(oox_unknown));
convert(vml);
}break; }break;
case OOX::et_v_background: case OOX::et_v_background:
{ {
OOX::Vml::CBackground *vml = dynamic_cast<OOX::Vml::CBackground*>(oox_unknown); convert(dynamic_cast<OOX::Vml::CBackground*>(oox_unknown));
convert(vml);
}break; }break;
case OOX::et_v_path: case OOX::et_v_path:
{ {
OOX::Vml::CPath *vml = dynamic_cast<OOX::Vml::CPath*>(oox_unknown); convert(dynamic_cast<OOX::Vml::CPath*>(oox_unknown));
convert(vml);
}break; }break;
case OOX::et_v_textpath: case OOX::et_v_textpath:
{ {
OOX::Vml::CTextPath *vml = dynamic_cast<OOX::Vml::CTextPath*>(oox_unknown); convert(dynamic_cast<OOX::Vml::CTextPath*>(oox_unknown));
convert(vml);
}break; }break;
case OOX::et_v_fill: case OOX::et_v_fill:
{ {
...@@ -268,13 +273,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -268,13 +273,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
}break; }break;
case OOX::et_v_image: case OOX::et_v_image:
{ {
OOX::Vml::CImage *vml = dynamic_cast<OOX::Vml::CImage*>(oox_unknown); convert(dynamic_cast<OOX::Vml::CImage*>(oox_unknown));
convert(vml);
}break; }break;
case OOX::et_wd_wrap: case OOX::et_wd_wrap:
{ {
OOX::VmlWord::CWrap *vml = dynamic_cast<OOX::VmlWord::CWrap*>(oox_unknown); convert(dynamic_cast<OOX::VmlWord::CWrap*>(oox_unknown));
convert(vml);
}break; }break;
// "ненужные" элементы // "ненужные" элементы
case OOX::et_w_softHyphen: case OOX::et_w_softHyphen:
...@@ -283,26 +286,6 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -283,26 +286,6 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
{ {
//бяка //бяка
}break; }break;
case OOX::et_p_r:
{
convert(dynamic_cast<PPTX::Logic::Run*>(oox_unknown));
}break;
case OOX::et_p_fld:
{
convert(dynamic_cast<PPTX::Logic::Fld*>(oox_unknown));
}break;
case OOX::et_p_br:
{
convert(dynamic_cast<PPTX::Logic::Br*>(oox_unknown));
}break;
case OOX::et_p_MathPara:
{
convert(dynamic_cast<PPTX::Logic::MathParaWrapper*>(oox_unknown));
}break;
case OOX::et_a_effectStyle:
{
convert(dynamic_cast<PPTX::Logic::EffectStyle*>(oox_unknown));
}break;
default: default:
{ {
_CP_LOG << L"[warning] : no convert element(" << oox_unknown->getType() << L")\n"; _CP_LOG << L"[warning] : no convert element(" << oox_unknown->getType() << L")\n";
......
...@@ -300,6 +300,7 @@ namespace PPTX ...@@ -300,6 +300,7 @@ namespace PPTX
class NvPr; class NvPr;
class Paragraph; class Paragraph;
class TxBody; class TxBody;
class TextListStyle;
class TextParagraphPr; class TextParagraphPr;
class TextSpacing; class TextSpacing;
class RunProperties; class RunProperties;
...@@ -392,7 +393,8 @@ public: ...@@ -392,7 +393,8 @@ public:
void convert(PPTX::Logic::CNvSpPr *oox_cnvSpPr); void convert(PPTX::Logic::CNvSpPr *oox_cnvSpPr);
void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr); void convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvPr *oox_nvPr); void convert(PPTX::Logic::NvPr *oox_nvPr);
void convert(PPTX::Logic::Paragraph *oox_para); void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties); void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties * text_properties); void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties * text_properties);
void convert(PPTX::Logic::Run *oox_run); void convert(PPTX::Logic::Run *oox_run);
......
...@@ -420,8 +420,8 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) ...@@ -420,8 +420,8 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
bool list_present = false; bool list_present = false;
std::wstring list_style_name; std::wstring list_style_name;
int list_level = -1; int list_level = -1;
int list_style_id = -1; int list_style_id = -1;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
std::vector<std::pair<int, int>> id_change_properties; std::vector<std::pair<int, int>> id_change_properties;
...@@ -1091,7 +1091,7 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp ...@@ -1091,7 +1091,7 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
/////////////////////////find parent properties /////////////////////////find parent properties
odf_writer::style_paragraph_properties parent_paragraph_properties; odf_writer::style_paragraph_properties parent_paragraph_properties;
odt_context->styles_context()->calc_paragraph_properties(style_name,odf_types::style_family::Paragraph, &parent_paragraph_properties.content_); odt_context->styles_context()->calc_paragraph_properties(style_name, odf_types::style_family::Paragraph, &parent_paragraph_properties.content_);
if (parent_paragraph_properties.content_.outline_level_) if (parent_paragraph_properties.content_.outline_level_)
{ {
...@@ -3323,7 +3323,7 @@ void DocxConverter::convert(OOX::CStyle *oox_style) ...@@ -3323,7 +3323,7 @@ void DocxConverter::convert(OOX::CStyle *oox_style)
std::wstring oox_name = oox_style->m_sStyleId.IsInit() ? *oox_style->m_sStyleId : L""; std::wstring oox_name = oox_style->m_sStyleId.IsInit() ? *oox_style->m_sStyleId : L"";
odt_context->styles_context()->create_style(oox_name,family, false, true, -1); odt_context->styles_context()->create_style(oox_name, family, false, true, -1);
if (oox_style->m_oName.IsInit() && oox_style->m_oName->m_sVal.IsInit()) if (oox_style->m_oName.IsInit() && oox_style->m_oName->m_sVal.IsInit())
...@@ -3331,7 +3331,7 @@ void DocxConverter::convert(OOX::CStyle *oox_style) ...@@ -3331,7 +3331,7 @@ void DocxConverter::convert(OOX::CStyle *oox_style)
if (oox_style->m_oRunPr.IsInit()) if (oox_style->m_oRunPr.IsInit())
{ {
odf_writer::style_text_properties * text_properties = odt_context->styles_context()->last_state()->get_text_properties(); odf_writer::style_text_properties* text_properties = odt_context->styles_context()->last_state()->get_text_properties();
if (oox_style->m_oDefault.IsInit() && oox_style->m_oDefault->ToBool()) if (oox_style->m_oDefault.IsInit() && oox_style->m_oDefault->ToBool())
{ {
...@@ -3366,25 +3366,27 @@ void DocxConverter::convert(OOX::CStyle *oox_style) ...@@ -3366,25 +3366,27 @@ void DocxConverter::convert(OOX::CStyle *oox_style)
{ {
int level = (oox_style->m_oParPr->m_oNumPr->m_oIlvl.IsInit() && oox_style->m_oParPr->m_oNumPr->m_oIlvl->m_oVal.IsInit()) ? int level = (oox_style->m_oParPr->m_oNumPr->m_oIlvl.IsInit() && oox_style->m_oParPr->m_oNumPr->m_oIlvl->m_oVal.IsInit()) ?
oox_style->m_oParPr->m_oNumPr->m_oIlvl->m_oVal->GetValue() : -1; oox_style->m_oParPr->m_oNumPr->m_oIlvl->m_oVal->GetValue() : -1;
int id = (oox_style->m_oParPr->m_oNumPr->m_oNumID.IsInit() && oox_style->m_oParPr->m_oNumPr->m_oNumID->m_oVal.IsInit()) ? int id = (oox_style->m_oParPr->m_oNumPr->m_oNumID.IsInit() && oox_style->m_oParPr->m_oNumPr->m_oNumID->m_oVal.IsInit()) ?
oox_style->m_oParPr->m_oNumPr->m_oNumID->m_oVal->GetValue() : -1; oox_style->m_oParPr->m_oNumPr->m_oNumID->m_oVal->GetValue() : -1;
if (level<0 && id >=0) level =0; if (level < 0 && id >= 0) level =0;
if (level >=0 && id >=0) if (level >= 0 && id >= 0)
{ {
odt_context->styles_context()->last_state()->set_list_style_level(level); odt_context->styles_context()->last_state()->set_list_style_level(level);
odt_context->styles_context()->last_state()->set_list_style_id(id); odt_context->styles_context()->last_state()->set_list_style_id(id);
odt_context->styles_context()->last_state()->set_list_style_exist(true); odt_context->styles_context()->last_state()->set_list_style_exist(true);
std::wstring list_style_name = odt_context->styles_context()->lists_styles().get_style_name(id); std::wstring list_style_name = odt_context->styles_context()->lists_styles().get_style_name(id);
odt_context->styles_context()->last_state()->set_list_style_name(list_style_name); } odt_context->styles_context()->last_state()->set_list_style_name(list_style_name);
}
} }
} }
if (oox_style->m_oBasedOn.IsInit() && oox_style->m_oBasedOn->m_sVal.IsInit()) if (oox_style->m_oBasedOn.IsInit() && oox_style->m_oBasedOn->m_sVal.IsInit())
odt_context->styles_context()->last_state()->set_parent_style_name(*oox_style->m_oBasedOn->m_sVal); odt_context->styles_context()->last_state()->set_parent_style_name(*oox_style->m_oBasedOn->m_sVal);
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oQFormat; //nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue>> m_oQFormat;
//nullable<ComplexTypes::Word::std::wstring_ > m_oAliases; //nullable<ComplexTypes::Word::std::wstring_> m_oAliases;
} }
......
...@@ -234,7 +234,7 @@ void PptxConverter::convert_styles() ...@@ -234,7 +234,7 @@ void PptxConverter::convert_styles()
if (slide->theme->themeElements.fontScheme.majorFont.ea.typeface.empty() == false) if (slide->theme->themeElements.fontScheme.majorFont.ea.typeface.empty() == false)
text_properties->content_.style_font_family_asian_ = slide->theme->themeElements.fontScheme.majorFont.ea.typeface; text_properties->content_.style_font_family_asian_ = slide->theme->themeElements.fontScheme.majorFont.ea.typeface;
} }
convert(presentation->defaultTextStyle.GetPointer()); //стили дефалтовых списков //convert(presentation->defaultTextStyle.GetPointer()); //стили дефалтовых списков
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -298,9 +298,11 @@ void PptxConverter::convert_slides() ...@@ -298,9 +298,11 @@ void PptxConverter::convert_slides()
master_style_name += std::to_wstring(m_mapMasters.size()); master_style_name += std::to_wstring(m_mapMasters.size());
odp_context->start_master_slide(master_style_name); odp_context->start_master_slide(master_style_name);
current_slide = slide->Master.operator->(); //if (slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true)
convert_slide(&slide->Master->cSld, false);//slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true); {
current_slide = slide->Master.operator->();
convert_slide(&slide->Master->cSld, false);
}
if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit()) if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer(); current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->(); current_slide = slide->Layout.operator->();
...@@ -876,12 +878,24 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, bool bPlaceholde ...@@ -876,12 +878,24 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, bool bPlaceholde
if (pShape.IsInit() && pShape->nvSpPr.nvPr.ph.is_init()) if (pShape.IsInit() && pShape->nvSpPr.nvPr.ph.is_init())
{ {
pShape->FillLevelUp();
if (bPlaceholders) if (bPlaceholders)
convert(pElem.operator->()); {
PPTX::Logic::Shape update_shape;
pShape->levelUp->Merge(update_shape, true);
pShape->Merge(update_shape);
OoxConverter::convert(&update_shape);
}
else
{
OoxConverter::convert(pShape.operator->());
}
} }
else else
{ {
convert(pElem.operator->()); OoxConverter::convert(pElem.operator->());
} }
//convert(oox_slide->spTree.SpTreeElems[i].GetElem().operator->()); //convert(oox_slide->spTree.SpTreeElems[i].GetElem().operator->());
} }
......
...@@ -43,7 +43,8 @@ namespace PPTX ...@@ -43,7 +43,8 @@ namespace PPTX
{ {
Shape::Shape(std::wstring name_) Shape::Shape(std::wstring name_)
{ {
m_name = name_; m_name = name_;
levelUp = NULL;
} }
Shape::~Shape() Shape::~Shape()
...@@ -52,17 +53,19 @@ namespace PPTX ...@@ -52,17 +53,19 @@ namespace PPTX
Shape::Shape(XmlUtils::CXmlNode& node) Shape::Shape(XmlUtils::CXmlNode& node)
{ {
levelUp = NULL;
fromXML(node); fromXML(node);
} }
Shape::Shape(XmlUtils::CXmlLiteReader& oReader)
{
levelUp = NULL;
fromXML(oReader);
}
const Shape& Shape::operator =(XmlUtils::CXmlNode& node) const Shape& Shape::operator =(XmlUtils::CXmlNode& node)
{ {
fromXML(node); fromXML(node);
return *this; return *this;
} }
Shape::Shape(XmlUtils::CXmlLiteReader& oReader)
{
fromXML(oReader);
}
const Shape& Shape::operator =(XmlUtils::CXmlLiteReader& oReader) const Shape& Shape::operator =(XmlUtils::CXmlLiteReader& oReader)
{ {
fromXML(oReader); fromXML(oReader);
...@@ -617,7 +620,14 @@ namespace PPTX ...@@ -617,7 +620,14 @@ namespace PPTX
if (!bIsSlidePlaceholder) if (!bIsSlidePlaceholder)
{ {
if(txBody.IsInit()) if(txBody.IsInit())
{
if(!shape.txBody.is_init())
shape.txBody = new TxBody();
txBody->Merge(shape.txBody); txBody->Merge(shape.txBody);
shape.txBody->Paragrs = txBody->Paragrs;
}
} }
else else
{ {
......
...@@ -310,9 +310,8 @@ namespace PPTX ...@@ -310,9 +310,8 @@ namespace PPTX
void FillShapeProperties(ShapeProperties& props); void FillShapeProperties(ShapeProperties& props);
void FillShapeTextProperties(CShapeTextProperties& props); void FillShapeTextProperties(CShapeTextProperties& props);
private:
void FillLevelUp()const; void FillLevelUp()const;
mutable Shape const * levelUp; mutable Shape const * levelUp;
void Merge(Shape& shape, bool bIsSlidePlaceholder = false)const; void Merge(Shape& shape, bool bIsSlidePlaceholder = false)const;
public: public:
......
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