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