summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <zolnaitamas2000@gmail.com>2013-07-23 11:18:38 +0200
committerZolnai Tamás <zolnaitamas2000@gmail.com>2013-07-23 20:19:56 +0200
commitc8b4ffc2adcc744c0d7d5e68944439238828692b (patch)
treebb75f0c0340170d0f36a45e0817e85f39e41a2e5
parentcacb32caabee56cb32cdb54e54dcb8229f9205d3 (diff)
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
-rw-r--r--sw/source/core/text/itrcrsr.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index a162a24f5a7a..42ab844843de 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() ?