1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterSlideShowView.hxx,v $
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_SLIDE_SHOW_VIEW_HXX
33 #define SDEXT_PRESENTER_SLIDE_SHOW_VIEW_HXX
35 #include "PresenterViewFactory.hxx"
36 #include <com/sun/star/presentation/XSlideShowView.hpp>
37 #include <com/sun/star/awt/XPaintListener.hpp>
38 #include <com/sun/star/awt/XMouseListener.hpp>
39 #include <com/sun/star/awt/XMouseMotionListener.hpp>
40 #include <com/sun/star/awt/XPointer.hpp>
41 #include <com/sun/star/awt/XWindowListener.hpp>
42 #include <com/sun/star/drawing/XDrawView.hpp>
43 #include <com/sun/star/drawing/framework/XPane.hpp>
44 #include <com/sun/star/drawing/framework/XResourceId.hpp>
45 #include <com/sun/star/drawing/framework/XView.hpp>
46 #include <com/sun/star/frame/XController.hpp>
47 #include <com/sun/star/presentation/XSlideShowController.hpp>
48 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
49 #include <com/sun/star/uno/XComponentContext.hpp>
50 #include <com/sun/star/util/Color.hpp>
51 #include <cppuhelper/compbase7.hxx>
52 #include <cppuhelper/interfacecontainer.hxx>
53 #include <cppuhelper/basemutex.hxx>
54 #include <boost/noncopyable.hpp>
56 namespace css
= ::com::sun::star
;
58 namespace sdext
{ namespace presenter
{
61 typedef cppu::WeakComponentImplHelper7
<
62 css::presentation::XSlideShowView
,
63 css::awt::XPaintListener
,
64 css::awt::XMouseListener
,
65 css::awt::XMouseMotionListener
,
66 css::awt::XWindowListener
,
67 css::drawing::framework::XView
,
68 css::drawing::XDrawView
69 > PresenterSlideShowViewInterfaceBase
;
72 /** Life view in a secondary windo of a full screen slide show.
74 class PresenterSlideShowView
75 : private ::boost::noncopyable
,
76 protected ::cppu::BaseMutex
,
77 public PresenterSlideShowViewInterfaceBase
,
78 public CachablePresenterView
81 PresenterSlideShowView (
82 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
,
83 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxViewId
,
84 const css::uno::Reference
<css::frame::XController
>& rxController
,
85 const ::rtl::Reference
<PresenterController
>& rpPresenterController
);
86 virtual ~PresenterSlideShowView (void);
89 virtual void SAL_CALL
disposing (void);
92 // CachablePresenterView
94 virtual void ReleaseView (void);
99 virtual css::uno::Reference
<
100 css::rendering::XSpriteCanvas
> SAL_CALL
getCanvas (void)
101 throw (css::uno::RuntimeException
);
103 virtual void SAL_CALL
clear (void)
104 throw (css::uno::RuntimeException
);
106 virtual css::geometry::AffineMatrix2D SAL_CALL
getTransformation (void)
107 throw (css::uno::RuntimeException
);
109 virtual void SAL_CALL
addTransformationChangedListener(
110 const css::uno::Reference
<
111 css::util::XModifyListener
>& xListener
)
112 throw (css::uno::RuntimeException
);
114 virtual void SAL_CALL
removeTransformationChangedListener(
115 const css::uno::Reference
<
116 css::util::XModifyListener
>& xListener
)
117 throw (css::uno::RuntimeException
);
119 virtual void SAL_CALL
addPaintListener(
120 const css::uno::Reference
<
121 css::awt::XPaintListener
>& xListener
)
122 throw (css::uno::RuntimeException
);
124 virtual void SAL_CALL
removePaintListener(
125 const css::uno::Reference
<
126 css::awt::XPaintListener
>& xListener
)
127 throw (css::uno::RuntimeException
);
129 virtual void SAL_CALL
addMouseListener(
130 const css::uno::Reference
<
131 css::awt::XMouseListener
>& xListener
)
132 throw (css::uno::RuntimeException
);
134 virtual void SAL_CALL
removeMouseListener(
135 const css::uno::Reference
<
136 css::awt::XMouseListener
>& xListener
)
137 throw (css::uno::RuntimeException
);
139 virtual void SAL_CALL
addMouseMotionListener(
140 const css::uno::Reference
<
141 css::awt::XMouseMotionListener
>& xListener
)
142 throw (css::uno::RuntimeException
);
144 virtual void SAL_CALL
removeMouseMotionListener(
145 const css::uno::Reference
<
146 css::awt::XMouseMotionListener
>& xListener
)
147 throw (css::uno::RuntimeException
);
149 virtual void SAL_CALL
setMouseCursor(::sal_Int16 nPointerShape
)
150 throw (css::uno::RuntimeException
);
152 virtual ::com::sun::star::awt::Rectangle SAL_CALL
getCanvasArea( )
153 throw (::com::sun::star::uno::RuntimeException
);
155 // lang::XEventListener
156 virtual void SAL_CALL
disposing (const css::lang::EventObject
& rEvent
)
157 throw (css::uno::RuntimeException
);
161 virtual void SAL_CALL
windowPaint (const css::awt::PaintEvent
& rEvent
)
162 throw (css::uno::RuntimeException
);
166 virtual void SAL_CALL
mousePressed (const css::awt::MouseEvent
& rEvent
)
167 throw (css::uno::RuntimeException
);
169 virtual void SAL_CALL
mouseReleased (const css::awt::MouseEvent
& rEvent
)
170 throw (css::uno::RuntimeException
);
172 virtual void SAL_CALL
mouseEntered (const css::awt::MouseEvent
& rEvent
)
173 throw (css::uno::RuntimeException
);
175 virtual void SAL_CALL
mouseExited (const css::awt::MouseEvent
& rEvent
)
176 throw (css::uno::RuntimeException
);
179 // XMouseMotionListener
181 virtual void SAL_CALL
mouseDragged (const css::awt::MouseEvent
& rEvent
)
182 throw (css::uno::RuntimeException
);
184 virtual void SAL_CALL
mouseMoved (const css::awt::MouseEvent
& rEvent
)
185 throw (css::uno::RuntimeException
);
190 virtual void SAL_CALL
windowResized (const css::awt::WindowEvent
& rEvent
)
191 throw (css::uno::RuntimeException
);
193 virtual void SAL_CALL
windowMoved (const css::awt::WindowEvent
& rEvent
)
194 throw (css::uno::RuntimeException
);
196 virtual void SAL_CALL
windowShown (const css::lang::EventObject
& rEvent
)
197 throw (css::uno::RuntimeException
);
199 virtual void SAL_CALL
windowHidden (const css::lang::EventObject
& rEvent
)
200 throw (css::uno::RuntimeException
);
205 virtual css::uno::Reference
<css::drawing::framework::XResourceId
> SAL_CALL
207 throw(css::uno::RuntimeException
);
209 virtual sal_Bool SAL_CALL
isAnchorOnly (void)
210 throw (com::sun::star::uno::RuntimeException
);
215 virtual void SAL_CALL
setCurrentPage (
216 const css::uno::Reference
<css::drawing::XDrawPage
>& rxSlide
)
217 throw (css::uno::RuntimeException
);
219 virtual css::uno::Reference
<css::drawing::XDrawPage
> SAL_CALL
getCurrentPage (void)
220 throw (css::uno::RuntimeException
);
223 // CachablePresenterView
225 virtual void ActivatePresenterView (void);
227 virtual void DeactivatePresenterView (void);
230 css::uno::Reference
<css::uno::XComponentContext
> mxComponentContext
;
231 ::rtl::Reference
<PresenterController
> mpPresenterController
;
232 css::uno::Reference
<css::drawing::framework::XResourceId
> mxViewId
;
233 css::uno::Reference
<css::frame::XController
> mxController
;
234 css::uno::Reference
<css::presentation::XSlideShowController
> mxSlideShowController
;
235 css::uno::Reference
<css::presentation::XSlideShow
> mxSlideShow
;
236 css::uno::Reference
<css::rendering::XCanvas
> mxCanvas
;
237 css::uno::Reference
<css::rendering::XCanvas
> mxViewCanvas
;
238 css::uno::Reference
<css::awt::XPointer
> mxPointer
;
239 css::uno::Reference
<css::awt::XWindow
> mxWindow
;
240 css::uno::Reference
<css::awt::XWindow
> mxViewWindow
;
241 css::uno::Reference
<css::drawing::framework::XPane
> mxTopPane
;
242 css::uno::Reference
<css::drawing::XPresenterHelper
> mxPresenterHelper
;
243 css::uno::Reference
<css::rendering::XPolyPolygon2D
> mxBackgroundPolygon1
;
244 css::uno::Reference
<css::rendering::XPolyPolygon2D
> mxBackgroundPolygon2
;
247 /** Aspect ratio of the current slide.
249 double mnPageAspectRatio
;
251 /** This broadcast helper is used to notify listeners registed to a
252 SlideShowView object.
254 ::cppu::OBroadcastHelper maBroadcaster
;
256 SharedBitmapDescriptor mpBackground
;
258 bool mbIsInModifyNotification
;
259 bool mbIsForcedPaintPending
;
260 bool mbIsPaintPending
;
261 ::rtl::OUString msClickToExitPresentationText
;
262 ::rtl::OUString msClickToExitPresentationTitle
;
263 ::rtl::OUString msTitleTemplate
;
264 bool mbIsEndSlideVisible
;
265 css::uno::Reference
<css::drawing::XDrawPage
> mxCurrentSlide
;
267 /** Create the window into which the slide show will render its
268 content. This window has the correct aspect ratio and is displayed centered
269 and as large as possible in its parent window.
271 css::uno::Reference
<css::awt::XWindow
> CreateViewWindow (
272 const css::uno::Reference
<css::awt::XWindow
>& rxParentWindow
) const;
273 css::uno::Reference
<css::rendering::XCanvas
> CreateViewCanvas (
274 const css::uno::Reference
<css::awt::XWindow
>& rxWindow
) const;
278 void PaintOuterWindow (const css::awt::Rectangle
& rRepaintBox
);
279 void PaintInnerWindow (const css::awt::PaintEvent
& rEvent
);
280 void PaintEndSlide (const css::awt::Rectangle
& rRepaintBox
);
282 /** The slide show relies on the back buffer of the canvas not being
283 modified. With a shared canvas there are times when that can not be
285 Call this method when the back buffer may have changed its content,
286 like when the window has been moved but not resized.
288 void ForceRepaint (void);
290 void CreateBackgroundPolygons (void);
292 /** This method throws a DisposedException when the object has already been
295 void ThrowIfDisposed (void)
296 throw (css::lang::DisposedException
);
299 } } // end of namespace ::sd::presenter