[Libreoffice-commits] core.git: sw/source

Zolnai Tamás zolnaitamas2000 at gmail.com
Sun Aug 18 02:34:18 PDT 2013


 sw/source/core/inc/swfont.hxx  |   27 +--------------------------
 sw/source/core/text/inftxt.cxx |   32 +++++++++-----------------------
 sw/source/core/text/inftxt.hxx |    2 +-
 3 files changed, 11 insertions(+), 50 deletions(-)

New commits:
commit 3b68a17b49413e3d20a32c6a1bce3a74b9da1477
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Sun Aug 18 10:55:35 2013 +0200

    Revert "Reduce text background painting rect with border"
    
    This reverts commit cc7a94cfa8ec901627e8f9abf28c724923deb520.
    MS Word has the concept not to paint background for
    the border line.
    But LibreOffice follow the general html box model which
    paint background for border too. So in case of double line
    the border's gap has the same color as the background.
    So the reverted patch can't fit to the general concept.

diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index d7a6eb5..82acffd 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -396,12 +396,7 @@ public:
     sal_uInt16 GetRightBorderDist() const { return m_nRightBorderDist; }
     sal_uInt16 GetLeftBorderDist() const { return m_nLeftBorderDist; }
 
-    sal_uInt16 GetTopBorderWidth() const;
-    sal_uInt16 GetBottomBorderWidth() const;
-    sal_uInt16 GetRightBorderWidth() const;
-    sal_uInt16 GetLeftBorderWidth() const;
-
-    // Return the border width plus spacing
+    // Return with the border width plus spacing
     sal_uInt16 GetTopBorderSpace() const;
     sal_uInt16 GetBottomBorderSpace() const;
     sal_uInt16 GetRightBorderSpace() const;
@@ -886,26 +881,6 @@ inline void SwFont::SetLeftBorderDist( const sal_uInt16 nLeftDist )
     aSub[SW_LATIN].pMagic = aSub[SW_CJK].pMagic = aSub[SW_CTL].pMagic = 0;
 }
 
-inline sal_uInt16 SwFont::GetTopBorderWidth() const
-{
-    return m_aTopBorder ? m_aTopBorder.get().GetScaledWidth() : 0;
-}
-
-inline sal_uInt16 SwFont::GetBottomBorderWidth() const
-{
-    return m_aBottomBorder ? m_aBottomBorder.get().GetScaledWidth() : 0;
-}
-
-inline sal_uInt16 SwFont::GetRightBorderWidth() const
-{
-    return m_aRightBorder ? m_aRightBorder.get().GetScaledWidth() : 0;
-}
-
-inline sal_uInt16 SwFont::GetLeftBorderWidth() const
-{
-    return m_aLeftBorder ? m_aLeftBorder.get().GetScaledWidth() : 0;
-}
-
 inline sal_uInt16 SwFont::GetTopBorderSpace() const
 {
     if( m_aTopBorder )
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 069cf8f..aff0ec9 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -748,23 +748,9 @@ void SwTxtPaintInfo::_DrawText( const XubString &rText, const SwLinePortion &rPo
 }
 
 void SwTxtPaintInfo::CalcRect( const SwLinePortion& rPor,
-                               SwRect* pRect, SwRect* pIntersect,
-                               const bool bInsideBorder ) const
+                               SwRect* pRect, SwRect* pIntersect ) const
 {
-    KSHORT nPorHeight = rPor.Height();
-    KSHORT nPorAscent = rPor.GetAscent();
-    KSHORT nPorWidth = rPor.Width();
-    SwTwips nX = X();
-
-    if( bInsideBorder )
-    {
-        nPorAscent -= GetFont()->GetTopBorderWidth();
-        nPorHeight -= GetFont()->GetTopBorderWidth() + GetFont()->GetBottomBorderWidth();
-        nPorWidth -= GetFont()->GetRightBorderWidth() + GetFont()->GetLeftBorderWidth();
-        nX += GetFont()->GetLeftBorderWidth();
-    }
-
-    Size aSize( nPorWidth, nPorHeight );
+    Size aSize( rPor.Width(), rPor.Height() );
     if( rPor.IsHangingPortion() )
         aSize.Width() = ((SwHangingPortion&)rPor).GetInnerWidth();
     if( rPor.InSpaceGrp() && GetSpaceAdd() )
@@ -784,23 +770,23 @@ void SwTxtPaintInfo::CalcRect( const SwLinePortion& rPor,
         aSize.Height() = nTmp;
         if ( 1 == GetDirection() )
         {
-            aPoint.A() = nX - nPorAscent;
+            aPoint.A() = X() - rPor.GetAscent();
             aPoint.B() = Y() - aSize.Height();
         }
         else
         {
-            aPoint.A() = nX - nPorHeight + nPorAscent;
+            aPoint.A() = X() - rPor.Height() + rPor.GetAscent();
             aPoint.B() = Y();
         }
     }
     else
     {
-        aPoint.A() = nX;
+        aPoint.A() = X();
         //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
         if ( GetTxtFrm()->IsVertLR() )
-            aPoint.B() = Y() - nPorHeight + nPorAscent;
+            aPoint.B() = Y() - rPor.Height() + rPor.GetAscent();
         else
-            aPoint.B() = Y() - nPorAscent;
+            aPoint.B() = Y() - rPor.GetAscent();
     }
 
     // Adjust x coordinate if we are inside a bidi portion
@@ -1138,7 +1124,7 @@ void SwTxtPaintInfo::DrawBackground( const SwLinePortion &rPor ) const
     OSL_ENSURE( OnWin(), "SwTxtPaintInfo::DrawBackground: printer pollution ?" );
 
     SwRect aIntersect;
-    CalcRect( rPor, 0, &aIntersect, true );
+    CalcRect( rPor, 0, &aIntersect );
 
     if ( aIntersect.HasArea() )
     {
@@ -1223,7 +1209,7 @@ void SwTxtPaintInfo::_DrawBackBrush( const SwLinePortion &rPor ) const
     OSL_ENSURE( m_pFnt->GetBackColor(), "DrawBackBrush: Lost Color" );
 
     SwRect aIntersect;
-    CalcRect( rPor, 0, &aIntersect, true );
+    CalcRect( rPor, 0, &aIntersect );
 
     if ( aIntersect.HasArea() )
     {
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index e22ec7a..c9d5d10 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -449,7 +449,7 @@ public:
     inline void NotifyURL( const SwLinePortion &rPor ) const
         { if( URLNotify() ) _NotifyURL( rPor ); }
 
-    void CalcRect( const SwLinePortion& rPor, SwRect* pRect, SwRect* pIntersect = 0, const bool bInsideBorder = false ) const;
+    void CalcRect( const SwLinePortion& rPor, SwRect* pRect, SwRect* pIntersect = 0 ) const;
 
     inline SwTwips GetPaintOfst() const;
     inline void SetPaintOfst( const SwTwips nNew );


More information about the Libreoffice-commits mailing list