Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SD_PPT_EXANIMATIONS_HXX
30 : : #define _SD_PPT_EXANIMATIONS_HXX
31 : :
32 : : #include <com/sun/star/animations/XTimeContainer.hpp>
33 : : #include <com/sun/star/drawing/XDrawPage.hpp>
34 : : #include <com/sun/star/animations/XAnimate.hpp>
35 : : #include <com/sun/star/beans/NamedValue.hpp>
36 : : #include "../ppt/pptanimations.hxx"
37 : : #include <pptexsoundcollection.hxx>
38 : : #include <filter/msfilter/escherex.hxx>
39 : :
40 : : #ifdef DBG_ANIM_LOG
41 : : #include <stdio.h>
42 : : #endif
43 : :
44 : : #include <boost/shared_ptr.hpp>
45 : :
46 : : #include <list>
47 : :
48 : : class SvStream;
49 : :
50 : : namespace ppt
51 : : {
52 : :
53 : 0 : struct AfterEffectNode
54 : : {
55 : : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxNode;
56 : : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxMaster;
57 : :
58 : 0 : AfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
59 : : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xMaster )
60 : 0 : : mxNode( xNode ), mxMaster( xMaster ) {}
61 : : };
62 : :
63 : : typedef boost::shared_ptr< AfterEffectNode > AfterEffectNodePtr;
64 : :
65 : : typedef sal_uInt32 TranslateMode;
66 : : #define TRANSLATE_NONE 0
67 : : #define TRANSLATE_VALUE 1
68 : : #define TRANSLATE_ATTRIBUTE 2
69 : : #define TRANSLATE_MEASURE 4
70 : : #define TRANSLATE_NUMBER_TO_STRING 8
71 : :
72 : : const int AFTEREFFECT_NONE = 0;
73 : : const int AFTEREFFECT_COLOR = 1;
74 : : const int AFTEREFFECT_SET = 2;
75 : :
76 : 0 : class AnimationExporter
77 : : {
78 : : ::com::sun::star::uno::Any aTarget;
79 : :
80 : : void writeZString( SvStream& rStrm, const rtl::OUString& rVal );
81 : : sal_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 ) const;
82 : : sal_Bool exportAnimProperty( SvStream& rStrm, const sal_uInt16 nPropertyId, const ::com::sun::star::uno::Any& rAny, const TranslateMode eTranslateMode );
83 : : void exportAnimPropertyString( SvStream& rStrm, const sal_uInt16 nPropertyId, const rtl::OUString& rVal, const TranslateMode eTranslateMode );
84 : : void exportAnimPropertyFloat( SvStream& rStrm, const sal_uInt16 nPropertyId, const double& rVal, const TranslateMode eTranslateMode );
85 : : void exportAnimPropertyuInt32( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt32 nVal, const TranslateMode eTranslateMode );
86 : : void exportAnimPropertyByte( SvStream& rStrm, const sal_uInt16 nPropertyId, const sal_uInt8 nVal, const TranslateMode eTranslateMode );
87 : :
88 : : /** if available exportAnimPropertySet
89 : : @return the ::com::sun::star::presentation::EffectNodeType*/
90 : : sal_Int16 exportAnimPropertySet( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
91 : : void exportAnimNode( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
92 : : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >* pParent, const sal_Int32 nGroupLevel, const sal_Int16 nFillDefault );
93 : : void exportAnimate( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
94 : : 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 );
95 : : void exportAnimateSet( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, int nAfterEffectType );
96 : : void exportAnimAction( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
97 : : void exportAnimEvent( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_Int32 nFlags = 0 );
98 : : void exportNode( SvStream& rStrm, ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > xNode,
99 : : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >* xParent,
100 : : const sal_uInt16 nContainerRecType, const sal_uInt16 nInstance, const sal_Int32 nGroupLevel, const sal_Bool bTakeBackInteractiveSequenceTiming,
101 : : const sal_Int16 nFillDefault );
102 : : void exportAnimateTargetElement( SvStream& rStrm, const ::com::sun::star::uno::Any aAny, const sal_Bool bCreate2b01Atom );
103 : : void exportAnimateKeyPoints( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimate >& xAnimate );
104 : : void exportAnimValue( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_Bool bExportAlways );
105 : : void exportTransitionFilter( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
106 : : void exportAnimateMotion( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
107 : : void exportAnimateTransform( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
108 : : void exportAnimateColor( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, int nAfterEffectType );
109 : : void exportIterate( SvStream& rStrm, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
110 : :
111 : : const EscherSolverContainer& mrSolverContainer;
112 : : ppt::ExSoundCollection& mrExSoundCollection;
113 : : void processAfterEffectNodes( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
114 : :
115 : : bool isAfterEffectNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
116 : : 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;
117 : : bool isEmptyNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
118 : :
119 : : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > createAfterEffectNodeClone( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
120 : :
121 : : std::list< AfterEffectNodePtr > maAfterEffectNodes;
122 : :
123 : : public:
124 : : AnimationExporter( const EscherSolverContainer& rSolverContainer, ppt::ExSoundCollection& rExSoundCollection );
125 : :
126 : : void doexport( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, SvStream& rStrm );
127 : :
128 : : sal_Int32 mnCurrentGroup;
129 : :
130 : : // helper methods also used in ooxml export
131 : : static ::com::sun::star::uno::Any convertAnimateValue( const ::com::sun::star::uno::Any& rSource, const rtl::OUString& rAttributeName );
132 : : static sal_Bool GetNodeType( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, sal_Int16& nType );
133 : : static sal_Int16 GetFillMode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const sal_Int16 nFillDefault );
134 : : 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 );
135 : : static sal_uInt32 TranslatePresetSubType( const sal_uInt32 nPresetClass, const sal_uInt32 nPresetId, const rtl::OUString& rPresetSubType );
136 : : static sal_uInt32 GetPresetID( const rtl::OUString& rPreset, sal_uInt32 nAPIPresetClass, sal_Bool& bPresetId );
137 : : static sal_uInt32 GetValueTypeForAttributeName( const rtl::OUString& rAttributeName );
138 : :
139 : : static const sal_Char* FindTransitionName( const sal_Int16 nType, const sal_Int16 nSubType, const sal_Bool bDirection );
140 : : 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, sal_Bool& rParagraphTarget );
141 : : };
142 : : } // namespace ppt
143 : :
144 : : #endif
145 : :
146 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|