summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-09-15 12:01:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-09-16 14:22:01 +0200
commitb979802fc92c8386fa35893f3c620082cec8fbde (patch)
tree6a6088a5a102c944a95ca797a25f8923358f13a3 /sc/source
parent120588850a43910fd2a6cd5ff903feece714b525 (diff)
ScTable ctor never called with a null ScDocument*
Change-Id: I183fd26df45ddd4e7432833c5c77b07b64e03609 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102842 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/documen2.cxx12
-rw-r--r--sc/source/core/data/document.cxx20
-rw-r--r--sc/source/core/data/documentimport.cxx2
-rw-r--r--sc/source/core/data/table1.cxx176
-rw-r--r--sc/source/core/data/table2.cxx300
-rw-r--r--sc/source/core/data/table3.cxx74
-rw-r--r--sc/source/core/data/table4.cxx64
-rw-r--r--sc/source/core/data/table5.cxx40
-rw-r--r--sc/source/core/data/table6.cxx40
-rw-r--r--sc/source/core/data/table7.cxx18
10 files changed, 373 insertions, 373 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 3e08ae45a35d..6015aa596b55 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -495,7 +495,7 @@ void ScDocument::ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks )
OUString aString = pSourceDoc->maTabs[i]->GetName();
if ( i < static_cast<SCTAB>(maTabs.size()) )
{
- maTabs[i].reset( new ScTable(this, i, aString) );
+ maTabs[i].reset( new ScTable(*this, i, aString) );
}
else
@@ -504,7 +504,7 @@ void ScDocument::ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks )
{
maTabs.resize(i);
}
- maTabs.emplace_back(new ScTable(this, i, aString));
+ maTabs.emplace_back(new ScTable(*this, i, aString));
}
maTabs[i]->SetLayoutRTL( pSourceDoc->maTabs[i]->IsLayoutRTL() );
}
@@ -524,7 +524,7 @@ void ScDocument::ResetClip( ScDocument* pSourceDoc, SCTAB nTab )
{
maTabs.resize(nTab+1);
}
- maTabs[nTab].reset( new ScTable(this, nTab, "baeh") );
+ maTabs[nTab].reset( new ScTable(*this, nTab, "baeh") );
if (nTab < static_cast<SCTAB>(pSourceDoc->maTabs.size()) && pSourceDoc->maTabs[nTab])
maTabs[nTab]->SetLayoutRTL( pSourceDoc->maTabs[nTab]->IsLayoutRTL() );
}
@@ -541,7 +541,7 @@ void ScDocument::EnsureTable( SCTAB nTab )
maTabs.resize(nTab+1);
if (!maTabs[nTab])
- maTabs[nTab].reset( new ScTable(this, nTab, "temp", bExtras, bExtras) );
+ maTabs[nTab].reset( new ScTable(*this, nTab, "temp", bExtras, bExtras) );
}
ScRefCellValue ScDocument::GetRefCellValue( const ScAddress& rPos )
@@ -790,7 +790,7 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM
if (nNewPos >= static_cast<SCTAB>(maTabs.size()))
{
nNewPos = static_cast<SCTAB>(maTabs.size());
- maTabs.emplace_back(new ScTable(this, nNewPos, aName));
+ maTabs.emplace_back(new ScTable(*this, nNewPos, aName));
}
else
{
@@ -820,7 +820,7 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM
(*it)->UpdateInsertTab(aCxt);
if (nNewPos <= nOldPos)
nOldPos++;
- maTabs.emplace(maTabs.begin() + nNewPos, new ScTable(this, nNewPos, aName));
+ maTabs.emplace(maTabs.begin() + nNewPos, new ScTable(*this, nNewPos, aName));
bValid = true;
for (TableContainer::iterator it = maTabs.begin(); it != maTabs.end(); ++it)
if (*it && it != maTabs.begin()+nOldPos && it != maTabs.begin() + nNewPos)
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 86fe8a318263..553b7e5f42af 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -177,13 +177,13 @@ void ScDocument::MakeTable( SCTAB nTab,bool _bNeedsNameCheck )
CreateValidTabName( aString ); // no doubles
if (nTab < static_cast<SCTAB>(maTabs.size()))
{
- maTabs[nTab].reset( new ScTable(this, nTab, aString) );
+ maTabs[nTab].reset( new ScTable(*this, nTab, aString) );
}
else
{
while(nTab > static_cast<SCTAB>(maTabs.size()))
maTabs.push_back(nullptr);
- maTabs.emplace_back( new ScTable(this, nTab, aString) );
+ maTabs.emplace_back( new ScTable(*this, nTab, aString) );
}
maTabs[nTab]->SetLoadingMedium(bLoadingMedium);
}
@@ -478,7 +478,7 @@ void ScDocument::AppendTabOnLoad(const OUString& rName)
OUString aName = rName;
CreateValidTabName(aName);
- maTabs.emplace_back( new ScTable(this, nTabCount, aName) );
+ maTabs.emplace_back( new ScTable(*this, nTabCount, aName) );
}
void ScDocument::SetTabNameOnLoad(SCTAB nTab, const OUString& rName)
@@ -513,7 +513,7 @@ bool ScDocument::InsertTab(
if (nPos == SC_TAB_APPEND || nPos >= nTabCount)
{
nPos = maTabs.size();
- maTabs.emplace_back( new ScTable(this, nTabCount, rName) );
+ maTabs.emplace_back( new ScTable(*this, nTabCount, rName) );
if ( bExternalDocument )
maTabs[nTabCount]->SetVisible( false );
}
@@ -544,7 +544,7 @@ bool ScDocument::InsertTab(
if (a)
a->UpdateInsertTab(aCxt);
}
- maTabs.emplace(maTabs.begin() + nPos, new ScTable(this, nPos, rName));
+ maTabs.emplace(maTabs.begin() + nPos, new ScTable(*this, nPos, rName));
// UpdateBroadcastAreas must be called between UpdateInsertTab,
// which ends listening, and StartAllListeners, to not modify
@@ -602,7 +602,7 @@ bool ScDocument::InsertTabs( SCTAB nPos, const std::vector<OUString>& rNames,
{
for ( SCTAB i = 0; i < nNewSheets; ++i )
{
- maTabs.emplace_back( new ScTable(this, nTabCount + i, rNames.at(i)) );
+ maTabs.emplace_back( new ScTable(*this, nTabCount + i, rNames.at(i)) );
}
}
else
@@ -633,7 +633,7 @@ bool ScDocument::InsertTabs( SCTAB nPos, const std::vector<OUString>& rNames,
}
for (SCTAB i = 0; i < nNewSheets; ++i)
{
- maTabs.emplace(maTabs.begin() + nPos + i, new ScTable(this, nPos + i, rNames.at(i)) );
+ maTabs.emplace(maTabs.begin() + nPos + i, new ScTable(*this, nPos + i, rNames.at(i)) );
}
// UpdateBroadcastAreas must be called between UpdateInsertTab,
@@ -1987,7 +1987,7 @@ void ScDocument::InitUndoSelected( const ScDocument* pSrcDoc, const ScMarkData&
for (SCTAB nTab = 0; nTab <= rTabSelection.GetLastSelected(); nTab++)
if ( rTabSelection.GetTableSelect( nTab ) )
{
- ScTableUniquePtr pTable(new ScTable(this, nTab, OUString(), bColInfo, bRowInfo));
+ ScTableUniquePtr pTable(new ScTable(*this, nTab, OUString(), bColInfo, bRowInfo));
if (nTab < static_cast<SCTAB>(maTabs.size()))
maTabs[nTab] = std::move(pTable);
else
@@ -2028,7 +2028,7 @@ void ScDocument::InitUndo( const ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2,
maTabs.resize(nTab2 + 1);
for (SCTAB nTab = nTab1; nTab <= nTab2; nTab++)
{
- maTabs[nTab].reset(new ScTable(this, nTab, OUString(), bColInfo, bRowInfo));
+ maTabs[nTab].reset(new ScTable(*this, nTab, OUString(), bColInfo, bRowInfo));
}
}
@@ -2048,7 +2048,7 @@ void ScDocument::AddUndoTab( SCTAB nTab1, SCTAB nTab2, bool bColInfo, bool bRowI
for (SCTAB nTab = nTab1; nTab <= nTab2; nTab++)
if (!maTabs[nTab])
{
- maTabs[nTab].reset( new ScTable(this, nTab, OUString(), bColInfo, bRowInfo) );
+ maTabs[nTab].reset( new ScTable(*this, nTab, OUString(), bColInfo, bRowInfo) );
}
}
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 224dfeacae6f..3b6a1e5315bf 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -163,7 +163,7 @@ bool ScDocumentImport::appendSheet(const OUString& rName)
if (!ValidTab(nTabCount))
return false;
- mpImpl->mrDoc.maTabs.emplace_back(new ScTable(&mpImpl->mrDoc, nTabCount, rName));
+ mpImpl->mrDoc.maTabs.emplace_back(new ScTable(mpImpl->mrDoc, nTabCount, rName));
return true;
}
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 9d70e081b1ae..331b5a7c3513 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -229,9 +229,9 @@ bool SetOptimalHeightsToRows(
}
-ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
+ScTable::ScTable( ScDocument& rDoc, SCTAB nNewTab, const OUString& rNewName,
bool bColInfo, bool bRowInfo ) :
- aCol( pDoc->GetSheetLimits(), INITIALCOLCOUNT ),
+ aCol( rDoc.GetSheetLimits(), INITIALCOLCOUNT ),
aName( rNewName ),
aCodeName( rNewName ),
nLinkRefreshDelay( 0 ),
@@ -242,14 +242,14 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
nRepeatStartY( SCROW_REPEAT_NONE ),
nRepeatEndY( SCROW_REPEAT_NONE ),
mpRowHeights( static_cast<ScFlatUInt16RowSegments*>(nullptr) ),
- mpHiddenCols(new ScFlatBoolColSegments(pDoc->MaxCol())),
- mpHiddenRows(new ScFlatBoolRowSegments(pDoc->MaxRow())),
- mpFilteredCols(new ScFlatBoolColSegments(pDoc->MaxCol())),
- mpFilteredRows(new ScFlatBoolRowSegments(pDoc->MaxRow())),
+ mpHiddenCols(new ScFlatBoolColSegments(rDoc.MaxCol())),
+ mpHiddenRows(new ScFlatBoolRowSegments(rDoc.MaxRow())),
+ mpFilteredCols(new ScFlatBoolColSegments(rDoc.MaxCol())),
+ mpFilteredRows(new ScFlatBoolRowSegments(rDoc.MaxRow())),
nTableAreaX( 0 ),
nTableAreaY( 0 ),
nTab( nNewTab ),
- pDocument( pDoc ),
+ rDocument( rDoc ),
pSortCollator( nullptr ),
nLockCount( 0 ),
aScenarioColor( COL_LIGHTGRAY ),
@@ -271,46 +271,46 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
bActiveScenario(false),
mbPageBreaksValid(false),
mbForceBreaks(false),
- aDefaultColAttrArray(static_cast<SCCOL>(-1), nNewTab, pDoc, nullptr)
+ aDefaultColAttrArray(static_cast<SCCOL>(-1), nNewTab, &rDoc, nullptr)
{
if (bColInfo)
{
- mpColWidth.reset( new ScCompressedArray<SCCOL, sal_uInt16>( pDocument->MaxCol()+1, STD_COL_WIDTH ) );
- mpColFlags.reset( new ScBitMaskCompressedArray<SCCOL, CRFlags>( pDocument->MaxCol()+1, CRFlags::NONE ) );
+ mpColWidth.reset( new ScCompressedArray<SCCOL, sal_uInt16>( rDocument.MaxCol()+1, STD_COL_WIDTH ) );
+ mpColFlags.reset( new ScBitMaskCompressedArray<SCCOL, CRFlags>( rDocument.MaxCol()+1, CRFlags::NONE ) );
}
if (bRowInfo)
{
- mpRowHeights.reset(new ScFlatUInt16RowSegments(pDocument->MaxRow(), ScGlobal::nStdRowHeight));
- pRowFlags.reset(new ScBitMaskCompressedArray<SCROW, CRFlags>( pDocument->MaxRow(), CRFlags::NONE));
+ mpRowHeights.reset(new ScFlatUInt16RowSegments(rDocument.MaxRow(), ScGlobal::nStdRowHeight));
+ pRowFlags.reset(new ScBitMaskCompressedArray<SCROW, CRFlags>( rDocument.MaxRow(), CRFlags::NONE));
}
- if ( pDocument->IsDocVisible() )
+ if ( rDocument.IsDocVisible() )
{
// when a sheet is added to a visible document,
// initialize its RTL flag from the system locale
bLayoutRTL = ScGlobal::IsSystemRTL();
}
- ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
if (pDrawLayer)
{
if ( pDrawLayer->ScAddPage( nTab ) ) // sal_False (not inserted) during Undo
{
pDrawLayer->ScRenamePage( nTab, aName );
- sal_uLong const nx = sal_uLong(double(pDocument->MaxCol()+1) * STD_COL_WIDTH * HMM_PER_TWIPS );
- sal_uLong ny = static_cast<sal_uLong>(double(pDocument->MaxRow()+1) * ScGlobal::nStdRowHeight * HMM_PER_TWIPS );
+ sal_uLong const nx = sal_uLong(double(rDocument.MaxCol()+1) * STD_COL_WIDTH * HMM_PER_TWIPS );
+ sal_uLong ny = static_cast<sal_uLong>(double(rDocument.MaxRow()+1) * ScGlobal::nStdRowHeight * HMM_PER_TWIPS );
pDrawLayer->SetPageSize( static_cast<sal_uInt16>(nTab), Size( nx, ny ), false );
}
}
for (SCCOL k=0; k < aCol.size(); k++)
- aCol[k].Init( k, nTab, pDocument, true );
+ aCol[k].Init( k, nTab, &rDocument, true );
}
ScTable::~ScTable() COVERITY_NOEXCEPT_FALSE
{
- if (!pDocument->IsInDtorClear())
+ if (!rDocument.IsInDtorClear())
{
for (SCCOL nCol = 0; nCol < (aCol.size() - 1); ++nCol)
{
@@ -320,7 +320,7 @@ ScTable::~ScTable() COVERITY_NOEXCEPT_FALSE
// (or else nTab does not reflect the page number!)
// In ScDocument::Clear is afterwards used from Clear at the Draw Layer to delete everything.
- ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
if (pDrawLayer)
pDrawLayer->ScRemovePage( nTab );
}
@@ -369,7 +369,7 @@ void ScTable::SetStreamValid( bool bSet, bool bIgnoreLock )
{
if (!bStreamValid && !bSet)
return; // shortcut
- if ( bIgnoreLock || !pDocument->IsStreamValidLocked() )
+ if ( bIgnoreLock || !rDocument.IsStreamValidLocked() )
bStreamValid = bSet;
}
@@ -456,14 +456,14 @@ bool ScTable::SetOptimalHeight(
OSL_ENSURE( rCxt.getExtraHeight() == 0 || rCxt.isForceAutoSize(),
"automatic OptimalHeight with Extra" );
- if ( pDocument->IsAdjustHeightLocked() )
+ if ( rDocument.IsAdjustHeightLocked() )
{
return false;
}
SCSIZE nCount = static_cast<SCSIZE>(nEndRow-nStartRow+1);
- ScProgress* pProgress = GetProgressBar(nCount, GetWeightedCount(), pOuterProgress, pDocument);
+ ScProgress* pProgress = GetProgressBar(nCount, GetWeightedCount(), pOuterProgress, &rDocument);
mpRowHeights->enableTreeSearch(false);
@@ -487,12 +487,12 @@ void ScTable::SetOptimalHeightOnly(
OSL_ENSURE( rCxt.getExtraHeight() == 0 || rCxt.isForceAutoSize(),
"automatic OptimalHeight with Extra" );
- if ( pDocument->IsAdjustHeightLocked() )
+ if ( rDocument.IsAdjustHeightLocked() )
return;
SCSIZE nCount = static_cast<SCSIZE>(nEndRow-nStartRow+1);
- ScProgress* pProgress = GetProgressBar(nCount, GetWeightedCount(), pOuterProgress, pDocument);
+ ScProgress* pProgress = GetProgressBar(nCount, GetWeightedCount(), pOuterProgress, &rDocument);
GetOptimalHeightsInColumn(rCxt, aCol, nStartRow, nEndRow, pProgress, nProgressStart);
@@ -603,7 +603,7 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes ) const
}
}
- if (nMaxX == pDocument->MaxCol()) // omit attribute at the right
+ if (nMaxX == rDocument.MaxCol()) // omit attribute at the right
{
--nMaxX;
while ( nMaxX>0 && aCol[nMaxX].IsVisibleAttrEqual(aCol[nMaxX+1]) )
@@ -658,7 +658,7 @@ bool ScTable::GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow,
}
}
- if (nMaxX == pDocument->MaxCol()) // omit attribute at the right
+ if (nMaxX == rDocument.MaxCol()) // omit attribute at the right
{
--nMaxX;
while ( nMaxX>0 && aCol[nMaxX].IsVisibleAttrEqual(aCol[nMaxX+1], nStartRow, nEndRow) )
@@ -727,7 +727,7 @@ bool ScTable::GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const
{
bool bFound = false;
SCCOL nMinX = aCol.size()-1;
- SCROW nMinY = pDocument->MaxRow();
+ SCROW nMinY = rDocument.MaxRow();
SCCOL i;
for (i=0; i<aCol.size(); i++) // Test attribute
@@ -819,7 +819,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
SCROW nStart = rStartRow;
SCROW nEnd = rEndRow;
if (nStart>0) --nStart;
- if (nEnd<pDocument->MaxRow()) ++nEnd;
+ if (nEnd<rDocument.MaxRow()) ++nEnd;
if (rEndCol < (aCol.size()-1))
if (!aCol[rEndCol+1].IsEmptyBlock(nStart,nEnd))
@@ -856,7 +856,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
}
}
- if (rEndRow < pDocument->MaxRow())
+ if (rEndRow < rDocument.MaxRow())
{
SCROW nTest = rEndRow+1;
bool needExtend = false;
@@ -883,7 +883,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
while ( rEndCol > 0 && rStartCol < rEndCol && aCol[rEndCol].IsEmptyBlock(rStartRow,rEndRow) )
--rEndCol;
- if ( !bTop && rStartRow < pDocument->MaxRow() && rStartRow < rEndRow )
+ if ( !bTop && rStartRow < rDocument.MaxRow() && rStartRow < rEndRow )
{
bool bShrink = true;
do
@@ -893,7 +893,7 @@ void ScTable::GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, S
bShrink = false;
if (bShrink)
++rStartRow;
- } while (bShrink && rStartRow < pDocument->MaxRow() && rStartRow < rEndRow);
+ } while (bShrink && rStartRow < rDocument.MaxRow() && rStartRow < rEndRow);
}
}
@@ -975,9 +975,9 @@ bool ScTable::ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rS
rEndCol = aCol.size()-1;
o_bShrunk = true;
}
- if (rEndRow > pDocument->MaxRow())
+ if (rEndRow > rDocument.MaxRow())
{
- rEndRow = pDocument->MaxRow();
+ rEndRow = rDocument.MaxRow();
o_bShrunk = true;
}
@@ -1173,17 +1173,17 @@ SCCOL ScTable::FindNextVisibleCol( SCCOL nCol, bool bRight ) const
{
nCol++;
SCCOL nEnd = 0;
- bool bHidden = pDocument->ColHidden(nCol, nTab, nullptr, &nEnd);
+ bool bHidden = rDocument.ColHidden(nCol, nTab, nullptr, &nEnd);
if(bHidden)
nCol = nEnd +1;
- return std::min<SCCOL>(pDocument->MaxCol(), nCol);
+ return std::min<SCCOL>(rDocument.MaxCol(), nCol);
}
else
{
nCol--;
- SCCOL nStart = pDocument->MaxCol();
- bool bHidden = pDocument->ColHidden(nCol, nTab, &nStart);
+ SCCOL nStart = rDocument.MaxCol();
+ bool bHidden = rDocument.ColHidden(nCol, nTab, &nStart);
if(bHidden)
nCol = nStart - 1;
@@ -1197,22 +1197,22 @@ SCCOL ScTable::FindNextVisibleColWithContent( SCCOL nCol, bool bRight, SCROW nRo
if(bRight)
{
// If nCol is the last allocated column index, there won't be any content to its right.
- // To maintain the original return behaviour, return pDocument->MaxCol().
+ // To maintain the original return behaviour, return rDocument.MaxCol().
if(nCol >= nLastCol)
- return pDocument->MaxCol();
+ return rDocument.MaxCol();
do
{
nCol++;
SCCOL nEndCol = 0;
- bool bHidden = pDocument->ColHidden( nCol, nTab, nullptr, &nEndCol );
+ bool bHidden = rDocument.ColHidden( nCol, nTab, nullptr, &nEndCol );
if(bHidden)
{
nCol = nEndCol +1;
// Can end search early as there is no data after nLastCol.
- // For nCol == nLastCol, it may still have data so don't want to return pDocument->MaxCol().
+ // For nCol == nLastCol, it may still have data so don't want to return rDocument.MaxCol().
if(nCol > nLastCol)
- return pDocument->MaxCol();
+ return rDocument.MaxCol();
}
if(aCol[nCol].HasVisibleDataAt(nRow))
@@ -1220,11 +1220,11 @@ SCCOL ScTable::FindNextVisibleColWithContent( SCCOL nCol, bool bRight, SCROW nRo
}
while(nCol < nLastCol); // Stop search as soon as the last allocated column is searched.
- return pDocument->MaxCol();
+ return rDocument.MaxCol();
}
else
{
- // If nCol is in the unallocated range [nLastCol+1, pDocument->MaxCol()], then move it directly to nLastCol
+ // If nCol is in the unallocated range [nLastCol+1, rDocument.MaxCol()], then move it directly to nLastCol
// as there is no data in the unallocated range. This also makes the search faster and avoids
// the need for more range checks in the loop below.
if ( nCol > nLastCol )
@@ -1236,8 +1236,8 @@ SCCOL ScTable::FindNextVisibleColWithContent( SCCOL nCol, bool bRight, SCROW nRo
do
{
nCol--;
- SCCOL nStartCol = pDocument->MaxCol();
- bool bHidden = pDocument->ColHidden( nCol, nTab, &nStartCol );
+ SCCOL nStartCol = rDocument.MaxCol();
+ bool bHidden = rDocument.ColHidden( nCol, nTab, &nStartCol );
if(bHidden)
{
nCol = nStartCol -1;
@@ -1265,7 +1265,7 @@ void ScTable::FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection
bool bRight = (eDirection == SC_MOVE_RIGHT);
if (bThere)
{
- if(nNewCol >= pDocument->MaxCol() && eDirection == SC_MOVE_RIGHT)
+ if(nNewCol >= rDocument.MaxCol() && eDirection == SC_MOVE_RIGHT)
return;
else if(nNewCol == 0 && eDirection == SC_MOVE_LEFT)
return;
@@ -1284,7 +1284,7 @@ void ScTable::FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection
else
bFound = true;
}
- while(!bFound && nNextCol > 0 && nNextCol < pDocument->MaxCol());
+ while(!bFound && nNextCol > 0 && nNextCol < rDocument.MaxCol());
}
else
{
@@ -1298,8 +1298,8 @@ void ScTable::FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection
if (nNewCol<0)
nNewCol=0;
- if (nNewCol>pDocument->MaxCol())
- nNewCol=pDocument->MaxCol();
+ if (nNewCol>rDocument.MaxCol())
+ nNewCol=rDocument.MaxCol();
rCol = nNewCol;
}
else
@@ -1309,9 +1309,9 @@ void ScTable::FindAreaPos( SCCOL& rCol, SCROW& rRow, ScMoveDirection eDirection
else
{
// The cell (rCol, rRow) is equivalent to an empty cell (although not allocated).
- // Set rRow to 0 or pDocument->MaxRow() depending on eDirection to maintain the behaviour of
+ // Set rRow to 0 or rDocument.MaxRow() depending on eDirection to maintain the behaviour of
// ScColumn::FindDataAreaPos() when the given column is empty.
- rRow = ( eDirection == SC_MOVE_DOWN ) ? pDocument->MaxRow() : 0;
+ rRow = ( eDirection == SC_MOVE_DOWN ) ? rDocument.MaxRow() : 0;
}
}
}
@@ -1322,7 +1322,7 @@ bool ScTable::ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
if (!ValidCol(nCol) || !ValidRow(nRow))
return false;
- if (pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::Overlapped))
+ if (rDocument.HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::Overlapped))
// Skip an overlapped cell.
return false;
@@ -1332,7 +1332,7 @@ bool ScTable::ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark,
/* TODO: for cursor movement *only* this should even take the protection
* options (select locked, select unlocked) into account, see
* ScTabView::SkipCursorHorizontal() and ScTabView::SkipCursorVertical(). */
- if (bUnprotected && pDocument->HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::Protected))
+ if (bUnprotected && rDocument.HasAttrib(nCol, nRow, nTab, nCol, nRow, nTab, HasAttrFlags::Protected))
return false;
if (bMarked || bUnprotected) //TODO: also in other case ???
@@ -1359,10 +1359,10 @@ bool ScTable::SkipRow( const SCCOL nCol, SCROW& rRow, const SCROW nMovY,
if ( !ValidRow( rRow ))
return false;
- if (bSheetProtected && pDocument->HasAttrib( nCol, rRow, nTab, nCol, rRow, nTab, HasAttrFlags::Protected))
+ if (bSheetProtected && rDocument.HasAttrib( nCol, rRow, nTab, nCol, rRow, nTab, HasAttrFlags::Protected))
{
if ( rRow > nUsedY )
- rRow = (bUp ? nUsedY : pDocument->MaxRow() + nMovY);
+ rRow = (bUp ? nUsedY : rDocument.MaxRow() + nMovY);
else
rRow += nMovY;
@@ -1374,7 +1374,7 @@ bool ScTable::SkipRow( const SCCOL nCol, SCROW& rRow, const SCROW nMovY,
else
{
bool bRowHidden = RowHidden( rRow );
- bool bOverlapped = pDocument->HasAttrib( nCol, rRow, nTab, nCol, rRow, nTab, HasAttrFlags::Overlapped );
+ bool bOverlapped = rDocument.HasAttrib( nCol, rRow, nTab, nCol, rRow, nTab, HasAttrFlags::Overlapped );
if ( bRowHidden || bOverlapped )
{
@@ -1433,13 +1433,13 @@ void ScTable::GetNextPos( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY,
nStartRow = 0;
nEndCol = rCol;
nEndRow = rRow;
- pDocument->GetPrintArea( nTab, nEndCol, nEndRow, true );
+ rDocument.GetPrintArea( nTab, nEndCol, nEndRow, true );
// Add some cols/rows to the print area (which is "content or
// visually different from empty") to enable travelling through
// protected forms with empty cells and no visual indicator.
// 42 might be good enough and not too much...
- nEndCol = std::min<SCCOL>( nEndCol+42, pDocument->MaxCol());
- nEndRow = std::min<SCROW>( nEndRow+42, pDocument->MaxRow());
+ nEndCol = std::min<SCCOL>( nEndCol+42, rDocument.MaxCol());
+ nEndRow = std::min<SCROW>( nEndRow+42, rDocument.MaxRow());
}
else
{
@@ -1641,10 +1641,10 @@ bool ScTable::GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMa
while ( rCol < aCol.size() )
{
ScMarkArray aArray( rMark.GetMarkArray( rCol ) );
- while ( rRow <= pDocument->MaxRow() )
+ while ( rRow <= rDocument.MaxRow() )
{
SCROW nStart = aArray.GetNextMarked( rRow, false );
- if ( nStart <= pDocument->MaxRow() )
+ if ( nStart <= rDocument.MaxRow() )
{
SCROW nEnd = aArray.GetMarkEnd( nStart, false );
@@ -1660,7 +1660,7 @@ bool ScTable::GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMa
if (it == rCells.end())
{
// No more block. Move on to the next column.
- rRow = pDocument->MaxRow() + 1;
+ rRow = rDocument.MaxRow() + 1;
continue;
}
}
@@ -1675,14 +1675,14 @@ bool ScTable::GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMa
rRow = nEnd + 1; // Search for next selected range
}
else
- rRow = pDocument->MaxRow() + 1; // End of column
+ rRow = rDocument.MaxRow() + 1; // End of column
}
rRow = 0;
++rCol; // test next column
}
- // Though searched only the allocated columns, it is equivalent to a search till pDocument->MaxCol().
- rCol = pDocument->MaxCol() + 1;
+ // Though searched only the allocated columns, it is equivalent to a search till rDocument.MaxCol().
+ rCol = rDocument.MaxCol() + 1;
return false; // Through all columns
}
@@ -1693,7 +1693,7 @@ void ScTable::UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nR
if ( !(nTab >= nTab1 && nTab <= nTab2 && nDz == 0) ) // only within the table
return;
- ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
if ( eUpdateRefMode != URM_COPY && pDrawLayer )
{
if ( eUpdateRefMode == URM_MOVE )
@@ -1722,7 +1722,7 @@ void ScTable::UpdateReference(
else
{
i = 0;
- iMax = pDocument->MaxCol();
+ iMax = rDocument.MaxCol();
}
UpdateRefMode eUpdateRefMode = rCxt.meMode;
@@ -1761,7 +1761,7 @@ void ScTable::UpdateReference(
nERow = rPrintRange.aEnd.Row();
// do not try to modify sheet index of print range
- if ( ScRefUpdate::Update( pDocument, eUpdateRefMode,
+ if ( ScRefUpdate::Update( &rDocument, eUpdateRefMode,
nCol1,nRow1,nTab, nCol2,nRow2,nTab,
nDx,nDy,0,
nSCol,nSRow,nSTab, nECol,nERow,nETab ) )
@@ -1779,7 +1779,7 @@ void ScTable::UpdateReference(
nERow = pRepeatColRange->aEnd.Row();
// do not try to modify sheet index of repeat range
- if ( ScRefUpdate::Update( pDocument, eUpdateRefMode,
+ if ( ScRefUpdate::Update( &rDocument, eUpdateRefMode,
nCol1,nRow1,nTab, nCol2,nRow2,nTab,
nDx,nDy,0,
nSCol,nSRow,nSTab, nECol,nERow,nETab ) )
@@ -1799,7 +1799,7 @@ void ScTable::UpdateReference(
nERow = pRepeatRowRange->aEnd.Row();
// do not try to modify sheet index of repeat range
- if ( ScRefUpdate::Update( pDocument, eUpdateRefMode,
+ if ( ScRefUpdate::Update( &rDocument, eUpdateRefMode,
nCol1,nRow1,nTab, nCol2,nRow2,nTab,
nDx,nDy,0,
nSCol,nSRow,nSTab, nECol,nERow,nETab ) )
@@ -1816,7 +1816,7 @@ void ScTable::UpdateReference(
{
UpdatePageBreaks(nullptr);
- pDocument->RepaintRange( ScRange(0,0,nTab,pDocument->MaxCol(),pDocument->MaxRow(),nTab) );
+ rDocument.RepaintRange( ScRange(0,0,nTab,rDocument.MaxCol(),rDocument.MaxRow(),nTab) );
}
}
@@ -1827,7 +1827,7 @@ void ScTable::UpdateReference(
mpCondFormatList->UpdateReference(rCxt);
if (pTabProtection)
- pTabProtection->updateReference( eUpdateRefMode, pDocument, rCxt.maRange, nDx, nDy, nDz);
+ pTabProtection->updateReference( eUpdateRefMode, &rDocument, rCxt.maRange, nDx, nDy, nDz);
}
void ScTable::UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
@@ -1862,8 +1862,8 @@ void ScTable::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt )
mpCondFormatList->UpdateInsertTab(rCxt);
if (pTabProtection)
- pTabProtection->updateReference( URM_INSDEL, pDocument,
- ScRange( 0, 0, rCxt.mnInsertPos, pDocument->MaxCol(), pDocument->MaxRow(), MAXTAB),
+ pTabProtection->updateReference( URM_INSDEL, &rDocument,
+ ScRange( 0, 0, rCxt.mnInsertPos, rDocument.MaxCol(), rDocument.MaxRow(), MAXTAB),
0, 0, rCxt.mnSheets);
for (SCCOL i=0; i < aCol.size(); i++)
@@ -1891,8 +1891,8 @@ void ScTable::UpdateDeleteTab( sc::RefUpdateDeleteTabContext& rCxt )
mpCondFormatList->UpdateDeleteTab(rCxt);
if (pTabProtection)
- pTabProtection->updateReference( URM_INSDEL, pDocument,
- ScRange( 0, 0, rCxt.mnDeletePos, pDocument->MaxCol(), pDocument->MaxRow(), MAXTAB),
+ pTabProtection->updateReference( URM_INSDEL, &rDocument,
+ ScRange( 0, 0, rCxt.mnDeletePos, rDocument.MaxCol(), rDocument.MaxRow(), MAXTAB),
0, 0, -rCxt.mnSheets);
for (SCCOL i = 0; i < aCol.size(); ++i)
@@ -1915,8 +1915,8 @@ void ScTable::UpdateMoveTab(
mpCondFormatList->UpdateMoveTab(rCxt);
if (pTabProtection)
- pTabProtection->updateReference( URM_REORDER, pDocument,
- ScRange( 0, 0, rCxt.mnOldPos, pDocument->MaxCol(), pDocument->MaxRow(), MAXTAB),
+ pTabProtection->updateReference( URM_REORDER, &rDocument,
+ ScRange( 0, 0, rCxt.mnOldPos, rDocument.MaxCol(), rDocument.MaxRow(), MAXTAB),
0, 0, rCxt.mnNewPos - rCxt.mnOldPos);
for ( SCCOL i=0; i < aCol.size(); i++ )
@@ -1966,9 +1966,9 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
// First, mark those columns that we need to skip i.e. hidden and empty columns.
- ScFlatBoolColSegments aSkipCols(pDocument->MaxCol());
- aSkipCols.setFalse(0, pDocument->MaxCol());
- for (SCCOL i = 0; i <= pDocument->MaxCol(); ++i)
+ ScFlatBoolColSegments aSkipCols(rDocument.MaxCol());
+ aSkipCols.setFalse(0, rDocument.MaxCol());
+ for (SCCOL i = 0; i <= rDocument.MaxCol(); ++i)
{
SCCOL nLastCol = i;
if (ColHidden(i, nullptr, &nLastCol))
@@ -1983,7 +1983,7 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
{
if ( j >= aCol.size() )
{
- aSkipCols.setTrue( j, pDocument->MaxCol() );
+ aSkipCols.setTrue( j, rDocument.MaxCol() );
break;
}
if (aCol[j].GetCellCount() == 0)
@@ -2012,7 +2012,7 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
for (SCCOL nDataCol = nCol; 0 <= nDataCol && nDataCol >= aColData.mnCol1; --nDataCol)
{
SCCOL nPrintCol = nDataCol;
- VisibleDataCellIterator aIter(pDocument, *mpHiddenRows, aCol[nDataCol]);
+ VisibleDataCellIterator aIter(&rDocument, *mpHiddenRows, aCol[nDataCol]);
ScRefCellValue aCell = aIter.reset(nStartRow);
if (aCell.isEmpty())
// No visible cells found in this column. Skip it.
@@ -2085,7 +2085,7 @@ void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, d
// look at alignment
const ScPatternAttr* pPattern = GetPattern( rCol, nRow );
- const SfxItemSet* pCondSet = pDocument->GetCondResult( rCol, nRow, nTab );
+ const SfxItemSet* pCondSet = rDocument.GetCondResult( rCol, nRow, nTab );
SvxCellHorJustify eHorJust =
pPattern->GetItem( ATTR_HOR_JUSTIFY, pCondSet ).GetValue();
@@ -2103,7 +2103,7 @@ void ScTable::MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, d
}
SCCOL nNewCol = rCol;
- while (nMissing > 0 && nNewCol < pDocument->MaxCol())
+ while (nMissing > 0 && nNewCol < rDocument.MaxCol())
{
auto nNextCol = nNewCol + 1;
bool bNextEmpty = true;
@@ -2617,8 +2617,8 @@ void ScTable::CreateColumnIfNotExistsImpl( const SCCOL nScCol ) const
// which is bad since that code is not thread-safe.
SolarMutexGuard aGuard;
const SCCOL aOldColSize = aCol.size();
- aCol.resize( pDocument->GetSheetLimits(), static_cast< size_t >( nScCol + 1 ) );
+ aCol.resize( rDocument.GetSheetLimits(), static_cast< size_t >( nScCol + 1 ) );
for (SCCOL i = aOldColSize; i <= nScCol; i++)
- aCol[i].Init( i, nTab, pDocument, false );
+ aCol[i].Init( i, nTab, &rDocument, false );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index e625fb037feb..a5ecf2b228f9 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -134,7 +134,7 @@ bool ScTable::TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SC
{
bool bTest = true;
- if ( nStartCol==0 && nEndCol==pDocument->MaxCol() && pOutlineTable )
+ if ( nStartCol==0 && nEndCol==rDocument.MaxCol() && pOutlineTable )
bTest = pOutlineTable->TestInsertRow(nSize);
for (SCCOL i=nStartCol; (i<=nEndCol) && bTest; i++)
@@ -145,7 +145,7 @@ bool ScTable::TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SC
void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize )
{
- if (nStartCol==0 && nEndCol==pDocument->MaxCol())
+ if (nStartCol==0 && nEndCol==rDocument.MaxCol())
{
if (mpRowHeights && pRowFlags)
{
@@ -195,7 +195,7 @@ void ScTable::DeleteRow(
const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize,
bool* pUndoOutline, std::vector<ScAddress>* pGroupPos )
{
- if (nStartCol==0 && nEndCol==pDocument->MaxCol())
+ if (nStartCol==0 && nEndCol==rDocument.MaxCol())
{
if (pRowFlags)
pRowFlags->Remove( nStartRow, nSize);
@@ -232,7 +232,7 @@ void ScTable::DeleteRow(
}
{ // scope for bulk broadcast
- ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM(), SfxHintId::ScDataChanged);
+ ScBulkBroadcast aBulkBroadcast( rDocument.GetBASM(), SfxHintId::ScDataChanged);
for (SCCOL j=nStartCol; j<=nEndCol; j++)
aCol[j].DeleteRow(nStartRow, nSize, pGroupPos);
}
@@ -251,14 +251,14 @@ void ScTable::DeleteRow(
bool ScTable::TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) const
{
- if ( nSize > o3tl::make_unsigned(pDocument->MaxCol()) )
+ if ( nSize > o3tl::make_unsigned(rDocument.MaxCol()) )
return false;
- if ( nStartRow==0 && nEndRow==pDocument->MaxRow() && pOutlineTable
+ if ( nStartRow==0 && nEndRow==rDocument.MaxRow() && pOutlineTable
&& ! pOutlineTable->TestInsertCol(nSize) )
return false;
- auto range = GetColumnsRange( pDocument->MaxCol() - static_cast<SCCOL>(nSize) + 1, pDocument->MaxCol() );
+ auto range = GetColumnsRange( rDocument.MaxCol() - static_cast<SCCOL>(nSize) + 1, rDocument.MaxCol() );
for (auto it = range.rbegin(); it != range.rend(); ++it )
if (! aCol[*it].TestInsertCol(nStartRow, nEndRow))
return false;
@@ -269,13 +269,13 @@ bool ScTable::TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ) cons
void ScTable::InsertCol(
const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize )
{
- if (nStartRow==0 && nEndRow==pDocument->MaxRow())
+ if (nStartRow==0 && nEndRow==rDocument.MaxRow())
{
if (mpColWidth && mpColFlags)
{
mpColWidth->InsertPreservingSize(nStartCol, nSize, STD_COL_WIDTH);
// The inserted columns have the same widths as the columns, which were selected for insert.
- for (SCSIZE i=0; i < std::min(pDocument->MaxCol()-nSize-nStartCol, nSize); ++i)
+ for (SCSIZE i=0; i < std::min(rDocument.MaxCol()-nSize-nStartCol, nSize); ++i)
mpColWidth->SetValue(nStartCol + i, mpColWidth->GetValue(nStartCol+i+nSize));
mpColFlags->InsertPreservingSize(nStartCol, nSize, CRFlags::NONE);
}
@@ -301,7 +301,7 @@ void ScTable::InsertCol(
}
}
- if ((nStartRow == 0) && (nEndRow == pDocument->MaxRow()))
+ if ((nStartRow == 0) && (nEndRow == rDocument.MaxRow()))
{
for (SCSIZE i=0; i < nSize; i++)
for (SCCOL nCol = aCol.size() - 1; nCol > nStartCol; nCol--)
@@ -323,7 +323,7 @@ void ScTable::InsertCol(
nWhichArray[0] = ATTR_MERGE;
nWhichArray[1] = 0;
- sc::CopyToDocContext aCxt(*pDocument);
+ sc::CopyToDocContext aCxt(rDocument);
for (SCSIZE i=0; i<nSize; i++)
{
aCol[nStartCol-1].CopyToColumn(aCxt, nStartRow, nEndRow, InsertDeleteFlags::ATTRIB,
@@ -346,11 +346,11 @@ void ScTable::InsertCol(
void ScTable::DeleteCol(
const sc::ColumnSet& rRegroupCols, SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize, bool* pUndoOutline )
{
- if (nStartRow==0 && nEndRow==pDocument->MaxRow())
+ if (nStartRow==0 && nEndRow==rDocument.MaxRow())
{
if (mpColWidth && mpColFlags)
{
- assert( nStartCol + nSize <= o3tl::make_unsigned(pDocument->MaxCol()+1) ); // moving 0 if ==pDocument->MaxCol()+1 is correct
+ assert( nStartCol + nSize <= o3tl::make_unsigned(rDocument.MaxCol()+1) ); // moving 0 if ==rDocument.MaxCol()+1 is correct
mpColWidth->RemovePreservingSize(nStartCol, nSize, STD_COL_WIDTH);
mpColFlags->RemovePreservingSize(nStartCol, nSize, CRFlags::NONE);
}
@@ -386,7 +386,7 @@ void ScTable::DeleteCol(
for (SCSIZE i = 0; i < nSize; i++)
aCol[nStartCol + i].DeleteArea(nStartRow, nEndRow, InsertDeleteFlags::ALL, false);
- if ((nStartRow == 0) && (nEndRow == pDocument->MaxRow()))
+ if ((nStartRow == 0) && (nEndRow == rDocument.MaxRow()))
{
for (SCSIZE i=0; i < nSize; i++)
for (SCCOL nCol = nStartCol; nCol < aCol.size() - 1; nCol++)
@@ -414,11 +414,11 @@ void ScTable::DeleteArea(
bool bBroadcast, sc::ColumnSpanSet* pBroadcastSpans )
{
if ( nCol2 >= aCol.size() ) nCol2 = aCol.size() - 1;
- if (nRow2 > pDocument->MaxRow()) nRow2 = pDocument->MaxRow();
+ if (nRow2 > rDocument.MaxRow()) nRow2 = rDocument.MaxRow();
if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
{
{ // scope for bulk broadcast
- ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM(), SfxHintId::ScDataChanged);
+ ScBulkBroadcast aBulkBroadcast( rDocument.GetBASM(), SfxHintId::ScDataChanged);
for (SCCOL i = nCol1; i <= nCol2; i++)
aCol[i].DeleteArea(nRow1, nRow2, nDelFlag, bBroadcast, pBroadcastSpans);
}
@@ -427,7 +427,7 @@ void ScTable::DeleteArea(
if ( IsProtected() && (nDelFlag & InsertDeleteFlags::ATTRIB) )
{
- ScPatternAttr aPattern(pDocument->GetPool());
+ ScPatternAttr aPattern(rDocument.GetPool());
aPattern.GetItemSet().Put( ScProtectionAttr( false ) );
ApplyPatternArea( nCol1, nRow1, nCol2, nRow2, aPattern );
}
@@ -444,7 +444,7 @@ void ScTable::DeleteArea(
void ScTable::DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMark, bool bBroadcast )
{
{ // scope for bulk broadcast
- ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM(), SfxHintId::ScDataChanged);
+ ScBulkBroadcast aBulkBroadcast( rDocument.GetBASM(), SfxHintId::ScDataChanged);
for (SCCOL i=0; i < aCol.size(); i++)
aCol[i].DeleteSelection(nDelFlag, rMark, bBroadcast);
}
@@ -464,7 +464,7 @@ void ScTable::DeleteSelection( InsertDeleteFlags nDelFlag, const ScMarkData& rMa
if ( IsProtected() && (nDelFlag & InsertDeleteFlags::ATTRIB) )
{
- ScDocumentPool* pPool = pDocument->GetPool();
+ ScDocumentPool* pPool = rDocument.GetPool();
SfxItemSet aSet( *pPool, svl::Items<ATTR_PATTERN_START, ATTR_PATTERN_END>{} );
aSet.Put( ScProtectionAttr( false ) );
SfxItemPoolCache aCache( pPool, &aSet );
@@ -520,7 +520,7 @@ void ScTable::CopyToClip(
for (SCCOL i = nCol1; i <= nCol2; i++)
pTable->aCol[i].RemoveProtected(nRow1, nRow2);
- pTable->mpCondFormatList.reset(new ScConditionalFormatList(pTable->pDocument, *mpCondFormatList));
+ pTable->mpCondFormatList.reset(new ScConditionalFormatList(&pTable->rDocument, *mpCondFormatList));
}
void ScTable::CopyToClip(
@@ -560,7 +560,7 @@ void ScTable::CopyStaticToDocument(
for (SCROW nRow = nRow1; nRow <= nRow2; ++nRow)
{
sal_uInt32 nNumFmt = aDefaultColAttrArray.GetPattern(nRow)->GetNumberFormat(
- pDocument->GetNonThreadedContext().GetFormatTable());
+ rDocument.GetNonThreadedContext().GetFormatTable());
SvNumberFormatterMergeMap::const_iterator itNum = rMap.find(nNumFmt);
if (itNum != rMap.end())
nNumFmt = itNum->second;
@@ -623,7 +623,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
{
ScRange aOldRange( nCol1 - nDx, nRow1 - nDy, pTable->nTab, nCol2 - nDx, nRow2 - nDy, pTable->nTab);
ScRange aNewRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
- bool bSameDoc = pDocument->GetStyleSheetPool() == pTable->pDocument->GetStyleSheetPool();
+ bool bSameDoc = rDocument.GetStyleSheetPool() == pTable->rDocument.GetStyleSheetPool();
for(const auto& rxCondFormat : *pTable->mpCondFormatList)
{
@@ -632,10 +632,10 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
continue;
ScRangeList aIntersectedRange = rCondFormatRange.GetIntersectedRange(aOldRange);
- std::unique_ptr<ScConditionalFormat> pNewFormat = rxCondFormat->Clone(pDocument);
+ std::unique_ptr<ScConditionalFormat> pNewFormat = rxCondFormat->Clone(&rDocument);
pNewFormat->SetRange(aIntersectedRange);
- sc::RefUpdateContext aRefCxt(*pDocument);
+ sc::RefUpdateContext aRefCxt(rDocument);
aRefCxt.meMode = URM_COPY;
aRefCxt.maRange = aNewRange;
aRefCxt.mnColDelta = nDx;
@@ -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(pDocument, 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(pDocument, rxCond.get(), pNewFormat.get(), nTab))
+ if (CheckAndDeduplicateCondFormat(&rDocument, rxCond.get(), pNewFormat.get(), nTab))
{
bDuplicate = true;
break;
@@ -687,16 +687,16 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
if(!aStyleName.isEmpty())
{
- if(pDocument->GetStyleSheetPool()->Find(aStyleName, SfxStyleFamily::Para))
+ if(rDocument.GetStyleSheetPool()->Find(aStyleName, SfxStyleFamily::Para))
continue;
- pDocument->GetStyleSheetPool()->CopyStyleFrom(
- pTable->pDocument->GetStyleSheetPool(), aStyleName, SfxStyleFamily::Para );
+ rDocument.GetStyleSheetPool()->CopyStyleFrom(
+ pTable->rDocument.GetStyleSheetPool(), aStyleName, SfxStyleFamily::Para );
}
}
}
- pDocument->AddCondFormatData( pNewFormatTmp->GetRange(), nTab, pNewFormatTmp->GetKey() );
+ rDocument.AddCondFormatData( pNewFormatTmp->GetRange(), nTab, pNewFormatTmp->GetKey() );
}
}
@@ -715,10 +715,10 @@ void ScTable::CopyFromClip(
sc::CopyFromClipContext& rCxt, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
SCCOL nDx, SCROW nDy, ScTable* pTable )
{
- if (nCol2 > pDocument->MaxCol())
- nCol2 = pDocument->MaxCol();
- if (nRow2 > pDocument->MaxRow())
- nRow2 = pDocument->MaxRow();
+ if (nCol2 > rDocument.MaxCol())
+ nCol2 = rDocument.MaxCol();
+ if (nRow2 > rDocument.MaxRow())
+ nRow2 = rDocument.MaxRow();
if (!(ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)))
return;
@@ -743,10 +743,10 @@ void ScTable::CopyFromClip(
if ((rCxt.getInsertFlag() & InsertDeleteFlags::ATTRIB) == InsertDeleteFlags::NONE)
return;
- if (nRow1==0 && nRow2==pDocument->MaxRow() && mpColWidth && pTable->mpColWidth)
+ if (nRow1==0 && nRow2==rDocument.MaxRow() && mpColWidth && pTable->mpColWidth)
mpColWidth->CopyFrom(*pTable->mpColWidth, nCol1, nCol2, nCol1 - nDx);
- if (nCol1==0 && nCol2==pDocument->MaxCol() && mpRowHeights && pTable->mpRowHeights &&
+ if (nCol1==0 && nCol2==rDocument.MaxCol() && mpRowHeights && pTable->mpRowHeights &&
pRowFlags && pTable->pRowFlags)
{
CopyRowHeight(*pTable, nRow1, nRow2, -nDy);
@@ -763,7 +763,7 @@ void ScTable::CopyFromClip(
// Do not set protected cell in a protected sheet
if (IsProtected() && (rCxt.getInsertFlag() & InsertDeleteFlags::ATTRIB))
{
- ScPatternAttr aPattern(pDocument->GetPool());
+ ScPatternAttr aPattern(rDocument.GetPool());
aPattern.GetItemSet().Put( ScProtectionAttr( false ) );
ApplyPatternArea( nCol1, nRow1, nCol2, nRow2, aPattern );
}
@@ -893,9 +893,9 @@ public:
void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
ScTable* pTransClip, InsertDeleteFlags nFlags, bool bAsLink )
{
- bool bWasCut = pDocument->IsCutMode();
+ bool bWasCut = rDocument.IsCutMode();
- ScDocument* pDestDoc = pTransClip->pDocument;
+ ScDocument& rDestDoc = pTransClip->rDocument;
for (SCCOL nCol=nCol1; nCol<=nCol2; nCol++)
{
@@ -912,12 +912,12 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
ScSingleRefData aRef;
aRef.InitAddress(ScAddress(nCol,nRow,nTab));
aRef.SetFlag3D(true);
- ScTokenArray aArr(*pDestDoc);
+ ScTokenArray aArr(rDestDoc);
aArr.AddSingleReference( aRef );
pTransClip->SetFormulaCell(
static_cast<SCCOL>(nRow-nRow1), static_cast<SCROW>(nCol-nCol1),
- new ScFormulaCell(pDestDoc, aDestPos, aArr));
+ new ScFormulaCell(&rDestDoc, aDestPos, aArr));
}
}
else
@@ -971,10 +971,10 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (rOldMerge.IsMerged())
rNewSet.Put( ScMergeAttr( std::min(
static_cast<SCCOL>(rOldMerge.GetRowMerge()),
- static_cast<SCCOL>(pDocument->MaxCol()+1 - (nAttrRow2-nRow1))),
+ static_cast<SCCOL>(rDocument.MaxCol()+1 - (nAttrRow2-nRow1))),
std::min(
static_cast<SCROW>(rOldMerge.GetColMerge()),
- static_cast<SCROW>(pDocument->MaxRow()+1 - (nCol-nCol1)))));
+ static_cast<SCROW>(rDocument.MaxRow()+1 - (nCol-nCol1)))));
const ScMergeFlagAttr& rOldFlag = rSet.Get(ATTR_MERGE_FLAG);
if (rOldFlag.IsOverlapped())
{
@@ -993,7 +993,7 @@ void ScTable::TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
}
// Cell Notes - fdo#68381 paste cell notes on Transpose
- if ( pDocument->HasColNotes(nCol, nTab) )
+ if ( rDocument.HasColNotes(nCol, nTab) )
TransposeColNotes(pTransClip, nCol1, nCol, nRow1, nRow2);
}
}
@@ -1043,12 +1043,12 @@ void ScTable::TransposeColNotes(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SC
for (; itData != itDataEnd; ++itData, ++curRow)
{
ScAddress aDestPos( static_cast<SCCOL>(curRow-nRow1), static_cast<SCROW>(nCol-nCol1), pTransClip->nTab );
- pTransClip->pDocument->ReleaseNote(aDestPos);
+ pTransClip->rDocument.ReleaseNote(aDestPos);
ScPostIt* pNote = *itData;
if (pNote)
{
- std::unique_ptr<ScPostIt> pClonedNote = pNote->Clone( ScAddress(nCol, curRow, nTab), *pTransClip->pDocument, aDestPos, true );
- pTransClip->pDocument->SetNote(aDestPos, std::move(pClonedNote));
+ std::unique_ptr<ScPostIt> pClonedNote = pNote->Clone( ScAddress(nCol, curRow, nTab), pTransClip->rDocument, aDestPos, true );
+ pTransClip->rDocument.SetNote(aDestPos, std::move(pClonedNote));
}
}
break; // we reached the last valid block
@@ -1060,12 +1060,12 @@ void ScTable::TransposeColNotes(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SC
for (; itData != itDataEnd; ++itData, ++curRow)
{
ScAddress aDestPos( static_cast<SCCOL>(curRow-nRow1), static_cast<SCROW>(nCol-nCol1), pTransClip->nTab );
- pTransClip->pDocument->ReleaseNote(aDestPos);
+ pTransClip->rDocument.ReleaseNote(aDestPos);
ScPostIt* pNote = *itData;
if (pNote)
{
- std::unique_ptr<ScPostIt> pClonedNote = pNote->Clone( ScAddress(nCol, curRow, nTab), *pTransClip->pDocument, aDestPos, true );
- pTransClip->pDocument->SetNote(aDestPos, std::move(pClonedNote));
+ std::unique_ptr<ScPostIt> pClonedNote = pNote->Clone( ScAddress(nCol, curRow, nTab), pTransClip->rDocument, aDestPos, true );
+ pTransClip->rDocument.SetNote(aDestPos, std::move(pClonedNote));
}
}
}
@@ -1076,7 +1076,7 @@ void ScTable::TransposeColNotes(ScTable* pTransClip, SCCOL nCol1, SCCOL nCol, SC
for ( curRow = nBlockStart + nOffsetInBlock; curRow <= nBlockEnd && curRow <= nRowPos; ++curRow)
{
ScAddress aDestPos( static_cast<SCCOL>(curRow-nRow1), static_cast<SCROW>(nCol-nCol1), pTransClip->nTab );
- pTransClip->pDocument->ReleaseNote(aDestPos);
+ pTransClip->rDocument.ReleaseNote(aDestPos);
}
if (curRow == nRowPos)
break;
@@ -1140,8 +1140,8 @@ void ScTable::SetDirtyFromClip(
SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sc::ColumnSpanSet& rBroadcastSpans )
{
if ( nCol2 >= aCol.size() ) nCol2 = aCol.size() - 1;
- if (nCol2 > pDocument->MaxCol()) nCol2 = pDocument->MaxCol();
- if (nRow2 > pDocument->MaxRow()) nRow2 = pDocument->MaxRow();
+ if (nCol2 > rDocument.MaxCol()) nCol2 = rDocument.MaxCol();
+ if (nRow2 > rDocument.MaxRow()) nRow2 = rDocument.MaxRow();
if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
for (SCCOL i = nCol1; i <= nCol2; i++)
aCol[i].SetDirtyFromClip(nRow1, nRow2, rBroadcastSpans);
@@ -1152,8 +1152,8 @@ void ScTable::StartListeningFormulaCells(
SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
{
if ( nCol2 >= aCol.size() ) nCol2 = aCol.size() - 1;
- if (nCol2 > pDocument->MaxCol()) nCol2 = pDocument->MaxCol();
- if (nRow2 > pDocument->MaxRow()) nRow2 = pDocument->MaxRow();
+ if (nCol2 > rDocument.MaxCol()) nCol2 = rDocument.MaxCol();
+ if (nRow2 > rDocument.MaxRow()) nRow2 = rDocument.MaxRow();
if (ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2))
for (SCCOL i = nCol1; i <= nCol2; i++)
aCol[i].StartListeningFormulaCells(rStartCxt, rEndCxt, nRow1, nRow2);
@@ -1167,7 +1167,7 @@ void ScTable::CopyToTable(
if (!ValidColRow(nCol1, nRow1) || !ValidColRow(nCol2, nRow2))
return;
- bool bIsUndoDoc = pDestTab->pDocument->IsUndo();
+ bool bIsUndoDoc = pDestTab->rDocument.IsUndo();
if (bIsUndoDoc && (nFlags & InsertDeleteFlags::CONTENTS))
{
@@ -1183,7 +1183,7 @@ void ScTable::CopyToTable(
// tdf#102364 - in some pathological cases CopyToTable() replacing cells with new cells
// can lead to repetitive splitting and rejoining of the same formula group, which can get
// quadratically expensive with large groups. So do the grouping just once at the end.
- sc::DelayFormulaGroupingSwitch delayGrouping( *pDestTab->pDocument, true );
+ sc::DelayFormulaGroupingSwitch delayGrouping( pDestTab->rDocument, true );
for (SCCOL i = nCol1; i <= ClampToAllocatedColumns(nCol2); i++)
aCol[i].CopyToColumn(rCxt, nRow1, nRow2, bIsUndoDoc ? nFlags : nTempFlags, bMarked,
pDestTab->CreateColumnIfNotExists(i), pMarkData, bAsLink, bGlobalNamesToLocal);
@@ -1194,7 +1194,7 @@ void ScTable::CopyToTable(
if(bIsUndoDoc && (nFlags & InsertDeleteFlags::ATTRIB))
{
- pDestTab->mpCondFormatList.reset(new ScConditionalFormatList(pDestTab->pDocument, *mpCondFormatList));
+ pDestTab->mpCondFormatList.reset(new ScConditionalFormatList(&pDestTab->rDocument, *mpCondFormatList));
}
if (pDBDataNoName)
@@ -1208,12 +1208,12 @@ void ScTable::CopyToTable(
pDestTab->SetAnonymousDBData(std::move(pNewDBData));
}
// Charts have to be adjusted when hide/show
- ScChartListenerCollection* pCharts = pDestTab->pDocument->GetChartListenerCollection();
+ ScChartListenerCollection* pCharts = pDestTab->rDocument.GetChartListenerCollection();
bool bFlagChange = false;
- bool bWidth = (nRow1==0 && nRow2==pDocument->MaxRow() && mpColWidth && pDestTab->mpColWidth);
- bool bHeight = (nCol1==0 && nCol2==pDocument->MaxCol() && mpRowHeights && pDestTab->mpRowHeights);
+ bool bWidth = (nRow1==0 && nRow2==rDocument.MaxRow() && mpColWidth && pDestTab->mpColWidth);
+ bool bHeight = (nCol1==0 && nCol2==rDocument.MaxCol() && mpRowHeights && pDestTab->mpRowHeights);
if (bWidth || bHeight)
{
@@ -1231,7 +1231,7 @@ void ScTable::CopyToTable(
pDestTab->SetColHidden(i, i, bThisHidden);
//TODO: collect changes?
if (bHiddenChange && pCharts)
- pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, pDocument->MaxRow(), nTab ));
+ pCharts->SetRangeDirty(ScRange( i, 0, nTab, i, rDocument.MaxRow(), nTab ));
if (bChange)
bFlagChange = true;
@@ -1264,7 +1264,7 @@ void ScTable::CopyToTable(
bool bHiddenChanged = pDestTab->SetRowHidden(i, nLastRow, bHidden);
if (bHiddenChanged && pCharts)
// Hidden flags differ.
- pCharts->SetRangeDirty(ScRange(0, i, nTab, pDocument->MaxCol(), nLastRow, nTab));
+ pCharts->SetRangeDirty(ScRange(0, i, nTab, rDocument.MaxCol(), nLastRow, nTab));
if (bHiddenChanged)
bFlagChange = true;
@@ -1328,8 +1328,8 @@ void ScTable::UndoToTable(
if (!(ValidColRow(nCol1, nRow1) && ValidColRow(nCol2, nRow2)))
return;
- bool bWidth = (nRow1==0 && nRow2==pDocument->MaxRow() && mpColWidth && pDestTab->mpColWidth);
- bool bHeight = (nCol1==0 && nCol2==pDocument->MaxCol() && mpRowHeights && pDestTab->mpRowHeights);
+ bool bWidth = (nRow1==0 && nRow2==rDocument.MaxRow() && mpColWidth && pDestTab->mpColWidth);
+ bool bHeight = (nCol1==0 && nCol2==rDocument.MaxCol() && mpRowHeights && pDestTab->mpRowHeights);
if ((nFlags & InsertDeleteFlags::CONTENTS) && mpRangeName)
{
@@ -1337,9 +1337,9 @@ void ScTable::UndoToTable(
// formulas. If mpRangeName is not set then the Undo wasn't even
// set to an empty ScRangeName map so don't "undo" that.
pDestTab->SetRangeName( std::unique_ptr<ScRangeName>( new ScRangeName( *GetRangeName())));
- if (!pDestTab->pDocument->IsClipOrUndo())
+ if (!pDestTab->rDocument.IsClipOrUndo())
{
- ScDocShell* pDocSh = static_cast<ScDocShell*>(pDestTab->pDocument->GetDocumentShell());
+ ScDocShell* pDocSh = static_cast<ScDocShell*>(pDestTab->rDocument.GetDocumentShell());
if (pDocSh)
pDocSh->SetAreasChangedNeedBroadcast();
}
@@ -1352,11 +1352,11 @@ void ScTable::UndoToTable(
if ( i >= nCol1 && i <= nCol2 )
aCol[i].UndoToColumn(rCxt, nRow1, nRow2, nFlags, bMarked, rDestCol);
else
- aCol[i].CopyToColumn(rCxt, 0, pDocument->MaxRow(), InsertDeleteFlags::FORMULA, false, rDestCol);
+ aCol[i].CopyToColumn(rCxt, 0, rDocument.MaxRow(), InsertDeleteFlags::FORMULA, false, rDestCol);
}
if (nFlags & InsertDeleteFlags::ATTRIB)
- pDestTab->mpCondFormatList.reset(new ScConditionalFormatList(pDestTab->pDocument, *mpCondFormatList));
+ pDestTab->mpCondFormatList.reset(new ScConditionalFormatList(&pDestTab->rDocument, *mpCondFormatList));
if (!(bWidth||bHeight))
return;
@@ -1455,7 +1455,7 @@ const ScRangeList* ScTable::GetScenarioRanges() const
if (!pScenarioRanges)
{
const_cast<ScTable*>(this)->pScenarioRanges.reset(new ScRangeList);
- ScMarkData aMark(pDocument->GetSheetLimits());
+ ScMarkData aMark(rDocument.GetSheetLimits());
MarkScenarioIn( aMark, ScScenarioFlags::NONE ); // always
aMark.FillRangeListWithMarks( pScenarioRanges.get(), false );
}
@@ -1484,7 +1484,7 @@ bool ScTable::SetString( SCCOL nCol, SCROW nRow, SCTAB nTabP, const OUString& rS
}
return CreateColumnIfNotExists(nCol).SetString(
- nRow, nTabP, rString, pDocument->GetAddressConvention(), pParam);
+ nRow, nTabP, rString, rDocument.GetAddressConvention(), pParam);
}
bool ScTable::SetEditText( SCCOL nCol, SCROW nRow, std::unique_ptr<EditTextObject> pEditText )
@@ -1515,7 +1515,7 @@ SCROW ScTable::GetFirstEditTextRow( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW
return -1;
nCol2 = ClampToAllocatedColumns(nCol2);
- SCROW nFirst = pDocument->MaxRow()+1;
+ SCROW nFirst = rDocument.MaxRow()+1;
for (SCCOL i = nCol1; i <= nCol2; ++i)
{
const ScColumn& rCol = aCol[i];
@@ -1530,7 +1530,7 @@ SCROW ScTable::GetFirstEditTextRow( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW
}
}
- return nFirst == (pDocument->MaxRow()+1) ? -1 : nFirst;
+ return nFirst == (rDocument.MaxRow()+1) ? -1 : nFirst;
}
void ScTable::SetEmptyCell( SCCOL nCol, SCROW nRow )
@@ -1731,19 +1731,19 @@ CommentCaptionState ScTable::GetAllNoteCaptionsState(const ScRange& rRange, std:
bool bIsFirstNoteShownState = true; // because of error: -Werror=maybe-uninitialized
bool bFirstControl = true;
- ScTable* pTab = pDocument->FetchTable(nTab);
+ ScTable* pTab = rDocument.FetchTable(nTab);
assert(pTab);
const SCCOL nEndCol = pTab->ClampToAllocatedColumns(rRange.aEnd.Col());
for (SCCOL nCol = rRange.aStart.Col(); nCol <= nEndCol; ++nCol)
{
- if (bFirstControl && pDocument->HasColNotes(nCol, nTab)) // detect status of first note caption
+ if (bFirstControl && rDocument.HasColNotes(nCol, nTab)) // detect status of first note caption
{
aCol[nCol].GetNotesInRange(nStartRow, nEndRow, rNotes);
bIsFirstNoteShownState = rNotes.begin()->mpNote->IsCaptionShown();
bFirstControl = false;
}
- if (pDocument->HasColNotes(nCol, nTab))
+ if (rDocument.HasColNotes(nCol, nTab))
{
aCol[nCol].GetNotesInRange(nStartRow, nEndRow, rNotes);
@@ -1760,7 +1760,7 @@ CommentCaptionState ScTable::GetAllNoteCaptionsState(const ScRange& rRange, std:
void ScTable::GetUnprotectedCells( ScRangeList& rRangeList ) const
{
for (auto const & pCol : aCol)
- pCol->GetUnprotectedCells(0, pDocument->MaxRow(), rRangeList);
+ pCol->GetUnprotectedCells(0, rDocument.MaxRow(), rRangeList);
}
bool ScTable::ContainsNotesInRange( const ScRange& rRange ) const
@@ -1796,7 +1796,7 @@ ScRefCellValue ScTable::GetCellValue( SCCOL nCol, SCROW nRow ) const
void ScTable::GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const
{
rCol = 0;
- rRow = pDocument->MaxRow()+1;
+ rRow = rDocument.MaxRow()+1;
while (rCol < (aCol.size() - 1) && aCol[rCol].IsEmptyData() )
++rCol;
SCCOL nCol = rCol;
@@ -1815,7 +1815,7 @@ void ScTable::GetLastDataPos(SCCOL& rCol, SCROW& rRow) const
while (aCol[rCol].IsEmptyData() && (rCol > 0))
rCol--;
SCCOL nCol = rCol;
- while (nCol >= 0 && rRow < pDocument->MaxRow())
+ while (nCol >= 0 && rRow < rDocument.MaxRow())
rRow = ::std::max( rRow, aCol[nCol--].GetLastDataPos());
}
@@ -1865,7 +1865,7 @@ void ScTable::SetDirtyVar()
void ScTable::CheckVectorizationState()
{
- sc::AutoCalcSwitch aACSwitch(*pDocument, false);
+ sc::AutoCalcSwitch aACSwitch(rDocument, false);
for (SCCOL i = 0; i < aCol.size(); i++)
aCol[i].CheckVectorizationState();
@@ -1873,7 +1873,7 @@ void ScTable::CheckVectorizationState()
void ScTable::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
{
- sc::AutoCalcSwitch aACSwitch(*pDocument, false);
+ sc::AutoCalcSwitch aACSwitch(rDocument, false);
for (SCCOL i=0; i < aCol.size(); i++)
aCol[i].SetAllFormulasDirty(rCxt);
@@ -1881,46 +1881,46 @@ void ScTable::SetAllFormulasDirty( const sc::SetFormulaDirtyContext& rCxt )
void ScTable::SetDirty( const ScRange& rRange, ScColumn::BroadcastMode eMode )
{
- bool bOldAutoCalc = pDocument->GetAutoCalc();
- pDocument->SetAutoCalc( false ); // avoid multiple recalculations
+ bool bOldAutoCalc = rDocument.GetAutoCalc();
+ rDocument.SetAutoCalc( false ); // avoid multiple recalculations
SCCOL nCol2 = rRange.aEnd.Col();
nCol2 = ClampToAllocatedColumns(nCol2);
for (SCCOL i=rRange.aStart.Col(); i<=nCol2; i++)
aCol[i].SetDirty(rRange.aStart.Row(), rRange.aEnd.Row(), eMode);
- pDocument->SetAutoCalc( bOldAutoCalc );
+ rDocument.SetAutoCalc( bOldAutoCalc );
}
void ScTable::SetTableOpDirty( const ScRange& rRange )
{
- bool bOldAutoCalc = pDocument->GetAutoCalc();
- pDocument->SetAutoCalc( false ); // no multiple recalculation
+ bool bOldAutoCalc = rDocument.GetAutoCalc();
+ rDocument.SetAutoCalc( false ); // no multiple recalculation
const SCCOL nCol2 = ClampToAllocatedColumns(rRange.aEnd.Col());
for (SCCOL i=rRange.aStart.Col(); i<=nCol2; i++)
aCol[i].SetTableOpDirty( rRange );
- pDocument->SetAutoCalc( bOldAutoCalc );
+ rDocument.SetAutoCalc( bOldAutoCalc );
}
void ScTable::SetDirtyAfterLoad()
{
- bool bOldAutoCalc = pDocument->GetAutoCalc();
- pDocument->SetAutoCalc( false ); // avoid multiple recalculations
+ bool bOldAutoCalc = rDocument.GetAutoCalc();
+ rDocument.SetAutoCalc( false ); // avoid multiple recalculations
for (SCCOL i=0; i < aCol.size(); i++)
aCol[i].SetDirtyAfterLoad();
- pDocument->SetAutoCalc( bOldAutoCalc );
+ rDocument.SetAutoCalc( bOldAutoCalc );
}
void ScTable::SetDirtyIfPostponed()
{
- bool bOldAutoCalc = pDocument->GetAutoCalc();
- pDocument->SetAutoCalc( false ); // avoid multiple recalculations
+ bool bOldAutoCalc = rDocument.GetAutoCalc();
+ rDocument.SetAutoCalc( false ); // avoid multiple recalculations
for (SCCOL i=0; i < aCol.size(); i++)
aCol[i].SetDirtyIfPostponed();
- pDocument->SetAutoCalc( bOldAutoCalc );
+ rDocument.SetAutoCalc( bOldAutoCalc );
}
void ScTable::BroadcastRecalcOnRefMove()
{
- sc::AutoCalcSwitch aSwitch(*pDocument, false);
+ sc::AutoCalcSwitch aSwitch(rDocument, false);
for (SCCOL i = 0; i < aCol.size(); ++i)
aCol[i].BroadcastRecalcOnRefMove();
}
@@ -1928,7 +1928,7 @@ void ScTable::BroadcastRecalcOnRefMove()
bool ScTable::BroadcastBroadcasters( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScHint& rHint )
{
bool bBroadcasted = false;
- sc::AutoCalcSwitch aSwitch(*pDocument, false);
+ sc::AutoCalcSwitch aSwitch(rDocument, false);
rHint.GetAddress().SetTab(nTab);
nCol2 = ClampToAllocatedColumns(nCol2);
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
@@ -2026,7 +2026,7 @@ sal_uInt32 ScTable::GetNumberFormat( const ScInterpreterContext& rContext, const
sal_uInt32 ScTable::GetNumberFormat( SCCOL nCol, SCROW nRow ) const
{
if (ValidColRow(nCol,nRow))
- return CreateColumnIfNotExists(nCol).GetNumberFormat(pDocument->GetNonThreadedContext(), nRow);
+ return CreateColumnIfNotExists(nCol).GetNumberFormat(rDocument.GetNonThreadedContext(), nRow);
else
return 0;
}
@@ -2054,7 +2054,7 @@ const ScPatternAttr* ScTable::GetPattern( SCCOL nCol, SCROW nRow ) const
else
{
OSL_FAIL("wrong column or row");
- return pDocument->GetDefPattern(); // for safety
+ return rDocument.GetDefPattern(); // for safety
}
}
@@ -2234,12 +2234,12 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC
SCROW nY1 = pRowInfo[0].nRowNo;
SCROW nY2 = pRowInfo[nArrCount-1].nRowNo;
- for (SCCOL nCol : GetColumnsRange(0, pDocument->MaxCol()))
+ for (SCCOL nCol : GetColumnsRange(0, rDocument.MaxCol()))
{
if (!ColHidden(nCol))
{
SCSIZE nArrY = 0;
- ScDocAttrIterator aIter( pDocument, nTab, nCol, nY1, nCol, nY2 );
+ ScDocAttrIterator aIter( &rDocument, nTab, nCol, nY1, nCol, nY2 );
SCCOL nAttrCol;
SCROW nAttrRow1, nAttrRow2;
const ScPatternAttr* pPattern = aIter.GetNext( nAttrCol, nAttrRow1, nAttrRow2 );
@@ -2253,7 +2253,7 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC
// handled individually
const ScCondFormatIndexes& rCondFormatData = static_cast<const ScCondFormatItem*>(pCondItem)->GetCondFormatData();
- ScStyleSheetPool* pStylePool = pDocument->GetStyleSheetPool();
+ ScStyleSheetPool* pStylePool = rDocument.GetStyleSheetPool();
if (mpCondFormatList && pStylePool && !rCondFormatData.empty())
{
for(const auto& rItem : rCondFormatData)
@@ -2427,7 +2427,7 @@ bool ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
bool bIsEditable = true;
if ( nLockCount )
bIsEditable = false;
- else if ( IsProtected() && !pDocument->IsScenario(nTab) )
+ else if ( IsProtected() && !rDocument.IsScenario(nTab) )
{
bIsEditable = !HasAttrib( nCol1, nRow1, nCol2, nRow2, HasAttrFlags::Protected );
if (!bIsEditable)
@@ -2443,13 +2443,13 @@ bool ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
// on the active scenario range. Note the 'copy back' must also
// be set to apply protection.
sal_uInt16 nScenTab = nTab+1;
- while(pDocument->IsScenario(nScenTab))
+ while(rDocument.IsScenario(nScenTab))
{
ScRange aEditRange(nCol1, nRow1, nScenTab, nCol2, nRow2, nScenTab);
- if(pDocument->IsActiveScenario(nScenTab) && pDocument->HasScenarioRange(nScenTab, aEditRange))
+ if(rDocument.IsActiveScenario(nScenTab) && rDocument.HasScenarioRange(nScenTab, aEditRange))
{
ScScenarioFlags nFlags;
- pDocument->GetScenarioFlags(nScenTab,nFlags);
+ rDocument.GetScenarioFlags(nScenTab,nFlags);
bIsEditable = !((nFlags & ScScenarioFlags::Protected) && (nFlags & ScScenarioFlags::TwoWay));
break;
}
@@ -2457,7 +2457,7 @@ bool ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
}
}
}
- else if (pDocument->IsScenario(nTab))
+ else if (rDocument.IsScenario(nTab))
{
// Determine if the preceding sheet is protected
SCTAB nActualTab = nTab;
@@ -2465,15 +2465,15 @@ bool ScTable::IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2,
{
nActualTab--;
}
- while(pDocument->IsScenario(nActualTab));
+ while(rDocument.IsScenario(nActualTab));
- if(pDocument->IsTabProtected(nActualTab))
+ if(rDocument.IsTabProtected(nActualTab))
{
ScRange aEditRange(nCol1, nRow1, nTab, nCol2, nRow2, nTab);
- if(pDocument->HasScenarioRange(nTab, aEditRange))
+ if(rDocument.HasScenarioRange(nTab, aEditRange))
{
ScScenarioFlags nFlags;
- pDocument->GetScenarioFlags(nTab,nFlags);
+ rDocument.GetScenarioFlags(nTab,nFlags);
bIsEditable = !(nFlags & ScScenarioFlags::Protected);
}
}
@@ -2500,7 +2500,7 @@ bool ScTable::IsSelectionEditable( const ScMarkData& rMark,
bool bIsEditable = true;
if ( nLockCount )
bIsEditable = false;
- else if ( IsProtected() && !pDocument->IsScenario(nTab) )
+ else if ( IsProtected() && !rDocument.IsScenario(nTab) )
{
ScRangeList aRanges;
rMark.FillRangeListWithMarks( &aRanges, false );
@@ -2517,17 +2517,17 @@ bool ScTable::IsSelectionEditable( const ScMarkData& rMark,
// check the active scenario protect flag if this area is
// in the active scenario range.
SCTAB nScenTab = nTab+1;
- while(pDocument->IsScenario(nScenTab) && bIsEditable)
+ while(rDocument.IsScenario(nScenTab) && bIsEditable)
{
- if(pDocument->IsActiveScenario(nScenTab))
+ if(rDocument.IsActiveScenario(nScenTab))
{
for (size_t i=0, nRange = aRanges.size(); (i < nRange) && bIsEditable; i++ )
{
const ScRange & rRange = aRanges[ i ];
- if(pDocument->HasScenarioRange(nScenTab, rRange))
+ if(rDocument.HasScenarioRange(nScenTab, rRange))
{
ScScenarioFlags nFlags;
- pDocument->GetScenarioFlags(nScenTab,nFlags);
+ rDocument.GetScenarioFlags(nScenTab,nFlags);
bIsEditable = !((nFlags & ScScenarioFlags::Protected) && (nFlags & ScScenarioFlags::TwoWay));
}
}
@@ -2536,7 +2536,7 @@ bool ScTable::IsSelectionEditable( const ScMarkData& rMark,
}
}
}
- else if (pDocument->IsScenario(nTab))
+ else if (rDocument.IsScenario(nTab))
{
// Determine if the preceding sheet is protected
SCTAB nActualTab = nTab;
@@ -2544,19 +2544,19 @@ bool ScTable::IsSelectionEditable( const ScMarkData& rMark,
{
nActualTab--;
}
- while(pDocument->IsScenario(nActualTab));
+ while(rDocument.IsScenario(nActualTab));
- if(pDocument->IsTabProtected(nActualTab))
+ if(rDocument.IsTabProtected(nActualTab))
{
ScRangeList aRanges;
rMark.FillRangeListWithMarks( &aRanges, false );
for (size_t i = 0, nRange = aRanges.size(); (i < nRange) && bIsEditable; i++)
{
const ScRange & rRange = aRanges[ i ];
- if(pDocument->HasScenarioRange(nTab, rRange))
+ if(rDocument.HasScenarioRange(nTab, rRange))
{
ScScenarioFlags nFlags;
- pDocument->GetScenarioFlags(nTab,nFlags);
+ rDocument.GetScenarioFlags(nTab,nFlags);
bIsEditable = !(nFlags & ScScenarioFlags::Protected);
}
}
@@ -2736,7 +2736,7 @@ void ScTable::ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, S
PutInOrder(nStartCol, nEndCol);
PutInOrder(nStartRow, nEndRow);
- if ( nEndCol == pDocument->MaxCol() )
+ if ( nEndCol == rDocument.MaxCol() )
{
if ( nStartCol < aCol.size() )
{
@@ -2858,13 +2858,13 @@ void ScTable::StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRem
double nPPTX, double nPPTY,
const Fraction& rZoomX, const Fraction& rZoomY )
{
- ScFlatBoolRowSegments aUsedRows(pDocument->MaxRow());
+ ScFlatBoolRowSegments aUsedRows(rDocument.MaxRow());
for (SCCOL i = 0; i < aCol.size(); ++i)
aCol[i].FindStyleSheet(pStyleSheet, aUsedRows, bRemoved);
- sc::RowHeightContext aCxt(pDocument->MaxRow(), nPPTX, nPPTY, rZoomX, rZoomY, pDev);
+ sc::RowHeightContext aCxt(rDocument.MaxRow(), nPPTX, nPPTY, rZoomX, rZoomY, pDev);
SCROW nRow = 0;
- while (nRow <= pDocument->MaxRow())
+ while (nRow <= rDocument.MaxRow())
{
ScFlatBoolRowSegments::RangeData aData;
if (!aUsedRows.getRangeData(nRow, aData))
@@ -3050,7 +3050,7 @@ bool ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNew
}
bool bSingle = false; // true = process every row for its own
- ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
if (pDrawLayer)
if (pDrawLayer->HasObjectsInRows( nTab, nStartRow, nEndRow ))
bSingle = true;
@@ -3170,7 +3170,7 @@ sal_uInt16 ScTable::GetCommonWidth( SCCOL nEndCol ) const
if ( !ValidCol(nEndCol) )
{
OSL_FAIL("wrong column");
- nEndCol = pDocument->MaxCol();
+ nEndCol = rDocument.MaxCol();
}
sal_uInt16 nMaxWidth = 0;
@@ -3379,9 +3379,9 @@ void ScTable::ShowCol(SCCOL nCol, bool bShow)
{
SetColHidden(nCol, nCol, !bShow);
- ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
+ ScChartListenerCollection* pCharts = rDocument.GetChartListenerCollection();
if ( pCharts )
- pCharts->SetRangeDirty(ScRange( nCol, 0, nTab, nCol, pDocument->MaxRow(), nTab ));
+ pCharts->SetRangeDirty(ScRange( nCol, 0, nTab, nCol, rDocument.MaxRow(), nTab ));
}
}
else
@@ -3400,9 +3400,9 @@ void ScTable::ShowRow(SCROW nRow, bool bShow)
SetRowHidden(nRow, nRow, !bShow);
if (bShow)
SetRowFiltered(nRow, nRow, false);
- ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
+ ScChartListenerCollection* pCharts = rDocument.GetChartListenerCollection();
if ( pCharts )
- pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, pDocument->MaxCol(), nRow, nTab ));
+ pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, rDocument.MaxCol(), nRow, nTab ));
InvalidatePageBreaks();
}
@@ -3423,9 +3423,9 @@ void ScTable::DBShowRow(SCROW nRow, bool bShow)
if (bChanged)
{
- ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
+ ScChartListenerCollection* pCharts = rDocument.GetChartListenerCollection();
if ( pCharts )
- pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, pDocument->MaxCol(), nRow, nTab ));
+ pCharts->SetRangeDirty(ScRange( 0, nRow, nTab, rDocument.MaxCol(), nRow, nTab ));
if (pOutlineTable)
UpdateOutlineRow( nRow, nRow, bShow );
@@ -3456,9 +3456,9 @@ void ScTable::DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
if ( bChanged )
{
- ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
+ ScChartListenerCollection* pCharts = rDocument.GetChartListenerCollection();
if ( pCharts )
- pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, pDocument->MaxCol(), nEndRow, nTab ));
+ pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, rDocument.MaxCol(), nEndRow, nTab ));
}
nStartRow = nEndRow + 1;
@@ -3476,7 +3476,7 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
SCROW nStartRow = nRow1;
// #i116164# if there are no drawing objects within the row range, a single HeightChanged call is enough
- ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
bool bHasObjects = pDrawLayer && pDrawLayer->HasObjectsInRows( nTab, nRow1, nRow2 );
while (nStartRow <= nRow2)
@@ -3494,9 +3494,9 @@ void ScTable::ShowRows(SCROW nRow1, SCROW nRow2, bool bShow)
if ( bChanged )
{
- ScChartListenerCollection* pCharts = pDocument->GetChartListenerCollection();
+ ScChartListenerCollection* pCharts = rDocument.GetChartListenerCollection();
if ( pCharts )
- pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, pDocument->MaxCol(), nEndRow, nTab ));
+ pCharts->SetRangeDirty(ScRange( 0, nStartRow, nTab, rDocument.MaxCol(), nEndRow, nTab ));
InvalidatePageBreaks();
}
@@ -3657,7 +3657,7 @@ void ScTable::ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 )
while (rX1 > 0 && ColHidden(rX1-1))
--rX1;
- while (rX2 < pDocument->MaxCol() && ColHidden(rX2+1))
+ while (rX2 < rDocument.MaxCol() && ColHidden(rX2+1))
++rX2;
// Row-wise expansion
@@ -3672,7 +3672,7 @@ void ScTable::ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 )
rY1 = nStartRow;
}
}
- if (rY2 < pDocument->MaxRow())
+ if (rY2 < rDocument.MaxRow())
{
SCROW nEndRow = -1;
if (RowHidden(rY2+1, nullptr, &nEndRow) && ValidRow(nEndRow))
@@ -3767,7 +3767,7 @@ void ScTable::DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SC
// Rows
- UsedRowsType aUsed(0, pDocument->MaxRow()+1, false);
+ UsedRowsType aUsed(0, rDocument.MaxRow()+1, false);
for (nCol=nStartCol; nCol<=nEndCol; nCol++)
aCol[nCol].FindUsed(nStartRow, nEndRow, aUsed);
aUsed.build_tree();
@@ -3842,11 +3842,11 @@ void ScTable::CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW n
aSrc.SetCol( nCol );
aDest.SetCol( nDestX );
ScCellValue aCell;
- aCell.assign(*pDocument, ScAddress(nCol, nRow, nTab));
+ aCell.assign(rDocument, ScAddress(nCol, nRow, nTab));
if (aCell.meType == CELLTYPE_FORMULA)
{
- sc::RefUpdateContext aCxt(*pDocument);
+ sc::RefUpdateContext aCxt(rDocument);
aCxt.meMode = URM_COPY;
aCxt.maRange = aRange;
aCxt.mnColDelta = nDestCol - nStartCol;
@@ -3863,8 +3863,8 @@ void ScTable::CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW n
}
else
{
- aCell.release(*pDocument, aDest);
- pDocument->SetPattern( aDest, *GetPattern( nCol, nRow ) );
+ aCell.release(rDocument, aDest);
+ rDocument.SetPattern( aDest, *GetPattern( nCol, nRow ) );
}
++nDestX;
@@ -3905,11 +3905,11 @@ void ScTable::GetUpperCellString(SCCOL nCol, SCROW nRow, OUString& rStr)
void ScTable::SetDrawPageSize(bool bResetStreamValid, bool bUpdateNoteCaptionPos)
{
- ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
if( pDrawLayer )
{
- double fValX = GetColOffset( pDocument->MaxCol() + 1 ) * HMM_PER_TWIPS;
- double fValY = GetRowOffset( pDocument->MaxRow() + 1 ) * HMM_PER_TWIPS;
+ double fValX = GetColOffset( rDocument.MaxCol() + 1 ) * HMM_PER_TWIPS;
+ double fValY = GetRowOffset( rDocument.MaxRow() + 1 ) * HMM_PER_TWIPS;
const long nMax = ::std::numeric_limits<long>::max();
// #i113884# Avoid int32 overflow with possible negative results than can cause bad effects.
// If the draw page size is smaller than all rows, only the bottom of the sheet is affected.
@@ -3976,7 +3976,7 @@ SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const
aRowHeightRange.mnRow2 = -1;
aRowHeightRange.mnValue = 0; // silence MSVC C4701
- for (SCROW nRow = 0; nRow <= pDocument->MaxRow(); ++nRow)
+ for (SCROW nRow = 0; nRow <= rDocument.MaxRow(); ++nRow)
{
if (!mpHiddenRows->getRangeData(nRow, aData))
// Failed to fetch the range data for whatever reason.
@@ -4000,8 +4000,8 @@ SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const
if (nSum > nHeight)
{
- if (nRow >= pDocument->MaxRow())
- return pDocument->MaxRow();
+ if (nRow >= rDocument.MaxRow())
+ return rDocument.MaxRow();
// Find the next visible row.
++nRow;
@@ -4014,7 +4014,7 @@ SCROW ScTable::GetRowForHeight(sal_uLong nHeight) const
// These rows are hidden.
nRow = aData.mnRow2 + 1;
- return nRow <= pDocument->MaxRow() ? nRow : pDocument->MaxRow();
+ return nRow <= rDocument.MaxRow() ? nRow : rDocument.MaxRow();
}
}
return -1;
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 7a34da65b1ca..1c8d5db104bc 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -957,12 +957,12 @@ void ScTable::SortReorderByColumn(
// Get all area listeners that listen on one column within the range
// and end their listening.
ScRange aMoveRange( nStart, nRow1, nTab, nLast, nRow2, nTab);
- std::vector<sc::AreaListener> aAreaListeners = pDocument->GetBASM()->GetAllListeners(
+ std::vector<sc::AreaListener> aAreaListeners = rDocument.GetBASM()->GetAllListeners(
aMoveRange, sc::AreaOverlapType::OneColumnInside);
{
for (auto& rAreaListener : aAreaListeners)
{
- pDocument->EndListeningArea(rAreaListener.maArea, rAreaListener.mbGroupListening, rAreaListener.mpListener);
+ rDocument.EndListeningArea(rAreaListener.maArea, rAreaListener.mbGroupListening, rAreaListener.mpListener);
aListeners.push_back( rAreaListener.mpListener);
}
}
@@ -986,7 +986,7 @@ void ScTable::SortReorderByColumn(
aNewRange.aStart.SetCol( itCol->second);
aNewRange.aEnd.SetCol( itCol->second);
}
- pDocument->StartListeningArea(aNewRange, rAreaListener.mbGroupListening, rAreaListener.mpListener);
+ rDocument.StartListeningArea(aNewRange, rAreaListener.mbGroupListening, rAreaListener.mpListener);
}
}
}
@@ -1005,7 +1005,7 @@ void ScTable::SortReorderByColumn(
sc::CellStoreType& rCells = aCol[nCol].maCells;
sc::CellStoreType::position_type aPos = rCells.position(nRow1);
sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
- if (nRow2 < pDocument->MaxRow())
+ if (nRow2 < rDocument.MaxRow())
{
aPos = rCells.position(aPos.first, nRow2+1);
sc::SharedFormulaUtil::joinFormulaCellAbove(aPos);
@@ -1031,7 +1031,7 @@ void ScTable::SortReorderByRow(
// cells in the sorted range before reordering, and re-start them
// afterward.
{
- sc::EndListeningContext aCxt(*pDocument);
+ sc::EndListeningContext aCxt(rDocument);
DetachFormulaCells(aCxt, nCol1, nRow1, nCol2, nRow2);
}
@@ -1106,13 +1106,13 @@ void ScTable::SortReorderByRow(
for (const auto& rSpan : aSpans)
{
assert(rSpan.mpPattern); // should never be NULL.
- pDocument->GetPool()->Put(*rSpan.mpPattern);
+ rDocument.GetPool()->Put(*rSpan.mpPattern);
}
for (const auto& rSpan : aSpans)
{
aCol[nThisCol].SetPatternArea(rSpan.mnRow1, rSpan.mnRow2, *rSpan.mpPattern);
- pDocument->GetPool()->Remove(*rSpan.mpPattern);
+ rDocument.GetPool()->Remove(*rSpan.mpPattern);
}
}
@@ -1152,7 +1152,7 @@ void ScTable::SortReorderByRow(
aCol[i].RegroupFormulaCells();
{
- sc::StartListeningContext aCxt(*pDocument);
+ sc::StartListeningContext aCxt(rDocument);
AttachFormulaCells(aCxt, nCol1, nRow1, nCol2, nRow2);
}
}
@@ -1175,7 +1175,7 @@ void ScTable::SortReorderByRowRefUpdate(
// Get the range of formula group listeners within sorted range (if any).
sc::QueryRange aQuery;
- ScBroadcastAreaSlotMachine* pBASM = pDocument->GetBASM();
+ ScBroadcastAreaSlotMachine* pBASM = rDocument.GetBASM();
std::vector<sc::AreaListener> aGrpListeners =
pBASM->GetAllListeners(
aMoveRange, sc::AreaOverlapType::InsideOrOverlap, sc::ListenerGroupType::Group);
@@ -1186,7 +1186,7 @@ void ScTable::SortReorderByRowRefUpdate(
assert(rGrpListener.mbGroupListening);
SvtListener* pGrpLis = rGrpListener.mpListener;
pGrpLis->Query(aQuery);
- pDocument->EndListeningArea(rGrpListener.maArea, rGrpListener.mbGroupListening, pGrpLis);
+ rDocument.EndListeningArea(rGrpListener.maArea, rGrpListener.mbGroupListening, pGrpLis);
}
}
@@ -1303,13 +1303,13 @@ void ScTable::SortReorderByRowRefUpdate(
for (const auto& rSpan : aSpans)
{
assert(rSpan.mpPattern); // should never be NULL.
- pDocument->GetPool()->Put(*rSpan.mpPattern);
+ rDocument.GetPool()->Put(*rSpan.mpPattern);
}
for (const auto& rSpan : aSpans)
{
aCol[nThisCol].SetPatternArea(rSpan.mnRow1, rSpan.mnRow2, *rSpan.mpPattern);
- pDocument->GetPool()->Remove(*rSpan.mpPattern);
+ rDocument.GetPool()->Remove(*rSpan.mpPattern);
}
}
@@ -1356,12 +1356,12 @@ void ScTable::SortReorderByRowRefUpdate(
// Get all area listeners that listen on one row within the range and end
// their listening.
- std::vector<sc::AreaListener> aAreaListeners = pDocument->GetBASM()->GetAllListeners(
+ std::vector<sc::AreaListener> aAreaListeners = rDocument.GetBASM()->GetAllListeners(
aMoveRange, sc::AreaOverlapType::OneRowInside);
{
for (auto& rAreaListener : aAreaListeners)
{
- pDocument->EndListeningArea(rAreaListener.maArea, rAreaListener.mbGroupListening, rAreaListener.mpListener);
+ rDocument.EndListeningArea(rAreaListener.maArea, rAreaListener.mbGroupListening, rAreaListener.mpListener);
aListeners.push_back( rAreaListener.mpListener);
}
}
@@ -1371,7 +1371,7 @@ void ScTable::SortReorderByRowRefUpdate(
std::vector<ScFormulaCell*> aFCells;
FormulaCellCollectAction aAction(aFCells);
- aGrpListenerRanges.executeColumnAction(*pDocument, aAction);
+ aGrpListenerRanges.executeColumnAction(rDocument, aAction);
aListeners.insert( aListeners.end(), aFCells.begin(), aFCells.end() );
}
@@ -1393,7 +1393,7 @@ void ScTable::SortReorderByRowRefUpdate(
for (const auto& [nCol, rCol] : rCols)
{
std::vector<SCROW> aBounds(rCol);
- pDocument->UnshareFormulaCells(rTab, nCol, aBounds);
+ rDocument.UnshareFormulaCells(rTab, nCol, aBounds);
}
}
@@ -1405,7 +1405,7 @@ void ScTable::SortReorderByRowRefUpdate(
for (const auto& [rTab, rCols] : rGroupTabs)
{
for (const auto& rEntry : rCols)
- pDocument->RegroupFormulaCells(rTab, rEntry.first);
+ rDocument.RegroupFormulaCells(rTab, rEntry.first);
}
// Re-start area listeners on the reordered rows.
@@ -1418,7 +1418,7 @@ void ScTable::SortReorderByRowRefUpdate(
aNewRange.aStart.SetRow( itRow->second);
aNewRange.aEnd.SetRow( itRow->second);
}
- pDocument->StartListeningArea(aNewRange, rAreaListener.mbGroupListening, rAreaListener.mpListener);
+ rDocument.StartListeningArea(aNewRange, rAreaListener.mbGroupListening, rAreaListener.mpListener);
}
// Re-group columns in the sorted range too.
@@ -1427,8 +1427,8 @@ void ScTable::SortReorderByRowRefUpdate(
{
// Re-start area listeners on the old group listener ranges.
- ListenerStartAction aAction(*pDocument);
- aGrpListenerRanges.executeColumnAction(*pDocument, aAction);
+ ListenerStartAction aAction(rDocument);
+ aGrpListenerRanges.executeColumnAction(rDocument, aAction);
}
}
@@ -1876,7 +1876,7 @@ void ScTable::RemoveSubTotals( ScSubTotalParam& rParam )
std::for_each(aRows.rbegin(), aRows.rend(), [this](const SCROW nRow) {
RemoveRowBreak(nRow+1, false, true);
- pDocument->DeleteRow(0, nTab, pDocument->MaxCol(), nTab, nRow, 1);
+ rDocument.DeleteRow(0, nTab, rDocument.MaxCol(), nTab, nRow, 1);
});
rParam.nRow2 -= aRows.size();
@@ -1946,7 +1946,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
sal_uInt16 i;
// Remove empty rows at the end
- // so that all exceeding (pDocument->MaxRow()) can be found by InsertRow (#35180#)
+ // so that all exceeding (rDocument.MaxRow()) can be found by InsertRow (#35180#)
// If sorted, all empty rows are at the end.
SCSIZE nEmpty = GetEmptyLinesInBlock( nStartCol, nStartRow, nEndCol, nEndRow, DIR_BOTTOM );
nEndRow -= nEmpty;
@@ -1977,7 +1977,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
//TODO: sort?
- ScStyleSheet* pStyle = static_cast<ScStyleSheet*>(pDocument->GetStyleSheetPool()->Find(
+ ScStyleSheet* pStyle = static_cast<ScStyleSheet*>(rDocument.GetStyleSheetPool()->Find(
ScResId(STR_STYLENAME_RESULT), SfxStyleFamily::Para ));
bool bSpaceLeft = true; // Success when inserting?
@@ -2042,10 +2042,10 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
aRowEntry.nFuncStart = aRowEntry.nSubStartRow;
aRowEntry.nFuncEnd = nRow-1;
- bSpaceLeft = pDocument->InsertRow( 0, nTab, pDocument->MaxCol(), nTab,
+ bSpaceLeft = rDocument.InsertRow( 0, nTab, rDocument.MaxCol(), nTab,
aRowEntry.nDestRow, 1 );
DBShowRow( aRowEntry.nDestRow, bBlockVis );
- if ( rParam.bPagebreak && nRow < pDocument->MaxRow() &&
+ if ( rParam.bPagebreak && nRow < rDocument.MaxRow() &&
aRowEntry.nSubStartRow != nStartRow && nLevel == 0)
SetRowBreak(aRowEntry.nSubStartRow, false, true);
@@ -2131,7 +2131,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
// increment row
nGlobalEndFunc++;
- bSpaceLeft = pDocument->InsertRow(0, nTab, pDocument->MaxCol(), nTab, aRowEntry.nDestRow, 1);
+ bSpaceLeft = rDocument.InsertRow(0, nTab, rDocument.MaxCol(), nTab, aRowEntry.nDestRow, 1);
if (bSpaceLeft)
{
@@ -2164,7 +2164,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
aRef.Ref2.SetAbsCol(nResCols[nResult]);
aRef.Ref2.SetAbsRow(rRowEntry.nFuncEnd);
- ScTokenArray aArr(*pDocument);
+ ScTokenArray aArr(rDocument);
aArr.AddOpCode( ocSubTotal );
aArr.AddOpCode( ocOpen );
aArr.AddDouble( static_cast<double>(pResFunc[nResult]) );
@@ -2173,7 +2173,7 @@ bool ScTable::DoSubTotals( ScSubTotalParam& rParam )
aArr.AddOpCode( ocClose );
aArr.AddOpCode( ocStop );
ScFormulaCell* pCell = new ScFormulaCell(
- pDocument, ScAddress(nResCols[nResult], rRowEntry.nDestRow, nTab), aArr);
+ &rDocument, ScAddress(nResCols[nResult], rRowEntry.nDestRow, nTab), aArr);
if ( rParam.bIncludePattern )
pCell->SetNeedNumberFormat(true);
@@ -2749,7 +2749,7 @@ bool ScTable::ValidQuery(
bool* pTest = ( nEntryCount <= nFixedBools ? &aTest[0] : new bool[nEntryCount] );
long nPos = -1;
- QueryEvaluator aEval(*pDocument, *this, rParam, pbTestEqualCondition != nullptr);
+ QueryEvaluator aEval(rDocument, *this, rParam, pbTestEqualCondition != nullptr);
ScQueryParam::const_iterator it, itBeg = rParam.begin(), itEnd = rParam.end();
for (it = itBeg; it != itEnd && (*it)->bDoQuery; ++it)
{
@@ -3068,7 +3068,7 @@ SCSIZE ScTable::Query(const ScQueryParam& rParamOrg, bool bKeepSub)
SCROW nOutRow = 0;
SCROW nHeader = aParam.bHasHeader ? 1 : 0;
- lcl_PrepareQuery(pDocument, this, aParam);
+ lcl_PrepareQuery(&rDocument, this, aParam);
if (!aParam.bInplace)
{
@@ -3178,7 +3178,7 @@ bool ScTable::CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow
if ( nTab == nDBTab )
GetUpperCellString(i, nDBRow1, aCellStr);
else
- pDocument->GetUpperCellString(i, nDBRow1, nDBTab, aCellStr);
+ rDocument.GetUpperCellString(i, nDBRow1, nDBTab, aCellStr);
bFound = (aCellStr == aQueryStr);
if (!bFound) i++;
}
@@ -3205,7 +3205,7 @@ bool ScTable::CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow
SCSIZE nIndex = 0;
SCROW nRow = nRow1 + 1;
- svl::SharedStringPool& rPool = pDocument->GetSharedStringPool();
+ svl::SharedStringPool& rPool = rDocument.GetSharedStringPool();
while (nRow <= nRow2)
{
nCol = nCol1;
@@ -3259,7 +3259,7 @@ bool ScTable::CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2
SCSIZE nNewEntries = static_cast<SCSIZE>(nRow2-nRow1+1);
rQueryParam.Resize( nNewEntries );
- svl::SharedStringPool& rPool = pDocument->GetSharedStringPool();
+ svl::SharedStringPool& rPool = rDocument.GetSharedStringPool();
do
{
@@ -3292,7 +3292,7 @@ bool ScTable::CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2
if ( nTab == nDBTab )
GetUpperCellString(i, nDBRow1, aFieldStr);
else
- pDocument->GetUpperCellString(i, nDBRow1, nDBTab, aFieldStr);
+ rDocument.GetUpperCellString(i, nDBRow1, nDBTab, aFieldStr);
bFound = (aCellStr == aFieldStr);
if (bFound)
{
@@ -3358,7 +3358,7 @@ bool ScTable::CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow
if (!bValid)
bValid = CreateExcelQuery(nCol1, nRow1, nCol2, nRow2, rQueryParam);
- SvNumberFormatter* pFormatter = pDocument->GetFormatTable();
+ SvNumberFormatter* pFormatter = rDocument.GetFormatTable();
nCount = rQueryParam.GetEntryCount();
if (bValid)
@@ -3474,7 +3474,7 @@ void ScTable::GetFilteredFilterEntries(
ScQueryParam aParam( rParam );
aParam.RemoveEntryByField(nCol);
- lcl_PrepareQuery(pDocument, this, aParam);
+ lcl_PrepareQuery(&rDocument, this, aParam);
for ( SCROW j = nRow1; j <= nRow2; ++j )
{
if (ValidQuery(j, aParam))
@@ -3560,7 +3560,7 @@ void ScTable::UpdateSelectionFunction( ScFunctionData& rData, const ScMarkData&
{
assert(!"ScTable::UpdateSelectionFunction - called without anything marked");
aMarkArea.aStart.SetCol(0);
- aMarkArea.aEnd.SetCol(pDocument->MaxCol());
+ aMarkArea.aEnd.SetCol(rDocument.MaxCol());
}
const SCCOL nStartCol = aMarkArea.aStart.Col();
const SCCOL nEndCol = ClampToAllocatedColumns(aMarkArea.aEnd.Col());
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index ff70ede09653..29d771eb8e75 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -252,7 +252,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
{
double fVal;
sal_uInt32 nFormat = GetAttr(nCol,nRow,ATTR_VALUE_FORMAT)->GetValue();
- const SvNumFormatType nFormatType = pDocument->GetFormatTable()->GetType(nFormat);
+ const SvNumFormatType nFormatType = rDocument.GetFormatTable()->GetType(nFormat);
bool bDate = (nFormatType == SvNumFormatType::DATE );
bool bBooleanCell = (!bDate && nFormatType == SvNumFormatType::LOGICAL);
if (bDate)
@@ -260,7 +260,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (nCount > 1)
{
double nVal;
- Date aNullDate = pDocument->GetFormatTable()->GetNullDate();
+ Date aNullDate = rDocument.GetFormatTable()->GetNullDate();
Date aDate1 = aNullDate;
nVal = aFirstCell.mfValue;
aDate1.AddDays(nVal);
@@ -359,7 +359,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if ( !::rtl::math::approxEqual( nDiff, rInc, 13 ) )
bVal = false;
else if ((nVal2 == 0.0 || nVal2 == 1.0) &&
- (pDocument->GetFormatTable()->GetType(GetNumberFormat(nCol,nRow)) ==
+ (rDocument.GetFormatTable()->GetType(GetNumberFormat(nCol,nRow)) ==
SvNumFormatType::LOGICAL))
bVal = false;
nVal1 = nVal2;
@@ -438,7 +438,7 @@ void ScTable::FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
CellType eType = aCell.meType;
if ( eType == CELLTYPE_STRING || eType == CELLTYPE_EDIT )
{
- aStr = aCell.getString(pDocument);
+ aStr = aCell.getString(&rDocument);
nFlag2 = lcl_DecompValueString( aStr, nVal2, &rMinDigits );
if ( nFlag1 == nFlag2 )
{
@@ -473,9 +473,9 @@ void ScTable::FillFormula(
const ScFormulaCell* pSrcCell, SCCOL nDestCol, SCROW nDestRow, bool bLast )
{
- pDocument->SetNoListening( true ); // still the wrong reference
+ rDocument.SetNoListening( true ); // still the wrong reference
ScAddress aAddr( nDestCol, nDestRow, nTab );
- ScFormulaCell* pDestCell = new ScFormulaCell( *pSrcCell, *pDocument, aAddr );
+ ScFormulaCell* pDestCell = new ScFormulaCell( *pSrcCell, rDocument, aAddr );
aCol[nDestCol].SetFormulaCell(nDestRow, pDestCell);
if ( bLast && pDestCell->GetMatrixFlag() != ScMatrixMode::NONE )
@@ -485,7 +485,7 @@ void ScTable::FillFormula(
{
if ( nDestCol >= aOrg.Col() && nDestRow >= aOrg.Row() )
{
- ScFormulaCell* pOrgCell = pDocument->GetFormulaCell(aOrg);
+ ScFormulaCell* pOrgCell = rDocument.GetFormulaCell(aOrg);
if (pOrgCell && pOrgCell->GetMatrixFlag() == ScMatrixMode::Formula)
{
pOrgCell->SetMatColsRows(
@@ -507,8 +507,8 @@ void ScTable::FillFormula(
OSL_FAIL( "FillFormula: no MatrixOrigin" );
}
}
- pDocument->SetNoListening( false );
- pDestCell->StartListeningTo( *pDocument );
+ rDocument.SetNoListening( false );
+ pDestCell->StartListeningTo( rDocument );
}
void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
@@ -659,7 +659,7 @@ void ScTable::FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if ( bVertical && nISrcStart == nISrcEnd && !bHasFiltered )
{
// set all attributes at once (en bloc)
- if (pNewPattern || pSrcPattern != pDocument->GetDefPattern())
+ if (pNewPattern || pSrcPattern != rDocument.GetDefPattern())
{
// Default is already present (DeleteArea)
SCROW nY1 = static_cast<SCROW>(std::min( nIStart, nIEnd ));
@@ -939,7 +939,7 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
{
- aValue = aCell.getString(pDocument);
+ aValue = aCell.getString(&rDocument);
if ( !(nScFillModeMouseModifier & KEY_MOD1) )
{
@@ -973,7 +973,7 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW
double nVal = aCell.mfValue;
if ( !(nScFillModeMouseModifier & KEY_MOD1) )
{
- const SvNumFormatType nFormatType = pDocument->GetFormatTable()->GetType(nNumFmt);
+ const SvNumFormatType nFormatType = rDocument.GetFormatTable()->GetType(nNumFmt);
bool bPercentCell = (nFormatType == SvNumFormatType::PERCENT);
if (bPercentCell)
{
@@ -993,7 +993,7 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW
}
const Color* pColor;
- pDocument->GetFormatTable()->GetOutputString( nVal, nNumFmt, aValue, &pColor );
+ rDocument.GetFormatTable()->GetOutputString( nVal, nNumFmt, aValue, &pColor );
}
break;
// not for formulas
@@ -1019,7 +1019,7 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW
case CELLTYPE_STRING:
case CELLTYPE_EDIT:
{
- aValue = aCell.getString(pDocument);
+ aValue = aCell.getString(&rDocument);
nHeadNoneTail = lcl_DecompValueString( aValue, nVal );
if ( nHeadNoneTail )
nStart = static_cast<double>(nVal);
@@ -1081,7 +1081,7 @@ OUString ScTable::GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW
//TODO: get number format according to Index?
const Color* pColor;
sal_uInt32 nNumFmt = GetNumberFormat( nCol1, nRow1 );
- pDocument->GetFormatTable()->GetOutputString( nStart, nNumFmt, aValue, &pColor );
+ rDocument.GetFormatTable()->GetOutputString( nStart, nNumFmt, aValue, &pColor );
}
}
}
@@ -1107,7 +1107,7 @@ void ScTable::IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillD
const sal_uInt16 nMaxYear = 9956;
long nInc = static_cast<long>(nStep); // upper/lower limits ?
- Date aNullDate = pDocument->GetFormatTable()->GetNullDate();
+ Date aNullDate = rDocument.GetFormatTable()->GetNullDate();
Date aDate = aNullDate;
aDate.AddDays(rVal);
switch (eCmd)
@@ -1263,9 +1263,9 @@ void ScTable::FillFormulaVertical(
aCol[nCol].DeleteRanges(aSpans, InsertDeleteFlags::VALUE | InsertDeleteFlags::DATETIME | InsertDeleteFlags::STRING | InsertDeleteFlags::FORMULA | InsertDeleteFlags::OUTLINE);
aCol[nCol].CloneFormulaCell(rSrcCell, sc::CellTextAttr(), aSpans);
- auto pSet = std::make_shared<sc::ColumnBlockPositionSet>(*pDocument);
- sc::StartListeningContext aStartCxt(*pDocument, pSet);
- sc::EndListeningContext aEndCxt(*pDocument, pSet);
+ auto pSet = std::make_shared<sc::ColumnBlockPositionSet>(rDocument);
+ sc::StartListeningContext aStartCxt(rDocument, pSet);
+ sc::EndListeningContext aEndCxt(rDocument, pSet);
SCROW nStartRow = aSpans.front().mnRow1;
SCROW nEndRow = aSpans.back().mnRow2;
@@ -1409,8 +1409,8 @@ void ScTable::FillAutoSimple(
FillFormulaVertical(*aSrcCell.mpFormula, rInner, rCol, nIStart, nIEnd, pProgress, rProgress);
return;
}
- const SvNumFormatType nFormatType = pDocument->GetFormatTable()->GetType(
- aCol[rCol].GetNumberFormat( pDocument->GetNonThreadedContext(), nSource));
+ const SvNumFormatType nFormatType = rDocument.GetFormatTable()->GetType(
+ aCol[rCol].GetNumberFormat( rDocument.GetNonThreadedContext(), nSource));
bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL);
bPercentCell = (nFormatType == SvNumFormatType::PERCENT);
@@ -1418,8 +1418,8 @@ void ScTable::FillAutoSimple(
else // rInner&:=nCol, rOuter&:=nRow
{
aSrcCell = aCol[nSource].GetCellValue(rRow);
- const SvNumFormatType nFormatType = pDocument->GetFormatTable()->GetType(
- aCol[nSource].GetNumberFormat( pDocument->GetNonThreadedContext(), rRow));
+ const SvNumFormatType nFormatType = rDocument.GetFormatTable()->GetType(
+ aCol[nSource].GetNumberFormat( rDocument.GetNonThreadedContext(), rRow));
bBooleanCell = (nFormatType == SvNumFormatType::LOGICAL);
bPercentCell = (nFormatType == SvNumFormatType::PERCENT);
}
@@ -1434,7 +1434,7 @@ void ScTable::FillAutoSimple(
if (aSrcCell.meType == CELLTYPE_STRING)
aValue = aSrcCell.mpString->getString();
else
- aValue = ScEditUtil::GetString(*aSrcCell.mpEditText, pDocument);
+ aValue = ScEditUtil::GetString(*aSrcCell.mpEditText, &rDocument);
if ( !(nScFillModeMouseModifier & KEY_MOD1) && !bHasFiltered )
{
nCellDigits = 0; // look at each source cell individually
@@ -1934,7 +1934,7 @@ void ScTable::FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
if (eCellType == CELLTYPE_STRING)
aValue = aSrcCell.mpString->getString();
else
- aValue = ScEditUtil::GetString(*aSrcCell.mpEditText, pDocument);
+ aValue = ScEditUtil::GetString(*aSrcCell.mpEditText, &rDocument);
sal_Int32 nStringValue;
sal_uInt16 nMinDigits = nArgMinDigits;
short nHeadNoneTail = lcl_DecompValueString( aValue, nStringValue, &nMinDigits );
@@ -2071,8 +2071,8 @@ void ScTable::AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW
std::unique_ptr<ScPatternAttr> pPatternAttrs[16];
for (sal_uInt8 i = 0; i < 16; ++i)
{
- pPatternAttrs[i].reset(new ScPatternAttr(pDocument->GetPool()));
- pData->FillToItemSet(i, pPatternAttrs[i]->GetItemSet(), *pDocument);
+ pPatternAttrs[i].reset(new ScPatternAttr(rDocument.GetPool()));
+ pData->FillToItemSet(i, pPatternAttrs[i]->GetItemSet(), rDocument);
}
SCCOL nCol = nStartCol;
@@ -2196,7 +2196,7 @@ void ScTable::AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW
void ScTable::GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData)
{
sal_uInt32 nFormatIndex = GetNumberFormat( nCol, nRow );
- ScNumFormatAbbrev aNumFormat( nFormatIndex, *pDocument->GetFormatTable() );
+ ScNumFormatAbbrev aNumFormat( nFormatIndex, *rDocument.GetFormatTable() );
rData.GetFromItemSet( nIndex, GetPattern( nCol, nRow )->GetItemSet(), aNumFormat );
}
@@ -2353,7 +2353,7 @@ void ScTable::UpdateInsertTabAbs(SCTAB nTable)
bool ScTable::GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel,
const ScMarkData& rMark) const
{
- if (rRow == pDocument->MaxRow()+2) // end of table
+ if (rRow == rDocument.MaxRow()+2) // end of table
{
rRow = 0;
rCol = 0;
@@ -2361,13 +2361,13 @@ bool ScTable::GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel,
else
{
rRow++;
- if (rRow == pDocument->MaxRow()+1)
+ if (rRow == rDocument.MaxRow()+1)
{
rCol++;
rRow = 0;
}
}
- if (rCol == pDocument->MaxCol()+1)
+ if (rCol == rDocument.MaxCol()+1)
return true;
for (;;)
{
@@ -2377,7 +2377,7 @@ bool ScTable::GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, bool bInSel,
return true;
if (aCol[rCol].GetNextSpellingCell(rRow, bInSel, rMark))
return true;
- /*else (rRow == pDocument->MaxRow()+1) */
+ /*else (rRow == rDocument.MaxRow()+1) */
rCol++;
rRow = 0;
}
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 0537e2f19882..71e15e26a55e 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -48,7 +48,7 @@ using ::std::set;
void ScTable::UpdatePageBreaks( const ScRange* pUserArea )
{
- if ( pDocument->IsImportingXML() )
+ if ( rDocument.IsImportingXML() )
return;
// pUserArea != NULL -> print area is specified. We need to force-update
@@ -64,7 +64,7 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea )
return;
}
- SfxStyleSheetBase* pStyle = pDocument->GetStyleSheetPool()->
+ SfxStyleSheetBase* pStyle = rDocument.GetStyleSheetPool()->
Find( aPageStyle, SfxStyleFamily::Page );
if ( !pStyle )
{
@@ -76,8 +76,8 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea )
SCCOL nStartCol = 0;
SCROW nStartRow = 0;
- SCCOL nEndCol = pDocument->MaxCol();
- SCROW nEndRow = pDocument->MaxRow();
+ SCCOL nEndCol = rDocument.MaxCol();
+ SCROW nEndRow = rDocument.MaxRow();
if (pUserArea)
{
nStartCol = pUserArea->aStart.Col();
@@ -92,10 +92,10 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea )
{
// Show nothing, when multiple ranges
- for (SCCOL nX : GetColumnsRange(0, pDocument->MaxCol()))
+ for (SCCOL nX : GetColumnsRange(0, rDocument.MaxCol()))
RemoveColBreak(nX, true, false);
- RemoveRowPageBreaks(0, pDocument->MaxRow()-1);
+ RemoveRowPageBreaks(0, rDocument.MaxRow()-1);
return;
}
@@ -283,17 +283,17 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea )
// End: Remove Break
- if (nEndCol < pDocument->MaxCol())
+ if (nEndCol < rDocument.MaxCol())
{
SetColBreak(nEndCol+1, true, false); // AREABREAK
- for (SCCOL nCol : GetColumnsRange(nEndCol + 2, pDocument->MaxCol()))
+ for (SCCOL nCol : GetColumnsRange(nEndCol + 2, rDocument.MaxCol()))
RemoveColBreak(nCol, true, false);
}
- if (nEndRow < pDocument->MaxRow())
+ if (nEndRow < rDocument.MaxRow())
{
SetRowBreak(nEndRow+1, true, false); // AREABREAK
- if (nEndRow+2 <= pDocument->MaxRow())
- RemoveRowPageBreaks(nEndRow+2, pDocument->MaxRow());
+ if (nEndRow+2 <= rDocument.MaxRow())
+ RemoveRowPageBreaks(nEndRow+2, rDocument.MaxRow());
}
mbPageBreaksValid = !pUserArea; // #i116881# the valid flag can only apply to the "no user area" case
}
@@ -584,7 +584,7 @@ bool ScTable::SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden)
bChanged = mpHiddenRows->setFalse(nStartRow, nEndRow);
std::vector<SdrObject*> aRowDrawObjects;
- ScDrawLayer* pDrawLayer = pDocument->GetDrawLayer();
+ ScDrawLayer* pDrawLayer = rDocument.GetDrawLayer();
if (pDrawLayer) {
aRowDrawObjects = pDrawLayer->GetObjectsAnchoredToRows(GetTab(), nStartRow, nEndRow);
for (auto aObj : aRowDrawObjects)
@@ -602,7 +602,7 @@ bool ScTable::SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden)
// SfxHintId::ScHiddenRowsChanged, leaving the bulk will track
// those and broadcast SfxHintId::ScDataChanged to notify all
// dependents.
- ScBulkBroadcast aBulkBroadcast( pDocument->GetBASM(), SfxHintId::ScDataChanged);
+ ScBulkBroadcast aBulkBroadcast( rDocument.GetBASM(), SfxHintId::ScDataChanged);
for (SCCOL i = 0; i < aCol.size(); i++)
{
aCol[i].BroadcastRows(nStartRow, nEndRow, SfxHintId::ScHiddenRowsChanged);
@@ -770,7 +770,7 @@ SCCOLROW ScTable::LastHiddenColRow(SCCOLROW nPos, bool bCol) const
SCCOL nCol = static_cast<SCCOL>(nPos);
if (ColHidden(nCol))
{
- for (SCCOL i = nCol+1; i <= pDocument->MaxCol(); ++i)
+ for (SCCOL i = nCol+1; i <= rDocument.MaxCol(); ++i)
{
if (!ColHidden(i))
return i - 1;
@@ -1009,8 +1009,8 @@ void ScTable::SyncColRowFlags()
CRFlags nManualBreakComplement = ~CRFlags::ManualBreak;
// Manual breaks.
- pRowFlags->AndValue(0, pDocument->MaxRow(), nManualBreakComplement);
- mpColFlags->AndValue(0, pDocument->MaxCol()+1, nManualBreakComplement);
+ pRowFlags->AndValue(0, rDocument.MaxRow(), nManualBreakComplement);
+ mpColFlags->AndValue(0, rDocument.MaxCol()+1, nManualBreakComplement);
for (const auto& rBreakPos : maRowManualBreaks)
pRowFlags->OrValue(rBreakPos, CRFlags::ManualBreak);
@@ -1019,8 +1019,8 @@ void ScTable::SyncColRowFlags()
mpColFlags->OrValue(rBreakPos, CRFlags::ManualBreak);
// Hidden flags.
- lcl_syncFlags(pDocument, *mpHiddenCols, *mpHiddenRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Hidden);
- lcl_syncFlags(pDocument, *mpFilteredCols, *mpFilteredRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Filtered);
+ lcl_syncFlags(&rDocument, *mpHiddenCols, *mpHiddenRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Hidden);
+ lcl_syncFlags(&rDocument, *mpFilteredCols, *mpFilteredRows, mpColFlags.get(), pRowFlags.get(), CRFlags::Filtered);
}
void ScTable::SetPageSize( const Size& rSize )
@@ -1116,7 +1116,7 @@ void ScTable::SetPageStyle( const OUString& rName )
return;
OUString aStrNew = rName;
- SfxStyleSheetBasePool* pStylePool = pDocument->GetStyleSheetPool();
+ SfxStyleSheetBasePool* pStylePool = rDocument.GetStyleSheetPool();
SfxStyleSheetBase* pNewStyle = pStylePool->Find( aStrNew, SfxStyleFamily::Page );
if ( !pNewStyle )
@@ -1200,7 +1200,7 @@ void ScTable::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* p
const SCCOL nCol1 = pAdrFrom ? pAdrFrom->Col() : 0;
const SCROW nRow1 = pAdrFrom ? pAdrFrom->Row() : 0;
const SCCOL nCol2 = pAdrTo ? pAdrTo->Col() : aCol.size() - 1;
- const SCROW nRow2 = pAdrTo ? pAdrTo->Row() : pDocument->MaxRow();
+ const SCROW nRow2 = pAdrTo ? pAdrTo->Row() : rDocument.MaxRow();
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
{
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index 00b856b4f14b..df3777abe02a 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -88,9 +88,9 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum
case SvxSearchCellType::FORMULA:
{
if ( eCellType == CELLTYPE_FORMULA )
- aCell.mpFormula->GetFormula(aString, pDocument->GetGrammar());
+ aCell.mpFormula->GetFormula(aString, rDocument.GetGrammar());
else if ( eCellType == CELLTYPE_EDIT )
- bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, pDocument, aString);
+ bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, &rDocument, aString);
else
{
if( !bSearchFormatted )
@@ -102,7 +102,7 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum
}
case SvxSearchCellType::VALUE:
if ( eCellType == CELLTYPE_EDIT )
- bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, pDocument, aString);
+ bMultiLine = lcl_GetTextWithBreaks(*aCell.mpEditText, &rDocument, aString);
else
{
if( !bSearchFormatted )
@@ -256,8 +256,8 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum
aString = aString.copy( 1 );
}
ScAddress aAdr( nCol, nRow, nTab );
- ScFormulaCell* pFCell = new ScFormulaCell( pDocument, aAdr,
- aString, pDocument->GetGrammar(), cMatrixFlag );
+ ScFormulaCell* pFCell = new ScFormulaCell( &rDocument, aAdr,
+ aString, rDocument.GetGrammar(), cMatrixFlag );
SCCOL nMatCols;
SCROW nMatRows;
aCell.mpFormula->GetMatColsRows(nMatCols, nMatRows);
@@ -266,12 +266,12 @@ bool ScTable::SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, sc::Colum
}
else if ( bMultiLine && aString.indexOf('\n') != -1 )
{
- ScFieldEditEngine& rEngine = pDocument->GetEditEngine();
+ ScFieldEditEngine& rEngine = rDocument.GetEditEngine();
rEngine.SetTextCurrentDefaults(aString);
SetEditText(nCol, nRow, rEngine.CreateTextObject());
}
else
- aCol[nCol].SetString(nRow, nTab, aString, pDocument->GetAddressConvention());
+ aCol[nCol].SetString(nRow, nTab, aString, rDocument.GetAddressConvention());
// pCell is invalid now (deleted)
aCol[nCol].InitBlockPosition( rBlockPos ); // invalidate also the cached position
@@ -344,7 +344,7 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
aCol[ i ].InitBlockPosition( blockPos[ i ] );
if (!bAll && rSearchItem.GetBackward())
{
- SCROW nLastNonFilteredRow = pDocument->MaxRow() + 1;
+ SCROW nLastNonFilteredRow = rDocument.MaxRow() + 1;
if (rSearchItem.GetRowDirection())
{
nCol--;
@@ -418,7 +418,7 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
// Not found in this column. Move to the next column.
bool bIsEmpty;
nRow = nLastRow;
- nLastNonFilteredRow = pDocument->MaxRow() + 1;
+ nLastNonFilteredRow = rDocument.MaxRow() + 1;
do
{
nCol--;
@@ -489,7 +489,7 @@ bool ScTable::Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow,
else
{
if (!aCol[nCol].GetNextDataPos(nRow))
- nRow = pDocument->MaxRow() + 1;
+ nRow = rDocument.MaxRow() + 1;
}
}
}
@@ -615,7 +615,7 @@ bool ScTable::SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW&
const ScMarkData& rMark)
{
const ScStyleSheet* pSearchStyle = static_cast<const ScStyleSheet*>(
- pDocument->GetStyleSheetPool()->Find(
+ rDocument.GetStyleSheetPool()->Find(
rSearchItem.GetSearchString(), SfxStyleFamily::Para ));
SCCOL nCol = rCol;
@@ -640,7 +640,7 @@ bool ScTable::SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW&
SCROW nNextRow = aCol[nCol].SearchStyle( nRow, pSearchStyle, bBack, bSelect, rMark );
if (!ValidRow(nNextRow))
{
- nRow = bBack ? pDocument->MaxRow() : 0;
+ nRow = bBack ? rDocument.MaxRow() : 0;
nCol = sal::static_int_cast<SCCOL>( nCol + nAdd );
}
else
@@ -682,7 +682,7 @@ bool ScTable::SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW&
}
else // forwards
{
- nRow = pDocument->MaxRow()+1;
+ nRow = rDocument.MaxRow()+1;
for (i=0; i < aColSize; ++i)
if (nNextRows[i]<nRow)
{
@@ -714,7 +714,7 @@ bool ScTable::ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW&
if (bRet)
{
const ScStyleSheet* pReplaceStyle = static_cast<const ScStyleSheet*>(
- pDocument->GetStyleSheetPool()->Find(
+ rDocument.GetStyleSheetPool()->Find(
rSearchItem.GetReplaceString(), SfxStyleFamily::Para ));
if (pReplaceStyle)
@@ -732,7 +732,7 @@ bool ScTable::SearchAllStyle(
const SvxSearchItem& rSearchItem, const ScMarkData& rMark, ScRangeList& rMatchedRanges)
{
const ScStyleSheet* pSearchStyle = static_cast<const ScStyleSheet*>(
- pDocument->GetStyleSheetPool()->Find(
+ rDocument.GetStyleSheetPool()->Find(
rSearchItem.GetSearchString(), SfxStyleFamily::Para ));
bool bSelect = rSearchItem.GetSelection();
bool bBack = rSearchItem.GetBackward();
@@ -743,7 +743,7 @@ bool ScTable::SearchAllStyle(
bool bFound = true;
SCROW nRow = 0;
SCROW nEndRow;
- while (bFound && nRow <= pDocument->MaxRow())
+ while (bFound && nRow <= rDocument.MaxRow())
{
bFound = aCol[i].SearchStyleRange( nRow, nEndRow, pSearchStyle, bBack, bSelect, rMark );
if (bFound)
@@ -772,13 +772,13 @@ bool ScTable::ReplaceAllStyle(
if (bRet)
{
const ScStyleSheet* pReplaceStyle = static_cast<const ScStyleSheet*>(
- pDocument->GetStyleSheetPool()->Find(
+ rDocument.GetStyleSheetPool()->Find(
rSearchItem.GetReplaceString(), SfxStyleFamily::Para ));
if (pReplaceStyle)
{
if (pUndoDoc)
- pDocument->CopyToDocument(0, 0 ,nTab, pDocument->MaxCol(),pDocument->MaxRow(),nTab,
+ rDocument.CopyToDocument(0, 0 ,nTab, rDocument.MaxCol(),rDocument.MaxRow(),nTab,
InsertDeleteFlags::ATTRIB, true, *pUndoDoc, &rMark);
ApplySelectionStyle( *pReplaceStyle, rMark );
}
@@ -968,7 +968,7 @@ bool ScTable::SearchRangeForEmptyCell(
if (rSearchItem.GetRowDirection())
{
// row direction.
- SCROW nLastNonFilteredRow = pDocument->MaxRow() + 1;
+ SCROW nLastNonFilteredRow = rDocument.MaxRow() + 1;
SCROW nBeginRow = std::min(rRange.aEnd.Row(), rRow);
for (SCROW nRow = nBeginRow; nRow >= rRange.aStart.Row(); --nRow)
{
@@ -995,7 +995,7 @@ bool ScTable::SearchRangeForEmptyCell(
SCCOL nBeginCol = std::min(rRange.aEnd.Col(), rCol);
for (SCCOL nCol = nBeginCol; nCol >= rRange.aStart.Col(); --nCol)
{
- SCROW nLastNonFilteredRow = pDocument->MaxRow() + 1;
+ SCROW nLastNonFilteredRow = rDocument.MaxRow() + 1;
SCROW nBeginRow = rRange.aEnd.Row();
if (nCol == rCol && nBeginRow >= rRow)
// always start from one cell before the cursor.
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index 65230448c052..cbe785995898 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -142,7 +142,7 @@ void ScTable::CopyOneCellFromClip(
}
}
- if (nCol1 == 0 && nCol2 == pDocument->MaxCol() && mpRowHeights)
+ if (nCol1 == 0 && nCol2 == rDocument.MaxCol() && mpRowHeights)
{
mpRowHeights->setValue(nRow1, nRow2, pSrcTab->GetOriginalHeight(nSrcRow));
@@ -278,7 +278,7 @@ void ScTable::UnshareFormulaCells( SCCOL nCol, std::vector<SCROW>& rRows )
if (!IsColValid(nCol))
return;
- sc::SharedFormulaUtil::unshareFormulaCells(pDocument, aCol[nCol].maCells, rRows);
+ sc::SharedFormulaUtil::unshareFormulaCells(&rDocument, aCol[nCol].maCells, rRows);
}
void ScTable::RegroupFormulaCells( SCCOL nCol )
@@ -345,7 +345,7 @@ bool ScTable::IsEditActionAllowed(
if (!IsProtected())
{
SCCOL nCol1 = 0, nCol2 = aCol.size() - 1;
- SCROW nRow1 = 0, nRow2 = pDocument->MaxRow();
+ SCROW nRow1 = 0, nRow2 = rDocument.MaxRow();
switch (eAction)
{
@@ -385,7 +385,7 @@ bool ScTable::IsEditActionAllowed(
case sc::ColRowEditAction::InsertColumnsAfter:
{
// TODO: improve the matrix range handling for the insert-before action.
- if (HasBlockMatrixFragment(nStart, 0, nEnd, pDocument->MaxRow()))
+ if (HasBlockMatrixFragment(nStart, 0, nEnd, rDocument.MaxRow()))
return false;
return pTabProtection->isOptionEnabled(ScTableProtection::INSERT_COLUMNS);
@@ -394,7 +394,7 @@ bool ScTable::IsEditActionAllowed(
case sc::ColRowEditAction::InsertRowsAfter:
{
// TODO: improve the matrix range handling for the insert-before action.
- if (HasBlockMatrixFragment(0, nStart, pDocument->MaxCol(), nEnd))
+ if (HasBlockMatrixFragment(0, nStart, rDocument.MaxCol(), nEnd))
return false;
return pTabProtection->isOptionEnabled(ScTableProtection::INSERT_ROWS);
@@ -404,14 +404,14 @@ bool ScTable::IsEditActionAllowed(
if (!pTabProtection->isOptionEnabled(ScTableProtection::DELETE_COLUMNS))
return false;
- return !HasAttrib(nStart, 0, nEnd, pDocument->MaxRow(), HasAttrFlags::Protected);
+ return !HasAttrib(nStart, 0, nEnd, rDocument.MaxRow(), HasAttrFlags::Protected);
}
case sc::ColRowEditAction::DeleteRows:
{
if (!pTabProtection->isOptionEnabled(ScTableProtection::DELETE_ROWS))
return false;
- return !HasAttrib(0, nStart, pDocument->MaxCol(), nEnd, HasAttrFlags::Protected);
+ return !HasAttrib(0, nStart, rDocument.MaxCol(), nEnd, HasAttrFlags::Protected);
}
default:
;
@@ -457,9 +457,9 @@ void ScTable::finalizeOutlineImport()
void ScTable::StoreToCache(SvStream& rStrm) const
{
SCCOL nStartCol = 0;
- SCCOL nEndCol = pDocument->MaxCol();
+ SCCOL nEndCol = rDocument.MaxCol();
SCROW nStartRow = 0;
- SCROW nEndRow = pDocument->MaxRow();
+ SCROW nEndRow = rDocument.MaxRow();
GetDataArea(nStartCol, nStartRow, nEndCol, nEndRow, false, false);