Commit 8cec4ce8 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter presentation layouts, layers

OdfFormat - nation style-name
parent 17e46a2c
......@@ -46,7 +46,6 @@
#include "../odf/style_text_properties.h"
#include "../odf/style_table_properties.h"
#include "../odf/style_graphic_properties.h"
#include "../odf/datatypes/style_ref.h"
#include "docx_package.h"
#include "oox_rels.h"
......@@ -1196,7 +1195,7 @@ void docx_conversion_context::process_headers_footers()
// проходим по всем page layout
BOOST_FOREACH(const odf_reader::style_master_page* page, pageLayouts.master_pages())
{
const std::wstring & styleName = page->style_master_page_attlist_.style_name_.get_value_or( odf_types::style_ref(L"") ).style_name();
const std::wstring & styleName = page->style_master_page_attlist_.style_name_.get_value_or( L"" );
const std::wstring masterPageNameLayout =context.pageLayoutContainer().page_layout_name_by_style(styleName);
add_page_properties(masterPageNameLayout);
......
......@@ -53,7 +53,6 @@ namespace cpdoccore {
namespace odf_types
{
class style_ref;
class length_or_percent;
}
namespace odf_reader
......
......@@ -271,9 +271,9 @@ void pptx_conversion_context::end_document()
odf_reader::odf_read_context & context = root()->odf_context();
odf_reader::page_layout_container & pageLayouts = context.pageLayoutContainer();
if ((pageLayouts.master_pages().size()>0) && (pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_))//default
if ((pageLayouts.master_pages().size() > 0) && (pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_))//default
{
const std::wstring masterStyleName = pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_->style_name();
const std::wstring masterStyleName = pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_.get();
const std::wstring pageProperties = root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masterStyleName);
odf_reader::page_layout_instance *pages_layouts = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);
......
......@@ -86,8 +86,8 @@ class calcext_date_is_attr
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(odf_types::style_ref) calcext_style_;
_CP_OPT(std::wstring) calcext_date_;
_CP_OPT(std::wstring) calcext_style_;
_CP_OPT(std::wstring) calcext_date_;
};
//////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -51,7 +51,6 @@
#include "stylehorizontalrel.h"
#include "percentorscale.h"
#include "anchortype.h"
#include "style_ref.h"
#include "linewidth.h"
#include "presentationclass.h"
#include "xlink.h"
......@@ -477,9 +476,9 @@ public:
void apply_from(const common_draw_style_name_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(style_ref) draw_style_name_;
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(std::wstring) draw_class_names_;
_CP_OPT(style_ref) presentation_style_name_;
_CP_OPT(std::wstring) presentation_style_name_;
_CP_OPT(std::wstring) presentation_class_names_;
};
......@@ -577,7 +576,7 @@ public:
void apply_from(const common_draw_text_style_name_attlist & Other);
void serialize(CP_ATTR_NODE);
_CP_OPT(style_ref) draw_text_style_name_;
_CP_OPT(std::wstring) draw_text_style_name_;
};
class common_draw_position_attlist
......@@ -609,7 +608,7 @@ public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
void serialize(CP_ATTR_NODE);
_CP_OPT(style_ref) style_name_;
_CP_OPT(std::wstring) style_name_;
_CP_OPT(std::wstring) number_language_;
_CP_OPT(std::wstring) number_country_;
_CP_OPT(std::wstring) number_title_;
......
......@@ -68,7 +68,8 @@ public:
PageLayout,
MasterPage,
HandoutMaster,
LayerSet
LayerSet,
PresentationPageLayout
};
style_family() : type_(Default) {}
......
......@@ -554,8 +554,8 @@ void draw_a::add_attributes( const xml::attributes_wc_ptr & Attributes )
CP_APPLY_ATTR(L"office:name" , office_name_ , std::wstring(L""));
CP_APPLY_ATTR(L"office:target-frame-name" , office_target_frame_name_);
CP_APPLY_ATTR(L"text:style-name" , text_style_name_ , style_ref(L""));
CP_APPLY_ATTR(L"text:visited-style-name" , text_visited_style_name_ , style_ref(L""));
CP_APPLY_ATTR(L"text:style-name" , text_style_name_ , std::wstring(L""));
CP_APPLY_ATTR(L"text:visited-style-name" , text_visited_style_name_ , std::wstring(L""));
}
......
......@@ -106,8 +106,8 @@ private:
std::wstring office_name_;
_CP_OPT(odf_types::target_frame_name) office_target_frame_name_;
odf_types::style_ref text_style_name_;
odf_types::style_ref text_visited_style_name_;
std::wstring text_style_name_;
std::wstring text_visited_style_name_;
};
CP_REGISTER_OFFICE_ELEMENT2(draw_a);
......
......@@ -765,10 +765,8 @@ 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)
{
const _CP_OPT(style_ref) & styleRef = attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.common_draw_style_name_attlist_.draw_style_name_;
const std::wstring styleName = styleRef ? styleRef->style_name() : L"";
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"");
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_);
......@@ -1138,12 +1136,8 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal,href);
drawing->fill.bitmap->bStretch = true;
const _CP_OPT(style_ref) & styleRef = frame->common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.
common_draw_style_name_attlist_.
draw_style_name_;
const std::wstring styleName = styleRef ? styleRef->style_name() : L"";
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"");
odf_reader::style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(styleName, odf_types::style_family::Graphic,Context.process_headers_footers_);
......
......@@ -93,7 +93,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
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(style_ref(L"")).style_name();
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_;
......@@ -132,8 +132,8 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
//////////////////////////////////////////////
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(style_ref(L"")).style_name();
const std::wstring baseStyleName = common_draw_attlist_.common_draw_style_name_attlist_.presentation_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring grStyleName = common_draw_attlist_.common_draw_style_name_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"");
odf_reader::style_instance* grStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(grStyleName, odf_types::style_family::Graphic,Context.process_masters_);
......
......@@ -121,11 +121,10 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
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(style_ref(L"")).style_name();
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(style_ref(L"")).style_name();
common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(L"");
//////////////////////////////////////////////////////////////////////////
Context.get_drawing_context().start_drawing( name);
......
......@@ -72,7 +72,7 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
const std::wstring name = common_draw_attlist_.common_draw_name_attlist_.draw_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(style_ref(L"")).style_name();
common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(L"");
///////////////////////////////////////////
Context.get_slide_context().set_name(name);
......@@ -110,8 +110,8 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
/////////////////////////////////////////////////////////////////////////////////
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(style_ref(L"")).style_name();
const std::wstring baseStyleName = common_draw_attlist_.common_draw_style_name_attlist_.presentation_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring grStyleName = common_draw_attlist_.common_draw_style_name_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"");
odf_reader::style_instance* grStyleInst =
Context.root()->odf_context().styleContainer().style_by_name(grStyleName, odf_types::style_family::Graphic,Context.process_masters_);
......@@ -244,7 +244,7 @@ void draw_custom_shape::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(style_ref(L"")).style_name();
//const std::wstring style = common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(L"");
Context.get_slide_context().start_shape(sub_type_);//rect с наваротами-атрибутами .. а-ля TextBox
......
......@@ -71,10 +71,10 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
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(style_ref(L"")).style_name();
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(style_ref(L"")).style_name();
common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(L"");
///////////////////////////////////////////
Context.get_drawing_context().start_drawing(name);
......@@ -247,7 +247,7 @@ void draw_custom_shape::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(style_ref(L"")).style_name();
//const std::wstring style = common_draw_text_style_name_attlist_.draw_text_style_name_.get_value_or(L"");
Context.get_drawing_context().start_shape(1);//rect с наваротами-атрибутами .. а-ля TextBox
......
......@@ -54,17 +54,12 @@ namespace odf_reader {
std::wstring number_style_base::get_style_name() const
{
if (common_data_style_attlist_.style_name_)
return common_data_style_attlist_.style_name_->style_name();
else
return L"";
return common_data_style_attlist_.style_name_.get_value_or(L"");
}
void number_style_base::oox_convert_impl(oox::num_format_context & Context)
{
std::wstring style_name = L"";
if (common_data_style_attlist_.style_name_)
style_name = common_data_style_attlist_.style_name_->style_name();
std::wstring style_name = common_data_style_attlist_.style_name_.get_value_or(L"");
Context.start_format(style_name);
......@@ -103,7 +98,7 @@ void number_style_base::oox_convert(oox::num_format_context & Context)
{
if (const style_map * styleMap = dynamic_cast<const style_map *>(elm.get()))
{
const std::wstring applyStyleName = styleMap->style_apply_style_name_.style_name();
const std::wstring applyStyleName = styleMap->style_apply_style_name_;
const std::wstring condition = styleMap->style_condition_;
if (office_element_ptr num_style = Context.odf_context_.numberStyles().find_by_style_name(applyStyleName))
......
......@@ -462,8 +462,8 @@ void odf_document::Impl::parse_styles()
continue;
}
const std::wstring styleName = masterPage->style_master_page_attlist_.style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring pageLayoutName = masterPage->style_master_page_attlist_.style_page_layout_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring styleName = masterPage->style_master_page_attlist_.style_name_.get_value_or(L"");
const std::wstring pageLayoutName = masterPage->style_master_page_attlist_.style_page_layout_name_.get_value_or(L"");
context_->pageLayoutContainer().add_master_page(styleName, pageLayoutName, masterPage);
}
......
......@@ -353,7 +353,9 @@ void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::doc
}
void page_layout_instance::pptx_convert(oox::pptx_conversion_context & Context)
{
properties()->pptx_convert(Context);
style_page_layout_properties * props = properties();
if (props)
props->pptx_convert(Context);
}
void page_layout_container::add_page_layout(const style_page_layout * StylePageLayout)
......
......@@ -203,7 +203,7 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
/// Обрабатываем стиль draw
std::vector<const odf_reader::style_instance *> instances;
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(
office_annotation_attr_.draw_style_name_.get_value_or(style_ref(L"")).style_name(), odf_types::style_family::Graphic,false/*Context.process_headers_footers_*/);
office_annotation_attr_.draw_style_name_.get_value_or(L""), odf_types::style_family::Graphic, false/*Context.process_headers_footers_*/);
if (styleInst)
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
......@@ -215,7 +215,7 @@ void office_annotation::xlsx_convert(oox::xlsx_conversion_context & Context)
graphicProperties.apply_to(Context.get_comments_context().get_draw_properties());
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");
std::wstring ref = Context.current_cell_address();
Context.get_comments_context().end_comment(ref,Context.current_table_column(), Context.current_table_row());
......@@ -280,7 +280,7 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
/// Обрабатываем стиль draw
std::vector<const odf_reader::style_instance *> instances;
style_instance* styleInst = Context.root()->odf_context().styleContainer().style_by_name(
office_annotation_attr_.draw_style_name_.get_value_or(style_ref(L"")).style_name(), odf_types::style_family::Graphic,false/*Context.process_headers_footers_*/);
office_annotation_attr_.draw_style_name_.get_value_or(L""), odf_types::style_family::Graphic,false/*Context.process_headers_footers_*/);
if (styleInst)
{
style_instance * defaultStyle = Context.root()->odf_context().styleContainer().style_default_by_type(odf_types::style_family::Graphic);
......@@ -292,7 +292,7 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
graphicProperties.apply_to(Context.get_comments_context().get_draw_properties());
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(style_ref(L"")).style_name();
const std::wstring textStyleName = office_annotation_attr_.draw_text_style_name_.get_value_or(L"");
Context.get_comments_context().end_comment();
}
......
......@@ -37,8 +37,6 @@
#include "office_elements.h"
#include "office_elements_create.h"
#include "datatypes/style_ref.h"
namespace cpdoccore {
namespace odf_reader {
......@@ -59,8 +57,8 @@ public:
_CP_OPT(bool) display_;
_CP_OPT(odf_types::style_ref) draw_text_style_name_;
_CP_OPT(odf_types::style_ref) draw_style_name_;
_CP_OPT(std::wstring) draw_text_style_name_;
_CP_OPT(std::wstring) draw_style_name_;
};
// dc:date
......
......@@ -98,7 +98,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
std::vector<style_master_page*> & masterPages = Context.root()->odf_context().pageLayoutContainer().master_pages();
if (!masterPages.empty())
{
Context.set_master_page_name(masterPages[0]->style_master_page_attlist_.style_name_.get_value_or(style_ref(L"Standard")).style_name() );
Context.set_master_page_name(masterPages[0]->style_master_page_attlist_.style_name_.get_value_or(L"Standard"));
}
const page_layout_instance * layout = Context.root()->odf_context().pageLayoutContainer().page_layout_first();
......
......@@ -340,7 +340,7 @@ std::wostream & span::text_to_stream(std::wostream & _Wostream) const
void span::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:style-name", text_style_name_, style_ref(L""));
CP_APPLY_ATTR(L"text:style-name", text_style_name_, std::wstring(L""));
const std::wstring classNames = Attributes->get_val< std::wstring >(L"text:class-names").get_value_or(L"");
std::vector< std::wstring > classNamesArray;
......@@ -351,7 +351,7 @@ void span::add_attributes( const xml::attributes_wc_ptr & Attributes )
BOOST_FOREACH(const std::wstring & name, classNamesArray)
{
text_class_names_.push_back( style_ref(name) );
text_class_names_.push_back( name );
}
}
}
......@@ -374,10 +374,10 @@ void span::docx_convert(oox::docx_conversion_context & Context)
std::wostream & _Wostream = Context.output_stream();
if (!text_style_name_.style_name().empty()/* && !drawing*/)
if (!text_style_name_.empty()/* && !drawing*/)
{
if (style_instance * styleInst
= Context.root()->odf_context().styleContainer().style_by_name(text_style_name_.style_name(), style_family::Text,Context.process_headers_footers_)
= Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text,Context.process_headers_footers_)
)
{
if (styleInst->is_automatic())
......@@ -418,7 +418,7 @@ void span::docx_convert(oox::docx_conversion_context & Context)
void span::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_span(text_style_name_.style_name());
Context.start_span(text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->xlsx_convert(Context);
......@@ -427,10 +427,10 @@ void span::xlsx_convert(oox::xlsx_conversion_context & Context)
}
void span::pptx_convert(oox::pptx_conversion_context & Context)
{
if (style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_.style_name(), style_family::Text,false))
if (style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text,false))
Context.get_text_context().get_styles_context().start_process_style(styleInst);
Context.get_text_context().start_span(text_style_name_.style_name());
Context.get_text_context().start_span(text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->pptx_convert(Context);
......@@ -456,10 +456,10 @@ void a::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
common_xlink_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"office:name", office_name_, std::wstring(L""));
CP_APPLY_ATTR(L"office:target-frame-name", office_target_frame_name_);
CP_APPLY_ATTR(L"text:style-name", text_style_name_, style_ref(L""));
CP_APPLY_ATTR(L"text:visited-style-name", text_visited_style_name_, style_ref(L""));
CP_APPLY_ATTR(L"office:name", office_name_, std::wstring(L""));
CP_APPLY_ATTR(L"office:target-frame-name", office_target_frame_name_);
CP_APPLY_ATTR(L"text:style-name", text_style_name_, std::wstring(L""));
CP_APPLY_ATTR(L"text:visited-style-name", text_visited_style_name_,std::wstring(L""));
}
void a::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
......@@ -491,8 +491,8 @@ void a::docx_convert(oox::docx_conversion_context & Context)
style_instance * styleInst = NULL;
if (!text_style_name_.style_name().empty())
styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_.style_name(), style_family::Text,Context.process_headers_footers_);
if (!text_style_name_.empty())
styleInst = Context.root()->odf_context().styleContainer().style_by_name(text_style_name_, style_family::Text,Context.process_headers_footers_);
else
styleInst = Context.root()->odf_context().styleContainer().hyperlink_style();
......@@ -540,7 +540,7 @@ void a::docx_convert(oox::docx_conversion_context & Context)
void a::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_hyperlink(text_style_name_.style_name());
Context.start_hyperlink(text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->xlsx_convert(Context);
......@@ -675,7 +675,7 @@ std::wostream & ruby::text_to_stream(std::wostream & _Wostream) const
void ruby::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_style_name_ = style_ref( Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") );
text_style_name_ = Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") ;
}
void ruby::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
......
......@@ -40,7 +40,6 @@
#include "paragraph_content.h"
#include "office_elements_create.h"
#include "datatypes/style_ref.h"
#include "datatypes/targetframename.h"
#include "datatypes/noteclass.h"
......@@ -380,8 +379,8 @@ public:
office_element_ptr_array content_;
odf_types::style_ref text_style_name_;
odf_types::style_ref_array text_class_names_;
std::wstring text_style_name_;
std::vector<std::wstring> text_class_names_;
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
......@@ -421,10 +420,10 @@ private:
std::wstring office_name_;
_CP_OPT(odf_types::target_frame_name) office_target_frame_name_;
odf_types::style_ref text_style_name_;
odf_types::style_ref text_visited_style_name_;
std::wstring text_style_name_;
std::wstring text_visited_style_name_;
office_element_ptr_array content_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(a);
......@@ -481,9 +480,9 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
odf_types::style_ref text_style_name_;
office_element_ptr text_ruby_base_;
office_element_ptr text_ruby_text_;
std::wstring text_style_name_;
office_element_ptr text_ruby_base_;
office_element_ptr text_ruby_text_;
};
......
......@@ -87,7 +87,7 @@ std::wostream & ruby_text::text_to_stream(std::wostream & _Wostream) const
void ruby_text::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_style_name_ = odf_types::style_ref( Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") );
text_style_name_ = Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"");
}
void ruby_text::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
......
......@@ -52,10 +52,10 @@ const wchar_t * style_map::name = L"map";
void style_map::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:condition", style_condition_, std::wstring(L""));
CP_APPLY_ATTR(L"style:name", style_name_, style_ref(L""));
CP_APPLY_ATTR(L"style:base-cell-address", style_base_cell_address_, std::wstring(L""));
CP_APPLY_ATTR(L"style:apply-style-name", style_apply_style_name_, style_ref(L""));
CP_APPLY_ATTR(L"style:condition", style_condition_, std::wstring(L""));
CP_APPLY_ATTR(L"style:name", style_name_, std::wstring(L""));
CP_APPLY_ATTR(L"style:base-cell-address", style_base_cell_address_, std::wstring(L""));
CP_APPLY_ATTR(L"style:apply-style-name", style_apply_style_name_, std::wstring(L""));
}
void style_map::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
......
......@@ -39,7 +39,6 @@
#include "office_elements.h"
#include "office_elements_create.h"
#include "datatypes/style_ref.h"
namespace cpdoccore {
namespace odf_reader {
......@@ -59,10 +58,10 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
std::wstring style_condition_;
odf_types::style_ref style_name_;
std::wstring style_base_cell_address_;
odf_types::style_ref style_apply_style_name_;
std::wstring style_condition_;
std::wstring style_name_;
std::wstring style_base_cell_address_;
std::wstring style_apply_style_name_;
};
......
......@@ -58,7 +58,6 @@
#include "datatypes/linestyle.h"
#include "datatypes/linetype.h"
#include "datatypes/styleleadercolor.h"
#include "datatypes/style_ref.h"
#include "datatypes/dropcaplength.h"
#include "datatypes/fobreak.h"
#include "datatypes/styleposition.h"
......@@ -108,7 +107,7 @@ private:
_CP_OPT(odf_types::style_leader_color) style_leader_color_;
_CP_OPT( std::wstring ) style_leader_text_;
_CP_OPT( odf_types::style_ref ) style_leader_text_style_;
_CP_OPT( std::wstring ) style_leader_text_style_;
};
......@@ -157,10 +156,10 @@ public:
public:
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
odf_types::drop_cap_length style_length_;
unsigned int style_lines_;
_CP_OPT(odf_types::length) style_distance_;
_CP_OPT(odf_types::style_ref) style_style_name_;
odf_types::drop_cap_length style_length_;
unsigned int style_lines_;
_CP_OPT(odf_types::length) style_distance_;
_CP_OPT(std::wstring) style_style_name_;
private:
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);
......
......@@ -918,10 +918,9 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
if (shape->word_art_)
{//взять из графических ствойст цвет текста ..
const _CP_OPT(style_ref) & styleRef = shape->common_draw_attlists_.shape_with_text_and_styles_.
common_draw_shape_with_styles_attlist_.common_draw_style_name_attlist_.draw_style_name_;
const std::wstring styleName = styleRef ? styleRef->style_name() : L"";
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"");
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_);
......
......@@ -40,7 +40,6 @@
#include "office_elements_create.h"
#include "datatypes/style_ref.h"
#include "datatypes/fontvariant.h"
#include "datatypes/texttransform.h"
#include "datatypes/color.h"
......@@ -106,7 +105,7 @@ public:
_CP_OPT(odf_types::line_width) style_text_line_through_width_;
_CP_OPT(odf_types::color) style_text_line_through_color_;
_CP_OPT(std::wstring) style_text_line_through_text_;
_CP_OPT(odf_types::style_ref) style_text_line_through_text_style_;
_CP_OPT(std::wstring) style_text_line_through_text_style_;
_CP_OPT(odf_types::text_position) style_text_position_;
_CP_OPT(std::wstring) style_font_name_;
_CP_OPT(std::wstring) style_font_name_asian_;
......
......@@ -46,7 +46,6 @@
#include "office_elements_create.h"
#include "datatypes/stylefamily.h"
#include "datatypes/style_ref.h"
#include "datatypes/textalign.h"
#include "datatypes/lengthorpercent.h"
#include "datatypes/styleverticalrel.h"
......@@ -433,12 +432,12 @@ class style_master_page_attlist
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(odf_types::style_ref) style_name_;
_CP_OPT(std::wstring) style_display_name_;
_CP_OPT(odf_types::style_ref) style_page_layout_name_;
_CP_OPT(std::wstring) style_name_;
_CP_OPT(std::wstring) style_display_name_;
_CP_OPT(std::wstring) style_page_layout_name_;
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(odf_types::style_ref) style_next_style_name_;
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(std::wstring) style_next_style_name_;
};
// style:master-page
......@@ -895,7 +894,7 @@ public:
odf_types::common_background_color_attlist common_background_color_attlist_;
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
_CP_OPT(odf_types::style_ref) style_register_truth_ref_style_name_;
_CP_OPT(std::wstring) style_register_truth_ref_style_name_;
_CP_OPT(std::wstring) style_print_;
_CP_OPT(odf_types::direction) style_print_page_order_;
_CP_OPT(std::wstring) style_first_page_number_;
......
......@@ -43,7 +43,6 @@
#include "office_elements_create.h"
#include "datatypes/common_attlists.h"
#include "datatypes/style_ref.h"
namespace cpdoccore { namespace odf_reader {
......@@ -94,7 +93,7 @@ public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
optional<odf_types::style_ref>::Type text_style_name_;
_CP_OPT(std::wstring) text_style_name_;
odf_types::common_num_format_attlist common_num_format_attlist_;
odf_types::common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
......@@ -218,10 +217,10 @@ public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
_CP_OPT(odf_types::style_ref) text_style_name_;
optional<wchar_t>::Type text_bullet_char_;
_CP_OPT(std::wstring) text_style_name_;
_CP_OPT(wchar_t) text_bullet_char_;
odf_types::common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
optional<odf_types::percent>::Type text_bullet_relative_size_;
_CP_OPT(odf_types::percent) text_bullet_relative_size_;
friend class text_list_level_style_bullet;
......
......@@ -38,8 +38,6 @@
#include "office_elements.h"
#include "office_elements_create.h"
#include "datatypes/style_ref.h"
namespace cpdoccore {
namespace odf_reader {
......
......@@ -44,7 +44,7 @@ namespace text {
void paragraph_attrs::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_style_name_ = style_ref( Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") );
text_style_name_ = Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") ;
const std::wstring classNames = Attributes->get_val< std::wstring >(L"text:class-names").get_value_or(L"");
if (classNames.size())
......@@ -54,11 +54,11 @@ void paragraph_attrs::add_attributes( const xml::attributes_wc_ptr & Attributes
for (size_t i = 0; i < classNamesArray.size(); i++)
{
text_class_names_.push_back( style_ref(classNamesArray[i]) );
text_class_names_.push_back( classNamesArray[i] );
}
}
text_cond_style_name_ = style_ref( Attributes->get_val< std::wstring >(L"text:cond-style-name").get_value_or(L"") );
text_cond_style_name_ = Attributes->get_val< std::wstring >(L"text:cond-style-name").get_value_or(L"");
}
......
......@@ -41,7 +41,6 @@
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "datatypes/style_ref.h"
namespace cpdoccore {
namespace xml {
......@@ -63,9 +62,9 @@ class paragraph_attrs
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
odf_types::style_ref text_style_name_;
odf_types::style_ref_array text_class_names_;
odf_types::style_ref text_cond_style_name_;
std::wstring text_style_name_;
std::vector<std::wstring> text_class_names_;
std::wstring text_cond_style_name_;
_CP_OPT(unsigned int) outline_level_; //from header attr
......
......@@ -96,7 +96,7 @@ void process_paragraph_drop_cap_attr(const paragraph_attrs & Attr, oox::docx_con
if (Attr.text_style_name_.empty())return;
style_instance * styleInst
= Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_.style_name(), style_family::Paragraph,Context.process_headers_footers_);
= Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_, style_family::Paragraph,Context.process_headers_footers_);
if ((!styleInst) || (styleInst->is_automatic() == false))return;
style_content * styleContent = styleInst->content();
......@@ -147,7 +147,7 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
if (!Attr.text_style_name_.empty())
{
if (style_instance * styleInst =
Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_.style_name(), style_family::Paragraph, Context.process_headers_footers_)
Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_, style_family::Paragraph, Context.process_headers_footers_)
)
{
process_page_break_after(styleInst, Context);
......@@ -342,7 +342,7 @@ void paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
span* first_span_in_paragraph = dynamic_cast<span*>(content_[0].get());
if (Context.get_drop_cap_context().FontSize < 1)
{
style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(first_span_in_paragraph->text_style_name_.style_name(), style_family::Text,Context.process_headers_footers_);
style_instance * styleInst = Context.root()->odf_context().styleContainer().style_by_name(first_span_in_paragraph->text_style_name_, style_family::Text,Context.process_headers_footers_);
if ((styleInst) && (styleInst->is_automatic()))
{
style_content * styleContent = styleInst->content();
......@@ -368,7 +368,7 @@ void paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
}
void paragraph::docx_convert(oox::docx_conversion_context & Context)
{
const std::wstring & styleName = attrs_.text_style_name_.style_name();
const std::wstring & styleName = attrs_.text_style_name_;
bool in_drawing = false;
......@@ -408,7 +408,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
// если да — устанавливаем контексту флаг на то что необходимо в конце текущего параграфа
// распечатать свойства секции
//проверить ... не она ли основная - может быть прописан дубляж - и тогда разрыв нарисуется ненужный
const std::wstring & next_styleName = next_par_->attrs_.text_style_name_.style_name();
const std::wstring & next_styleName = next_par_->attrs_.text_style_name_;
const _CP_OPT(std::wstring) next_masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(next_styleName);
if ((next_masterPageName) && (Context.get_master_page_name() != *next_masterPageName))
......@@ -509,7 +509,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
void paragraph::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context.start_paragraph(attrs_.text_style_name_.style_name());
Context.start_paragraph(attrs_.text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
elm->xlsx_convert(Context);
......@@ -518,7 +518,7 @@ void paragraph::xlsx_convert(oox::xlsx_conversion_context & Context)
}
void paragraph::pptx_convert(oox::pptx_conversion_context & Context)
{
Context.get_text_context().start_paragraph(attrs_.text_style_name_.style_name());
Context.get_text_context().start_paragraph(attrs_.text_style_name_);
BOOST_FOREACH(const office_element_ptr & elm, content_)
{
......@@ -647,8 +647,8 @@ std::wostream & list::text_to_stream(std::wostream & _Wostream) const
void list::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
text_style_name_ = style_ref( Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"") );
text_continue_numbering_ = Attributes->get_val< bool >(L"text:continue-numbering");
text_style_name_ = Attributes->get_val< std::wstring >(L"text:style-name").get_value_or(L"");
text_continue_numbering_ = Attributes->get_val< bool >(L"text:continue-numbering");
// TODO
}
......@@ -672,7 +672,7 @@ void list::add_text(const std::wstring & Text)
void list::docx_convert(oox::docx_conversion_context & Context)
{
bool continue_ = text_continue_numbering_.get_value_or(false);
Context.start_list(text_style_name_.style_name(), continue_);
Context.start_list(text_style_name_, continue_);
if (text_list_header_)
text_list_header_->docx_convert(Context);
......@@ -687,7 +687,7 @@ void list::docx_convert(oox::docx_conversion_context & Context)
void list::pptx_convert(oox::pptx_conversion_context & Context)
{
bool continue_ = text_continue_numbering_.get_value_or(false);
Context.get_text_context().start_list(text_style_name_.style_name(), continue_);
Context.get_text_context().start_list(text_style_name_, continue_);
if (text_list_header_)
text_list_header_->pptx_convert(Context);
......@@ -784,12 +784,9 @@ void text_section::docx_convert(oox::docx_conversion_context & Context)
{
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
current_page_properties
);
Context.add_page_properties(current_page_properties);
Context.get_section_context().add_section (text_section_attr_.text_name_, text_section_attr_.text_style_name_.get_value_or(L""), current_page_properties);
Context.add_page_properties(current_page_properties);
BOOST_FOREACH(const office_element_ptr & elm, text_content_)
{
......@@ -1000,12 +997,9 @@ void text_illustration_index::docx_convert(oox::docx_conversion_context & Contex
{
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
current_page_properties
);
Context.add_page_properties(current_page_properties);
Context.get_section_context().add_section (text_section_attr_.text_name_,text_section_attr_.text_style_name_.get_value_or(L""), current_page_properties);
Context.add_page_properties(current_page_properties);
if (text_index_body_)
text_index_body_->docx_convert(Context);
......@@ -1068,12 +1062,9 @@ void text_alphabetical_index::docx_convert(oox::docx_conversion_context & Contex
{
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
current_page_properties
);
Context.add_page_properties(current_page_properties);
Context.get_section_context().add_section (text_section_attr_.text_name_, text_section_attr_.text_style_name_.get_value_or(L""), current_page_properties);
Context.add_page_properties(current_page_properties);
if (text_index_body_)
text_index_body_->docx_convert(Context);
......@@ -1135,12 +1126,9 @@ void text_bibliography::docx_convert(oox::docx_conversion_context & Context)
{
std::wstring current_page_properties = Context.get_page_properties();
Context.get_section_context().add_section(
text_section_attr_.text_name_,
text_section_attr_.text_style_name_.get_value_or(style_ref()).style_name(),
current_page_properties
);
Context.add_page_properties(current_page_properties);
Context.get_section_context().add_section (text_section_attr_.text_name_, text_section_attr_.text_style_name_.get_value_or(L""), current_page_properties);
Context.add_page_properties(current_page_properties);
if (text_index_body_)
text_index_body_->docx_convert(Context);
......
......@@ -43,7 +43,6 @@
#include "datatypes/textdisplay.h"
#include "datatypes/common_attlists.h"
#include "datatypes/style_ref.h"
namespace cpdoccore {
namespace odf_reader {
......@@ -189,7 +188,7 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
virtual void add_text(const std::wstring & Text);
odf_types::style_ref text_style_name_;
std::wstring text_style_name_;
_CP_OPT(bool) text_continue_numbering_;
office_element_ptr text_list_header_;
......@@ -225,7 +224,7 @@ class text_section_attr
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(odf_types::style_ref) text_style_name_;
_CP_OPT(std::wstring) text_style_name_;
std::wstring text_name_;
_CP_OPT(bool) text_protected_;
_CP_OPT(std::wstring) text_protection_key_;
......
......@@ -41,7 +41,6 @@
#include "color.h"
#include "style_ref.h"
#include "iconset_type.h"
#include "calcext_type.h"
......@@ -65,7 +64,7 @@ public:
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) calcext_base_cell_address_;
_CP_OPT(odf_types::style_ref) calcext_apply_style_name_;
_CP_OPT(std::wstring) calcext_apply_style_name_;
_CP_OPT(std::wstring) calcext_value_;
};
......@@ -83,7 +82,7 @@ class calcext_date_is_attr
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(odf_types::style_ref) calcext_style_;
_CP_OPT(std::wstring) calcext_style_;
_CP_OPT(std::wstring) calcext_date_;
};
......
......@@ -55,14 +55,11 @@ namespace odf_writer {
std::wstring number_style_base::get_style_name() const
{
if (common_data_style_attlist_.style_name_)
return common_data_style_attlist_.style_name_->style_name();
else
return L"";
return common_data_style_attlist_.style_name_.get_value_or(L"");
}
void number_style_base::set_style_name(std::wstring & name)
{
common_data_style_attlist_.style_name_ = style_ref(name);
common_data_style_attlist_.style_name_ = name;
}
void number_style_base::serialize(std::wostream & strm)
......
......@@ -128,7 +128,7 @@ public:
void start_image (std::wstring file_path);
void end_image ();
void start_text_box ();
void set_text_box_min_size (bool val);
void set_text_box_min_size (double w_pt, double h_pt);
......@@ -211,8 +211,9 @@ 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_textarea_rotate (double dVal);
void set_layer (std::wstring val);
void set_placeholder_id (std::wstring val);
void set_placeholder_type (int val);
//////////////////////////////////////////////////////////////////////////////////////
void start_gradient_style ();
void set_gradient_type (odf_types::gradient_style::type style);
......
......@@ -112,6 +112,23 @@ void odf_page_layout_context::create_layer_sets()
master_state_list_.push_back( odf_master_state(sets_elm) );
}
office_element_ptr odf_page_layout_context::add_presentation_layout_page()
{
office_element_ptr elm;
create_element(L"style", L"presentation-page-layout", elm, odf_context_);
style_presentation_page_layout* style_ = dynamic_cast<style_presentation_page_layout*>(elm.get());
if (style_)
{
std::wstring style_name = local_style_context_->find_free_name(style_family::PresentationPageLayout);
style_->style_name_ = style_name;
local_style_context_->add_style(elm, false, true, style_family::PresentationPageLayout);
local_style_context_->last_state()->set_name(style_name);
}
return elm;
}
void odf_page_layout_context::add_master_page(std::wstring page_name)
{
office_element_ptr elm;
......@@ -167,7 +184,6 @@ void odf_page_layout_context::set_styles_context(odf_style_context * Context)
{
style_context_ = Context;
}
void odf_page_layout_context::create_layout_page()
{
office_element_ptr elm;
......
......@@ -64,6 +64,8 @@ public:
void add_master_page(std::wstring oox_name);
void create_layout_page();
office_element_ptr add_presentation_layout_page();
void set_current_master_page_base();
......
......@@ -108,9 +108,7 @@ std::wstring odf_master_state::get_name()
style_master_page* style_ = dynamic_cast<style_master_page*>(elements_[0].elm.get());
if (!style_)return L"";
if (style_->style_master_page_attlist_.style_name_)
return style_->style_master_page_attlist_.style_name_->style_name();
else return L"";
return style_->style_master_page_attlist_.style_name_.get_value_or(L"");
}
void odf_master_state::add_footer(office_element_ptr & elm)
{
......
......@@ -80,7 +80,7 @@ void odf_style_context::set_odf_context(odf_conversion_context * Context)
odf_style_state_ptr odf_style_context::last_state(style_family::type family)
{
for (size_t i = style_state_list_.size()-1; i>=0; i--)
for (int i = (int)style_state_list_.size() - 1; i >= 0; i--)
{
if (style_state_list_[i]->get_family_type() == family || family == style_family::None )
{
......@@ -89,7 +89,7 @@ odf_style_state_ptr odf_style_context::last_state(style_family::type family)
}
return odf_style_state_ptr();
}
void odf_style_context::create_style(std::wstring oox_name, style_family::type family, bool automatic,bool root,int oox_id)
void odf_style_context::create_style(std::wstring oox_name, style_family::type family, bool automatic, bool root, int oox_id)
{
std::wstring odf_name = oox_name;
......@@ -179,7 +179,7 @@ void odf_style_context::process_office_styles(office_element_ptr root )
}
std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_family::type family, bool root, bool automatic)
{
for (size_t i =0; i < style_state_list_.size(); i++)
for (size_t i = 0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->odf_style_)
{
......@@ -188,7 +188,7 @@ std::wstring odf_style_context::find_odf_style_name(int oox_id_style, style_fami
style_state_list_[i]->automatic_ == automatic &&
style_state_list_[i]->conditional_ == false)
{
if (oox_id_style >=0 && style_state_list_[i]->style_oox_id_ == oox_id_style)
if (oox_id_style >= 0 && style_state_list_[i]->style_oox_id_ == oox_id_style)
return style_state_list_[i]->get_name();
}
......@@ -262,7 +262,7 @@ bool odf_style_context::find_odf_style_state(int oox_id_style, style_family::typ
style_state_list_[i]->conditional_ == false &&
style_state_list_[i]->default_ == false)
{
if (oox_id_style >=0 && style_state_list_[i]->style_oox_id_ == oox_id_style)
if (oox_id_style >= 0 && style_state_list_[i]->style_oox_id_ == oox_id_style)
{
state = style_state_list_[i];
return true;
......@@ -374,10 +374,11 @@ std::wstring odf_style_context::get_name_family(style_family::type family)
case style_family::Marker: return L"Marker";
case style_family::StokeDash: return L"StokeDash";
case style_family::PageLayout: return L"Mpm";
case style_family::MasterPage: return L"MasterPage";
case style_family::HandoutMaster:return L"Handout";
case style_family::LayerSet: return L"";//нету
case style_family::PageLayout: return L"Mpm";
case style_family::MasterPage: return L"MasterPage";
case style_family::HandoutMaster: return L"Handout";
case style_family::LayerSet: return L"";//нету
case style_family::PresentationPageLayout: return L"AL";
}
return L"UnknownStyle";
......@@ -402,13 +403,13 @@ std::wstring odf_style_context::find_free_name(style_family::type family)
}
office_element_ptr & odf_style_context::add_or_find(std::wstring name, style_family::type family, bool automatic , bool root, int oox_id)
{
for (size_t i=0;i<style_state_list_.size(); i++)
for (size_t i = 0; i < style_state_list_.size(); i++)
{
if (style_state_list_[i]->odf_style_)
{
if (style_state_list_[i]->get_family_type() == family)
{
if (oox_id >=0 && style_state_list_[i]->style_oox_id_ == oox_id)
if (oox_id >= 0 && style_state_list_[i]->style_oox_id_ == oox_id)
return style_state_list_[i]->get_office_element();
if ((name.length() >=0 && style_state_list_[i]->odf_style_->get_name() == name)
......
......@@ -228,10 +228,10 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled)
}
text_p* p = dynamic_cast<text_p*>(elm.get());
if (p) p->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(style_name);
if (p) p->paragraph_.paragraph_attrs_.text_style_name_ = style_name;
text_h* h = dynamic_cast<text_h*>(elm.get());
if (h) h->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(style_name);
if (h) h->paragraph_.paragraph_attrs_.text_style_name_ = style_name;
style *style_ = dynamic_cast<style*>(style_elm.get());
if (style_)
......@@ -244,10 +244,10 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled)
else if (parent_paragraph_style_.length() >0)
{
text_p* p = dynamic_cast<text_p*>(elm.get());
if (p)p->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(parent_paragraph_style_);
if (p)p->paragraph_.paragraph_attrs_.text_style_name_ = parent_paragraph_style_;
text_h* h = dynamic_cast<text_h*>(elm.get());
if (h)p->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(parent_paragraph_style_);
if (h)p->paragraph_.paragraph_attrs_.text_style_name_ = parent_paragraph_style_;
}
if (paragraph_properties_ && need_break_)
{
......@@ -324,7 +324,7 @@ void odf_text_context::start_span(bool styled)
style *style_ = dynamic_cast<style*>(style_elm.get());
text_span* span = dynamic_cast<text_span*>(span_elm.get());
if (span) span->text_style_name_ = style_ref(style_name);
if (span) span->text_style_name_ = style_name;
if (style_)
{
......@@ -411,7 +411,7 @@ void odf_text_context::start_list(std::wstring style_name) //todoooo add new_num
text_list* list = dynamic_cast<text_list*>(list_elm.get());
if (list)
{
list->text_style_name_ = style_ref(style_name);
list->text_style_name_ = style_name;
list->text_continue_numbering_ = true;
}
list_state_.style_name = style_name;
......@@ -501,17 +501,17 @@ void odf_text_context::add_text_style(office_element_ptr & style_elm, std::wstri
if (text_span* span = dynamic_cast<text_span*>(current_level_.back().elm.get()))
{
span->text_style_name_ = style_ref(style_name);
span->text_style_name_ = style_name;
}
if (text_p* p = dynamic_cast<text_p*>(current_level_.back().elm.get()))
{
p->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(style_name);
p->paragraph_.paragraph_attrs_.text_style_name_ = style_name;
}
if (text_h* h = dynamic_cast<text_h*>(current_level_.back().elm.get()))
{
h->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(style_name);
h->paragraph_.paragraph_attrs_.text_style_name_ = style_name;
}
}
......
......@@ -78,7 +78,10 @@ void odp_conversion_context::start_slide()
drawing_context()->set_presentation(false);
}
void odp_conversion_context::end_slide()
{
slide_context_.end_page();
}
void odp_conversion_context::start_master_slide(std::wstring name)
{
slide_context_.set_styles_context(page_layout_context()->get_local_styles_context());
......@@ -88,17 +91,24 @@ void odp_conversion_context::start_master_slide(std::wstring name)
drawing_context()->set_presentation(true);
}
void odp_conversion_context::end_master_slide()
{
slide_context_.end_page();
}
void odp_conversion_context::end_slide()
void odp_conversion_context::start_layout_slide()
{
slide_context_.set_styles_context(page_layout_context()->get_local_styles_context());
office_element_ptr elm = page_layout_context()->add_presentation_layout_page();
slide_context_.start_page(elm);
drawing_context()->set_presentation(true);
}
void odp_conversion_context::end_layout_slide()
{
slide_context_.end_page();
}
void odp_conversion_context::start_text_context()
{
text_context_ = new odf_text_context(this);
......
......@@ -55,6 +55,9 @@ public:
void start_master_slide(std::wstring name);
void end_master_slide();
void start_layout_slide();
void end_layout_slide();
odp_page_state & current_slide() { return slide_context_.state();}
/////////////////////////////////////////////////////
......
......@@ -81,6 +81,16 @@ void odp_page_state::set_page_name(std::wstring name)
}
}
void odp_page_state::set_layout_page(std::wstring name)
{
if (name.empty())return;
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page == NULL)return;
page->draw_page_attr_.page_layout_name_ = name;
}
void odp_page_state::set_master_page(std::wstring name)
{
if (name.empty())return;
......
......@@ -77,7 +77,9 @@ public:
odp_page_state(odf_conversion_context * Context, office_element_ptr & elm);
void set_page_name(std::wstring name);
void set_page_style(office_element_ptr & _style);
void set_master_page(std::wstring name);
void set_layout_page(std::wstring name);
void add_child_element( const office_element_ptr & child_element);
......
......@@ -264,7 +264,7 @@ void ods_table_state::add_column(office_element_ptr & elm, short repeated,office
table_table_column* column = dynamic_cast<table_table_column*>(columns_.back().elm.get());
if (column == NULL)return;
if (style_name.length()>0) column->table_table_column_attlist_.table_style_name_ = style_ref(style_name);
if (style_name.length()>0) column->table_table_column_attlist_.table_style_name_ = style_name;
column->table_table_column_attlist_.table_number_columns_repeated_ = repeated;
}
......@@ -275,7 +275,7 @@ void ods_table_state::set_column_default_cell_style(std::wstring & style_name)
table_table_column* column = dynamic_cast<table_table_column*>(columns_.back().elm.get());
if (column == NULL)return;
column->table_table_column_attlist_.table_default_cell_style_name_ = style_ref(style_name);
column->table_table_column_attlist_.table_default_cell_style_name_ = style_name;
columns_.back().cell_style_name = style_name;
}
......@@ -350,7 +350,7 @@ void ods_table_state::add_row(office_element_ptr & elm, short repeated, office_e
table_table_row* row = dynamic_cast<table_table_row*>(rows_.back().elm.get());
if (row == NULL)return;
if (style_name.length()>0) row->table_table_row_attlist_.table_style_name_ = style_ref(style_name);
if (style_name.length()>0) row->table_table_row_attlist_.table_style_name_ = style_name;
row->table_table_row_attlist_.table_number_rows_repeated_ = repeated;
row_default_cell_style_name_ = L"";
......@@ -440,7 +440,7 @@ void ods_table_state::set_row_default_cell_style(std::wstring & style_name)
//table_table_row* row = dynamic_cast<table_table_row*>(rows_.back().elm.get());
//if (row == NULL)return;
//row->table_table_row_attlist_.table_default_cell_style_name_ = style_ref(style_name);
//row->table_table_row_attlist_.table_default_cell_style_name_ = style_name;
}
office_element_ptr & ods_table_state::current_row_element()
......@@ -1185,8 +1185,8 @@ void ods_table_state::set_conditional_style_name(std::wstring style_name)
calcext_condition* condition = dynamic_cast<calcext_condition*> (current_level_.back().get());
calcext_date_is* date_is = dynamic_cast<calcext_date_is*> (current_level_.back().get());
if (condition)condition->calcext_condition_attr_.calcext_apply_style_name_= style_ref(style_name);
if (date_is) date_is->calcext_date_is_attr_.calcext_style_ = style_ref(style_name);
if (condition) condition->calcext_condition_attr_.calcext_apply_style_name_= style_name;
if (date_is) date_is->calcext_date_is_attr_.calcext_style_ = style_name;
}
void ods_table_state::set_conditional_operator(int _operator)
{
......
......@@ -465,7 +465,7 @@ void odt_conversion_context::add_section(bool continuous)
state.style_name = styles_context()->last_state()->get_name();
text_section* section = dynamic_cast<text_section*>(state.elm.get());
if (section)section->text_section_attr_.text_style_name_ = style_ref(state.style_name);
if (section)section->text_section_attr_.text_style_name_ = state.style_name;
sections_.push_back(state);
}
......
......@@ -41,7 +41,6 @@
#include "bool.h"
#include "length.h"
#include "style_ref.h"
namespace cpdoccore {
namespace odf_writer {
......@@ -52,20 +51,19 @@ class office_annotation_attr
public:
void serialize(CP_ATTR_NODE);
public:
_CP_OPT(odf_types::length) svg_y_;
_CP_OPT(odf_types::length) svg_x_;
_CP_OPT(odf_types::length) svg_width_;
_CP_OPT(odf_types::length) svg_height_;
_CP_OPT(odf_types::length) svg_y_;
_CP_OPT(odf_types::length) svg_x_;
_CP_OPT(odf_types::length) svg_width_;
_CP_OPT(odf_types::length) svg_height_;
_CP_OPT(odf_types::length) caption_point_y_;
_CP_OPT(odf_types::length) caption_point_x_;
_CP_OPT(odf_types::length) caption_point_y_;
_CP_OPT(odf_types::length) caption_point_x_;
_CP_OPT(std::wstring) name_;
_CP_OPT(odf_types::Bool) display_;
_CP_OPT(std::wstring) name_;
_CP_OPT(odf_types::Bool) display_;
_CP_OPT(odf_types::style_ref) draw_text_style_name_;
_CP_OPT(odf_types::style_ref) draw_style_name_;
_CP_OPT(std::wstring) draw_text_style_name_;
_CP_OPT(std::wstring) draw_style_name_;
};
class dc_date : public office_element_impl<dc_date>
......
......@@ -461,7 +461,7 @@ void text_ruby::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR(L"text:style-name", text_style_name_.style_name());
CP_XML_ATTR(L"text:style-name", text_style_name_);
if (text_ruby_base_)
text_ruby_base_->serialize(CP_XML_STREAM());
......
......@@ -39,7 +39,6 @@
#include "office_elements_create.h"
#include "style_ref.h"
#include "targetframename.h"
#include "noteclass.h"
......@@ -322,8 +321,8 @@ public:
office_element_ptr_array paragraph_content_;
_CP_OPT(odf_types::style_ref) text_style_name_;//ваще то это такой элемент где стиль должОн быть всегда
odf_types::style_ref_array text_class_names_;
_CP_OPT(std::wstring) text_style_name_;//ваще то это такой элемент где стиль должОн быть всегда
std::vector<std::wstring> text_class_names_;
virtual void add_text(const std::wstring & Text);
};
......@@ -357,8 +356,8 @@ public:
_CP_OPT(std::wstring) office_name_;
_CP_OPT(odf_types::target_frame_name) office_target_frame_name_;
_CP_OPT(odf_types::style_ref) text_style_name_;
_CP_OPT(odf_types::style_ref) text_visited_style_name_;
_CP_OPT(std::wstring) text_style_name_;
_CP_OPT(std::wstring) text_visited_style_name_;
office_element_ptr_array paragraph_content_;
};
......@@ -467,10 +466,10 @@ public:
virtual void add_text(const std::wstring & Text);
odf_types::style_ref text_style_name_;
std::wstring text_style_name_;
office_element_ptr text_ruby_base_;
office_element_ptr text_ruby_text_;
office_element_ptr text_ruby_base_;
office_element_ptr text_ruby_text_;
};
......
......@@ -32,17 +32,12 @@
#include "style_map.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
// style:map
......
......@@ -38,8 +38,6 @@
#include "office_elements_create.h"
#include "style_ref.h"
namespace cpdoccore {
namespace odf_writer {
......@@ -57,10 +55,10 @@ public:
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
virtual void serialize(std::wostream & strm){}
std::wstring style_condition_;
odf_types::style_ref style_name_;
std::wstring style_base_cell_address_;
odf_types::style_ref style_apply_style_name_;
std::wstring style_condition_;
std::wstring style_name_;
std::wstring style_base_cell_address_;
std::wstring style_apply_style_name_;
};
......
......@@ -78,7 +78,7 @@ public:
odf_types::common_background_color_attlist common_background_color_attlist_;
odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
_CP_OPT(odf_types::style_ref) style_register_truth_ref_style_name_;
_CP_OPT(std::wstring) style_register_truth_ref_style_name_;
_CP_OPT(std::wstring) style_print_;
_CP_OPT(std::wstring) style_paper_tray_name_;
_CP_OPT(std::wstring) style_print_orientation_;
......
......@@ -56,7 +56,6 @@
#include "linestyle.h"
#include "linetype.h"
#include "styleleadercolor.h"
#include "style_ref.h"
#include "dropcaplength.h"
#include "fobreak.h"
#include "styleposition.h"
......@@ -101,7 +100,7 @@ public:
_CP_OPT(odf_types::style_leader_color) style_leader_color_;
_CP_OPT( std::wstring ) style_leader_text_;
_CP_OPT( odf_types::style_ref ) style_leader_text_style_;
_CP_OPT( std::wstring ) style_leader_text_style_;
};
......@@ -148,7 +147,7 @@ public:
_CP_OPT(odf_types::drop_cap_length) style_length_;
_CP_OPT(unsigned int) style_lines_;
_CP_OPT(odf_types::length) style_distance_;
_CP_OPT(odf_types::style_ref) style_style_name_;
_CP_OPT(std::wstring) style_style_name_;
_CP_OPT(odf_types::common_xlink_attlist) common_xlink_attlist_;
};
......
......@@ -93,7 +93,7 @@ public:
_CP_OPT(odf_types::line_width) style_text_line_through_width_;
_CP_OPT(odf_types::color) style_text_line_through_color_;
_CP_OPT(std::wstring) style_text_line_through_text_;
_CP_OPT(odf_types::style_ref) style_text_line_through_text_style_;
_CP_OPT(std::wstring) style_text_line_through_text_style_;
_CP_OPT(odf_types::text_position) style_text_position_;
......
......@@ -879,6 +879,11 @@ void office_styles::serialize(std::wostream & strm)
draw_styles_.serialize(CP_XML_STREAM());
for (size_t i = 0 ; i < style_presentation_page_layout_.size(); i++)
{
style_presentation_page_layout_[i]->serialize(CP_XML_STREAM());
}
templates_.serialize(CP_XML_STREAM());
styles_.serialize(CP_XML_STREAM());
......@@ -1349,5 +1354,25 @@ void style_presentation_page_layout::create_child_element( const std::wstring &
}
}
void style_presentation_page_layout::add_child_element( const office_element_ptr & child)
{
content_.push_back(child);
}
void style_presentation_page_layout::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"style:name", style_name_);
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
}
}
......@@ -476,12 +476,12 @@ class style_master_page_attlist
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(odf_types::style_ref) style_name_;
_CP_OPT(std::wstring) style_display_name_;
_CP_OPT(odf_types::style_ref) style_page_layout_name_;
_CP_OPT(std::wstring) style_name_;
_CP_OPT(std::wstring) style_display_name_;
_CP_OPT(std::wstring) style_page_layout_name_;
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(odf_types::style_ref) style_next_style_name_;
_CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(std::wstring) style_next_style_name_;
};
......@@ -851,13 +851,15 @@ public:
static const ElementType type = typeStylePresentationPageLayout;
CPDOCCORE_DEFINE_VISITABLE()
virtual void serialize(std::wostream & strm){}
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
virtual void serialize(std::wostream & strm);
virtual void create_child_element ( const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element ( const office_element_ptr & child);
_CP_OPT(std::wstring) style_name_;
office_element_ptr_array content_;
};
};
CP_REGISTER_OFFICE_ELEMENT2(style_presentation_page_layout)
......
......@@ -86,7 +86,7 @@ class text_list_level_style_number_attr
public:
text_list_level_style_number_attr() {}
_CP_OPT(odf_types::style_ref) text_style_name_;
_CP_OPT(std::wstring) text_style_name_;
odf_types::common_num_format_attlist common_num_format_attlist_;
odf_types::common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
......@@ -204,7 +204,7 @@ class text_list_level_style_bullet_attr
{
public:
_CP_OPT(odf_types::style_ref) text_style_name_;
_CP_OPT(std::wstring) text_style_name_;
_CP_OPT(wchar_t) text_bullet_char_;
_CP_OPT(odf_types::percent) text_bullet_relative_size_;
......@@ -242,7 +242,7 @@ class text_list_level_style_image_attr
{
public:
_CP_OPT(odf_types::style_ref) text_style_name_;
_CP_OPT(std::wstring) text_style_name_;
odf_types::common_xlink_attlist common_xlink_attlist_;
void serialize(CP_ATTR_NODE);
......
......@@ -62,14 +62,14 @@ public:
}
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(std::wstring) table_name_;
_CP_OPT(odf_types::style_ref) table_style_name_;
_CP_OPT(std::wstring) table_template_name_;
_CP_OPT(std::wstring) table_name_;
_CP_OPT(std::wstring) table_style_name_;
_CP_OPT(std::wstring) table_template_name_;
_CP_OPT(std::wstring) table_protection_key_;
_CP_OPT(std::wstring) table_print_ranges_;
_CP_OPT(std::wstring) table_protection_key_;
_CP_OPT(std::wstring) table_print_ranges_;
_CP_OPT(odf_types::Bool) table_protected_; // default false
_CP_OPT(odf_types::Bool) table_protected_; // default false
bool table_print_; // default true
......@@ -91,8 +91,8 @@ public:
unsigned int table_number_rows_repeated_; // default 1
_CP_OPT(odf_types::style_ref) table_style_name_;
_CP_OPT(odf_types::style_ref) table_default_cell_style_name_;
_CP_OPT(std::wstring) table_style_name_;
_CP_OPT(std::wstring) table_default_cell_style_name_;
_CP_OPT(odf_types::table_visibility) table_visibility_; // default Visible
void serialize(CP_ATTR_NODE);
......@@ -104,10 +104,10 @@ class table_table_cell_attlist
public:
table_table_cell_attlist() : table_number_columns_repeated_(1) {}
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(odf_types::style_ref) table_style_name_;
_CP_OPT(std::wstring) table_content_validation_name_;
_CP_OPT(std::wstring) table_formula_;
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(std::wstring) table_style_name_;
_CP_OPT(std::wstring) table_content_validation_name_;
_CP_OPT(std::wstring) table_formula_;
_CP_OPT(odf_types::common_value_and_type_attlist) common_value_and_type_attlist_;
......@@ -247,12 +247,12 @@ public:
class table_table_column_attlist
{
public:
table_table_column_attlist() : table_number_columns_repeated_(1){}
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(odf_types::style_ref) table_style_name_;
_CP_OPT(odf_types::table_visibility) table_visibility_; // default Visible
_CP_OPT(odf_types::style_ref) table_default_cell_style_name_;
table_table_column_attlist() : table_number_columns_repeated_(1){}
unsigned int table_number_columns_repeated_; // default 1
_CP_OPT(std::wstring) table_style_name_;
_CP_OPT(odf_types::table_visibility) table_visibility_; // default Visible
_CP_OPT(std::wstring) table_default_cell_style_name_;
void serialize(CP_ATTR_NODE);
};
......
......@@ -38,7 +38,6 @@
#include "office_elements_create.h"
#include "style_ref.h"
#include "bool.h"
namespace cpdoccore {
......
......@@ -40,8 +40,6 @@
namespace cpdoccore {
using namespace odf_types;
namespace odf_writer {
using xml::xml_char_wc;
......
......@@ -37,7 +37,6 @@
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
#include "style_ref.h"
namespace cpdoccore {
namespace odf_writer {
......
......@@ -95,9 +95,9 @@ void paragraph_attrs::serialize(CP_ATTR_NODE)
std::wstring text_class_names_all;
BOOST_FOREACH(const style_ref & elm, text_class_names_)
BOOST_FOREACH(const std::wstring & elm, text_class_names_)
{
text_class_names_all = elm.style_name() + std::wstring(L" ");
text_class_names_all = elm + std::wstring(L" ");
}
if (!text_class_names_all.empty())
......
......@@ -41,7 +41,6 @@
#include "common_attlists.h"
#include "bool.h"
#include "style_ref.h"
#include "textdisplay.h"
namespace cpdoccore {
......@@ -53,9 +52,9 @@ class paragraph_attrs
{
public:
_CP_OPT(odf_types::style_ref) text_style_name_;
_CP_OPT(odf_types::style_ref) text_cond_style_name_;
odf_types::style_ref_array text_class_names_;
_CP_OPT(std::wstring) text_style_name_;
_CP_OPT(std::wstring) text_cond_style_name_;
std::vector<std::wstring> text_class_names_;
void serialize(CP_ATTR_NODE);
......@@ -158,7 +157,7 @@ public:
virtual void serialize(std::wostream & _Wostream);
_CP_OPT(odf_types::style_ref) text_style_name_;
_CP_OPT(std::wstring) text_style_name_;
_CP_OPT(odf_types::Bool) text_continue_numbering_;
office_element_ptr text_list_header_;
......@@ -189,7 +188,7 @@ CP_REGISTER_OFFICE_ELEMENT2(text_soft_page_break);
class text_section_attr
{
public:
_CP_OPT(odf_types::style_ref) text_style_name_;
_CP_OPT(std::wstring) text_style_name_;
std::wstring text_name_;
_CP_OPT(bool) text_protected_;
_CP_OPT(std::wstring) text_protection_key_;
......
......@@ -948,7 +948,13 @@ void OoxConverter::convert(PPTX::Logic::NvPr *oox_nvPr)
if (oox_nvPr->ph.is_init())
{
odf_context()->drawing_context()->set_layer(L"backgroundobjects");
if (oox_nvPr->ph->type.IsInit())
odf_context()->drawing_context()->set_placeholder_type(oox_nvPr->ph->type->GetBYTECode());
if (oox_nvPr->ph->idx.IsInit())
odf_context()->drawing_context()->set_placeholder_id(oox_nvPr->ph->idx.get());
//nullable_bool hasCustomPrompt;
//nullable_limit<Limit::Orient> orient;
//nullable_limit<Limit::PlaceholderSize> sz;
}
}
void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph)
......
......@@ -204,11 +204,59 @@ void PptxConverter::convertDocument()
if (UpdateProgress(850000))return;
}
void PptxConverter::convert_styles()
{
if (presentation->sldIdLst.empty()) return;
std::wstring rId = presentation->sldIdLst[0].rid.get();
smart_ptr<PPTX::Slide> slide = ((*presentation)[rId]).smart_dynamic_cast<PPTX::Slide>();
if (slide.IsInit() == false) return;
odp_context->styles_context()->create_default_style(odf_types::style_family::Graphic);
odf_writer::style_paragraph_properties * paragraph_properties = odp_context->styles_context()->last_state()->get_paragraph_properties();
odf_writer::style_text_properties * text_properties = odp_context->styles_context()->last_state()->get_text_properties();
if (text_properties)
{
text_properties->content_.fo_font_size_ = odf_types::font_size(odf_types::length(18, odf_types::length::pt));
}
if (slide->theme.IsInit() && text_properties)
{
if (slide->theme->themeElements.fontScheme.majorFont.latin.typeface.empty() == false)
text_properties->content_.fo_font_family_ = slide->theme->themeElements.fontScheme.majorFont.latin.typeface;
if (slide->theme->themeElements.fontScheme.majorFont.cs.typeface.empty() == false)
text_properties->content_.style_font_family_complex_ = slide->theme->themeElements.fontScheme.majorFont.cs.typeface;
if (slide->theme->themeElements.fontScheme.majorFont.ea.typeface.empty() == false)
text_properties->content_.style_font_family_asian_ = slide->theme->themeElements.fontScheme.majorFont.ea.typeface;
}
convert(presentation->defaultTextStyle.GetPointer()); //стили дефалтовых списков
///////////////////////////////////////////////////////////////////////////
odp_context->styles_context()->create_default_style(odf_types::style_family::Table);
odf_writer::style_table_properties * table_properties = odp_context->styles_context()->last_state()->get_table_properties();
//для красивой отрисовки в редакторах - разрешим объеденить стили пересекающихся обрамлений
table_properties->table_format_properties_.table_border_model_ = odf_types::border_model(odf_types::border_model::Collapsing);
odp_context->styles_context()->create_default_style(odf_types::style_family::TableRow);
odf_writer::style_table_row_properties * row_properties = odp_context->styles_context()->last_state()->get_table_row_properties();
row_properties->style_table_row_properties_attlist_.fo_keep_together_ = odf_types::keep_together(odf_types::keep_together::Auto);
/////////////////////////////////////////////////////////////////////////////////////////////////
//зачемто ?! для OpenOffice для врезок/фреймов нужен базовый стиль - без него другой тип геометрии oO !!!
odp_context->styles_context()->create_style(L"Frame", odf_types::style_family::Graphic,false, true);
odf_writer::graphic_format_properties * frame_graphic_properties = odp_context->styles_context()->last_state()->get_graphic_properties();
odf_writer::style_text_properties * frame_text_properties = odp_context->styles_context()->last_state()->get_text_properties();
if (frame_text_properties && text_properties)
frame_text_properties->apply_from(text_properties);
odp_context->page_layout_context()->create_layer_sets();
//layouts
}
void PptxConverter::convert_settings()
......@@ -235,11 +283,8 @@ void PptxConverter::convert_slides()
if (slide->Master.IsInit())
{
current_clrMap = &slide->Master->clrMap;
// 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);
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename);
if (pFind == m_mapMasters.end())
{
master_style_name = L"MasterPage";
......@@ -254,21 +299,37 @@ void PptxConverter::convert_slides()
odp_context->start_master_slide(master_style_name);
current_slide = slide->Master.operator->();
convert(&slide->Master->cSld, false);//slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true);
convert_slide(&slide->Master->cSld, false);//slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true);
if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->();
convert(&slide->Layout->cSld, false);
convert_slide(&slide->Layout->cSld, false);
odp_context->end_master_slide();
m_mapMasters.insert(std::make_pair(master_layout, master_style_name));
m_mapMasters.insert(std::make_pair(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename, master_style_name));
}
else
{
master_style_name = pFind->second;
}
pFind = m_mapLayouts.find(slide->Layout->m_sOutputFilename);
if (pFind == m_mapLayouts.end())
{
odp_context->start_layout_slide();
convert_layout(&slide->Layout->cSld);
odp_context->end_layout_slide();
layout_style_name = odp_context->page_layout_context()->get_local_styles_context()->last_state(odf_types::style_family::PresentationPageLayout)->get_name();
m_mapLayouts.insert(std::make_pair(slide->Layout->m_sOutputFilename, layout_style_name));
}
else
{
layout_style_name = pFind->second;
}
}
//--------------------------------------------------------------------------------------------------------------------
current_clrMap = &slide->Master->clrMap; //after layout
if (slide->clrMapOvr.IsInit() && slide->clrMapOvr->overrideClrMapping.IsInit())
......@@ -279,23 +340,19 @@ void PptxConverter::convert_slides()
odp_context->start_slide();
odp_context->current_slide().set_master_page(master_style_name);
//odp_context->current_slide().set_layout_style(layout_style_name);
odp_context->current_slide().set_master_page (master_style_name);
odp_context->current_slide().set_layout_page (layout_style_name);
//nullable_bool show;
//nullable_bool showMasterPhAnim;
//nullable_bool showMasterSp;
convert(slide->cSld.GetPointer(), true);
convert_slide(slide->cSld.GetPointer(), true);
//nullable<Logic::Transition> transition;
//nullable<Logic::Timing> timing;
//smart_ptr<NotesSlide> Note;
//smart_ptr<Theme> theme;
//smart_ptr<OOX::CVmlDrawing> Vml;
//smart_ptr<TableStyles> tableStyles_;
//smart_ptr<PPTX::Comments> comments;
......@@ -799,7 +856,7 @@ void PptxConverter::convert(PPTX::Logic::Bg *oox_background)
odp_context->end_drawings();
}
void PptxConverter::convert(PPTX::Logic::CSld *oox_slide, bool placeholders)
void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, bool bPlaceholders)
{
if (oox_slide == NULL) return;
......@@ -819,7 +876,7 @@ void PptxConverter::convert(PPTX::Logic::CSld *oox_slide, bool placeholders)
if (pShape.IsInit() && pShape->nvSpPr.nvPr.ph.is_init())
{
if (placeholders)
if (bPlaceholders)
convert(pElem.operator->());
}
else
......@@ -831,7 +888,38 @@ void PptxConverter::convert(PPTX::Logic::CSld *oox_slide, bool placeholders)
convert(oox_slide->controls.GetPointer());
}
void PptxConverter::convert_layout(PPTX::Logic::CSld *oox_slide)
{
if (oox_slide == NULL) return;
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())
{
int type = 0;
if (pShape->nvSpPr.nvPr.ph->type.IsInit())
type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
if (type != 5 && type != 6 && type != 7 && type != 12)
{
odf_writer::office_element_ptr elm;
create_element(L"presentation", L"placeholder", elm, odp_context);
odf_context()->drawing_context()->start_drawing();
odf_context()->drawing_context()->start_element(elm);
OoxConverter::convert(&pShape->nvSpPr.nvPr);
OoxConverter::convert(pShape->spPr.xfrm.GetPointer());
odf_context()->drawing_context()->end_element();
odf_context()->drawing_context()->end_drawing();
}
}
}
}
}
......@@ -103,7 +103,9 @@ namespace Oox2Odf
void convert(OOX::WritingElement *oox_unknown);
void convert(PPTX::Logic::CSld *oox_slide, bool placeholders = true);
void convert_slide (PPTX::Logic::CSld *oox_slide, bool bPlaceholders = true);
void convert_layout (PPTX::Logic::CSld *oox_slide);
void convert(PPTX::Logic::Bg *oox_background);
void convert(PPTX::Logic::Table *oox_table);
......@@ -132,11 +134,12 @@ private:
odf_writer::odp_conversion_context *odp_context;
std::map<std::wstring, std::wstring> m_mapMasters;
std::vector<std::wstring> m_arLayouts;
std::map<std::wstring, std::wstring> m_mapLayouts;
void convert_slides ();
void convert_styles ();
void convert_settings ();
void convert_layouts ();
//--------------------------------------------------------------------------------
......
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