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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 7 11:32:01 UTC 2018


 sw/qa/core/data/html/pass/ofz9733-1.html |    1 +
 sw/source/filter/html/htmlsect.cxx       |    2 +-
 sw/source/filter/html/htmltab.cxx        |   18 +++++++++++-------
 sw/source/filter/html/swhtml.hxx         |    2 +-
 4 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit 74132131e74813834d2a09ff68e614415fe44747
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Aug 7 09:54:41 2018 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 7 13:31:37 2018 +0200

    ofz#9733 drop bookmarks in deleted range
    
    Change-Id: Ibf6d3cb244ddbfc600e6e91564988b9f814a258b
    Reviewed-on: https://gerrit.libreoffice.org/58668
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/core/data/html/pass/ofz9733-1.html b/sw/qa/core/data/html/pass/ofz9733-1.html
new file mode 100644
index 000000000000..3da9bdb80839
--- /dev/null
+++ b/sw/qa/core/data/html/pass/ofz9733-1.html
@@ -0,0 +1 @@
+<div title="footer"><div>ÿ</ol></div><p ID=ÿ></div><div title="footer">
\ No newline at end of file
diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx
index 818f90652f36..606b754d630e 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -200,7 +200,7 @@ void SwHTMLParser::NewDivision( HtmlTokenId nToken )
 
             if (!PendingObjectsInPaM(aDelPam))
             {
-                ClearFootnotesInRange(aDelPam.GetMark()->nNode, aDelPam.GetPoint()->nNode);
+                ClearFootnotesMarksInRange(aDelPam.GetMark()->nNode, aDelPam.GetPoint()->nNode);
                 m_xDoc->getIDocumentContentOperations().DelFullPara(aDelPam);
             }
 
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 5048ad6db408..69df8477af5a 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -50,6 +50,7 @@
 #include <pam.hxx>
 #include <doc.hxx>
 #include <IDocumentLayoutAccess.hxx>
+#include <IDocumentMarkAccess.hxx>
 #include <ndtxt.hxx>
 #include <shellio.hxx>
 #include <poolfmt.hxx>
@@ -4898,7 +4899,7 @@ namespace
     };
 }
 
-void SwHTMLParser::ClearFootnotesInRange(const SwNodeIndex& rMkNdIdx, const SwNodeIndex& rPtNdIdx)
+void SwHTMLParser::ClearFootnotesMarksInRange(const SwNodeIndex& rMkNdIdx, const SwNodeIndex& rPtNdIdx)
 {
     //similarly for footnotes
     if (m_pFootEndNoteImpl)
@@ -4912,9 +4913,14 @@ void SwHTMLParser::ClearFootnotesInRange(const SwNodeIndex& rMkNdIdx, const SwNo
     }
 
     //follow DelFlyInRange pattern here
-    const bool bDelFwrd = rMkNdIdx.GetIndex() <= rPtNdIdx.GetIndex();
+    assert(rMkNdIdx.GetIndex() <= rPtNdIdx.GetIndex());
 
     SwDoc* pDoc = rMkNdIdx.GetNode().GetDoc();
+
+    //ofz#9733 drop bookmarks in this range
+    IDocumentMarkAccess* const pMarkAccess = pDoc->getIDocumentMarkAccess();
+    pMarkAccess->deleteMarks(rMkNdIdx, SwNodeIndex(rPtNdIdx, 1), nullptr, nullptr, nullptr);
+
     SwFrameFormats& rTable = *pDoc->GetSpzFrameFormats();
     for ( auto i = rTable.size(); i; )
     {
@@ -4924,9 +4930,7 @@ void SwHTMLParser::ClearFootnotesInRange(const SwNodeIndex& rMkNdIdx, const SwNo
         if (pAPos &&
             ((rAnch.GetAnchorId() == RndStdIds::FLY_AT_PARA) ||
              (rAnch.GetAnchorId() == RndStdIds::FLY_AT_CHAR)) &&
-            ( bDelFwrd
-                ? rMkNdIdx < pAPos->nNode && pAPos->nNode <= rPtNdIdx
-                : rPtNdIdx <= pAPos->nNode && pAPos->nNode < rMkNdIdx ))
+            ( rMkNdIdx < pAPos->nNode && pAPos->nNode <= rPtNdIdx ))
         {
             if( rPtNdIdx != pAPos->nNode )
             {
@@ -4935,7 +4939,7 @@ void SwHTMLParser::ClearFootnotesInRange(const SwNodeIndex& rMkNdIdx, const SwNo
                 // But only fly formats own their content, not draw formats.
                 if (rContent.GetContentIdx() && pFormat->Which() == RES_FLYFRMFMT)
                 {
-                    ClearFootnotesInRange(*rContent.GetContentIdx(),
+                    ClearFootnotesMarksInRange(*rContent.GetContentIdx(),
                                           SwNodeIndex(*rContent.GetContentIdx()->GetNode().EndOfSectionNode()));
                 }
             }
@@ -4952,7 +4956,7 @@ void SwHTMLParser::DeleteSection(SwStartNode* pSttNd)
 
     //similarly for footnotes
     SwNodeIndex aSttIdx(*pSttNd), aEndIdx(*pSttNd->EndOfSectionNode());
-    ClearFootnotesInRange(aSttIdx, aEndIdx);
+    ClearFootnotesMarksInRange(aSttIdx, aEndIdx);
 
     m_xDoc->getIDocumentContentOperations().DeleteSection(pSttNd);
 
diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx
index c8d5d32c3ccc..b3560065c326 100644
--- a/sw/source/filter/html/swhtml.hxx
+++ b/sw/source/filter/html/swhtml.hxx
@@ -633,7 +633,7 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient
     // tags realized via character styles
     void NewCharFormat( HtmlTokenId nToken );
 
-    void ClearFootnotesInRange(const SwNodeIndex& rSttIdx, const SwNodeIndex& rEndIdx);
+    void ClearFootnotesMarksInRange(const SwNodeIndex& rSttIdx, const SwNodeIndex& rEndIdx);
 
     void DeleteSection(SwStartNode* pSttNd);
 


More information about the Libreoffice-commits mailing list