fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sdext / source / presenter / PresenterSlideShowView.hxx
blob36b527f97e1654c73c7dfeb47a03683878b4ec5e
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 INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSLIDESHOWVIEW_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSLIDESHOWVIEW_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();
74 void LateInit();
75 virtual void SAL_CALL disposing() SAL_OVERRIDE;
77 // CachablePresenterView
79 virtual void ReleaseView() SAL_OVERRIDE;
81 // XSlideShowView
83 virtual css::uno::Reference<
84 css::rendering::XSpriteCanvas > SAL_CALL getCanvas()
85 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 virtual void SAL_CALL clear()
88 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
90 virtual css::geometry::AffineMatrix2D SAL_CALL getTransformation()
91 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
93 virtual css::geometry::IntegerSize2D SAL_CALL getTranslationOffset()
94 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
96 virtual void SAL_CALL addTransformationChangedListener(
97 const css::uno::Reference<
98 css::util::XModifyListener >& xListener)
99 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
101 virtual void SAL_CALL removeTransformationChangedListener(
102 const css::uno::Reference<
103 css::util::XModifyListener >& xListener)
104 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
106 virtual void SAL_CALL addPaintListener(
107 const css::uno::Reference<
108 css::awt::XPaintListener >& xListener)
109 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
111 virtual void SAL_CALL removePaintListener(
112 const css::uno::Reference<
113 css::awt::XPaintListener >& xListener)
114 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
116 virtual void SAL_CALL addMouseListener(
117 const css::uno::Reference<
118 css::awt::XMouseListener >& xListener)
119 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
121 virtual void SAL_CALL removeMouseListener(
122 const css::uno::Reference<
123 css::awt::XMouseListener >& xListener)
124 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 virtual void SAL_CALL addMouseMotionListener(
127 const css::uno::Reference<
128 css::awt::XMouseMotionListener >& xListener)
129 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 virtual void SAL_CALL removeMouseMotionListener(
132 const css::uno::Reference<
133 css::awt::XMouseMotionListener >& xListener)
134 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
136 virtual void SAL_CALL setMouseCursor(::sal_Int16 nPointerShape)
137 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
139 virtual css::awt::Rectangle SAL_CALL getCanvasArea( )
140 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 // lang::XEventListener
143 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
144 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 // XPaintListener
147 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent)
148 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
150 // XMouseListener
151 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent)
152 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
154 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent)
155 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
157 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent)
158 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
160 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent)
161 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 // XMouseMotionListener
165 virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent)
166 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
168 virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent)
169 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 // XWindowListener
173 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
174 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
176 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
177 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
179 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
180 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
182 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
183 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
185 // XView
187 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL
188 getResourceId()
189 throw(css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
191 virtual sal_Bool SAL_CALL isAnchorOnly()
192 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
194 // XDrawView
196 virtual void SAL_CALL setCurrentPage (
197 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
198 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
200 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage()
201 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
203 // CachablePresenterView
205 virtual void ActivatePresenterView() SAL_OVERRIDE;
207 virtual void DeactivatePresenterView() SAL_OVERRIDE;
209 private:
210 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
211 ::rtl::Reference<PresenterController> mpPresenterController;
212 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
213 css::uno::Reference<css::frame::XController> mxController;
214 css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
215 css::uno::Reference<css::presentation::XSlideShow> mxSlideShow;
216 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
217 css::uno::Reference<css::rendering::XCanvas> mxViewCanvas;
218 css::uno::Reference<css::awt::XPointer> mxPointer;
219 css::uno::Reference<css::awt::XWindow> mxWindow;
220 css::uno::Reference<css::awt::XWindow> mxViewWindow;
221 css::uno::Reference<css::drawing::framework::XPane> mxTopPane;
222 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
223 css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon1;
224 css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon2;
225 bool mbIsViewAdded;
227 /** Aspect ratio of the current slide.
229 double mnPageAspectRatio;
231 /** This broadcast helper is used to notify listeners registed to a
232 SlideShowView object.
234 ::cppu::OBroadcastHelper maBroadcaster;
236 SharedBitmapDescriptor mpBackground;
238 bool mbIsInModifyNotification;
239 bool mbIsForcedPaintPending;
240 bool mbIsPaintPending;
241 OUString msClickToExitPresentationText;
242 OUString msClickToExitPresentationTitle;
243 OUString msTitleTemplate;
244 bool mbIsEndSlideVisible;
245 css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
247 /** Create the window into which the slide show will render its
248 content. This window has the correct aspect ratio and is displayed centered
249 and as large as possible in its parent window.
251 css::uno::Reference<css::awt::XWindow> CreateViewWindow (
252 const css::uno::Reference<css::awt::XWindow>& rxParentWindow) const;
253 css::uno::Reference<css::rendering::XCanvas> CreateViewCanvas (
254 const css::uno::Reference<css::awt::XWindow>& rxWindow) const;
256 void Resize();
258 void PaintOuterWindow (const css::awt::Rectangle& rRepaintBox);
259 void PaintInnerWindow (const css::awt::PaintEvent& rEvent);
260 void PaintEndSlide (const css::awt::Rectangle& rRepaintBox);
262 /** The slide show relies on the back buffer of the canvas not being
263 modified. With a shared canvas there are times when that can not be
264 guaranteed.
265 Call this method when the back buffer may have changed its content,
266 like when the window has been moved but not resized.
268 void ForceRepaint();
270 void CreateBackgroundPolygons();
272 /** This method throws a DisposedException when the object has already been
273 disposed.
275 void ThrowIfDisposed()
276 throw (css::lang::DisposedException);
278 void impl_addAndConfigureView();
281 } } // end of namespace ::sd::presenter
283 #endif
285 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */