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_PRESENTERSLIDEPREVIEW_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSLIDEPREVIEW_HXX
23 #include "PresenterController.hxx"
25 #include <com/sun/star/awt/XPaintListener.hpp>
26 #include <com/sun/star/awt/XWindowListener.hpp>
27 #include <com/sun/star/drawing/XDrawPage.hpp>
28 #include <com/sun/star/drawing/XDrawView.hpp>
29 #include <com/sun/star/drawing/XSlideRenderer.hpp>
30 #include <com/sun/star/drawing/framework/XPane.hpp>
31 #include <com/sun/star/drawing/framework/XView.hpp>
32 #include <com/sun/star/uno/XComponentContext.hpp>
33 #include <cppuhelper/basemutex.hxx>
34 #include <cppuhelper/compbase.hxx>
35 #include <rtl/ref.hxx>
37 namespace sdext::presenter
{
39 typedef ::cppu::WeakComponentImplHelper
<
40 css::drawing::framework::XView
,
41 css::drawing::XDrawView
,
42 css::awt::XPaintListener
,
43 css::awt::XWindowListener
44 > PresenterSlidePreviewInterfaceBase
;
46 /** Static preview of a slide. Typically used for the preview of the next
48 This implementation shows a preview of the slide given to the
49 setCurrentSlide. For showing the next slide the PresenterViewFactory
50 uses a derived class that overrides the setCurrentSlide() method.
52 class PresenterSlidePreview
53 : private ::cppu::BaseMutex
,
54 public PresenterSlidePreviewInterfaceBase
57 PresenterSlidePreview (
58 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
,
59 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxViewId
,
60 const css::uno::Reference
<css::drawing::framework::XPane
>& rxAnchorPane
,
61 const ::rtl::Reference
<PresenterController
>& rpPresenterController
);
62 virtual ~PresenterSlidePreview() override
;
63 PresenterSlidePreview(const PresenterSlidePreview
&) = delete;
64 PresenterSlidePreview
& operator=(const PresenterSlidePreview
&) = delete;
65 virtual void SAL_CALL
disposing() override
;
69 virtual css::uno::Reference
<css::drawing::framework::XResourceId
> SAL_CALL
getResourceId() override
;
71 virtual sal_Bool SAL_CALL
isAnchorOnly() override
;
75 virtual void SAL_CALL
windowResized (const css::awt::WindowEvent
& rEvent
) override
;
77 virtual void SAL_CALL
windowMoved (const css::awt::WindowEvent
& rEvent
) override
;
79 virtual void SAL_CALL
windowShown (const css::lang::EventObject
& rEvent
) override
;
81 virtual void SAL_CALL
windowHidden (const css::lang::EventObject
& rEvent
) override
;
85 virtual void SAL_CALL
windowPaint (const css::awt::PaintEvent
& rEvent
) override
;
87 // lang::XEventListener
88 virtual void SAL_CALL
disposing (const css::lang::EventObject
& rEvent
) override
;
92 virtual void SAL_CALL
setCurrentPage (
93 const css::uno::Reference
<css::drawing::XDrawPage
>& rxSlide
) override
;
95 virtual css::uno::Reference
<css::drawing::XDrawPage
> SAL_CALL
getCurrentPage() override
;
98 ::rtl::Reference
<PresenterController
> mpPresenterController
;
101 css::uno::Reference
<css::drawing::framework::XResourceId
> mxViewId
;
102 css::uno::Reference
<css::drawing::XSlideRenderer
> mxPreviewRenderer
;
104 /** This Image holds the preview of the current slide. After resize
105 requests the image may be empty. This results eventually in a call
106 to ProvideSlide() in order to created a preview in the correct new
109 css::uno::Reference
<css::rendering::XBitmap
> mxPreview
;
110 std::shared_ptr
<PresenterBitmapContainer
> mpBitmaps
;
112 /** The current slide for which a preview is displayed. This may or
113 may not be the same as the current slide of the PresenterView.
115 css::uno::Reference
<css::drawing::XDrawPage
> mxCurrentSlide
;
116 double mnSlideAspectRatio
;
118 css::uno::Reference
<css::awt::XWindow
> mxWindow
;
119 css::uno::Reference
<css::rendering::XCanvas
> mxCanvas
;
121 /** Set the given slide as the current slide of the called PresenterSlidePreview
124 void SetSlide (const css::uno::Reference
<css::drawing::XDrawPage
>& rxPage
);
126 /** Paint the preview of the current slide centered in the window of the
129 void Paint (const css::awt::Rectangle
& rBoundingBox
);
131 /** React to a resize of the anchor pane.
135 /** @throws css::lang::DisposedException when the object has already been
138 void ThrowIfDisposed();
141 } // end of namespace ::sd::presenter
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */