fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / drawinglayer / processor2d / hittestprocessor2d.hxx
blobfc2ab32525587a86aa61f23ec97f653fa08e9c58
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
25 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
27 //////////////////////////////////////////////////////////////////////////////
28 // predeclarations
30 namespace basegfx { class B2DPolygon; }
31 namespace basegfx { class B2DPolyPolygon; }
32 namespace drawinglayer { namespace primitive2d { class ScenePrimitive2D; }}
34 //////////////////////////////////////////////////////////////////////////////
36 namespace drawinglayer
38 namespace processor2d
40 /** HitTestProcessor2D class
42 This processor implements a HitTest with the feeded primitives,
43 given tolerance and extras
45 class DRAWINGLAYER_DLLPUBLIC HitTestProcessor2D : public BaseProcessor2D
47 private:
48 /// discrete HitTest position
49 basegfx::B2DPoint maDiscreteHitPosition;
51 /// discrete HitTolerance
52 double mfDiscreteHitTolerance;
54 /// bitfield
55 unsigned mbHit : 1;
56 unsigned mbHitToleranceUsed : 1;
58 /* this flag decides if primitives which are embedded to an
59 UnifiedTransparencePrimitive2D and are invisible will be taken into account for
60 HitTesting or not. Those primitives are created for objects which are else
61 completely invisible and normally their content exists of hairline
62 primitives describing the object's contour
64 unsigned mbUseInvisiblePrimitiveContent : 1;
66 /// flag to concentraze on text hits only
67 unsigned mbHitTextOnly : 1;
69 /// tooling methods
70 void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate);
71 bool checkHairlineHitWithTolerance(
72 const basegfx::B2DPolygon& rPolygon,
73 double fDiscreteHitTolerance);
74 bool checkFillHitWithTolerance(
75 const basegfx::B2DPolyPolygon& rPolyPolygon,
76 double fDiscreteHitTolerance);
77 void check3DHit(const primitive2d::ScenePrimitive2D& rCandidate);
79 public:
80 HitTestProcessor2D(
81 const geometry::ViewInformation2D& rViewInformation,
82 const basegfx::B2DPoint& rLogicHitPosition,
83 double fLogicHitTolerance,
84 bool bHitTextOnly);
85 virtual ~HitTestProcessor2D();
87 /// data write access
88 void setUseInvisiblePrimitiveContent(bool bNew)
90 if((bool)mbUseInvisiblePrimitiveContent != bNew) mbUseInvisiblePrimitiveContent = bNew;
93 /// data read access
94 const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; }
95 double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; }
96 bool getHit() const { return mbHit; }
97 bool getHitToleranceUsed() const { return mbHitToleranceUsed; }
98 bool getUseInvisiblePrimitiveContent() const { return mbUseInvisiblePrimitiveContent;}
99 bool getHitTextOnly() const { return mbHitTextOnly; }
101 } // end of namespace processor2d
102 } // end of namespace drawinglayer
104 //////////////////////////////////////////////////////////////////////////////
106 #endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */