LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/drawinglayer/processor2d - hittestprocessor2d.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 5 5 100.0 %
Date: 2012-08-25 Functions: 5 5 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                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
      30                 :            : #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
      31                 :            : 
      32                 :            : #include <drawinglayer/drawinglayerdllapi.h>
      33                 :            : 
      34                 :            : #include <drawinglayer/processor2d/baseprocessor2d.hxx>
      35                 :            : 
      36                 :            : //////////////////////////////////////////////////////////////////////////////
      37                 :            : // predeclarations
      38                 :            : 
      39                 :            : namespace basegfx { class B2DPolygon; }
      40                 :            : namespace basegfx { class B2DPolyPolygon; }
      41                 :            : namespace drawinglayer { namespace primitive2d { class ScenePrimitive2D; }}
      42                 :            : 
      43                 :            : //////////////////////////////////////////////////////////////////////////////
      44                 :            : 
      45                 :            : namespace drawinglayer
      46                 :            : {
      47                 :            :     namespace processor2d
      48                 :            :     {
      49                 :            :         /** HitTestProcessor2D class
      50                 :            : 
      51                 :            :             This processor implements a HitTest with the feeded primitives,
      52                 :            :             given tolerance and extras
      53                 :            :          */
      54                 :            :         class DRAWINGLAYER_DLLPUBLIC HitTestProcessor2D : public BaseProcessor2D
      55                 :            :         {
      56                 :            :         private:
      57                 :            :             /// discrete HitTest position
      58                 :            :             basegfx::B2DPoint           maDiscreteHitPosition;
      59                 :            : 
      60                 :            :             /// discrete HitTolerance
      61                 :            :             double                      mfDiscreteHitTolerance;
      62                 :            : 
      63                 :            :             /// bitfield
      64                 :            :             unsigned                    mbHit : 1;
      65                 :            :             unsigned                    mbHitToleranceUsed : 1;
      66                 :            : 
      67                 :            :             /*  this flag decides if primitives which are embedded to an
      68                 :            :                 UnifiedTransparencePrimitive2D and are invisible will be taken into account for
      69                 :            :                 HitTesting or not. Those primitives are created for objects which are else
      70                 :            :                 completely invisible and normally their content exists of hairline
      71                 :            :                 primitives describing the object's contour
      72                 :            :              */
      73                 :            :             unsigned                    mbUseInvisiblePrimitiveContent : 1;
      74                 :            : 
      75                 :            :             /// flag to concentraze on text hits only
      76                 :            :             unsigned                    mbHitTextOnly : 1;
      77                 :            : 
      78                 :            :             /// tooling methods
      79                 :            :             void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
      80                 :            :             bool checkHairlineHitWithTolerance(
      81                 :            :                 const basegfx::B2DPolygon& rPolygon,
      82                 :            :                 double fDiscreteHitTolerance);
      83                 :            :             bool checkFillHitWithTolerance(
      84                 :            :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
      85                 :            :                 double fDiscreteHitTolerance);
      86                 :            :             void check3DHit(const primitive2d::ScenePrimitive2D& rCandidate);
      87                 :            : 
      88                 :            :         public:
      89                 :            :             HitTestProcessor2D(
      90                 :            :                 const geometry::ViewInformation2D& rViewInformation,
      91                 :            :                 const basegfx::B2DPoint& rLogicHitPosition,
      92                 :            :                 double fLogicHitTolerance,
      93                 :            :                 bool bHitTextOnly);
      94                 :            :             virtual ~HitTestProcessor2D();
      95                 :            : 
      96                 :            :             /// data write access
      97                 :            :             void setUseInvisiblePrimitiveContent(bool bNew)
      98                 :            :             {
      99                 :            :                 if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew;
     100                 :            :             }
     101                 :            : 
     102                 :            :             /// data read access
     103                 :          6 :             const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; }
     104                 :          4 :             double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; }
     105                 :          8 :             bool getHit() const { return mbHit; }
     106                 :            :             bool getHitToleranceUsed() const { return mbHitToleranceUsed; }
     107                 :          2 :             bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;}
     108                 :          2 :             bool getHitTextOnly() const { return mbHitTextOnly; }
     109                 :            :         };
     110                 :            :     } // end of namespace processor2d
     111                 :            : } // end of namespace drawinglayer
     112                 :            : 
     113                 :            : //////////////////////////////////////////////////////////////////////////////
     114                 :            : 
     115                 :            : #endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
     116                 :            : 
     117                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10