Kaydet (Commit) 1c1747ac authored tarafından Vitaliy Anderson's avatar Vitaliy Anderson Kaydeden (comit) jan iversen

tdf#104668 remove the difference between MSO and LO text alignment

Change-Id: Id1964d87f6f4ec3dbcd617af2251a321c50ec428
Reviewed-on: https://gerrit.libreoffice.org/32213Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
Tested-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: 's avatarjan iversen <jani@documentfoundation.org>
üst 75367918
...@@ -73,6 +73,28 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, ...@@ -73,6 +73,28 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
SwTwips nLineWidth = rInf.Width() - rInf.X(); SwTwips nLineWidth = rInf.Width() - rInf.X();
sal_Int32 nMaxLen = rInf.GetText().getLength() - rInf.GetIdx(); 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 ) if ( rInf.GetLen() < nMaxLen )
nMaxLen = rInf.GetLen(); nMaxLen = rInf.GetLen();
...@@ -212,7 +234,6 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, ...@@ -212,7 +234,6 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
nBreakPos = nCutPos; nBreakPos = nCutPos;
sal_Int32 nX = nBreakPos; sal_Int32 nX = nBreakPos;
const SvxAdjust& rAdjust = rInf.GetTextFrame()->GetTextNode()->GetSwAttrSet().GetAdjust().GetAdjust();
if ( rAdjust == SVX_ADJUST_LEFT ) if ( rAdjust == SVX_ADJUST_LEFT )
{ {
// we step back until a non blank character has been found // we step back until a non blank character has been found
...@@ -423,7 +444,6 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, ...@@ -423,7 +444,6 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
CHAR_SOFTHYPHEN == rInf.GetText()[ nBreakPos - 1 ] ) CHAR_SOFTHYPHEN == rInf.GetText()[ nBreakPos - 1 ] )
nBreakPos = rInf.GetIdx() - 1; nBreakPos = rInf.GetIdx() - 1;
const SvxAdjust& rAdjust = rInf.GetTextFrame()->GetTextNode()->GetSwAttrSet().GetAdjust().GetAdjust();
if( rAdjust != SVX_ADJUST_LEFT ) if( rAdjust != SVX_ADJUST_LEFT )
{ {
// Delete any blanks at the end of a line, but be careful: // Delete any blanks at the end of a line, but be careful:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment