1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef INCLUDED_SLIDESHOW_VIEWLAYER_HXX 29*cdf0e10cSrcweir #define INCLUDED_SLIDESHOW_VIEWLAYER_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <sal/config.h> 32*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir namespace basegfx 35*cdf0e10cSrcweir { 36*cdf0e10cSrcweir class B1DRange; 37*cdf0e10cSrcweir class B2DRange; 38*cdf0e10cSrcweir class B2DVector; 39*cdf0e10cSrcweir class B2DHomMatrix; 40*cdf0e10cSrcweir class B2DPolyPolygon; 41*cdf0e10cSrcweir } 42*cdf0e10cSrcweir namespace cppcanvas 43*cdf0e10cSrcweir { 44*cdf0e10cSrcweir class Canvas; 45*cdf0e10cSrcweir class CustomSprite; 46*cdf0e10cSrcweir } 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir /* Definition of ViewLayer interface */ 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir namespace slideshow 52*cdf0e10cSrcweir { 53*cdf0e10cSrcweir namespace internal 54*cdf0e10cSrcweir { 55*cdf0e10cSrcweir class View; 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir class ViewLayer 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir public: 60*cdf0e10cSrcweir virtual ~ViewLayer() {} 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir /** Query whether layer displays on given view. 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir @return true, if this layer displays on the given 65*cdf0e10cSrcweir view. 66*cdf0e10cSrcweir */ 67*cdf0e10cSrcweir virtual bool isOnView(boost::shared_ptr<View> const& rView) const = 0; 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir /** Get the associated canvas of this layer. 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir The canvas returned by this method must not change, as 72*cdf0e10cSrcweir long as this object is alive. 73*cdf0e10cSrcweir */ 74*cdf0e10cSrcweir virtual boost::shared_ptr< cppcanvas::Canvas > getCanvas() const = 0; 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir /** Clear the clipped view layer area 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir This method clears the area inside the clip polygon, 79*cdf0e10cSrcweir if none is set, the transformed unit rectangle of the 80*cdf0e10cSrcweir view. 81*cdf0e10cSrcweir */ 82*cdf0e10cSrcweir virtual void clear() const = 0; 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir /** Clear the complete view 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir This method clears the full view area (not only the 87*cdf0e10cSrcweir transformed unit rectangle, or within the clip). If 88*cdf0e10cSrcweir this ViewLayer represents the background layer, the 89*cdf0e10cSrcweir whole XSlideShowView is cleared. If this ViewLayer is 90*cdf0e10cSrcweir implemented using sprites (i.e. one of the upper 91*cdf0e10cSrcweir layers), the sprite is cleared to fully transparent. 92*cdf0e10cSrcweir */ 93*cdf0e10cSrcweir virtual void clearAll() const = 0; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir /** Create a sprite for this layer 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir @param rSpriteSizePixel 98*cdf0e10cSrcweir Sprite size in device pixel 99*cdf0e10cSrcweir 100*cdf0e10cSrcweir @param nPriority 101*cdf0e10cSrcweir Sprite priority. This value determines the priority of 102*cdf0e10cSrcweir this sprite, relative to all other sprites of this 103*cdf0e10cSrcweir ViewLayer. The higher the priority, the closer to the 104*cdf0e10cSrcweir foreground the sprite will be. 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir @return the sprite, or NULL on failure (or if this 107*cdf0e10cSrcweir canvas does not support sprites). 108*cdf0e10cSrcweir */ 109*cdf0e10cSrcweir virtual boost::shared_ptr< cppcanvas::CustomSprite > 110*cdf0e10cSrcweir createSprite( const basegfx::B2DVector& rSpriteSizePixel, 111*cdf0e10cSrcweir double nPriority ) const = 0; 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir /** Set the layer priority range 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir This method influences the relative priority of this 116*cdf0e10cSrcweir layer, i.e. the z position in relation to other layers 117*cdf0e10cSrcweir on the parent view. The higher the priority range, the 118*cdf0e10cSrcweir further in front the layer resides. 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir @param rRange 121*cdf0e10cSrcweir Priority range, must be in the range [0,1] 122*cdf0e10cSrcweir */ 123*cdf0e10cSrcweir virtual void setPriority( const basegfx::B1DRange& rRange ) = 0; 124*cdf0e10cSrcweir 125*cdf0e10cSrcweir /** Get the overall view transformation. 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir This method should <em>not</em> simply return the 128*cdf0e10cSrcweir underlying canvas' transformation, but rather provide 129*cdf0e10cSrcweir a layer above that. This enables clients of the 130*cdf0e10cSrcweir slideshow to set their own user space transformation 131*cdf0e10cSrcweir at the canvas, whilst the slideshow adds their 132*cdf0e10cSrcweir transformation on top of that. Concretely, this method 133*cdf0e10cSrcweir returns the user transform (implicitely calculated 134*cdf0e10cSrcweir from the setViewSize() method), combined with the view 135*cdf0e10cSrcweir transformation. 136*cdf0e10cSrcweir */ 137*cdf0e10cSrcweir virtual basegfx::B2DHomMatrix getTransformation() const = 0; 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir /** Get the overall view transformation. 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir Same transformation as with getTransformation(), only 142*cdf0e10cSrcweir that you can safely use this one to position sprites 143*cdf0e10cSrcweir on screen (no ViewLayer offsets included whatsoever). 144*cdf0e10cSrcweir */ 145*cdf0e10cSrcweir virtual basegfx::B2DHomMatrix getSpriteTransformation() const = 0; 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir /** Set clipping on this view layer. 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir @param rClip 150*cdf0e10cSrcweir Clip poly-polygon to set. The polygon is interpreted 151*cdf0e10cSrcweir in the user coordinate system, i.e. the view layer has 152*cdf0e10cSrcweir the size as given by setViewSize() on its 153*cdf0e10cSrcweir corresponding View. 154*cdf0e10cSrcweir */ 155*cdf0e10cSrcweir virtual void setClip( const basegfx::B2DPolyPolygon& rClip ) = 0; 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir /** Resize this view layer. 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir @param rArea 160*cdf0e10cSrcweir New area to cover. The area is interpreted in the user 161*cdf0e10cSrcweir coordinate system, i.e. relative to the size as given 162*cdf0e10cSrcweir by setViewSize() on the corresponding View. 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir @return true, if layer was actually resized (which 165*cdf0e10cSrcweir invalidates its content) 166*cdf0e10cSrcweir */ 167*cdf0e10cSrcweir virtual bool resize( const basegfx::B2DRange& rArea ) = 0; 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir }; 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir typedef boost::shared_ptr< ViewLayer > ViewLayerSharedPtr; 172*cdf0e10cSrcweir } 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir #endif /* INCLUDED_SLIDESHOW_VIEWLAYER_HXX */ 176