sw/source/core/text/inftxt.cxx | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
New commits: commit eb53efed80302c4ca6409c6dbd023d8ba1eb8e47 Author: Miklos Vajna <[email protected]> AuthorDate: Fri Mar 25 08:37:22 2022 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Mar 25 09:36:38 2022 +0100 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 <[email protected]> Tested-by: Jenkins 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 );
