summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/items/borderline.cxx21
-rw-r--r--editeng/source/items/frmitems.cxx30
-rw-r--r--editeng/source/rtf/rtfitem.cxx5
3 files changed, 39 insertions, 17 deletions
diff --git a/editeng/source/items/borderline.cxx b/editeng/source/items/borderline.cxx
index 87a21ba901..0e25bba482 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 5d523f8762..ffb6c1b6fa 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
@@ -1794,8 +1797,15 @@ SvxBoxItem::LineToSvxLine(const ::com::sun::star::table::BorderLine2& rLine, Svx
break;
}
rSvxLine.SetStyle( nStyle );
+
+ 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);
+ 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 057cd2ec7d..85ee6b9416 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;
}