sw/source/core/crsr/crsrsh.cxx          |    8 ++++----
 sw/source/core/crsr/crstrvl.cxx         |    2 +-
 sw/source/core/doc/docfmt.cxx           |    4 ++--
 sw/source/core/doc/docnum.cxx           |    8 ++++----
 sw/source/core/edit/edattr.cxx          |    4 ++--
 sw/source/core/edit/edfcol.cxx          |    2 +-
 sw/source/core/edit/ednumber.cxx        |   20 ++++++++++----------
 sw/source/core/inc/txtfrm.hxx           |    3 ++-
 sw/source/core/text/txtfrm.cxx          |    6 +++---
 sw/source/core/tox/ToxTextGenerator.cxx |    2 +-
 sw/source/uibase/wrtsh/wrtsh1.cxx       |   10 +++++-----
 11 files changed, 35 insertions(+), 34 deletions(-)

New commits:
commit 59b8813606f084d62dbd3debed7f6b468d916459
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Aug 5 15:04:11 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Aug 6 09:09:58 2022 +0200

    make GetParaPropsNode take a SwNode, not an SwNodeIndex
    
    as part of the process of hiding the internals of SwPosition
    
    Change-Id: Idefc1cd390c551bf7b54ee122c7fc7e4feb8f45d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137872
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 13779e0b6999..99840a2494dc 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -351,7 +351,7 @@ bool SwCursorShell::LeftRight( bool bLeft, sal_uInt16 nCnt, 
SwCursorSkipMode nMo
             )->MapModelToViewPos(*pShellCursor->GetPoint()) == 
TextFrameIndex(0)
         && !pShellCursor->IsInFrontOfLabel()
         && !pShellCursor->HasMark()
-        && nullptr != (pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pShellCursor->GetPoint()->nNode))
+        && nullptr != (pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pShellCursor->GetPoint()->GetNode()))
         && pTextNd->HasVisibleNumberingOrBullet())
     {
         SetInFrontOfLabel( true );
@@ -405,7 +405,7 @@ void SwCursorShell::MarkListLevel( const OUString& sListId,
 void SwCursorShell::UpdateMarkedListLevel()
 {
     SwTextNode const*const pTextNd = sw::GetParaPropsNode(*GetLayout(),
-            GetCursor_()->GetPoint()->nNode);
+            GetCursor_()->GetPoint()->GetNode());
 
     if ( !pTextNd )
         return;
@@ -547,7 +547,7 @@ bool SwCursorShell::LRMargin( bool bLeft, bool bAPI)
     if ( bLeft && !bTableMode && bRet && bWasAtLM && !GetCursor_()->HasMark() )
     {
         const SwTextNode * pTextNd = GetCursor_()->GetNode().GetTextNode();
-        assert(sw::GetParaPropsNode(*GetLayout(), 
GetCursor_()->GetPoint()->nNode) == pTextNd);
+        assert(sw::GetParaPropsNode(*GetLayout(), 
GetCursor_()->GetPoint()->GetNode()) == pTextNd);
         if ( pTextNd && pTextNd->HasVisibleNumberingOrBullet() )
             SetInFrontOfLabel( true );
     }
@@ -769,7 +769,7 @@ int SwCursorShell::SetCursor( const Point &rLPt, bool 
bOnlyText, bool bBlock )
                                     bOnlyText ?  CursorMoveState::SetOnlyText 
: CursorMoveState::NONE );
     aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable();
 
-    SwTextNode const*const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->nNode);
+    SwTextNode const*const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->GetNode());
 
     if ( pTextNd && !IsTableMode() &&
         // #i37515# No bInFrontOfLabel during selection
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 089314a4b302..bd7535f21c18 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -1377,7 +1377,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt,
                  && IsAttrAtPos::NumLabel & rContentAtPos.eContentAtPos)
         {
             bRet = aTmpState.m_bInNumPortion;
-            rContentAtPos.aFnd.pNode = sw::GetParaPropsNode(*GetLayout(), 
aPos.nNode);
+            rContentAtPos.aFnd.pNode = sw::GetParaPropsNode(*GetLayout(), 
aPos.GetNode());
 
             Size aSizeLogic(aTmpState.m_nInNumPortionOffset, 0);
             Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 068a8eed98a7..4462f2b373f5 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1016,7 +1016,7 @@ static bool lcl_SetTextFormatColl( SwNode* pNode, void* 
pArgs )
         }
         if (pCNd->IsTextNode())
         {
-            pCNd = sw::GetParaPropsNode(*pPara->pLayout, SwNodeIndex(*pCNd));
+            pCNd = sw::GetParaPropsNode(*pPara->pLayout, *pCNd);
         }
     }
 
@@ -1656,7 +1656,7 @@ void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool 
bRight, bool bModulus,
         SwTextNode* pTNd = aIdx.GetNode().GetTextNode();
         if( pTNd )
         {
-            pTNd = sw::GetParaPropsNode(*pLayout, aIdx);
+            pTNd = sw::GetParaPropsNode(*pLayout, aIdx.GetNode());
             SvxLRSpaceItem aLS(pTNd->SwContentNode::GetAttr(RES_LR_SPACE));
 
             // #i93873# See also lcl_MergeListLevelIndentAsLRSpaceItem in 
thints.cxx
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 4aa9c9078084..422fea98bce9 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -88,11 +88,11 @@ namespace {
         // to which the attributes should be applied
         if (rPam.GetPoint()->GetNode().IsTextNode())
         {
-            rPam.GetPoint()->Assign( *sw::GetParaPropsNode(*pLayout, 
rPam.GetPoint()->nNode) );
+            rPam.GetPoint()->Assign( *sw::GetParaPropsNode(*pLayout, 
rPam.GetPoint()->GetNode()) );
         }
         if (rPam.GetMark()->GetNode().IsTextNode())
         {
-            rPam.GetMark()->Assign( *sw::GetParaPropsNode(*pLayout, 
rPam.GetMark()->nNode) );
+            rPam.GetMark()->Assign( *sw::GetParaPropsNode(*pLayout, 
rPam.GetMark()->GetNode()) );
         }
     }
 }
@@ -1624,7 +1624,7 @@ const SwNumRule *  SwDoc::SearchNumRule(const SwPosition 
& rPos,
     SwTextNode * pTextNd = rPos.GetNode().GetTextNode();
     if (pLayout)
     {
-        pTextNd = sw::GetParaPropsNode(*pLayout, rPos.nNode);
+        pTextNd = sw::GetParaPropsNode(*pLayout, rPos.GetNode());
     }
     SwNode * pStartFromNode = pTextNd;
 
@@ -2653,7 +2653,7 @@ bool SwDoc::IsFirstOfNumRuleAtPos(const SwPosition & rPos,
 {
     bool bResult = false;
 
-    const SwTextNode *const pTextNode = sw::GetParaPropsNode(rLayout, 
rPos.nNode);
+    const SwTextNode *const pTextNode = sw::GetParaPropsNode(rLayout, 
rPos.GetNode());
     if ( pTextNode != nullptr )
     {
         bResult = pTextNode->IsFirstOfNumRule(rLayout);
diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx
index 3231f9f0d8c2..610adc8c42f5 100644
--- a/sw/source/core/edit/edattr.cxx
+++ b/sw/source/core/edit/edattr.cxx
@@ -76,7 +76,7 @@ bool SwEditShell::GetPaMAttr( SwPaM* pPaM, SfxItemSet& rSet,
         if (rCurrentPaM.IsInFrontOfLabel())
         {
             SwTextNode const*const pTextNd = sw::GetParaPropsNode(*GetLayout(),
-                    rCurrentPaM.GetPoint()->nNode);
+                    rCurrentPaM.GetPoint()->GetNode());
 
             if (pTextNd)
             {
@@ -266,7 +266,7 @@ SwTextFormatColl* SwEditShell::GetPaMTextFormatColl( SwPaM* 
pPaM ) const
 
             if( pNd->IsTextNode() )
             {
-                SwTextNode *const pTextNode(sw::GetParaPropsNode(*GetLayout(), 
SwNodeIndex(*pNd)));
+                SwTextNode *const pTextNode(sw::GetParaPropsNode(*GetLayout(), 
*pNd));
                 // if it's a text node get its named paragraph format
                 SwTextFormatColl *const pFormat = pTextNode->GetTextColl();
 
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index af8248d0e165..b155f9b0737c 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -2276,7 +2276,7 @@ void SwEditShell::FillByEx(SwTextFormatColl* pColl)
     SwContentNode * pCnt = pCursor->GetContentNode();
     if (pCnt->IsTextNode()) // uhm... what nonsense would happen if not?
     {   // only need properties-node because BREAK/PAGEDESC filtered anyway!
-        pCnt = sw::GetParaPropsNode(*GetLayout(), pCursor->GetPoint()->nNode);
+        pCnt = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->GetNode());
     }
     const SfxItemSet* pSet = pCnt->GetpSwAttrSet();
     if( !pSet )
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 4366094d7c50..e06c8f86f4e4 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -157,7 +157,7 @@ bool SwEditShell::SelectionHasNumber() const
             SwTextNode* pTextNd = mxDoc->GetNodes()[nPos]->GetTextNode();
             if (pTextNd)
             {
-                pTextNd = sw::GetParaPropsNode(*GetLayout(), 
SwNodeIndex(*pTextNd));
+                pTextNd = sw::GetParaPropsNode(*GetLayout(), *pTextNd);
             }
             if (pTextNd && (!bResult || pTextNd->Len()!=0))
             {
@@ -192,7 +192,7 @@ bool SwEditShell::SelectionHasBullet() const
             SwTextNode* pTextNd = mxDoc->GetNodes()[nPos]->GetTextNode();
             if (pTextNd)
             {
-                pTextNd = sw::GetParaPropsNode(*GetLayout(), 
SwNodeIndex(*pTextNd));
+                pTextNd = sw::GetParaPropsNode(*GetLayout(), *pTextNd);
             }
             if (pTextNd && (!bResult || pTextNd->Len()!=0))
             {
@@ -212,7 +212,7 @@ bool SwEditShell::HasNumber() const
 {
     bool bResult = false;
 
-    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
GetCursor()->GetPoint()->nNode);
+    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
GetCursor()->GetPoint()->GetNode());
 
     if (pTextNd)
     {
@@ -234,7 +234,7 @@ bool SwEditShell::HasBullet() const
 {
     bool bResult = false;
 
-    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
GetCursor()->GetPoint()->nNode);
+    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
GetCursor()->GetPoint()->GetNode());
 
     if (pTextNd)
     {
@@ -379,7 +379,7 @@ int SwEditShell::GetCurrentParaOutlineLevel( ) const
     int nLevel = 0;
 
     SwPaM* pCursor = GetCursor();
-    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->nNode);
+    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->GetNode());
     if (pTextNd)
         nLevel = pTextNd->GetAttrOutlineLevel();
     return nLevel;
@@ -470,7 +470,7 @@ bool SwEditShell::MoveNumParas( bool bUpperLower, bool 
bUpperLeft )
                         else if (pNd->IsTextNode())
                         {
                             SwTextNode const*const pTextNode =
-                                sw::GetParaPropsNode(*GetLayout(), 
SwNodeIndex(*pNd));
+                                sw::GetParaPropsNode(*GetLayout(), *pNd);
                             if (pOrig == pTextNode->GetNumRule()
                                 && pTextNode->GetActualListLevel() > 
nUpperLevel)
                             {
@@ -656,7 +656,7 @@ bool SwEditShell::IsNoNum( bool bChkStart ) const
          && !HasSelection()
          && ( !bChkStart || IsSttPara() ) )
     {
-        const SwTextNode* pTextNd = sw::GetParaPropsNode(*GetLayout(), 
GetCursor()->GetPoint()->nNode);
+        const SwTextNode* pTextNd = sw::GetParaPropsNode(*GetLayout(), 
GetCursor()->GetPoint()->GetNode());
         if ( pTextNd != nullptr )
         {
             bResult =  !pTextNd->IsCountedInList();
@@ -672,7 +672,7 @@ sal_uInt8 SwEditShell::GetNumLevel() const
     sal_uInt8 nLevel = MAXLEVEL;
 
     SwPaM* pCursor = GetCursor();
-    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->nNode);
+    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->GetNode());
 
     OSL_ENSURE( pTextNd, "GetNumLevel() without text node" );
     if ( pTextNd == nullptr )
@@ -825,7 +825,7 @@ void SwEditShell::SetNumRuleStart( bool bFlag, SwPaM* pPaM )
 bool SwEditShell::IsNumRuleStart( SwPaM* pPaM ) const
 {
     SwPaM* pCursor = pPaM ? pPaM : GetCursor( );
-    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->nNode);
+    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->GetNode());
     return pTextNd && pTextNd->IsListRestart();
 }
 
@@ -858,7 +858,7 @@ void SwEditShell::SetNodeNumStart( sal_uInt16 nStt )
 sal_uInt16 SwEditShell::GetNodeNumStart( SwPaM* pPaM ) const
 {
     SwPaM* pCursor = pPaM ? pPaM : GetCursor();
-    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->nNode);
+    const SwTextNode *const pTextNd = sw::GetParaPropsNode(*GetLayout(), 
pCursor->GetPoint()->GetNode());
     // correction: check, if list restart value is set at text node and
     // use new method <SwTextNode::GetAttrListRestartValue()>.
     // return USHRT_MAX, if no list restart value is found.
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index 1b560e0d2bb3..dde60392c8df 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -49,6 +49,7 @@ class SwScriptInfo;
 enum class ExpandMode;
 class SwTextAttr;
 class SwWrtShell;
+class SwNode;
 
 #define NON_PRINTING_CHARACTER_COLOR Color(0x26, 0x8b, 0xd2)
 
@@ -108,7 +109,7 @@ SwTextFrame * MakeTextFrame(SwTextNode & rNode, SwFrame *, 
sw::FrameMode eMode);
 
 bool FrameContainsNode(SwContentFrame const& rFrame, SwNodeOffset nNodeIndex);
 bool IsParaPropsNode(SwRootFrame const& rLayout, SwTextNode const& rNode);
-SwTextNode * GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& 
rNode);
+SwTextNode * GetParaPropsNode(SwRootFrame const& rLayout, SwNode const& rNode);
 SwPosition GetParaPropsPos(SwRootFrame const& rLayout, SwPosition const& rPos);
 std::pair<SwTextNode *, SwTextNode *>
 GetFirstAndLastNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos);
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 496c717aff28..23e226f87d1c 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -327,16 +327,16 @@ namespace sw {
     }
 
     SwTextNode *
-    GetParaPropsNode(SwRootFrame const& rLayout, SwNodeIndex const& rPos)
+    GetParaPropsNode(SwRootFrame const& rLayout, SwNode const& rPos)
     {
-        SwTextNode *const pTextNode(rPos.GetNode().GetTextNode());
+        const SwTextNode *const pTextNode(rPos.GetTextNode());
         if (pTextNode && !sw::IsParaPropsNode(rLayout, *pTextNode))
         {
             return 
static_cast<SwTextFrame*>(pTextNode->getLayoutFrame(&rLayout))->GetMergedPara()->pParaPropsNode;
         }
         else
         {
-            return pTextNode;
+            return const_cast<SwTextNode*>(pTextNode);
         }
     }
 
diff --git a/sw/source/core/tox/ToxTextGenerator.cxx 
b/sw/source/core/tox/ToxTextGenerator.cxx
index 8b143d6fc1dc..8a92bbf1762f 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -84,7 +84,7 @@ ToxTextGenerator::GetNumStringOfFirstNode(const 
SwTOXSortTabBase& rBase,
     }
     if (pLayout && pLayout->HasMergedParas())
     {   // note: pNd could be any node, since it could be Sequence etc.
-        pNd = sw::GetParaPropsNode(*pLayout, SwNodeIndex(*pNd));
+        pNd = sw::GetParaPropsNode(*pLayout, *pNd);
     }
 
     const SwNumRule* pRule = pNd->GetNumRule();
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx 
b/sw/source/uibase/wrtsh/wrtsh1.cxx
index d5b04b087fc2..aebc12052269 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1374,7 +1374,7 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
                 // If not, let it been counted. Then it has to be checked,
                 // of the outline numbering has to be activated or continued.
                 SwTextNode const*const pTextNode = sw::GetParaPropsNode(
-                        *GetLayout(), GetCursor()->GetPoint()->nNode);
+                        *GetLayout(), GetCursor()->GetPoint()->GetNode());
                 if ( pTextNode && !pTextNode->IsCountedInList() )
                 {
                     // check, if numbering of the outline level of the 
paragraph
@@ -1481,7 +1481,7 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
         if ( !bContinueFoundNumRule )
         {
             SwTextNode const*const pTextNode = sw::GetParaPropsNode(
-                    *GetLayout(), GetCursor()->GetPoint()->nNode);
+                    *GetLayout(), GetCursor()->GetPoint()->GetNode());
 
             if (pTextNode)
             {
@@ -1545,7 +1545,7 @@ void SwWrtShell::NumOrBulletOn(bool bNum)
         }
 
         const SwTextNode *const pTextNode = sw::GetParaPropsNode(*GetLayout(),
-                GetCursor()->GetPoint()->nNode);
+                GetCursor()->GetPoint()->GetNode());
         const SwTwips nWidthOfTabs = pTextNode
                                      ? pTextNode->GetWidthOfLeadingTabs()
                                      : 0;
@@ -1654,7 +1654,7 @@ void SwWrtShell::NumOrBulletOff()
         SwNumRule aNumRule(*pCurNumRule);
 
         SwTextNode * pTextNode =
-            sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
+            sw::GetParaPropsNode(*GetLayout(), 
GetCursor()->GetPoint()->GetNode());
 
         if (pTextNode)
         {
@@ -1767,7 +1767,7 @@ SelectionType SwWrtShell::GetSelectionType() const
     if ( pNumRule )
     {
         const SwTextNode* pTextNd =
-            sw::GetParaPropsNode(*GetLayout(), GetCursor()->GetPoint()->nNode);
+            sw::GetParaPropsNode(*GetLayout(), 
GetCursor()->GetPoint()->GetNode());
 
         if ( pTextNd && pTextNd->IsInList() )
         {

Reply via email to