Commit a70255e5 authored by ElenaSubbotina's avatar ElenaSubbotina

.

parent 7e9dede9
......@@ -385,6 +385,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
odf_reader::GetProperty(additional, L"custom_path_w", w);
odf_reader::GetProperty(additional, L"custom_path_h", h);
CP_XML_NODE(L"a:pathLst")
{
CP_XML_NODE(L"a:path")
......@@ -392,7 +393,10 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
CP_XML_ATTR(L"w", w ? *w : cx);
CP_XML_ATTR(L"h", h ? *h : cy);
CP_XML_STREAM() << *sCustomPath;
if (sCustomPath)
{
CP_XML_STREAM() << *sCustomPath;
}
}
}
}
......
......@@ -530,6 +530,48 @@ void pptx_conversion_context::end_page()
get_slide_context().end_slide();
}
bool pptx_conversion_context::start_note(const std::wstring & pageName, const std::wstring & pageStyleName,
const std::wstring & pageLayoutName,
const std::wstring & pageMasterName)
{
// create_new_slide(pageName);
//get_slide_context().start_note();//pageName, pageStyleName);
//current_master_page_name_ = pageMasterName;
//current_layout_page_name_ = pageLayoutName;
//
////const std::wstring masterPageNameLayout = root()->odf_context().pageLayoutContainer().page_layout_name_by_style(current_master_page_name_);
//std::pair<int,std::wstring> layout_id =
// root()->odf_context().styleContainer().presentation_layouts().add_or_find(pageLayoutName,pageMasterName);
//current_slide().Rels().add(relationship(layout_id.second, L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout",
// std::wstring(L"../slideLayouts/slideLayout") + boost::lexical_cast<std::wstring>(layout_id.first) + L".xml"));
return true;
}
void pptx_conversion_context::end_note()
{
//if (!get_comments_context().empty())
// {
// std::wstringstream strm;
// get_comments_context().serialize(strm);
//
// const std::pair<std::wstring, std::wstring> commentsName =
// comments_context_handle_.add_comments_xml(strm.str(), get_comments_context().get_comments() );
// get_slide_context().add_rels(false, commentsName.second, L"../comments/" + commentsName.first, typeComment);
// }
//get_slide_context().serialize_background(current_slide().Background());
//get_slide_context().serialize_objects (current_slide().Data());
//get_slide_context().serialize_animations(current_slide().Timing());
//
//get_slide_context().dump_rels(current_slide().Rels());//hyperlinks, mediaitems, ...
//get_slide_context().end_slide();
}
void pptx_conversion_context::end_layout()
{
get_slide_context().serialize_objects(current_layout().Data());
......
......@@ -88,6 +88,12 @@ public:
const std::wstring & pageMasterName);
void end_page();
bool start_note(const std::wstring & pageName,
const std::wstring & pageStyleName,
const std::wstring & pageLayoutName,
const std::wstring & pageMasterName);
void end_note();
bool start_layout( int layout_index);
void end_layout();
......
......@@ -32,18 +32,14 @@
#include "anim_elements.h"
#include <boost/make_shared.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <boost/lexical_cast.hpp>
#include "serialize_elements.h"
#include "odfcontext.h"
#include <cpdoccore/odf/odf_document.h>
#include "draw_common.h"
#include <cpdoccore/xml/simple_xml_writer.h>
......@@ -74,16 +70,16 @@ void anim_par::pptx_convert(oox::pptx_conversion_context & Context)
}
///////////////////////// последовательности .. (если один элемент - основная последовательность, иное - взаимодействующая анимация)
//slide_context().animation_context().start_sequence();
BOOST_FOREACH(const office_element_ptr& elm, anim_seq_array_)
for (size_t i = 0; i < anim_seq_array_.size(); i++)
{
elm->pptx_convert(Context);
anim_seq_array_[i]->pptx_convert(Context);
}
//slide_context().animation_context().end_sequence();
/////////////////////////////////////////////////////////////////
//внутренние эффекты - те что внутри одной последовательности
BOOST_FOREACH(const office_element_ptr& elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
}
void anim_par::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
......@@ -106,9 +102,9 @@ void anim_seq::add_attributes( const xml::attributes_wc_ptr & Attributes )
void anim_seq::pptx_convert(oox::pptx_conversion_context & Context)
{
BOOST_FOREACH(const office_element_ptr& elm, anim_par_array_)
for (size_t i = 0; i < anim_par_array_.size(); i++)
{
elm->pptx_convert(Context);
anim_par_array_[i]->pptx_convert(Context);
}
}
void anim_seq::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
......
......@@ -32,13 +32,9 @@
#include "draw_page.h"
#include <boost/make_shared.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include <boost/lexical_cast.hpp>
#include "serialize_elements.h"
#include "odfcontext.h"
#include <cpdoccore/odf/odf_document.h>
......@@ -84,7 +80,7 @@ void draw_page::add_child_element( xml::sax * Reader, const std::wstring & Ns, c
void draw_page::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
draw_page_attr_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void draw_page::pptx_convert_placeHolder(oox::pptx_conversion_context & Context, std::wstring styleName, presentation_class::type PresentationClass)
......@@ -96,7 +92,7 @@ void draw_page::pptx_convert_placeHolder(oox::pptx_conversion_context & Context,
int index=-1;
const std::wstring masterName = draw_page_attr_.master_page_name_.get_value_or(L"");
const std::wstring masterName = attlist_.master_page_name_.get_value_or(L"");
style_master_page * master = Context.root()->odf_context().pageLayoutContainer().master_page_by_name(masterName);
if (master)
......@@ -129,16 +125,16 @@ void draw_page::pptx_convert_placeHolder(oox::pptx_conversion_context & Context,
void draw_page::pptx_convert(oox::pptx_conversion_context & Context)
{
const std::wstring pageStyleName = draw_page_attr_.draw_style_name_.get_value_or(L"");
const std::wstring pageName = draw_page_attr_.draw_name_.get_value_or(L"");
const std::wstring layoutName = draw_page_attr_.page_layout_name_.get_value_or(L"");
const std::wstring masterName = draw_page_attr_.master_page_name_.get_value_or(L"");
const std::wstring pageStyleName = attlist_.draw_style_name_.get_value_or(L"");
const std::wstring pageName = attlist_.draw_name_.get_value_or(L"");
const std::wstring layoutName = attlist_.page_layout_name_.get_value_or(L"");
const std::wstring masterName = attlist_.master_page_name_.get_value_or(L"");
_CP_LOG << L"[info][xlsx] process page(slide) \"" << pageName /*L"" */<< L"\"" << std::endl;
_CP_LOG << L"[info][pptx] process page(slide) \"" << pageName /*L"" */<< L"\"" << std::endl;
Context.start_page(pageName, pageStyleName, layoutName,masterName);
if (draw_page_attr_.draw_style_name_)
if (attlist_.draw_style_name_)
{
style_instance * style_inst = Context.root()->odf_context().styleContainer().style_by_name(pageStyleName,style_family::DrawingPage,false);
......@@ -191,19 +187,19 @@ void draw_page::pptx_convert(oox::pptx_conversion_context & Context)
animation_->pptx_convert(Context);
}
/////////////////////////
BOOST_FOREACH(const office_element_ptr& elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->pptx_convert(Context);
content_[i]->pptx_convert(Context);
}
if (draw_page_attr_.use_footer_name_)//from master_page
if (attlist_.use_footer_name_)//from master_page
{
std::wstring name = L"footer:" + *draw_page_attr_.use_footer_name_;
std::wstring name = L"footer:" + *attlist_.use_footer_name_;
pptx_convert_placeHolder(Context, name, presentation_class::footer);
}
if (draw_page_attr_.use_date_time_name_)//from master_page
if (attlist_.use_date_time_name_)//from master_page
{
std::wstring name = L"datetime:" + *draw_page_attr_.use_date_time_name_;
std::wstring name = L"datetime:" + *attlist_.use_date_time_name_;
pptx_convert_placeHolder(Context, name, presentation_class::date_time);
}
......@@ -243,6 +239,121 @@ void presentation_date_time_decl::pptx_convert(oox::pptx_conversion_context & Co
{
Context.get_text_context().add_text(text_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * presentation_notes::ns = L"presentation";
const wchar_t * presentation_notes::name = L"notes";
void presentation_notes::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void presentation_notes::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
attlist_.add_attributes(Attributes);
}
//void presentation_notes::pptx_convert_placeHolder(oox::pptx_conversion_context & Context, std::wstring styleName, presentation_class::type PresentationClass)
//{
// office_element_ptr elm = Context.root()->odf_context().drawStyles().find_by_style_name(styleName);
// //todooo если это элемент datatime -нужно вытащить формат поля
//
// if (!elm)return;
//
// int index=-1;
//
// const std::wstring masterName = attlist_.master_page_name_.get_value_or(L"");
// style_master_page * master = Context.root()->odf_context().pageLayoutContainer().master_page_by_name(masterName);
//
// //if (master)
// // index = master->find_placeHolderIndex(PresentationClass, Context.last_idx_placeHolder);
//
//
// Context.get_slide_context().start_shape(1);
// Context.get_slide_context().set_placeHolder_type(presentation_class(PresentationClass).get_type_ms());
// Context.get_slide_context().set_placeHolder_idx(index);
//
// Context.get_text_context().start_object();
//
// if (PresentationClass == presentation_class::date_time)
// {
// Context.get_text_context().start_field(oox::datetime, L"");
// }
//
// elm->pptx_convert(Context);
//
// std::wstring text_content_ = Context.get_text_context().end_object();
//
// if (text_content_.length()>0)
// {
// Context.get_slide_context().set_property(_property(L"text-content",text_content_));
// }
// Context.get_slide_context().set_property(_property(L"no_rect",true));
// Context.get_slide_context().end_shape();
//
//}
//
void presentation_notes::pptx_convert(oox::pptx_conversion_context & Context)
{
const std::wstring pageStyleName = attlist_.draw_style_name_.get_value_or(L"");
const std::wstring pageName = attlist_.draw_name_.get_value_or(L"");
const std::wstring layoutName = attlist_.page_layout_name_.get_value_or(L"");
const std::wstring masterName = attlist_.master_page_name_.get_value_or(L"");
_CP_LOG << L"[info][pptx] process note slide" << std::endl;
Context.start_note(pageName, pageStyleName, layoutName, masterName);
if (attlist_.draw_style_name_)
{
style_instance * style_inst = Context.root()->odf_context().styleContainer().style_by_name(pageStyleName,style_family::DrawingPage, false);
if ((style_inst) && (style_inst->content()))
{
const style_drawing_page_properties * properties = style_inst->content()->get_style_drawing_page_properties();
if (properties)
{
oox::_oox_fill fill;
Compute_GraphicFill(properties->content().common_draw_fill_attlist_, office_element_ptr(),
Context.root()->odf_context().drawStyles() ,fill);
Context.get_slide_context().add_background(fill);
////////////////////////////////////////////////
if ((properties->content().presentation_display_footer_) && (*properties->content().presentation_display_footer_))
Context.get_slide_context().set_footer();
if ((properties->content().presentation_display_header_) && (*properties->content().presentation_display_header_))
Context.get_slide_context().set_header();
if ((properties->content().presentation_display_page_number_) && (*properties->content().presentation_display_page_number_))
Context.get_slide_context().set_page_number();
if ((properties->content().presentation_display_date_time_) && (*properties->content().presentation_display_date_time_))
Context.get_slide_context().set_date_time();
}
}
}
/////////////////////////
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->pptx_convert(Context);
}
//if (attlist_.use_footer_name_)//from master_page
//{
// std::wstring name = L"footer:" + *attlist_.use_footer_name_;
// pptx_convert_placeHolder(Context, name, presentation_class::footer);
//}
//if (attlist_.use_date_time_name_)//from master_page
//{
// std::wstring name = L"datetime:" + *attlist_.use_date_time_name_;
// pptx_convert_placeHolder(Context, name, presentation_class::date_time);
//}
Context.end_note();
}
}
}
......@@ -79,11 +79,10 @@ private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
private:
office_element_ptr_array content_;
office_element_ptr animation_;
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);
......@@ -139,5 +138,28 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_date_time_decl);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
//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 pptx_convert(oox::pptx_conversion_context & Context);
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
office_element_ptr_array content_;
draw_page_attr attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_notes);
}
}
......@@ -316,6 +316,7 @@ enum ElementType
typeDrawPage,
typePresentationFooterDecl,
typePresentationDateTimeDecl,
typePresentationNotes,
typeAnimPar,
typeAnimSeq,
......
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