editeng/source/editeng/eehtml.cxx |   28 ++++++++++++++++------------
 editeng/source/editeng/eehtml.hxx |    1 +
 2 files changed, 17 insertions(+), 12 deletions(-)

New commits:
commit d6b5d08041b68946f655524c43360f12a72c7185
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Oct 2 13:25:09 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Oct 4 09:07:01 2024 +0200

    Split out this html parsing hunk as a separate NewLine method
    
    Change-Id: I1fb034af2419306f96152ce6802d193d7a1560af
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174386
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/editeng/source/editeng/eehtml.cxx 
b/editeng/source/editeng/eehtml.cxx
index b3ed28395506..3db92d077694 100644
--- a/editeng/source/editeng/eehtml.cxx
+++ b/editeng/source/editeng/eehtml.cxx
@@ -95,6 +95,14 @@ SvParserState EditHTMLParser::CallParser(EditEngine* pEE, 
const EditPaM& rPaM)
     return _eState;
 }
 
+void EditHTMLParser::Newline()
+{
+    bool bHasText = HasTextInCurrentPara();
+    if ( bHasText )
+        ImpInsertParaBreak();
+    StartPara( false );
+}
+
 void EditHTMLParser::NextToken( HtmlTokenId nToken )
 {
     switch( nToken )
@@ -280,7 +288,8 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken )
     case HtmlTokenId::TABLEHEADER_ON:
     case HtmlTokenId::TABLEDATA_ON:
         nInCell++;
-        [[fallthrough]];
+        Newline();
+    break;
     case HtmlTokenId::BLOCKQUOTE_ON:
     case HtmlTokenId::BLOCKQUOTE_OFF:
     case HtmlTokenId::BLOCKQUOTE30_ON:
@@ -291,28 +300,23 @@ void EditHTMLParser::NextToken( HtmlTokenId nToken )
     case HtmlTokenId::DT_ON:
     case HtmlTokenId::ORDERLIST_ON:
     case HtmlTokenId::UNORDERLIST_ON:
-    {
-        bool bHasText = HasTextInCurrentPara();
-        if ( bHasText )
-            ImpInsertParaBreak();
-        StartPara( false );
-    }
+        Newline();
     break;
 
     case HtmlTokenId::TABLEHEADER_OFF:
     case HtmlTokenId::TABLEDATA_OFF:
-    {
         if ( nInCell )
             nInCell--;
-        [[fallthrough]];
-    }
+        EndPara();
+    break;
     case HtmlTokenId::LISTHEADER_OFF:
     case HtmlTokenId::LI_OFF:
     case HtmlTokenId::DD_OFF:
     case HtmlTokenId::DT_OFF:
     case HtmlTokenId::ORDERLIST_OFF:
-    case HtmlTokenId::UNORDERLIST_OFF:  EndPara();
-                                break;
+    case HtmlTokenId::UNORDERLIST_OFF:
+        EndPara();
+    break;
 
     case HtmlTokenId::TABLEROW_ON:
     case HtmlTokenId::TABLEROW_OFF: // A RETURN only after a CELL, for Calc
diff --git a/editeng/source/editeng/eehtml.hxx 
b/editeng/source/editeng/eehtml.hxx
index fddd567ac6ba..9f8009c715c8 100644
--- a/editeng/source/editeng/eehtml.hxx
+++ b/editeng/source/editeng/eehtml.hxx
@@ -53,6 +53,7 @@ private:
     sal_uInt8               nDefListLevel;
 
     void                    StartPara( bool bReal );
+    void                    Newline();
     void                    EndPara();
     void                    AnchorStart();
     void                    AnchorEnd();

Reply via email to