summaryrefslogtreecommitdiff
path: root/comphelper
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2013-10-21 15:49:20 +0200
committerMichael Stahl <mstahl@redhat.com>2013-10-21 20:05:45 +0200
commit65fce1128cf99c91c9847d613f11fc9ea2325e08 (patch)
tree11e24bf4ab6ecbf05a04494e0330b22d4af93945 /comphelper
parent3f291812d3579768fa2ae753cae49c6723f25f7e (diff)
AccessibleEventNotifier: remove implementation details from header
Change-Id: Ia422df4066e77bbe3a43a380ba978815fe46dc9c
Diffstat (limited to 'comphelper')
-rw-r--r--comphelper/source/misc/accessibleeventnotifier.cxx85
1 files changed, 58 insertions, 27 deletions
diff --git a/comphelper/source/misc/accessibleeventnotifier.cxx b/comphelper/source/misc/accessibleeventnotifier.cxx
index 14ac88c78448..cafe9795bbcb 100644
--- a/comphelper/source/misc/accessibleeventnotifier.cxx
+++ b/comphelper/source/misc/accessibleeventnotifier.cxx
@@ -20,8 +20,11 @@
#include <comphelper/accessibleeventnotifier.hxx>
#include <osl/diagnose.h>
#include <rtl/instance.hxx>
+#include <cppuhelper/interfacecontainer.h>
#include <comphelper/guarding.hxx>
+#include <map>
+
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::accessibility;
@@ -33,35 +36,39 @@ using namespace ::comphelper;
//---------------------------------------------------------------------
namespace
{
+ typedef ::std::pair< AccessibleEventNotifier::TClientId,
+ AccessibleEventObject > ClientEvent;
+
+ typedef ::cppu::OInterfaceContainerHelper EventListeners;
+ typedef ::std::map< AccessibleEventNotifier::TClientId, EventListeners*,
+ ::std::less< AccessibleEventNotifier::TClientId > > ClientMap;
+
+
struct lclMutex
: public rtl::Static< ::osl::Mutex, lclMutex > {};
struct Clients
- : public rtl::Static< AccessibleEventNotifier::ClientMap, Clients > {};
-}
-
-//.........................................................................
-namespace comphelper
-{
-//.........................................................................
+ : public rtl::Static< ClientMap, Clients > {};
- //---------------------------------------------------------------------
- AccessibleEventNotifier::TClientId AccessibleEventNotifier::generateId()
+ /// generates a new client id
+ static AccessibleEventNotifier::TClientId generateId()
{
- TClientId nBiggestUsedId = 0;
- TClientId nFreeId = 0;
+ AccessibleEventNotifier::TClientId nBiggestUsedId = 0;
+ AccessibleEventNotifier::TClientId nFreeId = 0;
// look through all registered clients until we find a "gap" in the ids
- // Note that the following relies on the fact the elements in the map are traveled with
- // ascending keys (aka client ids)
- AccessibleEventNotifier::ClientMap &rClients = Clients::get();
+ // Note that the following relies on the fact the elements in the map
+ // are traveled with ascending keys (aka client ids)
+ ClientMap &rClients = Clients::get();
for ( ClientMap::const_iterator aLookup = rClients.begin();
aLookup != rClients.end();
++aLookup
)
{
- TClientId nCurrent = aLookup->first;
- OSL_ENSURE( nCurrent > nBiggestUsedId, "AccessibleEventNotifier::generateId: map is expected to be sorted ascending!" );
+ AccessibleEventNotifier::TClientId nCurrent = aLookup->first;
+ OSL_ENSURE( nCurrent > nBiggestUsedId,
+ "AccessibleEventNotifier::generateId: "
+ "map is expected to be sorted ascending!" );
if ( nCurrent - nBiggestUsedId > 1 )
{ // found a "gap"
@@ -81,6 +88,41 @@ namespace comphelper
return nFreeId;
}
+ /** looks up a client in our client map, asserts if it cannot find it or
+ no event thread is present
+
+ @precond
+ to be called with our mutex locked
+
+ @param nClient
+ the id of the client to loopup
+ @param rPos
+ out-parameter for the position of the client in the client map
+
+ @return
+ <TRUE/> if and only if the client could be found and
+ <arg>rPos</arg> has been filled with it's position
+ */
+ static sal_Bool implLookupClient(
+ const AccessibleEventNotifier::TClientId nClient,
+ ClientMap::iterator& rPos )
+ {
+ // look up this client
+ ClientMap &rClients = Clients::get();
+ rPos = rClients.find( nClient );
+ OSL_ENSURE( rClients.end() != rPos,
+ "AccessibleEventNotifier::implLookupClient: invalid client id "
+ "(did you register your client?)!" );
+
+ return ( rClients.end() != rPos );
+ }
+}
+
+//.........................................................................
+namespace comphelper
+{
+//.........................................................................
+
//---------------------------------------------------------------------
AccessibleEventNotifier::TClientId AccessibleEventNotifier::registerClient( )
{
@@ -104,17 +146,6 @@ namespace comphelper
}
//---------------------------------------------------------------------
- sal_Bool AccessibleEventNotifier::implLookupClient( const TClientId _nClient, ClientMap::iterator& _rPos )
- {
- // look up this client
- AccessibleEventNotifier::ClientMap &rClients = Clients::get();
- _rPos = rClients.find( _nClient );
- OSL_ENSURE( rClients.end() != _rPos, "AccessibleEventNotifier::implLookupClient: invalid client id (did you register your client?)!" );
-
- return ( rClients.end() != _rPos );
- }
-
- //---------------------------------------------------------------------
void AccessibleEventNotifier::revokeClient( const TClientId _nClient )
{
::osl::MutexGuard aGuard( lclMutex::get() );