sc/source/ui/vba/vbawindow.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
New commits: commit a984289075a46b600052269d7aa5682e8906ce10 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Nov 8 12:23:04 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Nov 9 06:23:45 2023 +0100 loplugin:fieldcast in SelectedSheetsEnumAccess Change-Id: Ie7b61eee10259358a86b46f2cb5e90fad9a2100e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159178 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index 9bc913dcc2b2..bd0ebd463500 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -100,13 +100,14 @@ class SelectedSheetsEnumAccess : public SelectedSheets_BASE uno::Reference< uno::XComponentContext > m_xContext; NameIndexHash namesToIndices; Sheets sheets; - uno::Reference< frame::XModel > m_xModel; + rtl::Reference< ScModelObj > m_xModel; public: - SelectedSheetsEnumAccess( uno::Reference< uno::XComponentContext > xContext, uno::Reference< frame::XModel > xModel ):m_xContext(std::move( xContext )), m_xModel(std::move( xModel )) + SelectedSheetsEnumAccess( uno::Reference< uno::XComponentContext > xContext, const uno::Reference< frame::XModel > & xModel ):m_xContext(std::move( xContext )) { - ScModelObj* pModel = static_cast< ScModelObj* >( m_xModel.get() ); + ScModelObj* pModel = static_cast< ScModelObj* >( xModel.get() ); if ( !pModel ) throw uno::RuntimeException("Cannot obtain current document" ); + m_xModel = pModel; ScDocShell* pDocShell = static_cast<ScDocShell*>(pModel->GetEmbeddedObject()); if ( !pDocShell ) throw uno::RuntimeException("Cannot obtain docshell" ); @@ -118,8 +119,7 @@ public: SCTAB nIndex = 0; const ScMarkData& rMarkData = pViewShell->GetViewData().GetMarkData(); sheets.reserve( nTabCount ); - uno::Reference <sheet::XSpreadsheetDocument> xSpreadSheet( m_xModel, uno::UNO_QUERY_THROW ); - uno::Reference <container::XIndexAccess> xIndex( xSpreadSheet->getSheets(), uno::UNO_QUERY_THROW ); + uno::Reference <container::XIndexAccess> xIndex( m_xModel->getSheets(), uno::UNO_QUERY_THROW ); for (const auto& rTab : rMarkData) { if (rTab >= nTabCount)