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_PRESENTERHELPVIEW_HXX 21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERHELPVIEW_HXX 22 23 #include "PresenterController.hxx" 24 #include <cppuhelper/basemutex.hxx> 25 #include <cppuhelper/compbase.hxx> 26 #include <com/sun/star/awt/XPaintListener.hpp> 27 #include <com/sun/star/awt/XWindowListener.hpp> 28 #include <com/sun/star/drawing/framework/XView.hpp> 29 #include <com/sun/star/drawing/framework/XResourceId.hpp> 30 #include <com/sun/star/frame/XController.hpp> 31 #include <memory> 32 33 namespace sdext::presenter { 34 35 class PresenterButton; 36 37 typedef cppu::WeakComponentImplHelper< 38 css::drawing::framework::XView, 39 css::awt::XWindowListener, 40 css::awt::XPaintListener 41 > PresenterHelpViewInterfaceBase; 42 43 /** Show help text that describes the defined keys. 44 */ 45 class PresenterHelpView 46 : private ::cppu::BaseMutex, 47 public PresenterHelpViewInterfaceBase 48 { 49 public: 50 explicit PresenterHelpView ( 51 const css::uno::Reference<css::uno::XComponentContext>& rxContext, 52 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 53 const css::uno::Reference<css::frame::XController>& rxController, 54 const ::rtl::Reference<PresenterController>& rpPresenterController); 55 virtual ~PresenterHelpView() override; 56 57 virtual void SAL_CALL disposing() override; 58 59 // lang::XEventListener 60 61 virtual void SAL_CALL 62 disposing (const css::lang::EventObject& rEventObject) override; 63 64 // XWindowListener 65 66 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override; 67 68 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override; 69 70 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override; 71 72 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override; 73 74 // XPaintListener 75 76 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override; 77 78 // XResourceId 79 80 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId() override; 81 82 virtual sal_Bool SAL_CALL isAnchorOnly() override; 83 84 private: 85 class TextContainer; 86 87 css::uno::Reference<css::uno::XComponentContext> mxComponentContext; 88 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId; 89 css::uno::Reference<css::drawing::framework::XPane> mxPane; 90 css::uno::Reference<css::awt::XWindow> mxWindow; 91 css::uno::Reference<css::rendering::XCanvas> mxCanvas; 92 ::rtl::Reference<PresenterController> mpPresenterController; 93 PresenterTheme::SharedFontDescriptor mpFont; 94 std::unique_ptr<TextContainer> mpTextContainer; 95 ::rtl::Reference<PresenterButton> mpCloseButton; 96 sal_Int32 mnSeparatorY; 97 sal_Int32 mnMaximalWidth; 98 99 void ProvideCanvas(); 100 void Resize(); 101 void Paint (const css::awt::Rectangle& rRedrawArea); 102 void ReadHelpStrings(); 103 void ProcessString ( 104 const css::uno::Reference<css::beans::XPropertySet>& rsProperties); 105 106 /** Find a font size, so that all text can be displayed at the same 107 time. 108 */ 109 void CheckFontSize(); 110 111 /** @throws css::lang::DisposedException when the object has already been 112 disposed. 113 */ 114 void ThrowIfDisposed(); 115 }; 116 117 } // end of namespace ::sdext::presenter 118 119 #endif 120 121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 122