xref: /AOO41X/main/sd/source/ui/animations/CustomAnimationPane.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef _SD_CUSTOMANIMATIONPANE_HXX
29*cdf0e10cSrcweir #define _SD_CUSTOMANIMATIONPANE_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
33*cdf0e10cSrcweir #include <vcl/dialog.hxx>
34*cdf0e10cSrcweir #include "CustomAnimationPreset.hxx"
35*cdf0e10cSrcweir #include "CustomAnimationList.hxx"
36*cdf0e10cSrcweir #include "CustomAnimationCreateDialog.hxx"
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #include "motionpathtag.hxx"
39*cdf0e10cSrcweir #include "misc/scopelock.hxx"
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #include <vector>
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir class PushButton;
44*cdf0e10cSrcweir class FixedLine;
45*cdf0e10cSrcweir class FixedText;
46*cdf0e10cSrcweir class ListBox;
47*cdf0e10cSrcweir class ComboBox;
48*cdf0e10cSrcweir class CheckBox;
49*cdf0e10cSrcweir class SdDrawDocument;
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace animations {
52*cdf0e10cSrcweir 	class XAnimationNode;
53*cdf0e10cSrcweir } } } }
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir namespace sd { namespace tools {
56*cdf0e10cSrcweir class EventMultiplexerEvent;
57*cdf0e10cSrcweir } }
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir namespace sd {
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir class PropertyControl;
62*cdf0e10cSrcweir class STLPropertySet;
63*cdf0e10cSrcweir class ViewShellBase;
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir typedef std::vector< rtl::Reference< MotionPathTag > > MotionPathTagVector;
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir // --------------------------------------------------------------------
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir class CustomAnimationPane : public Control, public ICustomAnimationListController
70*cdf0e10cSrcweir {
71*cdf0e10cSrcweir 	friend class MotionPathTag;
72*cdf0e10cSrcweir public:
73*cdf0e10cSrcweir 	CustomAnimationPane( ::Window* pParent, ViewShellBase& rBase, const Size& rMinSize );
74*cdf0e10cSrcweir 	virtual ~CustomAnimationPane();
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir 	// callbacks
77*cdf0e10cSrcweir 	void onSelectionChanged();
78*cdf0e10cSrcweir 	void onChangeCurrentPage();
79*cdf0e10cSrcweir 	void onChange( bool bCreate );
80*cdf0e10cSrcweir 	void onRemove();
81*cdf0e10cSrcweir 	void onChangeStart();
82*cdf0e10cSrcweir 	void onChangeStart( sal_Int16 nNodeType );
83*cdf0e10cSrcweir 	void onChangeProperty();
84*cdf0e10cSrcweir 	void onChangeSpeed();
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 	// methods
87*cdf0e10cSrcweir 	void preview( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode );
88*cdf0e10cSrcweir 	void remove( CustomAnimationEffectPtr& pEffect );
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir 	// Control
91*cdf0e10cSrcweir 	virtual void Resize();
92*cdf0e10cSrcweir 	virtual void StateChanged( StateChangedType nStateChange );
93*cdf0e10cSrcweir 	virtual void KeyInput( const KeyEvent& rKEvt );
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 	// ICustomAnimationListController
96*cdf0e10cSrcweir 	virtual void onSelect();
97*cdf0e10cSrcweir 	virtual void onDoubleClick();
98*cdf0e10cSrcweir 	virtual void onContextMenu( sal_uInt16 nSelectedPopupEntry );
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 	void addUndo();
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 	void updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag );
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir private:
105*cdf0e10cSrcweir 	void addListener();
106*cdf0e10cSrcweir 	void removeListener();
107*cdf0e10cSrcweir 	void updateLayout();
108*cdf0e10cSrcweir 	void updateControls();
109*cdf0e10cSrcweir 	void updateMotionPathTags();
110*cdf0e10cSrcweir 	void markShapesFromSelectedEffects();
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	void showOptions( sal_uInt16 nPage = 0 );
113*cdf0e10cSrcweir 	void moveSelection( bool bUp );
114*cdf0e10cSrcweir 	void onPreview( bool bForcePreview );
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir 	void createPath( PathKind eKind, std::vector< ::com::sun::star::uno::Any >& rTargets, double fDuration );
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir 	STLPropertySet* createSelectionSet();
119*cdf0e10cSrcweir 	void changeSelection( STLPropertySet* pResultSet, STLPropertySet* pOldSet );
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 	::com::sun::star::uno::Any getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect );
122*cdf0e10cSrcweir 	bool setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const ::com::sun::star::uno::Any& rValue );
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 	DECL_LINK( implControlHdl, Control* );
125*cdf0e10cSrcweir 	DECL_LINK( implPropertyHdl, Control* );
126*cdf0e10cSrcweir     DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent*);
127*cdf0e10cSrcweir     DECL_LINK(lateInitCallback, Timer*);
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir private:
130*cdf0e10cSrcweir 	ViewShellBase& mrBase;
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 	const CustomAnimationPresets* mpCustomAnimationPresets;
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 	FixedLine*	mpFLModify;
135*cdf0e10cSrcweir 	PushButton*	mpPBAddEffect;
136*cdf0e10cSrcweir 	PushButton* mpPBChangeEffect;
137*cdf0e10cSrcweir 	PushButton*	mpPBRemoveEffect;
138*cdf0e10cSrcweir 	FixedLine*	mpFLEffect;
139*cdf0e10cSrcweir 	FixedText*	mpFTStart;
140*cdf0e10cSrcweir 	ListBox*	mpLBStart;
141*cdf0e10cSrcweir 	FixedText*	mpFTProperty;
142*cdf0e10cSrcweir 	PropertyControl*	mpLBProperty;
143*cdf0e10cSrcweir 	PushButton*	mpPBPropertyMore;
144*cdf0e10cSrcweir 	FixedText*	mpFTSpeed;
145*cdf0e10cSrcweir 	ComboBox*	mpCBSpeed;
146*cdf0e10cSrcweir 	CustomAnimationList*	mpCustomAnimationList;
147*cdf0e10cSrcweir 	FixedText*	mpFTChangeOrder;
148*cdf0e10cSrcweir 	PushButton*	mpPBMoveUp;
149*cdf0e10cSrcweir 	PushButton* mpPBMoveDown;
150*cdf0e10cSrcweir 	FixedLine*	mpFLSeperator1;
151*cdf0e10cSrcweir 	PushButton*	mpPBPlay;
152*cdf0e10cSrcweir 	PushButton* mpPBSlideShow;
153*cdf0e10cSrcweir 	FixedLine*	mpFLSeperator2;
154*cdf0e10cSrcweir 	CheckBox*	mpCBAutoPreview;
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 	String		maStrModify;
157*cdf0e10cSrcweir 	String		maStrProperty;
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 	sal_Int32	mnPropertyType;
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 	Size		maMinSize;
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir 	EffectSequence maListSelection;
164*cdf0e10cSrcweir 	::com::sun::star::uno::Any maViewSelection;
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	MainSequencePtr	mpMainSequence;
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > mxCurrentPage;
169*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawView > mxView;
170*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxModel;
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir     /** The mpCustomAnimationPresets is initialized either on demand or
173*cdf0e10cSrcweir         after a short time after the construction of a new object of this
174*cdf0e10cSrcweir         class.  This timer is responsible for the later.
175*cdf0e10cSrcweir     */
176*cdf0e10cSrcweir     Timer maLateInitTimer;
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir     /** This method initializes the mpCustomAnimationPresets on demand and
179*cdf0e10cSrcweir         returns a reference to the list.
180*cdf0e10cSrcweir     */
181*cdf0e10cSrcweir     const CustomAnimationPresets& getPresets (void);
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 	MotionPathTagVector maMotionPathTags;
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 	ScopeLock maSelectionLock;
186*cdf0e10cSrcweir };
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir }
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir #endif // _SD_CUSTOMANIMATIONPANE_HXX
191