sw/inc/doc.hxx                       |   10 +++-------
 sw/inc/ndindex.hxx                   |   16 +++++++++++++---
 sw/inc/pam.hxx                       |    4 ++++
 sw/source/core/crsr/crsrsh.cxx       |    2 +-
 sw/source/core/crsr/pam.cxx          |   15 +++++++++++++++
 sw/source/core/doc/docglbl.cxx       |    2 +-
 sw/source/core/doc/docnew.cxx        |    2 +-
 sw/source/core/doc/docredln.cxx      |    4 ++--
 sw/source/core/docnode/ndtbl.cxx     |   14 +++++++-------
 sw/source/core/docnode/nodes.cxx     |    4 ++--
 sw/source/core/txtnode/atrftn.cxx    |    2 +-
 sw/source/core/undo/undel.cxx        |    3 +--
 sw/source/core/undo/undobj.cxx       |    2 +-
 sw/source/core/undo/unmove.cxx       |    2 +-
 sw/source/uibase/dochdl/swdtflvr.cxx |    8 ++++----
 sw/source/uibase/utlui/content.cxx   |   14 +++++++-------
 sw/source/uibase/wrtsh/wrtsh1.cxx    |    6 +++---
 17 files changed, 67 insertions(+), 43 deletions(-)

New commits:
commit 799753cb80f4c81a6e87bf016924e0f2a29f03f0
Author:     Noel Grandin <[email protected]>
AuthorDate: Sat Aug 6 21:29:33 2022 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Sun Aug 7 13:31:11 2022 +0200

    make SwNodeIndex constructors explicit
    
    which flushes out some more places where we were implicitly
    construcing SwNodeIndex temporaries
    
    Change-Id: If044cb54acd1fe1265837c8076d7fdfe4de49290
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137910
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index ea379a00bec3..d63a10a1ec2e 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1174,8 +1174,9 @@ public:
                                 bool bNewModel = true );
 
     // If index is in a table, return TableNode, else 0.
-                 SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx );
-    inline const SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx ) const;
+    SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx );
+    const SwTableNode* IsIdxInTable( const SwNodeIndex& rIdx ) const;
+    SwTableNode* IsInTable( const SwNode& ) const;
 
     // Create a balanced table out of the selected range.
     const SwTable* TextToTable( const SwInsertTableOptions& rInsTableOpts, // 
HeadlineNoBorder,
@@ -1686,11 +1687,6 @@ namespace o3tl {
 // This method is called in Dtor of SwDoc and deletes cache of ContourObjects.
 void ClrContourCache();
 
-inline const SwTableNode* SwDoc::IsIdxInTable( const SwNodeIndex& rIdx ) const
-{
-    return const_cast<SwDoc*>(this)->IsIdxInTable( rIdx );
-}
-
 inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
 {
     mbOLEPrtNotifyPending = bSet;
diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index c25d5530d02f..98c1357821e7 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -57,13 +57,13 @@ class SAL_WARN_UNUSED SW_DLLPUBLIC SwNodeIndex final : 
public sw::Ring<SwNodeInd
 
 public:
     SwNodeIndex( SwNodes& rNds, sal_Int32 nIdx ) : SwNodeIndex(rNds, 
SwNodeOffset(nIdx)) {}
-    SwNodeIndex( SwNodes& rNds, SwNodeOffset nIdx = SwNodeOffset(0) )
+    explicit SwNodeIndex( SwNodes& rNds, SwNodeOffset nIdx = SwNodeOffset(0) )
         : m_pNode( rNds[ nIdx ] )
     {
         RegisterIndex( rNds );
     };
     SwNodeIndex( const SwNodeIndex& rIdx, sal_Int32 nDiff ) : 
SwNodeIndex(rIdx, SwNodeOffset(nDiff)) {}
-    SwNodeIndex( const SwNodeIndex& rIdx, SwNodeOffset nDiff = SwNodeOffset(0) 
)
+    SwNodeIndex( const SwNodeIndex& rIdx, SwNodeOffset nDiff )
         : sw::Ring<SwNodeIndex>()
     {
         if( nDiff )
@@ -72,9 +72,10 @@ public:
             m_pNode = rIdx.m_pNode;
         RegisterIndex( m_pNode->GetNodes() );
     }
+    SwNodeIndex( const SwNodeIndex& rIdx ) : SwNodeIndex(rIdx, 0) {}
 
     SwNodeIndex( const SwNode& rNd, sal_Int32 nDiff ) : SwNodeIndex(rNd, 
SwNodeOffset(nDiff)) {}
-    SwNodeIndex( const SwNode& rNd, SwNodeOffset nDiff = SwNodeOffset(0) )
+    explicit SwNodeIndex( const SwNode& rNd, SwNodeOffset nDiff = 
SwNodeOffset(0) )
     {
         if( nDiff )
             m_pNode = rNd.GetNodes()[ rNd.GetIndex() + nDiff ];
@@ -108,6 +109,13 @@ public:
     inline bool operator==( SwNodeOffset ) const;
     inline bool operator!=( SwNodeOffset ) const;
 
+    bool operator<( const SwNode& rNd ) const { return 
operator<(rNd.GetIndex()); }
+    bool operator<=( const SwNode& rNd ) const { return 
operator<=(rNd.GetIndex()); }
+    bool operator>( const SwNode& rNd ) const { return 
operator>(rNd.GetIndex()); }
+    bool operator>=( const SwNode& rNd ) const { return 
operator>=(rNd.GetIndex()); }
+    bool operator==( const SwNode& rNd ) const { return m_pNode == &rNd; }
+    bool operator!=( const SwNode& rNd ) const { return m_pNode != &rNd; }
+
     inline SwNodeIndex& operator=( SwNodeOffset );
     inline SwNodeIndex& operator=( const SwNodeIndex& );
     inline SwNodeIndex& operator=( const SwNode& );
@@ -143,6 +151,8 @@ public:
 
     SwNodeRange( const SwNodeIndex &rS, const SwNodeIndex &rE )
         : aStart( rS ), aEnd( rE ) {};
+    SwNodeRange( const SwNode &rS, const SwNode &rE )
+        : aStart( rS ), aEnd( rE ) {};
     SwNodeRange( const SwNodeRange &rRange )
         : aStart( rRange.aStart ), aEnd( rRange.aEnd ) {};
 
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index 86e4b6fb5226..97fbbcc4f616 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -39,12 +39,15 @@ struct SAL_WARN_UNUSED SW_DLLPUBLIC SwPosition
     SwContentIndex nContent;
 
     SwPosition( const SwNodeIndex &rNode, const SwContentIndex &rContent );
+    SwPosition( const SwNode &rNode, const SwContentIndex &rContent );
     explicit SwPosition( SwNodes& rNodes, SwNodeOffset nIndex = 
SwNodeOffset(0) );
     explicit SwPosition( const SwNodeIndex &rNode, SwNodeOffset nDiff = 
SwNodeOffset(0) );
     explicit SwPosition( const SwNode& rNode, SwNodeOffset nDiff = 
SwNodeOffset(0) );
     explicit SwPosition( const SwContentNode& rNode, sal_Int32 nContentOffset 
= 0 );
     SwPosition( const SwNodeIndex &rNode, const SwContentNode*, const 
sal_Int32 nContentOffset );
+    SwPosition( const SwNode &rNode, const SwContentNode*, const sal_Int32 
nContentOffset );
     SwPosition( const SwNodeIndex &rNode, SwNodeOffset nDiff, const 
SwContentNode*, sal_Int32 nContentOffset );
+    SwPosition( const SwNode &rNode, SwNodeOffset nDiff, const SwContentNode*, 
sal_Int32 nContentOffset );
     SwPosition( const SwContentIndex &, short nDiff );
 
     // callers should be using one of the other constructors to avoid creating 
a temporary
@@ -202,6 +205,7 @@ public:
     SwPaM( const SwNode& rNd, SwNodeOffset nNdOffset, sal_Int32 nContent = 0, 
SwPaM* pRing = nullptr );
     SwPaM( const SwNode& rNd, sal_Int32 nContent = 0, SwPaM* pRing = nullptr );
     SwPaM( const SwNodeIndex& rNd, sal_Int32 nContent = 0, SwPaM* pRing = 
nullptr );
+    SwPaM( SwNodes& rNds, SwNodeOffset nMkOffset = SwNodeOffset(0), SwPaM* 
pRing = nullptr );
     virtual ~SwPaM() override;
 
     /// this takes a second parameter, which indicates the Ring that
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 7079b553329d..977b94e686fb 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -606,7 +606,7 @@ void SwCursorShell::ExtendedSelectAll(bool bFootnotes)
 bool SwCursorShell::ExtendedSelectedAll()
 {
     SwNodes& rNodes = GetDoc()->GetNodes();
-    SwNodeIndex nNode = rNodes.GetEndOfAutotext();
+    SwNodeIndex nNode(rNodes.GetEndOfAutotext());
     SwContentNode* pStart = rNodes.GoNext(&nNode);
     if (!pStart)
         return false;
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index f588e12f3d63..7015d5069917 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -62,6 +62,11 @@ SwPosition::SwPosition( const SwNodeIndex & rNodeIndex, 
const SwContentIndex & r
 {
 }
 
+SwPosition::SwPosition( const SwNode & rNode, const SwContentIndex & rContent )
+    : nNode( rNode ), nContent( rContent )
+{
+}
+
 SwPosition::SwPosition( const SwNodeIndex & rNodeIndex, const SwContentNode* 
pContentNode, sal_Int32 nContentOffset )
     : nNode( rNodeIndex ), nContent( pContentNode, nContentOffset )
 {
@@ -540,6 +545,16 @@ SwPaM::SwPaM( const SwNodeIndex& rNodeIdx, sal_Int32 
nContent, SwPaM* pRing )
     m_pPoint->nContent.Assign( rNodeIdx.GetNode().GetContentNode(), nContent );
 }
 
+SwPaM::SwPaM( SwNodes& rNodes, SwNodeOffset nNdOffset, SwPaM* pRing )
+    : Ring( pRing )
+    , m_Bound1( rNodes, nNdOffset )
+    , m_Bound2( rNodes ) // default initialize
+    , m_pPoint( &m_Bound1 )
+    , m_pMark( &m_Bound1 )
+    , m_bIsInFrontOfLabel( false )
+{
+}
+
 SwPaM::~SwPaM() {}
 
 SwPaM::SwPaM(SwPaM const& rPam, SwPaM *const pRing)
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index 29ed06b4cd60..282d98f14316 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -448,7 +448,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& 
rPath, bool bOutline,
                             // they are fully enclosed in [pSectNd,aEndIdx].
                             if( aEndIdx < pSectNd->EndOfSectionIndex() )
                             {
-                                SwNodeRange aRg( *pSectNd, SwNodeOffset(1), 
aEndIdx, SwNodeOffset(1) );
+                                SwNodeRange aRg( *pSectNd, SwNodeOffset(1), 
aEndIdx.GetNode(), SwNodeOffset(1) );
                                 SwNodeIndex aIdx( *pSectNd );
                                 GetNodes().MoveNodes( aRg, GetNodes(), aIdx );
                             }
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 9700cfdbd03d..67c284df1f9b 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -685,7 +685,7 @@ void SwDoc::ClearDoc()
         pFirstNd->SetAttr( SwFormatPageDesc( pDummyPgDsc ));
 
         SwPosition aPos( *pFirstNd );
-        SwPaM const tmpPaM(aSttIdx, GetNodes().GetEndOfContent());
+        SwPaM const tmpPaM(aSttIdx.GetNode(), GetNodes().GetEndOfContent());
         ::PaMCorrAbs(tmpPaM, aPos);
     }
 
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index f298e67598c4..3449a6420c5f 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -779,7 +779,7 @@ bool SwRedlineTable::isMoved( size_type rPos ) const
     }
     else // otherwise it is saved in pContentSect, e.g. during ODT import
     {
-        pPaM = new SwPaM(*pRedline->GetContentIdx(), 
*pRedline->GetContentIdx()->GetNode().EndOfSectionNode() );
+        pPaM = new SwPaM(pRedline->GetContentIdx()->GetNode(), 
*pRedline->GetContentIdx()->GetNode().EndOfSectionNode() );
         bDeletePaM = true;
     }
 
@@ -822,7 +822,7 @@ bool SwRedlineTable::isMoved( size_type rPos ) const
         else // otherwise it is saved in pContentSect, e.g. during ODT import
         {
             // saved in pContentSect, e.g. during ODT import
-            pPairPaM = new SwPaM(*pPair->GetContentIdx(), 
*pPair->GetContentIdx()->GetNode().EndOfSectionNode() );
+            pPairPaM = new SwPaM(pPair->GetContentIdx()->GetNode(), 
*pPair->GetContentIdx()->GetNode().EndOfSectionNode() );
             bDeletePairPaM = true;
         }
 
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 74b69f9caa95..01e2dc21d173 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -216,7 +216,10 @@ static SwTableBoxFormat *lcl_CreateAFormatBoxFormat( SwDoc 
&rDoc, std::vector<Sw
     return rBoxFormatArr[nId];
 }
 
-SwTableNode* SwDoc::IsIdxInTable(const SwNodeIndex& rIdx)
+SwTableNode* SwDoc::IsIdxInTable( const SwNodeIndex& rIdx ) { return 
IsInTable(rIdx.GetNode()); }
+const SwTableNode* SwDoc::IsIdxInTable( const SwNodeIndex& rIdx ) const { 
return IsInTable(rIdx.GetNode()); }
+
+SwTableNode* SwDoc::IsInTable(const SwNode& rIdx) const
 {
     SwTableNode* pTableNd = nullptr;
     SwNodeOffset nIndex = rIdx.GetIndex();
@@ -1302,11 +1305,9 @@ void SwNodes::ExpandRangeForTableBox(const SwNodeRange & 
rRange, std::optional<S
         else if (rNode.IsEndNode())
         {
             SwNode * pStartNode = rNode.StartOfSectionNode();
-            SwNodeIndex aStartIndex = *pStartNode;
-
-            if (aStartIndex < aNewStart)
+            if (pStartNode->GetIndex() < aNewStart.GetIndex())
             {
-                aNewStart = aStartIndex;
+                aNewStart = *pStartNode;
                 bChanged = true;
             }
         }
@@ -1319,8 +1320,7 @@ void SwNodes::ExpandRangeForTableBox(const SwNodeRange & 
rRange, std::optional<S
     while (pNode->IsEndNode() && aIndex < Count() - 1)
     {
         SwNode * pStartNode = pNode->StartOfSectionNode();
-        SwNodeIndex aStartIndex(*pStartNode);
-        aNewStart = aStartIndex;
+        aNewStart = *pStartNode;
         aNewEnd = aIndex;
         bChanged = true;
 
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 341eadc99fd1..f1d29db3802e 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1928,8 +1928,8 @@ SwStartNode* SwNodes::MakeTextSection( const SwNode & 
rWhere,
                                         SwStartNodeType eSttNdTyp,
                                         SwTextFormatColl *pColl )
 {
-    SwStartNode* pSttNd = new SwStartNode( rWhere, SwNodeType::Start, 
eSttNdTyp );
-    new SwEndNode( rWhere, *pSttNd );
+    SwStartNode* pSttNd = new SwStartNode( SwNodeIndex(rWhere), 
SwNodeType::Start, eSttNdTyp );
+    new SwEndNode( SwNodeIndex(rWhere), *pSttNd );
     MakeTextNode( SwNodeIndex( rWhere, - 1 ), pColl );
     return pSttNd;
 }
diff --git a/sw/source/core/txtnode/atrftn.cxx 
b/sw/source/core/txtnode/atrftn.cxx
index a9c2fc9036f1..69dc06c3db98 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -412,7 +412,7 @@ void SwTextFootnote::CopyFootnote(
         SwNodes &rDstNodes = rDstDoc.GetNodes();
 
         // copy only the content of the section
-        SwNodeRange aRg( *m_pStartNode, SwNodeOffset(1),
+        SwNodeRange aRg( m_pStartNode->GetNode(), SwNodeOffset(1),
                     *m_pStartNode->GetNode().EndOfSectionNode() );
 
         // insert at the end of rDest, i.e., the nodes are appended.
diff --git a/sw/source/core/undo/undel.cxx b/sw/source/core/undo/undel.cxx
index 09835a411b8a..82d5e9635b89 100644
--- a/sw/source/core/undo/undel.cxx
+++ b/sw/source/core/undo/undel.cxx
@@ -306,8 +306,7 @@ SwUndoDelete::SwUndoDelete(
     {
         SwNodes& rNds = rDoc.GetUndoManager().GetUndoNodes();
         SwNodes& rDocNds = rDoc.GetNodes();
-        SwNodeRange aRg( rDocNds, m_nSttNode - m_nNdDiff,
-                         rDocNds, m_nEndNode - m_nNdDiff );
+        SwNodeRange aRg( rDocNds, m_nSttNode - m_nNdDiff, m_nEndNode - 
m_nNdDiff );
         if( !bFullPara && !pEndTextNd &&
             &aRg.aEnd.GetNode() != &rDoc.GetNodes().GetEndOfContent() )
         {
diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx
index f9a1c452adc7..79df3eaf0c01 100644
--- a/sw/source/core/undo/undobj.cxx
+++ b/sw/source/core/undo/undobj.cxx
@@ -810,7 +810,7 @@ void SwUndoSaveContent::MoveFromUndoNds( SwDoc& rDoc, 
SwNodeOffset nNodeIdx,
     }
     else
     {
-        SwNodeRange aRg( rNds, nNodeIdx, rNds, (pEndNdIdx
+        SwNodeRange aRg( rNds, nNodeIdx, (pEndNdIdx
                         ? ((*pEndNdIdx) + 1)
                         : rNds.GetEndOfExtras().GetIndex() ) );
         rNds.MoveNodes(aRg, rDoc.GetNodes(), rInsPos.nNode, nullptr == 
pEndNdIdx || bForceCreateFrames);
diff --git a/sw/source/core/undo/unmove.cxx b/sw/source/core/undo/unmove.cxx
index d000afe8dba5..8e8ac541acae 100644
--- a/sw/source/core/undo/unmove.cxx
+++ b/sw/source/core/undo/unmove.cxx
@@ -243,7 +243,7 @@ void SwUndoMove::RedoImpl(::sw::UndoRedoContext & rContext)
     if( m_bMoveRange )
     {
         // only a move with SwRange
-        SwNodeRange aRg( rNds, m_nSttNode, rNds, m_nEndNode );
+        SwNodeRange aRg( rNds, m_nSttNode, m_nEndNode );
         rDoc.getIDocumentContentOperations().MoveNodeRange( aRg, aIdx, 
m_bMoveRedlines
                 ? SwMoveFlags::REDLINES
                 : SwMoveFlags::DEFAULT );
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 6f1304e901ed..08377b49ee22 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1521,7 +1521,7 @@ bool SwTransferable::Paste(SwWrtShell& rSh, 
TransferableDataHelper& rData, RndSt
 
         // convert the worksheet to a temporary native table using HTML 
format, and copy that into the original native table
         if (!bSingleCellTable && rData.HasFormat( SotClipboardFormatId::HTML ) 
&&
-                        rSh.GetDoc()->IsIdxInTable(rSh.GetCursor()->GetNode()) 
!= nullptr && rSh.DoesUndo())
+                        rSh.GetDoc()->IsInTable(rSh.GetCursor()->GetNode()) != 
nullptr && rSh.DoesUndo())
         {
             SfxDispatcher* pDispatch = 
rSh.GetView().GetViewFrame()->GetDispatcher();
             sal_uInt32 nLevel = 0;
@@ -1534,13 +1534,13 @@ bool SwTransferable::Paste(SwWrtShell& rSh, 
TransferableDataHelper& rData, RndSt
                 pDispatch->Execute(FN_INSERT_NNBSP, SfxCallMode::SYNCHRON);
                 pDispatch->Execute(FN_TABLE_DELETE_TABLE, 
SfxCallMode::SYNCHRON);
                 nLevel++;
-            } while (rSh.GetDoc()->IsIdxInTable(rSh.GetCursor()->GetNode()) != 
nullptr);
+            } while (rSh.GetDoc()->IsInTable(rSh.GetCursor()->GetNode()) != 
nullptr);
             if ( SwTransferable::PasteData( rData, rSh, 
EXCHG_OUT_ACTION_INSERT_STRING, nActionFlags, SotClipboardFormatId::HTML,
                                         nDestination, false, false, nullptr, 
0, false, nAnchorType, bIgnoreComments, &aPasteContext, ePasteTable) )
             {
                 bool bFoundTemporaryTable = false;
                 pDispatch->Execute(FN_LINE_UP, SfxCallMode::SYNCHRON);
-                if (rSh.GetDoc()->IsIdxInTable(rSh.GetCursor()->GetNode()) != 
nullptr)
+                if (rSh.GetDoc()->IsInTable(rSh.GetCursor()->GetNode()) != 
nullptr)
                 {
                     bFoundTemporaryTable = true;
                     pDispatch->Execute(FN_TABLE_SELECT_ALL, 
SfxCallMode::SYNCHRON);
@@ -1570,7 +1570,7 @@ bool SwTransferable::Paste(SwWrtShell& rSh, 
TransferableDataHelper& rData, RndSt
     // insert clipboard content as new table rows/columns before the actual 
row/column instead of overwriting it
     else if ( (rSh.GetTableInsertMode() != SwTable::SEARCH_NONE || ePasteTable 
== PasteTableType::PASTE_ROW || ePasteTable == PasteTableType::PASTE_COLUMN) &&
         rData.HasFormat( SotClipboardFormatId::HTML ) &&
-        rSh.GetDoc()->IsIdxInTable(rSh.GetCursor()->GetNode()) != nullptr )
+        rSh.GetDoc()->IsInTable(rSh.GetCursor()->GetNode()) != nullptr )
     {
         OUString aExpand;
         sal_Int32 nIdx;
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index e263a1230d99..896395193a75 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -287,19 +287,19 @@ namespace
         return false;
     }
 // Gets "YPos" for content, i.e. a number used to sort content members in 
Navigator's list
-sal_Int32 getYPos(const SwNodeIndex& rNodeIndex)
+sal_Int32 getYPos(const SwNode& rNode)
 {
-    SwNodeOffset nIndex = rNodeIndex.GetIndex();
-    if (rNodeIndex.GetNodes().GetEndOfExtras().GetIndex() >= nIndex)
+    SwNodeOffset nIndex = rNode.GetIndex();
+    if (rNode.GetNodes().GetEndOfExtras().GetIndex() >= nIndex)
     {
         // Not a node of BodyText
         // Are we in a fly?
-        if (const auto pFlyFormat = rNodeIndex.GetNode().GetFlyFormat())
+        if (const auto pFlyFormat = rNode.GetFlyFormat())
         {
             // Get node index of anchor
             if (auto pSwPosition = pFlyFormat->GetAnchor().GetContentAnchor())
             {
-                return getYPos(pSwPosition->nNode);
+                return getYPos(pSwPosition->GetNode());
             }
         }
     }
@@ -781,7 +781,7 @@ void SwContentType::FillMemberList(bool* pbContentChanged)
                     }
 
                     std::unique_ptr<SwContent> pCnt(new SwRegionContent(this, 
sSectionName,
-                            nLevel, m_bAlphabeticSort ? 0 : 
getYPos(*pNodeIndex)));
+                            nLevel, m_bAlphabeticSort ? 0 : 
getYPos(pNodeIndex->GetNode())));
                     if( !pFormat->GetInfo( aAskItem ) &&
                         !aAskItem.pObject )     // not visible
                         pCnt->SetInvisible();
@@ -4333,7 +4333,7 @@ IMPL_LINK(SwContentTree, QueryTooltipHdl, const 
weld::TreeIter&, rEntry, OUStrin
                         pIdx->GetNode().GetNodes().IsDocNodes())
                     {
                         SwDocStat aDocStat;
-                        SwPaM aPaM(*pIdx, *pIdx->GetNode().EndOfSectionNode());
+                        SwPaM aPaM(pIdx->GetNode(), 
*pIdx->GetNode().EndOfSectionNode());
                         SwDoc::CountWords(aPaM, aDocStat);
                         sEntry = SwResId(STR_REGION_DEFNAME) + ": " + sEntry + 
"\n" +
                                  SwResId(FLD_STAT_WORD) + ": " + 
OUString::number(aDocStat.nWord) + "\n" +
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index aebc12052269..45bac802ccff 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1260,7 +1260,7 @@ static bool 
lcl_FoldedOutlineNodeEndOfParaSplit(SwWrtShell *pThis)
             // insert at end of tablebox doesn't work correct without
             MakeAllOutlineContentTemporarilyVisible a(pDoc);
 
-            SwTextNode* pNd = pDoc->GetNodes().MakeTextNode(*pEndNd, 
pTextNode->GetTextColl(), true);
+            SwTextNode* pNd = 
pDoc->GetNodes().MakeTextNode(SwNodeIndex(*pEndNd), pTextNode->GetTextColl(), 
true);
 
             (void) rOutlineNodes.Seek_Entry(pNd, &nPos);
             pThis->GotoOutline(nPos);
@@ -1268,7 +1268,7 @@ static bool 
lcl_FoldedOutlineNodeEndOfParaSplit(SwWrtShell *pThis)
             if (pDoc->GetIDocumentUndoRedo().DoesUndo())
             {
                 pDoc->GetIDocumentUndoRedo().ClearRedo();
-                
pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsert>(*pNd));
+                
pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoInsert>(SwNodeIndex(*pNd)));
                 
pDoc->GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoFormatColl>
                                                         (*pNd, 
pNd->GetTextColl(), true, true));
             }
@@ -2430,7 +2430,7 @@ void SwWrtShell::MakeOutlineContentVisible(const size_t 
nPos, bool bMakeVisible)
     {
         // reset the index marker and make frames
         aIdx.Assign(*pSttNd, +1);
-        MakeFrames(GetDoc(), aIdx, *pEndNd);
+        MakeFrames(GetDoc(), aIdx, SwNodeIndex(*pEndNd));
 
         pSttNd->GetTextNode()->SetAttrOutlineContentVisible(true);
 

Reply via email to