xref: /AOO41X/main/sd/source/ui/animations/CustomAnimationPane.hxx (revision ca62e2c2083b5d0995f1245bad6c2edfb455fbec)
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 #ifndef _SD_CUSTOMANIMATIONPANE_HXX
25 #define _SD_CUSTOMANIMATIONPANE_HXX
26 
27 #include <com/sun/star/drawing/XDrawView.hpp>
28 #include <com/sun/star/frame/XModel.hpp>
29 #include <vcl/dialog.hxx>
30 #include "CustomAnimationPreset.hxx"
31 #include "CustomAnimationList.hxx"
32 #include "CustomAnimationCreateDialog.hxx"
33 
34 #include "motionpathtag.hxx"
35 #include "misc/scopelock.hxx"
36 
37 #include <vector>
38 
39 class PushButton;
40 class FixedLine;
41 class FixedText;
42 class ListBox;
43 class ComboBox;
44 class CheckBox;
45 class SdDrawDocument;
46 
47 namespace com { namespace sun { namespace star { namespace animations {
48     class XAnimationNode;
49 } } } }
50 
51 namespace sd { namespace tools {
52 class EventMultiplexerEvent;
53 } }
54 
55 namespace sd {
56 
57 class PropertyControl;
58 class STLPropertySet;
59 class ViewShellBase;
60 
61 typedef std::vector< rtl::Reference< MotionPathTag > > MotionPathTagVector;
62 
63 // --------------------------------------------------------------------
64 
65 class CustomAnimationPane : public Control, public ICustomAnimationListController
66 {
67     friend class MotionPathTag;
68 public:
69     CustomAnimationPane( ::Window* pParent, ViewShellBase& rBase, const Size& rMinSize );
70     virtual ~CustomAnimationPane();
71 
72     // callbacks
73     void onSelectionChanged();
74     void onChangeCurrentPage();
75     void onChange( bool bCreate );
76     void onRemove();
77     void onChangeStart();
78     void onChangeStart( sal_Int16 nNodeType );
79     void onChangeProperty();
80     void onChangeSpeed();
81 
82     // methods
83     void preview( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode );
84     void remove( CustomAnimationEffectPtr& pEffect );
85 
86     // Control
87     virtual void Resize();
88     virtual void StateChanged( StateChangedType nStateChange );
89     virtual void KeyInput( const KeyEvent& rKEvt );
90 
91     // ICustomAnimationListController
92     virtual void onSelect();
93     virtual void onDoubleClick();
94     virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry );
95 
96     // Window
97     virtual void DataChanged (const DataChangedEvent& rEvent);
98 
99     void addUndo();
100 
101     void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag );
102 
103 private:
104     void addListener();
105     void removeListener();
106     void updateLayout();
107     void updateControls();
108     void updateMotionPathTags();
109     void markShapesFromSelectedEffects();
110 
111     void showOptions( sal_uInt16 nPage = 0 );
112     void moveSelection( bool bUp );
113     void onPreview( bool bForcePreview );
114 
115     void createPath( PathKind eKind, std::vector< ::com::sun::star::uno::Any >& rTargets, double fDuration );
116 
117     STLPropertySet* createSelectionSet();
118     void changeSelection( STLPropertySet* pResultSet, STLPropertySet* pOldSet );
119 
120     ::com::sun::star::uno::Any getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect );
121     bool setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const ::com::sun::star::uno::Any& rValue );
122     void UpdateLook (void);
123 
124     DECL_LINK( implControlHdl, Control* );
125     DECL_LINK( implPropertyHdl, Control* );
126     DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
127     DECL_LINK(lateInitCallback, Timer*);
128 
129 private:
130     ViewShellBase& mrBase;
131 
132     const CustomAnimationPresets* mpCustomAnimationPresets;
133 
134     FixedLine*  mpFLModify;
135     PushButton* mpPBAddEffect;
136     PushButton* mpPBChangeEffect;
137     PushButton* mpPBRemoveEffect;
138     FixedLine*  mpFLEffect;
139     FixedText*  mpFTStart;
140     ListBox*    mpLBStart;
141     FixedText*  mpFTProperty;
142     PropertyControl*    mpLBProperty;
143     PushButton* mpPBPropertyMore;
144     FixedText*  mpFTSpeed;
145     ComboBox*   mpCBSpeed;
146     CustomAnimationList*    mpCustomAnimationList;
147     FixedText*  mpFTChangeOrder;
148     PushButton* mpPBMoveUp;
149     PushButton* mpPBMoveDown;
150     FixedLine*  mpFLSeperator1;
151     PushButton* mpPBPlay;
152     PushButton* mpPBSlideShow;
153     FixedLine*  mpFLSeperator2;
154     CheckBox*   mpCBAutoPreview;
155 
156     String      maStrModify;
157     String      maStrProperty;
158 
159     sal_Int32   mnPropertyType;
160 
161     Size        maMinSize;
162 
163     EffectSequence maListSelection;
164     ::com::sun::star::uno::Any maViewSelection;
165 
166     MainSequencePtr mpMainSequence;
167 
168     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxCurrentPage;
169     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
170     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
171 
172     /** The mpCustomAnimationPresets is initialized either on demand or
173         after a short time after the construction of a new object of this
174         class.  This timer is responsible for the later.
175     */
176     Timer maLateInitTimer;
177 
178     /** This method initializes the mpCustomAnimationPresets on demand and
179         returns a reference to the list.
180     */
181     const CustomAnimationPresets& getPresets (void);
182 
183     MotionPathTagVector maMotionPathTags;
184 
185     ScopeLock maSelectionLock;
186 };
187 
188 }
189 
190 #endif // _SD_CUSTOMANIMATIONPANE_HXX
191