1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SD_PPT_INANIMATIONS_HXX
25 #define _SD_PPT_INANIMATIONS_HXX
26 
27 #include <com/sun/star/animations/XTimeContainer.hpp>
28 #include <com/sun/star/drawing/XDrawPage.hpp>
29 
30 #include "pptanimations.hxx"
31 #include <animations.hxx>
32 
33 #ifdef DBG_ANIM_LOG
34 #include <stdio.h>
35 #endif
36 #include <filter/msfilter/svdfppt.hxx>
37 
38 #include <list>
39 
40 class DffRecordHeader;
41 class SdPage;
42 class SvStream;
43 class ImplSdPPTImport;
44 
45 namespace ppt
46 {
47 class PropertySet;
48 class Atom;
49 
50 class AnimationImporter
51 {
52 public:
53 	AnimationImporter( ImplSdPPTImport* pPPTImport, SvStream& rStCtrl );
54 
55 	void import( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xPage, const DffRecordHeader& rProgTagContentHd );
56 
57 private:
58 	void importAnimationContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xParent );
59 	void importTimeContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
60 	void importAnimationNodeContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
61 
62 	void importAnimateSetContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
63 	void importAnimateFilterContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
64 	void importAnimateContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
65 	void importAnimateScaleContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
66 	void importAnimateColorContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
67 	void importAnimateRotationContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
68 	void importAnimateMotionContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
69 	void importCommandContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
70 	void importAudioContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
71 
72 	void importAnimationEvents( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
73 	void importAnimationValues( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
74 	void importAnimationActions( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
75 	void importAnimateAttributeTargetContainer( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
76 
77 	void importAnimateKeyPoints( const Atom* pAtom, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
78 	void importPropertySetContainer( const Atom* pAtom,PropertySet& rSet );
79 	bool importAttributeValue( const Atom* pAtom, com::sun::star::uno::Any& rAny );
80 	bool importAttributeNamesContainer( const Atom* pAtom, rtl::OUString& rAttributeNames );
81 	sal_Int32 importTargetElementContainer( const Atom* pAtom, ::com::sun::star::uno::Any& rTarget, sal_Int16& nSubType );
82 
83 	void fillNode( ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xTiming, const AnimationNode& rNode, const PropertySet& rSet );
84 	::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > createNode( const Atom* pAtom, const AnimationNode& rNode );
85 
86 	bool convertAnimationNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode, const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xParent );
87 	bool convertAnimationValue( MS_AttributeNames eAttribute, com::sun::star::uno::Any& rValue );
88 
89 	void fixMainSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
90 	void fixInteractiveSequenceTiming( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
91 
92 	void processAfterEffectNodes();
93 
94 	::com::sun::star::uno::Any 	implGetColorAny( sal_Int32 nMode, sal_Int32  nA, sal_Int32 nB, sal_Int32 nC );
95     sal_Int16 					implGetColorSpace( sal_Int32 nMode, sal_Int32  nA, sal_Int32 nB, sal_Int32 nC );
96 
97 private:
98 	::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxRootNode;
99 
100 	ImplSdPPTImport* mpPPTImport;
101 	SvStream&	mrStCtrl;
102 
103 	sd::AfterEffectNodeList	maAfterEffectNodes;
104 
105 #ifdef DBG_ANIM_LOG
106 	FILE * mpFile;
107 	void dump_anim_group( const Atom* pAtom, const AnimationNode& rNode, const PropertySet& rSet, bool bOpen );
108 	void dump( const rtl::OUString& rString );
109 	void dump( sal_uInt32 nLen, bool bNewLine = true );
110 #endif
111 
112 	void dump_atom_header( const Atom* pAtom, bool bOpen, bool bAppend );
113 	void dump_atom( const Atom* pAtom, bool bNewLine = true );
114 	void dump_target( ::com::sun::star::uno::Any& rAny );
115 	void dump( ::com::sun::star::uno::Any& rAny );
116 	void dump( const PropertySet& rSet );
117 	void dump( const AnimationNode& rNode );
118 	void dump( const char * pText );
119 	void dump( const char * pText, sal_Int32 nInt );
120 	void dump( const char * pText, double fDouble );
121 	void dump( const char * pText, const char * pText2 );
122 	void dump( const char * pText, const rtl::OUString& rString );
123 };
124 
125 } // namespace ppt
126 
127 #endif
128