Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef SD_ANIMOBJS_HXX
21 : #define SD_ANIMOBJS_HXX
22 :
23 : #include <sfx2/dockwin.hxx>
24 : #include <vcl/fixed.hxx>
25 : #include <svtools/stdctrl.hxx>
26 : #include <vcl/group.hxx>
27 : #include <sfx2/ctrlitem.hxx>
28 :
29 : #include <vcl/button.hxx>
30 : #include <vcl/field.hxx>
31 : #include <svx/dlgctrl.hxx>
32 : #include <sfx2/progress.hxx>
33 :
34 :
35 : #include <vcl/lstbox.hxx>
36 :
37 : #include "sdresid.hxx"
38 : #include "misc/scopelock.hxx"
39 :
40 : class SdDrawDocument;
41 : class BitmapEx;
42 :
43 : namespace sd {
44 :
45 : class AnimationControllerItem;
46 : class View;
47 :
48 : //------------------------------------------------------------------------
49 :
50 : enum BitmapAdjustment
51 : {
52 : BA_LEFT_UP,
53 : BA_LEFT,
54 : BA_LEFT_DOWN,
55 : BA_UP,
56 : BA_CENTER,
57 : BA_DOWN,
58 : BA_RIGHT_UP,
59 : BA_RIGHT,
60 : BA_RIGHT_DOWN
61 : };
62 :
63 : //------------------------------------------------------------------------
64 :
65 : class SdDisplay : public Control
66 : {
67 : private:
68 : BitmapEx aBitmapEx;
69 : Fraction aScale;
70 :
71 : public:
72 : SdDisplay( ::Window* pWin, SdResId Id );
73 : ~SdDisplay();
74 :
75 : virtual void Paint( const Rectangle& rRect );
76 :
77 : void SetBitmapEx( BitmapEx* pBmpEx );
78 : void SetScale( const Fraction& rFrac );
79 :
80 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
81 : };
82 :
83 : //------------------------------------------------------------------------
84 :
85 : class AnimationWindow : public SfxDockingWindow
86 : {
87 : friend class AnimationChildWindow;
88 : friend class AnimationControllerItem;
89 :
90 : public:
91 : AnimationWindow( SfxBindings* pBindings, SfxChildWindow *pCW,
92 : ::Window* pParent, const SdResId& rSdResId );
93 : virtual ~AnimationWindow();
94 :
95 : void AddObj( ::sd::View& rView );
96 : void CreateAnimObj( ::sd::View& rView );
97 :
98 : virtual void DataChanged( const DataChangedEvent& rDCEvt );
99 :
100 : protected:
101 : virtual sal_Bool Close();
102 : virtual void Resize();
103 : virtual void FillInfo( SfxChildWinInfo& ) const;
104 :
105 : private:
106 : SdDisplay aCtlDisplay;
107 : ImageButton aBtnFirst;
108 : ImageButton aBtnReverse;
109 : ImageButton aBtnStop;
110 : ImageButton aBtnPlay;
111 : ImageButton aBtnLast;
112 : NumericField aNumFldBitmap;
113 : TimeField aTimeField;
114 : ListBox aLbLoopCount;
115 : FixedLine aGrpBitmap;
116 : ImageButton aBtnGetOneObject;
117 : ImageButton aBtnGetAllObjects;
118 : ImageButton aBtnRemoveBitmap;
119 : ImageButton aBtnRemoveAll;
120 : FixedText aFtCount;
121 : FixedInfo aFiCount;
122 : FixedLine aGrpAnimation;
123 :
124 : RadioButton aRbtGroup;
125 : RadioButton aRbtBitmap;
126 : FixedText aFtAdjustment;
127 : ListBox aLbAdjustment;
128 : PushButton aBtnCreateGroup;
129 :
130 : ::Window* pWin;
131 : ::std::vector< ::std::pair<BitmapEx*, Time*> > m_FrameList;
132 : static const size_t EMPTY_FRAMELIST = ULONG_MAX;
133 : size_t m_nCurrentFrame;
134 : SdDrawDocument* pMyDoc;
135 :
136 : Size aSize;
137 : Size aFltWinSize;
138 : Size aDisplaySize;
139 : Size aBmpSize;
140 : sal_Bool bMovie;
141 : sal_Bool bAllObjects;
142 :
143 : SfxBindings* pBindings;
144 : AnimationControllerItem* pControllerItem;
145 :
146 : ScopeLock maPlayLock;
147 : //------------------------------------
148 :
149 : DECL_LINK( ClickFirstHdl, void * );
150 : DECL_LINK( ClickStopHdl, void * );
151 : DECL_LINK( ClickPlayHdl, void * );
152 : DECL_LINK( ClickLastHdl, void * );
153 : DECL_LINK( ClickGetObjectHdl, void * );
154 : DECL_LINK( ClickRemoveBitmapHdl, void * );
155 : DECL_LINK( ClickRbtHdl, void * );
156 : DECL_LINK( ClickCreateGroupHdl, void * );
157 : DECL_LINK( ModifyBitmapHdl, void * );
158 : DECL_LINK( ModifyTimeHdl, void * );
159 :
160 : void UpdateControl(bool bDisableCtrls = false);
161 : void ResetAttrs();
162 : void WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime,
163 : SfxProgress* pStbMgr ) const;
164 : Fraction GetScale();
165 : };
166 :
167 : /*************************************************************************
168 : |*
169 : |* ControllerItem fuer Animator
170 : |*
171 : \************************************************************************/
172 :
173 0 : class AnimationControllerItem : public SfxControllerItem
174 : {
175 :
176 : public:
177 : AnimationControllerItem( sal_uInt16, AnimationWindow*, SfxBindings* );
178 :
179 : protected:
180 : virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
181 : const SfxPoolItem* pState );
182 : private:
183 : AnimationWindow* pAnimationWin;
184 : };
185 :
186 : } // end of namespace sd
187 :
188 : #endif
189 :
190 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|