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 INCLUDED_SLIDESHOW_VIEWLAYER_HXX 25*b1cdbd2cSJim Jagielski #define INCLUDED_SLIDESHOW_VIEWLAYER_HXX 26*b1cdbd2cSJim Jagielski 27*b1cdbd2cSJim Jagielski #include <sal/config.h> 28*b1cdbd2cSJim Jagielski #include <boost/shared_ptr.hpp> 29*b1cdbd2cSJim Jagielski 30*b1cdbd2cSJim Jagielski namespace basegfx 31*b1cdbd2cSJim Jagielski { 32*b1cdbd2cSJim Jagielski class B1DRange; 33*b1cdbd2cSJim Jagielski class B2DRange; 34*b1cdbd2cSJim Jagielski class B2DVector; 35*b1cdbd2cSJim Jagielski class B2DHomMatrix; 36*b1cdbd2cSJim Jagielski class B2DPolyPolygon; 37*b1cdbd2cSJim Jagielski } 38*b1cdbd2cSJim Jagielski namespace cppcanvas 39*b1cdbd2cSJim Jagielski { 40*b1cdbd2cSJim Jagielski class Canvas; 41*b1cdbd2cSJim Jagielski class CustomSprite; 42*b1cdbd2cSJim Jagielski } 43*b1cdbd2cSJim Jagielski 44*b1cdbd2cSJim Jagielski 45*b1cdbd2cSJim Jagielski /* Definition of ViewLayer interface */ 46*b1cdbd2cSJim Jagielski 47*b1cdbd2cSJim Jagielski namespace slideshow 48*b1cdbd2cSJim Jagielski { 49*b1cdbd2cSJim Jagielski namespace internal 50*b1cdbd2cSJim Jagielski { 51*b1cdbd2cSJim Jagielski class View; 52*b1cdbd2cSJim Jagielski 53*b1cdbd2cSJim Jagielski class ViewLayer 54*b1cdbd2cSJim Jagielski { 55*b1cdbd2cSJim Jagielski public: ~ViewLayer()56*b1cdbd2cSJim Jagielski virtual ~ViewLayer() {} 57*b1cdbd2cSJim Jagielski 58*b1cdbd2cSJim Jagielski /** Query whether layer displays on given view. 59*b1cdbd2cSJim Jagielski 60*b1cdbd2cSJim Jagielski @return true, if this layer displays on the given 61*b1cdbd2cSJim Jagielski view. 62*b1cdbd2cSJim Jagielski */ 63*b1cdbd2cSJim Jagielski virtual bool isOnView(boost::shared_ptr<View> const& rView) const = 0; 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim Jagielski /** Get the associated canvas of this layer. 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim Jagielski The canvas returned by this method must not change, as 68*b1cdbd2cSJim Jagielski long as this object is alive. 69*b1cdbd2cSJim Jagielski */ 70*b1cdbd2cSJim Jagielski virtual boost::shared_ptr< cppcanvas::Canvas > getCanvas() const = 0; 71*b1cdbd2cSJim Jagielski 72*b1cdbd2cSJim Jagielski /** Clear the clipped view layer area 73*b1cdbd2cSJim Jagielski 74*b1cdbd2cSJim Jagielski This method clears the area inside the clip polygon, 75*b1cdbd2cSJim Jagielski if none is set, the transformed unit rectangle of the 76*b1cdbd2cSJim Jagielski view. 77*b1cdbd2cSJim Jagielski */ 78*b1cdbd2cSJim Jagielski virtual void clear() const = 0; 79*b1cdbd2cSJim Jagielski 80*b1cdbd2cSJim Jagielski /** Clear the complete view 81*b1cdbd2cSJim Jagielski 82*b1cdbd2cSJim Jagielski This method clears the full view area (not only the 83*b1cdbd2cSJim Jagielski transformed unit rectangle, or within the clip). If 84*b1cdbd2cSJim Jagielski this ViewLayer represents the background layer, the 85*b1cdbd2cSJim Jagielski whole XSlideShowView is cleared. If this ViewLayer is 86*b1cdbd2cSJim Jagielski implemented using sprites (i.e. one of the upper 87*b1cdbd2cSJim Jagielski layers), the sprite is cleared to fully transparent. 88*b1cdbd2cSJim Jagielski */ 89*b1cdbd2cSJim Jagielski virtual void clearAll() const = 0; 90*b1cdbd2cSJim Jagielski 91*b1cdbd2cSJim Jagielski /** Create a sprite for this layer 92*b1cdbd2cSJim Jagielski 93*b1cdbd2cSJim Jagielski @param rSpriteSizePixel 94*b1cdbd2cSJim Jagielski Sprite size in device pixel 95*b1cdbd2cSJim Jagielski 96*b1cdbd2cSJim Jagielski @param nPriority 97*b1cdbd2cSJim Jagielski Sprite priority. This value determines the priority of 98*b1cdbd2cSJim Jagielski this sprite, relative to all other sprites of this 99*b1cdbd2cSJim Jagielski ViewLayer. The higher the priority, the closer to the 100*b1cdbd2cSJim Jagielski foreground the sprite will be. 101*b1cdbd2cSJim Jagielski 102*b1cdbd2cSJim Jagielski @return the sprite, or NULL on failure (or if this 103*b1cdbd2cSJim Jagielski canvas does not support sprites). 104*b1cdbd2cSJim Jagielski */ 105*b1cdbd2cSJim Jagielski virtual boost::shared_ptr< cppcanvas::CustomSprite > 106*b1cdbd2cSJim Jagielski createSprite( const basegfx::B2DVector& rSpriteSizePixel, 107*b1cdbd2cSJim Jagielski double nPriority ) const = 0; 108*b1cdbd2cSJim Jagielski 109*b1cdbd2cSJim Jagielski /** Set the layer priority range 110*b1cdbd2cSJim Jagielski 111*b1cdbd2cSJim Jagielski This method influences the relative priority of this 112*b1cdbd2cSJim Jagielski layer, i.e. the z position in relation to other layers 113*b1cdbd2cSJim Jagielski on the parent view. The higher the priority range, the 114*b1cdbd2cSJim Jagielski further in front the layer resides. 115*b1cdbd2cSJim Jagielski 116*b1cdbd2cSJim Jagielski @param rRange 117*b1cdbd2cSJim Jagielski Priority range, must be in the range [0,1] 118*b1cdbd2cSJim Jagielski */ 119*b1cdbd2cSJim Jagielski virtual void setPriority( const basegfx::B1DRange& rRange ) = 0; 120*b1cdbd2cSJim Jagielski 121*b1cdbd2cSJim Jagielski /** Get the overall view transformation. 122*b1cdbd2cSJim Jagielski 123*b1cdbd2cSJim Jagielski This method should <em>not</em> simply return the 124*b1cdbd2cSJim Jagielski underlying canvas' transformation, but rather provide 125*b1cdbd2cSJim Jagielski a layer above that. This enables clients of the 126*b1cdbd2cSJim Jagielski slideshow to set their own user space transformation 127*b1cdbd2cSJim Jagielski at the canvas, whilst the slideshow adds their 128*b1cdbd2cSJim Jagielski transformation on top of that. Concretely, this method 129*b1cdbd2cSJim Jagielski returns the user transform (implicitely calculated 130*b1cdbd2cSJim Jagielski from the setViewSize() method), combined with the view 131*b1cdbd2cSJim Jagielski transformation. 132*b1cdbd2cSJim Jagielski */ 133*b1cdbd2cSJim Jagielski virtual basegfx::B2DHomMatrix getTransformation() const = 0; 134*b1cdbd2cSJim Jagielski 135*b1cdbd2cSJim Jagielski /** Get the overall view transformation. 136*b1cdbd2cSJim Jagielski 137*b1cdbd2cSJim Jagielski Same transformation as with getTransformation(), only 138*b1cdbd2cSJim Jagielski that you can safely use this one to position sprites 139*b1cdbd2cSJim Jagielski on screen (no ViewLayer offsets included whatsoever). 140*b1cdbd2cSJim Jagielski */ 141*b1cdbd2cSJim Jagielski virtual basegfx::B2DHomMatrix getSpriteTransformation() const = 0; 142*b1cdbd2cSJim Jagielski 143*b1cdbd2cSJim Jagielski /** Set clipping on this view layer. 144*b1cdbd2cSJim Jagielski 145*b1cdbd2cSJim Jagielski @param rClip 146*b1cdbd2cSJim Jagielski Clip poly-polygon to set. The polygon is interpreted 147*b1cdbd2cSJim Jagielski in the user coordinate system, i.e. the view layer has 148*b1cdbd2cSJim Jagielski the size as given by setViewSize() on its 149*b1cdbd2cSJim Jagielski corresponding View. 150*b1cdbd2cSJim Jagielski */ 151*b1cdbd2cSJim Jagielski virtual void setClip( const basegfx::B2DPolyPolygon& rClip ) = 0; 152*b1cdbd2cSJim Jagielski 153*b1cdbd2cSJim Jagielski /** Resize this view layer. 154*b1cdbd2cSJim Jagielski 155*b1cdbd2cSJim Jagielski @param rArea 156*b1cdbd2cSJim Jagielski New area to cover. The area is interpreted in the user 157*b1cdbd2cSJim Jagielski coordinate system, i.e. relative to the size as given 158*b1cdbd2cSJim Jagielski by setViewSize() on the corresponding View. 159*b1cdbd2cSJim Jagielski 160*b1cdbd2cSJim Jagielski @return true, if layer was actually resized (which 161*b1cdbd2cSJim Jagielski invalidates its content) 162*b1cdbd2cSJim Jagielski */ 163*b1cdbd2cSJim Jagielski virtual bool resize( const basegfx::B2DRange& rArea ) = 0; 164*b1cdbd2cSJim Jagielski 165*b1cdbd2cSJim Jagielski }; 166*b1cdbd2cSJim Jagielski 167*b1cdbd2cSJim Jagielski typedef boost::shared_ptr< ViewLayer > ViewLayerSharedPtr; 168*b1cdbd2cSJim Jagielski } 169*b1cdbd2cSJim Jagielski } 170*b1cdbd2cSJim Jagielski 171*b1cdbd2cSJim Jagielski #endif /* INCLUDED_SLIDESHOW_VIEWLAYER_HXX */ 172