vbahelper/source/vbahelper/vbashaperange.cxx | 8 +++++--- vbahelper/source/vbahelper/vbashapes.cxx | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-)
New commits: commit cc772833a1166151bac2911037659582df655bcf Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Nov 7 14:42:15 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Nov 8 08:17:55 2023 +0100 loplugin:fieldcast in VbShapeRangeEnumHelper Change-Id: I18e24a4c0b86a6f9a456c0e962f87d74a4edf709 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159093 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vbahelper/source/vbahelper/vbashaperange.cxx b/vbahelper/source/vbahelper/vbashaperange.cxx index 4dd837259bf7..73af31d69145 100644 --- a/vbahelper/source/vbahelper/vbashaperange.cxx +++ b/vbahelper/source/vbahelper/vbashaperange.cxx @@ -26,6 +26,8 @@ #include <utility> #include <vbahelper/vbashaperange.hxx> #include <vbahelper/vbashape.hxx> +#include <rtl/ref.hxx> + using namespace ::ooo::vba; using namespace ::com::sun::star; @@ -33,18 +35,18 @@ namespace { class VbShapeRangeEnumHelper : public EnumerationHelper_BASE { - uno::Reference< XCollection > m_xParent; + rtl::Reference< ScVbaShapeRange > m_xParent; uno::Reference<container::XIndexAccess > m_xIndexAccess; sal_Int32 nIndex; public: - VbShapeRangeEnumHelper( uno::Reference< XCollection > xParent, uno::Reference< container::XIndexAccess > xIndexAccess ) : m_xParent(std::move( xParent )), m_xIndexAccess(std::move( xIndexAccess )), nIndex( 0 ) {} + VbShapeRangeEnumHelper( rtl::Reference< ScVbaShapeRange > xParent, uno::Reference< container::XIndexAccess > xIndexAccess ) : m_xParent(std::move( xParent )), m_xIndexAccess(std::move( xIndexAccess )), nIndex( 0 ) {} virtual sal_Bool SAL_CALL hasMoreElements( ) override { return ( nIndex < m_xIndexAccess->getCount() ); } virtual uno::Any SAL_CALL nextElement( ) override { - ScVbaShapeRange* pCollectionImpl = dynamic_cast< ScVbaShapeRange* >(m_xParent.get()); + ScVbaShapeRange* pCollectionImpl = m_xParent.get(); if ( pCollectionImpl && hasMoreElements() ) return pCollectionImpl->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); throw container::NoSuchElementException(); commit d31bb122bc5d7ca75a02d659bcf9dee3d429a165 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Nov 7 14:41:18 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Nov 8 08:17:48 2023 +0100 loplugin:fieldcast in VbShapeEnumHelper Change-Id: Iece221df3b650078a1796d407459bbd96ad058e8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159092 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx index 02630a75c520..e96cda4ac926 100644 --- a/vbahelper/source/vbahelper/vbashapes.cxx +++ b/vbahelper/source/vbahelper/vbashapes.cxx @@ -52,18 +52,18 @@ namespace { class VbShapeEnumHelper : public EnumerationHelper_BASE { - uno::Reference<msforms::XShapes > m_xParent; + rtl::Reference<ScVbaShapes> m_xParent; uno::Reference<container::XIndexAccess > m_xIndexAccess; sal_Int32 nIndex; public: - VbShapeEnumHelper( uno::Reference< msforms::XShapes > xParent, uno::Reference< container::XIndexAccess > xIndexAccess ) : m_xParent(std::move( xParent )), m_xIndexAccess(std::move( xIndexAccess )), nIndex( 0 ) {} + VbShapeEnumHelper( rtl::Reference< ScVbaShapes > xParent, uno::Reference< container::XIndexAccess > xIndexAccess ) : m_xParent(std::move( xParent )), m_xIndexAccess(std::move( xIndexAccess )), nIndex( 0 ) {} virtual sal_Bool SAL_CALL hasMoreElements( ) override { return ( nIndex < m_xIndexAccess->getCount() ); } virtual uno::Any SAL_CALL nextElement( ) override { - ScVbaShapes* pShapes = dynamic_cast< ScVbaShapes* >(m_xParent.get()); + ScVbaShapes* pShapes = m_xParent.get(); if ( pShapes && hasMoreElements() ) return pShapes->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); throw container::NoSuchElementException();