bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / filter / eppt / pptexanimations.hxx
blob6bdd0eeb0bc98975040fe9ad5be63b695d3e7632
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SD_SOURCE_FILTER_EPPT_PPTEXANIMATIONS_HXX
21 #define INCLUDED_SD_SOURCE_FILTER_EPPT_PPTEXANIMATIONS_HXX
23 #ifdef DBG_ANIM_LOG
24 #include <stdio.h>
25 #endif
27 #include <rtl/ustring.hxx>
28 #include <com/sun/star/uno/Any.hxx>
29 #include <com/sun/star/uno/Reference.h>
31 #include <memory>
32 #include <vector>
34 namespace com { namespace sun { namespace star { namespace animations { class XAnimate; } } } }
35 namespace com { namespace sun { namespace star { namespace animations { class XAnimationNode; } } } }
36 namespace com { namespace sun { namespace star { namespace beans { struct NamedValue; } } } }
37 namespace com { namespace sun { namespace star { namespace drawing { class XDrawPage; } } } }
38 namespace com { namespace sun { namespace star { namespace drawing { class XShape; } } } }
39 namespace ppt { class ExSoundCollection; }
41 class SvStream;
42 class EscherSolverContainer;
44 namespace ppt
47 struct AfterEffectNode
49 css::uno::Reference< css::animations::XAnimationNode > mxNode;
50 css::uno::Reference< css::animations::XAnimationNode > mxMaster;
52 AfterEffectNode( const css::uno::Reference< css::animations::XAnimationNode >& xNode,
53 const css::uno::Reference< css::animations::XAnimationNode >& xMaster )
54 : mxNode( xNode ), mxMaster( xMaster ) {}
57 typedef std::shared_ptr< AfterEffectNode > AfterEffectNodePtr;
59 typedef sal_uInt32 TranslateMode;
60 #define TRANSLATE_NONE 0
61 #define TRANSLATE_VALUE 1
62 #define TRANSLATE_ATTRIBUTE 2
63 #define TRANSLATE_MEASURE 4
64 #define TRANSLATE_NUMBER_TO_STRING 8
66 const int AFTEREFFECT_NONE = 0;
67 const int AFTEREFFECT_COLOR = 1;
68 const int AFTEREFFECT_SET = 2;
70 class AnimationExporter
72 css::uno::Any aTarget;
73 const EscherSolverContainer& mrSolverContainer;
74 ppt::ExSoundCollection& mrExSoundCollection;
75 std::vector< AfterEffectNodePtr > maAfterEffectNodes;
76 sal_Int32 mnCurrentGroup;
78 static void writeZString( SvStream& rStrm, const OUString& rVal );
79 static bool getColorAny( const css::uno::Any& rAny, const sal_Int16 nColorSpace, sal_Int32& rMode, sal_Int32& rA, sal_Int32& rB, sal_Int32& rC );
80 static bool exportAnimProperty( SvStream& rStrm, const sal_uInt16 nPropertyId, const css::uno::Any& rAny, const TranslateMode eTranslateMode );
81 static void exportAnimPropertyString( SvStream& rStrm, const sal_uInt16 nPropertyId, const OUString& rVal, const TranslateMode eTranslateMode );
82 static void exportAnimPropertyFloat( SvStream& rStrm, const sal_uInt16 nPropertyId, const double& rVal );
83 static void exportAnimPropertyuInt32( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt32 nVal );
84 static void exportAnimPropertyByte( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt8 nVal );
86 /** if available exportAnimPropertySet
87 @return the css::presentation::EffectNodeType*/
88 static sal_Int16 exportAnimPropertySet( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
89 static void exportAnimNode( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode,
90 const sal_Int16 nFillDefault );
91 void exportAnimate( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
92 void exportAnimateTarget( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode, const sal_uInt32 nForceAttributeName = 0, int nAfterEffectType = AFTEREFFECT_NONE );
93 void exportAnimateSet( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode, int nAfterEffectType );
94 static void exportAnimAction( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
95 void exportAnimEvent( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode, const sal_Int32 nFlags = 0 );
96 void exportNode( SvStream& rStrm, css::uno::Reference< css::animations::XAnimationNode > const & xNode,
97 const sal_uInt16 nContainerRecType, const sal_uInt16 nInstance, const sal_Int32 nGroupLevel, const bool bTakeBackInteractiveSequenceTiming,
98 const sal_Int16 nFillDefault );
99 void exportAnimateTargetElement( SvStream& rStrm, const css::uno::Any& rAny, const bool bCreate2b01Atom );
100 static void exportAnimateKeyPoints( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimate >& xAnimate );
101 static void exportAnimValue( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode, const bool bExportAlways );
102 void exportTransitionFilter( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
103 void exportAnimateMotion( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
104 void exportAnimateTransform( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
105 void exportAnimateColor( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode, int nAfterEffectType );
106 void exportIterate( SvStream& rStrm, const css::uno::Reference< css::animations::XAnimationNode >& xNode );
108 void processAfterEffectNodes( const css::uno::Reference< css::animations::XAnimationNode >& xNode );
110 bool isAfterEffectNode( const css::uno::Reference< css::animations::XAnimationNode >& xNode ) const;
111 bool hasAfterEffectNode( const css::uno::Reference< css::animations::XAnimationNode >& xNode, css::uno::Reference< css::animations::XAnimationNode >& xAfterEffectNode ) const;
112 bool isEmptyNode( const css::uno::Reference< css::animations::XAnimationNode >& xNode ) const;
114 static css::uno::Reference< css::animations::XAnimationNode > createAfterEffectNodeClone( const css::uno::Reference< css::animations::XAnimationNode >& xNode );
116 public:
117 AnimationExporter( const EscherSolverContainer& rSolverContainer, ppt::ExSoundCollection& rExSoundCollection );
119 void doexport( const css::uno::Reference< css::drawing::XDrawPage >& xPage, SvStream& rStrm );
121 // helper methods also used in ooxml export
122 static css::uno::Any convertAnimateValue( const css::uno::Any& rSource, const OUString& rAttributeName );
123 static bool GetNodeType( const css::uno::Reference< css::animations::XAnimationNode >& xNode, sal_Int16& nType );
124 static sal_Int16 GetFillMode( const css::uno::Reference< css::animations::XAnimationNode >& xNode, const sal_Int16 nFillDefault );
125 static void GetUserData( const css::uno::Sequence< css::beans::NamedValue >& rUserData, const css::uno::Any ** pAny, std::size_t nLen );
126 static sal_uInt32 TranslatePresetSubType( const sal_uInt32 nPresetClass, const sal_uInt32 nPresetId, const OUString& rPresetSubType );
127 static sal_uInt32 GetPresetID( const OUString& rPreset, sal_uInt32 nAPIPresetClass, bool& bPresetId );
128 static sal_uInt32 GetValueTypeForAttributeName( const OUString& rAttributeName );
130 static const sal_Char* FindTransitionName( const sal_Int16 nType, const sal_Int16 nSubType, const bool bDirection );
131 static css::uno::Reference< css::drawing::XShape > getTargetElementShape( const css::uno::Any& rAny, sal_Int32& rBegin, sal_Int32& rEnd, bool& rParagraphTarget );
133 } // namespace ppt
135 #endif
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */