1c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c45d927aSAndrew Rist  * distributed with this work for additional information
6c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10c45d927aSAndrew Rist  *
11c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12c45d927aSAndrew Rist  *
13c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17c45d927aSAndrew Rist  * specific language governing permissions and limitations
18c45d927aSAndrew Rist  * under the License.
19c45d927aSAndrew Rist  *
20c45d927aSAndrew Rist  *************************************************************/
21c45d927aSAndrew Rist 
22c45d927aSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _SD_CUSTOMANIMATIONPANE_HXX
25cdf0e10cSrcweir #define _SD_CUSTOMANIMATIONPANE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp>
28cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
29cdf0e10cSrcweir #include <vcl/dialog.hxx>
30cdf0e10cSrcweir #include "CustomAnimationPreset.hxx"
31cdf0e10cSrcweir #include "CustomAnimationList.hxx"
32cdf0e10cSrcweir #include "CustomAnimationCreateDialog.hxx"
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include "motionpathtag.hxx"
35cdf0e10cSrcweir #include "misc/scopelock.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <vector>
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class PushButton;
40cdf0e10cSrcweir class FixedLine;
41cdf0e10cSrcweir class FixedText;
42cdf0e10cSrcweir class ListBox;
43cdf0e10cSrcweir class ComboBox;
44cdf0e10cSrcweir class CheckBox;
45cdf0e10cSrcweir class SdDrawDocument;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace animations {
48cdf0e10cSrcweir 	class XAnimationNode;
49cdf0e10cSrcweir } } } }
50cdf0e10cSrcweir 
51cdf0e10cSrcweir namespace sd { namespace tools {
52cdf0e10cSrcweir class EventMultiplexerEvent;
53cdf0e10cSrcweir } }
54cdf0e10cSrcweir 
55cdf0e10cSrcweir namespace sd {
56cdf0e10cSrcweir 
57cdf0e10cSrcweir class PropertyControl;
58cdf0e10cSrcweir class STLPropertySet;
59cdf0e10cSrcweir class ViewShellBase;
60cdf0e10cSrcweir 
61cdf0e10cSrcweir typedef std::vector< rtl::Reference< MotionPathTag > > MotionPathTagVector;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir // --------------------------------------------------------------------
64cdf0e10cSrcweir 
65cdf0e10cSrcweir class CustomAnimationPane : public Control, public ICustomAnimationListController
66cdf0e10cSrcweir {
67cdf0e10cSrcweir 	friend class MotionPathTag;
68cdf0e10cSrcweir public:
69cdf0e10cSrcweir 	CustomAnimationPane( ::Window* pParent, ViewShellBase& rBase, const Size& rMinSize );
70cdf0e10cSrcweir 	virtual ~CustomAnimationPane();
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 	// callbacks
73cdf0e10cSrcweir 	void onSelectionChanged();
74cdf0e10cSrcweir 	void onChangeCurrentPage();
75cdf0e10cSrcweir 	void onChange( bool bCreate );
76cdf0e10cSrcweir 	void onRemove();
77cdf0e10cSrcweir 	void onChangeStart();
78cdf0e10cSrcweir 	void onChangeStart( sal_Int16 nNodeType );
79cdf0e10cSrcweir 	void onChangeProperty();
80cdf0e10cSrcweir 	void onChangeSpeed();
81cdf0e10cSrcweir 
82cdf0e10cSrcweir 	// methods
83cdf0e10cSrcweir 	void preview( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode );
84cdf0e10cSrcweir 	void remove( CustomAnimationEffectPtr& pEffect );
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	// Control
87cdf0e10cSrcweir 	virtual void Resize();
88cdf0e10cSrcweir 	virtual void StateChanged( StateChangedType nStateChange );
89cdf0e10cSrcweir 	virtual void KeyInput( const KeyEvent& rKEvt );
90cdf0e10cSrcweir 
91cdf0e10cSrcweir 	// ICustomAnimationListController
92cdf0e10cSrcweir 	virtual void onSelect();
93cdf0e10cSrcweir 	virtual void onDoubleClick();
94cdf0e10cSrcweir 	virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry );
95cdf0e10cSrcweir 
96*7a32b0c8SAndre Fischer     // Window
97*7a32b0c8SAndre Fischer     virtual void DataChanged (const DataChangedEvent& rEvent);
98*7a32b0c8SAndre Fischer 
99cdf0e10cSrcweir 	void addUndo();
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 	void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir private:
104cdf0e10cSrcweir 	void addListener();
105cdf0e10cSrcweir 	void removeListener();
106cdf0e10cSrcweir 	void updateLayout();
107cdf0e10cSrcweir 	void updateControls();
108cdf0e10cSrcweir 	void updateMotionPathTags();
109cdf0e10cSrcweir 	void markShapesFromSelectedEffects();
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	void showOptions( sal_uInt16 nPage = 0 );
112cdf0e10cSrcweir 	void moveSelection( bool bUp );
113cdf0e10cSrcweir 	void onPreview( bool bForcePreview );
114cdf0e10cSrcweir 
115cdf0e10cSrcweir 	void createPath( PathKind eKind, std::vector< ::com::sun::star::uno::Any >& rTargets, double fDuration );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	STLPropertySet* createSelectionSet();
118cdf0e10cSrcweir 	void changeSelection( STLPropertySet* pResultSet, STLPropertySet* pOldSet );
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	::com::sun::star::uno::Any getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect );
121cdf0e10cSrcweir 	bool setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const ::com::sun::star::uno::Any& rValue );
122*7a32b0c8SAndre Fischer     void UpdateLook (void);
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	DECL_LINK( implControlHdl, Control* );
125cdf0e10cSrcweir 	DECL_LINK( implPropertyHdl, Control* );
126cdf0e10cSrcweir     DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
127cdf0e10cSrcweir     DECL_LINK(lateInitCallback, Timer*);
128cdf0e10cSrcweir 
129cdf0e10cSrcweir private:
130cdf0e10cSrcweir 	ViewShellBase& mrBase;
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 	const CustomAnimationPresets* mpCustomAnimationPresets;
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 	FixedLine*	mpFLModify;
135cdf0e10cSrcweir 	PushButton*	mpPBAddEffect;
136cdf0e10cSrcweir 	PushButton* mpPBChangeEffect;
137cdf0e10cSrcweir 	PushButton*	mpPBRemoveEffect;
138cdf0e10cSrcweir 	FixedLine*	mpFLEffect;
139cdf0e10cSrcweir 	FixedText*	mpFTStart;
140cdf0e10cSrcweir 	ListBox*	mpLBStart;
141cdf0e10cSrcweir 	FixedText*	mpFTProperty;
142cdf0e10cSrcweir 	PropertyControl*	mpLBProperty;
143cdf0e10cSrcweir 	PushButton*	mpPBPropertyMore;
144cdf0e10cSrcweir 	FixedText*	mpFTSpeed;
145cdf0e10cSrcweir 	ComboBox*	mpCBSpeed;
146cdf0e10cSrcweir 	CustomAnimationList*	mpCustomAnimationList;
147cdf0e10cSrcweir 	FixedText*	mpFTChangeOrder;
148cdf0e10cSrcweir 	PushButton*	mpPBMoveUp;
149cdf0e10cSrcweir 	PushButton* mpPBMoveDown;
150cdf0e10cSrcweir 	FixedLine*	mpFLSeperator1;
151cdf0e10cSrcweir 	PushButton*	mpPBPlay;
152cdf0e10cSrcweir 	PushButton* mpPBSlideShow;
153cdf0e10cSrcweir 	FixedLine*	mpFLSeperator2;
154cdf0e10cSrcweir 	CheckBox*	mpCBAutoPreview;
155cdf0e10cSrcweir 
156cdf0e10cSrcweir 	String		maStrModify;
157cdf0e10cSrcweir 	String		maStrProperty;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	sal_Int32	mnPropertyType;
160cdf0e10cSrcweir 
161cdf0e10cSrcweir 	Size		maMinSize;
162cdf0e10cSrcweir 
163cdf0e10cSrcweir 	EffectSequence maListSelection;
164cdf0e10cSrcweir 	::com::sun::star::uno::Any maViewSelection;
165cdf0e10cSrcweir 
166cdf0e10cSrcweir 	MainSequencePtr	mpMainSequence;
167cdf0e10cSrcweir 
168cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxCurrentPage;
169cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
170cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
171cdf0e10cSrcweir 
172cdf0e10cSrcweir     /** The mpCustomAnimationPresets is initialized either on demand or
173cdf0e10cSrcweir         after a short time after the construction of a new object of this
174cdf0e10cSrcweir         class.  This timer is responsible for the later.
175cdf0e10cSrcweir     */
176cdf0e10cSrcweir     Timer maLateInitTimer;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir     /** This method initializes the mpCustomAnimationPresets on demand and
179cdf0e10cSrcweir         returns a reference to the list.
180cdf0e10cSrcweir     */
181cdf0e10cSrcweir     const CustomAnimationPresets& getPresets (void);
182cdf0e10cSrcweir 
183cdf0e10cSrcweir 	MotionPathTagVector maMotionPathTags;
184cdf0e10cSrcweir 
185cdf0e10cSrcweir 	ScopeLock maSelectionLock;
186cdf0e10cSrcweir };
187cdf0e10cSrcweir 
188cdf0e10cSrcweir }
189cdf0e10cSrcweir 
190cdf0e10cSrcweir #endif // _SD_CUSTOMANIMATIONPANE_HXX
191