[Libreoffice-commits] core.git: sw/source
Vitaliy Anderson
vanderson at smartru.com
Thu Jan 12 11:20:51 UTC 2017
sw/source/core/text/guess.cxx | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
New commits:
commit 1c1747ac13a9d895df0fcba2fbb1bd266dccd74b
Author: Vitaliy Anderson <vanderson at smartru.com>
Date: Tue Dec 20 03:00:51 2016 -0500
tdf#104668 remove the difference between MSO and LO text alignment
Change-Id: Id1964d87f6f4ec3dbcd617af2251a321c50ec428
Reviewed-on: https://gerrit.libreoffice.org/32213
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Tested-by: Mike Kaganski <mike.kaganski at collabora.com>
Reviewed-by: jan iversen <jani at documentfoundation.org>
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index f9b24e0..e347013 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -73,6 +73,28 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
SwTwips nLineWidth = rInf.Width() - rInf.X();
sal_Int32 nMaxLen = rInf.GetText().getLength() - rInf.GetIdx();
+ const SvxAdjust& rAdjust = rInf.GetTextFrame()->GetTextNode()->GetSwAttrSet().GetAdjust().GetAdjust();
+
+ // tdf#104668 space chars at the end should be cut
+ if ( rAdjust == SVX_ADJUST_RIGHT || rAdjust == SVX_ADJUST_CENTER )
+ {
+ sal_Int32 nSpaceCnt = 0;
+ for ( int i = (rInf.GetText().getLength() - 1); i >= rInf.GetIdx(); --i )
+ {
+ sal_Unicode cChar = rInf.GetText()[i];
+ if ( cChar != CH_BLANK && cChar != CH_FULL_BLANK )
+ break;
+ ++nSpaceCnt;
+ }
+ sal_Int32 nCharsCnt = nMaxLen - nSpaceCnt;
+ if ( nSpaceCnt && nCharsCnt < rPor.GetLen() )
+ {
+ nMaxLen = nCharsCnt;
+ if ( !nMaxLen )
+ return true;
+ }
+ }
+
if ( rInf.GetLen() < nMaxLen )
nMaxLen = rInf.GetLen();
@@ -212,7 +234,6 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
nBreakPos = nCutPos;
sal_Int32 nX = nBreakPos;
- const SvxAdjust& rAdjust = rInf.GetTextFrame()->GetTextNode()->GetSwAttrSet().GetAdjust().GetAdjust();
if ( rAdjust == SVX_ADJUST_LEFT )
{
// we step back until a non blank character has been found
@@ -423,7 +444,6 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
CHAR_SOFTHYPHEN == rInf.GetText()[ nBreakPos - 1 ] )
nBreakPos = rInf.GetIdx() - 1;
- const SvxAdjust& rAdjust = rInf.GetTextFrame()->GetTextNode()->GetSwAttrSet().GetAdjust().GetAdjust();
if( rAdjust != SVX_ADJUST_LEFT )
{
// Delete any blanks at the end of a line, but be careful:
More information about the Libreoffice-commits
mailing list