From e30ad6028be5eea3bad01bc1b813eb83746bfdd9 Mon Sep 17 00:00:00 2001 From: Armin Weiss Date: Wed, 7 Nov 2007 13:31:19 +0000 Subject: #i39532# committing to have a base for HDU --- drawinglayer/source/attribute/lineattribute.cxx | 50 ++++++ .../source/attribute/linestartendattribute.cxx | 60 +++++++ drawinglayer/source/attribute/makefile.mk | 9 +- drawinglayer/source/attribute/sdrattribute.cxx | 6 +- drawinglayer/source/attribute/strokeattribute.cxx | 63 ++++++++ .../source/primitive2d/polygonprimitive2d.cxx | 176 ++++++++++++--------- .../source/primitive2d/polypolygonprimitive2d.cxx | 105 ++++++++++-- .../primitive2d/textdecoratedprimitive2d.cxx | 60 +++---- .../source/primitive2d/wrongspellprimitive2d.cxx | 10 +- .../source/primitive3d/polygonprimitive3d.cxx | 40 +++-- .../source/primitive3d/polygontubeprimitive3d.cxx | 26 +-- .../source/primitive3d/sdrdecompositiontools3d.cxx | 11 +- .../source/processor2d/vclhelperbufferdevice.cxx | 11 +- .../source/processor2d/vclmetafileprocessor2d.cxx | 41 ++--- 14 files changed, 486 insertions(+), 182 deletions(-) create mode 100644 drawinglayer/source/attribute/lineattribute.cxx create mode 100644 drawinglayer/source/attribute/linestartendattribute.cxx create mode 100644 drawinglayer/source/attribute/strokeattribute.cxx (limited to 'drawinglayer/source') 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 +#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 +#endif + +#ifndef _BGFX_POLYGON_B2DPOLYGON_HXX +#include +#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 +#endif + +#include + +////////////////////////////////////////////////////////////////////////////// + +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. @@ -79,6 +79,66 @@ using namespace com::sun::star; ////////////////////////////////////////////////////////////////////////////// +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 @@ -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 #endif -#include - ////////////////////////////////////////////////////////////////////////////// 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())); -- cgit