1*06bcd5d2SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*06bcd5d2SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*06bcd5d2SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*06bcd5d2SAndrew Rist * distributed with this work for additional information 6*06bcd5d2SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*06bcd5d2SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*06bcd5d2SAndrew Rist * "License"); you may not use this file except in compliance 9*06bcd5d2SAndrew Rist * with the License. You may obtain a copy of the License at 10*06bcd5d2SAndrew Rist * 11*06bcd5d2SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*06bcd5d2SAndrew Rist * 13*06bcd5d2SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*06bcd5d2SAndrew Rist * software distributed under the License is distributed on an 15*06bcd5d2SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*06bcd5d2SAndrew Rist * KIND, either express or implied. See the License for the 17*06bcd5d2SAndrew Rist * specific language governing permissions and limitations 18*06bcd5d2SAndrew Rist * under the License. 19*06bcd5d2SAndrew Rist * 20*06bcd5d2SAndrew Rist *************************************************************/ 21*06bcd5d2SAndrew Rist 22*06bcd5d2SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SDEXT_PRESENTER_SLIDE_PREVIEW_HXX 25cdf0e10cSrcweir #define SDEXT_PRESENTER_SLIDE_PREVIEW_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "PresenterController.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <boost/noncopyable.hpp> 30cdf0e10cSrcweir #include <com/sun/star/awt/XBitmap.hpp> 31cdf0e10cSrcweir #include <com/sun/star/awt/XDisplayBitmap.hpp> 32cdf0e10cSrcweir #include <com/sun/star/awt/XPaintListener.hpp> 33cdf0e10cSrcweir #include <com/sun/star/awt/XWindowListener.hpp> 34cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp> 35cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawView.hpp> 36cdf0e10cSrcweir #include <com/sun/star/drawing/XSlideRenderer.hpp> 37cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XPane.hpp> 38cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XView.hpp> 39cdf0e10cSrcweir #include <com/sun/star/lang/DisposedException.hpp> 40cdf0e10cSrcweir #include <com/sun/star/uno/XComponentContext.hpp> 41cdf0e10cSrcweir #include <cppuhelper/basemutex.hxx> 42cdf0e10cSrcweir #include <cppuhelper/compbase4.hxx> 43cdf0e10cSrcweir #include <rtl/ref.hxx> 44cdf0e10cSrcweir 45cdf0e10cSrcweir namespace css = ::com::sun::star; 46cdf0e10cSrcweir 47cdf0e10cSrcweir namespace sdext { namespace presenter { 48cdf0e10cSrcweir 49cdf0e10cSrcweir namespace { 50cdf0e10cSrcweir typedef ::cppu::WeakComponentImplHelper4 < 51cdf0e10cSrcweir css::drawing::framework::XView, 52cdf0e10cSrcweir css::drawing::XDrawView, 53cdf0e10cSrcweir css::awt::XPaintListener, 54cdf0e10cSrcweir css::awt::XWindowListener 55cdf0e10cSrcweir > PresenterSlidePreviewInterfaceBase; 56cdf0e10cSrcweir } 57cdf0e10cSrcweir 58cdf0e10cSrcweir 59cdf0e10cSrcweir /** Static preview of a slide. Typically used for the preview of the next 60cdf0e10cSrcweir slide. 61cdf0e10cSrcweir This implementation shows a preview of the slide given to the 62cdf0e10cSrcweir setCurrentSlide. For showing the next slide the PresenterViewFactory 63cdf0e10cSrcweir uses a derived class that overloads the setCurrentSlide() method. 64cdf0e10cSrcweir */ 65cdf0e10cSrcweir class PresenterSlidePreview 66cdf0e10cSrcweir : private ::boost::noncopyable, 67cdf0e10cSrcweir private ::cppu::BaseMutex, 68cdf0e10cSrcweir public PresenterSlidePreviewInterfaceBase 69cdf0e10cSrcweir { 70cdf0e10cSrcweir public: 71cdf0e10cSrcweir PresenterSlidePreview ( 72cdf0e10cSrcweir const css::uno::Reference<css::uno::XComponentContext>& rxContext, 73cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId, 74cdf0e10cSrcweir const css::uno::Reference<css::drawing::framework::XPane>& rxAnchorPane, 75cdf0e10cSrcweir const ::rtl::Reference<PresenterController>& rpPresenterController); 76cdf0e10cSrcweir virtual ~PresenterSlidePreview (void); 77cdf0e10cSrcweir virtual void SAL_CALL disposing (void); 78cdf0e10cSrcweir 79cdf0e10cSrcweir 80cdf0e10cSrcweir // XResourceId 81cdf0e10cSrcweir 82cdf0e10cSrcweir virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId (void) 83cdf0e10cSrcweir throw (css::uno::RuntimeException); 84cdf0e10cSrcweir 85cdf0e10cSrcweir virtual sal_Bool SAL_CALL isAnchorOnly (void) 86cdf0e10cSrcweir throw (com::sun::star::uno::RuntimeException); 87cdf0e10cSrcweir 88cdf0e10cSrcweir // XWindowListener 89cdf0e10cSrcweir 90cdf0e10cSrcweir virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) 91cdf0e10cSrcweir throw (css::uno::RuntimeException); 92cdf0e10cSrcweir 93cdf0e10cSrcweir virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) 94cdf0e10cSrcweir throw (css::uno::RuntimeException); 95cdf0e10cSrcweir 96cdf0e10cSrcweir virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) 97cdf0e10cSrcweir throw (css::uno::RuntimeException); 98cdf0e10cSrcweir 99cdf0e10cSrcweir virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) 100cdf0e10cSrcweir throw (css::uno::RuntimeException); 101cdf0e10cSrcweir 102cdf0e10cSrcweir 103cdf0e10cSrcweir // XPaintListener 104cdf0e10cSrcweir 105cdf0e10cSrcweir virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) 106cdf0e10cSrcweir throw (css::uno::RuntimeException); 107cdf0e10cSrcweir 108cdf0e10cSrcweir 109cdf0e10cSrcweir // lang::XEventListener 110cdf0e10cSrcweir virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) 111cdf0e10cSrcweir throw (css::uno::RuntimeException); 112cdf0e10cSrcweir 113cdf0e10cSrcweir 114cdf0e10cSrcweir // XDrawView 115cdf0e10cSrcweir 116cdf0e10cSrcweir virtual void SAL_CALL setCurrentPage ( 117cdf0e10cSrcweir const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) 118cdf0e10cSrcweir throw (css::uno::RuntimeException); 119cdf0e10cSrcweir 120cdf0e10cSrcweir virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage (void) 121cdf0e10cSrcweir throw (css::uno::RuntimeException); 122cdf0e10cSrcweir 123cdf0e10cSrcweir protected: 124cdf0e10cSrcweir ::rtl::Reference<PresenterController> mpPresenterController; 125cdf0e10cSrcweir 126cdf0e10cSrcweir private: 127cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XPane> mxPane; 128cdf0e10cSrcweir css::uno::Reference<css::drawing::framework::XResourceId> mxViewId; 129cdf0e10cSrcweir css::uno::Reference<css::drawing::XSlideRenderer> mxPreviewRenderer; 130cdf0e10cSrcweir 131cdf0e10cSrcweir /** This Image holds the preview of the current slide. After resize 132cdf0e10cSrcweir requests the image may be empty. This results eventually in a call 133cdf0e10cSrcweir to ProvideSlide() in order to created a preview in the correct new 134cdf0e10cSrcweir size. 135cdf0e10cSrcweir */ 136cdf0e10cSrcweir css::uno::Reference<css::rendering::XBitmap> mxPreview; 137cdf0e10cSrcweir 138cdf0e10cSrcweir /** The current slide for which a preview is displayed. This may or 139cdf0e10cSrcweir may not be the same as the current slide of the PresenterView. 140cdf0e10cSrcweir */ 141cdf0e10cSrcweir css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide; 142cdf0e10cSrcweir double mnSlideAspectRatio; 143cdf0e10cSrcweir 144cdf0e10cSrcweir css::uno::Reference<css::awt::XWindow> mxWindow; 145cdf0e10cSrcweir css::uno::Reference<css::rendering::XCanvas> mxCanvas; 146cdf0e10cSrcweir 147cdf0e10cSrcweir /** Set the given slide as the current slide of the called PresenterSlidePreview 148cdf0e10cSrcweir object. 149cdf0e10cSrcweir */ 150cdf0e10cSrcweir void SetSlide (const css::uno::Reference<css::drawing::XDrawPage>& rxPage); 151cdf0e10cSrcweir 152cdf0e10cSrcweir /** Paint the preview of the current slide centered in the window of the 153cdf0e10cSrcweir anchor pane. 154cdf0e10cSrcweir */ 155cdf0e10cSrcweir void Paint (const css::awt::Rectangle& rBoundingBox); 156cdf0e10cSrcweir 157cdf0e10cSrcweir /** React to a resize of the anchor pane. 158cdf0e10cSrcweir */ 159cdf0e10cSrcweir void Resize (void); 160cdf0e10cSrcweir 161cdf0e10cSrcweir /** This method throws a DisposedException when the object has already been 162cdf0e10cSrcweir disposed. 163cdf0e10cSrcweir */ 164cdf0e10cSrcweir void ThrowIfDisposed (void) throw (css::lang::DisposedException); 165cdf0e10cSrcweir }; 166cdf0e10cSrcweir 167cdf0e10cSrcweir } } // end of namespace ::sd::presenter 168cdf0e10cSrcweir 169cdf0e10cSrcweir #endif 170