1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SD_PRESENTER_SLIDE_PREVIEW_HXX 29 #define SD_PRESENTER_SLIDE_PREVIEW_HXX 30 31 #include "PreviewRenderer.hxx" 32 #include <com/sun/star/drawing/XDrawPage.hpp> 33 #include <com/sun/star/drawing/XSlideRenderer.hpp> 34 #include <com/sun/star/lang/XInitialization.hpp> 35 #include <com/sun/star/rendering/XSpriteCanvas.hpp> 36 #include <cppuhelper/basemutex.hxx> 37 #include <cppuhelper/compbase2.hxx> 38 #include <boost/noncopyable.hpp> 39 40 namespace css = ::com::sun::star; 41 42 namespace sd { namespace presenter { 43 44 namespace { 45 typedef ::cppu::WeakComponentImplHelper2 < 46 css::drawing::XSlideRenderer, 47 css::lang::XInitialization 48 > SlideRendererInterfaceBase; 49 } 50 51 52 /** Render single slides into bitmaps. 53 */ 54 class SlideRenderer 55 : private ::boost::noncopyable, 56 protected ::cppu::BaseMutex, 57 public SlideRendererInterfaceBase 58 { 59 public: 60 explicit SlideRenderer (const css::uno::Reference<css::uno::XComponentContext>& rxContext); 61 virtual ~SlideRenderer (void); 62 virtual void SAL_CALL disposing (void); 63 64 65 // XInitialization 66 67 virtual void SAL_CALL initialize (const css::uno::Sequence<css::uno::Any>& rArguments) 68 throw (css::uno::Exception, css::uno::RuntimeException); 69 70 71 // XSlideRenderer 72 73 virtual css::uno::Reference<css::awt::XBitmap> SAL_CALL createPreview ( 74 const ::css::uno::Reference<css::drawing::XDrawPage>& rxSlide, 75 const css::awt::Size& rMaximumPreviewPixelSize, 76 sal_Int16 nSuperSampleFactor) 77 throw (css::uno::RuntimeException); 78 79 virtual css::uno::Reference<css::rendering::XBitmap> SAL_CALL createPreviewForCanvas ( 80 const ::css::uno::Reference<css::drawing::XDrawPage>& rxSlide, 81 const css::awt::Size& rMaximumPreviewPixelSize, 82 sal_Int16 nSuperSampleFactor, 83 const ::css::uno::Reference<css::rendering::XCanvas>& rxCanvas) 84 throw (css::uno::RuntimeException); 85 86 virtual css::awt::Size SAL_CALL calculatePreviewSize ( 87 double nSlideAspectRatio, 88 const css::awt::Size& rMaximumPreviewPixelSize) 89 throw (css::uno::RuntimeException); 90 91 private: 92 PreviewRenderer maPreviewRenderer; 93 94 BitmapEx CreatePreview ( 95 const ::css::uno::Reference<css::drawing::XDrawPage>& rxSlide, 96 const css::awt::Size& rMaximumPreviewPixelSize, 97 sal_Int16 nSuperSampleFactor) 98 throw (css::uno::RuntimeException); 99 100 /** This method throws a DisposedException when the object has already been 101 disposed. 102 */ 103 void ThrowIfDisposed (void) throw (css::lang::DisposedException); 104 }; 105 106 } } // end of namespace ::sd::presenter 107 108 #endif 109