fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sdext / source / presenter / PresenterSlidePreview.hxx
blobf3b2c8432083c94accef6432ae1eafdd4fd1f302
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_PRESENTERSLIDEPREVIEW_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSLIDEPREVIEW_HXX
23 #include "PresenterController.hxx"
25 #include <boost/noncopyable.hpp>
26 #include <com/sun/star/awt/XBitmap.hpp>
27 #include <com/sun/star/awt/XDisplayBitmap.hpp>
28 #include <com/sun/star/awt/XPaintListener.hpp>
29 #include <com/sun/star/awt/XWindowListener.hpp>
30 #include <com/sun/star/drawing/XDrawPage.hpp>
31 #include <com/sun/star/drawing/XDrawView.hpp>
32 #include <com/sun/star/drawing/XSlideRenderer.hpp>
33 #include <com/sun/star/drawing/framework/XPane.hpp>
34 #include <com/sun/star/drawing/framework/XView.hpp>
35 #include <com/sun/star/lang/DisposedException.hpp>
36 #include <com/sun/star/uno/XComponentContext.hpp>
37 #include <cppuhelper/basemutex.hxx>
38 #include <cppuhelper/compbase4.hxx>
39 #include <rtl/ref.hxx>
41 namespace sdext { namespace presenter {
43 namespace {
44 typedef ::cppu::WeakComponentImplHelper4 <
45 css::drawing::framework::XView,
46 css::drawing::XDrawView,
47 css::awt::XPaintListener,
48 css::awt::XWindowListener
49 > PresenterSlidePreviewInterfaceBase;
52 /** Static preview of a slide. Typically used for the preview of the next
53 slide.
54 This implementation shows a preview of the slide given to the
55 setCurrentSlide. For showing the next slide the PresenterViewFactory
56 uses a derived class that overrides the setCurrentSlide() method.
58 class PresenterSlidePreview
59 : private ::boost::noncopyable,
60 private ::cppu::BaseMutex,
61 public PresenterSlidePreviewInterfaceBase
63 public:
64 PresenterSlidePreview (
65 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
66 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
67 const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane,
68 const ::rtl::Reference<PresenterController>& rpPresenterController);
69 virtual ~PresenterSlidePreview();
70 virtual void SAL_CALL disposing() SAL_OVERRIDE;
72 // XResourceId
74 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId()
75 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
77 virtual sal_Bool SAL_CALL isAnchorOnly()
78 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
80 // XWindowListener
82 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
83 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
86 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
89 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
92 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 // XPaintListener
96 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent)
97 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 // lang::XEventListener
100 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
101 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 // XDrawView
105 virtual void SAL_CALL setCurrentPage (
106 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
107 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage()
110 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 protected:
113 ::rtl::Reference<PresenterController> mpPresenterController;
115 private:
116 css::uno::Reference<css::drawing::framework::XPane> mxPane;
117 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
118 css::uno::Reference<css::drawing::XSlideRenderer> mxPreviewRenderer;
120 /** This Image holds the preview of the current slide. After resize
121 requests the image may be empty. This results eventually in a call
122 to ProvideSlide() in order to created a preview in the correct new
123 size.
125 css::uno::Reference<css::rendering::XBitmap> mxPreview;
126 boost::shared_ptr<PresenterBitmapContainer> mpBitmaps;
128 /** The current slide for which a preview is displayed. This may or
129 may not be the same as the current slide of the PresenterView.
131 css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
132 double mnSlideAspectRatio;
134 css::uno::Reference<css::awt::XWindow> mxWindow;
135 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
137 /** Set the given slide as the current slide of the called PresenterSlidePreview
138 object.
140 void SetSlide (const css::uno::Reference<css::drawing::XDrawPage>& rxPage);
142 /** Paint the preview of the current slide centered in the window of the
143 anchor pane.
145 void Paint (const css::awt::Rectangle& rBoundingBox);
147 /** React to a resize of the anchor pane.
149 void Resize();
151 /** This method throws a DisposedException when the object has already been
152 disposed.
154 void ThrowIfDisposed() throw (css::lang::DisposedException);
157 } } // end of namespace ::sd::presenter
159 #endif
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */