/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// get the multimap for the specified type
ListenerMap *pMap = nullptr; auto tIter = pTMap->find(aType); if (tIter == pTMap->end()) { // the map has to be created autoconst pair = pTMap->emplace(aType, ListenerMap());
pMap = & pair.first->second;
} else {
pMap = & tIter->second;
}
assert(pMap != nullptr);
pMap->emplace(pNode, aListener);
}
// create the reference to the private event implementation // that will be dispatched to the listeners
Reference< XEvent > const xEvent(pEvent);
// build the path from target node to the root typedef std::vector< ::std::pair<Reference<XEventTarget>, xmlNodePtr> >
NodeVector_t;
NodeVector_t captureVector;
{
::osl::MutexGuard g(rMutex);
xmlNodePtr cur = pNode; while (cur != nullptr)
{
rtl::Reference< CNode > const xRef(rDocument.GetCNode(cur));
captureVector.emplace_back(Reference< XEventTarget >(xRef), cur);
cur = cur->parent;
}
}
// the capture vector now holds the node path from target to root // first we must search for capture listeners in order root to // to target. after that, any target listeners have to be called // then bubbeling phase listeners are called in target to root // order // 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()) return;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.