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_NOTES_VIEW2_HXX 29 #define SDEXT_PRESENTER_NOTES_VIEW2_HXX 30 31 #include "PresenterController.hxx" 32 #include "PresenterToolBar.hxx" 33 #include "PresenterViewFactory.hxx" 34 #include <cppuhelper/basemutex.hxx> 35 #include <cppuhelper/compbase5.hxx> 36 #include <com/sun/star/awt/ActionEvent.hpp> 37 #include <com/sun/star/awt/XActionListener.hpp> 38 #include <com/sun/star/awt/XButton.hpp> 39 #include <com/sun/star/awt/XControl.hpp> 40 #include <com/sun/star/awt/XTextComponent.hpp> 41 #include <com/sun/star/awt/XWindowListener.hpp> 42 #include <com/sun/star/drawing/XDrawPage.hpp> 43 #include <com/sun/star/drawing/XDrawView.hpp> 44 #include <com/sun/star/drawing/framework/XView.hpp> 45 #include <com/sun/star/drawing/framework/XResourceId.hpp> 46 #include <com/sun/star/frame/XController.hpp> 47 #include <rtl/ref.hxx> 48 #include <boost/shared_ptr.hpp> 49 50 namespace css = ::com::sun::star; 51 52 namespace { 53 typedef cppu::WeakComponentImplHelper5< 54 css::awt::XWindowListener, 55 css::awt::XPaintListener, 56 css::drawing::framework::XView, 57 css::drawing::XDrawView, 58 css::awt::XKeyListener 59 > PresenterNotesViewInterfaceBase; 60 } 61 62 namespace sdext { namespace presenter { 63 64 class PresenterButton; 65 class PresenterScrollBar; 66 class PresenterTextView; 67 68 69 /** A drawing framework view of the notes of a slide. At the moment this is 70 a simple text view that does not show the original formatting of the 71 notes text. 72 */ 73 class PresenterNotesView 74 : private ::cppu::BaseMutex, 75 public PresenterNotesViewInterfaceBase, 76 public CachablePresenterView 77 { 78 public: 79 explicit PresenterNotesView ( 80 const css::uno::Reference<css::uno::XComponentContext>& rxContext, 81 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 82 const css::uno::Reference<css::frame::XController>& rxController, 83 const ::rtl::Reference<PresenterController>& rpPresenterController); 84 virtual ~PresenterNotesView (void); 85 86 virtual void SAL_CALL disposing (void); 87 88 /** Typically called from setCurrentSlide() with the notes page that is 89 associed with the slide given to setCurrentSlide(). 90 91 Iterates over all text shapes on the given notes page and diplays 92 the concatenated text of these. 93 */ 94 void SetSlide ( 95 const css::uno::Reference<css::drawing::XDrawPage>& rxNotesPage); 96 97 void ChangeFontSize (const sal_Int32 nSizeChange); 98 99 ::boost::shared_ptr<PresenterTextView> GetTextView (void) const; 100 101 102 // lang::XEventListener 103 104 virtual void SAL_CALL 105 disposing (const css::lang::EventObject& rEventObject) 106 throw (css::uno::RuntimeException); 107 108 109 // XWindowListener 110 111 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) 112 throw (css::uno::RuntimeException); 113 114 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) 115 throw (css::uno::RuntimeException); 116 117 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) 118 throw (css::uno::RuntimeException); 119 120 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) 121 throw (css::uno::RuntimeException); 122 123 124 // XPaintListener 125 126 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) 127 throw (css::uno::RuntimeException); 128 129 130 // XResourceId 131 132 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void) 133 throw (css::uno::RuntimeException); 134 135 virtual sal_Bool SAL_CALL isAnchorOnly (void) 136 throw (com::sun::star::uno::RuntimeException); 137 138 139 // XDrawView 140 141 virtual void SAL_CALL setCurrentPage ( 142 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) 143 throw (css::uno::RuntimeException); 144 145 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void) 146 throw (css::uno::RuntimeException); 147 148 149 // XKeyListener 150 151 virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent) 152 throw (css::uno::RuntimeException); 153 virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent) 154 throw (css::uno::RuntimeException); 155 156 private: 157 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId; 158 ::rtl::Reference<PresenterController> mpPresenterController; 159 css::uno::Reference<css::awt::XWindow> mxParentWindow; 160 css::uno::Reference<css::rendering::XCanvas> mxCanvas; 161 css::uno::Reference<css::drawing::XDrawPage> mxCurrentNotesPage; 162 ::rtl::Reference<PresenterScrollBar> mpScrollBar; 163 css::uno::Reference<css::awt::XWindow> mxToolBarWindow; 164 css::uno::Reference<css::rendering::XCanvas> mxToolBarCanvas; 165 ::rtl::Reference<PresenterToolBar> mpToolBar; 166 ::rtl::Reference<PresenterButton> mpCloseButton; 167 css::util::Color maSeparatorColor; 168 sal_Int32 mnSeparatorYLocation; 169 css::geometry::RealRectangle2D maTextBoundingBox; 170 SharedBitmapDescriptor mpBackground; 171 double mnTop; 172 PresenterTheme::SharedFontDescriptor mpFont; 173 ::boost::shared_ptr<PresenterTextView> mpTextView; 174 175 void CreateToolBar ( 176 const css::uno::Reference<css::uno::XComponentContext>& rxContext, 177 const ::rtl::Reference<PresenterController>& rpPresenterController); 178 void Layout (void); 179 void Paint (const css::awt::Rectangle& rUpdateBox); 180 void PaintToolBar (const css::awt::Rectangle& rUpdateBox); 181 void PaintText (const css::awt::Rectangle& rUpdateBox); 182 void Invalidate (void); 183 void Scroll (const double nDistance); 184 void SetTop (const double nTop); 185 void UpdateScrollBar (void); 186 void MoveCaret (const sal_Int32 nDistance); 187 188 /** This method throws a DisposedException when the object has already been 189 disposed. 190 */ 191 void ThrowIfDisposed (void) 192 throw (css::lang::DisposedException); 193 }; 194 195 } } // end of namespace ::sdext::presenter 196 197 #endif 198