LCOV - code coverage report
Current view: top level - include/drawinglayer/processor2d - hittestprocessor2d.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 5 5 100.0 %
Date: 2015-06-13 12:38:46 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          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 INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
      21             : #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : 
      25             : #include <drawinglayer/processor2d/baseprocessor2d.hxx>
      26             : 
      27             : namespace basegfx { class B2DPolygon; }
      28             : namespace basegfx { class B2DPolyPolygon; }
      29             : namespace drawinglayer { namespace primitive2d { class ScenePrimitive2D; }}
      30             : 
      31             : namespace drawinglayer
      32             : {
      33             :     namespace processor2d
      34             :     {
      35             :         /** HitTestProcessor2D class
      36             : 
      37             :             This processor implements a HitTest with the feeded primitives,
      38             :             given tolerance and extras
      39             :          */
      40             :         class DRAWINGLAYER_DLLPUBLIC HitTestProcessor2D : public BaseProcessor2D
      41             :         {
      42             :         private:
      43             :             /// discrete HitTest position
      44             :             basegfx::B2DPoint           maDiscreteHitPosition;
      45             : 
      46             :             /// discrete HitTolerance
      47             :             double                      mfDiscreteHitTolerance;
      48             : 
      49             :             /// bitfield
      50             :             bool                        mbHit : 1;
      51             :             bool                        mbHitToleranceUsed : 1;
      52             : 
      53             :             /*  this flag decides if primitives which are embedded to an
      54             :                 UnifiedTransparencePrimitive2D and are invisible will be taken into account for
      55             :                 HitTesting or not. Those primitives are created for objects which are else
      56             :                 completely invisible and normally their content exists of hairline
      57             :                 primitives describing the object's contour
      58             :              */
      59             :             bool                        mbUseInvisiblePrimitiveContent : 1;
      60             : 
      61             :             /// flag to concentraze on text hits only
      62             :             bool                        mbHitTextOnly : 1;
      63             : 
      64             :             /// If we are tiled rendering.
      65             :             bool mbTiledRendering;
      66             : 
      67             :             /// tooling methods
      68             :             void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) SAL_OVERRIDE;
      69             :             bool checkHairlineHitWithTolerance(
      70             :                 const basegfx::B2DPolygon& rPolygon,
      71             :                 double fDiscreteHitTolerance);
      72             :             bool checkFillHitWithTolerance(
      73             :                 const basegfx::B2DPolyPolygon& rPolyPolygon,
      74             :                 double fDiscreteHitTolerance);
      75             :             void check3DHit(const primitive2d::ScenePrimitive2D& rCandidate);
      76             : 
      77             :         public:
      78             :             HitTestProcessor2D(
      79             :                 const geometry::ViewInformation2D& rViewInformation,
      80             :                 const basegfx::B2DPoint& rLogicHitPosition,
      81             :                 double fLogicHitTolerance,
      82             :                 bool bHitTextOnly,
      83             :                 bool bTiledRendering);
      84             :             virtual ~HitTestProcessor2D();
      85             : 
      86             :             /// data write access
      87             :             void setUseInvisiblePrimitiveContent(bool bNew)
      88             :             {
      89             :                 if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew;
      90             :             }
      91             : 
      92             :             /// data read access
      93         275 :             const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; }
      94         309 :             double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; }
      95         790 :             bool getHit() const { return mbHit; }
      96             :             bool getHitToleranceUsed() const { return mbHitToleranceUsed; }
      97          56 :             bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;}
      98         135 :             bool getHitTextOnly() const { return mbHitTextOnly; }
      99             :         };
     100             :     } // end of namespace processor2d
     101             : } // end of namespace drawinglayer
     102             : 
     103             : #endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
     104             : 
     105             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11