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

Zolnai Tamás zolnaitamas2000 at gmail.com
Tue Jul 23 11:45:34 PDT 2013


 sw/source/core/text/itrcrsr.cxx |   11 ++++++-----
 sw/source/core/text/txtdrop.cxx |    3 +++
 2 files changed, 9 insertions(+), 5 deletions(-)

New commits:
commit 1f47b46959267a25195d4f3f5602ca638bb14c58
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Tue Jul 23 13:14:53 2013 +0200

    Fix drop caps background
    
    Background were shifted upwards with the descent
    of the character and so the default grey background
    hanged out under the user added background.
    Examples: A (no descent), S (small descent)
    Q (big descent)
    
    Change-Id: I044fc63cf9988152e7b6aa4042bcf14651e097c0

diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index d61ca5c..d708cc67 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -281,9 +281,11 @@ void SwDropPortion::PaintTxt( const SwTxtPaintInfo &rInf ) const
 
     const SwDropPortionPart* pCurrPart = GetPart();
     const xub_StrLen nOldLen = GetLen();
+    const KSHORT nOldAscent = GetAscent();
 
     const SwTwips nBasePosY  = rInf.Y();
     ((SwTxtPaintInfo&)rInf).Y( nBasePosY + nY );
+    ((SwDropPortion*)this)->SetAscent( nOldAscent + nY );
     SwDropSave aSave( rInf );
     // for text inside drop portions we let vcl handle the text directions
     SwLayoutModeModifier aLayoutModeModifier( *rInf.GetOut() );
@@ -304,6 +306,7 @@ void SwDropPortion::PaintTxt( const SwTxtPaintInfo &rInf ) const
 
     ((SwTxtPaintInfo&)rInf).Y( nBasePosY );
     ((SwDropPortion*)this)->SetLen( nOldLen );
+    ((SwDropPortion*)this)->SetAscent( nOldAscent );
 }
 
 /*************************************************************************
commit c8b4ffc2adcc744c0d7d5e68944439238828692b
Author: Zolnai Tamás <zolnaitamas2000 at gmail.com>
Date:   Tue Jul 23 11:18:38 2013 +0200

    Check explicitily the space at the end of the line
    
    Can be bugous when the last character not a space.
    I don't have any real life examples, just some extreme
    -Line break is inside a word without hyphenation
    -A tabulator follow the last character of the line and so
    this tabulator get to the next line.
    
    Change-Id: I3c5d372295b960a5cc22c19ada382d0a995787cc

diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index a162a24..42ab844 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1259,7 +1259,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
     // If necessary, as catch up, do the adjustment
     GetAdjusted();
 
-    const XubString &rText = GetInfo().GetTxt();
+    const OUString &rText = GetInfo().GetTxt();
     xub_StrLen nOffset = 0;
 
     // x is the horizontal offset within the line.
@@ -1452,7 +1452,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
             ( pPor->IsMarginPortion() && !pPor->GetPortion() &&
               // 46598: Consider the situation: We might end up behind the last character,
               // in the last line of a centered paragraph
-              nCurrStart < rText.Len() ) )
+              nCurrStart < rText.getLength() ) )
             --nCurrStart;
         else if( pPor->InFldGrp() && ((SwFldPortion*)pPor)->IsFollow()
                  && nWidth > nX )
@@ -1523,7 +1523,9 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
         }
     }
 
-    if( bLastPortion && (pCurr->GetNext() || pFrm->GetFollow() ) )
+    // Skip space at the end of the line
+    if( bLastPortion && (pCurr->GetNext() || pFrm->GetFollow() )
+        && rText[nCurrStart + nLength - 1] == ' ' )
         --nLength;
 
     if( nWidth > nX ||
@@ -1592,8 +1594,7 @@ xub_StrLen SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
             else
                 nOldProp = 0;
             {
-                OUString aText = rText;
-                SwTxtSizeInfo aSizeInf( GetInfo(), &aText, nCurrStart );
+                SwTxtSizeInfo aSizeInf( GetInfo(), &rText, nCurrStart );
                 ((SwTxtCursor*)this)->SeekAndChg( aSizeInf );
                 SwTxtSlot aDiffTxt( &aSizeInf, ((SwTxtPortion*)pPor), false, false );
                 SwFontSave aSave( aSizeInf, pPor->IsDropPortion() ?


More information about the Libreoffice-commits mailing list