diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-05-16 11:12:48 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-06-29 07:25:22 +0000 |
commit | e57314f61f67b093510c5a8a8f34a62126ba8734 (patch) | |
tree | 7991c3a6f20c93b752628528196022474c6b4a7f /toolkit | |
parent | 371200675c2fb2fef0ac8362ebd7bf4203835440 (diff) |
return and use std::vector from OInterfaceContainerHelper
since most of the time we don’t need a heavyweight uno::Sequence.
Adds a new method getElementsAsVector().
Change-Id: I9e72bef0c0c723ffd0dd7d4152db5baec6784a7a
Reviewed-on: https://gerrit.libreoffice.org/15747
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 24 | ||||
-rw-r--r-- | toolkit/source/controls/controlmodelcontainerbase.cxx | 10 |
2 files changed, 16 insertions, 18 deletions
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index cf141577038e..ce25b2bba160 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -1757,13 +1757,13 @@ void VCLXToolkit::callTopWindowListeners( = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); if (pWindow->IsTopWindow()) { - css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > - aListeners(m_aTopWindowListeners.getElements()); - if (aListeners.hasElements()) + std::vector< css::uno::Reference< css::uno::XInterface > > + aListeners(m_aTopWindowListeners.getElementsAsVector()); + if (!aListeners.empty()) { css::lang::EventObject aAwtEvent( static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer())); - for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i) + for (::sal_Int32 i = 0; i < (sal_Int32)aListeners.size(); ++i) { css::uno::Reference< css::awt::XTopWindowListener > xListener(aListeners[i], css::uno::UNO_QUERY); @@ -1786,10 +1786,10 @@ void VCLXToolkit::callTopWindowListeners( long VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent, bool bPressed) { - css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > - aHandlers(m_aKeyHandlers.getElements()); + std::vector< css::uno::Reference< css::uno::XInterface > > + aHandlers(m_aKeyHandlers.getElementsAsVector()); - if (aHandlers.hasElements()) + if (!aHandlers.empty()) { vcl::Window * pWindow = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); @@ -1809,7 +1809,7 @@ long VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent, pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(), sal::static_int_cast< sal_Int16 >( pKeyEvent->GetKeyCode().GetFunction())); - for (::sal_Int32 i = 0; i < aHandlers.getLength(); ++i) + for (::sal_Int32 i = 0; i < (sal_Int32)aHandlers.size(); ++i) { css::uno::Reference< css::awt::XKeyHandler > xHandler( aHandlers[i], css::uno::UNO_QUERY); @@ -1838,9 +1838,9 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent, = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); if (pWindow->IsTopWindow()) { - css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > - aListeners(m_aFocusListeners.getElements()); - if (aListeners.hasElements()) + std::vector< css::uno::Reference< css::uno::XInterface > > + aListeners(m_aFocusListeners.getElementsAsVector()); + if (!aListeners.empty()) { // Ignore the interior of compound controls when determining the // window that gets the focus next (see implementation in @@ -1859,7 +1859,7 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent, static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()), static_cast<sal_Int16>(pWindow->GetGetFocusFlags()), xNext, false); - for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i) + for (size_t i = 0; i < aListeners.size(); ++i) { css::uno::Reference< css::awt::XFocusListener > xListener( aListeners[i], css::uno::UNO_QUERY); diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index a7eff04a42e5..b064aff4c295 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -916,13 +916,11 @@ void ControlModelContainerBase::implNotifyTabModelChange( const OUString& _rAcce aEvent.Changes[ 0 ].Accessor <<= _rAccessor; - Sequence< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() ); - const Reference< XInterface >* pListener = aChangeListeners.getConstArray(); - const Reference< XInterface >* pListenerEnd = aChangeListeners.getConstArray() + aChangeListeners.getLength(); - for ( ; pListener != pListenerEnd; ++pListener ) + std::vector< Reference< XInterface > > aChangeListeners( maChangeListeners.getElementsAsVector() ); + for ( Reference< XInterface > & rListener : aChangeListeners ) { - if ( pListener->is() ) - static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent ); + if ( rListener.is() ) + static_cast< XChangesListener* >( rListener.get() )->changesOccurred( aEvent ); } } |