diff options
author | Armin Weiss <aw@openoffice.org> | 2007-11-07 13:31:19 +0000 |
---|---|---|
committer | Armin Weiss <aw@openoffice.org> | 2007-11-07 13:31:19 +0000 |
commit | e30ad6028be5eea3bad01bc1b813eb83746bfdd9 (patch) | |
tree | 304a33fac525514d04a9dab33d8ab8a868c144d8 /drawinglayer | |
parent | 1c80385e37a1a662dabf780c5da8731940ed562c (diff) |
#i39532# committing to have a base for HDU
Diffstat (limited to 'drawinglayer')
25 files changed, 842 insertions, 262 deletions
diff --git a/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx new file mode 100644 index 000000000000..72e3c93daa20 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/lineattribute.hxx @@ -0,0 +1,113 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: lineattribute.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-11-07 14:27:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX + +#ifndef _BGFX_POLYGON_B2DLINEGEOMETRY_HXX +#include <basegfx/polygon/b2dlinegeometry.hxx> +#endif + +#ifndef _BGFX_COLOR_BCOLOR_HXX +#include <basegfx/color/bcolor.hxx> +#endif + +#include <vector> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class LineAttribute + { + private: + basegfx::BColor maColor; // color + double mfWidth; // absolute line width + basegfx::B2DLineJoin meLineJoin; // type of LineJoin + + public: + LineAttribute( + const basegfx::BColor& rColor, + double fWidth = 0.0, + basegfx::B2DLineJoin aB2DLineJoin = basegfx::B2DLINEJOIN_ROUND) + : maColor(rColor), + mfWidth(fWidth), + meLineJoin(aB2DLineJoin) + { + } + + LineAttribute(const LineAttribute& rCandidate) + { + *this = rCandidate; + } + + LineAttribute& operator=(const LineAttribute& rCandidate) + { + maColor = rCandidate.maColor; + mfWidth = rCandidate.mfWidth; + meLineJoin = rCandidate.meLineJoin; + return *this; + } + + ~LineAttribute() + { + } + + // compare operator + bool operator==(const LineAttribute& rCandidate) const + { + return (maColor == rCandidate.maColor + && mfWidth == rCandidate.mfWidth + && meLineJoin == rCandidate.meLineJoin); + } + + // data access + const basegfx::BColor& getColor() const { return maColor; } + double getWidth() const { return mfWidth; } + basegfx::B2DLineJoin getLineJoin() const { return meLineJoin; } + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx new file mode 100644 index 000000000000..7f5d87f8745b --- /dev/null +++ b/drawinglayer/inc/drawinglayer/attribute/linestartendattribute.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: linestartendattribute.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-11-07 14:27:16 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX +#define INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX + +#ifndef _BGFX_POLYGON_B2DPOLYPOLYGON_HXX +#include <basegfx/polygon/b2dpolypolygon.hxx> +#endif + +#ifndef _BGFX_NUMERIC_FTOOLS_HXX +#include <basegfx/numeric/ftools.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// +// predefines + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + class LineStartEndAttribute + { + private: + double mfWidth; // absolute line StartEndGeometry base width + basegfx::B2DPolyPolygon maPolyPolygon; // the StartEndGeometry PolyPolygon + + // bitfield + unsigned mbCentered : 1; // use centered to ineStart/End point? + + public: + LineStartEndAttribute( + double fWidth, + const basegfx::B2DPolyPolygon& rPolyPolygon, + bool bCentered) + : mfWidth(fWidth), + maPolyPolygon(rPolyPolygon), + mbCentered(bCentered) + { + } + + // compare operator + bool operator==(const LineStartEndAttribute& rCandidate) const + { + return (basegfx::fTools::equal(mfWidth, rCandidate.mfWidth) + && maPolyPolygon == rCandidate.maPolyPolygon + && mbCentered == rCandidate.mbCentered); + } + + // data access + double getWidth() const { return mfWidth; } + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } + bool isCentered() const { return mbCentered; } + bool isActive() const; + }; + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX + +// eof diff --git a/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx index 3c3229d5e3a9..b18a9b1a1574 100644 --- a/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/sdrattribute.hxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrattribute.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-10-19 10:30:35 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:16 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -69,7 +69,7 @@ namespace drawinglayer class SdrLineAttribute { // line definitions - basegfx::tools::B2DLineJoin meJoin; // B2DLINEJOIN_* defines + basegfx::B2DLineJoin meJoin; // B2DLINEJOIN_* defines double mfWidth; // 1/100th mm, 0.0==hair double mfTransparence; // [0.0 .. 1.0], 0.0==no transp. basegfx::BColor maColor; // color of line @@ -78,7 +78,7 @@ namespace drawinglayer public: SdrLineAttribute( - basegfx::tools::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, + basegfx::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, const ::std::vector< double >& rDotDashArray, double fFullDotDashLen); ~SdrLineAttribute(); @@ -90,7 +90,7 @@ namespace drawinglayer bool isDashed() const { return (0L != maDotDashArray.size()); } // data access - basegfx::tools::B2DLineJoin getJoin() const { return meJoin; } + basegfx::B2DLineJoin getJoin() const { return meJoin; } double getWidth() const { return mfWidth; } double getTransparence() const { return mfTransparence; } const basegfx::BColor& getColor() const { return maColor; } diff --git a/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx b/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx index f0099cfe7d47..0211306f6fae 100644 --- a/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx +++ b/drawinglayer/inc/drawinglayer/attribute/strokeattribute.hxx @@ -4,9 +4,9 @@ * * $RCSfile: strokeattribute.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2006-11-28 11:03:55 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:16 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -57,35 +57,21 @@ namespace drawinglayer { class StrokeAttribute { - basegfx::BColor maColor; // color - double mfWidth; // absolute line width - basegfx::tools::B2DLineJoin meLineJoin; // type of LineJoin + private: ::std::vector< double > maDotDashArray; // array of double which defines the dot-dash pattern double mfFullDotDashLen; // sum of maDotDashArray (for convenience) public: StrokeAttribute( - const basegfx::BColor& rColor, - double fWidth, - basegfx::tools::B2DLineJoin aB2DLineJoin, const ::std::vector< double >& rDotDashArray, - double fFullDotDashLen) - : maColor(rColor), - mfWidth(fWidth), - meLineJoin(aB2DLineJoin), - maDotDashArray(rDotDashArray), + double fFullDotDashLen = 0.0) + : maDotDashArray(rDotDashArray), mfFullDotDashLen(fFullDotDashLen) { } - StrokeAttribute( - const basegfx::BColor& rColor, - double fWidth, - basegfx::tools::B2DLineJoin aB2DLineJoin = basegfx::tools::B2DLINEJOIN_ROUND) - : maColor(rColor), - mfWidth(fWidth), - meLineJoin(aB2DLineJoin), - maDotDashArray(), + StrokeAttribute() + : maDotDashArray(), mfFullDotDashLen(0.0) { } @@ -97,12 +83,8 @@ namespace drawinglayer StrokeAttribute& operator=(const StrokeAttribute& rCandidate) { - maColor = rCandidate.maColor; - mfWidth = rCandidate.mfWidth; - meLineJoin = rCandidate.meLineJoin; maDotDashArray = rCandidate.maDotDashArray; mfFullDotDashLen = rCandidate.mfFullDotDashLen; - return *this; } @@ -113,19 +95,13 @@ namespace drawinglayer // compare operator bool operator==(const StrokeAttribute& rCandidate) const { - return (maColor == rCandidate.maColor - && mfWidth == rCandidate.mfWidth - && meLineJoin == rCandidate.meLineJoin - && mfFullDotDashLen == rCandidate.mfFullDotDashLen + return (mfFullDotDashLen == rCandidate.mfFullDotDashLen && maDotDashArray == rCandidate.maDotDashArray); } // data access - const basegfx::BColor& getColor() const { return maColor; } - double getWidth() const { return mfWidth; } - basegfx::tools::B2DLineJoin getLineJoin() const { return meLineJoin; } const ::std::vector< double >& getDotDashArray() const { return maDotDashArray; } - double getFullDotDashLen() const { return mfFullDotDashLen; } + double getFullDotDashLen() const; }; } // end of namespace attribute } // end of namespace drawinglayer diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index 1bbbafa2cfa3..36bb7fa849a6 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: drawinglayer_primitivetypes2d.hxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: aw $ $Date: 2007-09-27 15:59:32 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:16 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -92,6 +92,7 @@ #define PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 43) #define PRIMITIVE2D_ID_TEXTEFFECTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 44) #define PRIMITIVE2D_ID_TEXTHIERARCHYBULLETPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 45) +#define PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 46) ////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx index 12b4306dc6a0..1dda509d111e 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polygonprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: polygonprimitive2d.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2007-09-26 11:36:28 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:16 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -40,12 +40,16 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #endif +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX +#include <drawinglayer/attribute/lineattribute.hxx> +#endif + #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX #include <drawinglayer/attribute/strokeattribute.hxx> #endif -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEARROWATTRIBUTE_HXX -#include <drawinglayer/attribute/strokearrowattribute.hxx> +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX +#include <drawinglayer/attribute/linestartendattribute.hxx> #endif ////////////////////////////////////////////////////////////////////////////// @@ -135,6 +139,7 @@ namespace drawinglayer { private: basegfx::B2DPolygon maPolygon; + attribute::LineAttribute maLineAttribute; attribute::StrokeAttribute maStrokeAttribute; protected: @@ -144,10 +149,16 @@ namespace drawinglayer public: PolygonStrokePrimitive2D( const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute); + PolygonStrokePrimitive2D( + const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute); + // get data basegfx::B2DPolygon getB2DPolygon() const { return maPolygon; } + const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } // compare operator @@ -169,11 +180,9 @@ namespace drawinglayer { namespace primitive2d { - class PolygonWavePrimitive2D : public BasePrimitive2D + class PolygonWavePrimitive2D : public PolygonStrokePrimitive2D { private: - basegfx::B2DPolygon maPolygon; - attribute::StrokeAttribute maStrokeAttribute; double mfWaveWidth; double mfWaveHeight; @@ -184,13 +193,18 @@ namespace drawinglayer public: PolygonWavePrimitive2D( const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute, double fWaveWidth, double fWaveHeight); + PolygonWavePrimitive2D( + const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, + double fWaveWidth, + double fWaveHeight); + // get data - basegfx::B2DPolygon getB2DPolygon() const { return maPolygon; } - const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } double getWaveWidth() const { return mfWaveWidth; } double getWaveHeight() const { return mfWaveHeight; } @@ -216,8 +230,8 @@ namespace drawinglayer class PolygonStrokeArrowPrimitive2D : public PolygonStrokePrimitive2D { private: - attribute::StrokeArrowAttribute maStart; - attribute::StrokeArrowAttribute maEnd; + attribute::LineStartEndAttribute maStart; + attribute::LineStartEndAttribute maEnd; protected: // local decomposition. @@ -226,13 +240,20 @@ namespace drawinglayer public: PolygonStrokeArrowPrimitive2D( const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute, - const attribute::StrokeArrowAttribute& rStart, - const attribute::StrokeArrowAttribute& rEnd); + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd); + + PolygonStrokeArrowPrimitive2D( + const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd); // get data - const attribute::StrokeArrowAttribute& getStart() const { return maStart; } - const attribute::StrokeArrowAttribute& getEnd() const { return maEnd; } + const attribute::LineStartEndAttribute& getStart() const { return maStart; } + const attribute::LineStartEndAttribute& getEnd() const { return maEnd; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 960385b4b485..198ae69c044e 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: polypolygonprimitive2d.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: aw $ $Date: 2007-02-22 12:10:56 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:16 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -52,12 +52,16 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #endif +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX +#include <drawinglayer/attribute/lineattribute.hxx> +#endif + #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX #include <drawinglayer/attribute/strokeattribute.hxx> #endif -#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEARROWATTRIBUTE_HXX -#include <drawinglayer/attribute/strokearrowattribute.hxx> +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX +#include <drawinglayer/attribute/linestartendattribute.hxx> #endif ////////////////////////////////////////////////////////////////////////////// @@ -67,11 +71,48 @@ namespace drawinglayer { namespace primitive2d { + class PolyPolygonHairlinePrimitive2D : public BasePrimitive2D + { + private: + basegfx::B2DPolyPolygon maPolyPolygon; + basegfx::BColor maBColor; + + protected: + // local decomposition. + virtual Primitive2DSequence createLocalDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor); + + // get data + basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::BColor& getBColor() const { return maBColor; } + + // compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + // get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + // provide unique ID + DeclPrimitrive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// PolyPolygonStrokePrimitive2D class + +namespace drawinglayer +{ + namespace primitive2d + { class PolyPolygonStrokePrimitive2D : public BasePrimitive2D { private: - basegfx::B2DPolyPolygon maPolyPolygon; - attribute::StrokeAttribute maStrokeAttribute; + basegfx::B2DPolyPolygon maPolyPolygon; + attribute::LineAttribute maLineAttribute; + attribute::StrokeAttribute maStrokeAttribute; protected: // local decomposition. @@ -80,10 +121,16 @@ namespace drawinglayer public: PolyPolygonStrokePrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute); + PolyPolygonStrokePrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const attribute::LineAttribute& rLineAttribute); + // get data basegfx::B2DPolyPolygon getB2DPolyPolygon() const { return maPolyPolygon; } + const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } // compare operator @@ -108,8 +155,8 @@ namespace drawinglayer class PolyPolygonStrokeArrowPrimitive2D : public PolyPolygonStrokePrimitive2D { private: - attribute::StrokeArrowAttribute maStart; - attribute::StrokeArrowAttribute maEnd; + attribute::LineStartEndAttribute maStart; + attribute::LineStartEndAttribute maEnd; protected: // local decomposition. @@ -118,13 +165,20 @@ namespace drawinglayer public: PolyPolygonStrokeArrowPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute, - const attribute::StrokeArrowAttribute& rStart, - const attribute::StrokeArrowAttribute& rEnd); + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd); + + PolyPolygonStrokeArrowPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const attribute::LineAttribute& rLineAttribute, + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd); // get data - const attribute::StrokeArrowAttribute& getStart() const { return maStart; } - const attribute::StrokeArrowAttribute& getEnd() const { return maEnd; } + const attribute::LineStartEndAttribute& getStart() const { return maStart; } + const attribute::LineStartEndAttribute& getEnd() const { return maEnd; } // compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx index 30d49b9ecc12..cc58f3692346 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polygonprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: polygonprimitive3d.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:06 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:17 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -48,6 +48,10 @@ #include <basegfx/polygon/b3dpolygon.hxx> #endif +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX +#include <drawinglayer/attribute/lineattribute.hxx> +#endif + #ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX #include <drawinglayer/attribute/strokeattribute.hxx> #endif @@ -95,6 +99,7 @@ namespace drawinglayer { private: basegfx::B3DPolygon maPolygon; + attribute::LineAttribute maLineAttribute; attribute::StrokeAttribute maStrokeAttribute; protected: @@ -104,10 +109,16 @@ namespace drawinglayer public: PolygonStrokePrimitive3D( const basegfx::B3DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute); + PolygonStrokePrimitive3D( + const basegfx::B3DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute); + // get data basegfx::B3DPolygon getB3DPolygon() const { return maPolygon; } + const attribute::LineAttribute& getLineAttribute() const { return maLineAttribute; } const attribute::StrokeAttribute& getStrokeAttribute() const { return maStrokeAttribute; } // compare operator diff --git a/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx b/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx index fcebbcf41657..53149fdf5c3f 100644 --- a/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive3d/polygontubeprimitive3d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: polygontubeprimitive3d.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2006-11-07 15:49:06 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:17 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -60,7 +60,7 @@ namespace drawinglayer double mfRadius; double mfDegreeStepWidth; double mfMiterMinimumAngle; - basegfx::tools::B2DLineJoin maLineJoin; + basegfx::B2DLineJoin maLineJoin; protected: // local decomposition. @@ -70,7 +70,7 @@ namespace drawinglayer PolygonTubePrimitive3D( const basegfx::B3DPolygon& rPolygon, const basegfx::BColor& rBColor, - double fRadius, basegfx::tools::B2DLineJoin aLineJoin, + double fRadius, basegfx::B2DLineJoin aLineJoin, double fDegreeStepWidth = 10.0 * F_PI180, double fMiterMinimumAngle = 15.0 * F_PI180); @@ -78,7 +78,7 @@ namespace drawinglayer double getRadius() const { return mfRadius; } double getDegreeStepWidth() const { return mfDegreeStepWidth; } double getMiterMinimumAngle() const { return mfMiterMinimumAngle; } - basegfx::tools::B2DLineJoin getLineJoin() const { return maLineJoin; } + basegfx::B2DLineJoin getLineJoin() const { return maLineJoin; } // compare operator virtual bool operator==(const BasePrimitive3D& rPrimitive) const; diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx index df0128b1928b..4c9df575c58e 100644 --- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx @@ -4,9 +4,9 @@ * * $RCSfile: vclmetafileprocessor2d.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2007-10-02 16:54:53 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:17 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -61,8 +61,9 @@ class SvtGraphicStroke; namespace drawinglayer { namespace attribute { class FillGradientAttribute; + class LineAttribute; class StrokeAttribute; - class StrokeArrowAttribute; + class LineStartEndAttribute; }} namespace basegfx { @@ -91,9 +92,10 @@ namespace drawinglayer SvtGraphicStroke* impTryToCreateSvtGraphicStroke( const basegfx::B2DPolygon& rB2DPolygon, const basegfx::BColor* pColor, + const attribute::LineAttribute* pLineAttribute, const attribute::StrokeAttribute* pStrokeAttribute, - const attribute::StrokeArrowAttribute* pStart, - const attribute::StrokeArrowAttribute* pEnd); + const attribute::LineStartEndAttribute* pStart, + const attribute::LineStartEndAttribute* pEnd); void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke); diff --git a/drawinglayer/prj/d.lst b/drawinglayer/prj/d.lst index 5ebf8f708b3b..4f79d2217bce 100644 --- a/drawinglayer/prj/d.lst +++ b/drawinglayer/prj/d.lst @@ -89,8 +89,9 @@ mkdir: %_DEST%\inc%_EXT%\drawinglayer\attribute ..\inc\drawinglayer\attribute\sdrattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrattribute.hxx ..\inc\drawinglayer\attribute\sdrattribute3d.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrattribute3d.hxx ..\inc\drawinglayer\attribute\sdrfillbitmapattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\sdrfillbitmapattribute.hxx -..\inc\drawinglayer\attribute\strokearrowattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\strokearrowattribute.hxx ..\inc\drawinglayer\attribute\strokeattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\strokeattribute.hxx +..\inc\drawinglayer\attribute\lineattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\lineattribute.hxx +..\inc\drawinglayer\attribute\linestartendattribute.hxx %_DEST%\inc%_EXT%\drawinglayer\attribute\linestartendattribute.hxx mkdir: %_DEST%\inc%_EXT%\drawinglayer\texture ..\inc\drawinglayer\texture\texture.hxx %_DEST%\inc%_EXT%\drawinglayer\texture\texture.hxx diff --git a/drawinglayer/source/attribute/lineattribute.cxx b/drawinglayer/source/attribute/lineattribute.cxx new file mode 100644 index 000000000000..c0e52d36ffb2 --- /dev/null +++ b/drawinglayer/source/attribute/lineattribute.cxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: lineattribute.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINEATTRIBUTE_HXX +#include <drawinglayer/attribute/lineattribute.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/linestartendattribute.cxx b/drawinglayer/source/attribute/linestartendattribute.cxx new file mode 100644 index 000000000000..da22da1ee6da --- /dev/null +++ b/drawinglayer/source/attribute/linestartendattribute.cxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: linestartendattribute.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_LINESTARTENDATTRIBUTE_HXX +#include <drawinglayer/attribute/linestartendattribute.hxx> +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX +#include <basegfx/polygon/b2dpolygon.hxx> +#endif + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + bool LineStartEndAttribute::isActive() const + { + return (0.0 != getWidth() + && 0.0 != getB2DPolyPolygon().count() + && 0.0 != getB2DPolyPolygon().getB2DPolygon(0L).count()); + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/attribute/makefile.mk b/drawinglayer/source/attribute/makefile.mk index 0cd599d2a84d..fa91224e64b6 100644 --- a/drawinglayer/source/attribute/makefile.mk +++ b/drawinglayer/source/attribute/makefile.mk @@ -4,9 +4,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: aw $ $Date: 2006-12-13 16:57:08 $ +# last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ # # The Contents of this file are made available subject to # the terms of GNU Lesser General Public License Version 2.1. @@ -51,7 +51,10 @@ SLOFILES= \ $(SLO)$/sdrallattribute3d.obj \ $(SLO)$/sdrattribute.obj \ $(SLO)$/sdrattribute3d.obj \ - $(SLO)$/sdrfillbitmapattribute.obj + $(SLO)$/sdrfillbitmapattribute.obj \ + $(SLO)$/lineattribute.obj \ + $(SLO)$/linestartendattribute.obj \ + $(SLO)$/strokeattribute.obj # --- Targets ---------------------------------- diff --git a/drawinglayer/source/attribute/sdrattribute.cxx b/drawinglayer/source/attribute/sdrattribute.cxx index 0ce4a4f56763..2ff76f2338e7 100644 --- a/drawinglayer/source/attribute/sdrattribute.cxx +++ b/drawinglayer/source/attribute/sdrattribute.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrattribute.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2006-10-19 10:36:14 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -52,7 +52,7 @@ namespace drawinglayer namespace attribute { SdrLineAttribute::SdrLineAttribute( - basegfx::tools::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, + basegfx::B2DLineJoin eJoin, double fWidth, double fTransparence, const basegfx::BColor& rColor, const ::std::vector< double >& rDotDashArray, double fFullDotDashLen) : meJoin(eJoin), mfWidth(fWidth), diff --git a/drawinglayer/source/attribute/strokeattribute.cxx b/drawinglayer/source/attribute/strokeattribute.cxx new file mode 100644 index 000000000000..9ba17e6c4081 --- /dev/null +++ b/drawinglayer/source/attribute/strokeattribute.cxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: strokeattribute.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#ifndef INCLUDED_DRAWINGLAYER_ATTRIBUTE_STROKEATTRIBUTE_HXX +#include <drawinglayer/attribute/strokeattribute.hxx> +#endif + +#include <numeric> + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace attribute + { + double StrokeAttribute::getFullDotDashLen() const + { + if(0.0 == mfFullDotDashLen && maDotDashArray.size()) + { + // calculate length on demand + const double fAccumulated(::std::accumulate(maDotDashArray.begin(), maDotDashArray.end(), 0.0)); + const_cast< StrokeAttribute* >(this)->mfFullDotDashLen = fAccumulated; + } + + return mfFullDotDashLen; + } + } // end of namespace attribute +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx index 76ccb50c92db..22d799bf26f6 100644 --- a/drawinglayer/source/primitive2d/polygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polygonprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polygonprimitive2d.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: aw $ $Date: 2007-09-26 11:36:36 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -111,35 +111,20 @@ namespace drawinglayer { if(getDashLength() > 0.0) { - ::std::vector< double > aDashA; - ::std::vector< double > aDashB; + // apply dashing; get line and gap snippets + ::std::vector< double > aDash; + basegfx::B2DPolyPolygon aDashedPolyPolyA; + basegfx::B2DPolyPolygon aDashedPolyPolyB; - aDashA.push_back(getDashLength()); - aDashA.push_back(getDashLength()); - - aDashB.push_back(0.0); - aDashB.push_back(getDashLength()); - aDashB.push_back(getDashLength()); - aDashB.push_back(0.0); - - const basegfx::B2DPolyPolygon aDashedPolyPolyA(basegfx::tools::applyLineDashing(getB2DPolygon(), aDashA, 2.0 * getDashLength())); - const basegfx::B2DPolyPolygon aDashedPolyPolyB(basegfx::tools::applyLineDashing(getB2DPolygon(), aDashB, 2.0 * getDashLength())); + aDash.push_back(getDashLength()); + aDash.push_back(getDashLength()); + basegfx::tools::applyLineDashing(getB2DPolygon(), aDash, &aDashedPolyPolyA, &aDashedPolyPolyB, 2.0 * getDashLength()); // prepare return value - Primitive2DSequence aRetval(aDashedPolyPolyA.count() + aDashedPolyPolyB.count()); - sal_uInt32 a(0L), b(0L); - - for(; a < aDashedPolyPolyA.count(); a++) - { - const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aDashedPolyPolyA.getB2DPolygon(a), getRGBColorA())); - aRetval[a] = xRef; - } + Primitive2DSequence aRetval(2); - for(; b < aDashedPolyPolyB.count(); b++) - { - const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aDashedPolyPolyB.getB2DPolygon(b), getRGBColorB())); - aRetval[a + b] = xRef; - } + aRetval[0] = Primitive2DReference(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyA, getRGBColorA())); + aRetval[1] = Primitive2DReference(new PolyPolygonHairlinePrimitive2D(aDashedPolyPolyB, getRGBColorB())); return aRetval; } @@ -209,27 +194,30 @@ namespace drawinglayer else { // apply LineStyle - const basegfx::B2DPolygon aHairLinePolygon(basegfx::tools::adaptiveSubdivideByAngle(getB2DPolygon())); - aHairLinePolyPolygon = basegfx::tools::applyLineDashing(aHairLinePolygon, getStrokeAttribute().getDotDashArray(), getStrokeAttribute().getFullDotDashLen()); - - // merge LineStyle polygons to bigger parts - aHairLinePolyPolygon = basegfx::tools::mergeDashedLines(aHairLinePolyPolygon); + basegfx::tools::applyLineDashing(getB2DPolygon(), getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen()); } - if(getStrokeAttribute().getWidth()) + const sal_uInt32 nCount(aHairLinePolyPolygon.count()); + + if(getLineAttribute().getWidth()) { + static bool bTestNewMethod(true); + // create fat line data - aHairLinePolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(aHairLinePolyPolygon); - const double fHalfLineWidth(getStrokeAttribute().getWidth() / 2.0); - const double fDegreeStepWidth(10.0 * F_PI180); + if(!bTestNewMethod) + { + aHairLinePolyPolygon = basegfx::tools::adaptiveSubdivideByAngle(aHairLinePolyPolygon); + } + + const double fHalfLineWidth(getLineAttribute().getWidth() / 2.0); const double fMiterMinimumAngle(15.0 * F_PI180); - const basegfx::tools::B2DLineJoin aLineJoin(getStrokeAttribute().getLineJoin()); + const basegfx::B2DLineJoin aLineJoin(getLineAttribute().getLineJoin()); basegfx::B2DPolyPolygon aAreaPolyPolygon; - for(sal_uInt32 a(0L); a < aHairLinePolyPolygon.count(); a++) + for(sal_uInt32 a(0L); a < nCount; a++) { const basegfx::B2DPolyPolygon aNewPolyPolygon(basegfx::tools::createAreaGeometryForPolygon( - aHairLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, aLineJoin, fDegreeStepWidth, fMiterMinimumAngle)); + aHairLinePolyPolygon.getB2DPolygon(a), fHalfLineWidth, aLineJoin, fMiterMinimumAngle)); aAreaPolyPolygon.append(aNewPolyPolygon); } @@ -239,11 +227,14 @@ namespace drawinglayer // create primitive for(sal_uInt32 b(0L); b < aAreaPolyPolygon.count(); b++) { - // put into single polyPolygon primitives to make clear thta this is NOT meant - // to be painted XORed as fill rule. Alternatively, a melting process may be used - // here one day. + // put into single polyPolygon primitives to make clear that this is NOT meant + // to be painted as a single PolyPolygon (XORed as fill rule). Alternatively, a + // melting process may be used here one day. const basegfx::B2DPolyPolygon aNewPolyPolygon(aAreaPolyPolygon.getB2DPolygon(b)); - const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(aNewPolyPolygon, getStrokeAttribute().getColor())); + const basegfx::BColor aColor(bTestNewMethod + ? basegfx::BColor(rand() / 32767.0, rand() / 32767.0, rand() / 32767.0) + : getLineAttribute().getColor()); + const Primitive2DReference xRef(new PolyPolygonColorPrimitive2D(aNewPolyPolygon, aColor)); aRetval[b] = xRef; } @@ -252,17 +243,8 @@ namespace drawinglayer else { // prepare return value - Primitive2DSequence aRetval(aHairLinePolyPolygon.count()); - - // create hair line data for all sub polygons - for(sal_uInt32 a(0L); a < aHairLinePolyPolygon.count(); a++) - { - const basegfx::B2DPolygon aCandidate = aHairLinePolyPolygon.getB2DPolygon(a); - const Primitive2DReference xRef(new PolygonHairlinePrimitive2D(aCandidate, getStrokeAttribute().getColor())); - aRetval[a] = xRef; - } - - return aRetval; + const Primitive2DReference xRef(new PolyPolygonHairlinePrimitive2D(aHairLinePolyPolygon, getLineAttribute().getColor())); + return Primitive2DSequence(&xRef, 1); } } else @@ -273,13 +255,25 @@ namespace drawinglayer PolygonStrokePrimitive2D::PolygonStrokePrimitive2D( const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute) : BasePrimitive2D(), maPolygon(rPolygon), + maLineAttribute(rLineAttribute), maStrokeAttribute(rStrokeAttribute) { } + PolygonStrokePrimitive2D::PolygonStrokePrimitive2D( + const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute) + : BasePrimitive2D(), + maPolygon(rPolygon), + maLineAttribute(rLineAttribute), + maStrokeAttribute() + { + } + bool PolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { if(BasePrimitive2D::operator==(rPrimitive)) @@ -287,6 +281,7 @@ namespace drawinglayer const PolygonStrokePrimitive2D& rCompare = (PolygonStrokePrimitive2D&)rPrimitive; return (getB2DPolygon() == rCompare.getB2DPolygon() + && getLineAttribute() == rCompare.getLineAttribute() && getStrokeAttribute() == rCompare.getStrokeAttribute()); } @@ -299,9 +294,9 @@ namespace drawinglayer basegfx::B2DRange aRetval(basegfx::tools::getRange(basegfx::tools::adaptiveSubdivideByAngle(getB2DPolygon()))); // if width, grow by line width - if(getStrokeAttribute().getWidth()) + if(getLineAttribute().getWidth()) { - aRetval.grow(getStrokeAttribute().getWidth() / 2.0); + aRetval.grow(getLineAttribute().getWidth() / 2.0); } return aRetval; @@ -332,13 +327,13 @@ namespace drawinglayer { // create waveline curve const basegfx::B2DPolygon aWaveline(basegfx::tools::createWaveline(getB2DPolygon(), getWaveWidth(), getWaveHeight())); - const Primitive2DReference xRef(new PolygonStrokePrimitive2D(aWaveline, getStrokeAttribute())); + const Primitive2DReference xRef(new PolygonStrokePrimitive2D(aWaveline, getLineAttribute(), getStrokeAttribute())); aRetval = Primitive2DSequence(&xRef, 1); } else { // flat waveline, decompose to simple line primitive - const Primitive2DReference xRef(new PolygonStrokePrimitive2D(getB2DPolygon(), getStrokeAttribute())); + const Primitive2DReference xRef(new PolygonStrokePrimitive2D(getB2DPolygon(), getLineAttribute(), getStrokeAttribute())); aRetval = Primitive2DSequence(&xRef, 1); } } @@ -348,12 +343,31 @@ namespace drawinglayer PolygonWavePrimitive2D::PolygonWavePrimitive2D( const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute, double fWaveWidth, double fWaveHeight) - : BasePrimitive2D(), - maPolygon(rPolygon), - maStrokeAttribute(rStrokeAttribute), + : PolygonStrokePrimitive2D(rPolygon, rLineAttribute, rStrokeAttribute), + mfWaveWidth(fWaveWidth), + mfWaveHeight(fWaveHeight) + { + if(mfWaveWidth < 0.0) + { + mfWaveWidth = 0.0; + } + + if(mfWaveHeight < 0.0) + { + mfWaveHeight = 0.0; + } + } + + PolygonWavePrimitive2D::PolygonWavePrimitive2D( + const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, + double fWaveWidth, + double fWaveHeight) + : PolygonStrokePrimitive2D(rPolygon, rLineAttribute), mfWaveWidth(fWaveWidth), mfWaveHeight(fWaveHeight) { @@ -370,23 +384,21 @@ namespace drawinglayer bool PolygonWavePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { - if(BasePrimitive2D::operator==(rPrimitive)) + if(PolygonStrokePrimitive2D::operator==(rPrimitive)) { const PolygonWavePrimitive2D& rCompare = (PolygonWavePrimitive2D&)rPrimitive; - return (getB2DPolygon() == rCompare.getB2DPolygon() - && getStrokeAttribute() == rCompare.getStrokeAttribute() - && getWaveWidth() == rCompare.getWaveWidth() + return (getWaveWidth() == rCompare.getWaveWidth() && getWaveHeight() == rCompare.getWaveHeight()); } return false; } - basegfx::B2DRange PolygonWavePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + basegfx::B2DRange PolygonWavePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { - // get range of it (subdivided) - basegfx::B2DRange aRetval(basegfx::tools::getRange(basegfx::tools::adaptiveSubdivideByAngle(getB2DPolygon()))); + // get range of parent + basegfx::B2DRange aRetval(PolygonStrokePrimitive2D::getB2DRange(rViewInformation)); // if WaveHeight, grow by it if(!basegfx::fTools::equalZero(getWaveHeight())) @@ -395,9 +407,9 @@ namespace drawinglayer } // if line width, grow by it - if(!basegfx::fTools::equalZero(getStrokeAttribute().getWidth())) + if(!basegfx::fTools::equalZero(getLineAttribute().getWidth())) { - aRetval.grow(getStrokeAttribute().getWidth()); + aRetval.grow(getLineAttribute().getWidth()); } return aRetval; @@ -462,18 +474,18 @@ namespace drawinglayer sal_uInt32 nInd(0L); // add shaft - const Primitive2DReference xRefShaft(new PolygonStrokePrimitive2D(aLocalPolygon, getStrokeAttribute())); + const Primitive2DReference xRefShaft(new PolygonStrokePrimitive2D(aLocalPolygon, getLineAttribute(), getStrokeAttribute())); aRetval[nInd++] = xRefShaft; if(aArrowA.count()) { - const Primitive2DReference xRefA(new PolyPolygonColorPrimitive2D(aArrowA, getStrokeAttribute().getColor())); + const Primitive2DReference xRefA(new PolyPolygonColorPrimitive2D(aArrowA, getLineAttribute().getColor())); aRetval[nInd++] = xRefA; } if(aArrowB.count()) { - const Primitive2DReference xRefB(new PolyPolygonColorPrimitive2D(aArrowB, getStrokeAttribute().getColor())); + const Primitive2DReference xRefB(new PolyPolygonColorPrimitive2D(aArrowB, getLineAttribute().getColor())); aRetval[nInd++] = xRefB; } @@ -482,10 +494,22 @@ namespace drawinglayer PolygonStrokeArrowPrimitive2D::PolygonStrokeArrowPrimitive2D( const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute, - const attribute::StrokeArrowAttribute& rStart, - const attribute::StrokeArrowAttribute& rEnd) - : PolygonStrokePrimitive2D(rPolygon, rStrokeAttribute), + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd) + : PolygonStrokePrimitive2D(rPolygon, rLineAttribute, rStrokeAttribute), + maStart(rStart), + maEnd(rEnd) + { + } + + PolygonStrokeArrowPrimitive2D::PolygonStrokeArrowPrimitive2D( + const basegfx::B2DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd) + : PolygonStrokePrimitive2D(rPolygon, rLineAttribute), maStart(rStart), maEnd(rEnd) { diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index e885e24c0091..025cb07afcf6 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polypolygonprimitive2d.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2007-03-06 12:34:30 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -83,6 +83,66 @@ namespace drawinglayer { namespace primitive2d { + Primitive2DSequence PolyPolygonHairlinePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); + const sal_uInt32 nCount(aPolyPolygon.count()); + + if(nCount) + { + Primitive2DSequence aRetval(nCount); + + for(sal_uInt32 a(0L); a < nCount; a++) + { + aRetval[a] = Primitive2DReference(new PolygonHairlinePrimitive2D(aPolyPolygon.getB2DPolygon(a), getBColor())); + } + + return aRetval; + } + else + { + return Primitive2DSequence(); + } + } + + PolyPolygonHairlinePrimitive2D::PolyPolygonHairlinePrimitive2D(const basegfx::B2DPolyPolygon& rPolyPolygon, const basegfx::BColor& rBColor) + : BasePrimitive2D(), + maPolyPolygon(rPolyPolygon), + maBColor(rBColor) + { + } + + bool PolyPolygonHairlinePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(BasePrimitive2D::operator==(rPrimitive)) + { + const PolyPolygonHairlinePrimitive2D& rCompare = (PolyPolygonHairlinePrimitive2D&)rPrimitive; + + return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() + && getBColor() == rCompare.getBColor()); + } + + return false; + } + + basegfx::B2DRange PolyPolygonHairlinePrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + // return range + return basegfx::tools::getRange(basegfx::tools::adaptiveSubdivideByAngle(getB2DPolyPolygon())); + } + + // provide unique ID + ImplPrimitrive2DIDBlock(PolyPolygonHairlinePrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { Primitive2DSequence PolyPolygonStrokePrimitive2D::createLocalDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const { const basegfx::B2DPolyPolygon aPolyPolygon(getB2DPolyPolygon()); @@ -94,7 +154,7 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < nCount; a++) { - aRetval[a] = Primitive2DReference(new PolygonStrokePrimitive2D(aPolyPolygon.getB2DPolygon(a), getStrokeAttribute())); + aRetval[a] = Primitive2DReference(new PolygonStrokePrimitive2D(aPolyPolygon.getB2DPolygon(a), getLineAttribute(), getStrokeAttribute())); } return aRetval; @@ -107,13 +167,25 @@ namespace drawinglayer PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute) : BasePrimitive2D(), maPolyPolygon(rPolyPolygon), + maLineAttribute(rLineAttribute), maStrokeAttribute(rStrokeAttribute) { } + PolyPolygonStrokePrimitive2D::PolyPolygonStrokePrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const attribute::LineAttribute& rLineAttribute) + : BasePrimitive2D(), + maPolyPolygon(rPolyPolygon), + maLineAttribute(rLineAttribute), + maStrokeAttribute() + { + } + bool PolyPolygonStrokePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const { if(BasePrimitive2D::operator==(rPrimitive)) @@ -121,6 +193,7 @@ namespace drawinglayer const PolyPolygonStrokePrimitive2D& rCompare = (PolyPolygonStrokePrimitive2D&)rPrimitive; return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() + && getLineAttribute() == rCompare.getLineAttribute() && getStrokeAttribute() == rCompare.getStrokeAttribute()); } @@ -133,9 +206,9 @@ namespace drawinglayer basegfx::B2DRange aRetval(basegfx::tools::getRange(basegfx::tools::adaptiveSubdivideByAngle(getB2DPolyPolygon()))); // if width, grow by line width - if(getStrokeAttribute().getWidth()) + if(getLineAttribute().getWidth()) { - aRetval.grow(getStrokeAttribute().getWidth() / 2.0); + aRetval.grow(getLineAttribute().getWidth() / 2.0); } return aRetval; @@ -169,11 +242,11 @@ namespace drawinglayer if(aPolygon.isClosed()) { // no need for PolygonStrokeArrowPrimitive2D when polygon is closed - aRetval[a] = Primitive2DReference(new PolygonStrokePrimitive2D(aPolygon, getStrokeAttribute())); + aRetval[a] = Primitive2DReference(new PolygonStrokePrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute())); } else { - aRetval[a] = Primitive2DReference(new PolygonStrokeArrowPrimitive2D(aPolygon, getStrokeAttribute(), getStart(), getEnd())); + aRetval[a] = Primitive2DReference(new PolygonStrokeArrowPrimitive2D(aPolygon, getLineAttribute(), getStrokeAttribute(), getStart(), getEnd())); } } @@ -187,10 +260,22 @@ namespace drawinglayer PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D( const basegfx::B2DPolyPolygon& rPolyPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute, - const attribute::StrokeArrowAttribute& rStart, - const attribute::StrokeArrowAttribute& rEnd) - : PolyPolygonStrokePrimitive2D(rPolyPolygon, rStrokeAttribute), + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd) + : PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute, rStrokeAttribute), + maStart(rStart), + maEnd(rEnd) + { + } + + PolyPolygonStrokeArrowPrimitive2D::PolyPolygonStrokeArrowPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const attribute::LineAttribute& rLineAttribute, + const attribute::LineStartEndAttribute& rStart, + const attribute::LineStartEndAttribute& rEnd) + : PolyPolygonStrokePrimitive2D(rPolyPolygon, rLineAttribute), maStart(rStart), maEnd(rEnd) { diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx index c2217c8af279..d4c6e5a46b75 100644 --- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: textdecoratedprimitive2d.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: aw $ $Date: 2007-10-02 16:55:00 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -81,8 +81,6 @@ #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #endif -#include <numeric> - ////////////////////////////////////////////////////////////////////////////// namespace drawinglayer @@ -149,13 +147,13 @@ namespace drawinglayer bool bDoubleLine(false); bool bWaveLine(false); bool bBoldLine(false); - const int* pDashDotArray(0); - basegfx::tools::B2DLineJoin eLineJoin(basegfx::tools::B2DLINEJOIN_NONE); + const int* pDotDashArray(0); + basegfx::B2DLineJoin eLineJoin(basegfx::B2DLINEJOIN_NONE); double fUnderlineOffset(aTextLayouter.getUnderlineOffset()); double fUnderlineHeight(aTextLayouter.getUnderlineHeight()); static const int aDottedArray[] = { 1, 1, 0}; // DOTTED LINE - static const int aDashDotArray[] = { 1, 1, 4, 1, 0}; // DASHDOT + static const int aDotDashArray[] = { 1, 1, 4, 1, 0}; // DASHDOT static const int aDashDotDotArray[] = { 1, 1, 1, 1, 4, 1, 0}; // DASHDOTDOT static const int aDashedArray[] = { 5, 2, 0}; // DASHED LINE static const int aLongDashArray[] = { 7, 2, 0}; // LONGDASH @@ -173,27 +171,27 @@ namespace drawinglayer } case FONT_UNDERLINE_DOTTED: { - pDashDotArray = aDottedArray; + pDotDashArray = aDottedArray; break; } case FONT_UNDERLINE_DASH: { - pDashDotArray = aDashedArray; + pDotDashArray = aDashedArray; break; } case FONT_UNDERLINE_LONGDASH: { - pDashDotArray = aLongDashArray; + pDotDashArray = aLongDashArray; break; } case FONT_UNDERLINE_DASHDOT: { - pDashDotArray = aDashDotArray; + pDotDashArray = aDotDashArray; break; } case FONT_UNDERLINE_DASHDOTDOT: { - pDashDotArray = aDashDotDotArray; + pDotDashArray = aDashDotDotArray; break; } case FONT_UNDERLINE_SMALLWAVE: @@ -220,31 +218,31 @@ namespace drawinglayer case FONT_UNDERLINE_BOLDDOTTED: { bBoldLine = true; - pDashDotArray = aDottedArray; + pDotDashArray = aDottedArray; break; } case FONT_UNDERLINE_BOLDDASH: { bBoldLine = true; - pDashDotArray = aDashedArray; + pDotDashArray = aDashedArray; break; } case FONT_UNDERLINE_BOLDLONGDASH: { bBoldLine = true; - pDashDotArray = aLongDashArray; + pDotDashArray = aLongDashArray; break; } case FONT_UNDERLINE_BOLDDASHDOT: { bBoldLine = true; - pDashDotArray = aDashDotArray; + pDotDashArray = aDotDashArray; break; } case FONT_UNDERLINE_BOLDDASHDOTDOT: { bBoldLine = true; - pDashDotArray = aDashDotDotArray; + pDotDashArray = aDashDotDotArray; break; } case FONT_UNDERLINE_BOLDWAVE: @@ -268,30 +266,24 @@ namespace drawinglayer if(bWaveLine) { - eLineJoin = basegfx::tools::B2DLINEJOIN_ROUND; + eLineJoin = basegfx::B2DLINEJOIN_ROUND; fUnderlineHeight *= 0.5; } - // prepare StrokeAttributes - attribute::StrokeAttribute aStrokeAttribute(getTextlineColor(), fUnderlineHeight, eLineJoin); + // prepare Line and Stroke Attributes + const attribute::LineAttribute aLineAttribute(getTextlineColor(), fUnderlineHeight, eLineJoin); + attribute::StrokeAttribute aStrokeAttribute; - if(pDashDotArray) + if(pDotDashArray) { ::std::vector< double > aDoubleArray; - for(const int* p = pDashDotArray; *p; ++p) + for(const int* p = pDotDashArray; *p; ++p) { aDoubleArray.push_back((double)(*p) * fUnderlineHeight); } - const double fFullDashDotLen(::std::accumulate(aDoubleArray.begin(), aDoubleArray.end(), 0.0)); - - aStrokeAttribute = attribute::StrokeAttribute( - aStrokeAttribute.getColor(), - aStrokeAttribute.getWidth(), - aStrokeAttribute.getLineJoin(), - aDoubleArray, - fFullDashDotLen); + aStrokeAttribute = attribute::StrokeAttribute(aDoubleArray); } // create base polygon and new primitive @@ -316,11 +308,11 @@ namespace drawinglayer fWaveWidth *= 2.0; } - aNewPrimitive = Primitive2DReference(new PolygonWavePrimitive2D(aUnderline, aStrokeAttribute, fWaveWidth, 0.5 * fWaveWidth)); + aNewPrimitive = Primitive2DReference(new PolygonWavePrimitive2D(aUnderline, aLineAttribute, aStrokeAttribute, fWaveWidth, 0.5 * fWaveWidth)); } else { - aNewPrimitive = Primitive2DReference(new PolygonStrokePrimitive2D(aUnderline, aStrokeAttribute)); + aNewPrimitive = Primitive2DReference(new PolygonStrokePrimitive2D(aUnderline, aLineAttribute, aStrokeAttribute)); } // add primitive @@ -422,8 +414,8 @@ namespace drawinglayer aStrikeoutLine.append(basegfx::B2DPoint(fTextWidth, -fStrikeoutOffset)); aStrikeoutLine.transform(aUnscaledTransform); - const attribute::StrokeAttribute aStrokeAttribute(getFontColor(), fStrikeoutHeight, basegfx::tools::B2DLINEJOIN_NONE); - Primitive2DReference aNewPrimitive(new PolygonStrokePrimitive2D(aStrikeoutLine, aStrokeAttribute)); + const attribute::LineAttribute aLineAttribute(getFontColor(), fStrikeoutHeight, basegfx::B2DLINEJOIN_NONE); + Primitive2DReference aNewPrimitive(new PolygonStrokePrimitive2D(aStrikeoutLine, aLineAttribute)); // add primitive rTarget.push_back(aNewPrimitive); diff --git a/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx b/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx index 748ebcfd2d0b..4d0710b042cc 100644 --- a/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/wrongspellprimitive2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: wrongspellprimitive2d.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: aw $ $Date: 2007-09-26 11:36:36 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -93,11 +93,11 @@ namespace drawinglayer aPolygon.append(getTransformation() * aStart); aPolygon.append(getTransformation() * aStop); - // prepare stroke attribute - const attribute::StrokeAttribute aStrokeAttribute(getColor(), 0.0); + // prepare line attribute + const attribute::LineAttribute aLineAttribute(getColor()); // create the waveline primitive - Primitive2DReference xPrimitive(new PolygonWavePrimitive2D(aPolygon, aStrokeAttribute, fWaveWidth, 0.5 * fWaveWidth)); + Primitive2DReference xPrimitive(new PolygonWavePrimitive2D(aPolygon, aLineAttribute, fWaveWidth, 0.5 * fWaveWidth)); Primitive2DSequence xRetval(&xPrimitive, 1); return xRetval; diff --git a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx index a5bec933d0b7..16aeb4bc86c3 100644 --- a/drawinglayer/source/primitive3d/polygonprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygonprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polygonprimitive3d.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: aw $ $Date: 2007-03-06 12:34:56 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -112,30 +112,31 @@ namespace drawinglayer if(getB3DPolygon().count()) { - basegfx::B3DPolyPolygon aHairLinePolyPolygon(getB3DPolygon()); + basegfx::B3DPolyPolygon aHairLinePolyPolygon; - if(0.0 != getStrokeAttribute().getFullDotDashLen()) + if(0.0 == getStrokeAttribute().getFullDotDashLen()) + { + aHairLinePolyPolygon = basegfx::B3DPolyPolygon(getB3DPolygon()); + } + else { // apply LineStyle - aHairLinePolyPolygon = basegfx::tools::applyLineDashing(aHairLinePolyPolygon, getStrokeAttribute().getDotDashArray(), getStrokeAttribute().getFullDotDashLen()); - - // merge LineStyle polygons to bigger parts - aHairLinePolyPolygon = basegfx::tools::mergeDashedLines(aHairLinePolyPolygon); + basegfx::tools::applyLineDashing(getB3DPolygon(), getStrokeAttribute().getDotDashArray(), &aHairLinePolyPolygon, 0, getStrokeAttribute().getFullDotDashLen()); } // prepare result aRetval.realloc(aHairLinePolyPolygon.count()); - if(getStrokeAttribute().getWidth()) + if(getLineAttribute().getWidth()) { // create fat line data - const double fRadius(getStrokeAttribute().getWidth() / 2.0); - const basegfx::tools::B2DLineJoin aLineJoin(getStrokeAttribute().getLineJoin()); + const double fRadius(getLineAttribute().getWidth() / 2.0); + const basegfx::B2DLineJoin aLineJoin(getLineAttribute().getLineJoin()); for(sal_uInt32 a(0L); a < aHairLinePolyPolygon.count(); a++) { // create tube primitives - const Primitive3DReference xRef(new PolygonTubePrimitive3D(aHairLinePolyPolygon.getB3DPolygon(a), getStrokeAttribute().getColor(), fRadius, aLineJoin)); + const Primitive3DReference xRef(new PolygonTubePrimitive3D(aHairLinePolyPolygon.getB3DPolygon(a), getLineAttribute().getColor(), fRadius, aLineJoin)); aRetval[a] = xRef; } } @@ -145,7 +146,7 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < aHairLinePolyPolygon.count(); a++) { const basegfx::B3DPolygon aCandidate = aHairLinePolyPolygon.getB3DPolygon(a); - const Primitive3DReference xRef(new PolygonHairlinePrimitive3D(aCandidate, getStrokeAttribute().getColor())); + const Primitive3DReference xRef(new PolygonHairlinePrimitive3D(aCandidate, getLineAttribute().getColor())); aRetval[a] = xRef; } } @@ -156,13 +157,25 @@ namespace drawinglayer PolygonStrokePrimitive3D::PolygonStrokePrimitive3D( const basegfx::B3DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute, const attribute::StrokeAttribute& rStrokeAttribute) : BasePrimitive3D(), maPolygon(rPolygon), + maLineAttribute(rLineAttribute), maStrokeAttribute(rStrokeAttribute) { } + PolygonStrokePrimitive3D::PolygonStrokePrimitive3D( + const basegfx::B3DPolygon& rPolygon, + const attribute::LineAttribute& rLineAttribute) + : BasePrimitive3D(), + maPolygon(rPolygon), + maLineAttribute(rLineAttribute), + maStrokeAttribute() + { + } + bool PolygonStrokePrimitive3D::operator==(const BasePrimitive3D& rPrimitive) const { if(BasePrimitive3D::operator==(rPrimitive)) @@ -170,6 +183,7 @@ namespace drawinglayer const PolygonStrokePrimitive3D& rCompare = (PolygonStrokePrimitive3D&)rPrimitive; return (getB3DPolygon() == rCompare.getB3DPolygon() + && getLineAttribute() == rCompare.getLineAttribute() && getStrokeAttribute() == rCompare.getStrokeAttribute()); } diff --git a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx index a134b9ccedee..60ef2e2e7ee3 100644 --- a/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx +++ b/drawinglayer/source/primitive3d/polygontubeprimitive3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: polygontubeprimitive3d.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: aw $ $Date: 2007-03-06 12:34:56 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -194,7 +194,7 @@ namespace drawinglayer double fAngle, double /*fDegreeStepWidth*/, double fMiterMinimumAngle, - basegfx::tools::B2DLineJoin aLineJoin) + basegfx::B2DLineJoin aLineJoin) { // nSegments is for whole circle, adapt to half circle const sal_uInt32 nVerSeg(nSegments >> 1L); @@ -202,7 +202,7 @@ namespace drawinglayer if(nVerSeg) { - if(basegfx::tools::B2DLINEJOIN_ROUND == aLineJoin) + if(basegfx::B2DLINEJOIN_ROUND == aLineJoin) { // calculate new horizontal segments const sal_uInt32 nHorSeg((sal_uInt32)((fAngle / F_2PI) * (double)nSegments)); @@ -223,29 +223,29 @@ namespace drawinglayer else { // fallback to bevel when there is not at least one segment hor and ver - aLineJoin = basegfx::tools::B2DLINEJOIN_BEVEL; + aLineJoin = basegfx::B2DLINEJOIN_BEVEL; } } - if(basegfx::tools::B2DLINEJOIN_MIDDLE == aLineJoin - || basegfx::tools::B2DLINEJOIN_BEVEL == aLineJoin - || basegfx::tools::B2DLINEJOIN_MITER == aLineJoin) + if(basegfx::B2DLINEJOIN_MIDDLE == aLineJoin + || basegfx::B2DLINEJOIN_BEVEL == aLineJoin + || basegfx::B2DLINEJOIN_MITER == aLineJoin) { - if(basegfx::tools::B2DLINEJOIN_MITER == aLineJoin) + if(basegfx::B2DLINEJOIN_MITER == aLineJoin) { const double fMiterAngle(fAngle/2.0); if(fMiterAngle < fMiterMinimumAngle) { // fallback to bevel when miter's angle is too small - aLineJoin = basegfx::tools::B2DLINEJOIN_BEVEL; + aLineJoin = basegfx::B2DLINEJOIN_BEVEL; } } const double fInc(F_PI / (double)nVerSeg); const double fSin(sin(-fAngle)); const double fCos(cos(-fAngle)); - const bool bMiter(basegfx::tools::B2DLINEJOIN_MITER == aLineJoin); + const bool bMiter(basegfx::B2DLINEJOIN_MITER == aLineJoin); const double fMiterSin(bMiter ? sin(-(fAngle/2.0)) : 0.0); const double fMiterCos(bMiter ? cos(-(fAngle/2.0)) : 0.0); double fPos(-F_PI2); @@ -449,7 +449,7 @@ namespace drawinglayer const attribute::MaterialAttribute3D aMaterial(getBColor()); static sal_uInt32 nSegments(8L); // default for 3d line segments, for more quality just raise this value (in even steps) const bool bClosed(getB3DPolygon().isClosed()); - const bool bNoLineJoin(basegfx::tools::B2DLINEJOIN_NONE == getLineJoin()); + const bool bNoLineJoin(basegfx::B2DLINEJOIN_NONE == getLineJoin()); const sal_uInt32 nLoopCount(bClosed ? nPointCount : nPointCount - 1L); basegfx::B3DPoint aLast(getB3DPolygon().getB3DPoint(nPointCount - 1L)); basegfx::B3DPoint aCurr(getB3DPolygon().getB3DPoint(0L)); @@ -557,7 +557,7 @@ namespace drawinglayer PolygonTubePrimitive3D::PolygonTubePrimitive3D( const basegfx::B3DPolygon& rPolygon, const basegfx::BColor& rBColor, - double fRadius, basegfx::tools::B2DLineJoin aLineJoin, + double fRadius, basegfx::B2DLineJoin aLineJoin, double fDegreeStepWidth, double fMiterMinimumAngle) : PolygonHairlinePrimitive3D(rPolygon, rBColor), diff --git a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx index 1593e3d8d319..d07a02863128 100644 --- a/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx +++ b/drawinglayer/source/primitive3d/sdrdecompositiontools3d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: sdrdecompositiontools3d.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: aw $ $Date: 2006-10-19 10:38:33 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:26 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -132,15 +132,16 @@ namespace drawinglayer basegfx::B3DPolyPolygon aScaledPolyPolygon(rUnitPolyPolygon); aScaledPolyPolygon.transform(rObjectTransform); - // create stroke attribute - const attribute::StrokeAttribute aStrokeAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin(), rLine.getDotDashArray(), rLine.getFullDotDashLen()); + // create line and stroke attribute + const attribute::LineAttribute aLineAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin()); + const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen()); // create primitives Primitive3DSequence aRetval(aScaledPolyPolygon.count()); for(sal_uInt32 a(0L); a < aScaledPolyPolygon.count(); a++) { - const Primitive3DReference xRef(new PolygonStrokePrimitive3D(aScaledPolyPolygon.getB3DPolygon(a), aStrokeAttribute)); + const Primitive3DReference xRef(new PolygonStrokePrimitive3D(aScaledPolyPolygon.getB3DPolygon(a), aLineAttribute, aStrokeAttribute)); aRetval[a] = xRef; } diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index c1b813a1e522..b257aef16e7b 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -4,9 +4,9 @@ * * $RCSfile: vclhelperbufferdevice.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: aw $ $Date: 2007-03-06 12:34:16 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:27 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -80,6 +80,9 @@ namespace drawinglayer aNewMapMode.SetOrigin(Point(-aLogicTopLeft.X(), -aLogicTopLeft.Y())); maContent.SetMapMode(aNewMapMode); + + // copy AA flag for new target + maContent.SetAntialiasing(mrOutDev.GetAntialiasing()); } } @@ -132,6 +135,8 @@ namespace drawinglayer mpMask = new VirtualDevice(mrOutDev, 1); mpMask->SetOutputSizePixel(maDestPixel.GetSize(), true); mpMask->SetMapMode(maContent.GetMapMode()); + + // do NOT copy AA flag for mask! } return *mpMask; @@ -144,6 +149,8 @@ namespace drawinglayer mpAlpha = new VirtualDevice(); mpAlpha->SetOutputSizePixel(maDestPixel.GetSize(), true); mpAlpha->SetMapMode(maContent.GetMapMode()); + + // do NOT copy AA flag for alpha! } return *mpAlpha; diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 6098f8c625e4..70d4b5fc5d14 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -4,9 +4,9 @@ * * $RCSfile: vclmetafileprocessor2d.cxx,v $ * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * - * last change: $Author: aw $ $Date: 2007-10-15 16:11:08 $ + * last change: $Author: aw $ $Date: 2007-11-07 14:27:27 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -340,9 +340,10 @@ namespace drawinglayer SvtGraphicStroke* VclMetafileProcessor2D::impTryToCreateSvtGraphicStroke( const basegfx::B2DPolygon& rB2DPolygon, const basegfx::BColor* pColor, + const attribute::LineAttribute* pLineAttribute, const attribute::StrokeAttribute* pStrokeAttribute, - const attribute::StrokeArrowAttribute* pStart, - const attribute::StrokeArrowAttribute* pEnd) + const attribute::LineStartEndAttribute* pStart, + const attribute::LineStartEndAttribute* pEnd) { SvtGraphicStroke* pRetval = 0; @@ -356,9 +357,9 @@ namespace drawinglayer { aStrokeColor = *pColor; } - else if(pStrokeAttribute) + else if(pLineAttribute) { - aStrokeColor = maBColorModifierStack.getModifiedColor(pStrokeAttribute->getColor()); + aStrokeColor = maBColorModifierStack.getModifiedColor(pLineAttribute->getColor()); } // copied from ImpDrawLineGeometry. Ckecked. @@ -388,42 +389,45 @@ namespace drawinglayer double fMiterLength(0.0); SvtGraphicStroke::DashArray aDashArray; - if(pStrokeAttribute) + if(pLineAttribute) { // pre-fill fLineWidth - fLineWidth = pStrokeAttribute->getWidth(); + fLineWidth = pLineAttribute->getWidth(); // pre-fill fMiterLength fMiterLength = fLineWidth; // get Join - switch(pStrokeAttribute->getLineJoin()) + switch(pLineAttribute->getLineJoin()) { - default : // basegfx::tools::B2DLINEJOIN_NONE : + default : // basegfx::B2DLINEJOIN_NONE : { eJoin = SvtGraphicStroke::joinNone; break; } - case basegfx::tools::B2DLINEJOIN_BEVEL : + case basegfx::B2DLINEJOIN_BEVEL : { eJoin = SvtGraphicStroke::joinBevel; break; } - case basegfx::tools::B2DLINEJOIN_MIDDLE : - case basegfx::tools::B2DLINEJOIN_MITER : + case basegfx::B2DLINEJOIN_MIDDLE : + case basegfx::B2DLINEJOIN_MITER : { eJoin = SvtGraphicStroke::joinMiter; // ATM 15 degrees is assumed fMiterLength /= rtl::math::sin(M_PI * (15.0 / 360.0)); break; } - case basegfx::tools::B2DLINEJOIN_ROUND : + case basegfx::B2DLINEJOIN_ROUND : { eJoin = SvtGraphicStroke::joinRound; break; } } + } + if(pStrokeAttribute) + { // copy dash array aDashArray = pStrokeAttribute->getDotDashArray(); } @@ -1040,7 +1044,7 @@ namespace drawinglayer // also support SvtGraphicStroke MetaCommentAction const primitive2d::PolygonHairlinePrimitive2D& rHairlinePrimitive = static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate); const basegfx::BColor aLineColor(maBColorModifierStack.getModifiedColor(rHairlinePrimitive.getBColor())); - SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rHairlinePrimitive.getB2DPolygon(), &aLineColor, 0, 0, 0); + SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rHairlinePrimitive.getB2DPolygon(), &aLineColor, 0, 0, 0, 0); impStartSvtGraphicStroke(pSvtGraphicStroke); RenderPolygonHairlinePrimitive2D(static_cast< const primitive2d::PolygonHairlinePrimitive2D& >(rCandidate)); @@ -1051,7 +1055,8 @@ namespace drawinglayer { // support SvtGraphicStroke MetaCommentAction const primitive2d::PolygonStrokePrimitive2D& rStrokePrimitive = static_cast< const primitive2d::PolygonStrokePrimitive2D& >(rCandidate); - SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rStrokePrimitive.getB2DPolygon(), 0, &rStrokePrimitive.getStrokeAttribute(), 0, 0); + SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rStrokePrimitive.getB2DPolygon(), 0, &rStrokePrimitive.getLineAttribute(), + &rStrokePrimitive.getStrokeAttribute(), 0, 0); impStartSvtGraphicStroke(pSvtGraphicStroke); process(rCandidate.get2DDecomposition(getViewInformation2D())); @@ -1062,8 +1067,8 @@ namespace drawinglayer { // support SvtGraphicStroke MetaCommentAction const primitive2d::PolygonStrokeArrowPrimitive2D& rStrokeArrowPrimitive = static_cast< const primitive2d::PolygonStrokeArrowPrimitive2D& >(rCandidate); - SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rStrokeArrowPrimitive.getB2DPolygon(), 0, &rStrokeArrowPrimitive.getStrokeAttribute(), - &rStrokeArrowPrimitive.getStart(), &rStrokeArrowPrimitive.getEnd()); + SvtGraphicStroke* pSvtGraphicStroke = impTryToCreateSvtGraphicStroke(rStrokeArrowPrimitive.getB2DPolygon(), 0, &rStrokeArrowPrimitive.getLineAttribute(), + &rStrokeArrowPrimitive.getStrokeAttribute(), &rStrokeArrowPrimitive.getStart(), &rStrokeArrowPrimitive.getEnd()); impStartSvtGraphicStroke(pSvtGraphicStroke); process(rCandidate.get2DDecomposition(getViewInformation2D())); |