sc/qa/unit/bugfix-test.cxx | 6 sc/qa/unit/screenshots/screenshots.cxx | 6 sc/qa/unit/tiledrendering/tiledrendering.cxx | 4 sc/source/ui/Accessibility/AccessibleCell.cxx | 2 sc/source/ui/Accessibility/AccessibleDocument.cxx | 17 sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx | 2 sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx | 2 sc/source/ui/StatisticsDialogs/SamplingDialog.cxx | 2 sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx | 2 sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx | 2 sc/source/ui/app/inputhdl.cxx | 46 - sc/source/ui/app/inputwin.cxx | 30 sc/source/ui/app/scmod.cxx | 4 sc/source/ui/condformat/condformatdlg.cxx | 26 sc/source/ui/dbgui/PivotLayoutDialog.cxx | 2 sc/source/ui/dbgui/consdlg.cxx | 43 - sc/source/ui/dbgui/dbnamdlg.cxx | 2 sc/source/ui/dbgui/filtdlg.cxx | 4 sc/source/ui/dbgui/foptmgr.cxx | 2 sc/source/ui/dbgui/pfiltdlg.cxx | 4 sc/source/ui/dbgui/scendlg.cxx | 4 sc/source/ui/dbgui/sfiltdlg.cxx | 2 sc/source/ui/dbgui/tpsort.cxx | 13 sc/source/ui/dbgui/tpsubt.cxx | 4 sc/source/ui/drawfunc/drawsh.cxx | 6 sc/source/ui/drawfunc/drawsh2.cxx | 2 sc/source/ui/drawfunc/drawsh5.cxx | 4 sc/source/ui/drawfunc/drtxtob.cxx | 4 sc/source/ui/drawfunc/fuins1.cxx | 10 sc/source/ui/drawfunc/fuins2.cxx | 16 sc/source/ui/drawfunc/fupoor.cxx | 2 sc/source/ui/drawfunc/fusel.cxx | 10 sc/source/ui/drawfunc/fusel2.cxx | 2 sc/source/ui/drawfunc/futext3.cxx | 2 sc/source/ui/formdlg/formula.cxx | 4 sc/source/ui/inc/condformatdlg.hxx | 2 sc/source/ui/inc/consdlg.hxx | 2 sc/source/ui/inc/crnrdlg.hxx | 2 sc/source/ui/inc/drawview.hxx | 2 sc/source/ui/inc/highred.hxx | 2 sc/source/ui/inc/namedlg.hxx | 2 sc/source/ui/inc/olinewin.hxx | 2 sc/source/ui/inc/viewdata.hxx | 4 sc/source/ui/miscdlgs/acredlin.cxx | 6 sc/source/ui/miscdlgs/anyrefdg.cxx | 20 sc/source/ui/miscdlgs/autofmt.cxx | 6 sc/source/ui/miscdlgs/conflictsdlg.cxx | 2 sc/source/ui/miscdlgs/crnrdlg.cxx | 92 +-- sc/source/ui/miscdlgs/datafdlg.cxx | 4 sc/source/ui/miscdlgs/highred.cxx | 16 sc/source/ui/miscdlgs/instbdlg.cxx | 2 sc/source/ui/namedlg/namedefdlg.cxx | 2 sc/source/ui/namedlg/namedlg.cxx | 16 sc/source/ui/navipi/navcitem.cxx | 2 sc/source/ui/navipi/navipi.cxx | 20 sc/source/ui/optdlg/tpusrlst.cxx | 2 sc/source/ui/pagedlg/tphf.cxx | 4 sc/source/ui/uitest/uiobject.cxx | 22 sc/source/ui/undo/undoblk.cxx | 2 sc/source/ui/unoobj/docuno.cxx | 6 sc/source/ui/unoobj/viewuno.cxx | 27 sc/source/ui/vba/vbanames.cxx | 8 sc/source/ui/vba/vbanames.hxx | 2 sc/source/ui/vba/vbaworksheets.cxx | 2 sc/source/ui/view/auditsh.cxx | 2 sc/source/ui/view/cellsh.cxx | 170 ++--- sc/source/ui/view/cellsh1.cxx | 164 ++--- sc/source/ui/view/cellsh2.cxx | 86 +- sc/source/ui/view/cellsh3.cxx | 28 sc/source/ui/view/cellsh4.cxx | 4 sc/source/ui/view/cliputil.cxx | 6 sc/source/ui/view/colrowba.cxx | 46 - sc/source/ui/view/dbfunc.cxx | 26 sc/source/ui/view/dbfunc2.cxx | 6 sc/source/ui/view/dbfunc3.cxx | 132 ++-- sc/source/ui/view/drawvie3.cxx | 15 sc/source/ui/view/drawvie4.cxx | 10 sc/source/ui/view/drawview.cxx | 48 - sc/source/ui/view/editsh.cxx | 10 sc/source/ui/view/formatsh.cxx | 68 +- sc/source/ui/view/gridwin.cxx | 304 +++++----- sc/source/ui/view/gridwin2.cxx | 26 sc/source/ui/view/gridwin3.cxx | 10 sc/source/ui/view/gridwin4.cxx | 154 ++--- sc/source/ui/view/gridwin5.cxx | 20 sc/source/ui/view/gridwin_dbgutil.cxx | 22 sc/source/ui/view/hdrcont.cxx | 26 sc/source/ui/view/pgbrksh.cxx | 2 sc/source/ui/view/pivotsh.cxx | 6 sc/source/ui/view/select.cxx | 38 - sc/source/ui/view/tabcont.cxx | 88 +- sc/source/ui/view/tabview.cxx | 116 +-- sc/source/ui/view/tabview2.cxx | 162 ++--- sc/source/ui/view/tabview3.cxx | 166 ++--- sc/source/ui/view/tabview4.cxx | 54 - sc/source/ui/view/tabview5.cxx | 34 - sc/source/ui/view/tabvwsh.cxx | 4 sc/source/ui/view/tabvwsh3.cxx | 38 - sc/source/ui/view/tabvwsh4.cxx | 17 sc/source/ui/view/tabvwsh5.cxx | 10 sc/source/ui/view/tabvwsh8.cxx | 4 sc/source/ui/view/tabvwsha.cxx | 71 +- sc/source/ui/view/tabvwshb.cxx | 8 sc/source/ui/view/tabvwshc.cxx | 28 sc/source/ui/view/tabvwshe.cxx | 8 sc/source/ui/view/tabvwshf.cxx | 98 +-- sc/source/ui/view/tabvwshg.cxx | 8 sc/source/ui/view/tabvwshh.cxx | 16 sc/source/ui/view/viewdata.cxx | 95 +-- sc/source/ui/view/viewfun2.cxx | 229 +++---- sc/source/ui/view/viewfun3.cxx | 237 +++---- sc/source/ui/view/viewfun4.cxx | 36 - sc/source/ui/view/viewfun5.cxx | 24 sc/source/ui/view/viewfun6.cxx | 2 sc/source/ui/view/viewfun7.cxx | 30 sc/source/ui/view/viewfunc.cxx | 170 ++--- 116 files changed, 1859 insertions(+), 1897 deletions(-)
New commits: commit bf3d1b8e8f89bfdb409c70cfea126f36474d4772 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Sep 14 16:42:52 2020 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Sep 15 21:36:27 2020 +0200 establish that ScViewData::GetDocument can always return ScDocument& we can only be ctored with a ScDocShell& or ScDocument&, and ScDocShell provides a ScDocument& from its GetDocument() so we can always have a ScDocument& when a public ctor has completed some null checks can then be seen to be redundant and are removed Change-Id: Ifaf39cb06e8dbce363999c05ee0aeb3ec4f00428 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102775 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx index 62e356ddb6d2..df5817a06be2 100644 --- a/sc/qa/unit/bugfix-test.cxx +++ b/sc/qa/unit/bugfix-test.cxx @@ -169,12 +169,12 @@ void ScFiltersTest::testTdf91979() ScTabViewShell* pViewShell = xDocSh->GetBestViewShell(false); CPPUNIT_ASSERT(pViewShell != nullptr); auto& aViewData = pViewShell->GetViewData(); - auto* pDoc = aViewData.GetDocument(); + auto& rDoc = aViewData.GetDocument(); // Check coordinates of a distant cell Point aPos = aViewData.GetScrPos(MAXCOL - 1, 10000, SC_SPLIT_TOPLEFT, true); - int nColWidth = ScViewData::ToPixel(pDoc->GetColWidth(0, 0), aViewData.GetPPTX()); - int nRowHeight = ScViewData::ToPixel(pDoc->GetRowHeight(0, 0), aViewData.GetPPTY()); + int nColWidth = ScViewData::ToPixel(rDoc.GetColWidth(0, 0), aViewData.GetPPTX()); + int nRowHeight = ScViewData::ToPixel(rDoc.GetRowHeight(0, 0), aViewData.GetPPTY()); CPPUNIT_ASSERT_EQUAL(static_cast<long>((MAXCOL - 1) * nColWidth), aPos.getX()); CPPUNIT_ASSERT_EQUAL(static_cast<long>(10000 * nRowHeight), aPos.getY()); } diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index 632466e828f1..08100126a7ae 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -236,16 +236,16 @@ VclPtr<VclAbstractDialog> ScScreenshotTest::createDialogByID(sal_uInt32 nID) case 14: // "modules/scalc/ui/formatcellsdialog.ui" { ScViewData& rViewData = mpViewShell->GetViewData(); - ScDocument *pDoc = rViewData.GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); const ScPatternAttr *pAttr = mpViewShell->GetSelectionPattern(); std::unique_ptr<SvxNumberInfoItem> pNumberInfoItem; mpItemSet.reset(new SfxItemSet(pAttr->GetItemSet())); mpItemSet->Put(SfxUInt32Item(ATTR_VALUE_FORMAT, - pAttr->GetNumberFormat( pDoc->GetFormatTable() ) ) ); + pAttr->GetNumberFormat( rDoc.GetFormatTable() ) ) ); - pNumberInfoItem = ScTabViewShell::MakeNumberInfoItem(pDoc, &rViewData); + pNumberInfoItem = ScTabViewShell::MakeNumberInfoItem(&rDoc, &rViewData); mpItemSet->MergeRange(SID_ATTR_NUMBERFORMAT_INFO, SID_ATTR_NUMBERFORMAT_INFO); mpItemSet->Put(*pNumberInfoItem); diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 965dac89f5c9..fa560813b30f 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -655,7 +655,7 @@ void ScTiledRenderingTest::testViewLock() const ScViewData* pViewData = ScDocShell::GetViewData(); ScTabViewShell* pViewShell = pViewData->GetViewShell(); CPPUNIT_ASSERT(pViewShell); - SdrModel* pDrawModel = pViewData->GetDocument()->GetDrawLayer(); + SdrModel* pDrawModel = pViewData->GetDocument().GetDrawLayer(); SdrPage* pDrawPage = pDrawModel->GetPage(0); SdrObject* pObject = pDrawPage->GetObj(0); SdrView* pView = pViewShell->GetScDrawView(); @@ -838,7 +838,7 @@ void ScTiledRenderingTest::testCreateViewGraphicSelection() const ScViewData* pViewData = ScDocShell::GetViewData(); ScTabViewShell* pViewShell = pViewData->GetViewShell(); CPPUNIT_ASSERT(pViewShell); - SdrModel* pDrawModel = pViewData->GetDocument()->GetDrawLayer(); + SdrModel* pDrawModel = pViewData->GetDocument().GetDrawLayer(); SdrPage* pDrawPage = pDrawModel->GetPage(0); SdrObject* pObject = pDrawPage->GetObj(0); SdrView* pView = pViewShell->GetScDrawView(); diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index 800cca592385..e036a9fbd41e 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -366,7 +366,7 @@ ScDocument* ScAccessibleCell::GetDocument(ScTabViewShell* pViewShell) { ScDocument* pDoc = nullptr; if (pViewShell) - pDoc = pViewShell->GetViewData().GetDocument(); + pDoc = &pViewShell->GetViewData().GetDocument(); return pDoc; } diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 34c131741384..42b7ee4bcc73 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -323,12 +323,12 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* pAccessibleDocument, Sc return; ScViewData& rViewData = pViewShell->GetViewData(); - SfxBroadcaster* pDrawBC = rViewData.GetDocument()->GetDrawBroadcaster(); + SfxBroadcaster* pDrawBC = rViewData.GetDocument().GetDrawBroadcaster(); if (pDrawBC) { StartListening(*pDrawBC); - maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(rViewData.GetDocument()->GetDrawLayer()) ); + maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(rViewData.GetDocument().GetDrawLayer()) ); maShapeTreeInfo.SetSdrView(rViewData.GetScDrawView()); maShapeTreeInfo.SetController(nullptr); maShapeTreeInfo.SetDevice(pViewShell->GetWindowByPos(meSplitPos)); @@ -342,7 +342,7 @@ ScChildrenShapes::~ScChildrenShapes() delete pShapeData; if (mpViewShell) { - SfxBroadcaster* pDrawBC = mpViewShell->GetViewData().GetDocument()->GetDrawBroadcaster(); + SfxBroadcaster* pDrawBC = mpViewShell->GetViewData().GetDocument().GetDrawBroadcaster(); if (pDrawBC) EndListening(*pDrawBC); } @@ -356,12 +356,12 @@ void ScChildrenShapes::SetDrawBroadcaster() return; ScViewData& rViewData = mpViewShell->GetViewData(); - SfxBroadcaster* pDrawBC = rViewData.GetDocument()->GetDrawBroadcaster(); + SfxBroadcaster* pDrawBC = rViewData.GetDocument().GetDrawBroadcaster(); if (pDrawBC) { StartListening(*pDrawBC, DuplicateHandling::Prevent); - maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(rViewData.GetDocument()->GetDrawLayer()) ); + maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(rViewData.GetDocument().GetDrawLayer()) ); maShapeTreeInfo.SetSdrView(rViewData.GetScDrawView()); maShapeTreeInfo.SetController(nullptr); maShapeTreeInfo.SetDevice(mpViewShell->GetWindowByPos(meSplitPos)); @@ -874,10 +874,9 @@ SdrPage* ScChildrenShapes::GetDrawPage() const SdrPage* pDrawPage = nullptr; if (mpViewShell) { - ScDocument* pDoc = mpViewShell->GetViewData().GetDocument(); - if (pDoc && pDoc->GetDrawLayer()) + ScDocument& rDoc = mpViewShell->GetViewData().GetDocument(); + if (ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer()) { - ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); if (pDrawLayer->HasObjects() && (pDrawLayer->GetPageCount() > nTab)) pDrawPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(static_cast<sal_Int16>(nTab))); } @@ -2198,7 +2197,7 @@ OUString ScAccessibleDocument::GetCurrentCellDescription() ScDocument *ScAccessibleDocument::GetDocument() const { - return mpViewShell ? mpViewShell->GetViewData().GetDocument() : nullptr; + return mpViewShell ? &mpViewShell->GetViewData().GetDocument() : nullptr; } ScAddress ScAccessibleDocument::GetCurCellAddress() const diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index 9fb0f38b422b..055e1941f9d8 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -1374,7 +1374,7 @@ ScDocument* ScAccessibleSpreadsheet::GetDocument(ScTabViewShell* pViewShell) { ScDocument* pDoc = nullptr; if (pViewShell) - pDoc = pViewShell->GetViewData().GetDocument(); + pDoc = &pViewShell->GetViewData().GetDocument(); return pDoc; } diff --git a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx index dea6561288a6..ebb1d8b06390 100644 --- a/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/RandomNumberGeneratorDialog.cxx @@ -49,7 +49,7 @@ ScRandomNumberGeneratorDialog::ScRandomNumberGeneratorDialog( "modules/scalc/ui/randomnumbergenerator.ui", "RandomNumberGeneratorDialog") , mpViewData(pViewData) - , mrDoc(*pViewData->GetDocument()) + , mrDoc(pViewData->GetDocument()) , mbDialogLostFocus(false) , mxInputRangeText(m_xBuilder->weld_label("cell-range-label")) , mxInputRangeEdit(new formula::RefEdit(m_xBuilder->weld_entry("cell-range-edit"))) diff --git a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx index 62a93829c707..1113254c6f1e 100644 --- a/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/SamplingDialog.cxx @@ -25,7 +25,7 @@ ScSamplingDialog::ScSamplingDialog(SfxBindings* pSfxBindings, SfxChildWindow* pC "modules/scalc/ui/samplingdialog.ui", "SamplingDialog") , mpActiveEdit(nullptr) , mViewData(pViewData) - , mDocument(*pViewData->GetDocument()) + , mDocument(pViewData->GetDocument()) , mInputRange(ScAddress::INITIALIZE_INVALID) , mAddressDetails(mDocument.GetAddressConvention(), 0, 0) , mOutputAddress(ScAddress::INITIALIZE_INVALID) diff --git a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx index 959d7ee2dee3..a4a44f16a972 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/StatisticsInputOutputDialog.cxx @@ -59,7 +59,7 @@ ScStatisticsInputOutputDialog::ScStatisticsInputOutputDialog( , mxGroupByColumnsRadio(m_xBuilder->weld_radio_button("groupedby-columns-radio")) , mxGroupByRowsRadio(m_xBuilder->weld_radio_button("groupedby-rows-radio")) , mViewData(pViewData) - , mDocument(*pViewData->GetDocument()) + , mDocument(pViewData->GetDocument()) , mInputRange(ScAddress::INITIALIZE_INVALID) , mAddressDetails(mDocument.GetAddressConvention(), 0, 0) , mOutputAddress(ScAddress::INITIALIZE_INVALID) diff --git a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx index ab2b3c7fbd62..787c61bb3c3b 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog.cxx @@ -32,7 +32,7 @@ ScStatisticsTwoVariableDialog::ScStatisticsTwoVariableDialog( , mxOutputRangeEdit(new formula::RefEdit(m_xBuilder->weld_entry("output-range-edit"))) , mxOutputRangeButton(new formula::RefButton(m_xBuilder->weld_button("output-range-button"))) , mViewData(pViewData) - , mDocument(*pViewData->GetDocument()) + , mDocument(pViewData->GetDocument()) , mVariable1Range(ScAddress::INITIALIZE_INVALID) , mVariable2Range(ScAddress::INITIALIZE_INVALID) , mAddressDetails(mDocument.GetAddressConvention(), 0, 0 ) diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index d3ad4244d7de..28e2d83acd4b 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -596,9 +596,9 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) ScRange aJustified = rNew; aJustified.PutInOrder(); // Always display Ref in the Formula the right way - ScDocument* pDoc = pDocView->GetViewData().GetDocument(); - const ScAddress::Details aAddrDetails( *pDoc, aCursorPos ); - OUString aNewStr(aJustified.Format(*pDoc, rData.nFlags, aAddrDetails)); + ScDocument& rDoc = pDocView->GetViewData().GetDocument(); + const ScAddress::Details aAddrDetails( rDoc, aCursorPos ); + OUString aNewStr(aJustified.Format(rDoc, rData.nFlags, aAddrDetails)); ESelection aOldSel( 0, nOldStart, 0, nOldEnd ); SfxItemSet aSet( mpEditEngine->GetEmptyItemSet() ); @@ -850,7 +850,7 @@ void ScInputHandler::UpdateRefDevice() nCtrl &= ~EEControlBits::FORMAT100; // when formatting for screen, use the actual MapMode mpEditEngine->SetControlWord( nCtrl ); if ( bTextWysiwyg && pActiveViewSh ) - mpEditEngine->SetRefDevice( pActiveViewSh->GetViewData().GetDocument()->GetPrinter() ); + mpEditEngine->SetRefDevice( pActiveViewSh->GetViewData().GetDocument().GetPrinter() ); else mpEditEngine->SetRefDevice( nullptr ); @@ -910,7 +910,7 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab ) return; ScViewData& rViewData = pActiveViewSh->GetViewData(); - bool bOnlineSpell = rViewData.GetDocument()->GetDocOptions().IsAutoSpell(); + bool bOnlineSpell = rViewData.GetDocument().GetDocOptions().IsAutoSpell(); // SetDefaultLanguage is independent of the language attributes, // ScGlobal::GetEditDefaultLanguage is always used. @@ -937,10 +937,10 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab ) if ( nCntrl != nOld ) mpEditEngine->SetControlWord(nCntrl); - ScDocument* pDoc = rViewData.GetDocument(); - pDoc->ApplyAsianEditSettings( *mpEditEngine ); + ScDocument& rDoc = rViewData.GetDocument(); + rDoc.ApplyAsianEditSettings( *mpEditEngine ); mpEditEngine->SetDefaultHorizontalTextDirection( - pDoc->GetEditTextDirection( rViewData.GetTabNo() ) ); + rDoc.GetEditTextDirection( rViewData.GetTabNo() ) ); mpEditEngine->SetFirstWordCapitalization( false ); } @@ -2645,7 +2645,7 @@ void ScInputHandler::DataChanged( bool bFromTopNotify, bool bSetModified ) } if (!bNeedGrow) { - bNeedGrow = rViewData.GetDocument()->IsLayoutRTL( rViewData.GetTabNo() ); + bNeedGrow = rViewData.GetDocument().IsLayoutRTL( rViewData.GetTabNo() ); } if (bNeedGrow) { @@ -2946,12 +2946,12 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) // Test if valid (always with simple string) if ( bModified && nValidation && pActiveViewSh ) { - ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument(); - const ScValidationData* pData = pDoc->GetValidationEntry( nValidation ); + ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocument(); + const ScValidationData* pData = rDoc.GetValidationEntry( nValidation ); if (pData && pData->HasErrMsg()) { // #i67990# don't use pLastPattern in EnterHandler - const ScPatternAttr* pPattern = pDoc->GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() ); + const ScPatternAttr* pPattern = rDoc.GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() ); bool bOk; @@ -2995,8 +2995,8 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) // Check for input into DataPilot table if ( bModified && pActiveViewSh && !bForget ) { - ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument(); - ScDPObject* pDPObj = pDoc->GetDPAtCursor( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() ); + ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocument(); + ScDPObject* pDPObj = rDoc.GetDPAtCursor( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() ); if ( pDPObj ) { // Any input within the DataPilot table is either a valid renaming @@ -3015,12 +3015,12 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) // it still has to be treated as number, not EditEngine object. if ( pActiveViewSh ) { - ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument(); + ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocument(); // #i67990# don't use pLastPattern in EnterHandler - const ScPatternAttr* pPattern = pDoc->GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() ); + const ScPatternAttr* pPattern = rDoc.GetPattern( aCursorPos.Col(), aCursorPos.Row(), aCursorPos.Tab() ); if (pPattern) { - SvNumberFormatter* pFormatter = pDoc->GetFormatTable(); + SvNumberFormatter* pFormatter = rDoc.GetFormatTable(); // without conditional format, as in ScColumn::SetString sal_uInt32 nFormat = pPattern->GetNumberFormat( pFormatter ); double nVal; @@ -3080,8 +3080,8 @@ void ScInputHandler::EnterHandler( ScEnterMode nBlockMode ) if ( pCommonAttrs ) { - ScDocument* pDoc = pActiveViewSh->GetViewData().GetDocument(); - pCellAttrs = std::make_unique<ScPatternAttr>(pDoc->GetPool()); + ScDocument& rDoc = pActiveViewSh->GetViewData().GetDocument(); + pCellAttrs = std::make_unique<ScPatternAttr>(rDoc.GetPool()); pCellAttrs->GetFromEditItemSet( pCommonAttrs.get() ); } } @@ -3312,7 +3312,7 @@ void ScInputHandler::CancelHandler() if (pExecuteSh) pExecuteSh->StopEditShell(); - aCursorPos.Set(pExecuteSh->GetViewData().GetDocument()->MaxCol()+1,0,0); // Invalid flag + aCursorPos.Set(pExecuteSh->GetViewData().GetDocument().MaxCol()+1,0,0); // Invalid flag mpEditEngine->SetTextCurrentDefaults(OUString()); if ( !pLastState && pExecuteSh ) @@ -3337,7 +3337,7 @@ bool ScInputHandler::IsModalMode( const SfxObjectShell* pDocSh ) { // References to unnamed document; that doesn't work return bFormulaMode && pRefViewSh - && pRefViewSh->GetViewData().GetDocument()->GetDocumentShell() != pDocSh + && pRefViewSh->GetViewData().GetDocument().GetDocumentShell() != pDocSh && !pDocSh->HasName(); } @@ -3380,7 +3380,7 @@ void ScInputHandler::SetReference( const ScRange& rRef, const ScDocument& rDoc ) const ScDocument* pThisDoc = nullptr; if (pRefViewSh) - pThisDoc = pRefViewSh->GetViewData().GetDocument(); + pThisDoc = &pRefViewSh->GetViewData().GetDocument(); bool bOtherDoc = (pThisDoc != &rDoc); if (bOtherDoc && !rDoc.GetDocumentShell()->HasName()) { @@ -4046,7 +4046,7 @@ void ScInputHandler::NotifyChange( const ScInputHdlState* pState, // Is the range a name? //! Find by Timer? if ( pActiveViewSh ) - pActiveViewSh->GetViewData().GetDocument()-> + pActiveViewSh->GetViewData().GetDocument(). GetRangeAtBlock( ScRange( rSPos, rEPos ), &aPosStr ); if ( aPosStr.isEmpty() ) // Not a name -> format diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 7db170669a97..03cf77098523 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -391,8 +391,8 @@ void ScInputWindow::Select() const OUString& rString = aTextWindow.GetTextString(); const sal_Int32 nLen = rString.getLength(); - ScDocument* pDoc = pViewSh->GetViewData().GetDocument(); - CellType eCellType = pDoc->GetCellType( pViewSh->GetViewData().GetCurPos() ); + ScDocument& rDoc = pViewSh->GetViewData().GetDocument(); + CellType eCellType = rDoc.GetCellType( pViewSh->GetViewData().GetCurPos() ); switch ( eCellType ) { case CELLTYPE_VALUE: @@ -1476,8 +1476,8 @@ void ScTextWnd::InitEditEngine() if ( mpViewShell ) { pDocSh = mpViewShell->GetViewData().GetDocShell(); - ScDocument* pDoc = mpViewShell->GetViewData().GetDocument(); - pNew = std::make_unique<ScFieldEditEngine>(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool()); + ScDocument& rDoc = mpViewShell->GetViewData().GetDocument(); + pNew = std::make_unique<ScFieldEditEngine>(&rDoc, rDoc.GetEnginePool(), rDoc.GetEditPool()); } else pNew = std::make_unique<ScFieldEditEngine>(nullptr, EditEngine::CreatePool(), nullptr, true); @@ -2020,8 +2020,8 @@ void ScTextWnd::MakeDialogEditView() ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); if ( pViewSh ) { - ScDocument* pDoc = pViewSh->GetViewData().GetDocument(); - pNew = std::make_unique<ScFieldEditEngine>(pDoc, pDoc->GetEnginePool(), pDoc->GetEditPool()); + ScDocument& rDoc = pViewSh->GetViewData().GetDocument(); + pNew = std::make_unique<ScFieldEditEngine>(&rDoc, rDoc.GetEnginePool(), rDoc.GetEditPool()); } else pNew = std::make_unique<ScFieldEditEngine>(nullptr, EditEngine::CreatePool(), nullptr, true); @@ -2313,9 +2313,9 @@ static ScNameInputType lcl_GetInputType( const OUString& rText ) if ( pViewSh ) { ScViewData& rViewData = pViewSh->GetViewData(); - ScDocument* pDoc = rViewData.GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); SCTAB nTab = rViewData.GetTabNo(); - formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention(); // test in same order as in SID_CURRENTCELL execute @@ -2326,20 +2326,20 @@ static ScNameInputType lcl_GetInputType( const OUString& rText ) if (rText == ScResId(STR_MANAGE_NAMES)) eRet = SC_MANAGE_NAMES; - else if ( aRange.Parse( rText, pDoc, eConv ) & ScRefFlags::VALID ) + else if ( aRange.Parse( rText, &rDoc, eConv ) & ScRefFlags::VALID ) eRet = SC_NAME_INPUT_RANGE; - else if ( aAddress.Parse( rText, pDoc, eConv ) & ScRefFlags::VALID ) + else if ( aAddress.Parse( rText, &rDoc, eConv ) & ScRefFlags::VALID ) eRet = SC_NAME_INPUT_CELL; - else if ( ScRangeUtil::MakeRangeFromName( rText, *pDoc, nTab, aRange, RUTL_NAMES, eConv ) ) + else if ( ScRangeUtil::MakeRangeFromName( rText, rDoc, nTab, aRange, RUTL_NAMES, eConv ) ) eRet = SC_NAME_INPUT_NAMEDRANGE; - else if ( ScRangeUtil::MakeRangeFromName( rText, *pDoc, nTab, aRange, RUTL_DBASE, eConv ) ) + else if ( ScRangeUtil::MakeRangeFromName( rText, rDoc, nTab, aRange, RUTL_DBASE, eConv ) ) eRet = SC_NAME_INPUT_DATABASE; else if ( comphelper::string::isdigitAsciiString( rText ) && - ( nNumeric = rText.toInt32() ) > 0 && nNumeric <= pDoc->MaxRow()+1 ) + ( nNumeric = rText.toInt32() ) > 0 && nNumeric <= rDoc.MaxRow()+1 ) eRet = SC_NAME_INPUT_ROW; - else if ( pDoc->GetTable( rText, nNameTab ) ) + else if ( rDoc.GetTable( rText, nNameTab ) ) eRet = SC_NAME_INPUT_SHEET; - else if ( ScRangeData::IsNameValid( rText, pDoc ) == ScRangeData::NAME_VALID ) // nothing found, create new range? + else if ( ScRangeData::IsNameValid( rText, &rDoc ) == ScRangeData::NAME_VALID ) // nothing found, create new range? { if ( rViewData.GetSimpleArea( aRange ) == SC_MARK_SIMPLE ) eRet = SC_NAME_INPUT_DEFINE; diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 8c9bf33d3056..9426658f1894 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -1002,7 +1002,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) if ( rOldOpt != rNewOpt ) { rViewData.SetOptions( rNewOpt ); // Changes rOldOpt - rViewData.GetDocument()->SetViewOptions( rNewOpt ); + rViewData.GetDocument().SetViewOptions( rNewOpt ); if (pDocSh) pDocSh->SetDocumentModified(); bRepaint = true; @@ -1033,7 +1033,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) { aNewViewOpt.SetGridOptions( aNewGridOpt ); rViewData.SetOptions( aNewViewOpt ); - rViewData.GetDocument()->SetViewOptions( aNewViewOpt ); + rViewData.GetDocument().SetViewOptions( aNewViewOpt ); if (pDocSh) pDocSh->SetDocumentModified(); bRepaint = true; diff --git a/sc/source/ui/condformat/condformatdlg.cxx b/sc/source/ui/condformat/condformatdlg.cxx index 40756b7866d2..09432d8f6454 100644 --- a/sc/source/ui/condformat/condformatdlg.cxx +++ b/sc/source/ui/condformat/condformatdlg.cxx @@ -51,11 +51,11 @@ ScCondFormatList::~ScCondFormatList() Freeze(); } -void ScCondFormatList::init(ScDocument* pDoc, +void ScCondFormatList::init(ScDocument& rDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRanges, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType) { - mpDoc = pDoc; + mpDoc = &rDoc; maPos = rPos; maRanges = rRanges; @@ -440,8 +440,8 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, } else if (!mpDlgItem->IsManaged()) { - ScDocument* pDoc = mpViewData->GetDocument(); - pFormat = pDoc->GetCondFormList(mpViewData->GetTabNo())->GetFormat ( mnKey ); + ScDocument& rDoc = mpViewData->GetDocument(); + pFormat = rDoc.GetCondFormList(mpViewData->GetTabNo())->GetFormat ( mnKey ); } ScRangeList aRange; @@ -474,8 +474,8 @@ ScCondFormatDlg::ScCondFormatDlg(SfxBindings* pB, SfxChildWindow* pCW, mxEdRange->SetGetFocusHdl( LINK( this, ScCondFormatDlg, RangeGetFocusHdl ) ); OUString aRangeString; - const ScDocument* pDoc = pViewData->GetDocument(); - aRange.Format(aRangeString, ScRefFlags::VALID, *pDoc, pDoc->GetAddressConvention()); + const ScDocument& rDoc = pViewData->GetDocument(); + aRange.Format(aRangeString, ScRefFlags::VALID, rDoc, rDoc.GetAddressConvention()); mxEdRange->SetText(aRangeString); msBaseTitle = m_xDialog->get_title(); @@ -547,9 +547,9 @@ void ScCondFormatDlg::SetReference(const ScRange& rRef, ScDocument&) else nFlags = ScRefFlags::RANGE_ABS; - const ScDocument* pDoc = mpViewData->GetDocument(); - OUString aRefStr(rRef.Format(*pDoc, nFlags, - ScAddress::Details(pDoc->GetAddressConvention(), 0, 0))); + const ScDocument& rDoc = mpViewData->GetDocument(); + OUString aRefStr(rRef.Format(rDoc, nFlags, + ScAddress::Details(rDoc.GetAddressConvention(), 0, 0))); if (pEdit != mxEdRange.get()) { Selection sel = pEdit->GetSelection(); @@ -570,8 +570,8 @@ std::unique_ptr<ScConditionalFormat> ScCondFormatDlg::GetConditionalFormat() con return nullptr; ScRangeList aRange; - ScRefFlags nFlags = aRange.Parse(aRangeStr, *mpViewData->GetDocument(), - mpViewData->GetDocument()->GetAddressConvention(), maPos.Tab()); + ScRefFlags nFlags = aRange.Parse(aRangeStr, mpViewData->GetDocument(), + mpViewData->GetDocument().GetAddressConvention(), maPos.Tab()); mxCondFormList->SetRange(aRange); std::unique_ptr<ScConditionalFormat> pFormat = mxCondFormList->GetConditionalFormat(); @@ -671,8 +671,8 @@ IMPL_LINK(ScCondFormatDlg, EdRangeModifyHdl, formula::RefEdit&, rEdit, void) { OUString aRangeStr = rEdit.GetText(); ScRangeList aRange; - ScRefFlags nFlags = aRange.Parse(aRangeStr, *mpViewData->GetDocument(), - mpViewData->GetDocument()->GetAddressConvention()); + ScRefFlags nFlags = aRange.Parse(aRangeStr, mpViewData->GetDocument(), + mpViewData->GetDocument().GetAddressConvention()); if(nFlags & ScRefFlags::VALID) { rEdit.GetWidget()->set_message_type(weld::EntryMessageType::Normal); diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx index 73e5a820178e..f8aa54ad60d4 100644 --- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx +++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx @@ -74,7 +74,7 @@ ScPivotLayoutDialog::ScPivotLayoutDialog( , maPivotTableObject(*pPivotTableObject) , mpPreviouslyFocusedListBox(nullptr) , mpViewData(pViewData) - , mrDocument(*pViewData->GetDocument()) + , mrDocument(pViewData->GetDocument()) , mbNewPivotTable(bNewPivotTable) , maAddressDetails(mrDocument.GetAddressConvention(), 0, 0) , mbDialogLostFocus(false) diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx index e0609a493386..3c63a9f14692 100644 --- a/sc/source/ui/dbgui/consdlg.cxx +++ b/sc/source/ui/dbgui/consdlg.cxx @@ -75,7 +75,7 @@ ScConsolidateDlg::ScConsolidateDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::W ).GetData() ) , rViewData ( static_cast<ScTabViewShell*>(SfxViewShell::Current())-> GetViewData() ) - , pDoc ( static_cast<ScTabViewShell*>(SfxViewShell::Current())-> + , rDoc ( static_cast<ScTabViewShell*>(SfxViewShell::Current())-> GetViewData().GetDocument() ) , nAreaDataCount ( 0 ) , nWhichCons ( rArgSet.GetPool()->GetWhich( SID_CONSOLIDATE ) ) @@ -109,8 +109,6 @@ ScConsolidateDlg::~ScConsolidateDlg() void ScConsolidateDlg::Init() { - OSL_ENSURE( pDoc, "Error in Ctor" ); - OUString aStr; sal_uInt16 i=0; @@ -148,23 +146,23 @@ void ScConsolidateDlg::Init() // read consolidation areas m_xLbConsAreas->clear(); - const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention(); for ( i=0; i<theConsData.nDataAreaCount; i++ ) { const ScArea& rArea = theConsData.pDataAreas[i]; - if ( rArea.nTab < pDoc->GetTableCount() ) + if ( rArea.nTab < rDoc.GetTableCount() ) { aStr = ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab, - rArea.nColEnd, rArea.nRowEnd, rArea.nTab ).Format( *pDoc, + rArea.nColEnd, rArea.nRowEnd, rArea.nTab ).Format( rDoc, ScRefFlags::RANGE_ABS_3D, eConv ); m_xLbConsAreas->append_text(aStr); } } - if ( theConsData.nTab < pDoc->GetTableCount() ) + if ( theConsData.nTab < rDoc.GetTableCount() ) { aStr = ScAddress( theConsData.nCol, theConsData.nRow, theConsData.nTab - ).Format( ScRefFlags::ADDR_ABS_3D, pDoc, eConv ); + ).Format( ScRefFlags::ADDR_ABS_3D, &rDoc, eConv ); m_xEdDestArea->SetText( aStr ); } else @@ -173,8 +171,8 @@ void ScConsolidateDlg::Init() // Use the ScAreaData helper class to save those range names from the // RangeNames and database ranges that appear in the ListBoxes. - ScRangeName* pRangeNames = pDoc->GetRangeName(); - ScDBCollection* pDbNames = pDoc->GetDBCollection(); + ScRangeName* pRangeNames = rDoc.GetRangeName(); + ScDBCollection* pDbNames = rDoc.GetDBCollection(); size_t nRangeCount = pRangeNames ? pRangeNames->size() : 0; size_t nDbCount = pDbNames ? pDbNames->getNamedDBs().size() : 0; @@ -188,10 +186,10 @@ void ScConsolidateDlg::Init() OUString aStrName; sal_uInt16 nAt = 0; ScRange aRange; - ScAreaNameIterator aIter( *pDoc ); + ScAreaNameIterator aIter( rDoc ); while ( aIter.Next( aStrName, aRange ) ) { - OUString aStrArea(aRange.Format(*pDoc, ScRefFlags::ADDR_ABS_3D, eConv)); + OUString aStrArea(aRange.Format(rDoc, ScRefFlags::ADDR_ABS_3D, eConv)); pAreaData[nAt++].Set( aStrName, aStrArea ); } } @@ -284,18 +282,17 @@ void ScConsolidateDlg::Deactivate() bool ScConsolidateDlg::VerifyEdit( formula::RefEdit* pEd ) { - if ( !pDoc || - ((pEd != m_xEdDataArea.get()) && (pEd != m_xEdDestArea.get())) ) + if (pEd != m_xEdDataArea.get() && pEd != m_xEdDestArea.get()) return false; SCTAB nTab = rViewData.GetTabNo(); bool bEditOk = false; OUString theCompleteStr; - const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention(); if ( pEd == m_xEdDataArea.get() ) { - bEditOk = ScRangeUtil::IsAbsArea( pEd->GetText(), *pDoc, + bEditOk = ScRangeUtil::IsAbsArea( pEd->GetText(), rDoc, nTab, &theCompleteStr, nullptr, nullptr, eConv ); } else if ( pEd == m_xEdDestArea.get() ) @@ -303,7 +300,7 @@ bool ScConsolidateDlg::VerifyEdit( formula::RefEdit* pEd ) OUString aPosStr; ScRangeUtil::CutPosString( pEd->GetText(), aPosStr ); - bEditOk = ScRangeUtil::IsAbsPos( aPosStr, *pDoc, + bEditOk = ScRangeUtil::IsAbsPos( aPosStr, rDoc, nTab, &theCompleteStr, nullptr, eConv ); } @@ -337,9 +334,9 @@ IMPL_LINK_NOARG(ScConsolidateDlg, OkHdl, weld::Button&, void) ScRefAddress aDestAddress; SCTAB nTab = rViewData.GetTabNo(); OUString aDestPosStr( m_xEdDestArea->GetText() ); - const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention(); - if ( ScRangeUtil::IsAbsPos( aDestPosStr, *pDoc, nTab, nullptr, &aDestAddress, eConv ) ) + if ( ScRangeUtil::IsAbsPos( aDestPosStr, rDoc, nTab, nullptr, &aDestAddress, eConv ) ) { ScConsolidateParam theOutParam( theConsData ); std::unique_ptr<ScArea[]> pDataAreas(new ScArea[nDataAreaCount]); @@ -347,7 +344,7 @@ IMPL_LINK_NOARG(ScConsolidateDlg, OkHdl, weld::Button&, void) for ( sal_Int32 i=0; i<nDataAreaCount; ++i ) { ScRangeUtil::MakeArea(m_xLbConsAreas->get_text(i), - pDataAreas[i], *pDoc, nTab, eConv); + pDataAreas[i], rDoc, nTab, eConv); } theOutParam.nCol = aDestAddress.Col(); @@ -389,9 +386,9 @@ IMPL_LINK( ScConsolidateDlg, ClickHdl, weld::Button&, rBtn, void ) OUString aNewEntry( m_xEdDataArea->GetText() ); std::unique_ptr<ScArea[]> ppAreas; sal_uInt16 nAreaCount = 0; - const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention(); - if ( ScRangeUtil::IsAbsTabArea( aNewEntry, pDoc, &ppAreas, &nAreaCount, true, eConv ) ) + if ( ScRangeUtil::IsAbsTabArea( aNewEntry, &rDoc, &ppAreas, &nAreaCount, true, eConv ) ) { // IsAbsTabArea() creates an array of ScArea pointers, // which have been created dynamically as well. @@ -402,7 +399,7 @@ IMPL_LINK( ScConsolidateDlg, ClickHdl, weld::Button&, rBtn, void ) const ScArea& rArea = ppAreas[i]; OUString aNewArea = ScRange( rArea.nColStart, rArea.nRowStart, rArea.nTab, rArea.nColEnd, rArea.nRowEnd, rArea.nTab - ).Format(*pDoc, ScRefFlags::RANGE_ABS_3D, eConv); + ).Format(rDoc, ScRefFlags::RANGE_ABS_3D, eConv); if (m_xLbConsAreas->find_text(aNewArea) == -1) { diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index 45c0b5c71dd4..8b79e7fa3f5e 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -131,7 +131,7 @@ ScDbNameDlg::ScDbNameDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pPa : ScAnyRefDlgController(pB, pCW, pParent, "modules/scalc/ui/definedatabaserangedialog.ui", "DefineDatabaseRangeDialog") , pViewData(ptrViewData) - , rDoc(*ptrViewData->GetDocument()) + , rDoc(ptrViewData->GetDocument()) , bRefInputMode(false) , aAddrDetails(rDoc.GetAddressConvention(), 0, 0) , aLocalDbCol(*(rDoc.GetDBCollection())) diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 2e4ac4730545..46f32bf78fd6 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -162,7 +162,7 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet ) m_xBtnRemove4->connect_clicked( LINK( this, ScFilterDlg, BtnRemoveHdl ) ); pViewData = rQueryItem.GetViewData(); - pDoc = pViewData ? pViewData->GetDocument() : nullptr; + pDoc = pViewData ? &pViewData->GetDocument() : nullptr; nSrcTab = pViewData ? pViewData->GetTabNo() : static_cast<SCTAB>(0); // for easier access: @@ -1325,7 +1325,7 @@ void ScFilterDlg::SetValString( const OUString& rQueryStr, const ScQueryEntry::I { if (rQueryStr.isEmpty()) { - pDoc = pViewData ? pViewData->GetDocument() : nullptr; + pDoc = pViewData ? &pViewData->GetDocument() : nullptr; if (rItem.meType == ScQueryEntry::ByValue) { if (pDoc) diff --git a/sc/source/ui/dbgui/foptmgr.cxx b/sc/source/ui/dbgui/foptmgr.cxx index 31cb7efa245a..cecf9be64afc 100644 --- a/sc/source/ui/dbgui/foptmgr.cxx +++ b/sc/source/ui/dbgui/foptmgr.cxx @@ -48,7 +48,7 @@ ScFilterOptionsMgr::ScFilterOptionsMgr( const OUString& refStrUndefined ) : pViewData ( ptrViewData ), - pDoc ( ptrViewData ? ptrViewData->GetDocument() : nullptr ), + pDoc ( ptrViewData ? &ptrViewData->GetDocument() : nullptr ), pBtnCase ( refBtnCase ), pBtnRegExp ( refBtnRegExp ), pBtnHeader ( refBtnHeader ), diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index 98b0580bdda9..2c257ac686d2 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -89,7 +89,7 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) m_xBtnUnique->set_active( !theQueryData.bDuplicate ); pViewData = rQueryItem.GetViewData(); - pDoc = pViewData ? pViewData->GetDocument() : nullptr; + pDoc = pViewData ? &pViewData->GetDocument() : nullptr; // for easier access: aFieldLbArr [0] = m_xLbField1.get(); @@ -307,7 +307,7 @@ const ScQueryItem& ScPivotFilterDlg::GetOutputItem() sal_Int32 nConnect1 = m_xLbConnect1->get_active(); sal_Int32 nConnect2 = m_xLbConnect2->get_active(); - svl::SharedStringPool& rPool = pViewData->GetDocument()->GetSharedStringPool(); + svl::SharedStringPool& rPool = pViewData->GetDocument().GetSharedStringPool(); for ( SCSIZE i=0; i<3; i++ ) { diff --git a/sc/source/ui/dbgui/scendlg.cxx b/sc/source/ui/dbgui/scendlg.cxx index 5a30dcec7c07..42c27e558210 100644 --- a/sc/source/ui/dbgui/scendlg.cxx +++ b/sc/source/ui/dbgui/scendlg.cxx @@ -128,7 +128,7 @@ void ScNewScenarioDlg::SetScenarioData(const OUString& rName, const OUString& rC IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl, weld::Button&, void) { OUString aName = comphelper::string::strip(m_xEdName->get_text(), ' '); - ScDocument* pDoc = static_cast<ScTabViewShell*>(SfxViewShell::Current())->GetViewData().GetDocument(); + ScDocument& rDoc = static_cast<ScTabViewShell*>(SfxViewShell::Current())->GetViewData().GetDocument(); m_xEdName->set_text(aName); @@ -140,7 +140,7 @@ IMPL_LINK_NOARG(ScNewScenarioDlg, OkHdl, weld::Button&, void) xInfoBox->run(); m_xEdName->grab_focus(); } - else if ( !bIsEdit && !pDoc->ValidNewTabName( aName ) ) + else if ( !bIsEdit && !rDoc.ValidNewTabName( aName ) ) { std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(), VclMessageType::Info, VclButtonsType::Ok, diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx index 4d966ce9ddea..585e862d3c33 100644 --- a/sc/source/ui/dbgui/sfiltdlg.cxx +++ b/sc/source/ui/dbgui/sfiltdlg.cxx @@ -122,7 +122,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet ) m_xEdFilterArea->SetModifyHdl ( LINK( this, ScSpecialFilterDlg, FilterAreaModHdl ) ); pViewData = rQueryItem.GetViewData(); - pDoc = pViewData ? pViewData->GetDocument() : nullptr; + pDoc = pViewData ? &pViewData->GetDocument() : nullptr; m_xEdFilterArea->SetText( EMPTY_OUSTRING ); // may be overwritten below diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx index 6fc4d45655af..a0f7c14a923c 100644 --- a/sc/source/ui/dbgui/tpsort.cxx +++ b/sc/source/ui/dbgui/tpsort.cxx @@ -317,10 +317,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField ) if ( !pViewData ) return; - ScDocument* pDoc = pViewData->GetDocument(); - - if ( !pDoc ) - return; + ScDocument& rDoc = pViewData->GetDocument(); for (sal_uInt16 j = nStartField; j < nSortKeyCount; ++j) { @@ -339,12 +336,12 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField ) if ( bSortByRows ) { OUString aFieldName; - SCCOL nMaxCol = pDoc->ClampToAllocatedColumns(nTab, aSortData.nCol2); + SCCOL nMaxCol = rDoc.ClampToAllocatedColumns(nTab, aSortData.nCol2); SCCOL col; for ( col=nFirstSortCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ ) { - aFieldName = pDoc->GetString(col, nFirstSortRow, nTab); + aFieldName = rDoc.GetString(col, nFirstSortRow, nTab); if ( !bHasHeader || aFieldName.isEmpty() ) { aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, "%1", ScColToAlpha( col )); @@ -365,7 +362,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField ) for ( row=nFirstSortRow; row<=nMaxRow && i<SC_MAXFIELDS; row++ ) { - aFieldName = pDoc->GetString(nFirstSortCol, row, nTab); + aFieldName = rDoc.GetString(nFirstSortCol, row, nTab); if ( !bHasHeader || aFieldName.isEmpty() ) { aFieldName = ScGlobal::ReplaceOrAppend( aStrRow, "%1", OUString::number( row+1)); @@ -530,7 +527,7 @@ void ScTabPageSortOptions::Init() m_xLbLanguage->connect_changed( LINK( this, ScTabPageSortOptions, FillAlgorHdl ) ); pViewData = rSortItem.GetViewData(); - pDoc = pViewData ? pViewData->GetDocument() : nullptr; + pDoc = pViewData ? &pViewData->GetDocument() : nullptr; OSL_ENSURE( pViewData, "ViewData not found! :-/" ); diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index 92ff178eeaef..30133dce08ad 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -72,7 +72,7 @@ void ScTpSubTotalGroup::Init() GetItemSet().Get( nWhichSubTotals )); pViewData = rSubTotalItem.GetViewData(); - pDoc = pViewData ? pViewData->GetDocument() : nullptr; + pDoc = pViewData ? &pViewData->GetDocument() : nullptr; OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found :-(" ); @@ -448,7 +448,7 @@ void ScTpSubTotalOptions::Init() GetItemSet().Get( nWhichSubTotals )); pViewData = rSubTotalItem.GetViewData(); - pDoc = pViewData ? pViewData->GetDocument() : nullptr; + pDoc = pViewData ? &pViewData->GetDocument() : nullptr; OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found!" ); diff --git a/sc/source/ui/drawfunc/drawsh.cxx b/sc/source/ui/drawfunc/drawsh.cxx index ab0baaf89402..5b63d210f2df 100644 --- a/sc/source/ui/drawfunc/drawsh.cxx +++ b/sc/source/ui/drawfunc/drawsh.cxx @@ -180,7 +180,7 @@ void ScDrawShell::ExecDrawAttr( SfxRequest& rReq ) sal_uInt16 nSlot = rReq.GetSlot(); vcl::Window* pWin = pViewData->GetActiveWin(); ScDrawView* pView = pViewData->GetScDrawView(); - SdrModel* pDoc = pViewData->GetDocument()->GetDrawLayer(); + SdrModel* pDoc = pViewData->GetDocument().GetDrawLayer(); const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); const size_t nMarkCount = rMarkList.GetMarkCount(); @@ -484,7 +484,7 @@ void ScDrawShell::ExecuteLineDlg( const SfxRequest& rReq ) SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); VclPtr<SfxAbstractTabDialog> pDlg(pFact->CreateSvxLineTabDialog( pViewData->GetDialogParent(), &aNewAttr, - pViewData->GetDocument()->GetDrawLayer(), + pViewData->GetDocument().GetDrawLayer(), pObj, bHasMarked)); @@ -518,7 +518,7 @@ void ScDrawShell::ExecuteAreaDlg( const SfxRequest& rReq ) weld::Window* pWin = pViewData->GetDialogParent(); VclPtr<AbstractSvxAreaTabDialog> pDlg(pFact->CreateSvxAreaTabDialog( pWin, &aNewAttr, - pViewData->GetDocument()->GetDrawLayer(), true)); + pViewData->GetDocument().GetDrawLayer(), true)); pDlg->StartExecuteAsync([=](sal_Int32 nResult){ if ( nResult == RET_OK ) diff --git a/sc/source/ui/drawfunc/drawsh2.cxx b/sc/source/ui/drawfunc/drawsh2.cxx index 15d70334c028..1fb57fcaae1e 100644 --- a/sc/source/ui/drawfunc/drawsh2.cxx +++ b/sc/source/ui/drawfunc/drawsh2.cxx @@ -69,7 +69,7 @@ ScDrawShell::ScDrawShell( ScViewData* pData ) : SetPool( &pViewData->GetScDrawView()->GetModel()->GetItemPool() ); SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); - if ( !pViewData->GetDocument()->IsUndoEnabled() ) + if ( !pViewData->GetDocument().IsUndoEnabled() ) { pMgr->SetMaxUndoActionCount( 0 ); } diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index 5b1dd28f08ea..1c4e9f24c2f5 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -495,7 +495,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq ) { // graphics objects must have names // (all graphics are supposed to be in the navigator) - ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer(); + ScDrawLayer* pModel = pViewData->GetDocument().GetDrawLayer(); if(pModel) { @@ -611,7 +611,7 @@ IMPL_LINK( ScDrawShell, NameObjectHdl, AbstractSvxObjectNameDialog&, rDialog, bo OUString aName; rDialog.GetName( aName ); - ScDrawLayer* pModel = pViewData->GetDocument()->GetDrawLayer(); + ScDrawLayer* pModel = pViewData->GetDocument().GetDrawLayer(); if ( !aName.isEmpty() && pModel ) { SCTAB nDummyTab; diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index c4a83616eef5..73027fc89771 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -115,7 +115,7 @@ ScDrawTextObjectBar::ScDrawTextObjectBar(ScViewData* pData) : // At the switching-over the UndoManager is changed to edit mode SfxUndoManager* pMgr = pViewData->GetSfxDocShell()->GetUndoManager(); SetUndoManager( pMgr ); - if ( !pViewData->GetDocument()->IsUndoEnabled() ) + if ( !pViewData->GetDocument().IsUndoEnabled() ) { pMgr->SetMaxUndoActionCount( 0 ); } @@ -1158,7 +1158,7 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) if ( eAttrDir == SvxFrameDirection::Environment ) { // get "environment" direction from page style - if ( pViewData->GetDocument()->GetEditTextDirection( pViewData->GetTabNo() ) == EEHorizontalTextDirection::R2L ) + if ( pViewData->GetDocument().GetEditTextDirection( pViewData->GetTabNo() ) == EEHorizontalTextDirection::R2L ) eAttrDir = SvxFrameDirection::Horizontal_RL_TB; else eAttrDir = SvxFrameDirection::Horizontal_LR_TB; diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index 2a17b04b582f..bd2bbeb3b3ad 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -172,7 +172,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic, Point aInsertPos = rViewSh.GetInsertPos(); ScViewData& rData = rViewSh.GetViewData(); - if ( rData.GetDocument()->IsNegativePage( rData.GetTabNo() ) ) + if ( rData.GetDocument().IsNegativePage( rData.GetTabNo() ) ) aInsertPos.AdjustX( -(aLogicSize.Width()) ); // move position to left edge ScLimitSizeOnDrawPage( aLogicSize, aInsertPos, pPage->GetSize() ); @@ -193,7 +193,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic, pObj->SetName(aName); if (aAnchorType == SCA_CELL || aAnchorType == SCA_CELL_RESIZE) - ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *(rData.GetDocument()), rData.GetTabNo(), + ScDrawLayer::SetCellAnchoredFromPosition(*pObj, rData.GetDocument(), rData.GetTabNo(), aAnchorType == SCA_CELL_RESIZE); // don't select if from (dispatch) API, to allow subsequent cell operations @@ -229,7 +229,7 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi, ScLimitSizeOnDrawPage( aSize, aInsertPos, pPage->GetSize() ); - if( rData.GetDocument()->IsNegativePage( rData.GetTabNo() ) ) + if( rData.GetDocument().IsNegativePage( rData.GetTabNo() ) ) aInsertPos.AdjustX( -(aSize.Width()) ); OUString realURL; @@ -240,7 +240,7 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi, else { uno::Reference<frame::XModel> const xModel( - rData.GetDocument()->GetDocumentShell()->GetModel()); + rData.GetDocument().GetDocumentShell()->GetModel()); #if HAVE_FEATURE_AVMEDIA bool const bRet = ::avmedia::EmbedMedia(xModel, rMediaURL, realURL); if (!bRet) { return; } @@ -250,7 +250,7 @@ static void lcl_InsertMedia( const OUString& rMediaURL, bool bApi, } SdrMediaObj* pObj = new SdrMediaObj( - *rData.GetDocument()->GetDrawLayer(), + *rData.GetDocument().GetDrawLayer(), tools::Rectangle(aInsertPos, aSize)); pObj->setURL( realURL, ""/*TODO?*/ ); diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 015457d6b08d..e606054eb089 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -107,8 +107,8 @@ void lcl_ChartInit(const uno::Reference <embed::XEmbeddedObject>& xObj, ScViewDa PutInOrder( nRow1, nRow2 ); if (nCol2 >= nCol1 || nRow2 >= nRow1) { - ScDocument* pDoc = pViewData->GetDocument(); - pDoc->LimitChartArea( nTab1, nCol1,nRow1, nCol2,nRow2 ); + ScDocument& rDoc = pViewData->GetDocument(); + rDoc.LimitChartArea( nTab1, nCol1,nRow1, nCol2,nRow2 ); ScRange aRange( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 ); aRangeString = aRange.Format(rScDoc, ScRefFlags::RANGE_ABS_3D, rScDoc.GetAddressConvention()); @@ -341,7 +341,7 @@ FuInsertOLE::FuInsertOLE(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawView* ScViewData& rData = rViewSh.GetViewData(); Point aPnt = rViewSh.GetInsertPos(); - if ( rData.GetDocument()->IsNegativePage( rData.GetTabNo() ) ) + if ( rData.GetDocument().IsNegativePage( rData.GetTabNo() ) ) aPnt.AdjustX( -(aSize.Width()) ); // move position to left edge tools::Rectangle aRect (aPnt, aSize); SdrOle2Obj* pObj = new SdrOle2Obj( @@ -429,10 +429,10 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV } else { - ScDocument* pDocument = rViewSh.GetViewData().GetDocument(); - ScDPObject* pObject = pDocument->GetDPAtCursor(rViewSh.GetViewData().GetCurX(), - rViewSh.GetViewData().GetCurY(), - rViewSh.GetViewData().GetTabNo()); + ScDocument& rDocument = rViewSh.GetViewData().GetDocument(); + ScDPObject* pObject = rDocument.GetDPAtCursor(rViewSh.GetViewData().GetCurX(), + rViewSh.GetViewData().GetCurY(), + rViewSh.GetViewData().GetTabNo()); if (pObject) { aRangeString = pObject->GetName(); @@ -453,7 +453,7 @@ FuInsertChart::FuInsertChart(ScTabViewShell& rViewSh, vcl::Window* pWin, ScDrawV ScRangeList aRanges; aMultiMark.FillRangeListWithMarks( &aRanges, false ); OUString aStr; - aRanges.Format( aStr, ScRefFlags::RANGE_ABS_3D, *pDocument, pDocument->GetAddressConvention() ); + aRanges.Format( aStr, ScRefFlags::RANGE_ABS_3D, rDocument, rDocument.GetAddressConvention() ); aRangeString = aStr; // get "total" range for positioning diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx index 2a6fa9cf29db..1db8e6a99d6d 100644 --- a/sc/source/ui/drawfunc/fupoor.cxx +++ b/sc/source/ui/drawfunc/fupoor.cxx @@ -81,7 +81,7 @@ void FuPoor::ForceScroll(const Point& aPixPos) if ( aPixPos.Y() >= aSize.Height() ) dy = 1; ScViewData& rViewData = rViewShell.GetViewData(); - if ( rViewData.GetDocument()->IsNegativePage( rViewData.GetTabNo() ) ) + if ( rViewData.GetDocument().IsNegativePage( rViewData.GetTabNo() ) ) dx = -dx; ScSplitPos eWhich = rViewData.GetActivePart(); diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index e3c306574a73..e592085d14de 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -343,7 +343,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) bool bCopy = false; ScViewData& rViewData = rViewShell.GetViewData(); - ScDocument* pDocument = rViewData.GetDocument(); + ScDocument& rDocument = rViewData.GetDocument(); SdrPageView* pPageView = ( pView ? pView->GetSdrPageView() : nullptr ); SdrPage* pPage = ( pPageView ? pPageView->GetPage() : nullptr ); ::std::vector< OUString > aExcludedChartNames; @@ -360,7 +360,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) { ScChartHelper::GetChartNames( aExcludedChartNames, pPage ); } - if ( pView && pDocument ) + if ( pView ) { const SdrMarkList& rSdrMarkList = pView->GetMarkedObjectList(); const size_t nMarkCount = rSdrMarkList.GetMarkCount(); @@ -370,7 +370,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) pObj = ( pMark ? pMark->GetMarkedSdrObj() : nullptr ); if ( pObj ) { - ScChartHelper::AddRangesIfProtectedChart( aProtectedChartRangesVector, pDocument, pObj ); + ScChartHelper::AddRangesIfProtectedChart( aProtectedChartRangesVector, &rDocument, pObj ); } } } @@ -514,14 +514,14 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) rViewShell.GetViewData().GetDispatcher(). Execute(SID_OBJECT_SELECT, SfxCallMode::SLOT | SfxCallMode::RECORD); - if ( bCopy && pDocument && pPage ) + if ( bCopy && pPage ) { ScDocShell* pDocShell = rViewData.GetDocShell(); ScModelObj* pModelObj = ( pDocShell ? comphelper::getUnoTunnelImplementation<ScModelObj>( pDocShell->GetModel() ) : nullptr ); if ( pModelObj ) { SCTAB nTab = rViewData.GetTabNo(); - ScChartHelper::CreateProtectedChartListenersAndNotify( pDocument, pPage, pModelObj, nTab, + ScChartHelper::CreateProtectedChartListenersAndNotify( &rDocument, pPage, pModelObj, nTab, aProtectedChartRangesVector, aExcludedChartNames ); } } diff --git a/sc/source/ui/drawfunc/fusel2.cxx b/sc/source/ui/drawfunc/fusel2.cxx index b4ab7cefa6db..12024f29da62 100644 --- a/sc/source/ui/drawfunc/fusel2.cxx +++ b/sc/source/ui/drawfunc/fusel2.cxx @@ -120,7 +120,7 @@ bool FuSelection::IsNoteCaptionClicked( const Point& rPos ) const if( pPageView ) { const ScViewData& rViewData = rViewShell.GetViewData(); - ScDocument& rDoc = *rViewData.GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); SCTAB nTab = rViewData.GetTabNo(); ScDocShell* pDocSh = rViewData.GetDocShell(); bool bProtectDoc = rDoc.IsTabProtected( nTab ) || (pDocSh && pDocSh->IsReadOnly()); diff --git a/sc/source/ui/drawfunc/futext3.cxx b/sc/source/ui/drawfunc/futext3.cxx index 307cd87ec609..8411f75f62ed 100644 --- a/sc/source/ui/drawfunc/futext3.cxx +++ b/sc/source/ui/drawfunc/futext3.cxx @@ -48,7 +48,7 @@ void FuText::StopEditMode() pView->LockInternalLayer(); ScViewData& rViewData = rViewShell.GetViewData(); - ScDocument& rDoc = *rViewData.GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); ScDrawLayer* pDrawLayer = rDoc.GetDrawLayer(); OSL_ENSURE( pDrawLayer && (pDrawLayer == pDrDoc), "FuText::StopEditMode - missing or different drawing layers" ); diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index b57f5531d7ea..b1d703ecd60f 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -85,7 +85,7 @@ ScFormulaDlg::ScFormulaDlg(SfxBindings* pB, SfxChildWindow* pCW, } } - m_pDoc = pViewData->GetDocument(); + m_pDoc = &pViewData->GetDocument(); m_xParser.set(ScServiceProvider::MakeInstance(ScServiceProvider::Type::FORMULAPARS, static_cast<ScDocShell*>(m_pDoc->GetDocumentShell())),uno::UNO_QUERY); uno::Reference< beans::XPropertySet> xSet(m_xParser,uno::UNO_QUERY); @@ -114,7 +114,7 @@ ScFormulaDlg::ScFormulaDlg(SfxBindings* pB, SfxChildWindow* pCW, pScMod->SetRefInputHdl(pInputHdl); - m_pDoc = pViewData->GetDocument(); + m_pDoc = &pViewData->GetDocument(); SCCOL nCol = pViewData->GetCurX(); SCROW nRow = pViewData->GetCurY(); SCTAB nTab = pViewData->GetTabNo(); diff --git a/sc/source/ui/inc/condformatdlg.hxx b/sc/source/ui/inc/condformatdlg.hxx index 30c81b6dafdc..a4997f7bfaaa 100644 --- a/sc/source/ui/inc/condformatdlg.hxx +++ b/sc/source/ui/inc/condformatdlg.hxx @@ -51,7 +51,7 @@ public: weld::Container* GetContainer() { return mxGrid.get(); } ~ScCondFormatList(); - void init(ScDocument* pDoc, const ScConditionalFormat* pFormat, + void init(ScDocument& rDoc, const ScConditionalFormat* pFormat, const ScRangeList& rRanges, const ScAddress& rPos, condformat::dialog::ScCondFormatDialogType eType); diff --git a/sc/source/ui/inc/consdlg.hxx b/sc/source/ui/inc/consdlg.hxx index 098c1424243a..6abcfc85599e 100644 --- a/sc/source/ui/inc/consdlg.hxx +++ b/sc/source/ui/inc/consdlg.hxx @@ -48,7 +48,7 @@ private: ScConsolidateParam theConsData; ScViewData& rViewData; - ScDocument* pDoc; + ScDocument& rDoc; std::unique_ptr<ScAreaData[]> pAreaData; size_t nAreaDataCount; sal_uInt16 nWhichCons; diff --git a/sc/source/ui/inc/crnrdlg.hxx b/sc/source/ui/inc/crnrdlg.hxx index bfca95248a0b..10a577b89262 100644 --- a/sc/source/ui/inc/crnrdlg.hxx +++ b/sc/source/ui/inc/crnrdlg.hxx @@ -51,7 +51,7 @@ private: typedef std::unordered_map< OUString, ScRange > NameRangeMap; NameRangeMap aRangeMap; ScViewData* pViewData; - ScDocument* pDoc; + ScDocument& rDoc; bool bDlgLostFocus; formula::RefEdit* m_pEdActive; diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx index 444ce0d7b421..6ecf44456059 100644 --- a/sc/source/ui/inc/drawview.hxx +++ b/sc/source/ui/inc/drawview.hxx @@ -35,7 +35,7 @@ class ScDrawView final : public FmFormView { ScViewData* pViewData; VclPtr<OutputDevice> pDev; //! needed ? - ScDocument* pDoc; + ScDocument& rDoc; SCTAB nTab; Fraction aScaleX; // Factor for Drawing-MapMode Fraction aScaleY; diff --git a/sc/source/ui/inc/highred.hxx b/sc/source/ui/inc/highred.hxx index 316c5a62ee07..566811eacd22 100644 --- a/sc/source/ui/inc/highred.hxx +++ b/sc/source/ui/inc/highred.hxx @@ -33,7 +33,7 @@ class ScHighlightChgDlg : public ScAnyRefDlgController { private: ScViewData* pViewData; - ScDocument* pDoc; + ScDocument& rDoc; ScChangeViewSettings aChangeViewSet; std::unique_ptr<weld::CheckButton> m_xHighlightBox; diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index e7bb0a1df579..405fe99d0328 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -40,7 +40,7 @@ private: OUString maStrInfoDefault; ScViewData* mpViewData; - ScDocument* mpDoc; + ScDocument& mrDoc; const ScAddress maCursorPos; bool mbDataChanged; diff --git a/sc/source/ui/inc/olinewin.hxx b/sc/source/ui/inc/olinewin.hxx index 806960cc762f..9c8e79672727 100644 --- a/sc/source/ui/inc/olinewin.hxx +++ b/sc/source/ui/inc/olinewin.hxx @@ -79,7 +79,7 @@ private: void InitSettings(); /** Returns the calc document. */ - ScDocument& GetDoc() const { return *mrViewData.GetDocument(); } + ScDocument& GetDoc() const { return mrViewData.GetDocument(); } /** Returns the current sheet index. */ SCTAB GetTab() const { return mrViewData.GetTabNo(); } /** Returns the outline array of the corresponding document. */ diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index faebd6ee5aa6..fb60399c56b8 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -155,7 +155,7 @@ class ScBoundsProvider typedef ScPositionHelper::value_type value_type; typedef SCCOLROW index_type; - ScDocument* pDoc; + ScDocument& rDoc; const SCTAB nTab; const bool bColumnHeader; const index_type MAX_INDEX; @@ -379,7 +379,7 @@ public: void WriteUserDataSequence(css::uno::Sequence <css::beans::PropertyValue>& rSettings) const; void ReadUserDataSequence(const css::uno::Sequence <css::beans::PropertyValue>& rSettings); - ScDocument* GetDocument() const; + ScDocument& GetDocument() const; bool IsActive() const { return bActive; } void Activate(bool bActivate) { bActive = bActivate; } diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 7d5b3a3569b2..2c2aa60f5031 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -74,7 +74,7 @@ ScAcceptChgDlg::ScAcceptChgDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Windo , aSelectionIdle("ScAcceptChgDlg SelectionIdle") , aReOpenIdle("ScAcceptChgDlg ReOpenIdle") , pViewData( ptrViewData ) - , pDoc( ptrViewData->GetDocument() ) + , pDoc( &ptrViewData->GetDocument() ) , aStrInsertCols(ScResId(STR_CHG_INSERT_COLS)) , aStrInsertRows(ScResId(STR_CHG_INSERT_ROWS)) , aStrInsertTabs(ScResId(STR_CHG_INSERT_TABS)) @@ -159,9 +159,9 @@ void ScAcceptChgDlg::ReInit(ScViewData* ptrViewData) { pViewData=ptrViewData; if (pViewData) - pDoc=ptrViewData->GetDocument(); + pDoc = &ptrViewData->GetDocument(); else - pDoc=nullptr; + pDoc = nullptr; bNoSelection=false; bIgnoreMsg=false; diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index d8d7777a5efb..968bb5f4cf69 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -117,7 +117,7 @@ void ScFormulaReferenceHelper::ShowSimpleReference(const OUString& rStr) if ( !pViewData ) return; - ScDocument* pDoc=pViewData->GetDocument(); + ScDocument& rDoc = pViewData->GetDocument(); ScTabViewShell* pTabViewShell=pViewData->GetViewShell(); ScRangeList aRangeList; @@ -125,7 +125,7 @@ void ScFormulaReferenceHelper::ShowSimpleReference(const OUString& rStr) pTabViewShell->DoneRefMode(); pTabViewShell->ClearHighlightRanges(); - if( ParseWithNames( aRangeList, rStr, *pDoc ) ) + if( ParseWithNames( aRangeList, rStr, rDoc ) ) { for ( size_t i = 0, nRanges = aRangeList.size(); i < nRanges; ++i ) { @@ -193,7 +193,7 @@ void ScFormulaReferenceHelper::ShowFormulaReference(const OUString& rStr) return; const ScViewData& rViewData = pTabViewShell->GetViewData(); - ScDocument* pDoc = rViewData.GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); pTabViewShell->DoneRefMode(); pTabViewShell->ClearHighlightRanges(); @@ -212,12 +212,12 @@ void ScFormulaReferenceHelper::ShowFormulaReference(const OUString& rStr) if(bDoubleRef) { ScComplexRefData aRef( *pToken->GetDoubleRef() ); - aRange = aRef.toAbs(*pDoc, aPos); + aRange = aRef.toAbs(rDoc, aPos); } else { ScSingleRefData aRef( *pToken->GetSingleRef() ); - aRange.aStart = aRef.toAbs(*pDoc, aPos); + aRange.aStart = aRef.toAbs(rDoc, aPos); aRange.aEnd = aRange.aStart; } Color aColName=ScRangeFindList::GetColorName(nIndex++); @@ -296,9 +296,9 @@ void ScFormulaReferenceHelper::ReleaseFocus( formula::RefEdit* pEdit ) return; const ScViewData& rViewData = pViewShell->GetViewData(); - ScDocument* pDoc = rViewData.GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); ScRangeList aRangeList; - if( !ParseWithNames( aRangeList, m_pRefEdit->GetText(), *pDoc ) ) + if( !ParseWithNames( aRangeList, m_pRefEdit->GetText(), rDoc ) ) return; if ( !aRangeList.empty() ) @@ -309,7 +309,7 @@ void ScFormulaReferenceHelper::ReleaseFocus( formula::RefEdit* pEdit ) rRange.aStart.Row(), SC_FOLLOW_JUMP, false, false ); pViewShell->MoveCursorAbs( rRange.aEnd.Col(), rRange.aEnd.Row(), SC_FOLLOW_JUMP, true, false ); - m_pDlg->SetReference( rRange, *pDoc ); + m_pDlg->SetReference( rRange, rDoc ); } } @@ -319,13 +319,13 @@ void ScFormulaReferenceHelper::Init() if ( !pViewData ) return; - ScDocument* pDoc = pViewData->GetDocument(); + ScDocument& rDoc = pViewData->GetDocument(); SCCOL nCol = pViewData->GetCurX(); SCROW nRow = pViewData->GetCurY(); SCTAB nTab = pViewData->GetTabNo(); ScAddress aCursorPos( nCol, nRow, nTab ); - m_pRefComp.reset( new ScCompiler( pDoc, aCursorPos, pDoc->GetGrammar()) ); + m_pRefComp.reset( new ScCompiler( &rDoc, aCursorPos, rDoc.GetGrammar()) ); m_pRefComp->EnableJumpCommandReorder(false); m_pRefComp->EnableStopOnError(false); diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx index c8a172f0a331..1dddf426b60e 100644 --- a/sc/source/ui/miscdlgs/autofmt.cxx +++ b/sc/source/ui/miscdlgs/autofmt.cxx @@ -424,9 +424,9 @@ void ScAutoFmtPreview::Init() void ScAutoFmtPreview::DetectRTL(const ScViewData *pViewData) { SCTAB nCurrentTab = pViewData->GetTabNo(); - ScDocument* pDoc = pViewData->GetDocument(); - mbRTL = pDoc->IsLayoutRTL(nCurrentTab); - xBreakIter = pDoc->GetBreakIterator(); + ScDocument& rDoc = pViewData->GetDocument(); + mbRTL = rDoc.IsLayoutRTL(nCurrentTab); + xBreakIter = rDoc.GetBreakIterator(); } void ScAutoFmtPreview::CalcCellArray( bool bFitWidthP ) diff --git a/sc/source/ui/miscdlgs/conflictsdlg.cxx b/sc/source/ui/miscdlgs/conflictsdlg.cxx index e2b935c54954..d05007d984f2 100644 --- a/sc/source/ui/miscdlgs/conflictsdlg.cxx +++ b/sc/source/ui/miscdlgs/conflictsdlg.cxx @@ -343,7 +343,7 @@ ScConflictsDlg::ScConflictsDlg(weld::Window* pParent, ScViewData* pViewData, ScD , m_xLbConflicts(new SvxRedlinTable(m_xBuilder->weld_tree_view("container"), nullptr)) { OSL_ENSURE( mpViewData, "ScConflictsDlg CTOR: mpViewData is null!" ); - mpOwnDoc = ( mpViewData ? mpViewData->GetDocument() : nullptr ); + mpOwnDoc = ( mpViewData ? &mpViewData->GetDocument() : nullptr ); OSL_ENSURE( mpOwnDoc, "ScConflictsDlg CTOR: mpOwnDoc is null!" ); mpOwnTrack = ( mpOwnDoc ? mpOwnDoc->GetChangeTrack() : nullptr ); OSL_ENSURE( mpOwnTrack, "ScConflictsDlg CTOR: mpOwnTrack is null!" ); diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 4c3e1749e6fc..31dd29e9b879 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -61,7 +61,7 @@ ScColRowNameRangesDlg::ScColRowNameRangesDlg( SfxBindings* pB, : ScAnyRefDlgController(pB, pCW, pParent, "modules/scalc/ui/namerangesdialog.ui", "NameRangesDialog") , pViewData(ptrViewData) - , pDoc(ptrViewData->GetDocument()) + , rDoc(ptrViewData->GetDocument()) , bDlgLostFocus(false) , m_pEdActive(nullptr) , m_xLbRange(m_xBuilder->weld_tree_view("range")) @@ -84,8 +84,8 @@ ScColRowNameRangesDlg::ScColRowNameRangesDlg( SfxBindings* pB, m_xRbAssign2->SetReferences(this, m_xEdAssign2.get()); m_xEdAssign2->SetReferences(this, m_xDataFT.get()); - xColNameRanges = pDoc->GetColNameRanges()->Clone(); - xRowNameRanges = pDoc->GetRowNameRanges()->Clone(); + xColNameRanges = rDoc.GetColNameRanges()->Clone(); + xRowNameRanges = rDoc.GetRowNameRanges()->Clone(); Init(); } @@ -165,11 +165,11 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange, bool bRef SCCOL nCol2 = theCurArea.aEnd.Col(); SCROW nRow1 = theCurArea.aStart.Row(); SCROW nRow2 = theCurArea.aEnd.Row(); - if ( (static_cast<SCCOLROW>(nCol2 - nCol1) >= nRow2 - nRow1) || (nCol1 == 0 && nCol2 == pDoc->MaxCol()) ) + if ( (static_cast<SCCOLROW>(nCol2 - nCol1) >= nRow2 - nRow1) || (nCol1 == 0 && nCol2 == rDoc.MaxCol()) ) { // Column headers and the limiting case of the whole sheet m_xBtnColHead->set_active(true); m_xBtnRowHead->set_active(false); - if ( nRow2 == pDoc->MaxRow() ) + if ( nRow2 == rDoc.MaxRow() ) { if ( nRow1 == 0 ) bValid = false; // limiting case of the whole sheet @@ -182,14 +182,14 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange, bool bRef else { // Header at top, data below theCurData.aStart.SetRow( nRow2 + 1 ); - theCurData.aEnd.SetRow( pDoc->MaxRow() ); + theCurData.aEnd.SetRow( rDoc.MaxRow() ); } } else { // Column headers m_xBtnRowHead->set_active(true); m_xBtnColHead->set_active(false); - if ( nCol2 == pDoc->MaxCol() ) + if ( nCol2 == rDoc.MaxCol() ) { // Header at the right, data to the left theCurData.aStart.SetCol( 0 ); theCurData.aEnd.SetCol( nCol2 - 1 ); @@ -197,13 +197,13 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange, bool bRef else { // Header at the left, data to the right theCurData.aStart.SetCol( nCol2 + 1 ); - theCurData.aEnd.SetCol( pDoc->MaxCol() ); + theCurData.aEnd.SetCol( rDoc.MaxCol() ); } } if ( bValid ) { - const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); - OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, eConv)); + const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention(); + OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, eConv)); if(bRef) m_xEdAssign->SetRefString( aStr ); @@ -211,7 +211,7 @@ void ScColRowNameRangesDlg::SetColRowData( const ScRange& rLabelRange, bool bRef m_xEdAssign->SetText( aStr ); m_xEdAssign->SetCursorAtLast(); - aStr = theCurData.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, eConv); + aStr = theCurData.Format(rDoc, ScRefFlags::RANGE_ABS_3D, eConv); if(bRef) m_xEdAssign2->SetRefString( aStr ); @@ -253,7 +253,7 @@ void ScColRowNameRangesDlg::AdjustColRowData( const ScRange& rDataRange, bool bR SCROW nRow1 = theCurArea.aStart.Row(); SCROW nRow2 = theCurArea.aEnd.Row(); if ( nRow1 > 0 - && (theCurData.aEnd.Row() < nRow2 || nRow2 == pDoc->MaxRow()) ) + && (theCurData.aEnd.Row() < nRow2 || nRow2 == rDoc.MaxRow()) ) { // Data above header theCurData.aEnd.SetRow( nRow1 - 1 ); if ( theCurData.aStart.Row() > theCurData.aEnd.Row() ) @@ -276,7 +276,7 @@ void ScColRowNameRangesDlg::AdjustColRowData( const ScRange& rDataRange, bool bR SCCOL nCol1 = theCurArea.aStart.Col(); SCCOL nCol2 = theCurArea.aEnd.Col(); if ( nCol1 > 0 - && (theCurData.aEnd.Col() < nCol2 || nCol2 == pDoc->MaxCol()) ) + && (theCurData.aEnd.Col() < nCol2 || nCol2 == rDoc.MaxCol()) ) { // Data left of header theCurData.aEnd.SetCol( nCol1 - 1 ); if ( theCurData.aStart.Col() > theCurData.aEnd.Col() ) @@ -290,7 +290,7 @@ void ScColRowNameRangesDlg::AdjustColRowData( const ScRange& rDataRange, bool bR } } } - OUString aStr(theCurData.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, pDoc->GetAddressConvention())); + OUString aStr(theCurData.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention())); if(bRef) m_xEdAssign2->SetRefString( aStr ); @@ -361,7 +361,7 @@ void ScColRowNameRangesDlg::UpdateNames() SCROW nRow2; SCTAB nTab2; OUString rString; - const ScAddress::Details aDetails(pDoc->GetAddressConvention()); + const ScAddress::Details aDetails(rDoc.GetAddressConvention()); OUString strDelim(" --- "); OUString aString = strDelim + ScResId( STR_COLUMN ) + strDelim; @@ -369,12 +369,12 @@ void ScColRowNameRangesDlg::UpdateNames() if ( xColNameRanges->size() > 0 ) { std::vector<const ScRangePair*> aSortArray(xColNameRanges->CreateNameSortedArray( - pDoc )); + &rDoc )); nCount = aSortArray.size(); for ( j=0; j < nCount; j++ ) { const ScRange aRange(aSortArray[j]->GetRange(0)); - aString = aRange.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, aDetails); + aString = aRange.Format(rDoc, ScRefFlags::RANGE_ABS_3D, aDetails); //@008 get range parameters from document aSortArray[j]->GetRange(0).GetVars( nCol1, nRow1, nTab1, @@ -383,12 +383,12 @@ void ScColRowNameRangesDlg::UpdateNames() if(q>nCol2) q=nCol2; //@008 construct string OUStringBuffer strShow = " ["; - rString = pDoc->GetString(nCol1, nRow1, nTab1); + rString = rDoc.GetString(nCol1, nRow1, nTab1); strShow.append(rString); for(SCCOL i=nCol1+1;i<=q;i++) { strShow.append(", "); - rString = pDoc->GetString(i, nRow1, nTab1); + rString = rDoc.GetString(i, nRow1, nTab1); strShow.append(rString); } if(q<nCol2) // Too long? Add ",..." @@ -408,12 +408,12 @@ void ScColRowNameRangesDlg::UpdateNames() if ( xRowNameRanges->size() > 0 ) { std::vector<const ScRangePair*> aSortArray(xRowNameRanges->CreateNameSortedArray( - pDoc )); + &rDoc )); nCount = aSortArray.size(); for ( j=0; j < nCount; j++ ) { const ScRange aRange(aSortArray[j]->GetRange(0)); - aString = aRange.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, aDetails); + aString = aRange.Format(rDoc, ScRefFlags::RANGE_ABS_3D, aDetails); //@008 Build string for rows below aSortArray[j]->GetRange(0).GetVars( nCol1, nRow1, nTab1, @@ -421,12 +421,12 @@ void ScColRowNameRangesDlg::UpdateNames() SCROW q=nRow1+3; if(q>nRow2) q=nRow2; OUStringBuffer strShow = " ["; - rString = pDoc->GetString(nCol1, nRow1, nTab1); + rString = rDoc.GetString(nCol1, nRow1, nTab1); strShow.append(rString); for(SCROW i=nRow1+1;i<=q;i++) { strShow.append(", "); - rString = pDoc->GetString(nCol1, i, nTab1); + rString = rDoc.GetString(nCol1, i, nTab1); strShow.append(rString); } if(q<nRow2) @@ -455,16 +455,16 @@ void ScColRowNameRangesDlg::UpdateRangeData( const ScRange& rRange, bool bColNam if ( bFound ) { - const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention(); theCurArea = rRange; - OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, eConv)); + OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, eConv)); m_xEdAssign->SetText( aStr ); m_xBtnAdd->set_sensitive(false); m_xBtnRemove->set_sensitive(true); m_xBtnColHead->set_active(bColName); m_xBtnRowHead->set_active(!bColName); theCurData = pPair->GetRange(1); - aStr = theCurData.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, eConv); + aStr = theCurData.Format(rDoc, ScRefFlags::RANGE_ABS_3D, eConv); m_xEdAssign2->SetText( aStr ); } else @@ -492,12 +492,12 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, OkBtnHdl, weld::Button&, void) AddBtnHdl(*m_xBtnAdd); // assign RangeLists to the references in the document - pDoc->GetColNameRangesRef() = xColNameRanges; - pDoc->GetRowNameRangesRef() = xRowNameRanges; + rDoc.GetColNameRangesRef() = xColNameRanges; + rDoc.GetRowNameRangesRef() = xRowNameRanges; // changed ranges need to take effect - pDoc->CompileColRowNameFormula(); + rDoc.CompileColRowNameFormula(); ScDocShell* pDocShell = pViewData->GetDocShell(); - pDocShell->PostPaint(ScRange(0, 0, 0, pDoc->MaxCol(), pDoc->MaxRow(), MAXTAB), PaintPartFlags::Grid); + pDocShell->PostPaint(ScRange(0, 0, 0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB), PaintPartFlags::Grid); pDocShell->SetDocumentModified(); response(RET_OK); @@ -517,10 +517,10 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, AddBtnHdl, weld::Button&, void) if (aNewArea.isEmpty() || aNewData.isEmpty()) return; - const formula::FormulaGrammar::AddressConvention eConv = pDoc->GetAddressConvention(); + const formula::FormulaGrammar::AddressConvention eConv = rDoc.GetAddressConvention(); ScRange aRange1, aRange2; - bool bOk1 = (aRange1.ParseAny( aNewArea, *pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID; - if ( bOk1 && (aRange2.ParseAny( aNewData, *pDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID) + bool bOk1 = (aRange1.ParseAny( aNewArea, rDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID; + if ( bOk1 && (aRange2.ParseAny( aNewData, rDoc, eConv ) & ScRefFlags::VALID) == ScRefFlags::VALID) { theCurArea = aRange1; AdjustColRowData( aRange2 ); @@ -690,10 +690,10 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range1DataModifyHdl, formula::RefEdit&, v { OUString aNewArea( m_xEdAssign->GetText() ); bool bValid = false; - if (!aNewArea.isEmpty() && pDoc) + if (!aNewArea.isEmpty()) { ScRange aRange; - if ( (aRange.ParseAny(aNewArea, *pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID) + if ( (aRange.ParseAny(aNewArea, rDoc, rDoc.GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID) { SetColRowData( aRange ); bValid = true; @@ -725,7 +725,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, Range2DataModifyHdl, formula::RefEdit&, v if ( !aNewData.isEmpty() ) { ScRange aRange; - if ( (aRange.ParseAny(aNewData, *pDoc, pDoc->GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID) + if ( (aRange.ParseAny(aNewData, rDoc, rDoc.GetAddressConvention() ) & ScRefFlags::VALID) == ScRefFlags::VALID) { AdjustColRowData( aRange ); m_xBtnAdd->set_sensitive(true); @@ -745,15 +745,15 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, ColClickHdl, weld::Button&, void) if (!m_xBtnColHead->get_active()) return; - if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == pDoc->MaxRow() ) + if ( theCurArea.aStart.Row() == 0 && theCurArea.aEnd.Row() == rDoc.MaxRow() ) { - theCurArea.aEnd.SetRow( pDoc->MaxRow() - 1 ); - OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, pDoc->GetAddressConvention())); + theCurArea.aEnd.SetRow( rDoc.MaxRow() - 1 ); + OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention())); m_xEdAssign->SetText( aStr ); } ScRange aRange( theCurData ); - aRange.aStart.SetRow( std::min( static_cast<long>(theCurArea.aEnd.Row() + 1), static_cast<long>(pDoc->MaxRow()) ) ); - aRange.aEnd.SetRow( pDoc->MaxRow() ); + aRange.aStart.SetRow( std::min( static_cast<long>(theCurArea.aEnd.Row() + 1), static_cast<long>(rDoc.MaxRow()) ) ); + aRange.aEnd.SetRow( rDoc.MaxRow() ); AdjustColRowData( aRange ); } @@ -763,15 +763,15 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, RowClickHdl, weld::Button&, void) if (!m_xBtnRowHead->get_active()) return; - if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == pDoc->MaxCol() ) + if ( theCurArea.aStart.Col() == 0 && theCurArea.aEnd.Col() == rDoc.MaxCol() ) { - theCurArea.aEnd.SetCol( pDoc->MaxCol() - 1 ); - OUString aStr(theCurArea.Format(*pDoc, ScRefFlags::RANGE_ABS_3D, pDoc->GetAddressConvention())); + theCurArea.aEnd.SetCol( rDoc.MaxCol() - 1 ); + OUString aStr(theCurArea.Format(rDoc, ScRefFlags::RANGE_ABS_3D, rDoc.GetAddressConvention())); m_xEdAssign->SetText( aStr ); } ScRange aRange( theCurData ); - aRange.aStart.SetCol( static_cast<SCCOL>(std::min( static_cast<long>(theCurArea.aEnd.Col() + 1), static_cast<long>(pDoc->MaxCol()) )) ); - aRange.aEnd.SetCol( pDoc->MaxCol() ); + aRange.aStart.SetCol( static_cast<SCCOL>(std::min( static_cast<long>(theCurArea.aEnd.Col() + 1), static_cast<long>(rDoc.MaxCol()) )) ); + aRange.aEnd.SetCol( rDoc.MaxCol() ); AdjustColRowData( aRange ); } diff --git a/sc/source/ui/miscdlgs/datafdlg.cxx b/sc/source/ui/miscdlgs/datafdlg.cxx index d6026c8b7937..df21fb4c26b7 100644 --- a/sc/source/ui/miscdlgs/datafdlg.cxx +++ b/sc/source/ui/miscdlgs/datafdlg.cxx @@ -47,8 +47,8 @@ ScDataFormDlg::ScDataFormDlg(weld::Window* pParent, ScTabViewShell* pTabViewShel OSL_ENSURE( pTabViewShell, "pTabViewShell is NULL! :-/" ); ScViewData& rViewData = pTabViewShell->GetViewData(); - pDoc = rViewData.GetDocument(); - if (pDoc) + pDoc = &rViewData.GetDocument(); + { ScRange aRange; rViewData.GetSimpleArea( aRange ); diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx index 584119681fa0..c6cc22765e0d 100644 --- a/sc/source/ui/miscdlgs/highred.cxx +++ b/sc/source/ui/miscdlgs/highred.cxx @@ -29,7 +29,7 @@ ScHighlightChgDlg::ScHighlightChgDlg(SfxBindings* pB, SfxChildWindow* pCW, weld: ScViewData* ptrViewData) : ScAnyRefDlgController(pB, pCW, pParent, "modules/scalc/ui/showchangesdialog.ui", "ShowChangesDialog") , pViewData(ptrViewData) - , pDoc(ptrViewData->GetDocument()) + , rDoc(ptrViewData->GetDocument()) , m_xHighlightBox(m_xBuilder->weld_check_button("showchanges")) , m_xCbAccept(m_xBuilder->weld_check_button("showaccepted")) , m_xCbReject(m_xBuilder->weld_check_button("showrejected")) @@ -59,9 +59,9 @@ ScHighlightChgDlg::~ScHighlightChgDlg() void ScHighlightChgDlg::Init() { - OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found!" ); + OSL_ENSURE( pViewData, "ViewData or Document not found!" ); - ScChangeTrack* pChanges=pDoc->GetChangeTrack(); + ScChangeTrack* pChanges = rDoc.GetChangeTrack(); if(pChanges!=nullptr) { aChangeViewSet.SetTheAuthorToShow(pChanges->GetUser()); @@ -71,7 +71,7 @@ void ScHighlightChgDlg::Init() m_xFilterCtr->InsertAuthor(rItem); } - ScChangeViewSettings* pViewSettings=pDoc->GetChangeViewSettings(); + ScChangeViewSettings* pViewSettings = rDoc.GetChangeViewSettings(); if(pViewSettings!=nullptr) aChangeViewSet=*pViewSettings; @@ -116,7 +116,7 @@ void ScHighlightChgDlg::Init() if ( !aChangeViewSet.GetTheRangeList().empty() ) { const ScRange & rRangeEntry = aChangeViewSet.GetTheRangeList().front(); - OUString aRefStr(rRangeEntry.Format(*pDoc, ScRefFlags::RANGE_ABS_3D)); + OUString aRefStr(rRangeEntry.Format(rDoc, ScRefFlags::RANGE_ABS_3D)); m_xFilterCtr->SetRange(aRefStr); } m_xFilterCtr->Enable(true); @@ -212,10 +212,10 @@ IMPL_LINK_NOARG(ScHighlightChgDlg, OKBtnHdl, weld::Button&, void) aChangeViewSet.SetHasComment(m_xFilterCtr->IsComment()); aChangeViewSet.SetTheComment(m_xFilterCtr->GetComment()); ScRangeList aLocalRangeList; - aLocalRangeList.Parse(m_xFilterCtr->GetRange(), *pDoc); + aLocalRangeList.Parse(m_xFilterCtr->GetRange(), rDoc); aChangeViewSet.SetTheRangeList(aLocalRangeList); - aChangeViewSet.AdjustDateMode( *pDoc ); - pDoc->SetChangeViewSettings(aChangeViewSet); + aChangeViewSet.AdjustDateMode( rDoc ); + rDoc.SetChangeViewSettings(aChangeViewSet); pViewData->GetDocShell()->PostPaintGridAll(); response(RET_OK); } diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index 473646d227f9..a2f19ab05c8b 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -37,7 +37,7 @@ ScInsertTableDlg::ScInsertTableDlg(weld::Window* pParent, ScViewData& rData, SCTAB nTabCount, bool bFromFile) : GenericDialogController(pParent, "modules/scalc/ui/insertsheet.ui", "InsertSheetDialog") , rViewData(rData) - , rDoc(*rData.GetDocument()) + , rDoc(rData.GetDocument()) , pDocShTables(nullptr) , bMustClose(false) , nSelTabIndex(0) diff --git a/sc/source/ui/namedlg/namedefdlg.cxx b/sc/source/ui/namedlg/namedefdlg.cxx index 920f4d52ce11..9a4ec692bd7c 100644 --- a/sc/source/ui/namedlg/namedefdlg.cxx +++ b/sc/source/ui/namedlg/namedefdlg.cxx @@ -30,7 +30,7 @@ ScNameDefDlg::ScNameDefDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* const ScAddress& aCursorPos, const bool bUndo ) : ScAnyRefDlgController( pB, pCW, pParent, "modules/scalc/ui/definename.ui", "DefineNameDialog") , mbUndo( bUndo ) - , mrDoc(*pViewData->GetDocument()) + , mrDoc(pViewData->GetDocument()) , mpDocShell ( pViewData->GetDocShell() ) , maCursorPos( aCursorPos ) , maGlobalNameStr ( ScResId(STR_GLOBAL_SCOPE) ) diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 2b237dedf16c..140e74eb547e 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -54,7 +54,7 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParen , maStrMultiSelect(ScResId(STR_MULTI_SELECT)) , mpViewData(ptrViewData) - , mpDoc(ptrViewData->GetDocument()) + , mrDoc(ptrViewData->GetDocument()) , maCursorPos(aCursorPos) , mbDataChanged(false) , mbCloseWithoutUndo(false) @@ -83,7 +83,7 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParen if (!pRangeMap) { std::map<OUString, ScRangeName*> aRangeMap; - mpDoc->GetRangeNameMap(aRangeMap); + mrDoc.GetRangeNameMap(aRangeMap); for (const auto& [aTemp, pRangeName] : aRangeMap) { m_RangeMap.insert(std::make_pair(aTemp, std::make_unique<ScRangeName>(*pRangeName))); @@ -102,8 +102,6 @@ ScNameDlg::~ScNameDlg() void ScNameDlg::Init() { - OSL_ENSURE( mpViewData && mpDoc, "ViewData or Document not found!" ); - //init UI std::unique_ptr<weld::TreeView> xTreeView(m_xBuilder->weld_tree_view("names")); @@ -136,11 +134,11 @@ void ScNameDlg::Init() // Initialize scope list. m_xLbScope->append_text(maGlobalNameStr); m_xLbScope->set_active(0); - SCTAB n = mpDoc->GetTableCount(); + SCTAB n = mrDoc.GetTableCount(); for (SCTAB i = 0; i < n; ++i) { OUString aTabName; - mpDoc->GetName(i, aTabName); + mrDoc.GetName(i, aTabName); m_xLbScope->append_text(aTabName); } @@ -250,7 +248,7 @@ bool ScNameDlg::IsNameValid() ScRangeName* pRangeName = GetRangeName( aScope ); - if (ScRangeData::IsNameValid( aName, mpDoc ) != ScRangeData::NAME_VALID) + if (ScRangeData::IsNameValid( aName, &mrDoc ) != ScRangeData::NAME_VALID) { m_xFtInfo->set_label_type(weld::LabelType::Error); m_xFtInfo->set_label(maErrInvalidNameStr); @@ -268,7 +266,7 @@ bool ScNameDlg::IsNameValid() bool ScNameDlg::IsFormulaValid() { - ScCompiler aComp( mpDoc, maCursorPos, mpDoc->GetGrammar()); + ScCompiler aComp( &mrDoc, maCursorPos, mrDoc.GetGrammar()); std::unique_ptr<ScTokenArray> pCode = aComp.CompileString(m_xEdAssign->GetText()); if (pCode->GetCodeError() != FormulaError::NONE) { @@ -388,7 +386,7 @@ void ScNameDlg::NameModified() if ( m_xBtnPrintArea->get_active() ) nType |= ScRangeData::Type::PrintArea; if ( m_xBtnCriteria->get_active() ) nType |= ScRangeData::Type::Criteria; - ScRangeData* pNewEntry = new ScRangeData( *mpDoc, aNewName, aExpr, + ScRangeData* pNewEntry = new ScRangeData( mrDoc, aNewName, aExpr, maCursorPos, nType); pNewEntry->SetIndex( nIndex); pNewRangeName->insert(pNewEntry, false /*bReuseFreeIndex*/); diff --git a/sc/source/ui/navipi/navcitem.cxx b/sc/source/ui/navipi/navcitem.cxx index a3ba855cc27c..bac2b45e179d 100644 --- a/sc/source/ui/navipi/navcitem.cxx +++ b/sc/source/ui/navipi/navcitem.cxx @@ -51,7 +51,7 @@ void ScNavigatorControllerItem::StateChanged( sal_uInt16 /* nSID */, SfxItemStat const OUString& aAddress( pCellPosItem->GetValue() ); ScAddress aScAddress; ScViewData* pViewData = rNavigatorDlg.GetViewData(); - aScAddress.Parse(aAddress, pViewData ? pViewData->GetDocument() : nullptr); + aScAddress.Parse(aAddress, pViewData ? &pViewData->GetDocument() : nullptr); SCCOL nCol = aScAddress.Col()+1; SCROW nRow = aScAddress.Row()+1; diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index d0bf33ae0d95..1ff33a64cfd4 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -136,7 +136,7 @@ IMPL_LINK(ScNavigatorDlg, ParseRowInputHdl, int*, result, bool) // nKeyGroup is no longer set at VCL, in cause of lack of keyinput ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); - auto& rDoc = *pViewSh->GetViewData().GetDocument(); + auto& rDoc = pViewSh->GetViewData().GetDocument(); if ( CharClass::isAsciiNumeric(aStrCol) ) nCol = NumStrToAlpha( rDoc.GetSheetLimits(), aStrCol ); else @@ -347,14 +347,14 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent) set_id("NavigatorPanelParent"); // for uitests GetViewData(); - ScDocument* pDoc = pViewData->GetDocument(); - m_xEdRow->set_range(1, SCNAV_MAXROW(pDoc->GetSheetLimits())); + ScDocument& rDoc = pViewData->GetDocument(); + m_xEdRow->set_range(1, SCNAV_MAXROW(rDoc.GetSheetLimits())); m_xEdRow->set_width_chars(5); //max rows is 1,000,000, which is too long for typical use m_xEdRow->connect_activate(LINK(this, ScNavigatorDlg, ExecuteRowHdl)); - m_xEdCol->set_range(1, SCNAV_MAXCOL(pDoc->GetSheetLimits())); - m_xEdCol->set_width_chars(SCNAV_COLDIGITS(pDoc->GetSheetLimits())); // 1...256...18278 or A...IV...ZZZ + m_xEdCol->set_range(1, SCNAV_MAXCOL(rDoc.GetSheetLimits())); + m_xEdCol->set_width_chars(SCNAV_COLDIGITS(rDoc.GetSheetLimits())); // 1...256...18278 or A...IV...ZZZ m_xEdCol->connect_activate(LINK(this, ScNavigatorDlg, ExecuteColHdl)); m_xEdCol->connect_output(LINK(this, ScNavigatorDlg, FormatRowOutputHdl)); m_xEdCol->connect_input(LINK(this, ScNavigatorDlg, ParseRowInputHdl)); @@ -607,19 +607,19 @@ void ScNavigatorDlg::SetCurrentTableStr( const OUString& rName ) { if (!GetViewData()) return; - ScDocument* pDoc = pViewData->GetDocument(); - SCTAB nCount = pDoc->GetTableCount(); + ScDocument& rDoc = pViewData->GetDocument(); + SCTAB nCount = rDoc.GetTableCount(); OUString aTabName; SCTAB nLastSheet = 0; for (SCTAB i = 0; i<nCount; i++) { - pDoc->GetName(i, aTabName); + rDoc.GetName(i, aTabName); if (aTabName == rName) { // Check if this is a Scenario sheet and if so select the sheet // where it belongs to, which is the previous non-Scenario sheet. - if (pDoc->IsScenario(i)) + if (rDoc.IsScenario(i)) { SetCurrentTable(nLastSheet); return; @@ -632,7 +632,7 @@ void ScNavigatorDlg::SetCurrentTableStr( const OUString& rName ) } else { - if (!pDoc->IsScenario(i)) + if (!rDoc.IsScenario(i)) nLastSheet = i; } } diff --git a/sc/source/ui/optdlg/tpusrlst.cxx b/sc/source/ui/optdlg/tpusrlst.cxx index e0e4ed90e3c2..33f5bad417a7 100644 --- a/sc/source/ui/optdlg/tpusrlst.cxx +++ b/sc/source/ui/optdlg/tpusrlst.cxx @@ -105,7 +105,7 @@ void ScTpUserLists::Init() SCROW nEndRow = 0; pViewData = &pViewSh->GetViewData(); - pDoc = pViewData->GetDocument(); + pDoc = &pViewData->GetDocument(); pViewData->GetSimpleArea( nStartCol, nStartRow, nStartTab, nEndCol, nEndRow, nEndTab ); diff --git a/sc/source/ui/pagedlg/tphf.cxx b/sc/source/ui/pagedlg/tphf.cxx index b4689f51197f..b5e53311b6aa 100644 --- a/sc/source/ui/pagedlg/tphf.cxx +++ b/sc/source/ui/pagedlg/tphf.cxx @@ -59,9 +59,9 @@ ScHFPage::ScHFPage(weld::Container* pPage, weld::DialogController* pController, if ( pViewSh ) { ScViewData& rViewData = pViewSh->GetViewData(); - ScDocument* pDoc = rViewData.GetDocument(); + ScDocument& rDoc = rViewData.GetDocument(); - aStrPageStyle = pDoc->GetPageStyle( rViewData.GetTabNo() ); + aStrPageStyle = rDoc.GetPageStyle( rViewData.GetTabNo() ); } m_xBtnEdit->connect_clicked(LINK(this, ScHFPage, BtnHdl)); diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx index 18609b38af10..21b101b5bf46 100644 --- a/sc/source/ui/uitest/uiobject.cxx +++ b/sc/source/ui/uitest/uiobject.cxx @@ -34,19 +34,19 @@ namespace { -ScAddress get_address_from_string(const ScDocument* pDoc, const OUString& rStr) +ScAddress get_address_from_string(const ScDocument& rDoc, const OUString& rStr) { ScAddress aAddr; sal_Int32 nOffset = 0; - ScRangeStringConverter::GetAddressFromString(aAddr, rStr, pDoc, formula::FormulaGrammar::CONV_OOO, nOffset); + ScRangeStringConverter::GetAddressFromString(aAddr, rStr, &rDoc, formula::FormulaGrammar::CONV_OOO, nOffset); return aAddr; } -ScRange get_range_from_string(const ScDocument* pDoc, const OUString& rStr) +ScRange get_range_from_string(const ScDocument& rDoc, const OUString& rStr) { ScRange aRange; sal_Int32 nOffset = 0; - ScRangeStringConverter::GetRangeFromString(aRange, rStr, pDoc, formula::FormulaGrammar::CONV_OOO, nOffset); + ScRangeStringConverter::GetRangeFromString(aRange, rStr, &rDoc, formula::FormulaGrammar::CONV_OOO, nOffset); return aRange; } @@ -75,15 +75,15 @@ StringMap ScGridWinUIObject::get_state() 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* pDoc = mxGridWindow->getViewData()->GetDocument(); + ScDocument& rDoc = mxGridWindow->getViewData()->GetDocument(); ScAddress aPos( mxGridWindow->getViewData()->GetCurX() , mxGridWindow->getViewData()->GetCurY() , mxGridWindow->getViewData()->GetTabNo() ); - if ( pDoc->HasNote( aPos ) ) + if ( rDoc.HasNote( aPos ) ) { - ScPostIt* pNote = pDoc->GetNote(aPos); + ScPostIt* pNote = rDoc.GetNote(aPos); assert(pNote); aMap["CurrentCellCommentText"] = pNote->GetText(); } @@ -270,9 +270,9 @@ void ScGridWinUIObject::execute(const OUString& rAction, { ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits