xref: /trunk/main/sd/source/ui/inc/animobjs.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SD_ANIMOBJS_HXX
29 #define SD_ANIMOBJS_HXX
30 
31 #include <sfx2/dockwin.hxx>
32 #include <vcl/fixed.hxx>
33 #include <svtools/stdctrl.hxx>
34 #include <vcl/group.hxx>
35 #include <sfx2/ctrlitem.hxx>
36 
37 #ifndef _SV_BUTTON_HXX //autogen
38 #include <vcl/button.hxx>
39 #endif
40 #include <vcl/field.hxx>
41 #include <svx/dlgctrl.hxx>
42 #include <sfx2/progress.hxx>
43 
44 
45 #include <vcl/lstbox.hxx>
46 
47 #ifndef _SD_SDRESID_HXX
48 #include "sdresid.hxx"
49 #endif
50 #include "misc/scopelock.hxx"
51 
52 class SdDrawDocument;
53 class BitmapEx;
54 
55 namespace sd {
56 
57 class AnimationControllerItem;
58 class View;
59 
60 //------------------------------------------------------------------------
61 
62 enum BitmapAdjustment
63 {
64 	BA_LEFT_UP,
65 	BA_LEFT,
66 	BA_LEFT_DOWN,
67 	BA_UP,
68 	BA_CENTER,
69 	BA_DOWN,
70 	BA_RIGHT_UP,
71 	BA_RIGHT,
72 	BA_RIGHT_DOWN
73 };
74 
75 //------------------------------------------------------------------------
76 
77 class SdDisplay : public Control
78 {
79 private:
80 	BitmapEx 	aBitmapEx;
81 	Fraction	aScale;
82 
83 public:
84 	SdDisplay( ::Window* pWin, SdResId Id );
85 	~SdDisplay();
86 
87 	virtual void Paint( const Rectangle& rRect );
88 
89 	void	SetBitmapEx( BitmapEx* pBmpEx );
90 	void	SetScale( const Fraction& rFrac );
91 
92 	virtual void DataChanged( const DataChangedEvent& rDCEvt );
93 };
94 
95 //------------------------------------------------------------------------
96 
97 class AnimationWindow : public SfxDockingWindow
98 {
99  friend class AnimationChildWindow;
100  friend class AnimationControllerItem;
101 
102 public:
103     AnimationWindow( SfxBindings* pBindings, SfxChildWindow *pCW,
104         ::Window* pParent, const SdResId& rSdResId );
105     virtual ~AnimationWindow();
106 
107 	void	AddObj( ::sd::View& rView );
108 	void	CreateAnimObj( ::sd::View& rView );
109 
110 	virtual void DataChanged( const DataChangedEvent& rDCEvt );
111 
112 protected:
113 	virtual sal_Bool	Close();
114 	virtual void	Resize();
115 	virtual void	FillInfo( SfxChildWinInfo& ) const;
116 
117 private:
118 	SdDisplay		aCtlDisplay;
119 	ImageButton 	aBtnFirst;
120 	ImageButton 	aBtnReverse;
121 	ImageButton 	aBtnStop;
122 	ImageButton 	aBtnPlay;
123 	ImageButton 	aBtnLast;
124 	NumericField	aNumFldBitmap;
125 	TimeField		aTimeField;
126 	ListBox 		aLbLoopCount;
127 	FixedLine		aGrpBitmap;
128 	ImageButton		aBtnGetOneObject;
129 	ImageButton		aBtnGetAllObjects;
130 	ImageButton		aBtnRemoveBitmap;
131 	ImageButton		aBtnRemoveAll;
132 	FixedText		aFtCount;
133 	FixedInfo		aFiCount;
134 	FixedLine		aGrpAnimation;
135 
136 	RadioButton		aRbtGroup;
137 	RadioButton		aRbtBitmap;
138 	FixedText		aFtAdjustment;
139 	ListBox 		aLbAdjustment;
140 	PushButton		aBtnCreateGroup;
141 
142 	::Window* 		pWin;
143 	List			aBmpExList;
144 	List			aTimeList;
145 	SdDrawDocument* pMyDoc;
146 	BitmapEx* 		pBitmapEx;
147 
148 	Size			aSize;
149 	Size			aFltWinSize;
150 	Size			aDisplaySize;
151 	Size			aBmpSize;
152 	sal_Bool			bMovie;
153 	sal_Bool			bAllObjects;
154 
155 	SfxBindings*				pBindings;
156 	AnimationControllerItem*	pControllerItem;
157 
158 	ScopeLock		maPlayLock;
159 	//------------------------------------
160 
161 	DECL_LINK( ClickFirstHdl, void * );
162 	DECL_LINK( ClickStopHdl, void * );
163 	DECL_LINK( ClickPlayHdl, void * );
164 	DECL_LINK( ClickLastHdl, void * );
165 	DECL_LINK( ClickGetObjectHdl, void * );
166 	DECL_LINK( ClickRemoveBitmapHdl, void * );
167 	DECL_LINK( ClickRbtHdl, void * );
168 	DECL_LINK( ClickCreateGroupHdl, void * );
169 	DECL_LINK( ModifyBitmapHdl, void * );
170 	DECL_LINK( ModifyTimeHdl, void * );
171 
172 	void			UpdateControl( sal_uLong nPos, sal_Bool bDisableCtrls = sal_False );
173 	void			ResetAttrs();
174 	void			WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime,
175 										SfxProgress* pStbMgr ) const;
176 	Fraction		GetScale();
177 };
178 
179 /*************************************************************************
180 |*
181 |* ControllerItem fuer Animator
182 |*
183 \************************************************************************/
184 
185 class AnimationControllerItem : public SfxControllerItem
186 {
187 
188 public:
189 	AnimationControllerItem( sal_uInt16, AnimationWindow*, SfxBindings* );
190 
191 protected:
192 	virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
193         const SfxPoolItem* pState );
194 private:
195 	AnimationWindow* pAnimationWin;
196 };
197 
198 } // end of namespace sd
199 
200 #endif
201 
202