diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-09-24 16:19:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-09-25 20:47:45 +0200 |
commit | bb124949140ce37f081340168f64a69b8bc5668b (patch) | |
tree | 98c4249770189c06baae31ba585566283f7d9de2 /sc | |
parent | e2cea687d4275c31b780bfe8307daed552e45da0 (diff) |
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 <caolanm@redhat.com>
Diffstat (limited to 'sc')
38 files changed, 893 insertions, 898 deletions
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 - 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 ); } } - if ( bIsTiledRendering && rMEvt.IsLeft() && pViewData->GetView()->GetSelEngine()->SelMouseButtonUp( rMEvt ) ) + if ( bIsTiledRendering && rMEvt.IsLeft() && mrViewData.GetView()->GetSelEngine()->SelMouseButtonUp( rMEvt ) ) { - pViewData->GetView()->SelectionChanged(); + mrViewData.GetView()->SelectionChanged(); } if ( bDouble ) @@ -2269,14 +2269,14 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) } // On a mobile device view there is no ctrl+click and for hyperlink popup // the cell coordinates must be sent along with click position for elegance - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); if (isTiledRendering && pViewShell && (pViewShell->isLOKMobilePhone() || pViewShell->isLOKTablet())) { 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 ); auto pForTabView = dynamic_cast<const ScTabViewShell *>(pViewShell); OString aCursor = pForTabView->GetViewData().describeCellCursorAt(nPosX, nPosY); double fPPTX = pForTabView->GetViewData().GetPPTX(); @@ -2331,14 +2331,14 @@ 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 ); OUString sURL; ScRefCellValue aCell; if (lcl_GetHyperlinkCell(rDoc, nPosX, nPosY, nTab, aCell, sURL)) { ScAddress aCellPos( nPosX, nPosY, nTab ); - uno::Reference< table::XCell > xCell( new ScCellObj( pViewData->GetDocShell(), aCellPos ) ); + uno::Reference< table::XCell > xCell( new ScCellObj( mrViewData.GetDocShell(), aCellPos ) ); uno::Sequence< uno::Any > aArgs(1); aArgs[0] <<= xCell; xVbaEvents->processVbaEvent( script::vba::VBAEventId::WORKSHEET_FOLLOWHYPERLINK, aArgs ); @@ -2357,12 +2357,12 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) // SelMouseButtonDown is called only for left button, but SelMouseButtonUp would return // sal_True for any call, so IsLeft must be checked here, too. - if ( !(rMEvt.IsLeft() && pViewData->GetView()->GetSelEngine()->SelMouseButtonUp( rMEvt )) ) + if ( !(rMEvt.IsLeft() && mrViewData.GetView()->GetSelEngine()->SelMouseButtonUp( rMEvt )) ) return; - pViewData->GetView()->SelectionChanged(); + mrViewData.GetView()->SelectionChanged(); - SfxDispatcher* pDisp = pViewData->GetViewShell()->GetDispatcher(); + SfxDispatcher* pDisp = mrViewData.GetViewShell()->GetDispatcher(); bool bFormulaMode = pScMod->IsFormulaMode(); OSL_ENSURE( pDisp || bFormulaMode, "Cursor moved on inactive View ?" ); @@ -2389,7 +2389,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) } else // only move cursor { - ScAddress aScAddress( pViewData->GetCurX(), pViewData->GetCurY(), 0 ); + ScAddress aScAddress( mrViewData.GetCurX(), mrViewData.GetCurY(), 0 ); aAddr = aScAddress.Format(ScRefFlags::ADDR_ABS); } @@ -2402,10 +2402,10 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) SfxCallMode::SLOT | SfxCallMode::RECORD, { &aPosItem, &aAlignCursorItem }); - pViewData->GetView()->InvalidateAttribs(); + mrViewData.GetView()->InvalidateAttribs(); } - pViewData->GetViewShell()->SelectionChanged(); + mrViewData.GetViewShell()->SelectionChanged(); return; } @@ -2427,7 +2427,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) HideNoteMarker(); ScModule* pScMod = SC_MOD(); - if (pScMod->IsModalMode(pViewData->GetSfxDocShell())) + if (pScMod->IsModalMode(mrViewData.GetSfxDocShell())) return; // If the Drag&Drop is started in the edit mode then sadly nothing else is kept @@ -2445,7 +2445,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) if (nMouseStatus == SC_GM_WATERUNDO) // Undo in format paintbrush mode -> only what for Up return; - if ( pViewData->GetViewShell()->IsAuditShell() ) // Detective Fill Mode + if ( mrViewData.GetViewShell()->IsAuditShell() ) // Detective Fill Mode { SetPointer( PointerStyle::Fill ); return; @@ -2466,12 +2466,12 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) bool bFormulaMode = pScMod->IsFormulaMode(); // next click -> reference - if (bEEMouse && pViewData->HasEditView( eWhich )) + if (bEEMouse && mrViewData.HasEditView( eWhich )) { EditView* pEditView; SCCOL nEditCol; SCROW nEditRow; - pViewData->GetEditView( eWhich, pEditView, nEditCol, nEditRow ); + mrViewData.GetEditView( eWhich, pEditView, nEditCol, nEditRow ); pEditView->MouseMove( rMEvt ); return; } @@ -2496,22 +2496,22 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) // Show other mouse pointer? - bool bEditMode = pViewData->HasEditView(eWhich); + bool bEditMode = mrViewData.HasEditView(eWhich); //! Test if refMode dragging !!! - 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 ) @@ -2544,7 +2544,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) } } - bool bWater = SC_MOD()->GetIsWaterCan() || pViewData->GetView()->HasPaintBrush(); + bool bWater = SC_MOD()->GetIsWaterCan() || mrViewData.GetView()->HasPaintBrush(); if (bWater) SetPointer( PointerStyle::Fill ); @@ -2566,7 +2566,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) // Page-Break-Mode - if ( !nButtonDown && pViewData->IsPagebreakMode() ) + if ( !nButtonDown && mrViewData.IsPagebreakMode() ) { sal_uInt16 nBreakType = HitPageBreak( rMEvt.GetPosPixel(), nullptr, nullptr, nullptr ); if (nBreakType != 0 ) @@ -2604,7 +2604,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) if (TestMouse( rMEvt, false )) bCross = true; - if ( nButtonDown && pViewData->IsAnyFillMode() ) + if ( nButtonDown && mrViewData.IsAnyFillMode() ) { SetPointer( PointerStyle::Cross ); bCross = true; @@ -2625,7 +2625,7 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) } } - if ( pViewData->GetView()->GetSelEngine()->SelMouseMove( rMEvt ) ) + if ( mrViewData.GetView()->GetSelEngine()->SelMouseMove( rMEvt ) ) return; } @@ -2662,9 +2662,9 @@ bool ScGridWindow::PreNotify( NotifyEvent& rNEvt ) if ( nType == MouseNotifyEvent::MOUSEBUTTONUP || nType == MouseNotifyEvent::MOUSEBUTTONDOWN ) { vcl::Window* pWindow = rNEvt.GetWindow(); - if (pWindow == this && pViewData) + if (pWindow == this) { - SfxViewFrame* pViewFrame = pViewData->GetViewShell()->GetViewFrame(); + SfxViewFrame* pViewFrame = mrViewData.GetViewShell()->GetViewFrame(); if (pViewFrame) { css::uno::Reference<css::frame::XController> xController = pViewFrame->GetFrame().GetController(); @@ -2714,7 +2714,7 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt ) if ( rTEvt.IsTrackingCanceled() ) // Cancel everything... { - if (!pViewData->GetView()->IsInActivatePart() && !SC_MOD()->IsRefDialogOpen()) + if (!mrViewData.GetView()->IsInActivatePart() && !SC_MOD()->IsRefDialogOpen()) { if (bDPMouse) bDPMouse = false; // Paint for each bDragRect @@ -2739,7 +2739,7 @@ void ScGridWindow::Tracking( const TrackingEvent& rTEvt ) StopMarking(); MouseButtonUp( rMEvt ); // With status SC_GM_IGNORE from StopMarking - bool bRefMode = pViewData->IsRefMode(); + bool bRefMode = mrViewData.IsRefMode(); if (bRefMode) SC_MOD()->EndReference(); // Do not let the Dialog remain minimized } @@ -2768,12 +2768,12 @@ void ScGridWindow::StartDrag( sal_Int8 /* nAction */, const Point& rPosPixel ) CommandEvent aDragEvent( rPosPixel, CommandEventId::StartDrag, true ); - if (bEEMouse && pViewData->HasEditView( eWhich )) + if (bEEMouse && mrViewData.HasEditView( eWhich )) { EditView* pEditView; SCCOL nEditCol; SCROW nEditRow; - pViewData->GetEditView( eWhich, pEditView, nEditCol, nEditRow ); + mrViewData.GetEditView( eWhich, pEditView, nEditCol, nEditRow ); // don't remove the edit view while switching views ScModule* pScMod = SC_MOD(); @@ -2786,10 +2786,10 @@ void ScGridWindow::StartDrag( sal_Int8 /* nAction */, const Point& rPosPixel ) pHdl->DataChanged(); pScMod->SetInEditCommand( false ); - if (!pViewData->IsActive()) // dropped to different view? + if (!mrViewData.IsActive()) // dropped to different view? { - ScInputHandler* pViewHdl = pScMod->GetInputHdl( pViewData->GetViewShell() ); - if ( pViewHdl && pViewData->HasEditView( eWhich ) ) + ScInputHandler* pViewHdl = pScMod->GetInputHdl( mrViewData.GetViewShell() ); + if ( pViewHdl && mrViewData.HasEditView( eWhich ) ) { pViewHdl->CancelHandler(); ShowCursor(); // missing from KillEditView @@ -2798,14 +2798,14 @@ void ScGridWindow::StartDrag( sal_Int8 /* nAction */, const Point& rPosPixel ) } else if ( !DrawCommand(aDragEvent) ) - pViewData->GetView()->GetSelEngine()->Command( aDragEvent ); + mrViewData.GetView()->GetSelEngine()->Command( aDragEvent ); } -static void lcl_SetTextCursorPos( ScViewData* pViewData, ScSplitPos eWhich, vcl::Window* pWin ) +static void lcl_SetTextCursorPos( ScViewData& rViewData, ScSplitPos eWhich, vcl::Window* pWin ) { - SCCOL nCol = pViewData->GetCurX(); - SCROW nRow = pViewData->GetCurY(); - tools::Rectangle aEditArea = pViewData->GetEditArea( eWhich, nCol, nRow, pWin, nullptr, true ); + SCCOL nCol = rViewData.GetCurX(); + SCROW nRow = rViewData.GetCurY(); + tools::Rectangle aEditArea = rViewData.GetEditArea( eWhich, nCol, nRow, pWin, nullptr, true ); aEditArea.SetRight( aEditArea.Left() ); aEditArea = pWin->PixelToLogic( aEditArea ); pWin->SetCursorRect( &aEditArea ); @@ -2818,7 +2818,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) // deactivate the inplace client without any problem regarding parent // windows and code on the stack. CommandEventId nCmd = rCEvt.GetCommand(); - ScTabViewShell* pTabViewSh = pViewData->GetViewShell(); + ScTabViewShell* pTabViewSh = mrViewData.GetViewShell(); SfxInPlaceClient* pClient = pTabViewSh->GetIPClient(); if ( pClient && pClient->IsObjectInPlaceActive() && @@ -2843,11 +2843,11 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) nCmd == CommandEventId::CursorPos || nCmd == CommandEventId::QueryCharPosition ) { - bool bEditView = pViewData->HasEditView( eWhich ); + bool bEditView = mrViewData.HasEditView( eWhich ); if (!bEditView) { // only if no cell editview is active, look at drawview - SdrView* pSdrView = pViewData->GetView()->GetScDrawView(); + SdrView* pSdrView = mrViewData.GetView()->GetScDrawView(); if ( pSdrView ) { OutlinerView* pOlView = pSdrView->GetTextEditOutlinerView(); @@ -2866,11 +2866,11 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) // -> input mode must not be started, // manually calculate text insert position if not in input mode - lcl_SetTextCursorPos( pViewData, eWhich, this ); + lcl_SetTextCursorPos( mrViewData, eWhich, this ); return; } - ScInputHandler* pHdl = pScMod->GetInputHdl( pViewData->GetViewShell() ); + ScInputHandler* pHdl = pScMod->GetInputHdl( mrViewData.GetViewShell() ); if ( pHdl ) { pHdl->InputCommand( rCEvt ); @@ -2900,7 +2900,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) // #i55929# Font and font size state depends on input language if nothing is selected, // so the slots have to be invalidated when the input language is changed. - SfxBindings& rBindings = pViewData->GetBindings(); + SfxBindings& rBindings = mrViewData.GetBindings(); rBindings.Invalidate( SID_ATTR_CHAR_FONT ); rBindings.Invalidate( SID_ATTR_CHAR_FONTHEIGHT ); return; @@ -2908,14 +2908,14 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) if ( nCmd == CommandEventId::Wheel || nCmd == CommandEventId::StartAutoScroll || nCmd == CommandEventId::AutoScroll ) { - bool bDone = pViewData->GetView()->ScrollCommand( rCEvt, eWhich ); + bool bDone = mrViewData.GetView()->ScrollCommand( rCEvt, eWhich ); if (!bDone) Window::Command(rCEvt); return; } // #i7560# FormulaMode check is below scrolling - scrolling is allowed during formula input bool bDisable = pScMod->IsFormulaMode() || - pScMod->IsModalMode(pViewData->GetSfxDocShell()); + pScMod->IsModalMode(mrViewData.GetSfxDocShell()); if (bDisable) return; @@ -2926,10 +2926,10 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) if ( bMouse && nMouseStatus == SC_GM_IGNORE ) return; - if (pViewData->IsAnyFillMode()) + if (mrViewData.IsAnyFillMode()) { - pViewData->GetView()->StopRefMode(); - pViewData->ResetFillMode(); + mrViewData.GetView()->StopRefMode(); + mrViewData.ResetFillMode(); } ReleaseMouse(); StopMarking(); @@ -2939,15 +2939,15 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) SCCOL nCellX = -1; SCROW nCellY = -1; - pViewData->GetPosFromPixel(aPosPixel.X(), aPosPixel.Y(), eWhich, nCellX, nCellY); + mrViewData.GetPosFromPixel(aPosPixel.X(), aPosPixel.Y(), eWhich, nCellX, nCellY); bool bSpellError = false; SCCOL nColSpellError = nCellX; if ( bMouse ) { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); const ScTableProtection* pProtect = rDoc.GetTabProtection(nTab); bool bSelectAllowed = true; if ( pProtect && pProtect->isProtected() ) @@ -2998,7 +2998,7 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) } bool bDone = false; - bool bEdit = pViewData->HasEditView(eWhich); + bool bEdit = mrViewData.HasEditView(eWhich); if ( !bEdit ) { @@ -3008,14 +3008,14 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) // GetEditUrlOrError has already moved the Cursor pScMod->SetInputMode( SC_INPUT_TABLE ); - bEdit = pViewData->HasEditView(eWhich); // Did it work? + bEdit = mrViewData.HasEditView(eWhich); // Did it work? OSL_ENSURE( bEdit, "Can not be switched in edit mode" ); } } if ( bEdit ) { - EditView* pEditView = pViewData->GetEditView( eWhich ); // is then not 0 + EditView* pEditView = mrViewData.GetEditView( eWhich ); // is then not 0 if ( !bMouse ) { @@ -3055,21 +3055,21 @@ void ScGridWindow::Command( const CommandEvent& rCEvt ) else if ( !bMouse ) { // non-edit menu by keyboard -> use lower right of cell cursor position - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTabNo = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTabNo = mrViewData.GetTabNo(); bool bLayoutIsRTL = rDoc.IsLayoutRTL(nTabNo); - SCCOL nCurX = pViewData->GetCurX(); - SCROW nCurY = pViewData->GetCurY(); - aMenuPos = pViewData->GetScrPos( nCurX, nCurY, eWhich, true ); + SCCOL nCurX = mrViewData.GetCurX(); + SCROW nCurY = mrViewData.GetCurY(); + aMenuPos = mrViewData.GetScrPos( nCurX, nCurY, eWhich, true ); long nSizeXPix; long nSizeYPix; - pViewData->GetMergeSizePixel( nCurX, nCurY, nSizeXPix, nSizeYPix ); + mrViewData.GetMergeSizePixel( nCurX, nCurY, nSizeXPix, nSizeYPix ); // fdo#55432 take the correct position for RTL sheet aMenuPos.AdjustX(bLayoutIsRTL ? -nSizeXPix : nSizeXPix ); aMenuPos.AdjustY(nSizeYPix ); - ScTabViewShell* pViewSh = pViewData->GetViewShell(); + ScTabViewShell* pViewSh = mrViewData.GetViewShell(); if (pViewSh) { // Is a draw object selected? @@ -3096,25 +3096,25 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S // the cursor is moved or an object at the click position selected. // (see SwEditWin::SelectMenuPosition in Writer) - ScTabView* pView = pViewData->GetView(); + ScTabView* pView = mrViewData.GetView(); ScDrawView* pDrawView = pView->GetScDrawView(); // check cell edit mode - if ( pViewData->HasEditView(eWhich) ) + if ( mrViewData.HasEditView(eWhich) ) { ScModule* pScMod = SC_MOD(); - SCCOL nEditStartCol = pViewData->GetEditViewCol(); //! change to GetEditStartCol after calcrtl is integrated - SCROW nEditStartRow = pViewData->GetEditViewRow(); - SCCOL nEditEndCol = pViewData->GetEditEndCol(); - SCROW nEditEndRow = pViewData->GetEditEndRow(); + SCCOL nEditStartCol = mrViewData.GetEditViewCol(); //! change to GetEditStartCol after calcrtl is integrated + SCROW nEditStartRow = mrViewData.GetEditViewRow(); + SCCOL nEditEndCol = mrViewData.GetEditEndCol(); + SCROW nEditEndRow = mrViewData.GetEditEndRow(); if ( nCellX >= nEditStartCol && nCellX <= nEditEndCol && nCellY >= nEditStartRow && nCellY <= nEditEndRow ) { // handle selection within the EditView - EditView* pEditView = pViewData->GetEditView( eWhich ); // not NULL (HasEditView) + EditView* pEditView = mrViewData.GetEditView( eWhich ); // not NULL (HasEditView) EditEngine* pEditEngine = pEditView->GetEditEngine(); tools::Rectangle aOutputArea = pEditView->GetOutputArea(); tools::Rectangle aVisArea = pEditView->GetVisArea(); @@ -3212,7 +3212,7 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S // clicked on selected object -> don't change anything bHitSelected = true; } - else if ( pViewData->GetMarkData().IsCellMarked(nCellX, nCellY) ) + else if ( mrViewData.GetMarkData().IsCellMarked(nCellX, nCellY) ) { // clicked on selected cell -> don't change anything bHitSelected = true; @@ -3230,7 +3230,7 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S pDrawView->UnmarkAllObj(); // Unlock the Internal Layer in order to activate the context menu. // re-lock in ScDrawView::MarkListHasChanged() - lcl_UnLockComment( pDrawView, aLogicPos ,pViewData); + lcl_UnLockComment(pDrawView, aLogicPos, mrViewData); bHitDraw = pDrawView->MarkObj( aLogicPos ); // draw shell is activated in MarkListHasChanged } @@ -3239,7 +3239,7 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S pView->Unmark(); pView->SetCursor(nCellX, nCellY); if ( bWasDraw ) - pViewData->GetViewShell()->SetDrawShell( false ); // switch shells + mrViewData.GetViewShell()->SetDrawShell( false ); // switch shells } } @@ -3274,7 +3274,7 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) } else if (rKeyCode.GetCode() == KEY_F7) { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); auto& rMapper = rDoc.GetExternalDataMapper(); for (auto& itr : rMapper.getDataSources()) { @@ -3292,20 +3292,20 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) { SC_MOD()->EndReference(); } - else if( pViewData->GetViewShell()->MoveCursorKeyInput( rKEvt ) ) + else if( mrViewData.GetViewShell()->MoveCursorKeyInput( rKEvt ) ) { ScRange aRef( - pViewData->GetRefStartX(), pViewData->GetRefStartY(), pViewData->GetRefStartZ(), - pViewData->GetRefEndX(), pViewData->GetRefEndY(), pViewData->GetRefEndZ() ); - SC_MOD()->SetReference( aRef, pViewData->GetDocument() ); + mrViewData.GetRefStartX(), mrViewData.GetRefStartY(), mrViewData.GetRefStartZ(), + mrViewData.GetRefEndX(), mrViewData.GetRefEndY(), mrViewData.GetRefEndZ() ); + SC_MOD()->SetReference( aRef, mrViewData.GetDocument() ); } - pViewData->GetViewShell()->SelectionChanged(); + mrViewData.GetViewShell()->SelectionChanged(); return ; } - else if( rKeyCode.GetCode() == KEY_RETURN && pViewData->IsPasteMode() ) + else if( rKeyCode.GetCode() == KEY_RETURN && mrViewData.IsPasteMode() ) { - ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); - ScClipUtil::PasteFromClipboard( pViewData, pTabViewShell, true ); + ScTabViewShell* pTabViewShell = mrViewData.GetViewShell(); + ScClipUtil::PasteFromClipboard( &mrViewData, pTabViewShell, true ); // Clear clipboard content. uno::Reference<datatransfer::clipboard::XClipboard> xSystemClipboard = @@ -3318,26 +3318,26 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) } // hide the border around the copy source - pViewData->SetPasteMode( ScPasteFlags::NONE ); + mrViewData.SetPasteMode( ScPasteFlags::NONE ); // Clear CopySourceOverlay in each window of a split/frozen tabview - pViewData->GetView()->UpdateCopySourceOverlay(); + mrViewData.GetView()->UpdateCopySourceOverlay(); return; } // if semi-modeless SfxChildWindow dialog above, then no KeyInputs: - else if( !pViewData->IsAnyFillMode() ) + else if( !mrViewData.IsAnyFillMode() ) { if (rKeyCode.GetCode() == KEY_ESCAPE) { - pViewData->SetPasteMode( ScPasteFlags::NONE ); + mrViewData.SetPasteMode( ScPasteFlags::NONE ); // Clear CopySourceOverlay in each window of a split/frozen tabview - pViewData->GetView()->UpdateCopySourceOverlay(); + mrViewData.GetView()->UpdateCopySourceOverlay(); } // query for existing note marker before calling ViewShell's keyboard handling // which may remove the marker bool bHadKeyMarker = mpNoteMarker && mpNoteMarker->IsByKeyboard(); - ScTabViewShell* pViewSh = pViewData->GetViewShell(); + ScTabViewShell* pViewSh = mrViewData.GetViewShell(); - if (pViewData->GetDocShell()->GetProgress()) + if (mrViewData.GetDocShell()->GetProgress()) return; if (DrawKeyInput(rKEvt)) @@ -3348,7 +3348,7 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) || rLclKeyCode.GetCode() == KEY_LEFT || rLclKeyCode.GetCode() == KEY_RIGHT) { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); SfxBindings& rBindings = pViewShell->GetViewFrame()->GetBindings(); rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_X); rBindings.Invalidate(SID_ATTR_TRANSFORM_POS_Y); @@ -3356,7 +3356,7 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) return; } - if (!pViewData->GetView()->IsDrawSelMode() && !DrawHasMarkedObj()) // No entries in draw mode + if (!mrViewData.GetView()->IsDrawSelMode() && !DrawHasMarkedObj()) // No entries in draw mode { //! check DrawShell !!! if (pViewSh->TabKeyInput(rKEvt)) return; @@ -3382,7 +3382,7 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt) if ( bHadKeyMarker ) HideNoteMarker(); // hide when previously visible else - ShowNoteMarker( pViewData->GetCurX(), pViewData->GetCurY(), true ); + ShowNoteMarker( mrViewData.GetCurX(), mrViewData.GetCurY(), true ); return; } if (aCode.GetCode() == KEY_BRACKETLEFT && aCode.GetModifier() == KEY_MOD1) @@ -3407,14 +3407,14 @@ void ScGridWindow::StopMarking() if (nButtonDown) { - pViewData->GetMarkData().SetMarking(false); + mrViewData.GetMarkData().SetMarking(false); nMouseStatus = SC_GM_IGNORE; } } void ScGridWindow::UpdateInputContext() { - bool bReadOnly = pViewData->GetDocShell()->IsReadOnly(); + bool bReadOnly = mrViewData.GetDocShell()->IsReadOnly(); InputContextFlags nOptions = bReadOnly ? InputContextFlags::NONE : ( InputContextFlags::Text | InputContextFlags::ExtText ); // when font from InputContext is used, @@ -3430,34 +3430,34 @@ void ScGridWindow::UpdateInputContext() void ScGridWindow::DropScroll( const Point& rMousePos ) { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); SCCOL nDx = 0; SCROW nDy = 0; Size aSize = GetOutputSizePixel(); if (aSize.Width() > SCROLL_SENSITIVE * 3) { - if ( rMousePos.X() < SCROLL_SENSITIVE && pViewData->GetPosX(WhichH(eWhich)) > 0 ) + if ( rMousePos.X() < SCROLL_SENSITIVE && mrViewData.GetPosX(WhichH(eWhich)) > 0 ) nDx = -1; if ( rMousePos.X() >= aSize.Width() - SCROLL_SENSITIVE - && pViewData->GetPosX(WhichH(eWhich)) < rDoc.MaxCol() ) + && mrViewData.GetPosX(WhichH(eWhich)) < rDoc.MaxCol() ) nDx = 1; } if (aSize.Height() > SCROLL_SENSITIVE * 3) { - if ( rMousePos.Y() < SCROLL_SENSITIVE && pViewData->GetPosY(WhichV(eWhich)) > 0 ) + if ( rMousePos.Y() < SCROLL_SENSITIVE && mrViewData.GetPosY(WhichV(eWhich)) > 0 ) nDy = -1; if ( rMousePos.Y() >= aSize.Height() - SCROLL_SENSITIVE - && pViewData->GetPosY(WhichV(eWhich)) < rDoc.MaxRow() ) + && mrViewData.GetPosY(WhichV(eWhich)) < rDoc.MaxRow() ) nDy = 1; } if ( nDx != 0 || nDy != 0 ) { if ( nDx != 0 ) - pViewData->GetView()->ScrollX( nDx, WhichH(eWhich) ); + mrViewData.GetView()->ScrollX( nDx, WhichH(eWhich) ); if ( nDy != 0 ) - pViewData->GetView()->ScrollY( nDy, WhichV(eWhich) ); + mrViewData.GetView()->ScrollY( nDy, WhichV(eWhich) ); } } @@ -3535,11 +3535,11 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt ) Point aPos = rEvt.maPosPixel; ScDocument* pSourceDoc = rData.pCellTransfer->GetSourceDocument(); - ScDocument& rThisDoc = pViewData->GetDocument(); + ScDocument& rThisDoc = mrViewData.GetDocument(); if (pSourceDoc == &rThisDoc) { OUString aName; - if ( rThisDoc.HasChartAtPoint(pViewData->GetTabNo(), PixelToLogic(aPos), aName )) + if ( rThisDoc.HasChartAtPoint(mrViewData.GetTabNo(), PixelToLogic(aPos), aName )) { if (bDragRect) // Remove rectangle { @@ -3562,7 +3562,7 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt ) SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); ScRange aSourceRange = rData.pCellTransfer->GetRange(); SCCOL nSourceStartX = aSourceRange.aStart.Col(); @@ -3585,7 +3585,7 @@ sal_Int8 ScGridWindow::AcceptPrivateDrop( const AcceptDropEvent& rEvt ) nNewDragY = rThisDoc.MaxRow()-(nSizeY-1); // don't break scenario ranges, don't drop on filtered - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); ScRange aDropRange = lcl_MakeDropRange( rThisDoc, nNewDragX, nNewDragY, nTab, aSourceRange ); if ( lcl_TestScenarioRedliningDrop( &rThisDoc, aDropRange ) || lcl_TestScenarioRedliningDrop( pSourceDoc, aSourceRange ) || @@ -3736,10 +3736,10 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt ) return rEvt.mnAction; } - if ( pViewData->GetDocShell()->IsReadOnly() ) + if ( mrViewData.GetDocShell()->IsReadOnly() ) return DND_ACTION_NONE; - ScDocument& rThisDoc = pViewData->GetDocument(); + ScDocument& rThisDoc = mrViewData.GetDocument(); sal_Int8 nRet = DND_ACTION_NONE; if (rData.pCellTransfer) @@ -3756,7 +3756,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt ) if ( !rData.aLinkDoc.isEmpty() ) { OUString aThisName; - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocShell* pDocSh = mrViewData.GetDocShell(); if (pDocSh && pDocSh->HasName()) aThisName = pDocSh->GetMedium()->GetName(); @@ -3768,7 +3768,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt ) // internal bookmarks (from Navigator) // local jumps from an unnamed document are possible only within a document - if ( !rData.pJumpLocalDoc || rData.pJumpLocalDoc == &pViewData->GetDocument() ) + if ( !rData.pJumpLocalDoc || rData.pJumpLocalDoc == &mrViewData.GetDocument() ) nRet = rEvt.mnAction; } else @@ -3788,7 +3788,7 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt ) nMyAction = DND_ACTION_COPY; SdrObject* pHitObj = rThisDoc.GetObjectAtPoint( - pViewData->GetTabNo(), PixelToLogic(rEvt.maPosPixel) ); + mrViewData.GetTabNo(), PixelToLogic(rEvt.maPosPixel) ); if ( pHitObj && nMyAction == DND_ACTION_LINK ) { if ( IsDropFormatSupported(SotClipboardFormatId::SVXB) @@ -3872,9 +3872,9 @@ sal_Int8 ScGridWindow::AcceptDrop( const AcceptDropEvent& rEvt ) Point aPos = rEvt.maPosPixel; SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); - SCTAB nTab = pViewData->GetTabNo(); - ScDocument& rDoc = pViewData->GetDocument(); + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); + SCTAB nTab = mrViewData.GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); ScEditableTester aTester( rDoc, nTab, nPosX,nPosY, nPosX,nPosY ); if ( !aTester.IsFormatEditable() ) @@ -4028,10 +4028,10 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos return 0; ScDocument* pSourceDoc = pTransObj->GetSourceDocument(); - ScDocShell* pDocSh = pViewData->GetDocShell(); - ScDocument& rThisDoc = pViewData->GetDocument(); - ScViewFunc* pView = pViewData->GetView(); - SCTAB nThisTab = pViewData->GetTabNo(); + ScDocShell* pDocSh = mrViewData.GetDocShell(); + ScDocument& rThisDoc = mrViewData.GetDocument(); + ScViewFunc* pView = mrViewData.GetView(); + SCTAB nThisTab = mrViewData.GetTabNo(); ScDragSrc nFlags = pTransObj->GetDragSourceFlags(); bool bIsNavi = (nFlags & ScDragSrc::Navigator) == ScDragSrc::Navigator; @@ -4094,7 +4094,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos if ( rThisDoc.IsDocEditable() ) { SCTAB nSrcTab = aSource.aStart.Tab(); - pViewData->GetDocShell()->MoveTable( nSrcTab, nThisTab, !bIsMove, true ); // with Undo + mrViewData.GetDocShell()->MoveTable( nSrcTab, nThisTab, !bIsMove, true ); // with Undo pView->SetTabNo( nThisTab, true ); bDone = true; } @@ -4108,7 +4108,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos SfxStringItem aNameItem( SID_CHART_NAME, aChartName ); SfxStringItem aRangeItem( SID_CHART_SOURCE, aRangeName ); sal_uInt16 nId = bIsMove ? SID_CHART_SOURCE : SID_CHART_ADDSOURCE; - pViewData->GetDispatcher().ExecuteList(nId, + mrViewData.GetDispatcher().ExecuteList(nId, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD, { &aRangeItem, &aNameItem }); bDone = true; @@ -4119,7 +4119,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos ScAddress aDestPos( nDestPosX, nDestPosY, nThisTab ); if ( aDestPos != aSource.aStart ) - bDone = pViewData->GetView()->DataPilotMove( aSource, aDestPos ); + bDone = mrViewData.GetView()->DataPilotMove( aSource, aDestPos ); else bDone = true; // same position: nothing } @@ -4127,7 +4127,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos nSourceTab != nThisTab ) { OUString aUndo = ScResId( bIsMove ? STR_UNDO_MOVE : STR_UNDO_COPY ); - pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pViewData->GetViewShell()->GetViewShellId() ); + pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, mrViewData.GetViewShell()->GetViewShellId() ); SCCOL nCorrectCursorPosCol = 0; SCROW nCorrectCursorPosRow = 0; @@ -4156,7 +4156,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos nCorrectCursorPosCol = nSizeX; } } - pDocSh->UpdateOle( pViewData ); + pDocSh->UpdateOle( &mrViewData ); pView->CellContentChanged(); } } @@ -4202,7 +4202,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos ScRange aErrorRange( ScAddress::UNINITIALIZED ); bDone = aDest.Move( -nSizeX, 0, 0, aErrorRange, &rThisDoc ); } - pDocSh->UpdateOle( pViewData ); + pDocSh->UpdateOle( &mrViewData ); pView->CellContentChanged(); } } @@ -4281,7 +4281,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos if (pSourceSh) { OUString aUndo = ScResId( STR_UNDO_COPY ); - pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pViewData->GetViewShell()->GetViewShellId() ); + pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, mrViewData.GetViewShell()->GetViewShellId() ); bDone = true; if ( meDragInsertMode != INS_NONE ) @@ -4290,7 +4290,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos bDone = pDocSh->GetDocFunc().InsertCells( aDest, nullptr, meDragInsertMode, true /*bRecord*/, true /*bApi*/, true /*bPartOfPaste*/ ); if ( bDone ) { - pDocSh->UpdateOle( pViewData ); + pDocSh->UpdateOle( &mrViewData ); pView->CellContentChanged(); } } @@ -4341,7 +4341,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos //! or don't start dragging on a part of a matrix OUString aUndo = ScResId( bIsMove ? STR_UNDO_MOVE : STR_UNDO_COPY ); - pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pViewData->GetViewShell()->GetViewShellId() ); + pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, mrViewData.GetViewShell()->GetViewShellId() ); bDone = true; if ( meDragInsertMode != INS_NONE ) @@ -4350,7 +4350,7 @@ sal_Int8 ScGridWindow::DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPos bDone = pDocSh->GetDocFunc().InsertCells( aDest, nullptr, meDragInsertMode, true /*bRecord*/, true /*bApi*/, true /*bPartOfPaste*/ ); if ( bDone ) { - pDocSh->UpdateOle( pViewData ); + pDocSh->UpdateOle( &mrViewData ); pView->CellContentChanged(); } } @@ -4395,7 +4395,7 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) bool bOk = true; OUString aThisName; - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocShell* pDocSh = mrViewData.GetDocShell(); if (pDocSh && pDocSh->HasName()) aThisName = pDocSh->GetMedium()->GetName(); @@ -4403,7 +4403,7 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) bOk = false; else { - ScViewFunc* pView = pViewData->GetView(); + ScViewFunc* pView = mrViewData.GetView(); if ( !rData.aLinkTable.isEmpty() ) pView->InsertTableLink( rData.aLinkDoc, EMPTY_OUSTRING, EMPTY_OUSTRING, rData.aLinkTable ); @@ -4411,7 +4411,7 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) { SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); pView->MoveCursorAbs( nPosX, nPosY, SC_FOLLOW_NONE, false, false ); pView->InsertAreaLink( rData.aLinkDoc, EMPTY_OUSTRING, EMPTY_OUSTRING, @@ -4439,7 +4439,7 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) bPasteIsMove = bIsMove; - pViewData->GetView()->PasteDraw( + mrViewData.GetView()->PasteDraw( aLogicPos, rData.pDrawTransfer->GetModel(), false, "A", "B"); if (bPasteIsMove) @@ -4451,28 +4451,28 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); if (!rData.aJumpTarget.isEmpty()) { // internal bookmark (from Navigator) // bookmark clipboard formats are in PasteScDataObject - if ( !rData.pJumpLocalDoc || rData.pJumpLocalDoc == &pViewData->GetDocument() ) + if ( !rData.pJumpLocalDoc || rData.pJumpLocalDoc == &mrViewData.GetDocument() ) { - pViewData->GetViewShell()->InsertBookmark( rData.aJumpText, rData.aJumpTarget, + mrViewData.GetViewShell()->InsertBookmark( rData.aJumpText, rData.aJumpTarget, nPosX, nPosY ); return rEvt.mnAction; } } - ScDocument& rThisDoc = pViewData->GetDocument(); - SdrObject* pHitObj = rThisDoc.GetObjectAtPoint( pViewData->GetTabNo(), PixelToLogic(aPos) ); + ScDocument& rThisDoc = mrViewData.GetDocument(); + SdrObject* pHitObj = rThisDoc.GetObjectAtPoint( mrViewData.GetTabNo(), PixelToLogic(aPos) ); if ( pHitObj && bIsLink ) { // dropped on drawing object // PasteOnDrawObjectLinked checks for valid formats - if ( pViewData->GetView()->PasteOnDrawObjectLinked( rEvt.maDropEvent.Transferable, *pHitObj ) ) + if ( mrViewData.GetView()->PasteOnDrawObjectLinked( rEvt.maDropEvent.Transferable, *pHitObj ) ) return rEvt.mnAction; } @@ -4484,7 +4484,7 @@ sal_Int8 ScGridWindow::ExecuteDrop( const ExecuteDropEvent& rEvt ) if ( nFormatId != SotClipboardFormatId::NONE ) { pScMod->SetInExecuteDrop( true ); // #i28468# prevent error messages from PasteDataFormat - bDone = pViewData->GetView()->PasteDataFormat( + bDone = mrViewData.GetView()->PasteDataFormat( nFormatId, rEvt.maDropEvent.Transferable, nPosX, nPosY, &aLogicPos, bIsLink ); pScMod->SetInExecuteDrop( false ); } @@ -4499,11 +4499,11 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel ) SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( rPosPixel.X(), rPosPixel.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( rPosPixel.X(), rPosPixel.Y(), eWhich, nPosX, nPosY ); // If the mouse down was inside a visible note window, ignore it and // leave it up to the ScPostIt to handle it - SdrView* pDrawView = pViewData->GetViewShell()->GetScDrawView(); + SdrView* pDrawView = mrViewData.GetViewShell()->GetScDrawView(); if (pDrawView) { const size_t nCount = pDrawView->GetMarkedObjectCount(); @@ -4537,9 +4537,9 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel ) { // bSameDocClipboard argument for PasteDraw is needed // because only DragData is checked directly inside PasteDraw - pViewData->GetView()->PasteDraw( + mrViewData.GetView()->PasteDraw( aLogicPos, pDrawTransfer->GetModel(), false, - pDrawTransfer->GetShellID(), SfxObjectShell::CreateShellID(pViewData->GetDocShell())); + pDrawTransfer->GetShellID(), SfxObjectShell::CreateShellID(mrViewData.GetDocShell())); } } } @@ -4553,35 +4553,35 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel ) { SotClipboardFormatId nFormatId = lcl_GetDropFormatId( xTransferable, true ); if ( nFormatId != SotClipboardFormatId::NONE ) - pViewData->GetView()->PasteDataFormat( nFormatId, xTransferable, nPosX, nPosY, &aLogicPos ); + mrViewData.GetView()->PasteDataFormat( nFormatId, xTransferable, nPosX, nPosY, &aLogicPos ); } } } void ScGridWindow::UpdateEditViewPos() { - if (!pViewData->HasEditView(eWhich)) + if (!mrViewData.HasEditView(eWhich)) return; EditView* pView; SCCOL nCol; SCROW nRow; - pViewData->GetEditView( eWhich, pView, nCol, nRow ); - SCCOL nEndCol = pViewData->GetEditEndCol(); - SCROW nEndRow = pViewData->GetEditEndRow(); + mrViewData.GetEditView( eWhich, pView, nCol, nRow ); + SCCOL nEndCol = mrViewData.GetEditEndCol(); + SCROW nEndRow = mrViewData.GetEditEndRow(); // hide EditView? - bool bHide = ( nEndCol<pViewData->GetPosX(eHWhich) || nEndRow<pViewData->GetPosY(eVWhich) ); + bool bHide = ( nEndCol<mrViewData.GetPosX(eHWhich) || nEndRow<mrViewData.GetPosY(eVWhich) ); if ( SC_MOD()->IsFormulaMode() ) - if ( pViewData->GetTabNo() != pViewData->GetRefTabNo() ) + if ( mrViewData.GetTabNo() != mrViewData.GetRefTabNo() ) bHide = true; if (bHide) { tools::Rectangle aRect = pView->GetOutputArea(); long nHeight = aRect.Bottom() - aRect.Top(); - aRect.SetTop( PixelToLogic(GetOutputSizePixel(), pViewData->GetLogicMode()). + aRect.SetTop( PixelToLogic(GetOutputSizePixel(), mrViewData.GetLogicMode()). Height() * 2 ); aRect.SetBottom( aRect.Top() + nHeight ); pView->SetOutputArea( aRect ); @@ -4590,20 +4590,20 @@ void ScGridWindow::UpdateEditViewPos() else { // bForceToTop = sal_True for editing - tools::Rectangle aPixRect = pViewData->GetEditArea( eWhich, nCol, nRow, this, nullptr, true ); + tools::Rectangle aPixRect = mrViewData.GetEditArea( eWhich, nCol, nRow, this, nullptr, true ); if (comphelper::LibreOfficeKit::isActive() && comphelper::LibreOfficeKit::isCompatFlagSet( comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs)) { - tools::Rectangle aPTwipsRect = pViewData->GetEditArea(eWhich, nCol, nRow, this, nullptr, + tools::Rectangle aPTwipsRect = mrViewData.GetEditArea(eWhich, nCol, nRow, this, nullptr, true, true /* bInPrintTwips */); tools::Rectangle aOutputAreaPTwips = pView->GetLOKSpecialOutputArea(); aOutputAreaPTwips.SetPos(aPTwipsRect.TopLeft()); pView->SetLOKSpecialOutputArea(aOutputAreaPTwips); } - Point aScrPos = PixelToLogic( aPixRect.TopLeft(), pViewData->GetLogicMode() ); + Point aScrPos = PixelToLogic( aPixRect.TopLeft(), mrViewData.GetLogicMode() ); tools::Rectangle aRect = pView->GetOutputArea(); aRect.SetPos( aScrPos ); @@ -4630,7 +4630,7 @@ void ScGridWindow::ScrollPixel( long nDifX, long nDifY ) void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2) { - if (pViewData->GetView()->IsMinimized()) + if (mrViewData.GetView()->IsMinimized()) return; if ( nPaintCount ) @@ -4645,7 +4645,7 @@ void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2) if ( comphelper::LibreOfficeKit::isActive() ) { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); if (nX1 < 0) nX1 = pViewShell->GetLOKStartHeaderCol() + 1; if (nY1 < 0) @@ -4659,16 +4659,16 @@ void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2) } else { - nX1 = pViewData->GetPosX( eHWhich ); - nY1 = pViewData->GetPosY( eVWhich ); - nX2 = nX1 + pViewData->VisibleCellsX( eHWhich ); - nY2 = nY1 + pViewData->VisibleCellsY( eVWhich ); + nX1 = mrViewData.GetPosX( eHWhich ); + nY1 = mrViewData.GetPosY( eVWhich ); + nX2 = nX1 + mrViewData.VisibleCellsX( eHWhich ); + nY2 = nY1 + mrViewData.VisibleCellsY( eVWhich ); } if (nX2 < nX1) nX2 = nX1; if (nY2 < nY1) nY2 = nY1; - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); if (nX2 > rDoc.MaxCol()) nX2 = rDoc.MaxCol(); if (nY2 > rDoc.MaxRow()) nY2 = rDoc.MaxRow(); @@ -4679,19 +4679,19 @@ void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2) SCROW nPosY = nY1; - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); if ( !comphelper::LibreOfficeKit::isActive() ) { rDoc.ExtendHidden( nX1, nY1, nX2, nY2, nTab ); } - Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); + Point aScrPos = mrViewData.GetScrPos( nX1, nY1, eWhich ); long nMirrorWidth = GetSizePixel().Width(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); if ( bLayoutRTL ) { - long nEndPixel = pViewData->GetScrPos( nX2+1, nPosY, eWhich ).X(); + long nEndPixel = mrViewData.GetScrPos( nX2+1, nPosY, eWhich ).X(); nMirrorWidth = aScrPos.X() - nEndPixel; aScrPos.setX( nEndPixel + 1 ); } @@ -4699,14 +4699,14 @@ void ScGridWindow::UpdateFormulas(SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2) long nScrX = aScrPos.X(); long nScrY = aScrPos.Y(); - double nPPTX = pViewData->GetPPTX(); - double nPPTY = pViewData->GetPPTY(); + double nPPTX = mrViewData.GetPPTX(); + double nPPTY = mrViewData.GetPPTY(); ScTableInfo aTabInfo; rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, 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, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); @@ -4739,7 +4739,7 @@ void ScGridWindow::UpdateAutoFillMark(bool bMarked, const ScRange& rMarkRange) void ScGridWindow::updateLOKInputHelp(const OUString& title, const OUString& content) const { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); boost::property_tree::ptree aTree; aTree.put("title", title); @@ -4756,7 +4756,7 @@ void ScGridWindow::updateLOKValListButton( bool bVisible, const ScAddress& rPos SCROW nY = rPos.Row(); std::stringstream ss; ss << nX << ", " << nY << ", " << static_cast<unsigned int>(bVisible); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_VALIDITY_LIST_BUTTON, ss.str().c_str()); } @@ -4812,7 +4812,7 @@ void ScGridWindow::ShowCursor() void ScGridWindow::GetFocus() { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); pViewShell->SetFormShellAtTop( false ); // focus in GridWindow -> FormShell no longer on top if (pViewShell->HasAccessibilityObjects()) @@ -4826,13 +4826,13 @@ void ScGridWindow::GetFocus() // -> GetFocus/MouseButtonDown order on Mac } - pViewData->GetDocShell()->CheckConfigOptions(); + mrViewData.GetDocShell()->CheckConfigOptions(); Window::GetFocus(); } void ScGridWindow::LoseFocus() { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); if (pViewShell && pViewShell->HasAccessibilityObjects()) pViewShell->BroadcastAccessibility(ScAccGridWinFocusLostHint(eWhich)); @@ -4844,29 +4844,29 @@ bool ScGridWindow::HitRangeFinder( const Point& rMouse, RfCorner& rCorner, sal_uInt16* pIndex, SCCOL* pAddX, SCROW* pAddY) { bool bFound = false; - ScInputHandler* pHdl = SC_MOD()->GetInputHdl( pViewData->GetViewShell() ); + ScInputHandler* pHdl = SC_MOD()->GetInputHdl( mrViewData.GetViewShell() ); if (pHdl) { ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList(); if ( pRangeFinder && !pRangeFinder->IsHidden() && - pRangeFinder->GetDocName() == pViewData->GetDocShell()->GetTitle() ) + pRangeFinder->GetDocName() == mrViewData.GetDocShell()->GetTitle() ) { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); long nLayoutSign = bLayoutRTL ? -1 : 1; SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( rMouse.X(), rMouse.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( rMouse.X(), rMouse.Y(), eWhich, nPosX, nPosY ); // merged (single/Range) ??? ScAddress aAddr( nPosX, nPosY, nTab ); - Point aCellStart = pViewData->GetScrPos( nPosX, nPosY, eWhich, true ); + Point aCellStart = mrViewData.GetScrPos( nPosX, nPosY, eWhich, true ); Point aCellEnd = aCellStart; long nSizeXPix; long nSizeYPix; - pViewData->GetMergeSizePixel( nPosX, nPosY, nSizeXPix, nSizeYPix ); + mrViewData.GetMergeSizePixel( nPosX, nPosY, nSizeXPix, nSizeYPix ); aCellEnd.AdjustX(nSizeXPix * nLayoutSign ); aCellEnd.AdjustY(nSizeYPix ); @@ -5078,7 +5078,7 @@ static void lcl_PaintRefChanged( ScDocShell* pDocSh, const ScRange& rOldUn, cons void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp ) { - ScInputHandler* pHdl = SC_MOD()->GetInputHdl( pViewData->GetViewShell() ); + ScInputHandler* pHdl = SC_MOD()->GetInputHdl( mrViewData.GetViewShell() ); if (!pHdl) return; ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList(); @@ -5108,31 +5108,31 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp ) nDy = 1; if ( nDx != 0 || nDy != 0 ) { - if ( nDx != 0) pViewData->GetView()->ScrollX( nDx, WhichH(eWhich) ); - if ( nDy != 0 ) pViewData->GetView()->ScrollY( nDy, WhichV(eWhich) ); + if ( nDx != 0) mrViewData.GetView()->ScrollX( nDx, WhichH(eWhich) ); + if ( nDy != 0 ) mrViewData.GetView()->ScrollY( nDy, WhichV(eWhich) ); bTimer = true; } // Switching when fixating (so Scrolling works) - if ( eWhich == pViewData->GetActivePart() ) //?? + if ( eWhich == mrViewData.GetActivePart() ) //?? { - if ( pViewData->GetHSplitMode() == SC_SPLIT_FIX ) + if ( mrViewData.GetHSplitMode() == SC_SPLIT_FIX ) if ( nDx > 0 ) { if ( eWhich == SC_SPLIT_TOPLEFT ) - pViewData->GetView()->ActivatePart( SC_SPLIT_TOPRIGHT ); + mrViewData.GetView()->ActivatePart( SC_SPLIT_TOPRIGHT ); else if ( eWhich == SC_SPLIT_BOTTOMLEFT ) - pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ); + mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ); } - if ( pViewData->GetVSplitMode() == SC_SPLIT_FIX ) + if ( mrViewData.GetVSplitMode() == SC_SPLIT_FIX ) if ( nDy > 0 ) { if ( eWhich == SC_SPLIT_TOPLEFT ) - pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMLEFT ); + mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMLEFT ); else if ( eWhich == SC_SPLIT_TOPRIGHT ) - pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ); + mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ); } } @@ -5140,7 +5140,7 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp ) SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); ScRange aOld = rData.aRef; ScRange aNew = aOld; @@ -5170,7 +5170,7 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp ) } else { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); long nStartX = nPosX - nRFAddX; if ( nStartX < 0 ) nStartX = 0; long nStartY = nPosY - nRFAddY; @@ -5201,7 +5201,7 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp ) { pHdl->UpdateRange( nRFIndex, aNew ); - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocShell* pDocSh = mrViewData.GetDocShell(); pHdl->UpdateLokReferenceMarks(); @@ -5217,9 +5217,9 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp ) // Timer for Scrolling if (bTimer) - pViewData->GetView()->SetTimer( this, rMEvt ); // repeat event + mrViewData.GetView()->SetTimer( this, rMEvt ); // repeat event else - pViewData->GetView()->ResetTimer(); + mrViewData.GetView()->ResetTimer(); } namespace { @@ -5293,7 +5293,7 @@ bool extractURLInfo( const SvxFieldItem* pFieldItem, OUString* pName, OUString* bool ScGridWindow::GetEditUrl( const Point& rPos, OUString* pName, OUString* pUrl, OUString* pTarget ) { - ScTabViewShell* pViewSh = pViewData->GetViewShell(); + ScTabViewShell* pViewSh = mrViewData.GetViewShell(); ScInputHandler* pInputHdl = nullptr; if (pViewSh) pInputHdl = pViewSh->GetInputHandler(); @@ -5304,10 +5304,10 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, //! Pass on nPosX/Y? SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( rPos.X(), rPos.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( rPos.X(), rPos.Y(), eWhich, nPosX, nPosY ); - SCTAB nTab = pViewData->GetTabNo(); - ScDocShell* pDocSh = pViewData->GetDocShell(); + SCTAB nTab = mrViewData.GetTabNo(); + ScDocShell* pDocSh = mrViewData.GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); OUString sURL; ScRefCellValue aCell; @@ -5317,7 +5317,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, const ScPatternAttr* pPattern = rDoc.GetPattern( nPosX, nPosY, nTab ); // bForceToTop = sal_False, use the cell's real position - tools::Rectangle aEditRect = pViewData->GetEditArea( eWhich, nPosX, nPosY, this, pPattern, false ); + tools::Rectangle aEditRect = mrViewData.GetEditArea( eWhich, nPosX, nPosY, this, pPattern, false ); if (rPos.Y() < aEditRect.Top()) return false; @@ -5334,7 +5334,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, std::shared_ptr<ScFieldEditEngine> pEngine = createEditEngine(pDocSh, *pPattern); - MapMode aEditMode = pViewData->GetLogicMode(eWhich); // without draw scaling + MapMode aEditMode = mrViewData.GetLogicMode(eWhich); // without draw scaling tools::Rectangle aLogicEdit = PixelToLogic( aEditRect, aEditMode ); long nThisColLogic = aLogicEdit.Right() - aLogicEdit.Left() + 1; Size aPaperSize( 1000000, 1000000 ); @@ -5342,7 +5342,7 @@ bool ScGridWindow::GetEditUrl( const Point& rPos, { long nSizeX = 0; long nSizeY = 0; - pViewData->GetMergeSizePixel( nPosX, nPosY, nSizeX, nSizeY ); + mrViewData.GetMergeSizePixel( nPosX, nPosY, nSizeX, nSizeY ); aPaperSize = Size(nSizeX, nSizeY ); aPaperSize = PixelToLogic(aPaperSize); } @@ -5434,8 +5434,8 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCROW nRow if (!mpSpellCheckCxt) return false; - SCTAB nTab = pViewData->GetTabNo(); - ScDocShell* pDocSh = pViewData->GetDocShell(); + SCTAB nTab = mrViewData.GetTabNo(); + ScDocShell* pDocSh = mrViewData.GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); ScAddress aCellPos(nCol1, nRow, nTab); @@ -5449,7 +5449,7 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCROW nRow const ScPatternAttr* pPattern = rDoc.GetPattern(nCol1, nRow, nTab); - tools::Rectangle aEditRect = pViewData->GetEditArea(eWhich, nCol1, nRow, this, pPattern, false); + tools::Rectangle aEditRect = mrViewData.GetEditArea(eWhich, nCol1, nRow, this, pPattern, false); if (rPos.Y() < aEditRect.Top()) return false; @@ -5465,7 +5465,7 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCROW nRow long nTextWidth = static_cast<long>(pEngine->CalcTextWidth()); - MapMode aEditMode = pViewData->GetLogicMode(eWhich); + MapMode aEditMode = mrViewData.GetLogicMode(eWhich); tools::Rectangle aLogicEdit = PixelToLogic(aEditRect, aEditMode); Point aLogicClick = PixelToLogic(rPos, aEditMode); @@ -5485,19 +5485,19 @@ bool ScGridWindow::IsSpellErrorAtPos( const Point& rPos, SCCOL nCol1, SCROW nRow bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange ) { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); SCTAB nTabCount = rDoc.GetTableCount(); if ( nTab+1<nTabCount && rDoc.IsScenario(nTab+1) && !rDoc.IsScenario(nTab) ) { bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); - Size aButSize = pViewData->GetScenButSize(); + Size aButSize = mrViewData.GetScenButSize(); long nBWidth = aButSize.Width(); if (!nBWidth) return false; // No Button drawn yet -> there is none long nBHeight = aButSize.Height(); - long nHSpace = static_cast<long>( SC_SCENARIO_HSPACE * pViewData->GetPPTX() ); + long nHSpace = static_cast<long>( SC_SCENARIO_HSPACE * mrViewData.GetPPTX() ); //! cache the Ranges in Table!!!! @@ -5520,12 +5520,12 @@ bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRang Point aButtonPos; if ( bTextBelow ) { - aButtonPos = pViewData->GetScrPos( aRange.aEnd.Col()+1, aRange.aEnd.Row()+1, + aButtonPos = mrViewData.GetScrPos( aRange.aEnd.Col()+1, aRange.aEnd.Row()+1, eWhich, true ); } else { - aButtonPos = pViewData->GetScrPos( aRange.aEnd.Col()+1, aRange.aStart.Row(), + aButtonPos = mrViewData.GetScrPos( aRange.aEnd.Col()+1, aRange.aStart.Row(), eWhich, true ); aButtonPos.AdjustY( -nBHeight ); } @@ -5582,16 +5582,16 @@ bool ScGridWindow::ContinueOnlineSpelling() if (!mpSpellCheckCxt->maPos.isValid()) return false; - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); ScDPCollection* pDPs = nullptr; if (rDoc.HasPivotTable()) pDPs = rDoc.GetDPCollection(); - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); SpellCheckStatus aStatus; ScHorizontalCellIterator aIter( - &rDoc, nTab, maVisibleRange.mnCol1, mpSpellCheckCxt->maPos.mnRow, maVisibleRange.mnCol2, maVisibleRange.mnRow2); + rDoc, nTab, maVisibleRange.mnCol1, mpSpellCheckCxt->maPos.mnRow, maVisibleRange.mnCol2, maVisibleRange.mnRow2); ScRangeList aPivotRanges = pDPs ? pDPs->GetAllTableRanges(nTab) : ScRangeList(); @@ -5790,23 +5790,23 @@ OString ScGridWindow::getCellCursor() const if (comphelper::LibreOfficeKit::isCompatFlagSet( comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs)) - return pViewData->describeCellCursorInPrintTwips(); + return mrViewData.describeCellCursorInPrintTwips(); - return pViewData->describeCellCursor(); + return mrViewData.describeCellCursor(); } void ScGridWindow::notifyKitCellCursor() const { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, getCellCursor().getStr()); - if (bListValButton && aListValPos == pViewData->GetCurPos()) + if (bListValButton && aListValPos == mrViewData.GetCurPos()) updateLOKValListButton(true, aListValPos); } void ScGridWindow::notifyKitCellViewCursor(const SfxViewShell* pForShell) const { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); if (pViewShell->GetDocId() != pForShell->GetDocId()) return; @@ -5820,10 +5820,10 @@ void ScGridWindow::notifyKitCellViewCursor(const SfxViewShell* pForShell) const if (comphelper::LibreOfficeKit::isCompatFlagSet( comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs)) - aCursor = pViewData->describeCellCursorInPrintTwips(); + aCursor = mrViewData.describeCellCursorInPrintTwips(); else aCursor = pForTabView->GetViewData().describeCellCursorAt( - pViewData->GetCurX(), pViewData->GetCurY()); // our position. + mrViewData.GetCurX(), mrViewData.GetCurY()); // our position. } SfxLokHelper::notifyOtherView(pViewShell, pForShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", aCursor); } @@ -5839,7 +5839,7 @@ void ScGridWindow::updateKitCellCursor(const SfxViewShell* pForShell) const if (comphelper::LibreOfficeKit::isCompatFlagSet( comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs)) { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); // Generate the cursor info string just once and directly send to all. // Calling notifyKitCellViewCursor() would regenerate the // cursor-string unnecessarily. @@ -5868,7 +5868,7 @@ void ScGridWindow::updateKitCellCursor(const SfxViewShell* pForShell) const return; } - if (pForShell == pViewData->GetViewShell()) + if (pForShell == mrViewData.GetViewShell()) notifyKitCellCursor(); else notifyKitCellViewCursor(pForShell); @@ -5887,7 +5887,7 @@ void ScGridWindow::updateKitOtherCursors() const if (pGrid == this) notifyKitCellCursor(); else - pGrid->notifyKitCellViewCursor(pViewData->GetViewShell()); + pGrid->notifyKitCellViewCursor(mrViewData.GetViewShell()); } } @@ -5931,7 +5931,7 @@ void ScGridWindow::UpdateAllOverlays() void ScGridWindow::DeleteCursorOverlay() { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_CURSOR, "EMPTY"); SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_CELL_VIEW_CURSOR, "rectangle", "EMPTY"); mpOOCursors.reset(); @@ -5953,19 +5953,19 @@ void ScGridWindow::UpdateCopySourceOverlay() if (comphelper::LibreOfficeKit::isActive()) return; - if (!pViewData->ShowPasteSource()) + if (!mrViewData.ShowPasteSource()) return; rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager(); if (!xOverlayManager.is()) return; - const ScTransferObj* pTransObj = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pViewData->GetActiveWin())); + const ScTransferObj* pTransObj = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(mrViewData.GetActiveWin())); if (!pTransObj) return; ScDocument* pClipDoc = pTransObj->GetDocument(); if (!pClipDoc) return; - SCTAB nCurTab = pViewData->GetCurPos().Tab(); + SCTAB nCurTab = mrViewData.GetCurPos().Tab(); ScClipParam& rClipParam = pClipDoc->GetClipParam(); mpOOSelectionBorder.reset(new sdr::overlay::OverlayObjectList); @@ -5980,8 +5980,8 @@ void ScGridWindow::UpdateCopySourceOverlay() SCCOL nClipEndX = r.aEnd.Col(); SCROW nClipEndY = r.aEnd.Row(); - Point aClipStartScrPos = pViewData->GetScrPos( nClipStartX, nClipStartY, eWhich ); - Point aClipEndScrPos = pViewData->GetScrPos( nClipEndX + 1, nClipEndY + 1, eWhich ); + Point aClipStartScrPos = mrViewData.GetScrPos( nClipStartX, nClipStartY, eWhich ); + Point aClipEndScrPos = mrViewData.GetScrPos( nClipEndX + 1, nClipEndY + 1, eWhich ); aClipStartScrPos -= Point(1, 1); long nSizeXPix = aClipEndScrPos.X() - aClipStartScrPos.X(); long nSizeYPix = aClipEndScrPos.Y() - aClipStartScrPos.Y(); @@ -6002,14 +6002,14 @@ void ScGridWindow::UpdateCopySourceOverlay() } static std::vector<tools::Rectangle> convertPixelToLogical( - const ScViewData* pViewData, + const ScViewData& rViewData, const std::vector<tools::Rectangle>& rRectangles, tools::Rectangle &rBoundingBox) { std::vector<tools::Rectangle> aLogicRects; - double nPPTX = pViewData->GetPPTX(); - double nPPTY = pViewData->GetPPTY(); + double nPPTX = rViewData.GetPPTX(); + double nPPTY = rViewData.GetPPTY(); for (const auto& rRectangle : rRectangles) { @@ -6064,7 +6064,7 @@ void ScGridWindow::UpdateKitSelection(const std::vector<tools::Rectangle>& rRect std::for_each(rRectangles.begin(), rRectangles.end(), [&aBoundingBox](const tools::Rectangle& rRect) { aBoundingBox.Union(rRect); }); else - aConvertedRects = convertPixelToLogical(pViewData, rRectangles, aBoundingBox); + aConvertedRects = convertPixelToLogical(mrViewData, rRectangles, aBoundingBox); const std::vector<tools::Rectangle>& rLogicRects = bInPrintTwips ? rRectangles : aConvertedRects; if (pLogicRects) @@ -6073,7 +6073,7 @@ void ScGridWindow::UpdateKitSelection(const std::vector<tools::Rectangle>& rRect return; } - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); OString sBoundingBoxString = "EMPTY"; if (!aBoundingBox.IsEmpty()) sBoundingBoxString = aBoundingBox.toString(); @@ -6103,8 +6103,8 @@ void ScGridWindow::UpdateKitSelection(const std::vector<tools::Rectangle>& rRect // Fetch pixels & convert for each view separately. tools::Rectangle aDummyBBox; std::vector<tools::Rectangle> aPixelRects; - pGrid->GetPixelRectsFor(pViewData->GetMarkData() /* ours */, aPixelRects); - auto aOtherLogicRects = convertPixelToLogical(&pOther->GetViewData(), aPixelRects, aDummyBBox); + pGrid->GetPixelRectsFor(mrViewData.GetMarkData() /* ours */, aPixelRects); + auto aOtherLogicRects = convertPixelToLogical(pOther->GetViewData(), aPixelRects, aDummyBBox); SfxLokHelper::notifyOtherView(pViewShell, pOther, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", rectanglesToString(aOtherLogicRects).getStr()); } @@ -6116,7 +6116,7 @@ void ScGridWindow::UpdateKitSelection(const std::vector<tools::Rectangle>& rRect */ void ScGridWindow::updateOtherKitSelections() const { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); bool bInPrintTwips = comphelper::LibreOfficeKit::isCompatFlagSet( comphelper::LibreOfficeKit::Compat::scPrintTwipsMsgs); @@ -6140,7 +6140,7 @@ void ScGridWindow::updateOtherKitSelections() const } else aRectsString = rectanglesToString( - convertPixelToLogical(&pViewShell->GetViewData(), aRects, aBoundingBox)); + convertPixelToLogical(pViewShell->GetViewData(), aRects, aBoundingBox)); if (it == pViewShell) { @@ -6160,13 +6160,13 @@ void ScGridWindow::updateOtherKitSelections() const namespace { -void updateLibreOfficeKitAutoFill(const ScViewData* pViewData, tools::Rectangle const & rRectangle) +void updateLibreOfficeKitAutoFill(const ScViewData& rViewData, tools::Rectangle const & rRectangle) { if (!comphelper::LibreOfficeKit::isActive()) return; - double nPPTX = pViewData->GetPPTX(); - double nPPTY = pViewData->GetPPTY(); + double nPPTX = rViewData.GetPPTX(); + double nPPTY = rViewData.GetPPTY(); OString sRectangleString = "EMPTY"; if (!rRectangle.IsEmpty()) @@ -6178,7 +6178,7 @@ void updateLibreOfficeKitAutoFill(const ScViewData* pViewData, tools::Rectangle sRectangleString = aLogicRectangle.toString(); } - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = rViewData.GetViewShell(); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_AUTO_FILL_AREA, sRectangleString.getStr()); } @@ -6186,7 +6186,7 @@ void updateLibreOfficeKitAutoFill(const ScViewData* pViewData, tools::Rectangle void ScGridWindow::UpdateCursorOverlay() { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); MapMode aDrawMode = GetDrawMapMode(); MapMode aOldMode = GetMapMode(); @@ -6202,9 +6202,9 @@ void ScGridWindow::UpdateCursorOverlay() // determine the cursor rectangles in pixels (moved from ScGridWindow::DrawCursor) - SCTAB nTab = pViewData->GetTabNo(); - SCCOL nX = pViewData->GetCurX(); - SCROW nY = pViewData->GetCurY(); + SCTAB nTab = mrViewData.GetTabNo(); + SCCOL nX = mrViewData.GetCurX(); + SCROW nY = mrViewData.GetCurY(); const ScPatternAttr* pPattern = rDoc.GetPattern(nX,nY,nTab); @@ -6231,7 +6231,7 @@ void ScGridWindow::UpdateCursorOverlay() bool bOverlapped = rMergeFlag.IsOverlapped(); // left or above of the screen? - bool bVis = comphelper::LibreOfficeKit::isActive() || ( nX>=pViewData->GetPosX(eHWhich) && nY>=pViewData->GetPosY(eVWhich) ); + bool bVis = comphelper::LibreOfficeKit::isActive() || ( nX>=mrViewData.GetPosX(eHWhich) && nY>=mrViewData.GetPosY(eVWhich) ); if (!bVis) { SCCOL nEndX = nX; @@ -6241,12 +6241,12 @@ void ScGridWindow::UpdateCursorOverlay() nEndX += rMerge.GetColMerge()-1; if (rMerge.GetRowMerge() > 1) nEndY += rMerge.GetRowMerge()-1; - bVis = ( nEndX>=pViewData->GetPosX(eHWhich) && nEndY>=pViewData->GetPosY(eVWhich) ); + bVis = ( nEndX>=mrViewData.GetPosX(eHWhich) && nEndY>=mrViewData.GetPosY(eVWhich) ); } - if ( bVis && !bOverlapped && !pViewData->HasEditView(eWhich) && pViewData->IsActive() ) + if ( bVis && !bOverlapped && !mrViewData.HasEditView(eWhich) && mrViewData.IsActive() ) { - Point aScrPos = pViewData->GetScrPos( nX, nY, eWhich, true ); + Point aScrPos = mrViewData.GetScrPos( nX, nY, eWhich, true ); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); // completely right of/below the screen? @@ -6265,7 +6265,7 @@ void ScGridWindow::UpdateCursorOverlay() { long nSizeXPix; long nSizeYPix; - pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); + mrViewData.GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); if (bLayoutRTL) aScrPos.AdjustX( -(nSizeXPix - 2) ); // move instead of mirroring @@ -6319,7 +6319,7 @@ void ScGridWindow::UpdateCursorOverlay() if (xOverlayManager.is()) { Color aCursorColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); - if (pViewData->GetActivePart() != eWhich) + if (mrViewData.GetActivePart() != eWhich) // non-active pane uses a different color. aCursorColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor; std::vector< basegfx::B2DRange > aRanges; @@ -6382,7 +6382,7 @@ void ScGridWindow::UpdateSelectionOverlay() else GetSelectionRects(aRects); - if (!aRects.empty() && pViewData->IsActive()) + if (!aRects.empty() && mrViewData.IsActive()) { // #i70788# get the OverlayManager safely rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager(); @@ -6395,8 +6395,8 @@ void ScGridWindow::UpdateSelectionOverlay() { std::vector< basegfx::B2DRange > aRanges; const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); for(const tools::Rectangle & rRA : aRects) @@ -6432,7 +6432,7 @@ void ScGridWindow::UpdateSelectionOverlay() } else { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_TEXT_SELECTION, "EMPTY"); pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CELL_SELECTION_AREA, "EMPTY"); SfxLokHelper::notifyOtherViews(pViewShell, LOK_CALLBACK_TEXT_VIEW_SELECTION, "selection", "EMPTY"); @@ -6466,8 +6466,8 @@ void ScGridWindow::UpdateAutoFillOverlay() // get the AutoFill handle rectangle in pixels - if ( !(bAutoMarkVisible && aAutoMarkPos.Tab() == pViewData->GetTabNo() && - !pViewData->HasEditView(eWhich) && pViewData->IsActive()) ) + if ( !(bAutoMarkVisible && aAutoMarkPos.Tab() == mrViewData.GetTabNo() && + !mrViewData.HasEditView(eWhich) && mrViewData.IsActive()) ) return; SCCOL nX = aAutoMarkPos.Col(); @@ -6479,18 +6479,18 @@ void ScGridWindow::UpdateAutoFillOverlay() return; } - SCTAB nTab = pViewData->GetTabNo(); - ScDocument& rDoc = pViewData->GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); float fScaleFactor = GetDPIScaleFactor(); // Size should be even Size aFillHandleSize(6 * fScaleFactor, 6 * fScaleFactor); - Point aFillPos = pViewData->GetScrPos( nX, nY, eWhich, true ); + Point aFillPos = mrViewData.GetScrPos( nX, nY, eWhich, true ); long nSizeXPix; long nSizeYPix; - pViewData->GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); + mrViewData.GetMergeSizePixel( nX, nY, nSizeXPix, nSizeYPix ); if (bLayoutRTL) aFillPos.AdjustX( -(nSizeXPix - 2 + (aFillHandleSize.Width() / 2)) ); @@ -6510,12 +6510,12 @@ void ScGridWindow::UpdateAutoFillOverlay() rtl::Reference<sdr::overlay::OverlayManager> xOverlayManager = getOverlayManager(); if (comphelper::LibreOfficeKit::isActive()) // notify the LibreOfficeKit { - updateLibreOfficeKitAutoFill(pViewData, aFillRect); + updateLibreOfficeKitAutoFill(mrViewData, aFillRect); } else if (xOverlayManager.is()) { Color aHandleColor( SC_MOD()->GetColorConfig().GetColorValue(svtools::FONTCOLOR).nColor ); - if (pViewData->GetActivePart() != eWhich) + if (mrViewData.GetActivePart() != eWhich) // non-active pane uses a different color. aHandleColor = SC_MOD()->GetColorConfig().GetColorValue(svtools::CALCPAGEBREAKAUTOMATIC).nColor; std::vector< basegfx::B2DRange > aRanges; @@ -6565,22 +6565,22 @@ void ScGridWindow::UpdateDragRectOverlay() SCCOL nX2 = bDragRect ? nDragEndX : aPagebreakDrag.aEnd.Col(); SCROW nY2 = bDragRect ? nDragEndY : aPagebreakDrag.aEnd.Row(); - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); - SCCOL nPosX = pViewData->GetPosX(WhichH(eWhich)); - SCROW nPosY = pViewData->GetPosY(WhichV(eWhich)); + SCCOL nPosX = mrViewData.GetPosX(WhichH(eWhich)); + SCROW nPosY = mrViewData.GetPosY(WhichV(eWhich)); if (nX1 < nPosX) nX1 = nPosX; if (nX2 < nPosX) nX2 = nPosX; if (nY1 < nPosY) nY1 = nPosY; if (nY2 < nPosY) nY2 = nPosY; - Point aScrPos( pViewData->GetScrPos( nX1, nY1, eWhich ) ); + Point aScrPos( mrViewData.GetScrPos( nX1, nY1, eWhich ) ); long nSizeXPix=0; long nSizeYPix=0; - ScDocument& rDoc = pViewData->GetDocument(); - double nPPTX = pViewData->GetPPTX(); - double nPPTY = pViewData->GetPPTY(); + ScDocument& rDoc = mrViewData.GetDocument(); + double nPPTX = mrViewData.GetPPTX(); + double nPPTY = mrViewData.GetPPTY(); SCCOLROW i; bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); @@ -6731,17 +6731,17 @@ void ScGridWindow::UpdateShrinkOverlay() tools::Rectangle aPixRect; ScRange aRange; - SCTAB nTab = pViewData->GetTabNo(); - if ( pViewData->IsRefMode() && nTab >= pViewData->GetRefStartZ() && nTab <= pViewData->GetRefEndZ() && - pViewData->GetDelMark( aRange ) ) + SCTAB nTab = mrViewData.GetTabNo(); + if ( mrViewData.IsRefMode() && nTab >= mrViewData.GetRefStartZ() && nTab <= mrViewData.GetRefEndZ() && + mrViewData.GetDelMark( aRange ) ) { //! limit to visible area if ( aRange.aStart.Col() <= aRange.aEnd.Col() && aRange.aStart.Row() <= aRange.aEnd.Row() ) { - Point aStart = pViewData->GetScrPos( aRange.aStart.Col(), + Point aStart = mrViewData.GetScrPos( aRange.aStart.Col(), aRange.aStart.Row(), eWhich ); - Point aEnd = pViewData->GetScrPos( aRange.aEnd.Col()+1, + Point aEnd = mrViewData.GetScrPos( aRange.aEnd.Col()+1, aRange.aEnd.Row()+1, eWhich ); aEnd.AdjustX( -1 ); aEnd.AdjustY( -1 ); @@ -6783,7 +6783,7 @@ void ScGridWindow::UpdateShrinkOverlay() // #i70788# central method to get the OverlayManager safely rtl::Reference<sdr::overlay::OverlayManager> ScGridWindow::getOverlayManager() const { - SdrPageView* pPV = pViewData->GetView()->GetScDrawView()->GetSdrPageView(); + SdrPageView* pPV = mrViewData.GetView()->GetScDrawView()->GetSdrPageView(); if(pPV) { @@ -6807,9 +6807,9 @@ void ScGridWindow::flushOverlayManager() xOverlayManager->flush(); } -ScViewData* ScGridWindow::getViewData() +ScViewData& ScGridWindow::getViewData() { - return pViewData; + return mrViewData; } FactoryFunction ScGridWindow::GetUITestFactory() const diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index bab2cd2e7469..90c3e08f5781 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -53,8 +53,8 @@ using std::vector; DataPilotFieldOrientation ScGridWindow::GetDPFieldOrientation( SCCOL nCol, SCROW nRow ) const { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); ScDPObject* pDPObj = rDoc.GetDPAtCursor(nCol, nRow, nTab); if (!pDPObj) return DataPilotFieldOrientation_HIDDEN; @@ -103,9 +103,9 @@ bool ScGridWindow::DoPageFieldSelection( SCCOL nCol, SCROW nRow ) bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt ) { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); - Point aScrPos = pViewData->GetScrPos(nCol, nRow, eWhich); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); + Point aScrPos = mrViewData.GetScrPos(nCol, nRow, eWhich); Point aDiffPix = rMEvt.GetPosPixel(); aDiffPix -= aScrPos; @@ -114,13 +114,13 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& aDiffPix.setX( -aDiffPix.X() ); long nSizeX, nSizeY; - 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()); + nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), mrViewData.GetPPTY()); Size aScrSize(nSizeX-1, nSizeY-1); // Check if the mouse cursor is clicking on the popup arrow box. - mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomY(), &rDoc)); + mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &mrViewData.GetZoomY(), &rDoc)); mpFilterButton->setBoundingBox(aScrPos, aScrSize, bLayoutRTL); mpFilterButton->setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL Point aPopupPos; @@ -147,8 +147,8 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& void ScGridWindow::DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt, bool bButton, bool bPopup ) { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); ScDPObject* pDPObj = rDoc.GetDPAtCursor(nCol, nRow, nTab); @@ -195,15 +195,15 @@ void ScGridWindow::DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent& nSrcTab = pDesc->GetSourceRange().aStart.Tab(); } - SfxItemSet aArgSet( pViewData->GetViewShell()->GetPool(), + SfxItemSet aArgSet( mrViewData.GetViewShell()->GetPool(), svl::Items<SCITEM_QUERYDATA, SCITEM_QUERYDATA>{} ); - aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, pViewData, &aQueryParam ) ); + aArgSet.Put( ScQueryItem( SCITEM_QUERYDATA, &mrViewData, &aQueryParam ) ); ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScopedVclPtr<AbstractScPivotFilterDlg> pDlg( pFact->CreateScPivotFilterDlg( - pViewData->GetViewShell()->GetFrameWeld(), aArgSet, nSrcTab)); + mrViewData.GetViewShell()->GetFrameWeld(), aArgSet, nSrcTab)); if ( pDlg->Execute() == RET_OK ) { ScSheetSourceDesc aNewDesc(&rDoc); @@ -215,9 +215,9 @@ void ScGridWindow::DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent& ScDPObject aNewObj( *pDPObj ); aNewObj.SetSheetDesc( aNewDesc ); - 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 } } } @@ -255,21 +255,21 @@ void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, bool bMove ) UpdateDragRect( false, tools::Rectangle() ); if ( nDx != 0) - pViewData->GetView()->ScrollX( nDx, WhichH(eWhich) ); + mrViewData.GetView()->ScrollX( nDx, WhichH(eWhich) ); if ( nDy != 0 ) - pViewData->GetView()->ScrollY( nDy, WhichV(eWhich) ); + mrViewData.GetView()->ScrollY( nDy, WhichV(eWhich) ); bTimer = true; } SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPixel.X(), aPixel.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( aPixel.X(), aPixel.Y(), eWhich, nPosX, nPosY ); bool bMouseLeft; bool bMouseTop; - pViewData->GetMouseQuadrant( aPixel, eWhich, nPosX, nPosY, bMouseLeft, bMouseTop ); + mrViewData.GetMouseQuadrant( aPixel, eWhich, nPosX, nPosY, bMouseLeft, bMouseTop ); - ScAddress aPos( nPosX, nPosY, pViewData->GetTabNo() ); + ScAddress aPos( nPosX, nPosY, mrViewData.GetTabNo() ); tools::Rectangle aPosRect; DataPilotFieldOrientation nOrient; @@ -308,7 +308,7 @@ void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, bool bMove ) nOrient != DataPilotFieldOrientation_ROW ) ) { // removing data layout is not allowed - pViewData->GetView()->ErrorMessage(STR_PIVOT_MOVENOTALLOWED); + mrViewData.GetView()->ErrorMessage(STR_PIVOT_MOVENOTALLOWED); } else if ( bAllowed ) { @@ -326,28 +326,28 @@ void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, bool bMove ) ScDPObject aNewObj( *pDragDPObj ); aNewObj.SetSaveData( aSaveData ); - ScDBDocFunc aFunc( *pViewData->GetDocShell() ); + ScDBDocFunc aFunc( *mrViewData.GetDocShell() ); // when dragging fields, allow re-positioning (bAllowMove) aFunc.DataPilotUpdate( pDragDPObj, &aNewObj, true, false, true ); - pViewData->GetView()->CursorPosChanged(); // shells may be switched + mrViewData.GetView()->CursorPosChanged(); // shells may be switched } } if (bTimer && bMove) - pViewData->GetView()->SetTimer( this, rMEvt ); // repeat event + mrViewData.GetView()->SetTimer( this, rMEvt ); // repeat event else - pViewData->GetView()->ResetTimer(); + mrViewData.GetView()->ResetTimer(); } bool ScGridWindow::DPTestFieldPopupArrow( const MouseEvent& rMEvt, const ScAddress& rPos, const ScAddress& rDimPos, ScDPObject* pDPObj) { - bool bLayoutRTL = pViewData->GetDocument().IsLayoutRTL( pViewData->GetTabNo() ); + bool bLayoutRTL = mrViewData.GetDocument().IsLayoutRTL( mrViewData.GetTabNo() ); // Get the geometry of the cell. - Point aScrPos = pViewData->GetScrPos(rPos.Col(), rPos.Row(), eWhich); + Point aScrPos = mrViewData.GetScrPos(rPos.Col(), rPos.Row(), eWhich); long nSizeX, nSizeY; - pViewData->GetMergeSizePixel(rPos.Col(), rPos.Row(), nSizeX, nSizeY); + mrViewData.GetMergeSizePixel(rPos.Col(), rPos.Row(), nSizeX, nSizeY); Size aScrSize(nSizeX-1, nSizeY-1); // Check if the mouse cursor is clicking on the popup arrow box. @@ -467,7 +467,7 @@ void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScrPos, const Size& rScr const ScDPLabelData& rLabelData = pDPData->maLabels; mpDPFieldPopup.disposeAndClear(); - mpDPFieldPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, &pViewData->GetDocument(), + mpDPFieldPopup.reset(VclPtr<ScCheckListMenuWindow>::Create(this, &mrViewData.GetDocument(), bDimOrientNotPage, false)); ScCheckListMenuControl& rControl = mpDPFieldPopup->get_widget(); @@ -505,7 +505,7 @@ void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScrPos, const Size& rScr } // Populate the menus. - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); rControl.addMenuItem( ScResId(STR_MENU_SORT_ASC), new PopupSortAction(pDPObj, nDimIndex, PopupSortAction::ASCENDING, 0, pViewShell)); @@ -533,7 +533,7 @@ void ScGridWindow::DPLaunchFieldPopupMenu(const Point& rScrPos, const Size& rScr 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(); @@ -594,7 +594,7 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu() } pDim->UpdateMemberVisibility(aResult); - ScDBDocFunc aFunc(*pViewData->GetDocShell()); + ScDBDocFunc aFunc(*mrViewData.GetDocShell()); aFunc.UpdatePivotTable(*pDPObj, true, false); } @@ -611,7 +611,7 @@ T lcl_getValidValue(T value, T defvalue) bool ScGridWindow::UpdateVisibleRange() { - ScDocument const& rDoc = pViewData->GetDocument(); + ScDocument const& rDoc = mrViewData.GetDocument(); SCCOL nPosX = 0; SCROW nPosY = 0; SCCOL nXRight = rDoc.MaxCol(); @@ -619,7 +619,7 @@ bool ScGridWindow::UpdateVisibleRange() if (comphelper::LibreOfficeKit::isActive()) { - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); nPosX = lcl_getValidValue(pViewShell->GetLOKStartHeaderCol(), nPosX); nPosY = lcl_getValidValue(pViewShell->GetLOKStartHeaderRow(), nPosY); nXRight = lcl_getValidValue(pViewShell->GetLOKEndHeaderCol(), nXRight); @@ -627,12 +627,12 @@ bool ScGridWindow::UpdateVisibleRange() } else { - nPosX = pViewData->GetPosX(eHWhich); - nPosY = pViewData->GetPosY(eVWhich); - nXRight = nPosX + pViewData->VisibleCellsX(eHWhich); + nPosX = mrViewData.GetPosX(eHWhich); + nPosY = mrViewData.GetPosY(eVWhich); + nXRight = nPosX + mrViewData.VisibleCellsX(eHWhich); if (nXRight > rDoc.MaxCol()) nXRight = rDoc.MaxCol(); - nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich); + nYBottom = nPosY + mrViewData.VisibleCellsY(eVWhich); if (nYBottom > rDoc.MaxRow()) nYBottom = rDoc.MaxRow(); } @@ -696,7 +696,7 @@ sal_uInt16 ScGridWindow::HitPageBreak( const Point& rMouse, ScRange* pSource, SCCOLROW nBreak = 0; SCCOLROW nPrev = 0; - ScPageBreakData* pPageData = pViewData->GetView()->GetPageBreakData(); + ScPageBreakData* pPageData = mrViewData.GetView()->GetPageBreakData(); if ( pPageData ) { bool bHori = false; @@ -708,9 +708,9 @@ sal_uInt16 ScGridWindow::HitPageBreak( const Point& rMouse, ScRange* pSource, long nMouseY = rMouse.Y(); SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( nMouseX, nMouseY, eWhich, nPosX, nPosY ); - Point aTL = pViewData->GetScrPos( nPosX, nPosY, eWhich ); - Point aBR = pViewData->GetScrPos( nPosX+1, nPosY+1, eWhich ); + mrViewData.GetPosFromPixel( nMouseX, nMouseY, eWhich, nPosX, nPosY ); + Point aTL = mrViewData.GetScrPos( nPosX, nPosY, eWhich ); + Point aBR = mrViewData.GetScrPos( nPosX+1, nPosY+1, eWhich ); // Horizontal more tolerances as for vertical, because there is more space if ( nMouseX <= aTL.X() + 4 ) @@ -846,31 +846,31 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) UpdateDragRectOverlay(); } - if ( nDx != 0 ) pViewData->GetView()->ScrollX( nDx, WhichH(eWhich) ); - if ( nDy != 0 ) pViewData->GetView()->ScrollY( nDy, WhichV(eWhich) ); + if ( nDx != 0 ) mrViewData.GetView()->ScrollX( nDx, WhichH(eWhich) ); + if ( nDy != 0 ) mrViewData.GetView()->ScrollY( nDy, WhichV(eWhich) ); bTimer = true; } // Switching when fixating (so Scrolling works) - if ( eWhich == pViewData->GetActivePart() ) //?? + if ( eWhich == mrViewData.GetActivePart() ) //?? { - if ( pViewData->GetHSplitMode() == SC_SPLIT_FIX ) + if ( mrViewData.GetHSplitMode() == SC_SPLIT_FIX ) if ( nDx > 0 ) { if ( eWhich == SC_SPLIT_TOPLEFT ) - pViewData->GetView()->ActivatePart( SC_SPLIT_TOPRIGHT ); + mrViewData.GetView()->ActivatePart( SC_SPLIT_TOPRIGHT ); else if ( eWhich == SC_SPLIT_BOTTOMLEFT ) - pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ); + mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ); } - if ( pViewData->GetVSplitMode() == SC_SPLIT_FIX ) + if ( mrViewData.GetVSplitMode() == SC_SPLIT_FIX ) if ( nDy > 0 ) { if ( eWhich == SC_SPLIT_TOPLEFT ) - pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMLEFT ); + mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMLEFT ); else if ( eWhich == SC_SPLIT_TOPRIGHT ) - pViewData->GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ); + mrViewData.GetView()->ActivatePart( SC_SPLIT_BOTTOMRIGHT ); } } @@ -879,9 +879,9 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) // Searching for a position between the cells (before nPosX / nPosY) SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY ); bool bLeft, bTop; - pViewData->GetMouseQuadrant( aPos, eWhich, nPosX, nPosY, bLeft, bTop ); + mrViewData.GetMouseQuadrant( aPos, eWhich, nPosX, nPosY, bLeft, bTop ); if ( !bLeft ) ++nPosX; if ( !bTop ) ++nPosY; @@ -963,10 +963,10 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) if ( bUp ) { - ScViewFunc* pViewFunc = pViewData->GetView(); - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScViewFunc* pViewFunc = mrViewData.GetView(); + ScDocShell* pDocSh = mrViewData.GetDocShell(); ScDocument& rDoc = pDocSh->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); bool bUndo (rDoc.IsUndoEnabled()); if ( bBreak ) @@ -978,7 +978,7 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) if (bUndo) { OUString aUndo = ScResId( STR_UNDO_DRAG_BREAK ); - pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, pViewData->GetViewShell()->GetViewShellId() ); + pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo, 0, mrViewData.GetViewShell()->GetViewShellId() ); } bool bGrow = !bHide && nNew > nPagebreakBreak; @@ -1086,9 +1086,9 @@ void ScGridWindow::PagebreakMove( const MouseEvent& rMEvt, bool bUp ) // Timer for Scrolling if (bTimer && !bUp) - pViewData->GetView()->SetTimer( this, rMEvt ); // repeat event + mrViewData.GetView()->SetTimer( this, rMEvt ); // repeat event else - pViewData->GetView()->ResetTimer(); + mrViewData.GetView()->ResetTimer(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index 92cbbcfa8558..e78a97cd5e3f 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -38,8 +38,8 @@ bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) { bool bRet = false; - FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); - if (pDraw && !pViewData->IsRefMode()) + FuPoor* pDraw = mrViewData.GetView()->GetDrawFuncPtr(); + if (pDraw && !mrViewData.IsRefMode()) { MapMode aDrawMode = GetDrawMapMode(); MapMode aOldMode = GetMapMode(); @@ -65,7 +65,7 @@ bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) } // cancel draw with right key - ScDrawView* pDrView = pViewData->GetScDrawView(); + ScDrawView* pDrView = mrViewData.GetScDrawView(); if ( pDrView && !rMEvt.IsLeft() && !bRet ) { pDrView->BrkAction(); @@ -76,10 +76,10 @@ bool ScGridWindow::DrawMouseButtonDown(const MouseEvent& rMEvt) bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt) { - ScViewFunc* pView = pViewData->GetView(); + ScViewFunc* pView = mrViewData.GetView(); bool bRet = false; FuPoor* pDraw = pView->GetDrawFuncPtr(); - if (pDraw && !pViewData->IsRefMode()) + if (pDraw && !mrViewData.IsRefMode()) { MapMode aDrawMode = GetDrawMapMode(); MapMode aOldMode = GetMapMode(); @@ -93,7 +93,7 @@ bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt) SfxItemSet* pDrawBrush = pView->GetDrawBrushSet(); if ( pDrawBrush ) { - ScDrawView* pDrView = pViewData->GetScDrawView(); + ScDrawView* pDrView = mrViewData.GetScDrawView(); if ( pDrView ) { pDrView->SetAttrToMarked(*pDrawBrush, true/*bReplaceAll*/); @@ -112,8 +112,8 @@ bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt) bool ScGridWindow::DrawMouseMove(const MouseEvent& rMEvt) { - FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); - if (pDraw && !pViewData->IsRefMode()) + FuPoor* pDraw = mrViewData.GetView()->GetDrawFuncPtr(); + if (pDraw && !mrViewData.IsRefMode()) { MapMode aDrawMode = GetDrawMapMode(); MapMode aOldMode = GetMapMode(); @@ -139,11 +139,11 @@ bool ScGridWindow::DrawMouseMove(const MouseEvent& rMEvt) void ScGridWindow::DrawEndAction() { - ScDrawView* pDrView = pViewData->GetScDrawView(); + ScDrawView* pDrView = mrViewData.GetScDrawView(); if ( pDrView && pDrView->IsAction() ) pDrView->BrkAction(); - FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); + FuPoor* pDraw = mrViewData.GetView()->GetDrawFuncPtr(); if (pDraw) pDraw->StopDragTimer(); @@ -152,9 +152,9 @@ void ScGridWindow::DrawEndAction() bool ScGridWindow::DrawCommand(const CommandEvent& rCEvt) { - ScDrawView* pDrView = pViewData->GetScDrawView(); - FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); - if (pDrView && pDraw && !pViewData->IsRefMode()) + ScDrawView* pDrView = mrViewData.GetScDrawView(); + FuPoor* pDraw = mrViewData.GetView()->GetDrawFuncPtr(); + if (pDrView && pDraw && !mrViewData.IsRefMode()) { pDraw->SetWindow( this ); sal_uInt8 nUsed = pDraw->Command( rCEvt ); @@ -169,9 +169,9 @@ bool ScGridWindow::DrawCommand(const CommandEvent& rCEvt) bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt) { - ScDrawView* pDrView = pViewData->GetScDrawView(); - FuPoor* pDraw = pViewData->GetView()->GetDrawFuncPtr(); - if (pDrView && pDraw && !pViewData->IsRefMode()) + ScDrawView* pDrView = mrViewData.GetScDrawView(); + FuPoor* pDraw = mrViewData.GetView()->GetDrawFuncPtr(); + if (pDrView && pDraw && !mrViewData.IsRefMode()) { pDraw->SetWindow( this ); bool bOldMarked = pDrView->AreObjectsMarked(); @@ -180,10 +180,10 @@ bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt) bool bLeaveDraw = false; bool bUsed = true; bool bNewMarked = pDrView->AreObjectsMarked(); - if ( !pViewData->GetView()->IsDrawSelMode() ) + if ( !mrViewData.GetView()->IsDrawSelMode() ) if ( !bNewMarked ) { - pViewData->GetViewShell()->SetDrawShell( false ); + mrViewData.GetViewShell()->SetDrawShell( false ); bLeaveDraw = true; if ( !bOldMarked && rKEvt.GetKeyCode().GetCode() == KEY_DELETE ) @@ -202,7 +202,7 @@ bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt) void ScGridWindow::DrawRedraw( ScOutputData& rOutputData, SdrLayerID nLayer ) { - const ScViewOptions& rOpts = pViewData->GetOptions(); + const ScViewOptions& rOpts = mrViewData.GetOptions(); // use new flags at SdrPaintView for hiding objects const bool bDrawOle(VOBJ_MODE_SHOW == rOpts.GetObjMode(VOBJ_TYPE_OLE)); @@ -212,7 +212,7 @@ void ScGridWindow::DrawRedraw( ScOutputData& rOutputData, SdrLayerID nLayer ) if(!(bDrawOle || bDrawChart || bDrawDraw)) return; - ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); + ScDrawView* pDrView = mrViewData.GetView()->GetScDrawView(); if(pDrView) { @@ -229,7 +229,7 @@ void ScGridWindow::DrawSdrGrid( const tools::Rectangle& rDrawingRect, OutputDevi { // Draw grid lines - ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); + ScDrawView* pDrView = mrViewData.GetView()->GetScDrawView(); if ( pDrView && pDrView->IsGridVisible() ) { SdrPageView* pPV = pDrView->GetSdrPageView(); @@ -245,7 +245,7 @@ void ScGridWindow::DrawSdrGrid( const tools::Rectangle& rDrawingRect, OutputDevi MapMode ScGridWindow::GetDrawMapMode( bool bForce ) { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); // FIXME this shouldn't be necessary once we change the entire Calc to // work in the logic coordinates (ideally 100ths of mm - so that it is @@ -253,15 +253,15 @@ MapMode ScGridWindow::GetDrawMapMode( bool bForce ) // SetMapMode's and other unnecessary fun we have with pixels if (comphelper::LibreOfficeKit::isActive()) { - return pViewData->GetLogicMode(); + return mrViewData.GetLogicMode(); } - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); bool bNegativePage = rDoc.IsNegativePage( nTab ); - MapMode aDrawMode = pViewData->GetLogicMode(); + MapMode aDrawMode = mrViewData.GetLogicMode(); - ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); + ScDrawView* pDrView = mrViewData.GetView()->GetScDrawView(); if ( pDrView || bForce ) { Fraction aScaleX; @@ -276,15 +276,15 @@ MapMode ScGridWindow::GetDrawMapMode( bool bForce ) if (nEndCol<20) nEndCol = 20; if (nEndRow<20) nEndRow = 1000; ScDrawUtil::CalcScale( rDoc, nTab, 0,0, nEndCol,nEndRow, this, - pViewData->GetZoomX(),pViewData->GetZoomY(), - pViewData->GetPPTX(),pViewData->GetPPTY(), + mrViewData.GetZoomX(),mrViewData.GetZoomY(), + mrViewData.GetPPTX(),mrViewData.GetPPTY(), aScaleX,aScaleY ); } aDrawMode.SetScaleX(aScaleX); aDrawMode.SetScaleY(aScaleY); } aDrawMode.SetOrigin(Point()); - Point aStartPos = pViewData->GetPixPos(eWhich); + Point aStartPos = mrViewData.GetPixPos(eWhich); if ( bNegativePage ) { // RTL uses negative positions for drawing objects @@ -299,7 +299,7 @@ void ScGridWindow::DrawAfterScroll() { PaintImmediately(); // always, so the behaviour with and without DrawingLayer is the same - ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); + ScDrawView* pDrView = mrViewData.GetView()->GetScDrawView(); if (pDrView) { OutlinerView* pOlView = pDrView->GetTextEditOutlinerView(); @@ -310,14 +310,14 @@ void ScGridWindow::DrawAfterScroll() void ScGridWindow::CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress) { - ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); + ScDrawView* pDrView = mrViewData.GetView()->GetScDrawView(); if (pDrView) { - const ScViewOptions& rOpts = pViewData->GetOptions(); + const ScViewOptions& rOpts = mrViewData.GetOptions(); if(rOpts.GetOption( VOPT_ANCHOR )) { - bool bNegativePage = pViewData->GetDocument().IsNegativePage( pViewData->GetTabNo() ); - Point aPos = pViewData->GetScrPos( rAddress.Col(), rAddress.Row(), eWhich, true ); + bool bNegativePage = mrViewData.GetDocument().IsNegativePage( mrViewData.GetTabNo() ); + Point aPos = mrViewData.GetScrPos( rAddress.Col(), rAddress.Row(), eWhich, true ); aPos = PixelToLogic(aPos); rHdl.AddHdl(std::make_unique<SdrHdl>(aPos, bNegativePage ? SdrHdlKind::Anchor_TR : SdrHdlKind::Anchor)); } @@ -326,7 +326,7 @@ void ScGridWindow::CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddres void ScGridWindow::UpdateStatusPosSize() { - ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); + ScDrawView* pDrView = mrViewData.GetView()->GetScDrawView(); if (!pDrView) return; // shouldn't be called in that case @@ -334,7 +334,7 @@ void ScGridWindow::UpdateStatusPosSize() if (!pPV) return; // shouldn't be called in that case either - SfxItemSet aSet(pViewData->GetViewShell()->GetPool(), svl::Items<SID_ATTR_POSITION, SID_ATTR_SIZE>{}); + SfxItemSet aSet(mrViewData.GetViewShell()->GetPool(), svl::Items<SID_ATTR_POSITION, SID_ATTR_SIZE>{}); // Fill items for position and size: // show action rectangle during action, @@ -374,18 +374,18 @@ void ScGridWindow::UpdateStatusPosSize() } } - pViewData->GetBindings().SetState(aSet); + mrViewData.GetBindings().SetState(aSet); } bool ScGridWindow::DrawHasMarkedObj() { - ScDrawView* p = pViewData->GetScDrawView(); + ScDrawView* p = mrViewData.GetScDrawView(); return p && p->AreObjectsMarked(); } void ScGridWindow::DrawMarkDropObj( SdrObject* pObj ) { - ScDrawView* pDrView = pViewData->GetView()->GetScDrawView(); + ScDrawView* pDrView = mrViewData.GetView()->GetScDrawView(); if (pDrView) pDrView->MarkDropObj(pObj); } diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 3e2368bf3067..724d840ab990 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -88,10 +88,9 @@ static void lcl_LimitRect( tools::Rectangle& rRect, const tools::Rectangle& rVis static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle& rInnerPixel, const OUString& rTitle, const Color& rColor, bool bTextBelow, double nPPTX, double nPPTY, const Fraction& rZoomY, - ScDocument& rDoc, ScViewData* pButtonViewData, bool bLayoutRTL ) + ScDocument& rDoc, ScViewData& rButtonViewData, bool bLayoutRTL ) { - // pButtonViewData is only used to set the button size, - // can otherwise be NULL! + // rButtonViewData is only used to set the button size, tools::Rectangle aInner = rInnerPixel; if ( bLayoutRTL ) @@ -147,8 +146,7 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle& Size aButSize( nBWidth, nBHeight ); long nButtonPos = bLayoutRTL ? aOuter.Left() : aOuter.Right()-nBWidth+1; aComboButton.Draw( Point(nButtonPos, nButtonY), aButSize ); - if (pButtonViewData) - pButtonViewData->SetScenButSize( aButSize ); + rButtonViewData.SetScenButSize( aButSize ); long nTextStart = bLayoutRTL ? aInner.Right() - aTextSize.Width() + 1 : aInner.Left(); @@ -184,11 +182,11 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle& pDev->DrawRect( aOuter ); } -static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, ScSplitPos eWhich, +static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData& rViewData, ScSplitPos eWhich, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 ) { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = rViewData.GetDocument(); + SCTAB nTab = rViewData.GetTabNo(); SCTAB nTabCount = rDoc.GetTableCount(); if ( nTab+1 >= nTabCount || !rDoc.IsScenario(nTab+1) || rDoc.IsScenario(nTab) ) return; @@ -223,9 +221,9 @@ static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, S if ( aRange.Intersects( aViewRange ) ) //! Space for Text/Button? { - Point aStartPos = pViewData->GetScrPos( + Point aStartPos = rViewData.GetScrPos( aRange.aStart.Col(), aRange.aStart.Row(), eWhich, true ); - Point aEndPos = pViewData->GetScrPos( + Point aEndPos = rViewData.GetScrPos( aRange.aEnd.Col()+1, aRange.aEnd.Row()+1, eWhich, true ); // on the grid: aStartPos.AdjustX( -nLayoutSign ); @@ -253,16 +251,16 @@ static void lcl_DrawScenarioFrames( OutputDevice* pDev, ScViewData* pViewData, S lcl_DrawOneFrame( pDev, tools::Rectangle( aStartPos, aEndPos ), aCurrent, aColor, bTextBelow, - pViewData->GetPPTX(), pViewData->GetPPTY(), pViewData->GetZoomY(), - rDoc, pViewData, bLayoutRTL ); + rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomY(), + rDoc, rViewData, bLayoutRTL ); } } } -static void lcl_DrawHighlight( ScOutputData& rOutputData, const ScViewData* pViewData, +static void lcl_DrawHighlight( ScOutputData& rOutputData, const ScViewData& rViewData, const std::vector<ScHighlightEntry>& rHighlightRanges ) { - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = rViewData.GetTabNo(); for ( const auto& rHighlightRange : rHighlightRanges) { ScRange aRange = rHighlightRange.aRef; @@ -293,7 +291,7 @@ void ScGridWindow::DoInvertRect( const tools::Rectangle& rPixel ) void ScGridWindow::PrePaint(vcl::RenderContext& /*rRenderContext*/) { // forward PrePaint to DrawingLayer - ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); + ScTabViewShell* pTabViewShell = mrViewData.GetViewShell(); if(pTabViewShell) { @@ -334,7 +332,7 @@ void ScGridWindow::InvalidateLOKViewCursor(const tools::Rectangle& rCursorRect, if (!NeedLOKCursorInvalidation(rCursorRect, aScaleX, aScaleY)) return; - ScTabViewShell* pThisViewShell = pViewData->GetViewShell(); + ScTabViewShell* pThisViewShell = mrViewData.GetViewShell(); SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) @@ -361,7 +359,7 @@ void ScGridWindow::InvalidateLOKViewCursor(const tools::Rectangle& rCursorRect, void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect ) { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); if ( rDoc.IsInInterpreter() ) { // Via Reschedule, interpreted cells do not trigger Invalidate again, @@ -391,13 +389,13 @@ void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::R tools::Rectangle aPixRect = LogicToPixel( rRect ); - SCCOL nX1 = pViewData->GetPosX(eHWhich); - SCROW nY1 = pViewData->GetPosY(eVWhich); + SCCOL nX1 = mrViewData.GetPosX(eHWhich); + SCROW nY1 = mrViewData.GetPosY(eVWhich); - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); - double nPPTX = pViewData->GetPPTX(); - double nPPTY = pViewData->GetPPTY(); + double nPPTX = mrViewData.GetPPTX(); + double nPPTY = mrViewData.GetPPTY(); tools::Rectangle aMirroredPixel = aPixRect; if ( rDoc.IsLayoutRTL( nTab ) ) @@ -437,7 +435,7 @@ void ScGridWindow::Paint( vcl::RenderContext& /*rRenderContext*/, const tools::R void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode ) { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); // let's ignore the normal Draw() attempts when doing the tiled rendering, // all the rendering should go through PaintTile() in that case. @@ -449,7 +447,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod ScModule* pScMod = SC_MOD(); bool bTextWysiwyg = pScMod->GetInputOptions().GetTextWysiwyg(); - if (pViewData->IsMinimized()) + if (mrViewData.IsMinimized()) return; PutInOrder( nX1, nX2 ); @@ -482,15 +480,15 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod ++nPaintCount; // mark that painting is in progress - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); rDoc.ExtendHidden( nX1, nY1, nX2, nY2, nTab ); - Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); + Point aScrPos = mrViewData.GetScrPos( nX1, nY1, eWhich ); long nMirrorWidth = GetSizePixel().Width(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); if ( bLayoutRTL ) { - long nEndPixel = pViewData->GetScrPos( nX2+1, maVisibleRange.mnRow1, eWhich ).X(); + long nEndPixel = mrViewData.GetScrPos( nX2+1, maVisibleRange.mnRow1, eWhich ).X(); nMirrorWidth = aScrPos.X() - nEndPixel; aScrPos.setX( nEndPixel + 1 ); } @@ -498,8 +496,8 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod long nScrX = aScrPos.X(); long nScrY = aScrPos.Y(); - SCCOL nCurX = pViewData->GetCurX(); - SCROW nCurY = pViewData->GetCurY(); + SCCOL nCurX = mrViewData.GetCurX(); + SCROW nCurY = mrViewData.GetCurY(); SCCOL nCurEndX = nCurX; SCROW nCurEndY = nCurY; rDoc.ExtendMerge( nCurX, nCurY, nCurEndX, nCurEndY, nTab ); @@ -518,20 +516,20 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod //! Paint AutoFill handles alone (without Cursor) ??? } - double nPPTX = pViewData->GetPPTX(); - double nPPTY = pViewData->GetPPTY(); + double nPPTX = mrViewData.GetPPTX(); + double nPPTY = mrViewData.GetPPTY(); - const ScViewOptions& rOpts = pViewData->GetOptions(); + const ScViewOptions& rOpts = mrViewData.GetOptions(); // data block ScTableInfo aTabInfo; rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, nPPTX, nPPTY, false, rOpts.GetOption(VOPT_FORMULAS), - &pViewData->GetMarkData() ); + &mrViewData.GetMarkData() ); - Fraction aZoomX = pViewData->GetZoomX(); - Fraction aZoomY = pViewData->GetZoomY(); + Fraction aZoomX = mrViewData.GetZoomX(); + Fraction aZoomY = mrViewData.GetZoomY(); ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY, &aZoomX, &aZoomY ); @@ -547,10 +545,10 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod // use printer for text formatting OutputDevice* pFmtDev = rDoc.GetPrinter(); - pFmtDev->SetMapMode( pViewData->GetLogicMode(eWhich) ); + pFmtDev->SetMapMode( mrViewData.GetLogicMode(eWhich) ); aOutputData.SetFmtDevice( pFmtDev ); } - else if ( aZoomX != aZoomY && pViewData->IsOle() ) + else if ( aZoomX != aZoomY && mrViewData.IsOle() ) { // #i45033# For OLE inplace editing with different zoom factors, // use a virtual device with 1/100th mm as text formatting reference @@ -606,8 +604,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI bool bLogicText) { ScModule* pScMod = SC_MOD(); - ScDocument& rDoc = pViewData->GetDocument(); - const ScViewOptions& rOpts = pViewData->GetOptions(); + ScDocument& rDoc = mrViewData.GetDocument(); + const ScViewOptions& rOpts = mrViewData.GetOptions(); bool bIsTiledRendering = comphelper::LibreOfficeKit::isActive(); bool bNoBackgroundAndGrid = bIsTiledRendering && comphelper::LibreOfficeKit::isCompatFlagSet( @@ -629,7 +627,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI aGridColor = rOpts.GetGridColor(); } - aOutputData.SetSyntaxMode ( pViewData->IsSyntaxMode() ); + aOutputData.SetSyntaxMode ( mrViewData.IsSyntaxMode() ); aOutputData.SetGridColor ( aGridColor ); aOutputData.SetShowNullValues ( rOpts.GetOption( VOPT_NULLVALS ) ); aOutputData.SetShowFormulas ( rOpts.GetOption( VOPT_FORMULAS ) ); @@ -638,29 +636,29 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI aOutputData.SetUseStyleColor( true ); // always set in table view - aOutputData.SetViewShell( pViewData->GetViewShell() ); + aOutputData.SetViewShell( mrViewData.GetViewShell() ); - bool bGrid = rOpts.GetOption( VOPT_GRID ) && pViewData->GetShowGrid(); + bool bGrid = rOpts.GetOption( VOPT_GRID ) && mrViewData.GetShowGrid(); bool bGridFirst = !rOpts.GetOption( VOPT_GRID_ONTOP ); bool bPage = rOpts.GetOption( VOPT_PAGEBREAKS ) && !bIsTiledRendering; - bool bPageMode = pViewData->IsPagebreakMode(); + bool bPageMode = mrViewData.IsPagebreakMode(); if (bPageMode) // after FindChanged { // SetPagebreakMode also initializes bPrinted Flags - aOutputData.SetPagebreakMode( pViewData->GetView()->GetPageBreakData() ); + aOutputData.SetPagebreakMode( mrViewData.GetView()->GetPageBreakData() ); } EditView* pEditView = nullptr; - bool bEditMode = pViewData->HasEditView(eWhich); - if ( bEditMode && pViewData->GetRefTabNo() == nTab ) + bool bEditMode = mrViewData.HasEditView(eWhich); + if ( bEditMode && mrViewData.GetRefTabNo() == nTab ) { SCCOL nEditCol; SCROW nEditRow; - pViewData->GetEditView( eWhich, pEditView, nEditCol, nEditRow ); - SCCOL nEditEndCol = pViewData->GetEditEndCol(); - SCROW nEditEndRow = pViewData->GetEditEndRow(); + mrViewData.GetEditView( eWhich, pEditView, nEditCol, nEditRow ); + SCCOL nEditEndCol = mrViewData.GetEditEndCol(); + SCROW nEditEndRow = mrViewData.GetEditEndRow(); if ( nEditEndCol >= nX1 && nEditCol <= nX2 && nEditEndRow >= nY1 && nEditRow <= nY2 ) aOutputData.SetEditCell( nEditCol, nEditRow ); @@ -716,7 +714,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI { // init redraw - ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); + ScTabViewShell* pTabViewShell = mrViewData.GetViewShell(); if(pTabViewShell) { @@ -832,7 +830,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI // edit cells and printer-metrics text must be before the buttons // (DataPilot buttons contain labels in UI font) - pContentDev->SetMapMode(pViewData->GetLogicMode(eWhich)); + pContentDev->SetMapMode(mrViewData.GetLogicMode(eWhich)); if ( bLogicText ) aOutputData.DrawStrings(true); // in logic MapMode if bLogicText is set aOutputData.DrawEdit(true); @@ -865,7 +863,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI //! Disable scenario frame via view option? SCTAB nTabCount = rDoc.GetTableCount(); - const std::vector<ScHighlightEntry> &rHigh = pViewData->GetView()->GetHighlightRanges(); + const std::vector<ScHighlightEntry> &rHigh = mrViewData.GetView()->GetHighlightRanges(); bool bHasScenario = ( nTab+1<nTabCount && rDoc.IsScenario(nTab+1) && !rDoc.IsScenario(nTab) ); bool bHasChange = ( rDoc.GetChangeTrack() != nullptr ); @@ -877,9 +875,9 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI aOutputData.DrawChangeTrack(); if ( bHasScenario ) - lcl_DrawScenarioFrames( pContentDev, pViewData, eWhich, nX1,nY1,nX2,nY2 ); + lcl_DrawScenarioFrames( pContentDev, mrViewData, eWhich, nX1,nY1,nX2,nY2 ); - lcl_DrawHighlight( aOutputData, pViewData, rHigh ); + lcl_DrawHighlight( aOutputData, mrViewData, rHigh ); } // Drawing foreground @@ -908,20 +906,20 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI pContentDev->SetMapMode(MapMode(MapUnit::MapPixel)); - if ( pViewData->IsRefMode() && nTab >= pViewData->GetRefStartZ() && nTab <= pViewData->GetRefEndZ() ) + if ( mrViewData.IsRefMode() && nTab >= mrViewData.GetRefStartZ() && nTab <= mrViewData.GetRefEndZ() ) { Color aRefColor( rColorCfg.GetColorValue(svtools::CALCREFERENCE).nColor ); - aOutputData.DrawRefMark( pViewData->GetRefStartX(), pViewData->GetRefStartY(), - pViewData->GetRefEndX(), pViewData->GetRefEndY(), + aOutputData.DrawRefMark( mrViewData.GetRefStartX(), mrViewData.GetRefStartY(), + mrViewData.GetRefEndX(), mrViewData.GetRefEndY(), aRefColor, false ); } // range finder - ScInputHandler* pHdl = pScMod->GetInputHdl( pViewData->GetViewShell() ); + ScInputHandler* pHdl = pScMod->GetInputHdl( mrViewData.GetViewShell() ); if (pHdl) { - ScDocShell* pDocSh = pViewData->GetDocShell(); + ScDocShell* pDocSh = mrViewData.GetDocShell(); ScRangeFindList* pRangeFinder = pHdl->GetRangeFindList(); if ( pRangeFinder && !pRangeFinder->IsHidden() && pRangeFinder->GetDocName() == pDocSh->GetTitle() ) @@ -944,7 +942,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI { // end redraw - ScTabViewShell* pTabViewShell = pViewData->GetViewShell(); + ScTabViewShell* pTabViewShell = mrViewData.GetViewShell(); if(pTabViewShell) { @@ -979,7 +977,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI // paint in-place editing on other views if (bIsTiledRendering) { - ScTabViewShell* pThisViewShell = pViewData->GetViewShell(); + ScTabViewShell* pThisViewShell = mrViewData.GetViewShell(); SfxViewShell* pViewShell = SfxViewShell::GetFirst(); while (pViewShell) @@ -1009,8 +1007,8 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI rDevice.SetLineColor(); rDevice.SetFillColor(pOtherEditView->GetBackgroundColor()); - Point aStart = pViewData->GetScrPos( nCol1, nRow1, eOtherWhich ); - Point aEnd = pViewData->GetScrPos( nCol2+1, nRow2+1, eOtherWhich ); + Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eOtherWhich ); + Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eOtherWhich ); // don't overwrite grid long nLayoutSign = bLayoutRTL ? -1 : 1; @@ -1076,18 +1074,18 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI // using the editeng. // It's being done after EndDrawLayers() to get it outside the overlay // buffer and on top of everything. - if ( bEditMode && (pViewData->GetRefTabNo() == pViewData->GetTabNo()) ) + if ( bEditMode && (mrViewData.GetRefTabNo() == mrViewData.GetTabNo()) ) { // get the coordinates of the area we need to clear (overpaint by // the background) - SCCOL nCol1 = pViewData->GetEditStartCol(); - SCROW nRow1 = pViewData->GetEditStartRow(); - SCCOL nCol2 = pViewData->GetEditEndCol(); - SCROW nRow2 = pViewData->GetEditEndRow(); + SCCOL nCol1 = mrViewData.GetEditStartCol(); + SCROW nRow1 = mrViewData.GetEditStartRow(); + SCCOL nCol2 = mrViewData.GetEditEndCol(); + SCROW nRow2 = mrViewData.GetEditEndRow(); rDevice.SetLineColor(); rDevice.SetFillColor(pEditView->GetBackgroundColor()); - Point aStart = pViewData->GetScrPos( nCol1, nRow1, eWhich ); - Point aEnd = pViewData->GetScrPos( nCol2+1, nRow2+1, eWhich ); + Point aStart = mrViewData.GetScrPos( nCol1, nRow1, eWhich ); + Point aEnd = mrViewData.GetScrPos( nCol2+1, nRow2+1, eWhich ); // don't overwrite grid long nLayoutSign = bLayoutRTL ? -1 : 1; @@ -1116,7 +1114,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI rDevice.SetMapMode(aDrawMode); } else - rDevice.SetMapMode(pViewData->GetLogicMode()); + rDevice.SetMapMode(mrViewData.GetLogicMode()); if (bIsTiledRendering) { @@ -1205,13 +1203,13 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI pCrsr->Show(); } - if (pViewData->HasEditView(eWhich)) + if (mrViewData.HasEditView(eWhich)) { // flush OverlayManager before changing the MapMode flushOverlayManager(); // set MapMode for text edit - rDevice.SetMapMode(pViewData->GetLogicMode()); + rDevice.SetMapMode(mrViewData.GetLogicMode()); } else rDevice.SetMapMode(aDrawMode); @@ -1223,14 +1221,14 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI namespace { template<typename IndexType> - void lcl_getBoundingRowColumnforTile(ScViewData* pViewData, + void lcl_getBoundingRowColumnforTile(ScViewData& rViewData, long nTileStartPosPx, long nTileEndPosPx, sal_Int32& nTopLeftTileOffset, sal_Int32& nTopLeftTileOrigin, sal_Int32& nTopLeftTileIndex, sal_Int32& nBottomRightTileIndex) { const bool bColumnHeader = std::is_same<IndexType, SCCOL>::value; - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = rViewData.GetTabNo(); IndexType nStartIndex = -1; IndexType nEndIndex = -1; @@ -1238,11 +1236,11 @@ namespace long nEndPosPx = 0; ScPositionHelper& rPositionHelper = - bColumnHeader ? pViewData->GetLOKWidthHelper() : pViewData->GetLOKHeightHelper(); + bColumnHeader ? rViewData.GetLOKWidthHelper() : rViewData.GetLOKHeightHelper(); const auto& rStartNearest = rPositionHelper.getNearestByPosition(nTileStartPosPx); const auto& rEndNearest = rPositionHelper.getNearestByPosition(nTileEndPosPx); - ScBoundsProvider aBoundsProvider(*pViewData, nTab, bColumnHeader); + ScBoundsProvider aBoundsProvider(rViewData, nTab, bColumnHeader); aBoundsProvider.Compute(rStartNearest, rEndNearest, nTileStartPosPx, nTileEndPosPx); aBoundsProvider.GetStartIndexAndPosition(nStartIndex, nStartPosPx); ++nStartIndex; aBoundsProvider.GetEndIndexAndPosition(nEndIndex, nEndPosPx); @@ -1316,8 +1314,8 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, int nTilePosX, int nTilePosY, long nTileWidth, long nTileHeight ) { - Fraction origZoomX = pViewData->GetZoomX(); - Fraction origZoomY = pViewData->GetZoomY(); + Fraction origZoomX = mrViewData.GetZoomX(); + Fraction origZoomY = mrViewData.GetZoomY(); // Output size is in pixels while tile position and size are in logical units (twips). @@ -1341,10 +1339,10 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, // page break zoom, and aLogicMode in ScViewData // FIXME: there are issues when SetZoom is called conditionally. - pViewData->SetZoom(aFracX, aFracY, true); + mrViewData.SetZoom(aFracX, aFracY, true); if (bChangeZoom) { - if (ScDrawView* pDrawView = pViewData->GetScDrawView()) + if (ScDrawView* pDrawView = mrViewData.GetScDrawView()) pDrawView->resetGridOffsetsForAllSdrPageViews(); } @@ -1353,11 +1351,11 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, const double fTileBottomPixel = static_cast<double>(nTilePosY + nTileHeight) * nOutputHeight / nTileHeight; const double fTileRightPixel = static_cast<double>(nTilePosX + nTileWidth) * nOutputWidth / nTileWidth; - SCTAB nTab = pViewData->GetTabNo(); - ScDocument& rDoc = pViewData->GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); - const double fPPTX = pViewData->GetPPTX(); - const double fPPTY = pViewData->GetPPTY(); + const double fPPTX = mrViewData.GetPPTX(); + const double fPPTY = mrViewData.GetPPTY(); // find approximate col/row offsets of nearby. sal_Int32 nTopLeftTileRowOffset = 0; @@ -1370,12 +1368,12 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, sal_Int32 nBottomRightTileRow = 0; sal_Int32 nBottomRightTileCol = 0; - lcl_getBoundingRowColumnforTile<SCROW>(pViewData, + lcl_getBoundingRowColumnforTile<SCROW>(mrViewData, fTilePosYPixel, fTileBottomPixel, nTopLeftTileRowOffset, nTopLeftTileRowOrigin, nTopLeftTileRow, nBottomRightTileRow); - lcl_getBoundingRowColumnforTile<SCCOL>(pViewData, + lcl_getBoundingRowColumnforTile<SCCOL>(mrViewData, fTilePosXPixel, fTileRightPixel, nTopLeftTileColOffset, nTopLeftTileColOrigin, nTopLeftTileCol, nBottomRightTileCol); @@ -1422,7 +1420,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, nTab, fPPTX, fPPTY, false, false); // FIXME: is this called some -// Point aScrPos = pViewData->GetScrPos( nX1, nY1, eWhich ); +// Point aScrPos = mrViewData.GetScrPos( nX1, nY1, eWhich ); ScOutputData aOutputData(&rDevice, OUTTYPE_WINDOW, aTabInfo, &rDoc, nTab, -nTopLeftTileColOffset, @@ -1440,7 +1438,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, mpLOKDrawView.reset(bPrintTwipsMsgs ? new ScLOKDrawView( &rDevice, - *pViewData) : + mrViewData) : new FmFormView( *pModel, &rDevice)); @@ -1457,10 +1455,10 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice, rDoc.ResetChanged(ScRange(nTopLeftTileCol, nTopLeftTileRow, nTab, nBottomRightTileCol, nBottomRightTileRow, nTab)); rDoc.PrepareFormulaCalc(); - pViewData->SetZoom(origZoomX, origZoomY, true); + mrViewData.SetZoom(origZoomX, origZoomY, true); if (bChangeZoom) { - if (ScDrawView* pDrawView = pViewData->GetScDrawView()) + if (ScDrawView* pDrawView = mrViewData.GetScDrawView()) pDrawView->resetGridOffsetsForAllSdrPageViews(); } } @@ -1484,14 +1482,14 @@ void ScGridWindow::LogicInvalidate(const tools::Rectangle* pRectangle) sRectangle = aRectangle.toString(); } - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); SfxLokHelper::notifyInvalidation(pViewShell, sRectangle); } void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) { - ScTabView* pTabView = pViewData->GetView(); - ScTabViewShell* pViewShell = pViewData->GetViewShell(); + ScTabView* pTabView = mrViewData.GetView(); + ScTabViewShell* pViewShell = mrViewData.GetViewShell(); ScInputHandler* pInputHandler = SC_MOD()->GetInputHdl(pViewShell); if (pInputHandler && pInputHandler->IsInputMode()) @@ -1508,7 +1506,7 @@ void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) } // obtain the current selection - ScRangeList aRangeList = pViewData->GetMarkData().GetMarkedRanges(); + ScRangeList aRangeList = mrViewData.GetMarkData().GetMarkedRanges(); SCCOL nCol1, nCol2; SCROW nRow1, nRow2; @@ -1517,8 +1515,8 @@ void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) bool bWasEmpty = false; if (aRangeList.empty()) { - nCol1 = nCol2 = pViewData->GetCurX(); - nRow1 = nRow2 = pViewData->GetCurY(); + nCol1 = nCol2 = mrViewData.GetCurX(); + nRow1 = nRow2 = mrViewData.GetCurY(); bWasEmpty = true; } else @@ -1527,8 +1525,8 @@ void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY) // convert the coordinates to column/row SCCOL nNewPosX; SCROW nNewPosY; - SCTAB nTab = pViewData->GetTabNo(); - pViewData->GetPosFromPixel(nPixelX, nPixelY, eWhich, nNewPosX, nNewPosY); + SCTAB nTab = mrViewData.GetTabNo(); + mrViewData.GetPosFromPixel(nPixelX, nPixelY, eWhich, nNewPosX, nNewPosY); // change the selection switch (nType) @@ -1572,7 +1570,7 @@ void ScGridWindow::CheckNeedsRepaint() aRepaintPixel = tools::Rectangle(); // selection function in status bar might also be invalid - SfxBindings& rBindings = pViewData->GetBindings(); + SfxBindings& rBindings = mrViewData.GetBindings(); rBindings.Invalidate( SID_STATUS_SUM ); rBindings.Invalidate( SID_ATTR_SIZE ); rBindings.Invalidate( SID_TABLE_CELL ); @@ -1580,12 +1578,12 @@ void ScGridWindow::CheckNeedsRepaint() void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext) { - ScPageBreakData* pPageData = pViewData->GetView()->GetPageBreakData(); + ScPageBreakData* pPageData = mrViewData.GetView()->GetPageBreakData(); if (!pPageData) return; - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); Size aWinSize = GetOutputSizePixel(); const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig(); Color aManual( rColorCfg.GetColorValue(svtools::CALCPAGEBREAKMANUAL).nColor ); @@ -1638,9 +1636,9 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, else rRenderContext.SetFillColor( aManual ); - Point aStart = pViewData->GetScrPos( + Point aStart = mrViewData.GetScrPos( aRange.aStart.Col(), aRange.aStart.Row(), eWhich, true ); - Point aEnd = pViewData->GetScrPos( + Point aEnd = mrViewData.GetScrPos( aRange.aEnd.Col() + 1, aRange.aEnd.Row() + 1, eWhich, true ); aStart.AdjustX( -2 ); aStart.AdjustY( -2 ); @@ -1674,7 +1672,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, rRenderContext.SetFillColor( aManual ); else rRenderContext.SetFillColor( aAutomatic ); - Point aBreak = pViewData->GetScrPos( + Point aBreak = mrViewData.GetScrPos( nBreak, aRange.aStart.Row(), eWhich, true ); rRenderContext.DrawRect( tools::Rectangle( aBreak.X()-1, aStart.Y(), aBreak.X(), aEnd.Y() ) ); } @@ -1693,7 +1691,7 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, rRenderContext.SetFillColor( aManual ); else rRenderContext.SetFillColor( aAutomatic ); - Point aBreak = pViewData->GetScrPos( + Point aBreak = mrViewData.GetScrPos( aRange.aStart.Col(), nBreak, eWhich, true ); rRenderContext.DrawRect( tools::Rectangle( aStart.X(), aBreak.Y()-1, aEnd.X(), aBreak.Y() ) ); } @@ -1713,9 +1711,9 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, SCCOL nPrEndX = pColEnd[nColPos]; if ( nPrEndX >= nX1 && nPrStartX <= nX2 ) { - Point aPageStart = pViewData->GetScrPos( + Point aPageStart = mrViewData.GetScrPos( nPrStartX, nPrStartY, eWhich, true ); - Point aPageEnd = pViewData->GetScrPos( + Point aPageEnd = mrViewData.GetScrPos( nPrEndX+1,nPrEndY+1, eWhich, true ); long nPageNo = rData.GetFirstPage(); @@ -1783,14 +1781,14 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo { aComboButton.SetOutputDevice( pContentDev ); - ScDocument& rDoc = pViewData->GetDocument(); - ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &pViewData->GetZoomY(), &rDoc); + ScDocument& rDoc = mrViewData.GetDocument(); + ScDPFieldButton aCellBtn(pContentDev, &GetSettings().GetStyleSettings(), &mrViewData.GetZoomY(), &rDoc); SCCOL nCol; SCROW nRow; SCSIZE nArrY; SCSIZE nQuery; - SCTAB nTab = pViewData->GetTabNo(); + SCTAB nTab = mrViewData.GetTabNo(); ScDBData* pDBData = nullptr; std::unique_ptr<ScQueryParam> pQueryParam; @@ -1872,9 +1870,9 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo //if address(nCol,nRow) is not the start pos of the merge area, the value of the nSizeX will be incorrect, it will be the length of the cell. //should first get the start pos of the merge area, then get the nSizeX through the start pos. rDoc.ExtendOverlapped(nStartCol, nStartRow,nCol, nRow, nTab);//get nStartCol,nStartRow - pViewData->GetMergeSizePixel( nStartCol, nStartRow, nSizeX, nSizeY );//get nSizeX - nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), pViewData->GetPPTY()); - Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich ); + mrViewData.GetMergeSizePixel( nStartCol, nStartRow, nSizeX, nSizeY );//get nSizeX + nSizeY = ScViewData::ToPixel(rDoc.GetRowHeight(nRow, nTab), mrViewData.GetPPTY()); + Point aScrPos = mrViewData.GetScrPos( nCol, nRow, eWhich ); aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL); aCellBtn.setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL @@ -1896,10 +1894,10 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo if (pInfo->bHOverlapped || pInfo->bVOverlapped) continue; - Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich ); + Point aScrPos = mrViewData.GetScrPos( nCol, nRow, eWhich ); long nSizeX; long nSizeY; - pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY ); + mrViewData.GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY ); long nPosX = aScrPos.X(); long nPosY = aScrPos.Y(); // bLayoutRTL is handled in setBoundingBox @@ -1934,8 +1932,8 @@ void ScGridWindow::DrawButtons(SCCOL nX1, SCCOL nX2, const ScTableInfo& rTabInfo tools::Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& rButtonPos ) { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); long nLayoutSign = bLayoutRTL ? -1 : 1; @@ -1947,10 +1945,10 @@ tools::Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& rButtonPos long nCellSizeX; // width of this cell, including merged long nDummy; - pViewData->GetMergeSizePixel( nCol, nRow, nCellSizeX, nDummy ); + mrViewData.GetMergeSizePixel( nCol, nRow, nCellSizeX, nDummy ); // for height, only the cell's row is used, excluding merged cells - long nCellSizeY = ScViewData::ToPixel( rDoc.GetRowHeight( nRow, nTab ), pViewData->GetPPTY() ); + long nCellSizeY = ScViewData::ToPixel( rDoc.GetRowHeight( nRow, nTab ), mrViewData.GetPPTY() ); long nAvailable = nCellSizeX; // left edge of next cell if there is a non-hidden next column @@ -1962,14 +1960,14 @@ tools::Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& rButtonPos ++nNextCol; bool bNextCell = ( nNextCol <= rDoc.MaxCol() ); if ( bNextCell ) - nAvailable = ScViewData::ToPixel( rDoc.GetColWidth( nNextCol, nTab ), pViewData->GetPPTX() ); + nAvailable = ScViewData::ToPixel( rDoc.GetColWidth( nNextCol, nTab ), mrViewData.GetPPTX() ); if ( nAvailable < aBtnSize.Width() ) aBtnSize.setWidth( nAvailable ); if ( nCellSizeY < aBtnSize.Height() ) aBtnSize.setHeight( nCellSizeY ); - Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich, true ); + Point aPos = mrViewData.GetScrPos( nCol, nRow, eWhich, true ); aPos.AdjustX(nCellSizeX * nLayoutSign ); // start of next cell if (!bNextCell) aPos.AdjustX( -(aBtnSize.Width() * nLayoutSign) ); // right edge of cell if next cell not available @@ -1984,7 +1982,7 @@ tools::Rectangle ScGridWindow::GetListValButtonRect( const ScAddress& rButtonPos bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab ) { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); ScDBData* pDBData = rDoc.GetDBAtCursor( nCol, nRow, nTab, ScDBDataPortion::AREA ); ScQueryParam aQueryParam; @@ -2021,12 +2019,12 @@ bool ScGridWindow::IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab ) void ScGridWindow::GetSelectionRects( ::std::vector< tools::Rectangle >& rPixelRects ) const { - GetPixelRectsFor( pViewData->GetMarkData(), rPixelRects ); + GetPixelRectsFor( mrViewData.GetMarkData(), rPixelRects ); } void ScGridWindow::GetSelectionRectsPrintTwips(::std::vector< tools::Rectangle >& rRects) const { - GetRectsAnyFor(pViewData->GetMarkData(), rRects, true); + GetRectsAnyFor(mrViewData.GetMarkData(), rRects, true); } /// convert rMarkData into pixel rectangles for this view @@ -2043,8 +2041,8 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData, ScMarkData aMultiMark( rMarkData ); aMultiMark.SetMarking( false ); aMultiMark.MarkToMulti(); - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); long nLayoutSign = bLayoutRTL ? -1 : 1; @@ -2065,8 +2063,8 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData, rDoc.ExtendMerge( nX1,nY1, nTestX2,nTestY2, nTab ); - SCCOL nPosX = pViewData->GetPosX( eHWhich ); - SCROW nPosY = pViewData->GetPosY( eVWhich ); + SCCOL nPosX = mrViewData.GetPosX( eHWhich ); + SCROW nPosY = mrViewData.GetPosY( eVWhich ); // is the selection visible at all? if (nTestX2 < nPosX || nTestY2 < nPosY) return; @@ -2079,11 +2077,11 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData, if (!comphelper::LibreOfficeKit::isActive()) { // limit the selection to only what is visible on the screen - SCCOL nXRight = nPosX + pViewData->VisibleCellsX(eHWhich); + SCCOL nXRight = nPosX + mrViewData.VisibleCellsX(eHWhich); if (nXRight > rDoc.MaxCol()) nXRight = rDoc.MaxCol(); - SCROW nYBottom = nPosY + pViewData->VisibleCellsY(eVWhich); + SCROW nYBottom = nPosY + mrViewData.VisibleCellsY(eVWhich); if (nYBottom > rDoc.MaxRow()) nYBottom = rDoc.MaxRow(); @@ -2108,13 +2106,13 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData, nY2 = nMaxTiledRow; } - double nPPTX = pViewData->GetPPTX(); - double nPPTY = pViewData->GetPPTY(); + double nPPTX = mrViewData.GetPPTX(); + double nPPTY = mrViewData.GetPPTY(); ScInvertMerger aInvert( &rRects ); - Point aScrPos = bInPrintTwips ? pViewData->GetPrintTwipsPos(nX1, nY1) : - pViewData->GetScrPos(nX1, nY1, eWhich); + Point aScrPos = bInPrintTwips ? mrViewData.GetPrintTwipsPos(nX1, nY1) : + mrViewData.GetScrPos(nX1, nY1, eWhich); long nScrY = aScrPos.Y(); bool bWasHidden = false; for (SCROW nY=nY1; nY<=nY2; nY++) @@ -2202,8 +2200,8 @@ void ScGridWindow::GetRectsAnyFor(const ScMarkData &rMarkData, const SCCOL nEndColMerge = nThisX + pMerge->GetColMerge(); const SCROW nEndRowMerge = nThisY + pMerge->GetRowMerge(); Point aEndPos = bInPrintTwips ? - pViewData->GetPrintTwipsPos(nEndColMerge, nEndRowMerge) : - pViewData->GetScrPos(nEndColMerge, nEndRowMerge, eWhich); + mrViewData.GetPrintTwipsPos(nEndColMerge, nEndRowMerge) : + mrViewData.GetScrPos(nEndColMerge, nEndRowMerge, eWhich); if ( aEndPos.X() * nLayoutSign > nScrX * nLayoutSign && aEndPos.Y() > nScrY ) { aInvert.AddRect( tools::Rectangle( nScrX,nScrY, @@ -2237,15 +2235,15 @@ void ScGridWindow::DataChanged( const DataChangedEvent& rDCEvt ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE))) ) return; - if ( rDCEvt.GetType() == DataChangedEventType::FONTS && eWhich == pViewData->GetActivePart() ) - pViewData->GetDocShell()->UpdateFontList(); + if ( rDCEvt.GetType() == DataChangedEventType::FONTS && eWhich == mrViewData.GetActivePart() ) + mrViewData.GetDocShell()->UpdateFontList(); if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - if ( eWhich == pViewData->GetActivePart() ) // only once for the view + if ( eWhich == mrViewData.GetActivePart() ) // only once for the view { - ScTabView* pView = pViewData->GetView(); + ScTabView* pView = mrViewData.GetView(); pView->RecalcPPT(); @@ -2255,7 +2253,7 @@ void ScGridWindow::DataChanged( const DataChangedEvent& rDCEvt ) // invalidate cell attribs in input handler, in case the // EditEngine BackgroundColor has to be changed - if ( pViewData->IsActive() ) + if ( mrViewData.IsActive() ) { ScInputHandler* pHdl = SC_MOD()->GetInputHdl(); if (pHdl) diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx index 899b85677dd3..b0f1e92ca679 100644 --- a/sc/source/ui/view/gridwin5.cxx +++ b/sc/source/ui/view/gridwin5.cxx @@ -48,8 +48,8 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard ) { bool bDone = false; - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); ScAddress aCellPos( nPosX, nPosY, nTab ); OUString aTrackText; @@ -172,13 +172,13 @@ bool ScGridWindow::ShowNoteMarker( SCCOL nPosX, SCROW nPosY, bool bKeyboard ) mpNoteMarker.reset(); - bool bHSplit = pViewData->GetHSplitMode() != SC_SPLIT_NONE; - bool bVSplit = pViewData->GetVSplitMode() != SC_SPLIT_NONE; + bool bHSplit = mrViewData.GetHSplitMode() != SC_SPLIT_NONE; + bool bVSplit = mrViewData.GetVSplitMode() != SC_SPLIT_NONE; - vcl::Window* pLeft = pViewData->GetView()->GetWindowByPos( bVSplit ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT ); - vcl::Window* pRight = bHSplit ? pViewData->GetView()->GetWindowByPos( bVSplit ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT ) : nullptr; - vcl::Window* pBottom = bVSplit ? pViewData->GetView()->GetWindowByPos( SC_SPLIT_BOTTOMLEFT ) : nullptr; - vcl::Window* pDiagonal = (bHSplit && bVSplit) ? pViewData->GetView()->GetWindowByPos( SC_SPLIT_BOTTOMRIGHT ) : nullptr; + vcl::Window* pLeft = mrViewData.GetView()->GetWindowByPos( bVSplit ? SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT ); + vcl::Window* pRight = bHSplit ? mrViewData.GetView()->GetWindowByPos( bVSplit ? SC_SPLIT_TOPRIGHT : SC_SPLIT_BOTTOMRIGHT ) : nullptr; + vcl::Window* pBottom = bVSplit ? mrViewData.GetView()->GetWindowByPos( SC_SPLIT_BOTTOMLEFT ) : nullptr; + vcl::Window* pDiagonal = (bHSplit && bVSplit) ? mrViewData.GetView()->GetWindowByPos( SC_SPLIT_BOTTOMRIGHT ) : nullptr; OSL_ENSURE( pLeft, "ScGridWindow::ShowNoteMarker - missing top-left grid window" ); /* If caption is shown from right or bottom windows, adjust @@ -207,7 +207,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt) { bool bDone = false; bool bHelpEnabled = bool(rHEvt.GetMode() & ( HelpEventMode::BALLOON | HelpEventMode::QUICK )); - SdrView* pDrView = pViewData->GetScDrawView(); + SdrView* pDrView = mrViewData.GetScDrawView(); bool bDrawTextEdit = false; if (pDrView) bDrawTextEdit = pDrView->IsTextEdit(); @@ -217,7 +217,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt) Point aPosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() ); SCCOL nPosX; SCROW nPosY; - pViewData->GetPosFromPixel( aPosPixel.X(), aPosPixel.Y(), eWhich, nPosX, nPosY ); + mrViewData.GetPosFromPixel( aPosPixel.X(), aPosPixel.Y(), eWhich, nPosX, nPosY ); if ( ShowNoteMarker( nPosX, nPosY, false ) ) { @@ -311,15 +311,15 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt) aHelpText = SfxHelp::GetURLHelpText( INetURLObject::decode(aUrl, INetURLObject::DecodeMechanism::Unambiguous)); - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); SCCOL nPosX; SCROW nPosY; - SCTAB nTab = pViewData->GetTabNo(); - pViewData->GetPosFromPixel( aPosPixel.X(), aPosPixel.Y(), eWhich, nPosX, nPosY ); + SCTAB nTab = mrViewData.GetTabNo(); + mrViewData.GetPosFromPixel( aPosPixel.X(), aPosPixel.Y(), eWhich, nPosX, nPosY ); const ScPatternAttr* pPattern = rDoc.GetPattern( nPosX, nPosY, nTab ); // bForceToTop = sal_False, use the cell's real position - aPixRect = pViewData->GetEditArea( eWhich, nPosX, nPosY, this, pPattern, false ); + aPixRect = mrViewData.GetEditArea( eWhich, nPosX, nPosY, this, pPattern, false ); } } @@ -349,7 +349,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt) // If QuickHelp for AutoFill is shown, do not allow it to be removed - if ( nMouseStatus == SC_GM_TABDOWN && pViewData->GetRefType() == SC_REFTYPE_FILL && + if ( nMouseStatus == SC_GM_TABDOWN && mrViewData.GetRefType() == SC_REFTYPE_FILL && Help::IsQuickHelpEnabled() ) bDone = true; @@ -360,7 +360,7 @@ void ScGridWindow::RequestHelp(const HelpEvent& rHEvt) bool ScGridWindow::IsMyModel(const SdrEditView* pSdrView) { return pSdrView && - pSdrView->GetModel() == pViewData->GetDocument().GetDrawLayer(); + pSdrView->GetModel() == mrViewData.GetDocument().GetDrawLayer(); } void ScGridWindow::HideNoteMarker() @@ -379,7 +379,7 @@ css::uno::Reference< css::accessibility::XAccessible > ScAccessibleDocument* pAccessibleDocument = new ScAccessibleDocument(GetAccessibleParentWindow()->GetAccessible(), - pViewData->GetViewShell(), eWhich); + mrViewData.GetViewShell(), eWhich); pAccessibleDocument->PreInit(); xAcc = pAccessibleDocument; diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx index 22a6198bc29f..de7ac8abcce2 100644 --- a/sc/source/ui/view/gridwin_dbgutil.cxx +++ b/sc/source/ui/view/gridwin_dbgutil.cxx @@ -41,8 +41,8 @@ void dumpScDrawObjData(const ScGridWindow& rWindow, const ScDrawObjData& rData, void ScGridWindow::dumpColumnInformationPixel() { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); for (SCCOL nCol = 0; nCol <= 20; ++nCol) { sal_uInt16 nWidth = rDoc.GetColWidth(nCol, nTab); @@ -53,8 +53,8 @@ void ScGridWindow::dumpColumnInformationPixel() void ScGridWindow::dumpColumnInformationHmm() { - ScDocument& rDoc = pViewData->GetDocument(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + SCTAB nTab = mrViewData.GetTabNo(); for (SCCOL nCol = 0; nCol <= 20; ++nCol) { sal_uInt16 nWidth = rDoc.GetColWidth(nCol, nTab); @@ -65,9 +65,9 @@ void ScGridWindow::dumpColumnInformationHmm() void ScGridWindow::dumpCellProperties() { - ScDocument& rDoc = pViewData->GetDocument(); - const ScMarkData& rMark = pViewData->GetMarkData(); - SCTAB nTab = pViewData->GetTabNo(); + ScDocument& rDoc = mrViewData.GetDocument(); + const ScMarkData& rMark = mrViewData.GetMarkData(); + SCTAB nTab = mrViewData.GetTabNo(); ScRangeList aList; if (rMark.IsMultiMarked()) @@ -82,8 +82,8 @@ void ScGridWindow::dumpCellProperties() } else { - SCCOL nCol = pViewData->GetCurX(); - SCROW nRow = pViewData->GetCurY(); + SCCOL nCol = mrViewData.GetCurX(); + SCROW nRow = mrViewData.GetCurY(); ScRange aRange(nCol, nRow, nTab); aList.Join(aRange, false); @@ -126,7 +126,7 @@ void ScGridWindow::dumpCellProperties() void ScGridWindow::dumpGraphicInformation() { - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); if (!pDrawLayer) return; @@ -154,9 +154,9 @@ void ScGridWindow::dumpGraphicInformation() void ScGridWindow::dumpColumnCellStorage() { // Get the current cursor position. - ScAddress aCurPos = pViewData->GetCurPos(); + ScAddress aCurPos = mrViewData.GetCurPos(); - ScDocument& rDoc = pViewData->GetDocument(); + ScDocument& rDoc = mrViewData.GetDocument(); const ScDPObject* pDP = rDoc.GetDPAtCursor(aCurPos.Col(), aCurPos.Row(), aCurPos.Tab()); if (pDP) { diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 6df09e30d195..ec875dea6c36 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -443,8 +443,8 @@ static void lcl_HidePrint( const ScTableInfo& rTabInfo, SCCOL nX1, SCCOL nX2 ) // - Ole-Object (DocShell::Draw) // - Preview of templates -void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPrintFactor */, - const tools::Rectangle& rBound, ScViewData* pViewData, bool bMetaFile ) +void ScPrintFunc::DrawToDev(ScDocument& rDoc, OutputDevice* pDev, double /* nPrintFactor */, + const tools::Rectangle& rBound, ScViewData* pViewData, bool bMetaFile) { //! evaluate nPrintFactor !!! @@ -453,8 +453,8 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr nTab = pViewData->GetTabNo(); bool bDoGrid, bNullVal, bFormula; - ScStyleSheetPool* pStylePool = pDoc->GetStyleSheetPool(); - SfxStyleSheetBase* pStyleSheet = pStylePool->Find( pDoc->GetPageStyle( nTab ), SfxStyleFamily::Page ); + ScStyleSheetPool* pStylePool = rDoc.GetStyleSheetPool(); + SfxStyleSheetBase* pStyleSheet = pStylePool->Find( rDoc.GetPageStyle( nTab ), SfxStyleFamily::Page ); if (pStyleSheet) { SfxItemSet& rSet = pStyleSheet->GetItemSet(); @@ -464,7 +464,7 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr } else { - const ScViewOptions& rOpt = pDoc->GetViewOptions(); + const ScViewOptions& rOpt = rDoc.GetViewOptions(); bDoGrid = rOpt.GetOption(VOPT_GRID); bNullVal = rOpt.GetOption(VOPT_NULLVALS); bFormula = rOpt.GetOption(VOPT_FORMULAS); @@ -483,7 +483,7 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr SCROW nY2 = OLE_STD_CELLS_Y - 1; if (bMetaFile) { - ScRange aRange = pDoc->GetRange( nTab, rBound ); + ScRange aRange = rDoc.GetRange( nTab, rBound ); nX1 = aRange.aStart.Col(); nY1 = aRange.aStart.Row(); nX2 = aRange.aEnd.Col(); @@ -502,18 +502,18 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr if (nY2>nY1) --nY2; } - if (nX1 > pDoc->MaxCol()) nX1 = pDoc->MaxCol(); - if (nX2 > pDoc->MaxCol()) nX2 = pDoc->MaxCol(); - if (nY1 > pDoc->MaxRow()) nY1 = pDoc->MaxRow(); - if (nY2 > pDoc->MaxRow()) nY2 = pDoc->MaxRow(); + if (nX1 > rDoc.MaxCol()) nX1 = rDoc.MaxCol(); + if (nX2 > rDoc.MaxCol()) nX2 = rDoc.MaxCol(); + if (nY1 > rDoc.MaxRow()) nY1 = rDoc.MaxRow(); + if (nY2 > rDoc.MaxRow()) nY2 = rDoc.MaxRow(); long nDevSizeX = aRect.Right()-aRect.Left()+1; long nDevSizeY = aRect.Bottom()-aRect.Top()+1; long nTwipsSizeX = 0; for (SCCOL i=nX1; i<=nX2; i++) - nTwipsSizeX += pDoc->GetColWidth( i, nTab ); - long nTwipsSizeY = static_cast<long>(pDoc->GetRowHeight( nY1, nY2, nTab )); + nTwipsSizeX += rDoc.GetColWidth( i, nTab ); + long nTwipsSizeY = static_cast<long>(rDoc.GetRowHeight( nY1, nY2, nTab )); // if no lines, still space for the outline frame (20 Twips = 1pt) // (HasLines initializes aLines to 0,0,0,0) @@ -525,22 +525,22 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr //! hand over Flag at FillInfo !!!!! ScRange aERange; - bool bEmbed = pDoc->IsEmbedded(); + bool bEmbed = rDoc.IsEmbedded(); if (bEmbed) { - pDoc->GetEmbedded(aERange); - pDoc->ResetEmbedded(); + rDoc.GetEmbedded(aERange); + rDoc.ResetEmbedded(); } // Assemble data ScTableInfo aTabInfo; - pDoc->FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, - nScaleX, nScaleY, false, bFormula ); + rDoc.FillInfo( aTabInfo, nX1, nY1, nX2, nY2, nTab, + nScaleX, nScaleY, false, bFormula ); lcl_HidePrint( aTabInfo, nX1, nX2 ); if (bEmbed) - pDoc->SetEmbedded(aERange); + rDoc.SetEmbedded(aERange); long nScrX = aRect.Left(); long nScrY = aRect.Top(); @@ -550,13 +550,13 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr nScrX += 1; nScrY += 1; - ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pDoc, nTab, + ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, &rDoc, nTab, nScrX, nScrY, nX1, nY1, nX2, nY2, nScaleX, nScaleY ); aOutputData.SetMetaFileMode(bMetaFile); aOutputData.SetShowNullValues(bNullVal); aOutputData.SetShowFormulas(bFormula); - ScDrawLayer* pModel = pDoc->GetDrawLayer(); + ScDrawLayer* pModel = rDoc.GetDrawLayer(); std::unique_ptr<FmFormView> pDrawView; if( pModel ) @@ -617,7 +617,7 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr long nRight = nScrX + aOutputData.GetScrW() - aOne.Width(); long nBottom = nScrY + aOutputData.GetScrH() - aOne.Height(); - bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); + bool bLayoutRTL = rDoc.IsLayoutRTL( nTab ); // extra line at the left edge for left-to-right, right for right-to-left if ( bLayoutRTL ) diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 14f7a45cb1e9..cc89c444c2e2 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -1428,17 +1428,17 @@ void ScTabView::UpdateShow() if (bShowH && !pGridWin[SC_SPLIT_BOTTOMRIGHT]) { - pGridWin[SC_SPLIT_BOTTOMRIGHT] = VclPtr<ScGridWindow>::Create( pFrameWin, &aViewData, SC_SPLIT_BOTTOMRIGHT ); + pGridWin[SC_SPLIT_BOTTOMRIGHT] = VclPtr<ScGridWindow>::Create( pFrameWin, aViewData, SC_SPLIT_BOTTOMRIGHT ); DoAddWin( pGridWin[SC_SPLIT_BOTTOMRIGHT] ); } if (bShowV && !pGridWin[SC_SPLIT_TOPLEFT]) { - pGridWin[SC_SPLIT_TOPLEFT] = VclPtr<ScGridWindow>::Create( pFrameWin, &aViewData, SC_SPLIT_TOPLEFT ); + pGridWin[SC_SPLIT_TOPLEFT] = VclPtr<ScGridWindow>::Create( pFrameWin, aViewData, SC_SPLIT_TOPLEFT ); DoAddWin( pGridWin[SC_SPLIT_TOPLEFT] ); } if (bShowH && bShowV && !pGridWin[SC_SPLIT_TOPRIGHT]) { - pGridWin[SC_SPLIT_TOPRIGHT] = VclPtr<ScGridWindow>::Create( pFrameWin, &aViewData, SC_SPLIT_TOPRIGHT ); + pGridWin[SC_SPLIT_TOPRIGHT] = VclPtr<ScGridWindow>::Create( pFrameWin, aViewData, SC_SPLIT_TOPRIGHT ); DoAddWin( pGridWin[SC_SPLIT_TOPRIGHT] ); } diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 8a3b889a3ccc..b5ed82510dba 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -72,7 +72,7 @@ void ScTabView::Init() for (i=0; i<4; i++) pGridWin[i] = nullptr; - pGridWin[SC_SPLIT_BOTTOMLEFT] = VclPtr<ScGridWindow>::Create( pFrameWin, &aViewData, SC_SPLIT_BOTTOMLEFT ); + pGridWin[SC_SPLIT_BOTTOMLEFT] = VclPtr<ScGridWindow>::Create( pFrameWin, aViewData, SC_SPLIT_BOTTOMLEFT ); pSelEngine.reset( new ScViewSelectionEngine( pGridWin[SC_SPLIT_BOTTOMLEFT], this, SC_SPLIT_BOTTOMLEFT ) ); diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index 6c902554f898..bd667a51be1e 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -60,7 +60,7 @@ OUString ScTabViewShell::GetSelectionText( bool bWholeWord ) { // limit range to one data row // (only when the call comes from a format dialog) - ScHorizontalCellIterator aIter( &rDoc, aRange.aStart.Tab(), + ScHorizontalCellIterator aIter( rDoc, aRange.aStart.Tab(), aRange.aStart.Col(), aRange.aStart.Row(), aRange.aEnd.Col(), aRange.aEnd.Row() ); SCCOL nCol; |