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