diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-20 18:56:34 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-21 06:42:22 +0000 |
commit | 27b35b2c215b4832d4378ec3a7ecbba926552d06 (patch) | |
tree | 64fbf48416f078c8e2e4a5e1dd82b26649d6dc9c /vbahelper | |
parent | 2e8776c181d0e38a8d25481ac0eb33389940bf95 (diff) |
loplugin:unocast (ScVbaShapeRange)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)
Change-Id: I4a66df07f2e768ee3203b730b50be4b9ec6a01a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144634
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbashaperange.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/vbahelper/source/vbahelper/vbashaperange.cxx b/vbahelper/source/vbahelper/vbashaperange.cxx index 4dd837259bf7..53d9d4268401 100644 --- a/vbahelper/source/vbahelper/vbashaperange.cxx +++ b/vbahelper/source/vbahelper/vbashaperange.cxx @@ -24,6 +24,7 @@ #include <ooo/vba/office/MsoShapeType.hpp> #include <utility> +#include <comphelper/servicehelper.hxx> #include <vbahelper/vbashaperange.hxx> #include <vbahelper/vbashape.hxx> using namespace ::ooo::vba; @@ -44,7 +45,7 @@ public: } virtual uno::Any SAL_CALL nextElement( ) override { - ScVbaShapeRange* pCollectionImpl = dynamic_cast< ScVbaShapeRange* >(m_xParent.get()); + ScVbaShapeRange* pCollectionImpl = comphelper::getFromUnoTunnel< ScVbaShapeRange >(m_xParent); if ( pCollectionImpl && hasMoreElements() ) return pCollectionImpl->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); throw container::NoSuchElementException(); @@ -391,6 +392,15 @@ ScVbaShapeRange::createEnumeration() return new VbShapeRangeEnumHelper( this, m_xIndexAccess ); } +sal_Int64 ScVbaShapeRange::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) { + return comphelper::getSomethingImpl(aIdentifier, this); +} + +css::uno::Sequence<sal_Int8> const & ScVbaShapeRange::getUnoTunnelId() { + static comphelper::UnoIdInit const id; + return id.getSeq(); +} + uno::Any ScVbaShapeRange:: createCollectionObject( const css::uno::Any& aSource ) { |