editeng/source/editeng/impedit2.cxx |    3 ++-
 editeng/source/editeng/impedit3.cxx |   16 ++++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit a6535604dea24c1907c24bfe6be22f79f1d85d56
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Jan 31 16:10:08 2023 -0400
Commit:     Henry Castro <hcas...@collabora.com>
CommitDate: Wed Jun 21 21:16:04 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>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153400
    Tested-by: Jenkins

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 000c0b39a1f6..a2f88c7a5c5d 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 a521d59ef1c1..7a82359e8851 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1429,7 +1429,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 )
             {
@@ -2005,9 +2006,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 )

Reply via email to