Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
65fce112
Kaydet (Commit)
65fce112
authored
Eki 21, 2013
tarafından
Michael Stahl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
AccessibleEventNotifier: remove implementation details from header
Change-Id: Ia422df4066e77bbe3a43a380ba978815fe46dc9c
üst
3f291812
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
58 deletions
+59
-58
accessibleeventnotifier.cxx
comphelper/source/misc/accessibleeventnotifier.cxx
+58
-27
accessibleeventnotifier.hxx
include/comphelper/accessibleeventnotifier.hxx
+1
-31
No files found.
comphelper/source/misc/accessibleeventnotifier.cxx
Dosyayı görüntüle @
65fce112
...
@@ -20,8 +20,11 @@
...
@@ -20,8 +20,11 @@
#include <comphelper/accessibleeventnotifier.hxx>
#include <comphelper/accessibleeventnotifier.hxx>
#include <osl/diagnose.h>
#include <osl/diagnose.h>
#include <rtl/instance.hxx>
#include <rtl/instance.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <comphelper/guarding.hxx>
#include <comphelper/guarding.hxx>
#include <map>
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
uno
;
using
namespace
::
com
::
sun
::
star
::
lang
;
using
namespace
::
com
::
sun
::
star
::
lang
;
using
namespace
::
com
::
sun
::
star
::
accessibility
;
using
namespace
::
com
::
sun
::
star
::
accessibility
;
...
@@ -33,35 +36,39 @@ using namespace ::comphelper;
...
@@ -33,35 +36,39 @@ using namespace ::comphelper;
//---------------------------------------------------------------------
//---------------------------------------------------------------------
namespace
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
struct
lclMutex
:
public
rtl
::
Static
<
::
osl
::
Mutex
,
lclMutex
>
{};
:
public
rtl
::
Static
<
::
osl
::
Mutex
,
lclMutex
>
{};
struct
Clients
struct
Clients
:
public
rtl
::
Static
<
AccessibleEventNotifier
::
ClientMap
,
Clients
>
{};
:
public
rtl
::
Static
<
ClientMap
,
Clients
>
{};
}
//.........................................................................
namespace
comphelper
{
//.........................................................................
//
---------------------------------------------------------------------
//
/ generates a new client id
AccessibleEventNotifier
::
TClientId
AccessibleEventNotifier
::
generateId
()
static
AccessibleEventNotifier
::
TClientId
generateId
()
{
{
TClientId
nBiggestUsedId
=
0
;
AccessibleEventNotifier
::
TClientId
nBiggestUsedId
=
0
;
TClientId
nFreeId
=
0
;
AccessibleEventNotifier
::
TClientId
nFreeId
=
0
;
// look through all registered clients until we find a "gap" in the ids
// 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
// Note that the following relies on the fact the elements in the map
// ascending keys (aka client ids)
// a
re traveled with a
scending keys (aka client ids)
AccessibleEventNotifier
::
ClientMap
&
rClients
=
Clients
::
get
();
ClientMap
&
rClients
=
Clients
::
get
();
for
(
ClientMap
::
const_iterator
aLookup
=
rClients
.
begin
();
for
(
ClientMap
::
const_iterator
aLookup
=
rClients
.
begin
();
aLookup
!=
rClients
.
end
();
aLookup
!=
rClients
.
end
();
++
aLookup
++
aLookup
)
)
{
{
TClientId
nCurrent
=
aLookup
->
first
;
AccessibleEventNotifier
::
TClientId
nCurrent
=
aLookup
->
first
;
OSL_ENSURE
(
nCurrent
>
nBiggestUsedId
,
"AccessibleEventNotifier::generateId: map is expected to be sorted ascending!"
);
OSL_ENSURE
(
nCurrent
>
nBiggestUsedId
,
"AccessibleEventNotifier::generateId: "
"map is expected to be sorted ascending!"
);
if
(
nCurrent
-
nBiggestUsedId
>
1
)
if
(
nCurrent
-
nBiggestUsedId
>
1
)
{
// found a "gap"
{
// found a "gap"
...
@@ -81,6 +88,41 @@ namespace comphelper
...
@@ -81,6 +88,41 @@ namespace comphelper
return
nFreeId
;
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
(
)
AccessibleEventNotifier
::
TClientId
AccessibleEventNotifier
::
registerClient
(
)
{
{
...
@@ -103,17 +145,6 @@ namespace comphelper
...
@@ -103,17 +145,6 @@ namespace comphelper
return
nNewClientId
;
return
nNewClientId
;
}
}
//---------------------------------------------------------------------
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
)
void
AccessibleEventNotifier
::
revokeClient
(
const
TClientId
_nClient
)
{
{
...
...
include/comphelper/accessibleeventnotifier.hxx
Dosyayı görüntüle @
65fce112
...
@@ -22,13 +22,8 @@
...
@@ -22,13 +22,8 @@
#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
#include <osl/thread.hxx>
#include <osl/conditn.hxx>
#include <cppuhelper/interfacecontainer.h>
#include "comphelper/comphelperdllapi.h"
#include <map>
#include <comphelper/comphelperdllapi.h>
#include <list>
//.........................................................................
//.........................................................................
namespace
comphelper
namespace
comphelper
...
@@ -44,12 +39,6 @@ namespace comphelper
...
@@ -44,12 +39,6 @@ namespace comphelper
public
:
public
:
typedef
sal_uInt32
TClientId
;
typedef
sal_uInt32
TClientId
;
typedef
::
std
::
pair
<
TClientId
,
::
com
::
sun
::
star
::
accessibility
::
AccessibleEventObject
>
ClientEvent
;
typedef
::
cppu
::
OInterfaceContainerHelper
EventListeners
;
typedef
::
std
::
map
<
TClientId
,
EventListeners
*
,
::
std
::
less
<
TClientId
>
>
ClientMap
;
protected
:
protected
:
AccessibleEventNotifier
(
);
// never implemented
AccessibleEventNotifier
(
);
// never implemented
~
AccessibleEventNotifier
(
);
// never implemented
~
AccessibleEventNotifier
(
);
// never implemented
...
@@ -130,25 +119,6 @@ namespace comphelper
...
@@ -130,25 +119,6 @@ namespace comphelper
const
::
com
::
sun
::
star
::
accessibility
::
AccessibleEventObject
&
_rEvent
const
::
com
::
sun
::
star
::
accessibility
::
AccessibleEventObject
&
_rEvent
)
SAL_THROW
(
(
)
);
)
SAL_THROW
(
(
)
);
private
:
/// generates a new client id
COMPHELPER_DLLPRIVATE
static
TClientId
generateId
();
/** 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
*/
COMPHELPER_DLLPRIVATE
static
sal_Bool
implLookupClient
(
const
TClientId
_nClient
,
ClientMap
::
iterator
&
_rPos
);
};
};
//.........................................................................
//.........................................................................
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment