editeng/source/editeng/impedit2.cxx | 3 ++- editeng/source/editeng/impedit3.cxx | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-)
New commits: commit c10fc6658b0cf65e5ede027b9161f060dd1f586e Author: Henry Castro <[email protected]> AuthorDate: Tue Jan 31 16:10:08 2023 -0400 Commit: Xisco Fauli <[email protected]> CommitDate: Fri Jun 23 21:05:18 2023 +0200 editeng: ignore line breaks Add option to ignore line breaks, and draw the paragraph as single line. Signed-off-by: Henry Castro <[email protected]> Change-Id: I957c3462f6dabe7c1a3322dcbe6753c0c5adc851 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148001 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153400 Tested-by: Jenkins Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153485 diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index cc8b39154844..3a000cb7e911 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -2740,7 +2740,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 bcf0c044872f..c6847168be4a 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 )
