LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/svx/sdr/overlay - overlayobject.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 4 100.0 %
Date: 2012-08-25 Functions: 4 4 100.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : #ifndef _SDR_OVERLAY_OVERLAYOBJECT_HXX
      21                 :            : #define _SDR_OVERLAY_OVERLAYOBJECT_HXX
      22                 :            : 
      23                 :            : #include <basegfx/point/b2dpoint.hxx>
      24                 :            : #include <basegfx/range/b2drange.hxx>
      25                 :            : #include <tools/color.hxx>
      26                 :            : #include <rtl/ref.hxx>
      27                 :            : #include <svx/sdr/animation/scheduler.hxx>
      28                 :            : #include "svx/svxdllapi.h"
      29                 :            : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      30                 :            : 
      31                 :            : #include <vector>
      32                 :            : 
      33                 :            : //////////////////////////////////////////////////////////////////////////////
      34                 :            : // predeclarations
      35                 :            : 
      36                 :            : class OutputDevice;
      37                 :            : 
      38                 :            : namespace sdr
      39                 :            : {
      40                 :            :     namespace overlay
      41                 :            :     {
      42                 :            :         class OverlayManager;
      43                 :            :     } // end of namespace overlay
      44                 :            : } // end of namespace sdr
      45                 :            : 
      46                 :            : namespace basegfx
      47                 :            : {
      48                 :            :     class B2DPolygon;
      49                 :            :     class B2DPolyPolygon;
      50                 :            :     class B2DRange;
      51                 :            : } // end of namespace basegfx
      52                 :            : 
      53                 :            : //////////////////////////////////////////////////////////////////////////////
      54                 :            : 
      55                 :            : namespace sdr
      56                 :            : {
      57                 :            :     namespace overlay
      58                 :            :     {
      59                 :            :         class SVX_DLLPUBLIC OverlayObject : private ::boost::noncopyable, public ::sdr::animation::Event
      60                 :            :         {
      61                 :            :         private:
      62                 :            :             // Manager is allowed access to private Member mpOverlayManager
      63                 :            :             friend class                                    OverlayManager;
      64                 :            : 
      65                 :            :             // pointer to OverlayManager, if object is added. Changed by
      66                 :            :             // OverlayManager, do not chnge Yourself.
      67                 :            :             OverlayManager*                                 mpOverlayManager;
      68                 :            : 
      69                 :            :             // Primitive2DSequence of the OverlayObject
      70                 :            :             drawinglayer::primitive2d::Primitive2DSequence  maPrimitive2DSequence;
      71                 :            : 
      72                 :            :         protected:
      73                 :            :             // access methods to maPrimitive2DSequence. The usage of this methods may allow
      74                 :            :             // later thread-safe stuff to be added if needed. Only to be used by getPrimitive2DSequence()
      75                 :            :             // implementations for buffering the last decomposition.
      76                 :            :             const drawinglayer::primitive2d::Primitive2DSequence& getPrimitive2DSequence() const { return maPrimitive2DSequence; }
      77                 :            :             void setPrimitive2DSequence(const drawinglayer::primitive2d::Primitive2DSequence& rNew) { maPrimitive2DSequence = rNew; }
      78                 :            : 
      79                 :            :             // the creation method for Primitive2DSequence. Called when getPrimitive2DSequence()
      80                 :            :             // sees that maPrimitive2DSequence is empty. Needs to be supported by all
      81                 :            :             // OverlayObject implementations. Default implementation will assert
      82                 :            :             // a missing implementation
      83                 :            :             virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
      84                 :            : 
      85                 :            :             // region in logical coordinates
      86                 :            :             basegfx::B2DRange                               maBaseRange;
      87                 :            : 
      88                 :            :             // base color of this OverlayObject
      89                 :            :             Color                                           maBaseColor;
      90                 :            : 
      91                 :            :             // bitfield
      92                 :            :             // Flag for visibility
      93                 :            :             unsigned                                        mbIsVisible : 1;
      94                 :            : 
      95                 :            :             // Flag to control hittability
      96                 :            :             unsigned                                        mbIsHittable : 1;
      97                 :            : 
      98                 :            :             // Flag to hold info if this objects supports animation. Default is
      99                 :            :             // false. If true, the Trigger() method should be overloaded
     100                 :            :             // to implement the animation effect and to re-initiate the event.
     101                 :            :             unsigned                                        mbAllowsAnimation : 1;
     102                 :            : 
     103                 :            :             // Flag tocontrol if this OverlayObject allows AntiAliased visualisation.
     104                 :            :             // Default is true, but e.g. for selection visualisation in SC and SW,
     105                 :            :             // it is switched to false
     106                 :            :             unsigned                                        mbAllowsAntiAliase : 1;
     107                 :            : 
     108                 :            :             // set changed flag. Call after change, since the old range is invalidated
     109                 :            :             // and then the new one is calculated and invalidated, too. This will only
     110                 :            :             // work after the change.
     111                 :            :             virtual void objectChange();
     112                 :            : 
     113                 :            :             // write access to AntiAliase flag. This is protected since
     114                 :            :             // only implementations are allowed to change this, preferrably in their
     115                 :            :             // constructor
     116                 :            :             void allowAntiAliase(bool bNew);
     117                 :            : 
     118                 :            :         public:
     119                 :            :             explicit OverlayObject(Color aBaseColor);
     120                 :            :             virtual ~OverlayObject();
     121                 :            : 
     122                 :            :             // get OverlayManager
     123                 :         60 :             OverlayManager* getOverlayManager() const { return mpOverlayManager; }
     124                 :            : 
     125                 :            :             // the access method for Primitive2DSequence. Will use createPrimitive2DSequence and
     126                 :            :             // setPrimitive2DSequence if needed. Overloading may be used to allow disposal of last
     127                 :            :             // created primitives to react on changed circumstances and to re-create primitives
     128                 :            :             virtual drawinglayer::primitive2d::Primitive2DSequence getOverlayObjectPrimitive2DSequence() const;
     129                 :            : 
     130                 :            :             // access to visibility state
     131                 :        156 :             bool isVisible() const { return mbIsVisible; }
     132                 :            :             void setVisible(bool bNew);
     133                 :            : 
     134                 :            :             // access to hittable flag
     135                 :            :             bool isHittable() const { return mbIsHittable; }
     136                 :            :             void setHittable(bool bNew);
     137                 :            : 
     138                 :            :             // read access to AntiAliase flag
     139                 :            :             bool allowsAntiAliase() const { return mbAllowsAntiAliase; }
     140                 :            : 
     141                 :            :             // read access to baseRange. This may trigger createBaseRange() if
     142                 :            :             // object is changed.
     143                 :            :             const basegfx::B2DRange& getBaseRange() const;
     144                 :            : 
     145                 :            :             // access to baseColor
     146                 :         54 :             Color getBaseColor() const { return maBaseColor; }
     147                 :            :             void setBaseColor(Color aNew);
     148                 :            : 
     149                 :            :             // execute event from base class ::sdr::animation::Event. Default
     150                 :            :             // implementation does nothing and does not create a new event.
     151                 :            :             virtual void Trigger(sal_uInt32 nTime);
     152                 :            : 
     153                 :            :             // acces to AllowsAnimation flag
     154                 :            :             bool allowsAnimation() const { return mbAllowsAnimation; }
     155                 :            : 
     156                 :            :             // stripe definition has changed. The OverlayManager does have
     157                 :            :             // support data to draw graphics in two colors striped. This
     158                 :            :             // method notifies the OverlayObject if that change takes place.
     159                 :            :             // Default implementation does nothing.
     160                 :            :             virtual void stripeDefinitionHasChanged();
     161                 :            :         };
     162                 :            : 
     163                 :            :         // typedefs for a vector of OverlayObjects
     164                 :            :         typedef ::std::vector< OverlayObject* > OverlayObjectVector;
     165                 :            : 
     166                 :            :     } // end of namespace overlay
     167                 :            : } // end of namespace sdr
     168                 :            : 
     169                 :            : //////////////////////////////////////////////////////////////////////////////
     170                 :            : 
     171                 :            : namespace sdr
     172                 :            : {
     173                 :            :     namespace overlay
     174                 :            :     {
     175                 :            :         class SVX_DLLPUBLIC OverlayObjectWithBasePosition : public OverlayObject
     176                 :            :         {
     177                 :            :         protected:
     178                 :            :             // base position in logical coordinates
     179                 :            :             basegfx::B2DPoint                       maBasePosition;
     180                 :            : 
     181                 :            :         public:
     182                 :            :             OverlayObjectWithBasePosition(const basegfx::B2DPoint& rBasePos, Color aBaseColor);
     183                 :            :             virtual ~OverlayObjectWithBasePosition();
     184                 :            : 
     185                 :            :             // access to basePosition
     186                 :        204 :             const basegfx::B2DPoint& getBasePosition() const { return maBasePosition; }
     187                 :            :             void setBasePosition(const basegfx::B2DPoint& rNew);
     188                 :            :         };
     189                 :            :     } // end of namespace overlay
     190                 :            : } // end of namespace sdr
     191                 :            : 
     192                 :            : //////////////////////////////////////////////////////////////////////////////
     193                 :            : 
     194                 :            : #endif //_SDR_OVERLAY_OVERLAYOBJECT_HXX
     195                 :            : 
     196                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10