Commit 4201bcec authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - presentation notes masters

parent 7b7bfbc5
...@@ -126,13 +126,15 @@ std::wstring presentation_class::get_type_ms() ...@@ -126,13 +126,15 @@ std::wstring presentation_class::get_type_ms()
res = L"sldNum"; res = L"sldNum";
break; break;
case subtitle: case subtitle:
case page:
case notes: case notes:
case handout: case handout:
case outline: case outline:
case text: case text:
res = L"body"; res = L"body";
break; break;
case page:
res = L"sldImg";
break;
} }
return res; return res;
} }
......
...@@ -46,17 +46,17 @@ namespace odf_writer { ...@@ -46,17 +46,17 @@ namespace odf_writer {
void draw_page_attr::serialize(CP_ATTR_NODE) void draw_page_attr::serialize(CP_ATTR_NODE)
{ {
CP_XML_ATTR_OPT(L"draw:id", draw_id_); CP_XML_ATTR_OPT(L"draw:id", draw_id_);
CP_XML_ATTR_OPT(L"draw:name", draw_name_); CP_XML_ATTR_OPT(L"draw:name", draw_name_);
CP_XML_ATTR_OPT(L"draw:style-name", draw_style_name_); CP_XML_ATTR_OPT(L"draw:style-name", draw_style_name_);
CP_XML_ATTR_OPT(L"draw:master-page-name", draw_master_page_name_);
CP_XML_ATTR_OPT(L"presentation:presentation-page-layout-name", page_layout_name_); CP_XML_ATTR_OPT(L"style:page-layout-name", style_page_layout_name_);
CP_XML_ATTR_OPT(L"draw:master-page-name", master_page_name_);
CP_XML_ATTR_OPT(L"presentation:presentation-page-layout-name", presentation_page_layout_name_);
CP_XML_ATTR_OPT(L"presentation:use-date-time-name", use_date_time_name_); CP_XML_ATTR_OPT(L"presentation:use-date-time-name", presentation_use_date_time_name_);
CP_XML_ATTR_OPT(L"presentation:use-footer-name", use_footer_name_); CP_XML_ATTR_OPT(L"presentation:use-footer-name", presentation_use_footer_name_);
} }
////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -54,12 +54,13 @@ public: ...@@ -54,12 +54,13 @@ public:
_CP_OPT(std::wstring) draw_name_; _CP_OPT(std::wstring) draw_name_;
_CP_OPT(std::wstring) draw_id_; _CP_OPT(std::wstring) draw_id_;
_CP_OPT(std::wstring) draw_style_name_; _CP_OPT(std::wstring) draw_style_name_;
_CP_OPT(std::wstring) draw_master_page_name_;
_CP_OPT(std::wstring) page_layout_name_; _CP_OPT(std::wstring) style_page_layout_name_;
_CP_OPT(std::wstring) master_page_name_;
_CP_OPT(std::wstring) use_footer_name_; _CP_OPT(std::wstring) presentation_use_footer_name_;
_CP_OPT(std::wstring) use_date_time_name_; _CP_OPT(std::wstring) presentation_use_date_time_name_;
_CP_OPT(std::wstring) presentation_page_layout_name_;
}; };
class draw_page : public office_element_impl<draw_page> class draw_page : public office_element_impl<draw_page>
......
...@@ -264,7 +264,7 @@ public: ...@@ -264,7 +264,7 @@ public:
bool is_footer_; bool is_footer_;
bool is_header_; bool is_header_;
bool is_background_; bool is_background_;
_CP_OPT(bool) is_presentation_; _CP_OPT(int) is_presentation_;
void create_draw_base(int type); void create_draw_base(int type);
office_element_ptr create_draw_element(int type); office_element_ptr create_draw_element(int type);
...@@ -312,12 +312,12 @@ void odf_drawing_context::set_styles_context(odf_style_context* styles_context) ...@@ -312,12 +312,12 @@ void odf_drawing_context::set_styles_context(odf_style_context* styles_context)
impl_->styles_context_ = styles_context; impl_->styles_context_ = styles_context;
} }
void odf_drawing_context::set_presentation (bool bMaster) void odf_drawing_context::set_presentation (int type)
{ {
impl_->is_presentation_ = bMaster; impl_->is_presentation_ = type;
} }
_CP_OPT(bool) odf_drawing_context::get_presentation () _CP_OPT(int) odf_drawing_context::get_presentation ()
{ {
return impl_->is_presentation_; return impl_->is_presentation_;
} }
...@@ -500,8 +500,8 @@ void odf_drawing_context::end_drawing() ...@@ -500,8 +500,8 @@ void odf_drawing_context::end_drawing()
if (impl_->current_drawing_state_.presentation_class_ || impl_->current_drawing_state_.presentation_placeholder_) if (impl_->current_drawing_state_.presentation_class_ || impl_->current_drawing_state_.presentation_placeholder_)
{ {
_CP_OPT(std::wstring) draw_layer; _CP_OPT(std::wstring) draw_layer;
if (impl_->is_presentation_.get() == true) if (impl_->is_presentation_.get() > 0)
{//master {//masters
draw_layer = L"backgroundobjects"; draw_layer = L"backgroundobjects";
if (!impl_->current_drawing_state_.presentation_class_) if (!impl_->current_drawing_state_.presentation_class_)
...@@ -1207,7 +1207,15 @@ void odf_drawing_context::set_placeholder_type (int val) ...@@ -1207,7 +1207,15 @@ void odf_drawing_context::set_placeholder_type (int val)
switch(val) switch(val)
{ {
case 0: impl_->current_drawing_state_.presentation_class_ = presentation_class::outline; break; case 0:
{
if (impl_->is_presentation_ == 2) //notes master
impl_->current_drawing_state_.presentation_class_ = presentation_class::notes;
else if (impl_->is_presentation_ == 3) //handout master
impl_->current_drawing_state_.presentation_class_ = presentation_class::handout;
else
impl_->current_drawing_state_.presentation_class_ = presentation_class::outline;
}break;
case 1: impl_->current_drawing_state_.presentation_class_ = presentation_class::chart; break; case 1: impl_->current_drawing_state_.presentation_class_ = presentation_class::chart; break;
case 2: impl_->current_drawing_state_.presentation_class_ = presentation_class::graphic; break; case 2: impl_->current_drawing_state_.presentation_class_ = presentation_class::graphic; break;
case 3: impl_->current_drawing_state_.presentation_class_ = presentation_class::title; break; case 3: impl_->current_drawing_state_.presentation_class_ = presentation_class::title; break;
...@@ -1218,7 +1226,7 @@ void odf_drawing_context::set_placeholder_type (int val) ...@@ -1218,7 +1226,7 @@ void odf_drawing_context::set_placeholder_type (int val)
case 8: impl_->current_drawing_state_.presentation_class_ = presentation_class::object; break; case 8: impl_->current_drawing_state_.presentation_class_ = presentation_class::object; break;
case 9: impl_->current_drawing_state_.presentation_class_ = presentation_class::object; break; case 9: impl_->current_drawing_state_.presentation_class_ = presentation_class::object; break;
case 10: impl_->current_drawing_state_.presentation_class_ = presentation_class::graphic; break; case 10: impl_->current_drawing_state_.presentation_class_ = presentation_class::graphic; break;
case 11: impl_->current_drawing_state_.presentation_class_ = presentation_class::graphic; break; case 11: impl_->current_drawing_state_.presentation_class_ = presentation_class::page; break;
case 12: impl_->current_drawing_state_.presentation_class_ = presentation_class::page_number;break; case 12: impl_->current_drawing_state_.presentation_class_ = presentation_class::page_number;break;
case 13: impl_->current_drawing_state_.presentation_class_ = presentation_class::subtitle; break; case 13: impl_->current_drawing_state_.presentation_class_ = presentation_class::subtitle; break;
case 14: impl_->current_drawing_state_.presentation_class_ = presentation_class::table; break; case 14: impl_->current_drawing_state_.presentation_class_ = presentation_class::table; break;
......
...@@ -60,8 +60,8 @@ public: ...@@ -60,8 +60,8 @@ public:
odf_drawing_context (odf_conversion_context *odf_context); odf_drawing_context (odf_conversion_context *odf_context);
~odf_drawing_context (); ~odf_drawing_context ();
void set_presentation (bool bMaster); void set_presentation (int type);
_CP_OPT(bool) get_presentation (); _CP_OPT(int) get_presentation ();
void set_drawings_rect (_CP_OPT(double) x_pt, _CP_OPT(double) y_pt, _CP_OPT(double) width_pt, _CP_OPT(double) height_pt); void set_drawings_rect (_CP_OPT(double) x_pt, _CP_OPT(double) y_pt, _CP_OPT(double) width_pt, _CP_OPT(double) height_pt);
void clear (); void clear ();
......
...@@ -584,7 +584,8 @@ void odf_page_layout_context::set_pages_mirrored(bool val) ...@@ -584,7 +584,8 @@ void odf_page_layout_context::set_pages_mirrored(bool val)
style_page_layout_properties * odf_page_layout_context::get_properties() style_page_layout_properties * odf_page_layout_context::get_properties()
{ {
if (layout_state_list_.size() < 1) return NULL; if (layout_state_list_.empty()) return NULL;
style_page_layout_properties * props = layout_state_list_.back().get_properties(); style_page_layout_properties * props = layout_state_list_.back().get_properties();
if (props == NULL) if (props == NULL)
{ {
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "odp_conversion_context.h" #include "odp_conversion_context.h"
#include "office_presentation.h" #include "office_presentation.h"
#include "draw_page.h"
#include "styles.h" #include "styles.h"
#include "style_table_properties.h" #include "style_table_properties.h"
...@@ -95,7 +96,7 @@ void odp_conversion_context::start_slide() ...@@ -95,7 +96,7 @@ 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_presentation(false); drawing_context()->set_presentation(0);
} }
void odp_conversion_context::end_slide() void odp_conversion_context::end_slide()
{ {
...@@ -108,7 +109,7 @@ void odp_conversion_context::start_master_slide(std::wstring name) ...@@ -108,7 +109,7 @@ void odp_conversion_context::start_master_slide(std::wstring name)
page_layout_context()->add_master_page(name); page_layout_context()->add_master_page(name);
slide_context_.start_page(page_layout_context()->last_master()->get_root()); slide_context_.start_page(page_layout_context()->last_master()->get_root());
drawing_context()->set_presentation(true); drawing_context()->set_presentation(1);
} }
void odp_conversion_context::end_master_slide() void odp_conversion_context::end_master_slide()
{ {
...@@ -122,7 +123,7 @@ void odp_conversion_context::start_layout_slide() ...@@ -122,7 +123,7 @@ void odp_conversion_context::start_layout_slide()
slide_context_.start_page(elm); slide_context_.start_page(elm);
drawing_context()->set_presentation(true); drawing_context()->set_presentation(1);
} }
void odp_conversion_context::end_layout_slide() void odp_conversion_context::end_layout_slide()
{ {
...@@ -147,7 +148,7 @@ void odp_conversion_context::end_drawings() ...@@ -147,7 +148,7 @@ void odp_conversion_context::end_drawings()
{ {
current_slide().drawing_context()->clear(); current_slide().drawing_context()->clear();
} }
void odp_conversion_context::start_note() void odp_conversion_context::start_note(bool bMaster)
{ {
office_element_ptr note_elm; office_element_ptr note_elm;
create_element(L"presentation", L"notes", note_elm, this); create_element(L"presentation", L"notes", note_elm, this);
...@@ -156,6 +157,18 @@ void odp_conversion_context::start_note() ...@@ -156,6 +157,18 @@ void odp_conversion_context::start_note()
current_slide().drawing_context()->start_element(note_elm); current_slide().drawing_context()->start_element(note_elm);
slide_context_.start_page(note_elm); slide_context_.start_page(note_elm);
if (bMaster)
{
page_layout_context()->create_layout_page();
odf_writer::presentation_notes* notes = dynamic_cast<odf_writer::presentation_notes*>(note_elm.get());
notes->attlist_.style_page_layout_name_ = page_layout_context()->last_layout()->get_name();
drawing_context()->set_presentation(2);
}
else
drawing_context()->set_presentation(0);
} }
void odp_conversion_context::start_comment(int oox_comm_id) void odp_conversion_context::start_comment(int oox_comm_id)
{ {
......
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
void start_comment_content (); void start_comment_content ();
void end_comment_content (); void end_comment_content ();
void start_note(); void start_note(bool bMaster = false);
void end_note(); void end_note();
private: private:
......
...@@ -88,7 +88,7 @@ void odp_page_state::set_layout_page(std::wstring name) ...@@ -88,7 +88,7 @@ void odp_page_state::set_layout_page(std::wstring name)
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get()); draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page == NULL)return; if (page == NULL)return;
page->attlist_.page_layout_name_ = name; page->attlist_.presentation_page_layout_name_ = name;
} }
void odp_page_state::set_master_page(std::wstring name) void odp_page_state::set_master_page(std::wstring name)
...@@ -98,7 +98,7 @@ void odp_page_state::set_master_page(std::wstring name) ...@@ -98,7 +98,7 @@ void odp_page_state::set_master_page(std::wstring name)
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get()); draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page == NULL)return; if (page == NULL)return;
page->attlist_.master_page_name_ = name; page->attlist_.draw_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)
......
...@@ -437,8 +437,6 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape) ...@@ -437,8 +437,6 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
{ {
if (oox_shape == NULL) return; if (oox_shape == NULL) return;
_CP_OPT(bool) bMasterPresentation = odf_context()->drawing_context()->get_presentation();
if (oox_shape->txXfrm.IsInit()) if (oox_shape->txXfrm.IsInit())
{ {
odf_context()->drawing_context()->start_group(); odf_context()->drawing_context()->start_group();
...@@ -1424,9 +1422,9 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T ...@@ -1424,9 +1422,9 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
if (list_local) if (list_local)
{ {
_CP_OPT(bool) inStyles = odf_context()->drawing_context()->get_presentation(); _CP_OPT(int) inStyles = odf_context()->drawing_context()->get_presentation();
odf_context()->styles_context()->lists_styles().start_style(inStyles && *inStyles); odf_context()->styles_context()->lists_styles().start_style(inStyles && *inStyles > 0);
convert_list_level(oox_paragraph->pPr.GetPointer(), list_level /*- 1*/); convert_list_level(oox_paragraph->pPr.GetPointer(), list_level /*- 1*/);
odf_context()->styles_context()->lists_styles().end_style(); odf_context()->styles_context()->lists_styles().end_style();
...@@ -1926,9 +1924,9 @@ void OoxConverter::convert(PPTX::Logic::TextListStyle *oox_list_style) ...@@ -1926,9 +1924,9 @@ void OoxConverter::convert(PPTX::Logic::TextListStyle *oox_list_style)
if (!oox_list_style) return; if (!oox_list_style) return;
if (oox_list_style->IsListStyleEmpty()) return; if (oox_list_style->IsListStyleEmpty()) return;
_CP_OPT(bool) inStyles = odf_context()->drawing_context()->get_presentation(); _CP_OPT(int) inStyles = odf_context()->drawing_context()->get_presentation();
odf_context()->styles_context()->lists_styles().start_style(inStyles && *inStyles); odf_context()->styles_context()->lists_styles().start_style(inStyles && *inStyles > 0); // masters
for (int i = 0; i < 9; i++) for (int i = 0; i < 9; i++)
{ {
OoxConverter::convert_list_level(oox_list_style->levels[i].GetPointer(), i); OoxConverter::convert_list_level(oox_list_style->levels[i].GetPointer(), i);
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include "../../../ASCOfficePPTXFile/PPTXFormat/Folder.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Folder.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Presentation.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Presentation.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Slide.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Slide.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/NotesMaster.h"
#include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/Table.h" #include "../../../ASCOfficePPTXFile/PPTXFormat/Logic/Table/Table.h"
...@@ -359,7 +360,14 @@ void PptxConverter::convert_slides() ...@@ -359,7 +360,14 @@ void PptxConverter::convert_slides()
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, bShowLayoutMasterSp); convert_slide(&slide->Layout->cSld, current_txStyles, true, bShowLayoutMasterSp);
if (!presentation->notesMasterIdLst.empty())
{
rId = presentation->notesMasterIdLst[0].rid.get();
smart_ptr<PPTX::NotesMaster> notes_master = ((*presentation)[rId]).smart_dynamic_cast<PPTX::NotesMaster>();
convert(notes_master.operator->());
}
//add note master //add note master
odp_context->end_master_slide(); odp_context->end_master_slide();
...@@ -409,19 +417,49 @@ void PptxConverter::convert_slides() ...@@ -409,19 +417,49 @@ void PptxConverter::convert_slides()
odp_context->end_slide(); odp_context->end_slide();
} }
} }
void PptxConverter::convert(PPTX::NotesSlide *oox_note) void PptxConverter::convert(PPTX::NotesMaster *oox_notes)
{
if (!oox_notes) return;
odp_context->start_note(true);
current_slide = dynamic_cast<OOX::IFileContainer*>(oox_notes);
current_clrMap = &oox_notes->clrMap;
//PPTX::Logic::TxStyles* current_txStyles = oox_notes->notesStyle.GetPointer();
if (presentation->notesSz.IsInit())
{
_CP_OPT(odf_types::length) width = odf_types::length(presentation->notesSz->cx / 12700., odf_types::length::pt);
_CP_OPT(odf_types::length) height = odf_types::length(presentation->notesSz->cy / 12700., odf_types::length::pt);
odf_context()->page_layout_context()->set_page_size(width, height);
//if (presentation->notesSz->type.IsInit())
//{
// switch(presentation->notesSz->type->GetBYTECode())
// {
// default:
// break;
// }
// odf_context()->page_layout_context()->set_page_orientation
//}
}
convert_slide(&oox_notes->cSld, NULL, true, true);
odp_context->end_note();
}
void PptxConverter::convert(PPTX::NotesSlide *oox_notes)
{ {
if (!oox_note) return; if (!oox_notes) return;
odp_context->start_note(); odp_context->start_note();
current_slide = dynamic_cast<OOX::IFileContainer*>(oox_note); current_slide = dynamic_cast<OOX::IFileContainer*>(oox_notes);
if (oox_note->clrMapOvr.IsInit() && oox_note->clrMapOvr->overrideClrMapping.IsInit()) if (oox_notes->clrMapOvr.IsInit() && oox_notes->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = oox_note->clrMapOvr->overrideClrMapping.GetPointer(); current_clrMap = oox_notes->clrMapOvr->overrideClrMapping.GetPointer();
//current_txStyles = oox_note->Master->txStyles.GetPointer(); //current_txStyles = oox_notes->Master->txStyles.GetPointer();
convert_slide(&oox_note->cSld, NULL, true, true); convert_slide(&oox_notes->cSld, NULL, true, true);
odp_context->end_note(); odp_context->end_note();
} }
...@@ -979,8 +1017,6 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS ...@@ -979,8 +1017,6 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
convert(oox_slide->bg.GetPointer()); convert(oox_slide->bg.GetPointer());
bool bMaster = *odf_context()->drawing_context()->get_presentation();
for (size_t i = 0 ; i < oox_slide->spTree.SpTreeElems.size(); i++) 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::WrapperWritingElement> pElem = oox_slide->spTree.SpTreeElems[i].GetElem();
...@@ -999,9 +1035,6 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS ...@@ -999,9 +1035,6 @@ void PptxConverter::convert_slide(PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxS
{ {
int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode(); int ph_type = pShape->nvSpPr.nvPr.ph->type->GetBYTECode();
//if (!bMaster && (ph_type == 5 || ph_type == 6 || ph_type == 7 || ph_type == 12))
// continue;
odf_context()->drawing_context()->set_placeholder_type(ph_type); odf_context()->drawing_context()->set_placeholder_type(ph_type);
} }
else else
......
...@@ -48,6 +48,7 @@ namespace PPTX ...@@ -48,6 +48,7 @@ namespace PPTX
{ {
class TableStyles; class TableStyles;
class NotesSlide; class NotesSlide;
class NotesMaster;
class Presentation; class Presentation;
class Comments; class Comments;
class Folder; class Folder;
...@@ -110,7 +111,8 @@ namespace Oox2Odf ...@@ -110,7 +111,8 @@ namespace Oox2Odf
void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp); void convert_slide (PPTX::Logic::CSld *oox_slide, PPTX::Logic::TxStyles* txStyles, bool bPlaceholders, bool bFillUp);
void convert_layout (PPTX::Logic::CSld *oox_slide); void convert_layout (PPTX::Logic::CSld *oox_slide);
void convert (PPTX::Comments *oox_comments); void convert (PPTX::Comments *oox_comments);
void convert (PPTX::NotesSlide *oox_note); void convert (PPTX::NotesSlide *oox_notes);
void convert (PPTX::NotesMaster *oox_notes);
void convert(PPTX::Logic::Bg *oox_background); void convert(PPTX::Logic::Bg *oox_background);
void convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition); void convert(PPTX::Logic::Timing *oox_timing, PPTX::Logic::Transition *oox_transition);
......
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