xref: /aoo4110/main/oox/inc/oox/ppt/timenode.hxx (revision b1cdbd2c)
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 
25 #ifndef OOX_DRAWINGML_TIMENODE_HXX
26 #define OOX_DRAWINGML_TIMENODE_HXX
27 
28 #include <boost/shared_ptr.hpp>
29 #include <vector>
30 #include <list>
31 #include <rtl/ustring.hxx>
32 
33 #include <com/sun/star/frame/XModel.hpp>
34 #include <com/sun/star/animations/XAnimationNode.hpp>
35 #include "oox/helper/propertymap.hxx"
36 #include "oox/ppt/slidetransition.hxx"
37 #include "oox/ppt/slidepersist.hxx"
38 #include "oox/ppt/animationspersist.hxx"
39 #include "oox/ppt/timenode.hxx"
40 
41 namespace oox { namespace ppt {
42 
43 	class TimeNode;
44 	class SlideTransition;
45 
46 	typedef boost::shared_ptr< TimeNode > TimeNodePtr;
47 	typedef ::std::list< TimeNodePtr > TimeNodePtrList;
48 
49 	class TimeNode
50 	{
51 	public:
52         typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any > UserDataMap;
53 
54 		TimeNode( sal_Int16 nNodeType );
55 		virtual ~TimeNode();
56 
getNodeProperties()57 		NodePropertyMap & getNodeProperties() { return maNodeProperties; }
getUserData()58         UserDataMap & getUserData() { return maUserData; }
addChild(const TimeNodePtr & pChildPtr)59 		void addChild( const TimeNodePtr & pChildPtr )
60             { maChildren.push_back( pChildPtr ); }
61 
getChildren()62         TimeNodePtrList & getChildren()
63             { return maChildren; }
64 
65 		void setId( sal_Int32 nId );
getId() const66 		const ::rtl::OUString & getId() const { return msId; }
67 
68         void addNode(
69             const ::oox::core::XmlFilterBase& rFilter,
70             const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rxNode,
71             const SlidePersistPtr & slide);
72 		// data setters
73 		void setTo( const ::com::sun::star::uno::Any & aTo );
74 		void setFrom( const ::com::sun::star::uno::Any & aFrom );
75 		void setBy( const ::com::sun::star::uno::Any & aBy );
setTransitionFilter(const SlideTransition & aTransition)76 		void setTransitionFilter( const SlideTransition & aTransition)
77 			{ maTransitionFilter = aTransition; }
78 
79         void setNode(
80             const ::oox::core::XmlFilterBase& rFilter,
81             const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
82             const SlidePersistPtr & pSlide );
83 
getTarget()84 		AnimTargetElementPtr getTarget()
85 			{
86 				if( !mpTarget )
87 					mpTarget.reset( new AnimTargetElement );
88 				return mpTarget;
89 			}
90 
getStartCondition()91 		AnimationConditionList &getStartCondition()
92 			{ return maStCondList; }
getEndCondition()93 		AnimationConditionList &getEndCondition()
94 			{ return maEndCondList; }
getNextCondition()95 		AnimationConditionList &getNextCondition()
96 			{ return maNextCondList; }
getPrevCondition()97 		AnimationConditionList &getPrevCondition()
98 			{ return maPrevCondList; }
getEndSyncValue()99 		AnimationCondition & getEndSyncValue()
100 			{ mbHasEndSyncValue = true; return maEndSyncValue; }
101 	protected:
102 
103 		static rtl::OUString getServiceName( sal_Int16 nNodeType );
104 
105 		::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
106         createAndInsert(
107             const ::oox::core::XmlFilterBase& rFilter,
108             const rtl::OUString& rServiceName,
109             const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rxNode );
110 
111 	private:
112 		const sal_Int16 mnNodeType;
113 
114         TimeNodePtrList maChildren;
115 
116 		rtl::OUString	msId;
117 		NodePropertyMap	           maNodeProperties;
118         UserDataMap                maUserData; // a sequence to be stored as "UserData" property
119 		SlideTransition            maTransitionFilter;
120 		AnimTargetElementPtr       mpTarget;
121 		bool                       mbHasEndSyncValue; // set to true if we try to get the endSync.
122 		AnimationCondition         maEndSyncValue;
123 	    AnimationConditionList     maStCondList, maEndCondList;
124 		AnimationConditionList     maPrevCondList, maNextCondList;
125 	};
126 
127 } }
128 
129 
130 #endif
131