Update ooo320-m1
[ooovba.git] / sdext / source / presenter / PresenterSlidePreview.hxx
blob908fc88649ac864aaf8860dd18c07d2e462a0456
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: PresenterSlidePreview.hxx,v $
11 * $Revision: 1.3 $
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_SLIDE_PREVIEW_HXX
33 #define SDEXT_PRESENTER_SLIDE_PREVIEW_HXX
35 #include "PresenterController.hxx"
37 #include <boost/noncopyable.hpp>
38 #include <com/sun/star/awt/XBitmap.hpp>
39 #include <com/sun/star/awt/XDisplayBitmap.hpp>
40 #include <com/sun/star/awt/XPaintListener.hpp>
41 #include <com/sun/star/awt/XWindowListener.hpp>
42 #include <com/sun/star/drawing/XDrawPage.hpp>
43 #include <com/sun/star/drawing/XDrawView.hpp>
44 #include <com/sun/star/drawing/XSlideRenderer.hpp>
45 #include <com/sun/star/drawing/framework/XPane.hpp>
46 #include <com/sun/star/drawing/framework/XView.hpp>
47 #include <com/sun/star/lang/DisposedException.hpp>
48 #include <com/sun/star/uno/XComponentContext.hpp>
49 #include <cppuhelper/basemutex.hxx>
50 #include <cppuhelper/compbase4.hxx>
51 #include <rtl/ref.hxx>
53 namespace css = ::com::sun::star;
55 namespace sdext { namespace presenter {
57 namespace {
58 typedef ::cppu::WeakComponentImplHelper4 <
59 css::drawing::framework::XView,
60 css::drawing::XDrawView,
61 css::awt::XPaintListener,
62 css::awt::XWindowListener
63 > PresenterSlidePreviewInterfaceBase;
67 /** Static preview of a slide. Typically used for the preview of the next
68 slide.
69 This implementation shows a preview of the slide given to the
70 setCurrentSlide. For showing the next slide the PresenterViewFactory
71 uses a derived class that overloads the setCurrentSlide() method.
73 class PresenterSlidePreview
74 : private ::boost::noncopyable,
75 private ::cppu::BaseMutex,
76 public PresenterSlidePreviewInterfaceBase
78 public:
79 PresenterSlidePreview (
80 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
81 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
82 const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane,
83 const ::rtl::Reference<PresenterController>& rpPresenterController);
84 virtual ~PresenterSlidePreview (void);
85 virtual void SAL_CALL disposing (void);
88 // XResourceId
90 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void)
91 throw (css::uno::RuntimeException);
93 virtual sal_Bool SAL_CALL isAnchorOnly (void)
94 throw (com::sun::star::uno::RuntimeException);
96 // XWindowListener
98 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent)
99 throw (css::uno::RuntimeException);
101 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent)
102 throw (css::uno::RuntimeException);
104 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent)
105 throw (css::uno::RuntimeException);
107 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent)
108 throw (css::uno::RuntimeException);
111 // XPaintListener
113 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent)
114 throw (css::uno::RuntimeException);
117 // lang::XEventListener
118 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
119 throw (css::uno::RuntimeException);
122 // XDrawView
124 virtual void SAL_CALL setCurrentPage (
125 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide)
126 throw (css::uno::RuntimeException);
128 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void)
129 throw (css::uno::RuntimeException);
131 protected:
132 ::rtl::Reference<PresenterController> mpPresenterController;
134 private:
135 css::uno::Reference<css::drawing::framework::XPane> mxPane;
136 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
137 css::uno::Reference<css::drawing::XSlideRenderer> mxPreviewRenderer;
139 /** This Image holds the preview of the current slide. After resize
140 requests the image may be empty. This results eventually in a call
141 to ProvideSlide() in order to created a preview in the correct new
142 size.
144 css::uno::Reference<css::rendering::XBitmap> mxPreview;
146 /** The current slide for which a preview is displayed. This may or
147 may not be the same as the current slide of the PresenterView.
149 css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
150 double mnSlideAspectRatio;
152 css::uno::Reference<css::awt::XWindow> mxWindow;
153 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
155 /** Set the given slide as the current slide of the called PresenterSlidePreview
156 object.
158 void SetSlide (const css::uno::Reference<css::drawing::XDrawPage>& rxPage);
160 /** Paint the preview of the current slide centered in the window of the
161 anchor pane.
163 void Paint (const css::awt::Rectangle& rBoundingBox);
165 /** React to a resize of the anchor pane.
167 void Resize (void);
169 /** This method throws a DisposedException when the object has already been
170 disposed.
172 void ThrowIfDisposed (void) throw (css::lang::DisposedException);
175 } } // end of namespace ::sd::presenter
177 #endif