summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2015-05-16 11:12:48 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-06-29 07:25:22 +0000
commite57314f61f67b093510c5a8a8f34a62126ba8734 (patch)
tree7991c3a6f20c93b752628528196022474c6b4a7f /sc/source/ui/unoobj
parent371200675c2fb2fef0ac8362ebd7bf4203835440 (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 'sc/source/ui/unoobj')
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx66
1 files changed, 20 insertions, 46 deletions
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 94c29dcc50dd..b5ec70bdba6a 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -410,32 +410,19 @@ void SAL_CALL ScCellFieldsObj::refresh( )
if (mpRefreshListeners)
{
// Call all listeners.
- uno::Sequence< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElements());
- sal_uInt32 nLength(aListeners.getLength());
- if (nLength)
+ std::vector< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElementsAsVector());
+ if (!aListeners.empty())
{
- const uno::Reference< uno::XInterface >* pInterfaces = aListeners.getConstArray();
- if (pInterfaces)
+ lang::EventObject aEvent;
+ aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
+ for (auto & x : aListeners)
{
- lang::EventObject aEvent;
- aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
- sal_uInt32 i(0);
- while (i < nLength)
+ try
+ {
+ static_cast< util::XRefreshListener* >(x.get())->refreshed(aEvent);
+ }
+ catch(uno::RuntimeException&)
{
- try
- {
- while(i < nLength)
- {
- static_cast< util::XRefreshListener* >(pInterfaces->get())->refreshed(aEvent);
- ++pInterfaces;
- ++i;
- }
- }
- catch(uno::RuntimeException&)
- {
- ++pInterfaces;
- ++i;
- }
}
}
}
@@ -590,32 +577,19 @@ void SAL_CALL ScHeaderFieldsObj::refresh( )
if (mpRefreshListeners)
{
// Call all listeners.
- uno::Sequence< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElements());
- sal_uInt32 nLength(aListeners.getLength());
- if (nLength)
+ std::vector< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElementsAsVector());
+ if (!aListeners.empty())
{
- const uno::Reference< uno::XInterface >* pInterfaces = aListeners.getConstArray();
- if (pInterfaces)
+ lang::EventObject aEvent;
+ aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
+ for (auto & x : aListeners)
{
- lang::EventObject aEvent;
- aEvent.Source.set(uno::Reference< util::XRefreshable >(this));
- sal_uInt32 i(0);
- while (i < nLength)
+ try
+ {
+ static_cast< util::XRefreshListener* >(x.get())->refreshed(aEvent);
+ }
+ catch(uno::RuntimeException&)
{
- try
- {
- while(i < nLength)
- {
- static_cast< util::XRefreshListener* >(pInterfaces->get())->refreshed(aEvent);
- ++pInterfaces;
- ++i;
- }
- }
- catch(uno::RuntimeException&)
- {
- ++pInterfaces;
- ++i;
- }
}
}
}