diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-10-06 23:54:04 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-10-06 23:58:10 +0200 |
commit | 7db30f7aa037f52eb07cbb4fd2796bd869204af8 (patch) | |
tree | 655824d944ee2f6303810052479da12a0ed8341a /editeng | |
parent | 46247f7f126a5b9ff74ad0a160291123f12eb7ce (diff) |
fate#307731, fate#307730: Adds dotted and dashed border lines
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/borderline.hxx | 14 | ||||
-rw-r--r-- | editeng/inc/editeng/boxitem.hxx | 4 | ||||
-rw-r--r-- | editeng/inc/editeng/memberids.hrc | 2 | ||||
-rw-r--r-- | editeng/source/items/frmitems.cxx | 19 | ||||
-rw-r--r-- | editeng/source/rtf/rtfitem.cxx | 9 |
5 files changed, 37 insertions, 11 deletions
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; |