summaryrefslogtreecommitdiff
path: root/include/drawinglayer
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2017-07-31 14:46:03 +0200
committerArmin Le Grand <Armin.Le.Grand@cib.de>2017-07-31 21:26:03 +0200
commitd62d07b3d29014f76c0d676c891cbafa80d0765f (patch)
tree0e5f5c4bcd2348a1ef98ad06142c0573e1c7684b /include/drawinglayer
parent22334f8a003d26c71d772a8e00fc80b7e6d2bef1 (diff)
Corrected HitTest for layouted text
For text layouted using EditEngine the HitTest in SVX is identifying Field like URLs. Thus ist is better to use the anyways more precise primitives for HitTest (rotation/shear/ mirror, ...). This was necessary since the former mechanism which used a combination of primitive-beased HitTest and then using an Outliner to get the position/content of the Field landed on different positions e.g. when the layout needed to use multiple lines for the contained URL, but there could be more cases found. Adapted the text decompositon, the primitive HitTest and the TextHirearchyFieldPrimitive2D accordingly. Change-Id: Ice559e20d02547fdcfcf9783e7cc5481706aab03 Reviewed-on: https://gerrit.libreoffice.org/40591 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'include/drawinglayer')
-rw-r--r--include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx10
-rw-r--r--include/drawinglayer/processor2d/hittestprocessor2d.hxx15
2 files changed, 22 insertions, 3 deletions
diff --git a/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx b/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
index 093ccce65fa3..5234081584a3 100644
--- a/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/texthierarchyprimitive2d.hxx
@@ -148,19 +148,23 @@ namespace drawinglayer
class DRAWINGLAYER_DLLPUBLIC TextHierarchyFieldPrimitive2D : public GroupPrimitive2D
{
private:
+ /// field type definition
FieldType meType;
- OUString maString;
+
+ /// field data as name/value pairs (dependent of field type definition)
+ std::vector< std::pair< OUString, OUString>> meNameValue;
public:
/// constructor
TextHierarchyFieldPrimitive2D(
const Primitive2DContainer& rChildren,
const FieldType& rFieldType,
- const OUString& rString);
+ const std::vector< std::pair< OUString, OUString>>* pNameValue = nullptr);
/// data read access
FieldType getType() const { return meType; }
- const OUString& getString() const { return maString; }
+ const std::vector< std::pair< OUString, OUString>>& getNameValue() const { return meNameValue; }
+ OUString getValue(const OUString& rName) const;
/// compare operator
virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
diff --git a/include/drawinglayer/processor2d/hittestprocessor2d.hxx b/include/drawinglayer/processor2d/hittestprocessor2d.hxx
index 466bb948df49..e5002cb6cf2f 100644
--- a/include/drawinglayer/processor2d/hittestprocessor2d.hxx
+++ b/include/drawinglayer/processor2d/hittestprocessor2d.hxx
@@ -46,6 +46,13 @@ namespace drawinglayer
/// discrete HitTolerance
double mfDiscreteHitTolerance;
+ /// stack of HitPrimitives, taken care of during HitTest run
+ primitive2d::Primitive2DContainer maHitStack;
+
+ /// flag if HitStack shall be collected as part of the result, default is false
+ bool mbCollectHitStack : 1;
+
+ /// Boolean to flag if a hit was found. If yes, fast exit is taken
bool mbHit : 1;
/// flag to concentrate on text hits only
@@ -69,9 +76,17 @@ namespace drawinglayer
bool bHitTextOnly);
virtual ~HitTestProcessor2D() override;
+ /// switch on collecting primitives for a found hit on maHitStack, default is off
+ void collectHitStack(bool bCollect) { mbCollectHitStack = bCollect; }
+
+ /// get HitStack of primitives, first is the one that created the hit, last is the
+ /// top-most
+ const primitive2d::Primitive2DContainer& getHitStack() const { return maHitStack; }
+
/// data read access
const basegfx::B2DPoint& getDiscreteHitPosition() const { return maDiscreteHitPosition; }
double getDiscreteHitTolerance() const { return mfDiscreteHitTolerance; }
+ bool getCollectHitStack() const { return mbCollectHitStack; }
bool getHit() const { return mbHit; }
bool getHitTextOnly() const { return mbHitTextOnly; }
};