summaryrefslogtreecommitdiff
path: root/toolkit/source/awt
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-11-28 19:10:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-11-28 20:25:20 +0100
commit6762aff78bd346ebf816ead77e73b6fa9d8ea7d8 (patch)
tree80edf863841ca5617fae70d9c3a7fbf421df2adc /toolkit/source/awt
parentcf6823ea07047ad7681262e94721f88e768f5845 (diff)
use more OInterfaceContainerHelper3 in toolkit
Change-Id: If91b208db7fa59bc626293c0a868ac490a8d2d70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125983 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'toolkit/source/awt')
-rw-r--r--toolkit/source/awt/stylesettings.hxx4
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx25
-rw-r--r--toolkit/source/awt/vclxwindow.cxx21
3 files changed, 23 insertions, 27 deletions
diff --git a/toolkit/source/awt/stylesettings.hxx b/toolkit/source/awt/stylesettings.hxx
index ebd9bd2c6ee3..477a1f093be0 100644
--- a/toolkit/source/awt/stylesettings.hxx
+++ b/toolkit/source/awt/stylesettings.hxx
@@ -22,7 +22,7 @@
#include <com/sun/star/awt/XStyleSettings.hpp>
-#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <cppuhelper/implbase.hxx>
#include <tools/link.hxx>
@@ -171,7 +171,7 @@ namespace toolkit
DECL_LINK( OnWindowEvent, VclWindowEvent&, void );
VCLXWindow* pOwningWindow;
- ::comphelper::OInterfaceContainerHelper2 aStyleChangeListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::awt::XStyleChangeListener> aStyleChangeListeners;
};
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 6c21a5b474f1..351166d713e3 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -132,6 +132,7 @@
#include <awt/vclxspinbutton.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
+#include <comphelper/interfacecontainer3.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/profilezone.hxx>
@@ -444,9 +445,9 @@ class VCLXToolkit : public VCLXToolkitMutexHelper,
oslModule hSvToolsLib;
FN_SvtCreateWindow fnSvtCreateWindow;
- ::comphelper::OInterfaceContainerHelper2 m_aTopWindowListeners;
- ::comphelper::OInterfaceContainerHelper2 m_aKeyHandlers;
- ::comphelper::OInterfaceContainerHelper2 m_aFocusListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::awt::XTopWindowListener> m_aTopWindowListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::awt::XKeyHandler> m_aKeyHandlers;
+ ::comphelper::OInterfaceContainerHelper3<css::awt::XFocusListener> m_aFocusListeners;
::Link<VclSimpleEvent&,void> m_aEventListenerLink;
::Link<VclWindowEvent&,bool> m_aKeyListenerLink;
bool m_bEventListener;
@@ -2416,17 +2417,15 @@ void VCLXToolkit::callTopWindowListeners(
if (!pWindow->IsTopWindow())
return;
- std::vector< css::uno::Reference< css::uno::XInterface > >
+ std::vector< css::uno::Reference< css::awt::XTopWindowListener > >
aListeners(m_aTopWindowListeners.getElements());
if (aListeners.empty())
return;
css::lang::EventObject aAwtEvent(
static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()));
- for (const css::uno::Reference<XInterface> & i : aListeners)
+ for (const css::uno::Reference<css::awt::XTopWindowListener> & xListener : aListeners)
{
- css::uno::Reference< css::awt::XTopWindowListener >
- xListener(i, css::uno::UNO_QUERY);
try
{
(xListener.get()->*pFn)(aAwtEvent);
@@ -2441,7 +2440,7 @@ void VCLXToolkit::callTopWindowListeners(
bool VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent,
bool bPressed)
{
- std::vector< css::uno::Reference< css::uno::XInterface > >
+ std::vector< css::uno::Reference< css::awt::XKeyHandler > >
aHandlers(m_aKeyHandlers.getElements());
if (!aHandlers.empty())
@@ -2464,10 +2463,8 @@ bool VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent,
pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(),
sal::static_int_cast< sal_Int16 >(
pKeyEvent->GetKeyCode().GetFunction()));
- for (const css::uno::Reference<XInterface> & i : aHandlers)
+ for (const css::uno::Reference<css::awt::XKeyHandler> & xHandler : aHandlers)
{
- css::uno::Reference< css::awt::XKeyHandler > xHandler(
- i, css::uno::UNO_QUERY);
try
{
if (bPressed ? xHandler->keyPressed(aAwtEvent)
@@ -2491,7 +2488,7 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
if (!pWindow->IsTopWindow())
return;
- std::vector< css::uno::Reference< css::uno::XInterface > >
+ std::vector< css::uno::Reference< css::awt::XFocusListener > >
aListeners(m_aFocusListeners.getElements());
if (aListeners.empty())
return;
@@ -2513,10 +2510,8 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent,
static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()),
static_cast<sal_Int16>(pWindow->GetGetFocusFlags()),
xNext, false);
- for (const css::uno::Reference<XInterface> & i : aListeners)
+ for (const css::uno::Reference<css::awt::XFocusListener> & xListener : aListeners)
{
- css::uno::Reference< css::awt::XFocusListener > xListener(
- i, css::uno::UNO_QUERY);
try
{
bGained ? xListener->focusGained(aAwtEvent)
diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx
index b6cb0c90ecb5..6a07668e436b 100644
--- a/toolkit/source/awt/vclxwindow.cxx
+++ b/toolkit/source/awt/vclxwindow.cxx
@@ -55,6 +55,7 @@
#include <vcl/commandevent.hxx>
#include <comphelper/flagguard.hxx>
#include <comphelper/interfacecontainer2.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <comphelper/profilezone.hxx>
#include "stylesettings.hxx"
#include <tools/urlobj.hxx>
@@ -96,8 +97,8 @@ private:
bool mbDirectVisible;
::osl::Mutex maListenerContainerMutex;
- ::comphelper::OInterfaceContainerHelper2 maWindow2Listeners;
- ::comphelper::OInterfaceContainerHelper2 maDockableWindowListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::awt::XWindowListener2> maWindow2Listeners;
+ ::comphelper::OInterfaceContainerHelper3<XDockableWindowListener> maDockableWindowListeners;
EventListenerMultiplexer maEventListeners;
FocusListenerMultiplexer maFocusListeners;
WindowListenerMultiplexer maWindowListeners;
@@ -171,8 +172,8 @@ public:
/** returns the container of registered XWindowListener2 listeners
*/
- ::comphelper::OInterfaceContainerHelper2& getWindow2Listeners() { return maWindow2Listeners; }
- ::comphelper::OInterfaceContainerHelper2& getDockableWindowListeners(){ return maDockableWindowListeners; }
+ ::comphelper::OInterfaceContainerHelper3<css::awt::XWindowListener2>& getWindow2Listeners() { return maWindow2Listeners; }
+ ::comphelper::OInterfaceContainerHelper3<XDockableWindowListener>& getDockableWindowListeners() { return maDockableWindowListeners; }
EventListenerMultiplexer& getEventListeners() { return maEventListeners; }
FocusListenerMultiplexer& getFocusListeners() { return maFocusListeners; }
WindowListenerMultiplexer& getWindowListeners() { return maWindowListeners; }
@@ -404,7 +405,7 @@ namespace
{
struct CallWindow2Listener
{
- CallWindow2Listener( ::comphelper::OInterfaceContainerHelper2& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent )
+ CallWindow2Listener( ::comphelper::OInterfaceContainerHelper3<css::awt::XWindowListener2>& i_rWindow2Listeners, const bool i_bEnabled, const EventObject& i_rEvent )
:m_rWindow2Listeners( i_rWindow2Listeners )
,m_bEnabled( i_bEnabled )
,m_aEvent( i_rEvent )
@@ -416,7 +417,7 @@ namespace
m_rWindow2Listeners.notifyEach( m_bEnabled ? &XWindowListener2::windowEnabled : &XWindowListener2::windowDisabled, m_aEvent );
}
- ::comphelper::OInterfaceContainerHelper2& m_rWindow2Listeners;
+ ::comphelper::OInterfaceContainerHelper3<css::awt::XWindowListener2>& m_rWindow2Listeners;
const bool m_bEnabled;
const EventObject m_aEvent;
};
@@ -784,10 +785,10 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
aEvent.bInteractive = true;
Reference< XDockableWindowListener > xFirstListener;
- ::comphelper::OInterfaceIteratorHelper2 aIter( mpImpl->getDockableWindowListeners() );
+ ::comphelper::OInterfaceIteratorHelper3 aIter( mpImpl->getDockableWindowListeners() );
while ( aIter.hasMoreElements() && !xFirstListener.is() )
{
- xFirstListener.set( aIter.next(), UNO_QUERY );
+ xFirstListener = aIter.next();
}
css::awt::DockingData aDockingData =
@@ -826,10 +827,10 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
aEvent.Source = static_cast<cppu::OWeakObject*>(this);
Reference< XDockableWindowListener > xFirstListener;
- ::comphelper::OInterfaceIteratorHelper2 aIter( mpImpl->getDockableWindowListeners() );
+ ::comphelper::OInterfaceIteratorHelper3 aIter( mpImpl->getDockableWindowListeners() );
while ( aIter.hasMoreElements() && !xFirstListener.is() )
{
- xFirstListener.set( aIter.next(), UNO_QUERY );
+ xFirstListener = aIter.next();
}
*p_bFloating = xFirstListener->prepareToggleFloatingMode( aEvent );