drawinglayer/source/primitive2d/borderlineprimitive2d.cxx | 16 +-- drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx | 5 - include/drawinglayer/primitive2d/borderlineprimitive2d.hxx | 6 + include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx | 3 include/svx/framelink.hxx | 23 +--- svx/source/dialog/framelink.cxx | 49 +++++++++- 6 files changed, 74 insertions(+), 28 deletions(-)
New commits: commit d5583a9e6752f7f7ab2e95856073931d3e58211e Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Jan 15 15:29:01 2014 -0500 Use this pattern scale to scale things for better line pattern generation. This works much better across different output devices. Change-Id: Ie89e7284d9063f98fc5a31c505b64f8ce99a7ce1 diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index b389f6a..fc99399 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -133,7 +133,6 @@ namespace drawinglayer basegfx::B2DVector aVector(getEnd() - getStart()); aVector.normalize(); const basegfx::B2DVector aPerpendicular(basegfx::getPerpendicular(aVector)); - basegfx::B2DVector aScale = rViewInformation.getInverseObjectToViewTransformation() * aVector; const basegfx::B2DPolyPolygon& aClipRegion = getClipPolygon(rViewInformation); @@ -161,7 +160,7 @@ namespace drawinglayer aPolygon.append( getEnd() ); basegfx::B2DPolygon aPolygon2 = aPolygon; - double fGap = (mfDistance/mfLeftWidth) * aScale.getLength(); + double fGap = (mfDistance/mfLeftWidth) * mfPatternScale * 10.0; moveLine(aPolygon2, fGap, aVector); xRetval.realloc(2); @@ -191,7 +190,7 @@ namespace drawinglayer aPolygon = aClipped.getB2DPolygon(0); basegfx::B2DPolygon aPolygon2 = aPolygon; - double fGap = (mfDistance/mfLeftWidth + aVector.getLength()) * aScale.getLength(); + double fGap = (mfDistance/mfLeftWidth + aVector.getLength()) * mfPatternScale * 10.0; moveLine(aPolygon2, fGap, aVector); xRetval.realloc(2); @@ -243,7 +242,7 @@ namespace drawinglayer aPolygon.append( aTmpEnd ); basegfx::B2DPolyPolygon aDashed = svtools::ApplyLineDashing( - aPolygon, getStyle(), MAP_PIXEL, aScale.getLength() ); + aPolygon, getStyle(), MAP_PIXEL, mfPatternScale*10.0); for (sal_uInt32 i = 0; i < aDashed.count(); i++ ) { basegfx::B2DPolygon aDash = aDashed.getB2DPolygon( i ); commit 3510cd66b2d86900870d579502221584e0b26df0 Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Jan 15 15:18:37 2014 -0500 Pass scaling to borderline primitive objects. This will be used when generating line patterns. Change-Id: I2fa0298bd3e34df1cb304d9be41e471835484d83 diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx index 381dc79..b389f6a 100644 --- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx @@ -307,7 +307,8 @@ namespace drawinglayer const basegfx::BColor& rRGBColorLeft, const basegfx::BColor& rRGBColorGap, bool bHasGapColor, - const short nStyle) + const short nStyle, + double fPatternScale) : BufferedDecompositionPrimitive2D(), maStart(rStart), maEnd(rEnd), @@ -322,7 +323,8 @@ namespace drawinglayer maRGBColorLeft(rRGBColorLeft), maRGBColorGap(rRGBColorGap), mbHasGapColor(bHasGapColor), - mnStyle(nStyle) + mnStyle(nStyle), + mfPatternScale(fPatternScale) { } @@ -345,7 +347,8 @@ namespace drawinglayer && getRGBColorLeft() == rCompare.getRGBColorLeft() && getRGBColorGap() == rCompare.getRGBColorGap() && hasGapColor() == rCompare.hasGapColor() - && getStyle() == rCompare.getStyle()); + && getStyle() == rCompare.getStyle() + && getPatternScale() == rCompare.getPatternScale()); } return false; diff --git a/drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx index 2bfcd8c..895c06e 100644 --- a/drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/clippedborderlineprimitive2d.cxx @@ -33,10 +33,11 @@ namespace drawinglayer const basegfx::BColor& rRGBColorLeft, const basegfx::BColor& rRGBColorGap, bool bHasGapColor, - const short nStyle) + const short nStyle, + double fPatternScale) : BorderLinePrimitive2D( rStart, rEnd, fLeftWidth,fDistance, fRightWidth, 0.0, 0.0, 0.0, 0.0, rRGBColorRight, rRGBColorLeft, - rRGBColorGap, bHasGapColor, nStyle), + rRGBColorGap, bHasGapColor, nStyle, fPatternScale), maIntersection( rIntersection ) { } diff --git a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx index 3e85b3a..9726dcd 100644 --- a/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/borderlineprimitive2d.hxx @@ -69,6 +69,8 @@ namespace drawinglayer short mnStyle; + double mfPatternScale; + /// local helpers double getWidth( const geometry::ViewInformation2D& rViewInformation) const; @@ -111,7 +113,8 @@ namespace drawinglayer const basegfx::BColor& rRGBColorLeft, const basegfx::BColor& rRGBColorGap, bool bHasGapColor, - const short nStyle ); + const short nStyle, + double fPatternScale = 1.0 ); /// data read access const basegfx::B2DPoint& getStart() const { return maStart; } @@ -128,6 +131,7 @@ namespace drawinglayer const basegfx::BColor& getRGBColorGap () const { return maRGBColorGap; } bool hasGapColor( ) const { return mbHasGapColor; } short getStyle () const { return mnStyle; } + double getPatternScale() const { return mfPatternScale; } /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx b/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx index a2e2194..aaa2095 100644 --- a/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/clippedborderlineprimitive2d.hxx @@ -46,7 +46,8 @@ namespace drawinglayer const basegfx::BColor& rRGBColorLeft, const basegfx::BColor& rRGBColorGap, bool bHasGapColor, - const short nStyle ); + const short nStyle, + double fPatternScale = 1.0 ); /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const; diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx index ebdc010..afae83e 100644 --- a/include/svx/framelink.hxx +++ b/include/svx/framelink.hxx @@ -127,6 +127,7 @@ public: inline double Prim() const { return mnPrim; } inline double Dist() const { return mnDist; } inline double Secn() const { return mnSecn; } + double Scale() const; inline editeng::SvxBorderStyle Type() const { return mnType; } /** Returns the total width of this frame style. */ @@ -167,6 +168,7 @@ private: double mnPrim; /// Width of primary (single, left, or top) line. double mnDist; /// Distance between primary and secondary line. double mnSecn; /// Width of secondary (right or bottom) line. + double mfScale; editeng::SvxBorderStyle mnType; }; diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx index 93e16a0..8268374 100644 --- a/svx/source/dialog/framelink.cxx +++ b/svx/source/dialog/framelink.cxx @@ -1124,13 +1124,18 @@ void lclDrawDiagFrameBorders( #define SCALEVALUE( value ) lclScaleValue( value, fScale, nMaxWidth ) -Style::Style() - : meRefMode( REFMODE_CENTERED ) - , mnType( ::com::sun::star::table::BorderLineStyle::SOLID ) -{ Clear(); } +Style::Style() : + meRefMode(REFMODE_CENTERED), + mfScale(1.0), + mnType(table::BorderLineStyle::SOLID) +{ + Clear(); +} Style::Style( double nP, double nD, double nS, editeng::SvxBorderStyle nType ) : - meRefMode( REFMODE_CENTERED ), mnType( nType ) + meRefMode(REFMODE_CENTERED), + mfScale(1.0), + mnType(nType) { Clear(); Set( nP, nD, nS ); @@ -1138,23 +1143,32 @@ Style::Style( double nP, double nD, double nS, editeng::SvxBorderStyle nType ) : Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, double nP, double nD, double nS, editeng::SvxBorderStyle nType ) : - meRefMode( REFMODE_CENTERED ), mnType( nType ) + meRefMode(REFMODE_CENTERED), + mfScale(1.0), + mnType(nType) { Set( rColorPrim, rColorSecn, rColorGap, bUseGapColor, nP, nD, nS ); } Style::Style( const editeng::SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWidth ) : - meRefMode( REFMODE_CENTERED ) + meRefMode(REFMODE_CENTERED), + mfScale(fScale) { Set( rBorder, fScale, nMaxWidth ); } Style::Style( const editeng::SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWidth ) : - meRefMode( REFMODE_CENTERED ) + meRefMode(REFMODE_CENTERED), + mfScale(fScale) { Set( pBorder, fScale, nMaxWidth ); } +double Style::Scale() const +{ + return mfScale; +} + void Style::Clear() { Set( Color(), Color(), Color(), false, 0, 0, 0 ); @@ -1415,7 +1429,7 @@ drawinglayer::primitive2d::Primitive2DSequence CreateClippedBorderPrimitives ( rBorder.GetColorSecn().getBColor(), rBorder.GetColorPrim().getBColor(), rBorder.GetColorGap().getBColor(), - rBorder.UseGapColor(), rBorder.Type() ); + rBorder.UseGapColor(), rBorder.Type(), rBorder.Scale() ); return aSequence; } @@ -1443,7 +1457,7 @@ drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives( rBorder.GetColorSecn().getBColor(), rBorder.GetColorPrim().getBColor(), rBorder.GetColorGap().getBColor(), - rBorder.UseGapColor(), rBorder.Type() ); + rBorder.UseGapColor(), rBorder.Type(), rBorder.Scale() ); return aSequence; } commit d73a8b72cc2216568c1c86f7c070acf41c889d1b Author: Kohei Yoshida <kohei.yosh...@collabora.com> Date: Wed Jan 15 14:42:32 2014 -0500 Make thse constructors non-inline. Change-Id: Iaf23a9962c9dd748247cb986ffabb1a5ba173c09 diff --git a/include/svx/framelink.hxx b/include/svx/framelink.hxx index 952d66e..ebdc010 100644 --- a/include/svx/framelink.hxx +++ b/include/svx/framelink.hxx @@ -108,25 +108,16 @@ class SVX_DLLPUBLIC Style { public: /** Constructs an invisible frame style. */ - inline explicit Style() - : meRefMode( REFMODE_CENTERED ) - , mnType( ::com::sun::star::table::BorderLineStyle::SOLID ) - { Clear(); } + explicit Style(); /** Constructs a frame style with passed line widths. */ - inline explicit Style( double nP, double nD, double nS, editeng::SvxBorderStyle nType ) : - meRefMode( REFMODE_CENTERED ), mnType( nType ) - { Clear(); Set( nP, nD, nS ); } + explicit Style( double nP, double nD, double nS, editeng::SvxBorderStyle nType ); /** Constructs a frame style with passed color and line widths. */ - inline explicit Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, - double nP, double nD, double nS, editeng::SvxBorderStyle nType ) : - meRefMode( REFMODE_CENTERED ), mnType( nType ) - { Set( rColorPrim, rColorSecn, rColorGap, bUseGapColor, nP, nD, nS ); } + explicit Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, + double nP, double nD, double nS, editeng::SvxBorderStyle nType ); /** Constructs a frame style from the passed SvxBorderLine struct. */ - inline explicit Style( const editeng::SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ) : - meRefMode( REFMODE_CENTERED ) { Set( rBorder, fScale, nMaxWidth ); } + explicit Style( const editeng::SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ); /** Constructs a frame style from the passed SvxBorderLine struct. Clears the style, if pBorder is 0. */ - inline explicit Style( const editeng::SvxBorderLine* pBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ) : - meRefMode( REFMODE_CENTERED ) { Set( pBorder, fScale, nMaxWidth ); } + explicit Style( const editeng::SvxBorderLine* pBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ); inline RefMode GetRefMode() const { return meRefMode; } inline const Color& GetColorPrim() const { return maColorPrim; } diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx index 20fdd3f..93e16a0 100644 --- a/svx/source/dialog/framelink.cxx +++ b/svx/source/dialog/framelink.cxx @@ -1124,6 +1124,37 @@ void lclDrawDiagFrameBorders( #define SCALEVALUE( value ) lclScaleValue( value, fScale, nMaxWidth ) +Style::Style() + : meRefMode( REFMODE_CENTERED ) + , mnType( ::com::sun::star::table::BorderLineStyle::SOLID ) +{ Clear(); } + +Style::Style( double nP, double nD, double nS, editeng::SvxBorderStyle nType ) : + meRefMode( REFMODE_CENTERED ), mnType( nType ) +{ + Clear(); + Set( nP, nD, nS ); +} + +Style::Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, + double nP, double nD, double nS, editeng::SvxBorderStyle nType ) : + meRefMode( REFMODE_CENTERED ), mnType( nType ) +{ + Set( rColorPrim, rColorSecn, rColorGap, bUseGapColor, nP, nD, nS ); +} + +Style::Style( const editeng::SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWidth ) : + meRefMode( REFMODE_CENTERED ) +{ + Set( rBorder, fScale, nMaxWidth ); +} + +Style::Style( const editeng::SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWidth ) : + meRefMode( REFMODE_CENTERED ) +{ + Set( pBorder, fScale, nMaxWidth ); +} + void Style::Clear() { Set( Color(), Color(), Color(), false, 0, 0, 0 ); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits