diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-12-20 19:05:30 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-12-21 06:43:15 +0000 |
commit | f9785ea595fd8e911f6370e836fa579225b9e571 (patch) | |
tree | 238807969e974f203ec900ced18f5b64aa401d9d /forms | |
parent | bc661b966fd82808a94e8684d62007c3f254d778 (diff) |
loplugin:unocast (frm::OInterfaceContainer)
(See the upcoming commit introducing that loplugin:unocast on why such
dynamic_casts from UNO types are dangerous.)
Change-Id: Ie8f6fbe25dfffc082033a4bc967d738143746506
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144635
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/inc/InterfaceContainer.hxx | 9 | ||||
-rw-r--r-- | forms/source/misc/InterfaceContainer.cxx | 13 |
2 files changed, 19 insertions, 3 deletions
diff --git a/forms/source/inc/InterfaceContainer.hxx b/forms/source/inc/InterfaceContainer.hxx index 66135a02e48e..b42229ddc16c 100644 --- a/forms/source/inc/InterfaceContainer.hxx +++ b/forms/source/inc/InterfaceContainer.hxx @@ -22,6 +22,7 @@ #include <comphelper/uno3.hxx> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/io/XPersistObject.hpp> #include <com/sun/star/beans/XPropertyChangeListener.hpp> @@ -37,7 +38,7 @@ #include <comphelper/interfacecontainer3.hxx> #include <cppuhelper/component.hxx> #include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase8.hxx> +#include <cppuhelper/implbase9.hxx> #include <unordered_map> namespace com::sun::star::uno { class XComponentContext; } @@ -72,7 +73,7 @@ typedef std::unordered_multimap< OUString, css::uno::Reference<css::uno::XInterf // OInterfaceContainer // implements a container for form components -typedef ::cppu::ImplHelper8 < css::container::XNameContainer +typedef ::cppu::ImplHelper9 < css::container::XNameContainer , css::container::XIndexContainer , css::container::XContainer , css::container::XEnumerationAccess @@ -80,6 +81,7 @@ typedef ::cppu::ImplHelper8 < css::container::XNameContainer , css::beans::XPropertyChangeListener , css::io::XPersistObject , css::util::XCloneable + , css::lang::XUnoTunnel > OInterfaceContainer_BASE; class OInterfaceContainer : public OInterfaceContainer_BASE @@ -173,6 +175,9 @@ public: virtual void SAL_CALL addScriptListener( const css::uno::Reference< css::script::XScriptListener >& xListener ) override; virtual void SAL_CALL removeScriptListener( const css::uno::Reference< css::script::XScriptListener >& Listener ) override; + sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override; + static css::uno::Sequence<sal_Int8> const & getUnoTunnelId(); + protected: // helper virtual void SAL_CALL disposing(); diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index f7278117899c..e7d7b43672c2 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -41,6 +41,7 @@ #include <comphelper/eventattachermgr.hxx> #include <comphelper/property.hxx> #include <comphelper/sequence.hxx> +#include <comphelper/servicehelper.hxx> #include <comphelper/types.hxx> #include <cppuhelper/exc_hlp.hxx> #include <o3tl/safeint.hxx> @@ -834,7 +835,7 @@ void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XProper if ( bHandleVbaEvents ) { Reference< XEventAttacherManager > xMgr ( pElementMetaData->xInterface, UNO_QUERY ); - OInterfaceContainer* pIfcMgr = xMgr.is() ? dynamic_cast<OInterfaceContainer*>(xMgr.get()) : nullptr; + OInterfaceContainer* pIfcMgr = xMgr.is() ? comphelper::getFromUnoTunnel<OInterfaceContainer>(xMgr) : nullptr; if (pIfcMgr) { sal_Int32 nLen = pIfcMgr->getCount(); @@ -1236,6 +1237,16 @@ void SAL_CALL OInterfaceContainer::removeScriptListener( const Reference< XScrip } +sal_Int64 OInterfaceContainer::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) { + return comphelper::getSomethingImpl(aIdentifier, this); +} + +css::uno::Sequence<sal_Int8> const & OInterfaceContainer::getUnoTunnelId() { + static comphelper::UnoIdInit const id; + return id.getSeq(); +} + + //= OFormComponents |