LibreOffice Module sdext (master)  1
PresenterSlidePreview.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSLIDEPREVIEW_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSLIDEPREVIEW_HXX
22 
23 #include "PresenterController.hxx"
24 
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>
36 
37 namespace sdext { namespace presenter {
38 
39 typedef ::cppu::WeakComponentImplHelper <
40  css::drawing::framework::XView,
41  css::drawing::XDrawView,
42  css::awt::XPaintListener,
43  css::awt::XWindowListener
45 
53  : private ::cppu::BaseMutex,
55 {
56 public:
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;
65  virtual void SAL_CALL disposing() override;
66 
67  // XResourceId
68 
69  virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId() override;
70 
71  virtual sal_Bool SAL_CALL isAnchorOnly() override;
72 
73  // XWindowListener
74 
75  virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override;
76 
77  virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override;
78 
79  virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override;
80 
81  virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override;
82 
83  // XPaintListener
84 
85  virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
86 
87  // lang::XEventListener
88  virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override;
89 
90  // XDrawView
91 
92  virtual void SAL_CALL setCurrentPage (
93  const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) override;
94 
95  virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override;
96 
97 protected:
99 
100 private:
101  css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
102  css::uno::Reference<css::drawing::XSlideRenderer> mxPreviewRenderer;
103 
109  css::uno::Reference<css::rendering::XBitmap> mxPreview;
110  std::shared_ptr<PresenterBitmapContainer> mpBitmaps;
111 
115  css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
117 
118  css::uno::Reference<css::awt::XWindow> mxWindow;
119  css::uno::Reference<css::rendering::XCanvas> mxCanvas;
120 
124  void SetSlide (const css::uno::Reference<css::drawing::XDrawPage>& rxPage);
125 
129  void Paint (const css::awt::Rectangle& rBoundingBox);
130 
133  void Resize();
134 
138  void ThrowIfDisposed();
139 };
140 
141 } } // end of namespace ::sd::presenter
142 
143 #endif
144 
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< PresenterBitmapContainer > mpBitmaps
css::uno::Reference< css::drawing::framework::XResourceId > mxViewId
css::uno::Reference< css::awt::XWindow > mxWindow
virtual void SAL_CALL disposing() override
css::uno::Reference< css::rendering::XCanvas > mxCanvas
virtual sal_Bool SAL_CALL isAnchorOnly() override
css::uno::Reference< css::drawing::XDrawPage > mxCurrentSlide
The current slide for which a preview is displayed.
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
void Resize()
React to a resize of the anchor pane.
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentPage() override
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
css::uno::Reference< css::drawing::XSlideRenderer > mxPreviewRenderer
css::uno::Reference< css::rendering::XBitmap > mxPreview
This Image holds the preview of the current slide.
unsigned char sal_Bool
virtual void SAL_CALL setCurrentPage(const css::uno::Reference< css::drawing::XDrawPage > &rxSlide) override
PresenterSlidePreview & operator=(const PresenterSlidePreview &)=delete
void SetSlide(const css::uno::Reference< css::drawing::XDrawPage > &rxPage)
Set the given slide as the current slide of the called PresenterSlidePreview object.
::rtl::Reference< PresenterController > mpPresenterController
::cppu::WeakComponentImplHelper< css::drawing::framework::XView, css::drawing::XDrawView, css::awt::XPaintListener, css::awt::XWindowListener > PresenterSlidePreviewInterfaceBase
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getResourceId() override
PresenterSlidePreview(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId, const css::uno::Reference< css::drawing::framework::XPane > &rxAnchorPane, const ::rtl::Reference< PresenterController > &rpPresenterController)
void Paint(const css::awt::Rectangle &rBoundingBox)
Paint the preview of the current slide centered in the window of the anchor pane. ...