summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-12-01 20:28:29 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-03 08:40:02 +0100
commit95266ea93458644c89f1ac7bf924c5323ed64544 (patch)
treea29e4ccfb97b67cf5f6ca8eb3091a9a0ecddf6b7 /framework
parentcd888e4c04d209a8d436906369c13d6206c176f4 (diff)
use OMultiTypeInterfaceContainerHelperVar3 in framework
Change-Id: Ia2f59322511ed85492708262f90de26b33275105 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126197 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/stdtypes.h9
-rw-r--r--framework/source/services/autorecovery.cxx9
-rw-r--r--framework/source/services/frame.cxx23
3 files changed, 14 insertions, 27 deletions
diff --git a/framework/inc/stdtypes.h b/framework/inc/stdtypes.h
index feec3ef92ceb..0ccc056cf605 100644
--- a/framework/inc/stdtypes.h
+++ b/framework/inc/stdtypes.h
@@ -21,7 +21,6 @@
#include <com/sun/star/awt/KeyEvent.hpp>
-#include <comphelper/multiinterfacecontainer2.hxx>
#include <rtl/ustring.hxx>
namespace framework{
@@ -55,14 +54,6 @@ struct KeyEventEqualsFunc
}
};
-/**
- It can be used to map names (e.g. of properties) to her corresponding handles.
- Our helper class OPropertySetHelper works optimized with handles but sometimes we have only a property name.
- Mapping between these two parts of a property should be done in the fastest way :-)
-*/
-
-typedef comphelper::OMultiTypeInterfaceContainerHelperVar2<OUString> ListenerHash;
-
} // namespace framework
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index ebcae2a0862b..724d09204f68 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -75,6 +75,7 @@
#include <o3tl/safeint.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <unotools/mediadescriptor.hxx>
+#include <comphelper/multiinterfacecontainer3.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <comphelper/sequence.hxx>
#include <vcl/evntpost.hxx>
@@ -419,7 +420,7 @@ private:
/** @short contains all status listener registered at this instance.
*/
- ListenerHash m_lListener;
+ comphelper::OMultiTypeInterfaceContainerHelperVar3<css::frame::XStatusListener, OUString> m_lListener;
/** @descr This member is used to prevent us against re-entrance problems.
A mutex can't help to prevent us from concurrent using of members
@@ -3477,7 +3478,7 @@ void AutoRecovery::implts_informListener( Job eJob ,
const css::frame::FeatureStateEvent& aEvent)
{
// Helper shares mutex with us -> threadsafe!
- ::comphelper::OInterfaceContainerHelper2* pListenerForURL = nullptr;
+ ::comphelper::OInterfaceContainerHelper3<css::frame::XStatusListener>* pListenerForURL = nullptr;
OUString sJob = AutoRecovery::implst_getJobDescription(eJob);
// inform listener, which are registered for any URLs(!)
@@ -3485,12 +3486,12 @@ void AutoRecovery::implts_informListener( Job eJob ,
if(pListenerForURL == nullptr)
return;
- ::comphelper::OInterfaceIteratorHelper2 pIt(*pListenerForURL);
+ ::comphelper::OInterfaceIteratorHelper3 pIt(*pListenerForURL);
while(pIt.hasMoreElements())
{
try
{
- static_cast<css::frame::XStatusListener*>(pIt.next())->statusChanged(aEvent);
+ pIt.next()->statusChanged(aEvent);
}
catch(const css::uno::RuntimeException&)
{
diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx
index 991a7b58131b..fde9da72234a 100644
--- a/framework/source/services/frame.cxx
+++ b/framework/source/services/frame.cxx
@@ -68,6 +68,7 @@
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/compbase.hxx>
+#include <comphelper/multiinterfacecontainer3.hxx>
#include <comphelper/multicontainer2.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weak.hxx>
@@ -418,8 +419,8 @@ private:
typedef std::unordered_map<OUString, css::beans::Property> TPropInfoHash;
TPropInfoHash m_lProps;
- ListenerHash m_lSimpleChangeListener;
- ListenerHash m_lVetoChangeListener;
+ comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XPropertyChangeListener, OUString> m_lSimpleChangeListener;
+ comphelper::OMultiTypeInterfaceContainerHelperVar3<css::beans::XVetoableChangeListener, OUString> m_lVetoChangeListener;
// hold it weak ... otherwise this helper has to be "killed" explicitly .-)
css::uno::WeakReference< css::uno::XInterface > m_xBroadcaster;
@@ -2860,19 +2861,16 @@ bool XFrameImpl::impl_existsVeto(const css::beans::PropertyChangeEvent& aEvent)
The used helper is threadsafe and it lives for the whole lifetime of
our own object.
*/
- ::comphelper::OInterfaceContainerHelper2* pVetoListener = m_lVetoChangeListener.getContainer(aEvent.PropertyName);
+ ::comphelper::OInterfaceContainerHelper3<css::beans::XVetoableChangeListener>* pVetoListener = m_lVetoChangeListener.getContainer(aEvent.PropertyName);
if (! pVetoListener)
return false;
- ::comphelper::OInterfaceIteratorHelper2 pListener(*pVetoListener);
+ ::comphelper::OInterfaceIteratorHelper3 pListener(*pVetoListener);
while (pListener.hasMoreElements())
{
try
{
- css::uno::Reference< css::beans::XVetoableChangeListener > xListener(
- static_cast<css::beans::XVetoableChangeListener*>(pListener.next()),
- css::uno::UNO_QUERY_THROW);
- xListener->vetoableChange(aEvent);
+ pListener.next()->vetoableChange(aEvent);
}
catch(const css::uno::RuntimeException&)
{ pListener.remove(); }
@@ -2889,19 +2887,16 @@ void XFrameImpl::impl_notifyChangeListener(const css::beans::PropertyChangeEvent
The used helper is threadsafe and it lives for the whole lifetime of
our own object.
*/
- ::comphelper::OInterfaceContainerHelper2* pSimpleListener = m_lSimpleChangeListener.getContainer(aEvent.PropertyName);
+ ::comphelper::OInterfaceContainerHelper3<css::beans::XPropertyChangeListener>* pSimpleListener = m_lSimpleChangeListener.getContainer(aEvent.PropertyName);
if (! pSimpleListener)
return;
- ::comphelper::OInterfaceIteratorHelper2 pListener(*pSimpleListener);
+ ::comphelper::OInterfaceIteratorHelper3 pListener(*pSimpleListener);
while (pListener.hasMoreElements())
{
try
{
- css::uno::Reference< css::beans::XPropertyChangeListener > xListener(
- static_cast<css::beans::XVetoableChangeListener*>(pListener.next()),
- css::uno::UNO_QUERY_THROW);
- xListener->propertyChange(aEvent);
+ pListener.next()->propertyChange(aEvent);
}
catch(const css::uno::RuntimeException&)
{ pListener.remove(); }