summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/cellvalue.cxx6
-rw-r--r--sc/source/core/data/column.cxx6
-rw-r--r--sc/source/core/data/conditio.cxx10
-rw-r--r--sc/source/core/data/dbdocutl.cxx28
-rw-r--r--sc/source/core/data/docpool.cxx4
-rw-r--r--sc/source/core/data/documen2.cxx2
-rw-r--r--sc/source/core/data/document.cxx8
-rw-r--r--sc/source/core/data/formulacell.cxx32
-rw-r--r--sc/source/core/data/patattr.cxx6
-rw-r--r--sc/source/core/data/poolhelp.cxx13
-rw-r--r--sc/source/core/data/table2.cxx8
-rw-r--r--sc/source/core/data/table4.cxx2
-rw-r--r--sc/source/core/inc/poolhelp.hxx4
-rw-r--r--sc/source/core/tool/chartarr.cxx32
-rw-r--r--sc/source/core/tool/chartpos.cxx26
-rw-r--r--sc/source/core/tool/chgtrack.cxx2
-rw-r--r--sc/source/core/tool/detfunc.cxx4
-rw-r--r--sc/source/core/tool/reftokenhelper.cxx8
18 files changed, 100 insertions, 101 deletions
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index dc6cdaa326c4..419123ef7622 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -180,7 +180,7 @@ OUString getStringImpl( const CellT& rCell, const ScDocument* pDoc )
}
template<typename CellT>
-OUString getRawStringImpl( const CellT& rCell, const ScDocument* pDoc )
+OUString getRawStringImpl( const CellT& rCell, const ScDocument& rDoc )
{
switch (rCell.meType)
{
@@ -190,7 +190,7 @@ OUString getRawStringImpl( const CellT& rCell, const ScDocument* pDoc )
return rCell.mpString->getString();
case CELLTYPE_EDIT:
if (rCell.mpEditText)
- return ScEditUtil::GetString(*rCell.mpEditText, pDoc);
+ return ScEditUtil::GetString(*rCell.mpEditText, &rDoc);
break;
case CELLTYPE_FORMULA:
return rCell.mpFormula->GetRawString().getString();
@@ -664,7 +664,7 @@ OUString ScRefCellValue::getString( const ScDocument* pDoc ) const
OUString ScRefCellValue::getRawString( const ScDocument& rDoc ) const
{
- return getRawStringImpl(*this, &rDoc);
+ return getRawStringImpl(*this, rDoc);
}
bool ScRefCellValue::isEmpty() const
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 3d98018f64ac..fe968e85a23d 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -130,7 +130,7 @@ sc::MatrixEdge ScColumn::GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sc::Matr
if (pCell->GetMatrixFlag() == ScMatrixMode::NONE)
return MatrixEdge::Nothing;
- return pCell->GetMatrixEdge(&GetDoc(), aOrigin);
+ return pCell->GetMatrixEdge(GetDoc(), aOrigin);
}
bool bOpen = false;
@@ -160,7 +160,7 @@ sc::MatrixEdge ScColumn::GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sc::Matr
if (pCell->GetMatrixFlag() == ScMatrixMode::NONE)
continue;
- nEdges = pCell->GetMatrixEdge(&GetDoc(), aOrigin);
+ nEdges = pCell->GetMatrixEdge(GetDoc(), aOrigin);
if (nEdges == MatrixEdge::Nothing)
continue;
@@ -240,7 +240,7 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const
// cell is not a part of a matrix.
continue;
- MatrixEdge nEdges = pCell->GetMatrixEdge(&GetDoc(), aOrigin);
+ MatrixEdge nEdges = pCell->GetMatrixEdge(GetDoc(), aOrigin);
if (nEdges == MatrixEdge::Nothing)
continue;
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 698ab22a05d5..3b2c54cfc477 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -2228,16 +2228,16 @@ ScRangeList ScConditionalFormatList::GetCombinedRange() const
return aRange;
}
-void ScConditionalFormatList::RemoveFromDocument(ScDocument* pDoc) const
+void ScConditionalFormatList::RemoveFromDocument(ScDocument& rDoc) const
{
ScRangeList aRange = GetCombinedRange();
- ScMarkData aMark(pDoc->GetSheetLimits());
+ ScMarkData aMark(rDoc.GetSheetLimits());
aMark.MarkFromRangeList(aRange, true);
sal_uInt16 const pItems[2] = { sal_uInt16(ATTR_CONDITIONAL),0};
- pDoc->ClearSelectionItems(pItems, aMark);
+ rDoc.ClearSelectionItems(pItems, aMark);
}
-void ScConditionalFormatList::AddToDocument(ScDocument* pDoc) const
+void ScConditionalFormatList::AddToDocument(ScDocument& rDoc) const
{
for (auto& itr: m_ConditionalFormats)
{
@@ -2246,7 +2246,7 @@ void ScConditionalFormatList::AddToDocument(ScDocument* pDoc) const
continue;
SCTAB nTab = rRange.front().aStart.Tab();
- pDoc->AddCondFormatData(rRange, nTab, itr->GetKey());
+ rDoc.AddCondFormatData(rRange, nTab, itr->GetKey());
}
}
diff --git a/sc/source/core/data/dbdocutl.cxx b/sc/source/core/data/dbdocutl.cxx
index 32165dc5f653..07eca19c9ca6 100644
--- a/sc/source/core/data/dbdocutl.cxx
+++ b/sc/source/core/data/dbdocutl.cxx
@@ -34,9 +34,9 @@ ScDatabaseDocUtil::StrData::StrData() :
{
}
-void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
+void ScDatabaseDocUtil::PutData(ScDocument& rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab,
const uno::Reference<sdbc::XRow>& xRow, long nRowPos,
- long nType, bool bCurrency, StrData* pStrData )
+ long nType, bool bCurrency, StrData* pStrData)
{
OUString aString;
double nVal = 0.0;
@@ -54,7 +54,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
case sdbc::DataType::BIT:
case sdbc::DataType::BOOLEAN:
//TODO: use language from doc (here, date/time and currency)?
- nFormatIndex = pDoc->GetFormatTable()->GetStandardFormat(
+ nFormatIndex = rDoc.GetFormatTable()->GetStandardFormat(
SvNumFormatType::LOGICAL, ScGlobal::eLnge );
nVal = (xRow->getBoolean(nRowPos) ? 1 : 0);
bEmptyFlag = ( nVal == 0.0 ) && xRow->wasNull();
@@ -91,7 +91,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
nVal = 0.0;
else
{
- SvNumberFormatter* pFormTable = pDoc->GetFormatTable();
+ SvNumberFormatter* pFormTable = rDoc.GetFormatTable();
nFormatIndex = pFormTable->GetStandardFormat(
SvNumFormatType::DATE, ScGlobal::eLnge );
nVal = Date( aDate ) - pFormTable->GetNullDate();
@@ -102,7 +102,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
case sdbc::DataType::TIME:
{
- SvNumberFormatter* pFormTable = pDoc->GetFormatTable();
+ SvNumberFormatter* pFormTable = rDoc.GetFormatTable();
nFormatIndex = pFormTable->GetStandardFormat(
SvNumFormatType::TIME, ScGlobal::eLnge );
@@ -118,7 +118,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
case sdbc::DataType::TIMESTAMP:
{
- SvNumberFormatter* pFormTable = pDoc->GetFormatTable();
+ SvNumberFormatter* pFormTable = rDoc.GetFormatTable();
nFormatIndex = pFormTable->GetStandardFormat(
SvNumFormatType::DATETIME, ScGlobal::eLnge );
@@ -154,21 +154,21 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
}
if ( bValue && bCurrency )
- nFormatIndex = pDoc->GetFormatTable()->GetStandardFormat(
+ nFormatIndex = rDoc.GetFormatTable()->GetStandardFormat(
SvNumFormatType::CURRENCY, ScGlobal::eLnge );
ScAddress aPos(nCol, nRow, nTab);
if (bEmptyFlag)
- pDoc->SetEmptyCell(aPos);
+ rDoc.SetEmptyCell(aPos);
else if (bError)
{
- pDoc->SetError( nCol, nRow, nTab, FormulaError::NotAvailable );
+ rDoc.SetError( nCol, nRow, nTab, FormulaError::NotAvailable );
}
else if (bValue)
{
- pDoc->SetValue(aPos, nVal);
+ rDoc.SetValue(aPos, nVal);
if (nFormatIndex)
- pDoc->SetNumberFormat(aPos, nFormatIndex);
+ rDoc.SetNumberFormat(aPos, nFormatIndex);
}
else
{
@@ -176,7 +176,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
{
if (ScStringUtil::isMultiline(aString))
{
- pDoc->SetEditText(aPos, aString);
+ rDoc.SetEditText(aPos, aString);
if (pStrData)
pStrData->mbSimpleText = false;
}
@@ -184,7 +184,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
{
ScSetStringParam aParam;
aParam.setTextInput();
- pDoc->SetString(aPos, aString, &aParam);
+ rDoc.SetString(aPos, aString, &aParam);
if (pStrData)
pStrData->mbSimpleText = true;
}
@@ -193,7 +193,7 @@ void ScDatabaseDocUtil::PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB
pStrData->mnStrLength = aString.getLength();
}
else
- pDoc->SetEmptyCell(aPos);
+ rDoc.SetEmptyCell(aPos);
}
}
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index b4a8e47fdc54..ad7e33a3a3ff 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -358,7 +358,7 @@ void ScDocumentPool::StyleDeleted( const ScStyleSheet* pStyle )
}
}
-void ScDocumentPool::CellStyleCreated( const OUString& rName, const ScDocument* pDoc )
+void ScDocumentPool::CellStyleCreated( const OUString& rName, const ScDocument& rDoc )
{
// If a style was created, don't keep any pattern with its name string in the pool,
// because it would compare equal to a pattern with a pointer to the new style.
@@ -372,7 +372,7 @@ void ScDocumentPool::CellStyleCreated( const OUString& rName, const ScDocument*
{
const OUString* pStyleName = pPattern->GetStyleName();
if ( pStyleName && *pStyleName == rName )
- pPattern->UpdateStyleSheet(pDoc); // find and store style pointer
+ pPattern->UpdateStyleSheet(rDoc); // find and store style pointer
}
}
}
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 7274dd77b2d0..e2efd10d7fc0 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -190,7 +190,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
* have all of these available. */
if ( eMode == SCDOCMODE_DOCUMENT || eMode == SCDOCMODE_FUNCTIONACCESS )
{
- mxPoolHelper = new ScPoolHelper( this );
+ mxPoolHelper = new ScPoolHelper( *this );
pBASM.reset( new ScBroadcastAreaSlotMachine( this ) );
pChartListenerCollection.reset( new ScChartListenerCollection( *this ) );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 432673951492..c5926391988e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5435,7 +5435,7 @@ bool ScDocument::GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMat
return false;
ScAddress aOrigin = rCellPos;
- if (!pFCell->GetMatrixOrigin(this, aOrigin))
+ if (!pFCell->GetMatrixOrigin(*this, aOrigin))
// Failed to get the address of the matrix origin.
return false;
@@ -5457,7 +5457,7 @@ bool ScDocument::GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMat
// from old file format).
// Needs an "invalid" initialized address.
aOrigin.SetInvalid();
- pFCell->GetMatrixEdge(this, aOrigin);
+ pFCell->GetMatrixEdge(*this, aOrigin);
pFCell->GetMatColsRows(nSizeX, nSizeY);
}
@@ -6114,9 +6114,9 @@ void ScDocument::UpdStlShtPtrsFrmNms()
{
auto pPattern = const_cast<ScPatternAttr*>(dynamic_cast<const ScPatternAttr*>(pItem));
if (pPattern)
- pPattern->UpdateStyleSheet(this);
+ pPattern->UpdateStyleSheet(*this);
}
- const_cast<ScPatternAttr&>(pPool->GetDefaultItem(ATTR_PATTERN)).UpdateStyleSheet(this);
+ const_cast<ScPatternAttr&>(pPool->GetDefaultItem(ATTR_PATTERN)).UpdateStyleSheet(*this);
}
void ScDocument::StylesToNames()
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index ec99a7124656..370434367cb3 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -87,15 +87,15 @@ struct DebugCalculationEntry
{
ScAddress maPos;
OUString maResult;
- const ScDocument* mpDoc;
+ const ScDocument& mrDoc;
sal_uInt32 mnGroup;
sal_uInt16 mnRecursion;
- DebugCalculationEntry( const ScAddress& rPos, ScDocument* pDoc, sal_uInt32 nGroup ) :
+ DebugCalculationEntry( const ScAddress& rPos, ScDocument& rDoc, sal_uInt32 nGroup ) :
maPos(rPos),
- mpDoc(pDoc),
+ mrDoc(rDoc),
mnGroup(nGroup),
- mnRecursion(pDoc->GetRecursionHelper().GetRecursionCount())
+ mnRecursion(rDoc.GetRecursionHelper().GetRecursionCount())
{
}
};
@@ -125,7 +125,7 @@ static struct DebugCalculation
{
for (auto const& it : mvPos)
{
- OUString aStr( it.maPos.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, it.mpDoc) +
+ OUString aStr( it.maPos.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, &it.mrDoc) +
" [" + OUString::number( it.mnRecursion) + "," + OUString::number( it.mnGroup) + "]");
fprintf( stderr, "%s -> ", aStr.toUtf8().getStr());
}
@@ -137,7 +137,7 @@ static struct DebugCalculation
{
for (auto const& it : mvResults)
{
- OUString aStr( it.maPos.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, it.mpDoc));
+ OUString aStr( it.maPos.Format( ScRefFlags::VALID | ScRefFlags::TAB_3D, &it.mrDoc));
aStr += " (" + it.maResult + ")";
fprintf( stderr, "%s, ", aStr.toUtf8().getStr());
}
@@ -176,13 +176,13 @@ static struct DebugCalculation
struct DebugCalculationStacker
{
- DebugCalculationStacker( const ScAddress& rPos, ScDocument* pDoc )
+ DebugCalculationStacker( const ScAddress& rPos, ScDocument& rDoc )
{
if (!aDC.mbActive && rPos == aDC.maTrigger)
aDC.mbActive = aDC.mbSwitchOff = true;
if (aDC.mbActive)
{
- aDC.mvPos.push_back( DebugCalculationEntry( rPos, pDoc, aDC.mnGroup));
+ aDC.mvPos.push_back( DebugCalculationEntry( rPos, rDoc, aDC.mnGroup));
aDC.mbPrint = true;
}
}
@@ -1565,7 +1565,7 @@ bool ScFormulaCell::Interpret(SCROW nStartOffset, SCROW nEndOffset)
aDC.mbPrintResults = true;
bDebugCalculationInit = false;
}
- DebugCalculationStacker aDebugEntry( aPos, &rDocument);
+ DebugCalculationStacker aDebugEntry(aPos, rDocument);
#endif
if (!IsDirtyOrInTableOpDirty() || rRecursionHelper.IsInReturn())
@@ -2833,7 +2833,7 @@ const ScMatrix* ScFormulaCell::GetMatrix()
return aResult.GetMatrix().get();
}
-bool ScFormulaCell::GetMatrixOrigin( const ScDocument* pDoc, ScAddress& rPos ) const
+bool ScFormulaCell::GetMatrixOrigin( const ScDocument& rDoc, ScAddress& rPos ) const
{
switch ( cMatrixFlag )
{
@@ -2847,8 +2847,8 @@ bool ScFormulaCell::GetMatrixOrigin( const ScDocument* pDoc, ScAddress& rPos ) c
if( t )
{
ScSingleRefData& rRef = *t->GetSingleRef();
- ScAddress aAbs = rRef.toAbs(*pDoc, aPos);
- if (pDoc->ValidAddress(aAbs))
+ ScAddress aAbs = rRef.toAbs(rDoc, aPos);
+ if (rDoc.ValidAddress(aAbs))
{
rPos = aAbs;
return true;
@@ -2861,7 +2861,7 @@ bool ScFormulaCell::GetMatrixOrigin( const ScDocument* pDoc, ScAddress& rPos ) c
return false;
}
-sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument* pDoc, ScAddress& rOrgPos ) const
+sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument& rDoc, ScAddress& rOrgPos ) const
{
switch ( cMatrixFlag )
{
@@ -2871,7 +2871,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument* pDoc, ScAddress&
static thread_local SCCOL nC;
static thread_local SCROW nR;
ScAddress aOrg;
- if ( !GetMatrixOrigin( pDoc, aOrg ) )
+ if ( !GetMatrixOrigin( rDoc, aOrg ) )
return sc::MatrixEdge::Nothing;
if ( aOrg != rOrgPos )
{ // First time or a different matrix than last time.
@@ -2899,7 +2899,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument* pDoc, ScAddress&
{
pCell = rDocument.GetFormulaCell(aAdr);
if (pCell && pCell->cMatrixFlag == ScMatrixMode::Reference &&
- pCell->GetMatrixOrigin(&rDocument, aTmpOrg) && aTmpOrg == aOrg)
+ pCell->GetMatrixOrigin(rDocument, aTmpOrg) && aTmpOrg == aOrg)
{
nC++;
aAdr.IncCol();
@@ -2914,7 +2914,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument* pDoc, ScAddress&
{
pCell = rDocument.GetFormulaCell(aAdr);
if (pCell && pCell->cMatrixFlag == ScMatrixMode::Reference &&
- pCell->GetMatrixOrigin(&rDocument, aTmpOrg) && aTmpOrg == aOrg)
+ pCell->GetMatrixOrigin(rDocument, aTmpOrg) && aTmpOrg == aOrg)
{
nR++;
aAdr.IncRow();
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index bbb8471a8551..9ba0d854a4ca 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -1194,18 +1194,18 @@ void ScPatternAttr::SetStyleSheet( ScStyleSheet* pNewStyle, bool bClearDirectFor
}
}
-void ScPatternAttr::UpdateStyleSheet(const ScDocument* pDoc)
+void ScPatternAttr::UpdateStyleSheet(const ScDocument& rDoc)
{
if (pName)
{
- pStyle = static_cast<ScStyleSheet*>(pDoc->GetStyleSheetPool()->Find(*pName, SfxStyleFamily::Para));
+ pStyle = static_cast<ScStyleSheet*>(rDoc.GetStyleSheetPool()->Find(*pName, SfxStyleFamily::Para));
// use Standard if Style is not found,
// to avoid empty display in Toolbox-Controller
// Assumes that "Standard" is always the 1st entry!
if (!pStyle)
{
- std::unique_ptr<SfxStyleSheetIterator> pIter = pDoc->GetStyleSheetPool()->CreateIterator(SfxStyleFamily::Para);
+ std::unique_ptr<SfxStyleSheetIterator> pIter = rDoc.GetStyleSheetPool()->CreateIterator(SfxStyleFamily::Para);
pStyle = dynamic_cast< ScStyleSheet* >(pIter->First());
}
diff --git a/sc/source/core/data/poolhelp.cxx b/sc/source/core/data/poolhelp.cxx
index f29268d7bc72..dc7e5e6a7cbf 100644
--- a/sc/source/core/data/poolhelp.cxx
+++ b/sc/source/core/data/poolhelp.cxx
@@ -27,16 +27,15 @@
#include <docpool.hxx>
#include <stlpool.hxx>
-ScPoolHelper::ScPoolHelper( ScDocument* pSourceDoc )
-:pEditPool(nullptr)
-,pEnginePool(nullptr)
-,m_pSourceDoc(pSourceDoc)
+ScPoolHelper::ScPoolHelper( ScDocument& rSourceDoc )
+ : pEditPool(nullptr)
+ , pEnginePool(nullptr)
+ , m_rSourceDoc(rSourceDoc)
{
- OSL_ENSURE( pSourceDoc, "ScPoolHelper: no document" );
pDocPool = new ScDocumentPool;
pDocPool->FreezeIdRanges();
- mxStylePool = new ScStyleSheetPool( *pDocPool, pSourceDoc );
+ mxStylePool = new ScStyleSheetPool( *pDocPool, &rSourceDoc );
}
ScPoolHelper::~ScPoolHelper()
@@ -96,7 +95,7 @@ std::unique_ptr<SvNumberFormatter> ScPoolHelper::CreateNumberFormatter() const
osl::MutexGuard aGuard(&maMtxCreateNumFormatter);
p.reset(new SvNumberFormatter(comphelper::getProcessComponentContext(), LANGUAGE_SYSTEM));
}
- p->SetColorLink( LINK(m_pSourceDoc, ScDocument, GetUserDefinedColor) );
+ p->SetColorLink( LINK(&m_rSourceDoc, ScDocument, GetUserDefinedColor) );
p->SetEvalDateFormat(NF_EVALDATEFORMAT_INTL_FORMAT);
sal_uInt16 d,m;
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index c64dbf9b0d72..f20dc524c487 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -596,7 +596,7 @@ void ScTable::CopyCellToDocument(SCCOL nSrcCol, SCROW nSrcRow, SCCOL nDestCol, S
namespace {
-bool CheckAndDeduplicateCondFormat(ScDocument* pDocument, ScConditionalFormat* pOldFormat, const ScConditionalFormat* pNewFormat, SCTAB nTab)
+bool CheckAndDeduplicateCondFormat(ScDocument& rDocument, ScConditionalFormat* pOldFormat, const ScConditionalFormat* pNewFormat, SCTAB nTab)
{
if (!pOldFormat)
return false;
@@ -609,7 +609,7 @@ bool CheckAndDeduplicateCondFormat(ScDocument* pDocument, ScConditionalFormat* p
{
rDstRangeList.Join(rNewRangeList[i]);
}
- pDocument->AddCondFormatData(rNewRangeList, nTab, pOldFormat->GetKey());
+ rDocument.AddCondFormatData(rNewRangeList, nTab, pOldFormat->GetKey());
return true;
}
@@ -643,7 +643,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
aRefCxt.mnTabDelta = nTab - pTable->nTab;
pNewFormat->UpdateReference(aRefCxt, true);
- if (bSameDoc && pTable->nTab == nTab && CheckAndDeduplicateCondFormat(&rDocument, mpCondFormatList->GetFormat(rxCondFormat->GetKey()), pNewFormat.get(), nTab))
+ if (bSameDoc && pTable->nTab == nTab && CheckAndDeduplicateCondFormat(rDocument, mpCondFormatList->GetFormat(rxCondFormat->GetKey()), pNewFormat.get(), nTab))
{
continue;
}
@@ -653,7 +653,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
{
// Check if there is the same format in the destination
// If there is, then simply expand its range
- if (CheckAndDeduplicateCondFormat(&rDocument, rxCond.get(), pNewFormat.get(), nTab))
+ if (CheckAndDeduplicateCondFormat(rDocument, rxCond.get(), pNewFormat.get(), nTab))
{
bDuplicate = true;
break;
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 09a17546c002..2bd2076689b0 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -482,7 +482,7 @@ void ScTable::FillFormula(
if ( bLast && pDestCell->GetMatrixFlag() != ScMatrixMode::NONE )
{
ScAddress aOrg;
- if ( pDestCell->GetMatrixOrigin( &GetDoc(), aOrg ) )
+ if ( pDestCell->GetMatrixOrigin( GetDoc(), aOrg ) )
{
if ( nDestCol >= aOrg.Col() && nDestRow >= aOrg.Row() )
{
diff --git a/sc/source/core/inc/poolhelp.hxx b/sc/source/core/inc/poolhelp.hxx
index c7cf0639fba5..23fa529f7088 100644
--- a/sc/source/core/inc/poolhelp.hxx
+++ b/sc/source/core/inc/poolhelp.hxx
@@ -41,10 +41,10 @@ private:
mutable std::unique_ptr<SvNumberFormatter> pFormTable;
mutable SfxItemPool* pEditPool; // EditTextObjectPool
mutable SfxItemPool* pEnginePool; // EditEnginePool
- ScDocument* m_pSourceDoc;
+ ScDocument& m_rSourceDoc;
public:
- ScPoolHelper( ScDocument* pSourceDoc );
+ ScPoolHelper( ScDocument& rSourceDoc );
virtual ~ScPoolHelper() override;
// called in dtor of main document
diff --git a/sc/source/core/tool/chartarr.cxx b/sc/source/core/tool/chartarr.cxx
index 5a3d21c69c33..7b4637bc5b6e 100644
--- a/sc/source/core/tool/chartarr.cxx
+++ b/sc/source/core/tool/chartarr.cxx
@@ -55,9 +55,9 @@ ScMemChart::~ScMemChart()
}
ScChartArray::ScChartArray(
- ScDocument* pDoc, const ScRangeListRef& rRangeList ) :
- pDocument( pDoc ),
- aPositioner(pDoc, rRangeList) {}
+ ScDocument& rDoc, const ScRangeListRef& rRangeList ) :
+ rDocument( rDoc ),
+ aPositioner(rDoc, rRangeList) {}
std::unique_ptr<ScMemChart> ScChartArray::CreateMemChart()
{
@@ -135,12 +135,12 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle()
// Skip hidden columns.
// TODO: make use of last column value once implemented.
SCCOL nLastCol = -1;
- while (pDocument->ColHidden(nCol1, nTab1, nullptr, &nLastCol))
+ while (rDocument.ColHidden(nCol1, nTab1, nullptr, &nLastCol))
++nCol1;
// Skip hidden rows.
SCROW nLastRow = -1;
- if (pDocument->RowHidden(nRow1, nTab1, nullptr, &nLastRow))
+ if (rDocument.RowHidden(nRow1, nTab1, nullptr, &nLastRow))
nRow1 = nLastRow + 1;
// if everything is hidden then the label remains at the beginning
@@ -161,7 +161,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle()
for (SCSIZE i=0; i<nTotalCols; i++)
{
SCCOL nThisCol = sal::static_int_cast<SCCOL>(nCol1+i);
- if (!pDocument->ColHidden(nThisCol, nTab1, nullptr, &nLastCol))
+ if (!rDocument.ColHidden(nThisCol, nTab1, nullptr, &nLastCol))
aCols.push_back(nThisCol);
}
SCSIZE nColCount = aCols.size();
@@ -175,7 +175,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle()
SCROW nThisRow = nRow1;
while (nThisRow <= nRow2)
{
- if (pDocument->RowHidden(nThisRow, nTab1, nullptr, &nLastRow))
+ if (rDocument.RowHidden(nThisRow, nTab1, nullptr, &nLastRow))
nThisRow = nLastRow;
else
aRows.push_back(nThisRow);
@@ -210,14 +210,14 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle()
if ( bValidData )
{
- bool bCalcAsShown = pDocument->GetDocOptions().IsCalcAsShown();
+ bool bCalcAsShown = rDocument.GetDocOptions().IsCalcAsShown();
for (nCol=0; nCol<nColCount; nCol++)
{
for (nRow=0; nRow<nRowCount; nRow++)
{
// DBL_MIN is a Hack for Chart to recognize empty cells.
ScAddress aPos(aCols[nCol], aRows[nRow], nTab1);
- double nVal = getCellValue(*pDocument, aPos, DBL_MIN, bCalcAsShown);
+ double nVal = getCellValue(rDocument, aPos, DBL_MIN, bCalcAsShown);
pMemChart->SetData(nCol, nRow, nVal);
}
}
@@ -236,7 +236,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle()
{
OUString aString;
if (HasColHeaders())
- aString = pDocument->GetString(aCols[nCol], nStrRow, nTab1);
+ aString = rDocument.GetString(aCols[nCol], nStrRow, nTab1);
if (aString.isEmpty())
{
OUStringBuffer aBuf;
@@ -258,7 +258,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartSingle()
OUString aString;
if (HasRowHeaders())
{
- aString = pDocument->GetString(nStrCol, aRows[nRow], nTab1);
+ aString = rDocument.GetString(nStrCol, aRows[nRow], nTab1);
}
if (aString.isEmpty())
{
@@ -303,7 +303,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti()
SCSIZE nCol = 0;
SCSIZE nRow = 0;
- bool bCalcAsShown = pDocument->GetDocOptions().IsCalcAsShown();
+ bool bCalcAsShown = rDocument.GetDocOptions().IsCalcAsShown();
sal_uLong nIndex = 0;
if (bValidData)
{
@@ -315,7 +315,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti()
const ScAddress* pPos = GetPositionMap()->GetPosition( nIndex );
if (pPos)
// otherwise: Gap
- nVal = getCellValue(*pDocument, *pPos, DBL_MIN, bCalcAsShown);
+ nVal = getCellValue(rDocument, *pPos, DBL_MIN, bCalcAsShown);
pMemChart->SetData(nCol, nRow, nVal);
}
@@ -329,7 +329,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti()
const ScAddress* pPos = GetPositionMap()->GetPosition( nIndex );
if (pPos)
// otherwise: Gap
- nVal = getCellValue(*pDocument, *pPos, DBL_MIN, bCalcAsShown);
+ nVal = getCellValue(rDocument, *pPos, DBL_MIN, bCalcAsShown);
pMemChart->SetData(nCol, nRow, nVal);
}
@@ -345,7 +345,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti()
OUString aString;
const ScAddress* pPos = GetPositionMap()->GetColHeaderPosition( static_cast<SCCOL>(nCol) );
if ( HasColHeaders() && pPos )
- aString = pDocument->GetString(pPos->Col(), pPos->Row(), pPos->Tab());
+ aString = rDocument.GetString(pPos->Col(), pPos->Row(), pPos->Tab());
if (aString.isEmpty())
{
@@ -370,7 +370,7 @@ std::unique_ptr<ScMemChart> ScChartArray::CreateMemChartMulti()
OUString aString;
const ScAddress* pPos = GetPositionMap()->GetRowHeaderPosition( nRow );
if ( HasRowHeaders() && pPos )
- aString = pDocument->GetString(pPos->Col(), pPos->Row(), pPos->Tab());
+ aString = rDocument.GetString(pPos->Col(), pPos->Row(), pPos->Tab());
if (aString.isEmpty())
{
diff --git a/sc/source/core/tool/chartpos.cxx b/sc/source/core/tool/chartpos.cxx
index 89326661f319..1d2cdc53f018 100644
--- a/sc/source/core/tool/chartpos.cxx
+++ b/sc/source/core/tool/chartpos.cxx
@@ -26,14 +26,14 @@
namespace
{
- bool lcl_hasValueDataButNoDates( const ScDocument* pDocument, SCCOL nCol, SCROW nRow, SCTAB nTab )
+ bool lcl_hasValueDataButNoDates( const ScDocument& rDocument, SCCOL nCol, SCROW nRow, SCTAB nTab )
{
bool bReturn = false;
- if (pDocument->HasValueData( nCol, nRow, nTab ))
+ if (rDocument.HasValueData( nCol, nRow, nTab ))
{
//treat dates like text #i25706#
- sal_uInt32 nNumberFormat = pDocument->GetNumberFormat( ScAddress( nCol, nRow, nTab ) );
- SvNumFormatType nType = pDocument->GetFormatTable()->GetType(nNumberFormat);
+ sal_uInt32 nNumberFormat = rDocument.GetNumberFormat( ScAddress( nCol, nRow, nTab ) );
+ SvNumFormatType nType = rDocument.GetFormatTable()->GetType(nNumberFormat);
bool bIsDate(nType & SvNumFormatType::DATE);
bReturn = !bIsDate;
}
@@ -41,9 +41,9 @@ namespace
}
}
-ScChartPositioner::ScChartPositioner( ScDocument* pDoc, SCTAB nTab,
+ScChartPositioner::ScChartPositioner( ScDocument& rDoc, SCTAB nTab,
SCCOL nStartColP, SCROW nStartRowP, SCCOL nEndColP, SCROW nEndRowP) :
- pDocument( pDoc ),
+ rDocument( rDoc ),
eGlue( ScChartGlue::NA ),
nStartCol(0),
nStartRow(0),
@@ -55,9 +55,9 @@ ScChartPositioner::ScChartPositioner( ScDocument* pDoc, SCTAB nTab,
CheckColRowHeaders();
}
-ScChartPositioner::ScChartPositioner( ScDocument* pDoc, const ScRangeListRef& rRangeList ) :
+ScChartPositioner::ScChartPositioner( ScDocument& rDoc, const ScRangeListRef& rRangeList ) :
aRangeListRef( rRangeList ),
- pDocument( pDoc ),
+ rDocument( rDoc ),
eGlue( ScChartGlue::NA ),
nStartCol(0),
nStartRow(0),
@@ -71,7 +71,7 @@ ScChartPositioner::ScChartPositioner( ScDocument* pDoc, const ScRangeListRef& rR
ScChartPositioner::ScChartPositioner( const ScChartPositioner& rPositioner ) :
aRangeListRef( rPositioner.aRangeListRef ),
- pDocument(rPositioner.pDocument),
+ rDocument(rPositioner.rDocument),
eGlue(rPositioner.eGlue),
nStartCol(rPositioner.nStartCol),
nStartRow(rPositioner.nStartRow),
@@ -285,12 +285,12 @@ void ScChartPositioner::CheckColRowHeaders()
{
for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++)
{
- if (lcl_hasValueDataButNoDates( pDocument, iCol, nRow1, nTab1 ))
+ if (lcl_hasValueDataButNoDates( rDocument, iCol, nRow1, nTab1 ))
bColStrings = false;
}
for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++)
{
- if (lcl_hasValueDataButNoDates( pDocument, nCol1, iRow, nTab1 ))
+ if (lcl_hasValueDataButNoDates( rDocument, nCol1, iRow, nTab1 ))
bRowStrings = false;
}
}
@@ -312,7 +312,7 @@ void ScChartPositioner::CheckColRowHeaders()
if ( nCol1 <= nCol2 )
for (iRow=nRow1; iRow<=nRow2 && bRowStrings; iRow++)
{
- if (lcl_hasValueDataButNoDates( pDocument, nCol1, iRow, nTab1 ))
+ if (lcl_hasValueDataButNoDates( rDocument, nCol1, iRow, nTab1 ))
bRowStrings = false;
}
}
@@ -321,7 +321,7 @@ void ScChartPositioner::CheckColRowHeaders()
if ( nRow1 <= nRow2 )
for (iCol=nCol1; iCol<=nCol2 && bColStrings; iCol++)
{
- if (lcl_hasValueDataButNoDates( pDocument, iCol, nRow1, nTab1 ))
+ if (lcl_hasValueDataButNoDates( rDocument, iCol, nRow1, nTab1 ))
bColStrings = false;
}
}
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 06ad5357a0d9..bd40a24b3eb5 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -2917,7 +2917,7 @@ void ScChangeTrack::Dependencies( ScChangeAction* pAct )
if ( ScChangeActionContent::GetContentCellType(rCell) == SC_CACCT_MATREF )
{
ScAddress aOrg;
- bool bOrgFound = rCell.mpFormula->GetMatrixOrigin(&rDoc, aOrg);
+ bool bOrgFound = rCell.mpFormula->GetMatrixOrigin(rDoc, aOrg);
ScChangeActionContent* pContent = (bOrgFound ? SearchContentAt( aOrg, pAct ) : nullptr);
if ( pContent && pContent->IsMatrixOrigin() )
{
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 7393144f764c..d4c1ab66ec2e 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -1386,7 +1386,7 @@ void ScDetectiveFunc::GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n
{
vector<ScTokenRef> aSrcRange;
aSrcRange.push_back(
- ScRefTokenHelper::createRefToken(&rDoc, ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab)));
+ ScRefTokenHelper::createRefToken(rDoc, ScRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab)));
ScCellIterator aIter(rDoc, ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab));
for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
@@ -1403,7 +1403,7 @@ void ScDetectiveFunc::GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n
if (ScRefTokenHelper::intersects(&rDoc, aSrcRange, pRef, aPos))
{
// This address is absolute.
- pRef = ScRefTokenHelper::createRefToken(&rDoc, aPos);
+ pRef = ScRefTokenHelper::createRefToken(rDoc, aPos);
ScRefTokenHelper::join(&rDoc, rRefTokens, pRef, ScAddress());
}
}
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index 74319f5a77d0..58d9353222dc 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -447,19 +447,19 @@ bool ScRefTokenHelper::getDoubleRefDataFromToken(ScComplexRefData& rData, const
return true;
}
-ScTokenRef ScRefTokenHelper::createRefToken(const ScDocument* pDoc, const ScAddress& rAddr)
+ScTokenRef ScRefTokenHelper::createRefToken(const ScDocument& rDoc, const ScAddress& rAddr)
{
ScSingleRefData aRefData;
aRefData.InitAddress(rAddr);
- ScTokenRef pRef(new ScSingleRefToken(pDoc->GetSheetLimits(), aRefData));
+ ScTokenRef pRef(new ScSingleRefToken(rDoc.GetSheetLimits(), aRefData));
return pRef;
}
-ScTokenRef ScRefTokenHelper::createRefToken(const ScDocument* pDoc, const ScRange& rRange)
+ScTokenRef ScRefTokenHelper::createRefToken(const ScDocument& rDoc, const ScRange& rRange)
{
ScComplexRefData aRefData;
aRefData.InitRange(rRange);
- ScTokenRef pRef(new ScDoubleRefToken(pDoc->GetSheetLimits(), aRefData));
+ ScTokenRef pRef(new ScDoubleRefToken(rDoc.GetSheetLimits(), aRefData));
return pRef;
}