[Libreoffice-commits] core.git: sw/source
Caolán McNamara
caolanm at redhat.com
Fri Dec 29 14:22:13 UTC 2017
sw/source/filter/html/swhtml.cxx | 41 ++++++++++++++++++++++-----------------
sw/source/filter/html/swhtml.hxx | 2 +
2 files changed, 26 insertions(+), 17 deletions(-)
New commits:
commit 1f349bb10c3c1fc6d5d598847a7281cef728b762
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Dec 28 22:28:08 2017 +0000
ofz#4817 Chaos with multiple body tags
Change-Id: I4f2ab3a3be0909176599963c8ca113e3af85c832
Reviewed-on: https://gerrit.libreoffice.org/47159
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index 53dc9e5e32ef..7376ab23da47 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -298,6 +298,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn,
m_bInFootEndNoteSymbol( false ),
m_bIgnoreHTMLComments( bNoHTMLComments ),
m_bRemoveHidden( false ),
+ m_bBodySeen( false ),
m_pTempViewFrame(nullptr)
{
m_nEventId = nullptr;
@@ -1257,25 +1258,31 @@ void SwHTMLParser::NextToken( HtmlTokenId nToken )
switch( nToken )
{
case HtmlTokenId::BODY_ON:
- if( !m_aStyleSource.isEmpty() )
- {
- m_pCSS1Parser->ParseStyleSheet( m_aStyleSource );
- m_aStyleSource.clear();
- }
- if( IsNewDoc() )
+ if (m_bBodySeen)
+ eState = SvParserState::Error;
+ else
{
- InsertBodyOptions();
- // If there is a template for the first or the right page,
- // it is set here.
- const SwPageDesc *pPageDesc = nullptr;
- if( m_pCSS1Parser->IsSetFirstPageDesc() )
- pPageDesc = m_pCSS1Parser->GetFirstPageDesc();
- else if( m_pCSS1Parser->IsSetRightPageDesc() )
- pPageDesc = m_pCSS1Parser->GetRightPageDesc();
-
- if( pPageDesc )
+ m_bBodySeen = true;
+ if( !m_aStyleSource.isEmpty() )
{
- m_xDoc->getIDocumentContentOperations().InsertPoolItem( *m_pPam, SwFormatPageDesc( pPageDesc ) );
+ m_pCSS1Parser->ParseStyleSheet( m_aStyleSource );
+ m_aStyleSource.clear();
+ }
+ if( IsNewDoc() )
+ {
+ InsertBodyOptions();
+ // If there is a template for the first or the right page,
+ // it is set here.
+ const SwPageDesc *pPageDesc = nullptr;
+ if( m_pCSS1Parser->IsSetFirstPageDesc() )
+ pPageDesc = m_pCSS1Parser->GetFirstPageDesc();
+ else if( m_pCSS1Parser->IsSetRightPageDesc() )
+ pPageDesc = m_pCSS1Parser->GetRightPageDesc();
+
+ if( pPageDesc )
+ {
+ m_xDoc->getIDocumentContentOperations().InsertPoolItem( *m_pPam, SwFormatPageDesc( pPageDesc ) );
+ }
}
}
break;
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index 1392192852a9..7ba0e42ace00 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -483,6 +483,8 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
bool m_bIgnoreHTMLComments : 1;
bool m_bRemoveHidden : 1; // the filter implementation might set the hidden flag
+ bool m_bBodySeen : 1;
+
/// the names corresponding to the DOCINFO field subtypes INFO[1-4]
OUString m_InfoNames[4];
More information about the Libreoffice-commits
mailing list