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 INCLUDED_SLIDESHOW_VIEWBACKGROUNDSHAPE_HXX 29 #define INCLUDED_SLIDESHOW_VIEWBACKGROUNDSHAPE_HXX 30 31 #include <com/sun/star/uno/Reference.hxx> 32 #include <com/sun/star/rendering/XBitmap.hpp> 33 34 #include <basegfx/range/b2drectangle.hxx> 35 #include <basegfx/matrix/b2dhommatrix.hxx> 36 #include <cppcanvas/spritecanvas.hxx> 37 38 #include <boost/shared_ptr.hpp> 39 #include <boost/utility.hpp> 40 41 #include "gdimtftools.hxx" 42 #include "viewlayer.hxx" 43 44 45 namespace slideshow 46 { 47 namespace internal 48 { 49 /** This class is the viewable representation of a draw 50 document's background, associated to a specific View 51 52 The class is able to render the associated background on 53 View implementations. 54 */ 55 class ViewBackgroundShape : private boost::noncopyable 56 { 57 public: 58 /** Create a ViewBackgroundShape for the given View 59 60 @param rView 61 The associated View object. 62 63 @param rShapeBounds 64 Bounds of the background shape, in document coordinate 65 system. 66 */ 67 ViewBackgroundShape( const ViewLayerSharedPtr& rViewLayer, 68 const ::basegfx::B2DRectangle& rShapeBounds ); 69 70 /** Query the associated view layer of this shape 71 */ 72 ViewLayerSharedPtr getViewLayer() const; 73 74 bool render( const GDIMetaFileSharedPtr& rMtf ) const; 75 76 private: 77 /** Prefetch bitmap for given canvas 78 */ 79 bool prefetch( const ::cppcanvas::CanvasSharedPtr& rDestinationCanvas, 80 const GDIMetaFileSharedPtr& rMtf ) const; 81 82 /** The view layer this object is part of. 83 */ 84 ViewLayerSharedPtr mpViewLayer; 85 86 /// Generated content bitmap, already with correct output size 87 mutable ::com::sun::star::uno::Reference< 88 ::com::sun::star::rendering::XBitmap > mxBitmap; 89 90 /// The last metafile a render object was generated for 91 mutable GDIMetaFileSharedPtr mpLastMtf; 92 93 /// The canvas, mpRenderer is associated with 94 mutable ::basegfx::B2DHomMatrix maLastTransformation; 95 96 const ::basegfx::B2DRectangle maBounds; 97 }; 98 99 typedef ::boost::shared_ptr< ViewBackgroundShape > ViewBackgroundShapeSharedPtr; 100 101 } 102 } 103 104 #endif /* INCLUDED_SLIDESHOW_VIEWBACKGROUNDSHAPE_HXX */ 105