1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef SDEXT_PRESENTER_SLIDE_SHOW_VIEW_HXX
29*cdf0e10cSrcweir #define SDEXT_PRESENTER_SLIDE_SHOW_VIEW_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "PresenterViewFactory.hxx"
32*cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShowView.hpp>
33*cdf0e10cSrcweir #include <com/sun/star/awt/XPaintListener.hpp>
34*cdf0e10cSrcweir #include <com/sun/star/awt/XMouseListener.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/awt/XMouseMotionListener.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/awt/XPointer.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/awt/XWindowListener.hpp>
38*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XResourceId.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XView.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/frame/XController.hpp>
43*cdf0e10cSrcweir #include <com/sun/star/presentation/XSlideShowController.hpp>
44*cdf0e10cSrcweir #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
45*cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp>
46*cdf0e10cSrcweir #include <com/sun/star/util/Color.hpp>
47*cdf0e10cSrcweir #include <cppuhelper/compbase7.hxx>
48*cdf0e10cSrcweir #include <cppuhelper/interfacecontainer.hxx>
49*cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx>
50*cdf0e10cSrcweir #include <boost/noncopyable.hpp>
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir namespace css = ::com::sun::star;
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir namespace sdext { namespace presenter {
55*cdf0e10cSrcweir 
56*cdf0e10cSrcweir namespace {
57*cdf0e10cSrcweir     typedef cppu::WeakComponentImplHelper7<
58*cdf0e10cSrcweir         css::presentation::XSlideShowView,
59*cdf0e10cSrcweir         css::awt::XPaintListener,
60*cdf0e10cSrcweir         css::awt::XMouseListener,
61*cdf0e10cSrcweir         css::awt::XMouseMotionListener,
62*cdf0e10cSrcweir         css::awt::XWindowListener,
63*cdf0e10cSrcweir         css::drawing::framework::XView,
64*cdf0e10cSrcweir         css::drawing::XDrawView
65*cdf0e10cSrcweir         > PresenterSlideShowViewInterfaceBase;
66*cdf0e10cSrcweir }
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir /** Life view in a secondary windo of a full screen slide show.
69*cdf0e10cSrcweir */
70*cdf0e10cSrcweir class PresenterSlideShowView
71*cdf0e10cSrcweir     : private ::boost::noncopyable,
72*cdf0e10cSrcweir       protected ::cppu::BaseMutex,
73*cdf0e10cSrcweir       public PresenterSlideShowViewInterfaceBase,
74*cdf0e10cSrcweir       public CachablePresenterView
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir public:
77*cdf0e10cSrcweir     PresenterSlideShowView (
78*cdf0e10cSrcweir         const css::uno::Reference<css::uno::XComponentContext>& rxContext,
79*cdf0e10cSrcweir         const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
80*cdf0e10cSrcweir         const css::uno::Reference<css::frame::XController>& rxController,
81*cdf0e10cSrcweir         const ::rtl::Reference<PresenterController>& rpPresenterController);
82*cdf0e10cSrcweir     virtual ~PresenterSlideShowView (void);
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir     void LateInit (void);
85*cdf0e10cSrcweir     virtual void SAL_CALL disposing (void);
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir     // CachablePresenterView
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir     virtual void ReleaseView (void);
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir 
93*cdf0e10cSrcweir     // XSlideShowView
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir     virtual css::uno::Reference<
96*cdf0e10cSrcweir         css::rendering::XSpriteCanvas > SAL_CALL getCanvas (void)
97*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir     virtual void SAL_CALL clear (void)
100*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     virtual css::geometry::AffineMatrix2D SAL_CALL getTransformation (void)
103*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir     virtual void SAL_CALL addTransformationChangedListener(
106*cdf0e10cSrcweir         const css::uno::Reference<
107*cdf0e10cSrcweir             css::util::XModifyListener >& xListener)
108*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir     virtual void SAL_CALL removeTransformationChangedListener(
111*cdf0e10cSrcweir         const css::uno::Reference<
112*cdf0e10cSrcweir             css::util::XModifyListener >& xListener)
113*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     virtual void SAL_CALL addPaintListener(
116*cdf0e10cSrcweir         const css::uno::Reference<
117*cdf0e10cSrcweir             css::awt::XPaintListener >& xListener)
118*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir     virtual void SAL_CALL removePaintListener(
121*cdf0e10cSrcweir         const css::uno::Reference<
122*cdf0e10cSrcweir             css::awt::XPaintListener >& xListener)
123*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir     virtual void SAL_CALL addMouseListener(
126*cdf0e10cSrcweir         const css::uno::Reference<
127*cdf0e10cSrcweir             css::awt::XMouseListener >& xListener)
128*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir     virtual void SAL_CALL removeMouseListener(
131*cdf0e10cSrcweir         const css::uno::Reference<
132*cdf0e10cSrcweir             css::awt::XMouseListener >& xListener)
133*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir     virtual void SAL_CALL addMouseMotionListener(
136*cdf0e10cSrcweir         const css::uno::Reference<
137*cdf0e10cSrcweir             css::awt::XMouseMotionListener >& xListener)
138*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir     virtual void SAL_CALL removeMouseMotionListener(
141*cdf0e10cSrcweir         const css::uno::Reference<
142*cdf0e10cSrcweir             css::awt::XMouseMotionListener >& xListener)
143*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir     virtual void SAL_CALL setMouseCursor(::sal_Int16 nPointerShape)
146*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir     virtual ::com::sun::star::awt::Rectangle SAL_CALL getCanvasArea(  )
149*cdf0e10cSrcweir 	throw (::com::sun::star::uno::RuntimeException);
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir     // lang::XEventListener
152*cdf0e10cSrcweir     virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
153*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir     // XPaintListener
157*cdf0e10cSrcweir     virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent)
158*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir     // XMouseListener
162*cdf0e10cSrcweir     virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent)
163*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir     virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent)
166*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir     virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent)
169*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir     virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent)
172*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir     // XMouseMotionListener
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir     virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent)
178*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir     virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent)
181*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir     // XWindowListener
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir     virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
187*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir     virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
190*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir     virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
193*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir     virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
196*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir     // XView
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir     virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL
202*cdf0e10cSrcweir         getResourceId (void)
203*cdf0e10cSrcweir         throw(css::uno::RuntimeException);
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isAnchorOnly (void)
206*cdf0e10cSrcweir         throw (com::sun::star::uno::RuntimeException);
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir     // XDrawView
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     virtual void SAL_CALL setCurrentPage (
212*cdf0e10cSrcweir         const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
213*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir     virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void)
216*cdf0e10cSrcweir         throw (css::uno::RuntimeException);
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir     // CachablePresenterView
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir     virtual void ActivatePresenterView (void);
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir     virtual void DeactivatePresenterView (void);
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir private:
226*cdf0e10cSrcweir     css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
227*cdf0e10cSrcweir     ::rtl::Reference<PresenterController> mpPresenterController;
228*cdf0e10cSrcweir     css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
229*cdf0e10cSrcweir     css::uno::Reference<css::frame::XController> mxController;
230*cdf0e10cSrcweir     css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
231*cdf0e10cSrcweir     css::uno::Reference<css::presentation::XSlideShow> mxSlideShow;
232*cdf0e10cSrcweir     css::uno::Reference<css::rendering::XCanvas> mxCanvas;
233*cdf0e10cSrcweir     css::uno::Reference<css::rendering::XCanvas> mxViewCanvas;
234*cdf0e10cSrcweir     css::uno::Reference<css::awt::XPointer> mxPointer;
235*cdf0e10cSrcweir     css::uno::Reference<css::awt::XWindow> mxWindow;
236*cdf0e10cSrcweir     css::uno::Reference<css::awt::XWindow> mxViewWindow;
237*cdf0e10cSrcweir     css::uno::Reference<css::drawing::framework::XPane> mxTopPane;
238*cdf0e10cSrcweir     css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
239*cdf0e10cSrcweir     css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon1;
240*cdf0e10cSrcweir     css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon2;
241*cdf0e10cSrcweir     bool mbIsViewAdded;
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir     /** Aspect ratio of the current slide.
244*cdf0e10cSrcweir     */
245*cdf0e10cSrcweir     double mnPageAspectRatio;
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir     /** This broadcast helper is used to notify listeners registed to a
248*cdf0e10cSrcweir         SlideShowView object.
249*cdf0e10cSrcweir     */
250*cdf0e10cSrcweir     ::cppu::OBroadcastHelper maBroadcaster;
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir     SharedBitmapDescriptor mpBackground;
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir     bool mbIsInModifyNotification;
255*cdf0e10cSrcweir     bool mbIsForcedPaintPending;
256*cdf0e10cSrcweir     bool mbIsPaintPending;
257*cdf0e10cSrcweir     ::rtl::OUString msClickToExitPresentationText;
258*cdf0e10cSrcweir     ::rtl::OUString msClickToExitPresentationTitle;
259*cdf0e10cSrcweir     ::rtl::OUString msTitleTemplate;
260*cdf0e10cSrcweir     bool mbIsEndSlideVisible;
261*cdf0e10cSrcweir     css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir     /** Create the window into which the slide show will render its
264*cdf0e10cSrcweir         content.  This window has the correct aspect ratio and is displayed centered
265*cdf0e10cSrcweir         and as large as possible in its parent window.
266*cdf0e10cSrcweir     */
267*cdf0e10cSrcweir     css::uno::Reference<css::awt::XWindow> CreateViewWindow (
268*cdf0e10cSrcweir         const css::uno::Reference<css::awt::XWindow>& rxParentWindow) const;
269*cdf0e10cSrcweir     css::uno::Reference<css::rendering::XCanvas> CreateViewCanvas (
270*cdf0e10cSrcweir         const css::uno::Reference<css::awt::XWindow>& rxWindow) const;
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir     void Resize (void);
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir     void PaintOuterWindow (const css::awt::Rectangle& rRepaintBox);
275*cdf0e10cSrcweir     void PaintInnerWindow (const css::awt::PaintEvent& rEvent);
276*cdf0e10cSrcweir     void PaintEndSlide (const css::awt::Rectangle& rRepaintBox);
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir     /** The slide show relies on the back buffer of the canvas not being
279*cdf0e10cSrcweir         modified.  With a shared canvas there are times when that can not be
280*cdf0e10cSrcweir         guaranteed.
281*cdf0e10cSrcweir         Call this method when the back buffer may have changed its content,
282*cdf0e10cSrcweir         like when the window has been moved but not resized.
283*cdf0e10cSrcweir     */
284*cdf0e10cSrcweir     void ForceRepaint (void);
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir     void CreateBackgroundPolygons (void);
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir     /** This method throws a DisposedException when the object has already been
289*cdf0e10cSrcweir         disposed.
290*cdf0e10cSrcweir     */
291*cdf0e10cSrcweir     void ThrowIfDisposed (void)
292*cdf0e10cSrcweir         throw (css::lang::DisposedException);
293*cdf0e10cSrcweir };
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir } } // end of namespace ::sd::presenter
296*cdf0e10cSrcweir 
297*cdf0e10cSrcweir #endif
298