[Libreoffice-commits] core.git: sc/inc sc/qa sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Fri Dec 13 06:05:42 UTC 2019
sc/inc/columniterator.hxx | 6 ++---
sc/inc/formulacell.hxx | 4 +--
sc/inc/formulaiter.hxx | 3 +-
sc/qa/unit/subsequent_export-test.cxx | 2 -
sc/source/core/data/attarray.cxx | 26 +++++++++++-----------
sc/source/core/data/bcaslot.cxx | 6 ++---
sc/source/core/data/column.cxx | 6 ++---
sc/source/core/data/column2.cxx | 12 +++++-----
sc/source/core/data/column4.cxx | 30 +++++++++++++-------------
sc/source/core/data/columniterator.cxx | 12 +++++-----
sc/source/core/data/columnspanset.cxx | 12 +++++-----
sc/source/core/data/dociter.cxx | 24 ++++++++++----------
sc/source/core/data/documen8.cxx | 4 +--
sc/source/core/data/document.cxx | 10 ++++----
sc/source/core/data/dpcache.cxx | 2 -
sc/source/core/data/drwlayer.cxx | 4 +--
sc/source/core/data/fillinfo.cxx | 4 +--
sc/source/core/data/formulacell.cxx | 14 ++++++------
sc/source/core/data/formulaiter.cxx | 11 +++++----
sc/source/core/data/markarr.cxx | 4 +--
sc/source/core/data/table4.cxx | 2 -
sc/source/core/data/table5.cxx | 2 -
sc/source/core/inc/bcaslot.hxx | 6 ++---
sc/source/core/tool/chgtrack.cxx | 2 -
sc/source/core/tool/detfunc.cxx | 20 ++++++++---------
sc/source/filter/xml/xmlcelli.cxx | 2 -
sc/source/ui/Accessibility/AccessibleCell.cxx | 4 +--
sc/source/ui/app/transobj.cxx | 2 -
sc/source/ui/docshell/impex.cxx | 2 -
sc/source/ui/docshell/tablink.cxx | 2 -
sc/source/ui/unoobj/cellsuno.cxx | 8 +++---
sc/source/ui/view/gridwin.cxx | 2 -
32 files changed, 126 insertions(+), 124 deletions(-)
New commits:
commit afad9ccb381a02b90654a5fa302480e46f38a1fc
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Dec 12 16:49:19 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Dec 13 07:04:49 2019 +0100
sc: rowcol: tdf#50916 pass ScDocument* around in data/
Change-Id: Ifa99d1c8d593e2a5dd81a3aaf4cd702d3ba96b89
Reviewed-on: https://gerrit.libreoffice.org/85060
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/inc/columniterator.hxx b/sc/inc/columniterator.hxx
index 51270f363ea7..a217b6d9dff0 100644
--- a/sc/inc/columniterator.hxx
+++ b/sc/inc/columniterator.hxx
@@ -32,7 +32,7 @@ class ScColumnTextWidthIterator
public:
ScColumnTextWidthIterator(const ScColumnTextWidthIterator&) = delete;
const ScColumnTextWidthIterator& operator=(const ScColumnTextWidthIterator&) = delete;
- ScColumnTextWidthIterator(ScColumn& rCol, SCROW nStartRow, SCROW nEndRow);
+ ScColumnTextWidthIterator(const ScDocument& rDoc, ScColumn& rCol, SCROW nStartRow, SCROW nEndRow);
/**
* @param rDoc document instance.
@@ -42,7 +42,7 @@ public:
* validity.
* @param nEndRow end row position.
*/
- ScColumnTextWidthIterator(ScDocument& rDoc, const ScAddress& rStartPos, SCROW nEndRow);
+ ScColumnTextWidthIterator(const ScDocument& rDoc, const ScAddress& rStartPos, SCROW nEndRow);
void next();
bool hasCell() const;
@@ -51,7 +51,7 @@ public:
void setValue(sal_uInt16 nVal);
private:
- void init(SCROW nStartRow, SCROW nEndRow);
+ void init(const ScDocument& rDoc, SCROW nStartRow, SCROW nEndRow);
void getDataIterators(size_t nOffsetInBlock);
void checkEndRow();
};
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 9a5af01a3851..9f9ab5f23587 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -332,9 +332,9 @@ public:
*/
svl::SharedString GetRawString() const;
const ScMatrix* GetMatrix();
- bool GetMatrixOrigin( ScAddress& rPos ) const;
+ bool GetMatrixOrigin( const ScDocument* pDoc, ScAddress& rPos ) const;
void GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows );
- sc::MatrixEdge GetMatrixEdge( ScAddress& rOrgPos ) const;
+ sc::MatrixEdge GetMatrixEdge( const ScDocument* pDoc, ScAddress& rOrgPos ) const;
FormulaError GetErrCode(); // interpret first if necessary
FormulaError GetRawError() const; // don't interpret, just return code or result error
bool GetErrorOrValue( FormulaError& rErr, double& rVal );
diff --git a/sc/inc/formulaiter.hxx b/sc/inc/formulaiter.hxx
index aa92e78c7b65..660a201836da 100644
--- a/sc/inc/formulaiter.hxx
+++ b/sc/inc/formulaiter.hxx
@@ -32,10 +32,11 @@ class ScFormulaCell;
class ScDetectiveRefIter
{
private:
+ const ScDocument* mpDoc;
formula::FormulaTokenArrayPlainIterator maIter;
ScAddress const aPos;
public:
- ScDetectiveRefIter( ScFormulaCell* pCell );
+ ScDetectiveRefIter( const ScDocument* pDoc, ScFormulaCell* pCell );
bool GetNextRef( ScRange& rRange );
formula::FormulaToken* GetNextRefToken();
};
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 1b85a34ce8c0..a8a0acf765ea 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -2089,7 +2089,7 @@ void checkMatrixRange(ScDocument& rDoc, const ScRange& rRange)
const ScFormulaCell* pCell = rDoc.GetFormulaCell(aPos);
CPPUNIT_ASSERT_MESSAGE("This must be a formula cell.", pCell);
- bIsMatrix = pCell->GetMatrixOrigin(aMatOrigin);
+ bIsMatrix = pCell->GetMatrixOrigin(&rDoc, aMatOrigin);
CPPUNIT_ASSERT_MESSAGE("Not a part of matrix formula.", bIsMatrix);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong matrix origin.", aMatRange.aStart, aMatOrigin);
}
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index e7be9ee52394..1a45201521dc 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -240,7 +240,7 @@ const ScPatternAttr* ScAttrArray::GetPattern( SCROW nRow ) const
{
if ( mvData.empty() )
{
- if ( !ValidRow( nRow ) )
+ if ( !pDocument->ValidRow(nRow) )
return nullptr;
return pDocument->GetDefPattern();
}
@@ -256,7 +256,7 @@ const ScPatternAttr* ScAttrArray::GetPatternRange( SCROW& rStartRow,
{
if ( mvData.empty() )
{
- if ( !ValidRow( nRow ) )
+ if ( !pDocument->ValidRow( nRow ) )
return nullptr;
rStartRow = 0;
rEndRow = pDocument->MaxRow();
@@ -277,7 +277,7 @@ const ScPatternAttr* ScAttrArray::GetPatternRange( SCROW& rStartRow,
void ScAttrArray::AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex )
{
- if(!ValidRow(nStartRow) || !ValidRow(nEndRow))
+ if(!pDocument->ValidRow(nStartRow) || !pDocument->ValidRow(nEndRow))
return;
if(nEndRow < nStartRow)
@@ -337,7 +337,7 @@ void ScAttrArray::AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nInd
void ScAttrArray::RemoveCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex )
{
- if(!ValidRow(nStartRow) || !ValidRow(nEndRow))
+ if(!pDocument->ValidRow(nStartRow) || !pDocument->ValidRow(nEndRow))
return;
if(nEndRow < nStartRow)
@@ -454,7 +454,7 @@ bool ScAttrArray::Reserve( SCSIZE nReserve )
const ScPatternAttr* ScAttrArray::SetPatternAreaImpl(SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern,
bool bPutToPool, ScEditDataArray* pDataArray, bool bPassingOwnership )
{
- if (ValidRow(nStartRow) && ValidRow(nEndRow))
+ if (pDocument->ValidRow(nStartRow) && pDocument->ValidRow(nEndRow))
{
if (bPutToPool)
{
@@ -632,7 +632,7 @@ const ScPatternAttr* ScAttrArray::SetPatternAreaImpl(SCROW nStartRow, SCROW nEnd
void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle )
{
- if (ValidRow(nStartRow) && ValidRow(nEndRow))
+ if (pDocument->ValidRow(nStartRow) && pDocument->ValidRow(nEndRow))
{
SetDefaultIfNotInit();
SCSIZE nPos;
@@ -730,7 +730,7 @@ void ScAttrArray::ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
if ( bColorOnly && !pLine )
return;
- if (ValidRow(nStartRow) && ValidRow(nEndRow))
+ if (pDocument->ValidRow(nStartRow) && pDocument->ValidRow(nEndRow))
{
SCSIZE nPos;
SCROW nStart=0;
@@ -853,7 +853,7 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac
TestData();
#endif
- if (ValidRow(nStartRow) && ValidRow(nEndRow))
+ if (pDocument->ValidRow(nStartRow) && pDocument->ValidRow(nEndRow))
{
SCSIZE nPos;
SCROW nStart=0;
@@ -978,7 +978,7 @@ static void lcl_MergeDeep( SfxItemSet& rMergeSet, const SfxItemSet& rSource )
void ScAttrArray::MergePatternArea( SCROW nStartRow, SCROW nEndRow,
ScMergePatternState& rState, bool bDeep ) const
{
- if (ValidRow(nStartRow) && ValidRow(nEndRow))
+ if (pDocument->ValidRow(nStartRow) && pDocument->ValidRow(nEndRow))
{
SCSIZE nPos = 0;
SCROW nStart=0;
@@ -1778,7 +1778,7 @@ void ScAttrArray::ChangeIndent( SCROW nStartRow, SCROW nEndRow, bool bIncrement
SCROW ScAttrArray::GetNextUnprotected( SCROW nRow, bool bUp ) const
{
long nRet = nRow;
- if (ValidRow(nRow))
+ if (pDocument->ValidRow(nRow))
{
if ( mvData.empty() )
{
@@ -2529,7 +2529,7 @@ SCROW ScAttrArray::SearchStyle(
if (pMarkArray)
{
nRow = pMarkArray->GetNextMarked( nRow, bUp );
- if (!ValidRow(nRow))
+ if (!pDocument->ValidRow(nRow))
return nRow;
}
@@ -2587,7 +2587,7 @@ SCROW ScAttrArray::SearchStyle(
}
}
- OSL_ENSURE( bFound || !ValidRow(nRow), "Internal failure in ScAttrArray::SearchStyle" );
+ OSL_ENSURE( bFound || !pDocument->ValidRow(nRow), "Internal failure in ScAttrArray::SearchStyle" );
return nRow;
}
@@ -2597,7 +2597,7 @@ bool ScAttrArray::SearchStyleRange(
const ScMarkArray* pMarkArray) const
{
SCROW nStartRow = SearchStyle( rRow, pSearchStyle, bUp, pMarkArray );
- if (ValidRow(nStartRow))
+ if (pDocument->ValidRow(nStartRow))
{
if ( mvData.empty() )
{
diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx
index 227a6d751e63..af791ccc55ef 100644
--- a/sc/source/core/data/bcaslot.cxx
+++ b/sc/source/core/data/bcaslot.cxx
@@ -641,11 +641,11 @@ ScBroadcastAreaSlotMachine::~ScBroadcastAreaSlotMachine()
}
inline SCSIZE ScBroadcastAreaSlotMachine::ComputeSlotOffset(
- const ScAddress& rAddress )
+ const ScAddress& rAddress ) const
{
SCROW nRow = rAddress.Row();
SCCOL nCol = rAddress.Col();
- if ( !ValidRow(nRow) || !ValidCol(nCol) )
+ if ( !pDoc->ValidRow(nRow) || !pDoc->ValidCol(nCol) )
{
OSL_FAIL( "Row/Col invalid, using first slot!" );
return 0;
@@ -665,7 +665,7 @@ inline SCSIZE ScBroadcastAreaSlotMachine::ComputeSlotOffset(
}
void ScBroadcastAreaSlotMachine::ComputeAreaPoints( const ScRange& rRange,
- SCSIZE& rStart, SCSIZE& rEnd, SCSIZE& rRowBreak )
+ SCSIZE& rStart, SCSIZE& rEnd, SCSIZE& rRowBreak ) const
{
rStart = ComputeSlotOffset( rRange.aStart );
rEnd = ComputeSlotOffset( rRange.aEnd );
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 63080b5dfb7f..fcc0e00de4bd 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -128,7 +128,7 @@ sc::MatrixEdge ScColumn::GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sc::Matr
if (pCell->GetMatrixFlag() == ScMatrixMode::NONE)
return MatrixEdge::Nothing;
- return pCell->GetMatrixEdge(aOrigin);
+ return pCell->GetMatrixEdge(GetDoc(), aOrigin);
}
bool bOpen = false;
@@ -158,7 +158,7 @@ sc::MatrixEdge ScColumn::GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sc::Matr
if (pCell->GetMatrixFlag() == ScMatrixMode::NONE)
continue;
- nEdges = pCell->GetMatrixEdge(aOrigin);
+ nEdges = pCell->GetMatrixEdge(GetDoc(), aOrigin);
if (nEdges == MatrixEdge::Nothing)
continue;
@@ -233,7 +233,7 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark) const
// cell is not a part of a matrix.
continue;
- MatrixEdge nEdges = pCell->GetMatrixEdge(aOrigin);
+ MatrixEdge nEdges = pCell->GetMatrixEdge(GetDoc(), aOrigin);
if (nEdges == MatrixEdge::Nothing)
continue;
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 545179eb2857..d3db033b63f2 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -988,7 +988,7 @@ bool ScColumn::GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& r
if (bInSel)
{
nRow = rData.GetNextMarked(nCol, nRow, false);
- if (!ValidRow(nRow))
+ if (!pDocument->ValidRow(nRow))
{
nRow = GetDoc()->MaxRow()+1;
bStop = true;
@@ -2010,7 +2010,7 @@ void ScColumn::SetTextWidth(SCROW nRow, sal_uInt16 nWidth)
SvtScriptType ScColumn::GetScriptType( SCROW nRow ) const
{
- if (!ValidRow(nRow) || maCellTextAttrs.is_empty(nRow))
+ if (!GetDoc()->ValidRow(nRow) || maCellTextAttrs.is_empty(nRow))
return SvtScriptType::NONE;
return maCellTextAttrs.get<sc::CellTextAttr>(nRow).mnScriptType;
@@ -2019,7 +2019,7 @@ SvtScriptType ScColumn::GetScriptType( SCROW nRow ) const
SvtScriptType ScColumn::GetRangeScriptType(
sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2, const sc::CellStoreType::iterator& itrCells_ )
{
- if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2)
+ if (!GetDoc()->ValidRow(nRow1) || !GetDoc()->ValidRow(nRow2) || nRow1 > nRow2)
return SvtScriptType::NONE;
SCROW nRow = nRow1;
@@ -2089,7 +2089,7 @@ SvtScriptType ScColumn::GetRangeScriptType(
void ScColumn::SetScriptType( SCROW nRow, SvtScriptType nType )
{
- if (!ValidRow(nRow))
+ if (!GetDoc()->ValidRow(nRow))
return;
sc::CellTextAttrStoreType::position_type aPos = maCellTextAttrs.position(nRow);
@@ -2999,7 +2999,7 @@ void ScColumn::SetNumberFormat( SCROW nRow, sal_uInt32 nNumberFormat )
ScFormulaCell * const * ScColumn::GetFormulaCellBlockAddress( SCROW nRow, size_t& rBlockSize ) const
{
- if (!ValidRow(nRow))
+ if (!GetDoc()->ValidRow(nRow))
{
rBlockSize = 0;
return nullptr;
@@ -3252,7 +3252,7 @@ void ScColumn::EndListening( SvtListener& rLst, SCROW nRow )
void ScColumn::StartListening( sc::StartListeningContext& rCxt, const ScAddress& rAddress, SvtListener& rLst )
{
- if (!ValidRow(rAddress.Row()))
+ if (!GetDoc()->ValidRow(rAddress.Row()))
return;
sc::ColumnBlockPosition* p = rCxt.getBlockPosition(rAddress.Tab(), rAddress.Col());
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 8e0ae07bbef1..b684a87c84d1 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -94,8 +94,9 @@ sc::MultiDataCellState::StateType ScColumn::HasDataCellsInRange(
void ScColumn::DeleteBeforeCopyFromClip(
sc::CopyFromClipContext& rCxt, const ScColumn& rClipCol, sc::ColumnSpanSet& rBroadcastSpans )
{
+ ScDocument* pDocument = GetDoc();
sc::CopyFromClipContext::Range aRange = rCxt.getDestRange();
- if (!ValidRow(aRange.mnRow1) || !ValidRow(aRange.mnRow2))
+ if (!pDocument->ValidRow(aRange.mnRow1) || !pDocument->ValidRow(aRange.mnRow2))
return;
ScRange aClipRange = rCxt.getClipDoc()->GetClipParam().getWholeRange();
@@ -114,7 +115,6 @@ void ScColumn::DeleteBeforeCopyFromClip(
return;
// Translate the clip column spans into the destination column, and repeat as needed.
- ScDocument* pDocument = GetDoc();
std::vector<sc::RowSpan> aDestSpans;
SCROW nDestOffset = aRange.mnRow1 - nClipRow1;
bool bContinue = true;
@@ -309,7 +309,7 @@ void ScColumn::CopyOneCellFromClip( sc::CopyFromClipContext& rCxt, SCROW nRow1,
void ScColumn::SetValues( const SCROW nRow, const std::vector<double>& rVals )
{
- if (!ValidRow(nRow))
+ if (!GetDoc()->ValidRow(nRow))
return;
SCROW nLastRow = nRow + rVals.size() - 1;
@@ -339,7 +339,7 @@ void ScColumn::SetValues( const SCROW nRow, const std::vector<double>& rVals )
void ScColumn::TransferCellValuesTo( SCROW nRow, size_t nLen, sc::CellValues& rDest )
{
- if (!ValidRow(nRow))
+ if (!GetDoc()->ValidRow(nRow))
return;
SCROW nLastRow = nRow + nLen - 1;
@@ -364,7 +364,7 @@ void ScColumn::TransferCellValuesTo( SCROW nRow, size_t nLen, sc::CellValues& rD
void ScColumn::CopyCellValuesFrom( SCROW nRow, const sc::CellValues& rSrc )
{
- if (!ValidRow(nRow))
+ if (!GetDoc()->ValidRow(nRow))
return;
SCROW nLastRow = nRow + rSrc.size() - 1;
@@ -431,7 +431,7 @@ public:
void ScColumn::ConvertFormulaToValue(
sc::EndListeningContext& rCxt, SCROW nRow1, SCROW nRow2, sc::TableValues* pUndo )
{
- if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2)
+ if (!GetDoc()->ValidRow(nRow1) || !GetDoc()->ValidRow(nRow2) || nRow1 > nRow2)
return;
std::vector<SCROW> aBounds;
@@ -614,7 +614,7 @@ void ScColumn::CloneFormulaCell(
std::unique_ptr<ScPostIt> ScColumn::ReleaseNote( SCROW nRow )
{
- if (!ValidRow(nRow))
+ if (!GetDoc()->ValidRow(nRow))
return nullptr;
ScPostIt* p = nullptr;
@@ -672,7 +672,7 @@ void ScColumn::ForgetNoteCaptions( SCROW nRow1, SCROW nRow2, bool bPreserveData
if (maCellNotes.empty())
return;
- if (!ValidRow(nRow1) || !ValidRow(nRow2))
+ if (!GetDoc()->ValidRow(nRow1) || !GetDoc()->ValidRow(nRow2))
return;
NoteCaptionCleaner aFunc(bPreserveData);
@@ -1065,7 +1065,7 @@ public:
void ScColumn::UpdateScriptTypes( SCROW nRow1, SCROW nRow2 )
{
- if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2)
+ if (!GetDoc()->ValidRow(nRow1) || !GetDoc()->ValidRow(nRow2) || nRow1 > nRow2)
return;
ScriptTypeUpdater aFunc(*this);
@@ -1239,7 +1239,7 @@ public:
void ScColumn::CollectListeners( std::vector<SvtListener*>& rListeners, SCROW nRow1, SCROW nRow2 )
{
- if (nRow2 < nRow1 || !ValidRow(nRow1) || !ValidRow(nRow2))
+ if (nRow2 < nRow1 || !GetDoc()->ValidRow(nRow1) || !GetDoc()->ValidRow(nRow2))
return;
ListenerCollector aFunc(rListeners);
@@ -1248,7 +1248,7 @@ void ScColumn::CollectListeners( std::vector<SvtListener*>& rListeners, SCROW nR
void ScColumn::CollectFormulaCells( std::vector<ScFormulaCell*>& rCells, SCROW nRow1, SCROW nRow2 )
{
- if (nRow2 < nRow1 || !ValidRow(nRow1) || !ValidRow(nRow2))
+ if (nRow2 < nRow1 || !GetDoc()->ValidRow(nRow1) || !GetDoc()->ValidRow(nRow2))
return;
FormulaCellCollector aFunc(rCells);
@@ -1277,7 +1277,7 @@ bool ScColumn::HasFormulaCell( SCROW nRow1, SCROW nRow2 ) const
if (!mnBlkCountFormula)
return false;
- if (nRow2 < nRow1 || !ValidRow(nRow1) || !ValidRow(nRow2))
+ if (nRow2 < nRow1 || !GetDoc()->ValidRow(nRow1) || !GetDoc()->ValidRow(nRow2))
return false;
if (nRow1 == 0 && nRow2 == GetDoc()->MaxRow())
@@ -1493,7 +1493,7 @@ void ScColumn::EndListeningFormulaCells(
void ScColumn::EndListeningIntersectedGroup(
sc::EndListeningContext& rCxt, SCROW nRow, std::vector<ScAddress>* pGroupPos )
{
- if (!ValidRow(nRow))
+ if (!GetDoc()->ValidRow(nRow))
return;
sc::CellStoreType::position_type aPos = maCells.position(nRow);
@@ -1631,7 +1631,7 @@ void ScColumn::SetNeedsListeningGroup( SCROW nRow )
std::unique_ptr<sc::ColumnIterator> ScColumn::GetColumnIterator( SCROW nRow1, SCROW nRow2 ) const
{
- if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2)
+ if (!GetDoc()->ValidRow(nRow1) || !GetDoc()->ValidRow(nRow2) || nRow1 > nRow2)
return std::unique_ptr<sc::ColumnIterator>();
return std::make_unique<sc::ColumnIterator>(maCells, nRow1, nRow2);
@@ -1829,7 +1829,7 @@ static void lcl_EvalDirty(sc::CellStoreType& rCells, SCROW nRow1, SCROW nRow2, S
// Returns true if at least one FC is dirty.
bool ScColumn::EnsureFormulaCellResults( SCROW nRow1, SCROW nRow2, bool bSkipRunning )
{
- if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2)
+ if (!GetDoc()->ValidRow(nRow1) || !GetDoc()->ValidRow(nRow2) || nRow1 > nRow2)
return false;
if (!HasFormulaCell(nRow1, nRow2))
diff --git a/sc/source/core/data/columniterator.cxx b/sc/source/core/data/columniterator.cxx
index 7f3048d3661b..a65541fabb53 100644
--- a/sc/source/core/data/columniterator.cxx
+++ b/sc/source/core/data/columniterator.cxx
@@ -14,23 +14,23 @@
#include <osl/diagnose.h>
-ScColumnTextWidthIterator::ScColumnTextWidthIterator(ScColumn& rCol, SCROW nStartRow, SCROW nEndRow) :
+ScColumnTextWidthIterator::ScColumnTextWidthIterator(const ScDocument& rDoc, ScColumn& rCol, SCROW nStartRow, SCROW nEndRow) :
mnEnd(static_cast<size_t>(nEndRow)),
mnCurPos(0)
{
miBlockCur = rCol.maCellTextAttrs.begin();
miBlockEnd = rCol.maCellTextAttrs.end();
- init(nStartRow, nEndRow);
+ init(rDoc, nStartRow, nEndRow);
}
-ScColumnTextWidthIterator::ScColumnTextWidthIterator(ScDocument& rDoc, const ScAddress& rStartPos, SCROW nEndRow) :
+ScColumnTextWidthIterator::ScColumnTextWidthIterator(const ScDocument& rDoc, const ScAddress& rStartPos, SCROW nEndRow) :
mnEnd(static_cast<size_t>(nEndRow)),
mnCurPos(0)
{
auto & rCellTextAttrs = rDoc.maTabs[rStartPos.Tab()]->aCol[rStartPos.Col()].maCellTextAttrs;
miBlockCur = rCellTextAttrs.begin();
miBlockEnd = rCellTextAttrs.end();
- init(rStartPos.Row(), nEndRow);
+ init(rDoc, rStartPos.Row(), nEndRow);
}
void ScColumnTextWidthIterator::next()
@@ -87,9 +87,9 @@ void ScColumnTextWidthIterator::setValue(sal_uInt16 nVal)
miDataCur->mnTextWidth = nVal;
}
-void ScColumnTextWidthIterator::init(SCROW nStartRow, SCROW nEndRow)
+void ScColumnTextWidthIterator::init(const ScDocument& rDoc, SCROW nStartRow, SCROW nEndRow)
{
- if (!ValidRow(nStartRow) || !ValidRow(nEndRow))
+ if (!rDoc.ValidRow(nStartRow) || !rDoc.ValidRow(nEndRow))
miBlockCur = miBlockEnd;
size_t nStart = static_cast<size_t>(nStartRow);
diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx
index fe4408a58494..849783b5bce5 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -82,7 +82,7 @@ ColumnSpanSet::ColumnType& ColumnSpanSet::getColumn(const ScDocument& rDoc, SCTA
void ColumnSpanSet::set(const ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCROW nRow, bool bVal)
{
- if (!ValidTab(nTab) || !ValidCol(nCol) || !ValidRow(nRow))
+ if (!ValidTab(nTab) || !rDoc.ValidCol(nCol) || !rDoc.ValidRow(nRow))
return;
ColumnType& rCol = getColumn(rDoc, nTab, nCol);
@@ -91,7 +91,7 @@ void ColumnSpanSet::set(const ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCROW nR
void ColumnSpanSet::set(const ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCROW nRow1, SCROW nRow2, bool bVal)
{
- if (!ValidTab(nTab) || !ValidCol(nCol) || !ValidRow(nRow1) || !ValidRow(nRow2))
+ if (!ValidTab(nTab) || !rDoc.ValidCol(nCol) || !rDoc.ValidRow(nRow1) || !rDoc.ValidRow(nRow2))
return;
ColumnType& rCol = getColumn(rDoc, nTab, nCol);
@@ -121,7 +121,7 @@ void ColumnSpanSet::set( const ScDocument& rDoc, SCTAB nTab, SCCOL nCol, const S
void ColumnSpanSet::scan(
const ScDocument& rDoc, SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bVal)
{
- if (!ValidColRow(nCol1, nRow1) || !ValidColRow(nCol2, nRow2))
+ if (!rDoc.ValidColRow(nCol1, nRow1) || !rDoc.ValidColRow(nCol2, nRow2))
return;
if (nCol1 > nCol2 || nRow1 > nRow2)
@@ -191,7 +191,7 @@ void ColumnSpanSet::executeColumnAction(ScDocument& rDoc, ColumnAction& ac) cons
if (!pTab)
continue;
- if (!ValidCol(nCol) || nCol >= pTab->GetAllocatedColumnsCount())
+ if (!rDoc.ValidCol(nCol) || nCol >= pTab->GetAllocatedColumnsCount())
{
// End the loop.
nCol = rTab.size();
@@ -345,7 +345,7 @@ void RangeColumnSpanSet::executeColumnAction(ScDocument& rDoc, sc::ColumnSpanSet
SCCOL nEndCol = pTab->ClampToAllocatedColumns(range.aEnd.Col());
for (SCCOL nCol = range.aStart.Col(); nCol <= nEndCol; ++nCol)
{
- if (!ValidCol(nCol))
+ if (!rDoc.ValidCol(nCol))
break;
ScColumn& rColumn = pTab->aCol[nCol];
@@ -366,7 +366,7 @@ void RangeColumnSpanSet::executeColumnAction(ScDocument& rDoc, sc::ColumnSpanSet
SCCOL nEndCol = pTab->ClampToAllocatedColumns(range.aEnd.Col());
for (SCCOL nCol = range.aStart.Col(); nCol <= nEndCol; ++nCol)
{
- if (!ValidCol(nCol))
+ if (!rDoc.ValidCol(nCol))
break;
ScColumn& rColumn = pTab->aCol[nCol];
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 4616f5698b0f..bad6d64ff7c8 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -117,10 +117,10 @@ ScValueIterator::ScValueIterator( ScDocument* pDocument, const ScRange& rRange,
{
SCTAB nDocMaxTab = pDocument->GetTableCount() - 1;
- if (!ValidCol(maStartPos.Col())) maStartPos.SetCol(pDoc->MaxCol());
- if (!ValidCol(maEndPos.Col())) maEndPos.SetCol(pDoc->MaxCol());
- if (!ValidRow(maStartPos.Row())) maStartPos.SetRow(pDoc->MaxRow());
- if (!ValidRow(maEndPos.Row())) maEndPos.SetRow(pDoc->MaxRow());
+ if (!pDocument->ValidCol(maStartPos.Col())) maStartPos.SetCol(pDoc->MaxCol());
+ if (!pDocument->ValidCol(maEndPos.Col())) maEndPos.SetCol(pDoc->MaxCol());
+ if (!pDocument->ValidRow(maStartPos.Row())) maStartPos.SetRow(pDoc->MaxRow());
+ if (!pDocument->ValidRow(maEndPos.Row())) maEndPos.SetRow(pDoc->MaxRow());
if (!ValidTab(maStartPos.Tab()) || maStartPos.Tab() > nDocMaxTab) maStartPos.SetTab(nDocMaxTab);
if (!ValidTab(maEndPos.Tab()) || maEndPos.Tab() > nDocMaxTab) maEndPos.SetTab(nDocMaxTab);
}
@@ -876,10 +876,10 @@ void ScCellIterator::init()
PutInOrder(maStartPos, maEndPos);
- if (!ValidCol(maStartPos.Col())) maStartPos.SetCol(mpDoc->MaxCol());
- if (!ValidCol(maEndPos.Col())) maEndPos.SetCol(mpDoc->MaxCol());
- if (!ValidRow(maStartPos.Row())) maStartPos.SetRow(mpDoc->MaxRow());
- if (!ValidRow(maEndPos.Row())) maEndPos.SetRow(mpDoc->MaxRow());
+ if (!mpDoc->ValidCol(maStartPos.Col())) maStartPos.SetCol(mpDoc->MaxCol());
+ if (!mpDoc->ValidCol(maEndPos.Col())) maEndPos.SetCol(mpDoc->MaxCol());
+ if (!mpDoc->ValidRow(maStartPos.Row())) maStartPos.SetRow(mpDoc->MaxRow());
+ if (!mpDoc->ValidRow(maEndPos.Row())) maEndPos.SetRow(mpDoc->MaxRow());
if (!ValidTab(maStartPos.Tab(), nDocMaxTab)) maStartPos.SetTab(nDocMaxTab);
if (!ValidTab(maEndPos.Tab(), nDocMaxTab)) maEndPos.SetTab(nDocMaxTab);
@@ -2294,10 +2294,10 @@ ScHorizontalValueIterator::ScHorizontalValueIterator( ScDocument* pDocument,
PutInOrder( nStartRow, nEndRow);
PutInOrder( nStartTab, nEndTab );
- if (!ValidCol(nStartCol)) nStartCol = pDoc->MaxCol();
- if (!ValidCol(nEndCol)) nEndCol = pDoc->MaxCol();
- if (!ValidRow(nStartRow)) nStartRow = pDoc->MaxRow();
- if (!ValidRow(nEndRow)) nEndRow = pDoc->MaxRow();
+ if (!pDoc->ValidCol(nStartCol)) nStartCol = pDoc->MaxCol();
+ if (!pDoc->ValidCol(nEndCol)) nEndCol = pDoc->MaxCol();
+ if (!pDoc->ValidRow(nStartRow)) nStartRow = pDoc->MaxRow();
+ if (!pDoc->ValidRow(nEndRow)) nEndRow = pDoc->MaxRow();
if (!ValidTab(nStartTab)) nStartTab = MAXTAB;
if (!ValidTab(nEndTab)) nEndTab = MAXTAB;
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index 44525f009b42..2310dc82716e 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -580,7 +580,7 @@ bool ScDocument::IdleCalcTextWidth() // true = try next again
aScope.setCol(pTab->ClampToAllocatedColumns(aScope.Col()));
// Start at specified cell position (nCol, nRow, nTab).
ScColumn* pCol = &pTab->aCol[aScope.Col()];
- std::unique_ptr<ScColumnTextWidthIterator> pColIter(new ScColumnTextWidthIterator(*pCol, aScope.Row(), MaxRow()));
+ std::unique_ptr<ScColumnTextWidthIterator> pColIter(new ScColumnTextWidthIterator(*this, *pCol, aScope.Row(), MaxRow()));
OutputDevice* pDev = nullptr;
sal_uInt16 nRestart = 0;
@@ -677,7 +677,7 @@ bool ScDocument::IdleCalcTextWidth() // true = try next again
if ( nZoom > 0 )
{
pCol = &pTab->aCol[aScope.Col()];
- pColIter.reset(new ScColumnTextWidthIterator(*pCol, aScope.Row(), MaxRow()));
+ pColIter.reset(new ScColumnTextWidthIterator(*this, *pCol, aScope.Row(), MaxRow()));
}
else
{
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index fa1913a0c11c..3f87a7f24a98 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5431,7 +5431,7 @@ bool ScDocument::GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMat
return false;
ScAddress aOrigin = rCellPos;
- if (!pFCell->GetMatrixOrigin(aOrigin))
+ if (!pFCell->GetMatrixOrigin(this, aOrigin))
// Failed to get the address of the matrix origin.
return false;
@@ -5453,7 +5453,7 @@ bool ScDocument::GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMat
// from old file format).
// Needs an "invalid" initialized address.
aOrigin.SetInvalid();
- pFCell->GetMatrixEdge(aOrigin);
+ pFCell->GetMatrixEdge(this, aOrigin);
pFCell->GetMatColsRows(nSizeX, nSizeY);
}
@@ -6403,9 +6403,9 @@ void ScDocument::RemoveSubTotalCell(ScFormulaCell* pCell)
namespace {
-bool lcl_hasDirtyRange(ScFormulaCell* pCell, const ScRange& rDirtyRange)
+bool lcl_hasDirtyRange(const ScDocument* pDoc, ScFormulaCell* pCell, const ScRange& rDirtyRange)
{
- ScDetectiveRefIter aRefIter(pCell);
+ ScDetectiveRefIter aRefIter(pDoc, pCell);
ScRange aRange;
while (aRefIter.GetNextRef(aRange))
{
@@ -6429,7 +6429,7 @@ void ScDocument::SetSubTotalCellsDirty(const ScRange& rDirtyRange)
if (pCell->IsSubTotal())
{
aNewSet.insert(pCell);
- if (lcl_hasDirtyRange(pCell, rDirtyRange))
+ if (lcl_hasDirtyRange(this, pCell, rDirtyRange))
pCell->SetDirty();
}
}
diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx
index 5746e3e1a2e4..95f932339443 100644
--- a/sc/source/core/data/dpcache.cxx
+++ b/sc/source/core/data/dpcache.cxx
@@ -523,7 +523,7 @@ void ScDPCache::InitFromDoc(ScDocument* pDoc, const ScRange& rRange)
aDocData.mnEndRow = rRange.aEnd.Row();
// Sanity check
- if (!ValidRow(aDocData.mnStartRow) || !ValidRow(aDocData.mnEndRow) || aDocData.mnEndRow <= aDocData.mnStartRow)
+ if (!GetDoc()->ValidRow(aDocData.mnStartRow) || !GetDoc()->ValidRow(aDocData.mnEndRow) || aDocData.mnEndRow <= aDocData.mnStartRow)
return;
SCCOL nStartCol = rRange.aStart.Col();
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 515118d84c23..7006bbd48e8e 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1847,8 +1847,8 @@ void ScDrawLayer::MirrorRectRTL( tools::Rectangle& rRect )
tools::Rectangle ScDrawLayer::GetCellRect( const ScDocument& rDoc, const ScAddress& rPos, bool bMergedCell )
{
tools::Rectangle aCellRect;
- OSL_ENSURE( ValidColRowTab( rPos.Col(), rPos.Row(), rPos.Tab() ), "ScDrawLayer::GetCellRect - invalid cell address" );
- if( ValidColRowTab( rPos.Col(), rPos.Row(), rPos.Tab() ) )
+ OSL_ENSURE( rDoc.ValidColRowTab( rPos.Col(), rPos.Row(), rPos.Tab() ), "ScDrawLayer::GetCellRect - invalid cell address" );
+ if( rDoc.ValidColRowTab( rPos.Col(), rPos.Row(), rPos.Tab() ) )
{
// find top left position of passed cell address
Point aTopLeft;
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 610c4fb6a53b..cf649db4b5eb 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -202,7 +202,7 @@ void initRowInfo(const ScDocument* pDoc, RowInfo* pRowInfo, const SCSIZE nMaxRow
if (nY > nDocHeightEndRow)
{
- if (ValidRow(nY))
+ if (pDoc->ValidRow(nY))
nDocHeight = pDoc->GetRowHeight( nY, nTab, nullptr, &nDocHeightEndRow );
else
nDocHeight = ScGlobal::nStdRowHeight;
@@ -261,7 +261,7 @@ void initColWidths(RowInfo* pRowInfo, const ScDocument* pDoc, double fColScale,
for (SCCOL nArrCol=nCol2+3; nArrCol<=nRotMax+2; nArrCol++) // Add remaining widths
{
SCCOL nX = nArrCol-1;
- if ( ValidCol(nX) )
+ if ( pDoc->ValidCol(nX) )
{
if (!pDoc->ColHidden(nX, nTab))
{
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index adeb53d311ed..693eeb6c678b 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2800,7 +2800,7 @@ const ScMatrix* ScFormulaCell::GetMatrix()
return aResult.GetMatrix().get();
}
-bool ScFormulaCell::GetMatrixOrigin( ScAddress& rPos ) const
+bool ScFormulaCell::GetMatrixOrigin( const ScDocument* pDoc, ScAddress& rPos ) const
{
switch ( cMatrixFlag )
{
@@ -2815,7 +2815,7 @@ bool ScFormulaCell::GetMatrixOrigin( ScAddress& rPos ) const
{
ScSingleRefData& rRef = *t->GetSingleRef();
ScAddress aAbs = rRef.toAbs(aPos);
- if (ValidAddress(aAbs))
+ if (pDoc->ValidAddress(aAbs))
{
rPos = aAbs;
return true;
@@ -2828,7 +2828,7 @@ bool ScFormulaCell::GetMatrixOrigin( ScAddress& rPos ) const
return false;
}
-sc::MatrixEdge ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const
+sc::MatrixEdge ScFormulaCell::GetMatrixEdge( const ScDocument* pDoc, ScAddress& rOrgPos ) const
{
switch ( cMatrixFlag )
{
@@ -2838,7 +2838,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const
static thread_local SCCOL nC;
static thread_local SCROW nR;
ScAddress aOrg;
- if ( !GetMatrixOrigin( aOrg ) )
+ if ( !GetMatrixOrigin( pDoc, aOrg ) )
return sc::MatrixEdge::Nothing;
if ( aOrg != rOrgPos )
{ // First time or a different matrix than last time.
@@ -2866,7 +2866,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const
{
pCell = pDocument->GetFormulaCell(aAdr);
if (pCell && pCell->cMatrixFlag == ScMatrixMode::Reference &&
- pCell->GetMatrixOrigin(aTmpOrg) && aTmpOrg == aOrg)
+ pCell->GetMatrixOrigin(pDocument, aTmpOrg) && aTmpOrg == aOrg)
{
nC++;
aAdr.IncCol();
@@ -2881,7 +2881,7 @@ sc::MatrixEdge ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) const
{
pCell = pDocument->GetFormulaCell(aAdr);
if (pCell && pCell->cMatrixFlag == ScMatrixMode::Reference &&
- pCell->GetMatrixOrigin(aTmpOrg) && aTmpOrg == aOrg)
+ pCell->GetMatrixOrigin(pDocument, aTmpOrg) && aTmpOrg == aOrg)
{
nR++;
aAdr.IncRow();
@@ -3182,7 +3182,7 @@ bool checkCompileColRowName(
{
const ScSingleRefData& rRef = *t->GetSingleRef();
ScAddress aAbs = rRef.toAbs(aPos);
- if (ValidAddress(aAbs))
+ if (rDoc.ValidAddress(aAbs))
{
if (rCxt.maRange.In(aAbs))
return true;
diff --git a/sc/source/core/data/formulaiter.cxx b/sc/source/core/data/formulaiter.cxx
index bd37a4bc2163..4f71466888fa 100644
--- a/sc/source/core/data/formulaiter.cxx
+++ b/sc/source/core/data/formulaiter.cxx
@@ -26,23 +26,24 @@
using namespace formula;
-ScDetectiveRefIter::ScDetectiveRefIter( ScFormulaCell* pCell ) :
+ScDetectiveRefIter::ScDetectiveRefIter( const ScDocument* pDoc, ScFormulaCell* pCell ) :
+ mpDoc(pDoc),
maIter(*pCell->GetCode()),
aPos(pCell->aPos)
{
}
-static bool lcl_ScDetectiveRefIter_SkipRef( formula::FormulaToken* p, const ScAddress& rPos )
+static bool lcl_ScDetectiveRefIter_SkipRef( const ScDocument* pDoc, formula::FormulaToken* p, const ScAddress& rPos )
{
ScSingleRefData& rRef1 = *p->GetSingleRef();
ScAddress aAbs1 = rRef1.toAbs(rPos);
- if (!ValidAddress(aAbs1))
+ if (!pDoc->ValidAddress(aAbs1))
return true;
if ( p->GetType() == svDoubleRef || p->GetType() == svExternalDoubleRef )
{
ScSingleRefData& rRef2 = p->GetDoubleRef()->Ref2;
ScAddress aAbs2 = rRef2.toAbs(rPos);
- if (!ValidAddress(aAbs2))
+ if (!pDoc->ValidAddress(aAbs2))
return true;
}
return false;
@@ -66,7 +67,7 @@ bool ScDetectiveRefIter::GetNextRef( ScRange& rRange )
formula::FormulaToken* ScDetectiveRefIter::GetNextRefToken()
{
formula::FormulaToken* p = maIter.GetNextReferenceRPN();
- while (p && lcl_ScDetectiveRefIter_SkipRef(p, aPos))
+ while (p && lcl_ScDetectiveRefIter_SkipRef(mpDoc, p, aPos))
{
p = maIter.GetNextReferenceRPN();
}
diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx
index 83aca1a37d2f..242eabf881db 100644
--- a/sc/source/core/data/markarr.cxx
+++ b/sc/source/core/data/markarr.cxx
@@ -110,7 +110,7 @@ bool ScMarkArray::GetMark( SCROW nRow ) const
void ScMarkArray::SetMarkArea( SCROW nStartRow, SCROW nEndRow, bool bMarked )
{
- if (ValidRow(nStartRow) && ValidRow(nEndRow))
+ if (ValidRow(nStartRow, mnMaxRow) && ValidRow(nEndRow, mnMaxRow))
{
if ((nStartRow == 0) && (nEndRow == mnMaxRow))
{
@@ -357,7 +357,7 @@ SCROW ScMarkArray::GetNextMarked( SCROW nRow, bool bUp ) const
const_cast<ScMarkArray*>(this)->Reset(); // create pData for further processing
SCROW nRet = nRow;
- if (ValidRow(nRow))
+ if (ValidRow(nRow, mnMaxRow))
{
SCSIZE nIndex;
Search(nRow, nIndex);
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 28b085fff466..c79e81af397c 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -476,7 +476,7 @@ void ScTable::FillFormula(
if ( bLast && pDestCell->GetMatrixFlag() != ScMatrixMode::NONE )
{
ScAddress aOrg;
- if ( pDestCell->GetMatrixOrigin( aOrg ) )
+ if ( pDestCell->GetMatrixOrigin( &GetDoc(), aOrg ) )
{
if ( nDestCol >= aOrg.Col() && nDestRow >= aOrg.Row() )
{
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 9975d96212c5..6c2645077d70 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -1204,7 +1204,7 @@ void ScTable::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* p
for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol)
{
- ScColumnTextWidthIterator aIter(aCol[nCol], nRow1, nRow2);
+ ScColumnTextWidthIterator aIter(GetDoc(), aCol[nCol], nRow1, nRow2);
sc::ColumnBlockPosition blockPos; // cache mdds position
InitColumnBlockPosition( blockPos, nCol );
diff --git a/sc/source/core/inc/bcaslot.hxx b/sc/source/core/inc/bcaslot.hxx
index 11c0942df9a2..36374d9b6dba 100644
--- a/sc/source/core/inc/bcaslot.hxx
+++ b/sc/source/core/inc/bcaslot.hxx
@@ -296,10 +296,10 @@ private:
ScBroadcastArea *pEOUpdateChain;
sal_uInt32 nInBulkBroadcast;
- static inline SCSIZE ComputeSlotOffset( const ScAddress& rAddress );
- static void ComputeAreaPoints( const ScRange& rRange,
+ inline SCSIZE ComputeSlotOffset( const ScAddress& rAddress ) const;
+ void ComputeAreaPoints( const ScRange& rRange,
SCSIZE& nStart, SCSIZE& nEnd,
- SCSIZE& nRowBreak );
+ SCSIZE& nRowBreak ) const;
public:
ScBroadcastAreaSlotMachine( ScDocument* pDoc );
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index ba8c11ffa5ba..0b9f18ec3779 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -2909,7 +2909,7 @@ void ScChangeTrack::Dependencies( ScChangeAction* pAct )
if ( ScChangeActionContent::GetContentCellType(rCell) == SC_CACCT_MATREF )
{
ScAddress aOrg;
- bool bOrgFound = rCell.mpFormula->GetMatrixOrigin(aOrg);
+ bool bOrgFound = rCell.mpFormula->GetMatrixOrigin(pDoc, aOrg);
ScChangeActionContent* pContent = (bOrgFound ? SearchContentAt( aOrg, pAct ) : nullptr);
if ( pContent && pContent->IsMatrixOrigin() )
{
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 8cf2f8a5fd33..045998d7cdf8 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -310,9 +310,9 @@ bool ScDetectiveFunc::HasError( const ScRange& rRange, ScAddress& rErrPos )
Point ScDetectiveFunc::GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) const
{
- OSL_ENSURE( ValidColRow( nCol, nRow ), "ScDetectiveFunc::GetDrawPos - invalid cell address" );
- nCol = SanitizeCol( nCol );
- nRow = SanitizeRow( nRow );
+ OSL_ENSURE( pDoc->ValidColRow( nCol, nRow ), "ScDetectiveFunc::GetDrawPos - invalid cell address" );
+ nCol = pDoc->SanitizeCol( nCol );
+ nRow = pDoc->SanitizeRow( nRow );
Point aPos;
@@ -831,7 +831,7 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetective
sal_uInt16 nResult = DET_INS_EMPTY;
- ScDetectiveRefIter aIter(pFCell);
+ ScDetectiveRefIter aIter(pDoc, pFCell);
ScRange aRef;
while ( aIter.GetNextRef( aRef ) )
{
@@ -925,7 +925,7 @@ sal_uInt16 ScDetectiveFunc::FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nL
DeleteArrowsAt( nCol, nRow, true ); // arrows, that are pointing here
}
- ScDetectiveRefIter aIter(pFCell);
+ ScDetectiveRefIter aIter(pDoc, pFCell);
ScRange aRef;
while ( aIter.GetNextRef( aRef) )
{
@@ -976,7 +976,7 @@ sal_uInt16 ScDetectiveFunc::InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiv
sal_uInt16 nResult = DET_INS_EMPTY;
- ScDetectiveRefIter aIter(pFCell);
+ ScDetectiveRefIter aIter(pDoc, pFCell);
ScRange aRef;
ScAddress aErrorPos;
bool bHasError = false;
@@ -1026,7 +1026,7 @@ sal_uInt16 ScDetectiveFunc::InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCo
pFCell->Interpret(); // can't be called after SetRunning
pFCell->SetRunning(true);
- ScDetectiveRefIter aIter(pFCell);
+ ScDetectiveRefIter aIter(pDoc, pFCell);
ScRange aRef;
while ( aIter.GetNextRef( aRef) )
{
@@ -1114,7 +1114,7 @@ sal_uInt16 ScDetectiveFunc::FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2
pFCell->Interpret(); // can't be called after SetRunning
pFCell->SetRunning(true);
- ScDetectiveRefIter aIter(pFCell);
+ ScDetectiveRefIter aIter(pDoc, pFCell);
ScRange aRef;
while ( aIter.GetNextRef( aRef) )
{
@@ -1372,7 +1372,7 @@ void ScDetectiveFunc::GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n
continue;
ScFormulaCell* pFCell = aIter.getFormulaCell();
- ScDetectiveRefIter aRefIter(pFCell);
+ ScDetectiveRefIter aRefIter(pDoc, pFCell);
for (formula::FormulaToken* p = aRefIter.GetNextRefToken(); p; p = aRefIter.GetNextRefToken())
{
ScTokenRef pRef(p->Clone());
@@ -1395,7 +1395,7 @@ void ScDetectiveFunc::GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n
continue;
ScFormulaCell* pFCell = aIter.getFormulaCell();
- ScDetectiveRefIter aRefIter(pFCell);
+ ScDetectiveRefIter aRefIter(pDoc, pFCell);
for (formula::FormulaToken* p = aRefIter.GetNextRefToken(); p; p = aRefIter.GetNextRefToken())
{
const ScAddress& aPos = aIter.GetPos();
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 853578ea9ac5..a14c667abaa0 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -1070,7 +1070,7 @@ void ScXMLTableRowCellContext::PutTextCell( const ScAddress& rCurrentPos,
else
{
ScAddress aTopLeftMatrixCell;
- if (pFCell && pFCell->GetMatrixOrigin(aTopLeftMatrixCell))
+ if (pFCell && pFCell->GetMatrixOrigin(pDoc, aTopLeftMatrixCell))
{
ScFormulaCell* pMatrixCell = pDoc->GetFormulaCell(aTopLeftMatrixCell);
if (pMatrixCell)
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 008a3ea6d04a..ff0b52423d79 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -393,7 +393,7 @@ void ScAccessibleCell::FillDependents(utl::AccessibleRelationSetHelper* pRelatio
if (aCellIter.getType() == CELLTYPE_FORMULA)
{
bool bFound = false;
- ScDetectiveRefIter aIter(aCellIter.getFormulaCell());
+ ScDetectiveRefIter aIter(mpDoc, aCellIter.getFormulaCell());
ScRange aRef;
while ( !bFound && aIter.GetNextRef( aRef ) )
{
@@ -415,7 +415,7 @@ void ScAccessibleCell::FillPrecedents(utl::AccessibleRelationSetHelper* pRelatio
if (aCell.meType == CELLTYPE_FORMULA)
{
ScFormulaCell* pCell = aCell.mpFormula;
- ScDetectiveRefIter aIter(pCell);
+ ScDetectiveRefIter aIter(mpDoc, pCell);
ScRange aRef;
while ( aIter.GetNextRef( aRef ) )
{
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index dd11e67c0f42..f94f66a1f53e 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -864,7 +864,7 @@ void ScTransferObj::StripRefs( ScDocument* pDoc,
ScFormulaCell* pFCell = aIter.getFormulaCell();
bool bOut = false;
- ScDetectiveRefIter aRefIter( pFCell );
+ ScDetectiveRefIter aRefIter( pDoc, pFCell );
while ( !bOut && aRefIter.GetNextRef( aRef ) )
{
if ( aRef.aStart.Tab() != nSrcTab || aRef.aEnd.Tab() != nSrcTab ||
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 5b115f5bd276..bfa4447b3d73 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -2192,7 +2192,7 @@ bool ScImportExport::Doc2Sylk( SvStream& rStrm )
case ScMatrixMode::Reference :
{ // diff expression with 'I' M$-extension
ScAddress aPos;
- (void)pFCell->GetMatrixOrigin( aPos );
+ (void)pFCell->GetMatrixOrigin( pDoc, aPos );
aPrefix = ";I;R"
+ OUString::number( aPos.Row() - nStartRow + 1 )
+ ";C"
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 9956c7114a60..6d43206f4c0a 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -301,7 +301,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
continue;
ScFormulaCell* pCell = aIter.getFormulaCell();
- ScDetectiveRefIter aRefIter(pCell);
+ ScDetectiveRefIter aRefIter(&rDoc, pCell);
ScRange aRefRange;
while ( aRefIter.GetNextRef( aRefRange ) )
{
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 660ffffc657d..8920c1503765 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -3702,7 +3702,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryPreceden
if (aIter.getType() != CELLTYPE_FORMULA)
continue;
- ScDetectiveRefIter aRefIter(aIter.getFormulaCell());
+ ScDetectiveRefIter aRefIter(&rDoc, aIter.getFormulaCell());
ScRange aRefRange;
while ( aRefIter.GetNextRef( aRefRange) )
{
@@ -3751,7 +3751,7 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependen
continue;
bool bMark = false;
- ScDetectiveRefIter aIter(aCellIter.getFormulaCell());
+ ScDetectiveRefIter aIter(&rDoc, aCellIter.getFormulaCell());
ScRange aRefRange;
while ( aIter.GetNextRef( aRefRange) && !bMark )
{
@@ -4857,7 +4857,7 @@ OUString SAL_CALL ScCellRangeObj::getArrayFormula()
const ScFormulaCell* pFCell2 = aCell2.mpFormula;
ScAddress aStart1;
ScAddress aStart2;
- if (pFCell1->GetMatrixOrigin(aStart1) && pFCell2->GetMatrixOrigin(aStart2))
+ if (pFCell1->GetMatrixOrigin(&rDoc, aStart1) && pFCell2->GetMatrixOrigin(&rDoc, aStart2))
{
if (aStart1 == aStart2) // both the same matrix
pFCell1->GetFormula(aFormula); // it doesn't matter from which cell
@@ -4921,7 +4921,7 @@ uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens()
const ScFormulaCell* pFCell2 = aCell2.mpFormula;
ScAddress aStart1;
ScAddress aStart2;
- if (pFCell1->GetMatrixOrigin(aStart1) && pFCell2->GetMatrixOrigin(aStart2))
+ if (pFCell1->GetMatrixOrigin(&rDoc, aStart1) && pFCell2->GetMatrixOrigin(&rDoc, aStart2))
{
if (aStart1 == aStart2)
{
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 894f3d3f8e94..e3a7a8f69de0 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -345,7 +345,7 @@ static bool lcl_IsEditableMatrix( ScDocument* pDoc, const ScRange& rRange )
ScRefCellValue aCell(*pDoc, rRange.aEnd);
ScAddress aPos;
- return (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->GetMatrixOrigin(aPos) && aPos == rRange.aStart);
+ return (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->GetMatrixOrigin(pDoc, aPos) && aPos == rRange.aStart);
}
static void lcl_UnLockComment( ScDrawView* pView, const Point& rPos, const ScViewData* pViewData )
More information about the Libreoffice-commits
mailing list