/* * Copyright (C) Ascensio System SIA, 2009-2026 * * 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, together with the * additional terms provided in the LICENSE file. * * 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: https://www.gnu.org/licenses/agpl-3.0.html * * You can contact Ascensio System SIA by email at info@onlyoffice.com * or by postal mail at 20A-6 Ernesta Birznieka-Upisha Street, Riga, * LV-1050, Latvia, European Union. * * The interactive user interfaces in modified versions of the Program * are required to display Appropriate Legal Notices in accordance with * Section 5 of the GNU AGPL version 3. * * No trademark rights are granted under this License. * * All non-code elements of the Product, including illustrations, * icon sets, and technical writing content, are licensed under the * Creative Commons Attribution-ShareAlike 4.0 International License: * https://creativecommons.org/licenses/by-sa/4.0/legalcode * * This license applies only to such non-code elements and does not * modify or replace the licensing terms applicable to the Program's * source code, which remains licensed under the GNU Affero General * Public License v3. * * SPDX-License-Identifier: AGPL-3.0-only */ #include "style_presentation.h" #include "odfcontext.h" #include "odf_document.h" #include #include #include "calcs_styles.h" namespace cpdoccore { using namespace odf_types; namespace odf_reader { const wchar_t* presentation_placeholder::ns = L"presentation"; const wchar_t* presentation_placeholder::name = L"placeholder"; void presentation_placeholder::add_attributes(const xml::attributes_wc_ptr& Attributes) { CP_APPLY_ATTR(L"presentation:object", presentation_object_); CP_APPLY_ATTR(L"svg:height", svg_height_); CP_APPLY_ATTR(L"svg:width", svg_width_); CP_APPLY_ATTR(L"svg:x", svg_x_); CP_APPLY_ATTR(L"svg:y", svg_y_); CP_APPLY_ATTR(L"draw:text-style-name", text_style_name_); } void presentation_placeholder::add_child_element(xml::sax* Reader, const std::wstring& Ns, const std::wstring& Name) { CP_NOT_APPLICABLE_ELM(); } void presentation_placeholder::pptx_convert(oox::pptx_conversion_context& Context) { double cx = svg_width_.get_value_or(length(0)).get_value_unit(length::pt); double cy = svg_height_.get_value_or(length(0)).get_value_unit(length::pt); //not yet clear what negative width means ... cx = fabs(cx); cy = fabs(cy); double x = svg_x_.get_value_or(length(0)).get_value_unit(length::pt); double y = svg_y_.get_value_or(length(0)).get_value_unit(length::pt); Context.get_slide_context().start_shape(2);//rect Context.get_slide_context().set_name(L"place_holder"); if (text_style_name_ && !text_style_name_->empty()) { Context.get_text_context().start_base_style(*text_style_name_, odf_types::style_family::Paragraph); } Context.get_slide_context().set_rect(cx, cy, x, y); if (presentation_object_) { Context.get_slide_context().set_placeHolder_type(presentation_object_->get_type_ms()); Context.get_slide_context().set_property(_property(L"no_rect", true)); } std::wstring text_content_ = Context.get_text_context().end_object(); if (!text_content_.empty()) { Context.get_slide_context().set_property(_property(L"text-content", text_content_)); } Context.get_text_context().end_base_style(); Context.get_slide_context().end_shape(); } //------------------------------------------------------------------------------------------------- const wchar_t * presentation_sound::ns = L"presentation"; const wchar_t * presentation_sound::name = L"sound"; void presentation_sound::add_attributes( const xml::attributes_wc_ptr & Attributes ) { xlink_attlist_.add_attributes(Attributes); } void presentation_sound::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) { CP_NOT_APPLICABLE_ELM(); } void presentation_sound::pptx_convert(oox::pptx_conversion_context & Context) { Context.get_slide_context().set_link(xlink_attlist_.href_.get_value_or(L""), oox::typeHyperlink); } //------------------------------------------------------------------------------------------------- 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::add_attributes( const xml::attributes_wc_ptr & Attributes ) { content_.add_attributes(Attributes); } void style_drawing_page_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name) { if CP_CHECK_NAME(L"presentation", L"sound") CP_CREATE_ELEMENT(content_.presentation_sound_); else CP_NOT_APPLICABLE_ELM(); } void drawing_page_properties::add_attributes( const xml::attributes_wc_ptr & Attributes ) { common_draw_fill_attlist_.add_attributes(Attributes); anim_transition_filter_attlist_.add_attributes(Attributes); CP_APPLY_ATTR(L"draw:fill-image-height", draw_fill_image_height_); CP_APPLY_ATTR(L"draw:fill-image-width", draw_fill_image_width_); CP_APPLY_ATTR(L"draw:background-size", draw_background_size_); CP_APPLY_ATTR(L"presentation:transition-type", presentation_transition_type_); CP_APPLY_ATTR(L"presentation:transition-style", presentation_transition_style_); CP_APPLY_ATTR(L"presentation:transition-speed", presentation_transition_speed_); CP_APPLY_ATTR(L"presentation:display-footer", presentation_display_footer_); CP_APPLY_ATTR(L"presentation:display-page-number", presentation_display_page_number_); CP_APPLY_ATTR(L"presentation:display-date-time", presentation_display_date_time_); CP_APPLY_ATTR(L"presentation:display-header", presentation_display_header_); CP_APPLY_ATTR(L"presentation:page-duration", presentation_page_duration_); CP_APPLY_ATTR(L"presentation:visibility", presentation_visibility_); } void drawing_page_properties::apply_from(const drawing_page_properties & Other) { common_draw_fill_attlist_.apply_from(Other.common_draw_fill_attlist_); _CP_APPLY_PROP2(draw_fill_image_height_); _CP_APPLY_PROP2(draw_fill_image_width_); _CP_APPLY_PROP2(draw_background_size_); _CP_APPLY_PROP2(presentation_transition_type_); _CP_APPLY_PROP2(presentation_transition_style_); _CP_APPLY_PROP2(presentation_transition_speed_); _CP_APPLY_PROP2(presentation_display_footer_); _CP_APPLY_PROP2(presentation_display_page_number_); _CP_APPLY_PROP2(presentation_display_date_time_); _CP_APPLY_PROP2(presentation_display_header_); _CP_APPLY_PROP2(presentation_page_duration_); _CP_APPLY_PROP2(presentation_visibility_); } } }