diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-01-02 17:19:32 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-01-02 21:55:15 +0100 |
commit | 834cebd153573eea3cc321eca5bcb572b4776dec (patch) | |
tree | 234dd7bd8f0ec59be7a9d932b0c1ea93a9732ae9 /sw | |
parent | a820979e22e882f7005c326c8597c0647f4fcf90 (diff) |
ofz: assert on trying to insert footer when already inserting the footer
Change-Id: I1fd91cca4aec91700f7db233b420fe27752d659b
Reviewed-on: https://gerrit.libreoffice.org/47272
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/filter/html/htmlsect.cxx | 7 | ||||
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 1 | ||||
-rw-r--r-- | sw/source/filter/html/swhtml.hxx | 11 |
3 files changed, 16 insertions, 3 deletions
diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 0b2facf82e62..9a23aebaa8f9 100644 --- a/sw/source/filter/html/htmlsect.cxx +++ b/sw/source/filter/html/htmlsect.cxx @@ -138,8 +138,11 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken ) } } - if( !bPositioned && (bHeader || bFooter) && IsNewDoc() ) + if (!bPositioned && (bHeader || bFooter) && IsNewDoc() && !m_bReadingHeaderOrFooter) { + m_bReadingHeaderOrFooter = true; + xCntxt->SetHeaderOrFooter(true); + SwPageDesc *pPageDesc = m_pCSS1Parser->GetMasterPageDesc(); SwFrameFormat& rPageFormat = pPageDesc->GetMaster(); @@ -403,6 +406,8 @@ void SwHTMLParser::EndDivision() // close attribute EndContext(xCntxt.get()); SetAttr(); // set paragraph attributes really fast because of JavaScript + if (xCntxt->IsHeaderOrFooter()) + m_bReadingHeaderOrFooter = false; } } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index e8d3b316aaab..86a305b836a8 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -299,6 +299,7 @@ SwHTMLParser::SwHTMLParser( SwDoc* pD, SwPaM& rCursor, SvStream& rIn, m_bIgnoreHTMLComments( bNoHTMLComments ), m_bRemoveHidden( false ), m_bBodySeen( false ), + m_bReadingHeaderOrFooter( false ), m_pTempViewFrame(nullptr) { m_nEventId = nullptr; diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 8d6130d6c70c..45b5effe1857 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -231,6 +231,7 @@ class HTMLAttrContext bool bRestartPRE : 1; bool bRestartXMP : 1; bool bRestartListing : 1; + bool bHeaderOrFooter : 1; public: void ClearSaveDocContext(); @@ -255,7 +256,8 @@ public: bFinishPREListingXMP( false ), bRestartPRE( false ), bRestartXMP( false ), - bRestartListing( false ) + bRestartListing( false ), + bHeaderOrFooter( false ) {} explicit HTMLAttrContext( HtmlTokenId nTokn ) : @@ -276,7 +278,8 @@ public: bFinishPREListingXMP( false ), bRestartPRE( false ), bRestartXMP( false ), - bRestartListing( false ) + bRestartListing( false ), + bHeaderOrFooter( false ) {} ~HTMLAttrContext() { ClearSaveDocContext(); } @@ -326,6 +329,9 @@ public: void SetRestartListing( bool bSet ) { bRestartListing = bSet; } bool IsRestartListing() const { return bRestartListing; } + void SetHeaderOrFooter( bool bSet ) { bHeaderOrFooter = bSet; } + bool IsHeaderOrFooter() const { return bHeaderOrFooter; } + void SetAppendMode( SwHTMLAppendMode eMode ) { eAppend = eMode; } SwHTMLAppendMode GetAppendMode() const { return eAppend; } }; @@ -485,6 +491,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient bool m_bRemoveHidden : 1; // the filter implementation might set the hidden flag bool m_bBodySeen : 1; + bool m_bReadingHeaderOrFooter : 1; /// the names corresponding to the DOCINFO field subtypes INFO[1-4] OUString m_InfoNames[4]; |