Commit de22fb47 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - presentation sound, video objects, actions for shapes

parent 75177441
......@@ -41,8 +41,13 @@ namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const clockvalue & _Val)
{
// 5ms = 5 milliseconds
_Wostream << _Val.get_value() << "ms"; // todoooo усложнить ..
// 5ms = 5 milliseconds
if (_Val.get_value() < 0)
_Wostream << L"indefinite";
else
{
_Wostream << _Val.get_value() << "ms"; // todoooo усложнить ..
}
return _Wostream;
}
......@@ -120,15 +125,20 @@ static bool parseTime(const std::wstring & Time, double & Hours, double & Minute
}
clockvalue clockvalue::parse(const std::wstring & Str)
{
int v=0;
if (Str == L"indefinite")
return clockvalue(-1);
else
{
int v=0;
int ms=0;
double h=0,m=0,s =0;
bool res = parseTime(Str,h,m,s,ms);
int ms=0;
double h=0,m=0,s =0;
bool res = parseTime(Str,h,m,s,ms);
v = (((h*60)+m)*60+s)*1000+ms;
v = (((h*60)+m)*60+s)*1000+ms;
return clockvalue(v);
return clockvalue(v);
}
}
......
......@@ -804,28 +804,32 @@ void common_presentation_attlist::serialize(CP_ATTR_NODE)
void common_anim_smil_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"smil:direction", smil_direction_);
CP_APPLY_ATTR(L"smil:subtype", smil_subtype_);
CP_APPLY_ATTR(L"smil:type", smil_type_);
CP_APPLY_ATTR(L"smil:dur", smil_dur_);
CP_APPLY_ATTR(L"presentation:node-type", presentation_node_type_);
CP_APPLY_ATTR(L"smil:direction", smil_direction_);
CP_APPLY_ATTR(L"smil:begin", smil_begin_);
CP_APPLY_ATTR(L"smil:end", smil_end_);
CP_APPLY_ATTR(L"smil:restart", smil_restart_);
CP_APPLY_ATTR(L"smil:dur", smil_dur_);
}
void common_anim_smil_attlist::apply_from(const common_anim_smil_attlist & Other)
{
_CP_APPLY_PROP(presentation_node_type_, Other.presentation_node_type_);
_CP_APPLY_PROP(smil_direction_, Other.smil_direction_);
_CP_APPLY_PROP(smil_subtype_, Other.smil_subtype_);
_CP_APPLY_PROP(smil_type_, Other.smil_type_);
_CP_APPLY_PROP(smil_begin_, Other.smil_begin_);
_CP_APPLY_PROP(smil_end_, Other.smil_end_);
_CP_APPLY_PROP(smil_restart_, Other.smil_restart_);
_CP_APPLY_PROP(smil_dur_, Other.smil_dur_);
}
void common_anim_smil_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"smil:direction", smil_direction_);
CP_XML_ATTR_OPT(L"smil:subtype", smil_subtype_);
CP_XML_ATTR_OPT(L"smil:type", smil_type_);
CP_XML_ATTR_OPT(L"smil:restart", smil_restart_);
CP_XML_ATTR_OPT(L"smil:dur", smil_dur_);
CP_XML_ATTR_OPT(L"presentation:node-type", presentation_node_type_);
CP_XML_ATTR_OPT(L"smil:begin", smil_begin_);
CP_XML_ATTR_OPT(L"smil:end", smil_end_);
}
void union_common_draw_attlists::serialize(CP_ATTR_NODE)
{
......
......@@ -577,17 +577,14 @@ public:
void apply_from (const common_anim_smil_attlist & Other);
void serialize (CP_ATTR_NODE);
_CP_OPT(std::wstring) presentation_node_type_;
_CP_OPT(std::wstring) smil_direction_;
_CP_OPT(std::wstring) smil_restart_;
_CP_OPT(std::wstring) smil_subtype_;
_CP_OPT(std::wstring) smil_type_;
_CP_OPT(std::wstring) smil_dur_;
_CP_OPT(std::wstring) presentation_node_type_;
_CP_OPT(std::wstring) smil_begin_;
_CP_OPT(color) smil_fadeColor;
_CP_OPT(std::wstring) smil_direction_;
_CP_OPT(std::wstring) smil_restart_;
_CP_OPT(odf_types::clockvalue) smil_dur_;
_CP_OPT(std::wstring) smil_begin_;
_CP_OPT(std::wstring) smil_end_;
};
}
......
......@@ -59,6 +59,8 @@ void anim_par::create_child_element(const std::wstring & Ns, const std::wstring
}
void anim_par::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeAnimPar)
......@@ -122,16 +124,18 @@ void anim_seq::add_child_element( const office_element_ptr & child)
////////////////////////////////////////////////////////////////
void anim_transition_filter_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"smil:direction", smil_direction_);
CP_XML_ATTR_OPT(L"smil:subtype", smil_subtype_);
CP_XML_ATTR_OPT(L"smil:type", smil_type_);
CP_XML_ATTR_OPT(L"smil:fadeColor", smil_fadeColor_);
CP_XML_ATTR_OPT(L"smil:mode", smil_mode_);
CP_XML_ATTR_OPT(L"smil:dur", smil_dur_);
}
const wchar_t * anim_transitionFilter::ns = L"anim";
void anim_audio_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"xlink:href", xlink_href_);
CP_XML_ATTR_OPT(L"anim:audio-level",anim_audio_level_);
}
const wchar_t * anim_transitionFilter::ns = L"anim";
const wchar_t * anim_transitionFilter::name = L"transitionFilter";
void anim_transitionFilter::serialize(std::wostream & _Wostream)
......@@ -140,11 +144,26 @@ void anim_transitionFilter::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
attlist_.serialize(CP_GET_XML_NODE());
common_attlist_.serialize(CP_GET_XML_NODE());
filter_attlist_.serialize(CP_GET_XML_NODE());
}
}
}
//------------------------------------------------------------------------------------------------
const wchar_t * anim_audio::ns = L"anim";
const wchar_t * anim_audio::name = L"audio";
void anim_audio::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
common_attlist_.serialize(CP_GET_XML_NODE());
audio_attlist_.serialize(CP_GET_XML_NODE());
}
}
}
////////////////////////////////////////////////////////////////
}
}
......@@ -86,19 +86,24 @@ CP_REGISTER_OFFICE_ELEMENT2(anim_seq);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//anim:iterate
//class anim_iterate : public office_element_impl<anim_iterate>//Итеративные анимации
class anim_audio_attlist
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) xlink_href_;
_CP_OPT(std::wstring) anim_audio_level_;
};
class anim_transition_filter_attlist
{
public:
void serialize(CP_ATTR_NODE);
_CP_OPT(std::wstring) smil_direction_;
_CP_OPT(std::wstring) smil_subtype_;
_CP_OPT(odf_types::smil_transition_type) smil_type_;
_CP_OPT(std::wstring) smil_mode_;
_CP_OPT(odf_types::color) smil_fadeColor_;
_CP_OPT(odf_types::clockvalue) smil_dur_;
};
......@@ -116,11 +121,29 @@ public:
virtual void serialize(std::wostream & strm);
///////////////////////////////////////////////////////////
anim_transition_filter_attlist attlist_;
odf_types::common_anim_smil_attlist common_attlist_;
anim_transition_filter_attlist filter_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(anim_transitionFilter);
//anim:audio
class anim_audio : public office_element_impl<anim_audio>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeAnimAudio;
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){}
virtual void serialize(std::wostream & strm);
///////////////////////////////////////////////////////////
odf_types::common_anim_smil_attlist common_attlist_;
anim_audio_attlist audio_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(anim_audio);
//anim:command
}
......
......@@ -73,10 +73,9 @@ void draw_chart_attlist::serialize(CP_ATTR_NODE)
//CP_XML_ATTR_OPT(L"draw:filter-name", draw_filter_name_);
}
// draw:image
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_image::ns = L"draw";
const wchar_t * draw_image::name = L"image";
//-----------------------------------------------------------------------
const wchar_t * draw_image::ns = L"draw";
const wchar_t * draw_image::name = L"image";
void draw_image::serialize(std::wostream & _Wostream)
{
......@@ -111,6 +110,8 @@ void draw_image::create_child_element(const std::wstring & Ns, const std::wstrin
}
void draw_image::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeOfficeBinaryData)
......@@ -154,8 +155,7 @@ void draw_chart::add_child_element( const office_element_ptr & child_element)
content_.push_back(child_element);
}
// draw:g
//////////////////////////////////////////////////////////////////////////////////////////////////
///-----------------------------------------------------------------------
const wchar_t * draw_g::ns = L"draw";
const wchar_t * draw_g::name = L"g";
......@@ -207,12 +207,12 @@ void draw_frame::serialize(std::wostream & _Wostream)
void draw_frame::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
if (CP_CHECK_NAME(L"draw", L"text-box") ||
CP_CHECK_NAME(L"draw", L"image") ||//копия чарта в виде картинки ну.. или просто картинка
CP_CHECK_NAME(L"draw", L"object") ||//месторасположение чарта
CP_CHECK_NAME(L"draw", L"image") ||//копия чарта в виде картинки ну.. или просто картинка
CP_CHECK_NAME(L"draw", L"object") ||//месторасположение чарта
CP_CHECK_NAME(L"draw", L"object-ole") ||
CP_CHECK_NAME(L"draw", L"applet") ||
CP_CHECK_NAME(L"draw", L"applet") ||
CP_CHECK_NAME(L"draw", L"floating-frame") ||
CP_CHECK_NAME(L"draw", L"plugin") ||
CP_CHECK_NAME(L"draw", L"plugin") ||
CP_CHECK_NAME(L"table", L"table")
)
{
......@@ -242,9 +242,16 @@ void draw_frame::create_child_element( const std::wstring & Ns, const std::wstr
}
void draw_frame::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeDrawImage || type == typeDrawTextBox || type == typeDrawObject || type == typeDrawObjectOle || type == typeTableTable)
if (type == typeDrawImage ||
type == typeDrawTextBox ||
type == typeDrawObject ||
type == typeDrawObjectOle ||
type == typeDrawPlugin ||
type == typeTableTable)
{
draw_base::add_child_element(child_element);
}
......@@ -259,8 +266,6 @@ void draw_frame::add_child_element( const office_element_ptr & child_element)
}
///////////////////////
void draw_text_box_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"draw:chain-next-name", draw_chain_next_name_);
......@@ -271,9 +276,8 @@ void draw_text_box_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT(L"fo:max-height", fo_max_height_);
}
// draw:text-box
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_text_box::ns = L"draw";
//-----------------------------------------------------------------------
const wchar_t * draw_text_box::ns = L"draw";
const wchar_t * draw_text_box::name = L"text-box";
......@@ -285,9 +289,9 @@ void draw_text_box::serialize(std::wostream & _Wostream)
{
draw_text_box_attlist_.serialize(CP_GET_XML_NODE());
BOOST_FOREACH(const office_element_ptr & elm, content_)
for (size_t i = 0; i < content_.size(); i++)
{
elm->serialize(CP_XML_STREAM());
content_[i]->serialize(CP_XML_STREAM());
}
}
}
......@@ -302,8 +306,7 @@ void draw_text_box::add_child_element( const office_element_ptr & child_element)
content_.push_back(child_element);
}
// draw:object
//////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------
const wchar_t * draw_object::ns = L"draw";
const wchar_t * draw_object::name = L"object";
......@@ -326,10 +329,9 @@ void draw_object::add_child_element( const office_element_ptr & child_element)
{
//CP_NOT_APPLICABLE_ELM();
}
// draw:object
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * draw_object_ole::ns = L"draw";
const wchar_t * draw_object_ole::name = L"object-ole";
//-----------------------------------------------------------------------
const wchar_t * draw_object_ole::ns = L"draw";
const wchar_t * draw_object_ole::name = L"object-ole";
void draw_object_ole::serialize(std::wostream & _Wostream)
{
......@@ -351,5 +353,37 @@ void draw_object_ole::add_child_element( const office_element_ptr & child_elemen
{
//CP_NOT_APPLICABLE_ELM();
}
//-----------------------------------------------------------------------
const wchar_t * draw_plugin::ns = L"draw";
const wchar_t * draw_plugin::name = L"plugin";
void draw_plugin::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"draw:mime-type", draw_mime_type_);
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
void draw_plugin::create_child_element( const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"draw", L"param")
{
CP_CREATE_ELEMENT(content_);
}
}
void draw_plugin::add_child_element( const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
}
}
......@@ -235,10 +235,33 @@ public:
virtual void serialize(std::wostream & _Wostream);
odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) draw_class_id_;
_CP_OPT(std::wstring) draw_class_id_;
};
CP_REGISTER_OFFICE_ELEMENT2(draw_object_ole)
// draw:plugin
class draw_plugin : public office_element_impl<draw_plugin>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeDrawPlugin;
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);
odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) draw_mime_type_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(draw_plugin)
}
}
......@@ -72,6 +72,8 @@ void draw_page::create_child_element( const std::wstring & Ns, const std::wstrin
}
void draw_page::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if(type == typeAnimPar)
animation_ = child_element;
......
......@@ -464,7 +464,9 @@ void draw_enhanced_geometry::create_child_element( const std::wstring & Ns, cons
}
void draw_enhanced_geometry::add_child_element( const office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeDrawHandle)
{
......
......@@ -102,6 +102,8 @@ void text_list_item::create_child_element(const std::wstring & Ns, const std::ws
}
void text_list_item::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextNumber)
......@@ -148,6 +150,8 @@ void text_list_header::create_child_element(const std::wstring & Ns, const std::
}
void text_list_header::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextNumber)
......
......@@ -42,7 +42,7 @@ class rels;
class _mediaitems
{
public:
enum Type { typeUnknown = 0, typeImage, typeAudio, typeVideo};
enum Type { typeUnknown = 0, typeImage, typeMedia};
//oleObject ???
_mediaitems()
......
......@@ -123,6 +123,8 @@ void number_style_base::create_child_element( const std::wstring & Ns, const std
}
void number_style_base::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeStyleTextProperties)
......
......@@ -185,12 +185,12 @@ namespace odf_writer
{
if (mediaitems_.count_media < 1)return;
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"media";
std::wstring path = RootPath + FILE_SEPARATOR_STR + L"Media";
NSDirectory::CreateDirectory(path);
BOOST_FOREACH( _mediaitems::item & item, mediaitems_.items() )
{
if (item.type == _mediaitems::typeAudio || item.type == _mediaitems::typeVideo)
if (item.type == _mediaitems::typeMedia)
{
std::wstring file_name_out = RootPath + FILE_SEPARATOR_STR + item.odf_ref;
......@@ -346,13 +346,13 @@ namespace odf_writer
CP_XML_ATTR(L"xmlns:anim", L"urn:oasis:names:tc:opendocument:xmlns:animation:1.0" );
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf_writer-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
CP_XML_ATTR(L"office:version", L"1.2");
//CP_XML_NODE(L"office:scripts");
CP_XML_NODE(L"office:font-face-decls");
if (content_)
{
CP_XML_STREAM() << content_->styles_str();
......@@ -414,7 +414,7 @@ namespace odf_writer
CP_XML_ATTR(L"xmlns:chartooo", L"http://openoffice.org/2010/chart" );
CP_XML_ATTR(L"xmlns:calcext", L"urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" );
CP_XML_ATTR(L"xmlns:field", L"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf_writer-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:formx", L"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" );
CP_XML_ATTR(L"xmlns:loext", L"urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" );
CP_XML_ATTR(L"xmlns:css3t", L"http://www.w3.org/TR/css3-text/" );
CP_XML_ATTR(L"office:version", L"1.2");
......
......@@ -35,6 +35,7 @@
#include <boost/lexical_cast.hpp>
#include "office_spreadsheet.h"
#include "office_scripts.h"
#include "office_chart.h"
#include "office_elements_create.h"
......@@ -128,6 +129,10 @@ void odf_conversion_context::end_document()
process_settings(object, isRoot);
package::content_content_ptr content_root_ = package::content_content::create();
if (objects_.back().scripts)
objects_.back().scripts->serialize(content_root_->styles());
object.content->serialize(content_root_->content());
BOOST_FOREACH(const office_element_ptr & elm, object.content_styles)
{
......@@ -193,6 +198,8 @@ void odf_conversion_context::start_presentation()
{
create_object();
create_element(L"office", L"presentation", objects_.back().content, this, true);
create_element(L"office", L"scripts", objects_.back().scripts, this);
}
void odf_conversion_context::create_object()
{
......@@ -298,6 +305,15 @@ std::wstring odf_conversion_context::add_image(const std::wstring & image_file_n
return odf_ref_name;
}
std::wstring odf_conversion_context::add_media(const std::wstring & file_name)
{
if (file_name.empty()) return L"";
std::wstring odf_ref_name ;
mediaitems()->add_or_find(file_name,_mediaitems::typeMedia, odf_ref_name);
return odf_ref_name;
}
void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length, _CP_OPT(int) leader)
{
if (!temporary_.elm) return;
......
......@@ -65,6 +65,7 @@ class odf_conversion_context : boost::noncopyable
std::wstring name;
office_element_ptr content;
office_element_ptr scripts;
std::vector<office_element_ptr> content_styles;
std::vector<office_element_ptr> styles;
office_element_ptr settings;
......@@ -96,6 +97,7 @@ public:
virtual void end_text_context() = 0;
std::wstring add_image(const std::wstring & image_file_name);
std::wstring add_media(const std::wstring & file_name);
virtual odf_style_context * styles_context();
......
......@@ -42,6 +42,7 @@
#include "odf_text_context.h"
#include "odf_style_context.h"
#include "odf_conversion_context.h"
#include "office_event_listeners.h"
#include "draw_frame.h"
#include "draw_shapes.h"
......@@ -2332,14 +2333,37 @@ void odf_drawing_context::start_object(std::wstring name)
draw_object* object = dynamic_cast<draw_object*>(object_elm.get());
if (object == NULL)return;
object->common_xlink_attlist_.href_= std::wstring(L"./") + name;
object->common_xlink_attlist_.type_= xlink_type::Simple;
object->common_xlink_attlist_.show_ = xlink_show::Embed;
object->common_xlink_attlist_.actuate_= xlink_actuate::OnLoad;
object->common_xlink_attlist_.href_ = std::wstring(L"./") + name;
object->common_xlink_attlist_.type_ = xlink_type::Simple;
object->common_xlink_attlist_.show_ = xlink_show::Embed;
object->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
start_element(object_elm);
}
void odf_drawing_context::start_media(std::wstring name)
{
start_frame();
office_element_ptr plugin_elm;
create_element(L"draw", L"plugin", plugin_elm, impl_->odf_context_);
draw_plugin* plugin = dynamic_cast<draw_plugin*>(plugin_elm.get());
if (plugin == NULL)return;
plugin->common_xlink_attlist_.href_ = name;
plugin->common_xlink_attlist_.type_ = xlink_type::Simple;
plugin->common_xlink_attlist_.show_ = xlink_show::Embed;
plugin->common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
plugin->draw_mime_type_ = L"application/vnd.sun.star.media";
start_element(plugin_elm);
}
void odf_drawing_context::end_media()
{
end_element();
end_frame();
}
void odf_drawing_context::start_text_box()
{
impl_->current_drawing_state_.oox_shape_preset_ = 2000;
......@@ -2369,6 +2393,94 @@ void odf_drawing_context::set_text_box_min_size(bool val)
}
}
void odf_drawing_context::start_action(std::wstring value)
{
office_element_ptr elm_listeners;
create_element(L"office", L"event-listeners", elm_listeners, impl_->odf_context_);
start_element(elm_listeners);
office_element_ptr elm;
create_element(L"presentation", L"event-listener", elm, impl_->odf_context_);
start_element(elm);
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
if (event_)
{
event_->attlist_.script_event_name_ = L"dom:click";
if (std::wstring::npos != value.find(L"noaction") ||
std::wstring::npos != value.find(L"media"))
{
event_->attlist_.script_event_name_ = boost::none;
}
else if (std::wstring::npos != value.find(L"program"))
{
event_->attlist_.presentation_action_ = L"execute";
}
else if (std::wstring::npos != value.find(L"hlinkshowjump"))
{
if (std::wstring::npos != value.find(L"previousslide"))
event_->attlist_.presentation_action_ = L"previous-page";
if (std::wstring::npos != value.find(L"nextslide"))
event_->attlist_.presentation_action_ = L"next-page";
}
else if (std::wstring::npos != value.find(L"hlinksldjump"))
{
event_->attlist_.presentation_action_ = L"previous-page";
}
else
{//hyperlink
event_->attlist_.presentation_action_ = L"show";
}
}
}
void odf_drawing_context::add_link(std::wstring href)
{
if (href.empty()) return;
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
if (event_)
{
event_->attlist_.common_xlink_attlist_.href_ = href;
event_->attlist_.common_xlink_attlist_.type_ = xlink_type::Simple;
event_->attlist_.common_xlink_attlist_.show_ = xlink_show::Embed;
event_->attlist_.common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
}
}
void odf_drawing_context::add_sound(std::wstring href)
{
presentation_event_listener * event_ = dynamic_cast<presentation_event_listener*>(impl_->current_level_.back().get());
if (event_)
{
event_->attlist_.presentation_action_ = L"sound";
}
office_element_ptr elm;
create_element(L"presentation", L"sound", elm, impl_->odf_context_);
start_element(elm);
presentation_sound *sound = dynamic_cast<presentation_sound*>(elm.get());
if (sound)
{
sound->common_xlink_attlist_.href_ = href;
sound->common_xlink_attlist_.type_ = xlink_type::Simple;
sound->common_xlink_attlist_.show_ = xlink_show::New;
sound->common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
}
end_element();
}
void odf_drawing_context::end_action()
{
end_element();
end_element();
}
void odf_drawing_context::set_text_box_min_size(double w_pt, double h_pt)
{
if (impl_->current_drawing_state_.elements_.empty()) return;
......
......@@ -144,6 +144,9 @@ public:
void start_object(std::wstring name);
void end_object();
void start_media(std::wstring name);
void end_media();
bool isLineShape();
void corrected_line_fill();
......@@ -260,6 +263,11 @@ public:
void set_bitmap_tile_translate_y(double y);
void set_bitmap_tile_translate_x(double x);
void start_action(std::wstring value);
void add_sound (std::wstring href);
void add_link (std::wstring href);
void end_action();
std::map<std::wstring, OOX::Vml::CShapeType*> m_mapVmlShapeTypes;
private:
......
......@@ -214,17 +214,7 @@ void odp_conversion_context::end_note()
current_slide().drawing_context()->end_element();
current_slide().drawing_context()->end_drawing();
}
void odp_conversion_context::start_timing()
{
anim_state anim;
anim.elm = current_slide().page_elm_;
current_slide().anim_levels.push_back(anim);
}
void odp_conversion_context::end_timing()
{
current_slide().anim_levels.pop_back();
}
}
}
......@@ -80,9 +80,6 @@ public:
void start_note(bool bMaster = false);
void end_note();
void start_timing();
void end_timing();
private:
odp_slide_context slide_context_;
......
......@@ -61,8 +61,8 @@ namespace odf_writer {
odp_page_state::odp_page_state(odf_conversion_context * Context, office_element_ptr & elm)
: context_(Context), drawing_context_(Context), comment_context_(Context)
{
page_elm_ = elm;
page_elm_ = elm;
page_properties_ = NULL;
}
void odp_page_state::set_page_id(int id)
{
......@@ -113,6 +113,8 @@ void odp_page_state::set_page_style(office_element_ptr & elm)
if (!office_page_style_)return;
page_properties_ = office_page_style_->content_.get_style_drawing_page_properties();
draw_page* page = dynamic_cast<draw_page*>(page_elm_.get());
if (page)
page->attlist_.draw_style_name_ = office_page_style_->style_name_;
......@@ -142,6 +144,19 @@ void odp_page_state::set_anim_id (int val)
//anim_levels.back().attlist->smil_begin_ = L"id" + std::to_wstring(val) + L".begin";
}
void odp_page_state::finalize_page()
{
if (transactions.empty() == false)
{
start_timing();
start_timing_par();
set_anim_duration(-1);
set_anim_restart(L"never");
set_anim_type(L"tmRoot");
end_timing_par();
end_timing();
}
}
void odp_page_state::set_anim_type(std::wstring val)
{
if (anim_levels.empty()) return;
......@@ -150,7 +165,7 @@ void odp_page_state::set_anim_type(std::wstring val)
if (val == L"tmRoot")
{
anim_levels.back().attlist->presentation_node_type_ = L"timing-root";
if (page_transaction)
if (transactions.empty() == false)
{
std::wstring slide_id = L"slide_id" + std::to_wstring(page_id_);
......@@ -161,19 +176,22 @@ void odp_page_state::set_anim_type(std::wstring val)
start_timing_par();
anim_levels.back().attlist->smil_begin_ = slide_id + L".begin";
anim_levels.back().elm->add_child_element( page_transaction );
while(!transactions.empty())
{
anim_levels.back().elm->add_child_element( transactions[0] );
transactions.erase(transactions.begin());
}
end_timing_par();
}
}
}
}
void odp_page_state::set_anim_duration(std::wstring val)
void odp_page_state::set_anim_duration(int val)
{
if (anim_levels.empty()) return;
if (!anim_levels.back().attlist)return;
//if (val == L"indefinite")
anim_levels.back().attlist->smil_dur_ = val;
anim_levels.back().attlist->smil_dur_ = odf_types::clockvalue(val);
}
void odp_page_state::set_anim_restart(std::wstring val)
......@@ -185,36 +203,93 @@ void odp_page_state::set_anim_restart(std::wstring val)
}
void odp_page_state::start_transition()
{
create_element(L"anim", L"transitionFilter", page_transaction, context_);
office_element_ptr elm;
create_element(L"anim", L"transitionFilter", elm, context_);
transactions.push_back(elm);
}
void odp_page_state::set_transition_type(int val)
{
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
if (transactions.empty()) return;
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
if (trans)
trans->attlist_.smil_type_ = odf_types::smil_transition_type((odf_types::smil_transition_type::type)val);
trans->filter_attlist_.smil_type_ = odf_types::smil_transition_type((odf_types::smil_transition_type::type)val);
}
void odp_page_state::set_transition_subtype(std::wstring val)
{
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
if (transactions.empty()) return;
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
if (trans)
trans->attlist_.smil_subtype_ = val;
trans->filter_attlist_.smil_subtype_ = val;
}
void odp_page_state::set_transition_speed(int val)
{
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
if (transactions.empty()) return;
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
if (trans)
{
if (val == 0) trans->attlist_.smil_dur_ = odf_types::clockvalue(3000);
if (val == 1) trans->attlist_.smil_dur_ = odf_types::clockvalue(4000);
if (val == 2) trans->attlist_.smil_dur_ = odf_types::clockvalue(5000);
if (val == 0)
{
if (page_properties_)
page_properties_->content_.presentation_transition_speed_ = L"fast";
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(2000);
}
if (val == 1)
{
if (page_properties_)
page_properties_->content_.presentation_transition_speed_ = L"medium";
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(3000);
}
if (val == 2)
{
if (page_properties_)
page_properties_->content_.presentation_transition_speed_ = L"slow";
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(4000);
}
}
}
void odp_page_state::set_transition_duration(int val)
{
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(page_transaction.get());
if (transactions.empty()) return;
anim_transitionFilter *trans = dynamic_cast<anim_transitionFilter*>(transactions.back().get());
if (trans)
trans->attlist_.smil_dur_ = odf_types::clockvalue(val * 1000);
trans->common_attlist_.smil_dur_ = odf_types::clockvalue(val);
}
void odp_page_state::set_transition_sound(std::wstring ref, bool loop)
{
if (transactions.empty()) return;
if (ref.empty()) return;
office_element_ptr elm;
create_element(L"anim", L"audio", elm, context_);
anim_audio *audio = dynamic_cast<anim_audio*>(elm.get());
if (audio)
{
audio->audio_attlist_.xlink_href_ = ref;
}
transactions.push_back(elm);
if (page_properties_)
{
create_element(L"presentation", L"sound", page_properties_->content_.presentation_sound_, context_);
presentation_sound *sound = dynamic_cast<presentation_sound*>(page_properties_->content_.presentation_sound_.get());
if (sound)
{
sound->common_xlink_attlist_.href_ = ref;
sound->common_xlink_attlist_.type_ = xlink_type::Simple;
sound->common_xlink_attlist_.show_ = xlink_show::New;
sound->common_xlink_attlist_.actuate_ = xlink_actuate::OnRequest;
}
}
}
void odp_page_state::start_timing_seq()
{
if (anim_levels.empty()) return;
......@@ -231,10 +306,24 @@ void odp_page_state::start_timing_seq()
anim_levels.push_back(anim);
}
void odp_page_state::end_timing_seq()
void odp_page_state::start_timing()
{
anim_levels.pop_back();
if (!anim_levels.empty()) return;
anim_state anim;
anim.elm = page_elm_;
anim_levels.push_back(anim);
}
void odp_page_state::end_timing()
{
if (anim_levels.empty()) return;
anim_levels.pop_back();
}
void odp_page_state::end_timing_seq()
{
if (anim_levels.empty()) return;
anim_levels.pop_back();
}
void odp_page_state::start_timing_par()
{
......@@ -254,8 +343,8 @@ void odp_page_state::start_timing_par()
}
void odp_page_state::end_timing_par()
{
anim_levels.pop_back();
if (anim_levels.empty()) return;
anim_levels.pop_back();
}
}
}
......@@ -31,19 +31,13 @@
*/
#pragma once
#include <string>
#include <vector>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
#include"../../../Common/DocxFormat/Source/XML/Utils.h"
#include "odf_drawing_context.h"
#include "odf_comment_context.h"
#include "office_elements_create.h"
#include "style_presentation.h"
namespace cpdoccore {
......@@ -84,7 +78,7 @@ public:
void set_layout_page(std::wstring name);
void add_child_element( const office_element_ptr & child_element);
void finalize_page();
///////////////////////////////
odf_drawing_context * drawing_context(){return &drawing_context_;}
odf_comment_context * comment_context(){return &comment_context_;}
......@@ -94,32 +88,37 @@ public:
office_element_ptr page_elm_;
office_element_ptr page_style_elm_;
std::vector<anim_state> anim_levels;
office_element_ptr page_transaction;
std::vector<anim_state> anim_levels;
std::vector<office_element_ptr> transactions;
void set_anim_id (int val);
void set_anim_type (std::wstring val);
void set_anim_duration (std::wstring val);
void set_anim_restart (std::wstring val);
void start_timing();
void start_timing_par();
void end_timing_par();
void start_timing_par();
void end_timing_par();
void start_timing_seq();
void end_timing_seq();
void start_timing_seq();
void end_timing_seq();
void set_anim_id (int val);
void set_anim_type (std::wstring val);
void set_anim_duration (int val);
void set_anim_restart (std::wstring val);
void end_timing();
void start_transition();
void set_transition_type (int val);
void set_transition_subtype (std::wstring val);
void set_transition_speed (int val);
void set_transition_duration(int val);
void set_transition_sound (std::wstring ref, bool loop);
void end_transition(){}
private:
odf_conversion_context * context_;
odf_conversion_context * context_;
odf_drawing_context drawing_context_;
odf_comment_context comment_context_;
odf_drawing_context drawing_context_;
odf_comment_context comment_context_;
style_drawing_page_properties* page_properties_;
friend class odp_slide_context;
......
......@@ -81,6 +81,7 @@ void odp_slide_context::start_page(office_element_ptr & elm)
void odp_slide_context::end_page()
{
state().drawing_context()->finalize(state().page_elm_);
state().finalize_page();
}
void odp_slide_context::remove_page()
......
......@@ -31,6 +31,7 @@
*/
#pragma once
#include <list>
#include "odp_page_state.h"
#include "odf_table_context.h"
......
......@@ -124,6 +124,8 @@ void office_annotation::create_child_element(const std::wstring & Ns, const std:
}
void office_annotation::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeDcCreator)
......@@ -186,6 +188,8 @@ void officeooo_annotation::create_child_element( const std::wstring & Ns, const
}
void officeooo_annotation::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeDcCreator)
......
......@@ -153,6 +153,7 @@ enum ElementType
typeStyleFooterStyle,
typeStyleHeaderFooterProperties,
typeStylePresentationSound,
typeStylePresentationPageLayout,
typeStylePresentationPlaceholder,
typeStyleDrawingPageProperties,
......@@ -235,6 +236,7 @@ enum ElementType
typeDrawObject,
typeDrawObjectOle,
typeDrawChart,
typeDrawPlugin,
typeDrawBase,
typeDrawShape,
......@@ -267,6 +269,9 @@ enum ElementType
typeAnimPar,
typeAnimSeq,
typeAnimTransitionFilter,
typeAnimAudio,
typeAnimCommand,
typeAnimIterator,
typeStyleGraphicPropertis,
typeStyleDrawGradient,
......
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "office_event_listeners.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "office_elements_create.h"
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore {
namespace odf_writer {
//---------------------------------------------------------------------------------------------------------------
const wchar_t * office_event_listeners::ns = L"office";
const wchar_t * office_event_listeners::name = L"event-listeners";
void office_event_listeners::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME (L"presentation", L"event-listener")
CP_CREATE_ELEMENT (presentation_event_listeners_);
else if CP_CHECK_NAME (L"script", L"event-listener")
CP_CREATE_ELEMENT (script_event_listeners_);
}
void office_event_listeners::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typePresentationEventListener)
{
presentation_event_listeners_.push_back(child_element);
}
else if (type == typeScriptEventListener)
{
script_event_listeners_.push_back(child_element);
}
}
void office_event_listeners::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (size_t i = 0; i < presentation_event_listeners_.size(); i++)
{
presentation_event_listeners_[i]->serialize(CP_XML_STREAM());
}
for (size_t i = 0; i < script_event_listeners_.size(); i++)
{
script_event_listeners_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//---------------------------------------------------------------------------------------------------------------
void presentation_event_listener_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"script:event-name", script_event_name_);
CP_XML_ATTR_OPT(L"presentation:action", presentation_action_);
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
}
//---------------------------------------------------------------------------------------------------------------
const wchar_t * presentation_event_listener::ns = L"presentation";
const wchar_t * presentation_event_listener::name = L"event-listener";
void presentation_event_listener::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
if CP_CHECK_NAME(L"presentation", L"sound")
CP_CREATE_ELEMENT(presentation_sound_);
else
CP_NOT_APPLICABLE_ELM();
}
void presentation_event_listener::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeStylePresentationSound)
{
presentation_sound_ = child_element;
}
}
void presentation_event_listener::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
attlist_.serialize(CP_GET_XML_NODE());
if (presentation_sound_)
presentation_sound_->serialize(CP_XML_STREAM());
}
}
}
// script:event-listener
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * script_event_listener::ns = L"script";
const wchar_t * script_event_listener::name = L"event-listener";
void script_event_listener::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void script_event_listener::add_child_element( const office_element_ptr & child_element)
{
content_.push_back(child_element);
}
void script_event_listener::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
}
}
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
#include "common_attlists.h"
namespace cpdoccore {
namespace odf_writer {
class office_event_listeners : public office_element_impl<office_event_listeners>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeEventListeners;
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 presentation_event_listeners_;
office_element_ptr_array script_event_listeners_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_event_listeners);
//-------------------------------------------------------------------------------------
class presentation_event_listener_attlist
{
public:
void serialize(CP_ATTR_NODE);
odf_types::common_xlink_attlist common_xlink_attlist_;
_CP_OPT(std::wstring) script_event_name_;
_CP_OPT(std::wstring) presentation_action_;
//presentation:verb
//presentation:start-scale
//presentation:speed
//presentation:direction
//presentation:effect
};
class presentation_event_listener : public office_element_impl<presentation_event_listener>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typePresentationEventListener;
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_;
office_element_ptr presentation_sound_;
presentation_event_listener_attlist attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_event_listener);
// script:event-listeners_
class script_event_listener : public office_element_impl<presentation_event_listener>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeScriptEventListener;
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_;
};
CP_REGISTER_OFFICE_ELEMENT2(script_event_listener);
}
}
\ No newline at end of file
......@@ -61,6 +61,8 @@ void office_presentation::create_child_element(const std::wstring & Ns, const st
void office_presentation::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typePresentationDateTimeDecl)
......@@ -83,7 +85,7 @@ void office_presentation::serialize(std::wostream & _Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (int i = 0; i < pages_.size(); i++)
for (size_t i = 0; i < pages_.size(); i++)
{
pages_[i]->serialize(CP_XML_STREAM());
}
......
......@@ -56,8 +56,6 @@ public:
virtual void serialize(std::wostream & _Wostream);
public:
office_element_ptr_array date_time_decls_;
office_element_ptr_array footer_decls_;
......
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "office_scripts.h"
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
#include "office_elements_create.h"
#include <cpdoccore/xml/simple_xml_writer.h>
namespace cpdoccore {
namespace odf_writer {
const wchar_t * office_scripts::ns = L"office";
const wchar_t * office_scripts::name = L"scripts";
void office_scripts::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void office_scripts::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
content_.push_back(child_element);
}
void office_scripts::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
//-------------------------------------------------------------------------------------------
const wchar_t * office_script::ns = L"office";
const wchar_t * office_script::name = L"script";
void office_script::create_child_element(const std::wstring & Ns, const std::wstring & Name)
{
CP_CREATE_ELEMENT(content_);
}
void office_script::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
content_.push_back(child_element);
}
void office_script::serialize(std::wostream & _Wostream)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"script:language", script_language_);
for (size_t i = 0; i < content_.size(); i++)
{
content_[i]->serialize(CP_XML_STREAM());
}
}
}
}
}
}
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements.h"
#include "office_elements_create.h"
namespace cpdoccore {
namespace odf_writer {
class office_scripts : public office_element_impl<office_scripts>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeScripts;
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_;
// office-event-listeners ?
};
CP_REGISTER_OFFICE_ELEMENT2(office_scripts);
class office_script : public office_element_impl<office_script>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeOfficeScript;
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);
_CP_OPT(std::wstring) script_language_;
office_element_ptr_array content_;
};
CP_REGISTER_OFFICE_ELEMENT2(office_script);
}
}
\ No newline at end of file
......@@ -161,6 +161,8 @@ void office_change_info::create_child_element( const std::wstring & Ns, const st
}
void office_change_info::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeDcCreator)
......
......@@ -435,6 +435,8 @@ void text_note::create_child_element( const std::wstring & Ns, const std::wstri
}
void text_note::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextNoteCitation)
......@@ -487,6 +489,8 @@ void text_ruby::create_child_element( const std::wstring & Ns, const std::wstrin
}
void text_ruby::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextRubyBase)
......
......@@ -162,6 +162,8 @@ void paragraph_format_properties::create_child_element(const std::wstring & Ns,
}
void paragraph_format_properties::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeStyleTabStops)
......
......@@ -42,7 +42,7 @@ namespace cpdoccore {
namespace odf_writer {
//////////////////////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------------
const wchar_t * presentation_placeholder::ns = L"presentation";
const wchar_t * presentation_placeholder::name = L"placeholder";
......@@ -62,6 +62,20 @@ void presentation_placeholder::serialize(std::wostream & strm)
}
}
}
//----------------------------------------------------------------------------------
const wchar_t * presentation_sound::ns = L"presentation";
const wchar_t * presentation_sound::name = L"sound";
void presentation_sound::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE_SIMPLE()
{
common_xlink_attlist_.serialize(CP_GET_XML_NODE());
}
}
}
//-----------------------------------------------------------------------------------------------------------------------
void drawing_page_properties::serialize(std::wostream & strm, const wchar_t * ns, const wchar_t * name )
......@@ -85,17 +99,20 @@ void drawing_page_properties::serialize(std::wostream & strm, const wchar_t * ns
CP_XML_ATTR_OPT(L"presentation:display-page-number",presentation_display_page_number_);
CP_XML_ATTR_OPT(L"presentation:display-date-time", presentation_display_date_time_);
CP_XML_ATTR_OPT(L"presentation:display-header", presentation_display_header_);
if (presentation_sound_)
presentation_sound_->serialize(CP_XML_STREAM());
}
}
}
//-----------------------------------------------------------------------------------------------------------------------
const wchar_t * style_drawing_page_properties::ns = L"style";
const wchar_t * style_drawing_page_properties::ns = L"style";
const wchar_t * style_drawing_page_properties::name = L"drawing-page-properties";
void style_drawing_page_properties::serialize(std::wostream & strm)
{
content_.serialize(strm,ns,name);
content_.serialize(strm, ns, name);
}
}
......
......@@ -74,11 +74,33 @@ public:
CP_REGISTER_OFFICE_ELEMENT2(presentation_placeholder);
//////////////////////////////////////////////
//----------------------------------------------------------------------------------
class presentation_sound : public office_element_impl<presentation_sound>
{
public:
static const wchar_t * ns;
static const wchar_t * name;
static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeStylePresentationSound;
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){}
virtual void serialize(std::wostream & strm);
odf_types::common_xlink_attlist common_xlink_attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(presentation_sound);
//----------------------------------------------------------------------------------
class drawing_page_properties
{
public:
void apply_from(const drawing_page_properties & Other);
void serialize(std::wostream & strm, const wchar_t * ns, const wchar_t * name );
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
......@@ -87,23 +109,24 @@ public:
_CP_OPT(odf_types::length_or_percent) draw_fill_image_height_;
_CP_OPT(odf_types::length_or_percent) draw_fill_image_width_;
_CP_OPT(std::wstring) draw_background_size_;//"border" or "full"
_CP_OPT(std::wstring) draw_background_size_; //"border" or "full"
_CP_OPT(std::wstring) presentation_transition_type_;//manual, automatic, semi-automatic (переход отделен от эффектов кликом)
_CP_OPT(std::wstring) presentation_transition_style_;//none, fade, move, uncover,clockwise, .... игнор если smil
_CP_OPT(std::wstring) presentation_transition_speed_;//slow, medium, fast
_CP_OPT(std::wstring) presentation_transition_type_; //manual, automatic, semi-automatic (переход отделен от эффектов кликом)
_CP_OPT(std::wstring) presentation_transition_style_; //none, fade, move, uncover,clockwise, .... игнор если smil
_CP_OPT(std::wstring) presentation_transition_speed_; //slow, medium, fast
_CP_OPT(bool) presentation_display_footer_;
_CP_OPT(bool) presentation_display_page_number_;
_CP_OPT(bool) presentation_display_date_time_;
_CP_OPT(bool) presentation_display_header_;
_CP_OPT(std::wstring) presentation_page_duration_;
office_element_ptr presentation_sound_;
//presentation:background-objects-visible
//presentation:background-visible
//style:repeat
//presentation:page-duration
//presentation:visibility.
//presentation:sound.
//presentation:visibility
//draw:background-size
};
......
......@@ -184,6 +184,8 @@ void table_table::create_child_element(const std::wstring & Ns, const std::wstri
void table_table::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableSource)
......@@ -277,6 +279,8 @@ void table_table_columns::create_child_element(const std::wstring & Ns, const st
}
void table_table_columns::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableColumn)
......@@ -312,6 +316,8 @@ void table_table_header_columns::create_child_element( const std::wstring & Ns,
}
void table_table_header_columns::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableColumn)
......@@ -348,6 +354,8 @@ void table_columns::create_child_element( const std::wstring & Ns, const std::ws
}
void table_columns::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableColumns)
......@@ -400,6 +408,8 @@ void table_columns_no_group::create_child_element( const std::wstring & Ns, con
}
void table_columns_no_group::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableColumns || type == typeTableTableColumn)
......@@ -489,6 +499,8 @@ void table_columns_and_groups::create_child_element(const std::wstring & Ns, con
}
void table_columns_and_groups::add_child_element( const office_element_ptr & child_element, odf_conversion_context * Context)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableColumnGroup)
......@@ -608,6 +620,8 @@ void table_table_row::create_child_element( const std::wstring & Ns, const std::
}
void table_table_row::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableCell || type == typeTableCoveredTableCell )
......@@ -672,6 +686,8 @@ void table_table_header_rows::create_child_element( const std::wstring & Ns, con
}
void table_table_header_rows::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableRow)
......@@ -709,6 +725,8 @@ void table_rows::create_child_element(const std::wstring & Ns, const std::wstrin
}
void table_rows::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableRows)
......@@ -761,6 +779,8 @@ void table_rows_no_group::create_child_element( const std::wstring & Ns, const s
}
void table_rows_no_group::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableRows || type == typeTableTableRow)
......@@ -816,6 +836,8 @@ void table_rows_and_groups::create_child_element( const std::wstring & Ns, const
}
void table_rows_and_groups::add_child_element( const office_element_ptr & child_element, odf_conversion_context * Context)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableTableRowGroup)
......
......@@ -64,7 +64,9 @@ void table_database_ranges::create_child_element(const std::wstring & Ns, const
void table_database_ranges::add_child_element( const office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableDatabaseRange)
{
......
......@@ -66,7 +66,9 @@ void table_named_expressions::create_child_element(const std::wstring & Ns, cons
void table_named_expressions::add_child_element( const office_element_ptr & child_element)
{
ElementType type = child_element->get_type();
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTableNamedRange)
{
......
......@@ -255,6 +255,8 @@ void text_section::create_child_element( const std::wstring & Ns, const std::wst
void text_section::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeTextSectionSource)
......@@ -510,6 +512,8 @@ void text_unknown_change::create_child_element(const std::wstring & Ns, const st
void text_unknown_change::add_child_element( const office_element_ptr & child_element)
{
if (!child_element) return;
ElementType type = child_element->get_type();
if (type == typeOfficeChangeInfo)
......
......@@ -171,7 +171,6 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
{
if (!oox_picture)return;
bool bImage = true;
if (oox_picture->spPr.Geometry.is_init())
{
int type = SimpleTypes::shapetypeRect;
......@@ -203,7 +202,33 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
return;
}
}
//--------------------------------------------------------------------------------------
if (oox_picture->nvPicPr.nvPr.media.is_init())
{
if (oox_picture->nvPicPr.nvPr.media.is<PPTX::Logic::MediaFile>())
{
PPTX::Logic::MediaFile & media = oox_picture->nvPicPr.nvPr.media.as<PPTX::Logic::MediaFile>();
std::wstring sID = media.link.get();
std::wstring pathMedia = find_link_by_id(sID, 3);
std::wstring odf_ref = odf_context()->add_media(pathMedia);
if (!odf_ref.empty())
{
odf_context()->drawing_context()->start_media(odf_ref);
//... params
OoxConverter::convert(&oox_picture->nvPicPr.cNvPr);
OoxConverter::convert(&oox_picture->spPr, oox_picture->style.GetPointer());
odf_context()->drawing_context()->end_media();
return;
}
}
}
//--------------------------------------------------------------------------------------
std::wstring odf_ref;
std::wstring pathImage;
if (oox_picture->blipFill.blip.IsInit())
......@@ -222,7 +247,6 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
bEmbedded = false;
}
}
odf_context()->drawing_context()->start_image(odf_ref);
{
double Width = 0, Height = 0;
......@@ -1120,6 +1144,21 @@ void OoxConverter::convert(PPTX::Logic::CNvPr *oox_cnvPr)
}
if (oox_cnvPr->hlinkClick.IsInit())
{
odf_context()->drawing_context()->start_action(oox_cnvPr->hlinkClick->action.get_value_or(L""));
if (oox_cnvPr->hlinkClick->snd.IsInit())
{
std::wstring sound = find_link_by_id(oox_cnvPr->hlinkClick->snd->embed.get(), 3);
odf_context()->drawing_context()->add_sound(sound);
}
if (oox_cnvPr->hlinkClick->id.IsInit())
{
std::wstring hlink = find_link_by_id(oox_cnvPr->hlinkClick->id.get(), 2);
odf_context()->drawing_context()->add_link(hlink);
}
odf_context()->drawing_context()->end_action();
}
//nullable_string title;
//nullable<Hyperlink> hlinkHover;
......@@ -1146,8 +1185,11 @@ void OoxConverter::convert(PPTX::Logic::NvCxnSpPr *oox_nvSpPr)
void OoxConverter::convert(PPTX::Logic::NvPr *oox_nvPr)
{
if (!oox_nvPr) return;
//ph уровнем выше
}
void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_props, int level)
......
......@@ -304,28 +304,31 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
_CP_LOG << L"[error] : no convert element(" << (oox_unknown ? oox_unknown->getType() : -1 ) << L")\n";
}
}
std::wstring OoxConverter::find_link_by (smart_ptr<OOX::File> & oFile, int type)
{
if (!oFile.IsInit()) return L"";
std::wstring ref;
if (type == 1 && OOX::FileTypes::Image == oFile->type())
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
//void OoxConverter::convert(OOX::Drawing::CLockedCanvas *oox_canvas)
//{
// if (oox_canvas == NULL)return;
//
// odf_context()->drawing_context()->start_group();
// if (oox_canvas->m_oNvGroupSpPr.IsInit() && oox_canvas->m_oNvGroupSpPr->m_oCNvPr.IsInit())
// {
// if (oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_sName.IsInit())
// odf_context()->drawing_context()->set_group_name(*oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_sName);
// if (oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_oId.IsInit())
// odf_context()->drawing_context()->set_group_z_order(oox_canvas->m_oNvGroupSpPr->m_oCNvPr->m_oId->GetValue());
// }
// convert(oox_canvas->m_oGroupSpPr.GetPointer());
// convert(oox_canvas->m_oSpPr.GetPointer());
//
// for (size_t i = 0; i < oox_canvas->m_arrItems.size(); i++)
// {
// convert(oox_canvas->m_arrItems[i]);
// }
// odf_context()->drawing_context()->end_group();
//}
ref = pImage->filename().GetPath();
}
if (type == 2 && OOX::FileTypes::HyperLink == oFile->type())
{
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
if (pHyperlink->bHyperlink)
ref = pHyperlink->Uri().GetPath();
}
if (type == 3)
{
OOX::Media* pMedia = (OOX::Media*)oFile.operator->();
ref = pMedia->filename().GetPath();
}
return ref;
}
bool OoxConverter::convert(std::wstring sSchemeColor, DWORD & argb)
{
......
......@@ -360,6 +360,7 @@ public:
virtual PPTX::Theme *oox_theme() = 0;
virtual PPTX::Logic::ClrMap *oox_clrMap() {return NULL;}
std::wstring find_link_by (NSCommon::smart_ptr<OOX::File> & oFile, int type);
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;
......
......@@ -131,48 +131,23 @@ NSCommon::smart_ptr<OOX::File> DocxConverter::find_file_by_id(std::wstring sId)
std::wstring DocxConverter::find_link_by_id (std::wstring sId, int type)
{
OOX::CDocument *oox_doc = docx_document->GetDocument();
if (!docx_document) return L"";
if (oox_doc == NULL)return L"";
std::wstring ref;
std::wstring ref;
smart_ptr<OOX::File> oFile;
if (ref.empty() && oox_current_child_document)
if (oox_current_child_document)
{
smart_ptr<OOX::File> oFile = oox_current_child_document->Find(sId);
if (oFile.IsInit())
{
if (type==1 && OOX::FileTypes::Image == oFile->type())
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
ref = pImage->filename().GetPath();
}
if (type==2 && oFile.IsInit() && OOX::FileTypes::HyperLink == oFile->type())
{
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
ref = pHyperlink->Uri().GetPath();
}
}
oFile = oox_current_child_document->Find(sId);
ref = OoxConverter::find_link_by(oFile, type);
}
if (!ref.empty()) return ref;
smart_ptr<OOX::File> oFile = docx_document->GetDocument()->Find(sId);
if (ref.empty() && oFile.IsInit())
{
if (type==1 && OOX::FileTypes::Image == oFile->type())
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
ref = pImage->filename().GetPath();
}
if (type == 2 && OOX::FileTypes::HyperLink == oFile->type())
{
OOX::HyperLink* pHyperlink = (OOX::HyperLink*)oFile.operator->();
ref = pHyperlink->Uri().GetPath();
}
}
OOX::CDocument *oox_doc = docx_document->GetDocument();
if (oox_doc == NULL) return L"";
oFile = oox_doc->Find(sId);
ref = OoxConverter::find_link_by(oFile, type);
return ref;
}
......
......@@ -115,30 +115,20 @@ smart_ptr<OOX::File> XlsxConverter::find_file_by_id(std::wstring sId)
}
std::wstring XlsxConverter::find_link_by_id (std::wstring sId, int type)
{
std::wstring ref;
smart_ptr<OOX::File> oFile;
std::wstring ref;
if (type == 1)
if (xlsx_current_container)
{
if (ref.empty() && xlsx_current_container)
{
smart_ptr<OOX::File> oFile = xlsx_current_container->Find(sId);
if (oFile.IsInit() && OOX::FileTypes::Image == oFile->type())
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
ref = pImage->filename().GetPath();
}
}
if (ref.empty() && oox_current_child_document)
{
smart_ptr<OOX::File> oFile = oox_current_child_document->Find(sId);
if (oFile.IsInit() && OOX::FileTypes::Image == oFile->type())
{
OOX::Image* pImage = (OOX::Image*)oFile.operator->();
oFile = xlsx_current_container->Find(sId);
ref = OoxConverter::find_link_by(oFile, type);
}
if (!ref.empty()) return ref;
ref = pImage->filename().GetPath();
}
}
if (oox_current_child_document)
{
oFile = oox_current_child_document->Find(sId);
ref = OoxConverter::find_link_by(oFile, type);
}
return ref;
}
......
......@@ -401,6 +401,14 @@
RelativePath="..\OdfFormat\office_chart.h"
>
</File>
<File
RelativePath="..\OdfFormat\office_event_listeners.cpp"
>
</File>
<File
RelativePath="..\OdfFormat\office_event_listeners.h"
>
</File>
<File
RelativePath="..\OdfFormat\office_presentation.cpp"
>
......@@ -409,6 +417,14 @@
RelativePath="..\OdfFormat\office_presentation.h"
>
</File>
<File
RelativePath="..\OdfFormat\office_scripts.cpp"
>
</File>
<File
RelativePath="..\OdfFormat\office_scripts.h"
>
</File>
<File
RelativePath="..\OdfFormat\office_settings.cpp"
>
......
......@@ -114,9 +114,14 @@ namespace PPTX
pRelation->Type() == OOX::Presentation::FileTypes::Slide))
{// + external audio, video ...
smart_ptr<OOX::File> file;
smart_ptr<OOX::File> file = smart_ptr<OOX::File>(new OOX::HyperLink(pRelation->Target()));
file = smart_ptr<OOX::File>(new OOX::HyperLink(pRelation->Target()));
if (pRelation->Type() == OOX::Presentation::FileTypes::Slide)
{
OOX::HyperLink *link = dynamic_cast<OOX::HyperLink*>(file.operator->());
if (link)
link->bHyperlink = false;
}
normPath = pRelation->Target();
Add(pRelation->rId(), file);
......
......@@ -52,8 +52,6 @@ namespace OOX
~External()
{
}
public:
virtual void read(const CPath& uri)
{
m_uri = uri;
......@@ -61,9 +59,7 @@ namespace OOX
virtual void write(const CPath& filename, const CPath& directory, CContentTypes& content) const
{
}
public:
CPath Uri() const
CPath Uri() const
{
return m_uri;
}
......
......@@ -43,16 +43,16 @@ namespace OOX
public:
HyperLink()
{
bHyperlink = true;
}
HyperLink(const CPath& uri)
{
bHyperlink = true;
read(uri);
}
~HyperLink()
{
}
public:
virtual const FileType type() const
{
return FileTypes::HyperLink;
......@@ -65,6 +65,8 @@ namespace OOX
{
return type().DefaultFileName();
}
bool bHyperlink; // in pptx link to slide perhaps
};
} // namespace OOX
......
......@@ -45,6 +45,7 @@ namespace OOX
}
Audio(const CPath& filename)
{
read(filename);
}
virtual ~Audio()
{
......
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