vcl: allow for overriding the default PDF rendering resolution
[LibreOffice.git] / sdext / source / presenter / PresenterSlideSorter.hxx
blob3f5fb298ad7b77e9f883958e45edc48a3ab4f8d4
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>
40 namespace sdext { namespace presenter {
42 class PresenterButton;
43 class PresenterScrollBar;
45 typedef cppu::WeakComponentImplHelper<
46 css::drawing::framework::XView,
47 css::awt::XWindowListener,
48 css::awt::XPaintListener,
49 css::beans::XPropertyChangeListener,
50 css::drawing::XSlidePreviewCacheListener,
51 css::awt::XMouseListener,
52 css::awt::XMouseMotionListener,
53 css::drawing::XDrawView
54 > PresenterSlideSorterInterfaceBase;
56 /** A simple slide sorter for the presenter screen. It uses a preview cache
57 to create the slide previews. Painting is done via a canvas.
59 class PresenterSlideSorter
60 : private ::cppu::BaseMutex,
61 public PresenterSlideSorterInterfaceBase,
62 public CachablePresenterView
64 public:
65 PresenterSlideSorter (
66 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
67 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
68 const css::uno::Reference<css::frame::XController>& rxController,
69 const ::rtl::Reference<PresenterController>& rpPresenterController);
70 virtual ~PresenterSlideSorter() override;
72 virtual void SAL_CALL disposing() override;
74 // lang::XEventListener
76 virtual void SAL_CALL
77 disposing (const css::lang::EventObject& rEventObject) override;
79 // XWindowListener
81 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override;
83 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override;
85 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override;
87 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override;
89 // XPaintListener
91 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
93 // XMouseListener
95 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) override;
97 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) override;
99 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) override;
101 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) override;
103 // XMouseMotionListener
105 virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent) override;
107 virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent) override;
109 // XResourceId
111 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId() override;
113 virtual sal_Bool SAL_CALL isAnchorOnly() override;
115 // XPropertyChangeListener
117 virtual void SAL_CALL propertyChange (
118 const css::beans::PropertyChangeEvent& rEvent) override;
120 // XSlidePreviewCacheListener
122 virtual void SAL_CALL notifyPreviewCreation (
123 sal_Int32 nSlideIndex) override;
125 // XDrawView
127 virtual void SAL_CALL setCurrentPage (
128 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) override;
130 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override;
132 private:
133 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
134 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
135 css::uno::Reference<css::drawing::framework::XPane> mxPane;
136 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
137 css::uno::Reference<css::awt::XWindow> mxWindow;
138 ::rtl::Reference<PresenterController> mpPresenterController;
139 css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
140 css::uno::Reference<css::drawing::XSlidePreviewCache> mxPreviewCache;
141 bool mbIsLayoutPending;
142 class Layout;
143 std::shared_ptr<Layout> mpLayout;
144 ::rtl::Reference<PresenterScrollBar> mpVerticalScrollBar;
145 ::rtl::Reference<PresenterButton> mpCloseButton;
146 class MouseOverManager;
147 std::unique_ptr<MouseOverManager> mpMouseOverManager;
148 sal_Int32 mnSlideIndexMousePressed;
149 sal_Int32 mnCurrentSlideIndex;
150 sal_Int32 mnSeparatorY;
151 css::util::Color maSeparatorColor;
152 css::awt::Rectangle maCurrentSlideFrameBoundingBox;
153 class CurrentSlideFrameRenderer;
154 std::shared_ptr<CurrentSlideFrameRenderer> mpCurrentSlideFrameRenderer;
155 css::uno::Reference<css::rendering::XPolyPolygon2D> mxPreviewFrame;
157 void UpdateLayout();
158 css::geometry::RealRectangle2D PlaceScrollBars (
159 const css::geometry::RealRectangle2D& rUpperBox);
160 void PlaceCloseButton (
161 const PresenterPaneContainer::SharedPaneDescriptor& rpPane,
162 const css::awt::Rectangle& rCenterBox,
163 const sal_Int32 nLeftFrameWidth);
164 void ClearBackground (
165 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
166 const css::awt::Rectangle& rRedrawArea);
167 double GetSlideAspectRatio() const;
168 css::uno::Reference<css::rendering::XBitmap> GetPreview (const sal_Int32 nSlideIndex);
169 void PaintPreview (
170 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
171 const css::awt::Rectangle& rUpdateBox,
172 const sal_Int32 nSlideIndex);
173 void Paint (const css::awt::Rectangle& rUpdateBox);
174 void SetHorizontalOffset (const double nXOffset);
175 void SetVerticalOffset (const double nYOffset);
176 void GotoSlide (const sal_Int32 nSlideIndex);
177 bool ProvideCanvas();
179 /** @throws css::lang::DisposedException when the object has already been
180 disposed.
182 void ThrowIfDisposed();
185 } } // end of namespace ::sdext::presenter
187 #endif
189 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */