diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-11-06 19:23:59 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-03-19 17:57:15 +0100 |
commit | 83e1130832dfb5a55b3e8e1cc17bb49dd60a865f (patch) | |
tree | 53ee1be88da1171cd51ceb4c38c52654308d3949 /svx | |
parent | 718cd07930ee523e9c2943fe8de7a14d296a1a8a (diff) |
Nicely draw borders using drawinglayer
Diffstat (limited to 'svx')
-rwxr-xr-x | svx/inc/svx/framelink.hxx | 55 | ||||
-rwxr-xr-x | svx/inc/svx/sdr/contact/objectcontacttools.hxx | 3 | ||||
-rwxr-xr-x | svx/source/dialog/framelink.cxx | 198 | ||||
-rwxr-xr-x | svx/source/dialog/frmsel.cxx | 28 | ||||
-rwxr-xr-x | svx/source/inc/frmselimpl.hxx | 4 | ||||
-rwxr-xr-x | svx/source/table/svdotable.cxx | 6 | ||||
-rwxr-xr-x | svx/source/table/viewcontactoftableobj.cxx | 208 |
7 files changed, 337 insertions, 165 deletions
diff --git a/svx/inc/svx/framelink.hxx b/svx/inc/svx/framelink.hxx index 17b5fcb89d8c..6cfc8f0f7a2e 100755 --- a/svx/inc/svx/framelink.hxx +++ b/svx/inc/svx/framelink.hxx @@ -37,6 +37,8 @@ #include <vcl/outdev.hxx> #include <editeng/borderline.hxx> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + class OutputDevice; namespace svx { @@ -114,15 +116,16 @@ class SVX_DLLPUBLIC Style { public: /** Constructs an invisible frame style. */ - inline explicit Style() : meRefMode( REFMODE_CENTERED ), mnPrim( 0 ), mnDist( 0 ), mnSecn( 0 ), mnDashing( SOLID ) {} + inline explicit Style() : meRefMode( REFMODE_CENTERED ), mnPrim( 0 ), mnDist( 0 ), mnSecn( 0 ), mnType( SOLID ) {} /** Constructs a frame style with passed line widths. */ - inline explicit Style( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ) : - meRefMode( REFMODE_CENTERED ), mnDashing( SOLID ) + inline explicit Style( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS, SvxBorderStyle nType ) : + meRefMode( REFMODE_CENTERED ), mnType( nType ) { Set( nP, nD, nS ); } /** Constructs a frame style with passed color and line widths. */ - inline explicit Style( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS, SvxBorderStyle nDashing = SOLID ) : - meRefMode( REFMODE_CENTERED ), mnDashing( nDashing ) - { Set( rColor, nP, nD, nS ); } + inline explicit Style( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, + sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS, SvxBorderStyle nType ) : + meRefMode( REFMODE_CENTERED ), mnType( nType ) + { Set( rColorPrim, rColorSecn, rColorGap, bUseGapColor, nP, nD, nS ); } /** Constructs a frame style from the passed SvxBorderLine struct. */ inline explicit Style( const SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ) : meRefMode( REFMODE_CENTERED ) { Set( rBorder, fScale, nMaxWidth ); } @@ -131,22 +134,25 @@ public: meRefMode( REFMODE_CENTERED ) { Set( pBorder, fScale, nMaxWidth ); } inline RefMode GetRefMode() const { return meRefMode; } - inline const Color& GetColor() const { return maColor; } + inline const Color& GetColorPrim() const { return maColorPrim; } + inline const Color& GetColorSecn() const { return maColorSecn; } + inline const Color& GetColorGap() const { return maColorGap; } + inline bool UseGapColor() const { return mbUseGapColor; } inline sal_uInt16 Prim() const { return mnPrim; } inline sal_uInt16 Dist() const { return mnDist; } inline sal_uInt16 Secn() const { return mnSecn; } - inline SvxBorderStyle Dashing() const { return mnDashing; } + inline SvxBorderStyle Type() const { return mnType; } /** Returns the total width of this frame style. */ inline sal_uInt16 GetWidth() const { return mnPrim + mnDist + mnSecn; } - /** Sets the frame style to invisible state. */ void Clear(); /** Sets the frame style to the passed line widths. */ void Set( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ); /** Sets the frame style to the passed line widths. */ - void Set( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ); + void Set( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, + sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ); /** Sets the frame style to the passed SvxBorderLine struct. */ void Set( const SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ); /** Sets the frame style to the passed SvxBorderLine struct. Clears the style, if pBorder is 0. */ @@ -155,9 +161,11 @@ public: /** Sets a new reference point handling mode, does not modify other settings. */ inline void SetRefMode( RefMode eRefMode ) { meRefMode = eRefMode; } /** Sets a new color, does not modify other settings. */ - inline void SetColor( const Color& rColor ) { maColor = rColor; } + inline void SetColorPrim( const Color& rColor ) { maColorPrim = rColor; } + inline void SetColorSecn( const Color& rColor ) { maColorSecn = rColor; } + inline void SetColorGap( bool bUseIt, const Color& rColor ) { maColorGap = rColor; mbUseGapColor = bUseIt; } /** Sets whether to use dotted style for single hair lines. */ - inline void SetDashing( SvxBorderStyle nDashing ) { mnDashing = nDashing; } + inline void SetType( SvxBorderStyle nType ) { mnType = nType; } /** Scales the style by the specified scaling factor. Ensures that visible lines keep visible. */ Style& ScaleSelf( double fScale, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ); @@ -170,12 +178,15 @@ public: Style Mirror() const; private: - Color maColor; /// The color of the line(s) of this frame border. + Color maColorPrim; + Color maColorSecn; + Color maColorGap; + bool mbUseGapColor; RefMode meRefMode; /// Reference point handling for this frame border. sal_uInt16 mnPrim; /// Width of primary (single, left, or top) line. sal_uInt16 mnDist; /// Distance between primary and secondary line. sal_uInt16 mnSecn; /// Width of secondary (right or bottom) line. - SvxBorderStyle mnDashing; + SvxBorderStyle mnType; }; bool operator==( const Style& rL, const Style& rR ); @@ -450,6 +461,22 @@ SVX_DLLPUBLIC bool CheckFrameBorderConnectable( // Drawing functions // ============================================================================ +SVX_DLLPUBLIC drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives( + const Point& rLPos, /// Reference point for left end of the processed frame border. + const Point& rRPos, /// Reference point for right end of the processed frame border. + const Style& rBorder, /// Style of the processed frame border. + + const Style& rLFromT, /// Vertical frame border from top to left end of rBorder. + const Style& rLFromL, /// Horizontal frame border from left to left end of rBorder. + const Style& rLFromB, /// Vertical frame border from bottom to left end of rBorder. + + const Style& rRFromT, /// Vertical frame border from top to right end of rBorder. + const Style& rRFromR, /// Horizontal frame border from right to right end of rBorder. + const Style& rRFromB, /// Vertical frame border from bottom to right end of rBorder. + + const Color* pForceColor = 0 /// If specified, overrides frame border color. +); + /** Draws a horizontal frame border, regards all connected frame styles. The frame style to draw is passed as parameter rBorder. The function diff --git a/svx/inc/svx/sdr/contact/objectcontacttools.hxx b/svx/inc/svx/sdr/contact/objectcontacttools.hxx index efa8c1911869..83f704004555 100755 --- a/svx/inc/svx/sdr/contact/objectcontacttools.hxx +++ b/svx/inc/svx/sdr/contact/objectcontacttools.hxx @@ -30,6 +30,7 @@ #define _SDR_CONTACT_OBJECTCONTACTTOOLS_HXX #include <drawinglayer/geometry/viewinformation2d.hxx> +#include "svx/svxdllapi.h" ////////////////////////////////////////////////////////////////////////////// // predeclarations @@ -49,7 +50,7 @@ namespace sdr // create a mating VCL-Provessor for given OutputDevice. This includes // looking for MetaFile-recording. The returned renderer changes owner, // deletion is duty of the caller - drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice( + SVX_DLLPUBLIC drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice( OutputDevice& rTargetOutDev, const drawinglayer::geometry::ViewInformation2D& rViewInformation2D); diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx index e9ae076dde1f..35758d713648 100755 --- a/svx/source/dialog/framelink.cxx +++ b/svx/source/dialog/framelink.cxx @@ -55,6 +55,8 @@ #include <basegfx/polygon/b2dpolygontools.hxx> #endif +#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx> + namespace svx { namespace frame { @@ -133,8 +135,9 @@ struct BorderEndResult { LineEndResult maPrim; /// Result for primary line. LineEndResult maSecn; /// Result for secondary line. + LineEndResult maGap; /// Result for gap line. - inline void Negate() { maPrim.Negate(); maSecn.Negate(); } + inline void Negate() { maPrim.Negate(); maSecn.Negate(); maGap.Negate(); } }; /** Result struct used by the horizontal/vertical frame link functions. @@ -260,7 +263,6 @@ sal_uInt16 lclScaleValue( long nValue, double fScale, sal_uInt16 nMaxWidth ) | |<- middle of the frame border - lclGetDistEnd() ->||<- lclGetSecnBeg() || lclGetBeg() ->| lclGetDistBeg() ->| || |<- lclGetEnd() @@ -510,6 +512,23 @@ void lclLinkLeftEnd_Secn( rResult.Swap(); } +void lclLinkLeftEnd_Gap( + LineEndResult& rResult, const Style& rBorder, + const DiagStyle& /*rLFromTR*/, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& /*rLFromBR*/ ) + +{ + if ( rLFromT.Secn() ) + rResult.mnOffs1 = lclGetDistBeg( rLFromT ); + else if ( rLFromL.Secn( ) ) + rResult.mnOffs1 = ( rLFromL.GetWidth() == rBorder.GetWidth() )? + 0 : lclGetBehindEnd( rLFromT ); + else if ( rLFromB.Secn( ) ) + rResult.mnOffs1 = lclGetDistBeg( rLFromB ); + else + rResult.mnOffs1 = std::max( lclGetBehindEnd( rLFromT ), lclGetBehindEnd( rLFromB ) ); + + rResult.mnOffs2 = rResult.mnOffs1; +} // ---------------------------------------------------------------------------- // Linking of horizontal frame border ends. @@ -531,6 +550,7 @@ void lclLinkLeftEnd( // current frame border is double lclLinkLeftEnd_Prim( rResult.maPrim, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR ); lclLinkLeftEnd_Secn( rResult.maSecn, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR ); + lclLinkLeftEnd_Gap( rResult.maGap, rBorder, rLFromTR, rLFromT, rLFromL, rLFromB, rLFromBR ); } else if( rBorder.Prim() ) { @@ -756,11 +776,11 @@ Polygon lclCreatePolygon( const Point& rP1, const Point& rP2, const Point& rP3, @param rStyle The border style that contains the line color to be set to the device. */ -void lclSetColorToOutDev( OutputDevice& rDev, const Style& rStyle, const Color* pForceColor ) +void lclSetColorToOutDev( OutputDevice& rDev, const Color& rColor, const Color* pForceColor ) { rDev.Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); - rDev.SetLineColor( pForceColor ? *pForceColor : rStyle.GetColor() ); - rDev.SetFillColor( pForceColor ? *pForceColor : rStyle.GetColor() ); + rDev.SetLineColor( pForceColor ? *pForceColor : rColor ); + rDev.SetFillColor( pForceColor ? *pForceColor : rColor ); } // ---------------------------------------------------------------------------- @@ -811,13 +831,26 @@ void lclDrawHorFrameBorder( DBG_ASSERT( rLPos.Y() == rRPos.Y(), "svx::frame::lclDrawHorFrameBorder - line not horizontal" ); if( rLPos.X() <= rRPos.X() ) { - lclSetColorToOutDev( rDev, rBorder, pForceColor ); + if ( rBorder.UseGapColor( ) ) + { + lclSetColorToOutDev( rDev, rBorder.GetColorGap(), pForceColor ); + lclDrawHorLine( rDev, rLPos, rResult.maBeg.maGap, rRPos, rResult.maEnd.maGap, + lclGetPrimEnd( rBorder ), lclGetSecnBeg( rBorder ), rBorder.Type() ); + rDev.Pop(); // Gap color + } + + lclSetColorToOutDev( rDev, rBorder.GetColorPrim(), pForceColor ); lclDrawHorLine( rDev, rLPos, rResult.maBeg.maPrim, rRPos, rResult.maEnd.maPrim, - lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dashing() ); + lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Type() ); + rDev.Pop(); // colors + if( rBorder.Secn() ) + { + lclSetColorToOutDev( rDev, rBorder.GetColorSecn(), pForceColor ); lclDrawHorLine( rDev, rLPos, rResult.maBeg.maSecn, rRPos, rResult.maEnd.maSecn, - lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dashing() ); - rDev.Pop(); // colors + lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Type() ); + rDev.Pop(); // colors + } } } @@ -868,13 +901,25 @@ void lclDrawVerFrameBorder( DBG_ASSERT( rTPos.X() == rBPos.X(), "svx::frame::lclDrawVerFrameBorder - line not vertical" ); if( rTPos.Y() <= rBPos.Y() ) { - lclSetColorToOutDev( rDev, rBorder, pForceColor ); + if ( rBorder.UseGapColor( ) ) + { + lclSetColorToOutDev( rDev, rBorder.GetColorGap(), pForceColor ); + lclDrawVerLine( rDev, rTPos, rResult.maBeg.maGap, rBPos, rResult.maEnd.maGap, + lclGetPrimEnd( rBorder ), lclGetSecnBeg( rBorder ), rBorder.Type() ); + rDev.Pop(); // Gap color + } + + lclSetColorToOutDev( rDev, rBorder.GetColorPrim(), pForceColor ); lclDrawVerLine( rDev, rTPos, rResult.maBeg.maPrim, rBPos, rResult.maEnd.maPrim, - lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dashing() ); + lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Type() ); + rDev.Pop(); // colors if( rBorder.Secn() ) + { + lclSetColorToOutDev( rDev, rBorder.GetColorSecn(), pForceColor ); lclDrawVerLine( rDev, rTPos, rResult.maBeg.maSecn, rBPos, rResult.maEnd.maSecn, - lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dashing() ); - rDev.Pop(); // colors + lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Type() ); + rDev.Pop(); // colors + } } } @@ -1049,11 +1094,22 @@ void lclDrawDiagFrameBorder( if( bClip ) lclPushCrossingClipRegion( rDev, rRect, bTLBR, rCrossStyle ); - lclSetColorToOutDev( rDev, rBorder, pForceColor ); - lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maPrim, lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dashing() ); - if( rBorder.Secn() ) - lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maSecn, lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dashing() ); + lclSetColorToOutDev( rDev, rBorder.GetColorPrim(), pForceColor ); + lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maPrim, lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Type() ); rDev.Pop(); // colors + if( rBorder.Secn() ) + { + if ( rBorder.UseGapColor( ) ) + { + lclSetColorToOutDev( rDev, rBorder.GetColorGap(), pForceColor ); + lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maSecn, lclGetDistBeg( rBorder ), lclGetDistEnd( rBorder ), rBorder.Type() ); + rDev.Pop(); // colors + } + + lclSetColorToOutDev( rDev, rBorder.GetColorSecn(), pForceColor ); + lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maSecn, lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Type() ); + rDev.Pop(); // colors + } if( bClip ) rDev.Pop(); // clipping region @@ -1106,7 +1162,7 @@ void lclDrawDiagFrameBorders( void Style::Clear() { - Set( Color(), 0, 0, 0 ); + Set( Color(), Color(), Color(), false, 0, 0, 0 ); } void Style::Set( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ) @@ -1123,29 +1179,34 @@ void Style::Set( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ) mnSecn = (nP && nD) ? nS : 0; } -void Style::Set( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ) +void Style::Set( const Color& rColorPrim, const Color& rColorSecn, const Color& rColorGap, bool bUseGapColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ) { - maColor = rColor; + maColorPrim = rColorPrim; + maColorSecn = rColorSecn; + maColorGap = rColorGap; + mbUseGapColor = bUseGapColor; Set( nP, nD, nS ); } void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWidth ) { - maColor = rBorder.GetColor(); + maColorPrim = rBorder.GetColorOut(); + maColorSecn = rBorder.GetColorIn(); + maColorGap = rBorder.GetColorGap(); + mbUseGapColor = rBorder.HasGapColor(); sal_uInt16 nPrim = rBorder.GetOutWidth(); sal_uInt16 nDist = rBorder.GetDistance(); sal_uInt16 nSecn = rBorder.GetInWidth(); + mnType = rBorder.GetStyle(); if( !nSecn ) // no or single frame border { Set( SCALEVALUE( nPrim ), 0, 0 ); - mnDashing = rBorder.GetStyle(); } else { Set( SCALEVALUE( nPrim ), SCALEVALUE( nDist ), SCALEVALUE( nSecn ) ); - mnDashing = SOLID; // Enlarge the style if distance is too small due to rounding losses. sal_uInt16 nPixWidth = SCALEVALUE( nPrim + nDist + nSecn ); if( nPixWidth > GetWidth() ) @@ -1185,7 +1246,7 @@ void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWid else { Clear(); - mnDashing = SOLID; + mnType = SOLID; } } @@ -1217,8 +1278,9 @@ Style Style::Mirror() const bool operator==( const Style& rL, const Style& rR ) { return (rL.Prim() == rR.Prim()) && (rL.Dist() == rR.Dist()) && (rL.Secn() == rR.Secn()) && - (rL.GetColor() == rR.GetColor()) && (rL.GetRefMode() == rR.GetRefMode()) && - (rL.Dashing() == rR.Dashing()); + (rL.GetColorPrim() == rR.GetColorPrim()) && (rL.GetColorSecn() == rR.GetColorSecn()) && + (rL.GetColorGap() == rR.GetColorGap()) && (rL.GetRefMode() == rR.GetRefMode()) && + (rL.UseGapColor() == rR.UseGapColor() ) && (rL.Type() == rR.Type()); } bool operator<( const Style& rL, const Style& rR ) @@ -1235,7 +1297,7 @@ bool operator<( const Style& rL, const Style& rR ) if( (rL.Secn() && rR.Secn()) && (rL.Dist() != rR.Dist()) ) return rL.Dist() > rR.Dist(); // both lines single and 1 unit thick, only one is dotted -> rL<rR, if rL is dotted - if( (nLW == 1) && (rL.Dashing() != rR.Dashing()) ) return rL.Dashing(); + if( (nLW == 1) && (rL.Type() != rR.Type()) ) return rL.Type(); // seem to be equal return false; @@ -1303,6 +1365,68 @@ bool CheckFrameBorderConnectable( const Style& rLBorder, const Style& rRBorder, // Drawing functions // ============================================================================ +double lcl_GetExtent( const Style& rSide, const Style& rOpposite ) +{ + double nExtent = 0.0; + + if ( rSide.Prim() + rSide.Secn() > 0 ) + nExtent = - rSide.GetWidth( ) / 2.0; + else + nExtent = rOpposite.GetWidth() / 2.0; + + return nExtent; +} + +drawinglayer::primitive2d::Primitive2DSequence CreateBorderPrimitives( + const Point& rLPos, const Point& rRPos, const Style& rBorder, + const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, + const Style& rRFromT, const Style& rRFromR, const Style& rRFromB, + const Color* pForceColor ) +{ + const DiagStyle aNoStyle; + drawinglayer::primitive2d::Primitive2DSequence aSequence( 1 ); + + basegfx::B2DPoint aStart( rLPos.getX(), rLPos.getY() ); + basegfx::B2DPoint aEnd( rRPos.getX(), rRPos.getY() ); + + // Compute the offset for the start and end points + basegfx::B2DVector aVector( aStart - aEnd ); + aVector.normalize(); + double nOffStart = rBorder.GetWidth() / 2.0; + double nOffEnd = rBorder.GetWidth() / 2.0; + if ( aVector.getY( ) == 1.0 && aVector.getX() == 0.0 ) + { + // Deal with vertical lines + sal_uInt16 nWS1 = ( rLFromT.GetWidth() == 0 ) ? -1 : rLFromT.GetWidth( ); + sal_uInt16 nWS2 = ( rLFromB.GetWidth() == 0 ) ? -1 : rLFromB.GetWidth( ); + nOffStart = std::min( nWS1, nWS2 ) / 2.0; + + sal_uInt16 nWE1 = ( rRFromT.GetWidth() == 0 ) ? -1 : rRFromT.GetWidth( ); + sal_uInt16 nWE2 = ( rRFromB.GetWidth() == 0 ) ? -1 : rRFromB.GetWidth( ); + nOffEnd = std::min( nWE1, nWE2 ) / 2.0; + } + + basegfx::B2DVector aOffsetV( 0.0, 1.0 ); + aStart = aStart + aOffsetV * nOffStart; + aEnd = aEnd + aOffsetV * nOffEnd; + + aSequence[0] = new drawinglayer::primitive2d::BorderLinePrimitive2D( + aStart, aEnd, + rBorder.Prim() + 1, + rBorder.Dist() + 1, + rBorder.Secn() + 1, + lcl_GetExtent( rLFromT, rLFromB ), + lcl_GetExtent( rRFromT, rRFromB ), + lcl_GetExtent( rLFromB, rLFromT ), + lcl_GetExtent( rRFromB, rRFromT ), + rBorder.GetColorSecn().getBColor(), + rBorder.GetColorPrim().getBColor(), + rBorder.GetColorGap().getBColor(), + rBorder.UseGapColor(), rBorder.Type() ); + + return aSequence; +} + void DrawHorFrameBorder( OutputDevice& rDev, const Point& rLPos, const Point& rRPos, const Style& rBorder, const DiagStyle& rLFromTR, const Style& rLFromT, const Style& rLFromL, const Style& rLFromB, const DiagStyle& rLFromBR, @@ -1400,13 +1524,25 @@ void DrawVerFrameBorderSlanted( OutputDevice& rDev, Style aScaled( rBorder ); aScaled.ScaleSelf( 1.0 / cos( GetVerDiagAngle( rTPos, rBPos ) ) ); - lclSetColorToOutDev( rDev, aScaled, pForceColor ); + lclSetColorToOutDev( rDev, aScaled.GetColorPrim(), pForceColor ); lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes, - lclGetBeg( aScaled ), lclGetPrimEnd( aScaled ), aScaled.Dashing() ); + lclGetBeg( aScaled ), lclGetPrimEnd( aScaled ), aScaled.Type() ); + rDev.Pop(); // colors if( aScaled.Secn() ) + { + if ( aScaled.UseGapColor( ) ) + { + lclSetColorToOutDev( rDev, aScaled.GetColorGap(), pForceColor ); + lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes, + lclGetDistBeg( aScaled ), lclGetDistEnd( aScaled ), aScaled.Type() ); + rDev.Pop(); // colors + } + + lclSetColorToOutDev( rDev, aScaled.GetColorSecn(), pForceColor ); lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes, - lclGetSecnBeg( aScaled ), lclGetEnd( aScaled ), aScaled.Dashing() ); - rDev.Pop(); // colors + lclGetSecnBeg( aScaled ), lclGetEnd( aScaled ), aScaled.Type() ); + rDev.Pop(); // colors + } } } } diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index bedb2cc61b9c..56ab07dad111 100755 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -84,7 +84,7 @@ const long FRAMESEL_GEOM_ADD_CLICK_INNER = 2; // ---------------------------------------------------------------------------- -static const frame::Style OBJ_FRAMESTYLE_DONTCARE( 3, 0, 0 ); +static const frame::Style OBJ_FRAMESTYLE_DONTCARE( 3, 0, 0, SOLID ); static const FrameBorder OBJ_FRAMEBORDER_NONE( FRAMEBORDER_NONE ); // ---------------------------------------------------------------------------- @@ -627,8 +627,10 @@ void FrameSelectorImpl::DrawAllFrameBorders() // Translate core colors to current UI colors (regards current background and HC mode). for( FrameBorderIter aIt( maEnabBorders ); aIt.Is(); ++aIt ) { - Color aCoreColor = ((*aIt)->GetState() == FRAMESTATE_DONTCARE) ? maMarkCol : (*aIt)->GetCoreStyle().GetColor(); - (*aIt)->SetUIColor( GetDrawLineColor( aCoreColor ) ); + Color aCoreColorPrim = ((*aIt)->GetState() == FRAMESTATE_DONTCARE) ? maMarkCol : (*aIt)->GetCoreStyle().GetColorOut(); + Color aCoreColorSecn = ((*aIt)->GetState() == FRAMESTATE_DONTCARE) ? maMarkCol : (*aIt)->GetCoreStyle().GetColorIn(); + (*aIt)->SetUIColorPrim( GetDrawLineColor( aCoreColorPrim ) ); + (*aIt)->SetUIColorSecn( GetDrawLineColor( aCoreColorSecn ) ); } // Copy all frame border styles to the helper array @@ -637,9 +639,11 @@ void FrameSelectorImpl::DrawAllFrameBorders() // Invert the style for the right line const frame::Style rRightStyle = maRight.GetUIStyle( ); - frame::Style rInvertedRight( rRightStyle.GetColor(), + frame::Style rInvertedRight( rRightStyle.GetColorPrim(), + rRightStyle.GetColorSecn(), rRightStyle.GetColorGap(), + rRightStyle.UseGapColor(), rRightStyle.Secn(), rRightStyle.Dist(), rRightStyle.Prim( ), - rRightStyle.Dashing( ) ); + rRightStyle.Type( ) ); maArray.SetColumnStyleRight( mbVer ? 1 : 0, rInvertedRight ); maArray.SetRowStyleTop( 0, maTop.GetUIStyle() ); @@ -647,17 +651,21 @@ void FrameSelectorImpl::DrawAllFrameBorders() { // Invert the style for the hor line to match the real borders const frame::Style rHorStyle = maHor.GetUIStyle(); - frame::Style rInvertedHor( rHorStyle.GetColor(), + frame::Style rInvertedHor( rHorStyle.GetColorPrim(), + rHorStyle.GetColorSecn(), rHorStyle.GetColorGap(), + rHorStyle.UseGapColor(), rHorStyle.Secn(), rHorStyle.Dist(), rHorStyle.Prim( ), - rHorStyle.Dashing() ); + rHorStyle.Type() ); maArray.SetRowStyleTop( 1, rInvertedHor ); } // Invert the style for the bottom line const frame::Style rBottomStyle = maBottom.GetUIStyle( ); - frame::Style rInvertedBottom( rBottomStyle.GetColor(), + frame::Style rInvertedBottom( rBottomStyle.GetColorPrim(), + rBottomStyle.GetColorSecn(), rBottomStyle.GetColorGap(), + rBottomStyle.UseGapColor(), rBottomStyle.Secn(), rBottomStyle.Dist(), rBottomStyle.Prim( ), - rBottomStyle.Dashing() ); + rBottomStyle.Type() ); maArray.SetRowStyleBottom( mbHor ? 1 : 0, rInvertedBottom ); for( size_t nCol = 0; nCol < maArray.GetColCount(); ++nCol ) @@ -962,7 +970,7 @@ void FrameSelector::SelectAllVisibleBorders( bool bSelect ) } void FrameSelector::SetStyleToSelection( sal_uInt16 nPrim, sal_uInt16 nDist, sal_uInt16 nSecn, - SvxBorderStyle nStyle ) + SvxBorderStyle nStyle ) { mxImpl->maCurrStyle.SetOutWidth( nPrim ); mxImpl->maCurrStyle.SetDistance( nDist ); diff --git a/svx/source/inc/frmselimpl.hxx b/svx/source/inc/frmselimpl.hxx index e40ad8482035..ab1c5d06c4e4 100755 --- a/svx/source/inc/frmselimpl.hxx +++ b/svx/source/inc/frmselimpl.hxx @@ -60,7 +60,9 @@ public: const SvxBorderLine& GetCoreStyle() const { return maCoreStyle; } void SetCoreStyle( const SvxBorderLine* pStyle ); - inline void SetUIColor( const Color& rColor ) {maUIStyle.SetColor( rColor ); } + inline void SetUIColorPrim( const Color& rColor ) {maUIStyle.SetColorPrim( rColor ); } + inline void SetUIColorSecn( const Color& rColor ) {maUIStyle.SetColorSecn( rColor ); } + inline void SetUIColorGap( bool bUseIt, const Color& rColor ) {maUIStyle.SetColorGap(bUseIt, rColor);} inline const frame::Style& GetUIStyle() const { return maUIStyle; } inline void ClearFocusArea() { maFocusArea.Clear(); } diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index b746de8aa849..84ee34be44b7 100755 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -1914,15 +1914,15 @@ void lcl_VertLine( OutputDevice& rDev, const Point& rTop, const Point& rBottom, svx::frame::Style aScaled( rLine ); aScaled.ScaleSelf( 1.0 / cos( svx::frame::GetVerDiagAngle( rTop, rBottom ) ) ); if( pForceColor ) - aScaled.SetColor( *pForceColor ); + aScaled.SetColorPrim( *pForceColor ); long nXOffs = (aScaled.GetWidth() - 1) / -2L; - lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColor(), + lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColorPrim(), nXOffs, aScaled.Prim(), rTopLine, rBottomLine ); if( aScaled.Secn() ) - lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColor(), + lcl_VertLineEnds( rDev, rTop, rBottom, aScaled.GetColorPrim(), nXOffs + aScaled.Prim() + aScaled.Dist(), aScaled.Secn(), rTopLine, rBottomLine ); } } diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 96c9db837488..4fe67a7af3dc 100755 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -171,6 +171,16 @@ namespace drawinglayer SvxBorderLine maRightLine; SvxBorderLine maTopLine; + // Neighbor cells' borders + SvxBorderLine maLeftFromTLine; + SvxBorderLine maLeftFromBLine; + SvxBorderLine maRightFromTLine; + SvxBorderLine maRightFromBLine; + SvxBorderLine maTopFromLLine; + SvxBorderLine maTopFromRLine; + SvxBorderLine maBottomFromLLine; + SvxBorderLine maBottomFromRLine; + // bitfield unsigned mbLeftIsOutside : 1; unsigned mbBottomIsOutside : 1; @@ -189,6 +199,14 @@ namespace drawinglayer const SvxBorderLine& rBottomLine, const SvxBorderLine& rRightLine, const SvxBorderLine& rTopLine, + const SvxBorderLine& rLeftFromTLine, + const SvxBorderLine& rLeftFromBLine, + const SvxBorderLine& rRightFromTLine, + const SvxBorderLine& rRightFromBLine, + const SvxBorderLine& rTopFromLLine, + const SvxBorderLine& rTopFromRLine, + const SvxBorderLine& rBottomFromLLine, + const SvxBorderLine& rBottomFromRLine, bool bLeftIsOutside, bool bBottomIsOutside, bool bRightIsOutside, @@ -200,6 +218,14 @@ namespace drawinglayer maBottomLine(rBottomLine), maRightLine(rRightLine), maTopLine(rTopLine), + maLeftFromTLine(rLeftFromTLine), + maLeftFromBLine(rLeftFromBLine), + maRightFromTLine(rRightFromTLine), + maRightFromBLine(rRightFromBLine), + maTopFromLLine(rTopFromLLine), + maTopFromRLine(rTopFromRLine), + maBottomFromLLine(rBottomFromLLine), + maBottomFromRLine(rBottomFromRLine), mbLeftIsOutside(bLeftIsOutside), mbBottomIsOutside(bBottomIsOutside), mbRightIsOutside(bRightIsOutside), @@ -208,7 +234,6 @@ namespace drawinglayer { } - // data access const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } const SvxBorderLine& getLeftLine() const { return maLeftLine; } @@ -248,34 +273,20 @@ namespace drawinglayer return getBorderLineOutWidth(rLineA) + getBorderLineDistance(rLineA) + getBorderLineInWidth(rLineA); } - double getInnerExtend(const SvxBorderLine& rLineA, bool bSideToUse) + double getExtend(const SvxBorderLine& rLineSide, const SvxBorderLine& rLineOpposite) { - if(!rLineA.isEmpty()) + double nExtend = 0.0; + if(!rLineSide.isEmpty()) { - if(rLineA.isDouble()) - { - // reduce to inner edge of associated matching line - return -((getBorderLineWidth(rLineA) / 2.0) - (bSideToUse ? getBorderLineOutWidth(rLineA) : getBorderLineInWidth(rLineA))); - } - else - { - // extend to overlap with single line - return getBorderLineWidth(rLineA) / 2.0; - } + // reduce to inner edge of associated matching line + nExtend = -((getBorderLineWidth(rLineSide) / 2.0)); } - - return 0.0; - } - - double getOuterExtend(const SvxBorderLine& rLineA) - { - if(!rLineA.isEmpty()) + else { - // extend to overlap with single line - return getBorderLineWidth(rLineA) / 2.0; + nExtend = ((getBorderLineWidth(rLineOpposite) / 2.0)); } - return 0.0; + return nExtend; } double getChangedValue(sal_uInt16 nValue, bool bChangeToMM) @@ -303,23 +314,10 @@ namespace drawinglayer if(!aStart.equal(aEnd)) { - const double fExtendIS(getInnerExtend(getTopLine(), false)); - const double fExtendIE(getInnerExtend(getBottomLine(), true)); - double fExtendOS(0.0); - double fExtendOE(0.0); - - if(getLeftIsOutside()) - { - if(getTopIsOutside()) - { - fExtendOS = getOuterExtend(getTopLine()); - } - - if(getBottomIsOutside()) - { - fExtendOE = getOuterExtend(getBottomLine()); - } - } + const double fExtendIS(getExtend(getTopLine(), maTopFromLLine)); + const double fExtendIE(getExtend(getBottomLine(), maBottomFromLLine)); + const double fExtendOS(getExtend(maTopFromLLine, getTopLine())); + const double fExtendOE(getExtend(maBottomFromLLine, getBottomLine())); xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D( aStart, @@ -331,14 +329,15 @@ namespace drawinglayer fExtendIE * fTwipsToMM, fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM, - true, - getLeftIsOutside(), - getLeftLine().GetColor().getBColor(), + getLeftLine().GetColorOut(true).getBColor(), + getLeftLine().GetColorIn(true).getBColor(), + getLeftLine().GetColorGap().getBColor(), + getLeftLine().HasGapColor(), getLeftLine().GetStyle())); } } - if(!getBottomLine().isEmpty()) + if(!getBottomLine().isEmpty() && getBottomIsOutside()) { // create bottom line from left to right const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(0.0, 1.0)); @@ -346,23 +345,10 @@ namespace drawinglayer if(!aStart.equal(aEnd)) { - const double fExtendIS(getInnerExtend(getLeftLine(), true)); - const double fExtendIE(getInnerExtend(getRightLine(), false)); - double fExtendOS(0.0); - double fExtendOE(0.0); - - if(getBottomIsOutside()) - { - if(getLeftIsOutside()) - { - fExtendOS = getOuterExtend(getLeftLine()); - } - - if(getRightIsOutside()) - { - fExtendOE = getOuterExtend(getRightLine()); - } - } + const double fExtendIS(getExtend(getLeftLine(), maLeftFromBLine )); + const double fExtendIE(getExtend(getRightLine(), maRightFromBLine)); + const double fExtendOS(getExtend(maLeftFromBLine, getLeftLine())); + const double fExtendOE(getExtend(maRightFromBLine, getRightLine())); xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D( aStart, @@ -374,14 +360,15 @@ namespace drawinglayer fExtendIE * fTwipsToMM, fExtendOS * fTwipsToMM, fExtendOE * fTwipsToMM, - true, - getBottomIsOutside(), - getBottomLine().GetColor().getBColor(), + getBottomLine().GetColorOut(false).getBColor(), + getBottomLine().GetColorIn(false).getBColor(), + getBottomLine().GetColorGap().getBColor(), + getBottomLine().HasGapColor(), getBottomLine().GetStyle())); } } - if(!getRightLine().isEmpty()) + if(!getRightLine().isEmpty() && getRightIsOutside()) { // create right line from top to bottom const basegfx::B2DPoint aStart(getTransform() * basegfx::B2DPoint(1.0, 0.0)); @@ -389,23 +376,10 @@ namespace drawinglayer if(!aStart.equal(aEnd)) { - const double fExtendIS(getInnerExtend(getTopLine(), false)); - const double fExtendIE(getInnerExtend(getBottomLine(), true)); - double fExtendOS(0.0); - double fExtendOE(0.0); - - if(getRightIsOutside()) - { - if(getTopIsOutside()) - { - fExtendOS = getOuterExtend(getTopLine()); - } - - if(getBottomIsOutside()) - { - fExtendOE = getOuterExtend(getBottomLine()); - } - } + const double fExtendIS(getExtend(getTopLine(), maTopFromRLine)); + const double fExtendIE(getExtend(getBottomLine(), maBottomFromRLine)); + const double fExtendOS(getExtend(maTopFromRLine, getTopLine())); + const double fExtendOE(getExtend(maBottomFromRLine, getBottomLine())); xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D( aStart, @@ -417,9 +391,10 @@ namespace drawinglayer fExtendOE * fTwipsToMM, fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM, - getRightIsOutside(), - true, - getRightLine().GetColor().getBColor(), + getRightLine().GetColorOut(true).getBColor(), + getRightLine().GetColorIn(true).getBColor(), + getRightLine().GetColorGap().getBColor(), + getRightLine().HasGapColor(), getRightLine().GetStyle())); } } @@ -432,23 +407,10 @@ namespace drawinglayer if(!aStart.equal(aEnd)) { - const double fExtendIS(getInnerExtend(getLeftLine(), true)); - const double fExtendIE(getInnerExtend(getRightLine(), false)); - double fExtendOS(0.0); - double fExtendOE(0.0); - - if(getTopIsOutside()) - { - if(getLeftIsOutside()) - { - fExtendOS = getOuterExtend(getLeftLine()); - } - - if(getRightIsOutside()) - { - fExtendOE = getOuterExtend(getRightLine()); - } - } + const double fExtendIS(getExtend(getLeftLine(), maLeftFromTLine)); + const double fExtendIE(getExtend(getRightLine(), maRightFromTLine)); + const double fExtendOS(getExtend(maLeftFromTLine, getLeftLine())); + const double fExtendOE(getExtend(maRightFromTLine, getRightLine())); xRetval[nInsert++] = Primitive2DReference(new BorderLinePrimitive2D( aStart, @@ -460,9 +422,10 @@ namespace drawinglayer fExtendOE * fTwipsToMM, fExtendIS * fTwipsToMM, fExtendIE * fTwipsToMM, - getTopIsOutside(), - true, - getTopLine().GetColor().getBColor(), + getTopLine().GetColorOut(false).getBColor(), + getTopLine().GetColorIn(false).getBColor(), + getTopLine().GetColorGap().getBColor(), + getTopLine().HasGapColor(), getTopLine().GetStyle())); } } @@ -482,6 +445,14 @@ namespace drawinglayer && getBottomLine() == rCompare.getBottomLine() && getRightLine() == rCompare.getRightLine() && getTopLine() == rCompare.getTopLine() + && maLeftFromTLine == rCompare.maLeftFromTLine + && maLeftFromBLine == rCompare.maLeftFromBLine + && maRightFromTLine == rCompare.maRightFromTLine + && maRightFromBLine == rCompare.maRightFromBLine + && maTopFromLLine == rCompare.maTopFromLLine + && maTopFromRLine == rCompare.maTopFromRLine + && maBottomFromLLine == rCompare.maBottomFromLLine + && maBottomFromRLine == rCompare.maBottomFromRLine && getLeftIsOutside() == rCompare.getLeftIsOutside() && getBottomIsOutside() == rCompare.getBottomIsOutside() && getRightIsOutside() == rCompare.getRightIsOutside() @@ -587,6 +558,15 @@ namespace sdr SvxBorderLine aRightLine; SvxBorderLine aTopLine; + SvxBorderLine aLeftFromTLine; + SvxBorderLine aLeftFromBLine; + SvxBorderLine aRightFromTLine; + SvxBorderLine aRightFromBLine; + SvxBorderLine aTopFromLLine; + SvxBorderLine aTopFromRLine; + SvxBorderLine aBottomFromLLine; + SvxBorderLine aBottomFromRLine; + // create single primitives per cell for(aCellPos.mnRow = 0; aCellPos.mnRow < nRowCount; aCellPos.mnRow++) { @@ -658,6 +638,16 @@ namespace sdr impGetLine(aRightLine, rTableLayouter, nXRight, nY, false, nColCount, nRowCount, bIsRTL); impGetLine(aTopLine, rTableLayouter, nX, nY, true, nColCount, nRowCount, bIsRTL); + // get the neighbor cells' borders + impGetLine(aLeftFromTLine, rTableLayouter, nX, nY - 1, false, nColCount, nRowCount, bIsRTL); + impGetLine(aLeftFromBLine, rTableLayouter, nX, nYBottom + 1, false, nColCount, nRowCount, bIsRTL); + impGetLine(aRightFromTLine, rTableLayouter, nXRight, nY - 1, false, nColCount, nRowCount, bIsRTL); + impGetLine(aRightFromBLine, rTableLayouter, nXRight, nYBottom + 1, false, nColCount, nRowCount, bIsRTL); + impGetLine(aTopFromLLine, rTableLayouter, nX - 1, nY, true, nColCount, nRowCount, bIsRTL); + impGetLine(aTopFromRLine, rTableLayouter, nXRight + 1, nY, true, nColCount, nRowCount, bIsRTL); + impGetLine(aBottomFromLLine, rTableLayouter, nX - 1, nYBottom, true, nColCount, nRowCount, bIsRTL); + impGetLine(aBottomFromRLine, rTableLayouter, nXRight + 1, nYBottom, true, nColCount, nRowCount, bIsRTL); + // create the primtive containing all data for one cell with borders xBorderSequence[nBorderInsert++] = drawinglayer::primitive2d::Primitive2DReference( new drawinglayer::primitive2d::SdrBorderlinePrimitive2D( @@ -666,6 +656,14 @@ namespace sdr aBottomLine, aRightLine, aTopLine, + aLeftFromTLine, + aLeftFromBLine, + aRightFromTLine, + aRightFromBLine, + aTopFromLLine, + aTopFromRLine, + aBottomFromLLine, + aBottomFromRLine, bIsRTL ? nX == nColCount : 0 == nX, nRowCount == nYBottom, bIsRTL ? 0 == nXRight : nXRight == nColCount, |