diff --git a/OdfFile/DataTypes/common_attlists.h b/OdfFile/DataTypes/common_attlists.h index 141a90029b..040e69ad23 100644 --- a/OdfFile/DataTypes/common_attlists.h +++ b/OdfFile/DataTypes/common_attlists.h @@ -52,6 +52,7 @@ #include "anchortype.h" #include "linewidth.h" #include "presentationclass.h" +#include "presentationnodetype.h" #include "xlink.h" #include "drawfill.h" #include "clockvalue.h" @@ -592,14 +593,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(odf_types::presentation_node_type) presentation_node_type_; - _CP_OPT(std::wstring) smil_direction_; - _CP_OPT(std::wstring) smil_restart_; - _CP_OPT(odf_types::clockvalue) smil_dur_; + _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_; + _CP_OPT(std::wstring) smil_begin_; + _CP_OPT(std::wstring) smil_end_; }; class section_attlists diff --git a/OdfFile/DataTypes/presentationnodetype.cpp b/OdfFile/DataTypes/presentationnodetype.cpp new file mode 100644 index 0000000000..13e49edad1 --- /dev/null +++ b/OdfFile/DataTypes/presentationnodetype.cpp @@ -0,0 +1,69 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * 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 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * 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 "presentationnodetype.h" + +#include +#include + +namespace cpdoccore { namespace odf_types { + + std::wostream& operator << (std::wostream& _Wostream, const presentation_node_type& _Val) + { + switch (_Val.get_type()) + { + case presentation_node_type::default : _Wostream << L"default"; break; + case presentation_node_type::after_previous : _Wostream << L"after-previous"; break; + case presentation_node_type::interactive_sequence : _Wostream << L"interactive-sequence"; break; + case presentation_node_type::main_sequence : _Wostream << L"main-sequence"; break; + case presentation_node_type::on_click : _Wostream << L"on-click"; break; + case presentation_node_type::timing_root : _Wostream << L"timing-root"; break; + case presentation_node_type::with_previous : _Wostream << L"with-previous"; break; + } + return _Wostream; + } + + presentation_node_type presentation_node_type::parse(const std::wstring& Str) + { + if (Str == L"default") return presentation_node_type(default); + else if (Str == L"after-previous") return presentation_node_type(after_previous); + else if (Str == L"interactive-sequence") return presentation_node_type(interactive_sequence); + else if (Str == L"main-sequence") return presentation_node_type(main_sequence); + else if (Str == L"on-click") return presentation_node_type(on_click); + else if (Str == L"timing-root") return presentation_node_type(timing_root); + else if (Str == L"with-previous") return presentation_node_type(with_previous); + + return presentation_node_type::none; + } + +} // namespace odf_types +} // namespace cpdoccore diff --git a/OdfFile/DataTypes/presentationnodetype.h b/OdfFile/DataTypes/presentationnodetype.h new file mode 100644 index 0000000000..e6382081be --- /dev/null +++ b/OdfFile/DataTypes/presentationnodetype.h @@ -0,0 +1,75 @@ +/* + * (c) Copyright Ascensio System SIA 2010-2023 + * + * 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 20A-6 Ernesta Birznieka-Upish + * street, Riga, Latvia, EU, LV-1050. + * + * 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 +#include "odfattributes.h" + +namespace cpdoccore { namespace odf_types { + +class presentation_node_type +{ +public: + enum type + { + none, + + default, + after_previous, + interactive_sequence, + main_sequence, + on_click, + timing_root, + with_previous + }; + + presentation_node_type() {} + + presentation_node_type(type _Type) : type_(_Type) + {} + + type get_type() const + { + return type_; + }; + + static presentation_node_type parse(const std::wstring& Str); + +private: + type type_; +}; +std::wostream& operator << (std::wostream& _Wostream, const presentation_node_type& _Val); + + +} // namespace odf_types + APPLY_PARSE_XML_ATTRIBUTES(odf_types::presentation_node_type); +} // namespace cpdoccore diff --git a/OdfFile/DataTypes/smil_attributename.cpp b/OdfFile/DataTypes/smil_attributename.cpp index 61663e1ea5..5f52c1aca2 100644 --- a/OdfFile/DataTypes/smil_attributename.cpp +++ b/OdfFile/DataTypes/smil_attributename.cpp @@ -84,7 +84,7 @@ namespace cpdoccore { namespace odf_types { case smil_attribute_name::charUnderline : _Wostream << L"charUnderline" ; break; case smil_attribute_name::charWeight : _Wostream << L"charWeight" ; break; case smil_attribute_name::color : _Wostream << L"color" ; break; - case smil_attribute_name::fill : _Wostream << L"fill"; break; + case smil_attribute_name::fill : _Wostream << L"fill" ; break; case smil_attribute_name::fillColor : _Wostream << L"fillColor" ; break; case smil_attribute_name::fillStyle : _Wostream << L"fillStyle" ; break; case smil_attribute_name::height : _Wostream << L"height" ; break; diff --git a/OdfFile/Reader/Converter/pptx_animation_context.cpp b/OdfFile/Reader/Converter/pptx_animation_context.cpp index 292d36b847..3b1c02b414 100644 --- a/OdfFile/Reader/Converter/pptx_animation_context.cpp +++ b/OdfFile/Reader/Converter/pptx_animation_context.cpp @@ -928,11 +928,8 @@ namespace oox { { CP_XML_NODE(L"p:cTn") { - if (PresentationNodeType && PresentationNodeType.value() == L"main-sequence") - { - CP_XML_ATTR(L"dur", L"indefinite"); - CP_XML_ATTR(L"nodeType", L"mainSeq"); - } + if (PresentationNodeType) CP_XML_ATTR(L"nodeType", PresentationNodeType.value()); + if (Duration) CP_XML_ATTR(L"dur", Duration.value()); if (AnimParArray.size()) { @@ -945,6 +942,28 @@ namespace oox { } } } + CP_XML_NODE(L"p:prevCondLst") + { + CP_XML_NODE(L"p:cond") + { + CP_XML_ATTR(L"evt", L"onPrev"); + CP_XML_NODE(L"p:tgtEl") + { + CP_XML_NODE(L"p:sldTgt"); + } + } + } + CP_XML_NODE(L"p:nextCondLst") + { + CP_XML_NODE(L"p:cond") + { + CP_XML_ATTR(L"evt", L"onNext"); + CP_XML_NODE(L"p:tgtEl") + { + CP_XML_NODE(L"p:sldTgt"); + } + } + } } } } @@ -990,7 +1009,8 @@ namespace oox { { CP_XML_NODE(L"p:attrName") { - CP_XML_STREAM() << AttributeName.value(); + std::wstring attibuteName = L"\b" + AttributeName.value(); + CP_XML_STREAM() << attibuteName; } } } @@ -1124,7 +1144,8 @@ namespace oox { { CP_XML_NODE(L"p:attrName") { - CP_XML_STREAM() << AttributeName; + std::wstring attibuteName = L"\b" + AttributeName.value(); + CP_XML_STREAM() << attibuteName; } } } @@ -1198,7 +1219,8 @@ namespace oox { { CP_XML_NODE(L"p:attrName") { - CP_XML_STREAM() << AttributeName.value(); + std::wstring attributeName = L"\b" + AttributeName.value(); + CP_XML_STREAM() << attributeName; } } } diff --git a/OdfFile/Reader/Format/anim_elements.cpp b/OdfFile/Reader/Format/anim_elements.cpp index eee28e5960..de89f28dcd 100644 --- a/OdfFile/Reader/Format/anim_elements.cpp +++ b/OdfFile/Reader/Format/anim_elements.cpp @@ -282,7 +282,7 @@ static std::wstring pptx_convert_smil_attribute_name(const odf_types::smil_attri case smil_attribute_name::fill: return L"fill.type"; case smil_attribute_name::fillColor: return L"fillcolor"; case smil_attribute_name::fillStyle: return L""; - case smil_attribute_name::height: return L""; + case smil_attribute_name::height: return L"ppt_h"; case smil_attribute_name::lineColor: return L""; case smil_attribute_name::lineStyle: return L""; case smil_attribute_name::opacity: return L"style.opacity"; @@ -298,6 +298,24 @@ static std::wstring pptx_convert_smil_attribute_name(const odf_types::smil_attri return L""; } +static std::wstring pptx_convert_presentation_node_type(const odf_types::presentation_node_type& presentation_node_type_) +{ + using namespace odf_types; + + switch (presentation_node_type_.get_type()) + { + case presentation_node_type::default : return L"clickEffect"; + case presentation_node_type::after_previous : return L"afterEffect"; + case presentation_node_type::interactive_sequence : return L"interactiveSeq"; + case presentation_node_type::main_sequence : return L"mainSeq"; + case presentation_node_type::on_click : return L"clickEffect"; + case presentation_node_type::timing_root : return L"tmRoot"; + case presentation_node_type::with_previous : return L"withEffect"; + } + + return L"clickEffect"; +} + static std::wstring pptx_convert_animation_function(std::wstring animation_function) { boost::replace_all(animation_function, L"x", L"#ppt_x"); @@ -310,12 +328,13 @@ static std::wstring pptx_convert_animation_function(std::wstring animation_funct static std::wstring pptx_convert_smil_begin(const std::wstring& smil_begin) { + if(smil_begin == L"next") + return L"indefinite"; + std::wstring delay; clockvalue delayClockvalue = clockvalue::parse(smil_begin); if (delayClockvalue.get_value() != -1) delay = boost::lexical_cast(delayClockvalue.get_value()); - else - delay = L"indefinite"; return delay; } @@ -360,10 +379,23 @@ void anim_par::pptx_convert(oox::pptx_conversion_context & Context) if (common_attlist_.presentation_node_type_) { - if (common_attlist_.presentation_node_type_.value() == L"timing-root") presentationNodeType = L"tmRoot"; - else if (common_attlist_.presentation_node_type_.value() == L"on-click") presentationNodeType = L"clickEffect"; - else if (common_attlist_.presentation_node_type_.value() == L"after-previous") presentationNodeType = L"afterEffect"; - else if (common_attlist_.presentation_node_type_.value() == L"with-previous") presentationNodeType = L"withEffect"; + switch (common_attlist_.presentation_node_type_.value().get_type()) + { + case odf_types::presentation_node_type::timing_root: + presentationNodeType = L"tmRoot"; + break; + case odf_types::presentation_node_type::on_click: + presentationNodeType = L"clickEffect"; + break; + case odf_types::presentation_node_type::after_previous: + presentationNodeType = L"afterEffect"; + break; + case odf_types::presentation_node_type::with_previous: + presentationNodeType = L"withEffect"; + break; + } + + presentationNodeType = pptx_convert_presentation_node_type(common_attlist_.presentation_node_type_.value()); } if (common_attlist_.smil_direction_) @@ -494,14 +526,23 @@ void anim_seq::add_attributes( const xml::attributes_wc_ptr & Attributes ) void anim_seq::pptx_convert(oox::pptx_conversion_context & Context) { + _CP_OPT(std::wstring) presentationNodeType; + _CP_OPT(int) duration; + + if (attlist_.presentation_node_type_) + presentationNodeType = pptx_convert_presentation_node_type(attlist_.presentation_node_type_.value()); + + if (attlist_.smil_dur_) + duration = attlist_.smil_dur_->get_value(); + oox::pptx_animation_context& animationContext = Context.get_slide_context().get_animation_context(); animationContext.start_seq_animation(); - if (attlist_.presentation_node_type_) animationContext.set_seq_animation_presentation_node_type(attlist_.presentation_node_type_.value()); + if (presentationNodeType) animationContext.set_seq_animation_presentation_node_type(presentationNodeType.value()); if (attlist_.smil_direction_) animationContext.set_seq_animation_direction(attlist_.smil_direction_.value()); if (attlist_.smil_restart_) animationContext.set_seq_animation_restart(attlist_.smil_restart_.value()); - if (attlist_.smil_dur_) animationContext.set_seq_animation_dur(attlist_.smil_dur_.value().get_value()); + if (duration) animationContext.set_seq_animation_dur(duration.value()); if (attlist_.smil_begin_) animationContext.set_seq_animation_delay(attlist_.smil_begin_.value()); if (attlist_.smil_end_) animationContext.set_seq_animation_end(attlist_.smil_end_.value()); diff --git a/OdfFile/Writer/Format/odp_page_state.cpp b/OdfFile/Writer/Format/odp_page_state.cpp index 005033e401..9a78965f10 100644 --- a/OdfFile/Writer/Format/odp_page_state.cpp +++ b/OdfFile/Writer/Format/odp_page_state.cpp @@ -180,7 +180,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"; + anim_levels.back().attlist->presentation_node_type_ = presentation_node_type::timing_root; if (transactions.empty() == false) { std::wstring slide_id = L"slide" + std::to_wstring(page_id_) + L"id";