sc/inc/conditio.hxx | 2 sc/inc/dociter.hxx | 22 sc/inc/externalrefmgr.hxx | 4 sc/qa/unit/ucalc.cxx | 24 sc/source/core/data/conditio.cxx | 4 sc/source/core/data/dociter.cxx | 100 +-- sc/source/core/data/document.cxx | 2 sc/source/core/data/table2.cxx | 6 sc/source/core/tool/dbdata.cxx | 2 sc/source/core/tool/interpr1.cxx | 2 sc/source/filter/excel/xetable.cxx | 2 sc/source/filter/xml/XMLExportIterator.cxx | 2 sc/source/ui/app/transobj.cxx | 27 sc/source/ui/docshell/docfunc.cxx | 4 sc/source/ui/docshell/docsh.cxx | 2 sc/source/ui/docshell/docsh4.cxx | 4 sc/source/ui/docshell/docsh8.cxx | 2 sc/source/ui/docshell/externalrefmgr.cxx | 10 sc/source/ui/inc/dataproviderdlg.hxx | 2 sc/source/ui/inc/gridwin.hxx | 8 sc/source/ui/inc/printfun.hxx | 2 sc/source/ui/inc/transobj.hxx | 2 sc/source/ui/miscdlgs/dataproviderdlg.cxx | 12 sc/source/ui/uitest/uiobject.cxx | 54 - sc/source/ui/undo/undoblk.cxx | 2 sc/source/ui/unoobj/cellsuno.cxx | 8 sc/source/ui/unoobj/docuno.cxx | 2 sc/source/ui/view/cellsh2.cxx | 2 sc/source/ui/view/gridwin.cxx | 886 ++++++++++++++--------------- sc/source/ui/view/gridwin2.cxx | 118 +-- sc/source/ui/view/gridwin3.cxx | 78 +- sc/source/ui/view/gridwin4.cxx | 284 ++++----- sc/source/ui/view/gridwin5.cxx | 34 - sc/source/ui/view/gridwin_dbgutil.cxx | 24 sc/source/ui/view/printfun.cxx | 42 - sc/source/ui/view/tabview.cxx | 6 sc/source/ui/view/tabview5.cxx | 2 sc/source/ui/view/tabvwshe.cxx | 2 38 files changed, 893 insertions(+), 898 deletions(-)
New commits: commit bb124949140ce37f081340168f64a69b8bc5668b Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Sep 24 16:19:51 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Fri Sep 25 20:47:45 2020 +0200 change pointers to references where never possible to be nullptrs and drop some null checks then shown not to be needed Change-Id: I2806eeb64f43072a34aecd46424dbd063a119b7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103356 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 6a6339336907..b3caae236efb 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -635,7 +635,7 @@ private: public: ScConditionalFormatList() {} ScConditionalFormatList(const ScConditionalFormatList& rList); - ScConditionalFormatList(ScDocument* pDoc, const ScConditionalFormatList& rList); + ScConditionalFormatList(ScDocument& rDoc, const ScConditionalFormatList& rList); void InsertNew( std::unique_ptr<ScConditionalFormat> pNew ); diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx index 23e35e06514a..0bc9c4edf7fa 100644 --- a/sc/inc/dociter.hxx +++ b/sc/inc/dociter.hxx @@ -188,7 +188,7 @@ public: class ScFormulaGroupIterator { private: - ScDocument* mpDoc; + ScDocument& mrDoc; SCTAB mnTab; SCCOL mnCol; bool mbNullCol; @@ -196,7 +196,7 @@ private: std::vector<sc::FormulaGroupEntry> maEntries; public: - ScFormulaGroupIterator( ScDocument* pDoc ); + ScFormulaGroupIterator( ScDocument& rDoc ); sc::FormulaGroupEntry* first(); sc::FormulaGroupEntry* next(); @@ -374,7 +374,7 @@ class ScCountIfCellIterator typedef sc::CellStoreType::const_position_type PositionType; PositionType maCurPos; ScQueryParam maParam; - ScDocument* pDoc; + ScDocument& rDoc; const ScInterpreterContext& mrContext; SCTAB nTab; SCCOL nCol; @@ -387,7 +387,7 @@ class ScCountIfCellIterator void AdvanceQueryParamEntryField(); public: - ScCountIfCellIterator(ScDocument* pDocument, const ScInterpreterContext& rContext, SCTAB nTable, + ScCountIfCellIterator(ScDocument& rDocument, const ScInterpreterContext& rContext, SCTAB nTable, const ScQueryParam& aParam); int GetCount(); }; @@ -416,7 +416,7 @@ class ScAttrRectIterator // all attribute areas, including areas stre // across more than one column { private: - ScDocument* pDoc; + ScDocument& rDoc; SCTAB nTab; SCCOL nEndCol; SCROW nStartRow; @@ -427,7 +427,7 @@ private: pColIter; public: - ScAttrRectIterator(ScDocument* pDocument, SCTAB nTable, + ScAttrRectIterator(ScDocument& rDocument, SCTAB nTable, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); ~ScAttrRectIterator(); @@ -447,7 +447,7 @@ class ScHorizontalCellIterator // walk through all non empty cells in an ar std::vector<ColParam>::iterator maColPos; std::vector<ColParam> maColPositions; - ScDocument* pDoc; + ScDocument& rDoc; SCTAB mnTab; SCCOL nStartCol; SCCOL nEndCol; @@ -459,7 +459,7 @@ class ScHorizontalCellIterator // walk through all non empty cells in an ar bool mbMore; public: - ScHorizontalCellIterator(ScDocument* pDocument, SCTAB nTable, + ScHorizontalCellIterator(ScDocument& rDocument, SCTAB nTable, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); ~ScHorizontalCellIterator(); @@ -505,7 +505,7 @@ public: class ScHorizontalAttrIterator { private: - ScDocument* pDoc; + ScDocument& rDoc; SCTAB nTab; SCCOL nStartCol; SCROW nStartRow; @@ -526,7 +526,7 @@ private: bool InitForNextAttr(); public: - ScHorizontalAttrIterator( ScDocument* pDocument, SCTAB nTable, + ScHorizontalAttrIterator( ScDocument& rDocument, SCTAB nTable, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); ~ScHorizontalAttrIterator(); @@ -560,7 +560,7 @@ private: ScRefCellValue maFoundCell; public: - ScUsedAreaIterator( ScDocument* pDocument, SCTAB nTable, + ScUsedAreaIterator( ScDocument& rDocument, SCTAB nTable, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); ~ScUsedAreaIterator(); diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx index 8eee7a1588c8..645b19558dc1 100644 --- a/sc/inc/externalrefmgr.hxx +++ b/sc/inc/externalrefmgr.hxx @@ -56,7 +56,7 @@ class ColumnSpanSet; class ScExternalRefLink final : public ::sfx2::SvBaseLink { public: - ScExternalRefLink(ScDocument* pDoc, sal_uInt16 nFileId); + ScExternalRefLink(ScDocument& rDoc, sal_uInt16 nFileId); virtual ~ScExternalRefLink() override; virtual void Closed() override; @@ -71,7 +71,7 @@ private: ScExternalRefLink(const ScExternalRefLink&) = delete; sal_uInt16 mnFileId; - ScDocument* mpDoc; + ScDocument& mrDoc; bool mbDoRefresh; }; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index be42ed93ff42..cb1df8957604 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -888,11 +888,11 @@ struct HoriIterCheck }; template<size_t Size> -bool checkHorizontalIterator(ScDocument* pDoc, const char* pData[][Size], size_t nDataCount, const HoriIterCheck* pChecks, size_t nCheckCount) +bool checkHorizontalIterator(ScDocument& rDoc, const char* pData[][Size], size_t nDataCount, const HoriIterCheck* pChecks, size_t nCheckCount) { ScAddress aPos(0,0,0); - Test::insertRangeData(pDoc, aPos, pData, nDataCount); - ScHorizontalCellIterator aIter(pDoc, 0, 0, 0, 1, nDataCount-1); + Test::insertRangeData(&rDoc, aPos, pData, nDataCount); + ScHorizontalCellIterator aIter(rDoc, 0, 0, 0, 1, nDataCount-1); SCCOL nCol; SCROW nRow; @@ -918,10 +918,10 @@ bool checkHorizontalIterator(ScDocument* pDoc, const char* pData[][Size], size_t return false; } - if (OUString::createFromAscii(pChecks[i].pVal) != pCell->getString(pDoc)) + if (OUString::createFromAscii(pChecks[i].pVal) != pCell->getString(&rDoc)) { cerr << "String mismatch " << pChecks[i].pVal << " vs. " << - pCell->getString(pDoc) << endl; + pCell->getString(&rDoc) << endl; return false; } } @@ -956,7 +956,7 @@ void Test::testHorizontalIterator() }; bool bRes = checkHorizontalIterator( - m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); + *m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); if (!bRes) CPPUNIT_FAIL("Failed on test mixed."); @@ -979,7 +979,7 @@ void Test::testHorizontalIterator() }; bool bRes = checkHorizontalIterator( - m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); + *m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); if (!bRes) CPPUNIT_FAIL("Failed on test hole."); @@ -1012,7 +1012,7 @@ void Test::testHorizontalIterator() }; bool bRes = checkHorizontalIterator( - m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); + *m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); if (!bRes) CPPUNIT_FAIL("Failed on test holy."); @@ -1027,7 +1027,7 @@ void Test::testHorizontalIterator() }; bool bRes = checkHorizontalIterator( - m_pDoc, aData, SAL_N_ELEMENTS(aData), nullptr, 0); + *m_pDoc, aData, SAL_N_ELEMENTS(aData), nullptr, 0); if (!bRes) CPPUNIT_FAIL("Failed on test degenerate."); @@ -1046,7 +1046,7 @@ void Test::testHorizontalIterator() }; bool bRes = checkHorizontalIterator( - m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); + *m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); if (!bRes) CPPUNIT_FAIL("Failed on test at end."); @@ -1068,7 +1068,7 @@ void Test::testHorizontalIterator() }; bool bRes = checkHorizontalIterator( - m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); + *m_pDoc, aData, SAL_N_ELEMENTS(aData), aChecks, SAL_N_ELEMENTS(aChecks)); if (!bRes) CPPUNIT_FAIL("Failed on test in middle."); @@ -1131,7 +1131,7 @@ void Test::testHorizontalAttrIterator() const int aChecks[][3] = { {1, 3, 1}, {1, 2, 2}, {4, 4, 2}, {2, 3, 3}, {1, 4, 4} }; const size_t nCheckLen = SAL_N_ELEMENTS(aChecks); - ScHorizontalAttrIterator aIter(m_pDoc, 0, 0, 0, 5, 5); + ScHorizontalAttrIterator aIter(*m_pDoc, 0, 0, 0, 5, 5); SCCOL nCol1, nCol2; SCROW nRow; size_t nCheckPos = 0; diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 3b2c54cfc477..f71946688f6f 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -2055,10 +2055,10 @@ ScConditionalFormatList::ScConditionalFormatList(const ScConditionalFormatList& InsertNew( rxFormat->Clone() ); } -ScConditionalFormatList::ScConditionalFormatList(ScDocument* pDoc, const ScConditionalFormatList& rList) +ScConditionalFormatList::ScConditionalFormatList(ScDocument& rDoc, const ScConditionalFormatList& rList) { for(const auto& rxFormat : rList) - InsertNew( rxFormat->Clone(pDoc) ); + InsertNew( rxFormat->Clone(&rDoc) ); } void ScConditionalFormatList::InsertNew( std::unique_ptr<ScConditionalFormat> pNew ) diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 0d2591191743..d4e565edf80e 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -779,13 +779,13 @@ bool ScDBQueryDataIterator::GetNext(Value& rValue) return mpData->getNext(rValue); } -ScFormulaGroupIterator::ScFormulaGroupIterator( ScDocument* pDoc ) : - mpDoc(pDoc), +ScFormulaGroupIterator::ScFormulaGroupIterator( ScDocument& rDoc ) : + mrDoc(rDoc), mnTab(0), mnCol(0), mnIndex(0) { - ScTable *pTab = mpDoc->FetchTable(mnTab); + ScTable *pTab = mrDoc.FetchTable(mnTab); ScColumn *pCol = pTab ? pTab->FetchColumn(mnCol) : nullptr; if (pCol) { @@ -809,14 +809,14 @@ sc::FormulaGroupEntry* ScFormulaGroupIterator::next() { mnIndex = 0; mnCol++; - if (mnCol > mpDoc->MaxCol()) + if (mnCol > mrDoc.MaxCol()) { mnCol = 0; mnTab++; - if (mnTab >= mpDoc->GetTableCount()) + if (mnTab >= mrDoc.GetTableCount()) return nullptr; } - ScTable *pTab = mpDoc->FetchTable(mnTab); + ScTable *pTab = mrDoc.FetchTable(mnTab); ScColumn *pCol = pTab ? pTab->FetchColumn(mnCol) : nullptr; if (pCol) { @@ -1453,10 +1453,10 @@ bool ScQueryCellIterator::FindEqualOrSortedLastInRange( SCCOL& nFoundCol, return (nFoundCol <= rDoc.MaxCol()) && (nFoundRow <= rDoc.MaxRow()); } -ScCountIfCellIterator::ScCountIfCellIterator(ScDocument* pDocument, const ScInterpreterContext& rContext, SCTAB nTable, +ScCountIfCellIterator::ScCountIfCellIterator(ScDocument& rDocument, const ScInterpreterContext& rContext, SCTAB nTable, const ScQueryParam& rParam ) : maParam(rParam), - pDoc( pDocument ), + rDoc( rDocument ), mrContext( rContext ), nTab( nTable) { @@ -1469,7 +1469,7 @@ void ScCountIfCellIterator::InitPos() nRow = maParam.nRow1; if (maParam.bHasHeader && maParam.bByRow) ++nRow; - ScColumn* pCol = &(pDoc->maTabs[nTab])->aCol[nCol]; + ScColumn* pCol = &(rDoc.maTabs[nTab])->aCol[nCol]; maCurPos = pCol->maCells.position(nRow); } @@ -1496,7 +1496,7 @@ void ScCountIfCellIterator::IncBlock() int ScCountIfCellIterator::GetCount() { - assert(nTab < pDoc->GetTableCount() && "try to access index out of bounds, FIX IT"); + assert(nTab < rDoc.GetTableCount() && "try to access index out of bounds, FIX IT"); nCol = maParam.nCol1; InitPos(); @@ -1505,7 +1505,7 @@ int ScCountIfCellIterator::GetCount() const bool bSingleQueryItem = rEntry.GetQueryItems().size() == 1; int count = 0; - ScColumn* pCol = &(pDoc->maTabs[nTab])->aCol[nCol]; + ScColumn* pCol = &(rDoc.maTabs[nTab])->aCol[nCol]; while (true) { bool bNextColumn = maCurPos.first == pCol->maCells.end(); @@ -1520,10 +1520,10 @@ int ScCountIfCellIterator::GetCount() do { ++nCol; - if (nCol > maParam.nCol2 || nCol >= pDoc->maTabs[nTab]->GetAllocatedColumnsCount()) + if (nCol > maParam.nCol2 || nCol >= rDoc.maTabs[nTab]->GetAllocatedColumnsCount()) return count; // Over and out AdvanceQueryParamEntryField(); - pCol = &(pDoc->maTabs[nTab])->aCol[nCol]; + pCol = &(rDoc.maTabs[nTab])->aCol[nCol]; } while (!rItem.mbMatchEmpty && pCol->IsEmptyData()); @@ -1556,7 +1556,7 @@ int ScCountIfCellIterator::GetCount() ScRefCellValue aCell = sc::toRefCell(maCurPos.first, maCurPos.second); - if ( pDoc->maTabs[nTab]->ValidQuery( nRow, maParam, + if ( rDoc.maTabs[nTab]->ValidQuery( nRow, maParam, (nCol == static_cast<SCCOL>(rEntry.nField) ? &aCell : nullptr), nullptr, &mrContext) ) @@ -1581,7 +1581,7 @@ void ScCountIfCellIterator::AdvanceQueryParamEntryField() ScQueryEntry& rEntry = maParam.GetEntry( j ); if ( rEntry.bDoQuery ) { - if ( rEntry.nField < pDoc->MaxCol() ) + if ( rEntry.nField < rDoc.MaxCol() ) rEntry.nField++; else { @@ -2060,9 +2060,9 @@ bool ScQueryCellIterator::BinarySearch() } } -ScHorizontalCellIterator::ScHorizontalCellIterator(ScDocument* pDocument, SCTAB nTable, +ScHorizontalCellIterator::ScHorizontalCellIterator(ScDocument& rDocument, SCTAB nTable, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) : - pDoc( pDocument ), + rDoc( rDocument ), mnTab( nTable ), nStartCol( nCol1 ), nEndCol( nCol2 ), @@ -2072,9 +2072,9 @@ ScHorizontalCellIterator::ScHorizontalCellIterator(ScDocument* pDocument, SCTAB mnRow( nRow1 ), mbMore( false ) { - assert(mnTab < pDoc->GetTableCount() && "index out of bounds, FIX IT"); + assert(mnTab < rDoc.GetTableCount() && "index out of bounds, FIX IT"); - nEndCol = pDoc->maTabs[mnTab]->ClampToAllocatedColumns(nEndCol); + nEndCol = rDoc.maTabs[mnTab]->ClampToAllocatedColumns(nEndCol); if (nEndCol < nStartCol) // E.g., somewhere completely outside allocated area nEndCol = nStartCol - 1; // Empty @@ -2098,7 +2098,7 @@ void ScHorizontalCellIterator::SetTab( SCTAB nTabP ) // Set the start position in each column. for (SCCOL i = nStartCol; i <= nEndCol; ++i) { - ScColumn* pCol = &pDoc->maTabs[mnTab]->aCol[i]; + ScColumn* pCol = &rDoc.maTabs[mnTab]->aCol[i]; ColParam aParam; aParam.maPos = pCol->maCells.position(nStartRow).first; aParam.maEnd = pCol->maCells.end(); @@ -2233,7 +2233,7 @@ bool ScHorizontalCellIterator::SkipInvalidInRow() /// Find the next row that has some real content in one of its columns. SCROW ScHorizontalCellIterator::FindNextNonEmptyRow() { - size_t nNextRow = pDoc->MaxRow()+1; + size_t nNextRow = rDoc.MaxRow()+1; for (const ColParam& r : maColPositions) { @@ -2317,7 +2317,7 @@ ScHorizontalValueIterator::ScHorizontalValueIterator( ScDocument& rDocument, pAttrArray = nullptr; nAttrEndRow = 0; - pCellIter.reset( new ScHorizontalCellIterator( &rDoc, nStartTab, nStartCol, + pCellIter.reset( new ScHorizontalCellIterator( rDoc, nStartTab, nStartCol, nStartRow, nEndCol, nEndRow ) ); } @@ -2376,19 +2376,19 @@ bool ScHorizontalValueIterator::GetNext( double& rValue, FormulaError& rErr ) return bFound; } -ScHorizontalAttrIterator::ScHorizontalAttrIterator( ScDocument* pDocument, SCTAB nTable, +ScHorizontalAttrIterator::ScHorizontalAttrIterator( ScDocument& rDocument, SCTAB nTable, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) : - pDoc( pDocument ), + rDoc( rDocument ), nTab( nTable ), nStartCol( nCol1 ), nStartRow( nRow1 ), nEndCol( nCol2 ), nEndRow( nRow2 ) { - assert(nTab < pDoc->GetTableCount() && "index out of bounds, FIX IT"); - assert(pDoc->maTabs[nTab]); + assert(nTab < rDoc.GetTableCount() && "index out of bounds, FIX IT"); + assert(rDoc.maTabs[nTab]); - nEndCol = pDoc->maTabs[nTab]->ClampToAllocatedColumns(nEndCol); + nEndCol = rDoc.maTabs[nTab]->ClampToAllocatedColumns(nEndCol); nRow = nStartRow; nCol = nStartCol; @@ -2409,7 +2409,7 @@ ScHorizontalAttrIterator::~ScHorizontalAttrIterator() void ScHorizontalAttrIterator::InitForNextRow(bool bInitialization) { bool bEmpty = true; - nMinNextEnd = pDoc->MaxRow(); + nMinNextEnd = rDoc.MaxRow(); SCCOL nThisHead = 0; for (SCCOL i=nStartCol; i<=nEndCol; i++) @@ -2417,7 +2417,7 @@ void ScHorizontalAttrIterator::InitForNextRow(bool bInitialization) SCCOL nPos = i - nStartCol; if ( bInitialization || pNextEnd[nPos] < nRow ) { - const ScAttrArray* pArray = pDoc->maTabs[nTab]->aCol[i].pAttrArray.get(); + const ScAttrArray* pArray = rDoc.maTabs[nTab]->aCol[i].pAttrArray.get(); assert(pArray); SCSIZE nIndex; @@ -2428,14 +2428,14 @@ void ScHorizontalAttrIterator::InitForNextRow(bool bInitialization) else nIndex = 0; pIndices[nPos] = nIndex; - pHorizEnd[nPos] = pDoc->MaxCol()+1; // only for assert() + pHorizEnd[nPos] = rDoc.MaxCol()+1; // only for assert() } else nIndex = ++pIndices[nPos]; if ( !nIndex && !pArray->Count() ) { - pNextEnd[nPos] = pDoc->MaxRow(); + pNextEnd[nPos] = rDoc.MaxRow(); assert( pNextEnd[nPos] >= nRow && "Sequence out of order" ); ppPatterns[nPos] = nullptr; } @@ -2456,7 +2456,7 @@ void ScHorizontalAttrIterator::InitForNextRow(bool bInitialization) else { assert(!"AttrArray does not range to MAXROW"); - pNextEnd[nPos] = pDoc->MaxRow(); + pNextEnd[nPos] = rDoc.MaxRow(); ppPatterns[nPos] = nullptr; } } @@ -2485,7 +2485,7 @@ bool ScHorizontalAttrIterator::InitForNextAttr() { if ( !ppPatterns[nCol-nStartCol] ) // Skip default items { - assert( pHorizEnd[nCol-nStartCol] < pDoc->MaxCol()+1 && "missing stored data" ); + assert( pHorizEnd[nCol-nStartCol] < rDoc.MaxCol()+1 && "missing stored data" ); nCol = pHorizEnd[nCol-nStartCol] + 1; if ( nCol > nEndCol ) return false; @@ -2496,7 +2496,7 @@ bool ScHorizontalAttrIterator::InitForNextAttr() const ScPatternAttr* ScHorizontalAttrIterator::GetNext( SCCOL& rCol1, SCCOL& rCol2, SCROW& rRow ) { - assert(nTab < pDoc->GetTableCount() && "index out of bounds, FIX IT"); + assert(nTab < rDoc.GetTableCount() && "index out of bounds, FIX IT"); for (;;) { if ( !bRowEmpty && nCol <= nEndCol && InitForNextAttr() ) @@ -2504,7 +2504,7 @@ const ScPatternAttr* ScHorizontalAttrIterator::GetNext( SCCOL& rCol1, SCCOL& rCo const ScPatternAttr* pPat = ppPatterns[nCol-nStartCol]; rRow = nRow; rCol1 = nCol; - assert( pHorizEnd[nCol-nStartCol] < pDoc->MaxCol()+1 && "missing stored data" ); + assert( pHorizEnd[nCol-nStartCol] < rDoc.MaxCol()+1 && "missing stored data" ); nCol = pHorizEnd[nCol-nStartCol]; rCol2 = nCol; ++nCol; // Count up for next call @@ -2527,10 +2527,10 @@ static bool IsGreater( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) return ( nRow1 > nRow2 ) || ( nRow1 == nRow2 && nCol1 > nCol2 ); } -ScUsedAreaIterator::ScUsedAreaIterator( ScDocument* pDocument, SCTAB nTable, +ScUsedAreaIterator::ScUsedAreaIterator( ScDocument& rDocument, SCTAB nTable, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) - : aCellIter( pDocument, nTable, nCol1, nRow1, nCol2, nRow2 ) - , aAttrIter( pDocument, nTable, nCol1, nRow1, nCol2, nRow2 ) + : aCellIter( rDocument, nTable, nCol1, nRow1, nCol2, nRow2 ) + , aAttrIter( rDocument, nTable, nCol1, nRow1, nCol2, nRow2 ) , nNextCol( nCol1 ) , nNextRow( nRow1 ) , nCellCol( 0 ) @@ -2759,10 +2759,10 @@ void ScDocRowHeightUpdater::updateAll() } } -ScAttrRectIterator::ScAttrRectIterator(ScDocument* pDocument, SCTAB nTable, +ScAttrRectIterator::ScAttrRectIterator(ScDocument& rDocument, SCTAB nTable, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) : - pDoc( pDocument ), + rDoc( rDocument ), nTab( nTable ), nEndCol( nCol2 ), nStartRow( nRow1 ), @@ -2770,14 +2770,14 @@ ScAttrRectIterator::ScAttrRectIterator(ScDocument* pDocument, SCTAB nTable, nIterStartCol( nCol1 ), nIterEndCol( nCol1 ) { - if ( ValidTab(nTab) && nTab < pDoc->GetTableCount() && pDoc->maTabs[nTab] - && nCol1 < pDoc->maTabs[nTab]->GetAllocatedColumnsCount()) + if ( ValidTab(nTab) && nTab < rDoc.GetTableCount() && rDoc.maTabs[nTab] + && nCol1 < rDoc.maTabs[nTab]->GetAllocatedColumnsCount()) { - nEndCol = pDoc->maTabs[nTab]->ClampToAllocatedColumns(nEndCol); - pColIter = pDoc->maTabs[nTab]->aCol[nIterStartCol].CreateAttrIterator( nStartRow, nEndRow ); + nEndCol = rDoc.maTabs[nTab]->ClampToAllocatedColumns(nEndCol); + pColIter = rDoc.maTabs[nTab]->aCol[nIterStartCol].CreateAttrIterator( nStartRow, nEndRow ); while ( nIterEndCol < nEndCol && - pDoc->maTabs[nTab]->aCol[nIterEndCol].IsAllAttrEqual( - pDoc->maTabs[nTab]->aCol[nIterEndCol+1], nStartRow, nEndRow ) ) + rDoc.maTabs[nTab]->aCol[nIterEndCol].IsAllAttrEqual( + rDoc.maTabs[nTab]->aCol[nIterEndCol+1], nStartRow, nEndRow ) ) ++nIterEndCol; } else @@ -2793,7 +2793,7 @@ void ScAttrRectIterator::DataChanged() if (pColIter) { SCROW nNextRow = pColIter->GetNextRow(); - pColIter = pDoc->maTabs[nTab]->aCol[nIterStartCol].CreateAttrIterator( nNextRow, nEndRow ); + pColIter = rDoc.maTabs[nTab]->aCol[nIterStartCol].CreateAttrIterator( nNextRow, nEndRow ); } } @@ -2814,10 +2814,10 @@ const ScPatternAttr* ScAttrRectIterator::GetNext( SCCOL& rCol1, SCCOL& rCol2, if ( nIterStartCol <= nEndCol ) { nIterEndCol = nIterStartCol; - pColIter = pDoc->maTabs[nTab]->aCol[nIterStartCol].CreateAttrIterator( nStartRow, nEndRow ); + pColIter = rDoc.maTabs[nTab]->aCol[nIterStartCol].CreateAttrIterator( nStartRow, nEndRow ); while ( nIterEndCol < nEndCol && - pDoc->maTabs[nTab]->aCol[nIterEndCol].IsAllAttrEqual( - pDoc->maTabs[nTab]->aCol[nIterEndCol+1], nStartRow, nEndRow ) ) + rDoc.maTabs[nTab]->aCol[nIterEndCol].IsAllAttrEqual( + rDoc.maTabs[nTab]->aCol[nIterEndCol+1], nStartRow, nEndRow ) ) ++nIterEndCol; } else diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index c5926391988e..d5f7d9ebced7 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -6149,7 +6149,7 @@ sal_uLong ScDocument::GetFormulaGroupCount() const { sal_uLong nFormulaGroupCount = 0; - ScFormulaGroupIterator aIter( const_cast<ScDocument*>(this) ); + ScFormulaGroupIterator aIter( *const_cast<ScDocument*>(this) ); for ( sc::FormulaGroupEntry* ptr = aIter.first(); ptr; ptr = aIter.next()) { nFormulaGroupCount++; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index f20dc524c487..cb0d31a282bb 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -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->rDocument, *mpCondFormatList)); + pTable->mpCondFormatList.reset(new ScConditionalFormatList(pTable->rDocument, *mpCondFormatList)); } void ScTable::CopyToClip( @@ -1194,7 +1194,7 @@ void ScTable::CopyToTable( if(bIsUndoDoc && (nFlags & InsertDeleteFlags::ATTRIB)) { - pDestTab->mpCondFormatList.reset(new ScConditionalFormatList(&pDestTab->rDocument, *mpCondFormatList)); + pDestTab->mpCondFormatList.reset(new ScConditionalFormatList(pDestTab->rDocument, *mpCondFormatList)); } if (pDBDataNoName) @@ -1356,7 +1356,7 @@ void ScTable::UndoToTable( } if (nFlags & InsertDeleteFlags::ATTRIB) - pDestTab->mpCondFormatList.reset(new ScConditionalFormatList(&pDestTab->rDocument, *mpCondFormatList)); + pDestTab->mpCondFormatList.reset(new ScConditionalFormatList(pDestTab->rDocument, *mpCondFormatList)); if (!(bWidth||bHeight)) return; diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index 33c8681e6309..57295bedf538 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -786,7 +786,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc ) bHaveEmpty = true; // Assume we have empty ones and fill below. else { - ScHorizontalCellIterator aIter( pDoc, nTable, nStartCol, nStartRow, nEndCol, nStartRow); // header row only + ScHorizontalCellIterator aIter(*pDoc, nTable, nStartCol, nStartRow, nEndCol, nStartRow); // header row only ScRefCellValue* pCell; SCCOL nCol, nLastColFilled = nStartCol - 1; SCROW nRow; diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 5a1521524a36..65254b7f4a39 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -5815,7 +5815,7 @@ void ScInterpreter::ScCountIf() } else { - ScCountIfCellIterator aCellIter(&mrDoc, mrContext, nTab1, rParam); + ScCountIfCellIterator aCellIter(mrDoc, mrContext, nTab1, rParam); fCount += aCellIter.GetCount(); } } diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index fd8ec5a28d9f..bc9b550705cc 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2500,7 +2500,7 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : // range for cell iterator SCCOL nLastIterScCol = nMaxScCol; SCROW nLastIterScRow = ulimit_cast< SCROW >( nLastUsedScRow, nMaxScRow ); - ScUsedAreaIterator aIt( &rDoc, nScTab, 0, 0, nLastIterScCol, nLastIterScRow ); + ScUsedAreaIterator aIt( rDoc, nScTab, 0, 0, nLastIterScCol, nLastIterScRow ); // activate the correct segment and sub segment at the progress bar GetProgressBar().ActivateCreateRowsSegment(); diff --git a/sc/source/filter/xml/XMLExportIterator.cxx b/sc/source/filter/xml/XMLExportIterator.cxx index dd924507e77e..c2eb3f2a44d1 100644 --- a/sc/source/filter/xml/XMLExportIterator.cxx +++ b/sc/source/filter/xml/XMLExportIterator.cxx @@ -650,7 +650,7 @@ void ScMyNotEmptyCellsIterator::SetCurrentTable(const SCTAB nTable, mpCellItr.reset( new ScHorizontalCellIterator( - rExport.GetDocument(), nCurrentTable, 0, 0, + *rExport.GetDocument(), nCurrentTable, 0, 0, static_cast<SCCOL>(rExport.GetSharedData()->GetLastColumn(nCurrentTable)), static_cast<SCROW>(rExport.GetSharedData()->GetLastRow(nCurrentTable)))); diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 5aedba47d2c9..f478c23448f7 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -91,21 +91,18 @@ void ScTransferObj::GetAreaSize( const ScDocument& rDoc, SCTAB nTab1, SCTAB nTab nCol = nMaxCol; } -void ScTransferObj::PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPrintFactor, +void ScTransferObj::PaintToDev( OutputDevice* pDev, ScDocument& rDoc, double nPrintFactor, const ScRange& rBlock ) { - if (!pDoc) - return; - tools::Rectangle aBound( Point(), pDev->GetOutputSize() ); //! use size from clip area? - ScViewData aViewData(*pDoc); + ScViewData aViewData(rDoc); aViewData.SetTabNo( rBlock.aEnd.Tab() ); aViewData.SetScreen( rBlock.aStart.Col(), rBlock.aStart.Row(), rBlock.aEnd.Col(), rBlock.aEnd.Row() ); - ScPrintFunc::DrawToDev( pDoc, pDev, nPrintFactor, aBound, &aViewData, false/*bMetaFile*/ ); + ScPrintFunc::DrawToDev( rDoc, pDev, nPrintFactor, aBound, &aViewData, false/*bMetaFile*/ ); } ScTransferObj::ScTransferObj( ScDocumentUniquePtr pClipDoc, const TransferableObjectDescriptor& rDesc ) : @@ -233,9 +230,9 @@ void ScTransferObj::AddSupportedFormats() } } -static ScRange lcl_reduceBlock(const ScDocumentUniquePtr &pDoc, ScRange aReducedBlock, bool bIncludeVisual = false) +static ScRange lcl_reduceBlock(const ScDocument& rDoc, ScRange aReducedBlock, bool bIncludeVisual = false) { - if ((aReducedBlock.aEnd.Col() == pDoc->MaxCol() || aReducedBlock.aEnd.Row() == pDoc->MaxRow()) && + if ((aReducedBlock.aEnd.Col() == rDoc.MaxCol() || aReducedBlock.aEnd.Row() == rDoc.MaxRow()) && aReducedBlock.aStart.Tab() == aReducedBlock.aEnd.Tab()) { // Shrink the block here so we don't waste time creating huge @@ -244,7 +241,7 @@ static ScRange lcl_reduceBlock(const ScDocumentUniquePtr &pDoc, ScRange aReduced SCCOL nPrintAreaEndCol = 0; SCROW nPrintAreaEndRow = 0; if (bIncludeVisual) - pDoc->GetPrintArea( aReducedBlock.aStart.Tab(), nPrintAreaEndCol, nPrintAreaEndRow, true ); + rDoc.GetPrintArea( aReducedBlock.aStart.Tab(), nPrintAreaEndCol, nPrintAreaEndRow, true ); // Shrink the area to allow pasting to external applications. // Shrink to real data area for HTML, RTF and RICHTEXT, but include @@ -254,9 +251,9 @@ static ScRange lcl_reduceBlock(const ScDocumentUniquePtr &pDoc, ScRange aReduced SCCOL nEndCol = aReducedBlock.aEnd.Col(); SCROW nEndRow = aReducedBlock.aEnd.Row(); bool bShrunk = false; - pDoc->ShrinkToUsedDataArea( bShrunk, aReducedBlock.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, - false, bIncludeVisual /*bStickyTopRow*/, bIncludeVisual /*bStickyLeftCol*/, - bIncludeVisual /*bConsiderCellNotes*/, bIncludeVisual /*bConsiderCellDrawObjects*/); + rDoc.ShrinkToUsedDataArea( bShrunk, aReducedBlock.aStart.Tab(), nStartCol, nStartRow, nEndCol, nEndRow, + false, bIncludeVisual /*bStickyTopRow*/, bIncludeVisual /*bStickyLeftCol*/, + bIncludeVisual /*bConsiderCellNotes*/, bIncludeVisual /*bConsiderCellDrawObjects*/); if ( nPrintAreaEndRow > nEndRow ) nEndRow = nPrintAreaEndRow; @@ -289,7 +286,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt nFormat == SotClipboardFormatId::PNG); if (bReduceBlockFormat) - aReducedBlock = lcl_reduceBlock(m_pDoc, m_aBlock, bIncludeVisual); + aReducedBlock = lcl_reduceBlock(*m_pDoc, m_aBlock, bIncludeVisual); if ( nFormat == SotClipboardFormatId::LINKSRCDESCRIPTOR || nFormat == SotClipboardFormatId::OBJECTDESCRIPTOR ) { @@ -396,7 +393,7 @@ bool ScTransferObj::GetData( const datatransfer::DataFlavor& rFlavor, const OUSt ScopedVclPtrInstance< VirtualDevice > pVirtDev; pVirtDev->SetOutputSizePixel(pVirtDev->LogicToPixel(aMMRect.GetSize(), MapMode(MapUnit::Map100thMM))); - PaintToDev( pVirtDev, m_pDoc.get(), 1.0, aReducedBlock ); + PaintToDev( pVirtDev, *m_pDoc, 1.0, aReducedBlock ); pVirtDev->SetMapMode( MapMode( MapUnit::MapPixel ) ); BitmapEx aBmp = pVirtDev->GetBitmapEx( Point(), pVirtDev->GetOutputSize() ); @@ -544,7 +541,7 @@ bool ScTransferObj::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* p sal_Bool SAL_CALL ScTransferObj::isComplex() { - ScRange aReduced = lcl_reduceBlock(m_pDoc, m_aBlock); + ScRange aReduced = lcl_reduceBlock(*m_pDoc, m_aBlock); size_t nCells = (aReduced.aEnd.Col() - aReduced.aStart.Col() + 1) * (aReduced.aEnd.Row() - aReduced.aStart.Row() + 1) * (aReduced.aEnd.Tab() - aReduced.aStart.Tab() + 1); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index e05daaa02f65..36f676ddbf52 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -5683,7 +5683,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB ScConditionalFormatList* pOld = rDoc.GetCondFormList(nTab); if (pOld) - pUndoDoc->SetCondFormList(new ScConditionalFormatList(pUndoDoc.get(), *pOld), nTab); + pUndoDoc->SetCondFormList(new ScConditionalFormatList(*pUndoDoc, *pOld), nTab); else pUndoDoc->SetCondFormList(nullptr, nTab); @@ -5703,7 +5703,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB { ScDocumentUniquePtr pRedoDoc(new ScDocument(SCDOCMODE_UNDO)); pRedoDoc->InitUndo( rDoc, nTab, nTab ); - pRedoDoc->SetCondFormList(new ScConditionalFormatList(pRedoDoc.get(), *pList), nTab); + pRedoDoc->SetCondFormList(new ScConditionalFormatList(*pRedoDoc, *pList), nTab); rDocShell.GetUndoManager()->AddUndoAction( std::make_unique<ScUndoConditionalFormatList>(&rDocShell, std::move(pUndoDoc), std::move(pRedoDoc), nTab)); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index e1532db4a063..809f44de340f 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1991,7 +1991,7 @@ void ScDocShell::AsciiSave( SvStream& rStream, const ScImportOptions& rAsciiOpt SCROW nEmptyRow; SvNumberFormatter& rFormatter = *m_aDocument.GetFormatTable(); - ScHorizontalCellIterator aIter( &m_aDocument, nTab, nStartCol, nStartRow, + ScHorizontalCellIterator aIter( m_aDocument, nTab, nStartCol, nStartRow, nEndCol, nEndRow ); ScRefCellValue* pCell; while ( ( pCell = aIter.GetNext( nCol, nRow ) ) != nullptr ) diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index df7022239633..18e23c4851a3 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2134,7 +2134,7 @@ void ScDocShell::Draw( OutputDevice* pDev, const JobSetup & /* rSetup */, sal_uI aTmpData.SetTabNo(nVisTab); SnapVisArea( aBoundRect ); aTmpData.SetScreen( aBoundRect ); - ScPrintFunc::DrawToDev( &m_aDocument, pDev, 1.0, aBoundRect, &aTmpData, true ); + ScPrintFunc::DrawToDev( m_aDocument, pDev, 1.0, aBoundRect, &aTmpData, true ); } else { @@ -2146,7 +2146,7 @@ void ScDocShell::Draw( OutputDevice* pDev, const JobSetup & /* rSetup */, sal_uI if ( aNewArea != aOldArea && (m_aDocument.GetPosLeft() > 0 || m_aDocument.GetPosTop() > 0) ) SfxObjectShell::SetVisArea( aNewArea ); aTmpData.SetScreen( aNewArea ); - ScPrintFunc::DrawToDev( &m_aDocument, pDev, 1.0, aNewArea, &aTmpData, true ); + ScPrintFunc::DrawToDev( m_aDocument, pDev, 1.0, aNewArea, &aTmpData, true ); } pDev->SetLayoutMode( nOldLayoutMode ); diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 902a1852f9eb..da4ca2d97160 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -997,7 +997,7 @@ ErrCode ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncoding SCCOL nDocCol = nFirstCol; const sal_Int32* pColTypes = aColTypes.getConstArray(); const sal_Int32* pColLengths = aColLengths.getConstArray(); - ScHorizontalCellIterator aIter( &m_aDocument, nTab, nFirstCol, + ScHorizontalCellIterator aIter( m_aDocument, nTab, nFirstCol, nDocRow, nLastCol, nDocRow); bool bTest = true; while (bTest) diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 81e87dcb0a60..182cc05150a3 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -1411,10 +1411,10 @@ ScExternalRefCache::DocItem* ScExternalRefCache::getDocItem(sal_uInt16 nFileId) return &itrDoc->second; } -ScExternalRefLink::ScExternalRefLink(ScDocument* pDoc, sal_uInt16 nFileId) : +ScExternalRefLink::ScExternalRefLink(ScDocument& rDoc, sal_uInt16 nFileId) : ::sfx2::SvBaseLink(::SfxLinkUpdateMode::ONCALL, SotClipboardFormatId::SIMPLE_FILE), mnFileId(nFileId), - mpDoc(pDoc), + mrDoc(rDoc), mbDoRefresh(true) { } @@ -1425,7 +1425,7 @@ ScExternalRefLink::~ScExternalRefLink() void ScExternalRefLink::Closed() { - ScExternalRefManager* pMgr = mpDoc->GetExternalRefManager(); + ScExternalRefManager* pMgr = mrDoc.GetExternalRefManager(); pMgr->breakLink(mnFileId); } @@ -1436,7 +1436,7 @@ void ScExternalRefLink::Closed() OUString aFile, aFilter; sfx2::LinkManager::GetDisplayNames(this, nullptr, &aFile, nullptr, &aFilter); - ScExternalRefManager* pMgr = mpDoc->GetExternalRefManager(); + ScExternalRefManager* pMgr = mrDoc.GetExternalRefManager(); if (!pMgr->isFileLoadable(aFile)) return ERROR_GENERAL; @@ -2620,7 +2620,7 @@ void ScExternalRefManager::maybeLinkExternalFile( sal_uInt16 nFileId, bool bDefe SAL_WARN( "sc.ui", "ScExternalRefManager::maybeLinkExternalFile: pLinkMgr==NULL"); return; } - ScExternalRefLink* pLink = new ScExternalRefLink(&mrDoc, nFileId); + ScExternalRefLink* pLink = new ScExternalRefLink(mrDoc, nFileId); OSL_ENSURE(pFileName, "ScExternalRefManager::maybeLinkExternalFile: file name pointer is NULL"); pLinkMgr->InsertFileLink(*pLink, sfx2::SvBaseLinkObjectType::ClientFile, *pFileName, (aFilter.isEmpty() && bDeferFilterDetection ? nullptr : &aFilter)); diff --git a/sc/source/ui/inc/dataproviderdlg.hxx b/sc/source/ui/inc/dataproviderdlg.hxx index 2cc636973145..977dd154733d 100644 --- a/sc/source/ui/inc/dataproviderdlg.hxx +++ b/sc/source/ui/inc/dataproviderdlg.hxx @@ -69,7 +69,7 @@ public: void replaceNullTransformation(); void dateTimeTransformation(); - void import(ScDocument* pDoc, bool bInternal = false); + void import(ScDocument& rDoc, bool bInternal = false); }; #endif diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index a3ddbc84bac1..1af32863045c 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -125,7 +125,7 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, public DropTargetHel SCROW mnRow1; SCROW mnRow2; - VisibleRange(const ScDocument*); + VisibleRange(const ScDocument&); bool isInside(SCCOL nCol, SCROW nRow) const; bool set(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); @@ -146,7 +146,7 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, public DropTargetHel std::unique_ptr<sc::SpellCheckContext> mpSpellCheckCxt; - ScViewData* pViewData; + ScViewData& mrViewData; ScSplitPos eWhich; ScHSplitPos eHWhich; ScVSplitPos eVWhich; @@ -327,7 +327,7 @@ protected: public: enum class AutoFilterMode { Normal, Top10, Custom, Empty, NonEmpty, SortAscending, SortDescending }; - ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos eWhichPos ); + ScGridWindow( vcl::Window* pParent, ScViewData& rData, ScSplitPos eWhichPos ); virtual ~ScGridWindow() override; virtual void dispose() override; @@ -471,7 +471,7 @@ public: /// Same as MouseMove(), but coordinates are in logic unit. virtual void LogicMouseMove(const MouseEvent& rMouseEvent) override; - ScViewData* getViewData(); + ScViewData& getViewData(); virtual FactoryFunction GetUITestFactory() const override; void updateLOKValListButton(bool bVisible, const ScAddress& rPos) const; diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx index 193d713d8123..96a8715911df 100644 --- a/sc/source/ui/inc/printfun.hxx +++ b/sc/source/ui/inc/printfun.hxx @@ -296,7 +296,7 @@ public: ~ScPrintFunc(); - static void DrawToDev( ScDocument* rDoc, OutputDevice* pDev, double nPrintFactor, + static void DrawToDev( ScDocument& rDoc, OutputDevice* pDev, double nPrintFactor, const tools::Rectangle& rBound, ScViewData* pViewData, bool bMetaFile ); void SetDrawView( FmFormView* pNew ); diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx index 95cdf0265894..360b46f9a3e8 100644 --- a/sc/source/ui/inc/transobj.hxx +++ b/sc/source/ui/inc/transobj.hxx @@ -63,7 +63,7 @@ private: static void StripRefs( ScDocument& rDoc, SCCOL nStartX, SCROW nStartY, SCCOL nEndX, SCROW nEndY, ScDocument& rDestDoc ); - static void PaintToDev( OutputDevice* pDev, ScDocument* pDoc, double nPrintFactor, + static void PaintToDev( OutputDevice* pDev, ScDocument& rDoc, double nPrintFactor, const ScRange& rBlock ); static void GetAreaSize( const ScDocument& rDoc, SCTAB nTab1, SCTAB nTab2, SCROW& nRow, SCCOL& nCol ); diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx index 279f60215cfc..0ceee8cee473 100644 --- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx +++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx @@ -817,7 +817,7 @@ IMPL_LINK(ScDataProviderDlg, ImportHdl, ScDataProviderBaseControl*, pCtrl, void) { if (pCtrl == mxDataProviderCtrl.get()) { - import(mxDoc.get(), true); + import(*mxDoc, true); } } @@ -903,9 +903,9 @@ bool hasDBName(const OUString& rName, ScDBCollection* pDBCollection) } -void ScDataProviderDlg::import(ScDocument* pDoc, bool bInternal) +void ScDataProviderDlg::import(ScDocument& rDoc, bool bInternal) { - sc::ExternalDataSource aSource = mxDataProviderCtrl->getDataSource(pDoc); + sc::ExternalDataSource aSource = mxDataProviderCtrl->getDataSource(&rDoc); for (size_t i = 0; i < maControls.size(); ++i) { @@ -917,11 +917,11 @@ void ScDataProviderDlg::import(ScDocument* pDoc, bool bInternal) else { aSource.setDBData(mxDBRanges->get_active_text()); - if (!hasDBName(aSource.getDBName(), pDoc->GetDBCollection())) + if (!hasDBName(aSource.getDBName(), rDoc.GetDBCollection())) return; - pDoc->GetExternalDataMapper().insertDataSource(aSource); + rDoc.GetExternalDataMapper().insertDataSource(aSource); } - aSource.refresh(pDoc, true); + aSource.refresh(&rDoc, true); mxTable->Invalidate(); } diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx index 3668b0c9727b..661f69aacfcd 100644 --- a/sc/source/ui/uitest/uiobject.cxx +++ b/sc/source/ui/uitest/uiobject.cxx @@ -63,24 +63,24 @@ StringMap ScGridWinUIObject::get_state() { StringMap aMap = WindowUIObject::get_state(); - aMap["SelectedTable"] = OUString::number(mxGridWindow->getViewData()->GetTabNo()); - aMap["CurrentColumn"] = OUString::number(mxGridWindow->getViewData()->GetCurX()); - aMap["CurrentRow"] = OUString::number(mxGridWindow->getViewData()->GetCurY()); + aMap["SelectedTable"] = OUString::number(mxGridWindow->getViewData().GetTabNo()); + aMap["CurrentColumn"] = OUString::number(mxGridWindow->getViewData().GetCurX()); + aMap["CurrentRow"] = OUString::number(mxGridWindow->getViewData().GetCurY()); - ScSplitPos eAlign = mxGridWindow->getViewData()->GetActivePart(); + ScSplitPos eAlign = mxGridWindow->getViewData().GetActivePart(); ScHSplitPos eAlignX = WhichH(eAlign); ScVSplitPos eAlignY = WhichV(eAlign); - aMap["TopVisibleRow"] = OUString::number(mxGridWindow->getViewData()->GetPosY(eAlignY)); - aMap["TopVisibleColumn"] = OUString::number(mxGridWindow->getViewData()->GetPosX(eAlignX)); + aMap["TopVisibleRow"] = OUString::number(mxGridWindow->getViewData().GetPosY(eAlignY)); + aMap["TopVisibleColumn"] = OUString::number(mxGridWindow->getViewData().GetPosX(eAlignX)); - ScRangeList aMarkedArea = mxGridWindow->getViewData()->GetMarkData().GetMarkedRanges(); + ScRangeList aMarkedArea = mxGridWindow->getViewData().GetMarkData().GetMarkedRanges(); OUString aMarkedAreaString; - ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, &mxGridWindow->getViewData()->GetDocument(), formula::FormulaGrammar::CONV_OOO); + ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, &mxGridWindow->getViewData().GetDocument(), formula::FormulaGrammar::CONV_OOO); aMap["MarkedArea"] = aMarkedAreaString; - ScDocument& rDoc = mxGridWindow->getViewData()->GetDocument(); - ScAddress aPos( mxGridWindow->getViewData()->GetCurX() , mxGridWindow->getViewData()->GetCurY() , mxGridWindow->getViewData()->GetTabNo() ); + ScDocument& rDoc = mxGridWindow->getViewData().GetDocument(); + ScAddress aPos( mxGridWindow->getViewData().GetCurX() , mxGridWindow->getViewData().GetCurY() , mxGridWindow->getViewData().GetTabNo() ); if ( rDoc.HasNote( aPos ) ) { ScPostIt* pNote = rDoc.GetNote(aPos); @@ -95,32 +95,32 @@ StringMap ScGridWinUIObject::get_state() ScDBFunc* ScGridWinUIObject::getDBFunc() { - ScViewData* pViewData = mxGridWindow->getViewData(); - ScDBFunc* pFunc = pViewData->GetView(); + ScViewData& rViewData = mxGridWindow->getViewData(); + ScDBFunc* pFunc = rViewData.GetView(); return pFunc; } ScDrawView* ScGridWinUIObject::getDrawView() { - ScViewData* pViewData = mxGridWindow->getViewData(); - ScDrawView* pDrawView = pViewData->GetScDrawView(); + ScViewData& rViewData = mxGridWindow->getViewData(); + ScDrawView* pDrawView = rViewData.GetScDrawView(); return pDrawView; } ScTabViewShell* ScGridWinUIObject::getViewShell() { - ScViewData* pViewData = mxGridWindow->getViewData(); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScViewData& rViewData = mxGridWindow->getViewData(); + ScTabViewShell* pViewShell = rViewData.GetViewShell(); return pViewShell; } ScViewFunc* ScGridWinUIObject::getViewFunc() { - ScViewData* pViewData = mxGridWindow->getViewData(); - ScViewFunc* pViewFunc = pViewData->GetView(); + ScViewData& rViewData = mxGridWindow->getViewData(); + ScViewFunc* pViewFunc = rViewData.GetView(); return pViewFunc; } @@ -142,7 +142,7 @@ void ScGridWinUIObject::execute(const OUString& rAction, { auto itr = rParameters.find("CELL"); const OUString& rStr = itr->second; - ScAddress aAddr = get_address_from_string(mxGridWindow->getViewData()->GetDocument(), rStr); + ScAddress aAddr = get_address_from_string(mxGridWindow->getViewData().GetDocument(), rStr); ScDBFunc* pFunc = getDBFunc(); pFunc->MarkRange(ScRange(aAddr), true, bExtend); mxGridWindow->CursorChanged(); @@ -151,7 +151,7 @@ void ScGridWinUIObject::execute(const OUString& rAction, { auto itr = rParameters.find("RANGE"); const OUString rStr = itr->second; - ScRange aRange = get_range_from_string(mxGridWindow->getViewData()->GetDocument(), rStr); + ScRange aRange = get_range_from_string(mxGridWindow->getViewData().GetDocument(), rStr); ScDBFunc* pFunc = getDBFunc(); pFunc->MarkRange(aRange, true, bExtend); mxGridWindow->CursorChanged(); @@ -161,7 +161,7 @@ void ScGridWinUIObject::execute(const OUString& rAction, auto itr = rParameters.find("TABLE"); const OUString rStr = itr->second; sal_Int32 nTab = rStr.toUInt32(); - ScTabView* pTabView = mxGridWindow->getViewData()->GetView(); + ScTabView* pTabView = mxGridWindow->getViewData().GetView(); if (pTabView) pTabView->SetTabNo(nTab); } @@ -263,15 +263,15 @@ void ScGridWinUIObject::execute(const OUString& rAction, { FuDraw* pDraw = dynamic_cast<FuDraw*>(getViewFunc()->GetDrawFuncPtr()); assert(pDraw); - ScViewData* pViewData = mxGridWindow->getViewData(); - pViewData->GetDispatcher().Execute( pDraw->GetSlotID() , SfxCallMode::SLOT | SfxCallMode::RECORD ); + ScViewData& rViewData = mxGridWindow->getViewData(); + rViewData.GetDispatcher().Execute( pDraw->GetSlotID() , SfxCallMode::SLOT | SfxCallMode::RECORD ); } else if ( rParameters.find("SETTEXT") != rParameters.end() ) { auto itr = rParameters.find("SETTEXT"); const OUString rStr = itr->second; - ScDocument& rDoc = mxGridWindow->getViewData()->GetDocument(); - ScAddress aPos( mxGridWindow->getViewData()->GetCurX() , mxGridWindow->getViewData()->GetCurY() , mxGridWindow->getViewData()->GetTabNo() ); + ScDocument& rDoc = mxGridWindow->getViewData().GetDocument(); + ScAddress aPos( mxGridWindow->getViewData().GetCurX() , mxGridWindow->getViewData().GetCurY() , mxGridWindow->getViewData().GetTabNo() ); rDoc.GetOrCreateNote( aPos )->SetText( aPos , rStr ); } } @@ -320,7 +320,7 @@ namespace { ScDrawLayer* get_draw_layer(VclPtr<ScGridWindow> const & xGridWindow) { - return xGridWindow->getViewData()->GetDocument().GetDrawLayer(); + return xGridWindow->getViewData().GetDocument().GetDrawLayer(); } SdrPage* get_draw_page(VclPtr<ScGridWindow> const & xGridWindow, SCTAB nTab) @@ -332,7 +332,7 @@ SdrPage* get_draw_page(VclPtr<ScGridWindow> const & xGridWindow, SCTAB nTab) std::set<OUString> collect_charts(VclPtr<ScGridWindow> const & xGridWindow) { - SCTAB nTab = xGridWindow->getViewData()->GetTabNo(); + SCTAB nTab = xGridWindow->getViewData().GetTabNo(); SdrPage* pPage = get_draw_page(xGridWindow, nTab); std::set<OUString> aRet; diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index e7fccbedded5..ebb141171ca7 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1638,7 +1638,7 @@ void ScUndoConditionalFormatList::DoChange(const ScDocument* pSrcDoc) mpUndoDoc->GetCondFormList(mnTab)->RemoveFromDocument(rDoc); mpRedoDoc->GetCondFormList(mnTab)->AddToDocument(rDoc); } - rDoc.SetCondFormList(new ScConditionalFormatList(&rDoc, *pSrcDoc->GetCondFormList(mnTab)), mnTab); + rDoc.SetCondFormList(new ScConditionalFormatList(rDoc, *pSrcDoc->GetCondFormList(mnTab)), mnTab); pDocShell->PostPaintGridAll(); pDocShell->PostDataChanged(); diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 28de74f67ccc..fd4264bfddc9 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -8878,7 +8878,7 @@ ScCellRangeObj* ScCellFormatsObj::GetObjectByIndex_Impl(long nIndex) const { ScDocument& rDoc = pDocShell->GetDocument(); long nPos = 0; - ScAttrRectIterator aIter( &rDoc, aTotalRange.aStart.Tab(), + ScAttrRectIterator aIter( rDoc, aTotalRange.aStart.Tab(), aTotalRange.aStart.Col(), aTotalRange.aStart.Row(), aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() ); SCCOL nCol1, nCol2; @@ -8913,7 +8913,7 @@ sal_Int32 SAL_CALL ScCellFormatsObj::getCount() if (pDocShell) { ScDocument& rDoc = pDocShell->GetDocument(); - ScAttrRectIterator aIter( &rDoc, aTotalRange.aStart.Tab(), + ScAttrRectIterator aIter( rDoc, aTotalRange.aStart.Tab(), aTotalRange.aStart.Col(), aTotalRange.aStart.Row(), aTotalRange.aEnd.Col(), aTotalRange.aEnd.Row() ); SCCOL nCol1, nCol2; @@ -8970,7 +8970,7 @@ ScCellFormatsEnumeration::ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScR OSL_ENSURE( rRange.aStart.Tab() == rRange.aEnd.Tab(), "CellFormatsEnumeration: different tables" ); - pIter.reset( new ScAttrRectIterator( &rDoc, nTab, + pIter.reset( new ScAttrRectIterator( rDoc, nTab, rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row() ) ); Advance_Impl(); @@ -9239,7 +9239,7 @@ ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange ScDocument& rDoc = pDocShell->GetDocument(); SCTAB nTab = rTotalRange.aStart.Tab(); - ScAttrRectIterator aIter( &rDoc, nTab, + ScAttrRectIterator aIter( rDoc, nTab, rTotalRange.aStart.Col(), rTotalRange.aStart.Row(), rTotalRange.aEnd.Col(), rTotalRange.aEnd.Row() ); SCCOL nCol1, nCol2; diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 7799a28254ed..55d16e01d411 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -2089,7 +2089,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec // The bMetaFile argument maybe could be // pDev->GetConnectMetaFile() != nullptr // but for some yet unknown reason does not draw cell content if true. - ScPrintFunc::DrawToDev( &rDoc, pDev, nPrintFactor, aBound, &aViewData, false /*bMetaFile*/ ); + ScPrintFunc::DrawToDev( rDoc, pDev, nPrintFactor, aBound, &aViewData, false /*bMetaFile*/ ); return; } diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index d0d005ef3ac0..5866cad52d6b 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -764,7 +764,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) ScDataProviderDlg aDialog(pTabViewShell->GetDialogParent(), xDoc, &rDoc); if (aDialog.run() == RET_OK) { - aDialog.import(&rDoc); + aDialog.import(rDoc); } } break; diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index f6edb66554de..3051ce6586e3 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -163,11 +163,11 @@ struct ScGridWindow::MouseEventState #define SC_FILTERLISTBOX_LINES 12 -ScGridWindow::VisibleRange::VisibleRange(const ScDocument* pDoc) +ScGridWindow::VisibleRange::VisibleRange(const ScDocument& rDoc) : mnCol1(0) - , mnCol2(pDoc->MaxCol()) + , mnCol2(rDoc.MaxCol()) , mnRow1(0) - , mnRow2(pDoc->MaxRow()) + , mnRow2(rDoc.MaxRow()) { } @@ -363,20 +363,20 @@ static bool lcl_IsEditableMatrix( ScDocument& rDoc, const ScRange& rRange ) return (aCell.meType == CELLTYPE_FORMULA && aCell.mpFormula->GetMatrixOrigin(rDoc, aPos) && aPos == rRange.aStart); } -static void lcl_UnLockComment( ScDrawView* pView, const Point& rPos, const ScViewData* pViewData ) +static void lcl_UnLockComment( ScDrawView* pView, const Point& rPos, const ScViewData& rViewData ) { - if (!pView || !pViewData) + if (!pView) return; - ScDocument& rDoc = pViewData->GetDocument(); - ScAddress aCellPos( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() ); + ScDocument& rDoc = rViewData.GetDocument(); + ScAddress aCellPos( rViewData.GetCurX(), rViewData.GetCurY(), rViewData.GetTabNo() ); ScPostIt* pNote = rDoc.GetNote( aCellPos ); SdrObject* pObj = pNote ? pNote->GetCaption() : nullptr; if( pObj && pObj->GetLogicRect().IsInside( rPos ) && ScDrawLayer::IsNoteCaption( pObj ) ) { const ScProtectionAttr* pProtAttr = rDoc.GetAttr( aCellPos, ATTR_PROTECTION ); bool bProtectAttr = pProtAttr->GetProtection() || pProtAttr->GetHideCell() ; - bool bProtectDoc = rDoc.IsTabProtected( aCellPos.Tab() ) || pViewData->GetSfxDocShell()->IsReadOnly() ; + bool bProtectDoc = rDoc.IsTabProtected( aCellPos.Tab() ) || rViewData.GetSfxDocShell()->IsReadOnly() ; // unlock internal layer (if not protected), will be relocked in ScDrawView::MarkListHasChanged() pView->LockInternalLayer( bProtectDoc && bProtectAttr ); } @@ -419,7 +419,7 @@ static bool lcl_GetHyperlinkCell( } // WB_DIALOGCONTROL needed for UNO-Controls -ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos eWhichPos ) +ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData& rData, ScSplitPos eWhichPos ) : Window( pParent, WB_CLIPCHILDREN | WB_DIALOGCONTROL ), DropTargetHelper( this ), DragSourceHelper( this ), @@ -430,8 +430,8 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos mpOODragRect(), mpOOHeader(), mpOOShrink(), - maVisibleRange(&pData->GetDocument()), - pViewData( pData ), + maVisibleRange(rData.GetDocument()), + mrViewData( rData ), eWhich( eWhichPos ), mpNoteMarker(), mpFilterBox(), @@ -497,7 +497,7 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos SetBackground(); - SetMapMode(pViewData->GetLogicMode(eWhich)); + SetMapMode(mrViewData.GetLogicMode(eWhich)); EnableChildTransparentMode(); SetDialogControlFlags( DialogControlFlags::Return | DialogControlFlags::WantFocus ); @@ -559,9 +559,9 @@ IMPL_LINK_NOARG(ScGridWindow, PopupModeEndHdl, FloatingWindow*, void) IMPL_LINK( ScGridWindow, PopupSpellingHdl, SpellCallbackInfo&, rInfo, void ) { if( rInfo.nCommand == SpellCallbackCommand::STARTSPELLDLG ) - pViewData->GetDispatcher().Execute( SID_SPELL_DIALOG, SfxCallMode::ASYNCHRON ); + mrViewData.GetDispatcher().Execute( SID_SPELL_DIALOG, SfxCallMode::ASYNCHRON ); else if (rInfo.nCommand == SpellCallbackCommand::AUTOCORRECT_OPTIONS) - pViewData->GetDispatcher().Execute( SID_AUTO_CORRECT_DLG, SfxCallMode::ASYNCHRON ); + mrViewData.GetDispatcher().Execute( SID_AUTO_CORRECT_DLG, SfxCallMode::ASYNCHRON ); } namespace { @@ -648,8 +648,8 @@ void collectUIInformation(const OUString& aRow, const OUString& aCol , const OUS void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) { - SCTAB nTab = pViewData->GetTabNo(); - ScDocument& rDoc = pViewData->GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); bool bLOKActive = comphelper::LibreOfficeKit::isActive(); mpAutoFilterPopup.disposeAndClear(); @@ -658,7 +658,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) ScFilterEntries aFilterEntries; rDoc.GetFilterEntries(nCol, nRow, nTab, aFilterEntries); - int nColWidth = ScViewData::ToPixel(rDoc.GetColWidth(nCol, nTab), pViewData->GetPPTX()); + int nColWidth = ScViewData::ToPixel(rDoc.GetColWidth(nCol, nTab), mrViewData.GetPPTX()); mpAutoFilterPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, &rDoc, false, aFilterEntries.mbHasDates, nColWidth)); ScCheckListMenuControl& rControl = mpAutoFilterPopup->get_widget(); @@ -704,17 +704,17 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) std::unique_ptr<AutoFilterData> pData(new AutoFilterData); pData->maPos = ScAddress(nCol, nRow, nTab); - Point aPos = pViewData->GetScrPos(nCol, nRow, eWhich); + Point aPos = mrViewData.GetScrPos(nCol, nRow, eWhich); long nSizeX = 0; long nSizeY = 0; - pViewData->GetMergeSizePixel(nCol, nRow, nSizeX, nSizeY); + mrViewData.GetMergeSizePixel(nCol, nRow, nSizeX, nSizeY); if (bLOKActive) { // Reverse the zoom factor from aPos and nSize[X|Y] // before letting the autofilter window convert the to twips // with no zoom information. - double fZoomX(pViewData->GetZoomX()); - double fZoomY(pViewData->GetZoomY()); + double fZoomX(mrViewData.GetZoomX()); + double fZoomY(mrViewData.GetZoomY()); aPos.setX(aPos.getX() / fZoomX); aPos.setY(aPos.getY() / fZoomY); nSizeX = nSizeX / fZoomX; @@ -778,7 +778,7 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow) ScCheckListMenuControl::Config aConfig; aConfig.mbAllowEmptySet = false; - aConfig.mbRTL = pViewData->GetDocument().IsLayoutRTL(pViewData->GetTabNo()); + aConfig.mbRTL = mrViewData.GetDocument().IsLayoutRTL(mrViewData.GetTabNo()); rControl.setConfig(aConfig); if (IsMouseCaptured()) ReleaseMouse(); @@ -816,7 +816,7 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) if (!pDBData) return; - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); svl::SharedStringPool& rPool = rDoc.GetSharedStringPool(); switch (eMode) { @@ -847,7 +847,7 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) for (size_t i = 1; i < aSortParam.GetSortKeyCount(); ++i) aSortParam.maKeyState[i].bDoSort = false; - pViewData->GetViewShell()->UISort(aSortParam); + mrViewData.GetViewShell()->UISort(aSortParam); return; } default: @@ -858,9 +858,9 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) { ScRange aRange; pDBData->GetArea(aRange); - pViewData->GetView()->MarkRange(aRange); - pViewData->GetView()->SetCursor(rPos.Col(), rPos.Row()); - pViewData->GetDispatcher().Execute(SID_FILTER, SfxCallMode::SLOT|SfxCallMode::RECORD); + mrViewData.GetView()->MarkRange(aRange); + mrViewData.GetView()->SetCursor(rPos.Col(), rPos.Row()); + mrViewData.GetDispatcher().Execute(SID_FILTER, SfxCallMode::SLOT|SfxCallMode::RECORD); return; } @@ -885,7 +885,7 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) pEntry->nField = rPos.Col(); pEntry->eConnect = SC_AND; pEntry->eOp = SC_EQUAL; - pViewData->GetView()->Query(aParam, nullptr, true); + mrViewData.GetView()->Query(aParam, nullptr, true); } return; @@ -904,7 +904,7 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) // Something went terribly wrong! return; - if (ScTabViewShell::isAnyEditViewInRange(pViewData->GetViewShell(), /*bColumns*/ false, aParam.nRow1, aParam.nRow2)) + if (ScTabViewShell::isAnyEditViewInRange(mrViewData.GetViewShell(), /*bColumns*/ false, aParam.nRow1, aParam.nRow2)) return; pEntry->bDoQuery = true; @@ -942,20 +942,20 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) } } - pViewData->GetView()->Query(aParam, nullptr, true); + mrViewData.GetView()->Query(aParam, nullptr, true); pDBData->SetQueryParam(aParam); } namespace { -void getCellGeometry(Point& rScrPos, Size& rScrSize, const ScViewData* pViewData, SCCOL nCol, SCROW nRow, ScSplitPos eWhich) +void getCellGeometry(Point& rScrPos, Size& rScrSize, const ScViewData& rViewData, SCCOL nCol, SCROW nRow, ScSplitPos eWhich) { // Get the screen position of the cell. - rScrPos = pViewData->GetScrPos(nCol, nRow, eWhich); + rScrPos = rViewData.GetScrPos(nCol, nRow, eWhich); // Get the screen size of the cell. long nSizeX, nSizeY; - pViewData->GetMergeSizePixel(nCol, nRow, nSizeX, nSizeY); + rViewData.GetMergeSizePixel(nCol, nRow, nSizeX, nSizeY); rScrSize = Size(nSizeX-1, nSizeY-1); } @@ -967,27 +967,27 @@ void ScGridWindow::LaunchPageFieldMenu( SCCOL nCol, SCROW nRow ) // We assume that the page field button is located in cell to the immediate left. return; - SCTAB nTab = pViewData->GetTabNo(); - ScDPObject* pDPObj = pViewData->GetDocument().GetDPAtCursor(nCol, nRow, nTab); + SCTAB nTab = mrViewData.GetTabNo(); + ScDPObject* pDPObj = mrViewData.GetDocument().GetDPAtCursor(nCol, nRow, nTab); if (!pDPObj) return; Point aScrPos; Size aScrSize; - getCellGeometry(aScrPos, aScrSize, pViewData, nCol, nRow, eWhich); + getCellGeometry(aScrPos, aScrSize, mrViewData, nCol, nRow, eWhich); DPLaunchFieldPopupMenu(OutputToScreenPixel(aScrPos), aScrSize, ScAddress(nCol-1, nRow, nTab), pDPObj); } void ScGridWindow::LaunchDPFieldMenu( SCCOL nCol, SCROW nRow ) { - SCTAB nTab = pViewData->GetTabNo(); - ScDPObject* pDPObj = pViewData->GetDocument().GetDPAtCursor(nCol, nRow, nTab); + SCTAB nTab = mrViewData.GetTabNo(); + ScDPObject* pDPObj = mrViewData.GetDocument().GetDPAtCursor(nCol, nRow, nTab); if (!pDPObj) return; Point aScrPos; Size aScrSize; - getCellGeometry(aScrPos, aScrSize, pViewData, nCol, nRow, eWhich); + getCellGeometry(aScrPos, aScrSize, mrViewData, nCol, nRow, eWhich); DPLaunchFieldPopupMenu(OutputToScreenPixel(aScrPos), aScrSize, ScAddress(nCol, nRow, nTab), pDPObj); } @@ -1044,7 +1044,7 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange ) { bool bMenuAtTop = true; - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); mpFilterBox.disposeAndClear(); mpFilterFloat.disposeAndClear(); @@ -1057,15 +1057,15 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange ) bMenuAtTop = false; } - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); long nSizeX = 0; long nSizeY = 0; - pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY ); + mrViewData.GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY ); // The button height should not use the merged cell height, should still use single row height - nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), pViewData->GetPPTY()); - Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich ); + nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), mrViewData.GetPPTY()); + Point aPos = mrViewData.GetScrPos( nCol, nRow, eWhich ); if ( bLayoutRTL ) aPos.AdjustX( -nSizeX ); tools::Rectangle aCellRect( OutputToScreenPixel(aPos), Size(nSizeX,nSizeY) ); @@ -1073,7 +1073,7 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange ) aCellRect.AdjustBottom( -(nSizeY - 1) ); if (!bMenuAtTop) { - Size aButSize = pViewData->GetScenButSize(); + Size aButSize = mrViewData.GetScenButSize(); aCellRect.AdjustBottom(aButSize.Height()); } @@ -1134,14 +1134,14 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow ) mpFilterBox.disposeAndClear(); mpFilterFloat.disposeAndClear(); - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); long nSizeX = 0; long nSizeY = 0; - pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY ); - Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich ); + mrViewData.GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY ); + Point aPos = mrViewData.GetScrPos( nCol, nRow, eWhich ); bool bLOKActive = comphelper::LibreOfficeKit::isActive(); if (bLOKActive) @@ -1151,8 +1151,8 @@ void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow ) // so if we don't reverse the zoom now, a simple PixelToLogic(aPos, MapMode(MapUnit::MapTwip)) employed in // FloatingWindow::ImplCalcPos will produce a 'scaled' twips position which will again get zoom scaled in the // client (effective double scaling) causing wrong positioning/size. - double fZoomX(pViewData->GetZoomX()); - double fZoomY(pViewData->GetZoomY()); + double fZoomX(mrViewData.GetZoomX()); + double fZoomY(mrViewData.GetZoomY()); aPos.setX(aPos.getX() / fZoomX); aPos.setY(aPos.getY() / fZoomY); nSizeX = nSizeX / fZoomX; @@ -1279,7 +1279,7 @@ void ScGridWindow::FilterSelect( sal_uLong nSel ) ExecDataSelect(nCol, nRow, aString); break; case ScFilterBoxMode::Scenario: - pViewData->GetView()->UseScenario(aString); + mrViewData.GetView()->UseScenario(aString); break; } @@ -1292,12 +1292,12 @@ void ScGridWindow::FilterSelect( sal_uLong nSel ) void ScGridWindow::ExecDataSelect( SCCOL nCol, SCROW nRow, const OUString& rStr ) { ScModule* pScMod = SC_MOD(); - ScInputHandler* pViewHdl = pScMod->GetInputHdl(pViewData->GetViewShell()); - if (pViewHdl && pViewData->HasEditView(pViewData->GetActivePart())) + ScInputHandler* pViewHdl = pScMod->GetInputHdl(mrViewData.GetViewShell()); + if (pViewHdl && mrViewData.HasEditView(mrViewData.GetActivePart())) pViewHdl->CancelHandler(); - SCTAB nTab = pViewData->GetTabNo(); - ScViewFunc* pView = pViewData->GetView(); + SCTAB nTab = mrViewData.GetTabNo(); + ScViewFunc* pView = mrViewData.GetView(); pView->EnterData( nCol, nRow, nTab, rStr ); // #i52307# CellContentChanged is not in EnterData so it isn't called twice @@ -1346,21 +1346,21 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction ) bool bNewPointer = false; - SfxInPlaceClient* pClient = pViewData->GetViewShell()->GetIPClient(); + SfxInPlaceClient* pClient = mrViewData.GetViewShell()->GetIPClient(); bool bOleActive = ( pClient && pClient->IsObjectInPlaceActive() ); - if ( pViewData->IsActive() && !bOleActive ) + if ( mrViewData.IsActive() && !bOleActive ) { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); // Auto-Fill ScRange aMarkRange; - if (pViewData->GetSimpleArea( aMarkRange ) == SC_MARK_SIMPLE) + if (mrViewData.GetSimpleArea( aMarkRange ) == SC_MARK_SIMPLE) { - if (aMarkRange.aStart.Tab() == pViewData->GetTabNo() && mpAutoFillRect) + if (aMarkRange.aStart.Tab() == mrViewData.GetTabNo() && mpAutoFillRect) { Point aMousePos = rMEvt.GetPosPixel(); if (mpAutoFillRect->IsInside(aMousePos)) @@ -1371,16 +1371,16 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction ) SCCOL nX = aMarkRange.aEnd.Col(); SCROW nY = aMarkRange.aEnd.Row(); - if ( lcl_IsEditableMatrix( pViewData->GetDocument(), aMarkRange ) ) - pViewData->SetDragMode( + if ( lcl_IsEditableMatrix( mrViewData.GetDocument(), aMarkRange ) ) + mrViewData.SetDragMode( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), nX, nY, ScFillMode::MATRIX ); else - pViewData->SetFillMode( + mrViewData.SetFillMode( aMarkRange.aStart.Col(), aMarkRange.aStart.Row(), nX, nY ); // The simple selection must also be recognized when dragging, // where the Marking flag is set and MarkToSimple won't work anymore. - pViewData->GetMarkData().MarkToSimple(); + mrViewData.GetMarkData().MarkToSimple(); } bNewPointer = true; } @@ -1393,10 +1393,10 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction ) { ScRange aRange; rDoc.GetEmbedded( aRange ); - if ( pViewData->GetTabNo() == aRange.aStart.Tab() ) + if ( mrViewData.GetTabNo() == aRange.aStart.Tab() ) { - Point aStartPos = pViewData->GetScrPos( aRange.aStart.Col(), aRange.aStart.Row(), eWhich ); - Point aEndPos = pViewData->GetScrPos( aRange.aEnd.Col()+1, aRange.aEnd.Row()+1, eWhich ); + Point aStartPos = mrViewData.GetScrPos( aRange.aStart.Col(), aRange.aStart.Row(), eWhich ); + Point aEndPos = mrViewData.GetScrPos( aRange.aEnd.Col()+1, aRange.aEnd.Row()+1, eWhich ); Point aMousePos = rMEvt.GetPosPixel(); if ( bLayoutRTL ) { @@ -1413,7 +1413,7 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction ) if (bAction) { ScFillMode nMode = bTop ? ScFillMode::EMBED_LT : ScFillMode::EMBED_RB; - pViewData->SetDragMode( + mrViewData.SetDragMode( aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row(), nMode ); } @@ -1425,7 +1425,7 @@ bool ScGridWindow::TestMouse( const MouseEvent& rMEvt, bool bAction ) if (!bNewPointer && bAction) { - pViewData->ResetFillMode(); + mrViewData.ResetFillMode(); } return bNewPointer; @@ -1453,7 +1453,7 @@ void ScGridWindow::MouseButtonDown( const MouseEvent& rMEvt ) MouseEventState aState; HandleMouseButtonDown(rMEvt, aState); if (aState.mbActivatePart) - pViewData->GetView()->ActivatePart(eWhich); + mrViewData.GetView()->ActivatePart(eWhich); if ( nNestedButtonState == ScNestedButtonState::Up ) { @@ -1472,7 +1472,7 @@ void ScGridWindow::MouseButtonDown( const MouseEvent& rMEvt ) bool ScGridWindow::IsCellCoveredByText(SCCOL nPosX, SCROW nPosY, SCTAB nTab, SCCOL &rTextStartPosX) { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); // find the first non-empty cell (this, or to the left) SCCOL nNonEmptyX = nPosX; @@ -1495,14 +1495,14 @@ bool ScGridWindow::IsCellCoveredByText(SCCOL nPosX, SCROW nPosY, SCTAB nTab, SCC if (nNonEmptyX < 0 || rDoc.HasAttrib(nNonEmptyX, nPosY, nTab, nPosX, nPosY, nTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped)) return false; - double nPPTX = pViewData->GetPPTX(); - double nPPTY = pViewData->GetPPTY(); + double nPPTX = mrViewData.GetPPTX(); + double nPPTY = mrViewData.GetPPTY(); ScTableInfo aTabInfo; rDoc.FillInfo(aTabInfo, 0, nPosY, nPosX, nPosY, nTab, nPPTX, nPPTY, false, false); - Fraction aZoomX = pViewData->GetZoomX(); - Fraction aZoomY = pViewData->GetZoomY(); + Fraction aZoomX = mrViewData.GetZoomX(); + Fraction aZoomY = mrViewData.GetZoomY(); ScOutputData aOutputData(this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, 0, 0, 0, nPosY, nPosX, nPosY, nPPTX, nPPTY, &aZoomX, &aZoomY); @@ -1525,7 +1525,7 @@ bool ScGridWindow::IsCellCoveredByText(SCCOL nPosX, SCROW nPosY, SCTAB nTab, SCC // test the rightmost position of the text bounding box long nMiddle = (aRect.Top() + aRect.Bottom()) / 2; - pViewData->GetPosFromPixel(aRect.Right(), nMiddle, eWhich, nTextEndX, nTextEndY); + mrViewData.GetPosFromPixel(aRect.Right(), nMiddle, eWhich, nTextEndX, nTextEndY); if (nTextEndX >= nPosX) { rTextStartPosX = nNonEmptyX; @@ -1543,7 +1543,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta // opened by inplace client and we would deactivate the inplace client, // the context menu is closed by VCL asynchronously which in the end // would work on deleted objects or the context menu has no parent anymore) - SfxViewShell* pViewSh = pViewData->GetViewShell(); + SfxViewShell* pViewSh = mrViewData.GetViewShell(); SfxInPlaceClient* pClient = pViewSh->GetIPClient(); if ( pClient && pClient->IsObjectInPlaceActive() && @@ -1561,18 +1561,18 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta bEEMouse = false; ScModule* pScMod = SC_MOD(); - if (pScMod->IsModalMode(pViewData->GetSfxDocShell())) + if (pScMod->IsModalMode(mrViewData.GetSfxDocShell())) return; - pScActiveViewShell = pViewData->GetViewShell(); // if left is clicked + pScActiveViewShell = mrViewData.GetViewShell(); // if left is clicked nScClickMouseModifier = rMEvt.GetModifier(); // to always catch a control click - bool bDetective = pViewData->GetViewShell()->IsAuditShell(); - bool bRefMode = pViewData->IsRefMode(); // Start reference + bool bDetective = mrViewData.GetViewShell()->IsAuditShell(); + bool bRefMode = mrViewData.IsRefMode(); // Start reference bool bFormulaMode = pScMod->IsFormulaMode(); // next click -> reference - bool bEditMode = pViewData->HasEditView(eWhich); // also in Mode==SC_INPUT_TYPE + bool bEditMode = mrViewData.HasEditView(eWhich); // also in Mode==SC_INPUT_TYPE bool bDouble = (rMEvt.GetClicks() == 2); - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive(); // DeactivateIP does only happen when MarkListHasChanged @@ -1589,8 +1589,8 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta Point aPos(rMEvt.GetPosPixel()); SCCOL nPosX, nNonEmptyX(0); SCROW nPosY; - SCTAB nTab = pViewData->GetTabNo(); - pViewData->GetPosFromPixel(aPos.X(), aPos.Y(), eWhich, nPosX, nPosY); + SCTAB nTab = mrViewData.GetTabNo(); + mrViewData.GetPosFromPixel(aPos.X(), aPos.Y(), eWhich, nPosX, nPosY); ScRefCellValue aCell(rDoc, ScAddress(nPosX, nPosY, nTab)); bool bIsEmpty = aCell.isEmpty(); @@ -1602,16 +1602,16 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta // editengine, so that the text actually gets the events if (bDouble) { - ScViewFunc* pView = pViewData->GetView(); + ScViewFunc* pView = mrViewData.GetView(); pView->SetCursor(nNonEmptyX, nPosY); SC_MOD()->SetInputMode(SC_INPUT_TABLE); - bEditMode = pViewData->HasEditView(eWhich); + bEditMode = mrViewData.HasEditView(eWhich); assert(bEditMode); // synthesize the 1st click - EditView* pEditView = pViewData->GetEditView(eWhich); + EditView* pEditView = mrViewData.GetEditView(eWhich); MouseEvent aEditEvt(rMEvt.GetPosPixel(), 1, MouseEventModifiers::SYNTHETIC, MOUSE_LEFT, 0); pEditView->MouseButtonDown(aEditEvt); pEditView->MouseButtonUp(aEditEvt); @@ -1626,7 +1626,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta } } - if ( ( bEditMode && pViewData->GetActivePart() == eWhich ) || !bFormulaMode ) + if ( ( bEditMode && mrViewData.GetActivePart() == eWhich ) || !bFormulaMode ) GrabFocus(); // #i31846# need to cancel a double click if the first click has set the "ignore" state, @@ -1645,11 +1645,11 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta Point aPos = rMEvt.GetPosPixel(); SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); SfxInt16Item aPosXItem( SID_RANGE_COL, nPosX ); SfxInt32Item aPosYItem( SID_RANGE_ROW, nPosY ); - pViewData->GetDispatcher().ExecuteList(SID_FILL_SELECT, + mrViewData.GetDispatcher().ExecuteList(SID_FILL_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD, { &aPosXItem, &aPosYItem }); @@ -1666,25 +1666,25 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta if (bFormulaMode) { - ScViewSelectionEngine* pSelEng = pViewData->GetView()->GetSelEngine(); + ScViewSelectionEngine* pSelEng = mrViewData.GetView()->GetSelEngine(); pSelEng->SetWindow(this); pSelEng->SetWhich(eWhich); pSelEng->SetVisibleArea( tools::Rectangle(Point(), GetOutputSizePixel()) ); } - if (bEditMode && (pViewData->GetRefTabNo() == pViewData->GetTabNo())) + if (bEditMode && (mrViewData.GetRefTabNo() == mrViewData.GetTabNo())) { Point aPos = rMEvt.GetPosPixel(); SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); EditView* pEditView; SCCOL nEditCol; SCROW nEditRow; - pViewData->GetEditView( eWhich, pEditView, nEditCol, nEditRow ); - SCCOL nEndCol = pViewData->GetEditEndCol(); - SCROW nEndRow = pViewData->GetEditEndRow(); + mrViewData.GetEditView( eWhich, pEditView, nEditCol, nEditRow ); + SCCOL nEndCol = mrViewData.GetEditEndCol(); + SCROW nEndRow = mrViewData.GetEditEndRow(); if ( nPosX >= nEditCol && nPosX <= nEndCol && nPosY >= nEditRow && nPosY <= nEndRow ) @@ -1731,7 +1731,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta if ( bCrossPointer ) { if ( bDouble ) - pViewData->GetView()->FillCrossDblClick(); + mrViewData.GetView()->FillCrossDblClick(); else pScMod->InputEnterHandler(); // Autofill etc. } @@ -1758,7 +1758,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta return; } - pViewData->GetViewShell()->SetDrawShell( false ); // no Draw-object selected + mrViewData.GetViewShell()->SetDrawShell( false ); // no Draw-object selected // TestMouse has already happened above } @@ -1766,8 +1766,8 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta Point aPos = rMEvt.GetPosPixel(); SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); - SCTAB nTab = pViewData->GetTabNo(); + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); + SCTAB nTab = mrViewData.GetTabNo(); // FIXME: this is to limit the number of rows handled in the Online // to 1000; this will be removed again when the performance @@ -1785,7 +1785,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta { SCCOL nRealPosX; SCROW nRealPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nRealPosX, nRealPosY, false );//the real row/col + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nRealPosX, nRealPosY, false );//the real row/col const ScMergeFlagAttr* pRealPosAttr = rDoc.GetAttr( nRealPosX, nRealPosY, nTab, ATTR_MERGE_FLAG ); const ScMergeFlagAttr* pAttr = rDoc.GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG ); if( pRealPosAttr->HasAutoFilter() ) @@ -1877,13 +1877,13 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta if ( !rMEvt.IsLeft() ) return; - ScViewSelectionEngine* pSelEng = pViewData->GetView()->GetSelEngine(); + ScViewSelectionEngine* pSelEng = mrViewData.GetView()->GetSelEngine(); pSelEng->SetWindow(this); pSelEng->SetWhich(eWhich); pSelEng->SetVisibleArea( tools::Rectangle(Point(), GetOutputSizePixel()) ); // SelMouseButtonDown on the View is still setting the bMoveIsShift flag - if ( pViewData->GetView()->SelMouseButtonDown( rMEvt ) ) + if ( mrViewData.GetView()->SelMouseButtonDown( rMEvt ) ) { if (IsMouseCaptured()) { @@ -1892,7 +1892,7 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta ReleaseMouse(); StartTracking(); } - pViewData->GetMarkData().SetMarking(true); + mrViewData.GetMarkData().SetMarking(true); return; } } @@ -1900,8 +1900,8 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) { aCurMousePos = rMEvt.GetPosPixel(); - ScDocument& rDoc = pViewData->GetDocument(); - ScMarkData& rMark = pViewData->GetMarkData(); + ScDocument& rDoc = mrViewData.GetDocument(); + ScMarkData& rMark = mrViewData.GetMarkData(); // #i41690# detect a MouseButtonUp call from within MouseButtonDown // (possible through Reschedule from storing an OLE object that is deselected) @@ -1917,12 +1917,12 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) { nMouseStatus = SC_GM_NONE; // Selection engine: cancel selection - pViewData->GetView()->GetSelEngine()->Reset(); + mrViewData.GetView()->GetSelEngine()->Reset(); rMark.SetMarking(false); - if (pViewData->IsAnyFillMode()) + if (mrViewData.IsAnyFillMode()) { - pViewData->GetView()->StopRefMode(); - pViewData->ResetFillMode(); + mrViewData.GetView()->StopRefMode(); + mrViewData.ResetFillMode(); } StopMarking(); DrawEndAction(); // cancel selection/moving in drawing layer @@ -1938,16 +1938,16 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) } ScModule* pScMod = SC_MOD(); - if (pScMod->IsModalMode(pViewData->GetSfxDocShell())) + if (pScMod->IsModalMode(mrViewData.GetSfxDocShell())) return; - SfxBindings& rBindings = pViewData->GetBindings(); - if (bEEMouse && pViewData->HasEditView( eWhich )) + SfxBindings& rBindings = mrViewData.GetBindings(); + if (bEEMouse && mrViewData.HasEditView( eWhich )) { EditView* pEditView; SCCOL nEditCol; SCROW nEditRow; - pViewData->GetEditView( eWhich, pEditView, nEditCol, nEditRow ); + mrViewData.GetEditView( eWhich, pEditView, nEditCol, nEditRow ); pEditView->MouseButtonUp( rMEvt ); if ( rMEvt.IsMiddle() && @@ -1959,7 +1959,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) else pScMod->InputSelection( pEditView ); // parentheses etc. - pViewData->GetView()->InvalidateAttribs(); + mrViewData.GetView()->InvalidateAttribs(); rBindings.Invalidate( SID_HYPERLINK_GETLINK ); bEEMouse = false; return; @@ -1991,7 +1991,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) if (nMouseStatus == SC_GM_WATERUNDO) // Undo in format paintbrush mode { - SfxUndoManager* pMgr = pViewData->GetDocShell()->GetUndoManager(); + SfxUndoManager* pMgr = mrViewData.GetDocShell()->GetUndoManager(); if ( pMgr->GetUndoActionCount() && dynamic_cast<ScUndoSelectionStyle*>(pMgr->GetUndoAction()) ) pMgr->Undo(); return; @@ -1999,7 +1999,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) if (DrawMouseButtonUp(rMEvt)) // includes format paint brush handling for drawing objects { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); SfxBindings& rFrmBindings=pViewShell->GetViewFrame()->GetBindings(); rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_WIDTH); rFrmBindings.Invalidate(SID_ATTR_TRANSFORM_HEIGHT); @@ -2017,28 +2017,28 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) SetPointer( PointerStyle::Arrow ); - if (pViewData->IsFillMode() || - ( pViewData->GetFillMode() == ScFillMode::MATRIX && rMEvt.IsMod1() )) + if (mrViewData.IsFillMode() || + ( mrViewData.GetFillMode() == ScFillMode::MATRIX && rMEvt.IsMod1() )) { nScFillModeMouseModifier = rMEvt.GetModifier(); SCCOL nStartCol; SCROW nStartRow; SCCOL nEndCol; SCROW nEndRow; - pViewData->GetFillData( nStartCol, nStartRow, nEndCol, nEndRow ); + mrViewData.GetFillData( nStartCol, nStartRow, nEndCol, nEndRow ); ScRange aDelRange; - bool bIsDel = pViewData->GetDelMark( aDelRange ); + bool bIsDel = mrViewData.GetDelMark( aDelRange ); - ScViewFunc* pView = pViewData->GetView(); + ScViewFunc* pView = mrViewData.GetView(); pView->StopRefMode(); - pViewData->ResetFillMode(); + mrViewData.ResetFillMode(); pView->GetFunctionSet().SetAnchorFlag( false ); // #i5819# don't use AutoFill anchor flag for selection if ( bIsDel ) { pView->MarkRange( aDelRange, false ); pView->DeleteContents( InsertDeleteFlags::CONTENTS ); - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); ScRange aBlockRange( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab ); if ( aBlockRange != aDelRange ) { @@ -2050,43 +2050,43 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) } } else - pViewData->GetDispatcher().Execute( FID_FILL_AUTO, SfxCallMode::SLOT | SfxCallMode::RECORD ); + mrViewData.GetDispatcher().Execute( FID_FILL_AUTO, SfxCallMode::SLOT | SfxCallMode::RECORD ); } - else if (pViewData->GetFillMode() == ScFillMode::MATRIX) + else if (mrViewData.GetFillMode() == ScFillMode::MATRIX) { - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); SCCOL nStartCol; SCROW nStartRow; SCCOL nEndCol; SCROW nEndRow; - pViewData->GetFillData( nStartCol, nStartRow, nEndCol, nEndRow ); + mrViewData.GetFillData( nStartCol, nStartRow, nEndCol, nEndRow ); ScRange aBlockRange( nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab ); - SCCOL nFillCol = pViewData->GetRefEndX(); - SCROW nFillRow = pViewData->GetRefEndY(); + SCCOL nFillCol = mrViewData.GetRefEndX(); + SCROW nFillRow = mrViewData.GetRefEndY(); ScAddress aEndPos( nFillCol, nFillRow, nTab ); - ScTabView* pView = pViewData->GetView(); + ScTabView* pView = mrViewData.GetView(); pView->StopRefMode(); - pViewData->ResetFillMode(); + mrViewData.ResetFillMode(); pView->GetFunctionSet().SetAnchorFlag( false ); if ( aEndPos != aBlockRange.aEnd ) { - pViewData->GetDocShell()->GetDocFunc().ResizeMatrix( aBlockRange, aEndPos ); - pViewData->GetView()->MarkRange( ScRange( aBlockRange.aStart, aEndPos ) ); + mrViewData.GetDocShell()->GetDocFunc().ResizeMatrix( aBlockRange, aEndPos ); + mrViewData.GetView()->MarkRange( ScRange( aBlockRange.aStart, aEndPos ) ); } } - else if (pViewData->IsAnyFillMode()) + else if (mrViewData.IsAnyFillMode()) { // Embedded area has been changed - ScTabView* pView = pViewData->GetView(); + ScTabView* pView = mrViewData.GetView(); pView->StopRefMode(); - pViewData->ResetFillMode(); + mrViewData.ResetFillMode(); pView->GetFunctionSet().SetAnchorFlag( false ); - pViewData->GetDocShell()->UpdateOle(pViewData); + mrViewData.GetDocShell()->UpdateOle(&mrViewData); } - bool bRefMode = pViewData->IsRefMode(); + bool bRefMode = mrViewData.IsRefMode(); if (bRefMode) pScMod->EndReference(); @@ -2096,7 +2096,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) { // Check on undo already done above - ScStyleSheetPool* pStylePool = pViewData->GetDocument(). + ScStyleSheetPool* pStylePool = mrViewData.GetDocument(). GetStyleSheetPool(); if ( pStylePool ) { @@ -2110,17 +2110,17 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) switch ( eFamily ) { case SfxStyleFamily::Para: - pViewData->GetView()->SetStyleSheetToMarked( pStyleSheet ); - pViewData->GetView()->DoneBlockMode(); + mrViewData.GetView()->SetStyleSheetToMarked( pStyleSheet ); + mrViewData.GetView()->DoneBlockMode(); break; case SfxStyleFamily::Page: - pViewData->GetDocument().SetPageStyle( pViewData->GetTabNo(), + mrViewData.GetDocument().SetPageStyle( mrViewData.GetTabNo(), pStyleSheet->GetName() ); - ScPrintFunc( pViewData->GetDocShell(), - pViewData->GetViewShell()->GetPrinter(true), - pViewData->GetTabNo() ).UpdatePages(); + ScPrintFunc( mrViewData.GetDocShell(), + mrViewData.GetViewShell()->GetPrinter(true), + mrViewData.GetTabNo() ).UpdatePages(); rBindings.Invalidate( SID_STATUS_PAGESTYLE ); break; @@ -2132,7 +2132,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) } } - ScDBFunc* pView = pViewData->GetView(); + ScDBFunc* pView = mrViewData.GetView(); ScDocument* pBrushDoc = pView->GetBrushDocument(); if ( pBrushDoc ) { @@ -2155,12 +2155,12 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) Point aPos = rMEvt.GetPosPixel(); SCCOL nPosX; SCROW nPosY; - SCTAB nTab = pViewData->GetTabNo(); - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); + SCTAB nTab = mrViewData.GetTabNo(); + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); ScDPObject* pDPObj = rDoc.GetDPAtCursor( nPosX, nPosY, nTab ); if ( pDPObj && pDPObj->GetSaveData()->GetDrillDown() ) { - ScAddress aCellPos( nPosX, nPosY, pViewData->GetTabNo() ); + ScAddress aCellPos( nPosX, nPosY, mrViewData.GetTabNo() ); // Check for header drill-down first. sheet::DataPilotTableHeaderData aData; @@ -2173,16 +2173,16 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) if ( pView->HasSelectionForDrillDown( nDummy ) ) { // execute slot to show dialog - pViewData->GetDispatcher().Execute( SID_OUTLINE_SHOW, SfxCallMode::SLOT | SfxCallMode::RECORD ); + mrViewData.GetDispatcher().Execute( SID_OUTLINE_SHOW, SfxCallMode::SLOT | SfxCallMode::RECORD ); } else { // toggle single entry ScDPObject aNewObj( *pDPObj ); pDPObj->ToggleDetails( aData, &aNewObj ); - ScDBDocFunc aFunc( *pViewData->GetDocShell() ); + ScDBDocFunc aFunc( *mrViewData.GetDocShell() ); aFunc.DataPilotUpdate( pDPObj, &aNewObj, true, false ); - pViewData->GetView()->CursorPosChanged(); // shells may be switched + mrViewData.GetView()->CursorPosChanged(); // shells may be switched } } else @@ -2191,7 +2191,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) Sequence<sheet::DataPilotFieldFilter> aFilters; if ( pDPObj->GetDataFieldPositionData(aCellPos, aFilters) ) - pViewData->GetView()->ShowDataPilotSourceData( *pDPObj, aFilters ); + mrViewData.GetView()->ShowDataPilotSourceData( *pDPObj, aFilters ); } return; @@ -2220,27 +2220,27 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) // case we used the double-click to select the empty cell if (bIsTiledRendering && bDouble) { - ScRefCellValue aCell(pViewData->GetDocument(), ScAddress(nPosX, nPosY, nTab)); + ScRefCellValue aCell(mrViewData.GetDocument(), ScAddress(nPosX, nPosY, nTab)); if (aCell.isEmpty()) return; } // edit cell contents - pViewData->GetViewShell()->UpdateInputHandler(); + mrViewData.GetViewShell()->UpdateInputHandler(); pScMod->SetInputMode( SC_INPUT_TABLE ); - if (pViewData->HasEditView(eWhich)) + if (mrViewData.HasEditView(eWhich)) { // Set text cursor where clicked ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits