1*06bcd5d2SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*06bcd5d2SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*06bcd5d2SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*06bcd5d2SAndrew Rist  * distributed with this work for additional information
6*06bcd5d2SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*06bcd5d2SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*06bcd5d2SAndrew Rist  * "License"); you may not use this file except in compliance
9*06bcd5d2SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*06bcd5d2SAndrew Rist  *
11*06bcd5d2SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*06bcd5d2SAndrew Rist  *
13*06bcd5d2SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*06bcd5d2SAndrew Rist  * software distributed under the License is distributed on an
15*06bcd5d2SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*06bcd5d2SAndrew Rist  * KIND, either express or implied.  See the License for the
17*06bcd5d2SAndrew Rist  * specific language governing permissions and limitations
18*06bcd5d2SAndrew Rist  * under the License.
19*06bcd5d2SAndrew Rist  *
20*06bcd5d2SAndrew Rist  *************************************************************/
21*06bcd5d2SAndrew Rist 
22*06bcd5d2SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SDEXT_PRESENTER_NOTES_VIEW2_HXX
25cdf0e10cSrcweir #define SDEXT_PRESENTER_NOTES_VIEW2_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "PresenterController.hxx"
28cdf0e10cSrcweir #include "PresenterToolBar.hxx"
29cdf0e10cSrcweir #include "PresenterViewFactory.hxx"
30cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx>
31cdf0e10cSrcweir #include <cppuhelper/compbase5.hxx>
32cdf0e10cSrcweir #include <com/sun/star/awt/ActionEvent.hpp>
33cdf0e10cSrcweir #include <com/sun/star/awt/XActionListener.hpp>
34cdf0e10cSrcweir #include <com/sun/star/awt/XButton.hpp>
35cdf0e10cSrcweir #include <com/sun/star/awt/XControl.hpp>
36cdf0e10cSrcweir #include <com/sun/star/awt/XTextComponent.hpp>
37cdf0e10cSrcweir #include <com/sun/star/awt/XWindowListener.hpp>
38cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp>
39cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp>
40cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XView.hpp>
41cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XResourceId.hpp>
42cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp>
43cdf0e10cSrcweir #include <rtl/ref.hxx>
44cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir namespace css = ::com::sun::star;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir namespace {
49cdf0e10cSrcweir     typedef cppu::WeakComponentImplHelper5<
50cdf0e10cSrcweir         css::awt::XWindowListener,
51cdf0e10cSrcweir         css::awt::XPaintListener,
52cdf0e10cSrcweir         css::drawing::framework::XView,
53cdf0e10cSrcweir         css::drawing::XDrawView,
54cdf0e10cSrcweir         css::awt::XKeyListener
55cdf0e10cSrcweir         > PresenterNotesViewInterfaceBase;
56cdf0e10cSrcweir }
57cdf0e10cSrcweir 
58cdf0e10cSrcweir namespace sdext { namespace presenter {
59cdf0e10cSrcweir 
60cdf0e10cSrcweir class PresenterButton;
61cdf0e10cSrcweir class PresenterScrollBar;
62cdf0e10cSrcweir class PresenterTextView;
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
65cdf0e10cSrcweir /** A drawing framework view of the notes of a slide.  At the moment this is
66cdf0e10cSrcweir     a simple text view that does not show the original formatting of the
67cdf0e10cSrcweir     notes text.
68cdf0e10cSrcweir */
69cdf0e10cSrcweir class PresenterNotesView
70cdf0e10cSrcweir     : private ::cppu::BaseMutex,
71cdf0e10cSrcweir       public PresenterNotesViewInterfaceBase,
72cdf0e10cSrcweir       public CachablePresenterView
73cdf0e10cSrcweir {
74cdf0e10cSrcweir public:
75cdf0e10cSrcweir     explicit PresenterNotesView (
76cdf0e10cSrcweir         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
77cdf0e10cSrcweir         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
78cdf0e10cSrcweir         const css::uno::Reference<css::frame::XController>& rxController,
79cdf0e10cSrcweir         const ::rtl::Reference<PresenterController>& rpPresenterController);
80cdf0e10cSrcweir     virtual ~PresenterNotesView (void);
81cdf0e10cSrcweir 
82cdf0e10cSrcweir     virtual void SAL_CALL disposing (void);
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     /** Typically called from setCurrentSlide() with the notes page that is
85cdf0e10cSrcweir         associed with the slide given to setCurrentSlide().
86cdf0e10cSrcweir 
87cdf0e10cSrcweir         Iterates over all text shapes on the given notes page and diplays
88cdf0e10cSrcweir         the concatenated text of these.
89cdf0e10cSrcweir     */
90cdf0e10cSrcweir     void SetSlide (
91cdf0e10cSrcweir         const css::uno::Reference<css::drawing::XDrawPage>& rxNotesPage);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     void ChangeFontSize (const sal_Int32 nSizeChange);
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     ::boost::shared_ptr<PresenterTextView> GetTextView (void) const;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 
98cdf0e10cSrcweir     // lang::XEventListener
99cdf0e10cSrcweir 
100cdf0e10cSrcweir     virtual void SAL_CALL
101cdf0e10cSrcweir         disposing (const css::lang::EventObject& rEventObject)
102cdf0e10cSrcweir         throw (css::uno::RuntimeException);
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     // XWindowListener
106cdf0e10cSrcweir 
107cdf0e10cSrcweir     virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
108cdf0e10cSrcweir         throw (css::uno::RuntimeException);
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
111cdf0e10cSrcweir         throw (css::uno::RuntimeException);
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
114cdf0e10cSrcweir         throw (css::uno::RuntimeException);
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
117cdf0e10cSrcweir         throw (css::uno::RuntimeException);
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     // XPaintListener
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent)
123cdf0e10cSrcweir         throw (css::uno::RuntimeException);
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 
126cdf0e10cSrcweir     // XResourceId
127cdf0e10cSrcweir 
128cdf0e10cSrcweir     virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
129cdf0e10cSrcweir         throw (css::uno::RuntimeException);
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isAnchorOnly (void)
132cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir 
135cdf0e10cSrcweir     // XDrawView
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     virtual void SAL_CALL setCurrentPage (
138cdf0e10cSrcweir         const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
139cdf0e10cSrcweir         throw (css::uno::RuntimeException);
140cdf0e10cSrcweir 
141cdf0e10cSrcweir     virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void)
142cdf0e10cSrcweir         throw (css::uno::RuntimeException);
143cdf0e10cSrcweir 
144cdf0e10cSrcweir 
145cdf0e10cSrcweir     // XKeyListener
146cdf0e10cSrcweir 
147cdf0e10cSrcweir     virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent)
148cdf0e10cSrcweir         throw (css::uno::RuntimeException);
149cdf0e10cSrcweir     virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent)
150cdf0e10cSrcweir         throw (css::uno::RuntimeException);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir private:
153cdf0e10cSrcweir     css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
154cdf0e10cSrcweir     ::rtl::Reference<PresenterController> mpPresenterController;
155cdf0e10cSrcweir     css::uno::Reference<css::awt::XWindow> mxParentWindow;
156cdf0e10cSrcweir     css::uno::Reference<css::rendering::XCanvas> mxCanvas;
157cdf0e10cSrcweir     css::uno::Reference<css::drawing::XDrawPage> mxCurrentNotesPage;
158cdf0e10cSrcweir     ::rtl::Reference<PresenterScrollBar> mpScrollBar;
159cdf0e10cSrcweir     css::uno::Reference<css::awt::XWindow> mxToolBarWindow;
160cdf0e10cSrcweir     css::uno::Reference<css::rendering::XCanvas> mxToolBarCanvas;
161cdf0e10cSrcweir     ::rtl::Reference<PresenterToolBar> mpToolBar;
162cdf0e10cSrcweir     ::rtl::Reference<PresenterButton> mpCloseButton;
163cdf0e10cSrcweir     css::util::Color maSeparatorColor;
164cdf0e10cSrcweir     sal_Int32 mnSeparatorYLocation;
165cdf0e10cSrcweir     css::geometry::RealRectangle2D maTextBoundingBox;
166cdf0e10cSrcweir     SharedBitmapDescriptor mpBackground;
167cdf0e10cSrcweir     double mnTop;
168cdf0e10cSrcweir     PresenterTheme::SharedFontDescriptor mpFont;
169cdf0e10cSrcweir     ::boost::shared_ptr<PresenterTextView> mpTextView;
170cdf0e10cSrcweir 
171cdf0e10cSrcweir     void CreateToolBar (
172cdf0e10cSrcweir         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
173cdf0e10cSrcweir         const ::rtl::Reference<PresenterController>& rpPresenterController);
174cdf0e10cSrcweir     void Layout (void);
175cdf0e10cSrcweir     void Paint (const css::awt::Rectangle& rUpdateBox);
176cdf0e10cSrcweir     void PaintToolBar (const css::awt::Rectangle& rUpdateBox);
177cdf0e10cSrcweir     void PaintText (const css::awt::Rectangle& rUpdateBox);
178cdf0e10cSrcweir     void Invalidate (void);
179cdf0e10cSrcweir     void Scroll (const double nDistance);
180cdf0e10cSrcweir     void SetTop (const double nTop);
181cdf0e10cSrcweir     void UpdateScrollBar (void);
182cdf0e10cSrcweir     void MoveCaret (const sal_Int32 nDistance);
183cdf0e10cSrcweir 
184cdf0e10cSrcweir     /** This method throws a DisposedException when the object has already been
185cdf0e10cSrcweir         disposed.
186cdf0e10cSrcweir     */
187cdf0e10cSrcweir     void ThrowIfDisposed (void)
188cdf0e10cSrcweir         throw (css::lang::DisposedException);
189cdf0e10cSrcweir };
190cdf0e10cSrcweir 
191cdf0e10cSrcweir } } // end of namespace ::sdext::presenter
192cdf0e10cSrcweir 
193cdf0e10cSrcweir #endif
194