sw/inc/node.hxx                   |    3 ++-
 sw/source/core/doc/tblrwcl.cxx    |    2 +-
 sw/source/core/docnode/ndtbl.cxx  |   18 +++++++-----------
 sw/source/core/docnode/nodes.cxx  |    3 +--
 sw/source/core/frmedt/fetab.cxx   |    3 +--
 sw/source/core/layout/wsfrm.cxx   |    6 ++----
 sw/source/core/undo/untbl.cxx     |    6 ++----
 sw/source/filter/html/htmltab.cxx |    2 +-
 sw/source/filter/xml/xmltbli.cxx  |    3 +--
 9 files changed, 18 insertions(+), 28 deletions(-)

New commits:
commit 6cd8e893355ac838dcf5ce92bc6a456b7246475f
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Aug 26 16:08:53 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Aug 26 18:51:30 2022 +0200

    make the parameter to SwTableNode::MakeOwnFrames optional
    
    since most of the call sites seem to be just creating a temporary and
    then ignoring it
    
    Change-Id: Ia50cdd4ce5eca665351d3f76e395178bab827b08
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138879
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 4ff2366ee97c..0d749899b078 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -522,7 +522,8 @@ public:
     SwTabFrame *MakeFrame( SwFrame* );
 
     /// Creates the frms for the table node (i.e. the TabFrames).
-    void MakeOwnFrames(SwNodeIndex* pIdxBehind);
+    /// pIdxBehind is optional parameter.
+    void MakeOwnFrames(SwNodeIndex* pIdxBehind = nullptr);
 
     /** Method deletes all views of document for the node.
        The content frames are removed from the respective layout. */
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 31d7a275e96f..a665016a6f07 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -2198,7 +2198,7 @@ bool SwTable::MakeCopy( SwDoc& rInsDoc, const SwPosition& 
rPos,
     // Clean up
     pNewTable->GCLines();
 
-    pTableNd->MakeOwnFrames( &aIdx );  // re-generate the Frames
+    pTableNd->MakeOwnFrames();  // re-generate the Frames
 
     CHECKTABLELAYOUT
 
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index fe2fc3b6822b..d2828fabc69e 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -542,8 +542,7 @@ const SwTable* SwDoc::InsertTable( const 
SwInsertTableOptions& rInsTableOpts,
         }
     }
     // Insert Frames
-    GetNodes().GoNext( &aNdIdx ); // Go to the next ContentNode
-    pTableNd->MakeOwnFrames( &aNdIdx );
+    pTableNd->MakeOwnFrames();
 
     // To-Do - add 'SwExtraRedlineTable' also ?
     if( getIDocumentRedlineAccess().IsRedlineOn() || 
(!getIDocumentRedlineAccess().IsIgnoreRedline() && 
!getIDocumentRedlineAccess().GetRedlineTable().empty() ))
@@ -2381,14 +2380,15 @@ void 
SwTableNode::MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx)
  */
 void SwTableNode::MakeOwnFrames(SwNodeIndex* pIdxBehind)
 {
-    OSL_ENSURE( pIdxBehind, "No Index" );
     SwNode *pNd = GetNodes().FindPrvNxtFrameNode( *this, EndOfSectionNode() );
     if( !pNd )
     {
-        *pIdxBehind = *this;
+        if (pIdxBehind)
+            *pIdxBehind = *this;
         return;
     }
-    *pIdxBehind = *pNd;
+    if (pIdxBehind)
+        *pIdxBehind = *pNd;
 
     SwFrame *pFrame( nullptr );
     SwLayoutFrame *pUpper( nullptr );
@@ -2477,9 +2477,7 @@ void SwTableNode::SetNewTable( std::unique_ptr<SwTable> 
pNewTable, bool bNewFram
     m_pTable = std::move(pNewTable);
     if( bNewFrames )
     {
-        SwNodeIndex aIdx( *EndOfSectionNode());
-        GetNodes().GoNext( &aIdx );
-        MakeOwnFrames(&aIdx);
+        MakeOwnFrames();
     }
 }
 
@@ -3223,9 +3221,7 @@ void SwDoc::SplitTable( const SwPosition& rPos, 
SplitTable_HeadlineOption eHdlnM
         }
 
         // And insert Frames
-        SwNodeIndex aNdIdx( *pNew->EndOfSectionNode() );
-        GetNodes().GoNext( &aNdIdx ); // To the next ContentNode
-        pNew->MakeOwnFrames( &aNdIdx );
+        pNew->MakeOwnFrames();
 
         // Insert a paragraph between the Table
         GetNodes().MakeTextNode( *pNew,
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 6a8de7c94ff9..37d0159a4e3f 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -587,8 +587,7 @@ bool SwNodes::MoveNodes( const SwNodeRange& aRange, SwNodes 
& rNodes,
                     }
                     if( bNewFrames )
                     {
-                        SwNodeIndex aTmp( aIdx );
-                        pTableNd->MakeOwnFrames(&aTmp);
+                        pTableNd->MakeOwnFrames();
                     }
                     aIdx -= nInsPos;
                     nInsPos = SwNodeOffset(0);
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 35655febd031..f1b7145b1d4f 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -501,8 +501,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
                 pTableNd->DelFrames();
                 if ( !pTableNd->GetTable().IsDeleted() )
                 {
-                    SwNodeIndex aTableIdx( *pTableNd->EndOfSectionNode(), 1 );
-                    pTableNd->MakeOwnFrames(&aTableIdx);
+                    pTableNd->MakeOwnFrames();
                 }
 
                 EndAllActionAndCall();
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 20d832ac27b2..d6982d40bdee 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -4497,8 +4497,7 @@ static void UnHideRedlines(SwRootFrame & rLayout,
                 pTableNd->DelFrames(&rLayout);
                 if ( !pTableNd->GetTable().IsDeleted() )
                 {
-                    SwNodeIndex aIdx( *pTableNd->EndOfSectionNode(), 1 );
-                    pTableNd->MakeOwnFrames(&aIdx);
+                    pTableNd->MakeOwnFrames();
                 }
             }
         }
@@ -4507,8 +4506,7 @@ static void UnHideRedlines(SwRootFrame & rLayout,
         {
             SwTableNode * pTableNd = rNode.GetTableNode();
             pTableNd->DelFrames(&rLayout);
-            SwNodeIndex aIdx( *pTableNd->EndOfSectionNode(), 1 );
-            pTableNd->MakeOwnFrames(&aIdx);
+            pTableNd->MakeOwnFrames();
         }
 
         if (!rNode.IsCreateFrameWhenHidingRedlines())
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 70b84bbe6248..d219d4384b3d 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -995,8 +995,7 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool bMdfyBox 
)
         {
             SwTableNode* pTableNode = rTable.GetTableNode();
             pTableNode->DelFrames();
-            SwNodeIndex aTableIdx( *pTableNode->EndOfSectionNode(), 1 );
-            pTableNode->MakeOwnFrames(&aTableIdx);
+            pTableNode->MakeOwnFrames();
         }
         else
         {
@@ -3014,8 +3013,7 @@ void SwUndoMergeTable::UndoImpl(::sw::UndoRedoContext & 
rContext)
     }
 
     // create frames for the new table
-    SwNodeIndex aTmpIdx( *pNew );
-    pNew->MakeOwnFrames(&aTmpIdx);
+    pNew->MakeOwnFrames();
 
     // position cursor somewhere in content
     SwContentNode* pCNd = pDoc->GetNodes().GoNext( &rIdx );
diff --git a/sw/source/filter/html/htmltab.cxx 
b/sw/source/filter/html/htmltab.cxx
index b06536055e10..f63d00a95980 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -4729,7 +4729,7 @@ void TableSaveStruct::MakeTable( sal_uInt16 nWidth, 
SwPosition& rPos, SwDoc *pDo
             SwNodeIndex aIdx( *pTableNd->EndOfSectionNode(), 1 );
             OSL_ENSURE( aIdx.GetIndex() <= pTCntxt->GetPos()->GetNodeIndex(),
                     "unexpected node for table layout" );
-            pTableNd->MakeOwnFrames(&aIdx);
+            pTableNd->MakeOwnFrames();
         }
     }
 
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 9f61af14ec0d..b2fed3e3376f 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2639,8 +2639,7 @@ void SwXMLTableContext::MakeTable()
     if( 
m_pTableNode->GetDoc().getIDocumentLayoutAccess().GetCurrentViewShell() )
     {
         m_pTableNode->DelFrames();
-        SwNodeIndex aIdx( *m_pTableNode->EndOfSectionNode(), 1 );
-        m_pTableNode->MakeOwnFrames(&aIdx);
+        m_pTableNode->MakeOwnFrames();
     }
 }
 

Reply via email to