summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-15 10:11:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-16 10:57:44 +0200
commit5e522d5c9b49ba2ed04cca8111044994427c20aa (patch)
tree0d1aecf08e27be7214cc0d20dbbb1e7c7fecfb14 /sc/source/core
parent5c434aee89d2316db739ab86578c8dfed60151de (diff)
TransferTab always dereferences its ScDocument* argument
Change-Id: I68b1fb4cda82a8a334e60b43216cfa74534e4a28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102836 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/documen2.cxx44
-rw-r--r--sc/source/core/data/documen3.cxx2
2 files changed, 23 insertions, 23 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 34af43060d15..7b50c9d1ec38 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -903,7 +903,7 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM
return bValid;
}
-sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
+sal_uLong ScDocument::TransferTab( ScDocument& rSrcDoc, SCTAB nSrcPos,
SCTAB nDestPos, bool bInsertNew,
bool bResultsOnly )
{
@@ -911,29 +911,29 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
// 3 => NameBox
// 4 => both
- if (pSrcDoc->mpShell->GetMedium())
+ if (rSrcDoc.mpShell->GetMedium())
{
- pSrcDoc->maFileURL = pSrcDoc->mpShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
+ rSrcDoc.maFileURL = rSrcDoc.mpShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
// for unsaved files use the title name and adjust during save of file
- if (pSrcDoc->maFileURL.isEmpty())
- pSrcDoc->maFileURL = pSrcDoc->mpShell->GetName();
+ if (rSrcDoc.maFileURL.isEmpty())
+ rSrcDoc.maFileURL = rSrcDoc.mpShell->GetName();
}
else
{
- pSrcDoc->maFileURL = pSrcDoc->mpShell->GetName();
+ rSrcDoc.maFileURL = rSrcDoc.mpShell->GetName();
}
bool bValid = true;
if (bInsertNew) // re-insert
{
OUString aName;
- pSrcDoc->GetName(nSrcPos, aName);
+ rSrcDoc.GetName(nSrcPos, aName);
CreateValidTabName(aName);
bValid = InsertTab(nDestPos, aName);
// Copy the RTL settings
- maTabs[nDestPos]->SetLayoutRTL(pSrcDoc->maTabs[nSrcPos]->IsLayoutRTL());
- maTabs[nDestPos]->SetLoadingRTL(pSrcDoc->maTabs[nSrcPos]->IsLoadingRTL());
+ maTabs[nDestPos]->SetLayoutRTL(rSrcDoc.maTabs[nSrcPos]->IsLayoutRTL());
+ maTabs[nDestPos]->SetLoadingRTL(rSrcDoc.maTabs[nSrcPos]->IsLoadingRTL());
}
else // replace existing tables
{
@@ -953,12 +953,12 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
SetNoListening( true );
if ( bResultsOnly )
{
- bOldAutoCalcSrc = pSrcDoc->GetAutoCalc();
- pSrcDoc->SetAutoCalc( true ); // in case something needs calculation
+ bOldAutoCalcSrc = rSrcDoc.GetAutoCalc();
+ rSrcDoc.SetAutoCalc( true ); // in case something needs calculation
}
{
- NumFmtMergeHandler aNumFmtMergeHdl(this, pSrcDoc);
+ NumFmtMergeHandler aNumFmtMergeHdl(this, &rSrcDoc);
sc::CopyToDocContext aCxt(*this);
nDestPos = std::min(nDestPos, static_cast<SCTAB>(GetTableCount() - 1));
@@ -967,19 +967,19 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
if (!bResultsOnly)
{
const bool bGlobalNamesToLocal = false;
- const ScRangeName* pNames = pSrcDoc->GetRangeName( nSrcPos);
+ const ScRangeName* pNames = rSrcDoc.GetRangeName( nSrcPos);
if (pNames)
- pNames->CopyUsedNames( nSrcPos, nSrcPos, nDestPos, *pSrcDoc, *this, bGlobalNamesToLocal);
- pSrcDoc->GetRangeName()->CopyUsedNames( -1, nSrcPos, nDestPos, *pSrcDoc, *this, bGlobalNamesToLocal);
+ pNames->CopyUsedNames( nSrcPos, nSrcPos, nDestPos, rSrcDoc, *this, bGlobalNamesToLocal);
+ rSrcDoc.GetRangeName()->CopyUsedNames( -1, nSrcPos, nDestPos, rSrcDoc, *this, bGlobalNamesToLocal);
}
- pSrcDoc->maTabs[nSrcPos]->CopyToTable(aCxt, 0, 0, MaxCol(), MaxRow(),
+ rSrcDoc.maTabs[nSrcPos]->CopyToTable(aCxt, 0, 0, MaxCol(), MaxRow(),
( bResultsOnly ? InsertDeleteFlags::ALL & ~InsertDeleteFlags::FORMULA : InsertDeleteFlags::ALL),
false, maTabs[nDestPos].get(), /*pMarkData*/nullptr, /*bAsLink*/false, /*bColRowFlags*/true,
/*bGlobalNamesToLocal*/false, /*bCopyCaptions*/true );
}
}
maTabs[nDestPos]->SetTabNo(nDestPos);
- maTabs[nDestPos]->SetTabBgColor(pSrcDoc->maTabs[nSrcPos]->GetTabBgColor());
+ maTabs[nDestPos]->SetTabBgColor(rSrcDoc.maTabs[nSrcPos]->GetTabBgColor());
if ( !bResultsOnly )
{
@@ -1004,15 +1004,15 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
SetDirty( ScRange( 0, 0, nDestPos, MaxCol(), MaxRow(), nDestPos), false);
if ( bResultsOnly )
- pSrcDoc->SetAutoCalc( bOldAutoCalcSrc );
+ rSrcDoc.SetAutoCalc( bOldAutoCalcSrc );
SetAutoCalc( bOldAutoCalc );
// copy Drawing
if (bInsertNew)
- TransferDrawPage( pSrcDoc, nSrcPos, nDestPos );
+ TransferDrawPage( &rSrcDoc, nSrcPos, nDestPos );
- maTabs[nDestPos]->SetPendingRowHeights( pSrcDoc->maTabs[nSrcPos]->IsPendingRowHeights() );
+ maTabs[nDestPos]->SetPendingRowHeights( rSrcDoc.maTabs[nSrcPos]->IsPendingRowHeights() );
}
if (!bValid)
nRetVal = 0;
@@ -1020,7 +1020,7 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
if ( bVbaEnabled )
{
- SfxObjectShell* pSrcShell = pSrcDoc->GetDocumentShell();
+ SfxObjectShell* pSrcShell = rSrcDoc.GetDocumentShell();
if ( pSrcShell )
{
OUString aLibName("Standard");
@@ -1041,7 +1041,7 @@ sal_uLong ScDocument::TransferTab( ScDocument* pSrcDoc, SCTAB nSrcPos,
if( xLib.is() )
{
OUString sSrcCodeName;
- pSrcDoc->GetCodeName( nSrcPos, sSrcCodeName );
+ rSrcDoc.GetCodeName( nSrcPos, sSrcCodeName );
OUString sRTLSource;
xLib->getByName( sSrcCodeName ) >>= sRTLSource;
sSource = sRTLSource;
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index a3c412aff02a..f0d1e28c1947 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -577,7 +577,7 @@ bool ScDocument::LinkExternalTab( SCTAB& rTab, const OUString& aDocTab,
}
rTab = GetTableCount() - 1;
// Don't insert anew, just the results
- TransferTab( pSrcDoc, nSrcTab, rTab, false, true );
+ TransferTab( *pSrcDoc, nSrcTab, rTab, false, true );
}
else
return false;