Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sdext / source / presenter / PresenterSlideSorter.hxx
blob24010e38e88a481a566b8d60a5665cc2ab8de78a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <memory>
24 #include "PresenterController.hxx"
25 #include "PresenterPaneContainer.hxx"
26 #include "PresenterViewFactory.hxx"
27 #include <cppuhelper/basemutex.hxx>
28 #include <cppuhelper/compbase.hxx>
29 #include <com/sun/star/awt/XPaintListener.hpp>
30 #include <com/sun/star/awt/XWindowListener.hpp>
31 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
32 #include <com/sun/star/drawing/XDrawView.hpp>
33 #include <com/sun/star/drawing/XSlidePreviewCache.hpp>
34 #include <com/sun/star/drawing/framework/XView.hpp>
35 #include <com/sun/star/drawing/framework/XResourceId.hpp>
36 #include <com/sun/star/frame/XController.hpp>
37 #include <com/sun/star/geometry/RealRectangle2D.hpp>
38 #include <com/sun/star/rendering/XPolyPolygon2D.hpp>
39 #include <com/sun/star/rendering/XSprite.hpp>
40 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
42 namespace sdext { namespace presenter {
44 class PresenterButton;
45 class PresenterScrollBar;
47 typedef cppu::WeakComponentImplHelper<
48 css::drawing::framework::XView,
49 css::awt::XWindowListener,
50 css::awt::XPaintListener,
51 css::beans::XPropertyChangeListener,
52 css::drawing::XSlidePreviewCacheListener,
53 css::awt::XMouseListener,
54 css::awt::XMouseMotionListener,
55 css::drawing::XDrawView
56 > PresenterSlideSorterInterfaceBase;
58 /** A simple slide sorter for the presenter screen. It uses a preview cache
59 to create the slide previews. Painting is done via a canvas.
61 class PresenterSlideSorter
62 : private ::cppu::BaseMutex,
63 public PresenterSlideSorterInterfaceBase,
64 public CachablePresenterView
66 public:
67 PresenterSlideSorter (
68 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
69 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
70 const css::uno::Reference<css::frame::XController>& rxController,
71 const ::rtl::Reference<PresenterController>& rpPresenterController);
72 virtual ~PresenterSlideSorter() override;
74 virtual void SAL_CALL disposing() override;
76 // lang::XEventListener
78 virtual void SAL_CALL
79 disposing (const css::lang::EventObject& rEventObject) override;
81 // XWindowListener
83 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override;
85 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override;
87 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override;
89 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override;
91 // XPaintListener
93 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
95 // XMouseListener
97 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) override;
99 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) override;
101 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) override;
103 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) override;
105 // XMouseMotionListener
107 virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent) override;
109 virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent) override;
111 // XResourceId
113 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId() override;
115 virtual sal_Bool SAL_CALL isAnchorOnly() override;
117 // XPropertyChangeListener
119 virtual void SAL_CALL propertyChange (
120 const css::beans::PropertyChangeEvent& rEvent) override;
122 // XSlidePreviewCacheListener
124 virtual void SAL_CALL notifyPreviewCreation (
125 sal_Int32 nSlideIndex) override;
127 // XDrawView
129 virtual void SAL_CALL setCurrentPage (
130 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) override;
132 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override;
134 private:
135 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
136 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
137 css::uno::Reference<css::drawing::framework::XPane> mxPane;
138 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
139 css::uno::Reference<css::awt::XWindow> mxWindow;
140 ::rtl::Reference<PresenterController> mpPresenterController;
141 css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
142 css::uno::Reference<css::drawing::XSlidePreviewCache> mxPreviewCache;
143 bool mbIsLayoutPending;
144 class Layout;
145 std::shared_ptr<Layout> mpLayout;
146 ::rtl::Reference<PresenterScrollBar> mpVerticalScrollBar;
147 ::rtl::Reference<PresenterButton> mpCloseButton;
148 class MouseOverManager;
149 std::unique_ptr<MouseOverManager> mpMouseOverManager;
150 sal_Int32 mnSlideIndexMousePressed;
151 sal_Int32 mnCurrentSlideIndex;
152 sal_Int32 mnSeparatorY;
153 css::util::Color maSeparatorColor;
154 css::awt::Rectangle maCurrentSlideFrameBoundingBox;
155 class CurrentSlideFrameRenderer;
156 std::shared_ptr<CurrentSlideFrameRenderer> mpCurrentSlideFrameRenderer;
157 css::uno::Reference<css::rendering::XPolyPolygon2D> mxPreviewFrame;
159 void UpdateLayout();
160 css::geometry::RealRectangle2D PlaceScrollBars (
161 const css::geometry::RealRectangle2D& rUpperBox);
162 void PlaceCloseButton (
163 const PresenterPaneContainer::SharedPaneDescriptor& rpPane,
164 const css::awt::Rectangle& rCenterBox,
165 const sal_Int32 nLeftFrameWidth);
166 void ClearBackground (
167 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
168 const css::awt::Rectangle& rRedrawArea);
169 double GetSlideAspectRatio() const;
170 css::uno::Reference<css::rendering::XBitmap> GetPreview (const sal_Int32 nSlideIndex);
171 void PaintPreview (
172 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
173 const css::awt::Rectangle& rUpdateBox,
174 const sal_Int32 nSlideIndex);
175 void Paint (const css::awt::Rectangle& rUpdateBox);
176 void SetHorizontalOffset (const double nXOffset);
177 void SetVerticalOffset (const double nYOffset);
178 void GotoSlide (const sal_Int32 nSlideIndex);
179 bool ProvideCanvas();
181 /** @throws css::lang::DisposedException when the object has already been
182 disposed.
184 void ThrowIfDisposed();
187 } } // end of namespace ::sdext::presenter
189 #endif
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */