Commit ab72c897 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - presentation hyperlink, backgrounds slides & masters

parent a204c576
......@@ -39,6 +39,13 @@
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val)
{
// 5ms = 5 milliseconds
_Wostream << _Val.get_value() << "ms"; // todoooo усложнить ..
return _Wostream;
}
static bool parseTime(const std::wstring & Time, double & Hours, double & Minutes, double & Seconds, int & Ms)
{
try
......@@ -115,7 +122,6 @@ clockvalue clockvalue::parse(const std::wstring & Str)
{
int v=0;
int ms=0;
double h=0,m=0,s =0;
bool res = parseTime(Str,h,m,s,ms);
......
......@@ -57,6 +57,8 @@ private:
int value_;//in ms
};
std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val);
}
APPLY_PARSE_XML_ATTRIBUTES(odf_types::clockvalue);
......
......@@ -624,9 +624,6 @@ void common_horizontal_pos_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"svg:x", svg_x_);
}
// common_num_format_attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_num_format_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:num-format", style_num_format_);
......@@ -643,9 +640,6 @@ void common_num_format_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"style:num-letter-sync", style_num_letter_sync_);
}
// common_num_format_prefix_suffix_attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_num_format_prefix_suffix_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:num-prefix", style_num_prefix_);
......@@ -662,9 +656,6 @@ void common_num_format_prefix_suffix_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"style:num-suffix", style_num_suffix_);
}
/// common-draw-style-name-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_style_name_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:style-name", draw_style_name_);
......@@ -686,8 +677,6 @@ void common_draw_style_name_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"presentation:style-name", presentation_style_name_);
CP_XML_ATTR_OPT(L"presentation:class-names", presentation_class_names_);
}
/// common-draw-z-index-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_z_index_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
......@@ -702,9 +691,6 @@ void common_draw_z_index_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:z-index", draw_z_index_);
}
/// common-draw-id-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_id_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:id", draw_id_);
......@@ -717,8 +703,6 @@ void common_draw_id_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:id", draw_id_);
}
// common-draw-layer-name-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_layer_name_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
......@@ -732,8 +716,6 @@ void common_draw_layer_name_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:layer", draw_layer_);
}
// common-draw-transform-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_transform_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
......@@ -748,9 +730,6 @@ void common_draw_transform_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"draw:transform", draw_transform_);
}
// common-draw-name-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_name_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"draw:name", draw_name_);
......@@ -763,8 +742,6 @@ void common_draw_name_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:name", draw_name_);
}
/// common-text-spreadsheet-shape-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_text_spreadsheet_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
......@@ -791,9 +768,6 @@ void common_text_spreadsheet_shape_attlist::serialize(CP_ATTR_NODE)
common_text_anchor_attlist_.serialize(CP_GET_XML_NODE());
}
/// common-draw-shape-with-styles-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_shape_with_styles_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_draw_z_index_attlist_.add_attributes(Attributes);
......@@ -814,6 +788,7 @@ void common_draw_shape_with_styles_attlist::apply_from(const common_draw_shape_w
common_draw_name_attlist_.apply_from( Other.common_draw_name_attlist_);
common_text_spreadsheet_shape_attlist_.apply_from( Other.common_text_spreadsheet_shape_attlist_);
}
void common_draw_shape_with_styles_attlist::serialize(CP_ATTR_NODE)
{
common_draw_z_index_attlist_.serialize(CP_GET_XML_NODE());
......@@ -824,8 +799,6 @@ void common_draw_shape_with_styles_attlist::serialize(CP_ATTR_NODE)
common_draw_name_attlist_.serialize(CP_GET_XML_NODE());
common_text_spreadsheet_shape_attlist_.serialize(CP_GET_XML_NODE());
}
/// common-draw-text-style-name-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_text_style_name_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
......@@ -839,7 +812,6 @@ void common_draw_text_style_name_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:text-style-name", draw_text_style_name_);
}
/// common-draw-shape-with-text-and-styles-attlist
void common_draw_shape_with_text_and_styles_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
......@@ -857,9 +829,6 @@ void common_draw_shape_with_text_and_styles_attlist::serialize(CP_ATTR_NODE)
common_draw_text_style_name_attlist_.serialize(CP_GET_XML_NODE());
}
/// common-draw-position-attlist
//////////////////////////////////////////////////////////////////////////////////////////////////
void common_draw_position_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"svg:x", svg_x_);
......@@ -876,27 +845,6 @@ void common_draw_position_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"svg:y", svg_y_);
}
/// presentation-shape-attlist
void presentation_shape_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"presentation:class", presentation_class_);
CP_APPLY_ATTR(L"presentation:placeholder", presentation_placeholder_);
CP_APPLY_ATTR(L"presentation:user-transformed", presentation_user_transformed_);
}
void presentation_shape_attlist::apply_from(const presentation_shape_attlist & Other)
{
_CP_APPLY_PROP2(presentation_class_);
_CP_APPLY_PROP2(presentation_placeholder_);
_CP_APPLY_PROP2(presentation_user_transformed_);
}
void presentation_shape_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"presentation:class", presentation_class_);
CP_XML_ATTR_OPT(L"presentation:placeholder", presentation_placeholder_);
CP_XML_ATTR_OPT(L"presentation:user-transformed", presentation_user_transformed_);
}
/// common-data-style-attlist
void common_data_style_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:name", style_name_);
......@@ -930,18 +878,21 @@ void common_presentation_attlist::add_attributes( const xml::attributes_wc_ptr &
CP_APPLY_ATTR(L"presentation:class", presentation_class_);
CP_APPLY_ATTR(L"presentation:style-name", style_name_);
CP_APPLY_ATTR(L"presentation:placeholder", presentation_placeholder_);
CP_APPLY_ATTR(L"presentation:user-transformed", presentation_user_transformed_);
}
void common_presentation_attlist::apply_from(const common_presentation_attlist & Other)
{
_CP_APPLY_PROP(presentation_class_, Other.presentation_class_);
_CP_APPLY_PROP(style_name_, Other.style_name_);
_CP_APPLY_PROP(presentation_placeholder_, Other.presentation_placeholder_);
_CP_APPLY_PROP(presentation_user_transformed_, Other.presentation_user_transformed_);
}
void common_presentation_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"presentation:class", presentation_class_);
CP_XML_ATTR_OPT(L"presentation:style-name", style_name_);
CP_XML_ATTR_OPT(L"presentation:placeholder", presentation_placeholder_);
CP_XML_ATTR_OPT(L"presentation:user-transformed", presentation_user_transformed_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -528,24 +528,22 @@ public:
_CP_OPT(std::wstring) draw_transform_;
};
/// common-draw-name-attlist
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);
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_;
};
/// common-text-spreadsheet-shape-attlist
class common_text_spreadsheet_shape_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_text_spreadsheet_shape_attlist & Other);
void serialize(CP_ATTR_NODE);
void add_attributes (const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_text_spreadsheet_shape_attlist & Other);
void serialize (CP_ATTR_NODE);
_CP_OPT(std::wstring) table_end_cell_address_;
_CP_OPT(length) table_end_x_;
......@@ -555,14 +553,12 @@ public:
};
/// common-draw-shape-with-styles-attlist
class common_draw_shape_with_styles_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_draw_shape_with_styles_attlist & Other);
void serialize(CP_ATTR_NODE);
void add_attributes (const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_draw_shape_with_styles_attlist & Other);
void serialize (CP_ATTR_NODE);
common_draw_z_index_attlist common_draw_z_index_attlist_;
common_draw_id_attlist common_draw_id_attlist_;
......@@ -574,7 +570,6 @@ public:
};
/// common-draw-text-style-name-attlist
class common_draw_text_style_name_attlist
{
public:
......@@ -585,7 +580,6 @@ public:
_CP_OPT(style_ref) draw_text_style_name_;
};
/// common-draw-position-attlist
class common_draw_position_attlist
{
public:
......@@ -598,7 +592,6 @@ public:
};
/// common-draw-shape-with-text-and-styles-attlist
class common_draw_shape_with_text_and_styles_attlist
{
public:
......@@ -610,21 +603,6 @@ public:
common_draw_text_style_name_attlist common_draw_text_style_name_attlist_;
};
/// presentation-shape-attlist
class presentation_shape_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const presentation_shape_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) presentation_class_;
_CP_OPT(Bool) presentation_placeholder_;
_CP_OPT(Bool) presentation_user_transformed_;
};
/// common-data-style-attlist
class common_data_style_attlist
{
public:
......@@ -643,7 +621,6 @@ public:
};
struct union_common_draw_attlists
{
common_draw_shape_with_text_and_styles_attlist shape_with_text_and_styles_;
......@@ -653,29 +630,25 @@ struct union_common_draw_attlists
void serialize(CP_ATTR_NODE);
};
// common-presentation-attlist
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);
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_;
};
// common-anim-smil-attlist
class common_anim_smil_attlist
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void apply_from(const common_anim_smil_attlist & Other);
void serialize(CP_ATTR_NODE){}
void add_attributes ( const xml::attributes_wc_ptr & Attributes );
void apply_from (const common_anim_smil_attlist & Other);
void serialize (CP_ATTR_NODE){}
//_CP_OPT(std::wstring) smil_direction_;
//_CP_OPT(std::wstring) smil_subtype_;
......
......@@ -37,6 +37,55 @@
namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const smil_transition_type & _Val)
{
switch(_Val.get_type())
{
case smil_transition_type::barWipe : _Wostream << L"barwipe" ; break;
case smil_transition_type::boxWipe : _Wostream << L"boxwipe" ; break;
case smil_transition_type::fourBoxWipe : _Wostream << L"fourboxwipe" ; break;
case smil_transition_type::barnDoorWipe : _Wostream << L"barndoorwipe" ; break;
case smil_transition_type::diagonalWipe : _Wostream << L"diagonalwipe" ; break;
case smil_transition_type::bowTieWipe : _Wostream << L"bowtiewipe" ; break;
case smil_transition_type::miscDiagonalWipe : _Wostream << L"miscdiagonalwipe"; break;
case smil_transition_type::veeWipe : _Wostream << L"veewipe" ; break;
case smil_transition_type::barnVeeWipe : _Wostream << L"barnveewipe" ; break;
case smil_transition_type::zigZagWipe : _Wostream << L"zigzagwipe" ; break;
case smil_transition_type::barnZigZagWipe : _Wostream << L"barnzigzagwipe" ; break;
case smil_transition_type::irisWipe : _Wostream << L"iriswipe" ; break;
case smil_transition_type::triangleWipe : _Wostream << L"trianglewipe" ; break;
case smil_transition_type::arrowHeadWipe : _Wostream << L"arrowheadwipe" ; break;
case smil_transition_type::pentagonWipe : _Wostream << L"pentagonwipe" ; break;
case smil_transition_type::hexagonWipe : _Wostream << L"hexagonwipe" ; break;
case smil_transition_type::ellipseWipe : _Wostream << L"ellipsewipe" ; break;
case smil_transition_type::eyeWipe : _Wostream << L"eyewipe" ; break;
case smil_transition_type::roundRectWipe : _Wostream << L"roundrectwipe" ; break;
case smil_transition_type::starWipe : _Wostream << L"starwipe" ; break;
case smil_transition_type::miscShapeWipe : _Wostream << L"miscshapewipe" ; break;
case smil_transition_type::clockWipe : _Wostream << L"clockwipe" ; break;
case smil_transition_type::pinWheelWipe : _Wostream << L"pinwheelwipe" ; break;
case smil_transition_type::singleSweepWipe : _Wostream << L"singlesweepwipe" ; break;
case smil_transition_type::fanWipe : _Wostream << L"fanwipe" ; break;
case smil_transition_type::doubleFanWipe : _Wostream << L"doublefanwipe" ; break;
case smil_transition_type::doubleSweepWipe : _Wostream << L"doublesweepwipe" ; break;
case smil_transition_type::saloonDoorWipe : _Wostream << L"saloondoorwipe" ; break;
case smil_transition_type::windshieldWipe : _Wostream << L"windshieldwipe" ; break;
case smil_transition_type::snakeWipe : _Wostream << L"snakewipe" ; break;
case smil_transition_type::spiralWipe : _Wostream << L"spiralwipe" ; break;
case smil_transition_type::parallelSnakesWipe: _Wostream << L"parallelsnakeswipe"; break;
case smil_transition_type::boxSnakesWipe : _Wostream << L"boxsnakeswipe" ; break;
case smil_transition_type::waterfallWipe : _Wostream << L"waterfallwipe" ; break;
case smil_transition_type::pushWipe : _Wostream << L"pushwipe" ; break;
case smil_transition_type::slideWipe : _Wostream << L"slidewipe" ; break;
case smil_transition_type::fade : _Wostream << L"fade" ; break;
case smil_transition_type::checkerBoardWipe : _Wostream << L"checkerboardwipe"; break;
case smil_transition_type::blindsWipe : _Wostream << L"blindswipe" ; break;
case smil_transition_type::dissolve : _Wostream << L"dissolve" ; break;
case smil_transition_type::randomBarWipe : _Wostream << L"randombarwipe" ; break;
}
return _Wostream;
}
smil_transition_type smil_transition_type::parse(const std::wstring & Str)
{
std::wstring tmp = Str;
......
......@@ -172,8 +172,6 @@ void draw_frame::add_attributes( const xml::attributes_wc_ptr & Attributes )
common_draw_attlists_.position_.add_attributes(Attributes);
common_draw_attlists_.rel_size_.add_attributes(Attributes);
presentation_shape_attlist_.add_attributes(Attributes);
draw_frame_attlist_.add_attributes(Attributes);
}
......
......@@ -164,7 +164,6 @@ public:
odf_types::common_presentation_attlist common_presentation_attlist_;
odf_types::union_common_draw_attlists common_draw_attlists_;
odf_types::presentation_shape_attlist presentation_shape_attlist_;
draw_frame_attlist draw_frame_attlist_;
// draw-text-box, draw-image, draw-object, draw-object-ole, draw-applet, draw-floating-frame, draw-plugin
......
......@@ -141,9 +141,9 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
odf_reader::style_instance* baseStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(baseStyleName, odf_types::style_family::Presentation,Context.process_masters_);
if (baseStyleInst && ((!presentation_shape_attlist_.presentation_user_transformed_) ||
((presentation_shape_attlist_.presentation_user_transformed_) &&
(presentation_shape_attlist_.presentation_user_transformed_->get()== false))))//векторная фигура презентаций
if (baseStyleInst && ((!common_presentation_attlist_.presentation_user_transformed_) ||
((common_presentation_attlist_.presentation_user_transformed_) &&
(common_presentation_attlist_.presentation_user_transformed_->get()== false))))//векторная фигура презентаций
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Presentation);
if (defaultStyle)instances.push_back(defaultStyle);
......
......@@ -43,7 +43,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;USE_LITE_READER;_USE_XMLLITE_READER_;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;__WORDSIZE=32;DONT_WRITE_EMBEDDED_FONTS"
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"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
......
......@@ -129,10 +129,10 @@ public:
int idx_in_owner ;
odf_types::presentation_shape_attlist presentation_shape_attlist_;
draw_frame_attlist draw_frame_attlist_;
office_element_ptr office_event_listeners_; // в content перенести нельзя - иначе событи будет добавляться не к этому объекту а следующему
office_element_ptr office_event_listeners_;
// в content перенести нельзя - иначе событи будет добавляться не к этому объекту а следующему
office_element_ptr draw_glue_point_;
office_element_ptr draw_image_map_;
//office_element_ptr draw_chart_map_;
......
......@@ -39,10 +39,9 @@
#include "office_elements_create.h"
#include "length.h"
#include "anchortype.h"
#include "stylewrap.h"
#include "gradientstyle.h"
#include "common_attlists.h"
namespace OOX {namespace Vml { class CShapeType; }}
......@@ -60,6 +59,8 @@ public:
odf_drawing_context (odf_conversion_context *odf_context);
~odf_drawing_context ();
void set_presentation (bool bMaster);
void set_drawings_rect (_CP_OPT(double) x_pt, _CP_OPT(double) y_pt, _CP_OPT(double) width_pt, _CP_OPT(double) height_pt);
void clear ();
void set_styles_context (odf_style_context* styles_context);//для embedded
......@@ -99,6 +100,7 @@ public:
void start_drawing();
void end_drawing();
void end_drawing_background(odf_types::common_draw_fill_attlist & common_draw_attlist);
void start_group();
void set_group_flip_H (bool bVal);
......@@ -138,7 +140,7 @@ public:
office_element_ptr & get_root_element();
void start_element (office_element_ptr & elm, office_element_ptr style_elm = office_element_ptr());
void start_element (office_element_ptr elm, office_element_ptr style_elm = office_element_ptr());
void end_element ();
bool is_exist_content();
......@@ -204,6 +206,7 @@ public:
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_layer (std::wstring val);
//////////////////////////////////////////////////////////////////////////////////////
void start_gradient_style ();
void set_gradient_type (odf_types::gradient_style::type style);
......
......@@ -60,6 +60,8 @@ public:
void set_styles_context (odf_style_context * Context);
void create_layer_sets();
void add_master_page(std::wstring oox_name);
void create_layout_page();
......
......@@ -86,7 +86,16 @@ void odf_master_state::set_name(std::wstring & name)
style_->style_master_page_attlist_.style_name_ = name;
}
void odf_master_state::set_layout_name(std::wstring name)
void odf_master_state::set_display_name(std::wstring & name)
{
style_master_page* style_ = dynamic_cast<style_master_page*>(elements_[0].elm.get());
if (!style_)return;
style_->style_master_page_attlist_.style_display_name_ = name;
}
void odf_master_state::set_layout_style_name(std::wstring name)
{
style_master_page* style_ = dynamic_cast<style_master_page*>(elements_[0].elm.get());
......
......@@ -69,10 +69,11 @@ public:
void set_name(std::wstring & name);
std::wstring get_name();
void add_footer(office_element_ptr & elm);
void add_header(office_element_ptr & elm);
void add_footer (office_element_ptr & elm);
void add_header (office_element_ptr & elm);
void set_layout_name(std::wstring name);
void set_layout_style_name (std::wstring name);
void set_display_name (std::wstring & name);
office_element_ptr & get_root();
office_element_ptr & get_last_element();
......
......@@ -59,7 +59,7 @@ void calc_paragraph_properties_content(std::vector<style_paragraph_properties*>
BOOST_REVERSE_FOREACH(style_paragraph_properties* v, parProps)
{
if (v)
result->apply_from(v->content());
result->apply_from(v->content_);
}
}
......@@ -432,7 +432,7 @@ void odf_style_context::calc_paragraph_properties(std::wstring style_name, style
style *style_ = NULL;
if (!find_odf_style(style_name, family, style_) || !style_)break;
if (style_paragraph_properties * parProp = style_->style_content_.get_style_paragraph_properties())
if (style_paragraph_properties * parProp = style_->content_.get_style_paragraph_properties())
parProps.push_back(parProp);
style_name = style_->style_parent_style_name_ ? *style_->style_parent_style_name_ : L"";
......
......@@ -202,18 +202,18 @@ void odf_style_state::apply_from(style* other_style)
//style_->style_parent_style_name_ = other_style->style_parent_style_name_;
//style_paragraph_properties * props = style_->style_content_.get_style_text_properties();
//if (props)props->apply_from(other_style->style_content_.get_style_paragraph_properties());
//style_paragraph_properties * props = style_->content_.get_style_text_properties();
//if (props)props->apply_from(other_style->content_.get_style_paragraph_properties());
}
//////////////////////////////////////////////////////////////////
style_text_properties * odf_style_state::get_text_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_) return style_->style_content_.get_style_text_properties();
if (style_) return style_->content_.get_style_text_properties();
default_style* style_d_ = dynamic_cast<default_style*>(odf_style_.get());
if (style_d_)return style_d_->style_content_.get_style_text_properties();
if (style_d_)return style_d_->content_.get_style_text_properties();
return NULL;
}
......@@ -221,10 +221,10 @@ style_text_properties * odf_style_state::get_text_properties()
style_paragraph_properties * odf_style_state::get_paragraph_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_) return style_->style_content_.get_style_paragraph_properties();
if (style_) return style_->content_.get_style_paragraph_properties();
default_style* style_d = dynamic_cast<default_style*>(odf_style_.get());
if (style_d) return style_d->style_content_.get_style_paragraph_properties();
if (style_d) return style_d->content_.get_style_paragraph_properties();
return NULL;
}
......@@ -232,20 +232,20 @@ style_paragraph_properties * odf_style_state::get_paragraph_properties()
style_graphic_properties * odf_style_state::get_graphic_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_)return style_->style_content_.get_style_graphic_properties();
if (style_)return style_->content_.get_style_graphic_properties();
default_style* default_style_ = dynamic_cast<default_style*>(odf_style_.get());
if (default_style_)return default_style_->style_content_.get_style_graphic_properties();
if (default_style_)return default_style_->content_.get_style_graphic_properties();
return NULL;
}
style_table_properties * odf_style_state::get_table_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_) return style_->style_content_.get_style_table_properties();
if (style_) return style_->content_.get_style_table_properties();
default_style* default_style_ = dynamic_cast<default_style*>(odf_style_.get());
if (default_style_) return default_style_->style_content_.get_style_table_properties();
if (default_style_) return default_style_->content_.get_style_table_properties();
return NULL;
}
......@@ -253,10 +253,10 @@ style_table_properties * odf_style_state::get_table_properties()
style_section_properties * odf_style_state::get_section_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_) return style_->style_content_.get_style_section_properties();
if (style_) return style_->content_.get_style_section_properties();
default_style* default_style_ = dynamic_cast<default_style*>(odf_style_.get());
if (default_style_) return default_style_->style_content_.get_style_section_properties();
if (default_style_) return default_style_->content_.get_style_section_properties();
return NULL;
}
......@@ -264,10 +264,10 @@ style_section_properties * odf_style_state::get_section_properties()
style_table_cell_properties * odf_style_state::get_table_cell_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_) return style_->style_content_.get_style_table_cell_properties();
if (style_) return style_->content_.get_style_table_cell_properties();
default_style* default_style_ = dynamic_cast<default_style*>(odf_style_.get());
if (default_style_) return default_style_->style_content_.get_style_table_cell_properties();
if (default_style_) return default_style_->content_.get_style_table_cell_properties();
return NULL;
}
......@@ -275,10 +275,10 @@ style_table_cell_properties * odf_style_state::get_table_cell_properties()
style_table_row_properties * odf_style_state::get_table_row_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_) return style_->style_content_.get_style_table_row_properties();
if (style_) return style_->content_.get_style_table_row_properties();
default_style* default_style_ = dynamic_cast<default_style*>(odf_style_.get());
if (default_style_) return default_style_->style_content_.get_style_table_row_properties();
if (default_style_) return default_style_->content_.get_style_table_row_properties();
return NULL;
}
......@@ -286,10 +286,10 @@ style_table_row_properties * odf_style_state::get_table_row_properties()
style_table_column_properties * odf_style_state::get_table_column_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_) return style_->style_content_.get_style_table_column_properties();
if (style_) return style_->content_.get_style_table_column_properties();
default_style* default_style_ = dynamic_cast<default_style*>(odf_style_.get());
if (default_style_) return default_style_->style_content_.get_style_table_column_properties();
if (default_style_) return default_style_->content_.get_style_table_column_properties();
return NULL;
}
......@@ -297,10 +297,10 @@ style_table_column_properties * odf_style_state::get_table_column_properties()
style_chart_properties * odf_style_state::get_chart_properties()
{
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (style_) return style_->style_content_.get_style_chart_properties();
if (style_) return style_->content_.get_style_chart_properties();
default_style* default_style_ = dynamic_cast<default_style*>(odf_style_.get());
if (default_style_) return default_style_->style_content_.get_style_chart_properties();
if (default_style_) return default_style_->content_.get_style_chart_properties();
return NULL;
}
......@@ -309,7 +309,7 @@ style_chart_properties * odf_style_state::get_chart_properties()
// style* style_ = dynamic_cast<style*>(odf_style_.get());
// if (!style_)return NULL;
//
// return style_->style_content_.get_style_drawing_page_properties();
// return style_->content_.get_style_drawing_page_properties();
//}
///////////////////////
......
......@@ -183,7 +183,7 @@ void odf_table_context::end_table()
{
if (impl_->current_table().table_width > 0)
{
style_table_properties * table_props = style_->style_content_.get_style_table_properties();
style_table_properties * table_props = style_->content_.get_style_table_properties();
if (table_props)
{
table_props->table_format_properties_.style_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);
......@@ -313,7 +313,7 @@ void odf_table_context::set_column_optimal(bool val)
style *style_ = dynamic_cast<style*>(impl_->current_table().columns.back().style_elm.get());
if (style_ == NULL) return;
style_table_column_properties *properties = style_->style_content_.get_style_table_column_properties();
style_table_column_properties *properties = style_->content_.get_style_table_column_properties();
if (properties == NULL) return;
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = val;
......@@ -330,7 +330,7 @@ void odf_table_context::change_current_column_width(double width)
style *style_ = dynamic_cast<style*>(impl_->current_table().columns[index].style_elm.get());
if (style_ == NULL) return;
style_table_column_properties *properties = style_->style_content_.get_style_table_column_properties();
style_table_column_properties *properties = style_->content_.get_style_table_column_properties();
if (properties == NULL) return;
length length_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
......@@ -353,7 +353,7 @@ void odf_table_context::set_column_width(double width)
style *style_ = dynamic_cast<style*>(impl_->current_table().columns.back().style_elm.get());
if (style_ == NULL) return;
style_table_column_properties *properties = style_->style_content_.get_style_table_column_properties();
style_table_column_properties *properties = style_->content_.get_style_table_column_properties();
if (properties == NULL) return;
if (width > 0)
......
......@@ -174,9 +174,9 @@ void odf_text_context::set_symbol_font(const std::wstring & font)
{
if (text_properties_ == NULL) return;
text_properties_->text_format_properties_content_.fo_font_family_ = font;
text_properties_->text_format_properties_content_.style_font_family_complex_ = font;
text_properties_->text_format_properties_content_.style_font_family_asian_ = font;
text_properties_->content_.fo_font_family_ = font;
text_properties_->content_.style_font_family_complex_ = font;
text_properties_->content_.style_font_family_asian_ = font;
}
void odf_text_context::set_symbol_text(int sym)
{
......@@ -238,7 +238,7 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled)
{
if (parent_paragraph_style_.length() >0)style_->style_parent_style_name_ = parent_paragraph_style_;
paragraph_properties_ = style_->style_content_.get_style_paragraph_properties();
paragraph_properties_ = style_->content_.get_style_paragraph_properties();
}
}
else if (parent_paragraph_style_.length() >0)
......@@ -251,7 +251,7 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled)
}
if (paragraph_properties_ && need_break_)
{
paragraph_properties_->content().fo_break_before_ = need_break_;
paragraph_properties_->content_.fo_break_before_ = need_break_;
need_break_ = boost::none;
}
......@@ -332,7 +332,7 @@ void odf_text_context::start_span(bool styled)
{
style_->style_parent_style_name_ = parent_span_style_;
}
text_properties_ = style_->style_content_.get_style_text_properties();//для буквиц на поле
text_properties_ = style_->content_.get_style_text_properties();//для буквиц на поле
}
}
......@@ -514,6 +514,26 @@ void odf_text_context::add_text_style(office_element_ptr & style_elm, std::wstri
h->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(style_name);
}
}
void odf_text_context::add_hyperlink (std::wstring ref, std::wstring display_text)
{
office_element_ptr elm;
create_element(L"text", L"a", elm, odf_context_);
text_a* hyperlink = dynamic_cast<text_a*>(elm.get());
if (!hyperlink)return;
if (!display_text.empty())
hyperlink->add_text(display_text);
////////////////////////////
hyperlink->common_xlink_attlist_.href_ = ref;
hyperlink->common_xlink_attlist_.type_ = xlink_type::Simple;
if (current_level_.size()>0)
current_level_.back().elm->add_child_element(elm);
}
void odf_text_context::add_tab(_CP_OPT(int) ref)
{
office_element_ptr elm;
......@@ -560,7 +580,7 @@ void odf_text_context::save_property_break()
}
}
if (paragraph_properties_ == NULL) return;
paragraph_properties_->content().fo_break_before_ = need_break_;
paragraph_properties_->content_.fo_break_before_ = need_break_;
need_break_ = boost::none;
}
......
......@@ -95,6 +95,7 @@ public:
void save_property_break();
void add_tab (_CP_OPT(int) ref = boost::none);
void add_hyperlink (std::wstring ref, std::wstring display_text);
void set_outline_level (int level);
bool get_list_item_state() {return list_state_.levels.size() > 0 ? list_state_.levels.back() : false;}
......
......@@ -72,25 +72,22 @@ void odp_conversion_context::end_document()
}
void odp_conversion_context::start_slide()
{
create_element(L"draw", L"page", root_presentation_->pages_, this);
slide_context_.set_styles_context(styles_context());
create_element(L"draw", L"page", root_presentation_->pages_, this);
slide_context_.start_page(root_presentation_->pages_.back());
drawing_context()->set_styles_context(styles_context());
//page_layout_context()->set_styles_context(styles_context());
drawing_context()->set_presentation(false);
}
std::wstring odp_conversion_context::start_master_slide()
{
std::wstring name;
page_layout_context()->add_master_page(name);
name = page_layout_context()->last_master()->get_name();
void odp_conversion_context::start_master_slide(std::wstring name)
{
slide_context_.set_styles_context(page_layout_context()->get_local_styles_context());
page_layout_context()->add_master_page(name);
slide_context_.start_page(page_layout_context()->last_master()->get_root());
drawing_context()->set_styles_context(page_layout_context()->get_local_styles_context());
return name;
drawing_context()->set_presentation(true);
}
void odp_conversion_context::end_master_slide()
......
......@@ -52,7 +52,7 @@ public:
void start_slide();
void end_slide();
std::wstring start_master_slide();
void start_master_slide(std::wstring name);
void end_master_slide();
///////////////////////////////////////////////////////
......
......@@ -60,7 +60,7 @@ namespace odf_writer {
odp_page_state::odp_page_state(odf_conversion_context * Context, office_element_ptr & elm)
: context_(Context), drawing_context_(Context)
{
draw_page_ = elm;
page_elm_ = elm;
}
......@@ -70,16 +70,22 @@ void odp_page_state::set_page_name(std::wstring name)
office_page_name_ = name;
draw_page* page = dynamic_cast<draw_page*>(draw_page_.get());
if (page == NULL)return;
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page)
page->draw_page_attr_.draw_name_ = name;
else
{
//style_master_page *master_page = dynamic_cast<style_master_page*>(page_elm_.get());
//if (master_page)
// master_page->style_master_page_attlist_.style_display_name_ = name;
}
}
void odp_page_state::set_master_page(std::wstring name)
{
if (name.empty())return;
draw_page* page = dynamic_cast<draw_page*>(draw_page_.get());
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page == NULL)return;
page->draw_page_attr_.master_page_name_ = name;
......@@ -87,19 +93,25 @@ void odp_page_state::set_master_page(std::wstring name)
void odp_page_state::set_page_style(office_element_ptr & elm)
{
office_page_style_ = dynamic_cast<style*>(elm.get());
page_style_elm_ = elm;
if (!office_page_style_)return;
style* office_page_style_ = dynamic_cast<style*>(elm.get());
draw_page* page = dynamic_cast<draw_page*>(draw_page_.get());
if (page == NULL)return;
if (!office_page_style_)return;
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page)
page->draw_page_attr_.draw_style_name_ = office_page_style_->style_name_;
//потом в принципе и по имени можно будет связать(найти)
else
{
style_master_page *master_page = dynamic_cast<style_master_page*>(page_elm_.get());
if (master_page)
master_page->style_master_page_attlist_.draw_style_name_ = office_page_style_->style_name_;
}
}
void odp_page_state::add_child_element( const office_element_ptr & child_element)
{
draw_page_->add_child_element(child_element);
page_elm_->add_child_element(child_element);
}
}
......
......@@ -85,14 +85,12 @@ public:
odf_drawing_context * drawing_context(){return &drawing_context_;}
std::wstring office_page_name_;
office_element_ptr draw_page_;
office_element_ptr page_elm_;
office_element_ptr page_style_elm_;
private:
odf_conversion_context * context_;
style* office_page_style_;
odf_drawing_context drawing_context_;
friend class odp_slide_context;
......
......@@ -32,7 +32,6 @@
#include "odp_slide_context.h"
//#include "table.h"
#include "odp_conversion_context.h"
#include "logging.h"
......@@ -48,6 +47,11 @@ namespace odf_writer {
odp_slide_context::odp_slide_context(odp_conversion_context & Context): context_(Context)
{
styles_context_ = Context.styles_context();
}
void odp_slide_context::set_styles_context(odf_style_context* styles_context)
{
styles_context_ = styles_context;
}
odp_page_state & odp_slide_context::state()
......@@ -60,12 +64,11 @@ void odp_slide_context::start_page(office_element_ptr & elm)
page_state_list_.push_back( odp_page_state(&context_, elm) );
std::wstring style_name_new = L"dp" + boost::lexical_cast<std::wstring>(page_state_list_.size());
office_element_ptr & style = context_.styles_context()->add_or_find(style_name_new, style_family::DrawingPage, true);
office_element_ptr & style = styles_context_->add_or_find(style_name_new, style_family::DrawingPage, true);
style->create_child_element(L"style", L"drawing-page-properties");
state().set_page_style(style);
state().drawing_context()->set_styles_context(styles_context_);
//для свойств страницы, а не таблицы - нужно создать master-page c page layout и связать по имени со стилем таблицы
//причем здесь, т.к. с другой стороны это ВСЕ еще свойства листа. то есть совйства листа разделить на свйства страницы и таблицы ..
......@@ -75,7 +78,7 @@ void odp_slide_context::start_page(office_element_ptr & elm)
void odp_slide_context::end_page()
{
state().drawing_context()->finalize(state().draw_page_);
state().drawing_context()->finalize(state().page_elm_);
}
}
......
......@@ -48,15 +48,18 @@ class odp_slide_context
public:
odp_slide_context(odp_conversion_context & Context);
void start_page(office_element_ptr & elm);
void end_page();
void start_page (office_element_ptr & elm);
void end_page ();
void set_styles_context (odf_style_context* styles_context);
odp_page_state & state();
private:
odp_conversion_context & context_;
odp_conversion_context& context_;
odf_style_context* styles_context_;
std::list<odp_page_state> page_state_list_;
friend class odp_conversion_context;
......
......@@ -210,7 +210,7 @@ void ods_conversion_context::start_row(int _start_row, int repeated, int level,
style* _style = dynamic_cast<style*>(style_elm.get());
if (!_style)return;
style_table_row_properties * row_properties = _style->style_content_.get_style_table_row_properties();
style_table_row_properties * row_properties = _style->content_.get_style_table_row_properties();
if (row_properties == NULL)return; //error ????
row_properties->style_table_row_properties_attlist_.common_break_attlist_.fo_break_before_ = fo_break(fo_break::Auto);
......@@ -430,7 +430,7 @@ void ods_conversion_context::add_column(int start_column, int repeated, int leve
style* _style = dynamic_cast<style*>(style_elm.get());
if (!_style)return;
style_table_column_properties * column_properties = _style->style_content_.get_style_table_column_properties();
style_table_column_properties * column_properties = _style->content_.get_style_table_column_properties();
if (column_properties == NULL)return; //error ????
column_properties->style_table_column_properties_attlist_.common_break_attlist_.fo_break_before_ = fo_break(fo_break::Auto);
......
......@@ -174,7 +174,7 @@ void ods_table_state::set_table_hidden(bool Val)
{
if (!office_table_style_)return;
style_table_properties *table_properties = office_table_style_->style_content_.get_style_table_properties();
style_table_properties *table_properties = office_table_style_->content_.get_style_table_properties();
if (table_properties == NULL)return;
table_properties->table_format_properties_.table_display_ = !Val;
......@@ -184,7 +184,7 @@ void ods_table_state::set_table_rtl(bool Val)
{
if (!office_table_style_)return;
style_table_properties *table_properties = office_table_style_->style_content_.get_style_table_properties();
style_table_properties *table_properties = office_table_style_->content_.get_style_table_properties();
if (table_properties == NULL)return;
table_properties->table_format_properties_.common_writing_mode_attlist_.style_writing_mode_ = writing_mode(writing_mode::RlTb);
......@@ -203,7 +203,7 @@ void ods_table_state::set_table_tab_color(_CP_OPT(color) & _color)
{
if (!office_table_style_)return;
style_table_properties *table_properties = office_table_style_->style_content_.get_style_table_properties();
style_table_properties *table_properties = office_table_style_->content_.get_style_table_properties();
if (table_properties == NULL)return;
table_properties->table_format_properties_.tableooo_tab_color_ = _color;
......@@ -298,7 +298,7 @@ void ods_table_state::set_column_width(double width)//pt
odf_writer::style* style = dynamic_cast<odf_writer::style*>(columns_.back().style_elm.get());
if (!style)return;
style_table_column_properties * column_properties = style->style_content_.get_style_table_column_properties();
style_table_column_properties * column_properties = style->content_.get_style_table_column_properties();
if (column_properties == NULL)return; //error ????
columns_.back().size = width; //pt
......@@ -310,7 +310,7 @@ void ods_table_state::set_column_optimal_width(bool val)
odf_writer::style* style = dynamic_cast<odf_writer::style*>(columns_.back().style_elm.get());
if (!style)return;
style_table_column_properties * column_properties = style->style_content_.get_style_table_column_properties();
style_table_column_properties * column_properties = style->content_.get_style_table_column_properties();
if (column_properties == NULL)return; //error ????
column_properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = val;
......@@ -368,7 +368,7 @@ void ods_table_state::set_row_optimal_height(bool val)
odf_writer::style* style = dynamic_cast<odf_writer::style*>(rows_.back().style_elm.get());
if (!style)return;
style_table_row_properties * row_properties = style->style_content_.get_style_table_row_properties();
style_table_row_properties * row_properties = style->content_.get_style_table_row_properties();
if (row_properties == NULL)return; //error ????
row_properties->style_table_row_properties_attlist_.style_use_optimal_row_height_ = val;
......@@ -379,7 +379,7 @@ void ods_table_state::set_row_height(double height)
odf_writer::style* style = dynamic_cast<odf_writer::style*>(rows_.back().style_elm.get());
if (!style)return;
style_table_row_properties * row_properties = style->style_content_.get_style_table_row_properties();
style_table_row_properties * row_properties = style->content_.get_style_table_row_properties();
if (row_properties == NULL)return; //error ????
rows_.back().size = height;//pt
......@@ -908,7 +908,7 @@ void ods_table_state::set_cell_text(odf_text_context* text_context, bool cash_va
style* style_ = dynamic_cast<style*>(cells_.back().style_elm.get());
if (!style_)return;
odf_writer::style_table_cell_properties * table_cell_properties = style_->style_content_.get_style_table_cell_properties();
odf_writer::style_table_cell_properties * table_cell_properties = style_->content_.get_style_table_cell_properties();
//if (table_cell_properties && cash_value == false)
//{
......
......@@ -200,8 +200,8 @@ void odt_conversion_context::add_text_content(const std::wstring & text)
style_text_properties * props = text_context()->get_text_properties();
if (props)
{
std::wstring f_name = props->content().fo_font_family_.get_value_or(L"Arial");
double f_size = props->content().fo_font_size_.get_value_or(font_size(length(12,length::pt))).get_length().get_value_unit(length::pt);
std::wstring f_name = props->content_.fo_font_family_.get_value_or(L"Arial");
double f_size = props->content_.fo_font_size_.get_value_or(font_size(length(12,length::pt))).get_length().get_value_unit(length::pt);
drop_cap_state_.characters_size_pt += utils::calculate_size_font_symbols(text, f_name, f_size, applicationFonts_);
}
......@@ -235,7 +235,7 @@ void odt_conversion_context::start_drawings()
}
void odt_conversion_context::end_drawings()
{
if (drawing_context_.size() < 1) return;
if (drawing_context_.empty()) return;
office_element_ptr & elm = drawing_context()->get_root_element();
......@@ -322,7 +322,7 @@ void odt_conversion_context::add_paragraph_break(int type)
// if (styles_context()->last_state())
// {// нужна именно копия св-в так как будет добавочные свойства
// new_props = styles_context()->last_state()->get_paragraph_properties();
// if (new_props)new_props->apply_from(style_->style_content_.get_style_paragraph_properties());
// if (new_props)new_props->apply_from(style_->content_.get_style_paragraph_properties());
//
// if (style_->style_parent_style_name_)
// styles_context()->last_state()->set_parent_style_name(*style_->style_parent_style_name_);
......@@ -476,7 +476,7 @@ void odt_conversion_context::add_section_columns(int count, double space_pt, boo
style* style_ = dynamic_cast<style*>(sections_.back().style_elm.get());
if (!style_)return;
style_section_properties * section_properties = style_->style_content_.get_style_section_properties();
style_section_properties * section_properties = style_->content_.get_style_section_properties();
create_element(L"style", L"columns",section_properties->style_columns_,this);
style_columns* columns = dynamic_cast<style_columns*>(section_properties->style_columns_.get());
......@@ -506,7 +506,7 @@ void odt_conversion_context::add_section_column(std::vector<std::pair<double,dou
style* style_ = dynamic_cast<style*>(sections_.back().style_elm.get());
if (!style_)return;
style_section_properties * section_properties = style_->style_content_.get_style_section_properties();
style_section_properties * section_properties = style_->content_.get_style_section_properties();
//section_properties->text_dont_balance_text_columns_ = true;
style_columns* columns = dynamic_cast<style_columns*>(section_properties->style_columns_.get());
......@@ -648,9 +648,9 @@ void odt_conversion_context::flush_section()
//style *style_ = dynamic_cast<style*>(current_root_elements_[paragraph_break].style_elm.get());
//if (style_)
//{
// style_paragraph_properties *props = style_->style_content_.get_style_paragraph_properties();
// props->content().fo_break_before_ = fo_break(fo_break::Auto);
// props->content().fo_break_after_ = fo_break(fo_break::Auto);
// style_paragraph_properties *props = style_->content_.get_style_paragraph_properties();
// props->content_.fo_break_before_ = fo_break(fo_break::Auto);
// props->content_.fo_break_after_ = fo_break(fo_break::Auto);
//}
continue;
}
......@@ -935,7 +935,7 @@ void odt_conversion_context::start_drop_cap(style_paragraph_properties *paragrap
drop_cap_state_.paragraph_properties = paragraph_properties;
office_element_ptr comm_elm;
create_element(L"style", L"drop-cap", drop_cap_state_.paragraph_properties->content().style_drop_cap_, this);
create_element(L"style", L"drop-cap", drop_cap_state_.paragraph_properties->content_.style_drop_cap_, this);
}
void odt_conversion_context::set_drop_cap_lines(int lines)
......@@ -943,7 +943,7 @@ void odt_conversion_context::set_drop_cap_lines(int lines)
if (!drop_cap_state_.enabled) return;
if (!drop_cap_state_.paragraph_properties) return;
style_drop_cap *drop_cap = dynamic_cast<style_drop_cap*>(drop_cap_state_.paragraph_properties->content().style_drop_cap_.get());
style_drop_cap *drop_cap = dynamic_cast<style_drop_cap*>(drop_cap_state_.paragraph_properties->content_.style_drop_cap_.get());
if (drop_cap)drop_cap->style_lines_ = lines;
}
void odt_conversion_context::set_drop_cap_margin(bool val)
......@@ -957,7 +957,7 @@ void odt_conversion_context::end_drop_cap()
if (drop_cap_state_.characters >0 && drop_cap_state_.paragraph_properties)
{
style_drop_cap *drop_cap = dynamic_cast<style_drop_cap*>(drop_cap_state_.paragraph_properties->content().style_drop_cap_.get());
style_drop_cap *drop_cap = dynamic_cast<style_drop_cap*>(drop_cap_state_.paragraph_properties->content_.style_drop_cap_.get());
if (drop_cap)
{
drop_cap->style_length_ = drop_cap_length(drop_cap_state_.characters);
......@@ -967,15 +967,15 @@ void odt_conversion_context::end_drop_cap()
//сдвинуть первую строку - так чтоб буквица вся (что поместится) была на поле
//double indent_pt = 0;
//double indent_percent = 0;
//if (drop_cap_state_.paragraph_properties->content().fo_text_indent_)
//if (drop_cap_state_.paragraph_properties->content_.fo_text_indent_)
//{
// if ( drop_cap_state_.paragraph_properties->content().fo_text_indent_->get_type() == length_or_percent::Length)
// indent_pt = drop_cap_state_.paragraph_properties->content().fo_text_indent_->get_length().get_value_unit(length::pt);
// if ( drop_cap_state_.paragraph_properties->content_.fo_text_indent_->get_type() == length_or_percent::Length)
// indent_pt = drop_cap_state_.paragraph_properties->content_.fo_text_indent_->get_length().get_value_unit(length::pt);
// else
// indent_percent = drop_cap_state_.paragraph_properties->content().fo_text_indent_->get_percent()->get_value();
// indent_percent = drop_cap_state_.paragraph_properties->content_.fo_text_indent_->get_percent()->get_value();
//}
drop_cap_state_.paragraph_properties->content().fo_text_indent_ = length(length(-drop_cap_state_.characters_size_pt,length::pt).get_value_unit(length::cm),length::cm);
drop_cap_state_.paragraph_properties->content_.fo_text_indent_ = length(length(-drop_cap_state_.characters_size_pt,length::pt).get_value_unit(length::cm),length::cm);
//drop_cap_state_.characters * size_char;
}
}
......@@ -1029,7 +1029,7 @@ void odt_conversion_context::add_table_column(double width)
//
// if (styles_context()->find_odf_style(parent_name,style_family::TableCell,style_))
// {
// style_table_cell_properties * parent = style_->style_content_.get_style_table_cell_properties();
// style_table_cell_properties * parent = style_->content_.get_style_table_cell_properties();
// props->apply_from(parent);
// }
//}
......
......@@ -119,6 +119,7 @@ enum ElementType
typeStyleMasterPage,
typeStyleHandoutMasterPage,
typeStyleDrawLayerSet,
typeStyleDrawLayer,
typeOfficeStyles,
typeStyleDefaultStyle,
typeStyleStyle,
......
......@@ -120,7 +120,7 @@ void chart_format_properties::serialize(std::wostream & _Wostream ,const wchar_t
}
void style_chart_properties::serialize(std::wostream & _Wostream)
{
chart_format_properties_.serialize(_Wostream,ns,name);
content_.serialize(_Wostream,ns,name);
}
}
......
......@@ -121,8 +121,7 @@ public:
odf_types::common_rotation_angle_attlist common_rotation_angle_attlist_;
};
/// \class style_chart_properties
/// style:chart-properties
class style_chart_properties : public office_element_impl<style_chart_properties>//стили чарта не наследуются
{
public:
......@@ -137,12 +136,8 @@ public:
virtual void add_child_element( const office_element_ptr & child){}
virtual void serialize(std::wostream & strm);
chart_format_properties & content() { return chart_format_properties_; }
private:
chart_format_properties chart_format_properties_;
chart_format_properties content_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_chart_properties);
......
......@@ -128,7 +128,7 @@ const wchar_t * style_graphic_properties::name = L"graphic-properties";
void style_graphic_properties::serialize(std::wostream & strm)
{
graphic_format_properties_.serialize(strm,ns,name);
content_.serialize(strm,ns,name);
}
......
......@@ -159,15 +159,12 @@ public:
CPDOCCORE_DEFINE_VISITABLE()
graphic_format_properties & content(){ return graphic_format_properties_; }
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);
private:
graphic_format_properties graphic_format_properties_;
graphic_format_properties content_;
};
......
......@@ -166,12 +166,12 @@ const wchar_t * style_page_layout_properties::name = L"page-layout-properties";
void style_page_layout_properties::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
style_page_layout_properties_elements_.create_child_element( Ns, Name, getContext());
elements_.create_child_element( Ns, Name, getContext());
}
void style_page_layout_properties::add_child_element( const office_element_ptr & child)
{
style_page_layout_properties_elements_.add_child_element(child);
elements_.add_child_element(child);
}
void style_page_layout_properties::serialize(std::wostream & strm)
......@@ -180,8 +180,8 @@ void style_page_layout_properties::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
style_page_layout_properties_attlist_.serialize( CP_GET_XML_NODE());
style_page_layout_properties_elements_.serialize(CP_XML_STREAM());
attlist_.serialize( CP_GET_XML_NODE());
elements_.serialize(CP_XML_STREAM());
}
}
}
......
......@@ -131,8 +131,8 @@ public:
virtual void serialize(std::wostream & strm);
style_page_layout_properties_attlist style_page_layout_properties_attlist_;
style_page_layout_properties_elements style_page_layout_properties_elements_;
style_page_layout_properties_attlist attlist_;
style_page_layout_properties_elements elements_;
};
......
......@@ -253,21 +253,21 @@ const wchar_t * style_paragraph_properties::name = L"paragraph-properties";
void style_paragraph_properties::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
style_paragraph_properties_content_.create_child_element(Ns, Name, getContext());
content_.create_child_element(Ns, Name, getContext());
}
void style_paragraph_properties::add_child_element(const office_element_ptr & child_element)
{
style_paragraph_properties_content_.add_child_element(child_element);
content_.add_child_element(child_element);
}
void style_paragraph_properties::serialize(std::wostream & strm)
{
style_paragraph_properties_content_.serialize(strm,ns,name);
content_.serialize(strm,ns,name);
}
void style_paragraph_properties::apply_from(style_paragraph_properties * Other)
{
if (Other == NULL)return;
style_paragraph_properties_content_.apply_from(Other->content());
content_.apply_from(Other->content_);
}
void paragraph_format_properties::clear()
......
......@@ -277,10 +277,7 @@ public:
virtual void serialize(std::wostream & strm);
paragraph_format_properties & content(){ return style_paragraph_properties_content_; }
private:
paragraph_format_properties style_paragraph_properties_content_;
paragraph_format_properties content_;
};
......
......@@ -393,13 +393,13 @@ void style_text_properties::create_child_element(const std::wstring & Ns, const
}
void style_text_properties::serialize(std::wostream & strm)
{
text_format_properties_content_.serialize(strm,ns,name);
content_.serialize(strm,ns,name);
}
void style_text_properties::apply_from(const style_text_properties * Other)
{
if (Other == NULL) return;
text_format_properties_content_.apply_from(Other->content());
content_.apply_from(Other->content_);
}
}
......
......@@ -80,8 +80,6 @@ public:
void clear();
public:
_CP_OPT(std::wstring) r_style_;
_CP_OPT(odf_types::font_variant) fo_font_variant_;
_CP_OPT(odf_types::text_transform) fo_text_transform_;
......@@ -216,13 +214,10 @@ public:
virtual void serialize(std::wostream & strm);
const text_format_properties_content & content() const { return text_format_properties_content_; } ;
text_format_properties_content & content() { return text_format_properties_content_; } ;
style_text_properties(){};
style_text_properties(const std::wstring & rStyle){ text_format_properties_content_.set_r_style(rStyle); };
style_text_properties(const std::wstring & rStyle){ content_.set_r_style(rStyle); };
text_format_properties_content text_format_properties_content_;
text_format_properties_content content_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_text_properties);
......
......@@ -101,7 +101,7 @@ public:
style_table_row_properties * get_style_table_row_properties() ;
style_table_column_properties * get_style_table_column_properties() ;
style_chart_properties * get_style_chart_properties() ;
//style_drawing_page_properties* get_style_drawing_page_properties();
style_drawing_page_properties* get_style_drawing_page_properties();
private:
odf_conversion_context * Context;
......@@ -131,7 +131,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE()
public:
default_style() : style_content_(getContext()) {}
default_style() : content_(getContext()) {}
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child);
......@@ -139,7 +139,7 @@ public:
virtual void serialize(std::wostream & strm);
odf_types::style_family style_family_;
style_content style_content_;
style_content content_;
};
......@@ -241,6 +241,44 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(draw_opacity)
//----------------------------------------------------------------------------------------------------
class draw_layer : public office_element_impl<draw_layer>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleDrawLayer;
CPDOCCORE_DEFINE_VISITABLE()
_CP_OPT(std::wstring) draw_name_;
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void serialize(std::wostream & strm);
};
CP_REGISTER_OFFICE_ELEMENT2(draw_layer)
//----------------------------------------------------------------------------------------------------
class draw_layer_set : public office_element_impl<draw_layer_set>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStyleDrawLayerSet;
CPDOCCORE_DEFINE_VISITABLE()
office_element_ptr_array content_;
virtual void add_child_element( const office_element_ptr & child);
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void serialize(std::wostream & strm);
};
CP_REGISTER_OFFICE_ELEMENT2(draw_layer_set)
//----------------------------------------------------------------------------------------------------
class draw_fill_image : public office_element_impl<draw_fill_image>
{
......@@ -304,7 +342,7 @@ public:
static const ElementType type = typeStyleStyle;
CPDOCCORE_DEFINE_VISITABLE()
style() : style_content_(getContext()) {}
style() : content_(getContext()) {}
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child);
......@@ -326,7 +364,7 @@ public:
_CP_OPT(std::wstring) style_default_outline_level_;
style_content style_content_;
style_content content_;
office_element_ptr_array style_map_;
};
......
......@@ -373,7 +373,7 @@ public:
void convert(PPTX::Logic::EffectLst *oox_effect_lst);
void convert(PPTX::Logic::Ln *oox_line);
void convert(PPTX::Logic::FontRef *oox_fontRef);
void convert(PPTX::Logic::StyleRef *oox_styleRef);
void convert(PPTX::Logic::StyleRef *oox_styleRef, int type);
void convert(PPTX::Logic::Path2D *oox_path2D);
void convert(PPTX::Logic::PathBase *oox_path);
void convert(PPTX::Logic::BodyPr *oox_bodyPr);
......
......@@ -44,14 +44,14 @@
#include "../OdfFormat/odf_drawing_context.h"
#include "../OdfFormat/styles.h"
#include "../OdfFormat/style_presentation.h"
#include "../OdfFormat/style_page_layout_properties.h"
#include "../OdfFormat/style_table_properties.h"
#include "../OdfFormat/style_text_properties.h"
#include "../OdfFormat/style_paragraph_properties.h"
#include "../OdfFormat/style_graphic_properties.h"
#include "../OdfFormat/styles_list.h"
using namespace cpdoccore;
namespace Oox2Odf
......@@ -188,7 +188,8 @@ void PptxConverter::convertDocument()
if (UpdateProgress(300000))return;
//convert_settings();
convert_styles();
convert_settings();
convert_slides();
......@@ -201,6 +202,16 @@ void PptxConverter::convertDocument()
if (UpdateProgress(850000))return;
}
void PptxConverter::convert_styles()
{
odp_context->page_layout_context()->create_layer_sets();
//layouts
}
void PptxConverter::convert_settings()
{
}
void PptxConverter::convert_slides()
{
for (size_t i = 0; i < presentation->sldIdLst.size(); ++i)
......@@ -221,15 +232,32 @@ void PptxConverter::convert_slides()
{
current_clrMap = &slide->Master->clrMap;
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(slide->Master->m_sOutputFilename);
// Master & Layout
std::wstring master_layout = slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename;
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(master_layout);
if (pFind == m_mapMasters.end())
{
master_style_name = L"MasterPage";
if (slide->Master->cSld.attrName.IsInit()) master_style_name = slide->Master->cSld.attrName.get();
else if (current_theme->name.IsInit()) master_style_name = current_theme->name.get();
master_style_name += L"_" ;
if (slide->Layout->cSld.attrName.IsInit()) master_style_name += slide->Layout->cSld.attrName.get();
else if (slide->Layout->attrType.IsInit()) master_style_name += slide->Layout->attrType->get();
else
master_style_name += std::to_wstring(m_mapMasters.size());
odp_context->start_master_slide(master_style_name);
current_slide = slide->Master.operator->();
master_style_name = odp_context->start_master_slide();
convert(&slide->Master->cSld);
convert(&slide->Master->cSld, false);//slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true);
current_slide = slide->Layout.operator->();
convert(&slide->Layout->cSld, false);
odp_context->end_master_slide();
m_mapMasters.insert(std::make_pair(slide->Master->m_sOutputFilename, master_style_name));
m_mapMasters.insert(std::make_pair(master_layout, master_style_name));
}
else
master_style_name = pFind->second;
......@@ -247,7 +275,7 @@ void PptxConverter::convert_slides()
//nullable_bool showMasterPhAnim;
//nullable_bool showMasterSp;
convert(slide->cSld.GetPointer());
convert(slide->cSld.GetPointer(), true);
//nullable<Logic::Transition> transition;
......@@ -277,19 +305,57 @@ void PptxConverter::convert(OOX::WritingElement *oox_unknown)
}
}
void PptxConverter::convert(PPTX::Logic::CSld *slide)
void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
{
if (slide == NULL) return;
if (!oox_background) return;
if (!oox_background->bgPr.IsInit() && !oox_background->bgRef.IsInit())return;
if (slide->attrName.IsInit())
odp_context->current_slide().set_page_name(slide->attrName.get());
odp_context->drawing_context()->start_drawing();
odp_context->drawing_context()->set_background_state(true);
if (oox_background->bgPr.IsInit())
{
convert(&oox_background->bgPr->Fill);
//EffectProperties EffectList;
//nullable_bool shadeToTitle;
}
else if (oox_background->bgRef.IsInit())
{
OoxConverter::convert(oox_background->bgRef.GetPointer(), 1);
}
odf_writer::style* page_style_ = dynamic_cast<odf_writer::style*>(odp_context->current_slide().page_style_elm_.get());
odf_writer::style_drawing_page_properties* page_props = page_style_->content_.get_style_drawing_page_properties();
odp_context->drawing_context()->end_drawing_background(page_props->content_.common_draw_fill_attlist_);
odp_context->end_drawings();
}
void PptxConverter::convert(PPTX::Logic::CSld *oox_slide, bool placeholders)
{
if (oox_slide == NULL) return;
if (oox_slide->attrName.IsInit())
odp_context->current_slide().set_page_name(oox_slide->attrName.get());
for (size_t i = 0 ; i < slide->spTree.SpTreeElems.size(); i++)
convert(oox_slide->bg.GetPointer());
for (size_t i = 0 ; i < oox_slide->spTree.SpTreeElems.size(); i++)
{
smart_ptr<PPTX::WrapperWritingElement> pElem = oox_slide->spTree.SpTreeElems[i].GetElem();
smart_ptr<PPTX::Logic::Shape> pShape = pElem.smart_dynamic_cast<PPTX::Logic::Shape>();
if (pShape.IsInit() && pShape->nvSpPr.nvPr.ph.is_init())
{
convert(slide->spTree.SpTreeElems[i].GetElem().operator->());
if (placeholders)
convert(pElem.operator->());
}
else
{
convert(pElem.operator->());
}
//convert(oox_slide->spTree.SpTreeElems[i].GetElem().operator->());
}
//nullable<Bg> bg;
//nullable<Controls> controls;
convert(oox_slide->controls.GetPointer());
}
......
......@@ -52,6 +52,7 @@ namespace PPTX
namespace Logic
{
class CSld;
class Bg;
class Transition;
class Timing;
}
......@@ -94,7 +95,8 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown);
void convert(PPTX::Logic::CSld *slide);
void convert(PPTX::Logic::CSld *oox_slide, bool placeholders = true);
void convert(PPTX::Logic::Bg *oox_background);
private:
PPTX::Folder *pptx_document;
PPTX::Presentation *presentation;
......@@ -111,6 +113,8 @@ namespace Oox2Odf
std::vector<std::wstring> m_arLayouts;
void convert_slides ();
void convert_styles ();
void convert_settings ();
//--------------------------------------------------------------------------------
......
......@@ -321,6 +321,14 @@
<Filter
Name="elements"
>
<File
RelativePath="..\OdfFormat\anim_elements.cpp"
>
</File>
<File
RelativePath="..\OdfFormat\anim_elements.h"
>
</File>
<File
RelativePath="..\OdfFormat\calcext_elements.cpp"
>
......@@ -597,6 +605,14 @@
RelativePath="..\OdfFormat\style_paragraph_properties.h"
>
</File>
<File
RelativePath="..\OdfFormat\style_presentation.cpp"
>
</File>
<File
RelativePath="..\OdfFormat\style_presentation.h"
>
</File>
<File
RelativePath="..\OdfFormat\style_section_properties.cpp"
>
......
......@@ -59,6 +59,7 @@
#include "Diagram/DiagramData.h"
#include "VmlDrawing.h"
#include "../XlsxFormat/Chart/Chart.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
namespace OOX
......@@ -133,6 +134,8 @@ namespace OOX
return smart_ptr<OOX::File>(new OleObject( oFileName, true ));
else if ( oRelation.Type() == OOX::FileTypes::VmlDrawing )
return smart_ptr<OOX::File>(new CVmlDrawing( oRootPath, oFileName ));
else if ( oRelation.Type() == OOX::FileTypes::Chart )
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace( oRootPath, oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() );
}
......@@ -206,6 +209,8 @@ namespace OOX
return smart_ptr<OOX::File>(new CDiagramDrawing( oRootPath, oFileName ));
else if (pRelation->Type() == FileTypes::MicrosoftOfficeUnknown) //ms package
return smart_ptr<OOX::File>(new OleObject( oFileName, true ));
else if ( pRelation->Type() == OOX::FileTypes::Chart )
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace( oRootPath, oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() );
}
......
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