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; 41 class PresenterTextView; 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 49 > PresenterNotesViewInterfaceBase; 50 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. 54 */ 55 class PresenterNotesView 56 : private ::cppu::BaseMutex, 57 public PresenterNotesViewInterfaceBase, 58 public CachablePresenterView 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 70 /** Typically called from setCurrentSlide() with the notes page that is 71 associated with the slide given to setCurrentSlide(). 72 73 Iterates over all text shapes on the given notes page and displays 74 the concatenated text of these. 75 */ 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; 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; 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: */ 157