Commit a5e821cd authored by ElenaSubbotina's avatar ElenaSubbotina

.

parent cb5d9233
...@@ -72,8 +72,8 @@ public: ...@@ -72,8 +72,8 @@ public:
void start_base_style(const std::wstring baseStyleName, const odf_types::style_family::type baseStyleType); void start_base_style(const std::wstring baseStyleName, const odf_types::style_family::type baseStyleType);
void end_base_style(); void end_base_style();
void ApplyTextProperties (std::wstring style,odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type); void ApplyTextProperties (std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut);
void ApplyParagraphProperties (std::wstring style,odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type); void ApplyParagraphProperties (std::wstring para_style, odf_reader::paragraph_format_properties & propertiesOut);
void ApplyListProperties (odf_reader::paragraph_format_properties & propertiesOut, int Level); void ApplyListProperties (odf_reader::paragraph_format_properties & propertiesOut, int Level);
void set_local_styles_container(odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе void set_local_styles_container(odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
...@@ -239,32 +239,37 @@ void pptx_text_context::Impl::end_hyperlink(std::wstring hId) ...@@ -239,32 +239,37 @@ void pptx_text_context::Impl::end_hyperlink(std::wstring hId)
dump_run(); dump_run();
hyperlink_hId = L""; hyperlink_hId = L"";
} }
void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name,odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type) void pptx_text_context::Impl::ApplyTextProperties(std::wstring style_name, std::wstring para_style_name, odf_reader::text_format_properties_content & propertiesOut)
{ {
std::vector<const odf_reader::style_instance *> instances; std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* defaultStyle = NULL; odf_reader::style_instance* defaultStyle = NULL;
odf_reader::style_instance* style = NULL; odf_reader::style_instance* para_style = NULL;
odf_reader::style_instance* baseStyle = NULL; odf_reader::style_instance* text_style = NULL;
odf_reader::style_instance* baseStyle = NULL;
if (local_styles_ptr_) if (local_styles_ptr_)
{ {
style = local_styles_ptr_->style_by_name(style_name, Type,false/*process_headers_footers_*/); para_style = local_styles_ptr_->style_by_name (para_style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
defaultStyle = local_styles_ptr_->style_default_by_type(Type); text_style = local_styles_ptr_->style_by_name (style_name, odf_types::style_family::Text, false/*process_headers_footers_*/);
baseStyle = local_styles_ptr_->style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/); defaultStyle = local_styles_ptr_->style_default_by_type (odf_types::style_family::Text);
baseStyle = local_styles_ptr_->style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
} }
else else
{ {
style = odf_context_.styleContainer().style_by_name(style_name, Type,false/*process_headers_footers_*/); para_style = odf_context_.styleContainer().style_by_name (para_style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
defaultStyle = odf_context_.styleContainer().style_default_by_type(Type); text_style = odf_context_.styleContainer().style_by_name (style_name, odf_types::style_family::Text, false/*process_headers_footers_*/);
baseStyle = odf_context_.styleContainer().style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/); defaultStyle = odf_context_.styleContainer().style_default_by_type (odf_types::style_family::Text);
baseStyle = odf_context_.styleContainer().style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
} }
if (defaultStyle) instances.push_back(defaultStyle); if (defaultStyle) instances.push_back(defaultStyle);
if (baseStyle) instances.push_back(baseStyle); if (baseStyle) instances.push_back(baseStyle);
if (style) instances.push_back(style); if (para_style) instances.push_back(para_style);
if (text_style) instances.push_back(text_style);
if (style)get_styles_context().start_process_style(style); if (text_style) get_styles_context().start_process_style(text_style);
else get_styles_context().start_process_style(baseStyle); else if (para_style) get_styles_context().start_process_style(para_style);
else get_styles_context().start_process_style(baseStyle);
propertiesOut.apply_from(calc_text_properties_content(instances)); propertiesOut.apply_from(calc_text_properties_content(instances));
} }
...@@ -323,33 +328,33 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p ...@@ -323,33 +328,33 @@ void pptx_text_context::Impl::ApplyListProperties(odf_reader::paragraph_format_p
} }
void pptx_text_context::Impl::ApplyParagraphProperties(std::wstring style_name,odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type) void pptx_text_context::Impl::ApplyParagraphProperties(std::wstring style_name, odf_reader::paragraph_format_properties & propertiesOut)
{ {
std::vector<const odf_reader::style_instance *> instances; std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* style = NULL; odf_reader::style_instance* style = NULL;
odf_reader::style_instance * defaultStyle = NULL; odf_reader::style_instance* defaultStyle = NULL;
odf_reader::style_instance * baseStyle = NULL; odf_reader::style_instance* baseStyle = NULL;
if (local_styles_ptr_) if (local_styles_ptr_)
{ {
style = local_styles_ptr_->style_by_name(style_name, Type,false/*process_headers_footers_*/); style = local_styles_ptr_->style_by_name (style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
defaultStyle = local_styles_ptr_->style_default_by_type(Type); defaultStyle = local_styles_ptr_->style_default_by_type (odf_types::style_family::Paragraph);
baseStyle = local_styles_ptr_->style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/); baseStyle = local_styles_ptr_->style_by_name (base_style_name_, base_style_family_, false/*process_headers_footers_*/);
} }
else else
{ {
style = odf_context_.styleContainer().style_by_name(style_name, Type,false/*process_headers_footers_*/); style = odf_context_.styleContainer().style_by_name (style_name, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
defaultStyle = odf_context_.styleContainer().style_default_by_type(Type); defaultStyle = odf_context_.styleContainer().style_default_by_type (odf_types::style_family::Paragraph);
baseStyle= odf_context_.styleContainer().style_by_name(base_style_name_, base_style_family_,false/*process_headers_footers_*/); baseStyle = odf_context_.styleContainer().style_by_name (base_style_name_, base_style_family_,false/*process_headers_footers_*/);
} }
if (defaultStyle) instances.push_back(defaultStyle); if (defaultStyle) instances.push_back(defaultStyle);
if (baseStyle) instances.push_back(baseStyle); if (baseStyle) instances.push_back(baseStyle);
if (style) instances.push_back(style); if (style) instances.push_back(style);
if (style)get_styles_context().start_process_style(style); if (style) get_styles_context().start_process_style(style);
else get_styles_context().start_process_style(baseStyle); else get_styles_context().start_process_style(baseStyle);
propertiesOut.apply_from(calc_paragraph_properties_content(instances)); propertiesOut.apply_from(calc_paragraph_properties_content(instances));
} }
...@@ -360,9 +365,9 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm) ...@@ -360,9 +365,9 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
int level = list_style_stack_.size()-1; int level = list_style_stack_.size()-1;
odf_reader::paragraph_format_properties paragraph_properties_; odf_reader::paragraph_format_properties paragraph_properties_;
ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_,odf_types::style_family::Paragraph); ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_);
ApplyListProperties (paragraph_properties_, level);//выравнивания листа накатим на свойства параграфа ApplyListProperties (paragraph_properties_, level);//выравнивания листа накатим на свойства параграфа
paragraph_properties_.pptx_convert(pptx_context_); paragraph_properties_.pptx_convert(pptx_context_);
...@@ -403,16 +408,9 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm) ...@@ -403,16 +408,9 @@ void pptx_text_context::Impl::write_rPr(std::wostream & strm)
if (paragraph_style_name_.empty() && span_style_name_.empty() && !(!hyperlink_hId.empty()) && base_style_name_.empty()) if (paragraph_style_name_.empty() && span_style_name_.empty() && !(!hyperlink_hId.empty()) && base_style_name_.empty())
return; return;
odf_reader::text_format_properties_content text_properties_paragraph_;
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_,odf_types::style_family::Paragraph);
odf_reader::text_format_properties_content text_properties_span_;
ApplyTextProperties(span_style_name_, text_properties_span_,odf_types::style_family::Text);
odf_reader::text_format_properties_content text_properties_; odf_reader::text_format_properties_content text_properties_;
text_properties_.apply_from(text_properties_paragraph_); ApplyTextProperties(span_style_name_, paragraph_style_name_, text_properties_);
text_properties_.apply_from(text_properties_span_);
get_styles_context().start(); get_styles_context().start();
......
...@@ -84,10 +84,10 @@ public: ...@@ -84,10 +84,10 @@ public:
void serialize_shared_strings(std::wostream & strm); void serialize_shared_strings(std::wostream & strm);
void ApplyTextProperties (std::wstring style, odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type); void ApplyTextProperties (std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut);
void ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type); void ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut);
void set_local_styles_container(odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе void set_local_styles_container (odf_reader::styles_container* local_styles_);//это если стили объектов содержатся в другом документе
bool is_drawing_context(){return in_draw;} bool is_drawing_context(){return in_draw;}
...@@ -237,48 +237,54 @@ void xlsx_text_context::Impl::end_hyperlink(std::wstring hId) ...@@ -237,48 +237,54 @@ void xlsx_text_context::Impl::end_hyperlink(std::wstring hId)
hyperlink_hId = hId; hyperlink_hId = hId;
} }
void xlsx_text_context::Impl::ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut, odf_types::style_family::type Type) void xlsx_text_context::Impl::ApplyParagraphProperties (std::wstring style, odf_reader::paragraph_format_properties & propertiesOut)
{ {
std::vector<const odf_reader::style_instance *> instances; std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* defaultStyle = NULL;
odf_reader::style_instance* paraStyle = NULL;
if (local_styles_ptr_) if (local_styles_ptr_)
{ {
odf_reader::style_instance * defaultStyle = local_styles_ptr_->style_default_by_type(Type); defaultStyle = local_styles_ptr_->style_default_by_type(odf_types::style_family::Paragraph);
if (defaultStyle)instances.push_back(defaultStyle); paraStyle = local_styles_ptr_->style_by_name(style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
odf_reader::style_instance* styleInst = local_styles_ptr_->style_by_name(style, Type,false/*process_headers_footers_*/);
if(styleInst)instances.push_back(styleInst);
} }
else else
{ {
odf_reader::style_instance * defaultStyle = styles_.style_default_by_type(Type); defaultStyle = styles_.style_default_by_type(odf_types::style_family::Paragraph);
if (defaultStyle)instances.push_back(defaultStyle); paraStyle = styles_.style_by_name(style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
odf_reader::style_instance* styleInst = styles_.style_by_name(style, Type,false/*process_headers_footers_*/);
if(styleInst)instances.push_back(styleInst);
} }
if (defaultStyle) instances.push_back(defaultStyle);
if (paraStyle) instances.push_back(paraStyle);
propertiesOut.apply_from(calc_paragraph_properties_content(instances)); propertiesOut.apply_from(calc_paragraph_properties_content(instances));
} }
void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style, odf_reader::text_format_properties_content & propertiesOut, odf_types::style_family::type Type) void xlsx_text_context::Impl::ApplyTextProperties(std::wstring style, std::wstring para_style, odf_reader::text_format_properties_content & propertiesOut)
{ {
std::vector<const odf_reader::style_instance *> instances; std::vector<const odf_reader::style_instance *> instances;
odf_reader::style_instance* defaultStyle = NULL;
odf_reader::style_instance* textStyle = NULL;
odf_reader::style_instance* paraStyle = NULL;
if (local_styles_ptr_) if (local_styles_ptr_)
{ {
odf_reader::style_instance * defaultStyle = local_styles_ptr_->style_default_by_type(Type); defaultStyle = local_styles_ptr_->style_default_by_type(odf_types::style_family::Text);
if (defaultStyle)instances.push_back(defaultStyle); paraStyle = local_styles_ptr_->style_by_name(para_style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
textStyle = local_styles_ptr_->style_by_name(style, odf_types::style_family::Text, false/*process_headers_footers_*/);
odf_reader::style_instance* styleInst = local_styles_ptr_->style_by_name(style, Type,false/*process_headers_footers_*/);
if(styleInst)instances.push_back(styleInst);
} }
else else
{ {
odf_reader::style_instance * defaultStyle = styles_.style_default_by_type(Type); defaultStyle = styles_.style_default_by_type(odf_types::style_family::Text);
if (defaultStyle)instances.push_back(defaultStyle); paraStyle = styles_.style_by_name(para_style, odf_types::style_family::Paragraph, false/*process_headers_footers_*/);
textStyle = styles_.style_by_name(style, odf_types::style_family::Text, false/*process_headers_footers_*/);
odf_reader::style_instance* styleInst = styles_.style_by_name(style, Type,false/*process_headers_footers_*/);
if(styleInst)instances.push_back(styleInst);
} }
if (defaultStyle) instances.push_back(defaultStyle);
if (paraStyle) instances.push_back(paraStyle);
if (textStyle) instances.push_back(textStyle);
propertiesOut.apply_from(calc_text_properties_content(instances)); propertiesOut.apply_from(calc_text_properties_content(instances));
} }
...@@ -291,10 +297,10 @@ void xlsx_text_context::Impl::write_pPr (std::wostream & strm) ...@@ -291,10 +297,10 @@ void xlsx_text_context::Impl::write_pPr (std::wostream & strm)
{ {
if (paragraph_style_name_.empty())return; if (paragraph_style_name_.empty())return;
odf_reader::paragraph_format_properties paragraph_format_properties_; odf_reader::paragraph_format_properties paragraph_format_properties_;
ApplyParagraphProperties (paragraph_style_name_, paragraph_format_properties_ , odf_types::style_family::Paragraph); ApplyParagraphProperties (paragraph_style_name_, paragraph_format_properties_);
paragraph_format_properties_.xlsx_convert(strm, in_draw); paragraph_format_properties_.xlsx_convert (strm, in_draw);
} }
void xlsx_text_context::Impl::write_rPr(std::wostream & strm) void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
...@@ -303,20 +309,13 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm) ...@@ -303,20 +309,13 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
&& !(!hyperlink_hId.empty() && in_draw) && !(!hyperlink_hId.empty() && in_draw)
&& !(text_properties_cell_ && in_cell_content))return; && !(text_properties_cell_ && in_cell_content))return;
odf_reader::text_format_properties_content text_properties_paragraph_;
odf_reader::text_format_properties_content text_properties_span_;
ApplyTextProperties (paragraph_style_name_, text_properties_paragraph_ , odf_types::style_family::Paragraph);
ApplyTextProperties (span_style_name_, text_properties_span_ , odf_types::style_family::Text);
odf_reader::text_format_properties_content text_properties_; odf_reader::text_format_properties_content text_properties_;
if (in_cell_content && text_properties_cell_) if (in_cell_content && text_properties_cell_)
{ {
text_properties_.apply_from(*text_properties_cell_); text_properties_.apply_from(*text_properties_cell_);
} }
text_properties_.apply_from(text_properties_paragraph_);
text_properties_.apply_from(text_properties_span_); ApplyTextProperties (span_style_name_, paragraph_style_name_, text_properties_);
_CP_OPT(double) dValFontSize; _CP_OPT(double) dValFontSize;
if (text_properties_.fo_font_size_) if (text_properties_.fo_font_size_)
......
...@@ -41,22 +41,22 @@ std::wostream & operator << (std::wostream & _Wostream, const presentation_class ...@@ -41,22 +41,22 @@ std::wostream & operator << (std::wostream & _Wostream, const presentation_class
std::wstring res = L""; std::wstring res = L"";
switch(_Val.get_type()) switch(_Val.get_type())
{ {
case presentation_class::title: _Wostream << L"title" ; break; case presentation_class::title: _Wostream << L"title"; break;
case presentation_class::subtitle: _Wostream << L"subtitle" ; break; case presentation_class::subtitle: _Wostream << L"subtitle"; break;
case presentation_class::graphic: _Wostream << L"graphic" ; break; case presentation_class::graphic: _Wostream << L"graphic"; break;
case presentation_class::object: _Wostream << L"object" ; break; case presentation_class::object: _Wostream << L"object"; break;
case presentation_class::chart: _Wostream << L"chart" ; break; case presentation_class::chart: _Wostream << L"chart"; break;
case presentation_class::table: _Wostream << L"table" ; break; case presentation_class::table: _Wostream << L"table"; break;
case presentation_class::orgchart: _Wostream << L"orgchart" ; break; case presentation_class::orgchart: _Wostream << L"orgchart"; break;
case presentation_class::header: _Wostream << L"header" ; break; case presentation_class::header: _Wostream << L"header"; break;
case presentation_class::footer: _Wostream << L"footer" ; break; case presentation_class::footer: _Wostream << L"footer"; break;
case presentation_class::date_time: _Wostream << L"date_time" ; break; case presentation_class::date_time: _Wostream << L"date-time"; break;
case presentation_class::page_number: _Wostream << L"page_number" ; break; case presentation_class::page_number: _Wostream << L"page-number";break;
case presentation_class::page: _Wostream << L"page" ; break; case presentation_class::page: _Wostream << L"page"; break;
case presentation_class::notes: _Wostream << L"notes" ; break; case presentation_class::notes: _Wostream << L"notes"; break;
case presentation_class::handout: _Wostream << L"handout" ; break; case presentation_class::handout: _Wostream << L"handout"; break;
case presentation_class::outline: _Wostream << L"outline" ; break; case presentation_class::outline: _Wostream << L"outline"; break;
case presentation_class::text: _Wostream << L"text" ; break; case presentation_class::text: _Wostream << L"text"; break;
} }
return _Wostream; return _Wostream;
} }
...@@ -65,41 +65,24 @@ presentation_class presentation_class::parse(const std::wstring & Str) ...@@ -65,41 +65,24 @@ presentation_class presentation_class::parse(const std::wstring & Str)
std::wstring tmp = Str; std::wstring tmp = Str;
boost::algorithm::to_lower(tmp); boost::algorithm::to_lower(tmp);
if (tmp == L"page") if (tmp == L"page") return presentation_class( page );
return presentation_class( page ); else if (tmp == L"title") return presentation_class( title);
else if (tmp == L"title") else if (tmp == L"outline") return presentation_class( outline );
return presentation_class( title); else if (tmp == L"subtitle") return presentation_class( subtitle);
else if (tmp == L"outline") else if (tmp == L"text") return presentation_class( text);
return presentation_class( outline ); else if (tmp == L"graphic") return presentation_class( graphic );
else if (tmp == L"subtitle") else if (tmp == L"object") return presentation_class( object );
return presentation_class( subtitle); else if (tmp == L"chart") return presentation_class( chart );
else if (tmp == L"text") else if (tmp == L"table") return presentation_class( table );
return presentation_class( text); else if (tmp == L"orgchart") return presentation_class( orgchart );
else if (tmp == L"graphic") else if (tmp == L"notes") return presentation_class( notes );
return presentation_class( graphic ); else if (tmp == L"handout") return presentation_class( handout );
else if (tmp == L"object") else if (tmp == L"header") return presentation_class( header );
return presentation_class( object ); else if (tmp == L"footer") return presentation_class( footer );
else if (tmp == L"chart") else if (tmp == L"date-time") return presentation_class( date_time );
return presentation_class( chart ); else if (tmp == L"page-number") return presentation_class( page_number );
else if (tmp == L"table") else
return presentation_class( table );
else if (tmp == L"orgchart")
return presentation_class( orgchart );
else if (tmp == L"notes")
return presentation_class( notes );
else if (tmp == L"handout")
return presentation_class( handout );
else if (tmp == L"header")
return presentation_class( header );
else if (tmp == L"footer")
return presentation_class( footer );
else if (tmp == L"date-time")
return presentation_class( date_time );
else if (tmp == L"page-number")
return presentation_class( page_number );
else
{ {
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return presentation_class( page ); return presentation_class( page );
} }
} }
......
...@@ -458,7 +458,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co ...@@ -458,7 +458,7 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
{ {
CP_XML_NODE(L"a:spcBef") CP_XML_NODE(L"a:spcBef")
{ {
if (fo_margin_bottom_->get_type() == length_or_percent::Length) if (fo_margin_top_->get_type() == length_or_percent::Length)
{ {
std::wstring w_before = pptx_process_margin(fo_margin_top_, length::pt, 100.0); std::wstring w_before = pptx_process_margin(fo_margin_top_, length::pt, 100.0);
CP_XML_NODE(L"a:spcPts") CP_XML_NODE(L"a:spcPts")
......
...@@ -52,6 +52,7 @@ namespace odf_writer ...@@ -52,6 +52,7 @@ namespace odf_writer
class odf_conversion_context; class odf_conversion_context;
class odf_style_context; class odf_style_context;
class odf_text_context; class odf_text_context;
class style_paragraph_properties;
class odf_drawing_context class odf_drawing_context
{ {
...@@ -124,16 +125,18 @@ public: ...@@ -124,16 +125,18 @@ public:
void start_frame (); void start_frame ();
void end_frame (); void end_frame ();
bool change_text_box_2_wordart();
void start_image (std::wstring file_path); void start_image (std::wstring file_path);
void end_image (); void end_image ();
bool change_text_box_2_wordart ();
bool is_wordart ();
void set_paragraph_properties (style_paragraph_properties *paragraph_properties);
void start_text_box (); void start_text_box ();
void set_text_box_min_size (bool val); void set_text_box_min_size (bool val);
void set_text_box_min_size (double w_pt, double h_pt); void set_text_box_min_size (double w_pt, double h_pt);
void set_text_box_parent_style (std::wstring style_name); void set_text_box_parent_style (std::wstring style_name);
void set_text_box_tableframe (bool val); void set_text_box_tableframe (bool val);
void end_text_box (); void end_text_box ();
void start_object(std::wstring name); void start_object(std::wstring name);
......
...@@ -56,7 +56,26 @@ odp_conversion_context::odp_conversion_context(package::odf_document * outputDoc ...@@ -56,7 +56,26 @@ odp_conversion_context::odp_conversion_context(package::odf_document * outputDoc
: odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this), text_context_(NULL) : odf_conversion_context (PresentationDocument, outputDocument), slide_context_(*this), text_context_(NULL)
{ {
} }
odf_text_context* odp_conversion_context::text_context()
{
return text_context_;
}
odp_slide_context* odp_conversion_context::slide_context()
{
return &slide_context_;
}
odf_drawing_context* odp_conversion_context::drawing_context()
{
if (slide_context_.page_state_list_.empty()) return NULL;
return slide_context_.state().drawing_context();
}
odf_comment_context* odp_conversion_context::comment_context()
{
if (slide_context_.page_state_list_.empty()) return NULL;
return slide_context_.state().comment_context();
}
void odp_conversion_context::start_document() void odp_conversion_context::start_document()
{ {
......
...@@ -64,10 +64,10 @@ public: ...@@ -64,10 +64,10 @@ public:
virtual void start_text_context(); virtual void start_text_context();
virtual void end_text_context(); virtual void end_text_context();
virtual odf_drawing_context * drawing_context() {return current_slide().drawing_context();} virtual odf_drawing_context * drawing_context();
virtual odf_text_context * text_context() {return text_context_; } virtual odf_text_context * text_context();
odp_slide_context * slide_context() {return &slide_context_;} odp_slide_context * slide_context();
odf_comment_context * comment_context() {return current_slide().comment_context();} odf_comment_context * comment_context();
void start_drawings(); void start_drawings();
void end_drawings(); void end_drawings();
......
...@@ -364,6 +364,7 @@ public: ...@@ -364,6 +364,7 @@ public:
void convert (double oox_font_size, _CP_OPT(cpdoccore::odf_types::font_size) & odf_font_size); void convert (double oox_font_size, _CP_OPT(cpdoccore::odf_types::font_size) & odf_font_size);
bool convert (std::wstring sSchemeColor, DWORD & argb); bool convert (std::wstring sSchemeColor, DWORD & argb);
void convert_font(PPTX::Theme *theme, std::wstring & font);
//....................................................................................................................... //.......................................................................................................................
void convert(OOX::WritingElement *oox_unknown); void convert(OOX::WritingElement *oox_unknown);
//drawingML & pptx................................................................................................................................ //drawingML & pptx................................................................................................................................
...@@ -403,9 +404,12 @@ public: ...@@ -403,9 +404,12 @@ public:
void convert(PPTX::Logic::NvGrpSpPr *oox_nvSpPr); void convert(PPTX::Logic::NvGrpSpPr *oox_nvSpPr);
void convert(PPTX::Logic::NvPr *oox_nvPr); void convert(PPTX::Logic::NvPr *oox_nvPr);
void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL); void convert(PPTX::Logic::Paragraph *oox_para, PPTX::Logic::TextListStyle *oox_list_style = NULL);
void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties);
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties * paragraph_properties); void convert(PPTX::Logic::TextListStyle *oox_list_style, int level, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties * text_properties); cpdoccore::odf_writer::style_text_properties *text_properties);
void convert(PPTX::Logic::TextParagraphPr *oox_para_props, cpdoccore::odf_writer::style_paragraph_properties *paragraph_properties,
cpdoccore::odf_writer::style_text_properties *text_properties);
void convert(PPTX::Logic::RunProperties *oox_run_props, cpdoccore::odf_writer::style_text_properties *text_properties);
void convert(PPTX::Logic::Run *oox_run); void convert(PPTX::Logic::Run *oox_run);
void convert(PPTX::Logic::Fld *oox_fld); void convert(PPTX::Logic::Fld *oox_fld);
void convert(PPTX::Logic::Br *oox_br); void convert(PPTX::Logic::Br *oox_br);
......
...@@ -219,21 +219,20 @@ void PptxConverter::convert_styles() ...@@ -219,21 +219,20 @@ void PptxConverter::convert_styles()
odf_writer::style_paragraph_properties * paragraph_properties = odp_context->styles_context()->last_state()->get_paragraph_properties(); 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(); odf_writer::style_text_properties * text_properties = odp_context->styles_context()->last_state()->get_text_properties();
if (text_properties) if (presentation->defaultTextStyle.IsInit())
{ {
text_properties->content_.fo_font_size_ = odf_types::font_size(odf_types::length(18, odf_types::length::pt)); OoxConverter::convert(presentation->defaultTextStyle->levels[9].GetPointer(), paragraph_properties, text_properties); //defPPr
} OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
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) odp_context->styles_context()->create_default_style(odf_types::style_family::Paragraph);
text_properties->content_.style_font_family_asian_ = slide->theme->themeElements.fontScheme.majorFont.ea.typeface; paragraph_properties = odp_context->styles_context()->last_state()->get_paragraph_properties();
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
odp_context->styles_context()->create_default_style(odf_types::style_family::Text);
text_properties = odp_context->styles_context()->last_state()->get_text_properties();
OoxConverter::convert(presentation->defaultTextStyle->levels[0].GetPointer(), paragraph_properties, text_properties); //default text
} }
//convert(presentation->defaultTextStyle.GetPointer()); //стили дефалтовых списков //convert(presentation->defaultTextStyle.GetPointer()); //стили дефалтовых списков
...@@ -302,19 +301,27 @@ void PptxConverter::convert_slides() ...@@ -302,19 +301,27 @@ void PptxConverter::convert_slides()
std::wstring master_style_name; std::wstring master_style_name;
std::wstring layout_style_name; std::wstring layout_style_name;
bool bShow = slide->show.get_value_or(true);
bool bShowMasterAnim = slide->showMasterPhAnim.get_value_or(true);
bool bShowMasterSp = slide->showMasterSp.get_value_or(true);
PPTX::Logic::TxStyles* current_txStyles = NULL; PPTX::Logic::TxStyles* current_txStyles = NULL;
if (slide->Master.IsInit()) if (slide->Master.IsInit())
{ {
current_clrMap = &slide->Master->clrMap; current_clrMap = &slide->Master->clrMap;
current_txStyles = slide->Master->txStyles.GetPointer(); current_txStyles = slide->Master->txStyles.GetPointer();
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename); std::wstring master_name = (bShowMasterSp ? slide->Master->m_sOutputFilename : L"") + slide->Layout->m_sOutputFilename;
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(master_name);
if (pFind == m_mapMasters.end()) if (pFind == m_mapMasters.end())
{ {
master_style_name = L"MasterPage"; master_style_name = L"MasterPage";
if (slide->Master->cSld.attrName.IsInit()) master_style_name = slide->Master->cSld.attrName.get(); if (bShowMasterSp)
else if (current_theme->name.IsInit()) master_style_name = current_theme->name.get(); {
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"_" ; master_style_name += L"_" ;
if (slide->Layout->cSld.attrName.IsInit()) master_style_name += slide->Layout->cSld.attrName.get(); 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 if (slide->Layout->attrType.IsInit()) master_style_name += slide->Layout->attrType->get();
...@@ -323,18 +330,20 @@ void PptxConverter::convert_slides() ...@@ -323,18 +330,20 @@ void PptxConverter::convert_slides()
odp_context->start_master_slide(master_style_name); odp_context->start_master_slide(master_style_name);
convert_common(); convert_common();
//if (slide->Layout->showMasterSp.IsInit() ? *slide->Layout->showMasterSp : true)
{ current_slide = slide->Master.operator->();
current_slide = slide->Master.operator->(); if (bShowMasterSp)
convert_slide(&slide->Master->cSld, current_txStyles, false); convert_slide(&slide->Master->cSld, current_txStyles, false);
} else
convert(slide->Master->cSld.bg.GetPointer());
if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit()) if (slide->Layout->clrMapOvr.IsInit() && slide->Layout->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer(); current_clrMap = slide->Layout->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide->Layout.operator->(); current_slide = slide->Layout.operator->();
convert_slide(&slide->Layout->cSld, current_txStyles, true); convert_slide(&slide->Layout->cSld, current_txStyles, true);
odp_context->end_master_slide(); odp_context->end_master_slide();
m_mapMasters.insert(std::make_pair(slide->Master->m_sOutputFilename + slide->Layout->m_sOutputFilename, master_style_name)); m_mapMasters.insert(std::make_pair(master_name, master_style_name));
} }
else else
{ {
...@@ -369,9 +378,6 @@ void PptxConverter::convert_slides() ...@@ -369,9 +378,6 @@ void PptxConverter::convert_slides()
odp_context->current_slide().set_master_page (master_style_name); odp_context->current_slide().set_master_page (master_style_name);
odp_context->current_slide().set_layout_page (layout_style_name); odp_context->current_slide().set_layout_page (layout_style_name);
//nullable_bool show;
//nullable_bool showMasterPhAnim;
//nullable_bool showMasterSp;
convert_slide (slide->cSld.GetPointer(), current_txStyles, true); convert_slide (slide->cSld.GetPointer(), current_txStyles, true);
convert (slide->comments.operator->()); convert (slide->comments.operator->());
......
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