diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2010-11-08 16:20:15 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-03-19 17:57:16 +0100 |
commit | 97394f1e75d0f0013e883159a30d0291264e35d5 (patch) | |
tree | aa256779d39f78d2a350a383a087d010d5f56dc2 /editeng | |
parent | dbe9e685aceda03418026547a4207bfc6619d041 (diff) |
Borders: Started to impact the changes of SvxBorderLine
Diffstat (limited to 'editeng')
-rwxr-xr-x | editeng/inc/editeng/borderline.hxx | 9 | ||||
-rw-r--r-- | editeng/source/items/frmitems.cxx | 65 |
2 files changed, 58 insertions, 16 deletions
diff --git a/editeng/inc/editeng/borderline.hxx b/editeng/inc/editeng/borderline.hxx index 3dc90aa6d7..51bea3ecea 100755 --- a/editeng/inc/editeng/borderline.hxx +++ b/editeng/inc/editeng/borderline.hxx @@ -146,9 +146,12 @@ public: Color GetColorIn( bool bLeftOrTop = true ) const; bool HasGapColor() const { return m_pColorGapFn != NULL; } Color GetColorGap() const; - sal_uInt16 GetOutWidth() const; - sal_uInt16 GetInWidth() const; - sal_uInt16 GetDistance() const; + + void SetWidth( long nWidth = 0 ) { m_nWidth = nWidth; } + void SetLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nIn, sal_uInt16 nOut, sal_uInt16 nDist ); + sal_uInt16 GetOutWidth() const; + sal_uInt16 GetInWidth() const; + sal_uInt16 GetDistance() const; SvxBorderStyle GetStyle() const { return m_nStyle; } diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index d2ac77dfa3..06b6efa4d5 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1730,17 +1730,23 @@ void SvxBorderLine::ScaleMetrics( long nMult, long nDiv ) m_nDiv = nDiv; } -USHORT SvxBorderLine::GetOutWidth() const +void SvxBorderLine::SetLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nIn, sal_uInt16 nOut, sal_uInt16 nDist ) { - return (sal_uInt16)Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ); + SetStyle( nStyle ); + m_nWidth = m_aWidthImpl.GuessWidth( nIn, nOut, nDist ); } -USHORT SvxBorderLine::GetInWidth() const +sal_uInt16 SvxBorderLine::GetOutWidth() const { return (sal_uInt16)Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ); } -USHORT SvxBorderLine::GetDistance() const +sal_uInt16 SvxBorderLine::GetInWidth() const +{ + return (sal_uInt16)Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ); +} + +sal_uInt16 SvxBorderLine::GetDistance() const { return (sal_uInt16)Scale( m_aWidthImpl.GetGap( m_nWidth ), m_nMult, m_nDiv ); } @@ -2105,9 +2111,10 @@ sal_Bool lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) { rSvxLine.SetColor( Color(rLine.Color)); - rSvxLine.SetInWidth( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.InnerLineWidth) : rLine.InnerLineWidth )); - rSvxLine.SetOutWidth( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.OuterLineWidth) : rLine.OuterLineWidth )); - rSvxLine.SetDistance( sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.LineDistance ) : rLine.LineDistance )); + rSvxLine.SetLinesWidth( rSvxLine.GetStyle(), + sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.InnerLineWidth) : rLine.InnerLineWidth ), + sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.OuterLineWidth) : rLine.OuterLineWidth ), + sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.LineDistance ) : rLine.LineDistance )); sal_Bool bRet = rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0; return bRet; @@ -2124,23 +2131,55 @@ sal_Bool SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine& rL sal_Bool SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) { - const bool bRet(lcl_lineToSvxLine(rLine, rSvxLine, bConvert)); - switch ( rLine.LineStyle ) { default: case table::BorderLineStyle::SOLID: - rSvxLine.SetStyle( SOLID ); + nStyle = SOLID; break; case table::BorderLineStyle::DOTTED: - rSvxLine.SetStyle( DOTTED ); + nStyle = DOTTED; break; case table::BorderLineStyle::DASHED: - rSvxLine.SetStyle( DASHED ); + nStyle = DASHED; + break; + case table::BorderLineStyle::DOUBLE: + nStyle = DOUBLE; + break; + case table::BorderLineStyle::THINTHICK_SMALLGAP: + nStyle = THINTHICK_SMALLGAP; + break; + case table::BorderLineStyle::THINTHICK_MEDIUMGAP: + nStyle = THINTHICK_MEDIUMGAP; + break; + case table::BorderLineStyle::THINTHICK_LARGEGAP: + nStyle = THINTHICK_LARGEGAP; + break; + case table::BorderLineStyle::THICKTHIN_SMALLGAP: + nStyle = THICKTHIN_SMALLGAP; + break; + case table::BorderLineStyle::THICKTHIN_MEDIUMGAP: + nStyle = THICKTHIN_MEDIUMGAP; + break; + case table::BorderLineStyle::THICKTHIN_LARGEGAP: + nStyle = THICKTHIN_LARGEGAP; + break; + case table::BorderLineStyle::EMBOSSED: + nStyle = EMBOSSED; + break; + case table::BorderLineStyle::ENGRAVED: + nStyle = ENGRAVED; + break; + case table::BorderLineStyle::OUTSET: + nStyle = OUTSET; + break; + case table::BorderLineStyle::INSET: + nStyle = INSET; break; } + rSvxLine.SetStyle( nStyle ); - return bRet; + return lcl_lineToSvxLine(rLine, rSvxLine, bConvert); } // ----------------------------------------------------------------------- |