diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2018-02-20 00:30:27 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2018-02-21 13:32:10 +0100 |
commit | edca2b8eecf14d6e9b10acb501985d68f6b992d4 (patch) | |
tree | 5b8be5c73d69273efaf882ce0761a86cd3a94ec1 /editeng/source | |
parent | db7d2a81bd0cb9b25dd239fa30a7005d0b69462f (diff) |
tdf#115639: Handle alignment correctly for multiple paragraph case
I used the wrong calculator method to get the line width.
This commit also fixes the crashes found by crashtest.
Reviewed-on: https://gerrit.libreoffice.org/49994
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
(cherry picked from commit f0485ba2d90aae0312f5775588f22789016165d2)
Change-Id: I25392f86af912ee54c07b14480d82282210ac346
Reviewed-on: https://gerrit.libreoffice.org/50018
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/editeng.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit.hxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/impedit3.cxx | 4 |
4 files changed, 7 insertions, 7 deletions
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index dca25cc94873..330b57822f7c 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1434,13 +1434,13 @@ sal_uInt32 EditEngine::GetTextHeightNTP() const return pImpEditEngine->GetTextHeightNTP(); } -sal_uInt32 EditEngine::CalcTextWidth(bool bIgnoreTrailingWhiteSpaces) +sal_uInt32 EditEngine::CalcTextWidth() { if ( !pImpEditEngine->IsFormatted() ) pImpEditEngine->FormatDoc(); - sal_uInt32 nWidth = !IsVertical() ? pImpEditEngine->CalcTextWidth( true, bIgnoreTrailingWhiteSpaces ) : pImpEditEngine->GetTextHeight(); + sal_uInt32 nWidth = !IsVertical() ? pImpEditEngine->CalcTextWidth( true ) : pImpEditEngine->GetTextHeight(); return nWidth; } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index c1bdddbece80..70704890b752 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -824,7 +824,7 @@ public: sal_uInt32 CalcTextHeight( sal_uInt32* pHeightNTP ); sal_uInt32 GetTextHeight() const; sal_uInt32 GetTextHeightNTP() const; - sal_uInt32 CalcTextWidth( bool bIgnoreExtraSpace, bool bIgnoreTrailingWhiteSpaces = false ); + sal_uInt32 CalcTextWidth( bool bIgnoreExtraSpace ); sal_uInt32 CalcLineWidth( ParaPortion* pPortion, EditLine* pLine, bool bIgnoreExtraSpace, bool bIgnoreTrailingWhiteSpaces = false ); sal_Int32 GetLineCount( sal_Int32 nParagraph ) const; sal_Int32 GetLineLen( sal_Int32 nParagraph, sal_Int32 nLine ) const; diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index a6e3542547bd..76009022f7f4 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -3042,7 +3042,7 @@ sal_uInt32 ImpEditEngine::GetTextHeight() const return nCurTextHeight; } -sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace, bool bIgnoreTrailingWhiteSpaces ) +sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace ) { // If still not formatted and not in the process. // Will be brought in the formatting for AutoPageSize. @@ -3089,7 +3089,7 @@ sal_uInt32 ImpEditEngine::CalcTextWidth( bool bIgnoreExtraSpace, bool bIgnoreTra } } nCurWidth += GetXValue( rLRItem.GetRight() ); - nCurWidth += CalcLineWidth( pPortion, &rLine, bIgnoreExtraSpace, bIgnoreTrailingWhiteSpaces ); + nCurWidth += CalcLineWidth( pPortion, &rLine, bIgnoreExtraSpace ); if ( nCurWidth > nMaxWidth ) { nMaxWidth = nCurWidth; diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 7f53110bccd6..e021aac81082 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1471,7 +1471,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) { long n; if(IsHoriAlignIgnoreTrailingWhitespace()) - n = ( nMaxLineWidth - CalcTextWidth( true, true ) ) / 2; + n = ( nMaxLineWidth - CalcLineWidth( pParaPortion, pLine, false, true ) ) / 2; else n = ( nMaxLineWidth - aTextSize.Width() ) / 2; n += nStartX; // Indentation is kept. @@ -1484,7 +1484,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) // the blank must not be displayed! long n; if(IsHoriAlignIgnoreTrailingWhitespace()) - n = nMaxLineWidth - CalcTextWidth( true, true ); + n = nMaxLineWidth - CalcLineWidth( pParaPortion, pLine, false, true ); else n = nMaxLineWidth - aTextSize.Width(); n += nStartX; // Indentation is kept. |