editeng/source/editeng/impedit2.cxx | 3 ++- editeng/source/editeng/impedit3.cxx | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-)
New commits: commit 799b03fdf6acad03913ba82733c7e702b3645b32 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Tue Jan 31 16:10:08 2023 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Sat May 6 15:00:30 2023 +0200 editeng: ignore line breaks Add option to ignore line breaks, and draw the paragraph as single line. Signed-off-by: Henry Castro <hcas...@collabora.com> Change-Id: I957c3462f6dabe7c1a3322dcbe6753c0c5adc851 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148001 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index e6cbdcfbdeb9..6d40ce61e52f 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2743,7 +2743,8 @@ EditPaM ImpEditEngine::ImpInsertText(const EditSelection& aCurSel, const OUStrin sal_Int32 nStart = 0; while ( nStart < aText.getLength() ) { - sal_Int32 nEnd = aText.indexOf( LINE_SEP, nStart ); + sal_Int32 nEnd = !aStatus.IsSingleLine() ? + aText.indexOf( LINE_SEP, nStart ) : -1; if ( nEnd == -1 ) nEnd = aText.getLength(); // not dereference! diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 6cb45a385748..11e12c66e7e8 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -1437,7 +1437,8 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) else if ( !bEOL && !bContinueLastPortion ) { DBG_ASSERT( pPortion && ((nPortionEnd-nPortionStart) == pPortion->GetLen()), "However, another portion?!" ); - tools::Long nRemainingWidth = nMaxLineWidth - nTmpWidth; + tools::Long nRemainingWidth = !aStatus.IsSingleLine() ? + nMaxLineWidth - nTmpWidth : pLine->GetCharPosArray()[pLine->GetCharPosArray().size() - 1] + 1; bool bCanHyphenate = ( aTmpFont.GetCharSet() != RTL_TEXTENCODING_SYMBOL ); if ( bCompressedChars && pPortion && ( pPortion->GetLen() > 1 ) && pPortion->GetExtraInfos() && pPortion->GetExtraInfos()->bCompressed ) { @@ -2013,9 +2014,16 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te aUserOptions.allowPunctuationOutsideMargin = bAllowPunctuationOutsideMargin; aUserOptions.allowHyphenateEnglish = false; - i18n::LineBreakResults aLBR = _xBI->getLineBreak( - pNode->GetString(), nMaxBreakPos, aLocale, nMinBreakPos, aHyphOptions, aUserOptions ); - nBreakPos = aLBR.breakIndex; + if (!aStatus.IsSingleLine()) + { + i18n::LineBreakResults aLBR = _xBI->getLineBreak( + pNode->GetString(), nMaxBreakPos, aLocale, nMinBreakPos, aHyphOptions, aUserOptions ); + nBreakPos = aLBR.breakIndex; + } + else + { + nBreakPos = nMaxBreakPos; + } // BUG in I18N - under special condition (break behind field, #87327#) breakIndex is < nMinBreakPos if ( nBreakPos < nMinBreakPos )