summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2010-10-06 23:54:04 +0200
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2010-10-06 23:58:10 +0200
commit60d09ae471ba117e2eb773398a883df1d023daa4 (patch)
tree405f492d5a98dfebf956bbd5165a69b6c9bc50a0 /svx
parentbf8fb43fd8daa85f6ebb1c4d6997008e90835757 (diff)
fate#307731, fate#307730: Adds dotted and dashed border lines
Diffstat (limited to 'svx')
-rw-r--r--svx/inc/svx/framelink.hxx25
-rw-r--r--svx/inc/svx/frmsel.hxx7
-rw-r--r--svx/source/dialog/framelink.cxx163
-rw-r--r--svx/source/dialog/frmsel.cxx39
-rw-r--r--svx/source/table/cell.cxx1
-rw-r--r--svx/source/table/viewcontactoftableobj.cxx12
-rw-r--r--svx/source/tbxctrls/tbcontrl.cxx30
7 files changed, 139 insertions, 138 deletions
diff --git a/svx/inc/svx/framelink.hxx b/svx/inc/svx/framelink.hxx
index 660fd17ab0..747b6eb64a 100644
--- a/svx/inc/svx/framelink.hxx
+++ b/svx/inc/svx/framelink.hxx
@@ -33,9 +33,10 @@
#include <tools/gen.hxx>
#include <tools/color.hxx>
#include "svx/svxdllapi.h"
+#include <vcl/outdev.hxx>
+#include <editeng/borderline.hxx>
class OutputDevice;
-class SvxBorderLine;
namespace svx {
namespace frame {
@@ -112,20 +113,20 @@ class SVX_DLLPUBLIC Style
{
public:
/** Constructs an invisible frame style. */
- inline explicit Style() : meRefMode( REFMODE_CENTERED ), mnPrim( 0 ), mnDist( 0 ), mnSecn( 0 ), mbDotted( false ) {}
+ inline explicit Style() : meRefMode( REFMODE_CENTERED ), mnPrim( 0 ), mnDist( 0 ), mnSecn( 0 ), mnDashing( SOLID ) {}
/** Constructs a frame style with passed line widths. */
inline explicit Style( sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 nS ) :
- meRefMode( REFMODE_CENTERED ), mbDotted( false )
+ meRefMode( REFMODE_CENTERED ), mnDashing( SOLID )
{ 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 ) :
- meRefMode( REFMODE_CENTERED ), mbDotted( false )
+ 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 ); }
/** 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, bool /*bUseDots*/ = false ) :
+ inline explicit Style( const SvxBorderLine& rBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ) :
meRefMode( REFMODE_CENTERED ) { Set( rBorder, fScale, nMaxWidth ); }
/** Constructs a frame style from the passed SvxBorderLine struct. Clears the style, if pBorder is 0. */
- inline explicit Style( const SvxBorderLine* pBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16, bool /*bUseDots*/ = false ) :
+ inline explicit Style( const SvxBorderLine* pBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 ) :
meRefMode( REFMODE_CENTERED ) { Set( pBorder, fScale, nMaxWidth ); }
inline RefMode GetRefMode() const { return meRefMode; }
@@ -133,7 +134,7 @@ public:
inline sal_uInt16 Prim() const { return mnPrim; }
inline sal_uInt16 Dist() const { return mnDist; }
inline sal_uInt16 Secn() const { return mnSecn; }
- inline bool Dotted() const { return mbDotted; }
+ inline SvxBorderStyle Dashing() const { return mnDashing; }
/** Returns the total width of this frame style. */
inline sal_uInt16 GetWidth() const { return mnPrim + mnDist + mnSecn; }
@@ -146,16 +147,16 @@ public:
/** Sets the frame style to the passed line widths. */
void Set( const Color& rColor, 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, bool /*bUseDots*/ = false );
+ 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. */
- void Set( const SvxBorderLine* pBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16, bool /*bUseDots*/ = false );
+ void Set( const SvxBorderLine* pBorder, double fScale = 1.0, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 );
/** 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; }
/** Sets whether to use dotted style for single hair lines. */
- inline void SetDotted( bool bDotted ) { mbDotted = bDotted; }
+ inline void SetDashing( SvxBorderStyle nDashing ) { mnDashing = nDashing; }
/** Scales the style by the specified scaling factor. Ensures that visible lines keep visible. */
Style& ScaleSelf( double fScale, sal_uInt16 nMaxWidth = SAL_MAX_UINT16 );
@@ -173,7 +174,7 @@ private:
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.
- bool mbDotted; /// true = Draw dotted lines; false = Draw solid lines.
+ SvxBorderStyle mnDashing;
};
bool operator==( const Style& rL, const Style& rR );
diff --git a/svx/inc/svx/frmsel.hxx b/svx/inc/svx/frmsel.hxx
index 22100d3e0a..27066404df 100644
--- a/svx/inc/svx/frmsel.hxx
+++ b/svx/inc/svx/frmsel.hxx
@@ -32,6 +32,7 @@
#include <tools/color.hxx>
#include <vcl/ctrl.hxx>
#include <vcl/bitmap.hxx>
+#include <editeng/borderline.hxx>
#include <svx/framebordertype.hxx>
#include "svx/svxdllapi.h"
@@ -128,7 +129,8 @@ public:
/** Returns true, if all visible frame borders have equal widths.
@descr Ignores hidden and "don't care" frame borders. On success,
returns the widths in the passed parameters. */
- bool GetVisibleWidth( USHORT& rnPrim, USHORT& rnDist, USHORT& rnSec ) const;
+ bool GetVisibleWidth( USHORT& rnPrim, USHORT& rnDist, USHORT& rnSec,
+ SvxBorderStyle& rnStyle ) const;
/** Returns true, if all visible frame borders have equal color.
@descr Ignores hidden and "don't care" frame borders. On success,
returns the color in the passed parameter. */
@@ -159,7 +161,8 @@ public:
void SelectAllVisibleBorders( bool bSelect = true );
/** Sets the passed line widths to all selected frame borders (in twips). */
- void SetStyleToSelection( USHORT nPrim, USHORT nDist, USHORT nSec );
+ void SetStyleToSelection( USHORT nPrim, USHORT nDist, USHORT nSec,
+ SvxBorderStyle nStyle );
/** Sets the passed color to all selected frame borders. */
void SetColorToSelection( const Color& rColor );
diff --git a/svx/source/dialog/framelink.cxx b/svx/source/dialog/framelink.cxx
index 06fc47828b..13c7a4fd6e 100644
--- a/svx/source/dialog/framelink.cxx
+++ b/svx/source/dialog/framelink.cxx
@@ -32,6 +32,7 @@
#include <math.h>
#include <vcl/outdev.hxx>
#include <editeng/borderline.hxx>
+#include <svtools/borderhelper.hxx>
// ----------------------------------------------------------------------------
@@ -48,6 +49,9 @@
#if SVX_FRAME_USE_LINEINFO
#include <vcl/lineinfo.hxx>
+#else
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
#endif
namespace svx {
@@ -755,7 +759,7 @@ inline Polygon lclCreatePolygon( const PointVec& rPoints )
Polygon lclCreatePolygon( const Point& rP1, const Point& rP2, const Point& rP3, const Point& rP4 )
{
PointVec aPoints;
- aPoints.reserve( 4 );
+ aPoints.reserve( 2 );
aPoints.push_back( rP1 );
aPoints.push_back( rP2 );
aPoints.push_back( rP3 );
@@ -776,12 +780,6 @@ Polygon lclCreatePolygon( const Point& rP1, const Point& rP2, const Point& rP3,
return lclCreatePolygon( aPoints );
}
-/** Returns a polygon constructed from the two passed line positions. */
-inline Polygon lclCreatePolygon( const LinePoints& rPoints1, const LinePoints& rPoints2 )
-{
- return lclCreatePolygon( rPoints1.maBeg, rPoints1.maEnd, rPoints2.maEnd, rPoints2.maBeg );
-}
-
/** Sets the color of the passed frame style to the output device.
Sets the line color and fill color in the output device.
@@ -803,73 +801,6 @@ void lclSetColorToOutDev( OutputDevice& rDev, const Style& rStyle, const Color*
}
// ----------------------------------------------------------------------------
-// Generic drawing functions.
-
-/** Draws a thin (1 pixel wide) line, optionally dotted, into the passed output device. */
-void lclDrawThinLine( OutputDevice& rDev, const Point& rBeg, const Point& rEnd, bool bDotted )
-{
-#if SVX_FRAME_USE_LINEINFO
- if( bDotted && (rBeg != rEnd) )
- {
-// using LineInfo for dotted lines looks ugly and does not work well for diagonal lines
- LineInfo aLineInfo( LINE_DASH, 1 );
- aLineInfo.SetDotCount( 1 );
- aLineInfo.SetDotLen( 1 );
- aLineInfo.SetDistance( 3 );
- rDev.DrawLine( rBeg, rEnd, aLineInfo );
- }
-#else
- Point aBeg( rDev.LogicToPixel( rBeg ) );
- Point aEnd( rDev.LogicToPixel( rEnd ) );
- if( bDotted && (aBeg != aEnd) )
- {
- bool bHor = Abs( aEnd.X() - aBeg.X() ) > Abs( aEnd.Y() - aBeg.Y() );
- const Point& rBegPos( bHor ? ((aBeg.X() < aEnd.X()) ? aBeg : aEnd) : ((aBeg.Y() < aEnd.Y()) ? aBeg : aEnd ) );
- const Point& rEndPos( (rBegPos == aBeg) ? aEnd : aBeg );
-
- long nAlongBeg = bHor ? rBegPos.X() : rBegPos.Y();
- long nAcrssBeg = bHor ? rBegPos.Y() : rBegPos.X();
- long nAlongSize = (bHor ? rEndPos.X() : rEndPos.Y()) - nAlongBeg;
- long nAcrssSize = (bHor ? rEndPos.Y() : rEndPos.X()) - nAcrssBeg;
- double fGradient = static_cast< double >( nAcrssSize ) / nAlongSize;
-
- PointVec aPoints;
- aPoints.reserve( (nAlongSize + 1) / 2 );
- for( long nAlongIdx = 0; nAlongIdx <= nAlongSize; nAlongIdx += 2 )
- {
- long nAl = nAlongBeg + nAlongIdx;
- long nAc = nAcrssBeg + lclD2L( fGradient * nAlongIdx );
- aPoints.push_back( Point( bHor ? nAl : nAc, bHor ? nAc : nAl ) );
- }
-
- rDev.Push( PUSH_MAPMODE );
- rDev.SetMapMode( MAP_PIXEL );
- rDev.DrawPixel( lclCreatePolygon( aPoints ) );
- rDev.Pop(); // map mode
- }
-#endif
- else
- rDev.DrawLine( rBeg, rEnd );
-}
-
-/** Draws a thin (1 pixel wide) line, optionally dotted, into the passed output device. */
-inline void lclDrawThinLine( OutputDevice& rDev, const LinePoints& rPoints, bool bDotted )
-{
- lclDrawThinLine( rDev, rPoints.maBeg, rPoints.maEnd, bDotted );
-}
-
-/** Draws a polygon with four points into the passed output device. */
-inline void lclDrawPolygon( OutputDevice& rDev, const Point& rP1, const Point& rP2, const Point& rP3, const Point& rP4 )
-{
- rDev.DrawPolygon( lclCreatePolygon( rP1, rP2, rP3, rP4 ) );
-}
-
-/** Draws a polygon specified by two borders into the passed output device. */
-inline void lclDrawPolygon( OutputDevice& rDev, const LinePoints& rPoints1, const LinePoints& rPoints2 )
-{
- rDev.DrawPolygon( lclCreatePolygon( rPoints1, rPoints2 ) );
-}
-
// ============================================================================
// Drawing of horizontal frame borders.
@@ -882,16 +813,18 @@ void lclDrawHorLine(
OutputDevice& rDev,
const Point& rLPos, const LineEndResult& rLRes,
const Point& rRPos, const LineEndResult& rRRes,
- long nTOffs, long nBOffs, bool bDotted )
+ long nTOffs, long nBOffs, SvxBorderStyle nDashing )
{
LinePoints aTPoints( rLPos + lclToMapUnit( rLRes.mnOffs1, nTOffs ), rRPos + lclToMapUnit( rRRes.mnOffs1, nTOffs ) );
- if( nTOffs == nBOffs )
- lclDrawThinLine( rDev, aTPoints, bDotted );
- else
- {
- LinePoints aBPoints( rLPos + lclToMapUnit( rLRes.mnOffs2, nBOffs ), rRPos + lclToMapUnit( rRRes.mnOffs2, nBOffs ) );
- lclDrawPolygon( rDev, aTPoints, aBPoints );
- }
+ LinePoints aBPoints( rLPos + lclToMapUnit( rLRes.mnOffs2, nBOffs ), rRPos + lclToMapUnit( rRRes.mnOffs2, nBOffs ) );
+
+ sal_uInt32 nWidth = lclToMapUnit( abs( nTOffs ) ) + lclToMapUnit( abs( nBOffs ) );
+ if ( ( nTOffs >= 0 && nBOffs >= 0 ) || ( nTOffs <= 0 && nBOffs <= 0 ) )
+ nWidth = abs( lclToMapUnit( nTOffs ) - lclToMapUnit( nBOffs ) ) + 1;
+ Point rLMid = ( aTPoints.maBeg + aBPoints.maBeg ) / 2;
+ Point rRMid = ( aTPoints.maEnd + aBPoints.maEnd ) / 2;
+
+ ::svtools::DrawLine( rDev, rLMid, rRMid, nWidth, nDashing );
}
/** Draws a horizontal frame border into the passed output device.
@@ -917,10 +850,10 @@ void lclDrawHorFrameBorder(
{
lclSetColorToOutDev( rDev, rBorder, pForceColor );
lclDrawHorLine( rDev, rLPos, rResult.maBeg.maPrim, rRPos, rResult.maEnd.maPrim,
- lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dotted() );
+ lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dashing() );
if( rBorder.Secn() )
lclDrawHorLine( rDev, rLPos, rResult.maBeg.maSecn, rRPos, rResult.maEnd.maSecn,
- lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dotted() );
+ lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dashing() );
rDev.Pop(); // colors
}
}
@@ -937,16 +870,18 @@ void lclDrawVerLine(
OutputDevice& rDev,
const Point& rTPos, const LineEndResult& rTRes,
const Point& rBPos, const LineEndResult& rBRes,
- long nLOffs, long nROffs, bool bDotted )
+ long nLOffs, long nROffs, SvxBorderStyle nDashing )
{
LinePoints aLPoints( rTPos + lclToMapUnit( nLOffs, rTRes.mnOffs1 ), rBPos + lclToMapUnit( nLOffs, rBRes.mnOffs1 ) );
- if( nLOffs == nROffs )
- lclDrawThinLine( rDev, aLPoints, bDotted );
- else
- {
- LinePoints aRPoints( rTPos + lclToMapUnit( nROffs, rTRes.mnOffs2 ), rBPos + lclToMapUnit( nROffs, rBRes.mnOffs2 ) );
- lclDrawPolygon( rDev, aLPoints, aRPoints );
- }
+ LinePoints aRPoints( rTPos + lclToMapUnit( nROffs, rTRes.mnOffs2 ), rBPos + lclToMapUnit( nROffs, rBRes.mnOffs2 ) );
+
+ sal_uInt32 nWidth = lclToMapUnit( abs( nLOffs ) ) + lclToMapUnit( abs( nROffs ) );
+ if ( ( nLOffs >= 0 && nROffs >= 0 ) || ( nLOffs <= 0 && nROffs <= 0 ) )
+ nWidth = abs( lclToMapUnit( nLOffs ) - lclToMapUnit( nROffs ) ) + 1;
+ Point rTMid = ( aLPoints.maBeg + aRPoints.maBeg ) / 2;
+ Point rBMid = ( aLPoints.maEnd + aRPoints.maEnd ) / 2;
+
+ ::svtools::DrawLine( rDev, rTMid, rBMid, nWidth, nDashing );
}
/** Draws a vertical frame border into the passed output device.
@@ -972,10 +907,10 @@ void lclDrawVerFrameBorder(
{
lclSetColorToOutDev( rDev, rBorder, pForceColor );
lclDrawVerLine( rDev, rTPos, rResult.maBeg.maPrim, rBPos, rResult.maEnd.maPrim,
- lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dotted() );
+ lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dashing() );
if( rBorder.Secn() )
lclDrawVerLine( rDev, rTPos, rResult.maBeg.maSecn, rBPos, rResult.maEnd.maSecn,
- lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dotted() );
+ lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dashing() );
rDev.Pop(); // colors
}
}
@@ -1108,14 +1043,19 @@ void lclPushCrossingClipRegion( OutputDevice& rDev, const Rectangle& rRect, bool
*/
void lclDrawDiagLine(
OutputDevice& rDev, const Rectangle& rRect, bool bTLBR,
- const DiagLineResult& rResult, long nDiagOffs1, long nDiagOffs2, bool bDotted )
+ const DiagLineResult& rResult, long nDiagOffs1, long nDiagOffs2, SvxBorderStyle nDashing )
{
lclPushDiagClipRect( rDev, rRect, rResult );
LinePoints aLPoints( lclGetDiagLineEnds( rRect, bTLBR, nDiagOffs1 ) );
- if( nDiagOffs1 == nDiagOffs2 )
- lclDrawThinLine( rDev, aLPoints, bDotted );
- else
- lclDrawPolygon( rDev, aLPoints, lclGetDiagLineEnds( rRect, bTLBR, nDiagOffs2 ) );
+ LinePoints aL2Points( lclGetDiagLineEnds( rRect, bTLBR, nDiagOffs2 ) );
+ Point aSMid( ( aLPoints.maBeg + aL2Points.maBeg ) / 2 );
+ Point aEMid( ( aLPoints.maEnd + aL2Points.maEnd ) / 2 );
+
+ sal_uInt32 nWidth = lclToMapUnit( abs( nDiagOffs1 ) ) + lclToMapUnit( abs( nDiagOffs2 ) );
+ if ( ( nDiagOffs1 <= 0 && nDiagOffs2 <= 0 ) || ( nDiagOffs1 >=0 && nDiagOffs2 >=0 ) )
+ nWidth = lclToMapUnit( abs( nDiagOffs1 - nDiagOffs2 ) );
+
+ svtools::DrawLine( rDev, aSMid, aEMid, nWidth, nDashing );
rDev.Pop(); // clipping region
}
@@ -1147,9 +1087,9 @@ void lclDrawDiagFrameBorder(
lclPushCrossingClipRegion( rDev, rRect, bTLBR, rCrossStyle );
lclSetColorToOutDev( rDev, rBorder, pForceColor );
- lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maPrim, lclGetBeg( rBorder ), lclGetPrimEnd( rBorder ), rBorder.Dotted() );
+ 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.Dotted() );
+ lclDrawDiagLine( rDev, rRect, bTLBR, rResult.maSecn, lclGetSecnBeg( rBorder ), lclGetEnd( rBorder ), rBorder.Dashing() );
rDev.Pop(); // colors
if( bClip )
@@ -1226,7 +1166,7 @@ void Style::Set( const Color& rColor, sal_uInt16 nP, sal_uInt16 nD, sal_uInt16 n
Set( nP, nD, nS );
}
-void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWidth, bool bUseDots )
+void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWidth )
{
maColor = rBorder.GetColor();
@@ -1237,12 +1177,12 @@ void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWid
if( !nSecn ) // no or single frame border
{
Set( SCALEVALUE( nPrim ), 0, 0 );
- mbDotted = bUseDots && (0 < nPrim) && (nPrim < 10);
+ mnDashing = rBorder.GetStyle();
}
else
{
Set( SCALEVALUE( nPrim ), SCALEVALUE( nDist ), SCALEVALUE( nSecn ) );
- mbDotted = false;
+ mnDashing = SOLID;
// Enlarge the style if distance is too small due to rounding losses.
sal_uInt16 nPixWidth = SCALEVALUE( nPrim + nDist + nSecn );
if( nPixWidth > GetWidth() )
@@ -1275,14 +1215,14 @@ void Style::Set( const SvxBorderLine& rBorder, double fScale, sal_uInt16 nMaxWid
}
}
-void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWidth, bool bUseDots )
+void Style::Set( const SvxBorderLine* pBorder, double fScale, sal_uInt16 nMaxWidth )
{
if( pBorder )
- Set( *pBorder, fScale, nMaxWidth, bUseDots );
+ Set( *pBorder, fScale, nMaxWidth );
else
{
Clear();
- mbDotted = false;
+ mnDashing = SOLID;
}
}
@@ -1314,7 +1254,8 @@ 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.Dotted() == rR.Dotted());
+ (rL.GetColor() == rR.GetColor()) && (rL.GetRefMode() == rR.GetRefMode()) &&
+ (rL.Dashing() == rR.Dashing());
}
bool operator<( const Style& rL, const Style& rR )
@@ -1331,7 +1272,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.Dotted() != rR.Dotted()) ) return rL.Dotted();
+ if( (nLW == 1) && (rL.Dashing() != rR.Dashing()) ) return rL.Dashing();
// seem to be equal
return false;
@@ -1498,10 +1439,10 @@ void DrawVerFrameBorderSlanted( OutputDevice& rDev,
lclSetColorToOutDev( rDev, aScaled, pForceColor );
lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
- lclGetBeg( aScaled ), lclGetPrimEnd( aScaled ), aScaled.Dotted() );
+ lclGetBeg( aScaled ), lclGetPrimEnd( aScaled ), aScaled.Dashing() );
if( aScaled.Secn() )
lclDrawVerLine( rDev, rTPos, aRes, rBPos, aRes,
- lclGetSecnBeg( aScaled ), lclGetEnd( aScaled ), aScaled.Dotted() );
+ lclGetSecnBeg( aScaled ), lclGetEnd( aScaled ), aScaled.Dashing() );
rDev.Pop(); // colors
}
}
diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx
index 0e4b1b2e61..e8879a2ac5 100644
--- a/svx/source/dialog/frmsel.cxx
+++ b/svx/source/dialog/frmsel.cxx
@@ -153,7 +153,7 @@ void FrameBorder::SetCoreStyle( const SvxBorderLine* pStyle )
maCoreStyle = SvxBorderLine();
// from twips to points
- maUIStyle.Set( maCoreStyle, 0.05, FRAMESEL_GEOM_WIDTH, true );
+ maUIStyle.Set( maCoreStyle, 0.05, FRAMESEL_GEOM_WIDTH );
meState = maUIStyle.Prim() ? FRAMESTATE_SHOW : FRAMESTATE_HIDE;
}
@@ -633,11 +633,31 @@ void FrameSelectorImpl::DrawAllFrameBorders()
// Copy all frame border styles to the helper array
maArray.SetColumnStyleLeft( 0, maLeft.GetUIStyle() );
if( mbVer ) maArray.SetColumnStyleLeft( 1, maVer.GetUIStyle() );
- maArray.SetColumnStyleRight( mbVer ? 1 : 0, maRight.GetUIStyle() );
+
+ // Invert the style for the right line
+ const frame::Style rRightStyle = maRight.GetUIStyle( );
+ frame::Style rInvertedRight( rRightStyle.GetColor(),
+ rRightStyle.Secn(), rRightStyle.Dist(), rRightStyle.Prim( ),
+ rRightStyle.Dashing( ) );
+ maArray.SetColumnStyleRight( mbVer ? 1 : 0, rInvertedRight );
maArray.SetRowStyleTop( 0, maTop.GetUIStyle() );
- if( mbHor ) maArray.SetRowStyleTop( 1, maHor.GetUIStyle() );
- maArray.SetRowStyleBottom( mbHor ? 1 : 0, maBottom.GetUIStyle() );
+ if( mbHor )
+ {
+ // Invert the style for the hor line to match the real borders
+ const frame::Style rHorStyle = maHor.GetUIStyle();
+ frame::Style rInvertedHor( rHorStyle.GetColor(),
+ rHorStyle.Secn(), rHorStyle.Dist(), rHorStyle.Prim( ),
+ rHorStyle.Dashing() );
+ maArray.SetRowStyleTop( 1, rInvertedHor );
+ }
+
+ // Invert the style for the bottom line
+ const frame::Style rBottomStyle = maBottom.GetUIStyle( );
+ frame::Style rInvertedBottom( rBottomStyle.GetColor(),
+ rBottomStyle.Secn(), rBottomStyle.Dist(), rBottomStyle.Prim( ),
+ rBottomStyle.Dashing() );
+ maArray.SetRowStyleBottom( mbHor ? 1 : 0, rInvertedBottom );
for( size_t nCol = 0; nCol < maArray.GetColCount(); ++nCol )
for( size_t nRow = 0; nRow < maArray.GetRowCount(); ++nRow )
@@ -858,7 +878,8 @@ void FrameSelector::HideAllBorders()
mxImpl->SetBorderState( **aIt, FRAMESTATE_HIDE );
}
-bool FrameSelector::GetVisibleWidth( USHORT& rnPrim, USHORT& rnDist, USHORT& rnSecn ) const
+bool FrameSelector::GetVisibleWidth( USHORT& rnPrim, USHORT& rnDist, USHORT& rnSecn,
+ SvxBorderStyle& rnStyle ) const
{
VisFrameBorderCIter aIt( mxImpl->maEnabBorders );
if( !aIt.Is() )
@@ -870,13 +891,15 @@ bool FrameSelector::GetVisibleWidth( USHORT& rnPrim, USHORT& rnDist, USHORT& rnS
bFound =
(rStyle.GetOutWidth() == (*aIt)->GetCoreStyle().GetOutWidth()) &&
(rStyle.GetDistance() == (*aIt)->GetCoreStyle().GetDistance()) &&
- (rStyle.GetInWidth() == (*aIt)->GetCoreStyle().GetInWidth());
+ (rStyle.GetInWidth() == (*aIt)->GetCoreStyle().GetInWidth()) &&
+ (rStyle.GetStyle() == (*aIt)->GetCoreStyle().GetStyle());
if( bFound )
{
rnPrim = rStyle.GetOutWidth();
rnDist = rStyle.GetDistance();
rnSecn = rStyle.GetInWidth();
+ rnStyle = rStyle.GetStyle();
}
return bFound;
}
@@ -937,11 +960,13 @@ void FrameSelector::SelectAllVisibleBorders( bool bSelect )
mxImpl->SelectBorder( **aIt, bSelect );
}
-void FrameSelector::SetStyleToSelection( USHORT nPrim, USHORT nDist, USHORT nSecn )
+void FrameSelector::SetStyleToSelection( USHORT nPrim, USHORT nDist, USHORT nSecn,
+ SvxBorderStyle nStyle )
{
mxImpl->maCurrStyle.SetOutWidth( nPrim );
mxImpl->maCurrStyle.SetDistance( nDist );
mxImpl->maCurrStyle.SetInWidth( nSecn );
+ mxImpl->maCurrStyle.SetStyle( nStyle );
for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
mxImpl->SetBorderState( **aIt, FRAMESTATE_SHOW );
}
diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx
index 3d75c031f9..97fd27e063 100644
--- a/svx/source/table/cell.cxx
+++ b/svx/source/table/cell.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/text/WritingMode.hpp>
#include <com/sun/star/table/TableBorder.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
#include <cppuhelper/typeprovider.hxx>
#include <svl/style.hxx>
diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx
index 5f0af00fc5..482d1ef91a 100644
--- a/svx/source/table/viewcontactoftableobj.cxx
+++ b/svx/source/table/viewcontactoftableobj.cxx
@@ -332,7 +332,8 @@ namespace drawinglayer
fExtendOE * fTwipsToMM,
true,
getLeftIsOutside(),
- getLeftLine().GetColor().getBColor()));
+ getLeftLine().GetColor().getBColor(),
+ getLeftLine().GetStyle()));
}
}
@@ -374,7 +375,8 @@ namespace drawinglayer
fExtendOE * fTwipsToMM,
true,
getBottomIsOutside(),
- getBottomLine().GetColor().getBColor()));
+ getBottomLine().GetColor().getBColor(),
+ getBottomLine().GetStyle()));
}
}
@@ -416,7 +418,8 @@ namespace drawinglayer
fExtendIE * fTwipsToMM,
getRightIsOutside(),
true,
- getRightLine().GetColor().getBColor()));
+ getRightLine().GetColor().getBColor(),
+ getRightLine().GetStyle()));
}
}
@@ -458,7 +461,8 @@ namespace drawinglayer
fExtendIE * fTwipsToMM,
getTopIsOutside(),
true,
- getTopLine().GetColor().getBColor()));
+ getTopLine().GetColor().getBColor(),
+ getTopLine().GetStyle()));
}
}
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 01d02a6d68..694fa9eb5d 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -41,6 +41,7 @@
#include <svtools/ctrlbox.hxx>
#include <svl/style.hxx>
#include <svtools/ctrltool.hxx>
+#include <svtools/borderhelper.hxx>
#include <svl/stritem.hxx>
#include <unotools/pathoptions.hxx>
#include <sfx2/tplpitem.hxx>
@@ -88,6 +89,7 @@
#include "colorwindow.hxx"
#include <memory>
+#include <svx/framelink.hxx>
#include <svx/tbxcolorupdate.hxx>
#include <editeng/eerdll.hxx>
#include <editeng/editrids.hrc>
@@ -1522,6 +1524,21 @@ void SvxLineWindow_Impl::MakeLineBitmap( USHORT nNo, Bitmap& rBmp, const Size& r
aVirDev.DrawRect( aRect );
nLineWidth = (USHORT) (DEF_DOUBLE_LINE6_OUT+DEF_DOUBLE_LINE6_IN+DEF_DOUBLE_LINE6_DIST)/20;
break;
+ case 17: // Dotted line
+ aRect.Top() = 6;
+ aRect.Bottom() = 6;
+ aVirDev.SetLineColor( rLineCol );
+ aVirDev.SetFillColor();
+ svtools::DrawLine( aVirDev, aRect.LeftCenter(), aRect.RightCenter(), 1, DOTTED );
+ break;
+
+ case 18: // Dashed line
+ aRect.Top() = 6;
+ aRect.Bottom() = 6;
+ aVirDev.SetLineColor( rLineCol );
+ aVirDev.SetFillColor();
+ svtools::DrawLine( aVirDev, aRect.LeftCenter(), aRect.RightCenter(), 1, DASHED );
+ break;
default:
break;
@@ -1542,6 +1559,7 @@ IMPL_LINK( SvxLineWindow_Impl, SelectHdl, void *, EMPTYARG )
USHORT n1 = 0,
n2 = 0,
n3 = 0;
+ SvxBorderStyle nStyle = SOLID;
BOOL bSetLine = TRUE;
switch ( aLineSet.GetSelectItemId() )
@@ -1585,6 +1603,14 @@ IMPL_LINK( SvxLineWindow_Impl, SelectHdl, void *, EMPTYARG )
case 16: n1 = DEF_DOUBLE_LINE6_OUT;
n2 = DEF_DOUBLE_LINE6_IN;
n3 = DEF_DOUBLE_LINE6_DIST; break;
+ case 17:
+ n1 = DEF_LINE_WIDTH_5;
+ nStyle = DOTTED;
+ break;
+ case 18:
+ n1 = DEF_LINE_WIDTH_5;
+ nStyle = DASHED;
+ break;
case 0:
default:
bSetLine = FALSE;
@@ -1592,7 +1618,7 @@ IMPL_LINK( SvxLineWindow_Impl, SelectHdl, void *, EMPTYARG )
}
if ( bSetLine )
{
- SvxBorderLine aTmp( NULL, n1, n2, n3 );
+ SvxBorderLine aTmp( NULL, n1, n2, n3, nStyle );
aLineItem.SetLine( &aTmp );
}
else
@@ -1676,7 +1702,7 @@ void SvxLineWindow_Impl::CreateBitmaps( void )
::Color aBackCol( rStyleSettings.GetWindowColor() );
aLineSet.Clear();
- for( USHORT i = 1 ; i < 17 ; ++i )
+ for( USHORT i = 1 ; i < 19 ; ++i )
{
MakeLineBitmap( i, aBmp, aBmpSize, aStr, aLineCol, aBackCol );
aLineSet.InsertItem( i, aBmp, aStr );