diff options
50 files changed, 953 insertions, 893 deletions
diff --git a/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx b/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx index 83b18f9c75c5..dd23a841d51a 100644 --- a/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx +++ b/basegfx/inc/basegfx/curve/b2dcubicbezier.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dcubicbezier.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:46 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,11 +89,11 @@ namespace basegfx B2DCubicBezier& operator=(const B2DCubicBezier& rBezier); // compare operators - sal_Bool operator==(const B2DCubicBezier& rBezier) const; - sal_Bool operator!=(const B2DCubicBezier& rBezier) const; + bool operator==(const B2DCubicBezier& rBezier) const; + bool operator!=(const B2DCubicBezier& rBezier) const; // test if vectors are used - sal_Bool isBezier() const; + bool isBezier() const; // test if contained bezier is trivial and reset vectors accordingly void testAndSolveTrivialBezier(); diff --git a/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx b/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx index 6f81f26d97a7..259b19cc09c5 100644 --- a/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx +++ b/basegfx/inc/basegfx/curve/b2dquadraticbezier.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dquadraticbezier.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:46 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -88,11 +88,11 @@ namespace basegfx B2DQuadraticBezier& operator=(const B2DQuadraticBezier& rBezier); // compare operators - sal_Bool operator==(const B2DQuadraticBezier& rBezier) const; - sal_Bool operator!=(const B2DQuadraticBezier& rBezier) const; + bool operator==(const B2DQuadraticBezier& rBezier) const; + bool operator!=(const B2DQuadraticBezier& rBezier) const; // test if control point is placed on the edge - sal_Bool isBezier() const; + bool isBezier() const; // data interface ::basegfx::B2DPoint getStartPoint() const { return maStartPoint; } diff --git a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx index f574e062f5c1..ff00ea0cc8af 100644 --- a/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx +++ b/basegfx/inc/basegfx/matrix/b2dhommatrix.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dhommatrix.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:47 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -90,15 +90,15 @@ namespace basegfx void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue); // Auf Einheitsmatrix zuruecksetzen - sal_Bool isIdentity() const; + bool isIdentity() const; void identity(); // Invertierung - sal_Bool isInvertible() const; - sal_Bool invert(); + bool isInvertible() const; + bool invert(); // Normalisierung - sal_Bool isNormalized() const; + bool isNormalized() const; void normalize(); // Determinante @@ -128,8 +128,8 @@ namespace basegfx B2DHomMatrix& operator-=(const B2DHomMatrix& rMat); // Vergleichsoperatoren - sal_Bool operator==(const B2DHomMatrix& rMat) const; - sal_Bool operator!=(const B2DHomMatrix& rMat) const; + bool operator==(const B2DHomMatrix& rMat) const; + bool operator!=(const B2DHomMatrix& rMat) const; // Multiplikation, Division mit Konstante B2DHomMatrix& operator*=(double fValue); @@ -144,7 +144,7 @@ namespace basegfx // Help routine to decompose given homogen 3x3 matrix to components. A correction of // the components is done to avoid inaccuracies. // Zerlegung - sal_Bool decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const; + bool decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const; }; // Addition, Subtraktion diff --git a/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx b/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx index e2751a76c3cd..206f8ba82fa7 100644 --- a/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx +++ b/basegfx/inc/basegfx/matrix/b3dhommatrix.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dhommatrix.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:48 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -89,15 +89,15 @@ namespace basegfx double get(sal_uInt16 nRow, sal_uInt16 nColumn) const; void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue); - sal_Bool isIdentity() const; + bool isIdentity() const; /// Reset to the identity matrix void identity(); - sal_Bool isInvertible() const; + bool isInvertible() const; /// Invert the matrix (if possible) - sal_Bool invert(); + bool invert(); - sal_Bool isNormalized() const; + bool isNormalized() const; /// Normalize (i.e. force w=1) the matrix void normalize(); @@ -139,8 +139,8 @@ namespace basegfx B3DHomMatrix& operator-=(const B3DHomMatrix& rMat); // comparison - sal_Bool operator==(const B3DHomMatrix& rMat) const; - sal_Bool operator!=(const B3DHomMatrix& rMat) const; + bool operator==(const B3DHomMatrix& rMat) const; + bool operator!=(const B3DHomMatrix& rMat) const; // multiplication, division by constant value B3DHomMatrix& operator*=(double fValue); @@ -153,7 +153,7 @@ namespace basegfx B3DHomMatrix& operator=(const B3DHomMatrix& rMat); // decomposition - sal_Bool decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const; + bool decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const; }; // addition, subtraction diff --git a/basegfx/inc/basegfx/numeric/ftools.hxx b/basegfx/inc/basegfx/numeric/ftools.hxx index 9ae52843cfe0..44627976da32 100644 --- a/basegfx/inc/basegfx/numeric/ftools.hxx +++ b/basegfx/inc/basegfx/numeric/ftools.hxx @@ -2,9 +2,9 @@ * * $RCSfile: ftools.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:50 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,6 +95,24 @@ #define F_2PI 6.28318530717958647694 #endif +/** Round double to nearest integer + + @return the nearest integer + */ +inline sal_Int32 fround( double fVal ) +{ + return fVal > 0.0 ? static_cast<sal_Int32>( fVal + .5 ) : -static_cast<sal_Int32>( -fVal + .5 ); +} + +/** Round double to nearest integer + + @return the nearest 64 bit integer + */ +inline sal_Int64 fround64( double fVal ) +{ + return fVal > 0.0 ? static_cast<sal_Int64>( fVal + .5 ) : -static_cast<sal_Int64>( -fVal + .5 ); +} + ////////////////////////////////////////////////////////////////////////////// // fTools defines @@ -109,64 +127,64 @@ namespace basegfx static void setSmallValue(const double& rfNew) { mfSmallValue = rfNew; } - static sal_Bool equalZero(const double& rfVal) + static bool equalZero(const double& rfVal) { return (fabs(rfVal) <= getSmallValue()); } - static sal_Bool equalZero(const double& rfVal, const double& rfSmallValue) + static bool equalZero(const double& rfVal, const double& rfSmallValue) { return (fabs(rfVal) <= rfSmallValue); } - static sal_Bool equal(const double& rfValA, const double& rfValB) + static bool equal(const double& rfValA, const double& rfValB) { return (fabs(rfValB - rfValA) <= getSmallValue()); } - static sal_Bool less(const double& rfValA, const double& rfValB) + static bool less(const double& rfValA, const double& rfValB) { return (rfValA < rfValB && !equal(rfValA, rfValB)); } - static sal_Bool lessOrEqual(const double& rfValA, const double& rfValB) + static bool lessOrEqual(const double& rfValA, const double& rfValB) { return (rfValA < rfValB || equal(rfValA, rfValB)); } - static sal_Bool more(const double& rfValA, const double& rfValB) + static bool more(const double& rfValA, const double& rfValB) { return (rfValA > rfValB && !equal(rfValA, rfValB)); } - static sal_Bool moreOrEqual(const double& rfValA, const double& rfValB) + static bool moreOrEqual(const double& rfValA, const double& rfValB) { return (rfValA > rfValB || equal(rfValA, rfValB)); } - static sal_Bool equal(const double& rfValA, const double& rfValB, const double& rfSmallValue) + static bool equal(const double& rfValA, const double& rfValB, const double& rfSmallValue) { return (fabs(rfValB - rfValA) <= rfSmallValue); } - static sal_Bool less(const double& rfValA, const double& rfValB, const double& rfSmallValue) + static bool less(const double& rfValA, const double& rfValB, const double& rfSmallValue) { return (rfValA < rfValB && !equal(rfValA, rfValB, rfSmallValue)); } - static sal_Bool lessOrEqual(const double& rfValA, const double& rfValB, const double& rfSmallValue) + static bool lessOrEqual(const double& rfValA, const double& rfValB, const double& rfSmallValue) { return (rfValA < rfValB || equal(rfValA, rfValB, rfSmallValue)); } - static sal_Bool more(const double& rfValA, const double& rfValB, const double& rfSmallValue) + static bool more(const double& rfValA, const double& rfValB, const double& rfSmallValue) { return (rfValA > rfValB && !equal(rfValA, rfValB, rfSmallValue)); } - static sal_Bool moreOrEqual(const double& rfValA, const double& rfValB, const double& rfSmallValue) + static bool moreOrEqual(const double& rfValA, const double& rfValB, const double& rfSmallValue) { return (rfValA > rfValB || equal(rfValA, rfValB, rfSmallValue)); } diff --git a/basegfx/inc/basegfx/point/b2dhompoint.hxx b/basegfx/inc/basegfx/point/b2dhompoint.hxx index ca5fdb9fb9b0..d08cfa11440e 100644 --- a/basegfx/inc/basegfx/point/b2dhompoint.hxx +++ b/basegfx/inc/basegfx/point/b2dhompoint.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dhompoint.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-12-03 09:24:24 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:54 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,9 +92,9 @@ namespace basegfx /** Test if this homogen point does have a homogenous part - @return Returns sal_True if this point has no homogenous part + @return Returns true if this point has no homogenous part */ - sal_Bool implIsHomogenized() const; + bool implIsHomogenized() const; /** Remove homogenous part of this Point @@ -119,12 +119,10 @@ namespace basegfx public: /** Create a homogen point - @param fVal - This parameter is used to initialize the coordinate - part of the Point. The homogenous part is initialized to 1.0. + The point is initialized to (0.0, 0.0) */ - B2DHomPoint(double fVal = 0.0) - : maTuple(fVal), + B2DHomPoint() + : maTuple(), mfW(1.0) {} @@ -149,7 +147,7 @@ namespace basegfx The 2D point which will be copied. The homogenous part is initialized to 1.0. */ - B2DHomPoint(const B2DPoint& rVec) + explicit B2DHomPoint(const B2DPoint& rVec) : maTuple(rVec), mfW(1.0) {} @@ -233,9 +231,9 @@ namespace basegfx B2DHomPoint& operator-(void); - sal_Bool operator==( const B2DHomPoint& rPnt ) const; + bool operator==( const B2DHomPoint& rPnt ) const; - sal_Bool operator!=( const B2DHomPoint& rPnt ) const; + bool operator!=( const B2DHomPoint& rPnt ) const; B2DHomPoint& operator=( const B2DHomPoint& rPnt ); }; diff --git a/basegfx/inc/basegfx/point/b2dpoint.hxx b/basegfx/inc/basegfx/point/b2dpoint.hxx index ed07229f4e59..b9c29ee312f9 100644 --- a/basegfx/inc/basegfx/point/b2dpoint.hxx +++ b/basegfx/inc/basegfx/point/b2dpoint.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpoint.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:51 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,12 +84,10 @@ namespace basegfx public: /** Create a 2D Point - @param fVal - This parameter is used to initialize the coordinate - part of the 2D Point. + The point is initialized to (0.0, 0.0) */ - B2DPoint(double fVal = 0.0) - : B2DTuple(fVal) + B2DPoint() + : B2DTuple() {} /** Create a 2D Point @@ -118,7 +116,7 @@ namespace basegfx /** constructor with tuple to allow copy-constructing from B2DTuple-based classes */ - B2DPoint(const ::basegfx::B2DTuple& rTuple) + explicit B2DPoint(const ::basegfx::B2DTuple& rTuple) : B2DTuple(rTuple) {} diff --git a/basegfx/inc/basegfx/point/b3dhompoint.hxx b/basegfx/inc/basegfx/point/b3dhompoint.hxx index 2366ea578d70..d84dc8c9ef18 100644 --- a/basegfx/inc/basegfx/point/b3dhompoint.hxx +++ b/basegfx/inc/basegfx/point/b3dhompoint.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dhompoint.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2003-12-03 09:24:25 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:56 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,9 +92,9 @@ namespace basegfx /** Test if this homogen point does have a homogenous part - @return Returns sal_True if this point has no homogenous part + @return Returns true if this point has no homogenous part */ - sal_Bool implIsHomogenized() const + bool implIsHomogenized() const { const double fOne(1.0); return ::basegfx::fTools::equal(mfW, fOne); @@ -127,12 +127,10 @@ namespace basegfx public: /** Create a homogen point - @param fVal - This parameter is used to initialize the coordinate - part of the Point. The homogenous part is initialized to 1.0. + The point is initialized to (0.0, 0.0, 0.0) */ - B3DHomPoint(double fVal = 0.0) - : maTuple(fVal), + B3DHomPoint() + : maTuple(), mfW(1.0) {} @@ -161,7 +159,7 @@ namespace basegfx The 3D point which will be copied. The homogenous part is initialized to 1.0. */ - B3DHomPoint(const B3DPoint& rVec) + explicit B3DHomPoint(const B3DPoint& rVec) : maTuple(rVec), mfW(1.0) {} @@ -320,13 +318,13 @@ namespace basegfx return *this; } - sal_Bool operator==( const B3DHomPoint& rPnt ) const + bool operator==( const B3DHomPoint& rPnt ) const { implTestAndHomogenize(); return (maTuple == rPnt.maTuple); } - sal_Bool operator!=( const B3DHomPoint& rPnt ) const + bool operator!=( const B3DHomPoint& rPnt ) const { implTestAndHomogenize(); return (maTuple != rPnt.maTuple); diff --git a/basegfx/inc/basegfx/point/b3dpoint.hxx b/basegfx/inc/basegfx/point/b3dpoint.hxx index 06a4b7e346e1..6dcbad842e9b 100644 --- a/basegfx/inc/basegfx/point/b3dpoint.hxx +++ b/basegfx/inc/basegfx/point/b3dpoint.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dpoint.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:51 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:57 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,12 +84,10 @@ namespace basegfx public: /** Create a 3D Point - @param fVal - This parameter is used to initialize the coordinate - part of the 3D Point. + The point is initialized to (0.0, 0.0, 0.0) */ - B3DPoint(double fVal = 0.0) - : B3DTuple(fVal) + B3DPoint() + : B3DTuple() {} /** Create a 3D Point @@ -122,7 +120,7 @@ namespace basegfx /** constructor with tuple to allow copy-constructing from B3DTuple-based classes */ - B3DPoint(const ::basegfx::B3DTuple& rTuple) + explicit B3DPoint(const ::basegfx::B3DTuple& rTuple) : B3DTuple(rTuple) {} diff --git a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx index 610ce5c75df6..8bc81e641f09 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygon.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolygon.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:52 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -102,8 +102,8 @@ namespace basegfx B2DPolygon& operator=(const B2DPolygon& rPolygon); // compare operators - sal_Bool operator==(const B2DPolygon& rPolygon) const; - sal_Bool operator!=(const B2DPolygon& rPolygon) const; + bool operator==(const B2DPolygon& rPolygon) const; + bool operator!=(const B2DPolygon& rPolygon) const; // member count sal_uInt32 count() const; @@ -121,7 +121,7 @@ namespace basegfx void setControlVectorA(sal_uInt32 nIndex, const ::basegfx::B2DVector& rValue); ::basegfx::B2DVector getControlVectorB(sal_uInt32 nIndex) const; void setControlVectorB(sal_uInt32 nIndex, const ::basegfx::B2DVector& rValue); - sal_Bool areControlPointsUsed() const; + bool areControlPointsUsed() const; // insert/append other 2D polygons void insert(sal_uInt32 nIndex, const B2DPolygon& rPoly, sal_uInt32 nIndex2 = 0, sal_uInt32 nCount = 0); @@ -134,14 +134,14 @@ namespace basegfx void clear(); // closed state - sal_Bool isClosed() const; - void setClosed(sal_Bool bNew); + bool isClosed() const; + void setClosed(bool bNew); // flip polygon direction void flip(); // test if Polygon has double points - sal_Bool hasDoublePoints() const; + bool hasDoublePoints() const; // remove double points, at the begin/end and follow-ups, too void removeDoublePoints(); diff --git a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx index 4da9f650a526..3412198c3a68 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolygontools.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolygontools.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:53 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:33:59 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,62 +91,62 @@ namespace basegfx method corrects this (removes double start/end points) and sets the Closed()-state of the polygon correctly. */ - void checkClosed(::basegfx::B2DPolygon& rCandidate); + void checkClosed(B2DPolygon& rCandidate); // Get index of outmost point (e.g. biggest X and biggest Y) - sal_uInt32 getIndexOfOutmostPoint(const ::basegfx::B2DPolygon& rCandidate); + sal_uInt32 getIndexOfOutmostPoint(const B2DPolygon& rCandidate); // Get successor and predecessor indices. Returning the same index means there // is none. Same for successor. - sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate); - sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate); + sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate); + sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate); // Get index of first different predecessor. Returning the same index means there // is none. Same for successor. - sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate); - sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate); + sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate); + sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate); // Get orientation of Polygon - ::basegfx::B2DVectorOrientation getOrientation(const ::basegfx::B2DPolygon& rCandidate); + B2VectorOrientation getOrientation(const B2DPolygon& rCandidate); // isInside tests for B2dPoint and other B2dPolygon. On border is not inside as long as - // not sal_True is given in bWithBorder flag. - sal_Bool isInside(const ::basegfx::B2DPolygon& rCandidate, const ::basegfx::B2DPoint& rPoint, sal_Bool bWithBorder = sal_False); - sal_Bool isInside(const ::basegfx::B2DPolygon& rCandidate, const ::basegfx::B2DPolygon& rPolygon, sal_Bool bWithBorder = sal_False); + // not true is given in bWithBorder flag. + bool isInside(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder = false); + bool isInside(const B2DPolygon& rCandidate, const B2DPolygon& rPolygon, bool bWithBorder = false); // get size of polygon. Control vectors are included in that ranges. - ::basegfx::B2DRange getRange(const ::basegfx::B2DPolygon& rCandidate); + B2DRange getRange(const B2DPolygon& rCandidate); // get area of polygon - double getArea(const ::basegfx::B2DPolygon& rCandidate); + double getArea(const B2DPolygon& rCandidate); // get length of polygon edge from point nIndex to nIndex + 1 - double getEdgeLength(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nIndex); + double getEdgeLength(const B2DPolygon& rCandidate, sal_uInt32 nIndex); // get length of polygon - double getLength(const ::basegfx::B2DPolygon& rCandidate); + double getLength(const B2DPolygon& rCandidate); // get position on polygon for absolute given distance. If // length is given, it is assumed the correct polygon length, if 0.0 it is calculated // using getLength(...) - ::basegfx::B2DPoint getPositionAbsolute(const ::basegfx::B2DPolygon& rCandidate, double fDistance, double fLength = 0.0); + B2DPoint getPositionAbsolute(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0); // get position on polygon for relative given distance in range [0.0 .. 1.0]. If // length is given, it is assumed the correct polygon length, if 0.0 it is calculated // using getLength(...) - ::basegfx::B2DPoint getPositionRelative(const ::basegfx::B2DPolygon& rCandidate, double fDistance, double fLength = 0.0); + B2DPoint getPositionRelative(const B2DPolygon& rCandidate, double fDistance, double fLength = 0.0); // get orientation at given polygon point - ::basegfx::B2DVectorOrientation getPointOrientation(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nIndex); + B2VectorOrientation getPointOrientation(const B2DPolygon& rCandidate, sal_uInt32 nIndex); // Continuity check for point with given index - ::basegfx::B2DVectorContinuity getContinuityInPoint(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nIndex); + B2VectorContinuity getContinuityInPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex); // Subdivide all contained curves. Use distanceBound value if given. - ::basegfx::B2DPolygon adaptiveSubdivideByDistance(const ::basegfx::B2DPolygon& rCandidate, double fDistanceBound = 0.0); + B2DPolygon adaptiveSubdivideByDistance(const B2DPolygon& rCandidate, double fDistanceBound = 0.0); // Subdivide all contained curves. Use distanceBound value if given. - ::basegfx::B2DPolygon adaptiveSubdivideByAngle(const ::basegfx::B2DPolygon& rCandidate, double fAngleBound = 5.0); + B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon& rCandidate, double fAngleBound = 5.0); // Definitions for the cut flags used from the findCut methods typedef sal_uInt16 CutFlagValue; @@ -164,7 +164,7 @@ namespace basegfx // and pCut2 will contain the cut coordinate on each edge in ]0.0, 1.0] // (if given) and the return value will contain a cut description. CutFlagValue findCut( - const ::basegfx::B2DPolygon& rCandidate, + const B2DPolygon& rCandidate, sal_uInt32 nIndex1, sal_uInt32 nIndex2, CutFlagValue aCutFlags = CUTFLAG_DEFAULT, double* pCut1 = 0L, double* pCut2 = 0L); @@ -172,26 +172,26 @@ namespace basegfx // This version is working with two indexed edges from different // polygons. CutFlagValue findCut( - const ::basegfx::B2DPolygon& rCandidate1, sal_uInt32 nIndex1, - const ::basegfx::B2DPolygon& rCandidate2, sal_uInt32 nIndex2, + const B2DPolygon& rCandidate1, sal_uInt32 nIndex1, + const B2DPolygon& rCandidate2, sal_uInt32 nIndex2, CutFlagValue aCutFlags = CUTFLAG_DEFAULT, double* pCut1 = 0L, double* pCut2 = 0L); // This version works with two points and vectors to define the // edges for the cut test. CutFlagValue findCut( - const ::basegfx::B2DPoint& rEdge1Start, const ::basegfx::B2DVector& rEdge1Delta, - const ::basegfx::B2DPoint& rEdge2Start, const ::basegfx::B2DVector& rEdge2Delta, + const B2DPoint& rEdge1Start, const B2DVector& rEdge1Delta, + const B2DPoint& rEdge2Start, const B2DVector& rEdge2Delta, CutFlagValue aCutFlags = CUTFLAG_DEFAULT, double* pCut1 = 0L, double* pCut2 = 0L); // test if point is on the given edge in range ]0.0..1.0[ without - // the start/end points. If so, return sal_True and put the parameter + // the start/end points. If so, return true and put the parameter // value in pCut (if provided) - sal_Bool isPointOnEdge( - const ::basegfx::B2DPoint& rPoint, - const ::basegfx::B2DPoint& rEdgeStart, - const ::basegfx::B2DVector& rEdgeDelta, + bool isPointOnEdge( + const B2DPoint& rPoint, + const B2DPoint& rEdgeStart, + const B2DVector& rEdgeDelta, double* pCut = 0L); diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx index 1bffaee504f4..2fe9ea8b7063 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygon.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolypolygon.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:53 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:00 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,8 +97,8 @@ namespace basegfx B2DPolyPolygon& operator=(const B2DPolyPolygon& rPolyPolygon); // compare operators - sal_Bool operator==(const B2DPolyPolygon& rPolyPolygon) const; - sal_Bool operator!=(const B2DPolyPolygon& rPolyPolygon) const; + bool operator==(const B2DPolyPolygon& rPolyPolygon) const; + bool operator!=(const B2DPolyPolygon& rPolyPolygon) const; // polygon interface sal_uInt32 count() const; @@ -107,7 +107,7 @@ namespace basegfx void setB2DPolygon(sal_uInt32 nIndex, const B2DPolygon& rPolygon); // test for curve - sal_Bool areControlPointsUsed() const; + bool areControlPointsUsed() const; // insert/append single polygon void insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount = 1); @@ -124,14 +124,14 @@ namespace basegfx void clear(); // closed state - sal_Bool isClosed() const; - void setClosed(sal_Bool bNew); + bool isClosed() const; + void setClosed(bool bNew); // flip polygon direction void flip(); // test if PolyPolygon has double points - sal_Bool hasDoublePoints() const; + bool hasDoublePoints() const; // remove double points, at the begin/end and follow-ups, too void removeDoublePoints(); diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx index 641045afa14e..02e1872a71ba 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygoncutter.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolypolygoncutter.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:53 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:01 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -119,14 +119,14 @@ namespace basegfx void addToList(B2DPolygonNode*& rpList); void remFromList(B2DPolygonNode*& rpList); - sal_Bool getOrientation() const; + bool getOrientation() const; void swapOrientation(); ::basegfx::B2DRange getRange() const; // isInside tests for B2dPoint and other B2DPolygonNode Polygon. On border is not inside as long as - // not sal_True is given in bWithBorder flag. - sal_Bool isInside(const ::basegfx::B2DPoint& rPnt, sal_Bool bWithBorder = sal_False) const; - sal_Bool isPolygonInside(B2DPolygonNode* pPoly, sal_Bool bWithBorder = sal_False) const; + // not true is given in bWithBorder flag. + bool isInside(const ::basegfx::B2DPoint& rPnt, bool bWithBorder = false) const; + bool isPolygonInside(B2DPolygonNode* pPoly, bool bWithBorder = false) const; }; // a type definition to have a vector of pointers to B2DPolygonNodes @@ -149,7 +149,7 @@ namespace basegfx unsigned mbOrientation : 1; public: - B2DSimpleCut(B2DPolygonNode* pL, B2DPolygonNode* pR, sal_Bool bCoOr = sal_False, sal_Bool bOr = sal_True) + B2DSimpleCut(B2DPolygonNode* pL, B2DPolygonNode* pR, bool bCoOr = false, bool bOr = true) : mpLeft(pL), mpRight(pR), mbCorrectOrientation(bCoOr), @@ -161,7 +161,7 @@ namespace basegfx B2DPolygonNode* getLeft() const { return mpLeft; } B2DPolygonNode* getRight() const { return mpRight; } - sal_Bool isSameCut(B2DPolygonNode* pA, B2DPolygonNode* pB) const + bool isSameCut(B2DPolygonNode* pA, B2DPolygonNode* pB) const { return ((pA == mpLeft && pB == mpRight) || (pB == mpLeft && pA == mpRight)); } @@ -190,10 +190,10 @@ namespace basegfx void init(B2DPolygonNode* pNew); const ::basegfx::B2DRange& getRange() const { return maRange; } - sal_Bool getOrientation() const { return mbOrientation; } + bool getOrientation() const { return mbOrientation; } sal_Int32 getDepth() const { return mnDepth; } - void changeDepth(sal_Bool bOrientation); + void changeDepth(bool bOrientation); }; } // end of namespace basegfx @@ -209,22 +209,22 @@ namespace basegfx B2DPolyPolygon maNotClosedPolygons; // help routines - sal_Bool isSamePos(const ::basegfx::B2DPoint& rPntA, const ::basegfx::B2DPoint& rPntB) + bool isSamePos(const ::basegfx::B2DPoint& rPntA, const ::basegfx::B2DPoint& rPntB) { return rPntA.equal(rPntB); } B2DSimpleCut* getExistingCut(B2DSimpleCutVector& rTmpCuts, B2DPolygonNode* pA, B2DPolygonNode* pB); B2DPolygonNode* extractNextPolygon(B2DPolygonNode*& rpList); - sal_Bool isCrossover(B2DPolygonNode* pA, B2DPolygonNode* pB); - sal_Bool isCrossover(B2DSimpleCut* pEnter, B2DSimpleCut* pLeave); + bool isCrossover(B2DPolygonNode* pA, B2DPolygonNode* pB); + bool isCrossover(B2DSimpleCut* pEnter, B2DSimpleCut* pLeave); - sal_Bool isNextSamePos(B2DPolygonNode* pA, B2DPolygonNode* pB) + bool isNextSamePos(B2DPolygonNode* pA, B2DPolygonNode* pB) { return isSamePos(pA->getNext()->getPosition(), pB->getNext()->getPosition()); } - sal_Bool isPrevSamePos(B2DPolygonNode* pA, B2DPolygonNode* pB) + bool isPrevSamePos(B2DPolygonNode* pA, B2DPolygonNode* pB) { return isSamePos(pA->getPrevious()->getPosition(), pB->getPrevious()->getPosition()); } @@ -235,12 +235,12 @@ namespace basegfx void polysToList(B2DPolygonNode*& rpList); void listToPolys(B2DPolygonNode*& rpList); - sal_Bool doRangesIntersect(const ::basegfx::B2DRange& rRange1, const ::basegfx::B2DRange& rRange2) const + bool doRangesIntersect(const ::basegfx::B2DRange& rRange1, const ::basegfx::B2DRange& rRange2) const { return rRange1.overlaps(rRange2); } - sal_Bool doRangesInclude(const ::basegfx::B2DRange& rRange1, const ::basegfx::B2DRange& rRange2) const + bool doRangesInclude(const ::basegfx::B2DRange& rRange1, const ::basegfx::B2DRange& rRange2) const { return rRange1.isInside(rRange2); } @@ -252,7 +252,7 @@ namespace basegfx ~B2DPolyPolygonCutter(); // put/get poly - void addPolyPolygon(const B2DPolyPolygon& rPolyPolygon, sal_Bool bForceOrientation = sal_False); + void addPolyPolygon(const B2DPolyPolygon& rPolyPolygon, bool bForceOrientation = false); void getPolyPolygon(B2DPolyPolygon& rPolyPolygon); // transformations @@ -260,7 +260,7 @@ namespace basegfx void removeDoubleIntersections(); // remove included - void removeIncludedPolygons(sal_Bool bUseOr = sal_True); + void removeIncludedPolygons(bool bUseOr = true); }; } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx index f51f64e9ec23..2e5843c2fbe1 100644 --- a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx +++ b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolypolygontools.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:53 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -98,12 +98,12 @@ namespace basegfx // in the given PolyPolygon. Only closed polygons are handled. The non-closed // polygons or the ones with less than 3 points are preserved, but not // computed. - // bForceOrientation: If sal_True, the orientations of all contained polygons + // bForceOrientation: If true, the orientations of all contained polygons // is changed to ORIENTATION_POSITIVE before computing. - // bInvertRemove: if sal_True, created polygons which are inside others and + // bInvertRemove: if true, created polygons which are inside others and // have the same orientation are removed (cleanup). void removeIntersections(::basegfx::B2DPolyPolygon& rCandidate, - sal_Bool bForceOrientation = sal_True, sal_Bool bInvertRemove = sal_False); + bool bForceOrientation = true, bool bInvertRemove = false); // Subdivide all contained curves. Use distanceBound value if given. ::basegfx::B2DPolyPolygon adaptiveSubdivideByDistance(const ::basegfx::B2DPolyPolygon& rCandidate, double fDistanceBound = 0.0); diff --git a/basegfx/inc/basegfx/polygon/b3dpolygon.hxx b/basegfx/inc/basegfx/polygon/b3dpolygon.hxx index ef18da4035f9..8db419704fce 100644 --- a/basegfx/inc/basegfx/polygon/b3dpolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b3dpolygon.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dpolygon.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:53 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -101,8 +101,8 @@ namespace basegfx B3DPolygon& operator=(const B3DPolygon& rPolygon); // compare operators - sal_Bool operator==(const B3DPolygon& rPolygon) const; - sal_Bool operator!=(const B3DPolygon& rPolygon) const; + bool operator==(const B3DPolygon& rPolygon) const; + bool operator!=(const B3DPolygon& rPolygon) const; // member count sal_uInt32 count() const; @@ -126,14 +126,14 @@ namespace basegfx void clear(); // closed state - sal_Bool isClosed() const; - void setClosed(sal_Bool bNew); + bool isClosed() const; + void setClosed(bool bNew); // flip polygon direction void flip(); // test if Polygon has double points - sal_Bool hasDoublePoints() const; + bool hasDoublePoints() const; // remove double points, at the begin/end and follow-ups, too void removeDoublePoints(); diff --git a/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx b/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx index c3a84e3e8750..875e8d431e13 100644 --- a/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx +++ b/basegfx/inc/basegfx/polygon/b3dpolypolygon.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dpolypolygon.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:54 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -97,8 +97,8 @@ namespace basegfx B3DPolyPolygon& operator=(const B3DPolyPolygon& rPolyPolygon); // compare operators - sal_Bool operator==(const B3DPolyPolygon& rPolyPolygon) const; - sal_Bool operator!=(const B3DPolyPolygon& rPolyPolygon) const; + bool operator==(const B3DPolyPolygon& rPolyPolygon) const; + bool operator!=(const B3DPolyPolygon& rPolyPolygon) const; // polygon interface sal_uInt32 count() const; @@ -121,14 +121,14 @@ namespace basegfx void clear(); // closed state - sal_Bool isClosed() const; - void setClosed(sal_Bool bNew); + bool isClosed() const; + void setClosed(bool bNew); // flip polygon direction void flip(); // test if PolyPolygon has double points - sal_Bool hasDoublePoints() const; + bool hasDoublePoints() const; // remove double points, at the begin/end and follow-ups, too void removeDoublePoints(); diff --git a/basegfx/inc/basegfx/range/b1drange.hxx b/basegfx/inc/basegfx/range/b1drange.hxx index 4bb457b28d35..d31e6c65ee73 100644 --- a/basegfx/inc/basegfx/range/b1drange.hxx +++ b/basegfx/inc/basegfx/range/b1drange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b1drange.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:56 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -66,18 +66,19 @@ #include <basegfx/range/basicrange.hxx> #endif + namespace basegfx { class B1DRange { - ::basegfx::BasicRange maRange; + ::basegfx::BasicRange< double, DoubleTraits > maRange; public: B1DRange() { } - B1DRange(double fStartValue) + explicit B1DRange(double fStartValue) : maRange(fStartValue) { } @@ -87,7 +88,7 @@ namespace basegfx { } - sal_Bool isEmpty() const + bool isEmpty() const { return maRange.isEmpty(); } @@ -122,17 +123,17 @@ namespace basegfx return maRange.getCenter(); } - sal_Bool isInside(double fValue) const + bool isInside(double fValue) const { return maRange.isInside(fValue); } - sal_Bool isInside(const B1DRange& rRange) const + bool isInside(const B1DRange& rRange) const { return maRange.isInside(rRange.maRange); } - sal_Bool overlaps(const B1DRange& rRange) const + bool overlaps(const B1DRange& rRange) const { return maRange.overlaps(rRange.maRange); } diff --git a/basegfx/inc/basegfx/range/b2drange.hxx b/basegfx/inc/basegfx/range/b2drange.hxx index c30d461f259a..6c0e90fbff56 100644 --- a/basegfx/inc/basegfx/range/b2drange.hxx +++ b/basegfx/inc/basegfx/range/b2drange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2drange.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:56 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:07 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,15 +74,17 @@ namespace basegfx { class B2DRange { - ::basegfx::BasicRange maRangeX; - ::basegfx::BasicRange maRangeY; + typedef ::basegfx::BasicRange< double, DoubleTraits > MyBasicRange; + + MyBasicRange maRangeX; + MyBasicRange maRangeY; public: B2DRange() { } - B2DRange(const B2DTuple& rTuple) + explicit B2DRange(const B2DTuple& rTuple) : maRangeX(rTuple.getX()), maRangeY(rTuple.getY()) { @@ -94,7 +96,7 @@ namespace basegfx { } - sal_Bool isEmpty() const + bool isEmpty() const { return ( maRangeX.isEmpty() @@ -146,7 +148,7 @@ namespace basegfx ); } - sal_Bool isInside(const B2DTuple& rTuple) const + bool isInside(const B2DTuple& rTuple) const { return ( maRangeX.isInside(rTuple.getX()) @@ -154,7 +156,7 @@ namespace basegfx ); } - sal_Bool isInside(const B2DRange& rRange) const + bool isInside(const B2DRange& rRange) const { return ( maRangeX.isInside(rRange.maRangeX) @@ -162,7 +164,7 @@ namespace basegfx ); } - sal_Bool overlaps(const B2DRange& rRange) const + bool overlaps(const B2DRange& rRange) const { return ( maRangeX.overlaps(rRange.maRangeX) @@ -182,6 +184,7 @@ namespace basegfx maRangeY.expand(rRange.maRangeY); } }; + } // end of namespace basegfx #endif // _BGFX_RANGE_B2DRANGE_HXX diff --git a/basegfx/inc/basegfx/range/b3drange.hxx b/basegfx/inc/basegfx/range/b3drange.hxx index a4d5be99f6ec..d5128934e309 100644 --- a/basegfx/inc/basegfx/range/b3drange.hxx +++ b/basegfx/inc/basegfx/range/b3drange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b3drange.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:56 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,16 +74,18 @@ namespace basegfx { class B3DRange { - ::basegfx::BasicRange maRangeX; - ::basegfx::BasicRange maRangeY; - ::basegfx::BasicRange maRangeZ; + typedef ::basegfx::BasicRange< double, DoubleTraits > MyBasicRange; + + MyBasicRange maRangeX; + MyBasicRange maRangeY; + MyBasicRange maRangeZ; public: B3DRange() { } - B3DRange(const B3DTuple& rTuple) + explicit B3DRange(const B3DTuple& rTuple) : maRangeX(rTuple.getX()), maRangeY(rTuple.getY()), maRangeZ(rTuple.getZ()) @@ -97,7 +99,7 @@ namespace basegfx { } - sal_Bool isEmpty() const + bool isEmpty() const { return ( maRangeX.isEmpty() @@ -156,7 +158,7 @@ namespace basegfx ); } - sal_Bool isInside(const B3DTuple& rTuple) const + bool isInside(const B3DTuple& rTuple) const { return ( maRangeX.isInside(rTuple.getX()) @@ -165,7 +167,7 @@ namespace basegfx ); } - sal_Bool isInside(const B3DRange& rRange) const + bool isInside(const B3DRange& rRange) const { return ( maRangeX.isInside(rRange.maRangeX) @@ -174,7 +176,7 @@ namespace basegfx ); } - sal_Bool overlaps(const B3DRange& rRange) const + bool overlaps(const B3DRange& rRange) const { return ( maRangeX.overlaps(rRange.maRangeX) diff --git a/basegfx/inc/basegfx/range/basicrange.hxx b/basegfx/inc/basegfx/range/basicrange.hxx index 732a95abcf70..120e930c4523 100644 --- a/basegfx/inc/basegfx/range/basicrange.hxx +++ b/basegfx/inc/basegfx/range/basicrange.hxx @@ -2,9 +2,9 @@ * * $RCSfile: basicrange.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:56 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:10 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,105 +70,124 @@ #include <float.h> #endif -#define START_MINIMUM_VALUE (DBL_MAX) -#define START_MAXIMUM_VALUE (DBL_MIN) namespace basegfx { - class BasicRange + template< typename T, typename Traits > class BasicRange { protected: - double mfMinimum; - double mfMaximum; + T mnMinimum; + T mnMaximum; public: - void reset() + BasicRange() : + mnMinimum(Traits::initMin()), + mnMaximum(Traits::initMax()) { - mfMinimum = START_MINIMUM_VALUE; - mfMaximum = START_MAXIMUM_VALUE; } - sal_Bool isEmpty() const + BasicRange( T nValue ) : + mnMinimum(nValue), + mnMaximum(nValue) { - return sal_Bool(START_MINIMUM_VALUE == mfMinimum && START_MAXIMUM_VALUE == mfMaximum); } - double getMinimum() const { return mfMinimum; } - double getMaximum() const { return mfMaximum; } - - double getRange() const + BasicRange(const BasicRange& rRange) : + mnMinimum(rRange.mnMinimum), + mnMaximum(rRange.mnMaximum) { - return (mfMaximum - mfMinimum); } - double getCenter() const + void reset() { - return ((mfMaximum + mfMinimum) / 2.0); + mnMinimum = Traits::initMin(); + mnMaximum = Traits::initMax(); } - sal_Bool isInside(double fValue) const + bool isEmpty() const { - return sal_Bool((fValue >= mfMinimum) && (fValue <= mfMaximum)); + return Traits::initMin() == mnMinimum && Traits::initMax() == mnMaximum; } - sal_Bool isInside(const BasicRange& rRange) const - { - return sal_Bool((rRange.getMinimum() >= mfMinimum) && (rRange.getMaximum() <= mfMaximum)); - } + T getMinimum() const { return mnMinimum; } + T getMaximum() const { return mnMaximum; } - sal_Bool overlaps(const BasicRange& rRange) const + double getCenter() const { - return !sal_Bool((rRange.getMaximum() < mfMinimum) || (rRange.getMinimum() > mfMaximum)); + return ((mnMaximum + mnMinimum) / 2.0); } - BasicRange() - : mfMinimum(START_MINIMUM_VALUE), - mfMaximum(START_MAXIMUM_VALUE) + bool isInside(T nValue) const { + return (nValue >= mnMinimum) && (nValue <= mnMaximum); } - BasicRange(double fStartValue) - : mfMinimum(fStartValue), - mfMaximum(fStartValue) + + bool isInside(const BasicRange& rRange) const { + return (rRange.mnMinimum >= mnMinimum) && (rRange.mnMaximum <= mnMaximum); } - BasicRange(const BasicRange& rRange) - : mfMinimum(rRange.getMinimum()), - mfMaximum(rRange.getMaximum()) + + bool overlaps(const BasicRange& rRange) const { + return !((rRange.mnMinimum < mnMinimum) || (rRange.mnMaximum > mnMaximum)); } void operator=(const BasicRange& rRange) { - mfMinimum = rRange.getMinimum(); - mfMaximum = rRange.getMaximum(); + mnMinimum = rRange.mnMinimum; + mnMaximum = rRange.mnMaximum; } - void expand(double fValue) + void expand(T nValue) { - if(fValue < mfMinimum) + if(nValue < mnMinimum) { - mfMinimum = fValue; + mnMinimum = nValue; } - if(fValue > mfMaximum) + if(nValue > mnMaximum) { - mfMaximum = fValue; + mnMaximum = nValue; } } void expand(const BasicRange& rRange) { - if(rRange.getMinimum() < mfMinimum) + if(rRange.mnMinimum < mnMinimum) { - mfMinimum = rRange.getMinimum(); + mnMinimum = rRange.mnMinimum; } - if(rRange.getMaximum() > mfMaximum) + if(rRange.mnMaximum > mnMaximum) { - mfMaximum = rRange.getMaximum(); + mnMaximum = rRange.mnMaximum; } } + + typename Traits::DifferenceType getRange() const + { + return (mnMaximum - mnMinimum); + } + + }; + + // some pre-fabricated traits + struct DoubleTraits + { + static double initMin() { return DBL_MAX; }; + static double initMax() { return DBL_MIN; }; + + typedef double DifferenceType; }; + + struct Int32Traits + { + static sal_Int32 initMin() { return 0x7FFFFFFFL; }; + static sal_Int32 initMax() { return 0x80000000UL; }; + + typedef sal_Int64 DifferenceType; + }; + } // end of namespace basegfx #endif _BGFX_RANGE_BASICRANGE_HXX diff --git a/basegfx/inc/basegfx/tuple/b2dtuple.hxx b/basegfx/inc/basegfx/tuple/b2dtuple.hxx index c16cb545fa9a..e83b8cfc2e7e 100644 --- a/basegfx/inc/basegfx/tuple/b2dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b2dtuple.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dtuple.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-12-03 09:24:26 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,13 +92,11 @@ namespace basegfx public: /** Create a 2D Tuple - @param fVal - This parameter is used to initialize the coordinate - part of the 2D Tuple. + The tuple is initialized to (0.0, 0.0) */ - B2DTuple(double fVal = 0.0) - : mfX(fVal), - mfY(fVal) + B2DTuple() + : mfX(0.0), + mfY(0.0) {} /** Create a 2D Tuple @@ -174,13 +172,13 @@ namespace basegfx // comparators with tolerance ////////////////////////////////////////////////////////////////////// - sal_Bool equalZero() const; + bool equalZero() const; - sal_Bool equalZero(const double& rfSmallValue) const; + bool equalZero(const double& rfSmallValue) const; - sal_Bool equal(const B2DTuple& rTup) const; + bool equal(const B2DTuple& rTup) const; - sal_Bool equal(const B2DTuple& rTup, const double& rfSmallValue) const; + bool equal(const B2DTuple& rTup, const double& rfSmallValue) const; // operators ////////////////////////////////////////////////////////////////////// @@ -233,12 +231,12 @@ namespace basegfx return B2DTuple(-mfX, -mfY); } - sal_Bool operator==( const B2DTuple& rTup ) const + bool operator==( const B2DTuple& rTup ) const { return equal(rTup); } - sal_Bool operator!=( const B2DTuple& rTup ) const + bool operator!=( const B2DTuple& rTup ) const { return !equal(rTup); } @@ -360,8 +358,9 @@ namespace basegfx inline B2DTuple operator/(double t, const B2DTuple& rTup) { - B2DTuple aNew(rTup); - aNew /= t; + B2DTuple aNew(t, t); + B2DTuple aTmp(rTup); + aNew /= aTmp; return aNew; } } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/tuple/b3dtuple.hxx b/basegfx/inc/basegfx/tuple/b3dtuple.hxx index e57e71b8e3e1..e40794cc41b7 100644 --- a/basegfx/inc/basegfx/tuple/b3dtuple.hxx +++ b/basegfx/inc/basegfx/tuple/b3dtuple.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dtuple.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2003-12-03 09:24:26 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:12 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,10 +62,15 @@ #ifndef _BGFX_TUPLE_B3DTUPLE_HXX #define _BGFX_TUPLE_B3DTUPLE_HXX +#ifndef _SAL_TYPES_H_ +#include <sal/types.h> +#endif + #ifndef _BGFX_NUMERIC_FTOOLS_HXX #include <basegfx/numeric/ftools.hxx> #endif + namespace basegfx { /** Base class for all Points/Vectors with three double values @@ -89,14 +94,12 @@ namespace basegfx public: /** Create a 3D Tuple - @param fVal - This parameter is used to initialize the coordinate - part of the 3D Tuple. + The tuple is initialized to (0.0, 0.0, 0.0) */ - B3DTuple(double fVal = 0.0) - : mfX(fVal), - mfY(fVal), - mfZ(fVal) + B3DTuple() + : mfX(0.0), + mfY(0.0), + mfZ(0.0) {} /** Create a 3D Tuple @@ -190,7 +193,7 @@ namespace basegfx // comparators with tolerance ////////////////////////////////////////////////////////////////////// - sal_Bool equalZero() const + bool equalZero() const { return (this == &maEmptyTuple || (::basegfx::fTools::equalZero(mfX) @@ -198,7 +201,7 @@ namespace basegfx && ::basegfx::fTools::equalZero(mfZ))); } - sal_Bool equalZero(const double& rfSmallValue) const + bool equalZero(const double& rfSmallValue) const { return (this == &maEmptyTuple || (::basegfx::fTools::equalZero(mfX, rfSmallValue) @@ -206,7 +209,7 @@ namespace basegfx && ::basegfx::fTools::equalZero(mfZ, rfSmallValue))); } - sal_Bool equal(const B3DTuple& rTup) const + bool equal(const B3DTuple& rTup) const { return ( ::basegfx::fTools::equal(mfX, rTup.mfX) && @@ -214,7 +217,7 @@ namespace basegfx ::basegfx::fTools::equal(mfZ, rTup.mfZ)); } - sal_Bool equal(const B3DTuple& rTup, const double& rfSmallValue) const + bool equal(const B3DTuple& rTup, const double& rfSmallValue) const { return ( ::basegfx::fTools::equal(mfX, rTup.mfX, rfSmallValue) && @@ -279,12 +282,12 @@ namespace basegfx return B3DTuple(-mfX, -mfY, -mfZ); } - sal_Bool operator==( const B3DTuple& rTup ) const + bool operator==( const B3DTuple& rTup ) const { return equal(rTup); } - sal_Bool operator!=( const B3DTuple& rTup ) const + bool operator!=( const B3DTuple& rTup ) const { return !equal(rTup); } diff --git a/basegfx/inc/basegfx/vector/b2dvector.hxx b/basegfx/inc/basegfx/vector/b2dvector.hxx index 6b5fe724b3e9..e75238f9b2e7 100644 --- a/basegfx/inc/basegfx/vector/b2dvector.hxx +++ b/basegfx/inc/basegfx/vector/b2dvector.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dvector.hxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:58 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,7 +73,7 @@ namespace basegfx /** Descriptor for the mathematical orientations of two 2D Vectors */ - enum B2DVectorOrientation + enum B2VectorOrientation { /// mathematically positive oriented ORIENTATION_POSITIVE = 0, @@ -87,7 +87,7 @@ namespace basegfx /** Descriptor for the mathematical continuity of two 2D Vectors */ - enum B2DVectorContinuity + enum B2VectorContinuity { /// none CONTINUITY_NONE = 0, @@ -112,12 +112,10 @@ namespace basegfx public: /** Create a 2D Vector - @param fVal - This parameter is used to initialize the coordinate - part of the 2D Vector. + The vector is initialized to (0.0, 0.0) */ - B2DVector(double fVal = 0.0) - : B2DTuple(fVal) + B2DVector() + : B2DTuple() {} /** Create a 2D Vector @@ -146,7 +144,7 @@ namespace basegfx /** constructor with tuple to allow copy-constructing from B2DTuple-based classes */ - B2DVector(const ::basegfx::B2DTuple& rTuple) + explicit B2DVector(const ::basegfx::B2DTuple& rTuple) : B2DTuple(rTuple) {} @@ -198,10 +196,10 @@ namespace basegfx /** Test if this 2D Vector is normalized @return - sal_True if lenth of vector is equal to 1.0 - sal_False else + true if lenth of vector is equal to 1.0 + false else */ - sal_Bool isNormalized() const; + bool isNormalized() const; /** Calculate the Scalar with another 2D Vector @@ -264,7 +262,7 @@ namespace basegfx @return The mathematical Orientation of the two involved 2D Vectors */ - B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB ); + B2VectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB ); /** Calculate a perpendicular 2D Vector to the given one @@ -287,10 +285,10 @@ namespace basegfx The second 2D Vector @return - sal_Bool if the two values are parallel. Also sal_True if + bool if the two values are parallel. Also true if one of the vectors is empty. */ - sal_Bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB ); + bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB ); /** Transform vector by given transformation matrix. @@ -304,7 +302,7 @@ namespace basegfx The two given vectors are assumed to describe control points on a common point. Calculate if there is a continuity between them. */ - ::basegfx::B2DVectorContinuity getContinuity( const B2DVector& rBackVector, const B2DVector& rForwardVector ); + B2VectorContinuity getContinuity( const B2DVector& rBackVector, const B2DVector& rForwardVector ); } // end of namespace basegfx diff --git a/basegfx/inc/basegfx/vector/b3dvector.hxx b/basegfx/inc/basegfx/vector/b3dvector.hxx index 094bacfb50a1..adcbc1e1878f 100644 --- a/basegfx/inc/basegfx/vector/b3dvector.hxx +++ b/basegfx/inc/basegfx/vector/b3dvector.hxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dvector.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:17:58 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:13 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -84,12 +84,10 @@ namespace basegfx public: /** Create a 3D Vector - @param fVal - This parameter is used to initialize the coordinate - part of the 3D Vector. + The vector is initialized to (0.0, 0.0, 0.0) */ - B3DVector(double fVal = 0.0) - : B3DTuple(fVal) + B3DVector() + : B3DTuple() {} /** Create a 3D Vector @@ -122,7 +120,7 @@ namespace basegfx /** constructor with tuple to allow copy-constructing from B3DTuple-based classes */ - B3DVector(const ::basegfx::B3DTuple& rTuple) + explicit B3DVector(const ::basegfx::B3DTuple& rTuple) : B3DTuple(rTuple) {} @@ -243,10 +241,10 @@ namespace basegfx /** Test if this 3D Vector is normalized @return - sal_True if lenth of vector is equal to 1.0 - sal_False else + true if lenth of vector is equal to 1.0 + false else */ - sal_Bool isNormalized() const + bool isNormalized() const { const double fOne(1.0); const double fScalar(scalar(*this)); diff --git a/basegfx/prj/d.lst b/basegfx/prj/d.lst index bda0e26ceb42..a898ab53b830 100644 --- a/basegfx/prj/d.lst +++ b/basegfx/prj/d.lst @@ -15,6 +15,8 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\matrix mkdir: %_DEST%\inc%_EXT%\basegfx\point ..\inc\basegfx\point\b2dpoint.hxx %_DEST%\inc%_EXT%\basegfx\point\b2dpoint.hxx ..\inc\basegfx\point\b3dpoint.hxx %_DEST%\inc%_EXT%\basegfx\point\b3dpoint.hxx +..\inc\basegfx\point\b2ipoint.hxx %_DEST%\inc%_EXT%\basegfx\point\b2ipoint.hxx +..\inc\basegfx\point\b3ipoint.hxx %_DEST%\inc%_EXT%\basegfx\point\b3ipoint.hxx ..\inc\basegfx\point\b2dhompoint.hxx %_DEST%\inc%_EXT%\basegfx\point\b2dhompoint.hxx ..\inc\basegfx\point\b3dhompoint.hxx %_DEST%\inc%_EXT%\basegfx\point\b3dhompoint.hxx @@ -22,11 +24,24 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\range ..\inc\basegfx\range\basicrange.hxx %_DEST%\inc%_EXT%\basegfx\range\basicrange.hxx ..\inc\basegfx\range\b1drange.hxx %_DEST%\inc%_EXT%\basegfx\range\b1drange.hxx ..\inc\basegfx\range\b2drange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2drange.hxx +..\inc\basegfx\range\b2drectangle.hxx %_DEST%\inc%_EXT%\basegfx\range\b2drectangle.hxx ..\inc\basegfx\range\b3drange.hxx %_DEST%\inc%_EXT%\basegfx\range\b3drange.hxx +..\inc\basegfx\range\b3dbox.hxx %_DEST%\inc%_EXT%\basegfx\range\b3dbox.hxx +..\inc\basegfx\range\b1irange.hxx %_DEST%\inc%_EXT%\basegfx\range\b1irange.hxx +..\inc\basegfx\range\b2irange.hxx %_DEST%\inc%_EXT%\basegfx\range\b2irange.hxx +..\inc\basegfx\range\b2irectangle.hxx %_DEST%\inc%_EXT%\basegfx\range\b2irectangle.hxx +..\inc\basegfx\range\b3irange.hxx %_DEST%\inc%_EXT%\basegfx\range\b3irange.hxx +..\inc\basegfx\range\b3ibox.hxx %_DEST%\inc%_EXT%\basegfx\range\b3ibox.hxx mkdir: %_DEST%\inc%_EXT%\basegfx\vector ..\inc\basegfx\vector\b2dvector.hxx %_DEST%\inc%_EXT%\basegfx\vector\b2dvector.hxx +..\inc\basegfx\vector\b2dsize.hxx %_DEST%\inc%_EXT%\basegfx\vector\b2dsize.hxx ..\inc\basegfx\vector\b3dvector.hxx %_DEST%\inc%_EXT%\basegfx\vector\b3dvector.hxx +..\inc\basegfx\vector\b3dsize.hxx %_DEST%\inc%_EXT%\basegfx\vector\b3dsize.hxx +..\inc\basegfx\vector\b2ivector.hxx %_DEST%\inc%_EXT%\basegfx\vector\b2ivector.hxx +..\inc\basegfx\vector\b2isize.hxx %_DEST%\inc%_EXT%\basegfx\vector\b2isize.hxx +..\inc\basegfx\vector\b3ivector.hxx %_DEST%\inc%_EXT%\basegfx\vector\b3ivector.hxx +..\inc\basegfx\vector\b3isize.hxx %_DEST%\inc%_EXT%\basegfx\vector\b3isize.hxx mkdir: %_DEST%\inc%_EXT%\basegfx\curve ..\inc\basegfx\curve\b2dcubicbezier.hxx %_DEST%\inc%_EXT%\basegfx\curve\b2dcubicbezier.hxx @@ -48,3 +63,7 @@ mkdir: %_DEST%\inc%_EXT%\basegfx\polygon mkdir: %_DEST%\inc%_EXT%\basegfx\tuple ..\inc\basegfx\tuple\b2dtuple.hxx %_DEST%\inc%_EXT%\basegfx\tuple\b2dtuple.hxx ..\inc\basegfx\tuple\b3dtuple.hxx %_DEST%\inc%_EXT%\basegfx\tuple\b3dtuple.hxx +..\inc\basegfx\tuple\b2ituple.hxx %_DEST%\inc%_EXT%\basegfx\tuple\b2ituple.hxx +..\inc\basegfx\tuple\b3ituple.hxx %_DEST%\inc%_EXT%\basegfx\tuple\b3ituple.hxx +..\inc\basegfx\tuple\b2i64tuple.hxx %_DEST%\inc%_EXT%\basegfx\tuple\b2i64tuple.hxx +..\inc\basegfx\tuple\b3i64tuple.hxx %_DEST%\inc%_EXT%\basegfx\tuple\b3i64tuple.hxx diff --git a/basegfx/source/curve/b2dcubicbezier.cxx b/basegfx/source/curve/b2dcubicbezier.cxx index 33f6fdb8f1ca..7ff14e13601b 100644 --- a/basegfx/source/curve/b2dcubicbezier.cxx +++ b/basegfx/source/curve/b2dcubicbezier.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dcubicbezier.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:00 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:19 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -112,7 +112,7 @@ namespace basegfx } // compare operators - sal_Bool B2DCubicBezier::operator==(const B2DCubicBezier& rBezier) const + bool B2DCubicBezier::operator==(const B2DCubicBezier& rBezier) const { return ( maStartPoint == rBezier.maStartPoint @@ -122,7 +122,7 @@ namespace basegfx ); } - sal_Bool B2DCubicBezier::operator!=(const B2DCubicBezier& rBezier) const + bool B2DCubicBezier::operator!=(const B2DCubicBezier& rBezier) const { return ( maStartPoint != rBezier.maStartPoint @@ -133,14 +133,14 @@ namespace basegfx } // test if vectors are used - sal_Bool B2DCubicBezier::isBezier() const + bool B2DCubicBezier::isBezier() const { if(maControlPointA != maStartPoint || maControlPointB != maEndPoint) { - return sal_True; + return true; } - return sal_False; + return false; } void B2DCubicBezier::testAndSolveTrivialBezier() diff --git a/basegfx/source/curve/b2dquadraticbezier.cxx b/basegfx/source/curve/b2dquadraticbezier.cxx index 2086a9d1b15e..6a2281dd1701 100644 --- a/basegfx/source/curve/b2dquadraticbezier.cxx +++ b/basegfx/source/curve/b2dquadraticbezier.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dquadraticbezier.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:00 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -110,7 +110,7 @@ namespace basegfx } // compare operators - sal_Bool B2DQuadraticBezier::operator==(const B2DQuadraticBezier& rBezier) const + bool B2DQuadraticBezier::operator==(const B2DQuadraticBezier& rBezier) const { return ( maStartPoint == rBezier.maStartPoint @@ -119,7 +119,7 @@ namespace basegfx ); } - sal_Bool B2DQuadraticBezier::operator!=(const B2DQuadraticBezier& rBezier) const + bool B2DQuadraticBezier::operator!=(const B2DQuadraticBezier& rBezier) const { return ( maStartPoint != rBezier.maStartPoint @@ -129,13 +129,13 @@ namespace basegfx } // test if control vector is used - sal_Bool B2DQuadraticBezier::isBezier() const + bool B2DQuadraticBezier::isBezier() const { // if control vector is empty, bezier is not used if(maControlPoint == maStartPoint || maControlPoint == maEndPoint) - return sal_False; + return false; - return sal_True; + return true; } } // end of namespace basegfx diff --git a/basegfx/source/inc/PolygonPoint.hxx b/basegfx/source/inc/PolygonPoint.hxx index 2d8a7c164d09..dfd4654fd234 100644 --- a/basegfx/source/inc/PolygonPoint.hxx +++ b/basegfx/source/inc/PolygonPoint.hxx @@ -2,9 +2,9 @@ * * $RCSfile: PolygonPoint.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2003-11-26 14:32:41 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:23 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,7 +91,7 @@ public: maPoint = rValue; } - sal_Bool operator==(const SimplePointEntry& rEntry) const + bool operator==(const SimplePointEntry& rEntry) const { return (maPoint == rEntry.maPoint); } @@ -137,14 +137,14 @@ public: maForward = rValue; } - sal_Bool isBezierNeeded() + bool isBezierNeeded() { if(maBackward != Vector::getEmptyVector() || maForward != Vector::getEmptyVector()) - return sal_True; - return sal_False; + return true; + return false; } - sal_Bool operator==(const SimpleBezierEntry& rEntry) const + bool operator==(const SimpleBezierEntry& rEntry) const { return ((maBackward == rEntry.maBackward) && (maForward == rEntry.maForward)); } @@ -181,17 +181,17 @@ template < class Point, class Vector > class PolygonPointList } public: - sal_Bool isBezier() const + bool isBezier() const { - return sal_Bool(mnBezierCount); + return bool(mnBezierCount); } - sal_Bool isClosed() const + bool isClosed() const { - return sal_Bool(mbIsClosed); + return bool(mbIsClosed); } - void setClosed(sal_Bool bNew) + void setClosed(bool bNew) { mbIsClosed = bNew; } @@ -204,7 +204,7 @@ public: PolygonPointList() : mnBezierCount(0L), mpVectors(0L), - mbIsClosed(sal_False) + mbIsClosed(false) { // complete initialization with defaults } @@ -276,27 +276,27 @@ public: } } - sal_Bool isEqual(const PolygonPointList& rPointList) const + bool isEqual(const PolygonPointList& rPointList) const { // same point count? if(maPoints.size() != rPointList.maPoints.size()) - return sal_False; + return false; // if zero points the polys are equal if(!maPoints.size()) - return sal_True; + return true; // if bezier count used it needs to be equal if(mnBezierCount != rPointList.mnBezierCount) - return sal_False; + return false; // compare point content if(maPoints != rPointList.maPoints) - return sal_False; + return false; // beziercounts are equal: if it's zero, we are done if(!mnBezierCount) - return sal_True; + return true; // beziercounts are equal and not zero; compare them OSL_ENSURE(0L != mpVectors, "Error: Bezier list needs to exist here(!)"); @@ -328,9 +328,9 @@ public: if(mpVectors) { LocalSimpleBezierEntry& rDest = (*mpVectors)[nIndex]; - sal_Bool bBezierNeededBefore(rDest.isBezierNeeded()); + bool bBezierNeededBefore(rDest.isBezierNeeded()); ((*mpVectors)[nIndex]).setBackwardVector(rValue); - sal_Bool bBezierNeededAfter(rDest.isBezierNeeded()); + bool bBezierNeededAfter(rDest.isBezierNeeded()); if(bBezierNeededBefore != bBezierNeededAfter) { @@ -342,7 +342,7 @@ public: } else { - sal_Bool bEmptyVector(rValue == Vector::getEmptyVector()); + bool bEmptyVector(rValue == Vector::getEmptyVector()); if(bEmptyVector) return; @@ -366,9 +366,9 @@ public: if(mpVectors) { LocalSimpleBezierEntry& rDest = (*mpVectors)[nIndex]; - sal_Bool bBezierNeededBefore(rDest.isBezierNeeded()); + bool bBezierNeededBefore(rDest.isBezierNeeded()); ((*mpVectors)[nIndex]).setForwardVector(rValue); - sal_Bool bBezierNeededAfter(rDest.isBezierNeeded()); + bool bBezierNeededAfter(rDest.isBezierNeeded()); if(bBezierNeededBefore != bBezierNeededAfter) { @@ -380,7 +380,7 @@ public: } else { - sal_Bool bEmptyVector(rValue == Vector::getEmptyVector()); + bool bEmptyVector(rValue == Vector::getEmptyVector()); if(bEmptyVector) return; diff --git a/basegfx/source/inc/hommatrixtemplate.hxx b/basegfx/source/inc/hommatrixtemplate.hxx index 4c688b09a218..4c4b1ad10b07 100644 --- a/basegfx/source/inc/hommatrixtemplate.hxx +++ b/basegfx/source/inc/hommatrixtemplate.hxx @@ -2,9 +2,9 @@ * * $RCSfile: hommatrixtemplate.hxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:02 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:26 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -129,10 +129,10 @@ namespace basegfx public: // Is last line used? - sal_Bool isLastLineDefault() const + bool isLastLineDefault() const { if(!mpLine) - return sal_True; + return true; for(sal_uInt16 a(0); a < RowSize; a++) { @@ -141,7 +141,7 @@ namespace basegfx if(!::basegfx::fTools::equal(fDefault, fLineValue)) { - return sal_False; + return false; } } @@ -149,7 +149,7 @@ namespace basegfx delete ((ImplHomMatrixTemplate< RowSize >*)this)->mpLine; ((ImplHomMatrixTemplate< RowSize >*)this)->mpLine = 0L; - return sal_True; + return true; } // This constructor is only used form the static identity matrix, thus @@ -238,7 +238,7 @@ namespace basegfx { if(mpLine) { - sal_Bool bNecessary(sal_False); + bool bNecessary(false); for(sal_uInt16 a(0);!bNecessary && a < RowSize; a++) { @@ -247,7 +247,7 @@ namespace basegfx if(!::basegfx::fTools::equal(fDefault, fLineValue)) { - bNecessary = sal_True; + bNecessary = true; } } @@ -260,7 +260,7 @@ namespace basegfx } // Left-upper decompositon - sal_Bool ludcmp(sal_uInt16 nIndex[], sal_Int16& nParity) + bool ludcmp(sal_uInt16 nIndex[], sal_Int16& nParity) { double fBig, fSum, fDum; double fStorage[RowSize]; @@ -286,7 +286,7 @@ namespace basegfx if(::basegfx::fTools::equalZero(fBig)) { - return sal_False; + return false; } fStorage[a] = 1.0 / fBig; @@ -348,7 +348,7 @@ namespace basegfx if(::basegfx::fTools::equalZero(fValBB)) { - return sal_False; + return false; } if(b != (RowSize - 1)) @@ -362,7 +362,7 @@ namespace basegfx } } - return sal_True; + return true; } void lubksb(const sal_uInt16 nIndex[], double fRow[]) const @@ -410,7 +410,7 @@ namespace basegfx } } - sal_Bool isIdentity() const + bool isIdentity() const { // last line needs no testing if not existing const sal_uInt16 nMaxLine = (mpLine) ? RowSize : (RowSize - 1); @@ -424,15 +424,15 @@ namespace basegfx if(!::basegfx::fTools::equal(fDefault, fValueAB)) { - return sal_False; + return false; } } } - return sal_True; + return true; } - sal_Bool isInvertible() const + bool isInvertible() const { ImplHomMatrixTemplate aWork(*this); sal_uInt16 nIndex[RowSize]; @@ -441,26 +441,26 @@ namespace basegfx return aWork.ludcmp(nIndex, nParity); } - sal_Bool isNormalized() const + bool isNormalized() const { if(!mpLine) - return sal_True; + return true; const double fHomValue(get((RowSize - 1), (RowSize - 1))); if(::basegfx::fTools::equalZero(fHomValue)) { - return sal_True; + return true; } const double fOne(1.0); if(::basegfx::fTools::equal(fOne, fHomValue)) { - return sal_True; + return true; } - return sal_False; + return false; } void doInvert(const ImplHomMatrixTemplate& rWork, const sal_uInt16 nIndex[]) @@ -623,7 +623,7 @@ namespace basegfx testLastLine(); } - sal_Bool isEqual(const ImplHomMatrixTemplate& rMat) + bool isEqual(const ImplHomMatrixTemplate& rMat) { const sal_uInt16 nMaxLine = (mpLine || rMat.mpLine) ? RowSize : (RowSize - 1); @@ -636,12 +636,12 @@ namespace basegfx if(!::basegfx::fTools::equal(fValueA, fValueB)) { - return sal_False; + return false; } } } - return sal_True; + return true; } }; diff --git a/basegfx/source/inc/polygontemplate.hxx b/basegfx/source/inc/polygontemplate.hxx index 310706bb461d..1639c5070622 100644 --- a/basegfx/source/inc/polygontemplate.hxx +++ b/basegfx/source/inc/polygontemplate.hxx @@ -2,9 +2,9 @@ * * $RCSfile: polygontemplate.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-11-26 14:32:41 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:27 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,7 +91,7 @@ public: maPoint = rValue; } - sal_Bool operator==(const ImplSimplePointEntry& rEntry) const + bool operator==(const ImplSimplePointEntry& rEntry) const { return (maPoint == rEntry.maPoint); } @@ -137,14 +137,14 @@ public: maForward = rValue; } - sal_Bool isBezierNeeded() + bool isBezierNeeded() { if(!maBackward.equalZero() || !maForward.equalZero()) - return sal_True; - return sal_False; + return true; + return false; } - sal_Bool operator==(const ImplSimpleBezierEntry& rEntry) const + bool operator==(const ImplSimpleBezierEntry& rEntry) const { return ((maBackward == rEntry.maBackward) && (maForward == rEntry.maForward)); } @@ -181,17 +181,17 @@ template < class Point, class Vector > class ImplPolygonTemplate } public: - sal_Bool isBezier() const + bool isBezier() const { - return sal_Bool(mnBezierCount); + return bool(mnBezierCount); } - sal_Bool isClosed() const + bool isClosed() const { - return sal_Bool(mbIsClosed); + return bool(mbIsClosed); } - void setClosed(sal_Bool bNew) + void setClosed(bool bNew) { mbIsClosed = bNew; } @@ -204,7 +204,7 @@ public: ImplPolygonTemplate() : mnBezierCount(0L), mpVectors(0L), - mbIsClosed(sal_False) + mbIsClosed(false) { // complete initialization with defaults } @@ -276,27 +276,27 @@ public: } } - sal_Bool isEqual(const ImplPolygonTemplate& rPointList) const + bool isEqual(const ImplPolygonTemplate& rPointList) const { // same point count? if(maPoints.size() != rPointList.maPoints.size()) - return sal_False; + return false; // if zero points the polys are equal if(!maPoints.size()) - return sal_True; + return true; // if bezier count used it needs to be equal if(mnBezierCount != rPointList.mnBezierCount) - return sal_False; + return false; // compare point content if(maPoints != rPointList.maPoints) - return sal_False; + return false; // beziercounts are equal: if it's zero, we are done if(!mnBezierCount) - return sal_True; + return true; // beziercounts are equal and not zero; compare them OSL_ENSURE(0L != mpVectors, "Error: Bezier list needs to exist here(!)"); @@ -328,9 +328,9 @@ public: if(mpVectors) { LocalImplSimpleBezierEntry& rDest = (*mpVectors)[nIndex]; - sal_Bool bBezierNeededBefore(rDest.isBezierNeeded()); + bool bBezierNeededBefore(rDest.isBezierNeeded()); ((*mpVectors)[nIndex]).setBackwardVector(rValue); - sal_Bool bBezierNeededAfter(rDest.isBezierNeeded()); + bool bBezierNeededAfter(rDest.isBezierNeeded()); if(bBezierNeededBefore != bBezierNeededAfter) { @@ -342,7 +342,7 @@ public: } else { - sal_Bool bEmptyVector(rValue.equalZero()); + bool bEmptyVector(rValue.equalZero()); if(bEmptyVector) return; @@ -366,9 +366,9 @@ public: if(mpVectors) { LocalImplSimpleBezierEntry& rDest = (*mpVectors)[nIndex]; - sal_Bool bBezierNeededBefore(rDest.isBezierNeeded()); + bool bBezierNeededBefore(rDest.isBezierNeeded()); ((*mpVectors)[nIndex]).setForwardVector(rValue); - sal_Bool bBezierNeededAfter(rDest.isBezierNeeded()); + bool bBezierNeededAfter(rDest.isBezierNeeded()); if(bBezierNeededBefore != bBezierNeededAfter) { @@ -380,7 +380,7 @@ public: } else { - sal_Bool bEmptyVector(rValue.equalZero()); + bool bEmptyVector(rValue.equalZero()); if(bEmptyVector) return; diff --git a/basegfx/source/matrix/b2dhommatrix.cxx b/basegfx/source/matrix/b2dhommatrix.cxx index acf4355067a7..ee4c43a785be 100644 --- a/basegfx/source/matrix/b2dhommatrix.cxx +++ b/basegfx/source/matrix/b2dhommatrix.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dhommatrix.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: thb $ $Date: 2003-12-08 13:24:07 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -144,10 +144,10 @@ namespace basegfx mpM->set(nRow, nColumn, fValue); } - sal_Bool B2DHomMatrix::isIdentity() const + bool B2DHomMatrix::isIdentity() const { if(mpM == &get2DIdentityMatrix()) - return sal_True; + return true; return mpM->isIdentity(); } @@ -163,12 +163,12 @@ namespace basegfx mpM->incRefCount(); } - sal_Bool B2DHomMatrix::isInvertible() const + bool B2DHomMatrix::isInvertible() const { return mpM->isInvertible(); } - sal_Bool B2DHomMatrix::invert() + bool B2DHomMatrix::invert() { Impl2DHomMatrix aWork(*mpM); sal_uInt16* pIndex = new sal_uInt16[mpM->getEdgeLength()]; @@ -180,14 +180,14 @@ namespace basegfx mpM->doInvert(aWork, pIndex); delete pIndex; - return sal_True; + return true; } delete pIndex; - return sal_False; + return false; } - sal_Bool B2DHomMatrix::isNormalized() const + bool B2DHomMatrix::isNormalized() const { return mpM->isNormalized(); } @@ -270,18 +270,18 @@ namespace basegfx return *this; } - sal_Bool B2DHomMatrix::operator==(const B2DHomMatrix& rMat) const + bool B2DHomMatrix::operator==(const B2DHomMatrix& rMat) const { if(mpM == rMat.mpM) - return sal_True; + return true; return mpM->isEqual(*rMat.mpM); } - sal_Bool B2DHomMatrix::operator!=(const B2DHomMatrix& rMat) const + bool B2DHomMatrix::operator!=(const B2DHomMatrix& rMat) const { if(mpM == rMat.mpM) - return sal_False; + return false; return !mpM->isEqual(*rMat.mpM); } @@ -365,15 +365,15 @@ namespace basegfx } // Decomposition - sal_Bool B2DHomMatrix::decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const + bool B2DHomMatrix::decompose(B2DTuple& rScale, B2DTuple& rTranslate, double& rRotate, double& rShearX) const { // when perspective is used, decompose is not made here if(!mpM->isLastLineDefault()) - return sal_False; + return false; // If determinant is zero, decomposition is not possible if(0.0 == mpM->doDeterminant()) - return sal_False; + return false; // copy 2x2 matrix and translate vector to 3x3 matrix ::basegfx::B3DHomMatrix a3DHomMat; @@ -403,10 +403,10 @@ namespace basegfx rTranslate.setX(r3DTranslate.getX()); rTranslate.setY(r3DTranslate.getY()); - return sal_True; + return true; } - return sal_False; + return false; } } // end of namespace basegfx diff --git a/basegfx/source/matrix/b3dhommatrix.cxx b/basegfx/source/matrix/b3dhommatrix.cxx index b6df9ff51767..4817fc8f7655 100644 --- a/basegfx/source/matrix/b3dhommatrix.cxx +++ b/basegfx/source/matrix/b3dhommatrix.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dhommatrix.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:03 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -136,10 +136,10 @@ namespace basegfx mpM->set(nRow, nColumn, fValue); } - sal_Bool B3DHomMatrix::isIdentity() const + bool B3DHomMatrix::isIdentity() const { if(mpM == &get3DIdentityMatrix()) - return sal_True; + return true; return mpM->isIdentity(); } @@ -155,12 +155,12 @@ namespace basegfx mpM->incRefCount(); } - sal_Bool B3DHomMatrix::isInvertible() const + bool B3DHomMatrix::isInvertible() const { return mpM->isInvertible(); } - sal_Bool B3DHomMatrix::invert() + bool B3DHomMatrix::invert() { Impl3DHomMatrix aWork(*mpM); sal_uInt16* pIndex = new sal_uInt16[mpM->getEdgeLength()]; @@ -172,14 +172,14 @@ namespace basegfx mpM->doInvert(aWork, pIndex); delete pIndex; - return sal_True; + return true; } delete pIndex; - return sal_False; + return false; } - sal_Bool B3DHomMatrix::isNormalized() const + bool B3DHomMatrix::isNormalized() const { return mpM->isNormalized(); } @@ -262,18 +262,18 @@ namespace basegfx return *this; } - sal_Bool B3DHomMatrix::operator==(const B3DHomMatrix& rMat) const + bool B3DHomMatrix::operator==(const B3DHomMatrix& rMat) const { if(mpM == rMat.mpM) - return sal_True; + return true; return mpM->isEqual(*rMat.mpM); } - sal_Bool B3DHomMatrix::operator!=(const B3DHomMatrix& rMat) const + bool B3DHomMatrix::operator!=(const B3DHomMatrix& rMat) const { if(mpM == rMat.mpM) - return sal_False; + return false; return !mpM->isEqual(*rMat.mpM); } @@ -495,15 +495,15 @@ namespace basegfx mpM = new Impl3DHomMatrix(aOrthoMat); } - sal_Bool B3DHomMatrix::decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const + bool B3DHomMatrix::decompose(B3DTuple& rScale, B3DTuple& rTranslate, B3DTuple& rRotate, B3DTuple& rShear) const { // when perspective is used, decompose is not made here if(!mpM->isLastLineDefault()) - return sal_False; + return false; // If determinant is zero, decomposition is not possible if(0.0 == mpM->doDeterminant()) - return sal_False; + return false; // isolate translation rTranslate.setX(mpM->get(0, 3)); @@ -629,7 +629,7 @@ namespace basegfx // corrcet rotate values rRotate.correctValues(); - return sal_True; + return true; } } // end of namespace basegfx diff --git a/basegfx/source/point/b2dhompoint.cxx b/basegfx/source/point/b2dhompoint.cxx index e23c9530b0e8..5fbb04c0313c 100644 --- a/basegfx/source/point/b2dhompoint.cxx +++ b/basegfx/source/point/b2dhompoint.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dhompoint.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2003-12-03 09:24:28 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -73,7 +73,7 @@ namespace basegfx { - sal_Bool B2DHomPoint::implIsHomogenized() const + bool B2DHomPoint::implIsHomogenized() const { const double fOne(1.0); return ::basegfx::fTools::equal(fOne, mfW); @@ -181,13 +181,13 @@ namespace basegfx return *this; } - sal_Bool B2DHomPoint::operator==( const B2DHomPoint& rPnt ) const + bool B2DHomPoint::operator==( const B2DHomPoint& rPnt ) const { implTestAndHomogenize(); return (maTuple == rPnt.maTuple); } - sal_Bool B2DHomPoint::operator!=( const B2DHomPoint& rPnt ) const + bool B2DHomPoint::operator!=( const B2DHomPoint& rPnt ) const { implTestAndHomogenize(); return (maTuple != rPnt.maTuple); diff --git a/basegfx/source/point/makefile.mk b/basegfx/source/point/makefile.mk index 639b03621b13..80ed2f066bb8 100644 --- a/basegfx/source/point/makefile.mk +++ b/basegfx/source/point/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: aw $ $Date: 2003-11-06 16:30:28 $ +# last change: $Author: thb $ $Date: 2004-01-16 10:34:31 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -78,8 +78,10 @@ SLOFILES= \ $(SLO)$/b2dpoint.obj \ $(SLO)$/b2dhompoint.obj \ $(SLO)$/b3dpoint.obj \ - $(SLO)$/b3dhompoint.obj - + $(SLO)$/b3dhompoint.obj \ + $(SLO)$/b2ipoint.obj \ + $(SLO)$/b3ipoint.obj + # --- Targets ---------------------------------- .INCLUDE : target.mk diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 0dcbeaa7a3a2..0c2c921dd64a 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolygon.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:05 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,7 +95,7 @@ public: const ::basegfx::B2DPoint& getCoordinate() const { return maPoint; } void setCoordinate(const ::basegfx::B2DPoint& rValue) { if(rValue != maPoint) maPoint = rValue; } - sal_Bool operator==(const CoordinateData2D& rData ) const { return (maPoint == rData.getCoordinate()); } + bool operator==(const CoordinateData2D& rData ) const { return (maPoint == rData.getCoordinate()); } void transform(const ::basegfx::B2DHomMatrix& rMatrix) { maPoint *= rMatrix; } }; @@ -132,7 +132,7 @@ public: return maVector.size(); } - sal_Bool isEqual(const CoordinateDataArray2D& rCandidate) const + bool isEqual(const CoordinateDataArray2D& rCandidate) const { return (maVector == rCandidate.maVector); } @@ -262,7 +262,7 @@ public: const ::basegfx::B2DVector& getVectorB() const { return maVectorB; } void setVectorB(const ::basegfx::B2DVector& rValue) { if(rValue != maVectorB) maVectorB = rValue; } - sal_Bool operator==(const ControlVectorPair2D& rData ) const + bool operator==(const ControlVectorPair2D& rData ) const { return (maVectorA == rData.getVectorA() && maVectorB == rData.getVectorB()); } }; @@ -319,12 +319,12 @@ public: return maVector.size(); } - sal_Bool isEqual(const ControlVectorArray2D& rCandidate) const + bool isEqual(const ControlVectorArray2D& rCandidate) const { return (maVector == rCandidate.maVector); } - sal_Bool isUsed() const + bool isUsed() const { return (0L != mnUsedVectors); } @@ -336,8 +336,8 @@ public: void setVectorA(sal_uInt32 nIndex, const ::basegfx::B2DVector& rValue) { - sal_Bool bWasUsed(mnUsedVectors && !maVector[nIndex].getVectorA().equalZero()); - sal_Bool bIsUsed(!rValue.equalZero()); + bool bWasUsed(mnUsedVectors && !maVector[nIndex].getVectorA().equalZero()); + bool bIsUsed(!rValue.equalZero()); if(bWasUsed) { @@ -368,8 +368,8 @@ public: void setVectorB(sal_uInt32 nIndex, const ::basegfx::B2DVector& rValue) { - sal_Bool bWasUsed(mnUsedVectors && !maVector[nIndex].getVectorB().equalZero()); - sal_Bool bIsUsed(!rValue.equalZero()); + bool bWasUsed(mnUsedVectors && !maVector[nIndex].getVectorB().equalZero()); + bool bIsUsed(!rValue.equalZero()); if(bWasUsed) { @@ -483,7 +483,7 @@ public: : mnRefCount(1), maPoints(0L), mpControlVector(0L), - mbIsClosed(sal_False) + mbIsClosed(false) { // complete initialization with defaults } @@ -549,12 +549,12 @@ public: return maPoints.count(); } - sal_Bool isClosed() const + bool isClosed() const { return mbIsClosed; } - void setClosed(sal_Bool bNew) + void setClosed(bool bNew) { if(bNew != mbIsClosed) { @@ -562,13 +562,13 @@ public: } } - sal_Bool isEqual(const ImplB2DPolygon& rCandidate) const + bool isEqual(const ImplB2DPolygon& rCandidate) const { if(mbIsClosed == rCandidate.mbIsClosed) { if(maPoints.isEqual(rCandidate.maPoints)) { - sal_Bool bControlVectorsAreEqual(sal_True); + bool bControlVectorsAreEqual(true); if(mpControlVector) { @@ -593,12 +593,12 @@ public: if(bControlVectorsAreEqual) { - return sal_True; + return true; } } } - return sal_False; + return false; } const ::basegfx::B2DPoint& getPoint(sal_uInt32 nIndex) const @@ -660,7 +660,7 @@ public: } } - sal_Bool areControlPointsUsed() const + bool areControlPointsUsed() const { return (mpControlVector && mpControlVector->isUsed()); } @@ -821,7 +821,7 @@ public: } } - sal_Bool hasDoublePoints() const + bool hasDoublePoints() const { if(mbIsClosed) { @@ -835,12 +835,12 @@ public: if(mpControlVector->getVectorA(nIndex).equalZero() && mpControlVector->getVectorB(nIndex).equalZero()) { - return sal_True; + return true; } } else { - return sal_True; + return true; } } } @@ -855,17 +855,17 @@ public: if(mpControlVector->getVectorA(a).equalZero() && mpControlVector->getVectorB(a).equalZero()) { - return sal_True; + return true; } } else { - return sal_True; + return true; } } } - return sal_False; + return false; } void removeDoublePointsAtBeginEnd() @@ -875,11 +875,11 @@ public: { if(mpControlVector) { - sal_Bool bRemove; + bool bRemove; do { - bRemove = sal_False; + bRemove = false; if(maPoints.count() > 1L) { @@ -890,7 +890,7 @@ public: if(mpControlVector->getVectorA(nIndex).equalZero() && mpControlVector->getVectorB(nIndex).equalZero()) { - bRemove = sal_True; + bRemove = true; } } } @@ -1045,21 +1045,21 @@ namespace basegfx return *this; } - sal_Bool B2DPolygon::operator==(const B2DPolygon& rPolygon) const + bool B2DPolygon::operator==(const B2DPolygon& rPolygon) const { if(mpPolygon == rPolygon.mpPolygon) { - return sal_True; + return true; } return mpPolygon->isEqual(*(rPolygon.mpPolygon)); } - sal_Bool B2DPolygon::operator!=(const B2DPolygon& rPolygon) const + bool B2DPolygon::operator!=(const B2DPolygon& rPolygon) const { if(mpPolygon == rPolygon.mpPolygon) { - return sal_False; + return false; } return !mpPolygon->isEqual(*(rPolygon.mpPolygon)); @@ -1144,7 +1144,7 @@ namespace basegfx } } - sal_Bool B2DPolygon::areControlPointsUsed() const + bool B2DPolygon::areControlPointsUsed() const { return mpPolygon->areControlPointsUsed(); } @@ -1225,12 +1225,12 @@ namespace basegfx mpPolygon->incRefCount(); } - sal_Bool B2DPolygon::isClosed() const + bool B2DPolygon::isClosed() const { return mpPolygon->isClosed(); } - void B2DPolygon::setClosed(sal_Bool bNew) + void B2DPolygon::setClosed(bool bNew) { if(mpPolygon->isClosed() != bNew) { @@ -1248,7 +1248,7 @@ namespace basegfx } } - sal_Bool B2DPolygon::hasDoublePoints() const + bool B2DPolygon::hasDoublePoints() const { return mpPolygon->hasDoublePoints(); } diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 6f5ef6e89fba..a15ede36e987 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolygontools.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:05 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -103,32 +103,32 @@ namespace basegfx while(rCandidate.count() > 1L && rCandidate.getB2DPoint(0L).equal(rCandidate.getB2DPoint(rCandidate.count() - 1L))) { - rCandidate.setClosed(sal_True); + rCandidate.setClosed(true); rCandidate.remove(rCandidate.count() - 1L); } } // Get index of outmost point (e.g. biggest X and biggest Y) - sal_uInt32 getIndexOfOutmostPoint(const ::basegfx::B2DPolygon& rCandidate) + sal_uInt32 getIndexOfOutmostPoint(const B2DPolygon& rCandidate) { sal_uInt32 nRetval(0L); if(rCandidate.count()) { - ::basegfx::B2DPoint aOutmostPoint(rCandidate.getB2DPoint(0L)); + B2DPoint aOutmostPoint(rCandidate.getB2DPoint(0L)); for(sal_uInt32 a(1L); a < rCandidate.count(); a++) { - ::basegfx::B2DPoint rPoint(rCandidate.getB2DPoint(a)); + B2DPoint rPoint(rCandidate.getB2DPoint(a)); - if(::basegfx::fTools::more(rPoint.getX(), aOutmostPoint.getX())) + if(fTools::more(rPoint.getX(), aOutmostPoint.getX())) { nRetval = a; aOutmostPoint = rPoint; } else { - if(::basegfx::fTools::more(rPoint.getY(), aOutmostPoint.getY())) + if(fTools::more(rPoint.getY(), aOutmostPoint.getY())) { nRetval = a; aOutmostPoint = rPoint; @@ -142,7 +142,7 @@ namespace basegfx // Get successor and predecessor indices. Returning the same index means there // is none. Same for successor. - sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate) + sal_uInt32 getIndexOfPredecessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate) { OSL_ENSURE(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)"); @@ -160,7 +160,7 @@ namespace basegfx } } - sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate) + sal_uInt32 getIndexOfSuccessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate) { OSL_ENSURE(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)"); @@ -174,7 +174,7 @@ namespace basegfx } } - sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate) + sal_uInt32 getIndexOfDifferentPredecessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate) { sal_uInt32 nNewIndex(nIndex); OSL_ENSURE(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)"); @@ -182,7 +182,7 @@ namespace basegfx if(rCandidate.count() > 1) { nNewIndex = getIndexOfPredecessor(nIndex, rCandidate); - ::basegfx::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex)); + B2DPoint aPoint(rCandidate.getB2DPoint(nIndex)); while(nNewIndex != nIndex && aPoint.equal(rCandidate.getB2DPoint(nNewIndex))) @@ -194,7 +194,7 @@ namespace basegfx return nNewIndex; } - sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const ::basegfx::B2DPolygon& rCandidate) + sal_uInt32 getIndexOfDifferentSuccessor(sal_uInt32 nIndex, const B2DPolygon& rCandidate) { sal_uInt32 nNewIndex(nIndex); OSL_ENSURE(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)"); @@ -202,7 +202,7 @@ namespace basegfx if(rCandidate.count() > 1) { nNewIndex = getIndexOfSuccessor(nIndex, rCandidate); - ::basegfx::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex)); + B2DPoint aPoint(rCandidate.getB2DPoint(nIndex)); while(nNewIndex != nIndex && aPoint.equal(rCandidate.getB2DPoint(nNewIndex))) @@ -214,9 +214,9 @@ namespace basegfx return nNewIndex; } - ::basegfx::B2DVectorOrientation getOrientation(const ::basegfx::B2DPolygon& rCandidate) + B2VectorOrientation getOrientation(const B2DPolygon& rCandidate) { - ::basegfx::B2DVectorOrientation eRetval(::basegfx::ORIENTATION_NEUTRAL); + B2VectorOrientation eRetval(ORIENTATION_NEUTRAL); if(rCandidate.count() > 2) { @@ -227,26 +227,26 @@ namespace basegfx return eRetval; } - ::basegfx::B2DVectorContinuity getContinuityInPoint(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nIndex) + B2VectorContinuity getContinuityInPoint(const B2DPolygon& rCandidate, sal_uInt32 nIndex) { OSL_ENSURE(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)"); - ::basegfx::B2DVectorContinuity eRetval(::basegfx::CONTINUITY_NONE); + B2VectorContinuity eRetval(CONTINUITY_NONE); if(rCandidate.count() > 1L && rCandidate.areControlPointsUsed()) { sal_uInt32 nPrevInd(getIndexOfPredecessor(nIndex, rCandidate)); - const ::basegfx::B2DVector aForwardVector(rCandidate.getControlVectorA(nIndex)); - const ::basegfx::B2DVector aBackVector(rCandidate.getControlVectorB(nPrevInd)); + const B2DVector aForwardVector(rCandidate.getControlVectorA(nIndex)); + const B2DVector aBackVector(rCandidate.getControlVectorB(nPrevInd)); - eRetval = ::basegfx::getContinuity(aBackVector, aForwardVector); + eRetval = getContinuity(aBackVector, aForwardVector); } return eRetval; } - ::basegfx::B2DPolygon adaptiveSubdivideByDistance(const ::basegfx::B2DPolygon& rCandidate, double fDistanceBound) + B2DPolygon adaptiveSubdivideByDistance(const B2DPolygon& rCandidate, double fDistanceBound) { - ::basegfx::B2DPolygon aRetval(rCandidate); + B2DPolygon aRetval(rCandidate); if(aRetval.areControlPointsUsed()) { @@ -255,19 +255,19 @@ namespace basegfx for(sal_uInt32 a(0L); a < nPointCount; a++) { - const ::basegfx::B2DVector aVectorA(rCandidate.getControlVectorA(a)); - const ::basegfx::B2DVector aVectorB(rCandidate.getControlVectorB(a)); + const B2DVector aVectorA(rCandidate.getControlVectorA(a)); + const B2DVector aVectorB(rCandidate.getControlVectorB(a)); if(!aVectorA.equalZero() || !aVectorB.equalZero()) { // vectors are used, get points const sal_uInt32 nNext(getIndexOfSuccessor(a, rCandidate)); - ::basegfx::B2DPoint aPointA(rCandidate.getB2DPoint(a)); - ::basegfx::B2DPoint aPointB(rCandidate.getB2DPoint(nNext)); + B2DPoint aPointA(rCandidate.getB2DPoint(a)); + B2DPoint aPointB(rCandidate.getB2DPoint(nNext)); // build CubicBezier segment - ::basegfx::B2DCubicBezier aBezier( - aPointA, aPointA + aVectorA, aPointB + aVectorB, aPointB); + B2DCubicBezier aBezier( + aPointA, B2DPoint(aPointA + aVectorA), B2DPoint(aPointB + aVectorB), aPointB); // generate DistanceBound double fBound; @@ -276,8 +276,8 @@ namespace basegfx { // If not set, calculate rough length of bezier segment by taking // half of the sum of the edge and the control polygon - ::basegfx::B2DVector aSimpleDistance(aPointB - aPointA); - ::basegfx::B2DVector aTripleDistanceTop((aPointB + aVectorB) - (aPointA + aVectorA)); + B2DVector aSimpleDistance(aPointB - aPointA); + B2DVector aTripleDistanceTop((aPointB + aVectorB) - (aPointA + aVectorA)); const double fRoughLength( (aSimpleDistance.getLength() + (aVectorA.getLength() + aVectorB.getLength() + aTripleDistanceTop.getLength())) / 2.0); @@ -318,9 +318,9 @@ namespace basegfx return aRetval; } - ::basegfx::B2DPolygon adaptiveSubdivideByAngle(const ::basegfx::B2DPolygon& rCandidate, double fAngleBound) + B2DPolygon adaptiveSubdivideByAngle(const B2DPolygon& rCandidate, double fAngleBound) { - ::basegfx::B2DPolygon aRetval(rCandidate); + B2DPolygon aRetval(rCandidate); if(aRetval.areControlPointsUsed()) { @@ -329,25 +329,25 @@ namespace basegfx for(sal_uInt32 a(0L); a < nPointCount; a++) { - const ::basegfx::B2DVector aVectorA(rCandidate.getControlVectorA(a)); - const ::basegfx::B2DVector aVectorB(rCandidate.getControlVectorB(a)); + const B2DVector aVectorA(rCandidate.getControlVectorA(a)); + const B2DVector aVectorB(rCandidate.getControlVectorB(a)); if(!aVectorA.equalZero() || !aVectorB.equalZero()) { // vectors are used, get points const sal_uInt32 nNext(getIndexOfSuccessor(a, rCandidate)); - ::basegfx::B2DPoint aPointA(rCandidate.getB2DPoint(a)); - ::basegfx::B2DPoint aPointB(rCandidate.getB2DPoint(nNext)); + B2DPoint aPointA(rCandidate.getB2DPoint(a)); + B2DPoint aPointB(rCandidate.getB2DPoint(nNext)); // build CubicBezier segment - ::basegfx::B2DCubicBezier aBezier( - aPointA, aPointA + aVectorA, aPointB + aVectorB, aPointB); + B2DCubicBezier aBezier( + aPointA, B2DPoint(aPointA + aVectorA), B2DPoint(aPointB + aVectorB), aPointB); // generate AngleBound double fBound(fAngleBound); // make sure angle bound is not too small - if(::basegfx::fTools::less(fAngleBound, 0.1)) + if(fTools::less(fAngleBound, 0.1)) { fAngleBound = 0.1; } @@ -372,29 +372,29 @@ namespace basegfx return aRetval; } - sal_Bool isInside(const ::basegfx::B2DPolygon& rCandidate, const ::basegfx::B2DPoint& rPoint, sal_Bool bWithBorder) + bool isInside(const B2DPolygon& rCandidate, const B2DPoint& rPoint, bool bWithBorder) { - sal_Bool bRetval(sal_False); + bool bRetval(false); const sal_uInt32 nPointCount(rCandidate.count()); for(sal_uInt32 a(0L); a < nPointCount; a++) { - const ::basegfx::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a)); + const B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a)); if(bWithBorder && aCurrentPoint.equal(rPoint)) { - return sal_True; + return true; } // cross-over in Y? - const ::basegfx::B2DPoint aPreviousPoint(rCandidate.getB2DPoint((!a) ? nPointCount - 1L : a - 1L)); - const sal_Bool bCompYA(::basegfx::fTools::more(aPreviousPoint.getY(), rPoint.getY())); - const sal_Bool bCompYB(::basegfx::fTools::more(aCurrentPoint.getY(), rPoint.getY())); + const B2DPoint aPreviousPoint(rCandidate.getB2DPoint((!a) ? nPointCount - 1L : a - 1L)); + const bool bCompYA(fTools::more(aPreviousPoint.getY(), rPoint.getY())); + const bool bCompYB(fTools::more(aCurrentPoint.getY(), rPoint.getY())); if(bCompYA != bCompYB) { - const sal_Bool bCompXA(::basegfx::fTools::more(aPreviousPoint.getX(), rPoint.getX())); - const sal_Bool bCompXB(::basegfx::fTools::more(aCurrentPoint.getX(), rPoint.getX())); + const bool bCompXA(fTools::more(aPreviousPoint.getX(), rPoint.getX())); + const bool bCompXB(fTools::more(aCurrentPoint.getX(), rPoint.getX())); if(bCompXA == bCompXB) { @@ -410,11 +410,11 @@ namespace basegfx (aPreviousPoint.getX() - aCurrentPoint.getX()) / (aPreviousPoint.getY() - aCurrentPoint.getY()); - if(bWithBorder && ::basegfx::fTools::more(fCompare, rPoint.getX())) + if(bWithBorder && fTools::more(fCompare, rPoint.getX())) { bRetval = !bRetval; } - else if(::basegfx::fTools::moreOrEqual(fCompare, rPoint.getX())) + else if(fTools::moreOrEqual(fCompare, rPoint.getX())) { bRetval = !bRetval; } @@ -425,35 +425,35 @@ namespace basegfx return bRetval; } - sal_Bool isInside(const ::basegfx::B2DPolygon& rCandidate, const ::basegfx::B2DPolygon& rPolygon, sal_Bool bWithBorder) + bool isInside(const B2DPolygon& rCandidate, const B2DPolygon& rPolygon, bool bWithBorder) { const sal_uInt32 nPointCount(rPolygon.count()); for(sal_uInt32 a(0L); a < nPointCount; a++) { - const ::basegfx::B2DPoint aTestPoint(rPolygon.getB2DPoint(a)); + const B2DPoint aTestPoint(rPolygon.getB2DPoint(a)); if(!isInside(rCandidate, aTestPoint, bWithBorder)) { - return sal_False; + return false; } } - return sal_True; + return true; } - ::basegfx::B2DRange getRange(const ::basegfx::B2DPolygon& rCandidate) + B2DRange getRange(const B2DPolygon& rCandidate) { - ::basegfx::B2DRange aRetval; + B2DRange aRetval; const sal_uInt32 nPointCount(rCandidate.count()); if(rCandidate.areControlPointsUsed()) { for(sal_uInt32 a(0L); a < nPointCount; a++) { - const ::basegfx::B2DPoint aTestPoint(rCandidate.getB2DPoint(a)); - const ::basegfx::B2DVector aVectorA(rCandidate.getControlVectorA(a)); - const ::basegfx::B2DVector aVectorB(rCandidate.getControlVectorB(a)); + const B2DPoint aTestPoint(rCandidate.getB2DPoint(a)); + const B2DVector aVectorA(rCandidate.getControlVectorA(a)); + const B2DVector aVectorB(rCandidate.getControlVectorB(a)); aRetval.expand(aTestPoint); if(!aVectorA.equalZero()) @@ -464,7 +464,7 @@ namespace basegfx if(!aVectorB.equalZero()) { const sal_uInt32 nNextIndex(getIndexOfSuccessor(a, rCandidate)); - const ::basegfx::B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); + const B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); aRetval.expand(aNextPoint + aVectorB); } } @@ -473,7 +473,7 @@ namespace basegfx { for(sal_uInt32 a(0L); a < nPointCount; a++) { - const ::basegfx::B2DPoint aTestPoint(rCandidate.getB2DPoint(a)); + const B2DPoint aTestPoint(rCandidate.getB2DPoint(a)); aRetval.expand(aTestPoint); } } @@ -481,7 +481,7 @@ namespace basegfx return aRetval; } - double getArea(const ::basegfx::B2DPolygon& rCandidate) + double getArea(const B2DPolygon& rCandidate) { double fRetval(0.0); const sal_uInt32 nPointCount(rCandidate.count()); @@ -490,8 +490,8 @@ namespace basegfx { for(sal_uInt32 a(0L); a < nPointCount; a++) { - const ::basegfx::B2DPoint aPreviousPoint(rCandidate.getB2DPoint((!a) ? nPointCount - 1L : a - 1L)); - const ::basegfx::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a)); + const B2DPoint aPreviousPoint(rCandidate.getB2DPoint((!a) ? nPointCount - 1L : a - 1L)); + const B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a)); fRetval += aPreviousPoint.getX() * aCurrentPoint.getY(); fRetval -= aPreviousPoint.getY() * aCurrentPoint.getX(); @@ -501,7 +501,7 @@ namespace basegfx const double fZero(0.0); - if(::basegfx::fTools::less(fRetval, fZero)) + if(fTools::less(fRetval, fZero)) { fRetval = -fRetval; } @@ -510,7 +510,7 @@ namespace basegfx return fRetval; } - double getEdgeLength(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nIndex) + double getEdgeLength(const B2DPolygon& rCandidate, sal_uInt32 nIndex) { OSL_ENSURE(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)"); double fRetval(0.0); @@ -521,9 +521,9 @@ namespace basegfx if(rCandidate.isClosed() || nIndex + 1 != nPointCount) { const sal_uInt32 nNextIndex(nIndex + 1 == nPointCount ? 0L : nIndex + 1L); - const ::basegfx::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(nIndex)); - const ::basegfx::B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); - const ::basegfx::B2DVector aVector(aNextPoint - aCurrentPoint); + const B2DPoint aCurrentPoint(rCandidate.getB2DPoint(nIndex)); + const B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); + const B2DVector aVector(aNextPoint - aCurrentPoint); fRetval = aVector.getLength(); } } @@ -531,7 +531,7 @@ namespace basegfx return fRetval; } - double getLength(const ::basegfx::B2DPolygon& rCandidate) + double getLength(const B2DPolygon& rCandidate) { // This method may also be implemented using a loop over getEdgeLength, but // since this would cause a lot of sqare roots to be solved it is much better @@ -543,17 +543,17 @@ namespace basegfx for(sal_uInt32 a(0L); a < nLoopCount; a++) { const sal_uInt32 nNextIndex(a + 1 == nPointCount ? 0L : a + 1L); - const ::basegfx::B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a)); - const ::basegfx::B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); - const ::basegfx::B2DVector aVector(aNextPoint - aCurrentPoint); + const B2DPoint aCurrentPoint(rCandidate.getB2DPoint(a)); + const B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); + const B2DVector aVector(aNextPoint - aCurrentPoint); fRetval += aVector.scalar(aVector); } - if(!::basegfx::fTools::equalZero(fRetval)) + if(!fTools::equalZero(fRetval)) { const double fOne(1.0); - if(!::basegfx::fTools::equal(fOne, fRetval)) + if(!fTools::equal(fOne, fRetval)) { fRetval = sqrt(fRetval); } @@ -562,26 +562,26 @@ namespace basegfx return fRetval; } - ::basegfx::B2DPoint getPositionAbsolute(const ::basegfx::B2DPolygon& rCandidate, double fDistance, double fLength) + B2DPoint getPositionAbsolute(const B2DPolygon& rCandidate, double fDistance, double fLength) { - ::basegfx::B2DPoint aRetval; + B2DPoint aRetval; const sal_uInt32 nPointCount(rCandidate.count()); if(nPointCount > 1L) { sal_uInt32 nIndex(0L); - sal_Bool bIndexDone(sal_False); + bool bIndexDone(false); const double fZero(0.0); double fEdgeLength(fZero); // get length if not given - if(::basegfx::fTools::equalZero(fLength)) + if(fTools::equalZero(fLength)) { fLength = getLength(rCandidate); } // handle fDistance < 0.0 - if(::basegfx::fTools::less(fDistance, fZero)) + if(fTools::less(fDistance, fZero)) { if(rCandidate.isClosed()) { @@ -593,12 +593,12 @@ namespace basegfx { // crop to polygon start fDistance = fZero; - bIndexDone = sal_True; + bIndexDone = true; } } // handle fDistance >= fLength - if(::basegfx::fTools::moreOrEqual(fDistance, fLength)) + if(fTools::moreOrEqual(fDistance, fLength)) { if(rCandidate.isClosed()) { @@ -611,7 +611,7 @@ namespace basegfx // crop to polygon end fDistance = fZero; nIndex = nPointCount - 1L; - bIndexDone = sal_True; + bIndexDone = true; } } @@ -623,7 +623,7 @@ namespace basegfx // get length of next edge fEdgeLength = getEdgeLength(rCandidate, nIndex); - if(::basegfx::fTools::moreOrEqual(fDistance, fEdgeLength)) + if(fTools::moreOrEqual(fDistance, fEdgeLength)) { // go to next edge fDistance -= fEdgeLength; @@ -632,7 +632,7 @@ namespace basegfx else { // it's on this edge, stop - bIndexDone = sal_True; + bIndexDone = true; } } while (!bIndexDone); } @@ -642,29 +642,29 @@ namespace basegfx // if fDistance != 0.0, move that length on the edge. The edge // length is in fEdgeLength. - if(!::basegfx::fTools::equalZero(fDistance)) + if(!fTools::equalZero(fDistance)) { sal_uInt32 nNextIndex(getIndexOfSuccessor(nIndex, rCandidate)); - const ::basegfx::B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); + const B2DPoint aNextPoint(rCandidate.getB2DPoint(nNextIndex)); double fRelative(fZero); - if(!::basegfx::fTools::equalZero(fEdgeLength)) + if(!fTools::equalZero(fEdgeLength)) { fRelative = fDistance / fEdgeLength; } // add calculated average value to the return value - aRetval = ::basegfx::interpolate(aRetval, aNextPoint, fRelative); + aRetval = interpolate(aRetval, aNextPoint, fRelative); } } return aRetval; } - ::basegfx::B2DPoint getPositionRelative(const ::basegfx::B2DPolygon& rCandidate, double fDistance, double fLength) + B2DPoint getPositionRelative(const B2DPolygon& rCandidate, double fDistance, double fLength) { // get length if not given - if(::basegfx::fTools::equalZero(fLength)) + if(fTools::equalZero(fLength)) { fLength = getLength(rCandidate); } @@ -674,10 +674,10 @@ namespace basegfx return getPositionAbsolute(rCandidate, fDistance * fLength, fLength); } - ::basegfx::B2DVectorOrientation getPointOrientation(const ::basegfx::B2DPolygon& rCandidate, sal_uInt32 nIndex) + B2VectorOrientation getPointOrientation(const B2DPolygon& rCandidate, sal_uInt32 nIndex) { OSL_ENSURE(nIndex < rCandidate.count(), "getIndexOfPredecessor: Access to polygon out of range (!)"); - ::basegfx::B2DVectorOrientation eRetval(::basegfx::ORIENTATION_NEUTRAL); + B2VectorOrientation eRetval(ORIENTATION_NEUTRAL); if(rCandidate.count() > 2) { @@ -689,9 +689,9 @@ namespace basegfx if(nIndNext != nIndex && nIndNext != nIndPrev) { - ::basegfx::B2DPoint aPoint(rCandidate.getB2DPoint(nIndex)); - ::basegfx::B2DVector aVecPrev(rCandidate.getB2DPoint(nIndPrev) - aPoint); - ::basegfx::B2DVector aVecNext(rCandidate.getB2DPoint(nIndNext) - aPoint); + B2DPoint aPoint(rCandidate.getB2DPoint(nIndex)); + B2DVector aVecPrev(rCandidate.getB2DPoint(nIndPrev) - aPoint); + B2DVector aVecNext(rCandidate.getB2DPoint(nIndNext) - aPoint); eRetval = ::basegfx::getOrientation(aVecPrev, aVecNext); } } @@ -701,7 +701,7 @@ namespace basegfx } CutFlagValue findCut( - const ::basegfx::B2DPolygon& rCandidate, + const B2DPolygon& rCandidate, sal_uInt32 nIndex1, sal_uInt32 nIndex2, CutFlagValue aCutFlags, double* pCut1, double* pCut2) @@ -714,13 +714,13 @@ namespace basegfx sal_uInt32 nEnd1(getIndexOfSuccessor(nIndex1, rCandidate)); sal_uInt32 nEnd2(getIndexOfSuccessor(nIndex2, rCandidate)); - const ::basegfx::B2DPoint aStart1(rCandidate.getB2DPoint(nIndex1)); - const ::basegfx::B2DPoint aEnd1(rCandidate.getB2DPoint(nEnd1)); - const ::basegfx::B2DVector aVector1(aEnd1 - aStart1); + const B2DPoint aStart1(rCandidate.getB2DPoint(nIndex1)); + const B2DPoint aEnd1(rCandidate.getB2DPoint(nEnd1)); + const B2DVector aVector1(aEnd1 - aStart1); - const ::basegfx::B2DPoint aStart2(rCandidate.getB2DPoint(nIndex2)); - const ::basegfx::B2DPoint aEnd2(rCandidate.getB2DPoint(nEnd2)); - const ::basegfx::B2DVector aVector2(aEnd2 - aStart2); + const B2DPoint aStart2(rCandidate.getB2DPoint(nIndex2)); + const B2DPoint aEnd2(rCandidate.getB2DPoint(nEnd2)); + const B2DVector aVector2(aEnd2 - aStart2); aRetval = findCut( aStart1, aVector1, aStart2, aVector2, @@ -731,8 +731,8 @@ namespace basegfx } CutFlagValue findCut( - const ::basegfx::B2DPolygon& rCandidate1, sal_uInt32 nIndex1, - const ::basegfx::B2DPolygon& rCandidate2, sal_uInt32 nIndex2, + const B2DPolygon& rCandidate1, sal_uInt32 nIndex1, + const B2DPolygon& rCandidate2, sal_uInt32 nIndex2, CutFlagValue aCutFlags, double* pCut1, double* pCut2) { @@ -745,13 +745,13 @@ namespace basegfx sal_uInt32 nEnd1(getIndexOfSuccessor(nIndex1, rCandidate1)); sal_uInt32 nEnd2(getIndexOfSuccessor(nIndex2, rCandidate2)); - const ::basegfx::B2DPoint aStart1(rCandidate1.getB2DPoint(nIndex1)); - const ::basegfx::B2DPoint aEnd1(rCandidate1.getB2DPoint(nEnd1)); - const ::basegfx::B2DVector aVector1(aEnd1 - aStart1); + const B2DPoint aStart1(rCandidate1.getB2DPoint(nIndex1)); + const B2DPoint aEnd1(rCandidate1.getB2DPoint(nEnd1)); + const B2DVector aVector1(aEnd1 - aStart1); - const ::basegfx::B2DPoint aStart2(rCandidate2.getB2DPoint(nIndex2)); - const ::basegfx::B2DPoint aEnd2(rCandidate2.getB2DPoint(nEnd2)); - const ::basegfx::B2DVector aVector2(aEnd2 - aStart2); + const B2DPoint aStart2(rCandidate2.getB2DPoint(nIndex2)); + const B2DPoint aEnd2(rCandidate2.getB2DPoint(nEnd2)); + const B2DVector aVector2(aEnd2 - aStart2); aRetval = findCut( aStart1, aVector1, aStart2, aVector2, @@ -762,15 +762,15 @@ namespace basegfx } CutFlagValue findCut( - const ::basegfx::B2DPoint& rEdge1Start, const ::basegfx::B2DVector& rEdge1Delta, - const ::basegfx::B2DPoint& rEdge2Start, const ::basegfx::B2DVector& rEdge2Delta, + const B2DPoint& rEdge1Start, const B2DVector& rEdge1Delta, + const B2DPoint& rEdge2Start, const B2DVector& rEdge2Delta, CutFlagValue aCutFlags, double* pCut1, double* pCut2) { CutFlagValue aRetval(CUTFLAG_NONE); double fCut1(0.0); double fCut2(0.0); - sal_Bool bFinished(!((sal_Bool)(aCutFlags & CUTFLAG_ALL))); + bool bFinished(!((bool)(aCutFlags & CUTFLAG_ALL))); // test for same points? if(!bFinished @@ -782,7 +782,7 @@ namespace basegfx { if(rEdge1Start.equal(rEdge2Start)) { - bFinished = sal_True; + bFinished = true; aRetval = (CUTFLAG_START1|CUTFLAG_START2); } } @@ -790,12 +790,12 @@ namespace basegfx // same endpoint? if(!bFinished && (aCutFlags & (CUTFLAG_END1|CUTFLAG_END2)) == (CUTFLAG_END1|CUTFLAG_END2)) { - const ::basegfx::B2DPoint aEnd1(rEdge1Start + rEdge1Delta); - const ::basegfx::B2DPoint aEnd2(rEdge2Start + rEdge2Delta); + const B2DPoint aEnd1(rEdge1Start + rEdge1Delta); + const B2DPoint aEnd2(rEdge2Start + rEdge2Delta); if(aEnd1.equal(aEnd2)) { - bFinished = sal_True; + bFinished = true; aRetval = (CUTFLAG_END1|CUTFLAG_END2); fCut1 = fCut2 = 1.0; } @@ -804,11 +804,11 @@ namespace basegfx // startpoint1 == endpoint2? if(!bFinished && (aCutFlags & (CUTFLAG_START1|CUTFLAG_END2)) == (CUTFLAG_START1|CUTFLAG_END2)) { - const ::basegfx::B2DPoint aEnd2(rEdge2Start + rEdge2Delta); + const B2DPoint aEnd2(rEdge2Start + rEdge2Delta); if(rEdge1Start.equal(aEnd2)) { - bFinished = sal_True; + bFinished = true; aRetval = (CUTFLAG_START1|CUTFLAG_END2); fCut1 = 0.0; fCut2 = 1.0; @@ -818,11 +818,11 @@ namespace basegfx // startpoint2 == endpoint1? if(!bFinished&& (aCutFlags & (CUTFLAG_START2|CUTFLAG_END1)) == (CUTFLAG_START2|CUTFLAG_END1)) { - const ::basegfx::B2DPoint aEnd1(rEdge1Start + rEdge1Delta); + const B2DPoint aEnd1(rEdge1Start + rEdge1Delta); if(rEdge2Start.equal(aEnd1)) { - bFinished = sal_True; + bFinished = true; aRetval = (CUTFLAG_START2|CUTFLAG_END1); fCut1 = 1.0; fCut2 = 0.0; @@ -837,7 +837,7 @@ namespace basegfx // start1 on line 2 ? if(isPointOnEdge(rEdge1Start, rEdge2Start, rEdge2Delta, &fCut2)) { - bFinished = sal_True; + bFinished = true; aRetval = (CUTFLAG_LINE|CUTFLAG_START1); } } @@ -847,7 +847,7 @@ namespace basegfx // start2 on line 1 ? if(isPointOnEdge(rEdge2Start, rEdge1Start, rEdge1Delta, &fCut1)) { - bFinished = sal_True; + bFinished = true; aRetval = (CUTFLAG_LINE|CUTFLAG_START2); } } @@ -855,11 +855,11 @@ namespace basegfx if(!bFinished && (aCutFlags & CUTFLAG_END1)) { // end1 on line 2 ? - const ::basegfx::B2DPoint aEnd1(rEdge1Start + rEdge1Delta); + const B2DPoint aEnd1(rEdge1Start + rEdge1Delta); if(isPointOnEdge(aEnd1, rEdge2Start, rEdge2Delta, &fCut2)) { - bFinished = sal_True; + bFinished = true; aRetval = (CUTFLAG_LINE|CUTFLAG_END1); } } @@ -867,11 +867,11 @@ namespace basegfx if(!bFinished && (aCutFlags & CUTFLAG_END2)) { // end2 on line 1 ? - const ::basegfx::B2DPoint aEnd2(rEdge2Start + rEdge2Delta); + const B2DPoint aEnd2(rEdge2Start + rEdge2Delta); if(isPointOnEdge(aEnd2, rEdge1Start, rEdge1Delta, &fCut1)) { - bFinished = sal_True; + bFinished = true; aRetval = (CUTFLAG_LINE|CUTFLAG_END2); } } @@ -881,7 +881,7 @@ namespace basegfx // cut in line1, line2 ? fCut1 = (rEdge1Delta.getX() * rEdge2Delta.getY()) - (rEdge1Delta.getY() * rEdge2Delta.getX()); - if(!::basegfx::fTools::equalZero(fCut1)) + if(!fTools::equalZero(fCut1)) { fCut1 = (rEdge2Delta.getY() * (rEdge2Start.getX() - rEdge1Start.getX()) + rEdge2Delta.getX() * (rEdge1Start.getY() - rEdge2Start.getY())) / fCut1; @@ -890,8 +890,8 @@ namespace basegfx const double fOne(1.0); // inside parameter range edge1 AND fCut2 is calcable - if(::basegfx::fTools::more(fCut1, fZero) && ::basegfx::fTools::less(fCut1, fOne) - && (!::basegfx::fTools::equalZero(rEdge2Delta.getX()) || !::basegfx::fTools::equalZero(rEdge2Delta.getY()))) + if(fTools::more(fCut1, fZero) && fTools::less(fCut1, fOne) + && (!fTools::equalZero(rEdge2Delta.getX()) || !fTools::equalZero(rEdge2Delta.getY()))) { // take the mopre precise calculation of the two possible if(fabs(rEdge2Delta.getX()) > fabs(rEdge2Delta.getY())) @@ -906,9 +906,9 @@ namespace basegfx } // inside parameter range edge2, too - if(::basegfx::fTools::more(fCut2, fZero) && ::basegfx::fTools::less(fCut2, fOne)) + if(fTools::more(fCut2, fZero) && fTools::less(fCut2, fOne)) { - bFinished = sal_True; + bFinished = true; aRetval = CUTFLAG_LINE; } } @@ -930,56 +930,56 @@ namespace basegfx return aRetval; } - sal_Bool isPointOnEdge( - const ::basegfx::B2DPoint& rPoint, - const ::basegfx::B2DPoint& rEdgeStart, - const ::basegfx::B2DVector& rEdgeDelta, + bool isPointOnEdge( + const B2DPoint& rPoint, + const B2DPoint& rEdgeStart, + const B2DVector& rEdgeDelta, double* pCut) { - sal_Bool bDeltaXIsZero(::basegfx::fTools::equalZero(rEdgeDelta.getX())); - sal_Bool bDeltaYIsZero(::basegfx::fTools::equalZero(rEdgeDelta.getY())); + bool bDeltaXIsZero(fTools::equalZero(rEdgeDelta.getX())); + bool bDeltaYIsZero(fTools::equalZero(rEdgeDelta.getY())); const double fZero(0.0); const double fOne(1.0); if(bDeltaXIsZero && bDeltaYIsZero) { // no line, just a point - return sal_False; + return false; } else if(bDeltaXIsZero) { // vertical line - if(::basegfx::fTools::equal(rPoint.getX(), rEdgeStart.getX())) + if(fTools::equal(rPoint.getX(), rEdgeStart.getX())) { double fValue = (rPoint.getY() - rEdgeStart.getY()) / rEdgeDelta.getY(); - if(::basegfx::fTools::more(fValue, fZero) && ::basegfx::fTools::less(fValue, fOne)) + if(fTools::more(fValue, fZero) && fTools::less(fValue, fOne)) { if(pCut) { *pCut = fValue; } - return sal_True; + return true; } } } else if(bDeltaYIsZero) { // horizontal line - if(::basegfx::fTools::equal(rPoint.getY(), rEdgeStart.getY())) + if(fTools::equal(rPoint.getY(), rEdgeStart.getY())) { double fValue = (rPoint.getX() - rEdgeStart.getX()) / rEdgeDelta.getX(); - if(::basegfx::fTools::more(fValue, fZero) - && ::basegfx::fTools::less(fValue, fOne)) + if(fTools::more(fValue, fZero) + && fTools::less(fValue, fOne)) { if(pCut) { *pCut = fValue; } - return sal_True; + return true; } } } @@ -989,13 +989,13 @@ namespace basegfx double fTOne = (rPoint.getX() - rEdgeStart.getX()) / rEdgeDelta.getX(); double fTTwo = (rPoint.getY() - rEdgeStart.getY()) / rEdgeDelta.getY(); - if(::basegfx::fTools::equal(fTOne, fTTwo)) + if(fTools::equal(fTOne, fTTwo)) { // same parameter representation, point is on line. Take // middle value for better results double fValue = (fTOne + fTTwo) / 2.0; - if(::basegfx::fTools::more(fValue, fZero) && ::basegfx::fTools::less(fValue, fOne)) + if(fTools::more(fValue, fZero) && fTools::less(fValue, fOne)) { // point is inside line bounds, too if(pCut) @@ -1003,17 +1003,17 @@ namespace basegfx *pCut = fValue; } - return sal_True; + return true; } } } - return sal_False; + return false; } - ::basegfx::B2DPolyPolygon applyLineDashing(const ::basegfx::B2DPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen) + B2DPolyPolygon applyLineDashing(const B2DPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen) { - ::basegfx::B2DPolyPolygon aRetval; + B2DPolyPolygon aRetval; if(rCandidate.count() && fFullDashDotLen > 0.0) { @@ -1024,9 +1024,9 @@ namespace basegfx for(sal_uInt32 a(0L); a < nCount; a++) { const sal_uInt32 nNextIndex(getIndexOfSuccessor(a, rCandidate)); - const ::basegfx::B2DPoint aStart(rCandidate.getB2DPoint(a)); - const ::basegfx::B2DPoint aEnd(rCandidate.getB2DPoint(nNextIndex)); - const ::basegfx::B2DVector aVector(aEnd - aStart); + const B2DPoint aStart(rCandidate.getB2DPoint(a)); + const B2DPoint aEnd(rCandidate.getB2DPoint(nNextIndex)); + const B2DVector aVector(aEnd - aStart); double fLength(aVector.getLength()); double fPosOnVector(0.0); @@ -1035,7 +1035,7 @@ namespace basegfx // handle [fPosOnVector .. fPosOnVector+fDashDotLength] if(nDashDotIndex % 2) { - ::basegfx::B2DPolygon aResult; + B2DPolygon aResult; // add start point if(fPosOnVector == 0.0) @@ -1044,11 +1044,11 @@ namespace basegfx } else { - aResult.append(aStart + (aVector * fPosOnVector)); + aResult.append( B2DPoint(aStart + (aVector * fPosOnVector)) ); } // add end point - aResult.append(aStart + (aVector * (fPosOnVector + fDashDotLength))); + aResult.append( B2DPoint(aStart + (aVector * (fPosOnVector + fDashDotLength))) ); // add line to PolyPolygon aRetval.append(aResult); @@ -1064,10 +1064,10 @@ namespace basegfx // handle [fPosOnVector .. fPosOnVector+fLength (bzw. end)] if((fLength > 0.0) && (nDashDotIndex % 2)) { - ::basegfx::B2DPolygon aResult; + B2DPolygon aResult; // add start and end point - const ::basegfx::B2DPoint aPosA(aStart + (aVector * fPosOnVector)); + const B2DPoint aPosA(aStart + (aVector * fPosOnVector)); aResult.append(aPosA); // add line to PolyPolygon diff --git a/basegfx/source/polygon/b2dpolypolygon.cxx b/basegfx/source/polygon/b2dpolypolygon.cxx index f6fcbd9c0e55..53da317e483e 100644 --- a/basegfx/source/polygon/b2dpolypolygon.cxx +++ b/basegfx/source/polygon/b2dpolypolygon.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolypolygon.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:06 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:32 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -110,21 +110,21 @@ public: void incRefCount() { mnRefCount++; } void decRefCount() { mnRefCount--; } - sal_Bool isEqual(const ImplB2DPolyPolygon& rPolygonList) const + bool isEqual(const ImplB2DPolyPolygon& rPolygonList) const { // same polygon count? if(maPolygons.size() != rPolygonList.maPolygons.size()) - return sal_False; + return false; // if zero polygons the polys are equal if(!maPolygons.size()) - return sal_True; + return true; // compare polygon content if(maPolygons != rPolygonList.maPolygons) - return sal_False; + return false; - return sal_True; + return true; } const ::basegfx::B2DPolygon& getB2DPolygon(sal_uInt32 nIndex) const @@ -185,7 +185,7 @@ public: return maPolygons.size(); } - void setClosed(sal_Bool bNew) + void setClosed(bool bNew) { for(sal_uInt32 a(0L); a < maPolygons.size(); a++) { @@ -275,21 +275,21 @@ namespace basegfx return *this; } - sal_Bool B2DPolyPolygon::operator==(const B2DPolyPolygon& rPolyPolygon) const + bool B2DPolyPolygon::operator==(const B2DPolyPolygon& rPolyPolygon) const { if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon) { - return sal_True; + return true; } return mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon)); } - sal_Bool B2DPolyPolygon::operator!=(const B2DPolyPolygon& rPolyPolygon) const + bool B2DPolyPolygon::operator!=(const B2DPolyPolygon& rPolyPolygon) const { if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon) { - return sal_False; + return false; } return !mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon)); @@ -318,7 +318,7 @@ namespace basegfx } } - sal_Bool B2DPolyPolygon::areControlPointsUsed() const + bool B2DPolyPolygon::areControlPointsUsed() const { for(sal_uInt32 a(0L); a < mpPolyPolygon->count(); a++) { @@ -326,11 +326,11 @@ namespace basegfx if(rPolygon.areControlPointsUsed()) { - return sal_True; + return true; } } - return sal_False; + return false; } void B2DPolyPolygon::insert(sal_uInt32 nIndex, const B2DPolygon& rPolygon, sal_uInt32 nCount) @@ -399,9 +399,9 @@ namespace basegfx mpPolyPolygon->incRefCount(); } - sal_Bool B2DPolyPolygon::isClosed() const + bool B2DPolyPolygon::isClosed() const { - sal_Bool bRetval(sal_True); + bool bRetval(true); // PolyPOlygon is closed when all contained Polygons are closed or // no Polygon exists. @@ -409,14 +409,14 @@ namespace basegfx { if(!(mpPolyPolygon->getB2DPolygon(a)).isClosed()) { - bRetval = sal_False; + bRetval = false; } } return bRetval; } - void B2DPolyPolygon::setClosed(sal_Bool bNew) + void B2DPolyPolygon::setClosed(bool bNew) { if(bNew != isClosed()) { @@ -431,15 +431,15 @@ namespace basegfx mpPolyPolygon->flip(); } - sal_Bool B2DPolyPolygon::hasDoublePoints() const + bool B2DPolyPolygon::hasDoublePoints() const { - sal_Bool bRetval(sal_False); + bool bRetval(false); for(sal_uInt32 a(0L); !bRetval && a < mpPolyPolygon->count(); a++) { if((mpPolyPolygon->getB2DPolygon(a)).hasDoublePoints()) { - bRetval = sal_True; + bRetval = true; } } diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx index 17d1c476acbf..9d1fb54e1e75 100644 --- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx +++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolypolygoncutter.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:06 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -88,7 +88,7 @@ namespace basegfx { - B2DPolygonNode::B2DPolygonNode(const ::basegfx::B2DPoint& rPosition, B2DPolygonNode* pPrevious) + B2DPolygonNode::B2DPolygonNode(const B2DPoint& rPosition, B2DPolygonNode* pPrevious) : maPosition(rPosition) { mpListPrevious = this; @@ -190,14 +190,14 @@ namespace basegfx } } - sal_Bool B2DPolygonNode::getOrientation() const + bool B2DPolygonNode::getOrientation() const { const B2DPolygonNode* pOutmost = this; const B2DPolygonNode* pCurrent = this->getNext(); while(pCurrent != this) { - if(::basegfx::fTools::more(pOutmost->getPosition().getX(), pCurrent->getPosition().getX())) + if(fTools::more(pOutmost->getPosition().getX(), pCurrent->getPosition().getX())) { if(pCurrent->getPosition().getX() < pOutmost->getPosition().getX()) { @@ -216,9 +216,9 @@ namespace basegfx pCurrent = pCurrent->getNext(); } - ::basegfx::B2DVector aVec1(pOutmost->getPrevious()->getPosition() - pOutmost->getPosition()); - ::basegfx::B2DVector aVec2(pOutmost->getNext()->getPosition() - pOutmost->getPosition()); - return sal_Bool(::basegfx::fTools::more(aVec1.getX() * aVec2.getY(), aVec1.getY() * aVec2.getX())); + B2DVector aVec1(pOutmost->getPrevious()->getPosition() - pOutmost->getPosition()); + B2DVector aVec2(pOutmost->getNext()->getPosition() - pOutmost->getPosition()); + return bool(fTools::more(aVec1.getX() * aVec2.getY(), aVec1.getY() * aVec2.getX())); } void B2DPolygonNode::swapOrientation() @@ -231,9 +231,9 @@ namespace basegfx } while(pCurrent != this); } - ::basegfx::B2DRange B2DPolygonNode::getRange() const + B2DRange B2DPolygonNode::getRange() const { - ::basegfx::B2DRange aRetval; + B2DRange aRetval; const B2DPolygonNode* pCurrent = this; do { @@ -244,26 +244,26 @@ namespace basegfx return aRetval; } - sal_Bool B2DPolygonNode::isInside(const ::basegfx::B2DPoint& rPoint, sal_Bool bWithBorder) const + bool B2DPolygonNode::isInside(const B2DPoint& rPoint, bool bWithBorder) const { - sal_Bool bInside(sal_False); + bool bInside(false); const B2DPolygonNode* pCurrent = this; do { if(bWithBorder && pCurrent->getPosition().equal(rPoint)) { - return sal_True; + return true; } B2DPolygonNode* pNext = pCurrent->getNext(); - const sal_Bool bCompYA(::basegfx::fTools::more(pCurrent->getPosition().getY(), rPoint.getY())); - const sal_Bool bCompYB(::basegfx::fTools::more(pNext->getPosition().getY(), rPoint.getY())); + const bool bCompYA(fTools::more(pCurrent->getPosition().getY(), rPoint.getY())); + const bool bCompYB(fTools::more(pNext->getPosition().getY(), rPoint.getY())); if(bCompYA != bCompYB) { - const sal_Bool bCompXA(::basegfx::fTools::more(pCurrent->getPosition().getX(), rPoint.getX())); - const sal_Bool bCompXB(::basegfx::fTools::more(pNext->getPosition().getX(), rPoint.getX())); + const bool bCompXA(fTools::more(pCurrent->getPosition().getX(), rPoint.getX())); + const bool bCompXB(fTools::more(pNext->getPosition().getX(), rPoint.getX())); if(bCompXA == bCompXB) { @@ -279,11 +279,11 @@ namespace basegfx (pCurrent->getPosition().getX() - pNext->getPosition().getX()) / (pCurrent->getPosition().getY() - pNext->getPosition().getY()); - if(bWithBorder && ::basegfx::fTools::more(fCmp, rPoint.getX())) + if(bWithBorder && fTools::more(fCmp, rPoint.getX())) { bInside = !bInside; } - else if(::basegfx::fTools::moreOrEqual(fCmp, rPoint.getX())) + else if(fTools::moreOrEqual(fCmp, rPoint.getX())) { bInside = !bInside; } @@ -298,10 +298,10 @@ namespace basegfx return bInside; } - sal_Bool B2DPolygonNode::isPolygonInside(B2DPolygonNode* pPoly, sal_Bool bWithBorder) const + bool B2DPolygonNode::isPolygonInside(B2DPolygonNode* pPoly, bool bWithBorder) const { B2DPolygonNode* pTest = pPoly; - sal_Bool bAllAInside(sal_True); + bool bAllAInside(true); do { bAllAInside = isInside(pTest->getPosition(), bWithBorder); @@ -348,7 +348,7 @@ namespace basegfx mnDepth = (mbOrientation) ? 0L : -1L; } - void B2DClipExtraPolygonInfo::changeDepth(sal_Bool bOrientation) + void B2DClipExtraPolygonInfo::changeDepth(bool bOrientation) { if(bOrientation) { @@ -376,7 +376,7 @@ namespace basegfx maPolygonList.clear(); } - void B2DPolyPolygonCutter::removeIncludedPolygons(sal_Bool bUseOr) + void B2DPolyPolygonCutter::removeIncludedPolygons(bool bUseOr) { const sal_uInt32 aCount(maPolygonList.size()); B2DClipExtraPolygonInfo* pInfos = new B2DClipExtraPolygonInfo[aCount]; @@ -400,7 +400,7 @@ namespace basegfx if(a != b && doRangesInclude(rInfoA.getRange(), rInfoB.getRange())) { // volume B in A, test pA, pB for inclusion, with border - if(maPolygonList[a]->isPolygonInside(maPolygonList[b], sal_True)) + if(maPolygonList[a]->isPolygonInside(maPolygonList[b], true)) { // pB is inside pA rInfoB.changeDepth(rInfoA.getOrientation()); @@ -486,7 +486,7 @@ namespace basegfx for(sal_uInt32 a(0L); a < rPolygon.count(); a++) { - ::basegfx::B2DPoint aPoint(rPolygon.getB2DPoint(a)); + B2DPoint aPoint(rPolygon.getB2DPoint(a)); pRetval = new B2DPolygonNode(aPoint, pRetval); } @@ -521,7 +521,7 @@ namespace basegfx } while(pAct != pPolygon); } - void B2DPolyPolygonCutter::addPolyPolygon(const B2DPolyPolygon& rPolyPolygon, sal_Bool bForceOrientation) + void B2DPolyPolygonCutter::addPolyPolygon(const B2DPolyPolygon& rPolyPolygon, bool bForceOrientation) { for(sal_uInt32 a(0L); a < rPolyPolygon.count(); a++) { @@ -536,10 +536,10 @@ namespace basegfx { if(bForceOrientation) { - ::basegfx::B2DVectorOrientation aOrientation = - ::basegfx::tools::getOrientation(aCandidate); + B2VectorOrientation aOrientation = + tools::getOrientation(aCandidate); - if(::basegfx::ORIENTATION_POSITIVE != aOrientation) + if(ORIENTATION_POSITIVE != aOrientation) { aCandidate.flip(); } @@ -575,7 +575,7 @@ namespace basegfx pAct = pAct->getNext(); } while(pAct != pCand); - aNewPolygon.setClosed(sal_True); + aNewPolygon.setClosed(true); rPolyPolygon.append(aNewPolygon); } @@ -656,7 +656,7 @@ namespace basegfx do { if(isSamePos(pA->getPosition(), pB->getPosition())) { - aNewCuts.push_back(new B2DSimpleCut(pA, pB, sal_True, pCand->getOrientation())); + aNewCuts.push_back(new B2DSimpleCut(pA, pB, true, pCand->getOrientation())); } // next B @@ -679,42 +679,42 @@ namespace basegfx do { pB->calcMinMaxX(fMaxBX, fMinBX); - if(::basegfx::fTools::more(fMaxBX, fMinAX) - && ::basegfx::fTools::more(fMaxAX, fMinBX)) + if(fTools::more(fMaxBX, fMinAX) + && fTools::more(fMaxAX, fMinBX)) { pB->calcMinMaxY(fMaxBY, fMinBY); - if(::basegfx::fTools::more(fMaxBY, fMinAY) - && ::basegfx::fTools::more(fMaxAY, fMinBY)) + if(fTools::more(fMaxBY, fMinAY) + && fTools::more(fMaxAY, fMinBY)) { if(!isSamePos(pA->getPosition(), pB->getPosition())) { - const ::basegfx::B2DVector aVectorA(pA->getNext()->getPosition() - pA->getPosition()); - const ::basegfx::B2DVector aVectorB(pB->getNext()->getPosition() - pB->getPosition()); + const B2DVector aVectorA(pA->getNext()->getPosition() - pA->getPosition()); + const B2DVector aVectorB(pB->getNext()->getPosition() - pB->getPosition()); - if(::basegfx::tools::findCut(pA->getPosition(), aVectorA, pB->getPosition(), aVectorB, CUTFLAG_LINE, &fCut)) + if(tools::findCut(pA->getPosition(), aVectorA, pB->getPosition(), aVectorB, CUTFLAG_LINE, &fCut)) { // crossover, two new points - ::basegfx::B2DPoint aNewPos(::basegfx::interpolate(pA->getPosition(), pA->getNext()->getPosition(), fCut)); + B2DPoint aNewPos(interpolate(pA->getPosition(), pA->getNext()->getPosition(), fCut)); B2DPolygonNode* pCutLo = new B2DPolygonNode(aNewPos, pA); B2DPolygonNode* pCutHi = new B2DPolygonNode(aNewPos, pB); - aNewCuts.push_back(new B2DSimpleCut(pCutLo, pCutHi, sal_True, pCand->getOrientation())); + aNewCuts.push_back(new B2DSimpleCut(pCutLo, pCutHi, true, pCand->getOrientation())); pA->calcMinMaxX(fMaxAX, fMinAX); pA->calcMinMaxY(fMaxAY, fMinAY); } else { - if(::basegfx::tools::isPointOnEdge(pA->getPosition(), pB->getPosition(), aVectorB, &fCut)) + if(tools::isPointOnEdge(pA->getPosition(), pB->getPosition(), aVectorB, &fCut)) { // startpoint A at edge B, one new point B2DPolygonNode* pCutHi = new B2DPolygonNode(pA->getPosition(), pB); - aNewCuts.push_back(new B2DSimpleCut(pA, pCutHi, sal_True, pCand->getOrientation())); + aNewCuts.push_back(new B2DSimpleCut(pA, pCutHi, true, pCand->getOrientation())); } - else if(::basegfx::tools::isPointOnEdge(pB->getPosition(), pA->getPosition(), aVectorA, &fCut)) + else if(tools::isPointOnEdge(pB->getPosition(), pA->getPosition(), aVectorA, &fCut)) { // startpoint B at edge A, one new point B2DPolygonNode* pCutLo = new B2DPolygonNode(pB->getPosition(), pA); - aNewCuts.push_back(new B2DSimpleCut(pCutLo, pB, sal_True, pCand->getOrientation())); + aNewCuts.push_back(new B2DSimpleCut(pCutLo, pB, true, pCand->getOrientation())); pA->calcMinMaxX(fMaxAX, fMinAX); pA->calcMinMaxY(fMaxAY, fMinAY); } @@ -743,11 +743,11 @@ namespace basegfx } } - sal_Bool B2DPolyPolygonCutter::isCrossover(B2DPolygonNode* pA, B2DPolygonNode* pB) + bool B2DPolyPolygonCutter::isCrossover(B2DPolygonNode* pA, B2DPolygonNode* pB) { // build entering vectors - ::basegfx::B2DVector aVecA(pA->getPrevious()->getPosition() - pA->getPosition()); - ::basegfx::B2DVector aVecB(pB->getPrevious()->getPosition() - pA->getPosition()); + B2DVector aVecA(pA->getPrevious()->getPosition() - pA->getPosition()); + B2DVector aVecB(pB->getPrevious()->getPosition() - pA->getPosition()); aVecA.normalize(); aVecB.normalize(); double fDegreeA2 = atan2(aVecA.getY(), aVecA.getX()); @@ -769,30 +769,30 @@ namespace basegfx fDegreeA1 = fTemp; } - sal_Bool bB1Inside(::basegfx::fTools::more(fDegreeB1, fDegreeA1) - && ::basegfx::fTools::more(fDegreeA2, fDegreeB1)); - sal_Bool bB2Inside(::basegfx::fTools::more(fDegreeB2, fDegreeA1) - && ::basegfx::fTools::more(fDegreeA2, fDegreeB2)); + bool bB1Inside(fTools::more(fDegreeB1, fDegreeA1) + && fTools::more(fDegreeA2, fDegreeB1)); + bool bB2Inside(fTools::more(fDegreeB2, fDegreeA1) + && fTools::more(fDegreeA2, fDegreeB2)); if(bB1Inside && bB2Inside) { - return sal_False; + return false; } - sal_Bool bB1Outside(::basegfx::fTools::more(fDegreeA1, fDegreeB1) - || ::basegfx::fTools::more(fDegreeB1, fDegreeA2)); - sal_Bool bB2Outside(::basegfx::fTools::more(fDegreeA1, fDegreeB2) - || ::basegfx::fTools::more(fDegreeB2, fDegreeA2)); + bool bB1Outside(fTools::more(fDegreeA1, fDegreeB1) + || fTools::more(fDegreeB1, fDegreeA2)); + bool bB2Outside(fTools::more(fDegreeA1, fDegreeB2) + || fTools::more(fDegreeB2, fDegreeA2)); return !(bB1Outside && bB2Outside); } - sal_Bool B2DPolyPolygonCutter::isCrossover(B2DSimpleCut* pEnter, B2DSimpleCut* pLeave) + bool B2DPolyPolygonCutter::isCrossover(B2DSimpleCut* pEnter, B2DSimpleCut* pLeave) { // build entering vectors - ::basegfx::B2DVector aVecJ(pEnter->getLeft()->getNext()->getPosition() - pEnter->getLeft()->getPosition()); - ::basegfx::B2DVector aVecA(pEnter->getLeft()->getPrevious()->getPosition() - pEnter->getLeft()->getPosition()); - ::basegfx::B2DVector aVecB(pEnter->getRight()->getPrevious()->getPosition() - pEnter->getLeft()->getPosition()); + B2DVector aVecJ(pEnter->getLeft()->getNext()->getPosition() - pEnter->getLeft()->getPosition()); + B2DVector aVecA(pEnter->getLeft()->getPrevious()->getPosition() - pEnter->getLeft()->getPosition()); + B2DVector aVecB(pEnter->getRight()->getPrevious()->getPosition() - pEnter->getLeft()->getPosition()); aVecJ.normalize(); aVecA.normalize(); aVecB.normalize(); @@ -822,7 +822,7 @@ namespace basegfx fDegreeB2 -= (2.0 * F_PI); } - sal_Bool bA2BiggerB2(::basegfx::fTools::more(fDegreeA2, fDegreeB2)); + bool bA2BiggerB2(fTools::more(fDegreeA2, fDegreeB2)); // build leaving vectors aVecJ = pLeave->getLeft()->getPrevious()->getPosition() - pLeave->getLeft()->getPosition(); @@ -857,7 +857,7 @@ namespace basegfx fDegreeB1 -= (2.0 * F_PI); } - sal_Bool bA1BiggerB1(::basegfx::fTools::more(fDegreeA1, fDegreeB1)); + bool bA1BiggerB1(fTools::more(fDegreeA1, fDegreeB1)); // compare return (bA1BiggerB1 == bA2BiggerB2); @@ -878,7 +878,7 @@ namespace basegfx sal_uInt32 a; // create volume list for all polys for faster compares - ::basegfx::B2DRange* pVolumes = new ::basegfx::B2DRange[maPolygonList.size()]; + B2DRange* pVolumes = new B2DRange[maPolygonList.size()]; for(a = 0L; a < maPolygonList.size(); a++) { @@ -928,23 +928,23 @@ namespace basegfx do { pB->calcMinMaxX(fMaxBX, fMinBX); - if(::basegfx::fTools::more(fMaxBX, fMinAX) - && ::basegfx::fTools::more(fMaxAX, fMinBX)) + if(fTools::more(fMaxBX, fMinAX) + && fTools::more(fMaxAX, fMinBX)) { pB->calcMinMaxY(fMaxBY, fMinBY); - if(::basegfx::fTools::more(fMaxBY, fMinAY) - && ::basegfx::fTools::more(fMaxAY, fMinBY)) + if(fTools::more(fMaxBY, fMinAY) + && fTools::more(fMaxAY, fMinBY)) { if(!isSamePos(pA->getPosition(), pB->getPosition())) { - const ::basegfx::B2DVector aVectorA(pA->getNext()->getPosition() - pA->getPosition()); - const ::basegfx::B2DVector aVectorB(pB->getNext()->getPosition() - pB->getPosition()); + const B2DVector aVectorA(pA->getNext()->getPosition() - pA->getPosition()); + const B2DVector aVectorB(pB->getNext()->getPosition() - pB->getPosition()); - if(::basegfx::tools::findCut(pA->getPosition(), aVectorA, pB->getPosition(), aVectorB, CUTFLAG_LINE, &fCut)) + if(tools::findCut(pA->getPosition(), aVectorA, pB->getPosition(), aVectorB, CUTFLAG_LINE, &fCut)) { // crossover, two new points, use as cutpoint - ::basegfx::B2DPoint aNewPos(::basegfx::interpolate(pA->getPosition(), pA->getNext()->getPosition(), fCut)); + B2DPoint aNewPos(interpolate(pA->getPosition(), pA->getNext()->getPosition(), fCut)); B2DPolygonNode* pCutLo = new B2DPolygonNode(aNewPos, pA); B2DPolygonNode* pCutHi = new B2DPolygonNode(aNewPos, pB); aNewCuts.push_back(new B2DSimpleCut(pCutLo, pCutHi)); @@ -953,14 +953,14 @@ namespace basegfx } else { - if(::basegfx::tools::isPointOnEdge(pA->getPosition(), pB->getPosition(), aVectorB, &fCut)) + if(tools::isPointOnEdge(pA->getPosition(), pB->getPosition(), aVectorB, &fCut)) { // startpoint A at edge B, one new point // leaves or enters common section B2DPolygonNode* pCutHi = new B2DPolygonNode(pA->getPosition(), pB); aTmpCuts.push_back(new B2DSimpleCut(pA, pCutHi)); } - else if(::basegfx::tools::isPointOnEdge(pB->getPosition(), pA->getPosition(), aVectorA, &fCut)) + else if(tools::isPointOnEdge(pB->getPosition(), pA->getPosition(), aVectorA, &fCut)) { // startpoint B at edge A, one new point // leaves or enters common section @@ -986,15 +986,15 @@ namespace basegfx for(sal_uInt32 c(0L); c < aTmpCuts.size();) { B2DSimpleCut* pCand = aTmpCuts[c]; - sal_Bool bPrevSamePos(isPrevSamePos(pCand->getLeft(), pCand->getRight())); - sal_Bool bNextSamePos(isNextSamePos(pCand->getLeft(), pCand->getRight())); - sal_Bool bDelete(sal_False); - sal_Bool bIncC(sal_True); + bool bPrevSamePos(isPrevSamePos(pCand->getLeft(), pCand->getRight())); + bool bNextSamePos(isNextSamePos(pCand->getLeft(), pCand->getRight())); + bool bDelete(false); + bool bIncC(true); if(bPrevSamePos && bNextSamePos) { // single point inside continued same direction section - bDelete = sal_True; + bDelete = true; } else if(!bPrevSamePos && !bNextSamePos) { @@ -1004,12 +1004,12 @@ namespace basegfx // real cut, move to real cutlist aNewCuts.push_back(pCand); aTmpCuts.erase(aTmpCuts.begin() + c); - bIncC = sal_False; + bIncC = false; } else { // no cut, just a touch in one point - bDelete = sal_True; + bDelete = true; } } @@ -1018,7 +1018,7 @@ namespace basegfx { delete pCand; aTmpCuts.erase(aTmpCuts.begin() + c); - bIncC = sal_False; + bIncC = false; } // next candidate @@ -1036,8 +1036,8 @@ namespace basegfx aTmpCuts.erase(aTmpCuts.begin()); B2DPolygonNode* pActA = pCutA->getLeft(); B2DPolygonNode* pActB = pCutA->getRight(); - sal_Bool bPrevSamePos(isPrevSamePos(pActA, pActB)); - sal_Bool bNextSamePos(isNextSamePos(pActA, pActB)); + bool bPrevSamePos(isPrevSamePos(pActA, pActB)); + bool bNextSamePos(isNextSamePos(pActA, pActB)); if(aTmpCuts.size()) { diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index 60f61b347135..856725546868 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dpolypolygontools.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:06 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,37 +91,37 @@ namespace basegfx { // B2DPolyPolygon tools - void correctOrientations(::basegfx::B2DPolyPolygon& rCandidate) + void correctOrientations(B2DPolyPolygon& rCandidate) { const sal_uInt32 nPolygonCount(rCandidate.count()); sal_uInt32 nIndexOfOutmostPolygon(0L); - sal_Bool bIndexOfOutmostPolygonSet(sal_False); + bool bIndexOfOutmostPolygonSet(false); for(sal_uInt32 a(0L); a < nPolygonCount; a++) { - ::basegfx::B2DPolygon aCandidate = rCandidate.getB2DPolygon(a); + B2DPolygon aCandidate = rCandidate.getB2DPolygon(a); if(aCandidate.count() > 2L) { - ::basegfx::B2DVectorOrientation aOrientation = - ::basegfx::tools::getOrientation(aCandidate); - sal_Bool bDoFlip(::basegfx::ORIENTATION_POSITIVE != aOrientation); + B2VectorOrientation aOrientation = + tools::getOrientation(aCandidate); + bool bDoFlip(ORIENTATION_POSITIVE != aOrientation); // init values for depth and compare point for // inside test. Since the ordering makes only sense when assuming // that there are no intersections, the inside test is done with // any point of the candidate, so teke the first one. sal_uInt32 nDepth(0L); - const ::basegfx::B2DPoint aTestPoint(aCandidate.getB2DPoint(0L)); + const B2DPoint aTestPoint(aCandidate.getB2DPoint(0L)); // loop over other polygons and calculate depth for(sal_uInt32 b(0L); b < nPolygonCount; b++) { if(b != a) { - ::basegfx::B2DPolygon aComparePolygon = rCandidate.getB2DPolygon(b); + B2DPolygon aComparePolygon = rCandidate.getB2DPolygon(b); - if(::basegfx::tools::isInside(aComparePolygon, aTestPoint)) + if(tools::isInside(aComparePolygon, aTestPoint)) { nDepth++; } @@ -129,7 +129,7 @@ namespace basegfx } // if nDepth is odd it is a hole - sal_Bool bIsHole(1L == (nDepth & 0x00000001)); + bool bIsHole(1L == (nDepth & 0x00000001)); // does polygon need to be flipped? if((bDoFlip && !bIsHole) || (!bDoFlip && bIsHole)) @@ -143,7 +143,7 @@ namespace basegfx // remember the index if it's the outmost polygon if(!bIndexOfOutmostPolygonSet && 0L == nDepth) { - bIndexOfOutmostPolygonSet = sal_True; + bIndexOfOutmostPolygonSet = true; nIndexOfOutmostPolygon = a; } } @@ -152,16 +152,16 @@ namespace basegfx // if the outmost polygon is not the first, move it in front if(bIndexOfOutmostPolygonSet && nIndexOfOutmostPolygon > 0L) { - ::basegfx::B2DPolygon aOutmostPolygon = rCandidate.getB2DPolygon(nIndexOfOutmostPolygon); + B2DPolygon aOutmostPolygon = rCandidate.getB2DPolygon(nIndexOfOutmostPolygon); rCandidate.remove(nIndexOfOutmostPolygon); rCandidate.insert(0L, aOutmostPolygon); } } - void removeIntersections(::basegfx::B2DPolyPolygon& rCandidate, - sal_Bool bForceOrientation, sal_Bool bInvertRemove) + void removeIntersections(B2DPolyPolygon& rCandidate, + bool bForceOrientation, bool bInvertRemove) { - ::basegfx::B2DPolyPolygonCutter aCutter; + B2DPolyPolygonCutter aCutter; aCutter.addPolyPolygon(rCandidate, bForceOrientation); aCutter.removeSelfIntersections(); @@ -171,9 +171,9 @@ namespace basegfx aCutter.getPolyPolygon(rCandidate); } - ::basegfx::B2DPolyPolygon adaptiveSubdivideByDistance(const ::basegfx::B2DPolyPolygon& rCandidate, double fDistanceBound) + B2DPolyPolygon adaptiveSubdivideByDistance(const B2DPolyPolygon& rCandidate, double fDistanceBound) { - ::basegfx::B2DPolyPolygon aRetval(rCandidate); + B2DPolyPolygon aRetval(rCandidate); if(aRetval.areControlPointsUsed()) { @@ -181,11 +181,11 @@ namespace basegfx for(sal_uInt32 a(0L); aRetval.areControlPointsUsed() && a < nPolygonCount; a++) { - ::basegfx::B2DPolygon aCandidate = aRetval.getB2DPolygon(a); + B2DPolygon aCandidate = aRetval.getB2DPolygon(a); if(aCandidate.areControlPointsUsed()) { - aCandidate = ::basegfx::tools::adaptiveSubdivideByDistance(aCandidate, fDistanceBound); + aCandidate = tools::adaptiveSubdivideByDistance(aCandidate, fDistanceBound); aRetval.setB2DPolygon(a, aCandidate); } } @@ -194,9 +194,9 @@ namespace basegfx return aRetval; } - ::basegfx::B2DPolyPolygon adaptiveSubdivideByAngle(const ::basegfx::B2DPolyPolygon& rCandidate, double fAngleBound) + B2DPolyPolygon adaptiveSubdivideByAngle(const B2DPolyPolygon& rCandidate, double fAngleBound) { - ::basegfx::B2DPolyPolygon aRetval(rCandidate); + B2DPolyPolygon aRetval(rCandidate); if(aRetval.areControlPointsUsed()) { @@ -204,11 +204,11 @@ namespace basegfx for(sal_uInt32 a(0L); aRetval.areControlPointsUsed() && a < nPolygonCount; a++) { - ::basegfx::B2DPolygon aCandidate = aRetval.getB2DPolygon(a); + B2DPolygon aCandidate = aRetval.getB2DPolygon(a); if(aCandidate.areControlPointsUsed()) { - aCandidate = ::basegfx::tools::adaptiveSubdivideByAngle(aCandidate, fAngleBound); + aCandidate = tools::adaptiveSubdivideByAngle(aCandidate, fAngleBound); aRetval.setB2DPolygon(a, aCandidate); } } @@ -217,28 +217,28 @@ namespace basegfx return aRetval; } - ::basegfx::B2DRange getRange(const ::basegfx::B2DPolyPolygon& rCandidate) + B2DRange getRange(const B2DPolyPolygon& rCandidate) { - ::basegfx::B2DRange aRetval; + B2DRange aRetval; const sal_uInt32 nPolygonCount(rCandidate.count()); for(sal_uInt32 a(0L); a < nPolygonCount; a++) { - ::basegfx::B2DPolygon aCandidate = rCandidate.getB2DPolygon(a); - aRetval.expand(::basegfx::tools::getRange(aCandidate)); + B2DPolygon aCandidate = rCandidate.getB2DPolygon(a); + aRetval.expand(tools::getRange(aCandidate)); } return aRetval; } - ::basegfx::B2DPolyPolygon applyLineDashing(const ::basegfx::B2DPolyPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen) + B2DPolyPolygon applyLineDashing(const B2DPolyPolygon& rCandidate, const ::std::vector<double>& raDashDotArray, double fFullDashDotLen) { - ::basegfx::B2DPolyPolygon aRetval; + B2DPolyPolygon aRetval; const sal_uInt32 nPolygonCount(rCandidate.count()); for(sal_uInt32 a(0L); a < nPolygonCount; a++) { - ::basegfx::B2DPolygon aCandidate = rCandidate.getB2DPolygon(a); + B2DPolygon aCandidate = rCandidate.getB2DPolygon(a); aRetval.append(applyLineDashing(aCandidate, raDashDotArray, fFullDashDotLen)); } diff --git a/basegfx/source/polygon/b3dpolygon.cxx b/basegfx/source/polygon/b3dpolygon.cxx index 0d488c04bf2c..f31c91cdcb49 100644 --- a/basegfx/source/polygon/b3dpolygon.cxx +++ b/basegfx/source/polygon/b3dpolygon.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dpolygon.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:06 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:33 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,7 +91,7 @@ public: const ::basegfx::B3DPoint& getCoordinate() const { return maPoint; } void setCoordinate(const ::basegfx::B3DPoint& rValue) { if(rValue != maPoint) maPoint = rValue; } - sal_Bool operator==(const CoordinateData3D& rData ) const { return (maPoint == rData.getCoordinate()); } + bool operator==(const CoordinateData3D& rData ) const { return (maPoint == rData.getCoordinate()); } void transform(const ::basegfx::B3DHomMatrix& rMatrix) { maPoint *= rMatrix; } }; @@ -128,7 +128,7 @@ public: return maVector.size(); } - sal_Bool isEqual(const CoordinateDataArray3D& rCandidate) const + bool isEqual(const CoordinateDataArray3D& rCandidate) const { return (maVector == rCandidate.maVector); } @@ -262,7 +262,7 @@ public: ImplB3DPolygon() : mnRefCount(1), maPoints(0L), - mbIsClosed(sal_False) + mbIsClosed(false) { // complete initialization with defaults } @@ -307,12 +307,12 @@ public: return maPoints.count(); } - sal_Bool isClosed() const + bool isClosed() const { return mbIsClosed; } - void setClosed(sal_Bool bNew) + void setClosed(bool bNew) { if(bNew != mbIsClosed) { @@ -320,17 +320,17 @@ public: } } - sal_Bool isEqual(const ImplB3DPolygon& rCandidate) const + bool isEqual(const ImplB3DPolygon& rCandidate) const { if(mbIsClosed == rCandidate.mbIsClosed) { if(maPoints.isEqual(rCandidate.maPoints)) { - return sal_True; + return true; } } - return sal_False; + return false; } const ::basegfx::B3DPoint& getPoint(sal_uInt32 nIndex) const @@ -378,7 +378,7 @@ public: } } - sal_Bool hasDoublePoints() const + bool hasDoublePoints() const { if(mbIsClosed) { @@ -387,7 +387,7 @@ public: if(maPoints.getCoordinate(0L) == maPoints.getCoordinate(nIndex)) { - return sal_True; + return true; } } @@ -396,11 +396,11 @@ public: { if(maPoints.getCoordinate(a) == maPoints.getCoordinate(a + 1L)) { - return sal_True; + return true; } } - return sal_False; + return false; } void removeDoublePointsAtBeginEnd() @@ -486,21 +486,21 @@ namespace basegfx return *this; } - sal_Bool B3DPolygon::operator==(const B3DPolygon& rPolygon) const + bool B3DPolygon::operator==(const B3DPolygon& rPolygon) const { if(mpPolygon == rPolygon.mpPolygon) { - return sal_True; + return true; } return mpPolygon->isEqual(*(rPolygon.mpPolygon)); } - sal_Bool B3DPolygon::operator!=(const B3DPolygon& rPolygon) const + bool B3DPolygon::operator!=(const B3DPolygon& rPolygon) const { if(mpPolygon == rPolygon.mpPolygon) { - return sal_False; + return false; } return !mpPolygon->isEqual(*(rPolygon.mpPolygon)); @@ -625,12 +625,12 @@ namespace basegfx mpPolygon->incRefCount(); } - sal_Bool B3DPolygon::isClosed() const + bool B3DPolygon::isClosed() const { return mpPolygon->isClosed(); } - void B3DPolygon::setClosed(sal_Bool bNew) + void B3DPolygon::setClosed(bool bNew) { if(mpPolygon->isClosed() != bNew) { @@ -648,7 +648,7 @@ namespace basegfx } } - sal_Bool B3DPolygon::hasDoublePoints() const + bool B3DPolygon::hasDoublePoints() const { return mpPolygon->hasDoublePoints(); } diff --git a/basegfx/source/polygon/b3dpolygontools.cxx b/basegfx/source/polygon/b3dpolygontools.cxx index 9784ae5930a9..e4f2011795ae 100644 --- a/basegfx/source/polygon/b3dpolygontools.cxx +++ b/basegfx/source/polygon/b3dpolygontools.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dpolygontools.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:07 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -91,7 +91,7 @@ namespace basegfx while(rCandidate.count() > 1L && rCandidate.getB3DPoint(0L).equal(rCandidate.getB3DPoint(rCandidate.count() - 1L))) { - rCandidate.setClosed(sal_True); + rCandidate.setClosed(true); rCandidate.remove(rCandidate.count() - 1L); } } @@ -244,7 +244,7 @@ namespace basegfx if(nPointCount > 1L) { sal_uInt32 nIndex(0L); - sal_Bool bIndexDone(sal_False); + bool bIndexDone(false); const double fZero(0.0); double fEdgeLength(fZero); @@ -267,7 +267,7 @@ namespace basegfx { // crop to polygon start fDistance = fZero; - bIndexDone = sal_True; + bIndexDone = true; } } @@ -285,7 +285,7 @@ namespace basegfx // crop to polygon end fDistance = fZero; nIndex = nPointCount - 1L; - bIndexDone = sal_True; + bIndexDone = true; } } @@ -306,7 +306,7 @@ namespace basegfx else { // it's on this edge, stop - bIndexDone = sal_True; + bIndexDone = true; } } while (!bIndexDone); } @@ -328,7 +328,7 @@ namespace basegfx } // add calculated average value to the return value - aRetval += ::basegfx::average(aRetval, aNextPoint, fRelative); + aRetval += ::basegfx::interpolate(aRetval, aNextPoint, fRelative); } } @@ -382,11 +382,11 @@ namespace basegfx } else { - aResult.append(aStart + (aVector * fPosOnVector)); + aResult.append( B3DPoint(aStart + (aVector * fPosOnVector)) ); } // add end point - aResult.append(aStart + (aVector * (fPosOnVector + fDashDotLength))); + aResult.append( B3DPoint(aStart + (aVector * (fPosOnVector + fDashDotLength))) ); // add line to PolyPolygon aRetval.append(aResult); diff --git a/basegfx/source/polygon/b3dpolypolygon.cxx b/basegfx/source/polygon/b3dpolypolygon.cxx index bb78552b24e5..72e77b05f578 100644 --- a/basegfx/source/polygon/b3dpolypolygon.cxx +++ b/basegfx/source/polygon/b3dpolypolygon.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b3dpolypolygon.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:07 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:34 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -106,21 +106,21 @@ public: void incRefCount() { mnRefCount++; } void decRefCount() { mnRefCount--; } - sal_Bool isEqual(const ImplB3DPolyPolygon& rPolygonList) const + bool isEqual(const ImplB3DPolyPolygon& rPolygonList) const { // same polygon count? if(maPolygons.size() != rPolygonList.maPolygons.size()) - return sal_False; + return false; // if zero polygons the polys are equal if(!maPolygons.size()) - return sal_True; + return true; // compare polygon content if(maPolygons != rPolygonList.maPolygons) - return sal_False; + return false; - return sal_True; + return true; } const ::basegfx::B3DPolygon& getB3DPolygon(sal_uInt32 nIndex) const @@ -181,7 +181,7 @@ public: return maPolygons.size(); } - void setClosed(sal_Bool bNew) + void setClosed(bool bNew) { for(sal_uInt32 a(0L); a < maPolygons.size(); a++) { @@ -271,21 +271,21 @@ namespace basegfx return *this; } - sal_Bool B3DPolyPolygon::operator==(const B3DPolyPolygon& rPolyPolygon) const + bool B3DPolyPolygon::operator==(const B3DPolyPolygon& rPolyPolygon) const { if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon) { - return sal_True; + return true; } return mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon)); } - sal_Bool B3DPolyPolygon::operator!=(const B3DPolyPolygon& rPolyPolygon) const + bool B3DPolyPolygon::operator!=(const B3DPolyPolygon& rPolyPolygon) const { if(mpPolyPolygon == rPolyPolygon.mpPolyPolygon) { - return sal_False; + return false; } return !mpPolyPolygon->isEqual(*(rPolyPolygon.mpPolyPolygon)); @@ -380,9 +380,9 @@ namespace basegfx mpPolyPolygon->incRefCount(); } - sal_Bool B3DPolyPolygon::isClosed() const + bool B3DPolyPolygon::isClosed() const { - sal_Bool bRetval(sal_True); + bool bRetval(true); // PolyPOlygon is closed when all contained Polygons are closed or // no Polygon exists. @@ -390,14 +390,14 @@ namespace basegfx { if(!(mpPolyPolygon->getB3DPolygon(a)).isClosed()) { - bRetval = sal_False; + bRetval = false; } } return bRetval; } - void B3DPolyPolygon::setClosed(sal_Bool bNew) + void B3DPolyPolygon::setClosed(bool bNew) { if(bNew != isClosed()) { @@ -412,15 +412,15 @@ namespace basegfx mpPolyPolygon->flip(); } - sal_Bool B3DPolyPolygon::hasDoublePoints() const + bool B3DPolyPolygon::hasDoublePoints() const { - sal_Bool bRetval(sal_False); + bool bRetval(false); for(sal_uInt32 a(0L); !bRetval && a < mpPolyPolygon->count(); a++) { if((mpPolyPolygon->getB3DPolygon(a)).hasDoublePoints()) { - bRetval = sal_True; + bRetval = true; } } diff --git a/basegfx/source/tuple/b2dtuple.cxx b/basegfx/source/tuple/b2dtuple.cxx index 1565fe3ea0d2..caf527d2d522 100644 --- a/basegfx/source/tuple/b2dtuple.cxx +++ b/basegfx/source/tuple/b2dtuple.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dtuple.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:13 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,26 +72,26 @@ namespace basegfx // initialize static member ::basegfx::B2DTuple B2DTuple::maEmptyTuple(0.0, 0.0); - sal_Bool B2DTuple::equalZero() const + bool B2DTuple::equalZero() const { return (this == &maEmptyTuple || (::basegfx::fTools::equalZero(mfX) && ::basegfx::fTools::equalZero(mfY))); } - sal_Bool B2DTuple::equalZero(const double& rfSmallValue) const + bool B2DTuple::equalZero(const double& rfSmallValue) const { return (this == &maEmptyTuple || (::basegfx::fTools::equalZero(mfX, rfSmallValue) && ::basegfx::fTools::equalZero(mfY, rfSmallValue))); } - sal_Bool B2DTuple::equal(const B2DTuple& rTup) const + bool B2DTuple::equal(const B2DTuple& rTup) const { return ( ::basegfx::fTools::equal(mfX, rTup.mfX) && ::basegfx::fTools::equal(mfY, rTup.mfY)); } - sal_Bool B2DTuple::equal(const B2DTuple& rTup, const double& rfSmallValue) const + bool B2DTuple::equal(const B2DTuple& rTup, const double& rfSmallValue) const { return ( ::basegfx::fTools::equal(mfX, rTup.mfX, rfSmallValue) && diff --git a/basegfx/source/tuple/makefile.mk b/basegfx/source/tuple/makefile.mk index 94566b96d598..21e7a2465aad 100644 --- a/basegfx/source/tuple/makefile.mk +++ b/basegfx/source/tuple/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: aw $ $Date: 2003-10-28 11:24:16 $ +# last change: $Author: thb $ $Date: 2004-01-16 10:34:36 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -76,8 +76,12 @@ TARGET=tuple SLOFILES= \ $(SLO)$/b2dtuple.obj \ - $(SLO)$/b3dtuple.obj - + $(SLO)$/b3dtuple.obj \ + $(SLO)$/b2ituple.obj \ + $(SLO)$/b3ituple.obj \ + $(SLO)$/b2i64tuple.obj \ + $(SLO)$/b3i64tuple.obj + # --- Targets ---------------------------------- .INCLUDE : target.mk diff --git a/basegfx/source/vector/b2dvector.cxx b/basegfx/source/vector/b2dvector.cxx index d9c46044211c..ea131f8a4a60 100644 --- a/basegfx/source/vector/b2dvector.cxx +++ b/basegfx/source/vector/b2dvector.cxx @@ -2,9 +2,9 @@ * * $RCSfile: b2dvector.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: aw $ $Date: 2003-11-28 11:18:15 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:37 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -162,7 +162,7 @@ namespace basegfx return *this; } - sal_Bool B2DVector::isNormalized() const + bool B2DVector::isNormalized() const { const double fOne(1.0); const double fScalar(scalar(*this)); @@ -170,13 +170,13 @@ namespace basegfx return (::basegfx::fTools::equal(fOne, fScalar)); } - sal_Bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB ) + bool areParallel( const B2DVector& rVecA, const B2DVector& rVecB ) { double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX()); return ::basegfx::fTools::equalZero(fVal); } - B2DVectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB ) + B2VectorOrientation getOrientation( const B2DVector& rVecA, const B2DVector& rVecB ) { double fVal(rVecA.getX() * rVecB.getY() - rVecA.getY() * rVecB.getX()); @@ -205,9 +205,9 @@ namespace basegfx return aRes*=rMat; } - ::basegfx::B2DVectorContinuity getContinuity(const B2DVector& rBackVector, const B2DVector& rForwardVector ) + B2VectorContinuity getContinuity(const B2DVector& rBackVector, const B2DVector& rForwardVector ) { - ::basegfx::B2DVectorContinuity eRetval(::basegfx::CONTINUITY_NONE); + B2VectorContinuity eRetval(::basegfx::CONTINUITY_NONE); if(!rBackVector.equalZero() && !rForwardVector.equalZero()) { diff --git a/basegfx/source/vector/makefile.mk b/basegfx/source/vector/makefile.mk index fead5951b707..5075ee9aabb2 100644 --- a/basegfx/source/vector/makefile.mk +++ b/basegfx/source/vector/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.1 $ +# $Revision: 1.2 $ # -# last change: $Author: aw $ $Date: 2003-10-28 11:26:57 $ +# last change: $Author: thb $ $Date: 2004-01-16 10:34:39 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -76,8 +76,10 @@ TARGET=vector SLOFILES= \ $(SLO)$/b2dvector.obj \ - $(SLO)$/b3dvector.obj - + $(SLO)$/b3dvector.obj \ + $(SLO)$/b2ivector.obj \ + $(SLO)$/b3ivector.obj + # --- Targets ---------------------------------- .INCLUDE : target.mk diff --git a/basegfx/source/workbench/bezierclip.cxx b/basegfx/source/workbench/bezierclip.cxx index 7fb95c4977b1..12a26aa52a7f 100644 --- a/basegfx/source/workbench/bezierclip.cxx +++ b/basegfx/source/workbench/bezierclip.cxx @@ -2,9 +2,9 @@ * * $RCSfile: bezierclip.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-05 12:25:57 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:40 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -183,7 +183,7 @@ void Impl_calcBounds( Point2D& leftTop, rightBottom.y = ::std::max( c1.p0.y, ::std::max( c1.p1.y, ::std::max( c1.p2.y, c1.p3.y ) ) ); } -sal_Bool Impl_doBBoxIntersect( const Bezier& c1, +bool Impl_doBBoxIntersect( const Bezier& c1, const Bezier& c2 ) { // calc rectangular boxes from c1 and c2 @@ -198,11 +198,11 @@ sal_Bool Impl_doBBoxIntersect( const Bezier& c1, if( ::std::min(rb1.x, rb2.x) < ::std::max(lt1.x, lt2.x) || ::std::min(rb1.y, rb2.y) < ::std::max(lt1.y, lt2.y) ) { - return sal_False; + return false; } else { - return sal_True; + return true; } } @@ -211,7 +211,7 @@ sal_Bool Impl_doBBoxIntersect( const Bezier& c1, * the left, the second is the intersection of the max value line with * the convex hull from the right. */ -sal_Bool Impl_calcSafeParams( double& t1, +bool Impl_calcSafeParams( double& t1, double& t2, const Polygon2D& rPoly, double lowerYBound, @@ -229,13 +229,13 @@ sal_Bool Impl_calcSafeParams( double& t1, double currHigherT( 0.0 ); if( convHull.size() <= 1 ) - return sal_False; // only one point? Then we're done with clipping + return false; // only one point? Then we're done with clipping /* now, clip against lower and higher bounds */ Point2D p0; Point2D p1; - sal_Bool bIntersection( sal_False ); + bool bIntersection( false ); for( Polygon2D::size_type i=0; i<convHull.size(); ++i ) { @@ -298,7 +298,7 @@ sal_Bool Impl_calcSafeParams( double& t1, // set flag that at least one segment is contained or // intersects given horizontal band. - bIntersection = sal_True; + bIntersection = true; } } @@ -320,7 +320,7 @@ sal_Bool Impl_calcSafeParams( double& t1, * The polynomial coefficients c0 to c3 given to this method * must correspond to t values of 0, 1/3, 2/3 and 1, respectively. */ -sal_Bool Impl_calcSafeParams_clip( double& t1, +bool Impl_calcSafeParams_clip( double& t1, double& t2, const FatLine& bounds, double c0, @@ -340,7 +340,7 @@ sal_Bool Impl_calcSafeParams_clip( double& t1, return Impl_calcSafeParams( t1, t2, poly, bounds.dMin, bounds.dMax ); #else - sal_Bool bRet( Impl_calcSafeParams( t1, t2, poly, bounds.dMin, bounds.dMax ) ); + bool bRet( Impl_calcSafeParams( t1, t2, poly, bounds.dMin, bounds.dMax ) ); Polygon2D convHull( convexHull( poly ) ); @@ -592,7 +592,7 @@ void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part, // ----------------------------------------------------------------------------- /** determine parameter ranges [0,t1) and (t2,1] on c1, where c1 is guaranteed to lie outside c2. - Returns sal_False, if the two curves don't even intersect. + Returns false, if the two curves don't even intersect. @param t1 Range [0,t1) on c1 is guaranteed to lie outside c2 @@ -612,7 +612,7 @@ void printResultWithFinalCurves( const Bezier& c1, const Bezier& c1_part, @param c2_part Subdivided current part of c2 */ -sal_Bool Impl_calcClipRange( double& t1, +bool Impl_calcClipRange( double& t1, double& t2, const Bezier& c1_orig, const Bezier& c1_part, @@ -661,12 +661,12 @@ sal_Bool Impl_calcClipRange( double& t1, //printCurvesWithSafeRange(c1_orig, c2_orig, t1, t2, c2_part, bounds_c2); // they do intersect - return sal_True; + return true; } } // they don't intersect: nothing to do - return sal_False; + return false; } // ----------------------------------------------------------------------------- @@ -804,7 +804,7 @@ void Impl_calcFocus( Bezier& res, const Bezier& c ) // ----------------------------------------------------------------------------- -sal_Bool Impl_calcSafeParams_focus( double& t1, +bool Impl_calcSafeParams_focus( double& t1, double& t2, const Bezier& curve, const Bezier& focus ) @@ -913,7 +913,7 @@ sal_Bool Impl_calcSafeParams_focus( double& t1, return Impl_calcSafeParams( t1, t2, controlPolygon, 0.0, 0.0 ); #else - sal_Bool bRet( Impl_calcSafeParams( t1, t2, controlPolygon, 0.0, 0.0 ) ); + bool bRet( Impl_calcSafeParams( t1, t2, controlPolygon, 0.0, 0.0 ) ); Polygon2D convHull( convexHull( controlPolygon ) ); @@ -957,12 +957,12 @@ sal_Bool Impl_calcSafeParams_focus( double& t1, don't intersect, nothing is added. @param delta - Maximal allowed distance to sal_True critical point (measured in the + Maximal allowed distance to true critical point (measured in the original curve's coordinate system) @param safeRangeFunctor Functor object, that must provide the following operator(): - sal_Bool safeRangeFunctor( double& t1, + bool safeRangeFunctor( double& t1, double& t2, const Bezier& c1_orig, const Bezier& c1_part, @@ -970,7 +970,7 @@ sal_Bool Impl_calcSafeParams_focus( double& t1, const Bezier& c2_part ); This functor must calculate the safe ranges [0,t1] and [t2,1] on c1_orig, where c1_orig is 'safe' from c2_part. If the whole - c1_orig is safe, sal_False must be returned, sal_True otherwise. + c1_orig is safe, false must be returned, true otherwise. */ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > >& result, double delta, @@ -1026,7 +1026,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera // Note: we first perform the clipping and only test for precision // sufficiency afterwards, since we want to exploit the fact that - // Impl_calcClipRange returns sal_False if the curves don't + // Impl_calcClipRange returns false if the curves don't // intersect. We would have to check that separately for the end // condition, otherwise. @@ -1097,7 +1097,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera // 20%, subdivide longest curve, and clip shortest against // both parts of longest // if( (last_t2_c1 - last_t1_c1 - t2_c1 + t1_c1) / (last_t2_c1 - last_t1_c1) < 0.2 ) - if( sal_False ) + if( false ) { // subdivide and descend // ===================== @@ -1189,7 +1189,7 @@ template <class Functor> void Impl_applySafeRanges_rec( ::std::back_insert_itera struct ClipBezierFunctor { - sal_Bool operator()( double& t1_c1, + bool operator()( double& t1_c1, double& t2_c1, const Bezier& c1_orig, const Bezier& c1_part, @@ -1204,7 +1204,7 @@ struct ClipBezierFunctor struct BezierTangencyFunctor { - sal_Bool operator()( double& t1_c1, + bool operator()( double& t1_c1, double& t2_c1, const Bezier& c1_orig, const Bezier& c1_part, @@ -1218,7 +1218,7 @@ struct BezierTangencyFunctor // used for focus calculation // determine safe range on c1_orig - sal_Bool bRet( Impl_calcSafeParams_focus( t1_c1, t2_c1, + bool bRet( Impl_calcSafeParams_focus( t1_c1, t2_c1, c1_orig, // use orig curve here, need t's on original curve focus ) ); @@ -1237,7 +1237,7 @@ struct BezierTangencyFunctor iterator will remain empty, if there are no intersections. @param delta - Maximal allowed distance to sal_True intersection (measured in the + Maximal allowed distance to true intersection (measured in the original curve's coordinate system) */ void clipBezier( ::std::back_insert_iterator< ::std::vector< ::std::pair<double, double> > >& result, @@ -1646,7 +1646,7 @@ int main(int argc, const char *argv[]) double t1, t2; - sal_Bool bRet( Impl_calcSafeParams( t1, t2, poly, 0, 1 ) ); + bool bRet( Impl_calcSafeParams( t1, t2, poly, 0, 1 ) ); Polygon2D convHull( convexHull( poly ) ); @@ -1872,7 +1872,7 @@ int main(int argc, const char *argv[]) focus = c2; #endif // determine safe range on c1 - sal_Bool bRet( Impl_calcSafeParams_focus( t1, t2, + bool bRet( Impl_calcSafeParams_focus( t1, t2, c1, focus ) ); cerr << "t1: " << t1 << ", t2: " << t2 << endl; diff --git a/basegfx/source/workbench/bezierclip.hxx b/basegfx/source/workbench/bezierclip.hxx index b151a9bdd43f..7cb705edc075 100644 --- a/basegfx/source/workbench/bezierclip.hxx +++ b/basegfx/source/workbench/bezierclip.hxx @@ -2,9 +2,9 @@ * * $RCSfile: bezierclip.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-05 12:25:57 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -119,9 +119,9 @@ Polygon2D convexHull( const Polygon2D& rPoly ); #define DBL_EPSILON 1.0e-100 /* little approximate comparions */ -template <typename NumType> sal_Bool tolZero( NumType n ) { return fabs(n) < DBL_EPSILON; } -template <typename NumType> sal_Bool tolEqual( NumType n1, NumType n2 ) { return tolZero(n1-n2); } -template <typename NumType> sal_Bool tolLessEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1<n2; } -template <typename NumType> sal_Bool tolGreaterEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1>n2; } +template <typename NumType> bool tolZero( NumType n ) { return fabs(n) < DBL_EPSILON; } +template <typename NumType> bool tolEqual( NumType n1, NumType n2 ) { return tolZero(n1-n2); } +template <typename NumType> bool tolLessEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1<n2; } +template <typename NumType> bool tolGreaterEqual( NumType n1, NumType n2 ) { return tolEqual(n1,n2) || n1>n2; } #endif // BASEGFX_BEZIERCLIP_HXX diff --git a/basegfx/source/workbench/convexhull.cxx b/basegfx/source/workbench/convexhull.cxx index 3765d70663bc..772059a4a66d 100644 --- a/basegfx/source/workbench/convexhull.cxx +++ b/basegfx/source/workbench/convexhull.cxx @@ -2,9 +2,9 @@ * * $RCSfile: convexhull.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-05 12:25:57 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -88,14 +88,14 @@ template <class PointType> double theta( const PointType& p1, const PointType& p /* Model of LessThanComparable for theta sort. * Uses the theta function from Sedgewick: Algorithms in XXX, chapter 24 */ -template <class PointType> class ThetaCompare : public ::std::binary_function< const PointType&, const PointType&, sal_Bool > +template <class PointType> class ThetaCompare : public ::std::binary_function< const PointType&, const PointType&, bool > { public: ThetaCompare( const PointType& rRefPoint ) : maRefPoint( rRefPoint ) {} - sal_Bool operator() ( const PointType& p1, const PointType& p2 ) + bool operator() ( const PointType& p1, const PointType& p2 ) { - // return sal_True, if p1 precedes p2 in the angle relative to maRefPoint + // return true, if p1 precedes p2 in the angle relative to maRefPoint return theta(maRefPoint, p1) < theta(maRefPoint, p2); } diff --git a/basegfx/source/workbench/gauss.hxx b/basegfx/source/workbench/gauss.hxx index b5b65e2644c9..f002f174e70f 100644 --- a/basegfx/source/workbench/gauss.hxx +++ b/basegfx/source/workbench/gauss.hxx @@ -2,9 +2,9 @@ * * $RCSfile: gauss.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2003-11-05 12:25:58 $ + * last change: $Author: thb $ $Date: 2004-01-16 10:34:43 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,12 +76,12 @@ @param minPivot If the pivot element gets lesser than minPivot, this method fails, - otherwise, elimination succeeds and sal_True is returned. + otherwise, elimination succeeds and true is returned. - @return sal_True, if elimination succeeded. + @return true, if elimination succeeded. */ template <class Matrix, typename BaseType> -sal_Bool eliminate( Matrix& matrix, +bool eliminate( Matrix& matrix, int rows, int cols, const BaseType& minPivot ) @@ -100,7 +100,7 @@ sal_Bool eliminate( Matrix& matrix, /* check pivot value */ if( fabs(matrix[ max*cols + i ]) < minPivot ) - return sal_False; /* pivot too small! */ + return false; /* pivot too small! */ /* interchange rows 'max' and 'i' */ for(k=0; k<cols; ++k) @@ -118,7 +118,7 @@ sal_Bool eliminate( Matrix& matrix, } /* everything went well */ - return sal_True; + return true; } @@ -139,11 +139,11 @@ sal_Bool eliminate( Matrix& matrix, @param result Result vector. Given matrix must have space for one column (rows entries). - @return sal_True, if back substitution was possible (i.e. no division + @return true, if back substitution was possible (i.e. no division by zero occured). */ template <class Matrix, class Vector, typename BaseType> -sal_Bool substitute( const Matrix& matrix, +bool substitute( const Matrix& matrix, int rows, int cols, Vector& result ) @@ -159,13 +159,13 @@ sal_Bool substitute( const Matrix& matrix, temp += matrix[ j*cols + k ] * result[k]; if( matrix[ j*cols + j ] == 0.0 ) - return sal_False; /* imminent division by zero! */ + return false; /* imminent division by zero! */ result[j] = (matrix[ j*cols + cols-1 ] - temp) / matrix[ j*cols + j ]; } /* everything went well */ - return sal_True; + return true; } @@ -188,12 +188,12 @@ sal_Bool substitute( const Matrix& matrix, @param minPivot If the pivot element gets lesser than minPivot, this method fails, - otherwise, elimination succeeds and sal_True is returned. + otherwise, elimination succeeds and true is returned. - @return sal_True, if elimination succeeded. + @return true, if elimination succeeded. */ template <class Matrix, class Vector, typename BaseType> -sal_Bool solve( Matrix& matrix, +bool solve( Matrix& matrix, int rows, int cols, Vector& result, @@ -202,5 +202,5 @@ sal_Bool solve( Matrix& matrix, if( eliminate<Matrix,BaseType>(matrix, rows, cols, minPivot) ) return substitute<Matrix,Vector,BaseType>(matrix, rows, cols, result); - return sal_False; + return false; } |