[Libreoffice-commits] core.git: sw/source

Caolán McNamara caolanm at redhat.com
Thu Dec 21 15:00:36 UTC 2017


 sw/source/filter/html/htmlsect.cxx |    3 ++-
 sw/source/filter/html/htmltab.cxx  |   14 ++++++++++++++
 sw/source/filter/html/swhtml.hxx   |    2 ++
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit f297b0d043e0767d85f00aa1e4cae5b036b0ac51
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Dec 21 11:24:52 2017 +0000

    ofz: avoid deleting the table still being processed
    
    Change-Id: Ia92d469fd0e280bdc6470e780ab12b00366f0f8d
    Reviewed-on: https://gerrit.libreoffice.org/46902
    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/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx
index 67fa9d916d8a..56149052609f 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -195,7 +195,8 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken )
                 static_cast<const SwStartNode *>( &rContentStIdx.GetNode() );
             aDelPam.GetPoint()->nNode = pStNd->EndOfSectionIndex() - 1;
 
-            m_xDoc->getIDocumentContentOperations().DelFullPara( aDelPam );
+            if (!CurrentTableInPaM(aDelPam))
+                m_xDoc->getIDocumentContentOperations().DelFullPara(aDelPam);
 
             // 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 0f5f5ae162b1..7d40e971d559 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -5246,4 +5246,18 @@ std::shared_ptr<HTMLTable> SwHTMLParser::BuildTable(SvxAdjust eParentAdjust,
     return xRetTable;
 }
 
+bool SwHTMLParser::CurrentTableInPaM(SwPaM& rPam) const
+{
+    if (!m_xTable)
+        return false;
+    const SwTable *pTable = m_xTable->GetSwTable();
+    if (!pTable)
+        return false;
+    const SwTableNode* pTableNode = pTable->GetTableNode();
+    if (!pTableNode)
+        return false;
+    SwNodeIndex aTableNodeIndex(*pTableNode);
+    return (aTableNodeIndex >= rPam.Start()->nNode && aTableNodeIndex <= rPam.End()->nNode);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index a023d3549cfa..1392192852a9 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -867,6 +867,8 @@ private:
     bool HasCurrentParaFlys( bool bNoSurroundOnly = false,
                              bool bSurroundOnly = false ) const;
 
+    bool CurrentTableInPaM(SwPaM& rPam) const;
+
 public:         // used in tables
 
     // Create brush item (with new) or 0


More information about the Libreoffice-commits mailing list