1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski #ifndef _CPPCANVAS_IMPLSPRITECANVAS_HXX 25*b1cdbd2cSJim Jagielski #define _CPPCANVAS_IMPLSPRITECANVAS_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #ifndef _COM_SUN_STAR_RENDERING_XSPRITECANVAS_HPP__ 28*b1cdbd2cSJim Jagielski #include <com/sun/star/rendering/XSpriteCanvas.hpp> 29*b1cdbd2cSJim Jagielski #endif 30*b1cdbd2cSJim Jagielski #include <basegfx/vector/b2dsize.hxx> 31*b1cdbd2cSJim Jagielski #include <basegfx/matrix/b2dhommatrix.hxx> 32*b1cdbd2cSJim Jagielski 33*b1cdbd2cSJim Jagielski #ifndef BOOST_SHARED_PTR_HPP_INCLUDED 34*b1cdbd2cSJim Jagielski #include <boost/shared_ptr.hpp> 35*b1cdbd2cSJim Jagielski #endif 36*b1cdbd2cSJim Jagielski 37*b1cdbd2cSJim Jagielski 38*b1cdbd2cSJim Jagielski #include <cppcanvas/spritecanvas.hxx> 39*b1cdbd2cSJim Jagielski 40*b1cdbd2cSJim Jagielski #include <implbitmapcanvas.hxx> 41*b1cdbd2cSJim Jagielski 42*b1cdbd2cSJim Jagielski 43*b1cdbd2cSJim Jagielski namespace cppcanvas 44*b1cdbd2cSJim Jagielski { 45*b1cdbd2cSJim Jagielski namespace internal 46*b1cdbd2cSJim Jagielski { 47*b1cdbd2cSJim Jagielski class ImplSpriteCanvas : public virtual SpriteCanvas, protected virtual ImplBitmapCanvas 48*b1cdbd2cSJim Jagielski { 49*b1cdbd2cSJim Jagielski public: 50*b1cdbd2cSJim Jagielski ImplSpriteCanvas( const ::com::sun::star::uno::Reference< 51*b1cdbd2cSJim Jagielski ::com::sun::star::rendering::XSpriteCanvas >& rCanvas ); 52*b1cdbd2cSJim Jagielski ImplSpriteCanvas(const ImplSpriteCanvas&); 53*b1cdbd2cSJim Jagielski 54*b1cdbd2cSJim Jagielski virtual ~ImplSpriteCanvas(); 55*b1cdbd2cSJim Jagielski 56*b1cdbd2cSJim Jagielski virtual void setTransformation( const ::basegfx::B2DHomMatrix& rMatrix ); 57*b1cdbd2cSJim Jagielski 58*b1cdbd2cSJim Jagielski virtual bool updateScreen( bool bUpdateAll ) const; 59*b1cdbd2cSJim Jagielski 60*b1cdbd2cSJim Jagielski virtual CustomSpriteSharedPtr createCustomSprite( const ::basegfx::B2DSize& ) const; 61*b1cdbd2cSJim Jagielski virtual SpriteSharedPtr createClonedSprite( const SpriteSharedPtr& ) const; 62*b1cdbd2cSJim Jagielski 63*b1cdbd2cSJim Jagielski SpriteSharedPtr createSpriteFromBitmaps( 64*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Sequence< 65*b1cdbd2cSJim Jagielski ::com::sun::star::uno::Reference< 66*b1cdbd2cSJim Jagielski ::com::sun::star::rendering::XBitmap > >& animationBitmaps, 67*b1cdbd2cSJim Jagielski sal_Int8 interpolationMode ); 68*b1cdbd2cSJim Jagielski 69*b1cdbd2cSJim Jagielski virtual CanvasSharedPtr clone() const; 70*b1cdbd2cSJim Jagielski 71*b1cdbd2cSJim Jagielski virtual ::com::sun::star::uno::Reference< 72*b1cdbd2cSJim Jagielski ::com::sun::star::rendering::XSpriteCanvas > getUNOSpriteCanvas() const; 73*b1cdbd2cSJim Jagielski 74*b1cdbd2cSJim Jagielski /** This class passes the view transformation 75*b1cdbd2cSJim Jagielski to child sprites 76*b1cdbd2cSJim Jagielski 77*b1cdbd2cSJim Jagielski This helper class is necessary, because the 78*b1cdbd2cSJim Jagielski ImplSpriteCanvas object cannot hand out shared ptrs of 79*b1cdbd2cSJim Jagielski itself, but has somehow pass an object to child 80*b1cdbd2cSJim Jagielski sprites those can query for the canvas' view transform. 81*b1cdbd2cSJim Jagielski */ 82*b1cdbd2cSJim Jagielski class TransformationArbiter 83*b1cdbd2cSJim Jagielski { 84*b1cdbd2cSJim Jagielski public: 85*b1cdbd2cSJim Jagielski TransformationArbiter(); 86*b1cdbd2cSJim Jagielski 87*b1cdbd2cSJim Jagielski void setTransformation( const ::basegfx::B2DHomMatrix& rViewTransform ); 88*b1cdbd2cSJim Jagielski ::basegfx::B2DHomMatrix getTransformation() const; 89*b1cdbd2cSJim Jagielski 90*b1cdbd2cSJim Jagielski private: 91*b1cdbd2cSJim Jagielski ::basegfx::B2DHomMatrix maTransformation; 92*b1cdbd2cSJim Jagielski }; 93*b1cdbd2cSJim Jagielski 94*b1cdbd2cSJim Jagielski typedef ::boost::shared_ptr< TransformationArbiter > TransformationArbiterSharedPtr; 95*b1cdbd2cSJim Jagielski 96*b1cdbd2cSJim Jagielski private: 97*b1cdbd2cSJim Jagielski // default: disabled assignment 98*b1cdbd2cSJim Jagielski ImplSpriteCanvas& operator=( const ImplSpriteCanvas& ); 99*b1cdbd2cSJim Jagielski 100*b1cdbd2cSJim Jagielski const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSpriteCanvas > mxSpriteCanvas; 101*b1cdbd2cSJim Jagielski TransformationArbiterSharedPtr mpTransformArbiter; 102*b1cdbd2cSJim Jagielski }; 103*b1cdbd2cSJim Jagielski } 104*b1cdbd2cSJim Jagielski } 105*b1cdbd2cSJim Jagielski 106*b1cdbd2cSJim Jagielski #endif /* _CPPCANVAS_IMPLSPRITECANVAS_HXX */ 107