sw/source/core/text/guess.hxx | 16 +++++++--------- sw/source/core/text/portxt.cxx | 4 ++-- 2 files changed, 9 insertions(+), 11 deletions(-)
New commits: commit f6a2c26be19631b2f39b39ae0a56ba396c386d65 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Tue Feb 25 07:55:36 2025 +0100 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu Feb 27 11:23:00 2025 +0100 Simplify SwTextGuess ctor Change-Id: I112e66387d0d147b68119cceb9ba00af904c5c6e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182141 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/core/text/guess.hxx b/sw/source/core/text/guess.hxx index a480e860b3e7..6db8b107e971 100644 --- a/sw/source/core/text/guess.hxx +++ b/sw/source/core/text/guess.hxx @@ -32,17 +32,15 @@ class SwTextGuess { css::uno::Reference< css::linguistic2::XHyphenatedWord > m_xHyphWord; std::unique_ptr<SwHangingPortion> m_pHanging; // for hanging punctuation - TextFrameIndex m_nCutPos; // this character doesn't fit - TextFrameIndex m_nBreakStart; // start index of word containing line break - TextFrameIndex m_nBreakPos; // start index of break position - TextFrameIndex m_nFieldDiff; // absolute positions can be wrong if we + TextFrameIndex m_nCutPos{ 0 }; // this character doesn't fit + TextFrameIndex m_nBreakStart{ 0 }; // start index of word containing line break + TextFrameIndex m_nBreakPos{ 0 }; // start index of break position + TextFrameIndex m_nFieldDiff{ 0 }; // absolute positions can be wrong if we // a field in the text has been expanded - SwTwips m_nBreakWidth; // width of the broken portion - SwTwips m_nExtraBlankWidth; // width of spaces after the break + SwTwips m_nBreakWidth{ 0 }; // width of the broken portion + SwTwips m_nExtraBlankWidth{ 0 }; // width of spaces after the break public: - SwTextGuess(): m_nCutPos(0), m_nBreakStart(0), - m_nBreakPos(0), m_nFieldDiff(0), m_nBreakWidth(0), m_nExtraBlankWidth(0) - { } + SwTextGuess() = default; // true, if current portion still fits to current line bool Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf, diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index fecd7cc66e54..cc26e98c62a9 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -362,7 +362,7 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf ) } ExtraShrunkWidth( 0 ); - std::unique_ptr<SwTextGuess> pGuess(new SwTextGuess()); + std::unique_ptr<SwTextGuess> pGuess(new SwTextGuess); bool bFull = !pGuess->Guess( *this, rInf, Height() ); // tdf#158776 for the last full text portion, call Guess() again to allow more text in the @@ -403,7 +403,7 @@ bool SwTextPortion::Format_( SwTextFormatInfo &rInf ) if ( nSpacesInLine > 0 ) { SwTwips nOldWidth = pGuess->BreakWidth(); - pGuess.reset(new SwTextGuess()); + pGuess.reset(new SwTextGuess); bFull = !pGuess->Guess( *this, rInf, Height(), nSpacesInLine ); if ( pGuess->BreakWidth() > nOldWidth )