Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sdext / source / presenter / PresenterNotesView.hxx
blobd3f0e7ee3b24d37c34e7867fcd07690c40d0ed91
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/ActionEvent.hpp>
29 #include <com/sun/star/awt/XActionListener.hpp>
30 #include <com/sun/star/awt/XButton.hpp>
31 #include <com/sun/star/awt/XControl.hpp>
32 #include <com/sun/star/awt/XTextComponent.hpp>
33 #include <com/sun/star/awt/XWindowListener.hpp>
34 #include <com/sun/star/drawing/XDrawPage.hpp>
35 #include <com/sun/star/drawing/XDrawView.hpp>
36 #include <com/sun/star/drawing/framework/XView.hpp>
37 #include <com/sun/star/drawing/framework/XResourceId.hpp>
38 #include <com/sun/star/frame/XController.hpp>
39 #include <rtl/ref.hxx>
40 #include <memory>
42 namespace sdext { namespace presenter {
44 class PresenterButton;
45 class PresenterScrollBar;
46 class PresenterTextView;
48 typedef cppu::WeakComponentImplHelper<
49 css::awt::XWindowListener,
50 css::awt::XPaintListener,
51 css::drawing::framework::XView,
52 css::drawing::XDrawView,
53 css::awt::XKeyListener
54 > PresenterNotesViewInterfaceBase;
56 /** A drawing framework view of the notes of a slide. At the moment this is
57 a simple text view that does not show the original formatting of the
58 notes text.
60 class PresenterNotesView
61 : private ::cppu::BaseMutex,
62 public PresenterNotesViewInterfaceBase,
63 public CachablePresenterView
65 public:
66 explicit PresenterNotesView (
67 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
68 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
69 const css::uno::Reference<css::frame::XController>& rxController,
70 const ::rtl::Reference<PresenterController>& rpPresenterController);
71 virtual ~PresenterNotesView() override;
73 virtual void SAL_CALL disposing() override;
75 /** Typically called from setCurrentSlide() with the notes page that is
76 associated with the slide given to setCurrentSlide().
78 Iterates over all text shapes on the given notes page and displays
79 the concatenated text of these.
81 void SetSlide (
82 const css::uno::Reference<css::drawing::XDrawPage>& rxNotesPage);
84 void ChangeFontSize (const sal_Int32 nSizeChange);
86 const std::shared_ptr<PresenterTextView>& GetTextView() const;
88 // lang::XEventListener
90 virtual void SAL_CALL
91 disposing (const css::lang::EventObject& rEventObject) override;
93 // XWindowListener
95 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override;
97 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override;
99 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override;
101 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override;
103 // XPaintListener
105 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
107 // XResourceId
109 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId() override;
111 virtual sal_Bool SAL_CALL isAnchorOnly() override;
113 // XDrawView
115 virtual void SAL_CALL setCurrentPage (
116 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) override;
118 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override;
120 // XKeyListener
122 virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent) override;
123 virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent) override;
125 private:
126 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
127 ::rtl::Reference<PresenterController> mpPresenterController;
128 css::uno::Reference<css::awt::XWindow> mxParentWindow;
129 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
130 css::uno::Reference<css::drawing::XDrawPage> mxCurrentNotesPage;
131 ::rtl::Reference<PresenterScrollBar> mpScrollBar;
132 css::uno::Reference<css::awt::XWindow> mxToolBarWindow;
133 css::uno::Reference<css::rendering::XCanvas> mxToolBarCanvas;
134 ::rtl::Reference<PresenterToolBar> mpToolBar;
135 ::rtl::Reference<PresenterButton> mpCloseButton;
136 css::util::Color maSeparatorColor;
137 sal_Int32 mnSeparatorYLocation;
138 css::geometry::RealRectangle2D maTextBoundingBox;
139 SharedBitmapDescriptor mpBackground;
140 double mnTop;
141 PresenterTheme::SharedFontDescriptor mpFont;
142 std::shared_ptr<PresenterTextView> mpTextView;
144 void CreateToolBar (
145 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
146 const ::rtl::Reference<PresenterController>& rpPresenterController);
147 void Layout();
148 void Paint (const css::awt::Rectangle& rUpdateBox);
149 void PaintToolBar (const css::awt::Rectangle& rUpdateBox);
150 void PaintText (const css::awt::Rectangle& rUpdateBox);
151 void Invalidate();
152 void Scroll (const double nDistance);
153 void SetTop (const double nTop);
154 void UpdateScrollBar();
157 } } // end of namespace ::sdext::presenter
159 #endif
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */