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 <tools/fract.hxx>
27 : #include <vcl/group.hxx>
28 : #include <sfx2/ctrlitem.hxx>
29 :
30 : #include <vcl/button.hxx>
31 : #include <vcl/field.hxx>
32 : #include <svx/dlgctrl.hxx>
33 : #include <sfx2/progress.hxx>
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 : enum BitmapAdjustment
49 : {
50 : BA_LEFT_UP,
51 : BA_LEFT,
52 : BA_LEFT_DOWN,
53 : BA_UP,
54 : BA_CENTER,
55 : BA_DOWN,
56 : BA_RIGHT_UP,
57 : BA_RIGHT,
58 : BA_RIGHT_DOWN
59 : };
60 :
61 : class SdDisplay : public Control
62 : {
63 : private:
64 : BitmapEx aBitmapEx;
65 : Fraction aScale;
66 :
67 : public:
68 : SdDisplay(vcl::Window* pWin);
69 : virtual ~SdDisplay();
70 :
71 : virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
72 :
73 : void SetBitmapEx( BitmapEx* pBmpEx );
74 : void SetScale( const Fraction& rFrac );
75 :
76 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
77 : virtual Size GetOptimalSize() const SAL_OVERRIDE;
78 : };
79 :
80 : class AnimationWindow : public SfxDockingWindow
81 : {
82 : friend class AnimationChildWindow;
83 : friend class AnimationControllerItem;
84 :
85 : public:
86 : AnimationWindow(SfxBindings* pBindings, SfxChildWindow *pCW, vcl::Window* pParent);
87 : virtual ~AnimationWindow();
88 : virtual void dispose() SAL_OVERRIDE;
89 :
90 : void AddObj( ::sd::View& rView );
91 : void CreateAnimObj( ::sd::View& rView );
92 :
93 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
94 :
95 : protected:
96 : virtual bool Close() SAL_OVERRIDE;
97 : virtual void Resize() SAL_OVERRIDE;
98 : virtual void FillInfo( SfxChildWinInfo& ) const SAL_OVERRIDE;
99 :
100 : private:
101 : VclPtr<SdDisplay> m_pCtlDisplay;
102 : VclPtr<PushButton> m_pBtnFirst;
103 : VclPtr<PushButton> m_pBtnReverse;
104 : VclPtr<PushButton> m_pBtnStop;
105 : VclPtr<PushButton> m_pBtnPlay;
106 : VclPtr<PushButton> m_pBtnLast;
107 : VclPtr<NumericField> m_pNumFldBitmap;
108 : VclPtr<TimeField> m_pTimeField;
109 : VclPtr<ListBox> m_pLbLoopCount;
110 : VclPtr<PushButton> m_pBtnGetOneObject;
111 : VclPtr<PushButton> m_pBtnGetAllObjects;
112 : VclPtr<PushButton> m_pBtnRemoveBitmap;
113 : VclPtr<PushButton> m_pBtnRemoveAll;
114 : VclPtr<FixedText> m_pFiCount;
115 :
116 : VclPtr<RadioButton> m_pRbtGroup;
117 : VclPtr<RadioButton> m_pRbtBitmap;
118 : VclPtr<FixedText> m_pFtAdjustment;
119 : VclPtr<ListBox> m_pLbAdjustment;
120 : VclPtr<PushButton> m_pBtnCreateGroup;
121 :
122 : VclPtr<vcl::Window> pWin;
123 : ::std::vector< ::std::pair<BitmapEx*, ::tools::Time*> > m_FrameList;
124 : static const size_t EMPTY_FRAMELIST;
125 : size_t m_nCurrentFrame;
126 : SdDrawDocument* pMyDoc;
127 :
128 : bool bMovie;
129 : bool bAllObjects;
130 :
131 : SfxBindings* pBindings;
132 : AnimationControllerItem* pControllerItem;
133 :
134 : ScopeLock maPlayLock;
135 :
136 : DECL_LINK( ClickFirstHdl, void * );
137 : DECL_LINK( ClickStopHdl, void * );
138 : DECL_LINK( ClickPlayHdl, void * );
139 : DECL_LINK( ClickLastHdl, void * );
140 : DECL_LINK( ClickGetObjectHdl, void * );
141 : DECL_LINK( ClickRemoveBitmapHdl, void * );
142 : DECL_LINK( ClickRbtHdl, void * );
143 : DECL_LINK( ClickCreateGroupHdl, void * );
144 : DECL_LINK( ModifyBitmapHdl, void * );
145 : DECL_LINK( ModifyTimeHdl, void * );
146 :
147 : void UpdateControl(bool bDisableCtrls = false);
148 : void ResetAttrs();
149 : void WaitInEffect( sal_uLong nMilliSeconds, sal_uLong nTime,
150 : SfxProgress* pStbMgr ) const;
151 : Fraction GetScale();
152 : };
153 :
154 : /**
155 : * ControllerItem for Animator
156 : */
157 0 : class AnimationControllerItem : public SfxControllerItem
158 : {
159 :
160 : public:
161 : AnimationControllerItem( sal_uInt16, AnimationWindow*, SfxBindings* );
162 :
163 : protected:
164 : virtual void StateChanged( sal_uInt16 nSId, SfxItemState eState,
165 : const SfxPoolItem* pState ) SAL_OVERRIDE;
166 : private:
167 : VclPtr<AnimationWindow> pAnimationWin;
168 : };
169 :
170 : } // end of namespace sd
171 :
172 : #endif
173 :
174 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|