LibreOffice Module sdext (master)  1
PresenterNotesView.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_PRESENTERNOTESVIEW_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERNOTESVIEW_HXX
22 
23 #include "PresenterController.hxx"
24 #include "PresenterToolBar.hxx"
25 #include "PresenterViewFactory.hxx"
26 #include <cppuhelper/basemutex.hxx>
27 #include <cppuhelper/compbase.hxx>
28 #include <com/sun/star/awt/XWindowListener.hpp>
29 #include <com/sun/star/drawing/XDrawPage.hpp>
30 #include <com/sun/star/drawing/XDrawView.hpp>
31 #include <com/sun/star/drawing/framework/XView.hpp>
32 #include <com/sun/star/drawing/framework/XResourceId.hpp>
33 #include <com/sun/star/frame/XController.hpp>
34 #include <rtl/ref.hxx>
35 #include <memory>
36 
37 namespace sdext::presenter {
38 
39 class PresenterButton;
40 class PresenterScrollBar;
42 
43 typedef cppu::WeakComponentImplHelper<
44  css::awt::XWindowListener,
45  css::awt::XPaintListener,
46  css::drawing::framework::XView,
47  css::drawing::XDrawView,
48  css::awt::XKeyListener
50 
56  : private ::cppu::BaseMutex,
57  public PresenterNotesViewInterfaceBase,
59 {
60 public:
61  explicit PresenterNotesView (
62  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
63  const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
64  const css::uno::Reference<css::frame::XController>& rxController,
65  const ::rtl::Reference<PresenterController>& rpPresenterController);
66  virtual ~PresenterNotesView() override;
67 
68  virtual void SAL_CALL disposing() override;
69 
76  void SetSlide (
77  const css::uno::Reference<css::drawing::XDrawPage>& rxNotesPage);
78 
79  void ChangeFontSize (const sal_Int32 nSizeChange);
80 
81  const std::shared_ptr<PresenterTextView>& GetTextView() const;
82 
83  // lang::XEventListener
84 
85  virtual void SAL_CALL
86  disposing (const css::lang::EventObject& rEventObject) override;
87 
88  // XWindowListener
89 
90  virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override;
91 
92  virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override;
93 
94  virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override;
95 
96  virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override;
97 
98  // XPaintListener
99 
100  virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
101 
102  // XResourceId
103 
104  virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId() override;
105 
106  virtual sal_Bool SAL_CALL isAnchorOnly() override;
107 
108  // XDrawView
109 
110  virtual void SAL_CALL setCurrentPage (
111  const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) override;
112 
113  virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override;
114 
115  // XKeyListener
116 
117  virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent) override;
118  virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent) override;
119 
120 private:
121  css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
123  css::uno::Reference<css::awt::XWindow> mxParentWindow;
124  css::uno::Reference<css::rendering::XCanvas> mxCanvas;
125  css::uno::Reference<css::drawing::XDrawPage> mxCurrentNotesPage;
127  css::uno::Reference<css::awt::XWindow> mxToolBarWindow;
128  css::uno::Reference<css::rendering::XCanvas> mxToolBarCanvas;
131  css::util::Color maSeparatorColor;
133  css::geometry::RealRectangle2D maTextBoundingBox;
135  double mnTop;
137  std::shared_ptr<PresenterTextView> mpTextView;
138 
139  void CreateToolBar (
140  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
141  const ::rtl::Reference<PresenterController>& rpPresenterController);
142  void Layout();
143  void Paint (const css::awt::Rectangle& rUpdateBox);
144  void PaintToolBar (const css::awt::Rectangle& rUpdateBox);
145  void PaintText (const css::awt::Rectangle& rUpdateBox);
146  void Invalidate();
147  void Scroll (const double nDistance);
148  void SetTop (const double nTop);
149  void UpdateScrollBar();
150 };
151 
152 } // end of namespace ::sdext::presenter
153 
154 #endif
155 
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::rtl::Reference< PresenterToolBar > mpToolBar
std::shared_ptr< FontDescriptor > SharedFontDescriptor
::rtl::Reference< PresenterController > mpPresenterController
const std::shared_ptr< PresenterTextView > & GetTextView() const
void ChangeFontSize(const sal_Int32 nSizeChange)
void SetSlide(const css::uno::Reference< css::drawing::XDrawPage > &rxNotesPage)
Typically called from setCurrentSlide() with the notes page that is associated with the slide given t...
css::uno::Reference< css::awt::XWindow > mxParentWindow
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
virtual void SAL_CALL keyPressed(const css::awt::KeyEvent &rEvent) override
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
void PaintText(const css::awt::Rectangle &rUpdateBox)
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentPage() override
cppu::WeakComponentImplHelper< css::awt::XWindowListener, css::awt::XPaintListener, css::drawing::framework::XView, css::drawing::XDrawView, css::awt::XKeyListener > PresenterNotesViewInterfaceBase
css::uno::Reference< css::awt::XWindow > mxToolBarWindow
::rtl::Reference< PresenterScrollBar > mpScrollBar
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
PresenterTheme::SharedFontDescriptor mpFont
void Paint(const css::awt::Rectangle &rUpdateBox)
A drawing framework view of the notes of a slide.
css::uno::Reference< css::rendering::XCanvas > mxToolBarCanvas
std::shared_ptr< PresenterTextView > mpTextView
unsigned char sal_Bool
virtual sal_Bool SAL_CALL isAnchorOnly() override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
css::geometry::RealRectangle2D maTextBoundingBox
virtual void SAL_CALL setCurrentPage(const css::uno::Reference< css::drawing::XDrawPage > &rxSlide) override
void PaintToolBar(const css::awt::Rectangle &rUpdateBox)
css::uno::Reference< css::drawing::XDrawPage > mxCurrentNotesPage
void CreateToolBar(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const ::rtl::Reference< PresenterController > &rpPresenterController)
void Scroll(const double nDistance)
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getResourceId() override
A simple text view that paints text onto a given canvas.
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
PresenterNotesView(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId, const css::uno::Reference< css::frame::XController > &rxController, const ::rtl::Reference< PresenterController > &rpPresenterController)
::rtl::Reference< PresenterButton > mpCloseButton
virtual void SAL_CALL keyReleased(const css::awt::KeyEvent &rEvent) override
css::uno::Reference< css::rendering::XCanvas > mxCanvas
css::uno::Reference< css::drawing::framework::XResourceId > mxViewId
Base class for presenter views that allows the view factory to store them in a cache and reuse deacti...