summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basegfx/source/polygon/b2dlinegeometry.cxx14
-rw-r--r--basegfx/source/polygon/b2dpolygontools.cxx44
-rw-r--r--basegfx/source/polygon/b2dtrapezoid.cxx4
-rw-r--r--drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx2
-rw-r--r--include/basegfx/polygon/b2dpolygontools.hxx32
-rw-r--r--svx/source/dialog/framelink.cxx2
6 files changed, 52 insertions, 46 deletions
diff --git a/basegfx/source/polygon/b2dlinegeometry.cxx b/basegfx/source/polygon/b2dlinegeometry.cxx
index 78a722b092d8..860161d6af67 100644
--- a/basegfx/source/polygon/b2dlinegeometry.cxx
+++ b/basegfx/source/polygon/b2dlinegeometry.cxx
@@ -359,21 +359,21 @@ namespace basegfx
const B2DVector aPerpendStartA(aNormalizedPerpendicularA * -fHalfLineWidth);
const B2DVector aPerpendEndA(aNormalizedPerpendicularB * -fHalfLineWidth);
double fCutA(0.0);
- const tools::CutFlagValue aCutA(tools::findCut(
+ const CutFlagValue aCutA(tools::findCut(
rEdge.getStartPoint(), aPerpendStartA,
rEdge.getEndPoint(), aPerpendEndA,
- CUTFLAG_ALL, &fCutA));
- const bool bCutA(CUTFLAG_NONE != aCutA);
+ CutFlagValue::ALL, &fCutA));
+ const bool bCutA(CutFlagValue::NONE != aCutA);
// create lower displacement vectors and check if they cut
const B2DVector aPerpendStartB(aNormalizedPerpendicularA * fHalfLineWidth);
const B2DVector aPerpendEndB(aNormalizedPerpendicularB * fHalfLineWidth);
double fCutB(0.0);
- const tools::CutFlagValue aCutB(tools::findCut(
+ const CutFlagValue aCutB(tools::findCut(
rEdge.getEndPoint(), aPerpendEndB,
rEdge.getStartPoint(), aPerpendStartB,
- CUTFLAG_ALL, &fCutB));
- const bool bCutB(CUTFLAG_NONE != aCutB);
+ CutFlagValue::ALL, &fCutB));
+ const bool bCutB(CutFlagValue::NONE != aCutB);
// check if cut happens
const bool bCut(bCutA || bCutB);
@@ -713,7 +713,7 @@ namespace basegfx
// is not needed since the same fCut will be found on the first edge.
// If it exists, insert it to complete the mitered fill polygon.
double fCutPos(0.0);
- tools::findCut(aStartPoint, rTangentPrev, aEndPoint, rTangentEdge, CUTFLAG_ALL, &fCutPos);
+ tools::findCut(aStartPoint, rTangentPrev, aEndPoint, rTangentEdge, CutFlagValue::ALL, &fCutPos);
if(0.0 != fCutPos)
{
diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx
index 09cb226bdc40..ba27b93f7f09 100644
--- a/basegfx/source/polygon/b2dpolygontools.cxx
+++ b/basegfx/source/polygon/b2dpolygontools.cxx
@@ -947,28 +947,28 @@ namespace basegfx
CutFlagValue aCutFlags,
double* pCut1, double* pCut2)
{
- CutFlagValue aRetval(CUTFLAG_NONE);
+ CutFlagValue aRetval(CutFlagValue::NONE);
double fCut1(0.0);
double fCut2(0.0);
- bool bFinished(!((bool)(aCutFlags & CUTFLAG_ALL)));
+ bool bFinished(!((bool)(aCutFlags & CutFlagValue::ALL)));
// test for same points?
if(!bFinished
- && (aCutFlags & (CUTFLAG_START1|CUTFLAG_END1))
- && (aCutFlags & (CUTFLAG_START2|CUTFLAG_END2)))
+ && (aCutFlags & (CutFlagValue::START1|CutFlagValue::END1))
+ && (aCutFlags & (CutFlagValue::START2|CutFlagValue::END2)))
{
// same startpoint?
- if(!bFinished && (aCutFlags & (CUTFLAG_START1|CUTFLAG_START2)) == (CUTFLAG_START1|CUTFLAG_START2))
+ if(!bFinished && (aCutFlags & (CutFlagValue::START1|CutFlagValue::START2)) == (CutFlagValue::START1|CutFlagValue::START2))
{
if(rEdge1Start.equal(rEdge2Start))
{
bFinished = true;
- aRetval = (CUTFLAG_START1|CUTFLAG_START2);
+ aRetval = (CutFlagValue::START1|CutFlagValue::START2);
}
}
// same endpoint?
- if(!bFinished && (aCutFlags & (CUTFLAG_END1|CUTFLAG_END2)) == (CUTFLAG_END1|CUTFLAG_END2))
+ if(!bFinished && (aCutFlags & (CutFlagValue::END1|CutFlagValue::END2)) == (CutFlagValue::END1|CutFlagValue::END2))
{
const B2DPoint aEnd1(rEdge1Start + rEdge1Delta);
const B2DPoint aEnd2(rEdge2Start + rEdge2Delta);
@@ -976,63 +976,63 @@ namespace basegfx
if(aEnd1.equal(aEnd2))
{
bFinished = true;
- aRetval = (CUTFLAG_END1|CUTFLAG_END2);
+ aRetval = (CutFlagValue::END1|CutFlagValue::END2);
fCut1 = fCut2 = 1.0;
}
}
// startpoint1 == endpoint2?
- if(!bFinished && (aCutFlags & (CUTFLAG_START1|CUTFLAG_END2)) == (CUTFLAG_START1|CUTFLAG_END2))
+ if(!bFinished && (aCutFlags & (CutFlagValue::START1|CutFlagValue::END2)) == (CutFlagValue::START1|CutFlagValue::END2))
{
const B2DPoint aEnd2(rEdge2Start + rEdge2Delta);
if(rEdge1Start.equal(aEnd2))
{
bFinished = true;
- aRetval = (CUTFLAG_START1|CUTFLAG_END2);
+ aRetval = (CutFlagValue::START1|CutFlagValue::END2);
fCut1 = 0.0;
fCut2 = 1.0;
}
}
// startpoint2 == endpoint1?
- if(!bFinished&& (aCutFlags & (CUTFLAG_START2|CUTFLAG_END1)) == (CUTFLAG_START2|CUTFLAG_END1))
+ if(!bFinished&& (aCutFlags & (CutFlagValue::START2|CutFlagValue::END1)) == (CutFlagValue::START2|CutFlagValue::END1))
{
const B2DPoint aEnd1(rEdge1Start + rEdge1Delta);
if(rEdge2Start.equal(aEnd1))
{
bFinished = true;
- aRetval = (CUTFLAG_START2|CUTFLAG_END1);
+ aRetval = (CutFlagValue::START2|CutFlagValue::END1);
fCut1 = 1.0;
fCut2 = 0.0;
}
}
}
- if(!bFinished && (aCutFlags & CUTFLAG_LINE))
+ if(!bFinished && (aCutFlags & CutFlagValue::LINE))
{
- if(!bFinished && (aCutFlags & CUTFLAG_START1))
+ if(!bFinished && (aCutFlags & CutFlagValue::START1))
{
// start1 on line 2 ?
if(isPointOnEdge(rEdge1Start, rEdge2Start, rEdge2Delta, &fCut2))
{
bFinished = true;
- aRetval = (CUTFLAG_LINE|CUTFLAG_START1);
+ aRetval = (CutFlagValue::LINE|CutFlagValue::START1);
}
}
- if(!bFinished && (aCutFlags & CUTFLAG_START2))
+ if(!bFinished && (aCutFlags & CutFlagValue::START2))
{
// start2 on line 1 ?
if(isPointOnEdge(rEdge2Start, rEdge1Start, rEdge1Delta, &fCut1))
{
bFinished = true;
- aRetval = (CUTFLAG_LINE|CUTFLAG_START2);
+ aRetval = (CutFlagValue::LINE|CutFlagValue::START2);
}
}
- if(!bFinished && (aCutFlags & CUTFLAG_END1))
+ if(!bFinished && (aCutFlags & CutFlagValue::END1))
{
// end1 on line 2 ?
const B2DPoint aEnd1(rEdge1Start + rEdge1Delta);
@@ -1040,11 +1040,11 @@ namespace basegfx
if(isPointOnEdge(aEnd1, rEdge2Start, rEdge2Delta, &fCut2))
{
bFinished = true;
- aRetval = (CUTFLAG_LINE|CUTFLAG_END1);
+ aRetval = (CutFlagValue::LINE|CutFlagValue::END1);
}
}
- if(!bFinished && (aCutFlags & CUTFLAG_END2))
+ if(!bFinished && (aCutFlags & CutFlagValue::END2))
{
// end2 on line 1 ?
const B2DPoint aEnd2(rEdge2Start + rEdge2Delta);
@@ -1052,7 +1052,7 @@ namespace basegfx
if(isPointOnEdge(aEnd2, rEdge1Start, rEdge1Delta, &fCut1))
{
bFinished = true;
- aRetval = (CUTFLAG_LINE|CUTFLAG_END2);
+ aRetval = (CutFlagValue::LINE|CutFlagValue::END2);
}
}
@@ -1088,7 +1088,7 @@ namespace basegfx
// inside parameter range edge2, too
if(fTools::more(fCut2, fZero) && fTools::less(fCut2, fOne))
{
- aRetval = CUTFLAG_LINE;
+ aRetval = CutFlagValue::LINE;
}
}
}
diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx
index a5ac050af4fe..b813e03a9b85 100644
--- a/basegfx/source/polygon/b2dtrapezoid.cxx
+++ b/basegfx/source/polygon/b2dtrapezoid.cxx
@@ -390,9 +390,9 @@ namespace basegfx
if(tools::findCut(
aEdgeA.getStart(), aDeltaA,
aEdgeB.getStart(), aDeltaB,
- CUTFLAG_LINE,
+ CutFlagValue::LINE,
&fCutA,
- &fCutB))
+ &fCutB) != CutFlagValue::NONE)
{
// use a simple metric (length criteria) for choosing the numerically
// better cut
diff --git a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
index 9d4813be1194..01e56db4a23c 100644
--- a/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
+++ b/drawinglayer/source/primitive3d/sdrextrudelathetools3d.cxx
@@ -332,7 +332,7 @@ namespace
if(basegfx::tools::findCut(
rStart, aVector,
- aCurrent, aEdgeVector))
+ aCurrent, aEdgeVector) != CutFlagValue::NONE)
{
return true;
}
diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx
index 0fb90cb744ee..dc0cf11f9d6b 100644
--- a/include/basegfx/polygon/b2dpolygontools.hxx
+++ b/include/basegfx/polygon/b2dpolygontools.hxx
@@ -29,9 +29,27 @@
#include <com/sun/star/drawing/FlagSequence.hpp>
#include <vector>
#include <basegfx/basegfxdllapi.h>
+#include <o3tl/typed_flags_set.hxx>
+// Definitions for the cut flags used from the findCut methods
+enum class CutFlagValue
+{
+ NONE = 0x0000,
+ LINE = 0x0001,
+ START1 = 0x0002,
+ START2 = 0x0004,
+ END1 = 0x0008,
+ END2 = 0x0010,
+ ALL = LINE|START1|START2|END1|END2,
+ DEFAULT = LINE|START2|END2,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<CutFlagValue> : is_typed_flags<CutFlagValue, 0x1f> {};
+}
+
namespace basegfx
{
// predefinitions
@@ -123,24 +141,12 @@ namespace basegfx
// #i37443# Subdivide all contained curves.
BASEGFX_DLLPUBLIC B2DPolygon adaptiveSubdivideByCount(const B2DPolygon& rCandidate, sal_uInt32 nCount = 0L);
- // Definitions for the cut flags used from the findCut methods
- typedef sal_uInt16 CutFlagValue;
-
- #define CUTFLAG_NONE (0x0000)
- #define CUTFLAG_LINE (0x0001)
- #define CUTFLAG_START1 (0x0002)
- #define CUTFLAG_START2 (0x0004)
- #define CUTFLAG_END1 (0x0008)
- #define CUTFLAG_END2 (0x0010)
- #define CUTFLAG_ALL (CUTFLAG_LINE|CUTFLAG_START1|CUTFLAG_START2|CUTFLAG_END1|CUTFLAG_END2)
- #define CUTFLAG_DEFAULT (CUTFLAG_LINE|CUTFLAG_START2|CUTFLAG_END2)
-
// This version works with two points and vectors to define the
// edges for the cut test.
BASEGFX_DLLPUBLIC CutFlagValue findCut(
const B2DPoint& rEdge1Start, const B2DVector& rEdge1Delta,
const B2DPoint& rEdge2Start, const B2DVector& rEdge2Delta,
- CutFlagValue aCutFlags = CUTFLAG_DEFAULT,
+ CutFlagValue aCutFlags = CutFlagValue::DEFAULT,
double* pCut1 = 0L, double* pCut2 = 0L);
// test if point is on the given edge in range ]0.0..1.0[ without
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index aa5b5104e2a2..851028690638 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -1395,7 +1395,7 @@ double lcl_GetExtent( const Style& rBorder, const Style& rSide, const Style& rOp
double nCut = 0.0;
basegfx::tools::findCut(
aBasePoint, aBaseVector, aOtherPoint, aOtherVector,
- CUTFLAG_ALL, &nCut );
+ CutFlagValue::ALL, &nCut );
return nCut;
}