Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SD_SOURCE_FILTER_EPPT_PPTEXANIMATIONS_HXX
21 : #define INCLUDED_SD_SOURCE_FILTER_EPPT_PPTEXANIMATIONS_HXX
22 :
23 : #include <com/sun/star/animations/XTimeContainer.hpp>
24 : #include <com/sun/star/drawing/XDrawPage.hpp>
25 : #include <com/sun/star/animations/XAnimate.hpp>
26 : #include <com/sun/star/beans/NamedValue.hpp>
27 : #include "../ppt/pptanimations.hxx"
28 : #include <pptexsoundcollection.hxx>
29 : #include <filter/msfilter/escherex.hxx>
30 :
31 : #ifdef DBG_ANIM_LOG
32 : #include <stdio.h>
33 : #endif
34 :
35 : #include <boost/shared_ptr.hpp>
36 :
37 : #include <list>
38 :
39 : class SvStream;
40 :
41 : namespace ppt
42 : {
43 :
44 0 : struct AfterEffectNode
45 : {
46 : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxNode;
47 : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxMaster;
48 :
49 0 : AfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
50 : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xMaster )
51 0 : : mxNode( xNode ), mxMaster( xMaster ) {}
52 : };
53 :
54 : typedef boost::shared_ptr< AfterEffectNode > AfterEffectNodePtr;
55 :
56 : typedef sal_uInt32 TranslateMode;
57 : #define TRANSLATE_NONE 0
58 : #define TRANSLATE_VALUE 1
59 : #define TRANSLATE_ATTRIBUTE 2
60 : #define TRANSLATE_MEASURE 4
61 : #define TRANSLATE_NUMBER_TO_STRING 8
62 :
63 : const int AFTEREFFECT_NONE = 0;
64 : const int AFTEREFFECT_COLOR = 1;
65 : const int AFTEREFFECT_SET = 2;
66 :
67 5 : class AnimationExporter
68 : {
69 : ::com::sun::star::uno::Any aTarget;
70 :
71 : static void writeZString( SvStream& rStrm, const OUString& rVal );
72 : static bool getColorAny( const ::com::sun::star::uno::Any& rAny, const sal_Int16 nColorSpace, sal_Int32& rMode, sal_Int32& rA, sal_Int32& rB, sal_Int32& rC );
73 : static bool exportAnimProperty( SvStream& rStrm, const sal_uInt16 nPropertyId, const ::com::sun::star::uno::Any& rAny, const TranslateMode eTranslateMode );
74 : static void exportAnimPropertyString( SvStream& rStrm, const sal_uInt16 nPropertyId, const OUString& rVal, const TranslateMode eTranslateMode );
75 : static void exportAnimPropertyFloat( SvStream& rStrm, const sal_uInt16 nPropertyId, const double& rVal, const TranslateMode eTranslateMode );
76 : static void exportAnimPropertyuInt32( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt32 nVal, const TranslateMode eTranslateMode );
77 : static void exportAnimPropertyByte( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt8 nVal, const TranslateMode eTranslateMode );
78 :
79 : /** if available exportAnimPropertySet
80 : @return the ::com::sun::star::presentation::EffectNodeType*/
81 : static sal_Int16 exportAnimPropertySet( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
82 : static void exportAnimNode( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
83 : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >* pParent, const sal_Int32 nGroupLevel, const sal_Int16 nFillDefault );
84 : void exportAnimate( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
85 : void exportAnimateTarget( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_uInt32 nForceAttributeName = 0, int nAfterEffectType = AFTEREFFECT_NONE );
86 : void exportAnimateSet( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, int nAfterEffectType );
87 : static void exportAnimAction( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
88 : void exportAnimEvent( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_Int32 nFlags = 0 );
89 : void exportNode( SvStream& rStrm, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > xNode,
90 : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >* xParent,
91 : const sal_uInt16 nContainerRecType, const sal_uInt16 nInstance, const sal_Int32 nGroupLevel, const bool bTakeBackInteractiveSequenceTiming,
92 : const sal_Int16 nFillDefault );
93 : void exportAnimateTargetElement( SvStream& rStrm, const ::com::sun::star::uno::Any& rAny, const bool bCreate2b01Atom );
94 : static void exportAnimateKeyPoints( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimate >& xAnimate );
95 : static void exportAnimValue( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const bool bExportAlways );
96 : void exportTransitionFilter( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
97 : void exportAnimateMotion( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
98 : void exportAnimateTransform( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
99 : void exportAnimateColor( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, int nAfterEffectType );
100 : void exportIterate( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
101 :
102 : const EscherSolverContainer& mrSolverContainer;
103 : ppt::ExSoundCollection& mrExSoundCollection;
104 : void processAfterEffectNodes( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
105 :
106 : bool isAfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
107 : bool hasAfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAfterEffectNode ) const;
108 : bool isEmptyNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
109 :
110 : static ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > createAfterEffectNodeClone( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
111 :
112 : std::list< AfterEffectNodePtr > maAfterEffectNodes;
113 :
114 : public:
115 : AnimationExporter( const EscherSolverContainer& rSolverContainer, ppt::ExSoundCollection& rExSoundCollection );
116 :
117 : void doexport( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, SvStream& rStrm );
118 :
119 : sal_Int32 mnCurrentGroup;
120 :
121 : // helper methods also used in ooxml export
122 : static ::com::sun::star::uno::Any convertAnimateValue( const ::com::sun::star::uno::Any& rSource, const OUString& rAttributeName );
123 : static bool GetNodeType( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, sal_Int16& nType );
124 : static sal_Int16 GetFillMode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_Int16 nFillDefault );
125 : static void GetUserData( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rUserData, const ::com::sun::star::uno::Any ** pAny, sal_Size 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 );
129 :
130 : static const sal_Char* FindTransitionName( const sal_Int16 nType, const sal_Int16 nSubType, const bool bDirection );
131 : static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getTargetElementShape( const ::com::sun::star::uno::Any& rAny, sal_Int32& rBegin, sal_Int32& rEnd, bool& rParagraphTarget );
132 : };
133 : } // namespace ppt
134 :
135 : #endif
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|