Updated core
[LibreOffice.git] / sdext / source / presenter / PresenterSlideShowView.hxx
bloba392842d2e99eb2361b1af0ccade1501646004ef
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SDEXT_PRESENTER_SLIDE_SHOW_VIEW_HXX
21 #define SDEXT_PRESENTER_SLIDE_SHOW_VIEW_HXX
23 #include "PresenterViewFactory.hxx"
24 #include <com/sun/star/presentation/XSlideShowView.hpp>
25 #include <com/sun/star/awt/XPaintListener.hpp>
26 #include <com/sun/star/awt/XMouseListener.hpp>
27 #include <com/sun/star/awt/XMouseMotionListener.hpp>
28 #include <com/sun/star/awt/XPointer.hpp>
29 #include <com/sun/star/awt/XWindowListener.hpp>
30 #include <com/sun/star/drawing/XDrawView.hpp>
31 #include <com/sun/star/drawing/framework/XPane.hpp>
32 #include <com/sun/star/drawing/framework/XResourceId.hpp>
33 #include <com/sun/star/drawing/framework/XView.hpp>
34 #include <com/sun/star/frame/XController.hpp>
35 #include <com/sun/star/presentation/XSlideShowController.hpp>
36 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
37 #include <com/sun/star/uno/XComponentContext.hpp>
38 #include <com/sun/star/util/Color.hpp>
39 #include <cppuhelper/compbase7.hxx>
40 #include <cppuhelper/interfacecontainer.hxx>
41 #include <cppuhelper/basemutex.hxx>
42 #include <boost/noncopyable.hpp>
44 namespace sdext { namespace presenter {
46 namespace {
47 typedef cppu::WeakComponentImplHelper7<
48 css::presentation::XSlideShowView,
49 css::awt::XPaintListener,
50 css::awt::XMouseListener,
51 css::awt::XMouseMotionListener,
52 css::awt::XWindowListener,
53 css::drawing::framework::XView,
54 css::drawing::XDrawView
55 > PresenterSlideShowViewInterfaceBase;
58 /** Life view in a secondary windo of a full screen slide show.
60 class PresenterSlideShowView
61 : private ::boost::noncopyable,
62 protected ::cppu::BaseMutex,
63 public PresenterSlideShowViewInterfaceBase,
64 public CachablePresenterView
66 public:
67 PresenterSlideShowView (
68 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
69 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
70 const css::uno::Reference<css::frame::XController>& rxController,
71 const ::rtl::Reference<PresenterController>& rpPresenterController);
72 virtual ~PresenterSlideShowView (void);
74 void LateInit (void);
75 virtual void SAL_CALL disposing (void);
77 // CachablePresenterView
79 virtual void ReleaseView (void);
81 // XSlideShowView
83 virtual css::uno::Reference<
84 css::rendering::XSpriteCanvas > SAL_CALL getCanvas (void)
85 throw (css::uno::RuntimeException);
87 virtual void SAL_CALL clear (void)
88 throw (css::uno::RuntimeException);
90 virtual css::geometry::AffineMatrix2D SAL_CALL getTransformation (void)
91 throw (css::uno::RuntimeException);
93 virtual void SAL_CALL addTransformationChangedListener(
94 const css::uno::Reference<
95 css::util::XModifyListener >& xListener)
96 throw (css::uno::RuntimeException);
98 virtual void SAL_CALL removeTransformationChangedListener(
99 const css::uno::Reference<
100 css::util::XModifyListener >& xListener)
101 throw (css::uno::RuntimeException);
103 virtual void SAL_CALL addPaintListener(
104 const css::uno::Reference<
105 css::awt::XPaintListener >& xListener)
106 throw (css::uno::RuntimeException);
108 virtual void SAL_CALL removePaintListener(
109 const css::uno::Reference<
110 css::awt::XPaintListener >& xListener)
111 throw (css::uno::RuntimeException);
113 virtual void SAL_CALL addMouseListener(
114 const css::uno::Reference<
115 css::awt::XMouseListener >& xListener)
116 throw (css::uno::RuntimeException);
118 virtual void SAL_CALL removeMouseListener(
119 const css::uno::Reference<
120 css::awt::XMouseListener >& xListener)
121 throw (css::uno::RuntimeException);
123 virtual void SAL_CALL addMouseMotionListener(
124 const css::uno::Reference<
125 css::awt::XMouseMotionListener >& xListener)
126 throw (css::uno::RuntimeException);
128 virtual void SAL_CALL removeMouseMotionListener(
129 const css::uno::Reference<
130 css::awt::XMouseMotionListener >& xListener)
131 throw (css::uno::RuntimeException);
133 virtual void SAL_CALL setMouseCursor(::sal_Int16 nPointerShape)
134 throw (css::uno::RuntimeException);
136 virtual ::com::sun::star::awt::Rectangle SAL_CALL getCanvasArea( )
137 throw (::com::sun::star::uno::RuntimeException);
139 // lang::XEventListener
140 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
141 throw (css::uno::RuntimeException);
143 // XPaintListener
144 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent)
145 throw (css::uno::RuntimeException);
147 // XMouseListener
148 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent)
149 throw (css::uno::RuntimeException);
151 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent)
152 throw (css::uno::RuntimeException);
154 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent)
155 throw (css::uno::RuntimeException);
157 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent)
158 throw (css::uno::RuntimeException);
160 // XMouseMotionListener
162 virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent)
163 throw (css::uno::RuntimeException);
165 virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent)
166 throw (css::uno::RuntimeException);
168 // XWindowListener
170 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
171 throw (css::uno::RuntimeException);
173 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
174 throw (css::uno::RuntimeException);
176 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
177 throw (css::uno::RuntimeException);
179 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
180 throw (css::uno::RuntimeException);
182 // XView
184 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL
185 getResourceId (void)
186 throw(css::uno::RuntimeException);
188 virtual sal_Bool SAL_CALL isAnchorOnly (void)
189 throw (com::sun::star::uno::RuntimeException);
191 // XDrawView
193 virtual void SAL_CALL setCurrentPage (
194 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
195 throw (css::uno::RuntimeException);
197 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void)
198 throw (css::uno::RuntimeException);
200 // CachablePresenterView
202 virtual void ActivatePresenterView (void);
204 virtual void DeactivatePresenterView (void);
206 private:
207 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
208 ::rtl::Reference<PresenterController> mpPresenterController;
209 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
210 css::uno::Reference<css::frame::XController> mxController;
211 css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
212 css::uno::Reference<css::presentation::XSlideShow> mxSlideShow;
213 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
214 css::uno::Reference<css::rendering::XCanvas> mxViewCanvas;
215 css::uno::Reference<css::awt::XPointer> mxPointer;
216 css::uno::Reference<css::awt::XWindow> mxWindow;
217 css::uno::Reference<css::awt::XWindow> mxViewWindow;
218 css::uno::Reference<css::drawing::framework::XPane> mxTopPane;
219 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
220 css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon1;
221 css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon2;
222 bool mbIsViewAdded;
224 /** Aspect ratio of the current slide.
226 double mnPageAspectRatio;
228 /** This broadcast helper is used to notify listeners registed to a
229 SlideShowView object.
231 ::cppu::OBroadcastHelper maBroadcaster;
233 SharedBitmapDescriptor mpBackground;
235 bool mbIsInModifyNotification;
236 bool mbIsForcedPaintPending;
237 bool mbIsPaintPending;
238 OUString msClickToExitPresentationText;
239 OUString msClickToExitPresentationTitle;
240 OUString msTitleTemplate;
241 bool mbIsEndSlideVisible;
242 css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
244 /** Create the window into which the slide show will render its
245 content. This window has the correct aspect ratio and is displayed centered
246 and as large as possible in its parent window.
248 css::uno::Reference<css::awt::XWindow> CreateViewWindow (
249 const css::uno::Reference<css::awt::XWindow>& rxParentWindow) const;
250 css::uno::Reference<css::rendering::XCanvas> CreateViewCanvas (
251 const css::uno::Reference<css::awt::XWindow>& rxWindow) const;
253 void Resize (void);
255 void PaintOuterWindow (const css::awt::Rectangle& rRepaintBox);
256 void PaintInnerWindow (const css::awt::PaintEvent& rEvent);
257 void PaintEndSlide (const css::awt::Rectangle& rRepaintBox);
259 /** The slide show relies on the back buffer of the canvas not being
260 modified. With a shared canvas there are times when that can not be
261 guaranteed.
262 Call this method when the back buffer may have changed its content,
263 like when the window has been moved but not resized.
265 void ForceRepaint (void);
267 void CreateBackgroundPolygons (void);
269 /** This method throws a DisposedException when the object has already been
270 disposed.
272 void ThrowIfDisposed (void)
273 throw (css::lang::DisposedException);
275 void impl_addAndConfigureView();
278 } } // end of namespace ::sd::presenter
280 #endif
282 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */