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 #ifndef INCLUDED_SLIDESHOW_ANIMATIONBASENODE_HXX
28 #define INCLUDED_SLIDESHOW_ANIMATIONBASENODE_HXX
29 
30 #include <com/sun/star/animations/XAnimate.hpp>
31 
32 #include "basecontainernode.hxx"
33 #include "activitiesfactory.hxx"
34 #include "shapeattributelayer.hxx"
35 #include "shapeattributelayerholder.hxx"
36 #include "attributableshape.hxx"
37 #include "shapesubset.hxx"
38 
39 namespace slideshow {
40 namespace internal {
41 
42 /** Common base class for all leaf animation nodes.
43 
44     This class basically holds the target shape
45 */
46 class AnimationBaseNode : public BaseNode
47 {
48 public:
49     AnimationBaseNode(
50         ::com::sun::star::uno::Reference<
51         ::com::sun::star::animations::XAnimationNode> const& xNode,
52         ::boost::shared_ptr<BaseContainerNode> const& pParent,
53         NodeContext const& rContext );
54 
55 #if defined(VERBOSE) && defined(DBG_UTIL)
56     virtual void showState() const;
57 #endif
58 
59 protected:
60     virtual void dispose();
61 
62     ::com::sun::star::uno::Reference<
63         ::com::sun::star::animations::XAnimate> const& getXAnimateNode() const
64         { return mxAnimateNode; }
65 
66     /// Create parameter struct for ActivitiesFactory
67     ActivitiesFactory::CommonParameters fillCommonParameters() const;
68     ::basegfx::B2DVector const&         getSlideSize() const { return maSlideSize; }
69     AttributableShapeSharedPtr          getShape() const;
70 
71 private:
72     virtual bool hasPendingAnimation() const;
73 
74 private: // state transition callbacks
75     virtual bool init_st();
76     virtual bool resolve_st();
77     virtual void activate_st();
78     virtual void deactivate_st( NodeState eDestState );
79     virtual AnimationActivitySharedPtr createActivity() const = 0;
80 
81 private:
82     /** Returns true, if this is a subset animation, and
83         the subset is autogenerated (e.g. from an
84         iteration)
85     */
86     bool isDependentSubsettedShape() const
87         { return mpShapeSubset && !mbIsIndependentSubset; }
88 
89     ShapeAttributeLayerHolder const & getAttributeLayerHolder() const
90         { return maAttributeLayerHolder; }
91 
92 private:
93     ::com::sun::star::uno::Reference<
94         ::com::sun::star::animations::XAnimate>     mxAnimateNode;
95     ShapeAttributeLayerHolder                       maAttributeLayerHolder;
96     ::basegfx::B2DVector                            maSlideSize;
97     AnimationActivitySharedPtr                      mpActivity;
98 
99     /// When valid, this node has a plain target shape
100     AttributableShapeSharedPtr                      mpShape;
101     /// When valid, this is a subsetted target shape
102     ShapeSubsetSharedPtr                            mpShapeSubset;
103     SubsettableShapeManagerSharedPtr                mpSubsetManager;
104     bool                                            mbIsIndependentSubset;
105 };
106 
107 } // namespace internal
108 } // namespace presentation
109 
110 #endif /* INCLUDED_SLIDESHOW_ANIMATIONBASENODE_HXX */
111 
112