summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-23 12:09:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-24 11:02:05 +0200
commit2346b09d19d98992e2dae826d7576cfe01538461 (patch)
tree04857a9ef28258c06c49cf42249d0d51a43ff245 /sc/source
parent87f6ca70a7c1ce94d6a5a32789ab430f6e604db6 (diff)
ScCellFormat::GetString never called with a null ScDocument*
and similar, allowing a few redundant null checks to be dropped Change-Id: Ice0d6d57df112a09d3e1af3d34126b3519529daf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103278 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/bigrange.cxx8
-rw-r--r--sc/source/core/data/column2.cxx8
-rw-r--r--sc/source/core/data/column3.cxx6
-rw-r--r--sc/source/core/data/column4.cxx2
-rw-r--r--sc/source/core/data/documen2.cxx2
-rw-r--r--sc/source/core/data/documen3.cxx2
-rw-r--r--sc/source/core/data/documen6.cxx2
-rw-r--r--sc/source/core/data/documen8.cxx4
-rw-r--r--sc/source/core/data/document.cxx12
-rw-r--r--sc/source/core/tool/cellform.cxx8
-rw-r--r--sc/source/core/tool/charthelper.cxx10
-rw-r--r--sc/source/core/tool/chgtrack.cxx162
-rw-r--r--sc/source/core/tool/interpr4.cxx16
-rw-r--r--sc/source/filter/excel/xicontent.cxx2
-rw-r--r--sc/source/filter/html/htmlexp.cxx2
-rw-r--r--sc/source/filter/oox/formulabuffer.cxx2
-rw-r--r--sc/source/filter/xml/xmlcelli.cxx4
-rw-r--r--sc/source/filter/xml/xmlexprt.cxx2
-rw-r--r--sc/source/ui/app/scmod.cxx2
-rw-r--r--sc/source/ui/app/transobj.cxx2
-rw-r--r--sc/source/ui/docshell/arealink.cxx8
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx32
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx4
-rw-r--r--sc/source/ui/docshell/docfunc.cxx58
-rw-r--r--sc/source/ui/docshell/docfuncutil.cxx2
-rw-r--r--sc/source/ui/docshell/docsh.cxx8
-rw-r--r--sc/source/ui/docshell/docsh3.cxx10
-rw-r--r--sc/source/ui/docshell/docsh5.cxx6
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx82
-rw-r--r--sc/source/ui/docshell/impex.cxx12
-rw-r--r--sc/source/ui/docshell/macromgr.cxx10
-rw-r--r--sc/source/ui/docshell/olinefun.cxx20
-rw-r--r--sc/source/ui/docshell/tablink.cxx2
-rw-r--r--sc/source/ui/inc/dbfunc.hxx2
-rw-r--r--sc/source/ui/inc/printfun.hxx8
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx24
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.cxx6
-rw-r--r--sc/source/ui/miscdlgs/redcom.cxx4
-rw-r--r--sc/source/ui/undo/undoblk3.cxx2
-rw-r--r--sc/source/ui/undo/undotab.cxx2
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx28
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx2
-rw-r--r--sc/source/ui/view/dbfunc2.cxx2
-rw-r--r--sc/source/ui/view/dbfunc3.cxx8
-rw-r--r--sc/source/ui/view/dbfunc4.cxx8
-rw-r--r--sc/source/ui/view/gridwin5.cxx2
-rw-r--r--sc/source/ui/view/output2.cxx6
-rw-r--r--sc/source/ui/view/printfun.cxx208
-rw-r--r--sc/source/ui/view/spelldialog.cxx4
-rw-r--r--sc/source/ui/view/spelleng.cxx2
-rw-r--r--sc/source/ui/view/viewfun2.cxx8
-rw-r--r--sc/source/ui/view/viewfun3.cxx22
-rw-r--r--sc/source/ui/view/viewfun4.cxx12
-rw-r--r--sc/source/ui/view/viewfunc.cxx14
-rw-r--r--sc/source/ui/view/viewutil.cxx2
55 files changed, 446 insertions, 442 deletions
diff --git a/sc/source/core/data/bigrange.cxx b/sc/source/core/data/bigrange.cxx
index 14cc64556309..58a11eb03735 100644
--- a/sc/source/core/data/bigrange.cxx
+++ b/sc/source/core/data/bigrange.cxx
@@ -10,14 +10,14 @@
#include <bigrange.hxx>
#include <document.hxx>
-bool ScBigAddress::IsValid( const ScDocument* pDoc ) const
+bool ScBigAddress::IsValid( const ScDocument& rDoc ) const
{ // min/max interval bounds define whole col/row/tab
return
- ((0 <= nCol && nCol <= pDoc->MaxCol())
+ ((0 <= nCol && nCol <= rDoc.MaxCol())
|| nCol == nInt32Min || nCol == nInt32Max) &&
- ((0 <= nRow && nRow <= pDoc->MaxRow())
+ ((0 <= nRow && nRow <= rDoc.MaxRow())
|| nRow == nInt32Min || nRow == nInt32Max) &&
- ((0 <= nTab && nTab < pDoc->GetTableCount())
+ ((0 <= nTab && nTab < rDoc.GetTableCount())
|| nTab == nInt32Min || nTab == nInt32Max)
;
}
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index ce221435a30a..013d6d444093 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -285,7 +285,7 @@ long ScColumn::GetNeededSize(
const Color* pColor;
OUString aValStr;
ScCellFormat::GetString(
- aCell, nFormat, aValStr, &pColor, *pFormatter, &rDocument, true, rOptions.bFormula);
+ aCell, nFormat, aValStr, &pColor, *pFormatter, rDocument, true, rOptions.bFormula);
if (!aValStr.isEmpty())
{
@@ -462,7 +462,7 @@ long ScColumn::GetNeededSize(
const Color* pColor;
OUString aString;
ScCellFormat::GetString(
- aCell, nFormat, aString, &pColor, *pFormatter, &rDocument, true,
+ aCell, nFormat, aString, &pColor, *pFormatter, rDocument, true,
rOptions.bFormula);
if (!aString.isEmpty())
@@ -616,7 +616,7 @@ class MaxStrLenFinder
const Color* pColor;
OUString aValStr;
ScCellFormat::GetString(
- rCell, mnFormat, aValStr, &pColor, *mrDoc.GetFormatTable(), &mrDoc);
+ rCell, mnFormat, aValStr, &pColor, *mrDoc.GetFormatTable(), mrDoc);
if (aValStr.getLength() > mnMaxLen)
{
@@ -704,7 +704,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
{
ScRefCellValue aCell = GetCellValue(pParam->mnMaxTextRow);
ScCellFormat::GetString(
- aCell, nFormat, aLongStr, &pColor, *pFormatter, &rDocument);
+ aCell, nFormat, aLongStr, &pColor, *pFormatter, rDocument);
}
else
{
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 5501ae479d97..4142683c199c 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -791,7 +791,7 @@ bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, sc::CellSt
OUString aStr;
const Color* pColor;
sal_uInt32 nFormat = pPattern->GetNumberFormat(pFormatter, pCondSet);
- ScCellFormat::GetString(aCell, nFormat, aStr, &pColor, *pFormatter, &rDocument);
+ ScCellFormat::GetString(aCell, nFormat, aStr, &pColor, *pFormatter, rDocument);
// Store the real script type to the array.
rAttr.mnScriptType = rDocument.GetStringScriptType(aStr);
@@ -2919,7 +2919,7 @@ void ScColumn::GetString( const ScRefCellValue& aCell, SCROW nRow, OUString& rSt
sal_uInt32 nFormat = GetNumberFormat( pContext ? *pContext : GetDoc().GetNonThreadedContext(), nRow);
const Color* pColor = nullptr;
ScCellFormat::GetString(aCell, nFormat, rString, &pColor,
- pContext ? *(pContext->GetFormatTable()) : *(GetDoc().GetFormatTable()), &GetDoc());
+ pContext ? *(pContext->GetFormatTable()) : *(GetDoc().GetFormatTable()), GetDoc());
}
double* ScColumn::GetValueCell( SCROW nRow )
@@ -3146,7 +3146,7 @@ class MaxStringLenHandler
const Color* pColor;
OUString aString;
sal_uInt32 nFormat = mrColumn.GetAttr(nRow, ATTR_VALUE_FORMAT).GetValue();
- ScCellFormat::GetString(rCell, nFormat, aString, &pColor, *mpFormatter, &mrColumn.GetDoc());
+ ScCellFormat::GetString(rCell, nFormat, aString, &pColor, *mpFormatter, mrColumn.GetDoc());
sal_Int32 nLen = 0;
if (mbOctetEncoding)
{
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index bd919be1d9e9..a33c3d4b9175 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -1018,7 +1018,7 @@ private:
OUString aStr;
const Color* pColor;
sal_uInt32 nFormat = pPat->GetNumberFormat(mpFormatter, pCondSet);
- ScCellFormat::GetString(rCell, nFormat, aStr, &pColor, *mpFormatter, &mrCol.GetDoc());
+ ScCellFormat::GetString(rCell, nFormat, aStr, &pColor, *mpFormatter, mrCol.GetDoc());
rAttr.mnScriptType = mrCol.GetDoc().GetStringScriptType(aStr);
mbUpdated = true;
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index a21837999732..7274dd77b2d0 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1343,7 +1343,7 @@ void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos, OUString &aT
aTrackText += aComStr;
aTrackText += "\n( ";
}
- pFound->GetDescription( aTrackText, this );
+ pFound->GetDescription( aTrackText, *this );
if (!aComStr.isEmpty())
{
aTrackText += ")";
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 69c93b30e221..727eff32345c 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -605,7 +605,7 @@ ScExternalRefManager* ScDocument::GetExternalRefManager() const
{
ScDocument* pThis = const_cast<ScDocument*>(this);
if (!pExternalRefMgr)
- pThis->pExternalRefMgr.reset( new ScExternalRefManager( pThis));
+ pThis->pExternalRefMgr.reset( new ScExternalRefManager(*pThis));
return pExternalRefMgr.get();
}
diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx
index e1b15bff8ad5..a4b58131e29b 100644
--- a/sc/source/core/data/documen6.cxx
+++ b/sc/source/core/data/documen6.cxx
@@ -118,7 +118,7 @@ SvtScriptType ScDocument::GetCellScriptType( const ScAddress& rPos, sal_uInt32 n
const Color* pColor;
OUString aStr;
if( pCell )
- ScCellFormat::GetString(*pCell, nNumberFormat, aStr, &pColor, *mxPoolHelper->GetFormTable(), this);
+ ScCellFormat::GetString(*pCell, nNumberFormat, aStr, &pColor, *mxPoolHelper->GetFormTable(), *this);
else
aStr = ScCellFormat::GetString(*this, rPos, nNumberFormat, &pColor, *mxPoolHelper->GetFormTable());
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 7efb5a8f978d..0cef7c94acae 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -228,7 +228,7 @@ void ScDocument::ModifyStyleSheet( SfxStyleSheetBase& rStyleSheet,
{
const SfxPoolItem *pItem = nullptr;
if( rChanges.GetItemState(ATTR_WRITINGDIR, true, &pItem ) == SfxItemState::SET )
- ScChartHelper::DoUpdateAllCharts( this );
+ ScChartHelper::DoUpdateAllCharts( *this );
}
}
break;
@@ -377,7 +377,7 @@ EEHorizontalTextDirection ScDocument::GetEditTextDirection(SCTAB nTab) const
ScMacroManager* ScDocument::GetMacroManager()
{
if (!mpMacroMgr)
- mpMacroMgr.reset(new ScMacroManager(this));
+ mpMacroMgr.reset(new ScMacroManager(*this));
return mpMacroMgr.get();
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 3baa8c292123..432673951492 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2007,7 +2007,7 @@ void ScDocument::InitUndoSelected(const ScDocument& rSrcDoc, const ScMarkData& r
}
}
-void ScDocument::InitUndo( const ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
+void ScDocument::InitUndo( const ScDocument& rSrcDoc, SCTAB nTab1, SCTAB nTab2,
bool bColInfo, bool bRowInfo )
{
if (!bIsUndo)
@@ -2019,10 +2019,10 @@ void ScDocument::InitUndo( const ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
Clear();
// Undo document shares its pooled resources with the source document.
- SharePooledResources(pSrcDoc);
+ SharePooledResources(&rSrcDoc);
- if (pSrcDoc->mpShell->GetMedium())
- maFileURL = pSrcDoc->mpShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
+ if (rSrcDoc.mpShell->GetMedium())
+ maFileURL = rSrcDoc.mpShell->GetMedium()->GetURLObject().GetMainURL(INetURLObject::DecodeMechanism::ToIUri);
if ( nTab2 >= static_cast<SCTAB>(maTabs.size()))
maTabs.resize(nTab2 + 1);
@@ -3262,7 +3262,7 @@ void ScDocument::FillTab( const ScRange& rSrcArea, const ScMarkData& rMark,
if (!pMixDoc)
{
pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pMixDoc->InitUndo( this, i, i );
+ pMixDoc->InitUndo( *this, i, i );
}
else
pMixDoc->AddUndoTab( i, i );
@@ -3330,7 +3330,7 @@ void ScDocument::FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark,
if (!pMixDoc)
{
pMixDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pMixDoc->InitUndo( this, i, i );
+ pMixDoc->InitUndo( *this, i, i );
}
else
pMixDoc->AddUndoTab( i, i );
diff --git a/sc/source/core/tool/cellform.cxx b/sc/source/core/tool/cellform.cxx
index a18eae0c07d0..315bc9ca2a2a 100644
--- a/sc/source/core/tool/cellform.cxx
+++ b/sc/source/core/tool/cellform.cxx
@@ -31,7 +31,7 @@
#include <editutil.hxx>
void ScCellFormat::GetString( const ScRefCellValue& rCell, sal_uInt32 nFormat, OUString& rString,
- const Color** ppColor, SvNumberFormatter& rFormatter, const ScDocument* pDoc,
+ const Color** ppColor, SvNumberFormatter& rFormatter, const ScDocument& rDoc,
bool bNullVals, bool bFormula, bool bUseStarFormat )
{
*ppColor = nullptr;
@@ -42,7 +42,7 @@ void ScCellFormat::GetString( const ScRefCellValue& rCell, sal_uInt32 nFormat, O
rFormatter.GetOutputString(rCell.mpString->getString(), nFormat, rString, ppColor, bUseStarFormat);
break;
case CELLTYPE_EDIT:
- rFormatter.GetOutputString(rCell.getString(pDoc), nFormat, rString, ppColor );
+ rFormatter.GetOutputString(rCell.getString(&rDoc), nFormat, rString, ppColor );
break;
case CELLTYPE_VALUE:
{
@@ -113,7 +113,7 @@ OUString ScCellFormat::GetString(
*ppColor = nullptr;
ScRefCellValue aCell(rDoc, rPos);
- GetString(aCell, nFormat, aString, ppColor, rFormatter, &rDoc, bNullVals, bFormula);
+ GetString(aCell, nFormat, aString, ppColor, rFormatter, rDoc, bNullVals, bFormula);
return aString;
}
@@ -176,7 +176,7 @@ OUString ScCellFormat::GetOutputString( ScDocument& rDoc, const ScAddress& rPos,
// like in GetString for document (column)
const Color* pColor;
sal_uInt32 nNumFmt = rDoc.GetNumberFormat(rPos);
- GetString(rCell, nNumFmt, aVal, &pColor, *rDoc.GetFormatTable(), &rDoc);
+ GetString(rCell, nNumFmt, aVal, &pColor, *rDoc.GetFormatTable(), rDoc);
}
return aVal;
}
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index 47af430a8ac6..54ace0282c44 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -40,9 +40,9 @@ using ::com::sun::star::uno::Reference;
namespace
{
-sal_uInt16 lcl_DoUpdateCharts( ScDocument* pDoc )
+sal_uInt16 lcl_DoUpdateCharts( ScDocument& rDoc )
{
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (!pModel)
return 0;
@@ -61,7 +61,7 @@ sal_uInt16 lcl_DoUpdateCharts( ScDocument* pDoc )
if ( pObject->GetObjIdentifier() == OBJ_OLE2 && ScDocument::IsChart( pObject ) )
{
OUString aName = static_cast<SdrOle2Obj*>(pObject)->GetPersistName();
- pDoc->UpdateChart( aName );
+ rDoc.UpdateChart( aName );
++nFound;
}
pObject = aIter.Next();
@@ -104,9 +104,9 @@ bool lcl_AdjustRanges( ScRangeList& rRanges, SCTAB nSourceTab, SCTAB nDestTab, S
// ScChartHelper
//static
-sal_uInt16 ScChartHelper::DoUpdateAllCharts( ScDocument* pDoc )
+sal_uInt16 ScChartHelper::DoUpdateAllCharts( ScDocument& rDoc )
{
- return lcl_DoUpdateCharts( pDoc );
+ return lcl_DoUpdateCharts( rDoc );
}
void ScChartHelper::AdjustRangesOfChartsOnDestinationPage( const ScDocument& rSrcDoc, ScDocument& rDestDoc, const SCTAB nSrcTab, const SCTAB nDestTab )
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 3818e5b74bee..06ad5357a0d9 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -425,7 +425,7 @@ void ScChangeAction::UpdateReference( const ScChangeTrack* /* pTrack */,
}
void ScChangeAction::GetDescription(
- OUString& rStr, ScDocument* /* pDoc */, bool /* bSplitRange */, bool bWarning ) const
+ OUString& rStr, ScDocument& /* rDoc */, bool /* bSplitRange */, bool bWarning ) const
{
if (!IsRejecting() || !bWarning)
return;
@@ -502,10 +502,10 @@ void ScChangeAction::GetDescription(
}
OUString ScChangeAction::GetRefString(
- const ScBigRange& rRange, const ScDocument* pDoc, bool bFlag3D ) const
+ const ScBigRange& rRange, const ScDocument& rDoc, bool bFlag3D ) const
{
OUStringBuffer aBuf;
- ScRefFlags nFlags = ( rRange.IsValid( pDoc ) ? ScRefFlags::VALID : ScRefFlags::ZERO );
+ ScRefFlags nFlags = ( rRange.IsValid( rDoc ) ? ScRefFlags::VALID : ScRefFlags::ZERO );
if ( nFlags == ScRefFlags::ZERO )
aBuf.append(ScCompiler::GetNativeSymbol(ocErrRef));
else
@@ -518,7 +518,7 @@ OUString ScChangeAction::GetRefString(
if ( bFlag3D )
{
OUString aTmp;
- pDoc->GetName( aTmpRange.aStart.Tab(), aTmp );
+ rDoc.GetName( aTmpRange.aStart.Tab(), aTmp );
aBuf.append(aTmp);
aBuf.append('.');
}
@@ -531,7 +531,7 @@ OUString ScChangeAction::GetRefString(
if ( bFlag3D )
{
OUString aTmp;
- pDoc->GetName( aTmpRange.aStart.Tab(), aTmp );
+ rDoc.GetName( aTmpRange.aStart.Tab(), aTmp );
aBuf.append(aTmp);
aBuf.append('.');
}
@@ -544,7 +544,7 @@ OUString ScChangeAction::GetRefString(
if ( bFlag3D || GetType() == SC_CAT_INSERT_TABS )
nFlags |= ScRefFlags::TAB_3D;
- aBuf.append(aTmpRange.Format(*pDoc, nFlags, pDoc->GetAddressConvention()));
+ aBuf.append(aTmpRange.Format(rDoc, nFlags, rDoc.GetAddressConvention()));
}
}
if ( (bFlag3D && IsDeleteType()) || IsDeletedIn() )
@@ -567,9 +567,9 @@ void ScChangeAction::SetComment( const OUString& rStr )
}
void ScChangeAction::GetRefString(
- OUString& rStr, ScDocument* pDoc, bool bFlag3D ) const
+ OUString& rStr, ScDocument& rDoc, bool bFlag3D ) const
{
- rStr = GetRefString( GetBigRange(), pDoc, bFlag3D );
+ rStr = GetRefString( GetBigRange(), rDoc, bFlag3D );
}
void ScChangeAction::Accept()
@@ -613,7 +613,7 @@ void ScChangeAction::RejectRestoreContents( ScChangeTrack* pTrack,
for (ScChangeActionContent* pContent : aContentsList)
{
if ( !pContent->IsDeletedIn() &&
- pContent->GetBigRange().aStart.IsValid( &rDoc ) )
+ pContent->GetBigRange().aStart.IsValid( rDoc ) )
pContent->PutNewValueToDoc( &rDoc, nDx, nDy );
}
DeleteCellEntries(); // Remove generated ones
@@ -692,9 +692,9 @@ ScChangeActionIns::~ScChangeActionIns()
}
void ScChangeActionIns::GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange, bool bWarning ) const
{
- ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
+ ScChangeAction::GetDescription( rStr, rDoc, bSplitRange, bWarning );
const char* pWhatId;
switch ( GetType() )
@@ -717,7 +717,7 @@ void ScChangeActionIns::GetDescription(
// Construct a range string to replace '#1' first.
OUStringBuffer aBuf(ScResId(pWhatId));
aBuf.append(' ');
- aBuf.append(GetRefString(GetBigRange(), pDoc));
+ aBuf.append(GetRefString(GetBigRange(), rDoc));
OUString aRangeStr = aBuf.makeStringAndClear();
aRsc = aRsc.replaceAt(nPos, 2, aRangeStr); // replace '#1' with the range string.
@@ -731,26 +731,26 @@ bool ScChangeActionIns::IsEndOfList() const
return mbEndOfList;
}
-bool ScChangeActionIns::Reject( ScDocument* pDoc )
+bool ScChangeActionIns::Reject( ScDocument& rDoc )
{
- if ( !aBigRange.IsValid( pDoc ) )
+ if ( !aBigRange.IsValid( rDoc ) )
return false;
ScRange aRange( aBigRange.MakeRange() );
- if ( !pDoc->IsBlockEditable( aRange.aStart.Tab(), aRange.aStart.Col(),
+ if ( !rDoc.IsBlockEditable( aRange.aStart.Tab(), aRange.aStart.Col(),
aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row() ) )
return false;
switch ( GetType() )
{
case SC_CAT_INSERT_COLS :
- pDoc->DeleteCol( aRange );
+ rDoc.DeleteCol( aRange );
break;
case SC_CAT_INSERT_ROWS :
- pDoc->DeleteRow( aRange );
+ rDoc.DeleteRow( aRange );
break;
case SC_CAT_INSERT_TABS :
- pDoc->DeleteTab( aRange.aStart.Tab() );
+ rDoc.DeleteTab( aRange.aStart.Tab() );
break;
default:
{
@@ -928,9 +928,9 @@ ScBigRange ScChangeActionDel::GetOverAllRange() const
}
void ScChangeActionDel::GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange, bool bWarning ) const
{
- ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
+ ScChangeAction::GetDescription( rStr, rDoc, bSplitRange, bWarning );
const char* pWhatId;
switch ( GetType() )
@@ -966,7 +966,7 @@ void ScChangeActionDel::GetDescription(
OUStringBuffer aBuf;
aBuf.append(ScResId(pWhatId));
aBuf.append(' ');
- aBuf.append(GetRefString(aTmpRange, pDoc));
+ aBuf.append(GetRefString(aTmpRange, rDoc));
OUString aRangeStr = aBuf.makeStringAndClear();
aRsc = aRsc.replaceAt(nPos, 2, aRangeStr); // replace '#1' with the string.
@@ -974,20 +974,20 @@ void ScChangeActionDel::GetDescription(
rStr = aBuf.makeStringAndClear(); // append to the original.
}
-bool ScChangeActionDel::Reject( ScDocument* pDoc )
+bool ScChangeActionDel::Reject( ScDocument& rDoc )
{
- if ( !aBigRange.IsValid( pDoc ) && GetType() != SC_CAT_DELETE_TABS )
+ if ( !aBigRange.IsValid( rDoc ) && GetType() != SC_CAT_DELETE_TABS )
return false;
if ( IsTopDelete() )
{ // Restore whole section in one go
bool bOk = true;
ScBigRange aTmpRange( GetOverAllRange() );
- if ( !aTmpRange.IsValid( pDoc ) )
+ if ( !aTmpRange.IsValid( rDoc ) )
{
if ( GetType() == SC_CAT_DELETE_TABS )
{ // Do we attach a Tab?
- if ( aTmpRange.aStart.Tab() > pDoc->GetMaxTableNumber() )
+ if ( aTmpRange.aStart.Tab() > rDoc.GetMaxTableNumber() )
bOk = false;
}
else
@@ -1004,20 +1004,20 @@ bool ScChangeActionDel::Reject( ScDocument* pDoc )
switch ( GetType() )
{
case SC_CAT_DELETE_COLS :
- if ( aRange.aStart.Col() != 0 || aRange.aEnd.Col() != pDoc->MaxCol() )
+ if ( aRange.aStart.Col() != 0 || aRange.aEnd.Col() != rDoc.MaxCol() )
{ // Only if not TabDelete
- bOk = pDoc->CanInsertCol( aRange ) && pDoc->InsertCol( aRange );
+ bOk = rDoc.CanInsertCol( aRange ) && rDoc.InsertCol( aRange );
}
break;
case SC_CAT_DELETE_ROWS :
- bOk = pDoc->CanInsertRow( aRange ) && pDoc->InsertRow( aRange );
+ bOk = rDoc.CanInsertRow( aRange ) && rDoc.InsertRow( aRange );
break;
case SC_CAT_DELETE_TABS :
{
//TODO: Remember table names?
OUString aName;
- pDoc->CreateValidTabName( aName );
- bOk = pDoc->ValidNewTabName( aName ) && pDoc->InsertTab( aRange.aStart.Tab(), aName );
+ rDoc.CreateValidTabName( aName );
+ bOk = rDoc.ValidNewTabName( aName ) && rDoc.InsertTab( aRange.aStart.Tab(), aName );
}
break;
default:
@@ -1174,15 +1174,15 @@ void ScChangeActionMove::GetDelta( sal_Int32& nDx, sal_Int32& nDy, sal_Int32& nD
}
void ScChangeActionMove::GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange, bool bWarning ) const
{
- ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
+ ScChangeAction::GetDescription( rStr, rDoc, bSplitRange, bWarning );
bool bFlag3D = GetFromRange().aStart.Tab() != GetBigRange().aStart.Tab();
OUString aRsc = ScResId(STR_CHANGED_MOVE);
- OUString aTmpStr = ScChangeAction::GetRefString(GetFromRange(), pDoc, bFlag3D);
+ OUString aTmpStr = ScChangeAction::GetRefString(GetFromRange(), rDoc, bFlag3D);
sal_Int32 nPos = aRsc.indexOf("#1");
if (nPos >= 0)
{
@@ -1190,7 +1190,7 @@ void ScChangeActionMove::GetDescription(
nPos += aTmpStr.getLength();
}
- aTmpStr = ScChangeAction::GetRefString(GetBigRange(), pDoc, bFlag3D);
+ aTmpStr = ScChangeAction::GetRefString(GetBigRange(), rDoc, bFlag3D);
nPos = nPos >= 0 ? aRsc.indexOf("#2", nPos) : -1;
if (nPos >= 0)
{
@@ -1201,47 +1201,47 @@ void ScChangeActionMove::GetDescription(
}
void ScChangeActionMove::GetRefString(
- OUString& rStr, ScDocument* pDoc, bool bFlag3D ) const
+ OUString& rStr, ScDocument& rDoc, bool bFlag3D ) const
{
if ( !bFlag3D )
bFlag3D = ( GetFromRange().aStart.Tab() != GetBigRange().aStart.Tab() );
// overwrite existing string value.
- rStr = ScChangeAction::GetRefString(GetFromRange(), pDoc, bFlag3D)
+ rStr = ScChangeAction::GetRefString(GetFromRange(), rDoc, bFlag3D)
+ ", "
- + ScChangeAction::GetRefString(GetBigRange(), pDoc, bFlag3D);
+ + ScChangeAction::GetRefString(GetBigRange(), rDoc, bFlag3D);
}
-bool ScChangeActionMove::Reject( ScDocument* pDoc )
+bool ScChangeActionMove::Reject( ScDocument& rDoc )
{
- if ( !(aBigRange.IsValid( pDoc ) && aFromRange.IsValid( pDoc )) )
+ if ( !(aBigRange.IsValid( rDoc ) && aFromRange.IsValid( rDoc )) )
return false;
ScRange aToRange( aBigRange.MakeRange() );
ScRange aFrmRange( aFromRange.MakeRange() );
- bool bOk = pDoc->IsBlockEditable( aToRange.aStart.Tab(),
+ bool bOk = rDoc.IsBlockEditable( aToRange.aStart.Tab(),
aToRange.aStart.Col(), aToRange.aStart.Row(),
aToRange.aEnd.Col(), aToRange.aEnd.Row() );
if ( bOk )
- bOk = pDoc->IsBlockEditable( aFrmRange.aStart.Tab(),
+ bOk = rDoc.IsBlockEditable( aFrmRange.aStart.Tab(),
aFrmRange.aStart.Col(), aFrmRange.aStart.Row(),
aFrmRange.aEnd.Col(), aFrmRange.aEnd.Row() );
if ( !bOk )
return false;
- pTrack->LookUpContents( aToRange, pDoc, 0, 0, 0 ); // Contents to be moved
+ pTrack->LookUpContents( aToRange, &rDoc, 0, 0, 0 ); // Contents to be moved
- pDoc->DeleteAreaTab( aToRange, InsertDeleteFlags::ALL );
- pDoc->DeleteAreaTab( aFrmRange, InsertDeleteFlags::ALL );
+ rDoc.DeleteAreaTab( aToRange, InsertDeleteFlags::ALL );
+ rDoc.DeleteAreaTab( aFrmRange, InsertDeleteFlags::ALL );
// Adjust formula in the Document
- sc::RefUpdateContext aCxt(*pDoc);
+ sc::RefUpdateContext aCxt(rDoc);
aCxt.meMode = URM_MOVE;
aCxt.maRange = aFrmRange;
aCxt.mnColDelta = aFrmRange.aStart.Col() - aToRange.aStart.Col();
aCxt.mnRowDelta = aFrmRange.aStart.Row() - aToRange.aStart.Row();
aCxt.mnTabDelta = aFrmRange.aStart.Tab() - aToRange.aStart.Tab();
- pDoc->UpdateReference(aCxt);
+ rDoc.UpdateReference(aCxt);
// Free LinkDependent, set succeeding UpdateReference Undo
// ToRange->FromRange Dependents
@@ -1257,8 +1257,8 @@ bool ScChangeActionMove::Reject( ScDocument* pDoc )
{
ScChangeActionContent* pContent = static_cast<ScChangeActionContent*>(p);
if ( !pContent->IsDeletedIn() &&
- pContent->GetBigRange().aStart.IsValid( pDoc ) )
- pContent->PutNewValueToDoc( pDoc, 0, 0 );
+ pContent->GetBigRange().aStart.IsValid( rDoc ) )
+ pContent->PutNewValueToDoc( &rDoc, 0, 0 );
// Delete the ones created in LookUpContents
if ( pTrack->IsGenerated( pContent->GetActionNumber() ) &&
!pContent->IsDeletedIn() )
@@ -1431,14 +1431,14 @@ void ScChangeActionContent::GetNewString( OUString& rStr, const ScDocument* pDoc
}
void ScChangeActionContent::GetDescription(
- OUString& rStr, ScDocument* pDoc, bool bSplitRange, bool bWarning ) const
+ OUString& rStr, ScDocument& rDoc, bool bSplitRange, bool bWarning ) const
{
- ScChangeAction::GetDescription( rStr, pDoc, bSplitRange, bWarning );
+ ScChangeAction::GetDescription( rStr, rDoc, bSplitRange, bWarning );
OUString aRsc = ScResId(STR_CHANGED_CELL);
OUString aTmpStr;
- GetRefString(aTmpStr, pDoc);
+ GetRefString(aTmpStr, rDoc);
sal_Int32 nPos = aRsc.indexOf("#1", 0);
if (nPos >= 0)
@@ -1447,7 +1447,7 @@ void ScChangeActionContent::GetDescription(
nPos += aTmpStr.getLength();
}
- GetOldString( aTmpStr, pDoc );
+ GetOldString( aTmpStr, &rDoc );
if (aTmpStr.isEmpty())
aTmpStr = ScResId( STR_CHANGED_BLANK );
@@ -1458,7 +1458,7 @@ void ScChangeActionContent::GetDescription(
nPos += aTmpStr.getLength();
}
- GetNewString( aTmpStr, pDoc );
+ GetNewString( aTmpStr, &rDoc );
if (aTmpStr.isEmpty())
aTmpStr = ScResId( STR_CHANGED_BLANK );
@@ -1472,9 +1472,9 @@ void ScChangeActionContent::GetDescription(
}
void ScChangeActionContent::GetRefString(
- OUString& rStr, ScDocument* pDoc, bool bFlag3D ) const
+ OUString& rStr, ScDocument& rDoc, bool bFlag3D ) const
{
- ScRefFlags nFlags = ( GetBigRange().IsValid( pDoc ) ? ScRefFlags::VALID : ScRefFlags::ZERO );
+ ScRefFlags nFlags = ( GetBigRange().IsValid( rDoc ) ? ScRefFlags::VALID : ScRefFlags::ZERO );
if ( nFlags != ScRefFlags::ZERO )
{
const ScCellValue& rCell = GetNewCell();
@@ -1486,7 +1486,7 @@ void ScChangeActionContent::GetRefString(
rCell.mpFormula->GetMatColsRows( nC, nR );
aLocalBigRange.aEnd.IncCol( nC-1 );
aLocalBigRange.aEnd.IncRow( nR-1 );
- rStr = ScChangeAction::GetRefString( aLocalBigRange, pDoc, bFlag3D );
+ rStr = ScChangeAction::GetRefString( aLocalBigRange, rDoc, bFlag3D );
return ;
}
@@ -1494,7 +1494,7 @@ void ScChangeActionContent::GetRefString(
ScAddress aTmpAddress( GetBigRange().aStart.MakeAddress() );
if ( bFlag3D )
nFlags |= ScRefFlags::TAB_3D;
- rStr = aTmpAddress.Format(nFlags, pDoc, pDoc->GetAddressConvention());
+ rStr = aTmpAddress.Format(nFlags, &rDoc, rDoc.GetAddressConvention());
if ( IsDeletedIn() )
{
// Insert the parentheses.
@@ -1505,12 +1505,12 @@ void ScChangeActionContent::GetRefString(
rStr = ScCompiler::GetNativeSymbol(ocErrRef);
}
-bool ScChangeActionContent::Reject( ScDocument* pDoc )
+bool ScChangeActionContent::Reject( ScDocument& rDoc )
{
- if ( !aBigRange.IsValid( pDoc ) )
+ if ( !aBigRange.IsValid( rDoc ) )
return false;
- PutOldValueToDoc( pDoc, 0, 0 );
+ PutOldValueToDoc( &rDoc, 0, 0 );
SetState( SC_CAS_REJECTED );
RemoveAllLinks();
@@ -1518,10 +1518,10 @@ bool ScChangeActionContent::Reject( ScDocument* pDoc )
return true;
}
-bool ScChangeActionContent::Select( ScDocument* pDoc, ScChangeTrack* pTrack,
+bool ScChangeActionContent::Select( ScDocument& rDoc, ScChangeTrack* pTrack,
bool bOldest, ::std::stack<ScChangeActionContent*>* pRejectActions )
{
- if ( !aBigRange.IsValid( pDoc ) )
+ if ( !aBigRange.IsValid( rDoc ) )
return false;
ScChangeActionContent* pContent = this;
@@ -1555,13 +1555,13 @@ bool ScChangeActionContent::Select( ScDocument* pDoc, ScChangeTrack* pTrack,
ScChangeActionContent* pNew = new ScChangeActionContent( aRange );
ScCellValue aCell;
- aCell.assign(*pDoc, rPos);
- pNew->SetOldValue(aCell, pDoc, pDoc);
+ aCell.assign(rDoc, rPos);
+ pNew->SetOldValue(aCell, &rDoc, &rDoc);
if ( bOldest )
- PutOldValueToDoc( pDoc, 0, 0 );
+ PutOldValueToDoc( &rDoc, 0, 0 );
else
- PutNewValueToDoc( pDoc, 0, 0 );
+ PutNewValueToDoc( &rDoc, 0, 0 );
pNew->SetRejectAction( bOldest ? GetActionNumber() : pEnd->GetActionNumber() );
pNew->SetState( SC_CAS_ACCEPTED );
@@ -1569,8 +1569,8 @@ bool ScChangeActionContent::Select( ScDocument* pDoc, ScChangeTrack* pTrack,
pRejectActions->push( pNew );
else
{
- aCell.assign(*pDoc, rPos);
- pNew->SetNewValue(aCell, pDoc);
+ aCell.assign(rDoc, rPos);
+ pNew->SetNewValue(aCell, &rDoc);
pTrack->Append( pNew );
}
}
@@ -1979,7 +1979,7 @@ void ScChangeActionContent::UpdateReference( const ScChangeTrack* pTrack,
if ( bNewFormula )
maNewCell.mpFormula->UpdateReference(aRefCxt);
- if ( aBigRange.aStart.IsValid( &pTrack->GetDocument() ) )
+ if ( aBigRange.aStart.IsValid( pTrack->GetDocument() ) )
return;
//FIXME:
@@ -2031,7 +2031,7 @@ ScChangeActionReject::ScChangeActionReject(
{
}
-bool ScChangeActionReject::Reject(ScDocument* /*pDoc*/)
+bool ScChangeActionReject::Reject(ScDocument& /*rDoc*/)
{
return false;
}
@@ -4070,7 +4070,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest )
aBigRange.aEnd.IncRow( nR-1 );
}
- if ( !aBigRange.IsValid( &rDoc ) )
+ if ( !aBigRange.IsValid( rDoc ) )
return false;
ScRange aRange( aBigRange.MakeRange() );
@@ -4091,7 +4091,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest )
if ( p->GetType() == SC_CAT_CONTENT )
{
// we don't need no recursion here, do we?
- bOk &= static_cast<ScChangeActionContent*>(p)->Select( &rDoc, this,
+ bOk &= static_cast<ScChangeActionContent*>(p)->Select( rDoc, this,
bOldest, &aRejectActions );
}
else
@@ -4102,7 +4102,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest )
pL = pL->GetNext();
}
- bOk &= pContent->Select( &rDoc, this, bOldest, nullptr );
+ bOk &= pContent->Select( rDoc, this, bOldest, nullptr );
// now the matrix is inserted and new content values are ready
while ( !aRejectActions.empty() )
@@ -4118,7 +4118,7 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest )
return bOk;
}
else
- return pContent->Select( &rDoc, this, bOldest, nullptr );
+ return pContent->Select( rDoc, this, bOldest, nullptr );
}
void ScChangeTrack::AcceptAll()
@@ -4208,7 +4208,7 @@ bool ScChangeTrack::Reject(
}
if ( bOk )
{
- bRejected = pAct->Reject( &rDoc );
+ bRejected = pAct->Reject( rDoc );
if ( bRejected )
{
// pRefDoc NULL := Do not save deleted Cells
@@ -4227,7 +4227,7 @@ bool ScChangeTrack::Reject(
{
bTabDel = true;
aDelRange = pAct->GetBigRange();
- bTabDelOk = pAct->Reject( &rDoc );
+ bTabDelOk = pAct->Reject( rDoc );
bOk = bTabDelOk;
if ( bOk )
{
@@ -4241,7 +4241,7 @@ bool ScChangeTrack::Reject(
if ( bOk )
{
aDelRange = pDel->GetOverAllRange();
- bOk = aDelRange.IsValid( &rDoc );
+ bOk = aDelRange.IsValid( rDoc );
}
bool bOneOk = false;
if ( bOk )
@@ -4268,7 +4268,7 @@ bool ScChangeTrack::Reject(
do
{
pDel = static_cast<ScChangeActionDel*>(p);
- bOk = pDel->Reject( &rDoc );
+ bOk = pDel->Reject( rDoc );
if ( bOk )
{
if ( bOneOk )
@@ -4325,7 +4325,7 @@ bool ScChangeTrack::Reject(
}
if ( bOk )
{
- bRejected = pAct->Reject( &rDoc );
+ bRejected = pAct->Reject( rDoc );
if ( bRejected )
{
ScChangeActionMove* pReject = new ScChangeActionMove(
@@ -4351,7 +4351,7 @@ bool ScChangeTrack::Reject(
aCell.assign(rDoc, aRange.aStart);
pReject->SetOldValue(aCell, &rDoc, &rDoc);
}
- bRejected = pAct->Reject( &rDoc );
+ bRejected = pAct->Reject( rDoc );
if ( bRejected && !bRecursion )
{
ScCellValue aCell;
@@ -4700,7 +4700,7 @@ static void lcl_getTrackedChange(ScDocument& rDoc, int nIndex, const ScChangeAct
rRedlines.put("comment", pAction->GetComment());
OUString aDescription;
- pAction->GetDescription(aDescription, &rDoc, true);
+ pAction->GetDescription(aDescription, rDoc, true);
rRedlines.put("description", aDescription);
OUString sDateTime = utl::toISO8601(pAction->GetDateTimeUTC().GetUNODateTime());
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 8d08d1ba9516..0d39921474f8 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -2976,7 +2976,7 @@ void ScInterpreter::ScExternal()
PopSingleRef( aAdr );
ScRange aRange( aAdr );
uno::Reference<table::XCellRange> xObj =
- ScCellRangeObj::CreateRangeFromDoc( &mrDoc, aRange );
+ ScCellRangeObj::CreateRangeFromDoc( mrDoc, aRange );
if (xObj.is())
aParam <<= xObj;
else
@@ -2988,7 +2988,7 @@ void ScInterpreter::ScExternal()
ScRange aRange;
PopDoubleRef( aRange );
uno::Reference<table::XCellRange> xObj =
- ScCellRangeObj::CreateRangeFromDoc( &mrDoc, aRange );
+ ScCellRangeObj::CreateRangeFromDoc( mrDoc, aRange );
if (xObj.is())
{
aParam <<= xObj;
@@ -3139,17 +3139,17 @@ static uno::Any lcl_getSheetModule( const uno::Reference<table::XCellRange>& xCe
return uno::makeAny( xIf );
}
-static bool lcl_setVBARange( const ScRange& aRange, const ScDocument* pDok, SbxVariable* pPar )
+static bool lcl_setVBARange( const ScRange& aRange, const ScDocument& rDok, SbxVariable* pPar )
{
bool bOk = false;
try
{
uno::Reference< uno::XInterface > xVBARange;
- uno::Reference<table::XCellRange> xCellRange = ScCellRangeObj::CreateRangeFromDoc( pDok, aRange );
+ uno::Reference<table::XCellRange> xCellRange = ScCellRangeObj::CreateRangeFromDoc( rDok, aRange );
uno::Sequence< uno::Any > aArgs(2);
- aArgs[0] = lcl_getSheetModule( xCellRange, pDok );
+ aArgs[0] = lcl_getSheetModule( xCellRange, &rDok );
aArgs[1] <<= xCellRange;
- xVBARange = ooo::vba::createVBAUnoAPIServiceWithArgs( pDok->GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
+ xVBARange = ooo::vba::createVBAUnoAPIServiceWithArgs( rDok.GetDocumentShell(), "ooo.vba.excel.Range", aArgs );
if ( xVBARange.is() )
{
SbxObjectRef aObj = GetSbUnoObject( "A-Range", uno::Any( xVBARange ) );
@@ -3303,7 +3303,7 @@ void ScInterpreter::ScMacro()
if ( bUseVBAObjects )
{
ScRange aRange( aAdr );
- bOk = lcl_setVBARange( aRange, &mrDoc, pPar );
+ bOk = lcl_setVBARange( aRange, mrDoc, pPar );
}
else
{
@@ -3330,7 +3330,7 @@ void ScInterpreter::ScMacro()
if ( bUseVBAObjects )
{
ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
- bOk = lcl_setVBARange( aRange, &mrDoc, pPar );
+ bOk = lcl_setVBARange( aRange, mrDoc, pPar );
}
else
{
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 10e6f85acb1e..6c6ec113873d 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -168,7 +168,7 @@ void lclInsertUrl( XclImpRoot& rRoot, const OUString& rUrl, SCCOL nScCol, SCROW
SvNumberFormatter* pFormatter = rDoc.getDoc().GetFormatTable();
const Color* pColor;
OUString aDisplText;
- ScCellFormat::GetString(aCell, nNumFmt, aDisplText, &pColor, *pFormatter, &rDoc.getDoc());
+ ScCellFormat::GetString(aCell, nNumFmt, aDisplText, &pColor, *pFormatter, rDoc.getDoc());
if (aDisplText.isEmpty())
aDisplText = rUrl;
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index ae3a8502653f..6122c9b6c45c 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -1139,7 +1139,7 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC
break;
[[fallthrough]];
default:
- ScCellFormat::GetString(aCell, nFormat, aStrOut, &pColor, *pFormatter, pDoc);
+ ScCellFormat::GetString(aCell, nFormat, aStrOut, &pColor, *pFormatter, *pDoc);
}
if ( !bFieldText )
diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx
index ba6c017f4f3c..486ee3cf7d7d 100644
--- a/sc/source/filter/oox/formulabuffer.cxx
+++ b/sc/source/filter/oox/formulabuffer.cxx
@@ -371,7 +371,7 @@ void FormulaBuffer::finalizeImport()
ScDocumentImport& rDoc = getDocImport();
rDoc.getDoc().SetAutoNameCache(std::make_unique<ScAutoNameCache>(rDoc.getDoc()));
- ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc.getDoc());
+ ScExternalRefManager::ApiGuard aExtRefGuard(rDoc.getDoc());
SCTAB nTabCount = rDoc.getDoc().GetTableCount();
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 695276add693..a8f88c493685 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1303,7 +1303,7 @@ OUString getOutputString( ScDocument* pDoc, const ScAddress& aCellPos )
const Color* pColor;
sal_uInt32 nNumFmt = pDoc->GetNumberFormat(aCellPos);
OUString aStr;
- ScCellFormat::GetString(aCell, nNumFmt, aStr, &pColor, *pDoc->GetFormatTable(), pDoc);
+ ScCellFormat::GetString(aCell, nNumFmt, aStr, &pColor, *pDoc->GetFormatTable(), *pDoc);
return aStr;
}
}
@@ -1355,7 +1355,7 @@ void ScXMLTableRowCellContext::PutFormulaCell( const ScAddress& rCellPos )
OUString aText = maFormula->first;
- ScExternalRefManager::ApiGuard aExtRefGuard(pDoc);
+ ScExternalRefManager::ApiGuard aExtRefGuard(*pDoc);
if ( aText.isEmpty() )
return;
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index aa886af6b412..18d94fec4e11 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -221,7 +221,7 @@ OUString lcl_GetFormattedString(ScDocument* pDoc, const ScRefCellValue& rCell, c
SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
sal_uInt32 nFormat = pDoc->GetNumberFormat(rAddr);
- ScCellFormat::GetString(rCell, nFormat, aStr, &pColor, *pFormatter, pDoc);
+ ScCellFormat::GetString(rCell, nFormat, aStr, &pColor, *pFormatter, *pDoc);
return aStr;
}
case CELLTYPE_EDIT:
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index 06196ffd0b34..7f272e131192 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -1230,7 +1230,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
if ( pViewSh )
pViewSh->UpdateCharts( true );
else
- ScDBFunc::DoUpdateCharts( ScAddress(), pDoc, true );
+ ScDBFunc::DoUpdateCharts( ScAddress(), *pDoc, true );
if (pBindings)
pBindings->Invalidate( SID_ATTR_SIZE ); //SvxPosSize StatusControl Update
}
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index 5de58eb6dd00..dae7c230aade 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -319,7 +319,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt
sal_uInt32 nNumFmt = pPattern->GetNumberFormat(pFormatter);
OUString aText;
const Color* pColor;
- ScCellFormat::GetString(aCell, nNumFmt, aText, &pColor, *pFormatter, m_pDoc.get());
+ ScCellFormat::GetString(aCell, nNumFmt, aText, &pColor, *pFormatter, *m_pDoc);
if (!aText.isEmpty())
aEngine.SetTextCurrentDefaults(aText);
}
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index ac742334ef57..ab8a3585e4d6 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -342,17 +342,17 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
{
if ( nNewEndX != nOldEndX || nNewEndY != nOldEndY ) // range changed?
{
- pUndoDoc->InitUndo( &rDoc, 0, rDoc.GetTableCount()-1 );
+ pUndoDoc->InitUndo( rDoc, 0, rDoc.GetTableCount()-1 );
rDoc.CopyToDocument(0, 0, 0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB,
InsertDeleteFlags::FORMULA, false, *pUndoDoc); // all formulas
}
else
- pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab ); // only destination table
+ pUndoDoc->InitUndo( rDoc, nDestTab, nDestTab ); // only destination table
rDoc.CopyToDocument(aOldRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pUndoDoc);
}
else // without insertion
{
- pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab ); // only destination table
+ pUndoDoc->InitUndo( rDoc, nDestTab, nDestTab ); // only destination table
rDoc.CopyToDocument(aMaxRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pUndoDoc);
}
}
@@ -413,7 +413,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
if ( bAddUndo && bUndo)
{
ScDocumentUniquePtr pRedoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pRedoDoc->InitUndo( &rDoc, nDestTab, nDestTab );
+ pRedoDoc->InitUndo( rDoc, nDestTab, nDestTab );
rDoc.CopyToDocument(aNewRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pRedoDoc);
m_pDocSh->GetUndoManager()->AddUndoAction(
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 4683ee74ea0e..4ead59d46fbc 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -359,7 +359,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bApi, bool bIsUnnamed,
pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol );
pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow );
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument(static_cast<SCCOL>(nOutStartCol), 0,
nTab, static_cast<SCCOL>(nOutEndCol), rDoc.MaxRow(), nTab,
InsertDeleteFlags::NONE, false, *pUndoDoc);
@@ -368,7 +368,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bApi, bool bIsUnnamed,
InsertDeleteFlags::NONE, false, *pUndoDoc);
}
else
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
// secure data range - incl. filtering result
rDoc.CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::ALL, false, *pUndoDoc);
@@ -755,7 +755,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
if (bCopy)
{
- pUndoDoc->InitUndo( &rDoc, nDestTab, nDestTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nDestTab, nDestTab, false, true );
rDoc.CopyToDocument(aLocalParam.nCol1, aLocalParam.nRow1, nDestTab,
aLocalParam.nCol2, aLocalParam.nRow2, nDestTab,
InsertDeleteFlags::ALL, false, *pUndoDoc);
@@ -769,7 +769,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
}
else
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
rDoc.CopyToDocument(0, rQueryParam.nRow1, nTab, rDoc.MaxCol(), rQueryParam.nRow2, nTab,
InsertDeleteFlags::NONE, false, *pUndoDoc);
}
@@ -798,7 +798,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam,
aAttribRange.aEnd.SetCol( aAttribRange.aEnd.Col() + nFormulaCols );
pAttribDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pAttribDoc->InitUndo( &rDoc, nDestTab, nDestTab, false, true );
+ pAttribDoc->InitUndo( rDoc, nDestTab, nDestTab, false, true );
rDoc.CopyToDocument(aAttribRange, InsertDeleteFlags::ATTRIB, false, *pAttribDoc);
}
@@ -1056,12 +1056,12 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam,
pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol );
pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow );
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument(static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
rDoc.CopyToDocument(0, nOutStartRow, nTab, rDoc.MaxCol(), nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
}
else
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, bOldFilter );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, bOldFilter );
// secure data range - incl. filtering result
rDoc.CopyToDocument(0, rParam.nRow1+1,nTab, rDoc.MaxCol(),rParam.nRow2,nTab,
@@ -1183,12 +1183,12 @@ bool isEditable(ScDocShell& rDocShell, const ScRangeList& rRanges, bool bApi)
return true;
}
-void createUndoDoc(ScDocumentUniquePtr& pUndoDoc, ScDocument* pDoc, const ScRange& rRange)
+void createUndoDoc(ScDocumentUniquePtr& pUndoDoc, ScDocument& rDoc, const ScRange& rRange)
{
SCTAB nTab = rRange.aStart.Tab();
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo(pDoc, nTab, nTab);
- pDoc->CopyToDocument(rRange, InsertDeleteFlags::ALL, false, *pUndoDoc);
+ pUndoDoc->InitUndo(rDoc, nTab, nTab);
+ rDoc.CopyToDocument(rRange, InsertDeleteFlags::ALL, false, *pUndoDoc);
}
bool checkNewOutputRange(ScDPObject& rDPObj, ScDocShell& rDocShell, ScRange& rNewOut, bool bApi)
@@ -1274,7 +1274,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
bRecord = false;
if (bRecord)
- createUndoDoc(pOldUndoDoc, &rDoc, pOldObj->GetOutRange());
+ createUndoDoc(pOldUndoDoc, rDoc, pOldObj->GetOutRange());
pNewObj->WriteSourceDataTo(*pOldObj); // copy source data
@@ -1319,7 +1319,7 @@ bool ScDBDocFunc::DataPilotUpdate( ScDPObject* pOldObj, const ScDPObject* pNewOb
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, rDoc, aNewOut);
pOldObj->Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
@@ -1393,7 +1393,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
SCTAB nTab = aRange.aStart.Tab();
if (bRecord)
- createUndoDoc(pOldUndoDoc, &rDoc, aRange);
+ createUndoDoc(pOldUndoDoc, rDoc, aRange);
rDoc.DeleteAreaTab( aRange.aStart.Col(), aRange.aStart.Row(),
aRange.aEnd.Col(), aRange.aEnd.Row(),
@@ -1513,7 +1513,7 @@ bool ScDBDocFunc::CreatePivotTable(const ScDPObject& rDPObj, bool bRecord, bool
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, rDoc, aNewOut);
rDestObj.Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
@@ -1549,7 +1549,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
bRecord = false;
if (bRecord)
- createUndoDoc(pOldUndoDoc, &rDoc, rDPObj.GetOutRange());
+ createUndoDoc(pOldUndoDoc, rDoc, rDPObj.GetOutRange());
rDPObj.SetAllowMove(false);
rDPObj.ReloadGroupTableData();
@@ -1587,7 +1587,7 @@ bool ScDBDocFunc::UpdatePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
}
if (bRecord)
- createUndoDoc(pNewUndoDoc, &rDoc, aNewOut);
+ createUndoDoc(pNewUndoDoc, rDoc, aNewOut);
rDPObj.Output(aNewOut.aStart);
rDocShell.PostPaintGridAll(); //! only necessary parts
diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx
index 6a460119289b..8a19581362aa 100644
--- a/sc/source/ui/docshell/dbdocimp.cxx
+++ b/sc/source/ui/docshell/dbdocimp.cxx
@@ -181,7 +181,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
// ImportDoc - also used for Redo
ScDocumentUniquePtr pImportDoc(new ScDocument( SCDOCMODE_UNDO ));
- pImportDoc->InitUndo( &rDoc, nTab, nTab );
+ pImportDoc->InitUndo( rDoc, nTab, nTab );
// get data from database into import document
@@ -466,7 +466,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam,
if ( bRecord )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
pUndoDBData.reset(new ScDBData( *pDBData ));
}
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 3257e4744eff..826755bb9fa5 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -753,7 +753,7 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, TransliterationFlags
SCTAB nTabCount = rDoc.GetTableCount();
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab );
for (const auto& rTab : rMark)
{
if (rTab >= nTabCount)
@@ -1230,7 +1230,7 @@ bool ScDocFunc::SetCellText(
::std::unique_ptr<ScExternalRefManager::ApiGuard> pExtRefGuard;
if (bApi)
- pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(&rDoc));
+ pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(rDoc));
ScInputStringType aRes =
ScStringUtil::parseInputString(*rDoc.GetFormatTable(), rText, LANGUAGE_ENGLISH_US);
@@ -1437,7 +1437,7 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
if ( bRecord )
{
ScDocumentUniquePtr pUndoDoc( new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, aMultiRange.aStart.Tab(), aMultiRange.aEnd.Tab() );
+ pUndoDoc->InitUndo( rDoc, aMultiRange.aStart.Tab(), aMultiRange.aEnd.Tab() );
rDoc.CopyToDocument(aMultiRange, InsertDeleteFlags::ATTRIB, bMulti, *pUndoDoc, &rMark);
rDocShell.GetUndoManager()->AddUndoAction(
@@ -1511,7 +1511,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
SCTAB nStartTab = aMultiRange.aStart.Tab();
SCTAB nTabCount = rDoc.GetTableCount();
- pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab );
for (const auto& rTab : rMark)
{
if (rTab >= nTabCount)
@@ -1901,7 +1901,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord )
{
pRefUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1 );
+ pRefUndoDoc->InitUndo( rDoc, 0, nTabCount-1 );
// pRefUndoDoc is filled in InsertCol / InsertRow
@@ -2032,7 +2032,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
if (bRecord && !pUndoRemoveMerge)
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, *aMark.begin(), *aMark.rbegin());
+ pUndoDoc->InitUndo( rDoc, *aMark.begin(), *aMark.rbegin());
pUndoRemoveMerge.reset( new ScUndoRemoveMerge( &rDocShell, rRange, std::move(pUndoDoc) ));
}
@@ -2519,7 +2519,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
if (bRecord && !pUndoRemoveMerge)
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, *aMark.begin(), *aMark.rbegin());
+ pUndoDoc->InitUndo( rDoc, *aMark.begin(), *aMark.rbegin());
pUndoRemoveMerge.reset( new ScUndoRemoveMerge( &rDocShell, rRange, std::move(pUndoDoc) ));
}
@@ -2560,7 +2560,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
// so it's no longer necessary to copy more than the deleted range into pUndoDoc.
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, 0, nTabCount-1, (eCmd==DelCellCmd::Cols), (eCmd==DelCellCmd::Rows) );
+ pUndoDoc->InitUndo( rDoc, 0, nTabCount-1, (eCmd==DelCellCmd::Cols), (eCmd==DelCellCmd::Rows) );
for (const auto& rTab : aMark)
{
if (rTab >= nTabCount)
@@ -2576,7 +2576,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
}
pRefUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1 );
+ pRefUndoDoc->InitUndo( rDoc, 0, nTabCount-1 );
pUndoData.reset(new ScRefUndoData( &rDoc ));
@@ -2972,7 +2972,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
InsertDeleteFlags nUndoFlags = (InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS;
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab, bWholeCols, bWholeRows );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab, bWholeCols, bWholeRows );
if (bCut)
{
@@ -3315,7 +3315,7 @@ bool ScDocFunc::DeleteTable( SCTAB nTab, bool bRecord )
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
SCTAB nCount = rDoc.GetTableCount();
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); // only nTab with Flags
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true ); // only nTab with Flags
pUndoDoc->AddUndoTab( 0, nCount-1 ); // all sheets for references
rDoc.CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::ALL,false, *pUndoDoc );
@@ -3664,12 +3664,12 @@ bool ScDocFunc::SetWidthOrHeight(
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
if (bWidth)
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true );
rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab, static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
}
else
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
rDoc.CopyToDocument( 0, static_cast<SCROW>(nStart), nTab, rDoc.MaxCol(), static_cast<SCROW>(nEnd), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
}
@@ -4110,7 +4110,7 @@ void ScDocFunc::ClearItems( const ScMarkData& rMark, const sal_uInt16* pWhich, b
SCTAB nEndTab = aMarkRange.aEnd.Tab();
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab );
rDoc.CopyToDocument( aMarkRange, InsertDeleteFlags::ATTRIB, true, *pUndoDoc, &aMultiMark );
rDocShell.GetUndoManager()->AddUndoAction(
@@ -4148,7 +4148,7 @@ bool ScDocFunc::ChangeIndent( const ScMarkData& rMark, bool bIncrement, bool bAp
SCTAB nTabCount = rDoc.GetTableCount();
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab );
for (const auto& rTab : rMark)
{
if (rTab >= nTabCount)
@@ -4233,7 +4233,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
if ( bRecord )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab, bSize, bSize );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab, bSize, bSize );
for (const auto& rTab : aMark)
{
if (rTab >= nTabCount)
@@ -4346,7 +4346,7 @@ bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark,
{
//! take selected sheets into account also when undoing
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab );
rDoc.CopyToDocument( rRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pUndoDoc );
}
@@ -4430,7 +4430,7 @@ bool ScDocFunc::TabOp( const ScRange& rRange, const ScMarkData* pTabMark,
{
//! take selected sheets into account also when undoing
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab );
rDoc.CopyToDocument( rRange, InsertDeleteFlags::ALL & ~InsertDeleteFlags::NOTE, false, *pUndoDoc );
rDocShell.GetUndoManager()->AddUndoAction(
@@ -4601,7 +4601,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( rDoc, nDestStartTab, nDestStartTab );
for (const auto& rTab : aMark)
{
if (rTab >= nTabCount)
@@ -4721,7 +4721,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( rDoc, nDestStartTab, nDestStartTab );
for (const auto& rTab : aMark)
{
if (rTab >= nTabCount)
@@ -4877,7 +4877,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
SCTAB nDestStartTab = aDestArea.aStart.Tab();
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nDestStartTab, nDestStartTab );
+ pUndoDoc->InitUndo( rDoc, nDestStartTab, nDestStartTab );
for (const auto& rTab : aMark)
{
if (rTab >= nTabCount)
@@ -4987,7 +4987,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
if (!pUndoDoc)
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo(&rDoc, nTab1, nTab2);
+ pUndoDoc->InitUndo(rDoc, nTab1, nTab2);
}
// note captions are collected by drawing undo
rDoc.CopyToDocument( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab,
@@ -5082,7 +5082,7 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord, Sc
if (!pUndoDoc)
{
pUndoDoc = new ScDocument( SCDOCMODE_UNDO );
- pUndoDoc->InitUndo(&rDoc, *rOption.maTabs.begin(), *rOption.maTabs.rbegin());
+ pUndoDoc->InitUndo(rDoc, *rOption.maTabs.begin(), *rOption.maTabs.rbegin());
}
rDoc.CopyToDocument(aExtended, InsertDeleteFlags::ATTRIB, false, *pUndoDoc);
}
@@ -5390,7 +5390,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
if (bRecord)
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
rDoc.CopyToDocument(nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
InsertDeleteFlags::ALL, false, *pUndoDoc);
@@ -5436,7 +5436,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
if (bRecord)
{
ScDocumentUniquePtr pRedoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ pRedoDoc->InitUndo( rDoc, nTab, nTab );
rDoc.CopyToDocument(nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab,
InsertDeleteFlags::ALL, false, *pRedoDoc);
@@ -5604,7 +5604,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, std::unique_ptr<
if(bUndo)
{
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
if(pFormat)
{
@@ -5651,7 +5651,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, std::unique_ptr<
if(bUndo)
{
ScDocumentUniquePtr pRedoDoc(new ScDocument(SCDOCMODE_UNDO));
- pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ pRedoDoc->InitUndo( rDoc, nTab, nTab );
rDoc.CopyToDocument(aCompleteRange.aStart.Col(),aCompleteRange.aStart.Row(),nTab,
aCompleteRange.aEnd.Col(),aCompleteRange.aEnd.Row(),nTab,
InsertDeleteFlags::ALL, false, *pRedoDoc);
@@ -5678,7 +5678,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB
if (bUndo)
{
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
ScConditionalFormatList* pOld = rDoc.GetCondFormList(nTab);
@@ -5702,7 +5702,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB
if(bUndo)
{
ScDocumentUniquePtr pRedoDoc(new ScDocument(SCDOCMODE_UNDO));
- pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ pRedoDoc->InitUndo( rDoc, nTab, nTab );
pRedoDoc->SetCondFormList(new ScConditionalFormatList(pRedoDoc.get(), *pList), nTab);
rDocShell.GetUndoManager()->AddUndoAction(
diff --git a/sc/source/ui/docshell/docfuncutil.cxx b/sc/source/ui/docshell/docfuncutil.cxx
index d65d5b696b7a..ce1a25d61878 100644
--- a/sc/source/ui/docshell/docfuncutil.cxx
+++ b/sc/source/ui/docshell/docfuncutil.cxx
@@ -50,7 +50,7 @@ ScDocumentUniquePtr DocFuncUtil::createDeleteContentsUndoDoc(
{
ScDocumentUniquePtr pUndoDoc(new ScDocument(SCDOCMODE_UNDO));
SCTAB nTab = rRange.aStart.Tab();
- pUndoDoc->InitUndo(&rDoc, nTab, nTab);
+ pUndoDoc->InitUndo(rDoc, nTab, nTab);
SCTAB nTabCount = rDoc.GetTableCount();
for (const auto& rTab : rMark)
if (rTab != nTab)
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 0a2be452cfe6..e1532db4a063 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -2090,7 +2090,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
if ( bFixedWidth || bSaveAsShown )
{
const Color* pDummy;
- ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &m_aDocument);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, m_aDocument);
bString = bSaveAsShown && rFormatter.IsTextFormat( nFormat);
}
else
@@ -2105,7 +2105,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
{
sal_uInt32 nFormat = m_aDocument.GetNumberFormat(aPos);
const Color* pDummy;
- ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &m_aDocument);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, m_aDocument);
}
else
aString = pCell->mpFormula->GetString().getString();
@@ -2118,7 +2118,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
{
sal_uInt32 nFormat = m_aDocument.GetNumberFormat(aPos);
const Color* pDummy;
- ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &m_aDocument);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, m_aDocument);
}
else
aString = pCell->mpString->getString();
@@ -2140,7 +2140,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt
if ( bFixedWidth || bSaveAsShown )
{
const Color* pDummy;
- ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, &m_aDocument);
+ ScCellFormat::GetString(*pCell, nFormat, aString, &pDummy, rFormatter, m_aDocument);
bString = bSaveAsShown && rFormatter.IsTextFormat( nFormat);
}
else
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 074726c75e49..271d630094ae 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -732,9 +732,9 @@ static bool lcl_Equal( const ScChangeAction* pA, const ScChangeAction* pB, bool
// don't compare state if an old change has been accepted
}
-static bool lcl_FindAction( ScDocument* pDoc, const ScChangeAction* pAction, ScDocument* pSearchDoc, const ScChangeAction* pFirstSearchAction, const ScChangeAction* pLastSearchAction, bool bIgnore100Sec )
+static bool lcl_FindAction( ScDocument& rDoc, const ScChangeAction* pAction, ScDocument& rSearchDoc, const ScChangeAction* pFirstSearchAction, const ScChangeAction* pLastSearchAction, bool bIgnore100Sec )
{
- if ( !pDoc || !pAction || !pSearchDoc || !pFirstSearchAction || !pLastSearchAction )
+ if ( !pAction || !pFirstSearchAction || !pLastSearchAction )
{
return false;
}
@@ -751,9 +751,9 @@ static bool lcl_FindAction( ScDocument* pDoc, const ScChangeAction* pAction, ScD
pAction->GetBigRange() == pA->GetBigRange() )
{
OUString aActionDesc;
- pAction->GetDescription(aActionDesc, pDoc, true);
+ pAction->GetDescription(aActionDesc, rDoc, true);
OUString aADesc;
- pA->GetDescription(aADesc, pSearchDoc, true);
+ pA->GetDescription(aADesc, rSearchDoc, true);
if (aActionDesc == aADesc)
{
OSL_FAIL( "lcl_FindAction(): found equal action!" );
@@ -894,7 +894,7 @@ void ScDocShell::MergeDocument( ScDocument& rOtherDoc, bool bShared, bool bCheck
bool bMergeAction = false;
if ( bShared )
{
- if ( !bCheckDuplicates || !lcl_FindAction( &rOtherDoc, pSourceAction, &m_aDocument, pFirstSearchAction, pLastSearchAction, bIgnore100Sec ) )
+ if ( !bCheckDuplicates || !lcl_FindAction( rOtherDoc, pSourceAction, m_aDocument, pFirstSearchAction, pLastSearchAction, bIgnore100Sec ) )
{
bMergeAction = true;
}
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index fde5d60e5a10..cbdc901fa45c 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -577,7 +577,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
std::unique_ptr<ScOutlineTable> pUndoTab(pTable ? new ScOutlineTable( *pTable ) : nullptr);
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &m_aDocument, 0, nTabCount-1, false, true );
+ pUndoDoc->InitUndo( m_aDocument, 0, nTabCount-1, false, true );
// row state
m_aDocument.CopyToDocument(0, 0, nDestTab, m_aDocument.MaxCol(), m_aDocument.MaxRow(), nDestTab,
@@ -603,7 +603,7 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord )
else
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &m_aDocument, aDestArea.nTab, aDestArea.nTab );
+ pUndoDoc->InitUndo( m_aDocument, aDestArea.nTab, aDestArea.nTab );
m_aDocument.CopyToDocument(aDestArea.nColStart, aDestArea.nRowStart, aDestArea.nTab,
aDestArea.nColEnd, aDestArea.nRowEnd, aDestArea.nTab,
@@ -692,7 +692,7 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord )
if (bRecord)
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &m_aDocument, nTab,nEndTab ); // also all scenarios
+ pUndoDoc->InitUndo( m_aDocument, nTab,nEndTab ); // also all scenarios
// shown table:
m_aDocument.CopyToDocument(nStartCol, nStartRow, nTab,
nEndCol, nEndRow, nTab, InsertDeleteFlags::ALL,
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index 3537b141a3d7..81e87dcb0a60 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1473,7 +1473,7 @@ void ScExternalRefLink::SetDoRefresh(bool b)
mbDoRefresh = b;
}
-static FormulaToken* convertToToken( ScDocument* pHostDoc, const ScDocument* pSrcDoc, ScRefCellValue& rCell )
+static FormulaToken* convertToToken( ScDocument& rHostDoc, const ScDocument& rSrcDoc, ScRefCellValue& rCell )
{
if (rCell.hasEmptyValue())
{
@@ -1486,8 +1486,8 @@ static FormulaToken* convertToToken( ScDocument* pHostDoc, const ScDocument* pSr
case CELLTYPE_EDIT:
case CELLTYPE_STRING:
{
- OUString aStr = rCell.getString(pSrcDoc);
- svl::SharedString aSS = pHostDoc->GetSharedStringPool().intern(aStr);
+ OUString aStr = rCell.getString(&rSrcDoc);
+ svl::SharedString aSS = rHostDoc.GetSharedStringPool().intern(aStr);
return new formula::FormulaStringToken(aSS);
}
case CELLTYPE_VALUE:
@@ -1505,7 +1505,7 @@ static FormulaToken* convertToToken( ScDocument* pHostDoc, const ScDocument* pSr
}
else
{
- svl::SharedString aSS = pHostDoc->GetSharedStringPool().intern( pFCell->GetString().getString());
+ svl::SharedString aSS = rHostDoc.GetSharedStringPool().intern( pFCell->GetString().getString());
return new formula::FormulaStringToken(aSS);
}
}
@@ -1517,7 +1517,7 @@ static FormulaToken* convertToToken( ScDocument* pHostDoc, const ScDocument* pSr
}
static std::unique_ptr<ScTokenArray> convertToTokenArray(
- ScDocument* pHostDoc, const ScDocument& rSrcDoc, ScRange& rRange, vector<ScExternalRefCache::SingleRangeData>& rCacheData )
+ ScDocument& rHostDoc, const ScDocument& rSrcDoc, ScRange& rRange, vector<ScExternalRefCache::SingleRangeData>& rCacheData )
{
ScAddress& s = rRange.aStart;
ScAddress& e = rRange.aEnd;
@@ -1573,7 +1573,7 @@ static std::unique_ptr<ScTokenArray> convertToTokenArray(
xMat->GetDimensions( nMatCols, nMatRows);
if (nMatCols == nMatrixColumns && nMatRows == nMatrixRows)
{
- rSrcDoc.FillMatrix(*xMat, nTab, nCol1, nRow1, nCol2, nRow2, &pHostDoc->GetSharedStringPool());
+ rSrcDoc.FillMatrix(*xMat, nTab, nCol1, nRow1, nCol2, nRow2, &rHostDoc.GetSharedStringPool());
}
else if ((nCol1 == 0 && nCol2 == MAXCOL) || (nRow1 == 0 && nRow2 == MAXROW))
{
@@ -1585,7 +1585,7 @@ static std::unique_ptr<ScTokenArray> convertToTokenArray(
xMat = new ScMatrix( nMatrixColumns, nMatrixRows);
xMat->GetDimensions( nMatCols, nMatRows);
if (nMatCols == nMatrixColumns && nMatRows == nMatrixRows)
- rSrcDoc.FillMatrix(*xMat, nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2, &pHostDoc->GetSharedStringPool());
+ rSrcDoc.FillMatrix(*xMat, nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2, &rHostDoc.GetSharedStringPool());
}
}
@@ -1634,8 +1634,8 @@ bool isLinkUpdateAllowedInDoc(const ScDocument& rDoc)
}
}
-ScExternalRefManager::ScExternalRefManager(ScDocument* pDoc) :
- mpDoc(pDoc),
+ScExternalRefManager::ScExternalRefManager(ScDocument& rDoc) :
+ mrDoc(rDoc),
mbInReferenceMarking(false),
mbUserInteractionEnabled(true),
mbDocTimerEnabled(true)
@@ -1674,8 +1674,8 @@ ScExternalRefManager::LinkListener::~LinkListener()
{
}
-ScExternalRefManager::ApiGuard::ApiGuard(const ScDocument* pDoc) :
- mpMgr(pDoc->GetExternalRefManager()),
+ScExternalRefManager::ApiGuard::ApiGuard(const ScDocument& rDoc) :
+ mpMgr(rDoc.GetExternalRefManager()),
mbOldInteractionEnabled(mpMgr->mbUserInteractionEnabled)
{
// We don't want user interaction handled in the API.
@@ -1901,7 +1901,7 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
ScExternalRefCache::TokenRef pToken =
getSingleRefTokenFromSrcDoc(
- nFileId, pSrcDoc, ScAddress(rCell.Col(),rCell.Row(),nTab), pFmt);
+ nFileId, *pSrcDoc, ScAddress(rCell.Col(),rCell.Row(),nTab), pFmt);
putCellDataIntoCache(maRefCache, pToken, nFileId, rTabName, rCell, pFmt);
return pToken;
@@ -1923,7 +1923,7 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
if (!pSrcDoc)
{
// Source document not reachable.
- if (!isLinkUpdateAllowedInDoc(*mpDoc))
+ if (!isLinkUpdateAllowedInDoc(mrDoc))
{
// Indicate with specific error.
pToken.reset(new FormulaErrorToken(FormulaError::LinkFormulaNeedingCheck));
@@ -1965,7 +1965,7 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
}
pToken = getSingleRefTokenFromSrcDoc(
- nFileId, pSrcDoc, ScAddress(rCell.Col(),rCell.Row(),nTab), pFmt);
+ nFileId, *pSrcDoc, ScAddress(rCell.Col(),rCell.Row(),nTab), pFmt);
putCellDataIntoCache(maRefCache, pToken, nFileId, rTabName, rCell, pFmt);
return pToken;
@@ -2156,7 +2156,7 @@ void ScExternalRefManager::insertRefCell(sal_uInt16 nFileId, const ScAddress& rC
itr = r.first;
}
- insertRefCellByIterator(itr, mpDoc->GetFormulaCell(rCell));
+ insertRefCellByIterator(itr, mrDoc.GetFormulaCell(rCell));
}
void ScExternalRefManager::insertRefCellFromTemplate( ScFormulaCell* pTemplateCell, ScFormulaCell* pCell )
@@ -2173,7 +2173,7 @@ void ScExternalRefManager::insertRefCellFromTemplate( ScFormulaCell* pTemplateCe
bool ScExternalRefManager::hasCellExternalReference(const ScAddress& rCell)
{
- ScFormulaCell* pCell = mpDoc->GetFormulaCell(rCell);
+ ScFormulaCell* pCell = mrDoc.GetFormulaCell(rCell);
if (pCell)
return std::any_of(maRefCells.begin(), maRefCells.end(),
@@ -2207,7 +2207,7 @@ void ScExternalRefManager::fillCellFormat(sal_uLong nFmtIndex, ScExternalRefCach
if (!pFmt)
return;
- SvNumFormatType nFmtType = mpDoc->GetFormatTable()->GetType(nFmtIndex);
+ SvNumFormatType nFmtType = mrDoc.GetFormatTable()->GetType(nFmtIndex);
if (nFmtType != SvNumFormatType::UNDEFINED)
{
pFmt->mbIsSet = true;
@@ -2217,12 +2217,12 @@ void ScExternalRefManager::fillCellFormat(sal_uLong nFmtIndex, ScExternalRefCach
}
ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefTokenFromSrcDoc(
- sal_uInt16 nFileId, ScDocument* pSrcDoc, const ScAddress& rPos,
+ sal_uInt16 nFileId, ScDocument& rSrcDoc, const ScAddress& rPos,
ScExternalRefCache::CellFormat* pFmt)
{
// Get the cell from src doc, and convert it into a token.
- ScRefCellValue aCell(*pSrcDoc, rPos);
- ScExternalRefCache::TokenRef pToken(convertToToken(mpDoc, pSrcDoc, aCell));
+ ScRefCellValue aCell(rSrcDoc, rPos);
+ ScExternalRefCache::TokenRef pToken(convertToToken(mrDoc, rSrcDoc, aCell));
if (!pToken)
{
@@ -2232,8 +2232,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefTokenFromSrcDoc(
// Get number format information.
sal_uInt32 nFmtIndex = 0;
- pSrcDoc->GetNumberFormat(rPos.Col(), rPos.Row(), rPos.Tab(), nFmtIndex);
- nFmtIndex = getMappedNumberFormat(nFileId, nFmtIndex, pSrcDoc);
+ rSrcDoc.GetNumberFormat(rPos.Col(), rPos.Row(), rPos.Tab(), nFmtIndex);
+ nFmtIndex = getMappedNumberFormat(nFileId, nFmtIndex, rSrcDoc);
fillCellFormat(nFmtIndex, pFmt);
return pToken;
}
@@ -2276,7 +2276,7 @@ ScExternalRefCache::TokenArrayRef ScExternalRefManager::getDoubleRefTokensFromSr
aRange.aStart.SetTab(nTab1);
aRange.aEnd.SetTab(nTab1 + nTabSpan);
- pArray = convertToTokenArray(mpDoc, rSrcDoc, aRange, aCacheData);
+ pArray = convertToTokenArray(mrDoc, rSrcDoc, aRange, aCacheData);
rRange = aRange;
rCacheData.swap(aCacheData);
return pArray;
@@ -2346,7 +2346,7 @@ ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId)
return nullptr;
// Do not load document until it was allowed.
- if (!isLinkUpdateAllowedInDoc(*mpDoc))
+ if (!isLinkUpdateAllowedInDoc(mrDoc))
return nullptr;
ScDocument* pSrcDoc = nullptr;
@@ -2388,7 +2388,7 @@ ScDocument* ScExternalRefManager::getInMemorySrcDocument(sal_uInt16 nFileId)
ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
{
- if (!mpDoc->IsExecuteLinkEnabled())
+ if (!mrDoc.IsExecuteLinkEnabled())
return nullptr;
DocShellMap::iterator itrEnd = maDocShells.end();
@@ -2440,7 +2440,7 @@ ScDocument* ScExternalRefManager::getSrcDocument(sal_uInt16 nFileId)
SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUString& rFilter)
{
// Do not load document until it was allowed.
- if (!isLinkUpdateAllowedInDoc(*mpDoc))
+ if (!isLinkUpdateAllowedInDoc(mrDoc))
return nullptr;
const SrcFileData* pFileData = getExternalFileData(nFileId);
@@ -2492,7 +2492,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
// to update as well. When loading the document ScDocShell::Load() will
// check through ScDocShell::GetLinkUpdateModeState() if its location is
// trusted.
- SfxObjectShell* pShell = mpDoc->GetDocumentShell();
+ SfxObjectShell* pShell = mrDoc.GetDocumentShell();
if (pShell)
{
SfxMedium* pMedium = pShell->GetMedium();
@@ -2518,7 +2518,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
SfxObjectShellRef aRef = pNewShell;
// increment the recursive link count of the source document.
- ScExtDocOptions* pExtOpt = mpDoc->GetExtDocOptions();
+ ScExtDocOptions* pExtOpt = mrDoc.GetExtDocOptions();
sal_uInt32 nLinkCount = pExtOpt ? pExtOpt->GetDocSettings().mnLinkCnt : 0;
ScDocument& rSrcDoc = pNewShell->GetDocument();
rSrcDoc.EnableExecuteLink(false); // to prevent circular access of external references.
@@ -2606,7 +2606,7 @@ void ScExternalRefManager::maybeLinkExternalFile( sal_uInt16 nFileId, bool bDefe
// Filter detection may access external links; defer it until we are allowed.
if (!bDeferFilterDetection)
- bDeferFilterDetection = !isLinkUpdateAllowedInDoc(*mpDoc);
+ bDeferFilterDetection = !isLinkUpdateAllowedInDoc(mrDoc);
// If a filter was already set (for example, loading the cached table),
// don't call GetFilterName which has to access the source file.
@@ -2614,13 +2614,13 @@ void ScExternalRefManager::maybeLinkExternalFile( sal_uInt16 nFileId, bool bDefe
// will update SrcFileData filter name.
if (aFilter.isEmpty() && !bDeferFilterDetection)
ScDocumentLoader::GetFilterName(*pFileName, aFilter, aOptions, true, false);
- sfx2::LinkManager* pLinkMgr = mpDoc->GetLinkManager();
+ sfx2::LinkManager* pLinkMgr = mrDoc.GetLinkManager();
if (!pLinkMgr)
{
SAL_WARN( "sc.ui", "ScExternalRefManager::maybeLinkExternalFile: pLinkMgr==NULL");
return;
}
- ScExternalRefLink* pLink = new ScExternalRefLink(mpDoc, nFileId);
+ ScExternalRefLink* pLink = new ScExternalRefLink(&mrDoc, nFileId);
OSL_ENSURE(pFileName, "ScExternalRefManager::maybeLinkExternalFile: file name pointer is NULL");
pLinkMgr->InsertFileLink(*pLink, sfx2::SvBaseLinkObjectType::ClientFile, *pFileName,
(aFilter.isEmpty() && bDeferFilterDetection ? nullptr : &aFilter));
@@ -2675,7 +2675,7 @@ OUString ScExternalRefManager::getOwnDocumentName() const
if (utl::ConfigManager::IsFuzzing())
return "file:///tmp/document";
- SfxObjectShell* pShell = mpDoc->GetDocumentShell();
+ SfxObjectShell* pShell = mrDoc.GetDocumentShell();
if (!pShell)
// This should not happen!
return OUString();
@@ -2704,7 +2704,7 @@ void ScExternalRefManager::convertToAbsName(OUString& rFile) const
pShell = static_cast<ScDocShell*>(SfxObjectShell::GetNext(*pShell, checkSfxObjectShell<ScDocShell>, false));
}
- SfxObjectShell* pDocShell = mpDoc->GetDocumentShell();
+ SfxObjectShell* pDocShell = mrDoc.GetDocumentShell();
rFile = ScGlobal::GetAbsDocName(rFile, pDocShell);
}
@@ -2909,7 +2909,7 @@ bool ScExternalRefManager::refreshSrcDocument(sal_uInt16 nFileId)
// Clear the existing cache, and refill it. Make sure we keep the
// existing cache table instances here.
maRefCache.clearCacheTables(nFileId);
- RefCacheFiller aAction(mpDoc->GetSharedStringPool(), maRefCache, nFileId);
+ RefCacheFiller aAction(mrDoc.GetSharedStringPool(), maRefCache, nFileId);
aCachedArea.executeColumnAction(rSrcDoc, aAction);
DocShellMap::iterator it = maDocShells.find(nFileId);
@@ -2945,21 +2945,21 @@ void ScExternalRefManager::breakLink(sal_uInt16 nFileId)
// Make a copy because removing the formula cells below will modify
// the original container.
RefCellSet aSet = itrRefs->second;
- for_each(aSet.begin(), aSet.end(), ConvertFormulaToStatic(mpDoc));
+ for_each(aSet.begin(), aSet.end(), ConvertFormulaToStatic(&mrDoc));
maRefCells.erase(nFileId);
}
// Remove all named ranges that reference this document.
// Global named ranges.
- ScRangeName* pRanges = mpDoc->GetRangeName();
+ ScRangeName* pRanges = mrDoc.GetRangeName();
if (pRanges)
removeRangeNamesBySrcDoc(*pRanges, nFileId);
// Sheet-local named ranges.
- for (SCTAB i = 0, n = mpDoc->GetTableCount(); i < n; ++i)
+ for (SCTAB i = 0, n = mrDoc.GetTableCount(); i < n; ++i)
{
- pRanges = mpDoc->GetRangeName(i);
+ pRanges = mrDoc.GetRangeName(i);
if (pRanges)
removeRangeNamesBySrcDoc(*pRanges, nFileId);
}
@@ -3126,7 +3126,7 @@ void ScExternalRefManager::purgeStaleSrcDocument(sal_Int32 nTimeOut)
maSrcDocTimer.Stop();
}
-sal_uInt32 ScExternalRefManager::getMappedNumberFormat(sal_uInt16 nFileId, sal_uInt32 nNumFmt, const ScDocument* pSrcDoc)
+sal_uInt32 ScExternalRefManager::getMappedNumberFormat(sal_uInt16 nFileId, sal_uInt32 nNumFmt, const ScDocument& rSrcDoc)
{
NumFmtMap::iterator itr = maNumFormatMap.find(nFileId);
if (itr == maNumFormatMap.end())
@@ -3140,8 +3140,8 @@ sal_uInt32 ScExternalRefManager::getMappedNumberFormat(sal_uInt16 nFileId, sal_u
return nNumFmt;
itr = r.first;
- mpDoc->GetFormatTable()->MergeFormatter( *pSrcDoc->GetFormatTable());
- SvNumberFormatterMergeMap aMap = mpDoc->GetFormatTable()->ConvertMergeTableToMap();
+ mrDoc.GetFormatTable()->MergeFormatter(*rSrcDoc.GetFormatTable());
+ SvNumberFormatterMergeMap aMap = mrDoc.GetFormatTable()->ConvertMergeTableToMap();
itr->second.swap(aMap);
}
const SvNumberFormatterMergeMap& rMap = itr->second;
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 4162f6869bc9..ca14676c6ed4 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -246,7 +246,7 @@ bool ScImportExport::StartPaste()
if( bUndo && pDocSh && rDoc.IsUndoEnabled())
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
+ pUndoDoc->InitUndo( rDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
rDoc.CopyToDocument(aRange, InsertDeleteFlags::ALL | InsertDeleteFlags::NOCAPTIONS, false, *pUndoDoc);
}
return true;
@@ -261,7 +261,7 @@ void ScImportExport::EndPaste(bool bAutoRowHeight)
if( pUndoDoc && rDoc.IsUndoEnabled() && pDocSh )
{
ScDocumentUniquePtr pRedoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pRedoDoc->InitUndo( &rDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
+ pRedoDoc->InitUndo( rDoc, aRange.aStart.Tab(), aRange.aEnd.Tab() );
rDoc.CopyToDocument(aRange, InsertDeleteFlags::ALL | InsertDeleteFlags::NOCAPTIONS, false, *pRedoDoc);
ScMarkData aDestMark(pRedoDoc->GetSheetLimits());
aDestMark.SetMarkArea(aRange);
@@ -1696,7 +1696,7 @@ bool ScImportExport::Doc2Text( SvStream& rStrm )
else
{
const Color* pColor;
- ScCellFormat::GetString(aCell, nNumFmt, aCellStr, &pColor, *pFormatter, &rDoc);
+ ScCellFormat::GetString(aCell, nNumFmt, aCellStr, &pColor, *pFormatter, rDoc);
bool bMultiLineText = ( aCellStr.indexOf( '\n' ) != -1 );
if( bMultiLineText )
@@ -1720,7 +1720,7 @@ bool ScImportExport::Doc2Text( SvStream& rStrm )
case CELLTYPE_VALUE:
{
const Color* pColor;
- ScCellFormat::GetString(aCell, nNumFmt, aCellStr, &pColor, *pFormatter, &rDoc);
+ ScCellFormat::GetString(aCell, nNumFmt, aCellStr, &pColor, *pFormatter, rDoc);
lcl_WriteSimpleString( rStrm, aCellStr );
}
break;
@@ -1729,7 +1729,7 @@ bool ScImportExport::Doc2Text( SvStream& rStrm )
default:
{
const Color* pColor;
- ScCellFormat::GetString(aCell, nNumFmt, aCellStr, &pColor, *pFormatter, &rDoc);
+ ScCellFormat::GetString(aCell, nNumFmt, aCellStr, &pColor, *pFormatter, rDoc);
bool bMultiLineText = ( aCellStr.indexOf( '\n' ) != -1 );
if( bMultiLineText )
@@ -2261,7 +2261,7 @@ bool ScImportExport::Dif2Doc( SvStream& rStrm )
{
SCTAB nTab = aRange.aStart.Tab();
ScDocumentUniquePtr pImportDoc( new ScDocument( SCDOCMODE_UNDO ) );
- pImportDoc->InitUndo( &rDoc, nTab, nTab );
+ pImportDoc->InitUndo( rDoc, nTab, nTab );
// for DIF in the clipboard, IBM_850 is always used
ScFormatFilter::Get().ScImportDif( rStrm, pImportDoc.get(), aRange.aStart, RTL_TEXTENCODING_IBM_850 );
diff --git a/sc/source/ui/docshell/macromgr.cxx b/sc/source/ui/docshell/macromgr.cxx
index 2cf9ad442fe8..9ef4a6bf13f9 100644
--- a/sc/source/ui/docshell/macromgr.cxx
+++ b/sc/source/ui/docshell/macromgr.cxx
@@ -89,9 +89,9 @@ private:
ModuleCellMap maCells;
};
-ScMacroManager::ScMacroManager(ScDocument* pDoc) :
+ScMacroManager::ScMacroManager(ScDocument& rDoc) :
mpDepTracker(new ScUserMacroDepTracker),
- mpDoc(pDoc)
+ mrDoc(rDoc)
{
}
@@ -133,7 +133,7 @@ void ScMacroManager::InitUserFuncData()
OUString sProjectName("Standard");
Reference< container::XContainer > xModuleContainer;
- SfxObjectShell* pShell = mpDoc->GetDocumentShell();
+ SfxObjectShell* pShell = mrDoc.GetDocumentShell();
if (!pShell)
return;
if (!pShell->GetBasicManager()->GetName().isEmpty())
@@ -186,11 +186,11 @@ void ScMacroManager::BroadcastModuleUpdate(const OUString& aModuleName)
mpDepTracker->getCellsByModule(aModuleName, aCells);
for (ScFormulaCell* pCell : aCells)
{
- mpDoc->PutInFormulaTree(pCell); // for F9 recalc
+ mrDoc.PutInFormulaTree(pCell); // for F9 recalc
// for recalc on cell value change. If the cell is not volatile, the
// cell stops listening right away after it gets re-interpreted.
- mpDoc->StartListeningArea(BCA_LISTEN_ALWAYS, false, pCell);
+ mrDoc.StartListeningArea(BCA_LISTEN_ALWAYS, false, pCell);
}
}
diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx
index 8b99085ffd16..76ea01eae3bc 100644
--- a/sc/source/ui/docshell/olinefun.cxx
+++ b/sc/source/ui/docshell/olinefun.cxx
@@ -219,7 +219,7 @@ bool ScOutlineDocFunc::RemoveAllOutlines( SCTAB nTab, bool bRecord )
SCROW nEndRow = nRow2;
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument(nStartCol, 0, nTab, nEndCol, rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
rDoc.CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
@@ -282,7 +282,7 @@ void ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord )
SCROW nOutEndRow = nRow2;
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument(nOutStartCol, 0, nTab, nOutEndCol, rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
rDoc.CopyToDocument(0, nOutStartRow, nTab, rDoc.MaxCol(), nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
}
@@ -335,14 +335,14 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
if (bColumns)
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true );
rDoc.CopyToDocument(static_cast<SCCOL>(nStart), 0, nTab,
static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false,
*pUndoDoc);
}
else
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
rDoc.CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
}
@@ -454,7 +454,7 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord )
{
std::unique_ptr<ScOutlineTable> pUndoTab(new ScOutlineTable( *pTable ));
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument(nStartCol, 0, nTab, nEndCol, rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
rDoc.CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
@@ -580,7 +580,7 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord )
{
std::unique_ptr<ScOutlineTable> pUndoTab(new ScOutlineTable( *pTable ));
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument(static_cast<SCCOL>(nEffStartCol), 0, nTab,
static_cast<SCCOL>(nEffEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE,
false, *pUndoDoc);
@@ -652,14 +652,14 @@ void ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
if (bColumns)
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true );
rDoc.CopyToDocument(static_cast<SCCOL>(nStart), 0, nTab,
static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false,
*pUndoDoc);
}
else
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
rDoc.CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
}
@@ -744,14 +744,14 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
if (bColumns)
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true );
rDoc.CopyToDocument(static_cast<SCCOL>(nStart), 0, nTab,
static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false,
*pUndoDoc);
}
else
{
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
rDoc.CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
}
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 6880ff6224db..ca0fdb98c591 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -236,7 +236,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
if (bAddUndo && bUndo)
{
if (bFirst)
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
else
pUndoDoc->AddUndoTab( nTab, nTab, true, true );
bFirst = false;
diff --git a/sc/source/ui/inc/dbfunc.hxx b/sc/source/ui/inc/dbfunc.hxx
index 139e9cc926a6..3ebff62821fd 100644
--- a/sc/source/ui/inc/dbfunc.hxx
+++ b/sc/source/ui/inc/dbfunc.hxx
@@ -111,7 +111,7 @@ public:
void UpdateCharts(bool bAllCharts); // Default: at the Cursor
- static sal_uInt16 DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc, bool bAllCharts );
+ static sal_uInt16 DoUpdateCharts( const ScAddress& rPos, ScDocument& rDoc, bool bAllCharts );
void OnLOKShowHideColRow(bool bColumns, SCCOLROW nStartRow);
};
diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx
index e16fd855a8bd..193d713d8123 100644
--- a/sc/source/ui/inc/printfun.hxx
+++ b/sc/source/ui/inc/printfun.hxx
@@ -136,7 +136,7 @@ public:
SCCOL nStartCol, SCCOL nEndCol,
SCTAB nPrintTab, Size const & aDocSize);
- void calculate(ScDocument* pDoc, bool bSkipEmpty, bool bPrintArea,
+ void calculate(ScDocument& rDoc, bool bSkipEmpty, bool bPrintArea,
SCROW nStartRow, SCROW nEndRow, SCCOL nStartCol, SCCOL nEndCol,
SCTAB nPrintTab, Size const & aDocSize);
};
@@ -190,7 +190,7 @@ class ScPrintFunc
{
private:
ScDocShell* pDocShell;
- ScDocument* pDoc;
+ ScDocument& rDoc;
VclPtr<SfxPrinter> pPrinter;
VclPtr<OutputDevice> pDev;
FmFormView* pDrawView;
@@ -296,8 +296,8 @@ public:
~ScPrintFunc();
- static void DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double nPrintFactor,
- const tools::Rectangle& rBound, ScViewData* pViewData, bool bMetaFile );
+ static void DrawToDev( ScDocument* rDoc, OutputDevice* pDev, double nPrintFactor,
+ const tools::Rectangle& rBound, ScViewData* pViewData, bool bMetaFile );
void SetDrawView( FmFormView* pNew );
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 2c2aa60f5031..f07c7e01a57d 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -322,10 +322,10 @@ bool ScAcceptChgDlg::IsValidAction(const ScChangeAction* pScChangeAction)
if(eType==SC_CAT_CONTENT)
{
if(!pScChangeAction->IsDialogParent())
- pScChangeAction->GetDescription(aDesc, pDoc, true);
+ pScChangeAction->GetDescription(aDesc, *pDoc, true);
}
else
- pScChangeAction->GetDescription(aDesc, pDoc, !pScChangeAction->IsMasterDelete());
+ pScChangeAction->GetDescription(aDesc, *pDoc, !pScChangeAction->IsMasterDelete());
if (!aDesc.isEmpty())
{
@@ -394,7 +394,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction(
else
{
aBuf.append(*MakeTypeString(eType));
- pScChangeAction->GetDescription( aDesc, pDoc, true);
+ pScChangeAction->GetDescription( aDesc, *pDoc, true);
}
}
else
@@ -403,16 +403,16 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendChangeAction(
if(bDelMaster)
{
- pScChangeAction->GetDescription( aDesc, pDoc,true);
+ pScChangeAction->GetDescription( aDesc, *pDoc,true);
pNewData->bDisabled=true;
pNewData->bIsRejectable=false;
}
else
- pScChangeAction->GetDescription( aDesc, pDoc,!pScChangeAction->IsMasterDelete());
+ pScChangeAction->GetDescription( aDesc, *pDoc, !pScChangeAction->IsMasterDelete());
}
- pScChangeAction->GetRefString(aRefStr, pDoc, true);
+ pScChangeAction->GetRefString(aRefStr, *pDoc, true);
aBuf.append('\t');
aBuf.append(aRefStr);
@@ -565,7 +565,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendFilteredAction(
else
{
aActionString=*MakeTypeString(eType);
- pScChangeAction->GetDescription( aDesc, pDoc, true);
+ pScChangeAction->GetDescription( aDesc, *pDoc, true);
}
}
else
@@ -574,12 +574,12 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendFilteredAction(
if(bDelMaster)
{
- pScChangeAction->GetDescription( aDesc, pDoc,true);
+ pScChangeAction->GetDescription( aDesc, *pDoc,true);
pNewData->bDisabled=true;
pNewData->bIsRejectable=false;
}
else
- pScChangeAction->GetDescription( aDesc, pDoc,!pScChangeAction->IsMasterDelete());
+ pScChangeAction->GetDescription( aDesc, *pDoc,!pScChangeAction->IsMasterDelete());
}
@@ -597,7 +597,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::AppendFilteredAction(
rTreeView.insert(pParent, -1, &aActionString, &sId, nullptr, nullptr, bCreateOnDemand, xEntry.get());
OUString aRefStr;
- pScChangeAction->GetRefString(aRefStr, pDoc, true);
+ pScChangeAction->GetRefString(aRefStr, *pDoc, true);
rTreeView.set_text(*xEntry, aRefStr, 1);
if (!bIsGenerated)
@@ -685,7 +685,7 @@ std::unique_ptr<weld::TreeIter> ScAcceptChgDlg::InsertChangeActionContent(const
aDesc += a2String;
aString += "\t";
- pScChangeAction->GetRefString(aRefStr, pDoc, true);
+ pScChangeAction->GetRefString(aRefStr, *pDoc, true);
aString += aRefStr + "\t";
if(!bIsGenerated)
@@ -1584,7 +1584,7 @@ IMPL_LINK_NOARG(ScAcceptChgDlg, UpdateSelectionHdl, Timer *, void)
for (size_t i = 0, nCount = aActions.size(); i < nCount; ++i)
{
const ScBigRange& rBigRange = aActions[i]->GetBigRange();
- if (rBigRange.IsValid(pDoc) && m_xDialog->has_toplevel_focus())
+ if (rBigRange.IsValid(*pDoc) && m_xDialog->has_toplevel_focus())
{
bool bSetCursor = i == nCount - 1;
pTabView->MarkRange(rBigRange.MakeRange(), bSetCursor, bContMark);
diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx
index d05007d984f2..577706782e98 100644
--- a/sc/source/ui/miscdlgs/conflictsdlg.cxx
+++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx
@@ -402,12 +402,12 @@ void ScConflictsDlg::SetActionString(const ScChangeAction* pAction, ScDocument*
{
OSL_ENSURE( pAction, "ScConflictsDlg::GetActionString(): pAction is null!" );
OSL_ENSURE( pDoc, "ScConflictsDlg::GetActionString(): pDoc is null!" );
- if (!(pAction && pDoc))
+ if (!pAction || !pDoc)
return;
weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
OUString aDesc;
- pAction->GetDescription(aDesc, pDoc, true, false);
+ pAction->GetDescription(aDesc, *pDoc, true, false);
rTreeView.set_text(rEntry, aDesc, 0);
OUString aUser = comphelper::string::strip(pAction->GetUser(), ' ');
@@ -497,7 +497,7 @@ IMPL_LINK_NOARG(ScConflictsDlg, UpdateSelectionHdl, Timer *, void)
for (size_t i = 0, nCount = aActions.size(); i < nCount; ++i)
{
const ScBigRange& rBigRange = aActions[i]->GetBigRange();
- if (rBigRange.IsValid(mpOwnDoc))
+ if (rBigRange.IsValid(*mpOwnDoc))
{
bool bSetCursor = i == nCount - 1;
pTabView->MarkRange(rBigRange.MakeRange(), bSetCursor, bContMark);
diff --git a/sc/source/ui/miscdlgs/redcom.cxx b/sc/source/ui/miscdlgs/redcom.cxx
index cd18917408d1..6af353bb8ef4 100644
--- a/sc/source/ui/miscdlgs/redcom.cxx
+++ b/sc/source/ui/miscdlgs/redcom.cxx
@@ -99,7 +99,7 @@ void ScRedComDialog::ReInit(ScChangeAction *pAction)
return;
OUString aTitle;
- pChangeAction->GetDescription( aTitle, &pDocShell->GetDocument());
+ pChangeAction->GetDescription(aTitle, pDocShell->GetDocument());
pDlg->SetText(aTitle);
aComment=pChangeAction->GetComment();
@@ -136,7 +136,7 @@ void ScRedComDialog::SelectCell()
const ScChangeAction* pAction=pChangeAction;
const ScBigRange& rRange = pAction->GetBigRange();
- if(rRange.IsValid(&pDocShell->GetDocument()))
+ if(rRange.IsValid(pDocShell->GetDocument()))
{
ScViewData* pViewData=ScDocShell::GetViewData();
ScRange aRef=rRange.MakeRange();
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index d7358831d75f..4c966c4ae890 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -1391,7 +1391,7 @@ void ScUndoRefreshLink::Undo()
if (bMakeRedo)
{
if (bFirst)
- xRedoDoc->InitUndo(&rDoc, nTab, nTab, true, true);
+ xRedoDoc->InitUndo(rDoc, nTab, nTab, true, true);
else
xRedoDoc->AddUndoTab(nTab, nTab, true, true);
bFirst = false;
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index 5463cd509b69..f9956bded40c 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -904,7 +904,7 @@ void ScUndoImportTab::Undo()
if (bMakeRedo)
{
xRedoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- xRedoDoc->InitUndo(&rDoc, nTab,nTab+nCount-1, true, true);
+ xRedoDoc->InitUndo(rDoc, nTab,nTab+nCount-1, true, true);
OUString aOldName;
for (i=0; i<nCount; i++)
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index d31180a0f4bf..c9ddf00d91ff 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -926,13 +926,13 @@ static SCTAB lcl_FirstTab( const ScRangeList& rRanges )
return rFirst.aStart.Tab();
}
-static bool lcl_WholeSheet( const ScDocument* pDoc, const ScRangeList& rRanges )
+static bool lcl_WholeSheet( const ScDocument& rDoc, const ScRangeList& rRanges )
{
if ( rRanges.size() == 1 )
{
const ScRange & rRange = rRanges[0];
- if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == pDoc->MaxCol() &&
- rRange.aStart.Row() == 0 && rRange.aEnd.Row() == pDoc->MaxRow() )
+ if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == rDoc.MaxCol() &&
+ rRange.aStart.Row() == 0 && rRange.aEnd.Row() == rDoc.MaxRow() )
return true;
}
return false;
@@ -1069,7 +1069,7 @@ void ScHelperFunctions::ApplyBorder( ScDocShell* pDocShell, const ScRangeList& r
if (bUndo)
{
if ( i==0 )
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
else
pUndoDoc->AddUndoTab( nTab, nTab );
rDoc.CopyToDocument(rRange, InsertDeleteFlags::ATTRIB, false, *pUndoDoc);
@@ -1130,7 +1130,7 @@ static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
if ( bUndo )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
rDoc.CopyToDocument(rRange, InsertDeleteFlags::CONTENTS|InsertDeleteFlags::NOCAPTIONS, false, *pUndoDoc);
}
@@ -1265,7 +1265,7 @@ static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
if ( bUndo )
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
rDoc.CopyToDocument(rRange, InsertDeleteFlags::CONTENTS, false, *pUndoDoc);
}
@@ -3811,7 +3811,7 @@ uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll(
ScDocument& rDoc = pDocShell->GetDocument();
pSearchItem->SetCommand( SvxSearchCmd::FIND_ALL );
// always only within this object
- pSearchItem->SetSelection( !lcl_WholeSheet(&rDoc, aRanges) );
+ pSearchItem->SetSelection( !lcl_WholeSheet(rDoc, aRanges) );
ScMarkData aMark(*GetMarkData());
@@ -3849,7 +3849,7 @@ uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl(
ScDocument& rDoc = pDocShell->GetDocument();
pSearchItem->SetCommand( SvxSearchCmd::FIND );
// only always in this object
- pSearchItem->SetSelection( !lcl_WholeSheet(&rDoc, aRanges) );
+ pSearchItem->SetSelection( !lcl_WholeSheet(rDoc, aRanges) );
ScMarkData aMark(*GetMarkData());
@@ -3931,7 +3931,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea
bool bUndo(rDoc.IsUndoEnabled());
pSearchItem->SetCommand( SvxSearchCmd::REPLACE_ALL );
// only always in this object
- pSearchItem->SetSelection( !lcl_WholeSheet(&rDoc, aRanges) );
+ pSearchItem->SetSelection( !lcl_WholeSheet(rDoc, aRanges) );
ScMarkData aMark(*GetMarkData());
@@ -3959,7 +3959,7 @@ sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSea
if (bUndo)
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
}
for (const auto& rTab : aMark)
{
@@ -4565,9 +4565,9 @@ uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getSupportedServiceNames()
SCPARAPROPERTIES_SERVICE};
}
-uno::Reference<table::XCellRange> ScCellRangeObj::CreateRangeFromDoc( const ScDocument* pDoc, const ScRange& rR )
+uno::Reference<table::XCellRange> ScCellRangeObj::CreateRangeFromDoc( const ScDocument& rDoc, const ScRange& rR )
{
- SfxObjectShell* pObjSh = pDoc->GetDocumentShell();
+ SfxObjectShell* pObjSh = rDoc.GetDocumentShell();
if ( auto pDocShell = dynamic_cast<ScDocShell*>( pObjSh) )
return new ScCellRangeObj( pDocShell, rR );
return nullptr;
@@ -5065,7 +5065,7 @@ void SAL_CALL ScCellRangeObj::setFormulaArray(
ScDocShell* pDocSh = GetDocShell();
if (pDocSh)
{
- ScExternalRefManager::ApiGuard aExtRefGuard(&pDocSh->GetDocument());
+ ScExternalRefManager::ApiGuard aExtRefGuard(pDocSh->GetDocument());
// GRAM_API for API compatibility.
bDone = lcl_PutFormulaArray( *pDocSh, aRange, aArray, formula::FormulaGrammar::GRAM_API );
@@ -6880,7 +6880,7 @@ void SAL_CALL ScTableSheetObj::removeAllManualPageBreaks()
if (bUndo)
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
pDocSh->GetUndoManager()->AddUndoAction(
std::make_unique<ScUndoRemoveBreaks>( pDocSh, nTab, std::move(pUndoDoc) ) );
diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx
index 4f461777c056..3de405b605b2 100644
--- a/sc/source/ui/unoobj/tokenuno.cxx
+++ b/sc/source/ui/unoobj/tokenuno.cxx
@@ -131,7 +131,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScFormulaParserObj::parseFormula(
if (mpDocShell)
{
ScDocument& rDoc = mpDocShell->GetDocument();
- ScExternalRefManager::ApiGuard aExtRefGuard(&rDoc);
+ ScExternalRefManager::ApiGuard aExtRefGuard(rDoc);
ScAddress aRefPos( ScAddress::UNINITIALIZED );
ScUnoConversion::FillScAddress( aRefPos, rReferencePos );
diff --git a/sc/source/ui/view/dbfunc2.cxx b/sc/source/ui/view/dbfunc2.cxx
index f5b8cf6cba77..fffa16909f63 100644
--- a/sc/source/ui/view/dbfunc2.cxx
+++ b/sc/source/ui/view/dbfunc2.cxx
@@ -31,7 +31,7 @@ void ScDBFunc::UpdateCharts( bool bAllCharts )
nFound = DoUpdateCharts( ScAddress( rViewData.GetCurX(),
rViewData.GetCurY(),
rViewData.GetTabNo()),
- &rDoc,
+ rDoc,
bAllCharts );
if ( !nFound && !bAllCharts )
diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx
index cdfb2a7eb717..22263116da5b 100644
--- a/sc/source/ui/view/dbfunc3.cxx
+++ b/sc/source/ui/view/dbfunc3.cxx
@@ -503,12 +503,12 @@ void ScDBFunc::DoSubTotals( const ScSubTotalParam& rParam, bool bRecord,
pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol );
pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow );
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
rDoc.CopyToDocument( 0, nOutStartRow, nTab, rDoc.MaxCol(), nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
}
else
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, bOldFilter );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, bOldFilter );
// record data range - including filter results
rDoc.CopyToDocument( 0,rParam.nRow1+1,nTab, rDoc.MaxCol(),rParam.nRow2,nTab,
@@ -2178,12 +2178,12 @@ void ScDBFunc::RepeatDB( bool bRecord )
pTable->GetColArray().GetRange( nOutStartCol, nOutEndCol );
pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow );
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument( static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
rDoc.CopyToDocument( 0, nOutStartRow, nTab, rDoc.MaxCol(), nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
}
else
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
// Record data range - including filter results
rDoc.CopyToDocument( 0,nStartRow,nTab, rDoc.MaxCol(),nEndRow,nTab, InsertDeleteFlags::ALL, false, *pUndoDoc );
diff --git a/sc/source/ui/view/dbfunc4.cxx b/sc/source/ui/view/dbfunc4.cxx
index 786299e88853..0ac150e9b84e 100644
--- a/sc/source/ui/view/dbfunc4.cxx
+++ b/sc/source/ui/view/dbfunc4.cxx
@@ -27,9 +27,9 @@
using namespace com::sun::star;
-sal_uInt16 ScDBFunc::DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc, bool bAllCharts )
+sal_uInt16 ScDBFunc::DoUpdateCharts( const ScAddress& rPos, ScDocument& rDoc, bool bAllCharts )
{
- ScDrawLayer* pModel = pDoc->GetDrawLayer();
+ ScDrawLayer* pModel = rDoc.GetDrawLayer();
if (!pModel)
return 0;
@@ -54,12 +54,12 @@ sal_uInt16 ScDBFunc::DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc, bo
ScRangeList aRanges;
bool bColHeaders = false;
bool bRowHeaders = false;
- pDoc->GetOldChartParameters( aName, aRanges, bColHeaders, bRowHeaders );
+ rDoc.GetOldChartParameters( aName, aRanges, bColHeaders, bRowHeaders );
bHit = aRanges.In( rPos );
}
if ( bHit )
{
- pDoc->UpdateChart( aName );
+ rDoc.UpdateChart( aName );
++nFound;
}
}
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index f9f20670a991..899b85677dd3 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -139,7 +139,7 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard )
aTrackText += aComStr + "\n( ";
}
OUString aTmp;
- pFound->GetDescription(aTmp, &rDoc);
+ pFound->GetDescription(aTmp, rDoc);
aTrackText += aTmp;
if(!aComStr.isEmpty())
{
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 62beb6a35a88..6d123bccacf6 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -495,7 +495,7 @@ bool ScDrawStringsVars::SetText( const ScRefCellValue& rCell )
ScCellFormat::GetString( rCell,
nFormat, aString, &pColor,
*pOutput->mpDoc->GetFormatTable(),
- pOutput->mpDoc,
+ *pOutput->mpDoc,
pOutput->mbShowNullValues,
pOutput->mbShowFormulas,
true );
@@ -2375,7 +2375,7 @@ bool ScOutputData::DrawEditParam::readCellContent(
ScCellFormat::GetString( maCell,
nFormat,aString, &pColor,
*pDoc->GetFormatTable(),
- pDoc,
+ *pDoc,
bShowNullValues,
bShowFormulas);
@@ -4701,7 +4701,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic)
ScCellFormat::GetString( aCell,
nFormat,aString, &pColor,
*mpDoc->GetFormatTable(),
- mpDoc,
+ *mpDoc,
mbShowNullValues,
mbShowFormulas);
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 5b368d17023d..6df09e30d195 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -154,9 +154,8 @@ static long lcl_LineTotal(const ::editeng::SvxBorderLine* pLine)
void ScPrintFunc::Construct( const ScPrintOptions* pOptions )
{
pDocShell->UpdatePendingRowHeights( nPrintTab );
- pDoc = &pDocShell->GetDocument();
- SfxPrinter* pDocPrinter = pDoc->GetPrinter(); // use the printer, even for preview
+ SfxPrinter* pDocPrinter = rDoc.GetPrinter(); // use the printer, even for preview
if (pDocPrinter)
aOldPrinterMode = pDocPrinter->GetMapMode();
@@ -171,9 +170,9 @@ void ScPrintFunc::Construct( const ScPrintOptions* pOptions )
pEditEngine = nullptr;
pEditDefaults = nullptr;
- ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool();
+ ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool();
SfxStyleSheetBase* pStyleSheet = pStylePool->Find(
- pDoc->GetPageStyle( nPrintTab ),
+ rDoc.GetPageStyle( nPrintTab ),
SfxStyleFamily::Page );
if (pStyleSheet)
pParamSet = &pStyleSheet->GetItemSet();
@@ -200,6 +199,7 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, SfxPrinter* pNewPrinter, SCTAB nTa
const ScPrintOptions* pOptions,
ScPageBreakData* pData )
: pDocShell ( pShell ),
+ rDoc(pDocShell->GetDocument()),
pPrinter ( pNewPrinter ),
pDrawView ( nullptr ),
nPrintTab ( nTab ),
@@ -224,6 +224,7 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, SfxPrinter* pNewPrinter, SCTAB nTa
ScPrintFunc::ScPrintFunc(ScDocShell* pShell, SfxPrinter* pNewPrinter,
const ScPrintState& rState, const ScPrintOptions* pOptions)
: pDocShell ( pShell ),
+ rDoc(pDocShell->GetDocument()),
pPrinter ( pNewPrinter ),
pDrawView ( nullptr ),
pUserArea ( nullptr ),
@@ -267,6 +268,7 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell, SCTAB nTab,
long nPage, long nDocP, const ScRange* pArea,
const ScPrintOptions* pOptions )
: pDocShell ( pShell ),
+ rDoc(pDocShell->GetDocument()),
pPrinter ( nullptr ),
pDrawView ( nullptr ),
nPrintTab ( nTab ),
@@ -290,6 +292,7 @@ ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell, SCTAB nTab,
ScPrintFunc::ScPrintFunc( OutputDevice* pOutDev, ScDocShell* pShell,
const ScPrintState& rState, const ScPrintOptions* pOptions )
: pDocShell ( pShell ),
+ rDoc(pDocShell->GetDocument()),
pPrinter ( nullptr ),
pDrawView ( nullptr ),
pUserArea ( nullptr ),
@@ -404,7 +407,7 @@ ScPrintFunc::~ScPrintFunc()
// Printer settings are now restored from outside
// For DrawingLayer/Charts, the MapMode of the printer (RefDevice) must always be correct
- SfxPrinter* pDocPrinter = pDoc->GetPrinter(); // use Preview also for the printer
+ SfxPrinter* pDocPrinter = rDoc.GetPrinter(); // use Preview also for the printer
if (pDocPrinter)
pDocPrinter->SetMapMode(aOldPrinterMode);
}
@@ -688,15 +691,15 @@ bool ScPrintFunc::AdjustPrintArea( bool bNew )
{
nStartCol = 0;
nStartRow = 0;
- if (!pDoc->GetPrintArea( nPrintTab, nEndCol, nEndRow, bNotes ))
+ if (!rDoc.GetPrintArea( nPrintTab, nEndCol, nEndRow, bNotes ))
return false; // nothing
bPrintAreaValid = true;
}
else
{
bool bFound = true;
- bChangeCol = ( nStartCol == 0 && nEndCol == pDoc->MaxCol() );
- bChangeRow = ( nStartRow == 0 && nEndRow == pDoc->MaxRow() );
+ bChangeCol = ( nStartCol == 0 && nEndCol == rDoc.MaxCol() );
+ bChangeRow = ( nStartRow == 0 && nEndRow == rDoc.MaxRow() );
bool bForcedChangeRow = false;
// #i53558# Crop entire column of old row limit to real print area with
@@ -704,7 +707,7 @@ bool ScPrintFunc::AdjustPrintArea( bool bNew )
if (!bChangeRow && nStartRow == 0)
{
SCROW nPAEndRow;
- bFound = pDoc->GetPrintAreaVer( nPrintTab, nStartCol, nEndCol, nPAEndRow, bNotes );
+ bFound = rDoc.GetPrintAreaVer( nPrintTab, nStartCol, nEndCol, nPAEndRow, bNotes );
// Say we don't want to print more than ~1000 empty rows, which are
// about 14 pages intentionally left blank...
const SCROW nFuzzy = 23*42;
@@ -720,11 +723,11 @@ bool ScPrintFunc::AdjustPrintArea( bool bNew )
// same for horizontal cropping.
if ( bChangeCol && bChangeRow )
- bFound = pDoc->GetPrintArea( nPrintTab, nEndCol, nEndRow, bNotes );
+ bFound = rDoc.GetPrintArea( nPrintTab, nEndCol, nEndRow, bNotes );
else if ( bChangeCol )
- bFound = pDoc->GetPrintAreaHor( nPrintTab, nStartRow, nEndRow, nEndCol );
+ bFound = rDoc.GetPrintAreaHor( nPrintTab, nStartRow, nEndRow, nEndCol );
else if ( bChangeRow )
- bFound = pDoc->GetPrintAreaVer( nPrintTab, nStartCol, nEndCol, nEndRow, bNotes );
+ bFound = rDoc.GetPrintAreaVer( nPrintTab, nStartCol, nEndCol, nEndRow, bNotes );
if (!bFound)
return false; // empty
@@ -735,22 +738,22 @@ bool ScPrintFunc::AdjustPrintArea( bool bNew )
}
assert( bPrintAreaValid );
- pDoc->ExtendMerge( nStartCol,nStartRow, nEndCol,nEndRow, nPrintTab ); // no Refresh, incl. Attrs
+ rDoc.ExtendMerge( nStartCol,nStartRow, nEndCol,nEndRow, nPrintTab ); // no Refresh, incl. Attrs
if ( bChangeCol )
{
- OutputDevice* pRefDev = pDoc->GetPrinter(); // use the printer also for Preview
+ OutputDevice* pRefDev = rDoc.GetPrinter(); // use the printer also for Preview
pRefDev->SetMapMode(MapMode(MapUnit::MapPixel)); // important for GetNeededSize
- pDoc->ExtendPrintArea( pRefDev,
+ rDoc.ExtendPrintArea( pRefDev,
nPrintTab, nStartCol, nStartRow, nEndCol, nEndRow );
// changing nEndCol
}
- if ( nEndCol < pDoc->MaxCol() && pDoc->HasAttrib(
+ if ( nEndCol < rDoc.MaxCol() && rDoc.HasAttrib(
nEndCol,nStartRow,nPrintTab, nEndCol,nEndRow,nPrintTab, HasAttrFlags::ShadowRight ) )
++nEndCol;
- if ( nEndRow < pDoc->MaxRow() && pDoc->HasAttrib(
+ if ( nEndRow < rDoc.MaxRow() && rDoc.HasAttrib(
nStartCol,nEndRow,nPrintTab, nEndCol,nEndRow,nPrintTab, HasAttrFlags::ShadowDown ) )
++nEndRow;
@@ -971,15 +974,15 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions )
// TabPage "Parts":
//! walk through all PrintAreas of the table !!!
- const ScRange* pPrintArea = pDoc->GetPrintRange( nPrintTab, 0 );
- const ScRange* pRepeatCol = pDoc->GetRepeatColRange( nPrintTab );
- const ScRange* pRepeatRow = pDoc->GetRepeatRowRange( nPrintTab );
+ const ScRange* pPrintArea = rDoc.GetPrintRange( nPrintTab, 0 );
+ const ScRange* pRepeatCol = rDoc.GetRepeatColRange( nPrintTab );
+ const ScRange* pRepeatRow = rDoc.GetRepeatRowRange( nPrintTab );
// ignoring ATTR_PAGE_PRINTTABLES
- bool bHasPrintRange = pDoc->HasPrintRange();
- sal_uInt16 nPrintRangeCount = pDoc->GetPrintRangeCount(nPrintTab);
- bool bPrintEntireSheet = pDoc->IsPrintEntireSheet(nPrintTab);
+ bool bHasPrintRange = rDoc.HasPrintRange();
+ sal_uInt16 nPrintRangeCount = rDoc.GetPrintRangeCount(nPrintTab);
+ bool bPrintEntireSheet = rDoc.IsPrintEntireSheet(nPrintTab);
if (!bPrintEntireSheet && !nPrintRangeCount)
mbHasPrintRange = false;
@@ -1007,14 +1010,14 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions )
else
{
// do not print hidden sheets with "Print entire sheet" flag
- bPrintCurrentTable = pDoc->IsPrintEntireSheet( nPrintTab ) && pDoc->IsVisible( nPrintTab );
+ bPrintCurrentTable = rDoc.IsPrintEntireSheet( nPrintTab ) && rDoc.IsVisible( nPrintTab );
aAreaParam.bPrintArea = !bPrintCurrentTable; // otherwise the table is always counted
}
}
else
{
// don't print hidden tables if there's no print range defined there
- if ( pDoc->IsVisible( nPrintTab ) )
+ if ( rDoc.IsVisible( nPrintTab ) )
{
aAreaParam.bPrintArea = false;
bPrintCurrentTable = true;
@@ -1301,7 +1304,7 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH,
if ( bIsRender )
pRefDev = pDev; // don't use printer for PDF
else
- pRefDev = pDoc->GetPrinter(); // use printer also for preview
+ pRefDev = rDoc.GetPrinter(); // use printer also for preview
OUString referer;
if (pDocShell->HasName()) {
referer = pDocShell->GetMedium()->GetName();
@@ -1367,7 +1370,7 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH,
return;
ScDocumentUniquePtr pBorderDoc(new ScDocument( SCDOCMODE_UNDO ));
- pBorderDoc->InitUndo( pDoc, 0,0, true,true );
+ pBorderDoc->InitUndo( rDoc, 0,0, true,true );
pBorderDoc->ApplyAttr( 0,0,0, *pBorderData );
ScTableInfo aTabInfo;
@@ -1388,7 +1391,7 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH,
void ScPrintFunc::PrintColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY )
{
- bool bLayoutRTL = pDoc->IsLayoutRTL( nPrintTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nPrintTab );
long nLayoutSign = bLayoutRTL ? -1 : 1;
Size aOnePixel = pDev->PixelToLogic(Size(1,1));
@@ -1403,7 +1406,7 @@ void ScPrintFunc::PrintColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY )
if ( bLayoutRTL )
{
for (nCol=nX1; nCol<=nX2; nCol++)
- nPosX += static_cast<long>( pDoc->GetColWidth( nCol, nPrintTab ) * nScaleX );
+ nPosX += static_cast<long>( rDoc.GetColWidth( nCol, nPrintTab ) * nScaleX );
}
else
nPosX -= nOneX;
@@ -1412,7 +1415,7 @@ void ScPrintFunc::PrintColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY )
for (nCol=nX1; nCol<=nX2; nCol++)
{
- sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nPrintTab );
+ sal_uInt16 nDocW = rDoc.GetColWidth( nCol, nPrintTab );
if (nDocW)
{
long nWidth = static_cast<long>(nDocW * nScaleX);
@@ -1441,7 +1444,7 @@ void ScPrintFunc::PrintRowHdr( SCROW nY1, SCROW nY2, long nScrX, long nScrY )
long nOneX = aOnePixel.Width();
long nOneY = aOnePixel.Height();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nPrintTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nPrintTab );
long nWidth = static_cast<long>(PRINT_HEADER_WIDTH * nScaleX);
long nEndX = nScrX + nWidth;
@@ -1456,7 +1459,7 @@ void ScPrintFunc::PrintRowHdr( SCROW nY1, SCROW nY2, long nScrX, long nScrY )
for (SCROW nRow=nY1; nRow<=nY2; nRow++)
{
- sal_uInt16 nDocH = pDoc->GetRowHeight( nRow, nPrintTab );
+ sal_uInt16 nDocH = rDoc.GetRowHeight( nRow, nPrintTab );
if (nDocH)
{
long nHeight = static_cast<long>(nDocH * nScaleY);
@@ -1489,7 +1492,7 @@ void ScPrintFunc::LocateColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY,
long nPosX = nScrX - nOneX;
for (SCCOL nCol=nX1; nCol<=nX2; nCol++)
{
- sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nPrintTab );
+ sal_uInt16 nDocW = rDoc.GetColWidth( nCol, nPrintTab );
if (nDocW)
nPosX += static_cast<long>(nDocW * nScaleX);
}
@@ -1504,7 +1507,7 @@ void ScPrintFunc::LocateRowHdr( SCROW nY1, SCROW nY2, long nScrX, long nScrY,
long nOneX = aOnePixel.Width();
long nOneY = aOnePixel.Height();
- bool bLayoutRTL = pDoc->IsLayoutRTL( nPrintTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nPrintTab );
long nWidth = static_cast<long>(PRINT_HEADER_WIDTH * nScaleX);
long nEndX = nScrX + nWidth;
@@ -1512,7 +1515,7 @@ void ScPrintFunc::LocateRowHdr( SCROW nY1, SCROW nY2, long nScrX, long nScrY,
nEndX -= nOneX;
long nPosY = nScrY - nOneY;
- nPosY += pDoc->GetScaledRowHeight( nY1, nY2, nPrintTab, nScaleY);
+ nPosY += rDoc.GetScaledRowHeight( nY1, nY2, nPrintTab, nScaleY);
tools::Rectangle aCellRect( nScrX, nScrY, nEndX, nPosY );
rLocationData.AddRowHeaders( aCellRect, nY1, nY2, bRepRow );
}
@@ -1530,8 +1533,8 @@ void ScPrintFunc::LocateArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
SCCOL nCol;
Point aTwipOffset;
for (nCol=0; nCol<nX1; nCol++)
- aTwipOffset.AdjustX( -(pDoc->GetColWidth( nCol, nPrintTab )) );
- aTwipOffset.AdjustY( -sal_Int32(pDoc->GetRowHeight( 0, nY1-1, nPrintTab )) );
+ aTwipOffset.AdjustX( -(rDoc.GetColWidth( nCol, nPrintTab )) );
+ aTwipOffset.AdjustY( -sal_Int32(rDoc.GetRowHeight( 0, nY1-1, nPrintTab )) );
Point aMMOffset( aTwipOffset );
aMMOffset.setX( static_cast<long>(aMMOffset.X() * HMM_PER_TWIPS) );
@@ -1548,13 +1551,13 @@ void ScPrintFunc::LocateArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
long nPosX = nScrX - nOneX;
for (nCol=nX1; nCol<=nX2; nCol++)
{
- sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nPrintTab );
+ sal_uInt16 nDocW = rDoc.GetColWidth( nCol, nPrintTab );
if (nDocW)
nPosX += static_cast<long>(nDocW * nScaleX);
}
long nPosY = nScrY - nOneY;
- nPosY += pDoc->GetScaledRowHeight( nY1, nY2, nPrintTab, nScaleY);
+ nPosY += rDoc.GetScaledRowHeight( nY1, nY2, nPrintTab, nScaleY);
tools::Rectangle aCellRect( nScrX, nScrY, nPosX, nPosY );
rLocationData.AddCellRange( aCellRect, ScRange( nX1,nY1,nPrintTab, nX2,nY2,nPrintTab ),
bRepCol, bRepRow, aDrawMapMode );
@@ -1571,11 +1574,11 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
//! hand over Flag at FillInfo !!!!!
ScRange aERange;
- bool bEmbed = pDoc->IsEmbedded();
+ bool bEmbed = rDoc.IsEmbedded();
if (bEmbed)
{
- pDoc->GetEmbedded(aERange);
- pDoc->ResetEmbedded();
+ rDoc.GetEmbedded(aERange);
+ rDoc.ResetEmbedded();
}
Point aPos = OutputDevice::LogicToLogic(Point(nScrX,nScrY), aOffsetMode, aLogicMode);
@@ -1585,14 +1588,14 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
// Assemble data
ScTableInfo aTabInfo;
- pDoc->FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nPrintTab,
+ rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nPrintTab,
nScaleX, nScaleY, true, aTableParam.bFormulas );
lcl_HidePrint( aTabInfo, nX1, nX2 );
if (bEmbed)
- pDoc->SetEmbedded(aERange);
+ rDoc.SetEmbedded(aERange);
- ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pDoc, nPrintTab,
+ ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, &rDoc, nPrintTab,
nScrX, nScrY, nX1, nY1, nX2, nY2, nScaleX, nScaleY );
aOutputData.SetDrawView( pDrawView );
@@ -1624,7 +1627,7 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
if ( !pPrinter )
{
- OutputDevice* pRefDev = pDoc->GetPrinter(); // use the printer also for Preview
+ OutputDevice* pRefDev = rDoc.GetPrinter(); // use the printer also for Preview
Fraction aPrintFrac( nZoom, 100 ); // without nManualZoom
// MapMode, as it would arrive at the printer:
pRefDev->SetMapMode( MapMode( MapUnit::Map100thMM, Point(), aPrintFrac, aPrintFrac ) );
@@ -1687,7 +1690,7 @@ bool ScPrintFunc::IsLeft( long nPageNo ) // left foot notes?
void ScPrintFunc::MakeTableString()
{
OUString aTmp;
- pDoc->GetName(nPrintTab, aTmp);
+ rDoc.GetName(nPrintTab, aTmp);
aFieldData.aTabName = aTmp;
}
@@ -1703,17 +1706,17 @@ void ScPrintFunc::MakeEditEngine()
//fdo#45869 we want text to be positioned as it would be for the
//high dpi printed output, not as would be ideal for the 96dpi preview
//window itself
- pEditEngine->SetRefDevice(pPrinter ? pPrinter : pDoc->GetRefDevice());
+ pEditEngine->SetRefDevice(pPrinter ? pPrinter : rDoc.GetRefDevice());
pEditEngine->SetWordDelimiters(
ScEditUtil::ModifyDelimiters( pEditEngine->GetWordDelimiters() ) );
pEditEngine->SetControlWord( pEditEngine->GetControlWord() & ~EEControlBits::RTFSTYLESHEETS );
- pDoc->ApplyAsianEditSettings( *pEditEngine );
+ rDoc.ApplyAsianEditSettings( *pEditEngine );
pEditEngine->EnableAutoColor( bUseStyleColor );
// Default-Set for alignment
pEditDefaults.reset( new SfxItemSet( pEditEngine->GetEmptyItemSet() ) );
- const ScPatternAttr& rPattern = pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN);
+ const ScPatternAttr& rPattern = rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN);
rPattern.FillEditItemSet( pEditDefaults.get() );
// FillEditItemSet adjusts font height to 1/100th mm,
// but for header/footer twips is needed, as in the PatternAttr:
@@ -1879,7 +1882,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, bool bDoPrint, ScPreviewLocationData
vcl::Font aMarkFont;
ScAutoFontColorMode eColorMode = bUseStyleColor ? SC_AUTOCOL_DISPLAY : SC_AUTOCOL_PRINT;
- pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN).GetFont( aMarkFont, eColorMode );
+ rDoc.GetPool()->GetDefaultItem(ATTR_PATTERN).GetFont( aMarkFont, eColorMode );
pDev->SetFont( aMarkFont );
long nMarkLen = pDev->GetTextWidth("GW99999:");
// without Space-Char, because it rarely arrives there
@@ -1903,7 +1906,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, bool bDoPrint, ScPreviewLocationData
{
ScAddress &rPos = aNotePosList[ nNoteStart + nCount ];
- if( const ScPostIt* pNote = pDoc->GetNote( rPos ) )
+ if( const ScPostIt* pNote = rDoc.GetNote( rPos ) )
{
if(const EditTextObject *pEditText = pNote->GetEditTextObject())
pEditEngine->SetTextCurrentDefaults(*pEditText);
@@ -1914,7 +1917,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, bool bDoPrint, ScPreviewLocationData
{
pEditEngine->Draw( pDev, Point( nPosX, nPosY ) );
- OUString aMarkStr(rPos.Format(ScRefFlags::VALID, pDoc, pDoc->GetAddressConvention()) + ":");
+ OUString aMarkStr(rPos.Format(ScRefFlags::VALID, &rDoc, rDoc.GetAddressConvention()) + ":");
// cell position also via EditEngine, for correct positioning
pEditEngine->SetTextCurrentDefaults(aMarkStr);
@@ -2011,7 +2014,7 @@ long ScPrintFunc::PrintNotes( long nPageNo, long nNoteStart, bool bDoPrint, ScPr
void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
bool bDoPrint, ScPreviewLocationData* pLocationData )
{
- bool bLayoutRTL = pDoc->IsLayoutRTL( nPrintTab );
+ bool bLayoutRTL = rDoc.IsLayoutRTL( nPrintTab );
long nLayoutSign = bLayoutRTL ? -1 : 1;
// nPageNo is the page number within all sheets of one "start page" setting
@@ -2091,10 +2094,10 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO
long nDataWidth = 0;
SCCOL i;
for (i=nX1; i<=nX2; i++)
- nDataWidth += pDoc->GetColWidth( i,nPrintTab );
+ nDataWidth += rDoc.GetColWidth( i,nPrintTab );
if (bDoRepCol)
for (i=nRepeatStartCol; i<=nRepeatEndCol; i++)
- nDataWidth += pDoc->GetColWidth( i,nPrintTab );
+ nDataWidth += rDoc.GetColWidth( i,nPrintTab );
if (aTableParam.bHeaders)
nDataWidth += long(PRINT_HEADER_WIDTH);
if (pBorderItem)
@@ -2114,9 +2117,9 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO
}
if ( bCenterVer )
{
- long nDataHeight = pDoc->GetRowHeight( nY1, nY2, nPrintTab);
+ long nDataHeight = rDoc.GetRowHeight( nY1, nY2, nPrintTab);
if (bDoRepRow)
- nDataHeight += pDoc->GetRowHeight( nRepeatStartRow,
+ nDataHeight += rDoc.GetRowHeight( nRepeatStartRow,
nRepeatEndRow, nPrintTab);
if (aTableParam.bHeaders)
nDataHeight += long(PRINT_HEADER_HEIGHT);
@@ -2147,13 +2150,13 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO
}
if (bDoRepCol)
for (SCCOL i=nRepeatStartCol; i<=nRepeatEndCol; i++)
- nRepeatWidth += static_cast<long>(pDoc->GetColWidth(i,nPrintTab) * nScaleX);
+ nRepeatWidth += static_cast<long>(rDoc.GetColWidth(i,nPrintTab) * nScaleX);
if (bDoRepRow)
- nRepeatHeight += pDoc->GetScaledRowHeight( nRepeatStartRow,
+ nRepeatHeight += rDoc.GetScaledRowHeight( nRepeatStartRow,
nRepeatEndRow, nPrintTab, nScaleY);
for (SCCOL i=nX1; i<=nX2; i++)
- nContentWidth += static_cast<long>(pDoc->GetColWidth(i,nPrintTab) * nScaleX);
- nContentHeight += pDoc->GetScaledRowHeight( nY1, nY2, nPrintTab,
+ nContentWidth += static_cast<long>(rDoc.GetColWidth(i,nPrintTab) * nScaleX);
+ nContentHeight += rDoc.GetScaledRowHeight( nY1, nY2, nPrintTab,
nScaleY);
// partition the page
@@ -2291,7 +2294,7 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO
pDev->SetMapMode(aOffsetMode);
}
- ScPatternAttr aPattern( pDoc->GetPool() );
+ ScPatternAttr aPattern( rDoc.GetPool() );
vcl::Font aFont;
ScAutoFontColorMode eColorMode = bUseStyleColor ? SC_AUTOCOL_DISPLAY : SC_AUTOCOL_PRINT;
aPattern.GetFont( aFont, eColorMode, pDev );
@@ -2411,17 +2414,17 @@ bool ScPrintFunc::UpdatePages()
nZoom = ZOOM_MIN;
}
- OUString aName = pDoc->GetPageStyle( nPrintTab );
- SCTAB nTabCount = pDoc->GetTableCount();
+ OUString aName = rDoc.GetPageStyle( nPrintTab );
+ SCTAB nTabCount = rDoc.GetTableCount();
for (SCTAB nTab=0; nTab<nTabCount; nTab++)
- if ( nTab==nPrintTab || pDoc->GetPageStyle(nTab)==aName )
+ if ( nTab==nPrintTab || rDoc.GetPageStyle(nTab)==aName )
{
// Repeating rows/columns
- pDoc->SetRepeatArea( nTab, nRepeatStartCol,nRepeatEndCol, nRepeatStartRow,nRepeatEndRow );
+ rDoc.SetRepeatArea( nTab, nRepeatStartCol,nRepeatEndCol, nRepeatStartRow,nRepeatEndRow );
// set breaks
ResetBreaks(nTab);
- pDocShell->PostPaint(0,0,nTab,pDoc->MaxCol(),pDoc->MaxRow(),nTab, PaintPartFlags::Grid);
+ pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid);
}
return true;
@@ -2431,7 +2434,7 @@ long ScPrintFunc::CountPages() // sets also nPagesX, nP
{
bool bAreaOk = false;
- if (pDoc->HasTable( nPrintTab ))
+ if (rDoc.HasTable( nPrintTab ))
{
if (aAreaParam.bPrintArea) // Specify print area?
{
@@ -2462,7 +2465,7 @@ long ScPrintFunc::CountPages() // sets also nPagesX, nP
size_t nY;
if (bMultiArea)
{
- sal_uInt16 nRCount = pDoc->GetPrintRangeCount( nPrintTab );
+ sal_uInt16 nRCount = rDoc.GetPrintRangeCount( nPrintTab );
for (sal_uInt16 i=0; i<nRCount; i++)
{
CalcZoom(i);
@@ -2512,7 +2515,7 @@ long ScPrintFunc::CountNotePages()
sal_uInt16 nRepeats = 1; // how often go through it ?
if (bMultiArea)
- nRepeats = pDoc->GetPrintRangeCount(nPrintTab);
+ nRepeats = rDoc.GetPrintRangeCount(nPrintTab);
if (bError)
nRepeats = 0;
@@ -2521,7 +2524,7 @@ long ScPrintFunc::CountNotePages()
bool bDoThis = true;
if (bMultiArea) // go through all Areas
{
- const ScRange* pThisRange = pDoc->GetPrintRange( nPrintTab, nStep );
+ const ScRange* pThisRange = rDoc.GetPrintRange( nPrintTab, nStep );
if ( pThisRange )
{
nStartCol = pThisRange->aStart.Col();
@@ -2537,11 +2540,11 @@ long ScPrintFunc::CountNotePages()
assert( bPrintAreaValid );
for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol )
{
- if (pDoc->HasColNotes(nCol, nPrintTab))
+ if (rDoc.HasColNotes(nCol, nPrintTab))
{
for ( SCROW nRow = nStartRow; nRow <= nEndRow; ++nRow )
{
- if ( pDoc->HasNote(nCol, nRow, nPrintTab) )
+ if ( rDoc.HasNote(nCol, nRow, nPrintTab) )
aNotePosList.emplace_back( nCol, nRow, nPrintTab );
}
}
@@ -2656,7 +2659,7 @@ long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges,
sal_uInt16 nRepeats = 1;
if (bMultiArea)
- nRepeats = pDoc->GetPrintRangeCount(nPrintTab);
+ nRepeats = rDoc.GetPrintRangeCount(nPrintTab);
for (sal_uInt16 nStep=0; nStep<nRepeats; nStep++)
{
if (bMultiArea) // replace area
@@ -2761,10 +2764,10 @@ long ScPrintFunc::DoPrint( const MultiSelection& rPageRanges,
void ScPrintFunc::CalcZoom( sal_uInt16 nRangeNo ) // calculate zoom
{
- sal_uInt16 nRCount = pDoc->GetPrintRangeCount( nPrintTab );
+ sal_uInt16 nRCount = rDoc.GetPrintRangeCount( nPrintTab );
const ScRange* pThisRange = nullptr;
if (nRangeNo != RANGENO_NORANGE && nRangeNo < nRCount)
- pThisRange = pDoc->GetPrintRange( nPrintTab, nRangeNo );
+ pThisRange = rDoc.GetPrintRange( nPrintTab, nRangeNo );
if ( pThisRange )
{
nStartCol = pThisRange->aStart.Col();
@@ -2780,7 +2783,7 @@ void ScPrintFunc::CalcZoom( sal_uInt16 nRangeNo ) // calcu
return;
}
- pDoc->SetRepeatArea( nPrintTab, nRepeatStartCol,nRepeatEndCol, nRepeatStartRow,nRepeatEndRow );
+ rDoc.SetRepeatArea( nPrintTab, nRepeatStartCol,nRepeatEndCol, nRepeatStartRow,nRepeatEndRow );
if (aTableParam.bScalePageNum)
{
@@ -2793,8 +2796,8 @@ void ScPrintFunc::CalcZoom( sal_uInt16 nRangeNo ) // calcu
sal_uInt16 nMinPages = 0;
std::set<SCROW> aRowBreaks;
std::set<SCCOL> aColBreaks;
- pDoc->GetAllRowBreaks(aRowBreaks, nPrintTab, false, true);
- pDoc->GetAllColBreaks(aColBreaks, nPrintTab, false, true);
+ rDoc.GetAllRowBreaks(aRowBreaks, nPrintTab, false, true);
+ rDoc.GetAllColBreaks(aColBreaks, nPrintTab, false, true);
nMinPages = (aRowBreaks.size() + 1) * (aColBreaks.size() + 1);
// #i54993# use min forced by breaks if it's > # pages in
@@ -2850,8 +2853,8 @@ void ScPrintFunc::CalcZoom( sal_uInt16 nRangeNo ) // calcu
sal_uInt16 nMinPagesW = 0, nMinPagesH = 0;
std::set<SCROW> aRowBreaks;
std::set<SCCOL> aColBreaks;
- pDoc->GetAllRowBreaks(aRowBreaks, nPrintTab, false, true);
- pDoc->GetAllColBreaks(aColBreaks, nPrintTab, false, true);
+ rDoc.GetAllRowBreaks(aRowBreaks, nPrintTab, false, true);
+ rDoc.GetAllColBreaks(aColBreaks, nPrintTab, false, true);
nMinPagesW = aColBreaks.size() + 1;
nMinPagesH = aRowBreaks.size() + 1;
@@ -2977,11 +2980,11 @@ Size ScPrintFunc::GetDocPageSize()
void ScPrintFunc::ResetBreaks( SCTAB nTab ) // Set Breaks correctly for view
{
- pDoc->SetPageSize( nTab, GetDocPageSize() );
- pDoc->UpdatePageBreaks( nTab );
+ rDoc.SetPageSize( nTab, GetDocPageSize() );
+ rDoc.UpdatePageBreaks( nTab );
}
-static void lcl_SetHidden( const ScDocument* pDoc, SCTAB nPrintTab, ScPageRowEntry& rPageRowEntry,
+static void lcl_SetHidden( const ScDocument& rDoc, SCTAB nPrintTab, ScPageRowEntry& rPageRowEntry,
SCCOL nStartCol, const std::vector< SCCOL >& rPageEndX )
{
size_t nPagesX = rPageRowEntry.GetPagesX();
@@ -2990,13 +2993,13 @@ static void lcl_SetHidden( const ScDocument* pDoc, SCTAB nPrintTab, ScPageRowEnt
bool bLeftIsEmpty = false;
ScRange aTempRange;
- tools::Rectangle aTempRect = pDoc->GetMMRect( 0,0, 0,0, 0 );
+ tools::Rectangle aTempRect = rDoc.GetMMRect( 0,0, 0,0, 0 );
for (size_t i=0; i<nPagesX; i++)
{
OSL_ENSURE(i < rPageEndX.size(), "vector access error for aPageEndX");
SCCOL nEndCol = rPageEndX[i];
- if ( pDoc->IsPrintEmpty( nPrintTab, nStartCol, nStartRow, nEndCol, nEndRow,
+ if ( rDoc.IsPrintEmpty( nPrintTab, nStartCol, nStartRow, nEndCol, nEndRow,
bLeftIsEmpty, &aTempRange, &aTempRect ) )
{
rPageRowEntry.SetHidden(i);
@@ -3012,7 +3015,7 @@ static void lcl_SetHidden( const ScDocument* pDoc, SCTAB nPrintTab, ScPageRowEnt
void ScPrintFunc::CalcPages() // calculates aPageRect and pages from nZoom
{
assert( bPrintAreaValid );
- m_aRanges.calculate(pDoc, aTableParam.bSkipEmpty, aAreaParam.bPrintArea, nStartRow, nEndRow, nStartCol, nEndCol, nPrintTab, GetDocPageSize());
+ m_aRanges.calculate(rDoc, aTableParam.bSkipEmpty, aAreaParam.bPrintArea, nStartRow, nEndRow, nStartCol, nEndCol, nPrintTab, GetDocPageSize());
}
namespace sc
@@ -3051,7 +3054,8 @@ bool PrintPageRanges::checkIfAlreadyCalculatedAndSet(
return false;
}
-void PrintPageRanges::calculate(ScDocument* pDoc,
+
+void PrintPageRanges::calculate(ScDocument& rDoc,
bool bSkipEmpty, bool bPrintArea,
SCROW nStartRow, SCROW nEndRow,
SCCOL nStartCol, SCCOL nEndCol,
@@ -3063,22 +3067,22 @@ void PrintPageRanges::calculate(ScDocument* pDoc,
nPrintTab, rDocSize))
return;
- pDoc->SetPageSize(nPrintTab, rDocSize);
+ rDoc.SetPageSize(nPrintTab, rDocSize);
// #i123672# use dynamic mem to react on size changes
- if (m_aPageEndX.size() < static_cast<size_t>(pDoc->MaxCol()) + 1)
+ if (m_aPageEndX.size() < static_cast<size_t>(rDoc.MaxCol()) + 1)
{
- m_aPageEndX.resize(pDoc->MaxCol()+1, SCCOL());
+ m_aPageEndX.resize(rDoc.MaxCol()+1, SCCOL());
}
if (bPrintArea)
{
ScRange aRange(nStartCol, nStartRow, nPrintTab, nEndCol, nEndRow, nPrintTab);
- pDoc->UpdatePageBreaks(nPrintTab, &aRange);
+ rDoc.UpdatePageBreaks(nPrintTab, &aRange);
}
else
{
- pDoc->UpdatePageBreaks(nPrintTab); // else, end is marked
+ rDoc.UpdatePageBreaks(nPrintTab); // else, end is marked
}
const size_t nRealCnt = nEndRow - nStartRow + 1;
@@ -3105,8 +3109,8 @@ void PrintPageRanges::calculate(ScDocument* pDoc,
bool bVisCol = false;
for (SCCOL i = nStartCol; i <= nEndCol; i++)
{
- bool bHidden = pDoc->ColHidden(i, nPrintTab);
- bool bPageBreak(pDoc->HasColBreak(i, nPrintTab) & ScBreakType::Page);
+ bool bHidden = rDoc.ColHidden(i, nPrintTab);
+ bool bPageBreak(rDoc.HasColBreak(i, nPrintTab) & ScBreakType::Page);
if (i > nStartCol && bVisCol && bPageBreak)
{
OSL_ENSURE(m_nPagesX < m_aPageEndX.size(), "vector access error for aPageEndX");
@@ -3128,7 +3132,7 @@ void PrintPageRanges::calculate(ScDocument* pDoc,
SCROW nPageStartRow = nStartRow;
SCROW nLastVisibleRow = -1;
- std::unique_ptr<ScRowBreakIterator> pRowBreakIter(pDoc->GetRowBreakIterator(nPrintTab));
+ std::unique_ptr<ScRowBreakIterator> pRowBreakIter(rDoc.GetRowBreakIterator(nPrintTab));
SCROW nNextPageBreak = pRowBreakIter->first();
while (nNextPageBreak != ScRowBreakIterator::NOT_FOUND && nNextPageBreak < nStartRow)
// Skip until the page break position is at the start row or greater.
@@ -3146,14 +3150,14 @@ void PrintPageRanges::calculate(ScDocument* pDoc,
m_aPageEndY[m_nTotalY] = nRow - 1;
++m_nTotalY;
- if (!bSkipEmpty || !pDoc->IsPrintEmpty(nPrintTab, nStartCol, nPageStartRow, nEndCol, nRow-1))
+ if (!bSkipEmpty || !rDoc.IsPrintEmpty(nPrintTab, nStartCol, nPageStartRow, nEndCol, nRow-1))
{
OSL_ENSURE(m_nPagesY < m_aPageRows.size(), "vector access error for rPageRows");
m_aPageRows[m_nPagesY].SetStartRow(nPageStartRow);
m_aPageRows[m_nPagesY].SetEndRow(nRow - 1);
m_aPageRows[m_nPagesY].SetPagesX(m_nPagesX);
if (bSkipEmpty)
- lcl_SetHidden(pDoc, nPrintTab, m_aPageRows[m_nPagesY], nStartCol, m_aPageEndX);
+ lcl_SetHidden(rDoc, nPrintTab, m_aPageRows[m_nPagesY], nStartCol, m_aPageEndX);
++m_nPagesY;
}
@@ -3170,7 +3174,7 @@ void PrintPageRanges::calculate(ScDocument* pDoc,
}
SCROW nLastRow = -1;
- if (!pDoc->RowHidden(nRow, nPrintTab, nullptr, &nLastRow))
+ if (!rDoc.RowHidden(nRow, nPrintTab, nullptr, &nLastRow))
{
bVisRow = true;
nLastVisibleRow = nLastRow;
@@ -3187,14 +3191,14 @@ void PrintPageRanges::calculate(ScDocument* pDoc,
m_aPageEndY[m_nTotalY] = nEndRow;
++m_nTotalY;
- if (!bSkipEmpty || !pDoc->IsPrintEmpty(nPrintTab, nStartCol, nPageStartRow, nEndCol, nEndRow))
+ if (!bSkipEmpty || !rDoc.IsPrintEmpty(nPrintTab, nStartCol, nPageStartRow, nEndCol, nEndRow))
{
OSL_ENSURE(m_nPagesY < m_aPageRows.size(), "vector access error for maPageRows");
m_aPageRows[m_nPagesY].SetStartRow(nPageStartRow);
m_aPageRows[m_nPagesY].SetEndRow(nEndRow);
m_aPageRows[m_nPagesY].SetPagesX(m_nPagesX);
if (bSkipEmpty)
- lcl_SetHidden(pDoc, nPrintTab, m_aPageRows[m_nPagesY], nStartCol, m_aPageEndX);
+ lcl_SetHidden(rDoc, nPrintTab, m_aPageRows[m_nPagesY], nStartCol, m_aPageEndX);
++m_nPagesY;
}
}
diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx
index 32158705dddf..894157e578e1 100644
--- a/sc/source/ui/view/spelldialog.cxx
+++ b/sc/source/ui/view/spelldialog.cxx
@@ -225,9 +225,9 @@ void ScSpellDialogChildWindow::Init()
// *** create Undo/Redo documents *** -------------------------------------
mxUndoDoc.reset( new ScDocument( SCDOCMODE_UNDO ) );
- mxUndoDoc->InitUndo( mpDoc, nTab, nTab );
+ mxUndoDoc->InitUndo( *mpDoc, nTab, nTab );
mxRedoDoc.reset( new ScDocument( SCDOCMODE_UNDO ) );
- mxRedoDoc->InitUndo( mpDoc, nTab, nTab );
+ mxRedoDoc->InitUndo( *mpDoc, nTab, nTab );
if ( rMarkData.GetSelectCount() > 1 )
{
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 1f96526aac4e..d9fdc3bb4e68 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -256,7 +256,7 @@ void ScConversionEngineBase::FillFromCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
sal_uInt32 nNumFmt = mrDoc.GetNumberFormat(aPos);
OUString aText;
const Color* pColor;
- ScCellFormat::GetString(aCell, nNumFmt, aText, &pColor, *pFormatter, &mrDoc);
+ ScCellFormat::GetString(aCell, nNumFmt, aText, &pColor, *pFormatter, mrDoc);
SetTextCurrentDefaults(aText);
}
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 0d981959ca59..134420f5d2f6 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -982,7 +982,7 @@ void ScViewFunc::RemoveManualBreaks()
if (bUndo)
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
rDoc.CopyToDocument( 0,0,nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
pDocSh->GetUndoManager()->AddUndoAction(
std::make_unique<ScUndoRemoveBreaks>( pDocSh, nTab, std::move(pUndoDoc) ) );
@@ -1638,7 +1638,7 @@ void ScViewFunc::FillTab( InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool
if (bUndo)
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
for (const SCTAB& i : rMark)
if (i != nTab )
@@ -1936,7 +1936,7 @@ bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
if ( nCommand == SvxSearchCmd::REPLACE_ALL )
{
pUndoDoc.reset(new ScDocument(SCDOCMODE_UNDO));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nEndTab );
}
}
@@ -2467,7 +2467,7 @@ bool ScViewFunc::DeleteTables(const vector<SCTAB> &TheTabs, bool bRecord )
{
SCTAB nTab = TheTabs[i];
if (i==0)
- pUndoDoc->InitUndo( &rDoc, nTab,nTab, true,true ); // incl. column/fow flags
+ pUndoDoc->InitUndo( rDoc, nTab,nTab, true,true ); // incl. column/fow flags
else
pUndoDoc->AddUndoTab( nTab,nTab, true,true ); // incl. column/fow flags
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index a635c900460b..eb88e97891e9 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -828,11 +828,11 @@ bool ScViewFunc::PasteOnDrawObjectLinked(
return false;
}
-static bool lcl_SelHasAttrib( const ScDocument* pDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
+static bool lcl_SelHasAttrib( const ScDocument& rDoc, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
const ScMarkData& rTabSelection, HasAttrFlags nMask )
{
return std::any_of(rTabSelection.begin(), rTabSelection.end(),
- [&](const SCTAB& rTab) { return pDoc->HasAttrib( nCol1, nRow1, rTab, nCol2, nRow2, rTab, nMask ); });
+ [&](const SCTAB& rTab) { return rDoc.HasAttrib( nCol1, nRow1, rTab, nCol2, nRow2, rTab, nMask ); });
}
// paste into sheet:
@@ -841,7 +841,7 @@ static bool lcl_SelHasAttrib( const ScDocument* pDoc, SCCOL nCol1, SCROW nRow1,
namespace {
-bool checkDestRangeForOverwrite(const ScRangeList& rDestRanges, const ScDocument* pDoc, const ScMarkData& rMark, weld::Window* pParentWnd)
+bool checkDestRangeForOverwrite(const ScRangeList& rDestRanges, const ScDocument& rDoc, const ScMarkData& rMark, weld::Window* pParentWnd)
{
bool bIsEmpty = true;
size_t nRangeSize = rDestRanges.size();
@@ -850,7 +850,7 @@ bool checkDestRangeForOverwrite(const ScRangeList& rDestRanges, const ScDocument
for (size_t i = 0; i < nRangeSize && bIsEmpty; ++i)
{
const ScRange& rRange = rDestRanges[i];
- bIsEmpty = pDoc->IsBlockEmpty(
+ bIsEmpty = rDoc.IsBlockEmpty(
rTab, rRange.aStart.Col(), rRange.aStart.Row(),
rRange.aEnd.Col(), rRange.aEnd.Row());
}
@@ -1161,7 +1161,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if ( bAskIfNotEmpty )
{
ScRangeList aTestRanges(aUserRange);
- if (!checkDestRangeForOverwrite(aTestRanges, &rDoc, aFilteredMark, GetViewData().GetDialogParent()))
+ if (!checkDestRangeForOverwrite(aTestRanges, rDoc, aFilteredMark, GetViewData().GetDialogParent()))
return false;
}
}
@@ -1212,7 +1212,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
}
if (bClipOver)
- if (lcl_SelHasAttrib( &rDoc, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark, HasAttrFlags::Overlapped ))
+ if (lcl_SelHasAttrib( rDoc, nStartCol,nStartRow, nUndoEndCol,nUndoEndRow, aFilteredMark, HasAttrFlags::Overlapped ))
{ // "Cell merge not possible if cells already merged"
ScDocAttrIterator aIter( rDoc, nStartTab, nStartCol, nStartRow, nUndoEndCol, nUndoEndRow );
const ScPatternAttr* pPattern = nullptr;
@@ -1260,7 +1260,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if ( bCutMode )
{
pRefUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pRefUndoDoc->InitUndo( &rDoc, 0, nTabCount-1 );
+ pRefUndoDoc->InitUndo( rDoc, 0, nTabCount-1 );
pUndoData.reset(new ScRefUndoData( &rDoc ));
}
@@ -1288,7 +1288,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if ( nFlags & InsertDeleteFlags::CONTENTS )
{
pMixDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pMixDoc->InitUndo( &rDoc, nStartTab, nEndTab );
+ pMixDoc->InitUndo( rDoc, nStartTab, nEndTab );
rDoc.CopyToDocument(nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab,
InsertDeleteFlags::CONTENTS, false, *pMixDoc);
}
@@ -1385,7 +1385,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc,
if (pRefUndoDoc)
{
pRedoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pRedoDoc->InitUndo( &rDoc, nStartTab, nEndTab, bColInfo, bRowInfo );
+ pRedoDoc->InitUndo( rDoc, nStartTab, nEndTab, bColInfo, bRowInfo );
// move adapted refs to Redo-Doc
@@ -1530,7 +1530,7 @@ bool ScViewFunc::PasteMultiRangesFromClip(
if (bAskIfNotEmpty)
{
ScRangeList aTestRanges(aMarkedRange);
- if (!checkDestRangeForOverwrite(aTestRanges, &rDoc, aMark, GetViewData().GetDialogParent()))
+ if (!checkDestRangeForOverwrite(aTestRanges, rDoc, aMark, GetViewData().GetDialogParent()))
return false;
}
@@ -1692,7 +1692,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges(
if (bAskIfNotEmpty)
{
- if (!checkDestRangeForOverwrite(aRanges, &rDoc, aMark, GetViewData().GetDialogParent()))
+ if (!checkDestRangeForOverwrite(aRanges, rDoc, aMark, GetViewData().GetDialogParent()))
return false;
}
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 49f4f2531dc8..da574db27b53 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -115,7 +115,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
if (bRecord)
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
rDoc.CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, InsertDeleteFlags::ALL, false, *pUndoDoc );
}
@@ -136,7 +136,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
if (bRecord)
{
ScDocumentUniquePtr pRedoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ pRedoDoc->InitUndo( rDoc, nTab, nTab );
rDoc.CopyToDocument( nStartCol,nStartRow,nTab, nStartCol,nEndRow,nTab, InsertDeleteFlags::ALL|InsertDeleteFlags::NOCAPTIONS, false, *pRedoDoc );
ScRange aMarkRange(nStartCol, nStartRow, nTab, nStartCol, nEndRow, nTab);
@@ -213,7 +213,7 @@ void ScViewFunc::DoRefConversion()
{
pUndoDoc.reset( new ScDocument( SCDOCMODE_UNDO ) );
SCTAB nTab = aMarkRange.aStart.Tab();
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
if ( rMark.GetSelectCount() > 1 )
{
@@ -280,7 +280,7 @@ void ScViewFunc::DoRefConversion()
{
ScDocumentUniquePtr pRedoDoc(new ScDocument( SCDOCMODE_UNDO ));
SCTAB nTab = aMarkRange.aStart.Tab();
- pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ pRedoDoc->InitUndo( rDoc, nTab, nTab );
if ( rMark.GetSelectCount() > 1 )
{
@@ -482,9 +482,9 @@ void ScViewFunc::DoSheetConversion( const ScConversionParam& rConvParam )
if (bRecord)
{
pUndoDoc.reset( new ScDocument( SCDOCMODE_UNDO ) );
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
pRedoDoc.reset( new ScDocument( SCDOCMODE_UNDO ) );
- pRedoDoc->InitUndo( &rDoc, nTab, nTab );
+ pRedoDoc->InitUndo( rDoc, nTab, nTab );
if ( rMark.GetSelectCount() > 1 )
{
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index b15e7751b752..874020116144 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -1067,7 +1067,7 @@ void ScViewFunc::ApplyPatternLines( const ScPatternAttr& rAttr, const SvxBoxItem
bool bCopyOnlyMarked = false;
if( !bRemoveAdjCellBorder )
bCopyOnlyMarked = bMulti;
- pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab );
for (const auto& rTab : aFuncMark)
if (rTab != nStartTab)
pUndoDoc->AddUndoTab( rTab, rTab );
@@ -1177,7 +1177,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor
aCopyRange.aEnd.SetTab(nTabCount-1);
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nStartTab, nStartTab );
+ pUndoDoc->InitUndo( rDoc, nStartTab, nStartTab );
for (const auto& rTab : aFuncMark)
if (rTab != nStartTab)
pUndoDoc->AddUndoTab( rTab, rTab );
@@ -1347,7 +1347,7 @@ void ScViewFunc::SetStyleSheetToMarked( const SfxStyleSheet* pStyleSheet )
{
SCTAB nTab = rViewData.GetTabNo();
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
for (const auto& rTab : aFuncMark)
if (rTab != nTab)
pUndoDoc->AddUndoTab( rTab, rTab );
@@ -1379,7 +1379,7 @@ void ScViewFunc::SetStyleSheetToMarked( const SfxStyleSheet* pStyleSheet )
if ( bRecord )
{
ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab );
for (const auto& rTab : aFuncMark)
if (rTab != nTab)
pUndoDoc->AddUndoTab( rTab, rTab );
@@ -1837,7 +1837,7 @@ void ScViewFunc::DeleteMulti( bool bRows )
if (bRecord)
{
pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, !bRows, bRows ); // row height
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, !bRows, bRows ); // row height
for (const sc::ColRowSpan & rSpan : aSpans)
{
@@ -2093,7 +2093,7 @@ void ScViewFunc::SetWidthOrHeight(
if (bWidth)
{
if ( nTab == nFirstTab )
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, true );
else
pUndoDoc->AddUndoTab( nTab, nTab, true );
rDoc.CopyToDocument( static_cast<SCCOL>(nStart), 0, nTab,
@@ -2103,7 +2103,7 @@ void ScViewFunc::SetWidthOrHeight(
else
{
if ( nTab == nFirstTab )
- pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true );
+ pUndoDoc->InitUndo( rDoc, nTab, nTab, false, true );
else
pUndoDoc->AddUndoTab( nTab, nTab, false, true );
rDoc.CopyToDocument( 0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc );
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index 75c7ac543b80..67b48be34a38 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -150,7 +150,7 @@ bool ScViewUtil::IsActionShown( const ScChangeAction& rAction,
if ( rSettings.HasComment() )
{
OUString aTmp;
- rAction.GetDescription(aTmp, &rDocument);
+ rAction.GetDescription(aTmp, rDocument);
OUString aComStr = rAction.GetComment() + " (" + aTmp + ")";
if(!rSettings.IsValidComment(&aComStr))