1*c45d927aSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c45d927aSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c45d927aSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c45d927aSAndrew Rist  * distributed with this work for additional information
6*c45d927aSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c45d927aSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c45d927aSAndrew Rist  * "License"); you may not use this file except in compliance
9*c45d927aSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c45d927aSAndrew Rist  *
11*c45d927aSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c45d927aSAndrew Rist  *
13*c45d927aSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c45d927aSAndrew Rist  * software distributed under the License is distributed on an
15*c45d927aSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c45d927aSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c45d927aSAndrew Rist  * specific language governing permissions and limitations
18*c45d927aSAndrew Rist  * under the License.
19*c45d927aSAndrew Rist  *
20*c45d927aSAndrew Rist  *************************************************************/
21*c45d927aSAndrew Rist 
22*c45d927aSAndrew 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 
96cdf0e10cSrcweir 	void addUndo();
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag );
99cdf0e10cSrcweir 
100cdf0e10cSrcweir private:
101cdf0e10cSrcweir 	void addListener();
102cdf0e10cSrcweir 	void removeListener();
103cdf0e10cSrcweir 	void updateLayout();
104cdf0e10cSrcweir 	void updateControls();
105cdf0e10cSrcweir 	void updateMotionPathTags();
106cdf0e10cSrcweir 	void markShapesFromSelectedEffects();
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 	void showOptions( sal_uInt16 nPage = 0 );
109cdf0e10cSrcweir 	void moveSelection( bool bUp );
110cdf0e10cSrcweir 	void onPreview( bool bForcePreview );
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 	void createPath( PathKind eKind, std::vector< ::com::sun::star::uno::Any >& rTargets, double fDuration );
113cdf0e10cSrcweir 
114cdf0e10cSrcweir 	STLPropertySet* createSelectionSet();
115cdf0e10cSrcweir 	void changeSelection( STLPropertySet* pResultSet, STLPropertySet* pOldSet );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 	::com::sun::star::uno::Any getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect );
118cdf0e10cSrcweir 	bool setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const ::com::sun::star::uno::Any& rValue );
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 	DECL_LINK( implControlHdl, Control* );
121cdf0e10cSrcweir 	DECL_LINK( implPropertyHdl, Control* );
122cdf0e10cSrcweir     DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
123cdf0e10cSrcweir     DECL_LINK(lateInitCallback, Timer*);
124cdf0e10cSrcweir 
125cdf0e10cSrcweir private:
126cdf0e10cSrcweir 	ViewShellBase& mrBase;
127cdf0e10cSrcweir 
128cdf0e10cSrcweir 	const CustomAnimationPresets* mpCustomAnimationPresets;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 	FixedLine*	mpFLModify;
131cdf0e10cSrcweir 	PushButton*	mpPBAddEffect;
132cdf0e10cSrcweir 	PushButton* mpPBChangeEffect;
133cdf0e10cSrcweir 	PushButton*	mpPBRemoveEffect;
134cdf0e10cSrcweir 	FixedLine*	mpFLEffect;
135cdf0e10cSrcweir 	FixedText*	mpFTStart;
136cdf0e10cSrcweir 	ListBox*	mpLBStart;
137cdf0e10cSrcweir 	FixedText*	mpFTProperty;
138cdf0e10cSrcweir 	PropertyControl*	mpLBProperty;
139cdf0e10cSrcweir 	PushButton*	mpPBPropertyMore;
140cdf0e10cSrcweir 	FixedText*	mpFTSpeed;
141cdf0e10cSrcweir 	ComboBox*	mpCBSpeed;
142cdf0e10cSrcweir 	CustomAnimationList*	mpCustomAnimationList;
143cdf0e10cSrcweir 	FixedText*	mpFTChangeOrder;
144cdf0e10cSrcweir 	PushButton*	mpPBMoveUp;
145cdf0e10cSrcweir 	PushButton* mpPBMoveDown;
146cdf0e10cSrcweir 	FixedLine*	mpFLSeperator1;
147cdf0e10cSrcweir 	PushButton*	mpPBPlay;
148cdf0e10cSrcweir 	PushButton* mpPBSlideShow;
149cdf0e10cSrcweir 	FixedLine*	mpFLSeperator2;
150cdf0e10cSrcweir 	CheckBox*	mpCBAutoPreview;
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	String		maStrModify;
153cdf0e10cSrcweir 	String		maStrProperty;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 	sal_Int32	mnPropertyType;
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 	Size		maMinSize;
158cdf0e10cSrcweir 
159cdf0e10cSrcweir 	EffectSequence maListSelection;
160cdf0e10cSrcweir 	::com::sun::star::uno::Any maViewSelection;
161cdf0e10cSrcweir 
162cdf0e10cSrcweir 	MainSequencePtr	mpMainSequence;
163cdf0e10cSrcweir 
164cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxCurrentPage;
165cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
166cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
167cdf0e10cSrcweir 
168cdf0e10cSrcweir     /** The mpCustomAnimationPresets is initialized either on demand or
169cdf0e10cSrcweir         after a short time after the construction of a new object of this
170cdf0e10cSrcweir         class.  This timer is responsible for the later.
171cdf0e10cSrcweir     */
172cdf0e10cSrcweir     Timer maLateInitTimer;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir     /** This method initializes the mpCustomAnimationPresets on demand and
175cdf0e10cSrcweir         returns a reference to the list.
176cdf0e10cSrcweir     */
177cdf0e10cSrcweir     const CustomAnimationPresets& getPresets (void);
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	MotionPathTagVector maMotionPathTags;
180cdf0e10cSrcweir 
181cdf0e10cSrcweir 	ScopeLock maSelectionLock;
182cdf0e10cSrcweir };
183cdf0e10cSrcweir 
184cdf0e10cSrcweir }
185cdf0e10cSrcweir 
186cdf0e10cSrcweir #endif // _SD_CUSTOMANIMATIONPANE_HXX
187