merge the formfield patch from ooo-build
[ooovba.git] / sdext / source / presenter / PresenterNotesView.hxx
blob861b6a84a3e1bb6335bffdd8d34a71a6488650e4
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterNotesView.hxx,v $
11 * $Revision: 1.5 $
13 * This file is part of OpenOffice.org.
15 * OpenOffice.org is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU Lesser General Public License version 3
17 * only, as published by the Free Software Foundation.
19 * OpenOffice.org is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU Lesser General Public License version 3 for more details
23 * (a copy is included in the LICENSE file that accompanied this code).
25 * You should have received a copy of the GNU Lesser General Public License
26 * version 3 along with OpenOffice.org. If not, see
27 * <http://www.openoffice.org/license.html>
28 * for a copy of the LGPLv3 License.
30 ************************************************************************/
32 #ifndef SDEXT_PRESENTER_NOTES_VIEW2_HXX
33 #define SDEXT_PRESENTER_NOTES_VIEW2_HXX
35 #include "PresenterController.hxx"
36 #include "PresenterToolBar.hxx"
37 #include "PresenterViewFactory.hxx"
38 #include <cppuhelper/basemutex.hxx>
39 #include <cppuhelper/compbase5.hxx>
40 #include <com/sun/star/awt/ActionEvent.hpp>
41 #include <com/sun/star/awt/XActionListener.hpp>
42 #include <com/sun/star/awt/XButton.hpp>
43 #include <com/sun/star/awt/XControl.hpp>
44 #include <com/sun/star/awt/XTextComponent.hpp>
45 #include <com/sun/star/awt/XWindowListener.hpp>
46 #include <com/sun/star/drawing/XDrawPage.hpp>
47 #include <com/sun/star/drawing/XDrawView.hpp>
48 #include <com/sun/star/drawing/framework/XView.hpp>
49 #include <com/sun/star/drawing/framework/XResourceId.hpp>
50 #include <com/sun/star/frame/XController.hpp>
51 #include <rtl/ref.hxx>
52 #include <boost/shared_ptr.hpp>
54 namespace css = ::com::sun::star;
56 namespace {
57 typedef cppu::WeakComponentImplHelper5<
58 css::awt::XWindowListener,
59 css::awt::XPaintListener,
60 css::drawing::framework::XView,
61 css::drawing::XDrawView,
62 css::awt::XKeyListener
63 > PresenterNotesViewInterfaceBase;
66 namespace sdext { namespace presenter {
68 class PresenterButton;
69 class PresenterScrollBar;
70 class PresenterTextView;
73 /** A drawing framework view of the notes of a slide. At the moment this is
74 a simple text view that does not show the original formatting of the
75 notes text.
77 class PresenterNotesView
78 : private ::cppu::BaseMutex,
79 public PresenterNotesViewInterfaceBase,
80 public CachablePresenterView
82 public:
83 explicit PresenterNotesView (
84 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
85 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
86 const css::uno::Reference<css::frame::XController>& rxController,
87 const ::rtl::Reference<PresenterController>& rpPresenterController);
88 virtual ~PresenterNotesView (void);
90 virtual void SAL_CALL disposing (void);
92 /** Typically called from setCurrentSlide() with the notes page that is
93 associed with the slide given to setCurrentSlide().
95 Iterates over all text shapes on the given notes page and diplays
96 the concatenated text of these.
98 void SetSlide (
99 const css::uno::Reference<css::drawing::XDrawPage>& rxNotesPage);
101 void ChangeFontSize (const sal_Int32 nSizeChange);
103 ::boost::shared_ptr<PresenterTextView> GetTextView (void) const;
106 // lang::XEventListener
108 virtual void SAL_CALL
109 disposing (const css::lang::EventObject& rEventObject)
110 throw (css::uno::RuntimeException);
113 // XWindowListener
115 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
116 throw (css::uno::RuntimeException);
118 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
119 throw (css::uno::RuntimeException);
121 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
122 throw (css::uno::RuntimeException);
124 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
125 throw (css::uno::RuntimeException);
128 // XPaintListener
130 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent)
131 throw (css::uno::RuntimeException);
134 // XResourceId
136 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
137 throw (css::uno::RuntimeException);
139 virtual sal_Bool SAL_CALL isAnchorOnly (void)
140 throw (com::sun::star::uno::RuntimeException);
143 // XDrawView
145 virtual void SAL_CALL setCurrentPage (
146 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
147 throw (css::uno::RuntimeException);
149 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void)
150 throw (css::uno::RuntimeException);
153 // XKeyListener
155 virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent)
156 throw (css::uno::RuntimeException);
157 virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent)
158 throw (css::uno::RuntimeException);
160 private:
161 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
162 ::rtl::Reference<PresenterController> mpPresenterController;
163 css::uno::Reference<css::awt::XWindow> mxParentWindow;
164 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
165 css::uno::Reference<css::drawing::XDrawPage> mxCurrentNotesPage;
166 ::rtl::Reference<PresenterScrollBar> mpScrollBar;
167 css::uno::Reference<css::awt::XWindow> mxToolBarWindow;
168 css::uno::Reference<css::rendering::XCanvas> mxToolBarCanvas;
169 ::rtl::Reference<PresenterToolBar> mpToolBar;
170 ::rtl::Reference<PresenterButton> mpCloseButton;
171 css::util::Color maSeparatorColor;
172 sal_Int32 mnSeparatorYLocation;
173 css::geometry::RealRectangle2D maTextBoundingBox;
174 SharedBitmapDescriptor mpBackground;
175 double mnTop;
176 PresenterTheme::SharedFontDescriptor mpFont;
177 ::boost::shared_ptr<PresenterTextView> mpTextView;
179 void CreateToolBar (
180 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
181 const ::rtl::Reference<PresenterController>& rpPresenterController);
182 void Layout (void);
183 void Paint (const css::awt::Rectangle& rUpdateBox);
184 void PaintToolBar (const css::awt::Rectangle& rUpdateBox);
185 void PaintText (const css::awt::Rectangle& rUpdateBox);
186 void Invalidate (void);
187 void Scroll (const double nDistance);
188 void SetTop (const double nTop);
189 void UpdateScrollBar (void);
190 void MoveCaret (const sal_Int32 nDistance);
192 /** This method throws a DisposedException when the object has already been
193 disposed.
195 void ThrowIfDisposed (void)
196 throw (css::lang::DisposedException);
199 } } // end of namespace ::sdext::presenter
201 #endif