From 7c66fc45239d2589e90fd694d54b3ff826b1bd15 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 1 Jun 2023 14:22:57 +0200 Subject: use internal iterator for SfxBroadcaster So we can avoid exposing the internal listener vector. (which allows further optimisations) Change-Id: If288141a37314dcc01d203029dc51c71ec2b7f54 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152857 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/source/core/data/stlsheet.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'sc') diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx index 062be0a05280..7679f1936a6b 100644 --- a/sc/source/core/data/stlsheet.cxx +++ b/sc/source/core/data/stlsheet.cxx @@ -297,18 +297,18 @@ bool ScStyleSheet::IsUsed() const } case SfxStyleFamily::Frame: { - const size_t nListenerCount = GetSizeOfVector(); - for (size_t n = 0; n < nListenerCount; ++n) - { - auto pUser(dynamic_cast(GetListener(n))); - if (pUser && pUser->isUsedByModel()) + ForAllListeners([this] (SfxListener* pListener) { - eUsage = Usage::USED; - break; - } - else - eUsage = Usage::NOTUSED; - } + auto pUser(dynamic_cast(pListener)); + if (pUser && pUser->isUsedByModel()) + { + eUsage = Usage::USED; + return true; // break loop + } + else + eUsage = Usage::NOTUSED; + return false; + }); return eUsage == Usage::USED; } default: -- cgit