vcl: allow for overriding the default PDF rendering resolution
[LibreOffice.git] / sdext / source / presenter / PresenterNotesView.hxx
blob1a67a9261f6b4d785a2cbfd9f2c0a1fa0e9e0a4c
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 sdext { namespace presenter {
39 class PresenterButton;
40 class PresenterScrollBar;
41 class PresenterTextView;
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
49 > PresenterNotesViewInterfaceBase;
51 /** A drawing framework view of the notes of a slide. At the moment this is
52 a simple text view that does not show the original formatting of the
53 notes text.
55 class PresenterNotesView
56 : private ::cppu::BaseMutex,
57 public PresenterNotesViewInterfaceBase,
58 public CachablePresenterView
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;
68 virtual void SAL_CALL disposing() override;
70 /** Typically called from setCurrentSlide() with the notes page that is
71 associated with the slide given to setCurrentSlide().
73 Iterates over all text shapes on the given notes page and displays
74 the concatenated text of these.
76 void SetSlide (
77 const css::uno::Reference<css::drawing::XDrawPage>& rxNotesPage);
79 void ChangeFontSize (const sal_Int32 nSizeChange);
81 const std::shared_ptr<PresenterTextView>& GetTextView() const;
83 // lang::XEventListener
85 virtual void SAL_CALL
86 disposing (const css::lang::EventObject& rEventObject) override;
88 // XWindowListener
90 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override;
92 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override;
94 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override;
96 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override;
98 // XPaintListener
100 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
102 // XResourceId
104 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId() override;
106 virtual sal_Bool SAL_CALL isAnchorOnly() override;
108 // XDrawView
110 virtual void SAL_CALL setCurrentPage (
111 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) override;
113 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override;
115 // XKeyListener
117 virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent) override;
118 virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent) override;
120 private:
121 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
122 ::rtl::Reference<PresenterController> mpPresenterController;
123 css::uno::Reference<css::awt::XWindow> mxParentWindow;
124 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
125 css::uno::Reference<css::drawing::XDrawPage> mxCurrentNotesPage;
126 ::rtl::Reference<PresenterScrollBar> mpScrollBar;
127 css::uno::Reference<css::awt::XWindow> mxToolBarWindow;
128 css::uno::Reference<css::rendering::XCanvas> mxToolBarCanvas;
129 ::rtl::Reference<PresenterToolBar> mpToolBar;
130 ::rtl::Reference<PresenterButton> mpCloseButton;
131 css::util::Color maSeparatorColor;
132 sal_Int32 mnSeparatorYLocation;
133 css::geometry::RealRectangle2D maTextBoundingBox;
134 SharedBitmapDescriptor mpBackground;
135 double mnTop;
136 PresenterTheme::SharedFontDescriptor mpFont;
137 std::shared_ptr<PresenterTextView> mpTextView;
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();
152 } } // end of namespace ::sdext::presenter
154 #endif
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */