editeng/source/editeng/eehtml.cxx | 28 ++++++++++++++++------------ editeng/source/editeng/eehtml.hxx | 1 + 2 files changed, 17 insertions(+), 12 deletions(-)
New commits: commit 5739280623bcc111a0d8b808ca4cc5e6598f9cce Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Wed Oct 2 13:25:09 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Oct 4 13:01:10 2024 +0200 Split out this html parsing hunk as a separate NewLine method Change-Id: I1fb034af2419306f96152ce6802d193d7a1560af Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174441 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index 1b73960d129f..24fd670ad9ba 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();