1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/compbase.hxx>
40 #include <cppuhelper/interfacecontainer.hxx>
41 #include <cppuhelper/basemutex.hxx>
43 namespace sdext
{ namespace presenter
{
45 typedef cppu::WeakComponentImplHelper
<
46 css::presentation::XSlideShowView
,
47 css::awt::XPaintListener
,
48 css::awt::XMouseListener
,
49 css::awt::XMouseMotionListener
,
50 css::awt::XWindowListener
,
51 css::drawing::framework::XView
,
52 css::drawing::XDrawView
53 > PresenterSlideShowViewInterfaceBase
;
55 /** Life view in a secondary window of a full screen slide show.
57 class PresenterSlideShowView
58 : protected ::cppu::BaseMutex
,
59 public PresenterSlideShowViewInterfaceBase
,
60 public CachablePresenterView
63 PresenterSlideShowView (
64 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
,
65 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxViewId
,
66 const css::uno::Reference
<css::frame::XController
>& rxController
,
67 const ::rtl::Reference
<PresenterController
>& rpPresenterController
);
68 virtual ~PresenterSlideShowView() override
;
69 PresenterSlideShowView(const PresenterSlideShowView
&) = delete;
70 PresenterSlideShowView
& operator=(const PresenterSlideShowView
&) = delete;
73 virtual void SAL_CALL
disposing() override
;
75 // CachablePresenterView
77 virtual void ReleaseView() override
;
81 virtual css::uno::Reference
<
82 css::rendering::XSpriteCanvas
> SAL_CALL
getCanvas() override
;
84 virtual void SAL_CALL
clear() override
;
86 virtual css::geometry::AffineMatrix2D SAL_CALL
getTransformation() override
;
88 virtual css::geometry::IntegerSize2D SAL_CALL
getTranslationOffset() override
;
90 virtual void SAL_CALL
addTransformationChangedListener(
91 const css::uno::Reference
<
92 css::util::XModifyListener
>& xListener
) override
;
94 virtual void SAL_CALL
removeTransformationChangedListener(
95 const css::uno::Reference
<
96 css::util::XModifyListener
>& xListener
) override
;
98 virtual void SAL_CALL
addPaintListener(
99 const css::uno::Reference
<
100 css::awt::XPaintListener
>& xListener
) override
;
102 virtual void SAL_CALL
removePaintListener(
103 const css::uno::Reference
<
104 css::awt::XPaintListener
>& xListener
) override
;
106 virtual void SAL_CALL
addMouseListener(
107 const css::uno::Reference
<
108 css::awt::XMouseListener
>& xListener
) override
;
110 virtual void SAL_CALL
removeMouseListener(
111 const css::uno::Reference
<
112 css::awt::XMouseListener
>& xListener
) override
;
114 virtual void SAL_CALL
addMouseMotionListener(
115 const css::uno::Reference
<
116 css::awt::XMouseMotionListener
>& xListener
) override
;
118 virtual void SAL_CALL
removeMouseMotionListener(
119 const css::uno::Reference
<
120 css::awt::XMouseMotionListener
>& xListener
) override
;
122 virtual void SAL_CALL
setMouseCursor(::sal_Int16 nPointerShape
) override
;
124 virtual css::awt::Rectangle SAL_CALL
getCanvasArea( ) override
;
126 // lang::XEventListener
127 virtual void SAL_CALL
disposing (const css::lang::EventObject
& rEvent
) override
;
130 virtual void SAL_CALL
windowPaint (const css::awt::PaintEvent
& rEvent
) override
;
133 virtual void SAL_CALL
mousePressed (const css::awt::MouseEvent
& rEvent
) override
;
135 virtual void SAL_CALL
mouseReleased (const css::awt::MouseEvent
& rEvent
) override
;
137 virtual void SAL_CALL
mouseEntered (const css::awt::MouseEvent
& rEvent
) override
;
139 virtual void SAL_CALL
mouseExited (const css::awt::MouseEvent
& rEvent
) override
;
141 // XMouseMotionListener
143 virtual void SAL_CALL
mouseDragged (const css::awt::MouseEvent
& rEvent
) override
;
145 virtual void SAL_CALL
mouseMoved (const css::awt::MouseEvent
& rEvent
) override
;
149 virtual void SAL_CALL
windowResized (const css::awt::WindowEvent
& rEvent
) override
;
151 virtual void SAL_CALL
windowMoved (const css::awt::WindowEvent
& rEvent
) override
;
153 virtual void SAL_CALL
windowShown (const css::lang::EventObject
& rEvent
) override
;
155 virtual void SAL_CALL
windowHidden (const css::lang::EventObject
& rEvent
) override
;
159 virtual css::uno::Reference
<css::drawing::framework::XResourceId
> SAL_CALL
160 getResourceId() override
;
162 virtual sal_Bool SAL_CALL
isAnchorOnly() override
;
166 virtual void SAL_CALL
setCurrentPage (
167 const css::uno::Reference
<css::drawing::XDrawPage
>& rxSlide
) override
;
169 virtual css::uno::Reference
<css::drawing::XDrawPage
> SAL_CALL
getCurrentPage() override
;
171 // CachablePresenterView
173 virtual void ActivatePresenterView() override
;
175 virtual void DeactivatePresenterView() override
;
178 css::uno::Reference
<css::uno::XComponentContext
> mxComponentContext
;
179 ::rtl::Reference
<PresenterController
> mpPresenterController
;
180 css::uno::Reference
<css::drawing::framework::XResourceId
> mxViewId
;
181 css::uno::Reference
<css::frame::XController
> mxController
;
182 css::uno::Reference
<css::presentation::XSlideShowController
> mxSlideShowController
;
183 css::uno::Reference
<css::presentation::XSlideShow
> mxSlideShow
;
184 css::uno::Reference
<css::rendering::XCanvas
> mxCanvas
;
185 css::uno::Reference
<css::rendering::XCanvas
> mxViewCanvas
;
186 css::uno::Reference
<css::awt::XPointer
> mxPointer
;
187 css::uno::Reference
<css::awt::XWindow
> mxWindow
;
188 css::uno::Reference
<css::awt::XWindow
> mxViewWindow
;
189 css::uno::Reference
<css::drawing::framework::XPane
> mxTopPane
;
190 css::uno::Reference
<css::drawing::XPresenterHelper
> mxPresenterHelper
;
191 css::uno::Reference
<css::rendering::XPolyPolygon2D
> mxBackgroundPolygon1
;
192 css::uno::Reference
<css::rendering::XPolyPolygon2D
> mxBackgroundPolygon2
;
195 /** Aspect ratio of the current slide.
197 double mnPageAspectRatio
;
199 /** This broadcast helper is used to notify listeners registered to a
200 SlideShowView object.
202 ::cppu::OBroadcastHelper maBroadcaster
;
204 SharedBitmapDescriptor mpBackground
;
206 bool mbIsForcedPaintPending
;
207 bool mbIsPaintPending
;
208 OUString msClickToExitPresentationText
;
209 OUString msClickToExitPresentationTitle
;
210 OUString msTitleTemplate
;
211 bool mbIsEndSlideVisible
;
212 css::uno::Reference
<css::drawing::XDrawPage
> mxCurrentSlide
;
214 /** Create the window into which the slide show will render its
215 content. This window has the correct aspect ratio and is displayed centered
216 and as large as possible in its parent window.
218 css::uno::Reference
<css::awt::XWindow
> CreateViewWindow (
219 const css::uno::Reference
<css::awt::XWindow
>& rxParentWindow
) const;
220 css::uno::Reference
<css::rendering::XCanvas
> CreateViewCanvas (
221 const css::uno::Reference
<css::awt::XWindow
>& rxWindow
) const;
225 void PaintOuterWindow (const css::awt::Rectangle
& rRepaintBox
);
226 void PaintInnerWindow (const css::awt::PaintEvent
& rEvent
);
227 void PaintEndSlide (const css::awt::Rectangle
& rRepaintBox
);
229 void CreateBackgroundPolygons();
231 /** @throws css::lang::DisposedException when the object has already been
234 void ThrowIfDisposed();
236 void impl_addAndConfigureView();
239 } } // end of namespace ::sd::presenter
243 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */