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