Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
30 : : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
31 : :
32 : : #include <drawinglayer/drawinglayerdllapi.h>
33 : :
34 : : #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
35 : : #include <basegfx/matrix/b2dhommatrix.hxx>
36 : : #include <basegfx/matrix/b2dhommatrixtools.hxx>
37 : :
38 : : //////////////////////////////////////////////////////////////////////////////
39 : : // predefines
40 : : namespace drawinglayer { namespace animation {
41 : : class AnimationEntry;
42 : : }}
43 : :
44 : : //////////////////////////////////////////////////////////////////////////////
45 : :
46 : : namespace drawinglayer
47 : : {
48 : : namespace primitive2d
49 : : {
50 : : /** AnimatedSwitchPrimitive2D class
51 : :
52 : : This is the basic class for simple, animated primitives. The basic idea
53 : : is to have an animation definition (AnimationEntry) who's basic
54 : : functionality is to return a state value for any given animation time in
55 : : the range of [0.0 .. 1.0]. Depending on the state, the decomposition
56 : : calculates an index, which of the members of the child vector is to
57 : : be visualized.
58 : :
59 : : An example: For blinking, the Child vector should exist of two entries;
60 : : for values of [0.0 .. 0.5] the first, else the last entry will be used.
61 : : This mechanism is not limited to two entries, though.
62 : : */
63 : : class DRAWINGLAYER_DLLPUBLIC AnimatedSwitchPrimitive2D : public GroupPrimitive2D
64 : : {
65 : : private:
66 : : /**
67 : : The animation definition which allows translation of a point in time
68 : : to an animation state [0.0 .. 1.0]. This member contains a cloned
69 : : definition and is owned by this implementation.
70 : : */
71 : : animation::AnimationEntry* mpAnimationEntry;
72 : :
73 : : /// bitfield
74 : : /** flag if this is a text or graphic animation. Necessary since SdrViews need to differentiate
75 : : between both types if they are on/off
76 : : */
77 : : unsigned mbIsTextAnimation : 1;
78 : :
79 : : public:
80 : : /// constructor
81 : : AnimatedSwitchPrimitive2D(
82 : : const animation::AnimationEntry& rAnimationEntry,
83 : : const Primitive2DSequence& rChildren,
84 : : bool bIsTextAnimation);
85 : :
86 : : /// destructor - needed due to mpAnimationEntry
87 : : virtual ~AnimatedSwitchPrimitive2D();
88 : :
89 : : /// data read access
90 : 0 : const animation::AnimationEntry& getAnimationEntry() const { return *mpAnimationEntry; }
91 : 0 : bool isTextAnimation() const { return mbIsTextAnimation; }
92 : 0 : bool isGraphicAnimation() const { return !isTextAnimation(); }
93 : :
94 : : /// compare operator
95 : : virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
96 : :
97 : : /// provide unique ID
98 : : DeclPrimitrive2DIDBlock()
99 : :
100 : : /** The getDecomposition is overloaded here since the decompose is dependent of the point in time,
101 : : so the default implementation is nut useful here, it needs to be handled locally
102 : : */
103 : : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
104 : : };
105 : : } // end of namespace primitive2d
106 : : } // end of namespace drawinglayer
107 : :
108 : : //////////////////////////////////////////////////////////////////////////////
109 : :
110 : : namespace drawinglayer
111 : : {
112 : : namespace primitive2d
113 : : {
114 : : /** AnimatedBlinkPrimitive2D class
115 : :
116 : : Basically the same mechanism as in AnimatedSwitchPrimitive2D, but the
117 : : decomposition is specialized in delivering the children in the
118 : : range [0.0.. 0.5] and an empty sequence else
119 : : */
120 [ # # ]: 0 : class DRAWINGLAYER_DLLPUBLIC AnimatedBlinkPrimitive2D : public AnimatedSwitchPrimitive2D
121 : : {
122 : : protected:
123 : : public:
124 : : /// constructor
125 : : AnimatedBlinkPrimitive2D(
126 : : const animation::AnimationEntry& rAnimationEntry,
127 : : const Primitive2DSequence& rChildren,
128 : : bool bIsTextAnimation);
129 : :
130 : : /// create local decomposition
131 : : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
132 : :
133 : : /// provide unique ID
134 : : DeclPrimitrive2DIDBlock()
135 : : };
136 : : } // end of namespace primitive2d
137 : : } // end of namespace drawinglayer
138 : :
139 : : //////////////////////////////////////////////////////////////////////////////
140 : :
141 : : namespace drawinglayer
142 : : {
143 : : namespace primitive2d
144 : : {
145 : : /** AnimatedInterpolatePrimitive2D class
146 : :
147 : : Specialized on multi-step animations based on matrix transformations. The
148 : : Child sequelce will be embedded in a matrix transformation. That transformation
149 : : will be linearly combined from the decomposed values and the animation value
150 : : to allow a smooth animation.
151 : : */
152 [ # # ]: 0 : class DRAWINGLAYER_DLLPUBLIC AnimatedInterpolatePrimitive2D : public AnimatedSwitchPrimitive2D
153 : : {
154 : : private:
155 : : /// the transformations
156 : : std::vector< basegfx::tools::B2DHomMatrixBufferedDecompose > maMatrixStack;
157 : :
158 : : protected:
159 : : public:
160 : : /// constructor
161 : : AnimatedInterpolatePrimitive2D(
162 : : const std::vector< basegfx::B2DHomMatrix >& rmMatrixStack,
163 : : const animation::AnimationEntry& rAnimationEntry,
164 : : const Primitive2DSequence& rChildren,
165 : : bool bIsTextAnimation);
166 : :
167 : : /// create local decomposition
168 : : virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
169 : :
170 : : /// provide unique ID
171 : : DeclPrimitrive2DIDBlock()
172 : : };
173 : : } // end of namespace primitive2d
174 : : } // end of namespace drawinglayer
175 : :
176 : : //////////////////////////////////////////////////////////////////////////////
177 : :
178 : : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_ANIMATEDPRIMITIVE2D_HXX
179 : :
180 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|