summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-01-02 17:19:32 +0000
committerEike Rathke <erack@redhat.com>2018-01-24 17:33:17 +0100
commit2f62f9ef28203c7f143fb55a3407af503e1e7d38 (patch)
tree25d67394247430fb8e074dad66a1eaccf371e94a
parentaac8f29ee75607882386f88ab22e4df657bf619b (diff)
ofz: assert on trying to insert footer when already inserting the footer
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> (cherry picked from commit 834cebd153573eea3cc321eca5bcb572b4776dec) Reviewed-on: https://gerrit.libreoffice.org/48380 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 6fde78f1904243a4121c75f7c96711ed54cf787f) Change-Id: I1fd91cca4aec91700f7db233b420fe27752d659b Reviewed-on: https://gerrit.libreoffice.org/48444 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sw/source/filter/html/htmlsect.cxx7
-rw-r--r--sw/source/filter/html/swhtml.cxx1
-rw-r--r--sw/source/filter/html/swhtml.hxx11
3 files changed, 16 insertions, 3 deletions
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];