1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSLIDESORTER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSLIDESORTER_HXX
23 #include "PresenterController.hxx"
24 #include "PresenterPaneContainer.hxx"
25 #include "PresenterViewFactory.hxx"
26 #include <cppuhelper/basemutex.hxx>
27 #include <cppuhelper/compbase8.hxx>
28 #include <com/sun/star/awt/XPaintListener.hpp>
29 #include <com/sun/star/awt/XWindowListener.hpp>
30 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
31 #include <com/sun/star/drawing/XDrawView.hpp>
32 #include <com/sun/star/drawing/XSlidePreviewCache.hpp>
33 #include <com/sun/star/drawing/framework/XView.hpp>
34 #include <com/sun/star/drawing/framework/XResourceId.hpp>
35 #include <com/sun/star/frame/XController.hpp>
36 #include <com/sun/star/geometry/RealRectangle2D.hpp>
37 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
38 #include <com/sun/star/rendering/XSprite.hpp>
39 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
42 typedef cppu::WeakComponentImplHelper8
<
43 css::drawing::framework::XView
,
44 css::awt::XWindowListener
,
45 css::awt::XPaintListener
,
46 css::beans::XPropertyChangeListener
,
47 css::drawing::XSlidePreviewCacheListener
,
48 css::awt::XMouseListener
,
49 css::awt::XMouseMotionListener
,
50 css::drawing::XDrawView
51 > PresenterSlideSorterInterfaceBase
;
54 namespace sdext
{ namespace presenter
{
56 class PresenterButton
;
57 class PresenterScrollBar
;
59 /** A simple slide sorter for the presenter screen. It uses a preview cache
60 to create the slide previews. Painting is done via a canvas.
62 class PresenterSlideSorter
63 : private ::cppu::BaseMutex
,
64 public PresenterSlideSorterInterfaceBase
,
65 public CachablePresenterView
68 PresenterSlideSorter (
69 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
,
70 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxViewId
,
71 const css::uno::Reference
<css::frame::XController
>& rxController
,
72 const ::rtl::Reference
<PresenterController
>& rpPresenterController
);
73 virtual ~PresenterSlideSorter();
75 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
77 static void SetActiveState (const bool bIsActive
);
79 // lang::XEventListener
82 disposing (const css::lang::EventObject
& rEventObject
)
83 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
87 virtual void SAL_CALL
windowResized (const css::awt::WindowEvent
& rEvent
)
88 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 virtual void SAL_CALL
windowMoved (const css::awt::WindowEvent
& rEvent
)
91 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
93 virtual void SAL_CALL
windowShown (const css::lang::EventObject
& rEvent
)
94 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
96 virtual void SAL_CALL
windowHidden (const css::lang::EventObject
& rEvent
)
97 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
101 virtual void SAL_CALL
windowPaint (const css::awt::PaintEvent
& rEvent
)
102 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
106 virtual void SAL_CALL
mousePressed (const css::awt::MouseEvent
& rEvent
)
107 throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
109 virtual void SAL_CALL
mouseReleased (const css::awt::MouseEvent
& rEvent
)
110 throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
112 virtual void SAL_CALL
mouseEntered (const css::awt::MouseEvent
& rEvent
)
113 throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
115 virtual void SAL_CALL
mouseExited (const css::awt::MouseEvent
& rEvent
)
116 throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
118 // XMouseMotionListener
120 virtual void SAL_CALL
mouseMoved (const css::awt::MouseEvent
& rEvent
)
121 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
123 virtual void SAL_CALL
mouseDragged (const css::awt::MouseEvent
& rEvent
)
124 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 virtual css::uno::Reference
<css::drawing::framework::XResourceId
> SAL_CALL
getResourceId()
129 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
131 virtual sal_Bool SAL_CALL
isAnchorOnly()
132 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
134 // XPropertyChangeListener
136 virtual void SAL_CALL
propertyChange (
137 const css::beans::PropertyChangeEvent
& rEvent
)
138 throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
140 // XSlidePreviewCacheListener
142 virtual void SAL_CALL
notifyPreviewCreation (
143 sal_Int32 nSlideIndex
)
144 throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
148 virtual void SAL_CALL
setCurrentPage (
149 const css::uno::Reference
<css::drawing::XDrawPage
>& rxSlide
)
150 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
152 virtual css::uno::Reference
<css::drawing::XDrawPage
> SAL_CALL
getCurrentPage()
153 throw (css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
156 css::uno::Reference
<css::uno::XComponentContext
> mxComponentContext
;
157 css::uno::Reference
<css::drawing::framework::XResourceId
> mxViewId
;
158 css::uno::Reference
<css::drawing::framework::XPane
> mxPane
;
159 css::uno::Reference
<css::rendering::XCanvas
> mxCanvas
;
160 css::uno::Reference
<css::awt::XWindow
> mxWindow
;
161 ::rtl::Reference
<PresenterController
> mpPresenterController
;
162 css::uno::Reference
<css::presentation::XSlideShowController
> mxSlideShowController
;
163 css::uno::Reference
<css::drawing::XSlidePreviewCache
> mxPreviewCache
;
164 bool mbIsPaintPending
;
165 bool mbIsLayoutPending
;
167 ::boost::shared_ptr
<Layout
> mpLayout
;
168 ::rtl::Reference
<PresenterScrollBar
> mpVerticalScrollBar
;
169 ::rtl::Reference
<PresenterButton
> mpCloseButton
;
170 class MouseOverManager
;
171 ::boost::scoped_ptr
<MouseOverManager
> mpMouseOverManager
;
172 sal_Int32 mnSlideIndexMousePressed
;
173 sal_Int32 mnCurrentSlideIndex
;
174 sal_Int32 mnSeparatorY
;
175 css::util::Color maSeparatorColor
;
176 css::awt::Point maCloseButtonCenter
;
177 css::awt::Rectangle maCurrentSlideFrameBoundingBox
;
178 class CurrentSlideFrameRenderer
;
179 ::boost::shared_ptr
<CurrentSlideFrameRenderer
> mpCurrentSlideFrameRenderer
;
180 css::uno::Reference
<css::rendering::XPolyPolygon2D
> mxPreviewFrame
;
183 css::geometry::RealRectangle2D
PlaceScrollBars (
184 const css::geometry::RealRectangle2D
& rUpperBox
);
185 void PlaceCloseButton (
186 const PresenterPaneContainer::SharedPaneDescriptor
& rpPane
,
187 const css::awt::Rectangle
& rCenterBox
,
188 const sal_Int32 nLeftFrameWidth
);
189 void ClearBackground (
190 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
191 const css::awt::Rectangle
& rRedrawArea
);
192 double GetSlideAspectRatio() const;
193 css::uno::Reference
<css::rendering::XBitmap
> GetPreview (const sal_Int32 nSlideIndex
);
195 const css::uno::Reference
<css::rendering::XCanvas
>& rxCanvas
,
196 const css::awt::Rectangle
& rUpdateBox
,
197 const sal_Int32 nSlideIndex
);
198 void Paint (const css::awt::Rectangle
& rUpdateBox
);
199 void SetHorizontalOffset (const double nXOffset
);
200 void SetVerticalOffset (const double nYOffset
);
201 void GotoSlide (const sal_Int32 nSlideIndex
);
202 bool ProvideCanvas();
204 /** This method throws a DisposedException when the object has already been
207 void ThrowIfDisposed()
208 throw (css::lang::DisposedException
);
211 } } // end of namespace ::sdext::presenter
215 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */