1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_COMPHELPER_ACCESSIBLEEVENTNOTIFIER_HXX
21 #define INCLUDED_COMPHELPER_ACCESSIBLEEVENTNOTIFIER_HXX
23 #include <com/sun/star/accessibility/AccessibleEventObject.hpp>
24 #include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
26 #include <comphelper/comphelperdllapi.h>
28 namespace comphelper
{
30 class COMPHELPER_DLLPUBLIC AccessibleEventNotifier
33 typedef sal_uInt32 TClientId
;
36 AccessibleEventNotifier() = delete;
37 ~AccessibleEventNotifier() = delete;
38 AccessibleEventNotifier( const AccessibleEventNotifier
& ) = delete;
39 AccessibleEventNotifier
& operator=( const AccessibleEventNotifier
& ) = delete;
41 /** registers a client of this class, means a broadcaster of AccessibleEvents
43 <p>No precaution is taken to care for disposal of this component. When the component
44 dies, it <b>must</b> call <member>revokeClient</member> or <member>revokeClientNotifyDisposing</member>
45 explicitly itself.</p>
47 static TClientId
registerClient();
49 /** revokes a broadcaster of AccessibleEvents
51 <p>Note that no disposing event is fired when you use this method, the client is simply revoked.
52 You can for instance revoke a client if the last listener for it is revoked, but the client
53 itself is not disposed.<br/>
54 When the client is disposed, you should prefer <member>revokeClientNotifyDisposing</member></p>
56 <p>Any possibly pending events for this client are removed from the queue.</p>
58 @seealso revokeClientNotifyDisposing
60 static void revokeClient( const TClientId _nClient
);
62 /** revokes a client, with additionally notifying a disposing event to all listeners registered for
65 <p>Any other possibly pending events for this client are removed from the queue</p>
68 the id of the client which should be revoked
70 the source to be notified together with the <member scope="com.sun.star.lang">XComponent::disposing</member>
73 static void revokeClientNotifyDisposing(
74 const TClientId _nClient
,
75 const css::uno::Reference
< css::uno::XInterface
>& _rxEventSource
);
77 /** registers a listener for the given client
80 the id of the client for which a listener should be registered
82 the number of event listeners currently registered for this client
84 static sal_Int32
addEventListener(
85 const TClientId _nClient
,
86 const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& _rxListener
);
88 /** revokes a listener for the given client
91 the id of the client for which a listener should be revoked
93 the number of event listeners currently registered for this client
95 static sal_Int32
removeEventListener(
96 const TClientId _nClient
,
97 const css::uno::Reference
< css::accessibility::XAccessibleEventListener
>& _rxListener
);
99 /** adds an event, which is to be broadcasted, to the queue
102 the id of the client which needs to broadcast the event
104 static void addEvent(
105 const TClientId _nClient
,
106 const css::accessibility::AccessibleEventObject
& _rEvent
);
110 } // namespace comphelper
112 #endif // INCLUDED_COMPHELPER_ACCESSIBLEEVENTNOTIFIER_HXX
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */