1*c142477cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*c142477cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*c142477cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*c142477cSAndrew Rist  * distributed with this work for additional information
6*c142477cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*c142477cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*c142477cSAndrew Rist  * "License"); you may not use this file except in compliance
9*c142477cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*c142477cSAndrew Rist  *
11*c142477cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*c142477cSAndrew Rist  *
13*c142477cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*c142477cSAndrew Rist  * software distributed under the License is distributed on an
15*c142477cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*c142477cSAndrew Rist  * KIND, either express or implied.  See the License for the
17*c142477cSAndrew Rist  * specific language governing permissions and limitations
18*c142477cSAndrew Rist  * under the License.
19*c142477cSAndrew Rist  *
20*c142477cSAndrew Rist  *************************************************************/
21*c142477cSAndrew Rist 
22*c142477cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sdext.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "PresenterPaneAnimator.hxx"
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "PresenterAnimation.hxx"
30cdf0e10cSrcweir #include "PresenterAnimator.hxx"
31cdf0e10cSrcweir #include "PresenterCanvasHelper.hxx"
32cdf0e10cSrcweir #include "PresenterController.hxx"
33cdf0e10cSrcweir #include "PresenterGeometryHelper.hxx"
34cdf0e10cSrcweir #include "PresenterPaintManager.hxx"
35cdf0e10cSrcweir #include "PresenterPaneContainer.hxx"
36cdf0e10cSrcweir #include "PresenterPaneFactory.hxx"
37cdf0e10cSrcweir #include "PresenterSprite.hxx"
38cdf0e10cSrcweir #include "PresenterSpritePane.hxx"
39cdf0e10cSrcweir #include "PresenterWindowManager.hxx"
40cdf0e10cSrcweir 
41cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp>
42cdf0e10cSrcweir #include <com/sun/star/awt/XWindowPeer.hpp>
43cdf0e10cSrcweir #include <com/sun/star/rendering/CompositeOperation.hpp>
44cdf0e10cSrcweir #include <boost/bind.hpp>
45cdf0e10cSrcweir #include <boost/bind/protect.hpp>
46cdf0e10cSrcweir #include <boost/enable_shared_from_this.hpp>
47cdf0e10cSrcweir 
48cdf0e10cSrcweir using namespace ::com::sun::star;
49cdf0e10cSrcweir using namespace ::com::sun::star::uno;
50cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework;
51cdf0e10cSrcweir using ::rtl::OUString;
52cdf0e10cSrcweir using ::std::vector;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir namespace sdext { namespace presenter {
55cdf0e10cSrcweir 
56cdf0e10cSrcweir namespace {
57cdf0e10cSrcweir 
58cdf0e10cSrcweir     class PaneGroup;
59cdf0e10cSrcweir 
60cdf0e10cSrcweir     class PresenterPaneAnimatorBase
61cdf0e10cSrcweir         : public ::boost::enable_shared_from_this<PresenterPaneAnimatorBase>,
62cdf0e10cSrcweir           public PresenterPaneAnimator
63cdf0e10cSrcweir     {
64cdf0e10cSrcweir     public:
65cdf0e10cSrcweir         PresenterPaneAnimatorBase (
66cdf0e10cSrcweir             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
67cdf0e10cSrcweir             const ::rtl::Reference<PresenterController>& rpPresenterController,
68cdf0e10cSrcweir             const bool bAnimate,
69cdf0e10cSrcweir             const EndActions& rShowEndActions,
70cdf0e10cSrcweir             const EndActions& rEndEndActions);
71cdf0e10cSrcweir         virtual ~PresenterPaneAnimatorBase (void);
72cdf0e10cSrcweir 
73cdf0e10cSrcweir         typedef ::std::vector< ::boost::function<void()> > EndOperators;
74cdf0e10cSrcweir 
75cdf0e10cSrcweir         void ActivatePanes (void);
76cdf0e10cSrcweir         void ActivatePane (
77cdf0e10cSrcweir             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
78cdf0e10cSrcweir         void RestoreFrozenWindows (void);
79cdf0e10cSrcweir         void FreezePanes (const Reference<rendering::XSpriteCanvas>& rxCanvas);
80cdf0e10cSrcweir 
81cdf0e10cSrcweir     protected:
82cdf0e10cSrcweir         ::rtl::Reference<PresenterController> mpPresenterController;
83cdf0e10cSrcweir         ::rtl::Reference<PresenterPaneContainer> mpPaneContainer;
84cdf0e10cSrcweir         ::rtl::Reference<PresenterWindowManager> mpWindowManager;
85cdf0e10cSrcweir         ::std::vector< ::boost::shared_ptr<PaneGroup> > maPaneGroups;
86cdf0e10cSrcweir         css::uno::Reference<css::drawing::framework::XResourceId> mxCenterPaneId;
87cdf0e10cSrcweir         bool mbDoAnimation;
88cdf0e10cSrcweir         EndActions maShowEndActions;
89cdf0e10cSrcweir         EndActions maHideEndActions;
90cdf0e10cSrcweir 
91cdf0e10cSrcweir         void DeactivatePanes (void);
92cdf0e10cSrcweir         void ResizePane (
93cdf0e10cSrcweir             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
94cdf0e10cSrcweir             const geometry::RealRectangle2D& rBox);
95cdf0e10cSrcweir         void DeactivatePane (
96cdf0e10cSrcweir             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId);
97cdf0e10cSrcweir     };
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     class UnfoldInCenterAnimator : public PresenterPaneAnimatorBase
101cdf0e10cSrcweir     {
102cdf0e10cSrcweir     public:
103cdf0e10cSrcweir         UnfoldInCenterAnimator (
104cdf0e10cSrcweir             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
105cdf0e10cSrcweir             const ::rtl::Reference<PresenterController>& rpPresenterController,
106cdf0e10cSrcweir             const bool bAnimate,
107cdf0e10cSrcweir             const EndActions& rShowEndActions,
108cdf0e10cSrcweir             const EndActions& rEndEndActions);
109cdf0e10cSrcweir 
110cdf0e10cSrcweir         virtual ~UnfoldInCenterAnimator (void);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir         virtual void ShowPane (void);
113cdf0e10cSrcweir 
114cdf0e10cSrcweir         virtual void HidePane (void);
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     private:
117cdf0e10cSrcweir         geometry::RealRectangle2D maCenterPaneBox;
118cdf0e10cSrcweir 
119cdf0e10cSrcweir         void SetupPaneGroups (void);
120cdf0e10cSrcweir         geometry::RealRectangle2D MovePanesAway (
121cdf0e10cSrcweir             const css::geometry::RealRectangle2D& rFreeCenterArea);
122cdf0e10cSrcweir     };
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 
125cdf0e10cSrcweir     class MoveInFromBottomAnimator : public PresenterPaneAnimatorBase
126cdf0e10cSrcweir     {
127cdf0e10cSrcweir     public:
128cdf0e10cSrcweir         MoveInFromBottomAnimator(
129cdf0e10cSrcweir             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
130cdf0e10cSrcweir             const ::rtl::Reference<PresenterController>& rpPresenterController,
131cdf0e10cSrcweir             const bool bAnimate,
132cdf0e10cSrcweir             const EndActions& rShowEndActions,
133cdf0e10cSrcweir             const EndActions& rEndEndActions);
134cdf0e10cSrcweir         virtual ~MoveInFromBottomAnimator (void);
135cdf0e10cSrcweir 
136cdf0e10cSrcweir         virtual void ShowPane (void);
137cdf0e10cSrcweir         virtual void HidePane (void);
138cdf0e10cSrcweir 
139cdf0e10cSrcweir     private:
140cdf0e10cSrcweir         ::boost::shared_ptr<PresenterSprite> maNewPaneSprite;
141cdf0e10cSrcweir         geometry::RealRectangle2D maCenterPaneBox;
142cdf0e10cSrcweir 
143cdf0e10cSrcweir         void CreateShowAnimation (
144cdf0e10cSrcweir             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
145cdf0e10cSrcweir             const EndOperators& rpEndOperators,
146cdf0e10cSrcweir             const css::uno::Reference<css::rendering::XSpriteCanvas>& rxSpriteCanvas,
147cdf0e10cSrcweir             const bool bAnimate,
148cdf0e10cSrcweir             const css::geometry::RealPoint2D& rStartLocation,
149cdf0e10cSrcweir             const css::geometry::RealPoint2D& rEndLocation);
150cdf0e10cSrcweir     };
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 
153cdf0e10cSrcweir     class TransparentOverlayAnimator : public PresenterPaneAnimatorBase
154cdf0e10cSrcweir     {
155cdf0e10cSrcweir     public:
156cdf0e10cSrcweir         TransparentOverlayAnimator(
157cdf0e10cSrcweir             const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
158cdf0e10cSrcweir             const ::rtl::Reference<PresenterController>& rpPresenterController,
159cdf0e10cSrcweir             const bool bAnimate,
160cdf0e10cSrcweir             const EndActions& rShowEndActions,
161cdf0e10cSrcweir             const EndActions& rEndEndActions);
162cdf0e10cSrcweir         virtual ~TransparentOverlayAnimator (void);
163cdf0e10cSrcweir 
164cdf0e10cSrcweir         virtual void ShowPane (void);
165cdf0e10cSrcweir         virtual void HidePane (void);
166cdf0e10cSrcweir 
167cdf0e10cSrcweir     private:
168cdf0e10cSrcweir         PresenterSprite maBackgroundSprite;
169cdf0e10cSrcweir         void CreateBackgroundSprite (void);
170cdf0e10cSrcweir     };
171cdf0e10cSrcweir 
172cdf0e10cSrcweir 
173cdf0e10cSrcweir     class PaneDescriptor
174cdf0e10cSrcweir     {
175cdf0e10cSrcweir     public:
176cdf0e10cSrcweir         PresenterPaneContainer::SharedPaneDescriptor mpPaneDescriptor;
177cdf0e10cSrcweir 
178cdf0e10cSrcweir         PaneDescriptor (const PresenterPaneContainer::SharedPaneDescriptor& rpDescriptor);
179cdf0e10cSrcweir         void Restore (void) const;
180cdf0e10cSrcweir     private:
181cdf0e10cSrcweir         double mnLeft;
182cdf0e10cSrcweir         double mnTop;
183cdf0e10cSrcweir         double mnRight;
184cdf0e10cSrcweir         double mnBottom;
185cdf0e10cSrcweir     };
186cdf0e10cSrcweir 
187cdf0e10cSrcweir     class MultiAnimation : public PresenterAnimation
188cdf0e10cSrcweir     {
189cdf0e10cSrcweir     public:
190cdf0e10cSrcweir         typedef ::boost::function<void(double)> Animation;
191cdf0e10cSrcweir         MultiAnimation (const sal_uInt32 nDuration);
192cdf0e10cSrcweir         void AddAnimation (const Animation& rAnimation);
193cdf0e10cSrcweir         virtual void Run (const double nProgress, const sal_uInt64 nCurrentTime);
194cdf0e10cSrcweir     private:
195cdf0e10cSrcweir         vector<Animation> maAnimations;
196cdf0e10cSrcweir     };
197cdf0e10cSrcweir 
198cdf0e10cSrcweir 
199cdf0e10cSrcweir     class PaneGroup
200cdf0e10cSrcweir     {
201cdf0e10cSrcweir     public:
202cdf0e10cSrcweir         PaneGroup (void);
203cdf0e10cSrcweir         ~PaneGroup (void);
204cdf0e10cSrcweir         void AddPane (const PresenterPaneContainer::SharedPaneDescriptor& rpPane);
205cdf0e10cSrcweir         void CreateSubstitution (const Reference<rendering::XSpriteCanvas>& rxCanvas);
206cdf0e10cSrcweir         void ThawPanes (void);
207cdf0e10cSrcweir         void Restore (void);
208cdf0e10cSrcweir         ::boost::shared_ptr<PresenterSprite> GetSubstitution (void);
209cdf0e10cSrcweir         css::geometry::RealRectangle2D GetOriginalBoundingBox (void) const;
210cdf0e10cSrcweir         css::geometry::RealRectangle2D GetCurrentBoundingBox (void) const;
211cdf0e10cSrcweir         void MovePanes (
212cdf0e10cSrcweir             const double nXOffset,
213cdf0e10cSrcweir             const double nYOffset,
214cdf0e10cSrcweir             const ::rtl::Reference<PresenterWindowManager>& rpWindowManager);
215cdf0e10cSrcweir         void ActivatePanes (void);
216cdf0e10cSrcweir         void DeactivatePanes (void);
217cdf0e10cSrcweir         void HidePanes (void);
218cdf0e10cSrcweir         void ShowPanes (void);
219cdf0e10cSrcweir 
220cdf0e10cSrcweir     private:
221cdf0e10cSrcweir         vector<PaneDescriptor> maPanes;
222cdf0e10cSrcweir         awt::Rectangle maOriginalBoundingBox;
223cdf0e10cSrcweir         css::geometry::RealRectangle2D maCurrentBoundingBox;
224cdf0e10cSrcweir         ::boost::shared_ptr<PresenterSprite> mpSubstitution;
225cdf0e10cSrcweir 
226cdf0e10cSrcweir     };
227cdf0e10cSrcweir     typedef ::boost::shared_ptr<PaneGroup> SharedPaneGroup;
228cdf0e10cSrcweir 
229cdf0e10cSrcweir     void InterpolatePosition (
230cdf0e10cSrcweir         const ::boost::function<void(geometry::RealPoint2D)>& rSetter,
231cdf0e10cSrcweir         double nP,
232cdf0e10cSrcweir         const geometry::RealPoint2D rInitialBox,
233cdf0e10cSrcweir         const geometry::RealPoint2D rFinalBox);
234cdf0e10cSrcweir 
235cdf0e10cSrcweir     template<typename T>
236cdf0e10cSrcweir     void InterpolateValue (
237cdf0e10cSrcweir         const ::boost::function<void(T)>& rSetter,
238cdf0e10cSrcweir         double nP,
239cdf0e10cSrcweir         const T aInitialValue,
240cdf0e10cSrcweir         const T aFinalValue);
241cdf0e10cSrcweir 
242cdf0e10cSrcweir     void SpriteTransform(
243cdf0e10cSrcweir         const rtl::Reference<PresenterPaneContainer>& rpPaneContainer,
244cdf0e10cSrcweir         const Reference<XResourceId>& rxPaneId,
245cdf0e10cSrcweir         const Reference<awt::XWindow>& rxSpriteOwnerWindow,
246cdf0e10cSrcweir         const ::boost::shared_ptr<PresenterPaintManager>& rpPaintManager,
247cdf0e10cSrcweir         const bool bAppear,
248cdf0e10cSrcweir         const double nX,
249cdf0e10cSrcweir         const double nInitialTop,
250cdf0e10cSrcweir         const double nFinalTop,
251cdf0e10cSrcweir         const double nP);
252cdf0e10cSrcweir 
253cdf0e10cSrcweir     void SpritePaneMove (
254cdf0e10cSrcweir         const rtl::Reference<PresenterPaneContainer>& rpPaneContainer,
255cdf0e10cSrcweir         const Reference<XResourceId>& rxPaneId,
256cdf0e10cSrcweir         const geometry::RealPoint2D& rLocation);
257cdf0e10cSrcweir 
258cdf0e10cSrcweir     geometry::RealPoint2D GetLocation (const geometry::RealRectangle2D& rBox);
259cdf0e10cSrcweir     geometry::RealSize2D GetSize (const geometry::RealRectangle2D& rBox);
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 
262cdf0e10cSrcweir } // end of anonymous namespace
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 
265cdf0e10cSrcweir 
266cdf0e10cSrcweir 
267cdf0e10cSrcweir //=============================================================================
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 
CreateUnfoldInCenterAnimator(const css::uno::Reference<css::drawing::framework::XResourceId> & rxPaneId,const::rtl::Reference<PresenterController> & rpPresenterController,const bool bAnimate,const EndActions & rShowEndActions,const EndActions & rEndEndActions)270cdf0e10cSrcweir ::boost::shared_ptr<PresenterPaneAnimator> CreateUnfoldInCenterAnimator (
271cdf0e10cSrcweir     const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
272cdf0e10cSrcweir     const ::rtl::Reference<PresenterController>& rpPresenterController,
273cdf0e10cSrcweir     const bool bAnimate,
274cdf0e10cSrcweir     const EndActions& rShowEndActions,
275cdf0e10cSrcweir     const EndActions& rEndEndActions)
276cdf0e10cSrcweir {
277cdf0e10cSrcweir     return ::boost::shared_ptr<PresenterPaneAnimator>(
278cdf0e10cSrcweir         new UnfoldInCenterAnimator(rxPaneId, rpPresenterController, bAnimate,
279cdf0e10cSrcweir             rShowEndActions, rEndEndActions));
280cdf0e10cSrcweir }
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 
284cdf0e10cSrcweir 
CreateMoveInFromBottomAnimator(const css::uno::Reference<css::drawing::framework::XResourceId> & rxPaneId,const::rtl::Reference<PresenterController> & rpPresenterController,const bool bAnimate,const EndActions & rShowEndActions,const EndActions & rEndEndActions)285cdf0e10cSrcweir ::boost::shared_ptr<PresenterPaneAnimator> CreateMoveInFromBottomAnimator (
286cdf0e10cSrcweir         const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
287cdf0e10cSrcweir         const ::rtl::Reference<PresenterController>& rpPresenterController,
288cdf0e10cSrcweir         const bool bAnimate,
289cdf0e10cSrcweir         const EndActions& rShowEndActions,
290cdf0e10cSrcweir         const EndActions& rEndEndActions)
291cdf0e10cSrcweir {
292cdf0e10cSrcweir     return ::boost::shared_ptr<PresenterPaneAnimator>(
293cdf0e10cSrcweir         new MoveInFromBottomAnimator(rxPaneId, rpPresenterController, bAnimate,
294cdf0e10cSrcweir             rShowEndActions, rEndEndActions));
295cdf0e10cSrcweir }
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 
299cdf0e10cSrcweir 
CreateTransparentOverlay(const css::uno::Reference<css::drawing::framework::XResourceId> & rxPaneId,const::rtl::Reference<PresenterController> & rpPresenterController,const bool bAnimate,const EndActions & rShowEndActions,const EndActions & rEndEndActions)300cdf0e10cSrcweir ::boost::shared_ptr<PresenterPaneAnimator> CreateTransparentOverlay (
301cdf0e10cSrcweir         const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
302cdf0e10cSrcweir         const ::rtl::Reference<PresenterController>& rpPresenterController,
303cdf0e10cSrcweir         const bool bAnimate,
304cdf0e10cSrcweir         const EndActions& rShowEndActions,
305cdf0e10cSrcweir         const EndActions& rEndEndActions)
306cdf0e10cSrcweir {
307cdf0e10cSrcweir     return ::boost::shared_ptr<PresenterPaneAnimator>(
308cdf0e10cSrcweir         new TransparentOverlayAnimator(rxPaneId, rpPresenterController, bAnimate,
309cdf0e10cSrcweir             rShowEndActions, rEndEndActions));
310cdf0e10cSrcweir }
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 
313cdf0e10cSrcweir 
314cdf0e10cSrcweir 
315cdf0e10cSrcweir //===== PresenterPaneAnimator =================================================
316cdf0e10cSrcweir 
317cdf0e10cSrcweir namespace {
318cdf0e10cSrcweir 
PresenterPaneAnimatorBase(const css::uno::Reference<css::drawing::framework::XResourceId> & rxPaneId,const::rtl::Reference<PresenterController> & rpPresenterController,const bool bAnimate,const EndActions & rShowEndActions,const EndActions & rHideEndActions)319cdf0e10cSrcweir PresenterPaneAnimatorBase::PresenterPaneAnimatorBase (
320cdf0e10cSrcweir     const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
321cdf0e10cSrcweir     const ::rtl::Reference<PresenterController>& rpPresenterController,
322cdf0e10cSrcweir     const bool bAnimate,
323cdf0e10cSrcweir     const EndActions& rShowEndActions,
324cdf0e10cSrcweir     const EndActions& rHideEndActions)
325cdf0e10cSrcweir     : mpPresenterController(rpPresenterController),
326cdf0e10cSrcweir       mpPaneContainer(rpPresenterController->GetPaneContainer()),
327cdf0e10cSrcweir       mpWindowManager(rpPresenterController->GetWindowManager()),
328cdf0e10cSrcweir       maPaneGroups(),
329cdf0e10cSrcweir       mxCenterPaneId(rxPaneId),
330cdf0e10cSrcweir       mbDoAnimation(bAnimate),
331cdf0e10cSrcweir       maShowEndActions(rShowEndActions),
332cdf0e10cSrcweir       maHideEndActions(rHideEndActions)
333cdf0e10cSrcweir {
334cdf0e10cSrcweir }
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 
338cdf0e10cSrcweir 
~PresenterPaneAnimatorBase(void)339cdf0e10cSrcweir PresenterPaneAnimatorBase::~PresenterPaneAnimatorBase (void)
340cdf0e10cSrcweir {
341cdf0e10cSrcweir }
342cdf0e10cSrcweir 
343cdf0e10cSrcweir 
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 
FreezePanes(const Reference<rendering::XSpriteCanvas> & rxCanvas)346cdf0e10cSrcweir void PresenterPaneAnimatorBase::FreezePanes (const Reference<rendering::XSpriteCanvas>& rxCanvas)
347cdf0e10cSrcweir {
348cdf0e10cSrcweir     ::std::vector<SharedPaneGroup>::const_iterator iGroup;
349cdf0e10cSrcweir     for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup)
350cdf0e10cSrcweir     {
351cdf0e10cSrcweir         (*iGroup)->CreateSubstitution(rxCanvas);
352cdf0e10cSrcweir         (*iGroup)->GetSubstitution()->MoveTo(GetLocation((*iGroup)->GetOriginalBoundingBox()));
353cdf0e10cSrcweir     }
354cdf0e10cSrcweir }
355cdf0e10cSrcweir 
356cdf0e10cSrcweir 
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 
ActivatePanes(void)359cdf0e10cSrcweir void PresenterPaneAnimatorBase::ActivatePanes (void)
360cdf0e10cSrcweir {
361cdf0e10cSrcweir     ActivatePane(mxCenterPaneId);
362cdf0e10cSrcweir 
363cdf0e10cSrcweir     ::std::vector<SharedPaneGroup>::const_iterator iGroup;
364cdf0e10cSrcweir     for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup)
365cdf0e10cSrcweir     {
366cdf0e10cSrcweir         (*iGroup)->ShowPanes();
367cdf0e10cSrcweir         (*iGroup)->ActivatePanes();
368cdf0e10cSrcweir         (*iGroup)->GetSubstitution()->Hide();
369cdf0e10cSrcweir     }
370cdf0e10cSrcweir 
371cdf0e10cSrcweir     mpWindowManager->Update();
372cdf0e10cSrcweir }
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 
375cdf0e10cSrcweir 
376cdf0e10cSrcweir 
DeactivatePanes(void)377cdf0e10cSrcweir void PresenterPaneAnimatorBase::DeactivatePanes (void)
378cdf0e10cSrcweir {
379cdf0e10cSrcweir     ::std::vector<SharedPaneGroup>::const_iterator iGroup;
380cdf0e10cSrcweir     for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup)
381cdf0e10cSrcweir     {
382cdf0e10cSrcweir         (*iGroup)->GetSubstitution()->Show();
383cdf0e10cSrcweir         (*iGroup)->DeactivatePanes();
384cdf0e10cSrcweir         (*iGroup)->HidePanes();
385cdf0e10cSrcweir     }
386cdf0e10cSrcweir 
387cdf0e10cSrcweir     mpWindowManager->Update();
388cdf0e10cSrcweir }
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 
392cdf0e10cSrcweir 
ResizePane(const Reference<drawing::framework::XResourceId> & rxPaneId,const geometry::RealRectangle2D & rBox)393cdf0e10cSrcweir void PresenterPaneAnimatorBase::ResizePane (
394cdf0e10cSrcweir     const Reference<drawing::framework::XResourceId>& rxPaneId,
395cdf0e10cSrcweir     const geometry::RealRectangle2D& rBox)
396cdf0e10cSrcweir {
397cdf0e10cSrcweir     PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
398cdf0e10cSrcweir         mpPaneContainer->FindPaneId(rxPaneId));
399cdf0e10cSrcweir     if (pDescriptor.get() != NULL)
400cdf0e10cSrcweir     {
401cdf0e10cSrcweir         mpWindowManager->SetPanePosSizeAbsolute (
402cdf0e10cSrcweir             rxPaneId->getResourceURL(),
403cdf0e10cSrcweir             rBox.X1,
404cdf0e10cSrcweir             rBox.Y1,
405cdf0e10cSrcweir             rBox.X2-rBox.X1,
406cdf0e10cSrcweir             rBox.Y2-rBox.Y1);
407cdf0e10cSrcweir         mpWindowManager->Layout();
408cdf0e10cSrcweir         if ( ! pDescriptor->maSpriteProvider.empty())
409cdf0e10cSrcweir         {
410cdf0e10cSrcweir             pDescriptor->maSpriteProvider()->Resize(GetSize(rBox));
411cdf0e10cSrcweir         }
412cdf0e10cSrcweir     }
413cdf0e10cSrcweir }
414cdf0e10cSrcweir 
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 
417cdf0e10cSrcweir 
RestoreFrozenWindows(void)418cdf0e10cSrcweir void PresenterPaneAnimatorBase::RestoreFrozenWindows (void)
419cdf0e10cSrcweir {
420cdf0e10cSrcweir     ::std::vector<SharedPaneGroup>::const_iterator iGroup;
421cdf0e10cSrcweir     for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup)
422cdf0e10cSrcweir     {
423cdf0e10cSrcweir         (*iGroup)->Restore();
424cdf0e10cSrcweir         (*iGroup)->ShowPanes();
425cdf0e10cSrcweir         (*iGroup)->ActivatePanes();
426cdf0e10cSrcweir         (*iGroup)->GetSubstitution()->Hide();
427cdf0e10cSrcweir     }
428cdf0e10cSrcweir     maPaneGroups.clear();
429cdf0e10cSrcweir 
430cdf0e10cSrcweir     ActivatePane(mxCenterPaneId);
431cdf0e10cSrcweir 
432cdf0e10cSrcweir     mpWindowManager->Update();
433cdf0e10cSrcweir }
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 
436cdf0e10cSrcweir 
437cdf0e10cSrcweir 
ActivatePane(const Reference<drawing::framework::XResourceId> & rxPaneId)438cdf0e10cSrcweir void PresenterPaneAnimatorBase::ActivatePane (
439cdf0e10cSrcweir     const Reference<drawing::framework::XResourceId>& rxPaneId)
440cdf0e10cSrcweir {
441cdf0e10cSrcweir     PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
442cdf0e10cSrcweir         mpPaneContainer->FindPaneId(rxPaneId));
443cdf0e10cSrcweir     if (pDescriptor.get() != NULL)
444cdf0e10cSrcweir         pDescriptor->SetActivationState(true);
445cdf0e10cSrcweir }
446cdf0e10cSrcweir 
447cdf0e10cSrcweir 
448cdf0e10cSrcweir 
449cdf0e10cSrcweir 
DeactivatePane(const Reference<drawing::framework::XResourceId> & rxPaneId)450cdf0e10cSrcweir void PresenterPaneAnimatorBase::DeactivatePane (
451cdf0e10cSrcweir     const Reference<drawing::framework::XResourceId>& rxPaneId)
452cdf0e10cSrcweir {
453cdf0e10cSrcweir     PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
454cdf0e10cSrcweir         mpPaneContainer->FindPaneId(rxPaneId));
455cdf0e10cSrcweir     if (pDescriptor.get() != NULL)
456cdf0e10cSrcweir         pDescriptor->SetActivationState(false);
457cdf0e10cSrcweir }
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 
462cdf0e10cSrcweir //===== UnfoldInCenterAnimator ================================================
463cdf0e10cSrcweir 
UnfoldInCenterAnimator(const css::uno::Reference<css::drawing::framework::XResourceId> & rxPaneId,const::rtl::Reference<PresenterController> & rpPresenterController,const bool bAnimate,const EndActions & rShowEndActions,const EndActions & rEndEndActions)464cdf0e10cSrcweir UnfoldInCenterAnimator::UnfoldInCenterAnimator (
465cdf0e10cSrcweir     const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
466cdf0e10cSrcweir     const ::rtl::Reference<PresenterController>& rpPresenterController,
467cdf0e10cSrcweir     const bool bAnimate,
468cdf0e10cSrcweir     const EndActions& rShowEndActions,
469cdf0e10cSrcweir     const EndActions& rEndEndActions)
470cdf0e10cSrcweir     : PresenterPaneAnimatorBase(rxPaneId, rpPresenterController, bAnimate,
471cdf0e10cSrcweir         rShowEndActions, rEndEndActions)
472cdf0e10cSrcweir {
473cdf0e10cSrcweir }
474cdf0e10cSrcweir 
475cdf0e10cSrcweir 
476cdf0e10cSrcweir 
477cdf0e10cSrcweir 
~UnfoldInCenterAnimator(void)478cdf0e10cSrcweir UnfoldInCenterAnimator::~UnfoldInCenterAnimator (void)
479cdf0e10cSrcweir {
480cdf0e10cSrcweir }
481cdf0e10cSrcweir 
482cdf0e10cSrcweir 
483cdf0e10cSrcweir 
484cdf0e10cSrcweir 
ShowPane(void)485cdf0e10cSrcweir void UnfoldInCenterAnimator::ShowPane (void)
486cdf0e10cSrcweir {
487cdf0e10cSrcweir     OSL_ASSERT(mpWindowManager.get()!=NULL);
488cdf0e10cSrcweir 
489cdf0e10cSrcweir     Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY);
490cdf0e10cSrcweir     if ( ! xParentWindow.is())
491cdf0e10cSrcweir         return;
492cdf0e10cSrcweir 
493cdf0e10cSrcweir     Reference<rendering::XSpriteCanvas> xCanvas (mpWindowManager->GetParentCanvas(), UNO_QUERY);
494cdf0e10cSrcweir     if ( ! xCanvas.is())
495cdf0e10cSrcweir         return;
496cdf0e10cSrcweir 
497cdf0e10cSrcweir     Reference<rendering::XBitmap> xParentBitmap (xCanvas, UNO_QUERY);
498cdf0e10cSrcweir     if ( ! xParentBitmap.is())
499cdf0e10cSrcweir         return;
500cdf0e10cSrcweir 
501cdf0e10cSrcweir     Reference<rendering::XGraphicDevice> xDevice(xCanvas->getDevice());
502cdf0e10cSrcweir     if ( ! xDevice.is())
503cdf0e10cSrcweir         return;
504cdf0e10cSrcweir 
505cdf0e10cSrcweir     awt::Rectangle aWindowBox (xParentWindow->getPosSize());
506cdf0e10cSrcweir 
507cdf0e10cSrcweir     // Create two pane groups that will be moved together.  One contains the
508cdf0e10cSrcweir     // notes view, the other group contains all other panes.
509cdf0e10cSrcweir     SetupPaneGroups();
510cdf0e10cSrcweir 
511cdf0e10cSrcweir     // Setup the places where the two pane groups are moved to.
512cdf0e10cSrcweir     maCenterPaneBox
513cdf0e10cSrcweir         = MovePanesAway(geometry::RealRectangle2D(0,200,aWindowBox.Width, aWindowBox.Height-200));
514cdf0e10cSrcweir 
515cdf0e10cSrcweir     // Setup the final size of the new pane so that it fits into the space
516cdf0e10cSrcweir     // between the two pane groups.
517cdf0e10cSrcweir     ResizePane(mxCenterPaneId, maCenterPaneBox);
518cdf0e10cSrcweir 
519cdf0e10cSrcweir     // Avoid that the center pane updates its previews while being animated.
520cdf0e10cSrcweir     DeactivatePane(mxCenterPaneId);
521cdf0e10cSrcweir 
522cdf0e10cSrcweir     // Replace the pane groups with sprites that look like the panes but can
523cdf0e10cSrcweir     // be moved around much faster.
524cdf0e10cSrcweir     FreezePanes(xCanvas);
525cdf0e10cSrcweir 
526cdf0e10cSrcweir     // The vertical center of the new pane.
527cdf0e10cSrcweir     const double nY0 ((maPaneGroups[0]->GetOriginalBoundingBox().Y2
528cdf0e10cSrcweir             + maPaneGroups[1]->GetOriginalBoundingBox().Y1) / 2);
529cdf0e10cSrcweir 
530cdf0e10cSrcweir     // Make sure that the new pane is painted once before the animation starts.
531cdf0e10cSrcweir     SpriteTransform(
532cdf0e10cSrcweir         mpPaneContainer,
533cdf0e10cSrcweir         mxCenterPaneId,
534cdf0e10cSrcweir         xParentWindow,
535cdf0e10cSrcweir         mpPresenterController->GetPaintManager(),
536cdf0e10cSrcweir         true,
537cdf0e10cSrcweir         maCenterPaneBox.X1,
538cdf0e10cSrcweir         nY0,
539cdf0e10cSrcweir         maCenterPaneBox.Y1,
540cdf0e10cSrcweir         0);
541cdf0e10cSrcweir     PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
542cdf0e10cSrcweir         mpPaneContainer->FindPaneId(mxCenterPaneId));
543cdf0e10cSrcweir     if (pDescriptor.get() != NULL)
544cdf0e10cSrcweir     {
545cdf0e10cSrcweir         mpPresenterController->GetPaintManager()->Invalidate(
546cdf0e10cSrcweir             pDescriptor->mxBorderWindow,
547cdf0e10cSrcweir             true);
548cdf0e10cSrcweir     }
549cdf0e10cSrcweir 
550cdf0e10cSrcweir     // Animate the upper and lower window bitmaps.
551cdf0e10cSrcweir     ::boost::shared_ptr<MultiAnimation> pMultiAnimation (
552cdf0e10cSrcweir         new MultiAnimation(mbDoAnimation ? 500 : 0));
553cdf0e10cSrcweir 
554cdf0e10cSrcweir     // Animate the pane group sprites to be moved up or down.
555cdf0e10cSrcweir     vector<SharedPaneGroup>::const_iterator iGroup;
556cdf0e10cSrcweir     for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup)
557cdf0e10cSrcweir     {
558cdf0e10cSrcweir         pMultiAnimation->AddAnimation(
559cdf0e10cSrcweir             ::boost::bind(
560cdf0e10cSrcweir                 InterpolatePosition,
561cdf0e10cSrcweir                 ::boost::protect(::boost::bind(
562cdf0e10cSrcweir                     &PresenterSprite::MoveTo, (*iGroup)->GetSubstitution(), _1)),
563cdf0e10cSrcweir                 _1,
564cdf0e10cSrcweir                 GetLocation((*iGroup)->GetOriginalBoundingBox()),
565cdf0e10cSrcweir                 GetLocation((*iGroup)->GetCurrentBoundingBox())));
566cdf0e10cSrcweir     }
567cdf0e10cSrcweir 
568cdf0e10cSrcweir     // Animate the new center pane to expand.
569cdf0e10cSrcweir     pMultiAnimation->AddAnimation(
570cdf0e10cSrcweir         ::boost::bind(
571cdf0e10cSrcweir             SpriteTransform,
572cdf0e10cSrcweir             mpPaneContainer,
573cdf0e10cSrcweir             mxCenterPaneId,
574cdf0e10cSrcweir             xParentWindow,
575cdf0e10cSrcweir             mpPresenterController->GetPaintManager(),
576cdf0e10cSrcweir             true,
577cdf0e10cSrcweir             maCenterPaneBox.X1,
578cdf0e10cSrcweir             nY0,
579cdf0e10cSrcweir             maCenterPaneBox.Y1,
580cdf0e10cSrcweir             _1));
581cdf0e10cSrcweir 
582cdf0e10cSrcweir     // Call updateScreen after each animation step.
583cdf0e10cSrcweir     if (xCanvas.is())
584cdf0e10cSrcweir         pMultiAnimation->AddAnimation(
585cdf0e10cSrcweir             ::boost::bind(&rendering::XSpriteCanvas::updateScreen, xCanvas, sal_False));
586cdf0e10cSrcweir 
587cdf0e10cSrcweir     // Activate the panes when the animation is over.
588cdf0e10cSrcweir     pMultiAnimation->AddEndCallback(
589cdf0e10cSrcweir         ::boost::bind(&PresenterPaneAnimatorBase::ActivatePanes, shared_from_this()));
590cdf0e10cSrcweir     EndActions::const_iterator iAction;
591cdf0e10cSrcweir     for (iAction=maShowEndActions.begin(); iAction!=maShowEndActions.end(); ++iAction)
592cdf0e10cSrcweir         pMultiAnimation->AddEndCallback(*iAction);
593cdf0e10cSrcweir 
594cdf0e10cSrcweir     // Start the animation.
595cdf0e10cSrcweir     ::boost::shared_ptr<PresenterAnimator> pAnimator (mpPresenterController->GetAnimator());
596cdf0e10cSrcweir     OSL_ASSERT(pAnimator.get()!=NULL);
597cdf0e10cSrcweir     pAnimator->AddAnimation(SharedPresenterAnimation(pMultiAnimation));
598cdf0e10cSrcweir 
599cdf0e10cSrcweir     mpWindowManager->Update();
600cdf0e10cSrcweir }
601cdf0e10cSrcweir 
602cdf0e10cSrcweir 
603cdf0e10cSrcweir 
604cdf0e10cSrcweir 
HidePane(void)605cdf0e10cSrcweir void UnfoldInCenterAnimator::HidePane (void)
606cdf0e10cSrcweir {
607cdf0e10cSrcweir     OSL_ASSERT(mpWindowManager.get()!=NULL);
608cdf0e10cSrcweir 
609cdf0e10cSrcweir     Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY);
610cdf0e10cSrcweir     if ( ! xParentWindow.is())
611cdf0e10cSrcweir         return;
612cdf0e10cSrcweir 
613cdf0e10cSrcweir     DeactivatePanes();
614cdf0e10cSrcweir     DeactivatePane(mxCenterPaneId);
615cdf0e10cSrcweir 
616cdf0e10cSrcweir     ::boost::shared_ptr<PresenterAnimator> pAnimator (mpPresenterController->GetAnimator());
617cdf0e10cSrcweir     const awt::Rectangle aWindowBox (xParentWindow->getPosSize());
618cdf0e10cSrcweir     const rendering::ViewState aViewState (
619cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
620cdf0e10cSrcweir         NULL);
621cdf0e10cSrcweir     const rendering::RenderState aRenderState (
622cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
623cdf0e10cSrcweir         NULL,
624cdf0e10cSrcweir         Sequence<double>(4),
625cdf0e10cSrcweir         rendering::CompositeOperation::SOURCE);
626cdf0e10cSrcweir 
627cdf0e10cSrcweir     // Animate the uppder and lower window bitmaps.
628cdf0e10cSrcweir     Reference<rendering::XSpriteCanvas> xSpriteCanvas (mpWindowManager->GetParentCanvas(), UNO_QUERY);
629cdf0e10cSrcweir     ::boost::shared_ptr<MultiAnimation> pMultiAnimation (new MultiAnimation(mbDoAnimation ? 500 : 1));
630cdf0e10cSrcweir 
631cdf0e10cSrcweir     vector<SharedPaneGroup>::const_iterator iGroup;
632cdf0e10cSrcweir     for (iGroup=maPaneGroups.begin(); iGroup!=maPaneGroups.end(); ++iGroup)
633cdf0e10cSrcweir     {
634cdf0e10cSrcweir         pMultiAnimation->AddAnimation(
635cdf0e10cSrcweir             ::boost::bind(
636cdf0e10cSrcweir                 InterpolatePosition,
637cdf0e10cSrcweir                 ::boost::protect(::boost::bind(
638cdf0e10cSrcweir                     &PresenterSprite::MoveTo, (*iGroup)->GetSubstitution(), _1)),
639cdf0e10cSrcweir                 _1,
640cdf0e10cSrcweir                 GetLocation((*iGroup)->GetCurrentBoundingBox()),
641cdf0e10cSrcweir                 GetLocation((*iGroup)->GetOriginalBoundingBox())));
642cdf0e10cSrcweir     }
643cdf0e10cSrcweir 
644cdf0e10cSrcweir     // Animate the new center pane to collapse.
645cdf0e10cSrcweir     const double nY0 ((maPaneGroups[0]->GetOriginalBoundingBox().Y2
646cdf0e10cSrcweir             + maPaneGroups[1]->GetOriginalBoundingBox().Y1) / 2);
647cdf0e10cSrcweir     pMultiAnimation->AddAnimation(
648cdf0e10cSrcweir         ::boost::bind(
649cdf0e10cSrcweir             SpriteTransform,
650cdf0e10cSrcweir             mpPaneContainer,
651cdf0e10cSrcweir             mxCenterPaneId,
652cdf0e10cSrcweir             xParentWindow,
653cdf0e10cSrcweir             mpPresenterController->GetPaintManager(),
654cdf0e10cSrcweir             false,
655cdf0e10cSrcweir             maCenterPaneBox.X1,
656cdf0e10cSrcweir             nY0,
657cdf0e10cSrcweir             maCenterPaneBox.Y1,
658cdf0e10cSrcweir             _1));
659cdf0e10cSrcweir 
660cdf0e10cSrcweir     if (mbDoAnimation)
661cdf0e10cSrcweir     {
662cdf0e10cSrcweir         pMultiAnimation->AddAnimation(
663cdf0e10cSrcweir             ::boost::bind(&rendering::XSpriteCanvas::updateScreen, xSpriteCanvas, sal_False));
664cdf0e10cSrcweir     }
665cdf0e10cSrcweir     pMultiAnimation->AddEndCallback(
666cdf0e10cSrcweir         ::boost::bind(&PresenterPaneAnimatorBase::RestoreFrozenWindows, shared_from_this()));
667cdf0e10cSrcweir     EndActions::const_iterator iAction;
668cdf0e10cSrcweir     for (iAction=maHideEndActions.begin(); iAction!=maHideEndActions.end(); ++iAction)
669cdf0e10cSrcweir         pMultiAnimation->AddEndCallback(*iAction);
670cdf0e10cSrcweir 
671cdf0e10cSrcweir     pAnimator->AddAnimation(SharedPresenterAnimation(pMultiAnimation));
672cdf0e10cSrcweir }
673cdf0e10cSrcweir 
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 
676cdf0e10cSrcweir 
SetupPaneGroups(void)677cdf0e10cSrcweir void UnfoldInCenterAnimator::SetupPaneGroups (void)
678cdf0e10cSrcweir {
679cdf0e10cSrcweir     maPaneGroups.clear();
680cdf0e10cSrcweir 
681cdf0e10cSrcweir     // Setup the upper pane group.
682cdf0e10cSrcweir     SharedPaneGroup pUpperPanes (new PaneGroup());
683cdf0e10cSrcweir     pUpperPanes->AddPane(mpPaneContainer->FindPaneURL(
684cdf0e10cSrcweir         PresenterPaneFactory::msCurrentSlidePreviewPaneURL));
685cdf0e10cSrcweir     pUpperPanes->AddPane(mpPaneContainer->FindPaneURL(
686cdf0e10cSrcweir         PresenterPaneFactory::msNextSlidePreviewPaneURL));
687cdf0e10cSrcweir     pUpperPanes->AddPane(mpPaneContainer->FindPaneURL(
688cdf0e10cSrcweir         PresenterPaneFactory::msToolBarPaneURL));
689cdf0e10cSrcweir     pUpperPanes->AddPane(mpPaneContainer->FindPaneURL(
690cdf0e10cSrcweir         PresenterPaneFactory::msHelpPaneURL));
691cdf0e10cSrcweir     maPaneGroups.push_back(pUpperPanes);
692cdf0e10cSrcweir 
693cdf0e10cSrcweir     // Setup the lower pane group.
694cdf0e10cSrcweir     SharedPaneGroup pLowerPanes (new PaneGroup());
695cdf0e10cSrcweir     pLowerPanes->AddPane(mpPaneContainer->FindPaneURL(
696cdf0e10cSrcweir         PresenterPaneFactory::msNotesPaneURL));
697cdf0e10cSrcweir     maPaneGroups.push_back(pLowerPanes);
698cdf0e10cSrcweir }
699cdf0e10cSrcweir 
700cdf0e10cSrcweir 
701cdf0e10cSrcweir 
702cdf0e10cSrcweir 
MovePanesAway(const geometry::RealRectangle2D & rFreeCenterArea)703cdf0e10cSrcweir geometry::RealRectangle2D UnfoldInCenterAnimator::MovePanesAway (
704cdf0e10cSrcweir     const geometry::RealRectangle2D& rFreeCenterArea)
705cdf0e10cSrcweir {
706cdf0e10cSrcweir     SharedPaneGroup aUpperPanes = maPaneGroups[0];
707cdf0e10cSrcweir     SharedPaneGroup aLowerPanes = maPaneGroups[1];
708cdf0e10cSrcweir 
709cdf0e10cSrcweir     // Move upper pane group out of the way.
710cdf0e10cSrcweir     const double nTop (rFreeCenterArea.Y1);
711cdf0e10cSrcweir     const double nUpperVerticalOffset (nTop - aUpperPanes->GetOriginalBoundingBox().Y2);
712cdf0e10cSrcweir     aUpperPanes->MovePanes(0, nUpperVerticalOffset, mpWindowManager);
713cdf0e10cSrcweir 
714cdf0e10cSrcweir     // Move lower pane group out of the way.
715cdf0e10cSrcweir     const double nBottom (rFreeCenterArea.Y2);
716cdf0e10cSrcweir     const double nLowerVerticalOffset (nBottom - aLowerPanes->GetOriginalBoundingBox().Y1);
717cdf0e10cSrcweir     aLowerPanes->MovePanes(0, nLowerVerticalOffset, mpWindowManager);
718cdf0e10cSrcweir 
719cdf0e10cSrcweir     return geometry::RealRectangle2D(
720cdf0e10cSrcweir         ::std::min(
721cdf0e10cSrcweir             aUpperPanes->GetOriginalBoundingBox().X1,
722cdf0e10cSrcweir             aLowerPanes->GetOriginalBoundingBox().X1),
723cdf0e10cSrcweir         nTop+20,
724cdf0e10cSrcweir         ::std::max(
725cdf0e10cSrcweir             aUpperPanes->GetOriginalBoundingBox().X2,
726cdf0e10cSrcweir             aLowerPanes->GetOriginalBoundingBox().X2),
727cdf0e10cSrcweir         nBottom-20);
728cdf0e10cSrcweir }
729cdf0e10cSrcweir 
730cdf0e10cSrcweir 
731cdf0e10cSrcweir 
732cdf0e10cSrcweir 
733cdf0e10cSrcweir //===== MoveInFromBottomAnimator ==============================================
734cdf0e10cSrcweir 
MoveInFromBottomAnimator(const css::uno::Reference<css::drawing::framework::XResourceId> & rxPaneId,const::rtl::Reference<PresenterController> & rpPresenterController,const bool bAnimate,const EndActions & rShowEndActions,const EndActions & rEndEndActions)735cdf0e10cSrcweir MoveInFromBottomAnimator::MoveInFromBottomAnimator (
736cdf0e10cSrcweir     const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
737cdf0e10cSrcweir     const ::rtl::Reference<PresenterController>& rpPresenterController,
738cdf0e10cSrcweir     const bool bAnimate,
739cdf0e10cSrcweir     const EndActions& rShowEndActions,
740cdf0e10cSrcweir     const EndActions& rEndEndActions)
741cdf0e10cSrcweir     : PresenterPaneAnimatorBase(rxPaneId, rpPresenterController, bAnimate,
742cdf0e10cSrcweir         rShowEndActions, rEndEndActions),
743cdf0e10cSrcweir       maNewPaneSprite()
744cdf0e10cSrcweir {
745cdf0e10cSrcweir }
746cdf0e10cSrcweir 
747cdf0e10cSrcweir 
748cdf0e10cSrcweir 
749cdf0e10cSrcweir 
~MoveInFromBottomAnimator(void)750cdf0e10cSrcweir MoveInFromBottomAnimator::~MoveInFromBottomAnimator (void)
751cdf0e10cSrcweir {
752cdf0e10cSrcweir }
753cdf0e10cSrcweir 
754cdf0e10cSrcweir 
755cdf0e10cSrcweir 
756cdf0e10cSrcweir 
ShowPane(void)757cdf0e10cSrcweir void MoveInFromBottomAnimator::ShowPane (void)
758cdf0e10cSrcweir {
759cdf0e10cSrcweir     OSL_ASSERT(mpWindowManager.get()!=NULL);
760cdf0e10cSrcweir 
761cdf0e10cSrcweir     Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY);
762cdf0e10cSrcweir     if ( ! xParentWindow.is())
763cdf0e10cSrcweir         return;
764cdf0e10cSrcweir 
765cdf0e10cSrcweir     Reference<rendering::XSpriteCanvas> xCanvas (mpWindowManager->GetParentCanvas(), UNO_QUERY);
766cdf0e10cSrcweir     if ( ! xCanvas.is())
767cdf0e10cSrcweir         return;
768cdf0e10cSrcweir 
769cdf0e10cSrcweir     Reference<rendering::XBitmap> xParentBitmap (xCanvas, UNO_QUERY);
770cdf0e10cSrcweir     if ( ! xParentBitmap.is())
771cdf0e10cSrcweir         return;
772cdf0e10cSrcweir 
773cdf0e10cSrcweir     Reference<rendering::XGraphicDevice> xDevice(xCanvas->getDevice());
774cdf0e10cSrcweir     if ( ! xDevice.is())
775cdf0e10cSrcweir         return;
776cdf0e10cSrcweir 
777cdf0e10cSrcweir     awt::Rectangle aWindowBox (xParentWindow->getPosSize());
778cdf0e10cSrcweir 
779cdf0e10cSrcweir     // Create a pane group that just contains the notes view.
780cdf0e10cSrcweir     SharedPaneGroup pLowerPanes (new PaneGroup());
781cdf0e10cSrcweir     pLowerPanes->AddPane(mpPaneContainer->FindPaneURL(
782cdf0e10cSrcweir         PresenterPaneFactory::msNotesPaneURL));
783cdf0e10cSrcweir     maPaneGroups.push_back(pLowerPanes);
784cdf0e10cSrcweir 
785cdf0e10cSrcweir     // Deactivate the panes that will take place in the animation.
786cdf0e10cSrcweir     pLowerPanes->DeactivatePanes();
787cdf0e10cSrcweir     DeactivatePane(mxCenterPaneId);
788cdf0e10cSrcweir 
789cdf0e10cSrcweir     // Set the size of the new pane.
790cdf0e10cSrcweir     maCenterPaneBox = pLowerPanes->GetOriginalBoundingBox();
791cdf0e10cSrcweir     ResizePane(mxCenterPaneId, maCenterPaneBox);
792cdf0e10cSrcweir 
793cdf0e10cSrcweir     geometry::RealPoint2D aStartLocation (maCenterPaneBox.X1, aWindowBox.Height);
794cdf0e10cSrcweir     geometry::RealPoint2D aEndLocation (maCenterPaneBox.X1, maCenterPaneBox.Y1);
795cdf0e10cSrcweir 
796cdf0e10cSrcweir     // Get the sprite of the new pane, make it visible and move it to the
797cdf0e10cSrcweir     // start location.
798cdf0e10cSrcweir     PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
799cdf0e10cSrcweir         mpPaneContainer->FindPaneId(mxCenterPaneId));
800cdf0e10cSrcweir     if (pDescriptor.get() != NULL)
801cdf0e10cSrcweir     {
802cdf0e10cSrcweir         if (pDescriptor->mxBorderWindow.is())
803cdf0e10cSrcweir             pDescriptor->mxBorderWindow->setVisible(sal_True);
804cdf0e10cSrcweir 
805cdf0e10cSrcweir         maNewPaneSprite = pDescriptor->maSpriteProvider();
806cdf0e10cSrcweir         if (maNewPaneSprite.get() != NULL)
807cdf0e10cSrcweir         {
808cdf0e10cSrcweir             maNewPaneSprite->MoveTo(aStartLocation);
809cdf0e10cSrcweir             maNewPaneSprite->Show();
810cdf0e10cSrcweir         }
811cdf0e10cSrcweir         xCanvas->updateScreen(sal_False);
812cdf0e10cSrcweir     }
813cdf0e10cSrcweir 
814cdf0e10cSrcweir     CreateShowAnimation(
815cdf0e10cSrcweir         mxCenterPaneId,
816cdf0e10cSrcweir         maShowEndActions,
817cdf0e10cSrcweir         xCanvas,
818cdf0e10cSrcweir         mbDoAnimation,
819cdf0e10cSrcweir         aStartLocation,
820cdf0e10cSrcweir         aEndLocation);
821cdf0e10cSrcweir 
822cdf0e10cSrcweir     mpWindowManager->Update();
823cdf0e10cSrcweir }
824cdf0e10cSrcweir 
825cdf0e10cSrcweir 
826cdf0e10cSrcweir 
827cdf0e10cSrcweir 
HidePane(void)828cdf0e10cSrcweir void MoveInFromBottomAnimator::HidePane (void)
829cdf0e10cSrcweir {
830cdf0e10cSrcweir     OSL_ASSERT(mpWindowManager.get()!=NULL);
831cdf0e10cSrcweir 
832cdf0e10cSrcweir     Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY);
833cdf0e10cSrcweir     if ( ! xParentWindow.is())
834cdf0e10cSrcweir         return;
835cdf0e10cSrcweir 
836cdf0e10cSrcweir     Reference<rendering::XSpriteCanvas> xCanvas (mpWindowManager->GetParentCanvas(), UNO_QUERY);
837cdf0e10cSrcweir     if ( ! xCanvas.is())
838cdf0e10cSrcweir         return;
839cdf0e10cSrcweir 
840cdf0e10cSrcweir     DeactivatePanes();
841cdf0e10cSrcweir     DeactivatePane(mxCenterPaneId);
842cdf0e10cSrcweir 
843cdf0e10cSrcweir     SharedPaneGroup aPanes (maPaneGroups[0]);
844cdf0e10cSrcweir 
845cdf0e10cSrcweir     aPanes->ShowPanes();
846cdf0e10cSrcweir 
847cdf0e10cSrcweir     ::boost::shared_ptr<MultiAnimation> pMultiAnimation (
848cdf0e10cSrcweir         new MultiAnimation(mbDoAnimation ? 500 : 0));
849cdf0e10cSrcweir     awt::Rectangle aWindowBox (xParentWindow->getPosSize());
850cdf0e10cSrcweir 
851cdf0e10cSrcweir     // Animate the new center pane to collapse.
852cdf0e10cSrcweir     pMultiAnimation->AddAnimation(
853cdf0e10cSrcweir         ::boost::bind(
854cdf0e10cSrcweir             InterpolatePosition,
855cdf0e10cSrcweir             ::boost::protect(::boost::bind(&SpritePaneMove, mpPaneContainer, mxCenterPaneId, _1)),
856cdf0e10cSrcweir             _1,
857cdf0e10cSrcweir             geometry::RealPoint2D(maCenterPaneBox.X1, maCenterPaneBox.Y1),
858cdf0e10cSrcweir             geometry::RealPoint2D(maCenterPaneBox.X1, aWindowBox.Height)));
859cdf0e10cSrcweir 
860cdf0e10cSrcweir     if (mbDoAnimation)
861cdf0e10cSrcweir     {
862cdf0e10cSrcweir         pMultiAnimation->AddAnimation(
863cdf0e10cSrcweir             ::boost::bind(&rendering::XSpriteCanvas::updateScreen, xCanvas, sal_False));
864cdf0e10cSrcweir     }
865cdf0e10cSrcweir     pMultiAnimation->AddEndCallback(
866cdf0e10cSrcweir         ::boost::bind(&PresenterPaneAnimatorBase::RestoreFrozenWindows, shared_from_this()));
867cdf0e10cSrcweir     EndActions::const_iterator iAction;
868cdf0e10cSrcweir     for (iAction=maHideEndActions.begin(); iAction!=maHideEndActions.end(); ++iAction)
869cdf0e10cSrcweir         pMultiAnimation->AddEndCallback(*iAction);
870cdf0e10cSrcweir 
871cdf0e10cSrcweir     ::boost::shared_ptr<PresenterAnimator> pAnimator (mpPresenterController->GetAnimator());
872cdf0e10cSrcweir     pAnimator->AddAnimation(SharedPresenterAnimation(pMultiAnimation));
873cdf0e10cSrcweir }
874cdf0e10cSrcweir 
875cdf0e10cSrcweir 
876cdf0e10cSrcweir 
877cdf0e10cSrcweir 
CreateShowAnimation(const Reference<drawing::framework::XResourceId> & rxPaneId,const EndOperators & rEndOperators,const Reference<rendering::XSpriteCanvas> & rxSpriteCanvas,const bool bAnimate,const geometry::RealPoint2D & rStartLocation,const geometry::RealPoint2D & rEndLocation)878cdf0e10cSrcweir void MoveInFromBottomAnimator::CreateShowAnimation (
879cdf0e10cSrcweir     const Reference<drawing::framework::XResourceId>& rxPaneId,
880cdf0e10cSrcweir     const EndOperators& rEndOperators,
881cdf0e10cSrcweir     const Reference<rendering::XSpriteCanvas>& rxSpriteCanvas,
882cdf0e10cSrcweir     const bool bAnimate,
883cdf0e10cSrcweir     const geometry::RealPoint2D& rStartLocation,
884cdf0e10cSrcweir     const geometry::RealPoint2D& rEndLocation)
885cdf0e10cSrcweir {
886cdf0e10cSrcweir     // Animate the uppder and lower window bitmaps.
887cdf0e10cSrcweir     ::boost::shared_ptr<MultiAnimation> pMultiAnimation (new MultiAnimation(bAnimate ? 500 : 0));
888cdf0e10cSrcweir 
889cdf0e10cSrcweir     // Animate new pane to move in from the buttom.
890cdf0e10cSrcweir     pMultiAnimation->AddAnimation(
891cdf0e10cSrcweir         ::boost::bind(
892cdf0e10cSrcweir             InterpolatePosition,
893cdf0e10cSrcweir             ::boost::protect(::boost::bind(&SpritePaneMove, mpPaneContainer, rxPaneId, _1)),
894cdf0e10cSrcweir             _1,
895cdf0e10cSrcweir             rStartLocation,
896cdf0e10cSrcweir             rEndLocation));
897cdf0e10cSrcweir 
898cdf0e10cSrcweir     // Call updateScreen after each animation step.
899cdf0e10cSrcweir     if (rxSpriteCanvas.is())
900cdf0e10cSrcweir         pMultiAnimation->AddAnimation(
901cdf0e10cSrcweir             ::boost::bind(&rendering::XSpriteCanvas::updateScreen, rxSpriteCanvas, sal_False));
902cdf0e10cSrcweir 
903cdf0e10cSrcweir     // Activate the panes when the animation is over.
904cdf0e10cSrcweir     pMultiAnimation->AddEndCallback(
905cdf0e10cSrcweir         ::boost::bind(&PaneGroup::HidePanes, maPaneGroups[0]));
906cdf0e10cSrcweir     pMultiAnimation->AddEndCallback(
907cdf0e10cSrcweir         ::boost::bind(&PresenterPaneAnimatorBase::ActivatePane, shared_from_this(), mxCenterPaneId));
908cdf0e10cSrcweir     EndActions::const_iterator iAction;
909cdf0e10cSrcweir     for (iAction=rEndOperators.begin(); iAction!=rEndOperators.end(); ++iAction)
910cdf0e10cSrcweir         pMultiAnimation->AddEndCallback(*iAction);
911cdf0e10cSrcweir 
912cdf0e10cSrcweir     // Start the animation.
913cdf0e10cSrcweir     ::boost::shared_ptr<PresenterAnimator> pAnimator (mpPresenterController->GetAnimator());
914cdf0e10cSrcweir     OSL_ASSERT(pAnimator.get()!=NULL);
915cdf0e10cSrcweir     pAnimator->AddAnimation(SharedPresenterAnimation(pMultiAnimation));
916cdf0e10cSrcweir }
917cdf0e10cSrcweir 
918cdf0e10cSrcweir 
919cdf0e10cSrcweir 
920cdf0e10cSrcweir 
921cdf0e10cSrcweir 
922cdf0e10cSrcweir //===== TransparentOverlayAnimator ============================================
923cdf0e10cSrcweir 
TransparentOverlayAnimator(const css::uno::Reference<css::drawing::framework::XResourceId> & rxPaneId,const::rtl::Reference<PresenterController> & rpPresenterController,const bool bAnimate,const EndActions & rShowEndActions,const EndActions & rEndEndActions)924cdf0e10cSrcweir TransparentOverlayAnimator::TransparentOverlayAnimator (
925cdf0e10cSrcweir     const css::uno::Reference<css::drawing::framework::XResourceId>& rxPaneId,
926cdf0e10cSrcweir     const ::rtl::Reference<PresenterController>& rpPresenterController,
927cdf0e10cSrcweir     const bool bAnimate,
928cdf0e10cSrcweir     const EndActions& rShowEndActions,
929cdf0e10cSrcweir     const EndActions& rEndEndActions)
930cdf0e10cSrcweir     : PresenterPaneAnimatorBase(
931cdf0e10cSrcweir         rxPaneId,
932cdf0e10cSrcweir         rpPresenterController,
933cdf0e10cSrcweir         bAnimate,
934cdf0e10cSrcweir         rShowEndActions,
935cdf0e10cSrcweir         rEndEndActions),
936cdf0e10cSrcweir       maBackgroundSprite()
937cdf0e10cSrcweir {
938cdf0e10cSrcweir }
939cdf0e10cSrcweir 
940cdf0e10cSrcweir 
941cdf0e10cSrcweir 
942cdf0e10cSrcweir 
~TransparentOverlayAnimator(void)943cdf0e10cSrcweir TransparentOverlayAnimator::~TransparentOverlayAnimator (void)
944cdf0e10cSrcweir {
945cdf0e10cSrcweir }
946cdf0e10cSrcweir 
947cdf0e10cSrcweir 
948cdf0e10cSrcweir 
949cdf0e10cSrcweir 
ShowPane(void)950cdf0e10cSrcweir void TransparentOverlayAnimator::ShowPane (void)
951cdf0e10cSrcweir {
952cdf0e10cSrcweir     EndActions::const_iterator iAction;
953cdf0e10cSrcweir     for (iAction=maShowEndActions.begin(); iAction!=maShowEndActions.end(); ++iAction)
954cdf0e10cSrcweir         (*iAction)();
955cdf0e10cSrcweir 
956cdf0e10cSrcweir     CreateBackgroundSprite();
957cdf0e10cSrcweir 
958cdf0e10cSrcweir     Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY);
959cdf0e10cSrcweir     if (xParentWindow.is())
960cdf0e10cSrcweir     {
961cdf0e10cSrcweir         const awt::Rectangle aWindowBox (xParentWindow->getPosSize());
962cdf0e10cSrcweir         SharedPaneGroup pAllPanes (new PaneGroup());
963cdf0e10cSrcweir         pAllPanes->AddPane(mpPaneContainer->FindPaneURL(
964cdf0e10cSrcweir             PresenterPaneFactory::msCurrentSlidePreviewPaneURL));
965cdf0e10cSrcweir         pAllPanes->AddPane(mpPaneContainer->FindPaneURL(
966cdf0e10cSrcweir             PresenterPaneFactory::msNextSlidePreviewPaneURL));
967cdf0e10cSrcweir         pAllPanes->AddPane(mpPaneContainer->FindPaneURL(
968cdf0e10cSrcweir             PresenterPaneFactory::msToolBarPaneURL));
969cdf0e10cSrcweir         pAllPanes->AddPane(mpPaneContainer->FindPaneURL(
970cdf0e10cSrcweir             PresenterPaneFactory::msHelpPaneURL));
971cdf0e10cSrcweir         pAllPanes->AddPane(mpPaneContainer->FindPaneURL(
972cdf0e10cSrcweir             PresenterPaneFactory::msNotesPaneURL));
973cdf0e10cSrcweir         maPaneGroups.push_back(pAllPanes);
974cdf0e10cSrcweir         pAllPanes->DeactivatePanes();
975cdf0e10cSrcweir         mpWindowManager->Update();
976cdf0e10cSrcweir     }
977cdf0e10cSrcweir 
978cdf0e10cSrcweir     PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
979cdf0e10cSrcweir         mpPaneContainer->FindPaneId(mxCenterPaneId));
980cdf0e10cSrcweir     if (pDescriptor.get() != NULL)
981cdf0e10cSrcweir     {
982cdf0e10cSrcweir         PresenterSpritePane* pPane = dynamic_cast<PresenterSpritePane*>(
983cdf0e10cSrcweir             pDescriptor->mxPane.get());
984cdf0e10cSrcweir         if (pPane != NULL)
985cdf0e10cSrcweir             pPane->ShowTransparentBorder();
986cdf0e10cSrcweir 
987cdf0e10cSrcweir         pDescriptor->SetActivationState(true);
988cdf0e10cSrcweir         if (pDescriptor->mxBorderWindow.is())
989cdf0e10cSrcweir             pDescriptor->mxBorderWindow->setVisible(sal_True);
990cdf0e10cSrcweir     }
991cdf0e10cSrcweir }
992cdf0e10cSrcweir 
993cdf0e10cSrcweir 
994cdf0e10cSrcweir 
995cdf0e10cSrcweir 
HidePane(void)996cdf0e10cSrcweir void TransparentOverlayAnimator::HidePane (void)
997cdf0e10cSrcweir {
998cdf0e10cSrcweir     maPaneGroups[0]->ActivatePanes();
999cdf0e10cSrcweir     EndActions::const_iterator iAction;
1000cdf0e10cSrcweir     for (iAction=maHideEndActions.begin(); iAction!=maHideEndActions.end(); ++iAction)
1001cdf0e10cSrcweir         (*iAction)();
1002cdf0e10cSrcweir     mpWindowManager->Update();
1003cdf0e10cSrcweir }
1004cdf0e10cSrcweir 
1005cdf0e10cSrcweir 
1006cdf0e10cSrcweir 
1007cdf0e10cSrcweir 
CreateBackgroundSprite(void)1008cdf0e10cSrcweir void TransparentOverlayAnimator::CreateBackgroundSprite (void)
1009cdf0e10cSrcweir {
1010cdf0e10cSrcweir     Reference<awt::XWindow> xParentWindow (mpWindowManager->GetParentWindow(), UNO_QUERY);
1011cdf0e10cSrcweir     Reference<rendering::XSpriteCanvas> xParentCanvas (mpWindowManager->GetParentCanvas(), UNO_QUERY);
1012cdf0e10cSrcweir     if (xParentWindow.is() && xParentCanvas.is())
1013cdf0e10cSrcweir     {
1014cdf0e10cSrcweir         const awt::Rectangle aWindowBox (xParentWindow->getPosSize());
1015cdf0e10cSrcweir         maBackgroundSprite.SetFactory(xParentCanvas);
1016cdf0e10cSrcweir         maBackgroundSprite.Resize(
1017cdf0e10cSrcweir             geometry::RealSize2D(aWindowBox.Width, aWindowBox.Height));
1018cdf0e10cSrcweir         maBackgroundSprite.MoveTo(
1019cdf0e10cSrcweir             geometry::RealPoint2D(aWindowBox.X, aWindowBox.Y));
1020cdf0e10cSrcweir         maBackgroundSprite.SetAlpha(0.5);
1021cdf0e10cSrcweir         maBackgroundSprite.Show();
1022cdf0e10cSrcweir 
1023cdf0e10cSrcweir         Reference<rendering::XCanvas> xCanvas (maBackgroundSprite.GetCanvas());
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir         if (xCanvas.is())
1026cdf0e10cSrcweir         {
1027cdf0e10cSrcweir             rendering::ViewState aViewState(
1028cdf0e10cSrcweir                 geometry::AffineMatrix2D(1,0,0, 0,1,0),
1029cdf0e10cSrcweir                 NULL);
1030cdf0e10cSrcweir 
1031cdf0e10cSrcweir             rendering::RenderState aRenderState(
1032cdf0e10cSrcweir                 geometry::AffineMatrix2D(1,0,0, 0,1,0),
1033cdf0e10cSrcweir                 NULL,
1034cdf0e10cSrcweir                 Sequence<double>(4),
1035cdf0e10cSrcweir                 rendering::CompositeOperation::SOURCE);
1036cdf0e10cSrcweir             PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x80808080));
1037cdf0e10cSrcweir 
1038cdf0e10cSrcweir             Reference<rendering::XPolyPolygon2D> xPolygon (
1039cdf0e10cSrcweir                 PresenterGeometryHelper::CreatePolygon(aWindowBox, xCanvas->getDevice()));
1040cdf0e10cSrcweir             if (xPolygon.is())
1041cdf0e10cSrcweir                 xCanvas->fillPolyPolygon(
1042cdf0e10cSrcweir                     xPolygon,
1043cdf0e10cSrcweir                     aViewState,
1044cdf0e10cSrcweir                     aRenderState);
1045cdf0e10cSrcweir         }
1046cdf0e10cSrcweir     }
1047cdf0e10cSrcweir }
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir 
1050cdf0e10cSrcweir 
1051cdf0e10cSrcweir 
1052cdf0e10cSrcweir //===== PaneGroup =============================================================
1053cdf0e10cSrcweir 
PaneGroup(void)1054cdf0e10cSrcweir PaneGroup::PaneGroup (void)
1055cdf0e10cSrcweir     : maPanes(),
1056cdf0e10cSrcweir       maOriginalBoundingBox(),
1057cdf0e10cSrcweir       maCurrentBoundingBox(),
1058cdf0e10cSrcweir       mpSubstitution(new PresenterSprite())
1059cdf0e10cSrcweir {
1060cdf0e10cSrcweir }
1061cdf0e10cSrcweir 
1062cdf0e10cSrcweir 
1063cdf0e10cSrcweir 
1064cdf0e10cSrcweir 
~PaneGroup(void)1065cdf0e10cSrcweir PaneGroup::~PaneGroup (void)
1066cdf0e10cSrcweir {
1067cdf0e10cSrcweir     mpSubstitution.reset();
1068cdf0e10cSrcweir }
1069cdf0e10cSrcweir 
1070cdf0e10cSrcweir 
1071cdf0e10cSrcweir 
1072cdf0e10cSrcweir 
AddPane(const PresenterPaneContainer::SharedPaneDescriptor & rpPane)1073cdf0e10cSrcweir void PaneGroup::AddPane (const PresenterPaneContainer::SharedPaneDescriptor& rpPane)
1074cdf0e10cSrcweir {
1075cdf0e10cSrcweir     OSL_ASSERT(rpPane.get() != NULL);
1076cdf0e10cSrcweir 
1077cdf0e10cSrcweir     if (rpPane->mxBorderWindow.is())
1078cdf0e10cSrcweir     {
1079cdf0e10cSrcweir         PaneDescriptor aDescriptor (rpPane);
1080cdf0e10cSrcweir         maPanes.push_back(aDescriptor);
1081cdf0e10cSrcweir         maOriginalBoundingBox = PresenterGeometryHelper::Union(
1082cdf0e10cSrcweir             maOriginalBoundingBox,
1083cdf0e10cSrcweir             rpPane->mxBorderWindow->getPosSize());
1084cdf0e10cSrcweir     }
1085cdf0e10cSrcweir }
1086cdf0e10cSrcweir 
1087cdf0e10cSrcweir 
1088cdf0e10cSrcweir 
1089cdf0e10cSrcweir 
CreateSubstitution(const Reference<rendering::XSpriteCanvas> & rxCanvas)1090cdf0e10cSrcweir void PaneGroup::CreateSubstitution (const Reference<rendering::XSpriteCanvas>& rxCanvas)
1091cdf0e10cSrcweir {
1092cdf0e10cSrcweir     // Get the bitmap of the background.
1093cdf0e10cSrcweir     Reference<rendering::XBitmap> xBackgroundBitmap (rxCanvas, UNO_QUERY);
1094cdf0e10cSrcweir     if ( ! xBackgroundBitmap.is())
1095cdf0e10cSrcweir         return;
1096cdf0e10cSrcweir 
1097cdf0e10cSrcweir     // Create the sprite.
1098cdf0e10cSrcweir     mpSubstitution->SetFactory(rxCanvas);
1099cdf0e10cSrcweir     mpSubstitution->Resize(
1100cdf0e10cSrcweir         geometry::RealSize2D(maOriginalBoundingBox.Width, maOriginalBoundingBox.Height));
1101cdf0e10cSrcweir 
1102cdf0e10cSrcweir     // Fill it with the background inside the bounding box.
1103cdf0e10cSrcweir     const rendering::ViewState aViewState (
1104cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
1105cdf0e10cSrcweir         NULL);
1106cdf0e10cSrcweir     const rendering::RenderState aRenderState (
1107cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,-maOriginalBoundingBox.X, 0,1,-maOriginalBoundingBox.Y),
1108cdf0e10cSrcweir         NULL,
1109cdf0e10cSrcweir         Sequence<double>(4),
1110cdf0e10cSrcweir         rendering::CompositeOperation::SOURCE);
1111cdf0e10cSrcweir 
1112cdf0e10cSrcweir     Reference<rendering::XCanvas> xSpriteCanvas (mpSubstitution->GetCanvas());
1113cdf0e10cSrcweir     if (xSpriteCanvas.is())
1114cdf0e10cSrcweir         xSpriteCanvas->drawBitmap(xBackgroundBitmap, aViewState, aRenderState);
1115cdf0e10cSrcweir }
1116cdf0e10cSrcweir 
1117cdf0e10cSrcweir 
1118cdf0e10cSrcweir 
1119cdf0e10cSrcweir 
Restore(void)1120cdf0e10cSrcweir void PaneGroup::Restore (void)
1121cdf0e10cSrcweir {
1122cdf0e10cSrcweir     vector<PaneDescriptor>::iterator iPane;
1123cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane)
1124cdf0e10cSrcweir     {
1125cdf0e10cSrcweir         iPane->Restore();
1126cdf0e10cSrcweir     }
1127cdf0e10cSrcweir }
1128cdf0e10cSrcweir 
1129cdf0e10cSrcweir 
1130cdf0e10cSrcweir 
1131cdf0e10cSrcweir 
GetSubstitution(void)1132cdf0e10cSrcweir ::boost::shared_ptr<PresenterSprite> PaneGroup::GetSubstitution (void)
1133cdf0e10cSrcweir {
1134cdf0e10cSrcweir     return mpSubstitution;
1135cdf0e10cSrcweir }
1136cdf0e10cSrcweir 
1137cdf0e10cSrcweir 
1138cdf0e10cSrcweir 
1139cdf0e10cSrcweir 
GetOriginalBoundingBox(void) const1140cdf0e10cSrcweir geometry::RealRectangle2D PaneGroup::GetOriginalBoundingBox (void) const
1141cdf0e10cSrcweir {
1142cdf0e10cSrcweir     return geometry::RealRectangle2D(
1143cdf0e10cSrcweir         maOriginalBoundingBox.X,
1144cdf0e10cSrcweir         maOriginalBoundingBox.Y,
1145cdf0e10cSrcweir         maOriginalBoundingBox.X + maOriginalBoundingBox.Width,
1146cdf0e10cSrcweir         maOriginalBoundingBox.Y + maOriginalBoundingBox.Height);
1147cdf0e10cSrcweir }
1148cdf0e10cSrcweir 
1149cdf0e10cSrcweir 
1150cdf0e10cSrcweir 
1151cdf0e10cSrcweir 
GetCurrentBoundingBox(void) const1152cdf0e10cSrcweir geometry::RealRectangle2D PaneGroup::GetCurrentBoundingBox (void) const
1153cdf0e10cSrcweir {
1154cdf0e10cSrcweir     return maCurrentBoundingBox;
1155cdf0e10cSrcweir }
1156cdf0e10cSrcweir 
1157cdf0e10cSrcweir 
1158cdf0e10cSrcweir 
1159cdf0e10cSrcweir 
MovePanes(const double nXOffset,const double nYOffset,const::rtl::Reference<PresenterWindowManager> & rpWindowManager)1160cdf0e10cSrcweir void PaneGroup::MovePanes (
1161cdf0e10cSrcweir     const double nXOffset,
1162cdf0e10cSrcweir     const double nYOffset,
1163cdf0e10cSrcweir     const ::rtl::Reference<PresenterWindowManager>& rpWindowManager
1164cdf0e10cSrcweir     )
1165cdf0e10cSrcweir {
1166cdf0e10cSrcweir     awt::Rectangle aBBox;
1167cdf0e10cSrcweir     vector<PaneDescriptor>::iterator iPane;
1168cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane)
1169cdf0e10cSrcweir     {
1170cdf0e10cSrcweir         awt::Rectangle aBox (iPane->mpPaneDescriptor->mxBorderWindow->getPosSize());
1171cdf0e10cSrcweir         aBox.X += sal_Int32(nXOffset);
1172cdf0e10cSrcweir         aBox.Y += sal_Int32(nYOffset);
1173cdf0e10cSrcweir         rpWindowManager->SetPanePosSizeAbsolute(
1174cdf0e10cSrcweir             iPane->mpPaneDescriptor->mxPaneId->getResourceURL(),
1175cdf0e10cSrcweir             aBox.X,
1176cdf0e10cSrcweir             aBox.Y,
1177cdf0e10cSrcweir             aBox.Width,
1178cdf0e10cSrcweir             aBox.Height);
1179cdf0e10cSrcweir         aBBox = PresenterGeometryHelper::Union(aBBox, aBox);
1180cdf0e10cSrcweir     }
1181cdf0e10cSrcweir     maCurrentBoundingBox = geometry::RealRectangle2D(
1182cdf0e10cSrcweir         aBBox.X, aBBox.Y, aBBox.X+aBBox.Width, aBBox.Y+aBBox.Height);
1183cdf0e10cSrcweir }
1184cdf0e10cSrcweir 
1185cdf0e10cSrcweir 
1186cdf0e10cSrcweir 
1187cdf0e10cSrcweir 
ActivatePanes(void)1188cdf0e10cSrcweir void PaneGroup::ActivatePanes (void)
1189cdf0e10cSrcweir {
1190cdf0e10cSrcweir     vector<PaneDescriptor>::iterator iPane;
1191cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane)
1192cdf0e10cSrcweir     {
1193cdf0e10cSrcweir         iPane->mpPaneDescriptor->SetActivationState(true);
1194cdf0e10cSrcweir     }
1195cdf0e10cSrcweir }
1196cdf0e10cSrcweir 
1197cdf0e10cSrcweir 
1198cdf0e10cSrcweir 
1199cdf0e10cSrcweir 
DeactivatePanes(void)1200cdf0e10cSrcweir void PaneGroup::DeactivatePanes (void)
1201cdf0e10cSrcweir {
1202cdf0e10cSrcweir     vector<PaneDescriptor>::iterator iPane;
1203cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane)
1204cdf0e10cSrcweir     {
1205cdf0e10cSrcweir         iPane->mpPaneDescriptor->SetActivationState(false);
1206cdf0e10cSrcweir     }
1207cdf0e10cSrcweir }
1208cdf0e10cSrcweir 
1209cdf0e10cSrcweir 
1210cdf0e10cSrcweir 
1211cdf0e10cSrcweir 
ShowPanes(void)1212cdf0e10cSrcweir void PaneGroup::ShowPanes (void)
1213cdf0e10cSrcweir {
1214cdf0e10cSrcweir     vector<PaneDescriptor>::iterator iPane;
1215cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane)
1216cdf0e10cSrcweir     {
1217cdf0e10cSrcweir         iPane->mpPaneDescriptor->mxBorderWindow->setVisible(sal_True);
1218cdf0e10cSrcweir         iPane->mpPaneDescriptor->mxContentWindow->setVisible(sal_True);
1219cdf0e10cSrcweir     }
1220cdf0e10cSrcweir }
1221cdf0e10cSrcweir 
1222cdf0e10cSrcweir 
1223cdf0e10cSrcweir 
1224cdf0e10cSrcweir 
HidePanes(void)1225cdf0e10cSrcweir void PaneGroup::HidePanes (void)
1226cdf0e10cSrcweir {
1227cdf0e10cSrcweir     vector<PaneDescriptor>::iterator iPane;
1228cdf0e10cSrcweir     for (iPane=maPanes.begin(); iPane!=maPanes.end(); ++iPane)
1229cdf0e10cSrcweir     {
1230cdf0e10cSrcweir         iPane->mpPaneDescriptor->mxBorderWindow->setVisible(sal_False);
1231cdf0e10cSrcweir         iPane->mpPaneDescriptor->mxContentWindow->setVisible(sal_False);
1232cdf0e10cSrcweir     }
1233cdf0e10cSrcweir }
1234cdf0e10cSrcweir 
1235cdf0e10cSrcweir 
1236cdf0e10cSrcweir 
1237cdf0e10cSrcweir 
1238cdf0e10cSrcweir //===== PaneDescriptor ========================================================
1239cdf0e10cSrcweir 
PaneDescriptor(const PresenterPaneContainer::SharedPaneDescriptor & rpDescriptor)1240cdf0e10cSrcweir PaneDescriptor::PaneDescriptor (const PresenterPaneContainer::SharedPaneDescriptor& rpDescriptor)
1241cdf0e10cSrcweir     : mpPaneDescriptor(rpDescriptor),
1242cdf0e10cSrcweir       mnLeft(rpDescriptor->mnLeft),
1243cdf0e10cSrcweir       mnTop(rpDescriptor->mnTop),
1244cdf0e10cSrcweir       mnRight(rpDescriptor->mnRight),
1245cdf0e10cSrcweir       mnBottom(rpDescriptor->mnBottom)
1246cdf0e10cSrcweir {
1247cdf0e10cSrcweir }
1248cdf0e10cSrcweir 
1249cdf0e10cSrcweir 
1250cdf0e10cSrcweir 
1251cdf0e10cSrcweir 
Restore(void) const1252cdf0e10cSrcweir void PaneDescriptor::Restore (void) const
1253cdf0e10cSrcweir {
1254cdf0e10cSrcweir     mpPaneDescriptor->mnLeft = mnLeft;
1255cdf0e10cSrcweir     mpPaneDescriptor->mnTop = mnTop;
1256cdf0e10cSrcweir     mpPaneDescriptor->mnRight = mnRight;
1257cdf0e10cSrcweir     mpPaneDescriptor->mnBottom = mnBottom;
1258cdf0e10cSrcweir }
1259cdf0e10cSrcweir 
1260cdf0e10cSrcweir 
1261cdf0e10cSrcweir 
1262cdf0e10cSrcweir 
1263cdf0e10cSrcweir //===== MultiAnimation ========================================================
1264cdf0e10cSrcweir 
MultiAnimation(const sal_uInt32 nDuration)1265cdf0e10cSrcweir MultiAnimation::MultiAnimation (const sal_uInt32 nDuration)
1266cdf0e10cSrcweir     : PresenterAnimation(0, nDuration, 1000/50),
1267cdf0e10cSrcweir       maAnimations()
1268cdf0e10cSrcweir {
1269cdf0e10cSrcweir }
1270cdf0e10cSrcweir 
1271cdf0e10cSrcweir 
1272cdf0e10cSrcweir 
1273cdf0e10cSrcweir 
AddAnimation(const Animation & rAnimation)1274cdf0e10cSrcweir void MultiAnimation::AddAnimation (const Animation& rAnimation)
1275cdf0e10cSrcweir {
1276cdf0e10cSrcweir     maAnimations.push_back(rAnimation);
1277cdf0e10cSrcweir }
1278cdf0e10cSrcweir 
1279cdf0e10cSrcweir 
1280cdf0e10cSrcweir 
1281cdf0e10cSrcweir 
Run(const double nProgress,const sal_uInt64 nCurrentTime)1282cdf0e10cSrcweir void MultiAnimation::Run (const double nProgress, const sal_uInt64 nCurrentTime)
1283cdf0e10cSrcweir {
1284cdf0e10cSrcweir     (void)nCurrentTime;
1285cdf0e10cSrcweir     vector<Animation>::const_iterator iAnimation (maAnimations.begin());
1286cdf0e10cSrcweir     vector<Animation>::const_iterator iEnd (maAnimations.end());
1287cdf0e10cSrcweir     for ( ; iAnimation!=iEnd; ++iAnimation)
1288cdf0e10cSrcweir         (*iAnimation)(nProgress);
1289cdf0e10cSrcweir }
1290cdf0e10cSrcweir 
1291cdf0e10cSrcweir 
1292cdf0e10cSrcweir 
1293cdf0e10cSrcweir 
1294cdf0e10cSrcweir //===== functors ==============================================================
1295cdf0e10cSrcweir 
InterpolatePosition(const::boost::function<void (geometry::RealPoint2D)> & rSetter,double nP,const geometry::RealPoint2D rInitialBox,const geometry::RealPoint2D rFinalBox)1296cdf0e10cSrcweir void InterpolatePosition (
1297cdf0e10cSrcweir     const ::boost::function<void(geometry::RealPoint2D)>& rSetter,
1298cdf0e10cSrcweir     double nP,
1299cdf0e10cSrcweir     const geometry::RealPoint2D rInitialBox,
1300cdf0e10cSrcweir     const geometry::RealPoint2D rFinalBox)
1301cdf0e10cSrcweir {
1302cdf0e10cSrcweir     const double nQ (1 - nP);
1303cdf0e10cSrcweir 
1304cdf0e10cSrcweir     OSL_TRACE("InterpolatePosition %f\n", nP);
1305cdf0e10cSrcweir     rSetter(
1306cdf0e10cSrcweir         geometry::RealPoint2D(
1307cdf0e10cSrcweir             nQ * rInitialBox.X + nP * rFinalBox.X,
1308cdf0e10cSrcweir             nQ * rInitialBox.Y + nP * rFinalBox.Y));
1309cdf0e10cSrcweir }
1310cdf0e10cSrcweir 
1311cdf0e10cSrcweir 
1312cdf0e10cSrcweir 
1313cdf0e10cSrcweir 
1314cdf0e10cSrcweir template<typename T>
InterpolateValue(const::boost::function<void (T)> & rSetter,double nP,const T aInitialValue,const T aFinalValue)1315cdf0e10cSrcweir     void InterpolateValue (
1316cdf0e10cSrcweir         const ::boost::function<void(T)>& rSetter,
1317cdf0e10cSrcweir         double nP,
1318cdf0e10cSrcweir         const T aInitialValue,
1319cdf0e10cSrcweir         const T aFinalValue)
1320cdf0e10cSrcweir {
1321cdf0e10cSrcweir     const double nQ (1 - nP);
1322cdf0e10cSrcweir 
1323cdf0e10cSrcweir     rSetter(T(nQ * aInitialValue + nP * aFinalValue));
1324cdf0e10cSrcweir }
1325cdf0e10cSrcweir 
1326cdf0e10cSrcweir 
1327cdf0e10cSrcweir 
1328cdf0e10cSrcweir 
SpriteTransform(const rtl::Reference<PresenterPaneContainer> & rpPaneContainer,const Reference<XResourceId> & rxPaneId,const Reference<awt::XWindow> & rxSpriteOwnerWindow,const::boost::shared_ptr<PresenterPaintManager> & rpPaintManager,const bool bAppear,const double nX,const double nInitialTop,const double nFinalTop,const double nP)1329cdf0e10cSrcweir void SpriteTransform(
1330cdf0e10cSrcweir     const rtl::Reference<PresenterPaneContainer>& rpPaneContainer,
1331cdf0e10cSrcweir     const Reference<XResourceId>& rxPaneId,
1332cdf0e10cSrcweir     const Reference<awt::XWindow>& rxSpriteOwnerWindow,
1333cdf0e10cSrcweir     const ::boost::shared_ptr<PresenterPaintManager>& rpPaintManager,
1334cdf0e10cSrcweir     const bool bAppear,
1335cdf0e10cSrcweir     const double nX,
1336cdf0e10cSrcweir     const double nInitialTop,
1337cdf0e10cSrcweir     const double nFinalTop,
1338cdf0e10cSrcweir     const double nP)
1339cdf0e10cSrcweir {
1340cdf0e10cSrcweir     OSL_ASSERT(rpPaintManager.get()!=NULL);
1341cdf0e10cSrcweir 
1342cdf0e10cSrcweir     PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
1343cdf0e10cSrcweir         rpPaneContainer->FindPaneId(rxPaneId));
1344cdf0e10cSrcweir     if (pDescriptor.get() != NULL
1345cdf0e10cSrcweir         && ! pDescriptor->maSpriteProvider.empty()
1346cdf0e10cSrcweir         && pDescriptor->mxBorderWindow.is())
1347cdf0e10cSrcweir     {
1348cdf0e10cSrcweir         ::boost::shared_ptr<PresenterSprite> pSprite (pDescriptor->maSpriteProvider());
1349cdf0e10cSrcweir         if (pSprite.get())
1350cdf0e10cSrcweir         {
1351cdf0e10cSrcweir             // There seems to be a problem with sprites not correctly
1352cdf0e10cSrcweir             // invalidating the background when being transformed.  As a
1353cdf0e10cSrcweir             // workaround invalidate the background in the bounding box of
1354cdf0e10cSrcweir             // the sprite before the transformation.
1355cdf0e10cSrcweir             rpPaintManager->Invalidate(
1356cdf0e10cSrcweir                 rxSpriteOwnerWindow,
1357cdf0e10cSrcweir                 awt::Rectangle(
1358cdf0e10cSrcweir                     sal::static_int_cast<sal_Int32>(pSprite->GetLocation().X),
1359cdf0e10cSrcweir                     sal::static_int_cast<sal_Int32>(pSprite->GetLocation().Y),
1360cdf0e10cSrcweir                     sal::static_int_cast<sal_Int32>(pSprite->GetSize().Width),
1361cdf0e10cSrcweir                     sal::static_int_cast<sal_Int32>(pSprite->GetSize().Height)));
1362cdf0e10cSrcweir 
1363cdf0e10cSrcweir             const double nYScale (bAppear ? nP : 1-nP);
1364cdf0e10cSrcweir             pSprite->Transform(geometry::AffineMatrix2D(
1365cdf0e10cSrcweir                 1, 0, 0,
1366cdf0e10cSrcweir                 0, nYScale, 0));
1367cdf0e10cSrcweir             pSprite->MoveTo(
1368cdf0e10cSrcweir                 geometry::RealPoint2D(nX, nYScale*nFinalTop + (1-nYScale)*nInitialTop));
1369cdf0e10cSrcweir             pSprite->Show();
1370cdf0e10cSrcweir 
1371cdf0e10cSrcweir             pDescriptor->mxBorderWindow->setVisible(sal_True);
1372cdf0e10cSrcweir         }
1373cdf0e10cSrcweir     }
1374cdf0e10cSrcweir }
1375cdf0e10cSrcweir 
1376cdf0e10cSrcweir 
1377cdf0e10cSrcweir 
1378cdf0e10cSrcweir 
SpritePaneMove(const rtl::Reference<PresenterPaneContainer> & rpPaneContainer,const Reference<XResourceId> & rxPaneId,const geometry::RealPoint2D & rLocation)1379cdf0e10cSrcweir void SpritePaneMove (
1380cdf0e10cSrcweir     const rtl::Reference<PresenterPaneContainer>& rpPaneContainer,
1381cdf0e10cSrcweir     const Reference<XResourceId>& rxPaneId,
1382cdf0e10cSrcweir     const geometry::RealPoint2D& rLocation)
1383cdf0e10cSrcweir {
1384cdf0e10cSrcweir     PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
1385cdf0e10cSrcweir         rpPaneContainer->FindPaneId(rxPaneId));
1386cdf0e10cSrcweir     if (pDescriptor.get() != NULL
1387cdf0e10cSrcweir         && ! pDescriptor->maSpriteProvider.empty()
1388cdf0e10cSrcweir         && pDescriptor->mxBorderWindow.is())
1389cdf0e10cSrcweir     {
1390cdf0e10cSrcweir         ::boost::shared_ptr<PresenterSprite> pSprite (pDescriptor->maSpriteProvider());
1391cdf0e10cSrcweir         if (pSprite.get() != NULL)
1392cdf0e10cSrcweir         {
1393cdf0e10cSrcweir             pDescriptor->mxBorderWindow->setVisible(sal_True);
1394cdf0e10cSrcweir             pSprite->MoveTo(rLocation);
1395cdf0e10cSrcweir         }
1396cdf0e10cSrcweir     }
1397cdf0e10cSrcweir }
1398cdf0e10cSrcweir 
1399cdf0e10cSrcweir 
1400cdf0e10cSrcweir 
1401cdf0e10cSrcweir 
GetLocation(const geometry::RealRectangle2D & rBox)1402cdf0e10cSrcweir geometry::RealPoint2D GetLocation (const geometry::RealRectangle2D& rBox)
1403cdf0e10cSrcweir {
1404cdf0e10cSrcweir     return geometry::RealPoint2D(rBox.X1, rBox.Y1);
1405cdf0e10cSrcweir }
1406cdf0e10cSrcweir 
1407cdf0e10cSrcweir 
1408cdf0e10cSrcweir 
1409cdf0e10cSrcweir 
GetSize(const geometry::RealRectangle2D & rBox)1410cdf0e10cSrcweir geometry::RealSize2D GetSize (const geometry::RealRectangle2D& rBox)
1411cdf0e10cSrcweir {
1412cdf0e10cSrcweir     return geometry::RealSize2D(rBox.X2-rBox.X1, rBox.Y2-rBox.Y1);
1413cdf0e10cSrcweir }
1414cdf0e10cSrcweir 
1415cdf0e10cSrcweir } // end of anonymous namespace
1416cdf0e10cSrcweir 
1417cdf0e10cSrcweir 
1418cdf0e10cSrcweir 
1419cdf0e10cSrcweir 
1420cdf0e10cSrcweir } } // end of namespace ::sdext::presenter
1421