diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-12 10:19:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-01-12 14:46:29 +0000 |
commit | 0ef626f2ff72c62ee42e74e2b58174c047e384cd (patch) | |
tree | 340e7159b07866c884a776282726af8a8a8e16b5 /sc | |
parent | 5fd2f0b93bd7d38a277823bfc251c71da7a6f490 (diff) |
override GetModel in ScDocShell
so we can avoid dynamic_cast and XUnoTunnel in various places
Change-Id: I1f524270a8030106a2058691c3d89b90d46ed26f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145391
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
23 files changed, 36 insertions, 54 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 2f2f3521ae4e..071c2530f61b 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -503,8 +503,7 @@ bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const css::uno::Reference< css //if the document was not generated by LibreOffice, do hard recalc in case some other document //generator saved cached formula results that differ from LibreOffice's calculated results or //did not use cached formula results. - uno::Reference<document::XDocumentPropertiesSupplier> xDPS(GetModel(), uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties(); + uno::Reference<document::XDocumentProperties> xDocProps = GetModel()->getDocumentProperties(); ScRecalcOptions nRecalcMode = static_cast<ScRecalcOptions>(officecfg::Office::Calc::Formula::Load::ODFRecalcMode::get()); @@ -896,7 +895,6 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) bChangedViewSettings = true; } - uno::Reference< frame::XStorable > xStor( GetModel(), uno::UNO_QUERY_THROW ); // TODO/LATER: More entries from the MediaDescriptor might be interesting for the merge uno::Sequence< beans::PropertyValue > aValues{ comphelper::makePropertyValue( @@ -922,7 +920,7 @@ void ScDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) } SC_MOD()->SetInSharedDocSaving( true ); - xStor->storeToURL( GetSharedFileURL(), aValues ); + GetModel()->storeToURL( GetSharedFileURL(), aValues ); SC_MOD()->SetInSharedDocSaving( false ); if ( bChangedViewSettings ) diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 803ba61f8a7a..5d3cd076f623 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -175,7 +175,7 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa // the document size too - cell size affects that, obviously) if ((nPart & (PaintPartFlags::Top | PaintPartFlags::Left)) && comphelper::LibreOfficeKit::isActive()) { - ScModelObj* pModel = comphelper::getFromUnoTunnel<ScModelObj>(this->GetModel()); + ScModelObj* pModel = GetModel(); SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel); } } @@ -696,10 +696,8 @@ void ScDocShell::CompareDocument( ScDocument& rOtherDoc ) // (only if comparing different documents) using namespace ::com::sun::star; - uno::Reference<document::XDocumentPropertiesSupplier> xDPS( - GetModel(), uno::UNO_QUERY_THROW); uno::Reference<document::XDocumentProperties> xDocProps( - xDPS->getDocumentProperties()); + GetModel()->getDocumentProperties()); OSL_ENSURE(xDocProps.is(), "no DocumentProperties"); OUString aDocUser = xDocProps->getModifiedBy(); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 494057b12087..a57a40e9be8b 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1132,9 +1132,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) EnableSharedSettings( false ); // Do *not* use dispatch mechanism in this place - we don't want others (extensions etc.) to intercept this. - uno::Reference<frame::XStorable> xStorable2( - GetModel(), uno::UNO_QUERY_THROW); - xStorable2->store(); + GetModel()->store(); ScTabView* pTabView = pViewData->GetView(); if ( pTabView ) diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index ba7c2cba3573..e753e63214a6 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -139,7 +139,7 @@ void lcl_ChartInit(const uno::Reference <embed::XEmbeddedObject>& xObj, ScViewDa xReceiver->attachDataProvider(xDataProvider); - uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pDocShell->GetModel(), uno::UNO_QUERY ); + uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( static_cast<cppu::OWeakObject*>(pDocShell->GetModel()), uno::UNO_QUERY ); xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier ); // Same behavior as with old chart: Always assume data series in columns diff --git a/sc/source/ui/drawfunc/fusel.cxx b/sc/source/ui/drawfunc/fusel.cxx index 2b051bb3bf11..9695702c55e3 100644 --- a/sc/source/ui/drawfunc/fusel.cxx +++ b/sc/source/ui/drawfunc/fusel.cxx @@ -531,7 +531,7 @@ bool FuSelection::MouseButtonUp(const MouseEvent& rMEvt) if ( bCopy && pPage ) { ScDocShell* pDocShell = rViewData.GetDocShell(); - ScModelObj* pModelObj = ( pDocShell ? comphelper::getFromUnoTunnel<ScModelObj>( pDocShell->GetModel() ) : nullptr ); + ScModelObj* pModelObj = ( pDocShell ? pDocShell->GetModel() : nullptr ); if ( pModelObj ) { SCTAB nTab = rViewData.GetTabNo(); diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 8fac5cf6ed5a..edf0cbc1c1b0 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -430,6 +430,8 @@ public: void SnapVisArea( tools::Rectangle& rRect ) const; void RegisterAutomationWorkbookObject(css::uno::Reference< ooo::vba::excel::XWorkbook > const& xWorkbook); + + ScModelObj* GetModel() const { return static_cast<ScModelObj*>(SfxObjectShell::GetModel().get()); } }; void UpdateAcceptChangesDialog(); @@ -490,11 +492,6 @@ namespace HelperNotifyChanges return false; } - inline ScModelObj* getModel(const ScDocShell &rDocShell) - { - return comphelper::getFromUnoTunnel<ScModelObj>(rDocShell.GetModel()); - } - inline bool getMustPropagateChangesModel(ScModelObj* pModelObj) { return pModelObj && pModelObj->HasChangesListeners(); @@ -511,7 +508,7 @@ namespace HelperNotifyChanges inline void NotifyIfChangesListeners(const ScDocShell &rDocShell, const ScRange &rRange, const OUString &rType = OUString("cell-change")) { - ScModelObj* pModelObj = getModel(rDocShell); + ScModelObj* pModelObj = rDocShell.GetModel(); ScRangeList aChangeRanges(rRange); if (getMustPropagateChangesModel(pModelObj)) diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 5f4270b559c5..42fdf95ae1a7 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -830,7 +830,7 @@ bool ScOptSolverDlg::CallSolver() // return true -> close dialog after cal ReadConditions(); - uno::Reference<sheet::XSpreadsheetDocument> xDocument( mpDocShell->GetModel(), uno::UNO_QUERY ); + rtl::Reference<ScModelObj> xDocument( mpDocShell->GetModel() ); ScRange aObjRange; if ( !ParseRef( aObjRange, m_xEdObjectiveCell->GetText(), false ) ) diff --git a/sc/source/ui/miscdlgs/sharedocdlg.cxx b/sc/source/ui/miscdlgs/sharedocdlg.cxx index bb02a2e7d385..5ebe52a8e677 100644 --- a/sc/source/ui/miscdlgs/sharedocdlg.cxx +++ b/sc/source/ui/miscdlgs/sharedocdlg.cxx @@ -196,8 +196,7 @@ void ScShareDocumentDlg::UpdateView() } aUser += " " + m_aStrExclusiveAccess; - uno::Reference<document::XDocumentPropertiesSupplier> xDPS(mpDocShell->GetModel(), uno::UNO_QUERY_THROW); - uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties(); + uno::Reference<document::XDocumentProperties> xDocProps = mpDocShell->GetModel()->getDocumentProperties(); util::DateTime uDT(xDocProps->getModificationDate()); DateTime aDateTime(uDT); diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index c51110402b1e..16c79ea457f5 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -50,7 +50,7 @@ namespace HelperNotifyChanges static void NotifyIfChangesListeners(const ScDocShell& rDocShell, const ScAddress &rPos, const ScUndoEnterData::ValuesType &rOldValues, const OUString& rType = OUString("cell-change")) { - ScModelObj* pModelObj = getModel(rDocShell); + ScModelObj* pModelObj = rDocShell.GetModel(); if (pModelObj) { ScRangeList aChangeRanges; diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx b/sc/source/ui/unoobj/TablePivotCharts.cxx index da5fc9f2f19d..7bc7731cd1b0 100644 --- a/sc/source/ui/unoobj/TablePivotCharts.cxx +++ b/sc/source/ui/unoobj/TablePivotCharts.cxx @@ -139,7 +139,7 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const & rName, { xReceiver->attachDataProvider(xDataProvider); - uno::Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(m_pDocShell->GetModel(), uno::UNO_QUERY); + uno::Reference<util::XNumberFormatsSupplier> xNumberFormatsSupplier(static_cast<cppu::OWeakObject*>(m_pDocShell->GetModel()), uno::UNO_QUERY); xReceiver->attachNumberFormatsSupplier(xNumberFormatsSupplier); uno::Sequence<beans::PropertyValue> aArgs( comphelper::InitPropertySequence({ diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index 4d4ea02c3e24..25f356eed2e7 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -222,7 +222,7 @@ void SAL_CALL ScChartsObj::addNewByName( const OUString& rName, else sRangeStr = "all"; - uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( pDocShell->GetModel(), uno::UNO_QUERY ); + uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( static_cast<cppu::OWeakObject*>(pDocShell->GetModel()), uno::UNO_QUERY ); xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier ); // set arguments diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index f2713d26bfac..073a57119bb4 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -95,7 +95,7 @@ public: uno::Sequence< uno::Any > aArgs{ // access the application object ( parent for workbook ) uno::Any(ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.Application", {} )), - uno::Any(mpDocShell->GetModel()) + uno::Any(uno::Reference(static_cast<css::sheet::XSpreadsheetDocument*>(mpDocShell->GetModel()))) }; maWorkbook <<= ooo::vba::createVBAUnoAPIServiceWithArgs( mpDocShell, "ooo.vba.excel.Workbook", aArgs ); } @@ -182,8 +182,7 @@ public: OUString sCodeName; // need to find the page ( and index ) for this control - uno::Reference< drawing::XDrawPagesSupplier > xSupplier( mrDocShell.GetModel(), uno::UNO_QUERY_THROW ); - uno::Reference< container::XIndexAccess > xIndex( xSupplier->getDrawPages(), uno::UNO_QUERY_THROW ); + uno::Reference< container::XIndexAccess > xIndex( mrDocShell.GetModel()->getDrawPages(), uno::UNO_QUERY_THROW ); sal_Int32 nLen = xIndex->getCount(); bool bMatched = false; for ( sal_Int32 index = 0; index < nLen; ++index ) @@ -218,8 +217,7 @@ public: OUString SAL_CALL getCodeNameForContainer( const uno::Reference<uno::XInterface>& xContainer ) override { SolarMutexGuard aGuard; - uno::Reference<drawing::XDrawPagesSupplier> xSupplier(mrDocShell.GetModel(), uno::UNO_QUERY_THROW); - uno::Reference<container::XIndexAccess> xIndex(xSupplier->getDrawPages(), uno::UNO_QUERY_THROW); + uno::Reference<container::XIndexAccess> xIndex(mrDocShell.GetModel()->getDrawPages(), uno::UNO_QUERY_THROW); for (sal_Int32 i = 0, n = xIndex->getCount(); i < n; ++i) { @@ -583,7 +581,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance( uno::Any aGlobs; if ( !pDocShell->GetBasicManager()->GetGlobalUNOConstant( "VBAGlobals", aGlobs ) ) { - uno::Sequence< uno::Any > aArgs{ uno::Any(pDocShell->GetModel()) }; + uno::Sequence< uno::Any > aArgs{ uno::Any(uno::Reference(static_cast<css::sheet::XSpreadsheetDocument*>(pDocShell->GetModel()))) }; xRet = ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( "ooo.vba.excel.Globals", aArgs ); pDocShell->GetBasicManager()->SetGlobalUNOConstant( "VBAGlobals", uno::Any( xRet ) ); BasicManager* pAppMgr = SfxApplication::GetBasicManager(); diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx index 1c1824d89533..f752234943c5 100644 --- a/sc/source/ui/vba/excelvbahelper.cxx +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -339,8 +339,7 @@ void setUpDocumentModules( const uno::Reference< sheet::XSpreadsheetDocument >& if( xLib.is() ) { uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, uno::UNO_QUERY_THROW ); - uno::Reference< lang::XMultiServiceFactory> xSF( pShell->GetModel(), uno::UNO_QUERY_THROW); - uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess( xSF->createInstance("ooo.vba.VBAObjectModuleObjectProvider"), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xVBACodeNamedObjectAccess( pShell->GetModel()->createInstance("ooo.vba.VBAObjectModuleObjectProvider"), uno::UNO_QUERY_THROW ); // set up the module info for the workbook and sheets in the newly created // spreadsheet ScDocument& rDoc = pShell->GetDocument(); diff --git a/sc/source/ui/vba/vbachartobjects.cxx b/sc/source/ui/vba/vbachartobjects.cxx index 5cc12080c1e4..cdc1d3d48362 100644 --- a/sc/source/ui/vba/vbachartobjects.cxx +++ b/sc/source/ui/vba/vbachartobjects.cxx @@ -111,8 +111,7 @@ ScVbaChartObjects::getChartObjectNames() const if ( !pDocShell ) throw uno::RuntimeException("Failed to obtain the docshell implclass" ); - uno::Reference< sheet::XSpreadsheetDocument > xSpreadsheetDocument( pDocShell->GetModel(), uno::UNO_QUERY_THROW ); - uno::Reference< sheet::XSpreadsheets > xSpreadsheets = xSpreadsheetDocument->getSheets(); + uno::Reference< sheet::XSpreadsheets > xSpreadsheets = pDocShell->GetModel()->getSheets(); std::vector< OUString > aChartNamesVector; const uno::Sequence< OUString > sSheetNames = xSpreadsheets->getElementNames(); diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 15a04d480f9e..4998942084ce 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -1173,8 +1173,7 @@ ScVbaRange::getCellRangesForAddress( ScRefFlags& rResFlags, std::u16string_view bool getScRangeListForAddress( const OUString& sName, ScDocShell* pDocSh, const ScRange& refRange, ScRangeList& aCellRanges, formula::FormulaGrammar::AddressConvention aConv ) { // see if there is a match with a named range - uno::Reference< beans::XPropertySet > xProps( pDocSh->GetModel(), uno::UNO_QUERY_THROW ); - uno::Reference< container::XNameAccess > xNameAccess( xProps->getPropertyValue( "NamedRanges" ), uno::UNO_QUERY_THROW ); + uno::Reference< container::XNameAccess > xNameAccess( pDocSh->GetModel()->getPropertyValue( "NamedRanges" ), uno::UNO_QUERY_THROW ); // Strange enough you can have Range( "namedRange1, namedRange2, etc," ) // loop around each ',' separated name std::vector< OUString > vNames; @@ -5213,7 +5212,6 @@ ScVbaRange::GoalSeek( const uno::Any& Goal, const uno::Reference< excel::XRange ScVbaRange* pRange = static_cast< ScVbaRange* >( ChangingCell.get() ); if ( pDocShell && pRange ) { - uno::Reference< sheet::XGoalSeek > xGoalSeek( pDocShell->GetModel(), uno::UNO_QUERY_THROW ); RangeHelper thisRange( mxRange ); table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress(); RangeHelper changingCellRange( pRange->mxRange ); @@ -5221,7 +5219,7 @@ ScVbaRange::GoalSeek( const uno::Any& Goal, const uno::Reference< excel::XRange OUString sGoal = getAnyAsString( Goal ); table::CellAddress thisCell( thisAddress.Sheet, thisAddress.StartColumn, thisAddress.StartRow ); table::CellAddress changingCell( changingCellAddr.Sheet, changingCellAddr.StartColumn, changingCellAddr.StartRow ); - sheet::GoalResult res = xGoalSeek->seekGoal( thisCell, changingCell, sGoal ); + sheet::GoalResult res = pDocShell->GetModel()->seekGoal( thisCell, changingCell, sGoal ); ChangingCell->setValue( uno::Any( res.Result ) ); // openoffice behaves differently, result is 0 if the divergence is too great diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index 3c823fad2fa1..9c35f3f1a4c3 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -398,11 +398,10 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) const SfxStringItem* pFamilyItem = rReq.GetArg<SfxStringItem>(SID_STYLE_FAMILYNAME); if ( pFamilyItem && pNameItem ) { - css::uno::Reference< css::style::XStyleFamiliesSupplier > xModel(pDocSh->GetModel(), css::uno::UNO_QUERY); try { css::uno::Reference< css::container::XNameAccess > xStyles; - css::uno::Reference< css::container::XNameAccess > xCont = xModel->getStyleFamilies(); + css::uno::Reference< css::container::XNameAccess > xCont = pDocSh->GetModel()->getStyleFamilies(); xCont->getByName(pFamilyItem->GetValue()) >>= xStyles; css::uno::Reference< css::beans::XPropertySet > xInfo; xStyles->getByName( pNameItem->GetValue() ) >>= xInfo; diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 5b2c44ee4875..4248fdd08526 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2631,8 +2631,7 @@ void lcl_ExtendTiledDimension(bool bColumn, const SCCOLROW nEnd, const SCCOLROW return; ScDocShell* pDocSh = rViewData.GetDocShell(); - ScModelObj* pModelObj = pDocSh ? - comphelper::getFromUnoTunnel<ScModelObj>( pDocSh->GetModel() ) : nullptr; + ScModelObj* pModelObj = pDocSh ? pDocSh->GetModel() : nullptr; Size aOldSize(0, 0); if (pModelObj) aOldSize = pModelObj->getDocumentSize(); diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index feab66cbd411..fdf3a3d517dc 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -403,7 +403,7 @@ void ScTabView::SetCursor( SCCOL nPosX, SCROW nPosY, bool bNew ) ScDocument& rDoc = aViewData.GetDocument(); ScDocShell* pDocSh = aViewData.GetDocShell(); - ScModelObj* pModelObj = pDocSh ? comphelper::getFromUnoTunnel<ScModelObj>( pDocSh->GetModel() ) : nullptr; + ScModelObj* pModelObj = pDocSh ? pDocSh->GetModel() : nullptr; Size aOldSize(0, 0); if (pModelObj) aOldSize = pModelObj->getDocumentSize(); diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index dd3e057ada21..f3569ac9497f 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -332,7 +332,7 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) return; ScDocShell* pDocSh = GetViewData().GetDocShell(); - ScModelObj* pModelObj = pDocSh ? comphelper::getFromUnoTunnel<ScModelObj>( pDocSh->GetModel()) : nullptr; + ScModelObj* pModelObj = pDocSh ? pDocSh->GetModel() : nullptr; if (!pModelObj) return; diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 884722204f0a..8be670e2834f 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1487,7 +1487,7 @@ void ScViewFunc::FillAuto( FillDir eDir, SCCOL nStartCol, SCROW nStartRow, if ( bDoAutoSpell ) CopyAutoSpellData(eDir, nStartCol, nStartRow, nEndCol, nEndRow, nCount); - ScModelObj* pModelObj = HelperNotifyChanges::getModel(*pDocSh); + ScModelObj* pModelObj = pDocSh->GetModel(); ScRangeList aChangeRanges; ScRange aChangeRange( aRange ); diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 9dd9b810273a..a19484aa9007 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -1448,7 +1448,7 @@ bool ScViewFunc::PasteFromClip( InsertDeleteFlags nFlags, ScDocument* pClipDoc, if ( nFlags & InsertDeleteFlags::OBJECTS ) { - ScModelObj* pModelObj = comphelper::getFromUnoTunnel<ScModelObj>( pDocSh->GetModel() ); + ScModelObj* pModelObj = pDocSh->GetModel(); if ( pPage && pModelObj ) { bool bSameDoc = ( rClipParam.getSourceDocID() == rDoc.GetDocumentID() ); @@ -1803,7 +1803,7 @@ void ScViewFunc::PostPasteFromClip(const ScRangeList& rPasteRanges, const ScMark SelectionChanged(true); - ScModelObj* pModelObj = HelperNotifyChanges::getModel(*pDocSh); + ScModelObj* pModelObj = pDocSh->GetModel(); ScRangeList aChangeRanges; for (size_t i = 0, n = rPasteRanges.size(); i < n; ++i) diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx index d42860dad5fc..0b55f4eff0e2 100644 --- a/sc/source/ui/view/viewfun7.cxx +++ b/sc/source/ui/view/viewfun7.cxx @@ -178,7 +178,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, ScDocument& rDocument = GetViewData().GetDocument(); ScDocShell* pDocShell = GetViewData().GetDocShell(); - ScModelObj* pModelObj = ( pDocShell ? comphelper::getFromUnoTunnel<ScModelObj>( pDocShell->GetModel() ) : nullptr ); + ScModelObj* pModelObj = ( pDocShell ? pDocShell->GetModel() : nullptr ); if ( pDestPage && pModelObj && pDrawTrans ) { const ScRangeListVector& rProtectedChartRangesVector( pDrawTrans->GetProtectedChartRangesVector() ); @@ -247,7 +247,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel, ScDocument& rDocument = GetViewData().GetDocument(); ScDocShell* pDocShell = GetViewData().GetDocShell(); - ScModelObj* pModelObj = ( pDocShell ? comphelper::getFromUnoTunnel<ScModelObj>( pDocShell->GetModel() ) : nullptr ); + ScModelObj* pModelObj = ( pDocShell ? pDocShell->GetModel() : nullptr ); const ScDrawTransferObj* pTransferObj = ScDrawTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(GetViewData().GetActiveWin())); if ( pPage && pModelObj && ( pTransferObj || pDrawTrans ) ) { diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 6e15f9b3e0f8..4924e0c8c64f 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -340,7 +340,7 @@ namespace HelperNotifyChanges static void NotifyIfChangesListeners(const ScDocShell &rDocShell, ScMarkData& rMark, SCCOL nCol, SCROW nRow, const OUString& rType = "cell-change") { - ScModelObj* pModelObj = getModel(rDocShell); + ScModelObj* pModelObj = rDocShell.GetModel(); ScRangeList aChangeRanges; for (const auto& rTab : rMark) @@ -1347,7 +1347,7 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor CellContentChanged(); } - ScModelObj* pModelObj = HelperNotifyChanges::getModel(*pDocSh); + ScModelObj* pModelObj = pDocSh->GetModel(); if (HelperNotifyChanges::getMustPropagateChangesModel(pModelObj)) { @@ -2108,7 +2108,7 @@ void ScViewFunc::DeleteContents( InsertDeleteFlags nFlags ) pDocSh->UpdateOle(GetViewData()); - if (ScModelObj* pModelObj = HelperNotifyChanges::getModel(*pDocSh)) + if (ScModelObj* pModelObj = pDocSh->GetModel()) { ScRangeList aChangeRanges; if ( bSimple ) @@ -2443,7 +2443,7 @@ void ScViewFunc::SetWidthOrHeight( if ( !bWidth ) return; - ScModelObj* pModelObj = HelperNotifyChanges::getModel(*pDocSh); + ScModelObj* pModelObj = pDocSh->GetModel(); if (!HelperNotifyChanges::getMustPropagateChangesModel(pModelObj)) return; |