Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sd / source / console / PresenterNotesView.hxx
blobe2f3139f4bdacda439e03dc610f94406c287a549
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_PRESENTERNOTESVIEW_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERNOTESVIEW_HXX
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>
37 namespace sd { class DrawController; }
39 namespace sdext::presenter {
41 class PresenterButton;
42 class PresenterScrollBar;
43 class PresenterTextView;
45 typedef cppu::WeakComponentImplHelper<
46 css::awt::XWindowListener,
47 css::awt::XPaintListener,
48 css::drawing::framework::XView,
49 css::drawing::XDrawView,
50 css::awt::XKeyListener
51 > PresenterNotesViewInterfaceBase;
53 /** A drawing framework view of the notes of a slide. At the moment this is
54 a simple text view that does not show the original formatting of the
55 notes text.
57 class PresenterNotesView
58 : private ::cppu::BaseMutex,
59 public PresenterNotesViewInterfaceBase,
60 public CachablePresenterView
62 public:
63 explicit PresenterNotesView (
64 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
65 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
66 const ::rtl::Reference<::sd::DrawController>& rxController,
67 const ::rtl::Reference<PresenterController>& rpPresenterController);
68 virtual ~PresenterNotesView() override;
70 virtual void SAL_CALL disposing() override;
72 /** Typically called from setCurrentSlide() with the notes page that is
73 associated with the slide given to setCurrentSlide().
75 Iterates over all text shapes on the given notes page and displays
76 the concatenated text of these.
78 void SetSlide (
79 const css::uno::Reference<css::drawing::XDrawPage>& rxNotesPage);
81 void ChangeFontSize (const sal_Int32 nSizeChange);
83 const std::shared_ptr<PresenterTextView>& GetTextView() const;
85 // lang::XEventListener
87 virtual void SAL_CALL
88 disposing (const css::lang::EventObject& rEventObject) override;
90 // XWindowListener
92 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override;
94 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override;
96 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override;
98 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override;
100 // XPaintListener
102 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
104 // XResourceId
106 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId() override;
108 virtual sal_Bool SAL_CALL isAnchorOnly() override;
110 // XDrawView
112 virtual void SAL_CALL setCurrentPage (
113 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) override;
115 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override;
117 // XKeyListener
119 virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent) override;
120 virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent) override;
122 private:
123 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
124 ::rtl::Reference<PresenterController> mpPresenterController;
125 css::uno::Reference<css::awt::XWindow> mxParentWindow;
126 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
127 css::uno::Reference<css::drawing::XDrawPage> mxCurrentNotesPage;
128 ::rtl::Reference<PresenterScrollBar> mpScrollBar;
129 css::uno::Reference<css::awt::XWindow> mxToolBarWindow;
130 css::uno::Reference<css::rendering::XCanvas> mxToolBarCanvas;
131 ::rtl::Reference<PresenterToolBar> mpToolBar;
132 ::rtl::Reference<PresenterButton> mpCloseButton;
133 css::util::Color maSeparatorColor;
134 sal_Int32 mnSeparatorYLocation;
135 css::geometry::RealRectangle2D maTextBoundingBox;
136 SharedBitmapDescriptor mpBackground;
137 double mnTop;
138 PresenterTheme::SharedFontDescriptor mpFont;
139 std::shared_ptr<PresenterTextView> mpTextView;
141 void CreateToolBar (
142 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
143 const ::rtl::Reference<PresenterController>& rpPresenterController);
144 void Layout();
145 void Paint (const css::awt::Rectangle& rUpdateBox);
146 void PaintToolBar (const css::awt::Rectangle& rUpdateBox);
147 void PaintText (const css::awt::Rectangle& rUpdateBox);
148 void Invalidate();
149 void Scroll (const double nDistance);
150 void SetTop (const double nTop);
151 void UpdateScrollBar();
154 } // end of namespace ::sdext::presenter
156 #endif
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */