Commit 9b7ad034 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - presentation notes

parent 3162bb0b
......@@ -85,7 +85,7 @@ void draw_page::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
draw_page_attr_.serialize(CP_GET_XML_NODE());
attlist_.serialize(CP_GET_XML_NODE());
for (int i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
......@@ -107,7 +107,7 @@ const wchar_t * presentation_footer_decl::name = L"footer-decl";
// 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::name = L"date-time-decl";
//
......@@ -119,5 +119,33 @@ const wchar_t * presentation_date_time_decl::name = L"date-time-decl";
//}
//
//------------------------------------------------------
const wchar_t * presentation_notes::ns = L"presentation";
const wchar_t * presentation_notes::name = L"notes";
void presentation_notes::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void presentation_notes::add_child_element( const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void presentation_notes::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
attlist_.serialize(CP_GET_XML_NODE());
for (int i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
}
}
......@@ -79,7 +79,7 @@ public:
office_element_ptr_array content_;
office_element_ptr animation_;
draw_page_attr draw_page_attr_;
draw_page_attr attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(draw_page);
......@@ -127,6 +127,26 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_date_time_decl);
//---------------------------------------------------------------------
class presentation_notes : public office_element_impl<presentation_notes>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationNotes;
CPDOCCORE_DEFINE_VISITABLE();
virtual void create_child_element(const std::wstring & Ns, const std::wstring & Name);
virtual void add_child_element( const office_element_ptr & child_element);
virtual void serialize(std::wostream & _Wostream);
office_element_ptr_array content_;
draw_page_attr attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_notes);
}
}
......@@ -84,7 +84,7 @@ void odf_master_state::set_name(std::wstring & name)
if (!style_)return;
style_->style_master_page_attlist_.style_name_ = name;
style_->attlist_.style_name_ = name;
}
void odf_master_state::set_display_name(std::wstring & name)
{
......@@ -92,7 +92,7 @@ void odf_master_state::set_display_name(std::wstring & name)
if (!style_)return;
style_->style_master_page_attlist_.style_display_name_ = name;
style_->attlist_.style_display_name_ = name;
}
void odf_master_state::set_layout_style_name(std::wstring name)
......@@ -101,14 +101,14 @@ void odf_master_state::set_layout_style_name(std::wstring name)
if (!style_)return;
style_->style_master_page_attlist_.style_page_layout_name_ = name;
style_->attlist_.style_page_layout_name_ = name;
}
std::wstring odf_master_state::get_name()
{
style_master_page* style_ = dynamic_cast<style_master_page*>(elements_[0].elm.get());
if (!style_)return L"";
return style_->style_master_page_attlist_.style_name_.get_value_or(L"");
return style_->attlist_.style_name_.get_value_or(L"");
}
void odf_master_state::add_footer(office_element_ptr & elm)
{
......
......@@ -147,7 +147,16 @@ void odp_conversion_context::end_drawings()
{
current_slide().drawing_context()->clear();
}
void odp_conversion_context::start_note()
{
office_element_ptr note_elm;
create_element(L"presentation", L"notes", note_elm, this);
current_slide().drawing_context()->start_drawing();
current_slide().drawing_context()->start_element(note_elm);
slide_context_.start_page(note_elm);
}
void odp_conversion_context::start_comment(int oox_comm_id)
{
office_element_ptr comm_elm;
......@@ -182,6 +191,15 @@ void odp_conversion_context::end_comment()
current_slide().drawing_context()->end_element();
current_slide().drawing_context()->end_drawing();
}
void odp_conversion_context::end_note()
{
slide_context_.end_page();
slide_context_.remove_page();
current_slide().drawing_context()->end_element();
current_slide().drawing_context()->end_drawing();
}
}
}
......@@ -77,6 +77,9 @@ public:
void start_comment_content ();
void end_comment_content ();
void start_note();
void end_note();
private:
odp_slide_context slide_context_;
......
......@@ -72,12 +72,12 @@ void odp_page_state::set_page_name(std::wstring name)
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page)
page->draw_page_attr_.draw_name_ = name;
page->attlist_.draw_name_ = name;
else
{
//style_master_page *master_page = dynamic_cast<style_master_page*>(page_elm_.get());
//if (master_page)
// master_page->style_master_page_attlist_.style_display_name_ = name;
// master_page->attlist_.style_display_name_ = 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());
if (page == NULL)return;
page->draw_page_attr_.page_layout_name_ = name;
page->attlist_.page_layout_name_ = 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)
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page == NULL)return;
page->draw_page_attr_.master_page_name_ = name;
page->attlist_.master_page_name_ = name;
}
void odp_page_state::set_page_style(office_element_ptr & elm)
......@@ -111,12 +111,18 @@ void odp_page_state::set_page_style(office_element_ptr & elm)
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page)
page->draw_page_attr_.draw_style_name_ = office_page_style_->style_name_;
page->attlist_.draw_style_name_ = office_page_style_->style_name_;
else
{
style_master_page *master_page = dynamic_cast<style_master_page*>(page_elm_.get());
if (master_page)
master_page->style_master_page_attlist_.draw_style_name_ = office_page_style_->style_name_;
master_page->attlist_.draw_style_name_ = office_page_style_->style_name_;
else
{
presentation_notes* notes = dynamic_cast<presentation_notes*>(page_elm_.get());
if (notes)
notes->attlist_.draw_style_name_ = office_page_style_->style_name_;
}
}
}
void odp_page_state::add_child_element( const office_element_ptr & child_element)
......
......@@ -44,8 +44,9 @@ namespace cpdoccore {
namespace odf_writer {
odp_slide_context::odp_slide_context(odp_conversion_context & Context): context_(Context), table_context_(&Context), comment_context_(&Context)
odp_slide_context::odp_slide_context(odp_conversion_context & Context) : context_(Context), table_context_(&Context), comment_context_(&Context)
{
count_slides_ = 0;
styles_context_ = Context.styles_context();
}
void odp_slide_context::set_styles_context(odf_style_context* styles_context)
......@@ -67,17 +68,13 @@ void odp_slide_context::start_page(office_element_ptr & elm)
{
page_state_list_.push_back( odp_page_state(&context_, elm) );
std::wstring style_name_new = L"dp" + boost::lexical_cast<std::wstring>(page_state_list_.size());
std::wstring style_name_new = L"dp" + std::to_wstring(++count_slides_);
office_element_ptr & style = styles_context_->add_or_find(style_name_new, style_family::DrawingPage, true);
style->create_child_element(L"style", L"drawing-page-properties");
state().set_page_style(style);
state().drawing_context()->set_styles_context(styles_context_);
//для свойств страницы, а не таблицы - нужно создать master-page c page layout и связать по имени со стилем таблицы
//причем здесь, т.к. с другой стороны это ВСЕ еще свойства листа. то есть совйства листа разделить на свйства страницы и таблицы ..
//todooo
//????
}
void odp_slide_context::end_page()
......@@ -85,6 +82,11 @@ void odp_slide_context::end_page()
state().drawing_context()->finalize(state().page_elm_);
}
void odp_slide_context::remove_page()
{
page_state_list_.pop_back();
}
odf_table_context* odp_slide_context::table_context()
{
return &table_context_;
......
......@@ -53,6 +53,8 @@ public:
void start_page (office_element_ptr & elm);
void end_page ();
void remove_page();
void set_styles_context(odf_style_context* styles_context);
odf_style_context* get_styles_context();
......@@ -81,6 +83,7 @@ private:
odf_comment_context comment_context_;
std::list<odp_page_state> page_state_list_;
int count_slides_;
friend class odp_conversion_context;
......
......@@ -157,8 +157,6 @@ enum ElementType
typeStylePresentationPlaceholder,
typeStyleDrawingPageProperties,
typePresentationNotes,
typeStyleColumns,
typeStyleColumn,
typeStyleColumnSep,
......@@ -264,6 +262,7 @@ enum ElementType
typeDrawPage,
typePresentationFooterDecl,
typePresentationDateTimeDecl,
typePresentationNotes,
typeAnimPar,
typeAnimSeq,
......
......@@ -1270,7 +1270,7 @@ void style_master_page::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
style_master_page_attlist_.serialize( CP_GET_XML_NODE());
attlist_.serialize( CP_GET_XML_NODE());
if (style_footer_) style_footer_->serialize(CP_XML_STREAM());
if (style_header_) style_header_->serialize(CP_XML_STREAM());
......
......@@ -505,7 +505,7 @@ public:
int find_placeHolderIndex(odf_types::presentation_class::type placeHolder,int & last_idx);
style_master_page_attlist style_master_page_attlist_;
style_master_page_attlist attlist_;
office_element_ptr style_header_;
office_element_ptr style_header_left_;
......
......@@ -1947,17 +1947,17 @@ void OoxConverter::convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeSt
for (size_t i = 0; i < oox_txBody->Paragrs.size(); i++)
{
convert(&oox_txBody->Paragrs[i], oox_txBody->lstStyle.GetPointer());
//внешние настройки для текста
convert(oox_txBody->bodyPr.GetPointer());
if (oox_style)
{
convert(&oox_style->fontRef);
}
}
odf_context()->drawing_context()->set_text( odf_context()->text_context());
//внешние настройки для текста
convert(oox_txBody->bodyPr.GetPointer());
if (oox_style)
{
convert(&oox_style->fontRef);
}
odf_context()->end_text_context();
}
void OoxConverter::convert(PPTX::Logic::ArcTo *oox_geom_path)
......
......@@ -412,6 +412,18 @@ void PptxConverter::convert_slides()
void PptxConverter::convert(PPTX::NotesSlide *oox_note)
{
if (!oox_note) return;
odp_context->start_note();
current_slide = dynamic_cast<OOX::IFileContainer*>(oox_note);
if (oox_note->clrMapOvr.IsInit() && oox_note->clrMapOvr->overrideClrMapping.IsInit())
current_clrMap = oox_note->clrMapOvr->overrideClrMapping.GetPointer();
//current_txStyles = oox_note->Master->txStyles.GetPointer();
convert_slide(&oox_note->cSld, NULL, true, true);
odp_context->end_note();
}
void PptxConverter::convert(OOX::WritingElement *oox_unknown)
......
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