diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-12-13 20:45:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-12-14 06:57:53 +0100 |
commit | 5bcdbf03012e9d2754c3eb166bd5a01201406d9b (patch) | |
tree | c910eac80023f9cb1c0f943c8edad1928977968f /sc/source/ui | |
parent | 113444f59dc7690850919155b9b164b1a686bbe7 (diff) |
sc: rowcol: tdf#50916 convert Valid* methods
which means we end up passing around ScDocument*
__everywhere__
Change-Id: I44d235ca5e9d57519f068b6880ee7d66f3ceb529
Reviewed-on: https://gerrit.libreoffice.org/83548
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui')
-rw-r--r-- | sc/source/ui/app/inputhdl.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/docshell/arealink.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/dbdocfun.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/docshell/dbdocimp.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh3.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/formdlg/formula.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/anyrefdg.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/chart2uno.cxx | 31 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/select.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/tabview2.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/view/tabview3.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/view/tabview4.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh3.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewdata.cxx | 32 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun2.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun6.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/view/viewutil.cxx | 2 |
23 files changed, 97 insertions, 88 deletions
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 4c8f4fa9153d..52e2ee5bb546 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -2203,16 +2203,20 @@ bool ScInputHandler::StartTable( sal_Unicode cTyped, bool bFromCommand, bool bIn { bool bNewTable = false; - if (bModified || !ValidCol(aCursorPos.Col())) + if (bModified) return false; if (pActiveViewSh) { + ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument(); + + if (!rDoc.ValidCol(aCursorPos.Col())) + return false; + ImplCreateEditEngine(); UpdateActiveView(); SyncViews(); - ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocShell()->GetDocument(); const ScMarkData& rMark = pActiveViewSh->GetViewData().GetMarkData(); ScEditableTester aTester; diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index 366f17198650..0863c75f4be5 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -318,7 +318,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, } //! check CanFitBlock only if bDoInsert is set? - bool bCanDo = ValidColRow( aNewRange.aEnd.Col(), aNewRange.aEnd.Row() ) && + bool bCanDo = rDoc.ValidColRow( aNewRange.aEnd.Col(), aNewRange.aEnd.Row() ) && rDoc.CanFitBlock( aOldRange, aNewRange ); if (bCanDo) { diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index 6ae0cb176dfd..59446bcec528 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -678,7 +678,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, { aLocalParam.MoveToDest(); nDestTab = rQueryParam.nDestTab; - if ( !ValidColRow( aLocalParam.nCol2, aLocalParam.nRow2 ) ) + if ( !rDoc.ValidColRow( aLocalParam.nCol2, aLocalParam.nRow2 ) ) { if (!bApi) rDocShell.ErrorMessage(STR_PASTE_FULL); @@ -1209,7 +1209,7 @@ bool checkNewOutputRange(ScDPObject& rDPObj, ScDocShell& rDocShell, ScRange& rNe SCROW nDiff = aOldRange.aStart.Row() - rNewOut.aStart.Row(); rNewOut.aStart.SetRow(aOldRange.aStart.Row()); rNewOut.aEnd.IncRow(nDiff); - if (!ValidRow(rNewOut.aStart.Row()) || !ValidRow(rNewOut.aEnd.Row())) + if (!rDoc.ValidRow(rNewOut.aStart.Row()) || !rDoc.ValidRow(rNewOut.aEnd.Row())) bOverflow = true; } diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 4e95f43169c2..76d8333cdc78 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -325,7 +325,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, if ( !bEnd ) { - if ( ValidRow(nRow) ) + if ( rDoc.ValidRow(nRow) ) { nCol = rParam.nCol1; for (long i=0; i<nColCount; i++) diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 880d33472e95..b9598ed24c55 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1717,7 +1717,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, SCROW nEndRow = aTargetRange.aEnd.Row(); SCTAB nEndTab = aTargetRange.aEnd.Tab(); - if ( !ValidRow(nStartRow) || !ValidRow(nEndRow) ) + if ( !rDoc.ValidRow(nStartRow) || !rDoc.ValidRow(nEndRow) ) { OSL_FAIL("invalid row in InsertCells"); return false; @@ -2231,7 +2231,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, SCROW nEndRow = rRange.aEnd.Row(); SCTAB nEndTab = rRange.aEnd.Tab(); - if ( !ValidRow(nStartRow) || !ValidRow(nEndRow) ) + if ( !rDoc.ValidRow(nStartRow) || !rDoc.ValidRow(nEndRow) ) { OSL_FAIL("invalid row in DeleteCells"); return false; @@ -2804,7 +2804,8 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, SCROW nDestRow = rDestPos.Row(); SCTAB nDestTab = rDestPos.Tab(); - if ( !ValidRow(nStartRow) || !ValidRow(nEndRow) || !ValidRow(nDestRow) ) + ScDocument& rDoc = rDocShell.GetDocument(); + if ( !rDoc.ValidRow(nStartRow) || !rDoc.ValidRow(nEndRow) || !rDoc.ValidRow(nDestRow) ) { OSL_FAIL("invalid row in MoveBlock"); return false; @@ -2812,7 +2813,6 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, // adjust related scenarios too - but only when moved within one sheet bool bScenariosAdded = false; - ScDocument& rDoc = rDocShell.GetDocument(); if (bRecord && !rDoc.IsUndoEnabled()) bRecord = false; @@ -2880,7 +2880,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos, nUndoEndRow = nDestEndRow + nUndoAdd; } - if (!ValidCol(nUndoEndCol) || !ValidRow(nUndoEndRow)) + if (!rDoc.ValidCol(nUndoEndCol) || !rDoc.ValidRow(nUndoEndRow)) { if (!bApi) rDocShell.ErrorMessage(STR_PASTE_FULL); diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 33133e33a9e4..6806ef37d962 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -113,10 +113,10 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row(); SCTAB nTab1 = rRange.aStart.Tab(), nTab2 = rRange.aEnd.Tab(); - if (!ValidCol(nCol1)) nCol1 = m_aDocument.MaxCol(); - if (!ValidRow(nRow1)) nRow1 = m_aDocument.MaxRow(); - if (!ValidCol(nCol2)) nCol2 = m_aDocument.MaxCol(); - if (!ValidRow(nRow2)) nRow2 = m_aDocument.MaxRow(); + if (!m_aDocument.ValidCol(nCol1)) nCol1 = m_aDocument.MaxCol(); + if (!m_aDocument.ValidRow(nRow1)) nRow1 = m_aDocument.MaxRow(); + if (!m_aDocument.ValidCol(nCol2)) nCol2 = m_aDocument.MaxCol(); + if (!m_aDocument.ValidRow(nRow2)) nRow2 = m_aDocument.MaxRow(); if ( m_pPaintLockData ) { diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index bbe2bff7c845..9ccbf096fc10 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -204,7 +204,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) SCTAB nTab = static_cast<const SfxInt16Item*>(pTabItem)->GetValue() - 1; SCTAB nTabCount = m_aDocument.GetTableCount(); - if ( ValidCol(nCol) && ValidRow(nRow) && ValidTab(nTab,nTabCount) ) + if ( m_aDocument.ValidCol(nCol) && m_aDocument.ValidRow(nRow) && ValidTab(nTab,nTabCount) ) { if ( m_aDocument.IsBlockEditable( nTab, nCol,nRow, nCol, nRow ) ) { diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index bfa4447b3d73..204cfafe86da 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -911,7 +911,7 @@ bool ScImportExport::Text2Doc( SvStream& rStrm ) } if (*p) ++p; - if (ValidCol(nCol) && ValidRow(nRow) ) + if (pDoc->ValidCol(nCol) && pDoc->ValidRow(nRow) ) { if( bSingle ) { @@ -923,9 +923,9 @@ bool ScImportExport::Text2Doc( SvStream& rStrm ) } else // too many columns/rows { - if (!ValidRow(nRow)) + if (!pDoc->ValidRow(nRow)) bOverflowRow = true; // display warning on import - if (!ValidCol(nCol)) + if (!pDoc->ValidCol(nCol)) bOverflowCol = true; // display warning on import } ++nCol; @@ -965,7 +965,7 @@ static bool lcl_PutString( { ScDocument* pDoc = &rDocImport.getDoc(); bool bMultiLine = false; - if ( nColFormat == SC_COL_SKIP || !ValidCol(nCol) || !ValidRow(nRow) ) + if ( nColFormat == SC_COL_SKIP || !pDoc->ValidCol(nCol) || !pDoc->ValidRow(nRow) ) return bMultiLine; if ( rStr.isEmpty() ) { diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index dd9ef3559496..f59a5b9cd9f5 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -431,7 +431,7 @@ void ScFormulaDlg::SetReference( const ScRange& rRef, ScDocument& rRefDoc ) // position. ScTokenArray aArray(&rRefDoc); ScComplexRefData aRefData; - aRefData.InitRangeRel(rRef, m_CursorPos); + aRefData.InitRangeRel(&rRefDoc, rRef, m_CursorPos); bool bSingle = aRefData.Ref1 == aRefData.Ref2; if (m_CursorPos.Tab() != rRef.aStart.Tab()) { diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index ed81d8980ef6..0fa7bff3634d 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -189,6 +189,8 @@ void ScFormulaReferenceHelper::ShowFormulaReference(const OUString& rStr) if (pTabViewShell && pScTokA) { + const ScViewData& rViewData = pTabViewShell->GetViewData(); + ScDocument* pDoc = rViewData.GetDocument(); pTabViewShell->DoneRefMode(); pTabViewShell->ClearHighlightRanges(); @@ -207,12 +209,12 @@ void ScFormulaReferenceHelper::ShowFormulaReference(const OUString& rStr) if(bDoubleRef) { ScComplexRefData aRef( *pToken->GetDoubleRef() ); - aRange = aRef.toAbs(aPos); + aRange = aRef.toAbs(pDoc, aPos); } else { ScSingleRefData aRef( *pToken->GetSingleRef() ); - aRange.aStart = aRef.toAbs(aPos); + aRange.aStart = aRef.toAbs(pDoc, aPos); aRange.aEnd = aRange.aStart; } Color aColName=ScRangeFindList::GetColorName(nIndex++); diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index b7c11adfedba..9be81221a7b2 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -316,7 +316,7 @@ Chart2PositionMap::Chart2PositionMap(SCCOL nAllColCount, SCROW nAllRowCount, if( eType==svExternal || eType==svExternalSingleRef || eType==svExternalDoubleRef || eType==svExternalName ) bExternal = true;//lllll todo correct? ScTokenRef pSharedToken(rCell.second->Clone()); - ScRefTokenHelper::getRangeFromToken(aRange, pSharedToken, ScAddress(), bExternal); + ScRefTokenHelper::getRangeFromToken(pDoc, aRange, pSharedToken, ScAddress(), bExternal); SCCOL nCol1=0, nCol2=0; SCROW nRow1=0, nRow2=0; SCTAB nTab1=0, nTab2=0; @@ -2414,7 +2414,7 @@ void ScChart2DataSequence::RefChanged() for (const auto& rxToken : m_aTokens) { ScRange aRange; - if (!ScRefTokenHelper::getRangeFromToken(aRange, rxToken, ScAddress())) + if (!ScRefTokenHelper::getRangeFromToken(m_pDocument, aRange, rxToken, ScAddress())) continue; m_pDocument->StartListeningArea(aRange, false, m_pValueListener.get()); @@ -2446,7 +2446,7 @@ void ScChart2DataSequence::BuildDataCache() else { ScRange aRange; - if (!ScRefTokenHelper::getRangeFromToken(aRange, rxToken, ScAddress())) + if (!ScRefTokenHelper::getRangeFromToken(m_pDocument, aRange, rxToken, ScAddress())) continue; SCCOL nLastCol = -1; @@ -2536,7 +2536,7 @@ sal_Int32 ScChart2DataSequence::FillCacheFromExternalRef(const ScTokenRef& pToke { ScExternalRefManager* pRefMgr = m_pDocument->GetExternalRefManager(); ScRange aRange; - if (!ScRefTokenHelper::getRangeFromToken(aRange, pToken, ScAddress(), true)) + if (!ScRefTokenHelper::getRangeFromToken(m_pDocument, aRange, pToken, ScAddress(), true)) return 0; sal_uInt16 nFileId = pToken->GetIndex(); @@ -2707,7 +2707,7 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint if (!ScRefTokenHelper::isExternalRef(*itr)) { ScRange aRange; - ScRefTokenHelper::getRangeFromToken(aRange, *itr, ScAddress()); + ScRefTokenHelper::getRangeFromToken(m_pDocument, aRange, *itr, ScAddress()); aRanges.push_back(aRange); sal_uInt32 nPos = distance(itrBeg, itr); m_pRangeIndices->push_back(nPos); @@ -2976,14 +2976,14 @@ namespace { class AccumulateRangeSize { public: - AccumulateRangeSize() : - mnCols(0), mnRows(0) {} + AccumulateRangeSize(const ScDocument* pDoc) : + mpDoc(pDoc), mnCols(0), mnRows(0) {} void operator() (const ScTokenRef& pToken) { ScRange r; bool bExternal = ScRefTokenHelper::isExternalRef(pToken); - ScRefTokenHelper::getRangeFromToken(r, pToken, ScAddress(), bExternal); + ScRefTokenHelper::getRangeFromToken(mpDoc, r, pToken, ScAddress(), bExternal); r.PutInOrder(); mnCols += r.aEnd.Col() - r.aStart.Col() + 1; mnRows += r.aEnd.Row() - r.aStart.Row() + 1; @@ -2992,6 +2992,7 @@ public: SCCOL getCols() const { return mnCols; } SCROW getRows() const { return mnRows; } private: + const ScDocument* mpDoc; SCCOL mnCols; SCROW mnRows; }; @@ -3003,7 +3004,8 @@ private: class GenerateLabelStrings { public: - GenerateLabelStrings(sal_Int32 nSize, chart2::data::LabelOrigin eOrigin, bool bColumn) : + GenerateLabelStrings(const ScDocument* pDoc, sal_Int32 nSize, chart2::data::LabelOrigin eOrigin, bool bColumn) : + mpDoc(pDoc), mpLabels(new Sequence<OUString>(nSize)), meOrigin(eOrigin), mnCount(0), @@ -3013,7 +3015,7 @@ public: { bool bExternal = ScRefTokenHelper::isExternalRef(pToken); ScRange aRange; - ScRefTokenHelper::getRangeFromToken(aRange, pToken, ScAddress(), bExternal); + ScRefTokenHelper::getRangeFromToken(mpDoc, aRange, pToken, ScAddress(), bExternal); OUString* pArr = mpLabels->getArray(); if (mbColumn) { @@ -3052,6 +3054,7 @@ public: const Sequence<OUString>& getLabels() const { return *mpLabels; } private: + const ScDocument* mpDoc; shared_ptr< Sequence<OUString> > mpLabels; chart2::data::LabelOrigin meOrigin; sal_Int32 mnCount; @@ -3067,7 +3070,7 @@ uno::Sequence< OUString > SAL_CALL ScChart2DataSequence::generateLabel(chart2::d throw uno::RuntimeException(); // Determine the total size of all ranges. - AccumulateRangeSize func; + AccumulateRangeSize func(m_pDocument); func = ::std::for_each(m_aTokens.begin(), m_aTokens.end(), func); SCCOL nCols = func.getCols(); SCROW nRows = func.getRows(); @@ -3091,7 +3094,7 @@ uno::Sequence< OUString > SAL_CALL ScChart2DataSequence::generateLabel(chart2::d // Generate label strings based on the info so far. sal_Int32 nCount = bColumn ? nCols : nRows; - GenerateLabelStrings genLabels(nCount, eOrigin, bColumn); + GenerateLabelStrings genLabels(m_pDocument, nCount, eOrigin, bColumn); genLabels = ::std::for_each(m_aTokens.begin(), m_aTokens.end(), genLabels); Sequence<OUString> aSeq = genLabels.getLabels(); @@ -3171,7 +3174,7 @@ void SAL_CALL ScChart2DataSequence::addModifyListener( const uno::Reference< uti return; ScRangeList aRanges; - ScRefTokenHelper::getRangeListFromTokens(aRanges, m_aTokens, ScAddress()); + ScRefTokenHelper::getRangeListFromTokens(m_pDocument, aRanges, m_aTokens, ScAddress()); m_aValueListeners.emplace_back( aListener ); if ( m_aValueListeners.size() == 1 ) @@ -3188,7 +3191,7 @@ void SAL_CALL ScChart2DataSequence::addModifyListener( const uno::Reference< uti for (const auto& rxToken : m_aTokens) { ScRange aRange; - if (!ScRefTokenHelper::getRangeFromToken(aRange, rxToken, ScAddress())) + if (!ScRefTokenHelper::getRangeFromToken(m_pDocument, aRange, rxToken, ScAddress())) continue; m_pDocument->StartListeningArea( aRange, false, m_pValueListener.get() ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index e3a7a8f69de0..1d0a86481f3b 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4870,7 +4870,7 @@ static void lcl_PaintOneRange( ScDocShell* pDocSh, const ScRange& rRange, sal_uI bHiddenEdge = true; } nTmp = rDoc.FirstVisibleRow(0, nRow1, nTab1); - if (!ValidRow(nTmp)) + if (!rDoc.ValidRow(nTmp)) nTmp = 0; if (nTmp < nRow1) { @@ -4878,7 +4878,7 @@ static void lcl_PaintOneRange( ScDocShell* pDocSh, const ScRange& rRange, sal_uI bHiddenEdge = true; } nTmp = rDoc.FirstVisibleRow(nRow2, rDoc.MaxRow(), nTab1); - if (!ValidRow(nTmp)) + if (!rDoc.ValidRow(nTmp)) nTmp = rDoc.MaxRow(); if (nTmp > nRow2) { @@ -6326,7 +6326,7 @@ void ScGridWindow::UpdateDragRectOverlay() bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); long nLayoutSign = bLayoutRTL ? -1 : 1; - if (ValidCol(nX2) && nX2>=nX1) + if (pDoc->ValidCol(nX2) && nX2>=nX1) for (i=nX1; i<=nX2; i++) nSizeXPix += ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(i), nTab ), nPPTX ); else @@ -6335,7 +6335,7 @@ void ScGridWindow::UpdateDragRectOverlay() nSizeXPix += 2; } - if (ValidRow(nY2) && nY2>=nY1) + if (pDoc->ValidRow(nY2) && nY2>=nY1) for (i=nY1; i<=nY2; i++) nSizeYPix += ScViewData::ToPixel( pDoc->GetRowHeight( i, nTab ), nPPTY ); else diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index b60977f95025..7ed91bdac886 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -398,7 +398,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod PutInOrder( nX1, nX2 ); PutInOrder( nY1, nY2 ); - OSL_ENSURE( ValidCol(nX2) && ValidRow(nY2), "GridWin Draw area too big" ); + OSL_ENSURE( rDoc.ValidCol(nX2) && rDoc.ValidRow(nY2), "GridWin Draw area too big" ); UpdateVisibleRange(); diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index 489ea67cfeda..e532e07bd518 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -351,7 +351,7 @@ void ScViewFunctionSet::SetCursorAtPoint( const Point& rPointPixel, bool /* bDon if (--nPosY >= 0) { nPosY = pDoc->LastVisibleRow(0, nPosY, nTab); - if (!ValidRow(nPosY)) + if (!pDoc->ValidRow(nPosY)) nPosY = -1; } } @@ -571,7 +571,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll if (++nPosY < nStartY) { nPosY = pDoc->FirstVisibleRow(nPosY, nStartY-1, nTab); - if (!ValidRow(nPosY)) + if (!pDoc->ValidRow(nPosY)) nPosY = nStartY; } nSizeY += pDoc->GetRowHeight( nPosY, nStartY-1, nTab ); diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 6983f2fee4b7..72d0a9faa77f 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -302,10 +302,10 @@ void moveCursorByMergedCell( void ScTabView::PaintMarks(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) { auto pDoc = aViewData.GetDocument(); - if (!ValidCol(nStartCol)) nStartCol = pDoc->MaxCol(); - if (!ValidRow(nStartRow)) nStartRow = pDoc->MaxRow(); - if (!ValidCol(nEndCol)) nEndCol = pDoc->MaxCol(); - if (!ValidRow(nEndRow)) nEndRow = pDoc->MaxRow(); + if (!pDoc->ValidCol(nStartCol)) nStartCol = pDoc->MaxCol(); + if (!pDoc->ValidRow(nStartRow)) nStartRow = pDoc->MaxRow(); + if (!pDoc->ValidCol(nEndCol)) nEndCol = pDoc->MaxCol(); + if (!pDoc->ValidRow(nEndRow)) nEndRow = pDoc->MaxRow(); bool bLeft = (nStartCol==0 && nEndCol==pDoc->MaxCol()); bool bTop = (nStartRow==0 && nEndRow==pDoc->MaxRow()); @@ -355,8 +355,8 @@ void ScTabView::InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, if (!IsBlockMode()) { auto pDoc = aViewData.GetDocument(); - if (!ValidCol(nCurX)) nCurX = pDoc->MaxCol(); - if (!ValidRow(nCurY)) nCurY = pDoc->MaxRow(); + if (!pDoc->ValidCol(nCurX)) nCurX = pDoc->MaxCol(); + if (!pDoc->ValidRow(nCurY)) nCurY = pDoc->MaxRow(); ScMarkData& rMark = aViewData.GetMarkData(); SCTAB nTab = aViewData.GetTabNo(); @@ -449,8 +449,8 @@ void ScTabView::MarkCursor( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, bool bCols, bool bRows, bool bCellSelection ) { ScDocument* pDocument = aViewData.GetDocument(); - if (!ValidCol(nCurX)) nCurX = pDocument->MaxCol(); - if (!ValidRow(nCurY)) nCurY = pDocument->MaxRow(); + if (!pDocument->ValidCol(nCurX)) nCurX = pDocument->MaxCol(); + if (!pDocument->ValidRow(nCurY)) nCurY = pDocument->MaxRow(); if (!IsBlockMode()) { diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index f512e8dd9127..a14fb12b3fc1 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -1170,11 +1170,11 @@ void ScTabView::MoveCursorAbs( SCCOL nCurX, SCROW nCurY, ScFollowMode eMode, if (!bKeepOld) aViewData.ResetOldCursor(); + ScDocument* pDoc = aViewData.GetDocument(); // #i123629# if( aViewData.GetViewShell()->GetForceFocusOnCurCell() ) - aViewData.GetViewShell()->SetForceFocusOnCurCell( !ValidColRow(nCurX, nCurY) ); + aViewData.GetViewShell()->SetForceFocusOnCurCell( !pDoc->ValidColRow(nCurX, nCurY) ); - ScDocument* pDoc = aViewData.GetDocument(); if (nCurX < 0) nCurX = 0; if (nCurY < 0) nCurY = 0; if (nCurX > pDoc->MaxCol()) nCurX = pDoc->MaxCol(); @@ -1288,10 +1288,10 @@ void ScTabView::MoveCursorRel( SCCOL nMovX, SCROW nMovY, ScFollowMode eMode, aViewData.ResetOldCursor(); - if (nMovX != 0 && ValidColRow(nCurX,nCurY)) + if (nMovX != 0 && pDoc->ValidColRow(nCurX,nCurY)) SkipCursorHorizontal(nCurX, nCurY, nOldX, nMovX); - if (nMovY != 0 && ValidColRow(nCurX,nCurY)) + if (nMovY != 0 && pDoc->ValidColRow(nCurX,nCurY)) SkipCursorVertical(nCurX, nCurY, nOldY, nMovY); MoveCursorAbs( nCurX, nCurY, eMode, bShift, false, true, bKeepSel ); @@ -2438,7 +2438,7 @@ void ScTabView::PaintRangeFinderEntry (const ScRangeFindData* pData, const SCTAB bHiddenEdge = true; } nTmp = pDoc->LastVisibleRow(0, nRow1, nTab); - if (!ValidRow(nTmp)) + if (!pDoc->ValidRow(nTmp)) nTmp = 0; if (nTmp < nRow1) { @@ -2446,7 +2446,7 @@ void ScTabView::PaintRangeFinderEntry (const ScRangeFindData* pData, const SCTAB bHiddenEdge = true; } nTmp = pDoc->FirstVisibleRow(nRow2, pDoc->MaxRow(), nTab); - if (!ValidRow(nTmp)) + if (!pDoc->ValidRow(nTmp)) nTmp = pDoc->MaxRow(); if (nTmp > nRow2) { diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index f584dfdc8482..45c7f3492a86 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -518,10 +518,10 @@ void ScTabView::InterpretVisible() ScHSplitPos eHWhich = WhichH( ScSplitPos(i) ); ScVSplitPos eVWhich = WhichV( ScSplitPos(i) ); - SCCOL nX1 = SanitizeCol( aViewData.GetPosX( eHWhich )); - SCROW nY1 = SanitizeRow( aViewData.GetPosY( eVWhich )); - SCCOL nX2 = SanitizeCol( nX1 + aViewData.VisibleCellsX( eHWhich )); - SCROW nY2 = SanitizeRow( nY1 + aViewData.VisibleCellsY( eVWhich )); + SCCOL nX1 = pDoc->SanitizeCol( aViewData.GetPosX( eHWhich )); + SCROW nY1 = pDoc->SanitizeRow( aViewData.GetPosY( eVWhich )); + SCCOL nX2 = pDoc->SanitizeCol( nX1 + aViewData.VisibleCellsX( eHWhich )); + SCROW nY2 = pDoc->SanitizeRow( nY1 + aViewData.VisibleCellsY( eVWhich )); pDoc->InterpretDirtyCells(ScRange(nX1, nY1, nTab, nX2, nY2, nTab)); } diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 419c6bce7845..5601804260f1 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -381,7 +381,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) } } - if ( !ValidRow(aScRange.aStart.Row()) || !ValidRow(aScRange.aEnd.Row()) ) + if ( !pDoc->ValidRow(aScRange.aStart.Row()) || !pDoc->ValidRow(aScRange.aEnd.Row()) ) nResult = ScRefFlags::ZERO; // we have found something diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index d10e1d8be8ed..564c367d60f3 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -595,12 +595,12 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV if (sName == SC_CURSORPOSITIONX) { rSetting.Value >>= nTemp32; - nCurX = SanitizeCol( static_cast<SCCOL>(nTemp32)); + nCurX = rViewData.GetDocument()->SanitizeCol( static_cast<SCCOL>(nTemp32)); } else if (sName == SC_CURSORPOSITIONY) { rSetting.Value >>= nTemp32; - nCurY = SanitizeRow( static_cast<SCROW>(nTemp32)); + nCurY = rViewData.GetDocument()->SanitizeRow( static_cast<SCROW>(nTemp32)); } else if (sName == SC_HORIZONTALSPLITMODE) { @@ -640,22 +640,22 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV else if (sName == SC_POSITIONLEFT) { rSetting.Value >>= nTemp32; - nPosX[SC_SPLIT_LEFT] = SanitizeCol( static_cast<SCCOL>(nTemp32)); + nPosX[SC_SPLIT_LEFT] = rViewData.GetDocument()->SanitizeCol( static_cast<SCCOL>(nTemp32)); } else if (sName == SC_POSITIONRIGHT) { rSetting.Value >>= nTemp32; - nPosX[SC_SPLIT_RIGHT] = SanitizeCol( static_cast<SCCOL>(nTemp32)); + nPosX[SC_SPLIT_RIGHT] = rViewData.GetDocument()->SanitizeCol( static_cast<SCCOL>(nTemp32)); } else if (sName == SC_POSITIONTOP) { rSetting.Value >>= nTemp32; - nPosY[SC_SPLIT_TOP] = SanitizeRow( static_cast<SCROW>(nTemp32)); + nPosY[SC_SPLIT_TOP] = rViewData.GetDocument()->SanitizeRow( static_cast<SCROW>(nTemp32)); } else if (sName == SC_POSITIONBOTTOM) { rSetting.Value >>= nTemp32; - nPosY[SC_SPLIT_BOTTOM] = SanitizeRow( static_cast<SCROW>(nTemp32)); + nPosY[SC_SPLIT_BOTTOM] = rViewData.GetDocument()->SanitizeRow( static_cast<SCROW>(nTemp32)); } else if (sName == SC_ZOOMTYPE) { @@ -703,12 +703,12 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV } if (eHSplitMode == SC_SPLIT_FIX) - nFixPosX = SanitizeCol( static_cast<SCCOL>( bHasHSplitInTwips ? nTempPosHTw : nTempPosH )); + nFixPosX = rViewData.GetDocument()->SanitizeCol( static_cast<SCCOL>( bHasHSplitInTwips ? nTempPosHTw : nTempPosH )); else nHSplitPos = bHasHSplitInTwips ? static_cast< long >( nTempPosHTw * rViewData.GetPPTX() ) : nTempPosH; if (eVSplitMode == SC_SPLIT_FIX) - nFixPosY = SanitizeRow( static_cast<SCROW>( bHasVSplitInTwips ? nTempPosVTw : nTempPosV )); + nFixPosY = rViewData.GetDocument()->SanitizeRow( static_cast<SCROW>( bHasVSplitInTwips ? nTempPosVTw : nTempPosV )); else nVSplitPos = bHasVSplitInTwips ? static_cast< long >( nTempPosVTw * rViewData.GetPPTY() ) : nTempPosV; @@ -2954,15 +2954,15 @@ void ScViewData::ReadUserData(const OUString& rData) if (cTabSep) { nIdx = 0; - maTabData[nPos]->nCurX = SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32())); - maTabData[nPos]->nCurY = SanitizeRow( aTabOpt.getToken(0, cTabSep, nIdx).toInt32()); + maTabData[nPos]->nCurX = pDoc->SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32())); + maTabData[nPos]->nCurY = pDoc->SanitizeRow( aTabOpt.getToken(0, cTabSep, nIdx).toInt32()); maTabData[nPos]->eHSplitMode = static_cast<ScSplitMode>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32()); maTabData[nPos]->eVSplitMode = static_cast<ScSplitMode>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32()); sal_Int32 nTmp{ aTabOpt.getToken(0, cTabSep, nIdx).toInt32() }; if ( maTabData[nPos]->eHSplitMode == SC_SPLIT_FIX ) { - maTabData[nPos]->nFixPosX = SanitizeCol( static_cast<SCCOL>(nTmp)); + maTabData[nPos]->nFixPosX = pDoc->SanitizeCol( static_cast<SCCOL>(nTmp)); UpdateFixX(nPos); } else @@ -2971,17 +2971,17 @@ void ScViewData::ReadUserData(const OUString& rData) nTmp = aTabOpt.getToken(0, cTabSep, nIdx).toInt32(); if ( maTabData[nPos]->eVSplitMode == SC_SPLIT_FIX ) { - maTabData[nPos]->nFixPosY = SanitizeRow(nTmp); + maTabData[nPos]->nFixPosY = pDoc->SanitizeRow(nTmp); UpdateFixY(nPos); } else maTabData[nPos]->nVSplitPos = nTmp; maTabData[nPos]->eWhichActive = static_cast<ScSplitPos>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32()); - maTabData[nPos]->nPosX[0] = SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32())); - maTabData[nPos]->nPosX[1] = SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32())); - maTabData[nPos]->nPosY[0] = SanitizeRow( aTabOpt.getToken(0, cTabSep, nIdx).toInt32()); - maTabData[nPos]->nPosY[1] = SanitizeRow( aTabOpt.getToken(0, cTabSep, nIdx).toInt32()); + maTabData[nPos]->nPosX[0] = pDoc->SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32())); + maTabData[nPos]->nPosX[1] = pDoc->SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(0, cTabSep, nIdx).toInt32())); + maTabData[nPos]->nPosY[0] = pDoc->SanitizeRow( aTabOpt.getToken(0, cTabSep, nIdx).toInt32()); + maTabData[nPos]->nPosY[1] = pDoc->SanitizeRow( aTabOpt.getToken(0, cTabSep, nIdx).toInt32()); maTabData[nPos]->eWhichActive = maTabData[nPos]->SanitizeWhichActive(); } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 198a53495798..1880365a38af 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -808,7 +808,7 @@ OUString ScViewFunc::GetAutoSumFormula( const ScRangeList& rRangeList, bool bSub if (i != 0) pArray->AddOpCode(ocSep); ScComplexRefData aRef; - aRef.InitRangeRel(r, rAddr); + aRef.InitRangeRel(pDoc, r, rAddr); pArray->AddDoubleReference(aRef); } } diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 7a39f5037fa2..72bd69f209f2 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1129,7 +1129,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, nEndTab = nStartTab; } - bool bOffLimits = !ValidCol(nEndCol) || !ValidRow(nEndRow); + bool bOffLimits = !pDoc->ValidCol(nEndCol) || !pDoc->ValidRow(nEndRow); // target-range, as displayed: ScRange aUserRange( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ); @@ -1500,7 +1500,7 @@ bool ScViewFunc::PasteMultiRangesFromClip( nRowSize = static_cast<SCROW>(nTempColSize); } - if (!ValidCol(rCurPos.Col()+nColSize-1) || !ValidRow(rCurPos.Row()+nRowSize-1)) + if (!pDoc->ValidCol(rCurPos.Col()+nColSize-1) || !pDoc->ValidRow(rCurPos.Row()+nRowSize-1)) { ErrorMessage(STR_PASTE_FULL); return false; @@ -1668,7 +1668,7 @@ bool ScViewFunc::PasteFromClipToMultiRanges( SCROW nRowSize = aSrcRange.aEnd.Row() - aSrcRange.aStart.Row() + 1; SCCOL nColSize = aSrcRange.aEnd.Col() - aSrcRange.aStart.Col() + 1; - if (!ValidCol(rCurPos.Col()+nColSize-1) || !ValidRow(rCurPos.Row()+nRowSize-1)) + if (!pDoc->ValidCol(rCurPos.Col()+nColSize-1) || !pDoc->ValidRow(rCurPos.Row()+nRowSize-1)) { ErrorMessage(STR_PASTE_FULL); return false; diff --git a/sc/source/ui/view/viewfun6.cxx b/sc/source/ui/view/viewfun6.cxx index 393b33c3a09b..16a85889656e 100644 --- a/sc/source/ui/view/viewfun6.cxx +++ b/sc/source/ui/view/viewfun6.cxx @@ -177,7 +177,7 @@ void ScViewFunc::DetectiveMarkPred() const OUString* pPath = pRefMgr->getExternalFileName(nFileId); ScRange aRange; - if (pPath && ScRefTokenHelper::getRangeFromToken(aRange, p, aCurPos, true)) + if (pPath && ScRefTokenHelper::getRangeFromToken(&rDoc, aRange, p, aCurPos, true)) { OUString aTabName = p->GetString().getString(); OUString aRangeStr(aRange.Format(rDoc, ScRefFlags::VALID)); @@ -195,7 +195,7 @@ void ScViewFunc::DetectiveMarkPred() else { ScRange aRange; - ScRefTokenHelper::getRangeFromToken(aRange, p, aCurPos); + ScRefTokenHelper::getRangeFromToken(&rDoc, aRange, p, aCurPos); if (aRange.aStart.Tab() != aCurPos.Tab()) { // The first precedent range is on a different sheet. Jump to it @@ -206,7 +206,7 @@ void ScViewFunc::DetectiveMarkPred() } ScRangeList aDestRanges; - ScRefTokenHelper::getRangeListFromTokens(aDestRanges, aRefTokens, aCurPos); + ScRefTokenHelper::getRangeListFromTokens(&rDoc, aDestRanges, aRefTokens, aCurPos); MarkAndJumpToRanges(aDestRanges); } @@ -230,7 +230,7 @@ void ScViewFunc::DetectiveMarkSucc() return; ScRangeList aDestRanges; - ScRefTokenHelper::getRangeListFromTokens(aDestRanges, aRefTokens, aCurPos); + ScRefTokenHelper::getRangeListFromTokens(rView.GetDocument(), aDestRanges, aRefTokens, aCurPos); MarkAndJumpToRanges(aDestRanges); } diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index 8368cbee7c89..75c7ac543b80 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -263,7 +263,7 @@ bool ScViewUtil::FitToUnfilteredRows( ScRange & rRange, const ScDocument * pDoc, OSL_ENSURE( bOneTabOnly, "ScViewUtil::ExtendToUnfilteredRows: works only on one sheet"); SCROW nStartRow = rRange.aStart.Row(); SCROW nLastRow = pDoc->LastNonFilteredRow(nStartRow, pDoc->MaxRow(), nTab); - if (ValidRow(nLastRow)) + if (pDoc->ValidRow(nLastRow)) rRange.aEnd.SetRow(nLastRow); SCROW nCount = pDoc->CountNonFilteredRows(nStartRow, pDoc->MaxRow(), nTab); return static_cast<size_t>(nCount) == nRows && bOneTabOnly; |