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 INCLUDED_SD_SOURCE_UI_INC_ANIMOBJS_HXX
21 : #define INCLUDED_SD_SOURCE_UI_INC_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 : virtual ~SdDisplay();
74 :
75 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
76 :
77 : void SetBitmapEx( BitmapEx* pBmpEx );
78 : void SetScale( const Fraction& rFrac );
79 :
80 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
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 ) SAL_OVERRIDE;
99 :
100 : protected:
101 : virtual bool Close() SAL_OVERRIDE;
102 : virtual void Resize() SAL_OVERRIDE;
103 : virtual void FillInfo( SfxChildWinInfo& ) const SAL_OVERRIDE;
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 : HelpButton aBtnHelp;
131 :
132 :
133 : ::Window* pWin;
134 : ::std::vector< ::std::pair<BitmapEx*, Time*> > m_FrameList;
135 : static const size_t EMPTY_FRAMELIST = ULONG_MAX;
136 : size_t m_nCurrentFrame;
137 : SdDrawDocument* pMyDoc;
138 :
139 : Size aSize;
140 : Size aFltWinSize;
141 : Size aDisplaySize;
142 : Size aBmpSize;
143 : sal_Bool bMovie;
144 : sal_Bool bAllObjects;
145 :
146 : SfxBindings* pBindings;
147 : AnimationControllerItem* pControllerItem;
148 :
149 : ScopeLock maPlayLock;
150 :
151 :
152 : DECL_LINK( ClickFirstHdl, void * );
153 : DECL_LINK( ClickStopHdl, void * );
154 : DECL_LINK( ClickPlayHdl, void * );
155 : DECL_LINK( ClickLastHdl, void * );
156 : DECL_LINK( ClickGetObjectHdl, void * );
157 : DECL_LINK( ClickRemoveBitmapHdl, void * );
158 : DECL_LINK( ClickRbtHdl, void * );
159 : DECL_LINK( ClickCreateGroupHdl, void * );
160 : DECL_LINK( ModifyBitmapHdl, void * );
161 : DECL_LINK( ModifyTimeHdl, void * );
162 :
163 : void UpdateControl(bool bDisableCtrls = false);
164 : void ResetAttrs();
165 : void WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime,
166 : SfxProgress* pStbMgr ) const;
167 : Fraction GetScale();
168 : };
169 :
170 : /**
171 : * ControllerItem for Animator
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 ) SAL_OVERRIDE;
182 : private:
183 : AnimationWindow* pAnimationWin;
184 : };
185 :
186 : } // end of namespace sd
187 :
188 : #endif
189 :
190 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|