diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /include/oox/ppt | |
parent | Initial commit. (diff) | |
download | libreoffice-upstream.tar.xz libreoffice-upstream.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/oox/ppt')
24 files changed, 1776 insertions, 0 deletions
diff --git a/include/oox/ppt/animationspersist.hxx b/include/oox/ppt/animationspersist.hxx new file mode 100644 index 000000000..0dcf0dc06 --- /dev/null +++ b/include/oox/ppt/animationspersist.hxx @@ -0,0 +1,123 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +#ifndef INCLUDED_OOX_PPT_ANIMATIONSPERSIST_HXX +#define INCLUDED_OOX_PPT_ANIMATIONSPERSIST_HXX + +#include <array> +#include <vector> +#include <memory> + +#include <com/sun/star/uno/Any.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace oox::ppt { + + enum { + NP_TO = 0, + NP_FROM, NP_BY, NP_USERDATA, NP_ATTRIBUTENAME, + NP_ACCELERATION, NP_AUTOREVERSE, NP_DECELERATE, NP_DURATION, NP_FILL, + NP_REPEATCOUNT, NP_REPEATDURATION, NP_RESTART, + NP_DIRECTION, NP_COLORINTERPOLATION, NP_CALCMODE, NP_TRANSFORMTYPE, + NP_PATH, + NP_ENDSYNC, NP_ITERATETYPE, NP_ITERATEINTERVAL, + NP_SUBITEM, NP_TARGET, NP_COMMAND, NP_PARAMETER, + NP_VALUES, NP_FORMULA, NP_KEYTIMES, NP_DISPLAY, + NP_SIZE_ + }; + + typedef std::array< css::uno::Any, NP_SIZE_ > NodePropertyMap; + + + /** data for CT_TLShapeTargetElement */ + struct ShapeTargetElement + { + ShapeTargetElement() + : mnType(0) + , mnRangeType(0) + { + maRange.start = maRange.end = 0; + } + void convert( css::uno::Any & aAny, sal_Int16 & rSubType ) const; + + sal_Int32 mnType; + sal_Int32 mnRangeType; + drawingml::IndexRange maRange; + OUString msSubShapeId; + }; + + + /** data for CT_TLTimeTargetElement */ + struct AnimTargetElement + { + AnimTargetElement() + : mnType( 0 ) + {} + /** convert to a set of properties */ + css::uno::Any convert(const SlidePersistPtr & pSlide, sal_Int16 & nSubType) const; + + sal_Int32 mnType; + OUString msValue; + ShapeTargetElement maShapeTarget; + }; + + typedef std::shared_ptr< AnimTargetElement > AnimTargetElementPtr; + + struct AnimationCondition; + + typedef std::vector< AnimationCondition > AnimationConditionList; + + /** data for CT_TLTimeCondition */ + struct AnimationCondition + { + AnimationCondition() + : mnType( 0 ) + {} + + css::uno::Any convert(const SlidePersistPtr & pSlide) const; + static css::uno::Any convertList(const SlidePersistPtr & pSlide, const AnimationConditionList & l); + + AnimTargetElementPtr & getTarget() + { if(!mpTarget) mpTarget = std::make_shared<AnimTargetElement>(); return mpTarget; } + css::uno::Any maValue; + sal_Int32 mnType; + private: + AnimTargetElementPtr mpTarget; + }; + + + struct TimeAnimationValue + { + OUString msFormula; + OUString msTime; + css::uno::Any maValue; + }; + + typedef ::std::vector< TimeAnimationValue > TimeAnimationValueList; + +} + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/backgroundproperties.hxx b/include/oox/ppt/backgroundproperties.hxx new file mode 100644 index 000000000..35a209b30 --- /dev/null +++ b/include/oox/ppt/backgroundproperties.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_BACKGROUNDPROPERTIES_HXX +#define INCLUDED_OOX_PPT_BACKGROUNDPROPERTIES_HXX + +#include <oox/core/contexthandler.hxx> +#include <oox/core/fragmenthandler2.hxx> +#include <sal/types.h> + +namespace oox { class AttributeList; } +namespace oox::drawingml { struct FillProperties; } + +namespace oox::ppt { + + +class BackgroundPropertiesContext final : public ::oox::core::FragmentHandler2 +{ +public: + BackgroundPropertiesContext( ::oox::core::FragmentHandler2 const & rParent, ::oox::drawingml::FillProperties& rFillProperties ); + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; + +private: + ::oox::drawingml::FillProperties& mrFillProperties; +}; + +} + +#endif // INCLUDED_OOX_PPT_BACKGROUNDPROPERTIES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/comments.hxx b/include/oox/ppt/comments.hxx new file mode 100644 index 000000000..10cad1270 --- /dev/null +++ b/include/oox/ppt/comments.hxx @@ -0,0 +1,117 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + + +#ifndef INCLUDED_OOX_PPT_COMMENTS_HXX +#define INCLUDED_OOX_PPT_COMMENTS_HXX + +#include <vector> + +#include <com/sun/star/util/DateTime.hpp> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace oox::ppt { + +struct CommentAuthor +{ + OUString clrIdx; + OUString id; + OUString initials; + OUString lastIdx; + OUString name; +}; + +class CommentAuthorList +{ + private: + std::vector<CommentAuthor> cmAuthorLst; + + public: + void setValues(const CommentAuthorList& list); + + void addAuthor(const CommentAuthor& _author) + { + cmAuthorLst.push_back(_author); + } + + friend class Comment; +}; + +class Comment +{ + private: + OUString authorId; + OUString dt; + OUString idx; + OUString x; + OUString y; + OUString text; + css::util::DateTime aDateTime; + + void setDateTime (const OUString& datetime); + + public: + void setAuthorId(const OUString& _aId) + { + authorId = _aId; + } + void setdt(const OUString& _dt) + { + dt=_dt; + setDateTime(_dt); + } + void setidx(const OUString& _idx) + { + idx=_idx; + } + void setPoint(const OUString& _x, const OUString& _y) + { + x=_x; + y=_y; + } + void setText(const OUString& _text) + { + text = _text; + } + const OUString& get_text() const + { + return text; + } + const css::util::DateTime& getDateTime() const + { + return aDateTime; + } + sal_Int32 getIntX() const + { + return x.toInt32(); + } + sal_Int32 getIntY() const + { + return y.toInt32(); + } + OUString getAuthor ( const CommentAuthorList& list ); +}; + +class CommentList +{ + public: + std::vector<Comment> cmLst; + int getSize () const + { + return static_cast<int>(cmLst.size()); + } + const Comment& getCommentAtIndex (int index); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/customshowlistcontext.hxx b/include/oox/ppt/customshowlistcontext.hxx new file mode 100644 index 000000000..d79cfc637 --- /dev/null +++ b/include/oox/ppt/customshowlistcontext.hxx @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_CUSTOMSHOWLISTCONTEXT_HXX +#define INCLUDED_OOX_PPT_CUSTOMSHOWLISTCONTEXT_HXX + +#include <vector> + +#include <oox/core/contexthandler.hxx> +#include <oox/core/fragmenthandler2.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace oox { class AttributeList; } + +namespace oox::ppt { + + + struct CustomShow + { + OUString maCustomShowName; + OUString mnId; + std::vector< OUString >maSldLst; + }; + + /** CT_ */ + class CustomShowListContext final : public ::oox::core::FragmentHandler2 + { + std::vector< CustomShow >& mrCustomShowList; + + public: + CustomShowListContext( ::oox::core::FragmentHandler2 const & rParent, + std::vector< CustomShow >& rCustomShowList ); + + virtual ~CustomShowListContext( ) override; + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; + }; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/headerfooter.hxx b/include/oox/ppt/headerfooter.hxx new file mode 100644 index 000000000..e304f3c6e --- /dev/null +++ b/include/oox/ppt/headerfooter.hxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_HEADERFOOTER_HXX +#define INCLUDED_OOX_PPT_HEADERFOOTER_HXX + +namespace oox::ppt { + + struct HeaderFooter + { + bool mbSlideNumber; + bool mbHeader; + bool mbFooter; + bool mbDateTime; + + HeaderFooter() + : mbSlideNumber( true ) + , mbHeader( true ) + , mbFooter( true ) + , mbDateTime( true ) {}; + }; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/layoutfragmenthandler.hxx b/include/oox/ppt/layoutfragmenthandler.hxx new file mode 100644 index 000000000..41fb7a85b --- /dev/null +++ b/include/oox/ppt/layoutfragmenthandler.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_LAYOUTFRAGMENTHANDLER_HXX +#define INCLUDED_OOX_PPT_LAYOUTFRAGMENTHANDLER_HXX + +#include <oox/core/contexthandler.hxx> +#include <oox/ppt/slidefragmenthandler.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace oox { class AttributeList; } +namespace oox::core { class XmlFilterBase; } + +namespace oox::ppt { + +class LayoutFragmentHandler final : public SlideFragmentHandler +{ +public: + LayoutFragmentHandler(::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, + const SlidePersistPtr& pMasterPersistPtr); + virtual ~LayoutFragmentHandler() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; +}; + +} + +#endif // INCLUDED_OOX_PPT_LAYOUTFRAGMENTHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/pptfilterhelpers.hxx b/include/oox/ppt/pptfilterhelpers.hxx new file mode 100644 index 000000000..35372e6fe --- /dev/null +++ b/include/oox/ppt/pptfilterhelpers.hxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_PPTFILTERHELPERS_HXX +#define INCLUDED_OOX_PPT_PPTFILTERHELPERS_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <oox/dllapi.h> +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Any.hxx> + +namespace com::sun::star { + namespace animations { class XAnimationNode; } +} + +namespace oox::ppt { + + // conversion of MS to OOo attributes. + enum class AnimationAttributeEnum + { + PPT_X, PPT_Y, PPT_W, PPT_H, PPT_C, R, XSHEAR, FILLCOLOR, FILLTYPE, + FILLON, STROKECOLOR, STROKEON, STYLECOLOR, STYLEROTATION, FONTWEIGHT, + STYLEUNDERLINE, STYLEFONTFAMILY, STYLEFONTSIZE, STYLEFONTSTYLE, + STYLEVISIBILITY, STYLEOPACITY, UNKNOWN + }; + + struct ImplAttributeNameConversion + { + AnimationAttributeEnum meAttribute; + const char* mpMSName; + const char* mpAPIName; + }; + + OOX_DLLPUBLIC const ImplAttributeNameConversion *getAttributeConversionList(); + + struct OOX_DLLPUBLIC transition + { + const char* mpName; + sal_Int16 mnType; + sal_Int16 mnSubType; + bool mbDirection; // true: default geometric direction + + static const transition* getList(); + static const transition* find( const OUString& rName ); + }; + + struct OOX_DLLPUBLIC convert_subtype + { + sal_Int32 mnID; + const char* mpStrSubType; + + static const convert_subtype* getList(); + }; + + struct OOX_DLLPUBLIC preset_mapping + { + sal_Int32 mnPresetClass; + sal_Int32 mnPresetId; + const char* mpStrPresetId; + + static const preset_mapping* getList(); + }; + + OOX_DLLPUBLIC OUString getConvertedSubType( sal_Int16 nPresetClass, sal_Int32 nPresetId, sal_Int32 nPresetSubType ); + + OOX_DLLPUBLIC void fixMainSequenceTiming( const css::uno::Reference< css::animations::XAnimationNode >& xNode ); + + OOX_DLLPUBLIC void fixInteractiveSequenceTiming( const css::uno::Reference< css::animations::XAnimationNode >& xNode ); + + /** convert attribute values of the animation target so that LibreOffice understand. + */ + OOX_DLLPUBLIC bool convertAnimationValue(AnimationAttributeEnum eAttribute, css::uno::Any& rValue); + + /** convert the measure string to LibreOffice format. + * i.e. convert occurrence of #{0,1}ppt_[xywh] to x,y, width, height. + */ + OOX_DLLPUBLIC bool convertMeasure(OUString& rString); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/pptgraphicshapecontext.hxx b/include/oox/ppt/pptgraphicshapecontext.hxx new file mode 100644 index 000000000..bdc1f7d77 --- /dev/null +++ b/include/oox/ppt/pptgraphicshapecontext.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_PPTGRAPHICSHAPECONTEXT_HXX +#define INCLUDED_OOX_PPT_PPTGRAPHICSHAPECONTEXT_HXX + +#include <oox/core/contexthandler.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/drawingml/graphicshapecontext.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <sal/types.h> + +namespace oox { class AttributeList; } +namespace oox::core { class ContextHandler2Helper; } + +namespace oox::ppt { + +class PPTGraphicShapeContext final : public ::oox::drawingml::GraphicShapeContext +{ + SlidePersistPtr mpSlidePersistPtr; + +public: + PPTGraphicShapeContext( ::oox::core::ContextHandler2Helper const & rParent, const SlidePersistPtr& rSlidePersistPtr, const oox::drawingml::ShapePtr& pMasterShapePtr, const oox::drawingml::ShapePtr& pShapePtr ); + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; +}; + +} + +#endif // OOX_PPT_PPTGRAPHICSHAPEGROUPCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/pptimport.hxx b/include/oox/ppt/pptimport.hxx new file mode 100644 index 000000000..e96f04b70 --- /dev/null +++ b/include/oox/ppt/pptimport.hxx @@ -0,0 +1,109 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_PPTIMPORT_HXX +#define INCLUDED_OOX_PPT_PPTIMPORT_HXX + +#include <map> +#include <memory> +#include <vector> + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <oox/core/filterbase.hxx> +#include <oox/core/xmlfilterbase.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/drawingml/theme.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <oox/ppt/pptshape.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace com::sun::star { + namespace beans { struct PropertyValue; } + namespace uno { class XComponentContext; } +} + +namespace oox { + class GraphicHelper; + namespace drawingml::chart { class ChartConverter; } + namespace ole { class VbaProject; } + namespace vml { class Drawing; } +} + +namespace oox::ppt { + + +class PowerPointImport final : public oox::core::XmlFilterBase +{ +public: + /// @throws css::uno::RuntimeException + PowerPointImport( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); + virtual ~PowerPointImport() override; + + // from FilterBase + virtual bool importDocument() override; + virtual bool exportDocument() throw() override; + + virtual const ::oox::drawingml::Theme* getCurrentTheme() const override; + virtual ::oox::vml::Drawing* getVmlDrawing() override; + virtual oox::drawingml::table::TableStyleListPtr getTableStyles() override; + virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() override; + + const SlidePersistPtr& getActualSlidePersist() const { return mpActualSlidePersist; }; + void setActualSlidePersist( SlidePersistPtr pActualSlidePersist ){ mpActualSlidePersist = pActualSlidePersist; }; + std::map< OUString, oox::drawingml::ThemePtr >& getThemes(){ return maThemes; }; + std::vector< SlidePersistPtr >& getDrawPages(){ return maDrawPages; }; + std::vector< SlidePersistPtr >& getMasterPages(){ return maMasterPages; }; + std::vector< SlidePersistPtr >& getNotesPages(){ return maNotesPages; }; + + virtual sal_Bool SAL_CALL filter( const css::uno::Sequence< css::beans::PropertyValue >& rDescriptor ) override; + + ::Color getSchemeColor( sal_Int32 nToken ) const; + + static std::vector< PPTShape* > maPPTShapes; + +#if OSL_DEBUG_LEVEL > 0 + static XmlFilterBase* mpDebugFilterBase; +#endif + +private: + virtual GraphicHelper* implCreateGraphicHelper() const override; + virtual ::oox::ole::VbaProject* implCreateVbaProject() const override; + virtual OUString SAL_CALL getImplementationName() override; + +private: + OUString maTableStyleListPath; + oox::drawingml::table::TableStyleListPtr mpTableStyleList; + + SlidePersistPtr mpActualSlidePersist; + std::map< OUString, oox::drawingml::ThemePtr > maThemes; + + std::vector< SlidePersistPtr > maDrawPages; + std::vector< SlidePersistPtr > maMasterPages; + std::vector< SlidePersistPtr > maNotesPages; + + std::shared_ptr< ::oox::drawingml::chart::ChartConverter > mxChartConv; +}; + +} + +#endif // INCLUDED_OOX_PPT_PPTIMPORT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/pptshape.hxx b/include/oox/ppt/pptshape.hxx new file mode 100644 index 000000000..e67a77635 --- /dev/null +++ b/include/oox/ppt/pptshape.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_PPTSHAPE_HXX +#define INCLUDED_OOX_PPT_PPTSHAPE_HXX + +#include <vector> + +#include <com/sun/star/uno/Reference.hxx> +#include <oox/drawingml/shape.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace basegfx { class B2DHomMatrix; } + +namespace com::sun::star { + namespace awt { struct Rectangle; } + namespace drawing { class XShapes; } +} + +namespace oox { + namespace core { class XmlFilterBase; } + namespace drawingml { class Theme; } + template <typename Type> class OptValue; +} + +namespace oox::ppt { + +class PPTShape final : public oox::drawingml::Shape +{ + OUString msModelId; // fallback dgs smartart shape reference + ShapeLocation meShapeLocation; // placeholdershapes (mnSubType != 0) on Master are never displayed + bool mbReferenced; // placeholdershapes on Layout are displayed only, if they are not referenced + // placeholdershapes on Slide are displayed always + oox::drawingml::ShapePtr mpPlaceholder; + +public: + + PPTShape( const oox::ppt::ShapeLocation eShapeLocation, + const char* pServiceType ); + virtual ~PPTShape() override; + + using oox::drawingml::Shape::addShape; + // addShape is creating and inserting the corresponding XShape. + void addShape( + oox::core::XmlFilterBase& rFilterBase, + const SlidePersist& rPersist, + const oox::drawingml::Theme* pTheme, + const css::uno::Reference< css::drawing::XShapes >& rxShapes, + basegfx::B2DHomMatrix& aTransformation, + ::oox::drawingml::ShapeIdMap* pShapeMap, + bool bhasSameSubTypeIndex = false ); + + ShapeLocation getShapeLocation() const { return meShapeLocation; }; + void setReferenced( bool bReferenced ){ mbReferenced = bReferenced; }; + void setPlaceholder( oox::drawingml::ShapePtr pPlaceholder ) { mpPlaceholder = pPlaceholder; } + void setModelId( const OUString& rId ) { msModelId = rId; } + + static oox::drawingml::ShapePtr findPlaceholder( const sal_Int32 nFirstSubType, + const sal_Int32 nSecondSubType, const OptValue< sal_Int32 >& oSubTypeIndex, + std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly = false ); + static oox::drawingml::ShapePtr findPlaceholderByIndex( const sal_Int32 nIdx, + std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly = false ); + + static oox::drawingml::TextListStylePtr getSubTypeTextListStyle( const SlidePersist& rSlidePersist, sal_Int32 nSubType ); +}; + +} + +#endif // INCLUDED_OOX_PPT_PPTSHAPE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/pptshapecontext.hxx b/include/oox/ppt/pptshapecontext.hxx new file mode 100644 index 000000000..5d5277502 --- /dev/null +++ b/include/oox/ppt/pptshapecontext.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_PPTSHAPECONTEXT_HXX +#define INCLUDED_OOX_PPT_PPTSHAPECONTEXT_HXX + +#include <oox/core/contexthandler.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/drawingml/shapecontext.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <sal/types.h> + +namespace oox { class AttributeList; } +namespace oox::core { class ContextHandler2Helper; } + +namespace oox::ppt { + +class PPTShapeContext final : public ::oox::drawingml::ShapeContext +{ + SlidePersistPtr mpSlidePersistPtr; + +public: + PPTShapeContext( ::oox::core::ContextHandler2Helper const & rParent, const SlidePersistPtr& rSlidePersistPtr, const oox::drawingml::ShapePtr& pMasterShapePtr, const oox::drawingml::ShapePtr& pShapePtr ); + virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; +}; + +} + +#endif // INCLUDED_OOX_PPT_PPTSHAPECONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/pptshapegroupcontext.hxx b/include/oox/ppt/pptshapegroupcontext.hxx new file mode 100644 index 000000000..89f8ca65d --- /dev/null +++ b/include/oox/ppt/pptshapegroupcontext.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX +#define INCLUDED_OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX + +#include <oox/core/contexthandler.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/drawingml/shapegroupcontext.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <sal/types.h> + +namespace oox { + class AttributeList; + namespace core { class ContextHandler2Helper; } + namespace drawingml { class Color; } +} + +namespace oox::ppt { + +class PPTShapeGroupContext final : public ::oox::drawingml::ShapeGroupContext +{ + SlidePersistPtr mpSlidePersistPtr; + ShapeLocation meShapeLocation; + oox::drawingml::ShapePtr pGraphicShape; + + void applyFontRefColor(const oox::drawingml::ShapePtr& pShape, const oox::drawingml::Color& rFontRefColor); + +public: + PPTShapeGroupContext( + ::oox::core::FragmentHandler2 const & rParent, + const oox::ppt::SlidePersistPtr& rSlidePersistPtr, + const oox::ppt::ShapeLocation eShapeLocation, + const oox::drawingml::ShapePtr& pMasterShapePtr, + const oox::drawingml::ShapePtr& pGroupShapePtr ); + + virtual ::oox::core::ContextHandlerRef + onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; + + void importExtDrawings(); + +protected: + +}; + +} + +#endif // INCLUDED_OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/pptshapepropertiescontext.hxx b/include/oox/ppt/pptshapepropertiescontext.hxx new file mode 100644 index 000000000..124d7545d --- /dev/null +++ b/include/oox/ppt/pptshapepropertiescontext.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_PPTSHAPEPROPERTIESCONTEXT_HXX +#define INCLUDED_OOX_PPT_PPTSHAPEPROPERTIESCONTEXT_HXX + +#include <drawingml/shapepropertiescontext.hxx> +#include <oox/core/contexthandler.hxx> +#include <sal/types.h> + +namespace oox { + class AttributeList; + namespace core { class ContextHandler2Helper; } + namespace drawingml { class Shape; } +} + +namespace oox::ppt { + +class PPTShapePropertiesContext final : public ::oox::drawingml::ShapePropertiesContext +{ +public: + PPTShapePropertiesContext( ::oox::core::ContextHandler2Helper const & rParent, ::oox::drawingml::Shape& rShape ); + virtual ::oox::core::ContextHandlerRef + onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override; +}; + +} + +#endif // INCLUDED_OOX_PPT_PPTSHAPEPROPERTIESCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/presPropsfragmenthandler.hxx b/include/oox/ppt/presPropsfragmenthandler.hxx new file mode 100644 index 000000000..d760f39f4 --- /dev/null +++ b/include/oox/ppt/presPropsfragmenthandler.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_OOX_PPT_PRESPROPSFRAGMENTHANDLER_HXX +#define INCLUDED_OOX_PPT_PRESPROPSFRAGMENTHANDLER_HXX + +#include <oox/core/fragmenthandler2.hxx> + +namespace oox +{ +namespace core +{ +class XmlFilterBase; +} + +namespace ppt +{ +class PresPropsFragmentHandler final : public core::FragmentHandler2 +{ +public: + PresPropsFragmentHandler(core::XmlFilterBase& rFilter, const OUString& rFragmentPath); + virtual ~PresPropsFragmentHandler() override; + virtual void finalizeImport() override; + virtual core::ContextHandlerRef onCreateContext(sal_Int32 aElementToken, + const AttributeList& rAttribs) override; + +private: + bool m_bLoop = false; +}; +} // namespace ppt +} // namespace oox + +#endif // INCLUDED_OOX_PPT_PRESPROPSFRAGMENTHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/oox/ppt/presentationfragmenthandler.hxx b/include/oox/ppt/presentationfragmenthandler.hxx new file mode 100644 index 000000000..4ec27efe2 --- /dev/null +++ b/include/oox/ppt/presentationfragmenthandler.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_PRESENTATIONFRAGMENTHANDLER_HXX +#define INCLUDED_OOX_PPT_PRESENTATIONFRAGMENTHANDLER_HXX + +#include <vector> + +#include <com/sun/star/awt/Size.hpp> +#include <oox/core/contexthandler.hxx> +#include <oox/core/fragmenthandler.hxx> +#include <oox/core/fragmenthandler2.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/ppt/customshowlistcontext.hxx> +#include <oox/ppt/comments.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace oox { class AttributeList; } +namespace oox::core { class XmlFilterBase; } + +namespace oox::ppt { + +class PresentationFragmentHandler final : public ::oox::core::FragmentHandler2 +{ +public: + PresentationFragmentHandler(::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath); + virtual ~PresentationFragmentHandler() throw() override; + virtual void finalizeImport() override; + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; + +private: + void importSlide( const ::oox::core::FragmentHandlerRef& rSlideFragmentHandler, + const oox::ppt::SlidePersistPtr& rPersist ); + void importSlide(sal_uInt32 nSlide, bool bFirstSlide, bool bImportNotes); + void saveThemeToGrabBag(const oox::drawingml::ThemePtr& pThemePtr, sal_Int32 nThemeIdx); + + std::vector< OUString > maSlideMasterVector; + std::vector< OUString > maSlidesVector; + std::vector< OUString > maNotesMasterVector; + ::oox::drawingml::TextListStylePtr mpTextListStyle; + + css::awt::Size maSlideSize; + css::awt::Size maNotesSize; + + std::vector< CustomShow > maCustomShowList; + + CommentAuthorList maAuthorList; + bool mbCommentAuthorsRead; // read commentAuthors.xml only once +}; + +} + +#endif // INCLUDED_OOX_PPT_PRESENTATIONFRAGMENTHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/slidefragmenthandler.hxx b/include/oox/ppt/slidefragmenthandler.hxx new file mode 100644 index 000000000..b7d1d59b3 --- /dev/null +++ b/include/oox/ppt/slidefragmenthandler.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_SLIDEFRAGMENTHANDLER_HXX +#define INCLUDED_OOX_PPT_SLIDEFRAGMENTHANDLER_HXX + +#include <vector> + +#include <oox/core/contexthandler.hxx> +#include <oox/core/fragmenthandler2.hxx> +#include <oox/helper/propertymap.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace oox { class AttributeList; } +namespace oox::core { class XmlFilterBase; } + +namespace oox::ppt { + +class SlideFragmentHandler : public ::oox::core::FragmentHandler2 +{ +public: + SlideFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const OUString& rFragmentPath, const SlidePersistPtr& pPersistPtr, const ShapeLocation eShapeLocation ); + virtual ~SlideFragmentHandler() override; + + virtual void finalizeImport() override; + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; + virtual void onCharacters( const OUString& rChars ) override; + + const ::std::vector< OUString>& getCharVector() const { return maCharVector; } + +protected: + SlidePersistPtr mpSlidePersistPtr; + ShapeLocation meShapeLocation; + +private: + OUString maSlideName; + PropertyMap maSlideProperties; + ::std::vector< OUString> maCharVector; // handle char in OnCharacters +}; + +} + +#endif // INCLUDED_OOX_PPT_SLIDEFRAGMENTHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/slidemastertextstylescontext.hxx b/include/oox/ppt/slidemastertextstylescontext.hxx new file mode 100644 index 000000000..4d051ab8e --- /dev/null +++ b/include/oox/ppt/slidemastertextstylescontext.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_SLIDEMASTERTEXTSTYLESCONTEXT_HXX +#define INCLUDED_OOX_PPT_SLIDEMASTERTEXTSTYLESCONTEXT_HXX + +#include <oox/core/contexthandler.hxx> +#include <oox/core/fragmenthandler2.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <sal/types.h> + +namespace oox { class AttributeList; } + +namespace oox::ppt { + +class SlideMasterTextStylesContext final : public oox::core::FragmentHandler2 +{ +public: + SlideMasterTextStylesContext( ::oox::core::FragmentHandler2 const & rParent, SlidePersistPtr const & pSlidePersistPtr ); + virtual ~SlideMasterTextStylesContext() override; + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; + +private: + SlidePersistPtr mpSlidePersistPtr; +}; + +} + +#endif // INCLUDED_OOX_PPT_SLIDEMASTERTEXTSTYLESCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx new file mode 100644 index 000000000..c09e5f0b0 --- /dev/null +++ b/include/oox/ppt/slidepersist.hxx @@ -0,0 +1,165 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_SLIDEPERSIST_HXX +#define INCLUDED_OOX_PPT_SLIDEPERSIST_HXX + +#include <vector> +#include <map> +#include <memory> + +#include <cppuhelper/weakref.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <oox/drawingml/clrscheme.hxx> +#include <oox/drawingml/color.hxx> +#include <oox/drawingml/drawingmltypes.hxx> +#include <oox/drawingml/shape.hxx> +#include <oox/ppt/comments.hxx> +#include <oox/ppt/headerfooter.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace com::sun::star { + namespace animations { class XAnimationNode; } + namespace drawing { class XDrawPage; } +} + +namespace oox::core { class XmlFilterBase; } +namespace oox::vml { class Drawing; } + +namespace oox::ppt { + +enum ShapeLocation +{ + Master, + Layout, + Slide +}; + + +class TimeNode; +class SlidePersist; + +typedef std::shared_ptr< SlidePersist > SlidePersistPtr; + +class SlidePersist : public std::enable_shared_from_this< SlidePersist > +{ + +public: + SlidePersist( oox::core::XmlFilterBase& rFilter, bool bMaster, bool bNotes, + const css::uno::Reference< css::drawing::XDrawPage >&, + oox::drawingml::ShapePtr const & pShapesPtr, const ::oox::drawingml::TextListStylePtr & ); + ~SlidePersist(); + + + const css::uno::Reference< css::drawing::XDrawPage >& getPage() const { return mxPage; }; + +#if OSL_DEBUG_LEVEL > 0 + static css::uno::WeakReference< css::drawing::XDrawPage > mxDebugPage; +#endif + + void setMasterPersist( SlidePersistPtr pMasterPersistPtr ){ mpMasterPagePtr = pMasterPersistPtr; } + const SlidePersistPtr& getMasterPersist() const { return mpMasterPagePtr; } + + void setPath( const OUString& rPath ) { maPath = rPath; } + const OUString& getPath() const { return maPath; } + + void setLayoutPath( const OUString& rLayoutPath ) { maLayoutPath = rLayoutPath; } + const OUString& getLayoutPath() const { return maLayoutPath; } + + void setTheme( const oox::drawingml::ThemePtr& rThemePtr ){ mpThemePtr = rThemePtr; } + const oox::drawingml::ThemePtr& getTheme() const { return mpThemePtr; } + + void setClrMap( const oox::drawingml::ClrMapPtr pClrMapPtr ){ mpClrMapPtr = pClrMapPtr; } + const oox::drawingml::ClrMapPtr& getClrMap() const { return mpClrMapPtr; } + + void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr& rFillPropertiesPtr ){ mpBackgroundPropertiesPtr = rFillPropertiesPtr; } + const oox::drawingml::FillPropertiesPtr& getBackgroundProperties() const { return mpBackgroundPropertiesPtr; } + oox::drawingml::Color& getBackgroundColor() { return maBackgroundColor; } + + bool isMasterPage() const { return mbMaster; } + bool isNotesPage() const { return mbNotes; } + + void setLayoutValueToken( sal_Int32 nLayoutValueToken ) { mnLayoutValueToken = nLayoutValueToken; } + sal_Int16 getLayoutFromValueToken() const; + + + const oox::drawingml::TextListStylePtr& getDefaultTextStyle() const { return maDefaultTextStylePtr; } + const oox::drawingml::TextListStylePtr& getTitleTextStyle() const { return maTitleTextStylePtr; } + const oox::drawingml::TextListStylePtr& getBodyTextStyle() const { return maBodyTextStylePtr; } + const oox::drawingml::TextListStylePtr& getNotesTextStyle() const { return maNotesTextStylePtr; } + const oox::drawingml::TextListStylePtr& getOtherTextStyle() const { return maOtherTextStylePtr; } + + const oox::drawingml::ShapePtr& getShapes() const { return maShapesPtr; } + void hideShapesAsMasterShapes(); + ::std::vector< std::shared_ptr< TimeNode > >& getTimeNodeList() { return maTimeNodeList; } + oox::ppt::HeaderFooter& getHeaderFooter(){ return maHeaderFooter; }; + + oox::vml::Drawing* getDrawing() { return mpDrawingPtr.get(); } + + void createXShapes( oox::core::XmlFilterBase& rFilterBase ); + void createBackground( const oox::core::XmlFilterBase& rFilterBase ); + void applyTextStyles( const oox::core::XmlFilterBase& rFilterBase ); + + std::map< OUString, css::uno::Reference< css::animations::XAnimationNode > >& getAnimNodesMap() { return maAnimNodesMap; }; + css::uno::Reference<css::animations::XAnimationNode> getAnimationNode(const OUString& sId) const; + ::oox::drawingml::ShapePtr getShape( const OUString & id ) { return maShapeMap[ id ]; } + ::oox::drawingml::ShapeIdMap& getShapeMap() { return maShapeMap; } + + CommentList& getCommentsList() { return maCommentsList; } + CommentAuthorList& getCommentAuthors() { return maCommentAuthors; } + +private: + OUString maPath; + OUString maLayoutPath; + std::shared_ptr< oox::vml::Drawing > mpDrawingPtr; + css::uno::Reference< css::drawing::XDrawPage > mxPage; + oox::drawingml::ThemePtr mpThemePtr; // the theme that is used + oox::drawingml::ClrMapPtr mpClrMapPtr; // color mapping (if any) + SlidePersistPtr mpMasterPagePtr; + + oox::drawingml::ShapePtr maShapesPtr; + oox::drawingml::Color maBackgroundColor; + oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr; + ::std::vector< std::shared_ptr< TimeNode > > maTimeNodeList; + + oox::ppt::HeaderFooter maHeaderFooter; + sal_Int32 mnLayoutValueToken; + bool mbMaster; + bool mbNotes; + + oox::drawingml::TextListStylePtr maDefaultTextStylePtr; + oox::drawingml::TextListStylePtr maTitleTextStylePtr; + oox::drawingml::TextListStylePtr maBodyTextStylePtr; + oox::drawingml::TextListStylePtr maNotesTextStylePtr; + oox::drawingml::TextListStylePtr maOtherTextStylePtr; + + std::map< OUString, css::uno::Reference< css::animations::XAnimationNode > > maAnimNodesMap; + std::map< OUString, ::oox::drawingml::ShapePtr > maShapeMap; + + // slide comments + CommentList maCommentsList; + CommentAuthorList maCommentAuthors; +}; + +} + +#endif // INCLUDED_OOX_PPT_SLIDEPERSIST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/slidetimingcontext.hxx b/include/oox/ppt/slidetimingcontext.hxx new file mode 100644 index 000000000..6b32b2e23 --- /dev/null +++ b/include/oox/ppt/slidetimingcontext.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_SLIDETIMINGCONTEXT_HXX +#define INCLUDED_OOX_PPT_SLIDETIMINGCONTEXT_HXX + +#include <oox/core/contexthandler.hxx> +#include <oox/core/fragmenthandler2.hxx> +#include <oox/ppt/timenode.hxx> +#include <sal/types.h> + +namespace oox { class AttributeList; } + +namespace oox::ppt { + +class SlideTimingContext final : public ::oox::core::FragmentHandler2 +{ +public: + SlideTimingContext( ::oox::core::FragmentHandler2 const & rParent, TimeNodePtrList & aTimeNodeList ) throw(); + virtual ~SlideTimingContext() throw() override; + + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; + +private: + TimeNodePtrList & maTimeNodeList; +}; + +} + +#endif // INCLUDED_OOX_PPT_SLIDETIMINGCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/slidetransition.hxx b/include/oox/ppt/slidetransition.hxx new file mode 100644 index 000000000..40b664231 --- /dev/null +++ b/include/oox/ppt/slidetransition.hxx @@ -0,0 +1,82 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +#ifndef INCLUDED_OOX_PPT_SLIDETRANSITION_HXX +#define INCLUDED_OOX_PPT_SLIDETRANSITION_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/presentation/AnimationSpeed.hpp> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace com::sun::star { + namespace animations { class XTransitionFilter; } +} + +namespace oox { class PropertyMap; } + +namespace oox::ppt { + + class SlideTransition + { + public: + SlideTransition(); + explicit SlideTransition(const OUString & ); + + void setSlideProperties( PropertyMap& props ); + void setTransitionFilterProperties( const css::uno::Reference< css::animations::XTransitionFilter > & xFilter ); + + /// Set one of standard values for slide transition duration + void setOoxTransitionSpeed( sal_Int32 nToken ); + /// Set slide transition time directly + void setOoxTransitionSpeed( double fDuration ); + void setMode( bool bMode ) + { mbMode = bMode; } + void setOoxAdvanceTime( sal_Int32 nAdvanceTime ) + { mnAdvanceTime = nAdvanceTime; } + + static sal_Int16 ooxToOdpDirection( ::sal_Int32 nOoxType ); + static sal_Int16 ooxToOdpEightDirections( ::sal_Int32 nOoxType ); + static sal_Int16 ooxToOdpCornerDirections( ::sal_Int32 nOoxType ); + static sal_Int16 ooxToOdpBorderDirections( ::sal_Int32 nOoxType ); + static sal_Int16 ooxToOdpSideDirections( ::sal_Int32 nOoxType ); + static bool ooxToOdpSideDirectionsDirectionNormal( ::sal_Int32 nOoxType ); + + void setOoxTransitionType( ::sal_Int32 OoxType, + ::sal_Int32 param1, ::sal_Int32 param2 ); + + void setPresetTransition(OUString const & sPresetTransition); + + private: + ::sal_Int16 mnTransitionType; + ::sal_Int16 mnTransitionSubType; + bool mbTransitionDirectionNormal; + css::presentation::AnimationSpeed mnAnimationSpeed; + double mfTransitionDurationInSeconds; + bool mbMode; /**< https://api.libreoffice.org/docs/common/ref/com/sun/star/animations/XTransitionFilter.html Mode property */ + ::sal_Int32 mnAdvanceTime; + ::sal_Int32 mnTransitionFadeColor; + }; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/slidetransitioncontext.hxx b/include/oox/ppt/slidetransitioncontext.hxx new file mode 100644 index 000000000..1c0755ab1 --- /dev/null +++ b/include/oox/ppt/slidetransitioncontext.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_SLIDETRANSITIONCONTEXT_HXX +#define INCLUDED_OOX_PPT_SLIDETRANSITIONCONTEXT_HXX + +#include <oox/core/contexthandler.hxx> +#include <oox/core/fragmenthandler2.hxx> +#include <oox/ppt/slidetransition.hxx> +#include <sal/types.h> + +namespace oox { + class AttributeList; + class PropertyMap; +} + +namespace oox::ppt { + + class SlideTransitionContext final : public ::oox::core::FragmentHandler2 + { + public: + SlideTransitionContext( ::oox::core::FragmentHandler2 const & rParent, + const AttributeList& rAttributes, + PropertyMap & aProperties ) throw(); + virtual ~SlideTransitionContext() throw() override; + + virtual void onEndElement() override; + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; + + + private: + PropertyMap& maSlideProperties; + bool mbHasTransition; + bool mbHasTransitionDuration; + SlideTransition maTransition; + }; + +} + +#endif // INCLUDED_OOX_PPT_SLIDETRANSITIONCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/soundactioncontext.hxx b/include/oox/ppt/soundactioncontext.hxx new file mode 100644 index 000000000..81e7e8151 --- /dev/null +++ b/include/oox/ppt/soundactioncontext.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +#ifndef INCLUDED_OOX_PPT_SOUNDACTIONCONTEXT_HXX +#define INCLUDED_OOX_PPT_SOUNDACTIONCONTEXT_HXX + +#include <oox/core/contexthandler.hxx> +#include <oox/core/fragmenthandler2.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace oox { + class AttributeList; + class PropertyMap; +} + +namespace oox::ppt { + +class SoundActionContext final : public ::oox::core::FragmentHandler2 +{ +public: + SoundActionContext( ::oox::core::FragmentHandler2 const & rParent, PropertyMap & aProperties ) throw(); + virtual ~SoundActionContext() throw() override; + + virtual void onEndElement() override; + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; + +private: + PropertyMap& maSlideProperties; + bool mbHasStartSound; + bool mbLoopSound; + bool mbStopSound; + OUString msSndName; +}; + +} + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/timenode.hxx b/include/oox/ppt/timenode.hxx new file mode 100644 index 000000000..195e4472e --- /dev/null +++ b/include/oox/ppt/timenode.hxx @@ -0,0 +1,128 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + + +#ifndef INCLUDED_OOX_PPT_TIMENODE_HXX +#define INCLUDED_OOX_PPT_TIMENODE_HXX + +#include <vector> +#include <map> +#include <memory> + +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <oox/ppt/slidetransition.hxx> +#include <oox/ppt/slidepersist.hxx> +#include <oox/ppt/animationspersist.hxx> +#include <rtl/ustring.hxx> +#include <sal/types.h> + +namespace com::sun::star { + namespace animations { class XAnimationNode; } +} + +namespace oox::core { class XmlFilterBase; } + +namespace oox::ppt { + + class TimeNode; + + typedef std::shared_ptr< TimeNode > TimeNodePtr; + typedef std::vector< TimeNodePtr > TimeNodePtrList; + + class TimeNode final + { + public: + typedef ::std::map< OUString, css::uno::Any > UserDataMap; + + TimeNode( sal_Int16 nNodeType ); + ~TimeNode(); + + NodePropertyMap & getNodeProperties() { return maNodeProperties; } + UserDataMap & getUserData() { return maUserData; } + TimeNodePtrList & getChildren() + { return maChildren; } + + void setId( sal_Int32 nId ); + + void addNode( + const ::oox::core::XmlFilterBase& rFilter, + const css::uno::Reference< css::animations::XAnimationNode >& rxNode, + const SlidePersistPtr & slide); + // data setters + void setTo( const css::uno::Any & aTo ); + void setFrom( const css::uno::Any & aFrom ); + void setBy( const css::uno::Any & aBy ); + void setTransitionFilter( const SlideTransition & aTransition) + { maTransitionFilter = aTransition; } + + void setNode( + const ::oox::core::XmlFilterBase& rFilter, + const css::uno::Reference< css::animations::XAnimationNode >& xNode, + const SlidePersistPtr & pSlide, + const css::uno::Reference< css::animations::XAnimationNode >& xParent); + + AnimTargetElementPtr const & getTarget() + { + if( !mpTarget ) + mpTarget = std::make_shared<AnimTargetElement>(); + return mpTarget; + } + + AnimationConditionList &getStartCondition() + { return maStCondList; } + AnimationConditionList &getEndCondition() + { return maEndCondList; } + AnimationConditionList &getNextCondition() + { return maNextCondList; } + AnimationConditionList &getPrevCondition() + { return maPrevCondList; } + AnimationCondition & getEndSyncValue() + { mbHasEndSyncValue = true; return maEndSyncValue; } + private: + + static OUString getServiceName( sal_Int16 nNodeType ); + + static css::uno::Reference< css::animations::XAnimationNode > + createAndInsert( + const ::oox::core::XmlFilterBase& rFilter, + const OUString& rServiceName, + const css::uno::Reference< css::animations::XAnimationNode >& rxNode ); + + const sal_Int16 mnNodeType; + + TimeNodePtrList maChildren; + + OUString msId; + NodePropertyMap maNodeProperties; + UserDataMap maUserData; // a sequence to be stored as "UserData" property + SlideTransition maTransitionFilter; + AnimTargetElementPtr mpTarget; + bool mbHasEndSyncValue; // set to true if we try to get the endSync. + AnimationCondition maEndSyncValue; + AnimationConditionList maStCondList, maEndCondList; + AnimationConditionList maPrevCondList, maNextCondList; + }; + +} + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/oox/ppt/timenodelistcontext.hxx b/include/oox/ppt/timenodelistcontext.hxx new file mode 100644 index 000000000..8bc76b3c1 --- /dev/null +++ b/include/oox/ppt/timenodelistcontext.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_OOX_PPT_TIMENODELISTCONTEXT_HXX +#define INCLUDED_OOX_PPT_TIMENODELISTCONTEXT_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <oox/core/contexthandler.hxx> +#include <oox/core/fragmenthandler2.hxx> +#include <oox/ppt/timenode.hxx> +#include <sal/types.h> + +namespace com::sun::star { + namespace xml::sax { class XFastAttributeList; } +} + +namespace oox { class AttributeList; } + +namespace oox::ppt { + + + class TimeNodeContext : public ::oox::core::FragmentHandler2 + { + public: + virtual ~TimeNodeContext() throw() override; + + static TimeNodeContext * makeContext( ::oox::core::FragmentHandler2 const & rParent, sal_Int32 aElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttribs, const TimeNodePtr & pNode ); + + protected: + TimeNodeContext( ::oox::core::FragmentHandler2 const & rParent, sal_Int32 aElement, const TimeNodePtr & pNode ) throw(); + + sal_Int32 mnElement; + TimeNodePtr mpNode; + }; + + +/** FastParser context for XML_tnLst, XML_subTnLst and XML_childTnLst */ +class TimeNodeListContext final : public ::oox::core::FragmentHandler2 +{ +public: + TimeNodeListContext( ::oox::core::FragmentHandler2 const & rParent, TimeNodePtrList & aList ) throw(); + + virtual ~TimeNodeListContext() throw() override; + virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; + + +private: + TimeNodePtrList & maList; +}; + +} + +#endif // INCLUDED_OOX_PPT_TIMENODELISTCONTEXT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |