1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SDEXT_PRESENTER_HELP_VIEW_HXX 29 #define SDEXT_PRESENTER_HELP_VIEW_HXX 30 31 #include "PresenterController.hxx" 32 #include <cppuhelper/basemutex.hxx> 33 #include <cppuhelper/compbase3.hxx> 34 #include <com/sun/star/awt/XPaintListener.hpp> 35 #include <com/sun/star/awt/XWindowListener.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 <com/sun/star/rendering/XSpriteCanvas.hpp> 40 41 namespace css = ::com::sun::star; 42 43 namespace { 44 typedef cppu::WeakComponentImplHelper3< 45 css::drawing::framework::XView, 46 css::awt::XWindowListener, 47 css::awt::XPaintListener 48 > PresenterHelpViewInterfaceBase; 49 } 50 51 namespace sdext { namespace presenter { 52 53 class PresenterButton; 54 55 /** Show help text that describes the defined keys. 56 */ 57 class PresenterHelpView 58 : private ::cppu::BaseMutex, 59 public PresenterHelpViewInterfaceBase 60 { 61 public: 62 explicit PresenterHelpView ( 63 const css::uno::Reference<css::uno::XComponentContext>& rxContext, 64 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 65 const css::uno::Reference<css::frame::XController>& rxController, 66 const ::rtl::Reference<PresenterController>& rpPresenterController); 67 virtual ~PresenterHelpView (void); 68 69 virtual void SAL_CALL disposing (void); 70 71 // lang::XEventListener 72 73 virtual void SAL_CALL 74 disposing (const css::lang::EventObject& rEventObject) 75 throw (css::uno::RuntimeException); 76 77 78 // XWindowListener 79 80 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) 81 throw (css::uno::RuntimeException); 82 83 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) 84 throw (css::uno::RuntimeException); 85 86 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) 87 throw (css::uno::RuntimeException); 88 89 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) 90 throw (css::uno::RuntimeException); 91 92 93 // XPaintListener 94 95 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) 96 throw (css::uno::RuntimeException); 97 98 99 // XResourceId 100 101 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void) 102 throw (css::uno::RuntimeException); 103 104 virtual sal_Bool SAL_CALL isAnchorOnly (void) 105 throw (com::sun::star::uno::RuntimeException); 106 107 private: 108 class TextContainer; 109 110 css::uno::Reference<css::uno::XComponentContext> mxComponentContext; 111 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId; 112 css::uno::Reference<css::drawing::framework::XPane> mxPane; 113 css::uno::Reference<css::awt::XWindow> mxWindow; 114 css::uno::Reference<css::rendering::XCanvas> mxCanvas; 115 ::rtl::Reference<PresenterController> mpPresenterController; 116 PresenterTheme::SharedFontDescriptor mpFont; 117 ::boost::scoped_ptr<TextContainer> mpTextContainer; 118 ::rtl::Reference<PresenterButton> mpCloseButton; 119 sal_Int32 mnSeparatorY; 120 sal_Int32 mnMaximalWidth; 121 122 void ProvideCanvas (void); 123 void Resize (void); 124 void Paint (const css::awt::Rectangle& rRedrawArea); 125 void ReadHelpStrings (void); 126 void ProcessString ( 127 const css::uno::Reference<css::beans::XPropertySet>& rsProperties); 128 129 /** Find a font size, so that all text can be displayed at the same 130 time. 131 */ 132 void CheckFontSize (void); 133 134 /** This method throws a DisposedException when the object has already been 135 disposed. 136 */ 137 void ThrowIfDisposed (void) 138 throw (css::lang::DisposedException); 139 }; 140 141 } } // end of namespace ::sdext::presenter 142 143 #endif 144