xref: /AOO41X/main/sdext/source/presenter/PresenterSlideShowView.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sdext.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "PresenterSlideShowView.hxx"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "PresenterCanvasHelper.hxx"
34*cdf0e10cSrcweir #include "PresenterGeometryHelper.hxx"
35*cdf0e10cSrcweir #include "PresenterHelper.hxx"
36*cdf0e10cSrcweir #include "PresenterPaneContainer.hxx"
37*cdf0e10cSrcweir #include <com/sun/star/awt/InvalidateStyle.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/awt/PosSize.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/awt/WindowAttribute.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/awt/XWindow2.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/awt/XWindowPeer.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/drawing/CanvasFeature.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/drawing/XPresenterHelper.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XControllerManager.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/rendering/CompositeOperation.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/rendering/TextDirection.hpp>
50*cdf0e10cSrcweir #include <com/sun/star/rendering/TexturingMode.hpp>
51*cdf0e10cSrcweir #include <osl/mutex.hxx>
52*cdf0e10cSrcweir 
53*cdf0e10cSrcweir using namespace ::com::sun::star;
54*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
55*cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework;
56*cdf0e10cSrcweir using ::rtl::OUString;
57*cdf0e10cSrcweir 
58*cdf0e10cSrcweir #define A2S(pString) (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(pString)))
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir namespace sdext { namespace presenter {
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir //===== PresenterSlideShowView ================================================
63*cdf0e10cSrcweir 
64*cdf0e10cSrcweir PresenterSlideShowView::PresenterSlideShowView (
65*cdf0e10cSrcweir     const css::uno::Reference<css::uno::XComponentContext>& rxContext,
66*cdf0e10cSrcweir     const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
67*cdf0e10cSrcweir     const css::uno::Reference<css::frame::XController>& rxController,
68*cdf0e10cSrcweir     const ::rtl::Reference<PresenterController>& rpPresenterController)
69*cdf0e10cSrcweir     : PresenterSlideShowViewInterfaceBase(m_aMutex),
70*cdf0e10cSrcweir       mxComponentContext(rxContext),
71*cdf0e10cSrcweir       mpPresenterController(rpPresenterController),
72*cdf0e10cSrcweir       mxViewId(rxViewId),
73*cdf0e10cSrcweir       mxController(rxController),
74*cdf0e10cSrcweir       mxSlideShowController(PresenterHelper::GetSlideShowController(rxController)),
75*cdf0e10cSrcweir       mxSlideShow(),
76*cdf0e10cSrcweir       mxCanvas(),
77*cdf0e10cSrcweir       mxViewCanvas(),
78*cdf0e10cSrcweir       mxPointer(),
79*cdf0e10cSrcweir       mxWindow(),
80*cdf0e10cSrcweir       mxViewWindow(),
81*cdf0e10cSrcweir       mxTopPane(),
82*cdf0e10cSrcweir       mxPresenterHelper(),
83*cdf0e10cSrcweir       mxBackgroundPolygon1(),
84*cdf0e10cSrcweir       mxBackgroundPolygon2(),
85*cdf0e10cSrcweir       mbIsViewAdded(false),
86*cdf0e10cSrcweir       mnPageAspectRatio(28.0/21.0),
87*cdf0e10cSrcweir       maBroadcaster(m_aMutex),
88*cdf0e10cSrcweir       mpBackground(),
89*cdf0e10cSrcweir       mbIsInModifyNotification(false),
90*cdf0e10cSrcweir       mbIsForcedPaintPending(false),
91*cdf0e10cSrcweir       mbIsPaintPending(true),
92*cdf0e10cSrcweir       msClickToExitPresentationText(),
93*cdf0e10cSrcweir       msClickToExitPresentationTitle(),
94*cdf0e10cSrcweir       msTitleTemplate(),
95*cdf0e10cSrcweir       mbIsEndSlideVisible(false),
96*cdf0e10cSrcweir       mxCurrentSlide()
97*cdf0e10cSrcweir {
98*cdf0e10cSrcweir     if (mpPresenterController.get() != NULL)
99*cdf0e10cSrcweir     {
100*cdf0e10cSrcweir         mnPageAspectRatio = mpPresenterController->GetSlideAspectRatio();
101*cdf0e10cSrcweir         mpBackground = mpPresenterController->GetViewBackground(mxViewId->getResourceURL());
102*cdf0e10cSrcweir     }
103*cdf0e10cSrcweir }
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir void PresenterSlideShowView::LateInit (void)
108*cdf0e10cSrcweir {
109*cdf0e10cSrcweir     mxSlideShow = Reference<presentation::XSlideShow> (
110*cdf0e10cSrcweir         mxSlideShowController->getSlideShow(), UNO_QUERY_THROW);
111*cdf0e10cSrcweir     Reference<lang::XComponent> xSlideShowComponent (mxSlideShow, UNO_QUERY);
112*cdf0e10cSrcweir     if (xSlideShowComponent.is())
113*cdf0e10cSrcweir         xSlideShowComponent->addEventListener(static_cast<awt::XWindowListener*>(this));
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     Reference<lang::XMultiComponentFactory> xFactory (
116*cdf0e10cSrcweir         mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
117*cdf0e10cSrcweir     mxPresenterHelper.set (xFactory->createInstanceWithContext(
118*cdf0e10cSrcweir 			       OUString::createFromAscii("com.sun.star.comp.Draw.PresenterHelper"),
119*cdf0e10cSrcweir 			       mxComponentContext),
120*cdf0e10cSrcweir 			   UNO_QUERY_THROW);
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir     // Use view id and controller to retrieve window and canvas from
123*cdf0e10cSrcweir     // configuration controller.
124*cdf0e10cSrcweir     Reference<XControllerManager> xCM (mxController, UNO_QUERY_THROW);
125*cdf0e10cSrcweir     Reference<XConfigurationController> xCC (xCM->getConfigurationController());
126*cdf0e10cSrcweir 
127*cdf0e10cSrcweir     if (xCC.is())
128*cdf0e10cSrcweir     {
129*cdf0e10cSrcweir 	mxTopPane.set(xCC->getResource(mxViewId->getAnchor()->getAnchor()), UNO_QUERY);
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir         Reference<XPane> xPane (xCC->getResource(mxViewId->getAnchor()), UNO_QUERY_THROW);
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir         mxWindow = xPane->getWindow();
134*cdf0e10cSrcweir         mxCanvas = xPane->getCanvas();
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir         if (mxWindow.is())
137*cdf0e10cSrcweir         {
138*cdf0e10cSrcweir             mxWindow->addPaintListener(this);
139*cdf0e10cSrcweir             mxWindow->addWindowListener(this);
140*cdf0e10cSrcweir         }
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir         // The window does not have to paint a background.  We do
143*cdf0e10cSrcweir         // that ourself.
144*cdf0e10cSrcweir         Reference<awt::XWindowPeer> xPeer (mxWindow, UNO_QUERY);
145*cdf0e10cSrcweir         if (xPeer.is())
146*cdf0e10cSrcweir             xPeer->setBackground(util::Color(0xff000000));
147*cdf0e10cSrcweir     }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir     // Create a window for the actual slide show view.  It is places
150*cdf0e10cSrcweir     // centered and with maximal size inside the pane.
151*cdf0e10cSrcweir     mxViewWindow = CreateViewWindow(mxWindow);
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir     mxViewCanvas = CreateViewCanvas(mxViewWindow);
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir     if (mxViewWindow.is())
156*cdf0e10cSrcweir     {
157*cdf0e10cSrcweir         // Register listeners at window.
158*cdf0e10cSrcweir         mxViewWindow->addPaintListener(this);
159*cdf0e10cSrcweir         mxViewWindow->addMouseListener(this);
160*cdf0e10cSrcweir         mxViewWindow->addMouseMotionListener(this);
161*cdf0e10cSrcweir     }
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir     if (mxViewWindow.is())
164*cdf0e10cSrcweir         Resize();
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir     if (mxWindow.is())
167*cdf0e10cSrcweir         mxWindow->setVisible(sal_True);
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir     // Add the new slide show view to the slide show.
170*cdf0e10cSrcweir     if (mxSlideShow.is() && ! mbIsViewAdded)
171*cdf0e10cSrcweir     {
172*cdf0e10cSrcweir         Reference<presentation::XSlideShowView> xView (this);
173*cdf0e10cSrcweir         mxSlideShow->addView(xView);
174*cdf0e10cSrcweir         // Prevent embeded sounds being played twice at the same time by
175*cdf0e10cSrcweir         // disabling sound for the new slide show view.
176*cdf0e10cSrcweir         beans::PropertyValue aProperty;
177*cdf0e10cSrcweir         aProperty.Name = A2S("IsSoundEnabled");
178*cdf0e10cSrcweir         Sequence<Any> aValues (2);
179*cdf0e10cSrcweir         aValues[0] <<= xView;
180*cdf0e10cSrcweir         aValues[1] <<= sal_False;
181*cdf0e10cSrcweir         aProperty.Value <<= aValues;
182*cdf0e10cSrcweir         mxSlideShow->setProperty(aProperty);
183*cdf0e10cSrcweir         mbIsViewAdded = true;
184*cdf0e10cSrcweir     }
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     // Read text for one past last slide.
187*cdf0e10cSrcweir     PresenterConfigurationAccess aConfiguration (
188*cdf0e10cSrcweir         mxComponentContext,
189*cdf0e10cSrcweir         PresenterConfigurationAccess::msPresenterScreenRootName,
190*cdf0e10cSrcweir         PresenterConfigurationAccess::READ_ONLY);
191*cdf0e10cSrcweir     aConfiguration.GetConfigurationNode(
192*cdf0e10cSrcweir         A2S("Presenter/Views/CurrentSlidePreview/"
193*cdf0e10cSrcweir             "Strings/ClickToExitPresentationText/String"))
194*cdf0e10cSrcweir         >>= msClickToExitPresentationText;
195*cdf0e10cSrcweir     aConfiguration.GetConfigurationNode(
196*cdf0e10cSrcweir         A2S("Presenter/Views/CurrentSlidePreview/"
197*cdf0e10cSrcweir             "Strings/ClickToExitPresentationTitle/String"))
198*cdf0e10cSrcweir         >>= msClickToExitPresentationTitle;
199*cdf0e10cSrcweir }
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir PresenterSlideShowView::~PresenterSlideShowView (void)
205*cdf0e10cSrcweir {
206*cdf0e10cSrcweir }
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir void PresenterSlideShowView::disposing (void)
212*cdf0e10cSrcweir {
213*cdf0e10cSrcweir     // Tell all listeners that we are disposed.
214*cdf0e10cSrcweir     lang::EventObject aEvent;
215*cdf0e10cSrcweir     aEvent.Source = static_cast<XWeak*>(this);
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper* pIterator
218*cdf0e10cSrcweir           = maBroadcaster.getContainer(getCppuType((Reference<lang::XEventListener>*)NULL));
219*cdf0e10cSrcweir     if (pIterator != NULL)
220*cdf0e10cSrcweir         pIterator->disposeAndClear(aEvent);
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir     // Do this for
223*cdf0e10cSrcweir     // XPaintListener, XModifyListener,XMouseListener,XMouseMotionListener,XWindowListener?
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir     if (mxWindow.is())
226*cdf0e10cSrcweir     {
227*cdf0e10cSrcweir         mxWindow->removePaintListener(this);
228*cdf0e10cSrcweir         mxWindow->removeMouseListener(this);
229*cdf0e10cSrcweir         mxWindow->removeMouseMotionListener(this);
230*cdf0e10cSrcweir         mxWindow->removeWindowListener(this);
231*cdf0e10cSrcweir         mxWindow = NULL;
232*cdf0e10cSrcweir     }
233*cdf0e10cSrcweir     mxSlideShowController = NULL;
234*cdf0e10cSrcweir     mxSlideShow = NULL;
235*cdf0e10cSrcweir     if (mxViewCanvas.is())
236*cdf0e10cSrcweir     {
237*cdf0e10cSrcweir         Reference<XComponent> xComponent (mxViewCanvas, UNO_QUERY);
238*cdf0e10cSrcweir         mxViewCanvas = NULL;
239*cdf0e10cSrcweir         if (xComponent.is())
240*cdf0e10cSrcweir             xComponent->dispose();
241*cdf0e10cSrcweir     }
242*cdf0e10cSrcweir     if (mxViewWindow.is())
243*cdf0e10cSrcweir     {
244*cdf0e10cSrcweir         Reference<XComponent> xComponent (mxViewWindow, UNO_QUERY);
245*cdf0e10cSrcweir         mxViewWindow = NULL;
246*cdf0e10cSrcweir         if (xComponent.is())
247*cdf0e10cSrcweir             xComponent->dispose();
248*cdf0e10cSrcweir     }
249*cdf0e10cSrcweir     if (mxPointer.is())
250*cdf0e10cSrcweir     {
251*cdf0e10cSrcweir         Reference<XComponent> xComponent (mxPointer, UNO_QUERY);
252*cdf0e10cSrcweir         mxPointer = NULL;
253*cdf0e10cSrcweir         if (xComponent.is())
254*cdf0e10cSrcweir             xComponent->dispose();
255*cdf0e10cSrcweir     }
256*cdf0e10cSrcweir     if (mxBackgroundPolygon1.is())
257*cdf0e10cSrcweir     {
258*cdf0e10cSrcweir         Reference<XComponent> xComponent (mxBackgroundPolygon1, UNO_QUERY);
259*cdf0e10cSrcweir         mxBackgroundPolygon1 = NULL;
260*cdf0e10cSrcweir         if (xComponent.is())
261*cdf0e10cSrcweir             xComponent->dispose();
262*cdf0e10cSrcweir     }
263*cdf0e10cSrcweir     if (mxBackgroundPolygon2.is())
264*cdf0e10cSrcweir     {
265*cdf0e10cSrcweir         Reference<XComponent> xComponent (mxBackgroundPolygon2, UNO_QUERY);
266*cdf0e10cSrcweir         mxBackgroundPolygon2 = NULL;
267*cdf0e10cSrcweir         if (xComponent.is())
268*cdf0e10cSrcweir             xComponent->dispose();
269*cdf0e10cSrcweir     }
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir     mxComponentContext = NULL;
272*cdf0e10cSrcweir     mpPresenterController = NULL;
273*cdf0e10cSrcweir     mxViewId = NULL;
274*cdf0e10cSrcweir     mxController = NULL;
275*cdf0e10cSrcweir     mxCanvas = NULL;
276*cdf0e10cSrcweir     mpBackground.reset();
277*cdf0e10cSrcweir     msClickToExitPresentationText = OUString();
278*cdf0e10cSrcweir     msClickToExitPresentationTitle = OUString();
279*cdf0e10cSrcweir     msTitleTemplate = OUString();
280*cdf0e10cSrcweir     mxCurrentSlide = NULL;
281*cdf0e10cSrcweir }
282*cdf0e10cSrcweir 
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir //----- XDrawView -------------------------------------------------------------
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::setCurrentPage (
289*cdf0e10cSrcweir     const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
290*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
291*cdf0e10cSrcweir {
292*cdf0e10cSrcweir     mxCurrentSlide = rxSlide;
293*cdf0e10cSrcweir     if (mpPresenterController.get() != NULL
294*cdf0e10cSrcweir         && mxSlideShowController.is()
295*cdf0e10cSrcweir         && ! mpPresenterController->GetCurrentSlide().is()
296*cdf0e10cSrcweir         && ! mxSlideShowController->isPaused())
297*cdf0e10cSrcweir     {
298*cdf0e10cSrcweir         mbIsEndSlideVisible = true;
299*cdf0e10cSrcweir         Reference<awt::XWindowPeer> xPeer (mxViewWindow, UNO_QUERY);
300*cdf0e10cSrcweir         if (xPeer.is())
301*cdf0e10cSrcweir             xPeer->invalidate(awt::InvalidateStyle::NOTRANSPARENT);
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir         // For the end slide we use a special title, without the (n of m)
304*cdf0e10cSrcweir         // part.  Save the title template for the case that the user goes
305*cdf0e10cSrcweir         // backwards.
306*cdf0e10cSrcweir         PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
307*cdf0e10cSrcweir             mpPresenterController->GetPaneContainer()->FindViewURL(mxViewId->getResourceURL()));
308*cdf0e10cSrcweir         if (pDescriptor.get() != NULL)
309*cdf0e10cSrcweir         {
310*cdf0e10cSrcweir             msTitleTemplate = pDescriptor->msTitleTemplate;
311*cdf0e10cSrcweir             pDescriptor->msTitleTemplate = msClickToExitPresentationTitle;
312*cdf0e10cSrcweir             mpPresenterController->UpdatePaneTitles();
313*cdf0e10cSrcweir         }
314*cdf0e10cSrcweir     }
315*cdf0e10cSrcweir     else if (mbIsEndSlideVisible)
316*cdf0e10cSrcweir     {
317*cdf0e10cSrcweir         mbIsEndSlideVisible = false;
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir         // Restore the title template.
320*cdf0e10cSrcweir         PresenterPaneContainer::SharedPaneDescriptor pDescriptor (
321*cdf0e10cSrcweir             mpPresenterController->GetPaneContainer()->FindViewURL(mxViewId->getResourceURL()));
322*cdf0e10cSrcweir         if (pDescriptor.get() != NULL)
323*cdf0e10cSrcweir         {
324*cdf0e10cSrcweir             pDescriptor->msTitleTemplate = msTitleTemplate;
325*cdf0e10cSrcweir             pDescriptor->msTitle = OUString();
326*cdf0e10cSrcweir             mpPresenterController->UpdatePaneTitles();
327*cdf0e10cSrcweir         }
328*cdf0e10cSrcweir     }
329*cdf0e10cSrcweir }
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir css::uno::Reference<css::drawing::XDrawPage> SAL_CALL PresenterSlideShowView::getCurrentPage (void)
335*cdf0e10cSrcweir     throw (css::uno::RuntimeException)
336*cdf0e10cSrcweir {
337*cdf0e10cSrcweir     return mxCurrentSlide;
338*cdf0e10cSrcweir }
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir 
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir //----- CachablePresenterView -------------------------------------------------
344*cdf0e10cSrcweir 
345*cdf0e10cSrcweir void PresenterSlideShowView::ReleaseView (void)
346*cdf0e10cSrcweir {
347*cdf0e10cSrcweir     if (mxSlideShow.is() && mbIsViewAdded)
348*cdf0e10cSrcweir     {
349*cdf0e10cSrcweir         mxSlideShow->removeView(this);
350*cdf0e10cSrcweir         mbIsViewAdded = false;
351*cdf0e10cSrcweir     }
352*cdf0e10cSrcweir }
353*cdf0e10cSrcweir 
354*cdf0e10cSrcweir 
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir 
357*cdf0e10cSrcweir //----- XSlideShowView --------------------------------------------------------
358*cdf0e10cSrcweir 
359*cdf0e10cSrcweir Reference<rendering::XSpriteCanvas> SAL_CALL PresenterSlideShowView::getCanvas (void)
360*cdf0e10cSrcweir     throw (RuntimeException)
361*cdf0e10cSrcweir {
362*cdf0e10cSrcweir     ThrowIfDisposed();
363*cdf0e10cSrcweir 
364*cdf0e10cSrcweir     return Reference<rendering::XSpriteCanvas>(mxViewCanvas, UNO_QUERY);
365*cdf0e10cSrcweir }
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::clear (void)
371*cdf0e10cSrcweir     throw (RuntimeException)
372*cdf0e10cSrcweir {
373*cdf0e10cSrcweir     ThrowIfDisposed();
374*cdf0e10cSrcweir     mbIsForcedPaintPending = false;
375*cdf0e10cSrcweir     mbIsPaintPending = false;
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir     if (mxViewCanvas.is() && mxViewWindow.is())
378*cdf0e10cSrcweir     {
379*cdf0e10cSrcweir         // Create a polygon for the window outline.
380*cdf0e10cSrcweir         awt::Rectangle aViewWindowBox (mxViewWindow->getPosSize());
381*cdf0e10cSrcweir         Reference<rendering::XPolyPolygon2D> xPolygon (PresenterGeometryHelper::CreatePolygon(
382*cdf0e10cSrcweir             awt::Rectangle(0,0, aViewWindowBox.Width,aViewWindowBox.Height),
383*cdf0e10cSrcweir             mxViewCanvas->getDevice()));
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir         rendering::ViewState aViewState (
386*cdf0e10cSrcweir             geometry::AffineMatrix2D(1,0,0, 0,1,0),
387*cdf0e10cSrcweir             NULL);
388*cdf0e10cSrcweir         double aColor[3] = {0,0,0};
389*cdf0e10cSrcweir         rendering::RenderState aRenderState(
390*cdf0e10cSrcweir             geometry::AffineMatrix2D(1,0,0, 0,1,0),
391*cdf0e10cSrcweir             NULL,
392*cdf0e10cSrcweir             Sequence<double>(aColor,4),
393*cdf0e10cSrcweir             rendering::CompositeOperation::SOURCE);
394*cdf0e10cSrcweir         mxViewCanvas->fillPolyPolygon(xPolygon, aViewState, aRenderState);
395*cdf0e10cSrcweir     }
396*cdf0e10cSrcweir }
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir geometry::AffineMatrix2D SAL_CALL PresenterSlideShowView::getTransformation (void)
402*cdf0e10cSrcweir     throw (RuntimeException)
403*cdf0e10cSrcweir {
404*cdf0e10cSrcweir     ThrowIfDisposed();
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir     if (mxViewWindow.is())
407*cdf0e10cSrcweir     {
408*cdf0e10cSrcweir         // When the mbIsInModifyNotification is set then a slightly modifed
409*cdf0e10cSrcweir         // version of the transformation is returned in order to get past
410*cdf0e10cSrcweir         // optimizations the avoid updates when the transformation is
411*cdf0e10cSrcweir         // unchanged (when the window size changes then due to the constant
412*cdf0e10cSrcweir         // aspect ratio the size of the preview may remain the same while
413*cdf0e10cSrcweir         // the position changes.  The position, however, is repesented by
414*cdf0e10cSrcweir         // the position of the view window.  This transformation is given
415*cdf0e10cSrcweir         // relative to the view window and therefore does not contain the
416*cdf0e10cSrcweir         // position.)
417*cdf0e10cSrcweir         const awt::Rectangle aWindowBox = mxViewWindow->getPosSize();
418*cdf0e10cSrcweir         return geometry::AffineMatrix2D(
419*cdf0e10cSrcweir             aWindowBox.Width-1, 0, (mbIsInModifyNotification ? 1 : 0),
420*cdf0e10cSrcweir             0, aWindowBox.Height-1, 0);
421*cdf0e10cSrcweir     }
422*cdf0e10cSrcweir     else
423*cdf0e10cSrcweir     {
424*cdf0e10cSrcweir         return geometry::AffineMatrix2D(1,0,0, 0,1,0);
425*cdf0e10cSrcweir     }
426*cdf0e10cSrcweir }
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir 
431*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::addTransformationChangedListener(
432*cdf0e10cSrcweir     const Reference<util::XModifyListener>& rxListener)
433*cdf0e10cSrcweir     throw (RuntimeException)
434*cdf0e10cSrcweir {
435*cdf0e10cSrcweir     ThrowIfDisposed();
436*cdf0e10cSrcweir     maBroadcaster.addListener(
437*cdf0e10cSrcweir         getCppuType((Reference<util::XModifyListener>*)NULL),
438*cdf0e10cSrcweir         rxListener);
439*cdf0e10cSrcweir }
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir 
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::removeTransformationChangedListener(
445*cdf0e10cSrcweir     const Reference<util::XModifyListener>& rxListener)
446*cdf0e10cSrcweir     throw (RuntimeException)
447*cdf0e10cSrcweir {
448*cdf0e10cSrcweir     ThrowIfDisposed();
449*cdf0e10cSrcweir     maBroadcaster.removeListener(
450*cdf0e10cSrcweir         getCppuType((Reference<util::XModifyListener>*)NULL),
451*cdf0e10cSrcweir         rxListener);
452*cdf0e10cSrcweir }
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir 
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::addPaintListener(
458*cdf0e10cSrcweir     const Reference<awt::XPaintListener>& rxListener)
459*cdf0e10cSrcweir     throw (RuntimeException)
460*cdf0e10cSrcweir {
461*cdf0e10cSrcweir     ThrowIfDisposed();
462*cdf0e10cSrcweir     maBroadcaster.addListener(
463*cdf0e10cSrcweir         getCppuType((Reference<awt::XPaintListener>*)NULL),
464*cdf0e10cSrcweir         rxListener);
465*cdf0e10cSrcweir }
466*cdf0e10cSrcweir 
467*cdf0e10cSrcweir 
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir 
470*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::removePaintListener(
471*cdf0e10cSrcweir     const Reference<awt::XPaintListener>& rxListener)
472*cdf0e10cSrcweir     throw (RuntimeException)
473*cdf0e10cSrcweir {
474*cdf0e10cSrcweir     ThrowIfDisposed();
475*cdf0e10cSrcweir     maBroadcaster.removeListener(
476*cdf0e10cSrcweir         getCppuType((Reference<awt::XPaintListener>*)NULL),
477*cdf0e10cSrcweir         rxListener);
478*cdf0e10cSrcweir }
479*cdf0e10cSrcweir 
480*cdf0e10cSrcweir 
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir 
483*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::addMouseListener(
484*cdf0e10cSrcweir     const Reference<awt::XMouseListener>& rxListener)
485*cdf0e10cSrcweir     throw (RuntimeException)
486*cdf0e10cSrcweir {
487*cdf0e10cSrcweir     ThrowIfDisposed();
488*cdf0e10cSrcweir     maBroadcaster.addListener(
489*cdf0e10cSrcweir         getCppuType((Reference<awt::XMouseListener>*)NULL),
490*cdf0e10cSrcweir         rxListener);
491*cdf0e10cSrcweir }
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir 
494*cdf0e10cSrcweir 
495*cdf0e10cSrcweir 
496*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::removeMouseListener(
497*cdf0e10cSrcweir     const Reference<awt::XMouseListener>& rxListener)
498*cdf0e10cSrcweir     throw (RuntimeException)
499*cdf0e10cSrcweir {
500*cdf0e10cSrcweir     ThrowIfDisposed();
501*cdf0e10cSrcweir     maBroadcaster.removeListener(
502*cdf0e10cSrcweir         getCppuType((Reference<awt::XMouseListener>*)NULL),
503*cdf0e10cSrcweir         rxListener);
504*cdf0e10cSrcweir }
505*cdf0e10cSrcweir 
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir 
508*cdf0e10cSrcweir 
509*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::addMouseMotionListener(
510*cdf0e10cSrcweir     const Reference<awt::XMouseMotionListener>& rxListener)
511*cdf0e10cSrcweir     throw (RuntimeException)
512*cdf0e10cSrcweir {
513*cdf0e10cSrcweir     ThrowIfDisposed();
514*cdf0e10cSrcweir     maBroadcaster.addListener(
515*cdf0e10cSrcweir         getCppuType((Reference<awt::XMouseMotionListener>*)NULL),
516*cdf0e10cSrcweir         rxListener);
517*cdf0e10cSrcweir }
518*cdf0e10cSrcweir 
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir 
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::removeMouseMotionListener(
523*cdf0e10cSrcweir     const Reference<awt::XMouseMotionListener>& rxListener)
524*cdf0e10cSrcweir     throw (RuntimeException)
525*cdf0e10cSrcweir {
526*cdf0e10cSrcweir     ThrowIfDisposed();
527*cdf0e10cSrcweir     maBroadcaster.removeListener(
528*cdf0e10cSrcweir         getCppuType((Reference<awt::XMouseMotionListener>*)NULL),
529*cdf0e10cSrcweir         rxListener);
530*cdf0e10cSrcweir }
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir 
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir 
535*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::setMouseCursor(::sal_Int16 nPointerShape)
536*cdf0e10cSrcweir     throw (RuntimeException)
537*cdf0e10cSrcweir {
538*cdf0e10cSrcweir     ThrowIfDisposed();
539*cdf0e10cSrcweir 
540*cdf0e10cSrcweir     // Create a pointer when it does not yet exist.
541*cdf0e10cSrcweir     if ( ! mxPointer.is())
542*cdf0e10cSrcweir     {
543*cdf0e10cSrcweir         Reference<lang::XMultiServiceFactory> xFactory (
544*cdf0e10cSrcweir             mxComponentContext, UNO_QUERY);
545*cdf0e10cSrcweir         if (xFactory.is())
546*cdf0e10cSrcweir             mxPointer = Reference<awt::XPointer>(
547*cdf0e10cSrcweir                 xFactory->createInstance(OUString::createFromAscii("com.sun.star.awt.Pointer")),
548*cdf0e10cSrcweir                 UNO_QUERY);
549*cdf0e10cSrcweir     }
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir     // Set the pointer to the given shape and the window(peer) to the
552*cdf0e10cSrcweir     // pointer.
553*cdf0e10cSrcweir     Reference<awt::XWindowPeer> xPeer (mxViewWindow, UNO_QUERY);
554*cdf0e10cSrcweir     if (mxPointer.is() && xPeer.is())
555*cdf0e10cSrcweir     {
556*cdf0e10cSrcweir         mxPointer->setType(nPointerShape);
557*cdf0e10cSrcweir         xPeer->setPointer(mxPointer);
558*cdf0e10cSrcweir     }
559*cdf0e10cSrcweir }
560*cdf0e10cSrcweir 
561*cdf0e10cSrcweir 
562*cdf0e10cSrcweir 
563*cdf0e10cSrcweir awt::Rectangle SAL_CALL PresenterSlideShowView::getCanvasArea(  ) throw (RuntimeException)
564*cdf0e10cSrcweir {
565*cdf0e10cSrcweir     if( mxViewWindow.is() && mxTopPane.is() )
566*cdf0e10cSrcweir 	return mxPresenterHelper->getWindowExtentsRelative( mxViewWindow, mxTopPane->getWindow() );
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir     awt::Rectangle aRectangle;
569*cdf0e10cSrcweir 
570*cdf0e10cSrcweir     aRectangle.X = aRectangle.Y = aRectangle.Width = aRectangle.Height = 0;
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir     return aRectangle;
573*cdf0e10cSrcweir }
574*cdf0e10cSrcweir 
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir 
577*cdf0e10cSrcweir //----- lang::XEventListener --------------------------------------------------
578*cdf0e10cSrcweir 
579*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::disposing (const lang::EventObject& rEvent)
580*cdf0e10cSrcweir     throw (RuntimeException)
581*cdf0e10cSrcweir {
582*cdf0e10cSrcweir     if (rEvent.Source == mxViewWindow)
583*cdf0e10cSrcweir         mxViewWindow = NULL;
584*cdf0e10cSrcweir     else if (rEvent.Source == mxSlideShow)
585*cdf0e10cSrcweir         mxSlideShow = NULL;
586*cdf0e10cSrcweir }
587*cdf0e10cSrcweir 
588*cdf0e10cSrcweir 
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir 
591*cdf0e10cSrcweir //----- XPaintListener --------------------------------------------------------
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::windowPaint (const awt::PaintEvent& rEvent)
594*cdf0e10cSrcweir     throw (RuntimeException)
595*cdf0e10cSrcweir {
596*cdf0e10cSrcweir     // Deactivated views must not be painted.
597*cdf0e10cSrcweir     if ( ! mbIsPresenterViewActive)
598*cdf0e10cSrcweir         return;
599*cdf0e10cSrcweir 
600*cdf0e10cSrcweir     awt::Rectangle aViewWindowBox (mxViewWindow->getPosSize());
601*cdf0e10cSrcweir     if (aViewWindowBox.Width <= 0 || aViewWindowBox.Height <= 0)
602*cdf0e10cSrcweir         return;
603*cdf0e10cSrcweir 
604*cdf0e10cSrcweir     if (rEvent.Source == mxWindow)
605*cdf0e10cSrcweir         PaintOuterWindow(rEvent.UpdateRect);
606*cdf0e10cSrcweir     else if (mbIsEndSlideVisible)
607*cdf0e10cSrcweir         PaintEndSlide(rEvent.UpdateRect);
608*cdf0e10cSrcweir     else
609*cdf0e10cSrcweir         PaintInnerWindow(rEvent);
610*cdf0e10cSrcweir }
611*cdf0e10cSrcweir 
612*cdf0e10cSrcweir 
613*cdf0e10cSrcweir 
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir //----- XMouseListener --------------------------------------------------------
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::mousePressed (const awt::MouseEvent& rEvent)
618*cdf0e10cSrcweir     throw (RuntimeException)
619*cdf0e10cSrcweir {
620*cdf0e10cSrcweir     awt::MouseEvent aEvent (rEvent);
621*cdf0e10cSrcweir     aEvent.Source = static_cast<XWeak*>(this);
622*cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper* pIterator
623*cdf0e10cSrcweir         = maBroadcaster.getContainer(getCppuType((Reference<awt::XMouseListener>*)NULL));
624*cdf0e10cSrcweir     if (pIterator != NULL)
625*cdf0e10cSrcweir     {
626*cdf0e10cSrcweir         pIterator->notifyEach(&awt::XMouseListener::mousePressed, aEvent);
627*cdf0e10cSrcweir     }
628*cdf0e10cSrcweir 
629*cdf0e10cSrcweir     // Only when the end slide is displayed we forward the mouse event to
630*cdf0e10cSrcweir     // the PresenterController so that it switches to the next slide and
631*cdf0e10cSrcweir     // ends the presentation.
632*cdf0e10cSrcweir     if (mbIsEndSlideVisible)
633*cdf0e10cSrcweir         if (mpPresenterController.get() != NULL)
634*cdf0e10cSrcweir             mpPresenterController->HandleMouseClick(rEvent);
635*cdf0e10cSrcweir }
636*cdf0e10cSrcweir 
637*cdf0e10cSrcweir 
638*cdf0e10cSrcweir 
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::mouseReleased (const awt::MouseEvent& rEvent)
641*cdf0e10cSrcweir     throw (RuntimeException)
642*cdf0e10cSrcweir {
643*cdf0e10cSrcweir     awt::MouseEvent aEvent (rEvent);
644*cdf0e10cSrcweir     aEvent.Source = static_cast<XWeak*>(this);
645*cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper* pIterator
646*cdf0e10cSrcweir         = maBroadcaster.getContainer(getCppuType((Reference<awt::XMouseListener>*)NULL));
647*cdf0e10cSrcweir     if (pIterator != NULL)
648*cdf0e10cSrcweir     {
649*cdf0e10cSrcweir         pIterator->notifyEach(&awt::XMouseListener::mouseReleased, aEvent);
650*cdf0e10cSrcweir     }
651*cdf0e10cSrcweir }
652*cdf0e10cSrcweir 
653*cdf0e10cSrcweir 
654*cdf0e10cSrcweir 
655*cdf0e10cSrcweir 
656*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::mouseEntered (const awt::MouseEvent& rEvent)
657*cdf0e10cSrcweir     throw (RuntimeException)
658*cdf0e10cSrcweir {
659*cdf0e10cSrcweir     awt::MouseEvent aEvent (rEvent);
660*cdf0e10cSrcweir     aEvent.Source = static_cast<XWeak*>(this);
661*cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper* pIterator
662*cdf0e10cSrcweir         = maBroadcaster.getContainer(getCppuType((Reference<awt::XMouseListener>*)NULL));
663*cdf0e10cSrcweir     if (pIterator != NULL)
664*cdf0e10cSrcweir     {
665*cdf0e10cSrcweir         pIterator->notifyEach(&awt::XMouseListener::mouseEntered, aEvent);
666*cdf0e10cSrcweir     }
667*cdf0e10cSrcweir }
668*cdf0e10cSrcweir 
669*cdf0e10cSrcweir 
670*cdf0e10cSrcweir 
671*cdf0e10cSrcweir 
672*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::mouseExited (const awt::MouseEvent& rEvent)
673*cdf0e10cSrcweir     throw (RuntimeException)
674*cdf0e10cSrcweir {
675*cdf0e10cSrcweir     awt::MouseEvent aEvent (rEvent);
676*cdf0e10cSrcweir     aEvent.Source = static_cast<XWeak*>(this);
677*cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper* pIterator
678*cdf0e10cSrcweir         = maBroadcaster.getContainer(getCppuType((Reference<awt::XMouseListener>*)NULL));
679*cdf0e10cSrcweir     if (pIterator != NULL)
680*cdf0e10cSrcweir     {
681*cdf0e10cSrcweir         pIterator->notifyEach(&awt::XMouseListener::mouseExited, aEvent);
682*cdf0e10cSrcweir     }
683*cdf0e10cSrcweir }
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir 
686*cdf0e10cSrcweir 
687*cdf0e10cSrcweir 
688*cdf0e10cSrcweir //----- XMouseMotionListener --------------------------------------------------
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::mouseDragged (const awt::MouseEvent& rEvent)
691*cdf0e10cSrcweir     throw (RuntimeException)
692*cdf0e10cSrcweir {
693*cdf0e10cSrcweir     awt::MouseEvent aEvent (rEvent);
694*cdf0e10cSrcweir     aEvent.Source = static_cast<XWeak*>(this);
695*cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper* pIterator
696*cdf0e10cSrcweir         = maBroadcaster.getContainer(getCppuType((Reference<awt::XMouseMotionListener>*)NULL));
697*cdf0e10cSrcweir     if (pIterator != NULL)
698*cdf0e10cSrcweir     {
699*cdf0e10cSrcweir         pIterator->notifyEach(&awt::XMouseMotionListener::mouseDragged, aEvent);
700*cdf0e10cSrcweir     }
701*cdf0e10cSrcweir }
702*cdf0e10cSrcweir 
703*cdf0e10cSrcweir 
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir 
706*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::mouseMoved (const awt::MouseEvent& rEvent)
707*cdf0e10cSrcweir     throw (RuntimeException)
708*cdf0e10cSrcweir {
709*cdf0e10cSrcweir     awt::MouseEvent aEvent (rEvent);
710*cdf0e10cSrcweir     aEvent.Source = static_cast<XWeak*>(this);
711*cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper* pIterator
712*cdf0e10cSrcweir         = maBroadcaster.getContainer(getCppuType((Reference<awt::XMouseMotionListener>*)NULL));
713*cdf0e10cSrcweir     if (pIterator != NULL)
714*cdf0e10cSrcweir     {
715*cdf0e10cSrcweir         pIterator->notifyEach(&awt::XMouseMotionListener::mouseMoved, aEvent);
716*cdf0e10cSrcweir     }
717*cdf0e10cSrcweir }
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir 
720*cdf0e10cSrcweir 
721*cdf0e10cSrcweir 
722*cdf0e10cSrcweir //----- XWindowListener -------------------------------------------------------
723*cdf0e10cSrcweir 
724*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::windowResized (const awt::WindowEvent& rEvent)
725*cdf0e10cSrcweir     throw (RuntimeException)
726*cdf0e10cSrcweir {
727*cdf0e10cSrcweir     (void)rEvent;
728*cdf0e10cSrcweir 
729*cdf0e10cSrcweir     ThrowIfDisposed();
730*cdf0e10cSrcweir 	::osl::MutexGuard aGuard (::osl::Mutex::getGlobalMutex());
731*cdf0e10cSrcweir 
732*cdf0e10cSrcweir     Resize();
733*cdf0e10cSrcweir }
734*cdf0e10cSrcweir 
735*cdf0e10cSrcweir 
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir 
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::windowMoved (const awt::WindowEvent& rEvent)
740*cdf0e10cSrcweir     throw (RuntimeException)
741*cdf0e10cSrcweir {
742*cdf0e10cSrcweir     (void)rEvent;
743*cdf0e10cSrcweir     if ( ! mbIsPaintPending)
744*cdf0e10cSrcweir         mbIsForcedPaintPending = true;
745*cdf0e10cSrcweir }
746*cdf0e10cSrcweir 
747*cdf0e10cSrcweir 
748*cdf0e10cSrcweir 
749*cdf0e10cSrcweir 
750*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::windowShown (const lang::EventObject& rEvent)
751*cdf0e10cSrcweir     throw (RuntimeException)
752*cdf0e10cSrcweir {
753*cdf0e10cSrcweir     (void)rEvent;
754*cdf0e10cSrcweir     Resize();
755*cdf0e10cSrcweir }
756*cdf0e10cSrcweir 
757*cdf0e10cSrcweir 
758*cdf0e10cSrcweir 
759*cdf0e10cSrcweir 
760*cdf0e10cSrcweir void SAL_CALL PresenterSlideShowView::windowHidden (const lang::EventObject& rEvent)
761*cdf0e10cSrcweir     throw (RuntimeException)
762*cdf0e10cSrcweir {
763*cdf0e10cSrcweir     (void)rEvent;
764*cdf0e10cSrcweir }
765*cdf0e10cSrcweir 
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir 
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir //----- XView -----------------------------------------------------------------
770*cdf0e10cSrcweir 
771*cdf0e10cSrcweir Reference<XResourceId> SAL_CALL PresenterSlideShowView::getResourceId (void)
772*cdf0e10cSrcweir     throw(RuntimeException)
773*cdf0e10cSrcweir {
774*cdf0e10cSrcweir     return mxViewId;
775*cdf0e10cSrcweir }
776*cdf0e10cSrcweir 
777*cdf0e10cSrcweir 
778*cdf0e10cSrcweir 
779*cdf0e10cSrcweir 
780*cdf0e10cSrcweir sal_Bool SAL_CALL PresenterSlideShowView::isAnchorOnly (void)
781*cdf0e10cSrcweir     throw (RuntimeException)
782*cdf0e10cSrcweir {
783*cdf0e10cSrcweir     return false;
784*cdf0e10cSrcweir }
785*cdf0e10cSrcweir 
786*cdf0e10cSrcweir 
787*cdf0e10cSrcweir 
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir //----- CachablePresenterView -------------------------------------------------
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir void PresenterSlideShowView::ActivatePresenterView (void)
792*cdf0e10cSrcweir {
793*cdf0e10cSrcweir     if (mxSlideShow.is() && ! mbIsViewAdded)
794*cdf0e10cSrcweir     {
795*cdf0e10cSrcweir         mxSlideShow->addView(this);
796*cdf0e10cSrcweir         mbIsViewAdded = true;
797*cdf0e10cSrcweir     }
798*cdf0e10cSrcweir }
799*cdf0e10cSrcweir 
800*cdf0e10cSrcweir 
801*cdf0e10cSrcweir 
802*cdf0e10cSrcweir 
803*cdf0e10cSrcweir void PresenterSlideShowView::DeactivatePresenterView (void)
804*cdf0e10cSrcweir {
805*cdf0e10cSrcweir     if (mxSlideShow.is() && mbIsViewAdded)
806*cdf0e10cSrcweir     {
807*cdf0e10cSrcweir         mxSlideShow->removeView(this);
808*cdf0e10cSrcweir         mbIsViewAdded = false;
809*cdf0e10cSrcweir     }
810*cdf0e10cSrcweir }
811*cdf0e10cSrcweir 
812*cdf0e10cSrcweir 
813*cdf0e10cSrcweir 
814*cdf0e10cSrcweir 
815*cdf0e10cSrcweir //-----------------------------------------------------------------------------
816*cdf0e10cSrcweir 
817*cdf0e10cSrcweir void PresenterSlideShowView::PaintOuterWindow (const awt::Rectangle& rRepaintBox)
818*cdf0e10cSrcweir {
819*cdf0e10cSrcweir     if ( ! mxCanvas.is())
820*cdf0e10cSrcweir         return;
821*cdf0e10cSrcweir 
822*cdf0e10cSrcweir     if (mpBackground.get() == NULL)
823*cdf0e10cSrcweir         return;
824*cdf0e10cSrcweir 
825*cdf0e10cSrcweir     const rendering::ViewState aViewState(
826*cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
827*cdf0e10cSrcweir         PresenterGeometryHelper::CreatePolygon(rRepaintBox, mxCanvas->getDevice()));
828*cdf0e10cSrcweir 
829*cdf0e10cSrcweir     rendering::RenderState aRenderState (
830*cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
831*cdf0e10cSrcweir         NULL,
832*cdf0e10cSrcweir         Sequence<double>(4),
833*cdf0e10cSrcweir         rendering::CompositeOperation::SOURCE);
834*cdf0e10cSrcweir 
835*cdf0e10cSrcweir     Reference<rendering::XBitmap> xBackgroundBitmap (mpBackground->GetNormalBitmap());
836*cdf0e10cSrcweir     if (xBackgroundBitmap.is())
837*cdf0e10cSrcweir     {
838*cdf0e10cSrcweir         Sequence<rendering::Texture> aTextures (1);
839*cdf0e10cSrcweir         const geometry::IntegerSize2D aBitmapSize(xBackgroundBitmap->getSize());
840*cdf0e10cSrcweir         aTextures[0] = rendering::Texture (
841*cdf0e10cSrcweir             geometry::AffineMatrix2D(
842*cdf0e10cSrcweir                 aBitmapSize.Width,0,0,
843*cdf0e10cSrcweir                 0,aBitmapSize.Height,0),
844*cdf0e10cSrcweir             1,
845*cdf0e10cSrcweir             0,
846*cdf0e10cSrcweir             xBackgroundBitmap,
847*cdf0e10cSrcweir             NULL,
848*cdf0e10cSrcweir             NULL,
849*cdf0e10cSrcweir             rendering::StrokeAttributes(),
850*cdf0e10cSrcweir             rendering::TexturingMode::REPEAT,
851*cdf0e10cSrcweir             rendering::TexturingMode::REPEAT);
852*cdf0e10cSrcweir 
853*cdf0e10cSrcweir         if (mxBackgroundPolygon1.is())
854*cdf0e10cSrcweir             mxCanvas->fillTexturedPolyPolygon(
855*cdf0e10cSrcweir                 mxBackgroundPolygon1,
856*cdf0e10cSrcweir                 aViewState,
857*cdf0e10cSrcweir                 aRenderState,
858*cdf0e10cSrcweir                 aTextures);
859*cdf0e10cSrcweir         if (mxBackgroundPolygon2.is())
860*cdf0e10cSrcweir             mxCanvas->fillTexturedPolyPolygon(
861*cdf0e10cSrcweir                 mxBackgroundPolygon2,
862*cdf0e10cSrcweir                 aViewState,
863*cdf0e10cSrcweir                 aRenderState,
864*cdf0e10cSrcweir                 aTextures);
865*cdf0e10cSrcweir     }
866*cdf0e10cSrcweir     else
867*cdf0e10cSrcweir     {
868*cdf0e10cSrcweir         PresenterCanvasHelper::SetDeviceColor(aRenderState, mpBackground->maReplacementColor);
869*cdf0e10cSrcweir 
870*cdf0e10cSrcweir         if (mxBackgroundPolygon1.is())
871*cdf0e10cSrcweir             mxCanvas->fillPolyPolygon(mxBackgroundPolygon1, aViewState, aRenderState);
872*cdf0e10cSrcweir         if (mxBackgroundPolygon2.is())
873*cdf0e10cSrcweir             mxCanvas->fillPolyPolygon(mxBackgroundPolygon2, aViewState, aRenderState);
874*cdf0e10cSrcweir     }
875*cdf0e10cSrcweir }
876*cdf0e10cSrcweir 
877*cdf0e10cSrcweir 
878*cdf0e10cSrcweir 
879*cdf0e10cSrcweir 
880*cdf0e10cSrcweir void PresenterSlideShowView::PaintEndSlide (const awt::Rectangle& rRepaintBox)
881*cdf0e10cSrcweir {
882*cdf0e10cSrcweir     if ( ! mxCanvas.is())
883*cdf0e10cSrcweir         return;
884*cdf0e10cSrcweir 
885*cdf0e10cSrcweir     const rendering::ViewState aViewState(
886*cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
887*cdf0e10cSrcweir         PresenterGeometryHelper::CreatePolygon(rRepaintBox, mxCanvas->getDevice()));
888*cdf0e10cSrcweir 
889*cdf0e10cSrcweir     rendering::RenderState aRenderState (
890*cdf0e10cSrcweir         geometry::AffineMatrix2D(1,0,0, 0,1,0),
891*cdf0e10cSrcweir         NULL,
892*cdf0e10cSrcweir         Sequence<double>(4),
893*cdf0e10cSrcweir         rendering::CompositeOperation::SOURCE);
894*cdf0e10cSrcweir     PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00000000));
895*cdf0e10cSrcweir     mxCanvas->fillPolyPolygon(
896*cdf0e10cSrcweir         PresenterGeometryHelper::CreatePolygon(mxViewWindow->getPosSize(), mxCanvas->getDevice()),
897*cdf0e10cSrcweir         aViewState,
898*cdf0e10cSrcweir         aRenderState);
899*cdf0e10cSrcweir 
900*cdf0e10cSrcweir     do
901*cdf0e10cSrcweir     {
902*cdf0e10cSrcweir         if (mpPresenterController.get() == NULL)
903*cdf0e10cSrcweir             break;
904*cdf0e10cSrcweir         ::boost::shared_ptr<PresenterTheme> pTheme (mpPresenterController->GetTheme());
905*cdf0e10cSrcweir         if (pTheme.get() == NULL)
906*cdf0e10cSrcweir             break;
907*cdf0e10cSrcweir 
908*cdf0e10cSrcweir         const OUString sViewStyle (pTheme->GetStyleName(mxViewId->getResourceURL()));
909*cdf0e10cSrcweir         PresenterTheme::SharedFontDescriptor pFont (pTheme->GetFont(sViewStyle));
910*cdf0e10cSrcweir         if (pFont.get() == NULL)
911*cdf0e10cSrcweir             break;
912*cdf0e10cSrcweir 
913*cdf0e10cSrcweir         PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff));
914*cdf0e10cSrcweir         aRenderState.AffineTransform.m02 = 20;
915*cdf0e10cSrcweir         aRenderState.AffineTransform.m12 = 40;
916*cdf0e10cSrcweir         const rendering::StringContext aContext (
917*cdf0e10cSrcweir             msClickToExitPresentationText, 0, msClickToExitPresentationText.getLength());
918*cdf0e10cSrcweir         pFont->PrepareFont(mxCanvas);
919*cdf0e10cSrcweir         mxCanvas->drawText(
920*cdf0e10cSrcweir             aContext,
921*cdf0e10cSrcweir             pFont->mxFont,
922*cdf0e10cSrcweir             aViewState,
923*cdf0e10cSrcweir             aRenderState,
924*cdf0e10cSrcweir             rendering::TextDirection::WEAK_LEFT_TO_RIGHT);
925*cdf0e10cSrcweir     }
926*cdf0e10cSrcweir     while (false);
927*cdf0e10cSrcweir 
928*cdf0e10cSrcweir     // Finally, in double buffered environments, request the changes to be
929*cdf0e10cSrcweir     // made visible.
930*cdf0e10cSrcweir     Reference<rendering::XSpriteCanvas> mxSpriteCanvas (mxCanvas, UNO_QUERY);
931*cdf0e10cSrcweir     if (mxSpriteCanvas.is())
932*cdf0e10cSrcweir         mxSpriteCanvas->updateScreen(sal_True);
933*cdf0e10cSrcweir }
934*cdf0e10cSrcweir 
935*cdf0e10cSrcweir 
936*cdf0e10cSrcweir 
937*cdf0e10cSrcweir 
938*cdf0e10cSrcweir void PresenterSlideShowView::PaintInnerWindow (const awt::PaintEvent& rEvent)
939*cdf0e10cSrcweir {
940*cdf0e10cSrcweir     // Forward window paint to listeners.
941*cdf0e10cSrcweir     awt::PaintEvent aEvent (rEvent);
942*cdf0e10cSrcweir     aEvent.Source = static_cast<XWeak*>(this);
943*cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper* pIterator
944*cdf0e10cSrcweir         = maBroadcaster.getContainer(getCppuType((Reference<awt::XPaintListener>*)NULL));
945*cdf0e10cSrcweir     if (pIterator != NULL)
946*cdf0e10cSrcweir     {
947*cdf0e10cSrcweir         pIterator->notifyEach(&awt::XPaintListener::windowPaint, aEvent);
948*cdf0e10cSrcweir     }
949*cdf0e10cSrcweir 
950*cdf0e10cSrcweir     if (mbIsForcedPaintPending)
951*cdf0e10cSrcweir         ForceRepaint();
952*cdf0e10cSrcweir 
953*cdf0e10cSrcweir     // Finally, in double buffered environments, request the changes to be
954*cdf0e10cSrcweir     // made visible.
955*cdf0e10cSrcweir     Reference<rendering::XSpriteCanvas> mxSpriteCanvas (mxCanvas, UNO_QUERY);
956*cdf0e10cSrcweir     if (mxSpriteCanvas.is())
957*cdf0e10cSrcweir         mxSpriteCanvas->updateScreen(sal_True);
958*cdf0e10cSrcweir }
959*cdf0e10cSrcweir 
960*cdf0e10cSrcweir 
961*cdf0e10cSrcweir 
962*cdf0e10cSrcweir 
963*cdf0e10cSrcweir Reference<awt::XWindow> PresenterSlideShowView::CreateViewWindow (
964*cdf0e10cSrcweir     const Reference<awt::XWindow>& rxParentWindow) const
965*cdf0e10cSrcweir {
966*cdf0e10cSrcweir     Reference<awt::XWindow> xViewWindow;
967*cdf0e10cSrcweir     try
968*cdf0e10cSrcweir     {
969*cdf0e10cSrcweir         Reference<lang::XMultiComponentFactory> xFactory (mxComponentContext->getServiceManager());
970*cdf0e10cSrcweir         if ( ! xFactory.is())
971*cdf0e10cSrcweir             return xViewWindow;
972*cdf0e10cSrcweir 
973*cdf0e10cSrcweir         Reference<awt::XToolkit> xToolkit (
974*cdf0e10cSrcweir             xFactory->createInstanceWithContext(
975*cdf0e10cSrcweir                 OUString::createFromAscii("com.sun.star.awt.Toolkit"),
976*cdf0e10cSrcweir                 mxComponentContext),
977*cdf0e10cSrcweir             UNO_QUERY_THROW);
978*cdf0e10cSrcweir         awt::WindowDescriptor aWindowDescriptor (
979*cdf0e10cSrcweir             awt::WindowClass_CONTAINER,
980*cdf0e10cSrcweir             OUString(),
981*cdf0e10cSrcweir             Reference<awt::XWindowPeer>(rxParentWindow,UNO_QUERY_THROW),
982*cdf0e10cSrcweir             -1, // parent index not available
983*cdf0e10cSrcweir             awt::Rectangle(0,0,10,10),
984*cdf0e10cSrcweir             awt::WindowAttribute::SIZEABLE
985*cdf0e10cSrcweir                 | awt::WindowAttribute::MOVEABLE
986*cdf0e10cSrcweir                 | awt::WindowAttribute::NODECORATION);
987*cdf0e10cSrcweir         xViewWindow = Reference<awt::XWindow>(
988*cdf0e10cSrcweir             xToolkit->createWindow(aWindowDescriptor),UNO_QUERY_THROW);
989*cdf0e10cSrcweir 
990*cdf0e10cSrcweir         // Make the background transparent.  The slide show paints its own background.
991*cdf0e10cSrcweir         Reference<awt::XWindowPeer> xPeer (xViewWindow, UNO_QUERY_THROW);
992*cdf0e10cSrcweir         if (xPeer.is())
993*cdf0e10cSrcweir         {
994*cdf0e10cSrcweir             xPeer->setBackground(0xff000000);
995*cdf0e10cSrcweir         }
996*cdf0e10cSrcweir 
997*cdf0e10cSrcweir         xViewWindow->setVisible(sal_True);
998*cdf0e10cSrcweir     }
999*cdf0e10cSrcweir     catch (RuntimeException&)
1000*cdf0e10cSrcweir     {
1001*cdf0e10cSrcweir     }
1002*cdf0e10cSrcweir     return xViewWindow;
1003*cdf0e10cSrcweir }
1004*cdf0e10cSrcweir 
1005*cdf0e10cSrcweir 
1006*cdf0e10cSrcweir 
1007*cdf0e10cSrcweir 
1008*cdf0e10cSrcweir Reference<rendering::XCanvas> PresenterSlideShowView::CreateViewCanvas (
1009*cdf0e10cSrcweir     const Reference<awt::XWindow>& rxViewWindow) const
1010*cdf0e10cSrcweir {
1011*cdf0e10cSrcweir     // Create a canvas for the view window.
1012*cdf0e10cSrcweir     return mxPresenterHelper->createSharedCanvas(
1013*cdf0e10cSrcweir         Reference<rendering::XSpriteCanvas>(mxTopPane->getCanvas(), UNO_QUERY),
1014*cdf0e10cSrcweir         mxTopPane->getWindow(),
1015*cdf0e10cSrcweir         mxTopPane->getCanvas(),
1016*cdf0e10cSrcweir         mxTopPane->getWindow(),
1017*cdf0e10cSrcweir         rxViewWindow);
1018*cdf0e10cSrcweir }
1019*cdf0e10cSrcweir 
1020*cdf0e10cSrcweir 
1021*cdf0e10cSrcweir 
1022*cdf0e10cSrcweir 
1023*cdf0e10cSrcweir void PresenterSlideShowView::Resize (void)
1024*cdf0e10cSrcweir {
1025*cdf0e10cSrcweir     if ( ! mxWindow.is() || ! mxViewWindow.is())
1026*cdf0e10cSrcweir         return;
1027*cdf0e10cSrcweir 
1028*cdf0e10cSrcweir     const awt::Rectangle aWindowBox (mxWindow->getPosSize());
1029*cdf0e10cSrcweir     awt::Rectangle aViewWindowBox;
1030*cdf0e10cSrcweir     if (aWindowBox.Height > 0)
1031*cdf0e10cSrcweir     {
1032*cdf0e10cSrcweir         const double nWindowAspectRatio (
1033*cdf0e10cSrcweir             double(aWindowBox.Width) / double(aWindowBox.Height));
1034*cdf0e10cSrcweir         if (nWindowAspectRatio > mnPageAspectRatio)
1035*cdf0e10cSrcweir         {
1036*cdf0e10cSrcweir             // Slides will be painted with the full parent window height.
1037*cdf0e10cSrcweir             aViewWindowBox.Width = sal_Int32(aWindowBox.Height * mnPageAspectRatio + 0.5);
1038*cdf0e10cSrcweir             aViewWindowBox.Height = aWindowBox.Height;
1039*cdf0e10cSrcweir             aViewWindowBox.X = (aWindowBox.Width - aViewWindowBox.Width) / 2;
1040*cdf0e10cSrcweir             aViewWindowBox.Y = 0;
1041*cdf0e10cSrcweir         }
1042*cdf0e10cSrcweir         else
1043*cdf0e10cSrcweir         {
1044*cdf0e10cSrcweir             // Slides will be painted with the full parent window width.
1045*cdf0e10cSrcweir             aViewWindowBox.Width = aWindowBox.Width;
1046*cdf0e10cSrcweir             aViewWindowBox.Height = sal_Int32(aWindowBox.Width / mnPageAspectRatio + 0.5);
1047*cdf0e10cSrcweir             aViewWindowBox.X = 0;
1048*cdf0e10cSrcweir             aViewWindowBox.Y = (aWindowBox.Height - aViewWindowBox.Height) / 2;
1049*cdf0e10cSrcweir         }
1050*cdf0e10cSrcweir         mxViewWindow->setPosSize(
1051*cdf0e10cSrcweir             aViewWindowBox.X,
1052*cdf0e10cSrcweir             aViewWindowBox.Y,
1053*cdf0e10cSrcweir             aViewWindowBox.Width,
1054*cdf0e10cSrcweir             aViewWindowBox.Height,
1055*cdf0e10cSrcweir             awt::PosSize::POSSIZE);
1056*cdf0e10cSrcweir     }
1057*cdf0e10cSrcweir 
1058*cdf0e10cSrcweir     // Clear the background polygon so that on the next paint it is created
1059*cdf0e10cSrcweir     // for the new size.
1060*cdf0e10cSrcweir     CreateBackgroundPolygons();
1061*cdf0e10cSrcweir 
1062*cdf0e10cSrcweir     // Notify listeners that the transformation that maps the view into the
1063*cdf0e10cSrcweir     // window has changed.
1064*cdf0e10cSrcweir     lang::EventObject aEvent (static_cast<XWeak*>(this));
1065*cdf0e10cSrcweir     ::cppu::OInterfaceContainerHelper* pIterator
1066*cdf0e10cSrcweir         = maBroadcaster.getContainer(getCppuType((Reference<util::XModifyListener>*)NULL));
1067*cdf0e10cSrcweir     if (pIterator != NULL)
1068*cdf0e10cSrcweir     {
1069*cdf0e10cSrcweir         pIterator->notifyEach(&util::XModifyListener::modified, aEvent);
1070*cdf0e10cSrcweir     }
1071*cdf0e10cSrcweir 
1072*cdf0e10cSrcweir     // Due to constant aspect ratio resizing may lead a preview that changes
1073*cdf0e10cSrcweir     // its position but not its size.  This invalidates the back buffer and
1074*cdf0e10cSrcweir     // we have to enforce a complete repaint.
1075*cdf0e10cSrcweir     if ( ! mbIsPaintPending)
1076*cdf0e10cSrcweir         mbIsForcedPaintPending = true;
1077*cdf0e10cSrcweir }
1078*cdf0e10cSrcweir 
1079*cdf0e10cSrcweir 
1080*cdf0e10cSrcweir 
1081*cdf0e10cSrcweir 
1082*cdf0e10cSrcweir void PresenterSlideShowView::ForceRepaint (void)
1083*cdf0e10cSrcweir {
1084*cdf0e10cSrcweir     if (mxSlideShow.is() && mbIsViewAdded)
1085*cdf0e10cSrcweir     {
1086*cdf0e10cSrcweir         mxSlideShow->removeView(this);
1087*cdf0e10cSrcweir         mxSlideShow->addView(this);
1088*cdf0e10cSrcweir     }
1089*cdf0e10cSrcweir }
1090*cdf0e10cSrcweir 
1091*cdf0e10cSrcweir 
1092*cdf0e10cSrcweir 
1093*cdf0e10cSrcweir 
1094*cdf0e10cSrcweir void PresenterSlideShowView::CreateBackgroundPolygons (void)
1095*cdf0e10cSrcweir {
1096*cdf0e10cSrcweir     const awt::Rectangle aWindowBox (mxWindow->getPosSize());
1097*cdf0e10cSrcweir     const awt::Rectangle aViewWindowBox (mxViewWindow->getPosSize());
1098*cdf0e10cSrcweir     if (aWindowBox.Height == aViewWindowBox.Height && aWindowBox.Width == aViewWindowBox.Width)
1099*cdf0e10cSrcweir     {
1100*cdf0e10cSrcweir         mxBackgroundPolygon1 = NULL;
1101*cdf0e10cSrcweir         mxBackgroundPolygon2 = NULL;
1102*cdf0e10cSrcweir     }
1103*cdf0e10cSrcweir     else if (aWindowBox.Height == aViewWindowBox.Height)
1104*cdf0e10cSrcweir     {
1105*cdf0e10cSrcweir         // Paint two boxes to the left and right of the view window.
1106*cdf0e10cSrcweir         mxBackgroundPolygon1 = PresenterGeometryHelper::CreatePolygon(
1107*cdf0e10cSrcweir             awt::Rectangle(
1108*cdf0e10cSrcweir                 0,
1109*cdf0e10cSrcweir                 0,
1110*cdf0e10cSrcweir                 aViewWindowBox.X,
1111*cdf0e10cSrcweir                 aWindowBox.Height),
1112*cdf0e10cSrcweir             mxCanvas->getDevice());
1113*cdf0e10cSrcweir         mxBackgroundPolygon2 = PresenterGeometryHelper::CreatePolygon(
1114*cdf0e10cSrcweir             awt::Rectangle(
1115*cdf0e10cSrcweir                 aViewWindowBox.X + aViewWindowBox.Width,
1116*cdf0e10cSrcweir                 0,
1117*cdf0e10cSrcweir                 aWindowBox.Width - aViewWindowBox.X - aViewWindowBox.Width,
1118*cdf0e10cSrcweir                 aWindowBox.Height),
1119*cdf0e10cSrcweir             mxCanvas->getDevice());
1120*cdf0e10cSrcweir     }
1121*cdf0e10cSrcweir     else
1122*cdf0e10cSrcweir     {
1123*cdf0e10cSrcweir         // Paint two boxes above and below the view window.
1124*cdf0e10cSrcweir         mxBackgroundPolygon1 = PresenterGeometryHelper::CreatePolygon(
1125*cdf0e10cSrcweir             awt::Rectangle(
1126*cdf0e10cSrcweir                 0,
1127*cdf0e10cSrcweir                 0,
1128*cdf0e10cSrcweir                 aWindowBox.Width,
1129*cdf0e10cSrcweir                 aViewWindowBox.Y),
1130*cdf0e10cSrcweir             mxCanvas->getDevice());
1131*cdf0e10cSrcweir         mxBackgroundPolygon2 = PresenterGeometryHelper::CreatePolygon(
1132*cdf0e10cSrcweir             awt::Rectangle(
1133*cdf0e10cSrcweir                 0,
1134*cdf0e10cSrcweir                 aViewWindowBox.Y + aViewWindowBox.Height,
1135*cdf0e10cSrcweir                 aWindowBox.Width,
1136*cdf0e10cSrcweir                 aWindowBox.Height - aViewWindowBox.Y - aViewWindowBox.Height),
1137*cdf0e10cSrcweir             mxCanvas->getDevice());
1138*cdf0e10cSrcweir     }
1139*cdf0e10cSrcweir }
1140*cdf0e10cSrcweir 
1141*cdf0e10cSrcweir 
1142*cdf0e10cSrcweir 
1143*cdf0e10cSrcweir 
1144*cdf0e10cSrcweir void PresenterSlideShowView::ThrowIfDisposed (void)
1145*cdf0e10cSrcweir     throw (::com::sun::star::lang::DisposedException)
1146*cdf0e10cSrcweir {
1147*cdf0e10cSrcweir 	if (rBHelper.bDisposed || rBHelper.bInDispose)
1148*cdf0e10cSrcweir 	{
1149*cdf0e10cSrcweir         throw lang::DisposedException (
1150*cdf0e10cSrcweir             OUString::createFromAscii("PresenterSlideShowView object has already been disposed"),
1151*cdf0e10cSrcweir             static_cast<uno::XWeak*>(this));
1152*cdf0e10cSrcweir     }
1153*cdf0e10cSrcweir }
1154*cdf0e10cSrcweir 
1155*cdf0e10cSrcweir 
1156*cdf0e10cSrcweir } } // end of namespace ::sd::presenter
1157