sw/qa/core/data/html/pass/ofz43310-1.html |binary
 sw/source/filter/html/htmlsect.cxx        |   16 +++++++++-------
 sw/source/filter/html/htmltab.cxx         |   19 -------------------
 sw/source/filter/html/swhtml.hxx          |    2 --
 4 files changed, 9 insertions(+), 28 deletions(-)

New commits:
commit 2c13433ed38e08be60824f21a73ba29f78b9520f
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Mar 10 21:04:28 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri Mar 11 14:15:38 2022 +0100

    ofz#43310 don't try and delete prior header/footer contents
    
    If a duplicate appears, just hide the prior ones.
    
    FWIW our own html export only exports a single header/footer as far as I
    can see.
    
    Change-Id: I5df28f7215ed49ce4a13add990716edcc7f2c72c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131329
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/qa/core/data/html/pass/ofz43310-1.html 
b/sw/qa/core/data/html/pass/ofz43310-1.html
new file mode 100644
index 000000000000..e84d1cccf5d7
Binary files /dev/null and b/sw/qa/core/data/html/pass/ofz43310-1.html differ
diff --git a/sw/source/filter/html/htmlsect.cxx 
b/sw/source/filter/html/htmlsect.cxx
index c684f0a9affb..d5de7077a8bf 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -194,7 +194,11 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken )
         }
         else
         {
-            // Create a new node at the beginning of the section
+            // Our own html export only exports one "header" at most (and one 
"footer")
+
+            // Create a new node at the beginning of the section if a 
duplicate arises
+            // and hide the original header/footers content by putting it into 
a hidden
+            // document-level section
             SwNodeIndex aSttIdx( rContentStIdx, 1 );
             pCNd = m_xDoc->GetNodes().MakeTextNode( aSttIdx,
                             
m_pCSS1Parser->GetTextCollFromPool(RES_POOLCOLL_TEXT));
@@ -205,13 +209,11 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken )
 
             const SwStartNode *pStNd =
                 static_cast<const SwStartNode *>( &rContentStIdx.GetNode() );
-            aDelPam.GetPoint()->nNode = pStNd->EndOfSectionIndex() - 1;
+            aDelPam.GetPoint()->nNode = pStNd->EndOfSectionIndex();
 
-            if (!PendingTableInPaM(aDelPam))
-            {
-                m_xDoc->getIDocumentContentOperations().DeleteRange(aDelPam);
-                m_xDoc->getIDocumentContentOperations().DelFullPara(aDelPam);
-            }
+            SwSectionData aSection(SectionType::Content, 
m_xDoc->GetUniqueSectionName());
+            if (SwSection* pOldContent = m_xDoc->InsertSwSection(aDelPam, 
aSection, nullptr, nullptr, false))
+                pOldContent->SetHidden(true);
 
             // update page style
             for( size_t i=0; i < m_xDoc->GetPageDescCnt(); i++ )
diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index dad2219b01f1..d5cde194f99b 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -5248,23 +5248,4 @@ std::shared_ptr<HTMLTable> 
SwHTMLParser::BuildTable(SvxAdjust eParentAdjust,
     return xRetTable;
 }
 
-bool SwHTMLParser::PendingTableInPaM(SwPaM& rPam) const
-{
-    bool bRet = false;
-    for (const auto& a : m_aTables)
-    {
-        const SwTable *pTable = a->GetSwTable();
-        if (!pTable)
-            continue;
-        const SwTableNode* pTableNode = pTable->GetTableNode();
-        if (!pTableNode)
-            continue;
-        SwNodeIndex aTableNodeIndex(*pTableNode);
-        bRet = (aTableNodeIndex >= rPam.Start()->nNode && aTableNodeIndex <= 
rPam.End()->nNode);
-        if (bRet)
-            break;
-    }
-    return bRet;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index a0b714307974..346e612eb19c 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -874,8 +874,6 @@ private:
     bool HasCurrentParaFlys( bool bNoSurroundOnly = false,
                              bool bSurroundOnly = false ) const;
 
-    bool PendingTableInPaM(SwPaM& rPam) const;
-
     class TableDepthGuard
     {
     private:

Reply via email to