Commit e0296d5a authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - odp master page

parent e26cf3bf
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
#include "office_elements_create.h" #include "office_elements_create.h"
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore { namespace cpdoccore {
using namespace odf_types; using namespace odf_types;
...@@ -46,18 +44,18 @@ namespace cpdoccore { ...@@ -46,18 +44,18 @@ namespace cpdoccore {
namespace odf_writer { namespace odf_writer {
void draw_page_attr::add_attributes( const xml::attributes_wc_ptr & Attributes ) void draw_page_attr::serialize(CP_ATTR_NODE)
{ {
CP_APPLY_ATTR(L"draw:id", draw_id_); CP_XML_ATTR_OPT(L"draw:id", draw_id_);
CP_APPLY_ATTR(L"draw:name", draw_name_); CP_XML_ATTR_OPT(L"draw:name", draw_name_);
CP_APPLY_ATTR(L"draw:style-name", draw_style_name_); CP_XML_ATTR_OPT(L"draw:style-name", draw_style_name_);
CP_APPLY_ATTR(L"presentation:presentation-page-layout-name", page_layout_name_); CP_XML_ATTR_OPT(L"presentation:presentation-page-layout-name", page_layout_name_);
CP_APPLY_ATTR(L"draw:master-page-name", master_page_name_); CP_XML_ATTR_OPT(L"draw:master-page-name", master_page_name_);
CP_APPLY_ATTR(L"presentation:use-date-time-name", use_date_time_name_); CP_XML_ATTR_OPT(L"presentation:use-date-time-name", use_date_time_name_);
CP_APPLY_ATTR(L"presentation:use-footer-name", use_footer_name_); CP_XML_ATTR_OPT(L"presentation:use-footer-name", use_footer_name_);
} }
...@@ -81,20 +79,20 @@ void draw_page::add_child_element( const office_element_ptr & child_element) ...@@ -81,20 +79,20 @@ void draw_page::add_child_element( const office_element_ptr & child_element)
content_.push_back(child_element); content_.push_back(child_element);
} }
void draw_page::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_page_attr_.add_attributes(Attributes);
}
void draw_page::serialize(std::wostream & _Wostream) void draw_page::serialize(std::wostream & _Wostream)
{ {
CP_XML_WRITER(_Wostream) CP_XML_WRITER(_Wostream)
{ {
CP_XML_NODE_SIMPLE() CP_XML_NODE_SIMPLE()
{ {
draw_page_attr_.serialize(CP_GET_XML_NODE());
for (int i = 0; i < content_.size(); i++) for (int i = 0; i < content_.size(); i++)
{ {
content_[i]->serialize(CP_XML_STREAM()); content_[i]->serialize(CP_XML_STREAM());
} }
if (animation_)
animation_->serialize(CP_XML_STREAM());
} }
} }
} }
...@@ -104,22 +102,22 @@ void draw_page::serialize(std::wostream & _Wostream) ...@@ -104,22 +102,22 @@ void draw_page::serialize(std::wostream & _Wostream)
const wchar_t * presentation_footer_decl::ns = L"presentation"; const wchar_t * presentation_footer_decl::ns = L"presentation";
const wchar_t * presentation_footer_decl::name = L"footer-decl"; const wchar_t * presentation_footer_decl::name = L"footer-decl";
void presentation_footer_decl::add_attributes( const xml::attributes_wc_ptr & Attributes ) //void presentation_footer_decl::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ //{
CP_APPLY_ATTR(L"presentation:name", presentation_name_); // CP_XML_ATTR_OPT(L"presentation:name", presentation_name_);
} //}
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * presentation_date_time_decl::ns = L"presentation"; const wchar_t * presentation_date_time_decl::ns = L"presentation";
const wchar_t * presentation_date_time_decl::name = L"date-time-decl"; const wchar_t * presentation_date_time_decl::name = L"date-time-decl";
//
void presentation_date_time_decl::add_attributes( const xml::attributes_wc_ptr & Attributes ) //void presentation_date_time_decl::add_attributes( const xml::attributes_wc_ptr & Attributes )
{ //{
CP_APPLY_ATTR(L"presentation:name", presentation_name_); // CP_XML_ATTR_OPT(L"presentation:name", presentation_name_);
CP_APPLY_ATTR(L"presentation:source", presentation_source_); // CP_XML_ATTR_OPT(L"presentation:source", presentation_source_);
CP_APPLY_ATTR(L"style:data-style-name", style_data_style_name_); // CP_XML_ATTR_OPT(L"style:data-style-name", style_data_style_name_);
} //}
//
} }
} }
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <cpdoccore/CPOptional.h> #include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h> #include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h> #include <cpdoccore/xml/nodetype.h>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "office_elements.h" #include "office_elements.h"
#include "office_elements_create.h" #include "office_elements_create.h"
...@@ -48,7 +49,7 @@ namespace odf_writer { ...@@ -48,7 +49,7 @@ namespace odf_writer {
class draw_page_attr class draw_page_attr
{ {
public: public:
void add_attributes( const xml::attributes_wc_ptr & Attributes ); void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) draw_name_; _CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_id_; _CP_OPT(std::wstring) draw_id_;
...@@ -75,8 +76,6 @@ public: ...@@ -75,8 +76,6 @@ public:
virtual void serialize(std::wostream & _Wostream); virtual void serialize(std::wostream & _Wostream);
void add_attributes( const xml::attributes_wc_ptr & Attributes );
office_element_ptr_array content_; office_element_ptr_array content_;
office_element_ptr animation_; office_element_ptr animation_;
...@@ -100,8 +99,6 @@ public: ...@@ -100,8 +99,6 @@ public:
virtual void serialize(std::wostream & _Wostream){} virtual void serialize(std::wostream & _Wostream){}
void add_attributes( const xml::attributes_wc_ptr & Attributes );
_CP_OPT(std::wstring) presentation_name_; _CP_OPT(std::wstring) presentation_name_;
std::wstring text_; std::wstring text_;
...@@ -128,8 +125,6 @@ public: ...@@ -128,8 +125,6 @@ public:
virtual void add_child_element( const office_element_ptr & child_element){} virtual void add_child_element( const office_element_ptr & child_element){}
virtual void serialize(std::wostream & _Wostream){} virtual void serialize(std::wostream & _Wostream){}
void add_attributes( const xml::attributes_wc_ptr & Attributes );
}; };
CP_REGISTER_OFFICE_ELEMENT2(presentation_date_time_decl); CP_REGISTER_OFFICE_ELEMENT2(presentation_date_time_decl);
......
...@@ -106,7 +106,7 @@ void odf_page_layout_context::add_master_page(std::wstring page_name) ...@@ -106,7 +106,7 @@ void odf_page_layout_context::add_master_page(std::wstring page_name)
void odf_page_layout_context::process_master_styles(office_element_ptr root ) void odf_page_layout_context::process_master_styles(office_element_ptr root )
{ {
for (size_t i =0 ; i < master_state_list_.size(); i++) for (size_t i = 0; i < master_state_list_.size(); i++)
{ {
try try
{ {
......
...@@ -73,23 +73,34 @@ void odp_conversion_context::end_document() ...@@ -73,23 +73,34 @@ void odp_conversion_context::end_document()
void odp_conversion_context::start_slide() void odp_conversion_context::start_slide()
{ {
create_element(L"draw", L"page", root_presentation_->pages_, this); create_element(L"draw", L"page", root_presentation_->pages_, this);
slide_context_.start_page(root_presentation_->pages_.back()); slide_context_.start_page(root_presentation_->pages_.back());
drawing_context()->set_styles_context(styles_context()); drawing_context()->set_styles_context(styles_context());
page_layout_context()->set_styles_context(styles_context()); //page_layout_context()->set_styles_context(styles_context());
}
std::wstring odp_conversion_context::start_master_slide()
{
std::wstring name;
page_layout_context()->add_master_page(name);
name = page_layout_context()->last_master()->get_name();
slide_context_.start_page(page_layout_context()->last_master()->get_root());
//page_layout_context()->add_master_page(L""); drawing_context()->set_styles_context(page_layout_context()->get_local_styles_context());
//current_table().set_table_master_page(page_layout_context()->last_master() ? return name;
// page_layout_context()->last_master()->get_name() : L"");
} }
void odp_conversion_context::end_slide() void odp_conversion_context::end_master_slide()
{ {
slide_context_.end_page();
}
void odp_conversion_context::end_slide()
{
slide_context_.end_page(); slide_context_.end_page();
//
//styles_context()->reset_defaults();
} }
void odp_conversion_context::start_text_context() void odp_conversion_context::start_text_context()
......
...@@ -52,6 +52,9 @@ public: ...@@ -52,6 +52,9 @@ public:
void start_slide(); void start_slide();
void end_slide(); void end_slide();
std::wstring start_master_slide();
void end_master_slide();
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
odp_page_state & current_slide() { return slide_context_.state();} odp_page_state & current_slide() { return slide_context_.state();}
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
......
...@@ -66,18 +66,23 @@ odp_page_state::odp_page_state(odf_conversion_context * Context, office_element_ ...@@ -66,18 +66,23 @@ odp_page_state::odp_page_state(odf_conversion_context * Context, office_element_
void odp_page_state::set_page_name(std::wstring name) void odp_page_state::set_page_name(std::wstring name)
{ {
if (name.empty()) return;
office_page_name_ = name; office_page_name_ = name;
draw_page* page = dynamic_cast<draw_page*>(draw_page_.get()); draw_page* page = dynamic_cast<draw_page*>(draw_page_.get());
if (page == NULL)return; if (page == NULL)return;
page->draw_page_attr_.draw_name_ = name; page->draw_page_attr_.draw_name_ = name;
} }
void odp_page_state::set_page_master_page(std::wstring name) void odp_page_state::set_master_page(std::wstring name)
{ {
if (!office_page_style_)return; if (name.empty())return;
draw_page* page = dynamic_cast<draw_page*>(draw_page_.get());
if (page == NULL)return;
office_page_style_->style_master_page_name_ = name; page->draw_page_attr_.master_page_name_ = name;
} }
void odp_page_state::set_page_style(office_element_ptr & elm) void odp_page_state::set_page_style(office_element_ptr & elm)
......
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
odp_page_state(odf_conversion_context * Context, office_element_ptr & elm); odp_page_state(odf_conversion_context * Context, office_element_ptr & elm);
void set_page_name(std::wstring name); void set_page_name(std::wstring name);
void set_page_style(office_element_ptr & _style); void set_page_style(office_element_ptr & _style);
void set_page_master_page(std::wstring name); void set_master_page(std::wstring name);
void add_child_element( const office_element_ptr & child_element); void add_child_element( const office_element_ptr & child_element);
......
...@@ -59,7 +59,7 @@ void odp_slide_context::start_page(office_element_ptr & elm) ...@@ -59,7 +59,7 @@ void odp_slide_context::start_page(office_element_ptr & elm)
{ {
page_state_list_.push_back( odp_page_state(&context_, elm) ); page_state_list_.push_back( odp_page_state(&context_, elm) );
std::wstring style_name_new = L"ta" + boost::lexical_cast<std::wstring>(page_state_list_.size()); std::wstring style_name_new = L"dp" + boost::lexical_cast<std::wstring>(page_state_list_.size());
office_element_ptr & style = context_.styles_context()->add_or_find(style_name_new, style_family::DrawingPage, true); office_element_ptr & style = context_.styles_context()->add_or_find(style_name_new, style_family::DrawingPage, true);
style->create_child_element(L"style", L"drawing-page-properties"); style->create_child_element(L"style", L"drawing-page-properties");
......
...@@ -434,12 +434,12 @@ void OoxConverter::convert(PPTX::Logic::PathBase *oox_path) ...@@ -434,12 +434,12 @@ void OoxConverter::convert(PPTX::Logic::PathBase *oox_path)
{ {
if (!oox_path) return; if (!oox_path) return;
PPTX::Logic::MoveTo* moveTo = static_cast<PPTX::Logic::MoveTo*> (oox_path); PPTX::Logic::MoveTo* moveTo = dynamic_cast<PPTX::Logic::MoveTo*> (oox_path);
PPTX::Logic::LineTo* lineTo = static_cast<PPTX::Logic::LineTo*> (oox_path); PPTX::Logic::LineTo* lineTo = dynamic_cast<PPTX::Logic::LineTo*> (oox_path);
PPTX::Logic::CubicBezTo* cubicBezTo = static_cast<PPTX::Logic::CubicBezTo*> (oox_path); PPTX::Logic::CubicBezTo* cubicBezTo = dynamic_cast<PPTX::Logic::CubicBezTo*> (oox_path);
PPTX::Logic::Close* close = static_cast<PPTX::Logic::Close*> (oox_path); PPTX::Logic::Close* close = dynamic_cast<PPTX::Logic::Close*> (oox_path);
PPTX::Logic::ArcTo* arcTo = static_cast<PPTX::Logic::ArcTo*> (oox_path); PPTX::Logic::ArcTo* arcTo = dynamic_cast<PPTX::Logic::ArcTo*> (oox_path);
PPTX::Logic::QuadBezTo* quadBezTo = static_cast<PPTX::Logic::QuadBezTo*> (oox_path); PPTX::Logic::QuadBezTo* quadBezTo = dynamic_cast<PPTX::Logic::QuadBezTo*> (oox_path);
if (moveTo) if (moveTo)
{ {
...@@ -634,41 +634,17 @@ void OoxConverter::convert(PPTX::Logic::UniColor * color, std::wstring & hexStri ...@@ -634,41 +634,17 @@ void OoxConverter::convert(PPTX::Logic::UniColor * color, std::wstring & hexStri
DWORD argb = 0; DWORD argb = 0;
smart_ptr<PPTX::Logic::ClrMap> clrMap; smart_ptr<PPTX::Logic::ClrMap> clrMap(oox_clrMap()); clrMap.AddRef();
smart_ptr<PPTX::Theme> theme(oox_theme()); theme.AddRef(); smart_ptr<PPTX::Theme> theme(oox_theme()); theme.AddRef();
argb = color->GetRGBColor(theme, clrMap); argb = color->GetRGBColor(theme, clrMap);
//switch(color->getType ())
//{
// case OOX::et_a_schemeClr:
// {
// NSCommon::smart_ptr<PPTX::Logic::SchemeClr> schemeColor = color->Color.smart_dynamic_cast<PPTX::Logic::SchemeClr>();
// if (schemeColor.IsInit())
// {
// convert(schemeColor->val.get(), argb);
// }
// }break;
// case OOX::et_a_prstClr:
// case OOX::et_a_scrgbClr:
// case OOX::et_a_srgbClr:
// case OOX::et_a_sysClr:
// default:
// {
// argb = color->GetARGB();
// result = true;
// }break;
//}
//if (result)
{
hexString = XmlUtils::IntToString(argb & 0x00FFFFFF, L"#%06X"); hexString = XmlUtils::IntToString(argb & 0x00FFFFFF, L"#%06X");
if ((argb >> 24) != 0xff) if ((argb >> 24) != 0xff)
{ {
opacity = ((argb >> 24) /255.) * 100.; opacity = ((argb >> 24) /255.) * 100.;
} }
}
} }
void OoxConverter::convert(PPTX::Logic::SolidFill *oox_fill) void OoxConverter::convert(PPTX::Logic::SolidFill *oox_fill)
......
...@@ -324,7 +324,7 @@ void OoxConverter::convert(OOX::Vml::CShape *vml_shape) ...@@ -324,7 +324,7 @@ void OoxConverter::convert(OOX::Vml::CShape *vml_shape)
odf_context()->drawing_context()->set_path(vml_shape->m_oPath->GetValue()); odf_context()->drawing_context()->set_path(vml_shape->m_oPath->GetValue());
} }
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_shape); OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_shape);
convert(vml_common); convert(vml_common);
} }
...@@ -381,14 +381,14 @@ void OoxConverter::convert(OOX::Vml::CArc *vml_arc) ...@@ -381,14 +381,14 @@ void OoxConverter::convert(OOX::Vml::CArc *vml_arc)
{ {
if (vml_arc == NULL) return; if (vml_arc == NULL) return;
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_arc); OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_arc);
convert(vml_common); convert(vml_common);
} }
void OoxConverter::convert(OOX::Vml::CBackground *vml_background) void OoxConverter::convert(OOX::Vml::CBackground *vml_background)
{ {
if (vml_background == NULL) return; if (vml_background == NULL) return;
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_background); OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_background);
convert(vml_common); convert(vml_common);
} }
...@@ -520,7 +520,7 @@ void OoxConverter::convert(OOX::Vml::CLine *vml_line) ...@@ -520,7 +520,7 @@ void OoxConverter::convert(OOX::Vml::CLine *vml_line)
{ {
if (vml_line == NULL) return; if (vml_line == NULL) return;
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_line); OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_line);
convert(vml_common); convert(vml_common);
_CP_OPT(double) x = vml_line->m_oFrom.GetX(); _CP_OPT(double) x = vml_line->m_oFrom.GetX();
...@@ -538,7 +538,7 @@ void OoxConverter::convert(OOX::Vml::COval *vml_oval) ...@@ -538,7 +538,7 @@ void OoxConverter::convert(OOX::Vml::COval *vml_oval)
{ {
if (vml_oval == NULL) return; if (vml_oval == NULL) return;
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_oval); OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_oval);
convert(vml_common); convert(vml_common);
} }
void OoxConverter::convert(OOX::Vml::CPath *vml_path) void OoxConverter::convert(OOX::Vml::CPath *vml_path)
...@@ -564,14 +564,14 @@ void OoxConverter::convert(OOX::Vml::CPolyLine *vml_polyline) ...@@ -564,14 +564,14 @@ void OoxConverter::convert(OOX::Vml::CPolyLine *vml_polyline)
{ {
if (vml_polyline == NULL) return; if (vml_polyline == NULL) return;
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_polyline); OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_polyline);
convert(vml_common); convert(vml_common);
} }
void OoxConverter::convert(OOX::Vml::CRect *vml_rect) void OoxConverter::convert(OOX::Vml::CRect *vml_rect)
{ {
if (vml_rect == NULL) return; if (vml_rect == NULL) return;
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_rect); OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_rect);
convert(vml_common); convert(vml_common);
} }
...@@ -579,7 +579,7 @@ void OoxConverter::convert(OOX::Vml::CRoundRect *vml_roundrect) ...@@ -579,7 +579,7 @@ void OoxConverter::convert(OOX::Vml::CRoundRect *vml_roundrect)
{ {
if (vml_roundrect == NULL) return; if (vml_roundrect == NULL) return;
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_roundrect); OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_roundrect);
convert(vml_common); convert(vml_common);
} }
...@@ -587,7 +587,7 @@ void OoxConverter::convert(OOX::Vml::CCurve *vml_curve) ...@@ -587,7 +587,7 @@ void OoxConverter::convert(OOX::Vml::CCurve *vml_curve)
{ {
if (vml_curve == NULL) return; if (vml_curve == NULL) return;
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_curve); OOX::Vml::CVmlCommonElements *vml_common = dynamic_cast<OOX::Vml::CVmlCommonElements *>(vml_curve);
convert(vml_common); convert(vml_common);
} }
void OoxConverter::convert(OOX::Vml::CShadow *vml_shadow) void OoxConverter::convert(OOX::Vml::CShadow *vml_shadow)
...@@ -905,7 +905,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group) ...@@ -905,7 +905,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
if (vml_group->m_arrItems[i]->getType() == OOX::et_v_group) if (vml_group->m_arrItems[i]->getType() == OOX::et_v_group)
{ {
OOX::Vml::CGroup * vml = static_cast<OOX::Vml::CGroup*>(vml_group->m_arrItems[i]); OOX::Vml::CGroup * vml = dynamic_cast<OOX::Vml::CGroup*>(vml_group->m_arrItems[i]);
convert(vml); convert(vml);
continue; continue;
} }
...@@ -919,7 +919,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group) ...@@ -919,7 +919,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
{ {
case OOX::et_v_shape: case OOX::et_v_shape:
{ {
OOX::Vml::CShape * vml = static_cast<OOX::Vml::CShape*>(vml_group->m_arrItems[i]); OOX::Vml::CShape * vml = dynamic_cast<OOX::Vml::CShape*>(vml_group->m_arrItems[i]);
bool bSet = false; bool bSet = false;
if (vml) if (vml)
{ {
...@@ -952,7 +952,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group) ...@@ -952,7 +952,7 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
}break; }break;
case OOX::et_v_shapetype: case OOX::et_v_shapetype:
{ {
OOX::Vml::CShapeType * vml = static_cast<OOX::Vml::CShapeType*>(vml_group->m_arrItems[i]); OOX::Vml::CShapeType * vml = dynamic_cast<OOX::Vml::CShapeType*>(vml_group->m_arrItems[i]);
SimpleTypes::Vml::SptType sptType = vml->m_oSpt.IsInit() ? static_cast<SimpleTypes::Vml::SptType>(vml->m_oSpt->GetValue()) : SimpleTypes::Vml::sptNotPrimitive; SimpleTypes::Vml::SptType sptType = vml->m_oSpt.IsInit() ? static_cast<SimpleTypes::Vml::SptType>(vml->m_oSpt->GetValue()) : SimpleTypes::Vml::sptNotPrimitive;
odf_context()->drawing_context()->start_shape(OOX::VmlShapeType2PrstShape(sptType)); odf_context()->drawing_context()->start_shape(OOX::VmlShapeType2PrstShape(sptType));
...@@ -961,28 +961,28 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group) ...@@ -961,28 +961,28 @@ void OoxConverter::convert(OOX::Vml::CGroup *vml_group)
}break; }break;
case OOX::et_v_oval: case OOX::et_v_oval:
{ {
OOX::Vml::COval * vml = static_cast<OOX::Vml::COval*>(vml_group->m_arrItems[i]); OOX::Vml::COval * vml = dynamic_cast<OOX::Vml::COval*>(vml_group->m_arrItems[i]);
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeEllipse); odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeEllipse);
OoxConverter::convert(vml); OoxConverter::convert(vml);
odf_context()->drawing_context()->end_shape(); odf_context()->drawing_context()->end_shape();
}break; }break;
case OOX::et_v_rect: case OOX::et_v_rect:
{ {
OOX::Vml::CRect * vml = static_cast<OOX::Vml::CRect*>(vml_group->m_arrItems[i]); OOX::Vml::CRect * vml = dynamic_cast<OOX::Vml::CRect*>(vml_group->m_arrItems[i]);
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect); odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeRect);
OoxConverter::convert(vml); OoxConverter::convert(vml);
odf_context()->drawing_context()->end_shape(); odf_context()->drawing_context()->end_shape();
}break; }break;
case OOX::et_v_line: case OOX::et_v_line:
{ {
OOX::Vml::CLine * vml = static_cast<OOX::Vml::CLine*>(vml_group->m_arrItems[i]); OOX::Vml::CLine * vml = dynamic_cast<OOX::Vml::CLine*>(vml_group->m_arrItems[i]);
odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeLine); odf_context()->drawing_context()->start_shape(SimpleTypes::shapetypeLine);
OoxConverter::convert(vml); OoxConverter::convert(vml);
odf_context()->drawing_context()->end_shape(); odf_context()->drawing_context()->end_shape();
}break; }break;
case OOX::et_v_curve: case OOX::et_v_curve:
{ {
OOX::Vml::CCurve * vml = static_cast<OOX::Vml::CCurve*>(vml_group->m_arrItems[i]); OOX::Vml::CCurve * vml = dynamic_cast<OOX::Vml::CCurve*>(vml_group->m_arrItems[i]);
odf_context()->drawing_context()->start_shape(1000); odf_context()->drawing_context()->start_shape(1000);
OoxConverter::convert(vml); OoxConverter::convert(vml);
odf_context()->drawing_context()->end_shape(); odf_context()->drawing_context()->end_shape();
......
...@@ -263,6 +263,7 @@ namespace PPTX ...@@ -263,6 +263,7 @@ namespace PPTX
class Theme; class Theme;
namespace Logic namespace Logic
{ {
class ClrMap;
class SpTreeElem; class SpTreeElem;
class GraphicFrame; class GraphicFrame;
class SpTree; class SpTree;
...@@ -342,6 +343,8 @@ public: ...@@ -342,6 +343,8 @@ public:
//....................................................................................................................... //.......................................................................................................................
virtual cpdoccore::odf_writer::odf_conversion_context *odf_context() = 0; virtual cpdoccore::odf_writer::odf_conversion_context *odf_context() = 0;
virtual PPTX::Theme *oox_theme() = 0; virtual PPTX::Theme *oox_theme() = 0;
virtual PPTX::Logic::ClrMap *oox_clrMap() {return NULL;}
virtual std::wstring find_link_by_id(std::wstring sId, int t) = 0; virtual std::wstring find_link_by_id(std::wstring sId, int t) = 0;
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id(std::wstring sId) = 0; virtual NSCommon::smart_ptr<OOX::File> find_file_by_id(std::wstring sId) = 0;
......
...@@ -80,14 +80,17 @@ PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback* ...@@ -80,14 +80,17 @@ PptxConverter::PptxConverter(const std::wstring & path, const ProgressCallback*
output_document = new odf_writer::package::odf_document(L"presentation"); output_document = new odf_writer::package::odf_document(L"presentation");
odp_context = new odf_writer::odp_conversion_context(output_document); odp_context = new odf_writer::odp_conversion_context(output_document);
current_clrMap = NULL;
current_slide = NULL; current_slide = NULL;
current_theme = NULL; current_theme = NULL;
pCallBack = CallBack; pCallBack = CallBack;
if (UpdateProgress(290000))return; if (UpdateProgress(290000))return;
} }
PptxConverter::~PptxConverter() PptxConverter::~PptxConverter()
{ {
current_clrMap = NULL;
current_slide = NULL; current_slide = NULL;
current_theme = NULL; current_theme = NULL;
presentation = NULL; presentation = NULL;
...@@ -112,6 +115,10 @@ PPTX::Theme* PptxConverter::oox_theme() ...@@ -112,6 +115,10 @@ PPTX::Theme* PptxConverter::oox_theme()
{ {
return current_theme; return current_theme;
} }
PPTX::Logic::ClrMap* PptxConverter::oox_clrMap()
{
return current_clrMap;
}
NSCommon::smart_ptr<OOX::File> PptxConverter::find_file_by_id(std::wstring sId) NSCommon::smart_ptr<OOX::File> PptxConverter::find_file_by_id(std::wstring sId)
{ {
...@@ -205,20 +212,44 @@ void PptxConverter::convert_slides() ...@@ -205,20 +212,44 @@ void PptxConverter::convert_slides()
{ {
continue;// странное ... слайд 38 в FY10_September_Partner_Call.pptx continue;// странное ... слайд 38 в FY10_September_Partner_Call.pptx
} }
current_slide = slide.operator->();
current_theme = slide->theme.operator->(); current_theme = slide->theme.operator->();
//smart_ptr<SlideLayout> Layout; std::wstring master_style_name;
//smart_ptr<SlideMaster> Master; std::wstring layout_style_name;
if (slide->Master.IsInit())
{
current_clrMap = &slide->Master->clrMap;
std::map<std::wstring, std::wstring>::iterator pFind = m_mapMasters.find(slide->Master->m_sOutputFilename);
if (pFind == m_mapMasters.end())
{
current_slide = slide->Master.operator->();
master_style_name = odp_context->start_master_slide();
convert(&slide->Master->cSld);
odp_context->end_master_slide();
m_mapMasters.insert(std::make_pair(slide->Master->m_sOutputFilename, master_style_name));
}
else
master_style_name = pFind->second;
}
if (slide->clrMapOvr.IsInit())
current_clrMap = slide->clrMapOvr->overrideClrMapping.GetPointer();
current_slide = slide.operator->();
odp_context->start_slide(); odp_context->start_slide();
convert(slide->cSld.GetPointer());
odp_context->current_slide().set_master_page(master_style_name);
//odp_context->current_slide().set_layout_style(layout_style_name);
//nullable_bool show; //nullable_bool show;
//nullable_bool showMasterPhAnim; //nullable_bool showMasterPhAnim;
//nullable_bool showMasterSp; //nullable_bool showMasterSp;
//nullable<Logic::ClrMapOvr> clrMapOvr; convert(slide->cSld.GetPointer());
//nullable<Logic::CSld> cSld;
//nullable<Logic::Transition> transition; //nullable<Logic::Transition> transition;
//nullable<Logic::Timing> timing; //nullable<Logic::Timing> timing;
......
...@@ -87,6 +87,8 @@ namespace Oox2Odf ...@@ -87,6 +87,8 @@ namespace Oox2Odf
virtual odf_writer::odf_conversion_context *odf_context(); virtual odf_writer::odf_conversion_context *odf_context();
virtual PPTX::Theme *oox_theme(); virtual PPTX::Theme *oox_theme();
virtual PPTX::Logic::ClrMap *oox_clrMap();
virtual std::wstring find_link_by_id (std::wstring sId, int t); virtual std::wstring find_link_by_id (std::wstring sId, int t);
virtual NSCommon::smart_ptr<OOX::File> find_file_by_id (std::wstring sId); virtual NSCommon::smart_ptr<OOX::File> find_file_by_id (std::wstring sId);
...@@ -99,10 +101,15 @@ namespace Oox2Odf ...@@ -99,10 +101,15 @@ namespace Oox2Odf
cpdoccore::odf_writer::package::odf_document *output_document; cpdoccore::odf_writer::package::odf_document *output_document;
PPTX::Theme *current_theme; PPTX::Theme *current_theme;
OOX::IFileContainer *current_slide; OOX::IFileContainer *current_slide;
PPTX::Logic::ClrMap *current_clrMap;
odf_writer::odp_conversion_context *odp_context; odf_writer::odp_conversion_context *odp_context;
std::map<std::wstring, std::wstring> m_mapMasters;
std::vector<std::wstring> m_arLayouts;
void convert_slides (); void convert_slides ();
......
...@@ -527,7 +527,7 @@ void XlsxConverter::convert_sharing_string(int number) ...@@ -527,7 +527,7 @@ void XlsxConverter::convert_sharing_string(int number)
if (number <0 || (SharedStrings->m_oCount.IsInit() && number > SharedStrings->m_oCount->GetValue()))return;//???? m_oUniqueCount; if (number <0 || (SharedStrings->m_oCount.IsInit() && number > SharedStrings->m_oCount->GetValue()))return;//???? m_oUniqueCount;
convert(static_cast<OOX::Spreadsheet::CSi*>(SharedStrings->m_arrItems[number])); convert(dynamic_cast<OOX::Spreadsheet::CSi*>(SharedStrings->m_arrItems[number]));
} }
void XlsxConverter::convert(OOX::Spreadsheet::CSi* oox_rtf_text) void XlsxConverter::convert(OOX::Spreadsheet::CSi* oox_rtf_text)
...@@ -552,27 +552,27 @@ void XlsxConverter::convert(OOX::Spreadsheet::WritingElement *oox_unknown) ...@@ -552,27 +552,27 @@ void XlsxConverter::convert(OOX::Spreadsheet::WritingElement *oox_unknown)
{ {
case OOX::et_x_r: case OOX::et_x_r:
{ {
OOX::Spreadsheet::CRun* pRun = static_cast<OOX::Spreadsheet::CRun*>(oox_unknown); OOX::Spreadsheet::CRun* pRun = dynamic_cast<OOX::Spreadsheet::CRun*>(oox_unknown);
convert(pRun); convert(pRun);
}break; }break;
case OOX::et_x_t: case OOX::et_x_t:
{ {
OOX::Spreadsheet::CText* pText = static_cast<OOX::Spreadsheet::CText*>(oox_unknown); OOX::Spreadsheet::CText* pText = dynamic_cast<OOX::Spreadsheet::CText*>(oox_unknown);
convert(pText); convert(pText);
}break; }break;
case OOX::et_x_IconSet: case OOX::et_x_IconSet:
{ {
OOX::Spreadsheet::CIconSet *pIc = static_cast<OOX::Spreadsheet::CIconSet*>(oox_unknown); OOX::Spreadsheet::CIconSet *pIc = dynamic_cast<OOX::Spreadsheet::CIconSet*>(oox_unknown);
convert(pIc); convert(pIc);
}break; }break;
case OOX::et_x_DataBar: case OOX::et_x_DataBar:
{ {
OOX::Spreadsheet::CDataBar *pB = static_cast<OOX::Spreadsheet::CDataBar*>(oox_unknown); OOX::Spreadsheet::CDataBar *pB = dynamic_cast<OOX::Spreadsheet::CDataBar*>(oox_unknown);
convert(pB); convert(pB);
}break; }break;
case OOX::et_x_FormulaCF: case OOX::et_x_FormulaCF:
{ {
OOX::Spreadsheet::CFormulaCF *pF = static_cast<OOX::Spreadsheet::CFormulaCF*>(oox_unknown); OOX::Spreadsheet::CFormulaCF *pF = dynamic_cast<OOX::Spreadsheet::CFormulaCF*>(oox_unknown);
convert(pF); convert(pF);
}break; }break;
default: default:
...@@ -1774,22 +1774,22 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_po ...@@ -1774,22 +1774,22 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_po
// { // {
// case OOX::et_x_Shape: // case OOX::et_x_Shape:
// { // {
// OOX::Spreadsheet::CShape* item = static_cast<OOX::Spreadsheet::CShape*>(oox_group_shape->m_arrItems[i]); // OOX::Spreadsheet::CShape* item = dynamic_cast<OOX::Spreadsheet::CShape*>(oox_group_shape->m_arrItems[i]);
// convert(item); // convert(item);
// }break; // }break;
// case OOX::et_x_ConnShape: // case OOX::et_x_ConnShape:
// { // {
// OOX::Spreadsheet::CConnShape* item = static_cast<OOX::Spreadsheet::CConnShape*>(oox_group_shape->m_arrItems[i]); // OOX::Spreadsheet::CConnShape* item = dynamic_cast<OOX::Spreadsheet::CConnShape*>(oox_group_shape->m_arrItems[i]);
// convert(item); // convert(item);
// }break; // }break;
// case OOX::et_x_GroupShape: // case OOX::et_x_GroupShape:
// { // {
// OOX::Spreadsheet::CGroupShape* item = static_cast<OOX::Spreadsheet::CGroupShape*>(oox_group_shape->m_arrItems[i]); // OOX::Spreadsheet::CGroupShape* item = dynamic_cast<OOX::Spreadsheet::CGroupShape*>(oox_group_shape->m_arrItems[i]);
// convert(item); // convert(item);
// }break; // }break;
// case OOX::et_x_Pic: // case OOX::et_x_Pic:
// { // {
// OOX::Spreadsheet::CPic* item = static_cast<OOX::Spreadsheet::CPic*>(oox_group_shape->m_arrItems[i]); // OOX::Spreadsheet::CPic* item = dynamic_cast<OOX::Spreadsheet::CPic*>(oox_group_shape->m_arrItems[i]);
// convert(item); // convert(item);
// }break; // }break;
// } // }
...@@ -2045,7 +2045,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale) ...@@ -2045,7 +2045,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CColorScale *oox_cond_colorscale)
else else
{ {
_CP_OPT(odf_types::color) color; _CP_OPT(odf_types::color) color;
convert(static_cast<OOX::Spreadsheet::CColor*>(oox_cond_colorscale->m_arrItems[i]),color); convert(dynamic_cast<OOX::Spreadsheet::CColor*>(oox_cond_colorscale->m_arrItems[i]),color);
ods_context->current_table().add_conditional_colorscale(color); ods_context->current_table().add_conditional_colorscale(color);
} }
} }
......
...@@ -77,7 +77,7 @@ namespace PPTX ...@@ -77,7 +77,7 @@ namespace PPTX
public: public:
virtual void read(const OOX::CPath& filename, FileMap& map) virtual void read(const OOX::CPath& filename, FileMap& map)
{ {
//FileContainer::read(filename, map); m_sOutputFilename = filename.GetFilename();
XmlUtils::CXmlNode oNode; XmlUtils::CXmlNode oNode;
oNode.FromXmlFile(filename.m_strFilename); oNode.FromXmlFile(filename.m_strFilename);
......
...@@ -76,7 +76,8 @@ namespace PPTX ...@@ -76,7 +76,8 @@ namespace PPTX
public: public:
virtual void read(const OOX::CPath& filename, FileMap& map) virtual void read(const OOX::CPath& filename, FileMap& map)
{ {
//FileContainer::read(filename, map); m_sOutputFilename = filename.GetFilename();
XmlUtils::CXmlNode oNode; XmlUtils::CXmlNode oNode;
oNode.FromXmlFile(filename.m_strFilename); oNode.FromXmlFile(filename.m_strFilename);
......
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