xref: /trunk/main/cppcanvas/source/wrapper/implspritecanvas.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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_IMPLSPRITECANVAS_HXX
29 #define _CPPCANVAS_IMPLSPRITECANVAS_HXX
30 
31 #ifndef _COM_SUN_STAR_RENDERING_XSPRITECANVAS_HPP__
32 #include <com/sun/star/rendering/XSpriteCanvas.hpp>
33 #endif
34 #include <basegfx/vector/b2dsize.hxx>
35 #include <basegfx/matrix/b2dhommatrix.hxx>
36 
37 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
38 #include <boost/shared_ptr.hpp>
39 #endif
40 
41 
42 #include <cppcanvas/spritecanvas.hxx>
43 
44 #include <implbitmapcanvas.hxx>
45 
46 
47 namespace cppcanvas
48 {
49     namespace internal
50     {
51         class ImplSpriteCanvas : public virtual SpriteCanvas, protected virtual ImplBitmapCanvas
52         {
53         public:
54             ImplSpriteCanvas( const ::com::sun::star::uno::Reference<
55                                 ::com::sun::star::rendering::XSpriteCanvas >& rCanvas );
56             ImplSpriteCanvas(const ImplSpriteCanvas&);
57 
58             virtual ~ImplSpriteCanvas();
59 
60             virtual void                    setTransformation( const ::basegfx::B2DHomMatrix& rMatrix );
61 
62             virtual bool                    updateScreen( bool bUpdateAll ) const;
63 
64             virtual CustomSpriteSharedPtr   createCustomSprite( const ::basegfx::B2DSize& ) const;
65             virtual SpriteSharedPtr         createClonedSprite( const SpriteSharedPtr& ) const;
66 
67             SpriteSharedPtr                 createSpriteFromBitmaps(
68                 const ::com::sun::star::uno::Sequence<
69                     ::com::sun::star::uno::Reference<
70                         ::com::sun::star::rendering::XBitmap > >&   animationBitmaps,
71                 sal_Int8                                                    interpolationMode );
72 
73             virtual CanvasSharedPtr         clone() const;
74 
75             virtual ::com::sun::star::uno::Reference<
76                 ::com::sun::star::rendering::XSpriteCanvas >    getUNOSpriteCanvas() const;
77 
78             /** This class passes the view transformation
79                 to child sprites
80 
81                 This helper class is necessary, because the
82                 ImplSpriteCanvas object cannot hand out shared ptrs of
83                 itself, but has somehow pass an object to child
84                 sprites those can query for the canvas' view transform.
85              */
86             class TransformationArbiter
87             {
88             public:
89                 TransformationArbiter();
90 
91                 void                        setTransformation( const ::basegfx::B2DHomMatrix& rViewTransform );
92                 ::basegfx::B2DHomMatrix     getTransformation() const;
93 
94             private:
95                 ::basegfx::B2DHomMatrix     maTransformation;
96             };
97 
98             typedef ::boost::shared_ptr< TransformationArbiter > TransformationArbiterSharedPtr;
99 
100         private:
101             // default: disabled assignment
102             ImplSpriteCanvas& operator=( const ImplSpriteCanvas& );
103 
104             const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSpriteCanvas >    mxSpriteCanvas;
105             TransformationArbiterSharedPtr                                                          mpTransformArbiter;
106         };
107     }
108 }
109 
110 #endif /* _CPPCANVAS_IMPLSPRITECANVAS_HXX */
111