summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-03-25 08:37:22 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-03-25 09:36:38 +0100
commiteb53efed80302c4ca6409c6dbd023d8ba1eb8e47 (patch)
tree7f844d60e97a86f429ef15338f2e4a01946ce33e
parent34df7e2cb95385d513e9c74cda5178e3a68d27df (diff)
sw clearing breaks: add clearing indicator during rendering
A left / right line around the break portion now allows seeing if the clearing is none, left, right or all (somewhat familiar from Word). No test for this, SwBreakPortion::Paint() is a NOP unless rendering on a window, so the metafile-based rendering used for testing won't detect the difference. Change-Id: I3ff0c89bc4bb45deb03bea43c3ee4589887dee7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132093 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--sw/source/core/text/inftxt.cxx27
1 files changed, 26 insertions, 1 deletions
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 6b1c68bf3313..7408e17f43c0 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -67,6 +67,7 @@
#include <vcl/virdev.hxx>
#include <vcl/gradient.hxx>
#include <i18nlangtag/mslangid.hxx>
+#include <formatlinebreak.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::linguistic2;
@@ -964,6 +965,13 @@ void SwTextPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const
if( !OnWin() )
return;
+ SwLineBreakClear eClear = SwLineBreakClear::NONE;
+ if (rPor.IsBreakPortion())
+ {
+ const auto& rBreakPortion = static_cast<const SwBreakPortion&>(rPor);
+ eClear = rBreakPortion.GetClear();
+ }
+
sal_uInt16 nOldWidth = rPor.Width();
const_cast<SwLinePortion&>(rPor).Width( LINE_BREAK_WIDTH );
@@ -976,7 +984,24 @@ void SwTextPaintInfo::DrawLineBreak( const SwLinePortion &rPor ) const
CHAR_LINEBREAK_RTL : CHAR_LINEBREAK;
const sal_uInt8 nOptions = 0;
- lcl_DrawSpecial( *this, rPor, aRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
+ SwRect aTextRect(aRect);
+ if (eClear == SwLineBreakClear::LEFT || eClear == SwLineBreakClear::ALL)
+ aTextRect.AddLeft(30);
+ if (eClear == SwLineBreakClear::RIGHT || eClear == SwLineBreakClear::ALL)
+ aTextRect.AddRight(-30);
+ lcl_DrawSpecial( *this, rPor, aTextRect, NON_PRINTING_CHARACTER_COLOR, cChar, nOptions );
+
+ if (eClear != SwLineBreakClear::NONE)
+ {
+ // Paint indicator if this clear is left/right/all.
+ m_pOut->Push(vcl::PushFlags::LINECOLOR);
+ m_pOut->SetLineColor(NON_PRINTING_CHARACTER_COLOR);
+ if (eClear != SwLineBreakClear::RIGHT)
+ m_pOut->DrawLine(aRect.BottomLeft(), aRect.TopLeft());
+ if (eClear != SwLineBreakClear::LEFT)
+ m_pOut->DrawLine(aRect.BottomRight(), aRect.TopRight());
+ m_pOut->Pop();
+ }
}
const_cast<SwLinePortion&>(rPor).Width( nOldWidth );