sw/inc/ndarr.hxx                   |    1 +
 sw/source/core/docnode/nodes.cxx   |    7 ++++++-
 sw/source/core/undo/undobj.cxx     |    2 +-
 sw/source/filter/html/htmlgrin.cxx |    2 +-
 sw/source/filter/html/htmltab.cxx  |    2 +-
 sw/source/filter/html/swhtml.cxx   |    4 ++--
 sw/source/filter/xml/xmlimp.cxx    |    4 ++--
 7 files changed, 14 insertions(+), 8 deletions(-)

New commits:
commit 43546af2e7af3f87482512411466c278a99dc8f0
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Aug 19 21:04:58 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Aug 20 10:50:04 2022 +0200

    Add a SwNodes::Delete variant that takes an SwNode
    
    and use it to replace usage of SwPosition::nNode with
    SwPosition::GetNode
    
    Change-Id: I67449ce1cba1ea33c975a546df6e348bffe2d280
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138568
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 478e135bdcb4..902f227800c3 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -168,6 +168,7 @@ public:
 
     static sal_uInt16 GetSectionLevel(const SwNode &rIndex);
     void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes = 
SwNodeOffset(1));
+    void Delete(const SwNode& rPos, SwNodeOffset nNodes = SwNodeOffset(1));
 
     bool MoveNodes( const SwNodeRange&, SwNodes& rNodes, SwNode& rPos,
                 bool bNewFrames = true );
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 221166f37e12..48c135861686 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1070,6 +1070,11 @@ void SwNodes::SectionUpDown( const SwNodeIndex & aStart, 
const SwNodeIndex & aEn
     }
 }
 
+void SwNodes::Delete(const SwNodeIndex &rIndex, SwNodeOffset nNodes)
+{
+    Delete(rIndex.GetNode(), nNodes);
+}
+
 /** delete nodes
  *
  * This is a specific implementation of a delete function for a variable array.
@@ -1079,7 +1084,7 @@ void SwNodes::SectionUpDown( const SwNodeIndex & aStart, 
const SwNodeIndex & aEn
  * @param rIndex position to delete at (unchanged afterwards)
  * @param nNodes number of nodes to delete (default: 1)
  */
-void SwNodes::Delete(const SwNodeIndex &rIndex, SwNodeOffset nNodes)
+void SwNodes::Delete(const SwNode &rIndex, SwNodeOffset nNodes)
 {
     int nLevel = 0; // level counter
     SwNode * pCurrentNode;
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index 99c316bd0915..e7d20d28d70f 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -801,7 +801,7 @@ void SwUndoSaveContent::MoveFromUndoNds( SwDoc& rDoc, 
SwNodeOffset nNodeIdx,
         {
             aPaM.GetPoint()->nContent.Assign( nullptr, 0 );
             aPaM.SetMark();
-            rNds.Delete( aPaM.GetPoint()->nNode,
+            rNds.Delete( aPaM.GetPoint()->GetNode(),
                         rNds.GetEndOfExtras().GetIndex() -
                         aPaM.GetPoint()->GetNodeIndex() );
         }
diff --git a/sw/source/filter/html/htmlgrin.cxx 
b/sw/source/filter/html/htmlgrin.cxx
index c33f66cb0d1b..4f9572d93dae 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -1489,7 +1489,7 @@ void SwHTMLParser::StripTrailingPara()
             m_pPam->GetPoint()->nContent.Assign( nullptr, 0 );
             m_pPam->SetMark();
             m_pPam->DeleteMark();
-            m_xDoc->GetNodes().Delete( m_pPam->GetPoint()->nNode );
+            m_xDoc->GetNodes().Delete( m_pPam->GetPoint()->GetNode() );
             m_pPam->Move( fnMoveBackward, GoInNode );
         }
         else if (pCNd && pCNd->IsTextNode() && m_xTable)
diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index 68b1c80f6f97..5d3d56dec7e7 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -3843,7 +3843,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, 
bool bReadOptions,
         {
             HTMLTableContext* pTableContext = m_xTable ? 
m_xTable->GetContext() : nullptr;
             SwPosition* pSavedPos = pTableContext ? pTableContext->GetPos() : 
nullptr;
-            const bool bDeleteSafe = !pSavedPos || pSavedPos->nNode != 
m_pPam->GetPoint()->nNode;
+            const bool bDeleteSafe = !pSavedPos || pSavedPos->nNode != 
m_pPam->GetPoint()->GetNode();
             if (bDeleteSafe)
                 StripTrailingPara();
         }
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx
index c3fa16f24fde..0d02435812ca 100644
--- a/sw/source/filter/html/swhtml.cxx
+++ b/sw/source/filter/html/swhtml.cxx
@@ -829,7 +829,7 @@ void SwHTMLParser::Continue( HtmlTokenId nToken )
                         }
                         m_pPam->GetBound().nContent.Assign( nullptr, 0 );
                         m_pPam->GetBound(false).nContent.Assign( nullptr, 0 );
-                        m_xDoc->GetNodes().Delete( m_pPam->GetPoint()->nNode );
+                        m_xDoc->GetNodes().Delete( 
m_pPam->GetPoint()->GetNode() );
                     }
                 }
             }
@@ -846,7 +846,7 @@ void SwHTMLParser::Continue( HtmlTokenId nToken )
                 {
                     pPos->nContent.Assign( nullptr, 0 );
                     m_pPam->SetMark(); m_pPam->DeleteMark();
-                    m_xDoc->GetNodes().Delete( pPos->nNode );
+                    m_xDoc->GetNodes().Delete( pPos->GetNode() );
                     m_pPam->Move( fnMoveBackward );
                 }
             }
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index d773a1240c19..61bbf47aa11d 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -733,7 +733,7 @@ void SwXMLImport::endDocument()
                     {
                         pPaM->GetBound().nContent.Assign( nullptr, 0 );
                         pPaM->GetBound(false).nContent.Assign( nullptr, 0 );
-                        pDoc->GetNodes().Delete( pPaM->GetPoint()->nNode );
+                        pDoc->GetNodes().Delete( pPaM->GetPoint()->GetNode() );
                     }
                 }
             }
@@ -771,7 +771,7 @@ void SwXMLImport::endDocument()
                 {
                     pPos->nContent.Assign( nullptr, 0 );
                     pPaM->SetMark(); pPaM->DeleteMark();
-                    pDoc->GetNodes().Delete( pPos->nNode );
+                    pDoc->GetNodes().Delete( pPos->GetNode() );
                     pPaM->Move( fnMoveBackward );
                 }
             }

Reply via email to