sw/source/filter/html/htmlsect.cxx | 7 ++++++- sw/source/filter/html/swhtml.cxx | 1 + sw/source/filter/html/swhtml.hxx | 11 +++++++++-- 3 files changed, 16 insertions(+), 3 deletions(-)
New commits: commit 6fde78f1904243a4121c75f7c96711ed54cf787f Author: Caolán McNamara <caol...@redhat.com> Date: Tue Jan 2 17:19:32 2018 +0000 ofz: assert on trying to insert footer when already inserting the footer Reviewed-on: https://gerrit.libreoffice.org/47272 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 834cebd153573eea3cc321eca5bcb572b4776dec) Change-Id: I1fd91cca4aec91700f7db233b420fe27752d659b Reviewed-on: https://gerrit.libreoffice.org/48380 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Jenkins <c...@libreoffice.org> diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx index 436508a5e377..a63b788137fb 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; + pCntxt->SetHeaderOrFooter(true); + SwPageDesc *pPageDesc = m_pCSS1Parser->GetMasterPageDesc(); SwFrameFormat& rPageFormat = pPageDesc->GetMaster(); @@ -402,6 +405,8 @@ void SwHTMLParser::EndDivision() // close attribute EndContext( pCntxt ); SetAttr(); // set paragraph attributes really fast because of JavaScript + if (pCntxt->IsHeaderOrFooter()) + m_bReadingHeaderOrFooter = false; delete pCntxt; } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 057dc3ad4c04..3b18ef33328a 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -297,6 +297,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 66f7837704ae..450f7ddbde56 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -225,6 +225,7 @@ class HTMLAttrContext bool bRestartPRE : 1; bool bRestartXMP : 1; bool bRestartListing : 1; + bool bHeaderOrFooter : 1; public: void ClearSaveDocContext(); @@ -249,7 +250,8 @@ public: bFinishPREListingXMP( false ), bRestartPRE( false ), bRestartXMP( false ), - bRestartListing( false ) + bRestartListing( false ), + bHeaderOrFooter( false ) {} explicit HTMLAttrContext( HtmlTokenId nTokn ) : @@ -270,7 +272,8 @@ public: bFinishPREListingXMP( false ), bRestartPRE( false ), bRestartXMP( false ), - bRestartListing( false ) + bRestartListing( false ), + bHeaderOrFooter( false ) {} ~HTMLAttrContext() { ClearSaveDocContext(); } @@ -320,6 +323,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; } }; @@ -473,6 +479,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]; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits