summaryrefslogtreecommitdiff
path: root/sw/source/core/text/inftxt.cxx
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2023-05-12 14:47:54 -0400
committerJustin Luth <jluth@mail.com>2023-05-13 02:21:51 +0200
commitb5a22fceed57f05eb43a5fb0817afbc141610c5e (patch)
treefce05930f08d96f3d87619253743013c82dcf0c1 /sw/source/core/text/inftxt.cxx
parent06824845cc0a1b48d87554091bcac5aad8d60b4a (diff)
tdf#130363 sw layout: MS Word compatibility trailing blanks option part 4
There are also margins to be considered. Granted, the previous approach DID seem to get the right width, since MS Word doesn't paint the left border spacing either. However, since the existing situation doesn't cover that case, just remove the excess amount. Although not perfect (and this whole thing is a total hack, so perfection can hardly be expected) it is better than before. Change-Id: I9dd1e801d8fe0000de020d59c7463138e2ad9f6f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151716 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'sw/source/core/text/inftxt.cxx')
-rw-r--r--sw/source/core/text/inftxt.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index dcb1657d2801..dd436e0358c6 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1259,11 +1259,10 @@ void SwTextPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
if (GetText()[i] != CH_BLANK)
{
const sal_uInt16 nOldWidth = rPor.Width();
- const sal_uInt16 nNewWidth
- = GetTextSize(m_pOut, nullptr, GetText(), GetIdx(),
- TextFrameIndex(i + 1) - GetIdx()).Width();
-
- const_cast<SwLinePortion&>(rPor).Width( nNewWidth );
+ const sal_uInt16 nExcessWidth
+ = GetTextSize(m_pOut, nullptr, GetText(), TextFrameIndex(i + 1),
+ TextFrameIndex(nLastPos - i)).Width();
+ const_cast<SwLinePortion&>(rPor).Width(nOldWidth - nExcessWidth);
CalcRect( rPor, nullptr, &aIntersect, true );
const_cast<SwLinePortion&>(rPor).Width( nOldWidth );