diff options
author | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-01-07 13:40:44 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedricbosdo@openoffice.org> | 2011-03-19 17:57:17 +0100 |
commit | d674abd352080308f0d21ae1b4cf4a2cb4549979 (patch) | |
tree | c1b43b49f58b8ae5ae98d1136a9c2e36b7d218b5 /editeng/source | |
parent | 9bd78655198ad497bef9872422a1004cfbf8698f (diff) |
Switching the order of the SetLinesWidth arguments
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/items/borderline.cxx | 21 | ||||
-rw-r--r-- | editeng/source/items/frmitems.cxx | 30 | ||||
-rw-r--r-- | editeng/source/rtf/rtfitem.cxx | 5 |
3 files changed, 39 insertions, 17 deletions
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx index 87a21ba90190..0e25bba482db 100644 --- a/editeng/source/items/borderline.cxx +++ b/editeng/source/items/borderline.cxx @@ -99,6 +99,7 @@ SvxBorderLine::SvxBorderLine( const Color *pCol, long nWidth, Color (*pColorOutFn)( Color ), Color (*pColorInFn)( Color ), Color (*pColorGapFn)( Color ) ) : m_nWidth( nWidth ) +, m_bMirrorWidths( false ) , m_aWidthImpl( SvxBorderLine::getWidthImpl( nStyle ) ) , m_nMult( 1 ) , m_nDiv( 1 ) @@ -216,7 +217,9 @@ SvxBorderLine::SvxBorderLine( const SvxBorderLine& r ) SvxBorderLine& SvxBorderLine::operator=( const SvxBorderLine& r ) { aColor = r.aColor; + m_nWidth = r.m_nWidth; m_aWidthImpl = r.m_aWidthImpl; + m_bMirrorWidths = r.m_bMirrorWidths; m_nStyle = r.m_nStyle; m_bUseLeftTop = r.m_bUseLeftTop; m_pColorOutFn = r.m_pColorOutFn; @@ -233,8 +236,14 @@ void SvxBorderLine::ScaleMetrics( long nMult, long nDiv ) m_nDiv = nDiv; } -void SvxBorderLine::SetLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nIn, sal_uInt16 nOut, sal_uInt16 nDist ) +void SvxBorderLine::GuessLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nOut, sal_uInt16 nIn, sal_uInt16 nDist ) { + if ( nStyle == NO_STYLE ) { + nStyle = SOLID; + if ( nOut > 0 && nIn > 0 ) + nStyle = DOUBLE; + } + if ( nStyle == DOUBLE ) { static SvxBorderStyle aDoubleStyles[] = @@ -276,17 +285,17 @@ void SvxBorderLine::SetLinesWidths( SvxBorderStyle nStyle, sal_uInt16 nIn, sal_u sal_uInt16 SvxBorderLine::GetOutWidth() const { - sal_uInt16 nOut = (sal_uInt16)Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ); + sal_uInt16 nOut = (sal_uInt16)Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ); if ( m_bMirrorWidths ) - nOut = (sal_uInt16)Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ); + nOut = (sal_uInt16)Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ); return nOut; } sal_uInt16 SvxBorderLine::GetInWidth() const { - sal_uInt16 nIn = (sal_uInt16)Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ); + sal_uInt16 nIn = (sal_uInt16)Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ); if ( m_bMirrorWidths ) - nIn = (sal_uInt16)Scale( m_aWidthImpl.GetLine1( m_nWidth ), m_nMult, m_nDiv ); + nIn = (sal_uInt16)Scale( m_aWidthImpl.GetLine2( m_nWidth ), m_nMult, m_nDiv ); return nIn; } @@ -300,6 +309,8 @@ sal_uInt16 SvxBorderLine::GetDistance() const sal_Bool SvxBorderLine::operator==( const SvxBorderLine& rCmp ) const { return ( ( aColor == rCmp.aColor ) && + ( m_nWidth == rCmp.m_nWidth ) && + ( m_bMirrorWidths == rCmp.m_bMirrorWidths ) && ( m_aWidthImpl == rCmp.m_aWidthImpl ) && ( m_nStyle == rCmp.GetStyle() ) && ( m_bUseLeftTop == rCmp.m_bUseLeftTop ) && diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index d088a8f28451..647e8cd064ac 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -1724,13 +1724,16 @@ namespace { sal_Bool -lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) +lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert, sal_Bool bGuessWidth) { rSvxLine.SetColor( Color(rLine.Color)); - rSvxLine.SetLinesWidths( 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 )); + if ( bGuessWidth ) + { + rSvxLine.GuessLinesWidths( rSvxLine.GetStyle(), + sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.OuterLineWidth) : rLine.OuterLineWidth ), + sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.InnerLineWidth) : rLine.InnerLineWidth ), + sal_uInt16( bConvert ? MM100_TO_TWIP(rLine.LineDistance ) : rLine.LineDistance )); + } sal_Bool bRet = rLine.InnerLineWidth > 0 || rLine.OuterLineWidth > 0; return bRet; @@ -1741,7 +1744,7 @@ lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_B // ----------------------------------------------------------------------- sal_Bool SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine& rLine, SvxBorderLine& rSvxLine, sal_Bool bConvert) { - return lcl_lineToSvxLine(rLine, rSvxLine, bConvert); + return lcl_lineToSvxLine(rLine, rSvxLine, bConvert, sal_True); } sal_Bool @@ -1795,7 +1798,14 @@ SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, Svx } rSvxLine.SetStyle( nStyle ); - return lcl_lineToSvxLine(rLine, rSvxLine, bConvert); + sal_Bool bGuessWidth = true; + if ( rLine->LineWidth ) + { + rSvxLine.SetWidth( bConvert? MM100_TO_TWIP_UNSIGNED( rLine->LineWidth ) : rLine->LineWidth ); + bGuessWidth = false; + } + + return lcl_lineToSvxLine(rLine, rSvxLine, bConvert, bGuessWidth); } // ----------------------------------------------------------------------- @@ -2224,7 +2234,7 @@ SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const Color aColor; rStrm >> aColor >> nOutline >> nInline >> _nDistance; SvxBorderLine aBorder( &aColor ); - aBorder.SetLinesWidths( SOLID, nInline, nOutline, _nDistance ); + aBorder.GuessLinesWidths( NO_STYLE, nOutline, nInline, _nDistance ); pAttr->SetLine( &aBorder, aLineMap[cLine] ); } @@ -2598,7 +2608,7 @@ SfxPoolItem* SvxBoxInfoItem::Create( SvStream& rStrm, sal_uInt16 ) const Color aColor; rStrm >> aColor >> nOutline >> nInline >> nDistance; SvxBorderLine aBorder( &aColor ); - aBorder.SetLinesWidths( SOLID, nInline, nOutline, nDistance ); + aBorder.GuessLinesWidths( NO_STYLE, nOutline, nInline, nDistance ); switch( cLine ) { @@ -3204,7 +3214,7 @@ SfxPoolItem* SvxLineItem::Create( SvStream& rStrm, sal_uInt16 ) const if( nOutline ) { SvxBorderLine aLine( &aColor ); - aLine.SetLinesWidths( SOLID, nInline, nOutline, nDistance ); + aLine.GuessLinesWidths( NO_STYLE, nOutline, nInline, nDistance ); _pLine->SetLine( &aLine ); } return _pLine; diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx index feaf9aa5bdd4..a782d556648c 100644 --- a/editeng/source/rtf/rtfitem.cxx +++ b/editeng/source/rtf/rtfitem.cxx @@ -1766,8 +1766,9 @@ SETBORDER: break; } nDistWidth = sal_uInt16( nTokenValue ); - aBrd.SetLinesWidths( SOLID, nInWidth, - nOutWidth, nDistWidth ); + + aBrd.GuessLinesWidths( NO_STYLE, nOutWidth, + nInWidth, nDistWidth ); SetBorderLine( nBorderTyp, aAttr, aBrd ); break; } |