summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-10-02 20:26:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-10-04 15:03:32 +0200
commit5ec50565b35f3a776dffb7afc33a985e5ea6409f (patch)
treee00985d6330a1c9998356553a66cc7bb54903038 /sw
parent3dee30f1c033d3679f7b8dbc7813b7dc03ac8f70 (diff)
MakeCopy family never called with a null SwDoc* arg
Change-Id: I4ba4569a529425a5e92fb3f82990e34ae4db3228 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103877 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/ndgrf.hxx2
-rw-r--r--sw/inc/ndole.hxx2
-rw-r--r--sw/inc/ndtxt.hxx2
-rw-r--r--sw/inc/node.hxx6
-rw-r--r--sw/inc/swtable.hxx20
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx2
-rw-r--r--sw/source/core/doc/doclay.cxx2
-rw-r--r--sw/source/core/doc/tblrwcl.cxx72
-rw-r--r--sw/source/core/docnode/ndcopy.cxx42
-rw-r--r--sw/source/core/docnode/ndsect.cxx16
-rw-r--r--sw/source/core/docnode/ndtbl.cxx10
-rw-r--r--sw/source/core/docnode/nodes.cxx6
-rw-r--r--sw/source/core/graphic/ndgrf.cxx4
-rw-r--r--sw/source/core/inc/tblrwcl.hxx2
-rw-r--r--sw/source/core/ole/ndole.cxx16
-rw-r--r--sw/source/core/table/swnewtable.cxx16
-rw-r--r--sw/source/core/table/swtable.cxx12
-rw-r--r--sw/source/filter/basflt/shellio.cxx2
-rw-r--r--sw/source/uibase/uno/unoatxt.cxx16
19 files changed, 124 insertions, 126 deletions
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index c208552f23ff..a5fd33f51fe5 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -106,7 +106,7 @@ public:
void SetScaleImageMap( bool b ) { mbScaleImageMap = b; }
/// in ndcopy.cxx
- virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const override;
+ virtual SwContentNode* MakeCopy(SwDoc&, const SwNodeIndex&, bool bNewFrames) const override;
/** Re-read in case graphic was not OK. The current one
gets replaced by the new one. */
diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx
index 8382a42e58dc..7c07c2656b44 100644
--- a/sw/inc/ndole.hxx
+++ b/sw/inc/ndole.hxx
@@ -114,7 +114,7 @@ public:
virtual ~SwOLENode() override;
/// Is in ndcopy.cxx.
- virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const override;
+ virtual SwContentNode* MakeCopy(SwDoc&, const SwNodeIndex&, bool bNewFrames) const override;
virtual Size GetTwipSize() const override;
diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx
index 9dd3a5abe78a..e2d3dde7f887 100644
--- a/sw/inc/ndtxt.hxx
+++ b/sw/inc/ndtxt.hxx
@@ -672,7 +672,7 @@ public:
/// in ndcopy.cxx
bool IsSymbolAt(sal_Int32 nBegin) const; // In itratr.cxx.
- virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const override;
+ virtual SwContentNode* MakeCopy(SwDoc&, const SwNodeIndex&, bool bNewFrames) const override;
/// Interactive hyphenation: we find TextFrame and call its CalcHyph.
bool Hyphenate( SwInterHyphInfo &rHyphInf );
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index c8c1c704f00f..7c052e037d7d 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -425,7 +425,7 @@ public:
There are differences between text node and formula node. */
virtual sal_Int32 Len() const;
- virtual SwContentNode* MakeCopy(SwDoc*, const SwNodeIndex&, bool bNewFrames) const = 0;
+ virtual SwContentNode* MakeCopy(SwDoc&, const SwNodeIndex&, bool bNewFrames) const = 0;
/// Get information from Client.
virtual bool GetInfo( SfxPoolItem& ) const override;
@@ -517,7 +517,7 @@ public:
The content frames that are created are put into the respective layout. */
void MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx);
- SwTableNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
+ SwTableNode* MakeCopy( SwDoc&, const SwNodeIndex& ) const;
void SetNewTable( std::unique_ptr<SwTable> , bool bNewFrames=true );
// Removes redline objects that relate to this table from the 'Extra Redlines' table
@@ -565,7 +565,7 @@ public:
The content frames created are put into the respective layout. */
void MakeFramesForAdjacentContentNode(const SwNodeIndex & rIdx);
- SwSectionNode* MakeCopy( SwDoc*, const SwNodeIndex& ) const;
+ SwSectionNode* MakeCopy( SwDoc&, const SwNodeIndex& ) const;
/// Set pointer in format of section on itself.
void NodesArrChgd();
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index ef04b527b65b..bb43c2e86388 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -156,14 +156,14 @@ private:
// @@@ public copy ctor, but no copy assignment?
SwTable & operator= (const SwTable &) = delete;
bool OldMerge( SwDoc*, const SwSelBoxes&, SwTableBox*, SwUndoTableMerge* );
- bool OldSplitRow( SwDoc*, const SwSelBoxes&, sal_uInt16, bool );
+ bool OldSplitRow( SwDoc&, const SwSelBoxes&, sal_uInt16, bool );
bool NewMerge( SwDoc*, const SwSelBoxes&, const SwSelBoxes& rMerged,
SwUndoTableMerge* );
- bool NewSplitRow( SwDoc*, const SwSelBoxes&, sal_uInt16, bool );
+ bool NewSplitRow( SwDoc&, const SwSelBoxes&, sal_uInt16, bool );
std::unique_ptr<SwBoxSelection> CollectBoxSelection( const SwPaM& rPam ) const;
- void InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
+ void InsertSpannedRow( SwDoc& rDoc, sal_uInt16 nIdx, sal_uInt16 nCnt );
bool InsertRow_( SwDoc*, const SwSelBoxes&, sal_uInt16 nCnt, bool bBehind );
- bool NewInsertCol( SwDoc*, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool );
+ bool NewInsertCol( SwDoc&, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool );
void FindSuperfluousRows_( SwSelBoxes& rBoxes, SwTableLine*, SwTableLine* );
void AdjustWidths( const long nOld, const long nNew );
void NewSetTabCols( Parm &rP, const SwTabCols &rNew, const SwTabCols &rOld,
@@ -232,25 +232,25 @@ public:
return m_bNewModel ? NewMerge( pDoc, rBoxes, rMerged, pUndo ) :
OldMerge( pDoc, rBoxes, pMergeBox, pUndo );
}
- bool SplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
+ bool SplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
bool bSameHeight )
{
- return m_bNewModel ? NewSplitRow( pDoc, rBoxes, nCnt, bSameHeight ) :
- OldSplitRow( pDoc, rBoxes, nCnt, bSameHeight );
+ return m_bNewModel ? NewSplitRow( rDoc, rBoxes, nCnt, bSameHeight ) :
+ OldSplitRow( rDoc, rBoxes, nCnt, bSameHeight );
}
bool PrepareMerge( const SwPaM& rPam, SwSelBoxes& rBoxes,
SwSelBoxes& rMerged, SwTableBox** ppMergeBox, SwUndoTableMerge* pUndo );
void ExpandColumnSelection( SwSelBoxes& rBoxes, long &rMin, long &rMax ) const;
void PrepareDeleteCol( long nMin, long nMax );
- bool InsertCol( SwDoc*, const SwSelBoxes& rBoxes,
+ bool InsertCol( SwDoc&, const SwSelBoxes& rBoxes,
sal_uInt16 nCnt, bool bBehind );
bool InsertRow( SwDoc*, const SwSelBoxes& rBoxes,
sal_uInt16 nCnt, bool bBehind );
void PrepareDelBoxes( const SwSelBoxes& rBoxes );
bool DeleteSel( SwDoc*, const SwSelBoxes& rBoxes, const SwSelBoxes* pMerged,
SwUndo* pUndo, const bool bDelMakeFrames, const bool bCorrBorder );
- bool SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt );
+ bool SplitCol( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt );
void FindSuperfluousRows( SwSelBoxes& rBoxes )
{ FindSuperfluousRows_( rBoxes, nullptr, nullptr ); }
@@ -275,7 +275,7 @@ public:
const SwTableBox* GetTableBox( const OUString& rName,
const bool bPerformValidCheck = false ) const;
// Copy selected boxes to another document.
- bool MakeCopy( SwDoc*, const SwPosition&, const SwSelBoxes&,
+ bool MakeCopy( SwDoc&, const SwPosition&, const SwSelBoxes&,
bool bCpyName = false ) const;
// Copy table in this
bool InsTable( const SwTable& rCpyTable, const SwNodeIndex&,
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 4ca1c1cb894d..cf697077133f 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4820,7 +4820,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
rDoc.getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD));
else
{
- pDestTextNd = pSttTextNd->MakeCopy(&rDoc, aInsPos, true)->GetTextNode();
+ pDestTextNd = pSttTextNd->MakeCopy(rDoc, aInsPos, true)->GetTextNode();
bCopyOk = true;
}
aDestIdx.Assign( pDestTextNd, 0 );
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 81d4e86c5724..5e03d523dd70 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -395,7 +395,7 @@ SwFlyFrameFormat* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rS
}
else
{
- rTable.MakeCopy( this, aPos, *pSelBoxes );
+ rTable.MakeCopy(*this, aPos, *pSelBoxes);
// Don't delete a part of a table with row span!!
// You could delete the content instead -> ToDo
//rTable.DeleteSel( this, *pSelBoxes, 0, 0, true, true );
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index e98d44c14e80..402f2c920095 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -202,7 +202,7 @@ namespace {
struct CpyPara
{
std::shared_ptr< std::vector< std::vector< sal_uLong > > > pWidths;
- SwDoc* pDoc;
+ SwDoc& rDoc;
SwTableNode* pTableNd;
CpyTabFrames& rTabFrameArr;
SwTableLine* pInsLine;
@@ -215,7 +215,7 @@ struct CpyPara
bool bCpyContent;
CpyPara( SwTableNode* pNd, sal_uInt16 nCopies, CpyTabFrames& rFrameArr )
- : pDoc( &pNd->GetDoc() ), pTableNd( pNd ), rTabFrameArr(rFrameArr),
+ : rDoc( pNd->GetDoc() ), pTableNd( pNd ), rTabFrameArr(rFrameArr),
pInsLine(nullptr), pInsBox(nullptr), nOldSize(0), nNewSize(0),
nMinLeft(ULONG_MAX), nMaxRight(0),
nCpyCnt(nCopies), nInsPos(0),
@@ -223,7 +223,7 @@ struct CpyPara
nDelBorderFlag(0), bCpyContent( true )
{}
CpyPara( const CpyPara& rPara, SwTableLine* pLine )
- : pWidths( rPara.pWidths ), pDoc(rPara.pDoc), pTableNd(rPara.pTableNd),
+ : pWidths( rPara.pWidths ), rDoc(rPara.rDoc), pTableNd(rPara.pTableNd),
rTabFrameArr(rPara.rTabFrameArr), pInsLine(pLine), pInsBox(rPara.pInsBox),
nOldSize(0), nNewSize(rPara.nNewSize), nMinLeft( rPara.nMinLeft ),
nMaxRight( rPara.nMaxRight ), nCpyCnt(rPara.nCpyCnt), nInsPos(0),
@@ -231,7 +231,7 @@ struct CpyPara
nDelBorderFlag( rPara.nDelBorderFlag ), bCpyContent( rPara.bCpyContent )
{}
CpyPara( const CpyPara& rPara, SwTableBox* pBox )
- : pWidths( rPara.pWidths ), pDoc(rPara.pDoc), pTableNd(rPara.pTableNd),
+ : pWidths( rPara.pWidths ), rDoc(rPara.rDoc), pTableNd(rPara.pTableNd),
rTabFrameArr(rPara.rTabFrameArr), pInsLine(rPara.pInsLine), pInsBox(pBox),
nOldSize(rPara.nOldSize), nNewSize(rPara.nNewSize),
nMinLeft( rPara.nMinLeft ), nMaxRight( rPara.nMaxRight ),
@@ -335,7 +335,7 @@ static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara)
}
else
{
- ::InsTableBox( pCpyPara->pDoc, pCpyPara->pTableNd, pCpyPara->pInsLine,
+ ::InsTableBox( pCpyPara->rDoc, pCpyPara->pTableNd, pCpyPara->pInsLine,
aFindFrame.pNewFrameFormat, pBox, pCpyPara->nInsPos++ );
const FndBoxes_t& rFndBxs = rFndBox.GetUpper()->GetBoxes();
@@ -448,7 +448,7 @@ static SwRowFrame* GetRowFrame( SwTableLine& rLine )
return nullptr;
}
-bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind )
+bool SwTable::InsertCol( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind )
{
OSL_ENSURE( !rBoxes.empty() && nCnt, "No valid Box List" );
SwTableNode* pTableNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
@@ -457,7 +457,7 @@ bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
bool bRes = true;
if( IsNewModel() )
- bRes = NewInsertCol( pDoc, rBoxes, nCnt, bBehind );
+ bRes = NewInsertCol( rDoc, rBoxes, nCnt, bBehind );
else
{
// Find all Boxes/Lines
@@ -497,12 +497,12 @@ bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
bRes = true;
}
- SwChartDataProvider *pPCD = pDoc->getIDocumentChartDataProviderAccess().GetChartDataProvider();
+ SwChartDataProvider *pPCD = rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider();
if (pPCD && nCnt)
pPCD->AddRowCols( *this, rBoxes, nCnt, bBehind );
- pDoc->UpdateCharts( GetFrameFormat()->GetName() );
+ rDoc.UpdateCharts( GetFrameFormat()->GetName() );
- pDoc->GetDocShell()->GetFEShell()->UpdateTableStyleFormatting();
+ rDoc.GetDocShell()->GetFEShell()->UpdateTableStyleFormatting();
return bRes;
}
@@ -1005,10 +1005,10 @@ bool SwTable::DeleteSel(
return true;
}
-bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
+bool SwTable::OldSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
bool bSameHeight )
{
- OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid values" );
+ OSL_ENSURE( !rBoxes.empty() && nCnt, "No valid values" );
SwTableNode* pTableNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTableNd )
return false;
@@ -1016,7 +1016,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn
// TL_CHART2: splitting/merging of a number of cells or rows will usually make
// the table too complex to be handled with chart.
// Thus we tell the charts to use their own data provider and forget about this table
- pDoc->getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( this );
+ rDoc.getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( this );
SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>()); // Delete HTML Layout
@@ -1073,7 +1073,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn
sal_uLong nSttNd = pLastBox->GetSttIdx() + 1,
nEndNd = pLastBox->GetSttNd()->EndOfSectionIndex();
while( nSttNd < nEndNd )
- if( !pDoc->GetNodes()[ nSttNd++ ]->IsTextNode() )
+ if( !rDoc.GetNodes()[ nSttNd++ ]->IsTextNode() )
{
bMoveNodes = false;
break;
@@ -1104,7 +1104,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn
}
else
{
- ::InsTableBox( pDoc, pTableNd, pNewLine, pCpyBoxFrameFormat,
+ ::InsTableBox( rDoc, pTableNd, pNewLine, pCpyBoxFrameFormat,
pLastBox, 0 );
if( bChkBorder )
@@ -1125,8 +1125,8 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn
SwNodeRange aRg( *pLastBox->GetSttNd(), +2, *pEndNd );
pLastBox = pNewLine->GetTabBoxes()[0]; // reset
SwNodeIndex aInsPos( *pLastBox->GetSttNd(), 1 );
- pDoc->GetNodes().MoveNodes(aRg, pDoc->GetNodes(), aInsPos, false);
- pDoc->GetNodes().Delete( aInsPos ); // delete the empty one
+ rDoc.GetNodes().MoveNodes(aRg, rDoc.GetNodes(), aInsPos, false);
+ rDoc.GetNodes().Delete( aInsPos ); // delete the empty one
}
}
}
@@ -1148,9 +1148,9 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn
return true;
}
-bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt )
+bool SwTable::SplitCol(SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt)
{
- OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid values" );
+ OSL_ENSURE( !rBoxes.empty() && nCnt, "No valid values" );
SwTableNode* pTableNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTableNd )
return false;
@@ -1158,7 +1158,7 @@ bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt )
// TL_CHART2: splitting/merging of a number of cells or rows will usually make
// the table too complex to be handled with chart.
// Thus we tell the charts to use their own data provider and forget about this table
- pDoc->getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( this );
+ rDoc.getIDocumentChartDataProviderAccess().CreateChartInternalDataProviders( this );
SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>()); // Delete HTML Layout
SwSelBoxes aSelBoxes(rBoxes);
@@ -1219,10 +1219,10 @@ bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt )
// Insert the Boxes at the Position
for( sal_uInt16 i = 1; i < nCnt; ++i )
- ::InsTableBox( pDoc, pTableNd, pInsLine, aFindFrame.pNewFrameFormat,
+ ::InsTableBox( rDoc, pTableNd, pInsLine, aFindFrame.pNewFrameFormat,
pSelBox, nBoxPos + i ); // insert after
- ::InsTableBox( pDoc, pTableNd, pInsLine, pLastBoxFormat,
+ ::InsTableBox( rDoc, pTableNd, pInsLine, pLastBoxFormat,
pSelBox, nBoxPos + nCnt ); // insert after
// Special treatment for the Border:
@@ -1849,7 +1849,7 @@ static void lcl_CopyBoxToDoc(FndBox_ const& rFndBox, CpyPara *const pCpyPara)
if(DoCopyIt)
{
// It doesn't exist yet, so copy it
- aFindFrame.pNewFrameFormat = pCpyPara->pDoc->MakeTableBoxFormat();
+ aFindFrame.pNewFrameFormat = pCpyPara->rDoc.MakeTableBoxFormat();
aFindFrame.pNewFrameFormat->CopyAttrs( *rFndBox.GetBox()->GetFrameFormat() );
if( !pCpyPara->bCpyContent )
aFindFrame.pNewFrameFormat->ResetFormatAttr( RES_BOXATR_FORMULA, RES_BOXATR_VALUE );
@@ -1874,9 +1874,9 @@ static void lcl_CopyBoxToDoc(FndBox_ const& rFndBox, CpyPara *const pCpyPara)
else
{
// Create an empty Box
- pCpyPara->pDoc->GetNodes().InsBoxen( pCpyPara->pTableNd, pCpyPara->pInsLine,
+ pCpyPara->rDoc.GetNodes().InsBoxen( pCpyPara->pTableNd, pCpyPara->pInsLine,
aFindFrame.pNewFrameFormat,
- pCpyPara->pDoc->GetDfltTextFormatColl(),
+ pCpyPara->rDoc.GetDfltTextFormatColl(),
nullptr, pCpyPara->nInsPos );
pBox = pCpyPara->pInsLine->GetTabBoxes()[ pCpyPara->nInsPos ];
if( bDummy )
@@ -1888,13 +1888,13 @@ static void lcl_CopyBoxToDoc(FndBox_ const& rFndBox, CpyPara *const pCpyPara)
// We can also copy formulas and values, if we copy the content
{
- SfxItemSet aBoxAttrSet( pCpyPara->pDoc->GetAttrPool(),
+ SfxItemSet aBoxAttrSet( pCpyPara->rDoc.GetAttrPool(),
svl::Items<RES_BOXATR_FORMAT, RES_BOXATR_VALUE>{} );
aBoxAttrSet.Put(rFndBox.GetBox()->GetFrameFormat()->GetAttrSet());
if( aBoxAttrSet.Count() )
{
const SfxPoolItem* pItem;
- SvNumberFormatter* pN = pCpyPara->pDoc->GetNumberFormatter( false );
+ SvNumberFormatter* pN = pCpyPara->rDoc.GetNumberFormatter( false );
if( pN && pN->HasMergeFormatTable() && SfxItemState::SET == aBoxAttrSet.
GetItemState( RES_BOXATR_FORMAT, false, &pItem ) )
{
@@ -1913,7 +1913,7 @@ static void lcl_CopyBoxToDoc(FndBox_ const& rFndBox, CpyPara *const pCpyPara)
pFromDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly(aCpyRg, aInsIdx, nullptr, false);
// Delete the initial TextNode
- pCpyPara->pDoc->GetNodes().Delete( aInsIdx );
+ pCpyPara->rDoc.GetNodes().Delete( aInsIdx );
}
++pCpyPara->nInsPos;
}
@@ -1942,7 +1942,7 @@ lcl_CopyLineToDoc(const FndLine_& rFndLine, CpyPara *const pCpyPara)
if( itFind == pCpyPara->rTabFrameArr.end() )
{
// It doesn't exist yet, so copy it
- aFindFrame.pNewFrameFormat = reinterpret_cast<SwTableBoxFormat*>(pCpyPara->pDoc->MakeTableLineFormat());
+ aFindFrame.pNewFrameFormat = reinterpret_cast<SwTableBoxFormat*>(pCpyPara->rDoc.MakeTableLineFormat());
aFindFrame.pNewFrameFormat->CopyAttrs( *rFndLine.GetLine()->GetFrameFormat() );
pCpyPara->rTabFrameArr.insert( aFindFrame );
}
@@ -2042,7 +2042,7 @@ void SwTable::CopyHeadlineIntoTable( SwTableNode& rTableNd )
}
}
-bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos,
+bool SwTable::MakeCopy( SwDoc& rInsDoc, const SwPosition& rPos,
const SwSelBoxes& rSelBoxes,
bool bCpyName ) const
{
@@ -2058,13 +2058,13 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos,
// First copy the PoolTemplates for the Table, so that the Tables are
// actually copied and have valid values.
SwDoc* pSrcDoc = GetFrameFormat()->GetDoc();
- if( pSrcDoc != pInsDoc )
+ if( pSrcDoc != &rInsDoc )
{
- pInsDoc->CopyTextColl( *pSrcDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TABLE ) );
- pInsDoc->CopyTextColl( *pSrcDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TABLE_HDLN ) );
+ rInsDoc.CopyTextColl( *pSrcDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TABLE ) );
+ rInsDoc.CopyTextColl( *pSrcDoc->getIDocumentStylePoolAccess().GetTextCollFromPool( RES_POOLCOLL_TABLE_HDLN ) );
}
- SwTable* pNewTable = const_cast<SwTable*>(pInsDoc->InsertTable(
+ SwTable* pNewTable = const_cast<SwTable*>(rInsDoc.InsertTable(
SwInsertTableOptions( SwInsertTableFlags::HeadlineNoBorder, 1 ),
rPos, 1, 1, GetFrameFormat()->GetHoriOrient().GetHoriOrient(),
nullptr, nullptr, false, IsNewModel() ));
@@ -2084,7 +2084,7 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos,
{
// A DDE-Table is being copied
// Does the new Document actually have it's FieldType?
- SwFieldType* pFieldType = pInsDoc->getIDocumentFieldsAccess().InsertFieldType(
+ SwFieldType* pFieldType = rInsDoc.getIDocumentFieldsAccess().InsertFieldType(
*pSwDDETable->GetDDEFieldType() );
OSL_ENSURE( pFieldType, "unknown FieldType" );
@@ -2107,7 +2107,7 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos,
pSrcDoc->getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
}
- SwTableNumFormatMerge aTNFM( *pSrcDoc, *pInsDoc );
+ SwTableNumFormatMerge aTNFM(*pSrcDoc, rInsDoc);
// Also copy Names or enforce a new unique one
if( bCpyName )
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 152c8e20deb0..37fe854f88c4 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -56,7 +56,7 @@ struct MapTableFrameFormat
typedef std::vector<MapTableFrameFormat> MapTableFrameFormats;
-SwContentNode* SwTextNode::MakeCopy(SwDoc* pDoc, const SwNodeIndex& rIdx, bool const bNewFrames) const
+SwContentNode* SwTextNode::MakeCopy(SwDoc& rDoc, const SwNodeIndex& rIdx, bool const bNewFrames) const
{
// the Copy-Textnode is the Node with the Text, the Copy-Attrnode is the
// node with the collection and hard attributes. Normally is the same
@@ -67,7 +67,7 @@ SwContentNode* SwTextNode::MakeCopy(SwDoc* pDoc, const SwNodeIndex& rIdx, bool c
// Copy the formats to the other document
SwTextFormatColl* pColl = nullptr;
- if( pDoc->IsInsOnlyTextGlossary() )
+ if( rDoc.IsInsOnlyTextGlossary() )
{
SwNodeIndex aIdx( rIdx, -1 );
if( aIdx.GetNode().IsTextNode() )
@@ -77,9 +77,9 @@ SwContentNode* SwTextNode::MakeCopy(SwDoc* pDoc, const SwNodeIndex& rIdx, bool c
}
}
if( !pColl )
- pColl = pDoc->CopyTextColl( *GetTextColl() );
+ pColl = rDoc.CopyTextColl( *GetTextColl() );
- SwTextNode* pTextNd = pDoc->GetNodes().MakeTextNode(rIdx, pColl, bNewFrames);
+ SwTextNode* pTextNd = rDoc.GetNodes().MakeTextNode(rIdx, pColl, bNewFrames);
// METADATA: register copy
pTextNd->RegisterAsCopyOf(*pCpyTextNd);
@@ -126,7 +126,7 @@ namespace {
struct CopyTable
{
- SwDoc* m_pDoc;
+ SwDoc& m_rDoc;
sal_uLong m_nOldTableSttIdx;
MapTableFrameFormats& m_rMapArr;
SwTableLine* m_pInsLine;
@@ -134,9 +134,9 @@ struct CopyTable
SwTableNode *m_pTableNd;
const SwTable *m_pOldTable;
- CopyTable(SwDoc* pDc, MapTableFrameFormats& rArr, sal_uLong nOldStt,
+ CopyTable(SwDoc& rDc, MapTableFrameFormats& rArr, sal_uLong nOldStt,
SwTableNode& rTableNd, const SwTable* pOldTable)
- : m_pDoc(pDc), m_nOldTableSttIdx(nOldStt), m_rMapArr(rArr),
+ : m_rDoc(rDc), m_nOldTableSttIdx(nOldStt), m_rMapArr(rArr),
m_pInsLine(nullptr), m_pInsBox(nullptr), m_pTableNd(&rTableNd), m_pOldTable(pOldTable)
{}
};
@@ -161,12 +161,12 @@ static void lcl_CopyTableBox( SwTableBox* pBox, CopyTable* pCT )
const_cast<SwTableBoxFormula*>(static_cast<const SwTableBoxFormula*>(pItem))->PtrToBoxNm(pCT->m_pOldTable);
}
- pBoxFormat = pCT->m_pDoc->MakeTableBoxFormat();
+ pBoxFormat = pCT->m_rDoc.MakeTableBoxFormat();
pBoxFormat->CopyAttrs( *pBox->GetFrameFormat() );
if( pBox->GetSttIdx() )
{
- SvNumberFormatter* pN = pCT->m_pDoc->GetNumberFormatter(false);
+ SvNumberFormatter* pN = pCT->m_rDoc.GetNumberFormatter(false);
if( pN && pN->HasMergeFormatTable() && SfxItemState::SET == pBoxFormat->
GetItemState( RES_BOXATR_FORMAT, false, &pItem ) )
{
@@ -219,7 +219,7 @@ static void lcl_CopyTableLine( const SwTableLine* pLine, CopyTable* pCT )
if( pLineFormat == pLine->GetFrameFormat() ) // Create a new one?
{
- pLineFormat = pCT->m_pDoc->MakeTableLineFormat();
+ pLineFormat = pCT->m_rDoc.MakeTableLineFormat();
pLineFormat->CopyAttrs( *pLine->GetFrameFormat() );
pCT->m_rMapArr.emplace_back(pLine->GetFrameFormat(), pLineFormat);
}
@@ -240,31 +240,31 @@ static void lcl_CopyTableLine( const SwTableLine* pLine, CopyTable* pCT )
lcl_CopyTableBox(rpBox, pCT);
}
-SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+SwTableNode* SwTableNode::MakeCopy( SwDoc& rDoc, const SwNodeIndex& rIdx ) const
{
// In which array are we? Nodes? UndoNodes?
SwNodes& rNds = const_cast<SwNodes&>(GetNodes());
{
- if( rIdx < pDoc->GetNodes().GetEndOfInserts().GetIndex() &&
- rIdx >= pDoc->GetNodes().GetEndOfInserts().StartOfSectionIndex() )
+ if( rIdx < rDoc.GetNodes().GetEndOfInserts().GetIndex() &&
+ rIdx >= rDoc.GetNodes().GetEndOfInserts().StartOfSectionIndex() )
return nullptr;
}
// Copy the TableFrameFormat
OUString sTableName( GetTable().GetFrameFormat()->GetName() );
- if( !pDoc->IsCopyIsMove() )
+ if( !rDoc.IsCopyIsMove() )
{
- const SwFrameFormats& rTableFormats = *pDoc->GetTableFrameFormats();
+ const SwFrameFormats& rTableFormats = *rDoc.GetTableFrameFormats();
for( size_t n = rTableFormats.size(); n; )
if( rTableFormats[ --n ]->GetName() == sTableName )
{
- sTableName = pDoc->GetUniqueTableName();
+ sTableName = rDoc.GetUniqueTableName();
break;
}
}
- SwFrameFormat* pTableFormat = pDoc->MakeTableFrameFormat( sTableName, pDoc->GetDfltFrameFormat() );
+ SwFrameFormat* pTableFormat = rDoc.MakeTableFrameFormat( sTableName, rDoc.GetDfltFrameFormat() );
pTableFormat->CopyAttrs( *GetTable().GetFrameFormat() );
SwTableNode* pTableNd = new SwTableNode( rIdx );
SwEndNode* pEndNd = new SwEndNode( rIdx, *pTableNd );
@@ -284,9 +284,9 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
// Is the field type available in the new document?
pDDEType = const_cast<SwDDETable*>(pSwDDETable)->GetDDEFieldType();
if( pDDEType->IsDeleted() )
- pDoc->getIDocumentFieldsAccess().InsDeletedFieldType( *pDDEType );
+ rDoc.getIDocumentFieldsAccess().InsDeletedFieldType( *pDDEType );
else
- pDDEType = static_cast<SwDDEFieldType*>(pDoc->getIDocumentFieldsAccess().InsertFieldType( *pDDEType ));
+ pDDEType = static_cast<SwDDEFieldType*>(rDoc.getIDocumentFieldsAccess().InsertFieldType( *pDDEType ));
OSL_ENSURE( pDDEType, "unknown FieldType" );
// Swap the table pointers in the node
@@ -311,7 +311,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
{
aRg.aStart.Assign( *pTableNd, 1 );
aRg.aEnd.Assign( *pTableNd->EndOfSectionNode() );
- pDoc->GetNodes().SectionDown( &aRg, SwTableBoxStartNode );
+ rDoc.GetNodes().SectionDown( &aRg, SwTableBoxStartNode );
}
// Delete all frames from the copied area, they will be created
@@ -319,7 +319,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
pTableNd->DelFrames();
MapTableFrameFormats aMapArr;
- CopyTable aPara( pDoc, aMapArr, GetIndex(), *pTableNd, &GetTable() );
+ CopyTable aPara( rDoc, aMapArr, GetIndex(), *pTableNd, &GetTable() );
for( const SwTableLine* pLine : GetTable().GetTabLines() )
lcl_CopyTableLine( pLine, &aPara );
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 54ec466d6165..415334221392 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1196,13 +1196,13 @@ void SwSectionNode::DelFrames(SwRootFrame const*const /*FIXME TODO*/, bool const
}
}
-SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
+SwSectionNode* SwSectionNode::MakeCopy( SwDoc& rDoc, const SwNodeIndex& rIdx ) const
{
// In which array am I: Nodes, UndoNodes?
const SwNodes& rNds = GetNodes();
// Copy the SectionFrameFormat
- SwSectionFormat* pSectFormat = pDoc->MakeSectionFormat();
+ SwSectionFormat* pSectFormat = rDoc.MakeSectionFormat();
pSectFormat->CopyAttrs( *GetSection().GetFormat() );
std::unique_ptr<SwTOXBase> pTOXBase;
@@ -1211,7 +1211,7 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c
OSL_ENSURE( dynamic_cast< const SwTOXBaseSection* >( &GetSection() ) != nullptr , "no TOXBaseSection!" );
SwTOXBaseSection const& rTBS(
dynamic_cast<SwTOXBaseSection const&>(GetSection()));
- pTOXBase.reset( new SwTOXBase(rTBS, pDoc) );
+ pTOXBase.reset( new SwTOXBase(rTBS, &rDoc) );
}
SwSectionNode *const pSectNd =
@@ -1225,14 +1225,14 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c
if (SectionType::ToxContent != GetSection().GetType())
{
// Keep the Name for Move
- if( &rNds.GetDoc() == pDoc && pDoc->IsCopyIsMove() )
+ if( &rNds.GetDoc() == &rDoc && rDoc.IsCopyIsMove() )
{
pNewSect->SetSectionName( GetSection().GetSectionName() );
}
else
{
const OUString sSectionName(GetSection().GetSectionName());
- pNewSect->SetSectionName(pDoc->GetUniqueSectionName( &sSectionName ));
+ pNewSect->SetSectionName(rDoc.GetUniqueSectionName( &sSectionName ));
}
}
@@ -1256,14 +1256,14 @@ SwSectionNode* SwSectionNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) c
// Copy the Links/Server
if( pNewSect->IsLinkType() ) // Add the Link
- pNewSect->CreateLink( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ? LinkCreateType::Connect : LinkCreateType::NONE );
+ pNewSect->CreateLink( rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() ? LinkCreateType::Connect : LinkCreateType::NONE );
// If we copy from the Undo as Server, enter it again
if (m_pSection->IsServer()
- && pDoc->GetIDocumentUndoRedo().IsUndoNodes(rNds))
+ && rDoc.GetIDocumentUndoRedo().IsUndoNodes(rNds))
{
pNewSect->SetRefObject( m_pSection->GetObject() );
- pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertServer( pNewSect->GetObject() );
+ rDoc.getIDocumentLinksAdministration().GetLinkManager().InsertServer( pNewSect->GetObject() );
}
// METADATA: copy xml:id; must be done after insertion of node
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 3c66f9d43b86..dcd662f4c163 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1750,7 +1750,7 @@ bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind )
aMsgHint.m_eFlags = TBL_BOXPTR;
getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
- bRet = rTable.InsertCol( this, rBoxes, nCnt, bBehind );
+ bRet = rTable.InsertCol(*this, rBoxes, nCnt, bBehind);
if (bRet)
{
getIDocumentState().SetModified();
@@ -2197,9 +2197,9 @@ bool SwDoc::SplitTable( const SwSelBoxes& rBoxes, bool bVert, sal_uInt16 nCnt,
getIDocumentFieldsAccess().UpdateTableFields( &aMsgHint );
if (bVert)
- bRet = rTable.SplitCol( this, rBoxes, nCnt );
+ bRet = rTable.SplitCol(*this, rBoxes, nCnt);
else
- bRet = rTable.SplitRow( this, rBoxes, nCnt, bSameHeight );
+ bRet = rTable.SplitRow(*this, rBoxes, nCnt, bSameHeight);
if (bRet)
{
@@ -4305,7 +4305,7 @@ bool SwDoc::InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
{
::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
- bRet = pSrcTableNd->GetTable().MakeCopy( this, rInsPos, rBoxes,
+ bRet = pSrcTableNd->GetTable().MakeCopy( *this, rInsPos, rBoxes,
bCpyName );
}
@@ -4342,7 +4342,7 @@ bool SwDoc::InsCopyOfTable( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
xCpyDoc = new SwDoc;
SwPosition aPos( SwNodeIndex( xCpyDoc->GetNodes().GetEndOfContent() ));
- if( !pSrcTableNd->GetTable().MakeCopy( xCpyDoc.get(), aPos, rBoxes, true ))
+ if( !pSrcTableNd->GetTable().MakeCopy( *xCpyDoc, aPos, rBoxes, true ))
{
xCpyDoc.clear();
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index b0cb1a5586f4..c462bc7e6835 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -1761,7 +1761,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
{
SwNodeIndex nStt( aInsPos, -1 );
SwTableNode* pTableNd = static_cast<SwTableNode*>(pCurrentNode)->
- MakeCopy( &rDoc, aInsPos );
+ MakeCopy( rDoc, aInsPos );
const long nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
if (nDistance < nNodeCnt)
nNodeCnt -= nDistance;
@@ -1788,7 +1788,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
// copy of the whole section, so create a new SectionNode
SwNodeIndex nStt( aInsPos, -1 );
SwSectionNode* pSectNd = static_cast<SwSectionNode*>(pCurrentNode)->
- MakeCopy( &rDoc, aInsPos );
+ MakeCopy( rDoc, aInsPos );
const long nDistance = aInsPos.GetIndex() - nStt.GetIndex() - 2;
if (nDistance < nNodeCnt)
@@ -1836,7 +1836,7 @@ void SwNodes::CopyNodes( const SwNodeRange& rRange,
case SwNodeType::Ole:
{
static_cast<SwContentNode*>(pCurrentNode)->MakeCopy(
- &rDoc, aInsPos, bNewFrames);
+ rDoc, aInsPos, bNewFrames);
}
break;
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 7ba9f49d952a..5114516c82fc 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -692,10 +692,10 @@ void SwGrfNode::ScaleImageMap()
}
}
-SwContentNode* SwGrfNode::MakeCopy(SwDoc* pDoc, const SwNodeIndex& rIdx, bool) const
+SwContentNode* SwGrfNode::MakeCopy(SwDoc& rDoc, const SwNodeIndex& rIdx, bool) const
{
// copy formats into the other document
- SwGrfFormatColl* pColl = pDoc->CopyGrfColl( *GetGrfColl() );
+ SwGrfFormatColl* pColl = rDoc.CopyGrfColl( *GetGrfColl() );
Graphic aTmpGrf = GetGrf();
diff --git a/sw/source/core/inc/tblrwcl.hxx b/sw/source/core/inc/tblrwcl.hxx
index 4deba61bc65e..9b059eea61c8 100644
--- a/sw/source/core/inc/tblrwcl.hxx
+++ b/sw/source/core/inc/tblrwcl.hxx
@@ -43,7 +43,7 @@ void sw_LineSetHeadCondColl( const SwTableLine* pLine );
void CheckBoxWidth( const SwTableLine& rLine, SwTwips nSize );
#endif
-void InsTableBox( SwDoc* pDoc, SwTableNode* pTableNd,
+void InsTableBox( SwDoc& rDoc, SwTableNode* pTableNd,
SwTableLine* pLine, SwTableBoxFormat* pBoxFrameFormat,
SwTableBox* pBox, sal_uInt16 nInsPos, sal_uInt16 nCnt = 1 );
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 1152e26e8977..e02c8fc23f43 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -423,16 +423,16 @@ Size SwOLENode::GetTwipSize() const
return const_cast<SwOLENode*>(this)->maOLEObj.GetObject().GetSize( &aMapMode );
}
-SwContentNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx, bool) const
+SwContentNode* SwOLENode::MakeCopy( SwDoc& rDoc, const SwNodeIndex& rIdx, bool) const
{
// If there's already a SvPersist instance, we use it
- SfxObjectShell* pPersistShell = pDoc->GetPersist();
+ SfxObjectShell* pPersistShell = rDoc.GetPersist();
if( !pPersistShell )
{
// TODO/LATER: is EmbeddedObjectContainer not enough?
- // the created document will be closed by pDoc ( should use SfxObjectShellLock )
- pPersistShell = new SwDocShell( pDoc, SfxObjectCreateMode::INTERNAL );
- pDoc->SetTmpDocShell( pPersistShell );
+ // the created document will be closed by rDoc ( should use SfxObjectShellLock )
+ pPersistShell = new SwDocShell( &rDoc, SfxObjectCreateMode::INTERNAL );
+ rDoc.SetTmpDocShell( pPersistShell );
pPersistShell->DoInitNew();
}
@@ -448,8 +448,8 @@ SwContentNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx, bool)
pSrc->getDocumentBaseURL(),
pPersistShell->getDocumentBaseURL());
- SwOLENode* pOLENd = pDoc->GetNodes().MakeOLENode( rIdx, aNewName, GetAspect(),
- pDoc->GetDfltGrfFormatColl(),
+ SwOLENode* pOLENd = rDoc.GetNodes().MakeOLENode( rIdx, aNewName, GetAspect(),
+ rDoc.GetDfltGrfFormatColl(),
GetpSwAttrSet() );
pOLENd->SetChartTableName( GetChartTableName() );
@@ -459,7 +459,7 @@ SwContentNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx, bool)
pOLENd->SetAspect( GetAspect() ); // the replacement image must be already copied
pOLENd->SetOLESizeInvalid( true );
- pDoc->SetOLEPrtNotifyPending();
+ rDoc.SetOLEPrtNotifyPending();
return pOLENd;
}
diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx
index 73fd1d8acedc..76421004c72b 100644
--- a/sw/source/core/table/swnewtable.cxx
+++ b/sw/source/core/table/swnewtable.cxx
@@ -647,7 +647,7 @@ insertion behind (true) or before (false) the selected boxes
*/
-bool SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes,
+bool SwTable::NewInsertCol( SwDoc& rDoc, const SwSelBoxes& rBoxes,
sal_uInt16 nCnt, bool bBehind )
{
if( m_aLines.empty() || !nCnt )
@@ -700,7 +700,7 @@ bool SwTable::NewInsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes,
if( bBehind )
++nInsPos;
SwTableBoxFormat* pBoxFrameFormat = static_cast<SwTableBoxFormat*>(pBox->GetFrameFormat());
- ::InsTableBox( pDoc, pTableNd, pLine, pBoxFrameFormat, pBox, nInsPos, nCnt );
+ ::InsTableBox( rDoc, pTableNd, pLine, pBoxFrameFormat, pBox, nInsPos, nCnt );
long nRowSpan = pBox->getRowSpan();
long nDiff = i - nLastLine;
bool bNewSpan = false;
@@ -1164,7 +1164,7 @@ static void lcl_FillSelBoxes( SwSelBoxes &rBoxes, SwTableLine &rLine )
overlapped cells only. This is a preparation for an upcoming split.
*/
-void SwTable::InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nRowIdx, sal_uInt16 nCnt )
+void SwTable::InsertSpannedRow( SwDoc& rDoc, sal_uInt16 nRowIdx, sal_uInt16 nCnt )
{
CHECK_TABLE( *this )
OSL_ENSURE( nCnt && nRowIdx < GetTabLines().size(), "Wrong call of InsertSpannedRow" );
@@ -1181,7 +1181,7 @@ void SwTable::InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nRowIdx, sal_uInt16 nCnt
aFSz.SetHeight( nNewHeight );
pFrameFormat->SetFormatAttr( aFSz );
}
- InsertRow_( pDoc, aBoxes, nCnt, true );
+ InsertRow_( &rDoc, aBoxes, nCnt, true );
const size_t nBoxCount = rLine.GetTabBoxes().size();
for( sal_uInt16 n = 0; n < nCnt; ++n )
{
@@ -1402,7 +1402,7 @@ static sal_uInt16 lcl_LineIndex( const SwTable& rTable, const SwSelBoxes& rBoxes
/** SwTable::NewSplitRow(..) splits all selected boxes horizontally.
*/
-bool SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
+bool SwTable::NewSplitRow( SwDoc& rDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt,
bool bSameHeight )
{
CHECK_TABLE( *this )
@@ -1410,7 +1410,7 @@ bool SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn
FndBox_ aFndBox( nullptr, nullptr );
aFndBox.SetTableLines( rBoxes, *this );
- if( bSameHeight && pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() )
+ if( bSameHeight && rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() )
{
SwSplitLines aRowLines;
SwSplitLines aSplitLines;
@@ -1423,7 +1423,7 @@ bool SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn
{
while( pSplit != aSplitLines.end() && *pSplit < rCurr )
{
- InsertSpannedRow( pDoc, nFirst, 1 );
+ InsertSpannedRow( rDoc, nFirst, 1 );
SwTableLine* pRow = GetTabLines()[ nFirst ];
SwFrameFormat* pRowFormat = pRow->ClaimFrameFormat();
SwFormatFrameSize aFSz( pRowFormat->GetFrameSize() );
@@ -1458,7 +1458,7 @@ bool SwTable::NewSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn
SwLineOffsetArray::reverse_iterator pCurr( aLineOffs.rbegin() );
while( pCurr != aLineOffs.rend() )
{
- InsertSpannedRow( pDoc, pCurr->first, pCurr->second );
+ InsertSpannedRow( rDoc, pCurr->first, pCurr->second );
++pCurr;
}
}
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 8d6b2b504d60..043f1bb0bc74 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -152,7 +152,7 @@ static OUString& lcl_DelTabsAtSttEnd( OUString& rText )
return rText;
}
-void InsTableBox( SwDoc* pDoc, SwTableNode* pTableNd,
+void InsTableBox( SwDoc& rDoc, SwTableNode* pTableNd,
SwTableLine* pLine, SwTableBoxFormat* pBoxFrameFormat,
SwTableBox* pBox,
sal_uInt16 nInsPos, sal_uInt16 nCnt )
@@ -161,7 +161,7 @@ void InsTableBox( SwDoc* pDoc, SwTableNode* pTableNd,
SwNodeIndex aIdx( *pBox->GetSttNd(), +1 );
SwContentNode* pCNd = aIdx.GetNode().GetContentNode();
if( !pCNd )
- pCNd = pDoc->GetNodes().GoNext( &aIdx );
+ pCNd = rDoc.GetNodes().GoNext( &aIdx );
OSL_ENSURE( pCNd, "Box with no content node" );
if( pCNd->IsTextNode() )
@@ -173,19 +173,19 @@ void InsTableBox( SwDoc* pDoc, SwTableNode* pTableNd,
aAttrSet.Put( SvxColorItem( *pBox->GetSaveUserColor(), RES_CHRATR_COLOR ));
else
aAttrSet.ClearItem( RES_CHRATR_COLOR );
- pDoc->GetNodes().InsBoxen( pTableNd, pLine, pBoxFrameFormat,
+ rDoc.GetNodes().InsBoxen( pTableNd, pLine, pBoxFrameFormat,
static_cast<SwTextNode*>(pCNd)->GetTextColl(),
&aAttrSet, nInsPos, nCnt );
}
else
- pDoc->GetNodes().InsBoxen( pTableNd, pLine, pBoxFrameFormat,
+ rDoc.GetNodes().InsBoxen( pTableNd, pLine, pBoxFrameFormat,
static_cast<SwTextNode*>(pCNd)->GetTextColl(),
pCNd->GetpSwAttrSet(),
nInsPos, nCnt );
}
else
- pDoc->GetNodes().InsBoxen( pTableNd, pLine, pBoxFrameFormat,
- pDoc->GetDfltTextFormatColl(), nullptr,
+ rDoc.GetNodes().InsBoxen( pTableNd, pLine, pBoxFrameFormat,
+ rDoc.GetDfltTextFormatColl(), nullptr,
nInsPos, nCnt );
long nRowSpan = pBox->getRowSpan();
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 373d552f374a..88e6d04459cd 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -755,7 +755,7 @@ ErrCode SwWriter::Write( WriterRef const & rxWriter, const OUString* pRealFileNa
SwContentNode *pNd = aIdx.GetNode().GetContentNode();
OSL_ENSURE( pNd, "Node not found" );
SwPosition aPos( aIdx, SwIndex( pNd ) );
- pTableNd->GetTable().MakeCopy( xDoc.get(), aPos, aBoxes );
+ pTableNd->GetTable().MakeCopy( *xDoc, aPos, aBoxes );
}
if( !m_bWriteAll && ( m_pShell || m_pOutPam ))
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index 76e4496ef166..6e77e6de71f7 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -283,18 +283,16 @@ void SwXAutoTextGroup::renameByName(const OUString& aElementName,
}
-static bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTextRange* pxRange)
+static bool lcl_CopySelToDoc(SwDoc& rInsDoc, OTextCursorHelper* pxCursor, SwXTextRange* pxRange)
{
- OSL_ENSURE( pInsDoc, "no InsDoc");
-
- SwNodes& rNds = pInsDoc->GetNodes();
+ SwNodes& rNds = rInsDoc.GetNodes();
SwNodeIndex aIdx( rNds.GetEndOfContent(), -1 );
SwContentNode * pNd = aIdx.GetNode().GetContentNode();
SwPosition aPos(aIdx, SwIndex(pNd, pNd ? pNd->Len() : 0));
bool bRet = false;
- pInsDoc->getIDocumentFieldsAccess().LockExpFields();
+ rInsDoc.getIDocumentFieldsAccess().LockExpFields();
{
SwDoc *const pDoc(pxCursor ? pxCursor->GetDoc() : &pxRange->GetDoc());
SwPaM aPam(pDoc->GetNodes());
@@ -315,9 +313,9 @@ static bool lcl_CopySelToDoc( SwDoc* pInsDoc, OTextCursorHelper* pxCursor, SwXTe
|| bRet;
}
- pInsDoc->getIDocumentFieldsAccess().UnlockExpFields();
- if( !pInsDoc->getIDocumentFieldsAccess().IsExpFieldsLocked() )
- pInsDoc->getIDocumentFieldsAccess().UpdateExpFields(nullptr, true);
+ rInsDoc.getIDocumentFieldsAccess().UnlockExpFields();
+ if( !rInsDoc.getIDocumentFieldsAccess().IsExpFieldsLocked() )
+ rInsDoc.getIDocumentFieldsAccess().UpdateExpFields(nullptr, true);
return bRet;
}
@@ -380,7 +378,7 @@ uno::Reference< text::XAutoTextEntry > SwXAutoTextGroup::insertNewByName(const
if( pGlosGroup->BeginPutDoc( sShortName, sLongName ) )
{
pGDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( RedlineFlags::DeleteRedlines );
- lcl_CopySelToDoc( pGDoc, pxCursor, pxRange );
+ lcl_CopySelToDoc(*pGDoc, pxCursor, pxRange);
pGDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern(RedlineFlags::NONE);
nRet = pGlosGroup->PutDoc();
}