summaryrefslogtreecommitdiff
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
commit7db30f7aa037f52eb07cbb4fd2796bd869204af8 (patch)
tree655824d944ee2f6303810052479da12a0ed8341a
parent46247f7f126a5b9ff74ad0a160291123f12eb7ce (diff)
fate#307731, fate#307730: Adds dotted and dashed border lines
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx7
-rw-r--r--drawinglayer/source/primitive2d/borderlineprimitive2d.cxx35
-rw-r--r--editeng/inc/editeng/borderline.hxx14
-rw-r--r--editeng/inc/editeng/boxitem.hxx4
-rw-r--r--editeng/inc/editeng/memberids.hrc2
-rw-r--r--editeng/source/items/frmitems.cxx19
-rw-r--r--editeng/source/rtf/rtfitem.cxx9
-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
-rw-r--r--xmloff/source/style/PageMasterExportPropMapper.cxx11
-rw-r--r--xmloff/source/style/PageMasterImportPropMapper.cxx14
-rw-r--r--xmloff/source/style/bordrhdl.cxx54
-rw-r--r--xmloff/source/text/txtexppr.cxx16
-rw-r--r--xmloff/source/text/txtimppr.cxx10
19 files changed, 283 insertions, 189 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;
diff --git a/editeng/inc/editeng/borderline.hxx b/editeng/inc/editeng/borderline.hxx
index 10d27f176d85..8b2dc5c2d43a 100644
--- a/editeng/inc/editeng/borderline.hxx
+++ b/editeng/inc/editeng/borderline.hxx
@@ -90,6 +90,13 @@
// ============================================================================
+enum SvxBorderStyle
+{
+ SOLID,
+ DOTTED,
+ DASHED
+};
+
class EDITENG_DLLPUBLIC SvxBorderLine
{
protected:
@@ -97,9 +104,11 @@ protected:
USHORT nOutWidth;
USHORT nInWidth;
USHORT nDistance;
+ SvxBorderStyle m_nStyle;
public:
- SvxBorderLine( const Color *pCol = 0, USHORT nOut = 0, USHORT nIn = 0, USHORT nDist = 0 );
+ SvxBorderLine( const Color *pCol = 0, USHORT nOut = 0, USHORT nIn = 0, USHORT nDist = 0,
+ SvxBorderStyle nStyle = SOLID );
SvxBorderLine( const SvxBorderLine& r );
SvxBorderLine& operator=( const SvxBorderLine& r );
@@ -109,10 +118,13 @@ public:
USHORT GetInWidth() const { return nInWidth; }
USHORT GetDistance() const { return nDistance; }
+ SvxBorderStyle GetStyle() const { return m_nStyle; }
+
void SetColor( const Color &rColor ) { aColor = rColor; }
void SetOutWidth( USHORT nNew ) { nOutWidth = nNew; }
void SetInWidth( USHORT nNew ) { nInWidth = nNew; }
void SetDistance( USHORT nNew ) { nDistance = nNew; }
+ void SetStyle( SvxBorderStyle nNew ) { m_nStyle = nNew; }
void ScaleMetrics( long nMult, long nDiv );
BOOL operator==( const SvxBorderLine &rCmp ) const;
diff --git a/editeng/inc/editeng/boxitem.hxx b/editeng/inc/editeng/boxitem.hxx
index 40c6a2cbc22f..4bde9bb69feb 100644
--- a/editeng/inc/editeng/boxitem.hxx
+++ b/editeng/inc/editeng/boxitem.hxx
@@ -30,7 +30,7 @@
#include <svl/poolitem.hxx>
#include <editeng/borderline.hxx>
#include <editeng/editengdllapi.h>
-#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
namespace rtl { class OUString; }
@@ -106,7 +106,7 @@ public:
//JP 09.06.99: bIgnoreLine = TRUE -> Distance auch returnen, wenn
// keine Line gesetzt ist
USHORT CalcLineSpace( USHORT nLine, BOOL bIgnoreLine = FALSE ) const;
- static com::sun::star::table::BorderLine SvxLineToLine( const SvxBorderLine* pLine, sal_Bool bConvert );
+ static com::sun::star::table::BorderLine2 SvxLineToLine( const SvxBorderLine* pLine, sal_Bool bConvert );
static sal_Bool LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert);
};
diff --git a/editeng/inc/editeng/memberids.hrc b/editeng/inc/editeng/memberids.hrc
index c98b726a6eb8..dc2aae408b83 100644
--- a/editeng/inc/editeng/memberids.hrc
+++ b/editeng/inc/editeng/memberids.hrc
@@ -41,6 +41,8 @@
#define MID_OUTER_WIDTH 0x41
#define MID_INNER_WIDTH 0x35
#define MID_LINESPACE 0x3b
+#define MID_LINE_STYLE 0x90
+
//NameOrIndex
#define MID_NAME 16
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index effe1e71fcfb..dff765e30685 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/table/TableOrientation.hpp>
#include <com/sun/star/util/SortField.hpp>
#include <com/sun/star/util/SortFieldType.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/table/CellOrientation.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/style/PageStyleLayout.hpp>
@@ -1565,10 +1566,12 @@ void SvxShadowItem::SetEnumValue( sal_uInt16 nVal )
// class SvxBorderLine --------------------------------------------------
-SvxBorderLine::SvxBorderLine( const Color *pCol, sal_uInt16 nOut, sal_uInt16 nIn, sal_uInt16 nDist )
+SvxBorderLine::SvxBorderLine( const Color *pCol, sal_uInt16 nOut, sal_uInt16 nIn, sal_uInt16 nDist,
+ SvxBorderStyle nStyle )
: nOutWidth( nOut )
, nInWidth ( nIn )
, nDistance( nDist )
+, m_nStyle( nStyle )
{
if ( pCol )
aColor = *pCol;
@@ -1589,6 +1592,7 @@ SvxBorderLine& SvxBorderLine::operator=( const SvxBorderLine& r )
nOutWidth = r.nOutWidth;
nInWidth = r.nInWidth;
nDistance = r.nDistance;
+ m_nStyle = r.m_nStyle;
return *this;
}
@@ -1608,7 +1612,8 @@ sal_Bool SvxBorderLine::operator==( const SvxBorderLine& rCmp ) const
return ( ( aColor == rCmp.GetColor() ) &&
( nInWidth == rCmp.GetInWidth() ) &&
( nOutWidth == rCmp.GetOutWidth() ) &&
- ( nDistance == rCmp.GetDistance() ) );
+ ( nDistance == rCmp.GetDistance() ) &&
+ ( m_nStyle == rCmp.GetStyle() ) );
}
// -----------------------------------------------------------------------
@@ -1825,15 +1830,16 @@ int SvxBoxItem::operator==( const SfxPoolItem& rAttr ) const
}
// -----------------------------------------------------------------------
-table::BorderLine SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, sal_Bool bConvert)
+table::BorderLine2 SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, sal_Bool bConvert)
{
- table::BorderLine aLine;
+ table::BorderLine2 aLine;
if(pLine)
{
aLine.Color = pLine->GetColor().GetColor() ;
aLine.InnerLineWidth = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetInWidth() ): pLine->GetInWidth() );
aLine.OuterLineWidth = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetOutWidth()): pLine->GetOutWidth() );
aLine.LineDistance = sal_uInt16( bConvert ? TWIP_TO_MM100_UNSIGNED(pLine->GetDistance()): pLine->GetDistance() );
+ aLine.LineStyle = pLine->GetStyle( );
}
else
aLine.Color = aLine.InnerLineWidth = aLine.OuterLineWidth = aLine.LineDistance = 0;
@@ -1843,7 +1849,7 @@ table::BorderLine SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, sal_Bool
bool SvxBoxItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
{
sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- table::BorderLine aRetLine;
+ table::BorderLine2 aRetLine;
sal_uInt16 nDist = 0;
sal_Bool bDistMember = sal_False;
nMemberId &= ~CONVERT_TWIPS;
@@ -2780,7 +2786,7 @@ void SvxBoxInfoItem::ResetFlags()
bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, BYTE nMemberId ) const
{
sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
- table::BorderLine aRetLine;
+ table::BorderLine2 aRetLine;
sal_Int16 nVal=0;
sal_Bool bIntMember = sal_False;
nMemberId &= ~CONVERT_TWIPS;
@@ -3321,6 +3327,7 @@ bool SvxLineItem::PutValue( const uno::Any& rVal, BYTE nMemId )
case MID_OUTER_WIDTH: pLine->SetOutWidth((USHORT)nVal); break;
case MID_INNER_WIDTH: pLine->SetInWidth((USHORT)nVal); break;
case MID_DISTANCE: pLine->SetDistance((USHORT)nVal); break;
+ case MID_LINE_STYLE: pLine->SetStyle((SvxBorderStyle)nVal); break;
default:
DBG_ERROR( "Wrong MemberId" );
return sal_False;
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 89b44be23ba8..dccbf5c7cab3 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -1627,10 +1627,15 @@ case RTF_BRDRBAR: break;
}
goto SETBORDERLINE;
- case RTF_BRDRS:
case RTF_BRDRDOT:
- case RTF_BRDRHAIR:
+ aBrd.SetStyle( DOTTED );
+ break;
case RTF_BRDRDASH:
+ aBrd.SetStyle( DASHED );
+ break;
+ case RTF_BRDRS:
+ case RTF_BRDRHAIR:
+ aBrd.SetStyle( SOLID );
SETBORDERLINE:
SetBorderLine( nBorderTyp, aAttr, aBrd );
break;
diff --git a/svx/inc/svx/framelink.hxx b/svx/inc/svx/framelink.hxx
index 9d5e2cd3b1c6..c6bbbe6b8424 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 b342c58809bb..e398369f61cf 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 8d9ebac5a5aa..d7a41f8438ac 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 3df38d648d8d..7f0a3abfbd9a 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 0f5467c99721..6a99b0608cda 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 63d1066e7149..1d8956b405b6 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 813a4b131536..9718b8c70dde 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 );
diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx
index 3f379bba32ca..c5118b17bf0a 100644
--- a/xmloff/source/style/PageMasterExportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterExportPropMapper.cxx
@@ -30,7 +30,7 @@
#include "PageMasterExportPropMapper.hxx"
#include <xmloff/xmltoken.hxx>
#include <comphelper/types.hxx>
-#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
#include <xmloff/PageMasterStyleMap.hxx>
#include <tools/debug.hxx>
#include <rtl/ustrbuf.hxx>
@@ -52,10 +52,11 @@ inline sal_Bool lcl_HasSameLineWidth( const table::BorderLine& rLine1, const tab
(rLine1.LineDistance == rLine2.LineDistance);
}
-inline sal_Bool operator==( const table::BorderLine& rLine1, const table::BorderLine& rLine2 )
+inline sal_Bool operator==( const table::BorderLine2& rLine1, const table::BorderLine2& rLine2 )
{
return (rLine1.Color == rLine2.Color) &&
- lcl_HasSameLineWidth( rLine1, rLine2 );
+ lcl_HasSameLineWidth( rLine1, rLine2 ) &&
+ ( rLine1.LineStyle == rLine2.LineStyle );
}
inline void lcl_RemoveState( XMLPropertyState* pState )
@@ -131,7 +132,7 @@ void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& )
{
if( pPMBorderTop && pPMBorderBottom && pPMBorderLeft && pPMBorderRight )
{
- table::BorderLine aLineTop, aLineBottom, aLineLeft, aLineRight;
+ table::BorderLine2 aLineTop, aLineBottom, aLineLeft, aLineRight;
pPMBorderTop->maValue >>= aLineTop;
pPMBorderBottom->maValue >>= aLineBottom;
@@ -156,7 +157,7 @@ void XMLPropertyStateBuffer::ContextFilter( ::std::vector< XMLPropertyState >& )
{
if( pPMBorderWidthTop && pPMBorderWidthBottom && pPMBorderWidthLeft && pPMBorderWidthRight )
{
- table::BorderLine aLineTop, aLineBottom, aLineLeft, aLineRight;
+ table::BorderLine2 aLineTop, aLineBottom, aLineLeft, aLineRight;
pPMBorderWidthTop->maValue >>= aLineTop;
pPMBorderWidthBottom->maValue >>= aLineBottom;
diff --git a/xmloff/source/style/PageMasterImportPropMapper.cxx b/xmloff/source/style/PageMasterImportPropMapper.cxx
index 5edec583e109..196aa81d0a8e 100644
--- a/xmloff/source/style/PageMasterImportPropMapper.cxx
+++ b/xmloff/source/style/PageMasterImportPropMapper.cxx
@@ -33,7 +33,7 @@
#include "PageMasterPropMapper.hxx"
#include <xmloff/PageMasterStyleMap.hxx>
#include <xmloff/maptype.hxx>
-#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <xmloff/xmlimp.hxx>
@@ -204,11 +204,11 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >&
pBorderWidths[i]->mnIndex = -1;
if( pBorders[i] )
{
- table::BorderLine aBorderLine;
+ table::BorderLine2 aBorderLine;
pBorders[i]->maValue >>= aBorderLine;
if( pBorderWidths[i] )
{
- table::BorderLine aBorderLineWidth;
+ table::BorderLine2 aBorderLineWidth;
pBorderWidths[i]->maValue >>= aBorderLineWidth;
aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
@@ -226,11 +226,11 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >&
pHeaderBorderWidths[i]->mnIndex = -1;
if( pHeaderBorders[i] )
{
- table::BorderLine aBorderLine;
+ table::BorderLine2 aBorderLine;
pHeaderBorders[i]->maValue >>= aBorderLine;
if( pHeaderBorderWidths[i] )
{
- table::BorderLine aBorderLineWidth;
+ table::BorderLine2 aBorderLineWidth;
pHeaderBorderWidths[i]->maValue >>= aBorderLineWidth;
aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
@@ -248,11 +248,11 @@ void PageMasterImportPropertyMapper::finished(::std::vector< XMLPropertyState >&
pFooterBorderWidths[i]->mnIndex = -1;
if( pFooterBorders[i] )
{
- table::BorderLine aBorderLine;
+ table::BorderLine2 aBorderLine;
pFooterBorders[i]->maValue >>= aBorderLine;
if( pFooterBorderWidths[i] )
{
- table::BorderLine aBorderLineWidth;
+ table::BorderLine2 aBorderLineWidth;
pFooterBorderWidths[i]->maValue >>= aBorderLineWidth;
aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
diff --git a/xmloff/source/style/bordrhdl.cxx b/xmloff/source/style/bordrhdl.cxx
index 5611bbd1f472..4b8aa24b5c8a 100644
--- a/xmloff/source/style/bordrhdl.cxx
+++ b/xmloff/source/style/bordrhdl.cxx
@@ -34,7 +34,7 @@
#include <xmloff/xmluconv.hxx>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
@@ -42,6 +42,10 @@ using ::rtl::OUStringBuffer;
using namespace ::com::sun::star;
using namespace ::xmloff::token;
+const sal_Int16 API_LINE_SOLID = 0;
+const sal_Int16 API_LINE_DOTTED = 1;
+const sal_Int16 API_LINE_DASHED = 2;
+
// copied from svx/boxitem.hxx
#define DEF_LINE_WIDTH_0 1
#define DEF_LINE_WIDTH_1 35
@@ -101,6 +105,8 @@ using namespace ::xmloff::token;
#define SVX_XML_BORDER_STYLE_NONE 0
#define SVX_XML_BORDER_STYLE_SOLID 1
#define SVX_XML_BORDER_STYLE_DOUBLE 2
+#define SVX_XML_BORDER_STYLE_DASHED 3
+#define SVX_XML_BORDER_STYLE_DOTTED 4
#define SVX_XML_BORDER_WIDTH_THIN 0
#define SVX_XML_BORDER_WIDTH_MIDDLE 1
@@ -112,8 +118,8 @@ SvXMLEnumMapEntry pXML_BorderStyles[] =
{ XML_HIDDEN, SVX_XML_BORDER_STYLE_NONE },
{ XML_SOLID, SVX_XML_BORDER_STYLE_SOLID },
{ XML_DOUBLE, SVX_XML_BORDER_STYLE_DOUBLE },
- { XML_DOTTED, SVX_XML_BORDER_STYLE_SOLID },
- { XML_DASHED, SVX_XML_BORDER_STYLE_SOLID },
+ { XML_DOTTED, SVX_XML_BORDER_STYLE_DOTTED },
+ { XML_DASHED, SVX_XML_BORDER_STYLE_DASHED },
{ XML_GROOVE, SVX_XML_BORDER_STYLE_SOLID },
{ XML_RIDGE, SVX_XML_BORDER_STYLE_SOLID },
{ XML_INSET, SVX_XML_BORDER_STYLE_SOLID },
@@ -171,6 +177,23 @@ static sal_uInt16 __READONLY_DATA aDBorderWidths[] =
DBORDER_ENTRY( 5 )
};
+void lcl_frmitems_setXMLBorderStyle( table::BorderLine2 & rBorderLine, sal_uInt16 nStyle )
+{
+ sal_Int16 eStyle = API_LINE_SOLID;
+ switch ( nStyle )
+ {
+ case SVX_XML_BORDER_STYLE_DOTTED:
+ eStyle = API_LINE_DOTTED;
+ break;
+ case SVX_XML_BORDER_STYLE_DASHED:
+ eStyle = API_LINE_DASHED;
+ break;
+ default:
+ break;
+ }
+ rBorderLine.LineStyle = eStyle;
+}
+
void lcl_frmitems_setXMLBorderWidth( table::BorderLine &rBorderLine,
sal_uInt16 nWidth, sal_Bool bDouble )
{
@@ -273,7 +296,7 @@ sal_Bool XMLBorderWidthHdl::importXML( const OUString& rStrImpValue, uno::Any& r
sal_uInt16 nWidth = i < nSize ? 0 : nOutWidth + nInWidth + nDistance;
#endif
- table::BorderLine aBorderLine;
+ table::BorderLine2 aBorderLine;
if(!(rValue >>= aBorderLine))
aBorderLine.Color = 0;
@@ -289,7 +312,7 @@ sal_Bool XMLBorderWidthHdl::exportXML( OUString& rStrExpValue, const uno::Any& r
{
OUStringBuffer aOut;
- table::BorderLine aBorderLine;
+ table::BorderLine2 aBorderLine;
if(!(rValue >>= aBorderLine))
return sal_False;
@@ -368,7 +391,7 @@ sal_Bool XMLBorderHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue
if( !bHasStyle || (SVX_XML_BORDER_STYLE_NONE != nStyle && !bHasWidth) )
return sal_False;
- table::BorderLine aBorderLine;
+ table::BorderLine2 aBorderLine;
if(!(rValue >>= aBorderLine))
{
aBorderLine.Color = 0;
@@ -400,11 +423,13 @@ sal_Bool XMLBorderHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue
else
{
lcl_frmitems_setXMLBorderWidth( aBorderLine, nWidth, bDouble );
+ lcl_frmitems_setXMLBorderStyle( aBorderLine, nStyle );
}
}
else
{
lcl_frmitems_setXMLBorderWidth( aBorderLine, 0, bDouble );
+ lcl_frmitems_setXMLBorderStyle( aBorderLine, nStyle );
}
// set color
@@ -419,7 +444,7 @@ sal_Bool XMLBorderHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue
{
OUStringBuffer aOut;
- table::BorderLine aBorderLine;
+ table::BorderLine2 aBorderLine;
if(!(rValue >>= aBorderLine))
return sal_False;
@@ -441,7 +466,20 @@ sal_Bool XMLBorderHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue
aOut.append( sal_Unicode( ' ' ) );
- aOut.append( GetXMLToken((0 == nDistance) ? XML_SOLID : XML_DOUBLE) );
+ XMLTokenEnum eStyleToken = XML_SOLID;
+ switch ( aBorderLine.LineStyle )
+ {
+ case API_LINE_DASHED:
+ eStyleToken = XML_DASHED;
+ break;
+ case API_LINE_DOTTED:
+ eStyleToken = XML_DOTTED;
+ break;
+ case API_LINE_SOLID:
+ default:
+ eStyleToken = XML_SOLID;
+ }
+ aOut.append( GetXMLToken((0 == nDistance) ? eStyleToken : XML_DOUBLE) );
aOut.append( sal_Unicode( ' ' ) );
diff --git a/xmloff/source/text/txtexppr.cxx b/xmloff/source/text/txtexppr.cxx
index 7b3c7e828683..4b85994f2e0c 100644
--- a/xmloff/source/text/txtexppr.cxx
+++ b/xmloff/source/text/txtexppr.cxx
@@ -29,7 +29,7 @@
#include "precompiled_xmloff.hxx"
#include <tools/debug.hxx>
#include <xmloff/txtprmap.hxx>
-#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/text/SizeType.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
@@ -692,7 +692,7 @@ void XMLTextExportPropertySetMapper::ContextFilter(
{
if( pLeftBorderWidthState && pRightBorderWidthState && pTopBorderWidthState && pBottomBorderWidthState )
{
- table::BorderLine aLeft, aRight, aTop, aBottom;
+ table::BorderLine2 aLeft, aRight, aTop, aBottom;
pLeftBorderWidthState->maValue >>= aLeft;
pRightBorderWidthState->maValue >>= aRight;
@@ -700,10 +700,13 @@ void XMLTextExportPropertySetMapper::ContextFilter(
pBottomBorderWidthState->maValue >>= aBottom;
if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
+ aLeft.LineStyle == aRight.LineStyle &&
aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
+ aLeft.LineStyle == aTop.LineStyle &&
aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
- aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance )
+ aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
+ aLeft.LineStyle == aBottom.LineStyle )
{
pLeftBorderWidthState->mnIndex = -1;
pLeftBorderWidthState->maValue.clear();
@@ -765,7 +768,7 @@ void XMLTextExportPropertySetMapper::ContextFilter(
{
if( pLeftBorderState && pRightBorderState && pTopBorderState && pBottomBorderState )
{
- table::BorderLine aLeft, aRight, aTop, aBottom;
+ table::BorderLine2 aLeft, aRight, aTop, aBottom;
pLeftBorderState->maValue >>= aLeft;
pRightBorderState->maValue >>= aRight;
@@ -773,10 +776,13 @@ void XMLTextExportPropertySetMapper::ContextFilter(
pBottomBorderState->maValue >>= aBottom;
if( aLeft.Color == aRight.Color && aLeft.InnerLineWidth == aRight.InnerLineWidth &&
aLeft.OuterLineWidth == aRight.OuterLineWidth && aLeft.LineDistance == aRight.LineDistance &&
+ aLeft.LineStyle == aRight.LineStyle &&
aLeft.Color == aTop.Color && aLeft.InnerLineWidth == aTop.InnerLineWidth &&
aLeft.OuterLineWidth == aTop.OuterLineWidth && aLeft.LineDistance == aTop.LineDistance &&
+ aLeft.LineStyle == aTop.LineStyle &&
aLeft.Color == aBottom.Color && aLeft.InnerLineWidth == aBottom.InnerLineWidth &&
- aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance )
+ aLeft.OuterLineWidth == aBottom.OuterLineWidth && aLeft.LineDistance == aBottom.LineDistance &&
+ aLeft.LineStyle == aBottom.LineStyle )
{
pLeftBorderState->mnIndex = -1;
pLeftBorderState->maValue.clear();
diff --git a/xmloff/source/text/txtimppr.cxx b/xmloff/source/text/txtimppr.cxx
index fa2f4cc08273..be8db5d384aa 100644
--- a/xmloff/source/text/txtimppr.cxx
+++ b/xmloff/source/text/txtimppr.cxx
@@ -30,7 +30,7 @@
#include <tools/debug.hxx>
#include <com/sun/star/awt/FontFamily.hpp>
#include <com/sun/star/awt/FontPitch.hpp>
-#include <com/sun/star/table/BorderLine.hpp>
+#include <com/sun/star/table/BorderLine2.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
#include <com/sun/star/text/SizeType.hpp>
#include <tools/string.hxx>
@@ -438,12 +438,12 @@ void XMLTextImportPropertyMapper::finished(
sal_Bool bHasBorder = sal_False;
if( pBorders[i] )
{
- table::BorderLine aBorderLine;
+ table::BorderLine2 aBorderLine;
pBorders[i]->maValue >>= aBorderLine;
if( pBorderWidths[i] )
{
- table::BorderLine aBorderLineWidth;
+ table::BorderLine2 aBorderLineWidth;
pBorderWidths[i]->maValue >>= aBorderLineWidth;
aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;
aBorderLine.InnerLineWidth = aBorderLineWidth.InnerLineWidth;
@@ -492,10 +492,10 @@ void XMLTextImportPropertyMapper::finished(
#else
if( pBorders[i] && pBorderWidths[i] )
{
- table::BorderLine aBorderLine;
+ table::BorderLine2 aBorderLine;
pBorders[i]->maValue >>= aBorderLine;
- table::BorderLine aBorderLineWidth;
+ table::BorderLine2 aBorderLineWidth;
pBorderWidths[i]->maValue >>= aBorderLineWidth;
aBorderLine.OuterLineWidth = aBorderLineWidth.OuterLineWidth;