xref: /aoo41x/main/oox/inc/oox/ppt/timenode.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 
29 #ifndef OOX_DRAWINGML_TIMENODE_HXX
30 #define OOX_DRAWINGML_TIMENODE_HXX
31 
32 #include <boost/shared_ptr.hpp>
33 #include <vector>
34 #include <list>
35 #include <rtl/ustring.hxx>
36 
37 #include <com/sun/star/frame/XModel.hpp>
38 #include <com/sun/star/animations/XAnimationNode.hpp>
39 #include "oox/helper/propertymap.hxx"
40 #include "oox/ppt/slidetransition.hxx"
41 #include "oox/ppt/slidepersist.hxx"
42 #include "oox/ppt/animationspersist.hxx"
43 #include "oox/ppt/timenode.hxx"
44 
45 namespace oox { namespace ppt {
46 
47 	class TimeNode;
48 	class SlideTransition;
49 
50 	typedef boost::shared_ptr< TimeNode > TimeNodePtr;
51 	typedef ::std::list< TimeNodePtr > TimeNodePtrList;
52 
53 	class TimeNode
54 	{
55 	public:
56         typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any > UserDataMap;
57 
58 		TimeNode( sal_Int16 nNodeType );
59 		virtual ~TimeNode();
60 
61 		NodePropertyMap & getNodeProperties() { return maNodeProperties; }
62         UserDataMap & getUserData() { return maUserData; }
63 		void addChild( const TimeNodePtr & pChildPtr )
64             { maChildren.push_back( pChildPtr ); }
65 
66         TimeNodePtrList & getChildren()
67             { return maChildren; }
68 
69 		void setId( sal_Int32 nId );
70 		const ::rtl::OUString & getId() const { return msId; }
71 
72         void addNode(
73             const ::oox::core::XmlFilterBase& rFilter,
74             const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rxNode,
75             const SlidePersistPtr & slide);
76 		// data setters
77 		void setTo( const ::com::sun::star::uno::Any & aTo );
78 		void setFrom( const ::com::sun::star::uno::Any & aFrom );
79 		void setBy( const ::com::sun::star::uno::Any & aBy );
80 		void setTransitionFilter( const SlideTransition & aTransition)
81 			{ maTransitionFilter = aTransition; }
82 
83         void setNode(
84             const ::oox::core::XmlFilterBase& rFilter,
85             const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode,
86             const SlidePersistPtr & pSlide );
87 
88 		AnimTargetElementPtr getTarget()
89 			{
90 				if( !mpTarget )
91 					mpTarget.reset( new AnimTargetElement );
92 				return mpTarget;
93 			}
94 
95 		AnimationConditionList &getStartCondition()
96 			{ return maStCondList; }
97 		AnimationConditionList &getEndCondition()
98 			{ return maEndCondList; }
99 		AnimationConditionList &getNextCondition()
100 			{ return maNextCondList; }
101 		AnimationConditionList &getPrevCondition()
102 			{ return maPrevCondList; }
103 		AnimationCondition & getEndSyncValue()
104 			{ mbHasEndSyncValue = true; return maEndSyncValue; }
105 	protected:
106 
107 		static rtl::OUString getServiceName( sal_Int16 nNodeType );
108 
109 		::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >
110         createAndInsert(
111             const ::oox::core::XmlFilterBase& rFilter,
112             const rtl::OUString& rServiceName,
113             const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& rxNode );
114 
115 	private:
116 		const sal_Int16 mnNodeType;
117 
118         TimeNodePtrList maChildren;
119 
120 		rtl::OUString	msId;
121 		NodePropertyMap	           maNodeProperties;
122         UserDataMap                maUserData; // a sequence to be stored as "UserData" property
123 		SlideTransition            maTransitionFilter;
124 		AnimTargetElementPtr       mpTarget;
125 		bool                       mbHasEndSyncValue; // set to true if we try to get the endSync.
126 		AnimationCondition         maEndSyncValue;
127 	    AnimationConditionList     maStCondList, maEndCondList;
128 		AnimationConditionList     maPrevCondList, maNextCondList;
129 	};
130 
131 } }
132 
133 
134 #endif
135