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

Zolnai Tamás zolnaitamas2000 at gmail.com
Wed Sep 18 05:25:21 PDT 2013


 sw/source/core/text/inftxt.cxx  |   39 +++++++++++++++++++++++++--------------
 sw/source/core/text/itrcrsr.cxx |   12 +++++++-----
 2 files changed, 32 insertions(+), 19 deletions(-)

New commits:
commit 7ef89c96cc27aee96ceb947c7b676d56b55cd7b5
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Wed Sep 18 14:16:24 2013 +0200

    Make the code of character border a bit robust
    
    Change-Id: I62a6c932745ee8ff5adeed00df808b62cbb9884f

diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 41d569b..e680672 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -639,7 +639,7 @@ void SwTxtPaintInfo::_DrawText( const OUString &rText, const SwLinePortion &rPor
 
     // Draw text next to the left border
     Point aFontPos(aPos);
-    if( !static_cast<const SwTxtPortion&>(rPor).GetJoinBorderWithPrev() )
+    if( m_pFnt->GetLeftBorder() && !static_cast<const SwTxtPortion&>(rPor).GetJoinBorderWithPrev() )
     {
         const sal_uInt16 nLeftBorderSpace = m_pFnt->GetLeftBorderSpace();
         if ( GetTxtFrm()->IsRightToLeft() )
@@ -664,6 +664,10 @@ void SwTxtPaintInfo::_DrawText( const OUString &rText, const SwLinePortion &rPor
                     break;
             }
         }
+        if( aFontPos.X() < 0 )
+            aFontPos.X() = 0;
+        if( aFontPos.X() < 0 )
+            aFontPos.X() = 0;
     }
 
     if( GetTxtFly()->IsOn() )
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index e524c5e..1e981892 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -940,12 +940,13 @@ void SwTxtCursor::_GetCharRect( SwRect* pOrig, const xub_StrLen nOfst,
                                 {
                                     pCurrPart = pCurrPart->GetFollow();
                                 }
-                                if( pCurrPart && nSumLength != nOfst - aInf.GetIdx() && !pCurrPart->GetJoinBorderWithNext() )
+                                if( pCurrPart && nSumLength != nOfst - aInf.GetIdx() &&
+                                    pCurrPart->GetFont().GetRightBorder() && !pCurrPart->GetJoinBorderWithNext() )
                                 {
                                     nX -= pCurrPart->GetFont().GetRightBorderSpace();
                                 }
                             }
-                            else if( !pPor->GetJoinBorderWithNext())
+                            else if( GetInfo().GetFont()->GetRightBorder() && !pPor->GetJoinBorderWithNext())
                             {
                                 nX -= GetInfo().GetFont()->GetRightBorderSpace();
                             }
@@ -1650,11 +1651,12 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
                     while( pCurrPart && nSumWidth <= nX - nCurrStart )
                     {
                         nSumWidth += pCurrPart->GetWidth();
-                        if( !pCurrPart->GetJoinBorderWithPrev() )
+                        if( pCurrPart->GetFont().GetLeftBorder() && !pCurrPart->GetJoinBorderWithPrev() )
                         {
                             nSumBorderWidth += pCurrPart->GetFont().GetLeftBorderSpace();
                         }
-                        if( nSumWidth <= nX - nCurrStart && !pCurrPart->GetJoinBorderWithNext() )
+                        if( nSumWidth <= nX - nCurrStart && pCurrPart->GetFont().GetRightBorder() &&
+                            !pCurrPart->GetJoinBorderWithNext() )
                         {
                             nSumBorderWidth += pCurrPart->GetFont().GetRightBorderSpace();
                         }
@@ -1663,7 +1665,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
                     nX = std::max(0, nX - nSumBorderWidth);
                 }
                 // Shift the offset with the left border width
-                else if( !pPor->GetJoinBorderWithPrev() )
+                else if( GetInfo().GetFont()->GetLeftBorder() && !pPor->GetJoinBorderWithPrev() )
                 {
                     nX = std::max(0, nX - GetInfo().GetFont()->GetLeftBorderSpace());
                 }
commit 89093f50cd0b25f9789fc7023fee116a839fd3aa
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Wed Sep 18 13:21:53 2013 +0200

    Fix RTL character border
    
    Change-Id: I9cad3f7689e5badafb7fe2cd3f707e3f226c9725

diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index cf8e582..41d569b 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -642,20 +642,27 @@ void SwTxtPaintInfo::_DrawText( const OUString &rText, const SwLinePortion &rPor
     if( !static_cast<const SwTxtPortion&>(rPor).GetJoinBorderWithPrev() )
     {
         const sal_uInt16 nLeftBorderSpace = m_pFnt->GetLeftBorderSpace();
-        switch( m_pFnt->GetOrientation(GetTxtFrm()->IsVertical()) )
+        if ( GetTxtFrm()->IsRightToLeft() )
         {
-            case 0 :
-                aFontPos.X() += nLeftBorderSpace;
-                break;
-            case 900 :
-                aFontPos.Y() -= nLeftBorderSpace;
-                break;
-            case 1800 :
-                aFontPos.X() -= nLeftBorderSpace;
-                break;
-            case 2700 :
-                aFontPos.Y() += nLeftBorderSpace;
-                break;
+            aFontPos.X() -= nLeftBorderSpace;
+        }
+        else
+        {
+            switch( m_pFnt->GetOrientation(GetTxtFrm()->IsVertical()) )
+            {
+                case 0 :
+                    aFontPos.X() += nLeftBorderSpace;
+                    break;
+                case 900 :
+                    aFontPos.Y() -= nLeftBorderSpace;
+                    break;
+                case 1800 :
+                    aFontPos.X() -= nLeftBorderSpace;
+                    break;
+                case 2700 :
+                    aFontPos.Y() += nLeftBorderSpace;
+                    break;
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list