summaryrefslogtreecommitdiff
path: root/unoxml/source/events
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-08-05 20:28:37 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-08-06 09:27:18 +0200
commitfebc581c30fe22eb133d5c1e355fc12fe3c0dc39 (patch)
treeccfce9d0cbb091de22d9ab63475f5d0c5509d70f /unoxml/source/events
parentc2864be448b52cdac0f8712708cb6c988155fdc8 (diff)
loplugin:flatten in unoxml
Change-Id: I7c85b3618450ea6914c3076b0dca67ef4847be51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/100187 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml/source/events')
-rw-r--r--unoxml/source/events/eventdispatcher.cxx83
1 files changed, 42 insertions, 41 deletions
diff --git a/unoxml/source/events/eventdispatcher.cxx b/unoxml/source/events/eventdispatcher.cxx
index ef07dff5ad2d..cc5fb159d3c8 100644
--- a/unoxml/source/events/eventdispatcher.cxx
+++ b/unoxml/source/events/eventdispatcher.cxx
@@ -60,20 +60,21 @@ namespace DOM::events {
// get the multimap for the specified type
auto tIter = pTMap->find(aType);
- if (tIter != pTMap->end()) {
- ListenerMap & rMap = tIter->second;
- // find listeners of specified type for specified node
- ListenerMap::iterator iter = rMap.find(pNode);
- while (iter != rMap.end() && iter->first == pNode)
+ if (tIter == pTMap->end())
+ return;
+
+ ListenerMap & rMap = tIter->second;
+ // find listeners of specified type for specified node
+ ListenerMap::iterator iter = rMap.find(pNode);
+ while (iter != rMap.end() && iter->first == pNode)
+ {
+ // erase all references to specified listener
+ if (iter->second.is() && iter->second == aListener)
{
- // erase all references to specified listener
- if (iter->second.is() && iter->second == aListener)
- {
- iter = rMap.erase(iter);
- }
- else
- ++iter;
+ iter = rMap.erase(iter);
}
+ else
+ ++iter;
}
}
@@ -210,38 +211,38 @@ namespace DOM::events {
// start at the root
NodeVector_t::const_reverse_iterator rinode =
const_cast<NodeVector_t const&>(captureVector).rbegin();
- if (rinode != const_cast<NodeVector_t const&>(captureVector).rend())
+ if (rinode == const_cast<NodeVector_t const&>(captureVector).rend())
+ return;
+
+ // capturing phase:
+ pEvent->m_phase = PhaseType_CAPTURING_PHASE;
+ while (rinode !=
+ const_cast<NodeVector_t const&>(captureVector).rend())
{
- // capturing phase:
- pEvent->m_phase = PhaseType_CAPTURING_PHASE;
- while (rinode !=
- const_cast<NodeVector_t const&>(captureVector).rend())
+ pEvent->m_currentTarget = rinode->first;
+ callListeners(captureListeners, rinode->second, aType, xEvent);
+ if (pEvent->m_canceled) return;
+ ++rinode;
+ }
+
+ NodeVector_t::const_iterator inode = captureVector.begin();
+
+ // target phase
+ pEvent->m_phase = PhaseType_AT_TARGET;
+ pEvent->m_currentTarget = inode->first;
+ callListeners(targetListeners, inode->second, aType, xEvent);
+ if (pEvent->m_canceled) return;
+ // bubbeling phase
+ ++inode;
+ if (i_xEvent->getBubbles()) {
+ pEvent->m_phase = PhaseType_BUBBLING_PHASE;
+ while (inode != captureVector.end())
{
- pEvent->m_currentTarget = rinode->first;
- callListeners(captureListeners, rinode->second, aType, xEvent);
+ pEvent->m_currentTarget = inode->first;
+ callListeners(targetListeners,
+ inode->second, aType, xEvent);
if (pEvent->m_canceled) return;
- ++rinode;
- }
-
- NodeVector_t::const_iterator inode = captureVector.begin();
-
- // target phase
- pEvent->m_phase = PhaseType_AT_TARGET;
- pEvent->m_currentTarget = inode->first;
- callListeners(targetListeners, inode->second, aType, xEvent);
- if (pEvent->m_canceled) return;
- // bubbeling phase
- ++inode;
- if (i_xEvent->getBubbles()) {
- pEvent->m_phase = PhaseType_BUBBLING_PHASE;
- while (inode != captureVector.end())
- {
- pEvent->m_currentTarget = inode->first;
- callListeners(targetListeners,
- inode->second, aType, xEvent);
- if (pEvent->m_canceled) return;
- ++inode;
- }
+ ++inode;
}
}
}