diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-10-06 23:54:04 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-10-06 23:58:10 +0200 |
commit | 7db30f7aa037f52eb07cbb4fd2796bd869204af8 (patch) | |
tree | 655824d944ee2f6303810052479da12a0ed8341a /drawinglayer | |
parent | 46247f7f126a5b9ff74ad0a160291123f12eb7ce (diff) |
fate#307731, fate#307730: Adds dotted and dashed border lines
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx | 7 | ||||
-rw-r--r-- | drawinglayer/source/primitive2d/borderlineprimitive2d.cxx | 35 |
2 files changed, 32 insertions, 10 deletions
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx index cbad5fc40afc..9e0ccece083c 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -66,6 +66,7 @@ namespace drawinglayer /// the line color basegfx::BColor maRGBColor; + short mnStyle; /// bitfield /// flags to influence inside/outside creation @@ -131,7 +132,8 @@ namespace drawinglayer double fExtendOuterEnd, bool bCreateInside, bool bCreateOutside, - const basegfx::BColor& rRGBColor); + const basegfx::BColor& rRGBColor, + const short nStyle ); /// data read access const basegfx::B2DPoint& getStart() const { return maStart; } @@ -145,7 +147,8 @@ namespace drawinglayer double getExtendOuterEnd() const { return mfExtendOuterEnd; } bool getCreateInside() const { return mbCreateInside; } bool getCreateOutside() const { return mbCreateOutside; } - const basegfx::BColor& getRGBColor() const { return maRGBColor; } + const basegfx::BColor& getRGBColor () const { return maRGBColor; } + short getStyle () const { return mnStyle; } /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index 86c2ef1db123..6ef1852008b0 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -33,6 +33,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> +#include <svtools/borderhelper.hxx> #include <numeric> ////////////////////////////////////////////////////////////////////////////// @@ -157,14 +158,29 @@ namespace drawinglayer // create filled polygon primitive const basegfx::B2DVector aLineWidthOffset((getCorrectedLeftWidth() * 0.5) * aPerpendicular); - aPolygon.append(aTmpStart + aLineWidthOffset); - aPolygon.append(aTmpEnd + aLineWidthOffset); - aPolygon.append(aTmpEnd - aLineWidthOffset); - aPolygon.append(aTmpStart - aLineWidthOffset); - aPolygon.setClosed(true); + aPolygon.append( aTmpStart ); + aPolygon.append( aTmpEnd ); + + basegfx::B2DPolyPolygon aDashed = svtools::ApplyLineDashing( + aPolygon, getStyle(), MAP_100TH_MM ); + for (sal_uInt32 i = 0; i < aDashed.count(); i++ ) + { + basegfx::B2DPolygon aDash = aDashed.getB2DPolygon( i ); + basegfx::B2DPoint aDashStart = aDash.getB2DPoint( 0 ); + basegfx::B2DPoint aDashEnd = aDash.getB2DPoint( aDash.count() - 1 ); + + basegfx::B2DPolygon aDashPolygon; + aDashPolygon.append( aDashStart + aLineWidthOffset ); + aDashPolygon.append( aDashEnd + aLineWidthOffset ); + aDashPolygon.append( aDashEnd - aLineWidthOffset ); + aDashPolygon.append( aDashStart - aLineWidthOffset ); + aDashPolygon.setClosed( true ); + + aDashed.setB2DPolygon( i, aDashPolygon ); + } xRetval[0] = Primitive2DReference(new PolyPolygonColorPrimitive2D( - basegfx::B2DPolyPolygon(aPolygon), getRGBColor())); + basegfx::B2DPolyPolygon( aDashed ), getRGBColor())); } } } @@ -185,7 +201,8 @@ namespace drawinglayer double fExtendOuterEnd, bool bCreateInside, bool bCreateOutside, - const basegfx::BColor& rRGBColor) + const basegfx::BColor& rRGBColor, + const short nStyle) : BufferedDecompositionPrimitive2D(), maStart(rStart), maEnd(rEnd), @@ -197,6 +214,7 @@ namespace drawinglayer mfExtendOuterStart(fExtendOuterStart), mfExtendOuterEnd(fExtendOuterEnd), maRGBColor(rRGBColor), + mnStyle(nStyle), mbCreateInside(bCreateInside), mbCreateOutside(bCreateOutside) { @@ -219,7 +237,8 @@ namespace drawinglayer && getExtendOuterEnd() == rCompare.getExtendOuterEnd() && getCreateInside() == rCompare.getCreateInside() && getCreateOutside() == rCompare.getCreateOutside() - && getRGBColor() == rCompare.getRGBColor()); + && getRGBColor() == rCompare.getRGBColor() + && getStyle() == rCompare.getStyle()); } return false; |