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 _CPPCANVAS_SPRITECANVAS_HXX 29 #define _CPPCANVAS_SPRITECANVAS_HXX 30 31 #include <sal/types.h> 32 #include <osl/diagnose.h> 33 #include <basegfx/vector/b2dsize.hxx> 34 35 #include <boost/shared_ptr.hpp> 36 37 38 #include <cppcanvas/bitmapcanvas.hxx> 39 #include <cppcanvas/sprite.hxx> 40 #include <cppcanvas/customsprite.hxx> 41 42 namespace com { namespace sun { namespace star { namespace rendering 43 { 44 class XSpriteCanvas; 45 } } } } 46 47 48 /* Definition of SpriteCanvas */ 49 50 namespace cppcanvas 51 { 52 class SpriteCanvas; 53 54 // forward declaration, since cloneSpriteCanvas() also references SpriteCanvas 55 typedef ::boost::shared_ptr< ::cppcanvas::SpriteCanvas > SpriteCanvasSharedPtr; 56 57 /** SpriteCanvas interface 58 */ 59 class SpriteCanvas : public virtual BitmapCanvas 60 { 61 public: 62 virtual bool updateScreen( bool bUpdateAll ) const = 0; 63 64 virtual CustomSpriteSharedPtr createCustomSprite( const ::basegfx::B2DSize& ) const = 0; 65 virtual SpriteSharedPtr createClonedSprite( const SpriteSharedPtr& ) const = 0; 66 67 // shared_ptr does not allow for covariant return types 68 SpriteCanvasSharedPtr cloneSpriteCanvas() const 69 { 70 SpriteCanvasSharedPtr p( ::boost::dynamic_pointer_cast< SpriteCanvas >(this->clone()) ); 71 OSL_ENSURE(p.get(), "SpriteCanvas::cloneSpriteCanvas(): dynamic cast failed"); 72 return p; 73 } 74 75 virtual ::com::sun::star::uno::Reference< 76 ::com::sun::star::rendering::XSpriteCanvas > getUNOSpriteCanvas() const = 0; 77 }; 78 79 } 80 81 #endif /* _CPPCANVAS_SPRITECANVAS_HXX */ 82