LibreOffice Module drawinglayer (master) 1
hittestprocessor2d.hxx
Go to the documentation of this file.
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
26
27namespace basegfx { class B2DPolygon; }
28namespace basegfx { class B2DPolyPolygon; }
29namespace drawinglayer::primitive2d { class ScenePrimitive2D; }
30
32 {
39 {
40 private:
43
46
49
52
54 bool mbHit : 1;
55
57 bool mbHitTextOnly : 1;
58
60 void processBasePrimitive2D(const primitive2d::BasePrimitive2D& rCandidate) override;
61 bool checkHairlineHitWithTolerance(
62 const basegfx::B2DPolygon& rPolygon,
63 const basegfx::B2DVector& rDiscreteHitTolerancePerAxis) const;
64 bool checkFillHitWithTolerance(
65 const basegfx::B2DPolyPolygon& rPolyPolygon,
66 const basegfx::B2DVector& rDiscreteHitTolerancePerAxis) const;
67 void check3DHit(const primitive2d::ScenePrimitive2D& rCandidate);
68
69 public:
71 const geometry::ViewInformation2D& rViewInformation,
72 const basegfx::B2DPoint& rLogicHitPosition,
73 const basegfx::B2DVector& rLogicHitTolerancePerAxis,
74 bool bHitTextOnly);
75 virtual ~HitTestProcessor2D() override;
76
78 void collectHitStack(bool bCollect) { mbCollectHitStack = bCollect; }
79
82 const primitive2d::Primitive2DContainer& getHitStack() const { return maHitStack; }
83
85 const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; }
86 const basegfx::B2DVector& getDiscreteHitTolerance() const { return maDiscreteHitTolerancePerAxis; }
87 bool getCollectHitStack() const { return mbCollectHitStack; }
88 bool getHit() const { return mbHit; }
89 bool getHitTextOnly() const { return mbHitTextOnly; }
90 };
91
92} // end of namespace drawinglayer::processor2d
93
94#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HITTESTPROCESSOR2D_HXX
95
96/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const basegfx::B2DPoint & getDiscreteHitPosition() const
data read access
basegfx::B2DVector maDiscreteHitTolerancePerAxis
discrete HitTolerance
void collectHitStack(bool bCollect)
switch on collecting primitives for a found hit on maHitStack, default is off
const primitive2d::Primitive2DContainer & getHitStack() const
get HitStack of primitives, first is the one that created the hit, last is the top-most
bool mbCollectHitStack
flag if HitStack shall be collected as part of the result, default is false
basegfx::B2DPoint maDiscreteHitPosition
discrete HitTest position
const basegfx::B2DVector & getDiscreteHitTolerance() const
bool mbHitTextOnly
flag to concentrate on text hits only
primitive2d::Primitive2DContainer maHitStack
stack of HitPrimitives, taken care of during HitTest run
bool mbHit
Boolean to flag if a hit was found. If yes, fast exit is taken.
#define DRAWINGLAYER_DLLPUBLIC