summaryrefslogtreecommitdiff
path: root/editeng/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-02 13:25:09 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-10-04 13:01:10 +0200
commit5739280623bcc111a0d8b808ca4cc5e6598f9cce (patch)
treef596eae0de15ebe5289ca8587b0f95bc6ef5621d /editeng/source
parent263e0c5665a45bc181ac00803127ce2e12dfadc0 (diff)
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.mcnamara@collabora.com>
Diffstat (limited to 'editeng/source')
-rw-r--r--editeng/source/editeng/eehtml.cxx28
-rw-r--r--editeng/source/editeng/eehtml.hxx1
2 files changed, 17 insertions, 12 deletions
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();