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 : #include <vcl/lstbox.hxx>
35 :
36 : #include "sdresid.hxx"
37 : #include "misc/scopelock.hxx"
38 :
39 : class SdDrawDocument;
40 : class BitmapEx;
41 :
42 : namespace sd {
43 :
44 : class AnimationControllerItem;
45 : class View;
46 :
47 : enum BitmapAdjustment
48 : {
49 : BA_LEFT_UP,
50 : BA_LEFT,
51 : BA_LEFT_DOWN,
52 : BA_UP,
53 : BA_CENTER,
54 : BA_DOWN,
55 : BA_RIGHT_UP,
56 : BA_RIGHT,
57 : BA_RIGHT_DOWN
58 : };
59 :
60 : class SdDisplay : public Control
61 : {
62 : private:
63 : BitmapEx aBitmapEx;
64 : Fraction aScale;
65 :
66 : public:
67 : SdDisplay( vcl::Window* pWin, SdResId Id );
68 : virtual ~SdDisplay();
69 :
70 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
71 :
72 : void SetBitmapEx( BitmapEx* pBmpEx );
73 : void SetScale( const Fraction& rFrac );
74 :
75 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
76 : };
77 :
78 : class AnimationWindow : public SfxDockingWindow
79 : {
80 : friend class AnimationChildWindow;
81 : friend class AnimationControllerItem;
82 :
83 : public:
84 : AnimationWindow( SfxBindings* pBindings, SfxChildWindow *pCW,
85 : vcl::Window* pParent, const SdResId& rSdResId );
86 : virtual ~AnimationWindow();
87 :
88 : void AddObj( ::sd::View& rView );
89 : void CreateAnimObj( ::sd::View& rView );
90 :
91 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
92 :
93 : protected:
94 : virtual bool Close() SAL_OVERRIDE;
95 : virtual void Resize() SAL_OVERRIDE;
96 : virtual void FillInfo( SfxChildWinInfo& ) const SAL_OVERRIDE;
97 :
98 : private:
99 : SdDisplay aCtlDisplay;
100 : ImageButton aBtnFirst;
101 : ImageButton aBtnReverse;
102 : ImageButton aBtnStop;
103 : ImageButton aBtnPlay;
104 : ImageButton aBtnLast;
105 : NumericField aNumFldBitmap;
106 : TimeField aTimeField;
107 : ListBox aLbLoopCount;
108 : FixedLine aGrpBitmap;
109 : ImageButton aBtnGetOneObject;
110 : ImageButton aBtnGetAllObjects;
111 : ImageButton aBtnRemoveBitmap;
112 : ImageButton aBtnRemoveAll;
113 : FixedText aFtCount;
114 : FixedInfo aFiCount;
115 : FixedLine aGrpAnimation;
116 :
117 : RadioButton aRbtGroup;
118 : RadioButton aRbtBitmap;
119 : FixedText aFtAdjustment;
120 : ListBox aLbAdjustment;
121 : PushButton aBtnCreateGroup;
122 :
123 : HelpButton aBtnHelp;
124 :
125 : vcl::Window* pWin;
126 : ::std::vector< ::std::pair<BitmapEx*, ::tools::Time*> > m_FrameList;
127 : static const size_t EMPTY_FRAMELIST = ULONG_MAX;
128 : size_t m_nCurrentFrame;
129 : SdDrawDocument* pMyDoc;
130 :
131 : Size aSize;
132 : Size aFltWinSize;
133 : Size aDisplaySize;
134 : Size aBmpSize;
135 : bool bMovie;
136 : bool bAllObjects;
137 :
138 : SfxBindings* pBindings;
139 : AnimationControllerItem* pControllerItem;
140 :
141 : ScopeLock maPlayLock;
142 :
143 : DECL_LINK( ClickFirstHdl, void * );
144 : DECL_LINK( ClickStopHdl, void * );
145 : DECL_LINK( ClickPlayHdl, void * );
146 : DECL_LINK( ClickLastHdl, void * );
147 : DECL_LINK( ClickGetObjectHdl, void * );
148 : DECL_LINK( ClickRemoveBitmapHdl, void * );
149 : DECL_LINK( ClickRbtHdl, void * );
150 : DECL_LINK( ClickCreateGroupHdl, void * );
151 : DECL_LINK( ModifyBitmapHdl, void * );
152 : DECL_LINK( ModifyTimeHdl, void * );
153 :
154 : void UpdateControl(bool bDisableCtrls = false);
155 : void ResetAttrs();
156 : void WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime,
157 : SfxProgress* pStbMgr ) const;
158 : Fraction GetScale();
159 : };
160 :
161 : /**
162 : * ControllerItem for Animator
163 : */
164 0 : class AnimationControllerItem : public SfxControllerItem
165 : {
166 :
167 : public:
168 : AnimationControllerItem( sal_uInt16, AnimationWindow*, SfxBindings* );
169 :
170 : protected:
171 : virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
172 : const SfxPoolItem* pState ) SAL_OVERRIDE;
173 : private:
174 : AnimationWindow* pAnimationWin;
175 : };
176 :
177 : } // end of namespace sd
178 :
179 : #endif
180 :
181 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|