diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-20 18:50:07 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-21 06:42:34 +0000 |
commit | 5e5f40a4a92a31b0932c690219d002fcf18598cf (patch) | |
tree | 17f4dfe07d07154f9f1bead242bf880e024fc04e /vbahelper | |
parent | 27b35b2c215b4832d4378ec3a7ecbba926552d06 (diff) |
loplugin:unocast (ScVbaShapes)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)
Change-Id: I913565ccd93472f2a8893c4251e80d0309827c34
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144633
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vbahelper')
-rw-r--r-- | vbahelper/source/vbahelper/vbashapes.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx index 02630a75c520..a61fbddfb350 100644 --- a/vbahelper/source/vbahelper/vbashapes.cxx +++ b/vbahelper/source/vbahelper/vbashapes.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/drawing/XShapes.hpp> #include <utility> +#include <comphelper/servicehelper.hxx> #include <vbahelper/vbahelper.hxx> #include <vbahelper/vbashape.hxx> #include <vbahelper/vbashapes.hxx> @@ -63,7 +64,7 @@ public: } virtual uno::Any SAL_CALL nextElement( ) override { - ScVbaShapes* pShapes = dynamic_cast< ScVbaShapes* >(m_xParent.get()); + ScVbaShapes* pShapes = comphelper::getFromUnoTunnel< ScVbaShapes >(m_xParent); if ( pShapes && hasMoreElements() ) return pShapes->createCollectionObject( m_xIndexAccess->getByIndex( nIndex++ ) ); throw container::NoSuchElementException(); @@ -101,6 +102,15 @@ ScVbaShapes::createEnumeration() return new VbShapeEnumHelper( this, m_xIndexAccess ); } +sal_Int64 ScVbaShapes::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) { + return comphelper::getSomethingImpl(aIdentifier, this); +} + +css::uno::Sequence<sal_Int8> const & ScVbaShapes::getUnoTunnelId() { + static comphelper::UnoIdInit const id; + return id.getSeq(); +} + uno::Any ScVbaShapes::createCollectionObject( const css::uno::Any& aSource ) { |