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: PresenterSlideSorter.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_PRESENTER_SLIDE_SORTER_HXX
33 #define SDEXT_PRESENTER_PRESENTER_SLIDE_SORTER_HXX
35 #include "PresenterController.hxx"
36 #include "PresenterPaneContainer.hxx"
37 #include "PresenterViewFactory.hxx"
38 #include <cppuhelper/basemutex.hxx>
39 #include <cppuhelper/compbase8.hxx>
40 #include <com/sun/star/awt/XPaintListener.hpp>
41 #include <com/sun/star/awt/XWindowListener.hpp>
42 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
43 #include <com/sun/star/drawing/XDrawView.hpp>
44 #include <com/sun/star/drawing/XSlidePreviewCache.hpp>
45 #include <com/sun/star/drawing/framework/XView.hpp>
46 #include <com/sun/star/drawing/framework/XResourceId.hpp>
47 #include <com/sun/star/frame/XController.hpp>
48 #include <com/sun/star/geometry/RealRectangle2D.hpp>
49 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
50 #include <com/sun/star/rendering/XSprite.hpp>
51 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
53 namespace css
= ::com::sun::star
;
56 typedef cppu::WeakComponentImplHelper8
<
57 css::drawing::framework::XView
,
58 css::awt::XWindowListener
,
59 css::awt::XPaintListener
,
60 css::beans::XPropertyChangeListener
,
61 css::drawing::XSlidePreviewCacheListener
,
62 css::awt::XMouseListener
,
63 css::awt::XMouseMotionListener
,
64 css::drawing::XDrawView
65 > PresenterSlideSorterInterfaceBase
;
68 namespace sdext
{ namespace presenter
{
70 class PresenterButton
;
71 class PresenterScrollBar
;
73 /** A simple slide sorter for the presenter screen. It uses a preview cache
74 to create the slide previews. Painting is done via a canvas.
76 class PresenterSlideSorter
77 : private ::cppu::BaseMutex
,
78 public PresenterSlideSorterInterfaceBase
,
79 public CachablePresenterView
82 PresenterSlideSorter (
83 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
,
84 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxViewId
,
85 const css::uno::Reference
<css::frame::XController
>& rxController
,
86 const ::rtl::Reference
<PresenterController
>& rpPresenterController
);
87 virtual ~PresenterSlideSorter (void);
89 virtual void SAL_CALL
disposing (void);
91 void SetActiveState (const bool bIsActive
);
94 // lang::XEventListener
97 disposing (const css::lang::EventObject
& rEventObject
)
98 throw (css::uno::RuntimeException
);
103 virtual void SAL_CALL
windowResized (const css::awt::WindowEvent
& rEvent
)
104 throw (css::uno::RuntimeException
);
106 virtual void SAL_CALL
windowMoved (const css::awt::WindowEvent
& rEvent
)
107 throw (css::uno::RuntimeException
);
109 virtual void SAL_CALL
windowShown (const css::lang::EventObject
& rEvent
)
110 throw (css::uno::RuntimeException
);
112 virtual void SAL_CALL
windowHidden (const css::lang::EventObject
& rEvent
)
113 throw (css::uno::RuntimeException
);
118 virtual void SAL_CALL
windowPaint (const css::awt::PaintEvent
& rEvent
)
119 throw (css::uno::RuntimeException
);
124 virtual void SAL_CALL
mousePressed (const css::awt::MouseEvent
& rEvent
)
125 throw(css::uno::RuntimeException
);
127 virtual void SAL_CALL
mouseReleased (const css::awt::MouseEvent
& rEvent
)
128 throw(css::uno::RuntimeException
);
130 virtual void SAL_CALL
mouseEntered (const css::awt::MouseEvent
& rEvent
)
131 throw(css::uno::RuntimeException
);
133 virtual void SAL_CALL
mouseExited (const css::awt::MouseEvent
& rEvent
)
134 throw(css::uno::RuntimeException
);
137 // XMouseMotionListener
139 virtual void SAL_CALL
mouseMoved (const css::awt::MouseEvent
& rEvent
)
140 throw (css::uno::RuntimeException
);
142 virtual void SAL_CALL
mouseDragged (const css::awt::MouseEvent
& rEvent
)
143 throw (css::uno::RuntimeException
);
148 virtual css::uno::Reference
<css::drawing::framework::XResourceId
> SAL_CALL
getResourceId (void)
149 throw (css::uno::RuntimeException
);
151 virtual sal_Bool SAL_CALL
isAnchorOnly (void)
152 throw (com::sun::star::uno::RuntimeException
);
155 // XPropertyChangeListener
157 virtual void SAL_CALL
propertyChange (
158 const css::beans::PropertyChangeEvent
& rEvent
)
159 throw(css::uno::RuntimeException
);
162 // XSlidePreviewCacheListener
164 virtual void SAL_CALL
notifyPreviewCreation (
165 sal_Int32 nSlideIndex
)
166 throw(css::uno::RuntimeException
);
171 virtual void SAL_CALL
setCurrentPage (
172 const css::uno::Reference
<css::drawing::XDrawPage
>& rxSlide
)
173 throw (css::uno::RuntimeException
);
175 virtual css::uno::Reference
<css::drawing::XDrawPage
> SAL_CALL
getCurrentPage (void)
176 throw (css::uno::RuntimeException
);
179 css::uno::Reference
<css::uno::XComponentContext
> mxComponentContext
;
180 css::uno::Reference
<css::drawing::framework::XResourceId
> mxViewId
;
181 css::uno::Reference
<css::drawing::framework::XPane
> mxPane
;
182 css::uno::Reference
<css::rendering::XCanvas
> mxCanvas
;
183 css::uno::Reference
<css::awt::XWindow
> mxWindow
;
184 ::rtl::Reference
<PresenterController
> mpPresenterController
;
185 css::uno::Reference
<css::presentation::XSlideShowController
> mxSlideShowController
;
186 css::uno::Reference
<css::drawing::XSlidePreviewCache
> mxPreviewCache
;
187 bool mbIsPaintPending
;
188 bool mbIsLayoutPending
;
190 ::boost::shared_ptr
<Layout
> mpLayout
;
191 ::rtl::Reference
<PresenterScrollBar
> mpHorizontalScrollBar
;
192 ::rtl::Reference
<PresenterScrollBar
> mpVerticalScrollBar
;
193 ::rtl::Reference
<PresenterButton
> mpCloseButton
;
194 class MouseOverManager
;
195 ::boost::scoped_ptr
<MouseOverManager
> mpMouseOverManager
;
196 sal_Int32 mnSlideIndexMousePressed
;
197 sal_Int32 mnCurrentSlideIndex
;
198 sal_Int32 mnSeparatorY
;
199 css::util::Color maSeparatorColor
;
200 css::awt::Point maCloseButtonCenter
;
201 css::awt::Rectangle maCurrentSlideFrameBoundingBox
;
202 class CurrentSlideFrameRenderer
;
203 ::boost::shared_ptr
<CurrentSlideFrameRenderer
> mpCurrentSlideFrameRenderer
;
204 css::uno::Reference
<css::rendering::XPolyPolygon2D
> mxPreviewFrame
;
206 void UpdateLayout (void);
207 css::geometry::RealRectangle2D
PlaceScrollBars (
208 const css::geometry::RealRectangle2D
& rUpperBox
);
209 void PlaceCloseButton (
210 const PresenterPaneContainer::SharedPaneDescriptor
& rpPane
,
211 const css::awt::Rectangle
& rCenterBox
,
212 const sal_Int32 nLeftFrameWidth
);
213 void ClearBackground (
214 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
215 const css::awt::Rectangle
& rRedrawArea
);
216 double GetSlideAspectRatio (void) const;
217 css::uno::Reference
<css::rendering::XBitmap
> GetPreview (const sal_Int32 nSlideIndex
);
219 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
220 const css::awt::Rectangle
& rUpdateBox
,
221 const sal_Int32 nSlideIndex
);
222 void Paint (const css::awt::Rectangle
& rUpdateBox
);
223 void SetHorizontalOffset (const double nXOffset
);
224 void SetVerticalOffset (const double nYOffset
);
225 void GotoSlide (const sal_Int32 nSlideIndex
);
226 bool ProvideCanvas (void);
228 /** This method throws a DisposedException when the object has already been
231 void ThrowIfDisposed (void)
232 throw (css::lang::DisposedException
);
235 } } // end of namespace ::sdext::presenter