diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-01-06 18:43:28 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-01-06 19:02:05 +0000 |
commit | ec98e7769048d44c6d274e3edcac19d5cbc74348 (patch) | |
tree | 1f059916db08d101c8e24ea76d4fd21582a246ca | |
parent | a2e0d46ec556382140069fe473d6e0018e1d2881 (diff) |
Merge comphelper::OAccessibleContextHelper into comphelper::OCommonAccessibleComponent
Change-Id: I586ae8fe2842fd879ae2ae506c659d06dda16843
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145160
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
45 files changed, 366 insertions, 393 deletions
diff --git a/accessibility/source/extended/accessibleiconchoicectrl.cxx b/accessibility/source/extended/accessibleiconchoicectrl.cxx index 72ce9854e204..f9f3599bb4b4 100644 --- a/accessibility/source/extended/accessibleiconchoicectrl.cxx +++ b/accessibility/source/extended/accessibleiconchoicectrl.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <vcl/toolkit/ivctrl.hxx> #include <cppuhelper/supportsservice.hxx> diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx index df4a9a759c0f..d9507fefd4b3 100644 --- a/accessibility/source/extended/accessiblelistbox.cxx +++ b/accessibility/source/extended/accessiblelistbox.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx index 8d192b9fe277..0a9747a3e708 100644 --- a/accessibility/source/extended/accessibletabbar.cxx +++ b/accessibility/source/extended/accessibletabbar.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <i18nlangtag/languagetag.hxx> diff --git a/accessibility/source/extended/accessibletabbarpage.cxx b/accessibility/source/extended/accessibletabbarpage.cxx index 1e9a6d947e9a..ff98170ea480 100644 --- a/accessibility/source/extended/accessibletabbarpage.cxx +++ b/accessibility/source/extended/accessibletabbarpage.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <vcl/svapp.hxx> diff --git a/accessibility/source/extended/accessibletabbarpagelist.cxx b/accessibility/source/extended/accessibletabbarpagelist.cxx index fb50211117b7..f09d43fd23db 100644 --- a/accessibility/source/extended/accessibletabbarpagelist.cxx +++ b/accessibility/source/extended/accessibletabbarpagelist.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <o3tl/safeint.hxx> #include <unotools/accessiblerelationsethelper.hxx> diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx index 99af7273d3f9..2e1cf87fa10f 100644 --- a/accessibility/source/extended/textwindowaccessibility.cxx +++ b/accessibility/source/extended/textwindowaccessibility.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/i18n/Boundary.hpp> #include <cppuhelper/exc_hlp.hxx> #include <extended/textwindowaccessibility.hxx> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/accessibleeventnotifier.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <utility> diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx index 88002f860b10..d288dfb30ceb 100644 --- a/accessibility/source/standard/accessiblemenubasecomponent.cxx +++ b/accessibility/source/standard/accessiblemenubasecomponent.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <o3tl/safeint.hxx> #include <vcl/menu.hxx> diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx index 7bc5f2c6f538..4b6323126252 100644 --- a/accessibility/source/standard/accessiblemenucomponent.cxx +++ b/accessibility/source/standard/accessiblemenucomponent.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/awt/XWindowPeer.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <vcl/svapp.hxx> #include <vcl/window.hxx> diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/accessibility/source/standard/accessiblemenuitemcomponent.cxx index 9ffcc2313a4c..a69b1f12f652 100644 --- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx +++ b/accessibility/source/standard/accessiblemenuitemcomponent.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <unotools/accessiblerelationsethelper.hxx> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/accessibletexthelper.hxx> #include <vcl/svapp.hxx> #include <vcl/window.hxx> diff --git a/accessibility/source/standard/svtaccessiblenumericfield.cxx b/accessibility/source/standard/svtaccessiblenumericfield.cxx index 729966eb8fef..4f696f71a9f3 100644 --- a/accessibility/source/standard/svtaccessiblenumericfield.cxx +++ b/accessibility/source/standard/svtaccessiblenumericfield.cxx @@ -18,6 +18,7 @@ */ #include <standard/svtaccessiblenumericfield.hxx> +#include <comphelper/accessiblecontexthelper.hxx> #include <toolkit/awt/vclxwindows.hxx> #include <com/sun/star/accessibility/AccessibleRole.hpp> diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx index 3cc94edde3f0..e73f56c74a22 100644 --- a/accessibility/source/standard/vclxaccessiblebutton.cxx +++ b/accessibility/source/standard/vclxaccessiblebutton.cxx @@ -21,6 +21,7 @@ #include <helper/accresmgr.hxx> #include <strings.hrc> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/accessiblekeybindinghelper.hxx> #include <com/sun/star/awt/KeyModifier.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx index 18816fd17799..27da7e6bfbe5 100644 --- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx +++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx @@ -23,6 +23,7 @@ #include <helper/accresmgr.hxx> #include <strings.hrc> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/accessiblekeybindinghelper.hxx> #include <com/sun/star/awt/KeyModifier.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx index d01a6b193b13..ea7c5c91b5bf 100644 --- a/accessibility/source/standard/vclxaccessibleedit.cxx +++ b/accessibility/source/standard/vclxaccessibleedit.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> #include <com/sun/star/accessibility/AccessibleTextType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/string.hxx> #include <vcl/svapp.hxx> #include <vcl/window.hxx> diff --git a/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx b/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx index 3ca7b6987c4b..be077d822e53 100644 --- a/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx +++ b/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <unotools/accessiblerelationsethelper.hxx> diff --git a/accessibility/source/standard/vclxaccessiblemenu.cxx b/accessibility/source/standard/vclxaccessiblemenu.cxx index 9aba762da209..e3ad7c118014 100644 --- a/accessibility/source/standard/vclxaccessiblemenu.cxx +++ b/accessibility/source/standard/vclxaccessiblemenu.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <vcl/menu.hxx> diff --git a/accessibility/source/standard/vclxaccessiblemenubar.cxx b/accessibility/source/standard/vclxaccessiblemenubar.cxx index 641d10336699..c54f376fe056 100644 --- a/accessibility/source/standard/vclxaccessiblemenubar.cxx +++ b/accessibility/source/standard/vclxaccessiblemenubar.cxx @@ -20,6 +20,7 @@ #include <standard/vclxaccessiblemenubar.hxx> #include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <vcl/svapp.hxx> #include <vcl/window.hxx> #include <vcl/menu.hxx> diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx index faa9acbf97b1..307b1246b873 100644 --- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx +++ b/accessibility/source/standard/vclxaccessiblemenuitem.cxx @@ -20,6 +20,7 @@ #include <standard/vclxaccessiblemenuitem.hxx> #include <toolkit/helper/convert.hxx> #include <helper/characterattributeshelper.hxx> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/accessiblekeybindinghelper.hxx> #include <com/sun/star/awt/KeyModifier.hpp> diff --git a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx b/accessibility/source/standard/vclxaccessiblepopupmenu.cxx index a937776b3cce..65d4043187ba 100644 --- a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx +++ b/accessibility/source/standard/vclxaccessiblepopupmenu.cxx @@ -20,6 +20,7 @@ #include <standard/vclxaccessiblepopupmenu.hxx> #include <com/sun/star/accessibility/AccessibleRole.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx index e065a75e09cb..c9ba225eb4ab 100644 --- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx +++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx @@ -22,6 +22,7 @@ #include <toolkit/awt/vclxwindows.hxx> #include <unotools/accessiblerelationsethelper.hxx> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/accessiblekeybindinghelper.hxx> #include <com/sun/star/awt/KeyModifier.hpp> #include <com/sun/star/accessibility/AccessibleRelationType.hpp> diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx index 130b6d71aabb..8b001ea0f232 100644 --- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx +++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/awt/ScrollBarOrientation.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <vcl/toolkit/scrbar.hxx> #include <vcl/vclevent.hxx> #include <strings.hxx> diff --git a/accessibility/source/standard/vclxaccessiblestatusbar.cxx b/accessibility/source/standard/vclxaccessiblestatusbar.cxx index 05b061a5f76b..52d32eb7cc55 100644 --- a/accessibility/source/standard/vclxaccessiblestatusbar.cxx +++ b/accessibility/source/standard/vclxaccessiblestatusbar.cxx @@ -22,6 +22,7 @@ #include <toolkit/helper/convert.hxx> #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <o3tl/safeint.hxx> #include <vcl/status.hxx> #include <vcl/vclevent.hxx> diff --git a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx index 0bbefc103caf..6b56af0220f6 100644 --- a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx +++ b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <vcl/ctrl.hxx> diff --git a/accessibility/source/standard/vclxaccessibletabcontrol.cxx b/accessibility/source/standard/vclxaccessibletabcontrol.cxx index f44b58a760c9..a3c9eb03c476 100644 --- a/accessibility/source/standard/vclxaccessibletabcontrol.cxx +++ b/accessibility/source/standard/vclxaccessibletabcontrol.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <o3tl/safeint.hxx> #include <vcl/tabctrl.hxx> #include <vcl/tabpage.hxx> diff --git a/accessibility/source/standard/vclxaccessibletabpage.cxx b/accessibility/source/standard/vclxaccessibletabpage.cxx index 5d4f94b7970b..5175ab68e160 100644 --- a/accessibility/source/standard/vclxaccessibletabpage.cxx +++ b/accessibility/source/standard/vclxaccessibletabpage.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <unotools/accessiblerelationsethelper.hxx> #include <vcl/mnemonic.hxx> diff --git a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx index 7eae8cf90be2..dea12aed6fb0 100644 --- a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx +++ b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx @@ -18,6 +18,7 @@ */ #include <standard/vclxaccessibletabpagewindow.hxx> +#include <comphelper/accessiblecontexthelper.hxx> #include <toolkit/helper/convert.hxx> #include <vcl/tabctrl.hxx> #include <vcl/tabpage.hxx> diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx index 63974960b694..8a406acb207d 100644 --- a/accessibility/source/standard/vclxaccessibletextcomponent.cxx +++ b/accessibility/source/standard/vclxaccessibletextcomponent.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <vcl/window.hxx> #include <vcl/mnemonic.hxx> #include <vcl/svapp.hxx> diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index 4ef03cd1efe3..062ba442c32c 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -29,6 +29,7 @@ #include <o3tl/safeint.hxx> #include <vcl/toolbox.hxx> #include <vcl/vclevent.hxx> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/accessiblewrapper.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/servicehelper.hxx> diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index a91b7bb80f37..ed88660333f5 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -29,6 +29,7 @@ #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> #include <vcl/toolbox.hxx> diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index e6f75045af8c..b7972f3a1ea2 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -31,6 +31,7 @@ #include <toolkit/awt/vclxfont.hxx> #include <toolkit/helper/convert.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/diagnose_ex.hxx> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 54e3743b5332..2145f2546ea2 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <tools/debug.hxx> #include <unotools/accessiblerelationsethelper.hxx> diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk index 0bad46866d54..be60c4dc886c 100644 --- a/comphelper/Library_comphelper.mk +++ b/comphelper/Library_comphelper.mk @@ -77,7 +77,6 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\ comphelper/source/container/namecontainer \ comphelper/source/eventattachermgr/eventattachermgr \ comphelper/source/misc/accessiblecomponenthelper \ - comphelper/source/misc/accessiblecontexthelper \ comphelper/source/misc/accessibleeventnotifier \ comphelper/source/misc/accessiblekeybindinghelper \ comphelper/source/misc/accessibleselectionhelper \ diff --git a/comphelper/source/misc/accessiblecomponenthelper.cxx b/comphelper/source/misc/accessiblecomponenthelper.cxx index 2962bbac95a8..b5ca0bbd9af1 100644 --- a/comphelper/source/misc/accessiblecomponenthelper.cxx +++ b/comphelper/source/misc/accessiblecomponenthelper.cxx @@ -18,6 +18,11 @@ */ #include <comphelper/accessiblecomponenthelper.hxx> +#include <comphelper/accessiblecontexthelper.hxx> +#include <osl/diagnose.h> +#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp> +#include <comphelper/accessibleeventnotifier.hxx> +#include <comphelper/solarmutex.hxx> namespace comphelper @@ -30,12 +35,213 @@ namespace comphelper using namespace ::com::sun::star::accessibility; OCommonAccessibleComponent::OCommonAccessibleComponent( ) + :OCommonAccessibleComponent_Base( GetMutex() ) + ,m_nClientId( 0 ) { } OCommonAccessibleComponent::~OCommonAccessibleComponent( ) { + // this ensures that the lock, which may be already destroyed as part of the derivee, + // is not used anymore + + ensureDisposed(); + } + + + void SAL_CALL OCommonAccessibleComponent::disposing() + { + // rhbz#1001768: de facto this class is locked by SolarMutex; + // do not lock m_Mutex because it may cause deadlock + osl::Guard<SolarMutex> aGuard(SolarMutex::get()); + + if ( m_nClientId ) + { + AccessibleEventNotifier::revokeClientNotifyDisposing( m_nClientId, *this ); + m_nClientId=0; + } + } + + + void SAL_CALL OCommonAccessibleComponent::addAccessibleEventListener( const Reference< XAccessibleEventListener >& _rxListener ) + { + osl::Guard<SolarMutex> aGuard(SolarMutex::get()); + // don't use the OContextEntryGuard - it will throw an exception if we're not alive + // anymore, while the most recent specification for XComponent states that we should + // silently ignore the call in such a situation + if ( !isAlive() ) + { + if ( _rxListener.is() ) + _rxListener->disposing( EventObject( *this ) ); + return; + } + + if ( _rxListener.is() ) + { + if ( !m_nClientId ) + m_nClientId = AccessibleEventNotifier::registerClient( ); + + AccessibleEventNotifier::addEventListener( m_nClientId, _rxListener ); + } + } + + + void SAL_CALL OCommonAccessibleComponent::removeAccessibleEventListener( const Reference< XAccessibleEventListener >& _rxListener ) + { + osl::Guard<SolarMutex> aGuard(SolarMutex::get()); + // don't use the OContextEntryGuard - it will throw an exception if we're not alive + // anymore, while the most recent specification for XComponent states that we should + // silently ignore the call in such a situation + if ( !isAlive() ) + return; + + if ( !(_rxListener.is() && m_nClientId) ) + return; + + sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( m_nClientId, _rxListener ); + if ( !nListenerCount ) + { + // no listeners anymore + // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), + // and at least to us not firing any events anymore, in case somebody calls + // NotifyAccessibleEvent, again + AccessibleEventNotifier::revokeClient( m_nClientId ); + m_nClientId = 0; + } + } + + + void OCommonAccessibleComponent::NotifyAccessibleEvent( const sal_Int16 _nEventId, + const Any& _rOldValue, const Any& _rNewValue ) + { + if ( !m_nClientId ) + // if we don't have a client id for the notifier, then we don't have listeners, then + // we don't need to notify anything + return; + + // build an event object + AccessibleEventObject aEvent; + aEvent.Source = *this; + aEvent.EventId = _nEventId; + aEvent.OldValue = _rOldValue; + aEvent.NewValue = _rNewValue; + + // let the notifier handle this event + AccessibleEventNotifier::addEvent( m_nClientId, aEvent ); + } + + + bool OCommonAccessibleComponent::isAlive() const + { + return !rBHelper.bDisposed && !rBHelper.bInDispose; + } + + + void OCommonAccessibleComponent::ensureAlive() const + { + if( !isAlive() ) + throw DisposedException(); + } + + + void OCommonAccessibleComponent::ensureDisposed( ) + { + if ( !rBHelper.bDisposed ) + { + OSL_ENSURE( 0 == m_refCount, "OCommonAccessibleComponent::ensureDisposed: this method _has_ to be called from without your dtor only!" ); + acquire(); + dispose(); + } + } + + + void OCommonAccessibleComponent::lateInit( const Reference< XAccessible >& _rxAccessible ) + { + m_aCreator = _rxAccessible; + } + + + Reference< XAccessible > OCommonAccessibleComponent::getAccessibleCreator( ) const + { + return m_aCreator; + } + + + OUString SAL_CALL OCommonAccessibleComponent::getAccessibleId( ) + { + return OUString(); + } + + + sal_Int64 SAL_CALL OCommonAccessibleComponent::getAccessibleIndexInParent( ) + { + OExternalLockGuard aGuard( this ); + + // -1 for child not found/no parent (according to specification) + sal_Int64 nRet = -1; + + try + { + + Reference< XAccessibleContext > xParentContext( implGetParentContext() ); + + // iterate over parent's children and search for this object + if ( xParentContext.is() ) + { + // our own XAccessible for comparing with the children of our parent + Reference< XAccessible > xCreator( m_aCreator); + + OSL_ENSURE( xCreator.is(), "OCommonAccessibleComponent::getAccessibleIndexInParent: invalid creator!" ); + // two ideas why this could be NULL: + // * nobody called our late ctor (init), so we never had a creator at all -> bad + // * the creator is already dead. In this case, we should have been disposed, and + // never survived the above OContextEntryGuard. + // in all other situations the creator should be non-NULL + + if ( xCreator.is() ) + { + sal_Int64 nChildCount = xParentContext->getAccessibleChildCount(); + for ( sal_Int64 nChild = 0; ( nChild < nChildCount ) && ( -1 == nRet ); ++nChild ) + { + Reference< XAccessible > xChild( xParentContext->getAccessibleChild( nChild ) ); + if ( xChild.get() == xCreator.get() ) + nRet = nChild; + } + } + } + } + catch( const Exception& ) + { + OSL_FAIL( "OCommonAccessibleComponent::getAccessibleIndexInParent: caught an exception!" ); + } + + return nRet; + } + + + Locale SAL_CALL OCommonAccessibleComponent::getLocale( ) + { + // simply ask the parent + Reference< XAccessible > xParent = getAccessibleParent(); + Reference< XAccessibleContext > xParentContext; + if ( xParent.is() ) + xParentContext = xParent->getAccessibleContext(); + + if ( !xParentContext.is() ) + throw IllegalAccessibleComponentStateException( OUString(), *this ); + + return xParentContext->getLocale(); + } + + + Reference< XAccessibleContext > OCommonAccessibleComponent::implGetParentContext() + { + Reference< XAccessible > xParent = getAccessibleParent(); + Reference< XAccessibleContext > xParentContext; + if ( xParent.is() ) + xParentContext = xParent->getAccessibleContext(); + return xParentContext; } diff --git a/comphelper/source/misc/accessiblecontexthelper.cxx b/comphelper/source/misc/accessiblecontexthelper.cxx deleted file mode 100644 index 854b3966036e..000000000000 --- a/comphelper/source/misc/accessiblecontexthelper.cxx +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- 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 . - */ - -#include <comphelper/accessiblecontexthelper.hxx> -#include <osl/diagnose.h> -#include <cppuhelper/weakref.hxx> -#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp> -#include <comphelper/accessibleeventnotifier.hxx> -#include <comphelper/solarmutex.hxx> - - -namespace comphelper -{ - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::accessibility; - - OAccessibleContextHelper::OAccessibleContextHelper( ) - :OAccessibleContextHelper_Base( GetMutex() ) - ,m_nClientId( 0 ) - { - } - - - OAccessibleContextHelper::~OAccessibleContextHelper( ) - { - // this ensures that the lock, which may be already destroyed as part of the derivee, - // is not used anymore - - ensureDisposed(); - } - - - void SAL_CALL OAccessibleContextHelper::disposing() - { - // rhbz#1001768: de facto this class is locked by SolarMutex; - // do not lock m_Mutex because it may cause deadlock - osl::Guard<SolarMutex> aGuard(SolarMutex::get()); - - if ( m_nClientId ) - { - AccessibleEventNotifier::revokeClientNotifyDisposing( m_nClientId, *this ); - m_nClientId=0; - } - } - - - void SAL_CALL OAccessibleContextHelper::addAccessibleEventListener( const Reference< XAccessibleEventListener >& _rxListener ) - { - osl::Guard<SolarMutex> aGuard(SolarMutex::get()); - // don't use the OContextEntryGuard - it will throw an exception if we're not alive - // anymore, while the most recent specification for XComponent states that we should - // silently ignore the call in such a situation - if ( !isAlive() ) - { - if ( _rxListener.is() ) - _rxListener->disposing( EventObject( *this ) ); - return; - } - - if ( _rxListener.is() ) - { - if ( !m_nClientId ) - m_nClientId = AccessibleEventNotifier::registerClient( ); - - AccessibleEventNotifier::addEventListener( m_nClientId, _rxListener ); - } - } - - - void SAL_CALL OAccessibleContextHelper::removeAccessibleEventListener( const Reference< XAccessibleEventListener >& _rxListener ) - { - osl::Guard<SolarMutex> aGuard(SolarMutex::get()); - // don't use the OContextEntryGuard - it will throw an exception if we're not alive - // anymore, while the most recent specification for XComponent states that we should - // silently ignore the call in such a situation - if ( !isAlive() ) - return; - - if ( !(_rxListener.is() && m_nClientId) ) - return; - - sal_Int32 nListenerCount = AccessibleEventNotifier::removeEventListener( m_nClientId, _rxListener ); - if ( !nListenerCount ) - { - // no listeners anymore - // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client), - // and at least to us not firing any events anymore, in case somebody calls - // NotifyAccessibleEvent, again - AccessibleEventNotifier::revokeClient( m_nClientId ); - m_nClientId = 0; - } - } - - - void OAccessibleContextHelper::NotifyAccessibleEvent( const sal_Int16 _nEventId, - const Any& _rOldValue, const Any& _rNewValue ) - { - if ( !m_nClientId ) - // if we don't have a client id for the notifier, then we don't have listeners, then - // we don't need to notify anything - return; - - // build an event object - AccessibleEventObject aEvent; - aEvent.Source = *this; - aEvent.EventId = _nEventId; - aEvent.OldValue = _rOldValue; - aEvent.NewValue = _rNewValue; - - // let the notifier handle this event - AccessibleEventNotifier::addEvent( m_nClientId, aEvent ); - } - - - bool OAccessibleContextHelper::isAlive() const - { - return !rBHelper.bDisposed && !rBHelper.bInDispose; - } - - - void OAccessibleContextHelper::ensureAlive() const - { - if( !isAlive() ) - throw DisposedException(); - } - - - void OAccessibleContextHelper::ensureDisposed( ) - { - if ( !rBHelper.bDisposed ) - { - OSL_ENSURE( 0 == m_refCount, "OAccessibleContextHelper::ensureDisposed: this method _has_ to be called from without your dtor only!" ); - acquire(); - dispose(); - } - } - - - void OAccessibleContextHelper::lateInit( const Reference< XAccessible >& _rxAccessible ) - { - m_aCreator = _rxAccessible; - } - - - Reference< XAccessible > OAccessibleContextHelper::getAccessibleCreator( ) const - { - return m_aCreator; - } - - - OUString SAL_CALL OAccessibleContextHelper::getAccessibleId( ) - { - return OUString(); - } - - - sal_Int64 SAL_CALL OAccessibleContextHelper::getAccessibleIndexInParent( ) - { - OExternalLockGuard aGuard( this ); - - // -1 for child not found/no parent (according to specification) - sal_Int64 nRet = -1; - - try - { - - Reference< XAccessibleContext > xParentContext( implGetParentContext() ); - - // iterate over parent's children and search for this object - if ( xParentContext.is() ) - { - // our own XAccessible for comparing with the children of our parent - Reference< XAccessible > xCreator( m_aCreator); - - OSL_ENSURE( xCreator.is(), "OAccessibleContextHelper::getAccessibleIndexInParent: invalid creator!" ); - // two ideas why this could be NULL: - // * nobody called our late ctor (init), so we never had a creator at all -> bad - // * the creator is already dead. In this case, we should have been disposed, and - // never survived the above OContextEntryGuard. - // in all other situations the creator should be non-NULL - - if ( xCreator.is() ) - { - sal_Int64 nChildCount = xParentContext->getAccessibleChildCount(); - for ( sal_Int64 nChild = 0; ( nChild < nChildCount ) && ( -1 == nRet ); ++nChild ) - { - Reference< XAccessible > xChild( xParentContext->getAccessibleChild( nChild ) ); - if ( xChild.get() == xCreator.get() ) - nRet = nChild; - } - } - } - } - catch( const Exception& ) - { - OSL_FAIL( "OAccessibleContextHelper::getAccessibleIndexInParent: caught an exception!" ); - } - - return nRet; - } - - - Locale SAL_CALL OAccessibleContextHelper::getLocale( ) - { - // simply ask the parent - Reference< XAccessible > xParent = getAccessibleParent(); - Reference< XAccessibleContext > xParentContext; - if ( xParent.is() ) - xParentContext = xParent->getAccessibleContext(); - - if ( !xParentContext.is() ) - throw IllegalAccessibleComponentStateException( OUString(), *this ); - - return xParentContext->getLocale(); - } - - - Reference< XAccessibleContext > OAccessibleContextHelper::implGetParentContext() - { - Reference< XAccessible > xParent = getAccessibleParent(); - Reference< XAccessibleContext > xParentContext; - if ( xParent.is() ) - xParentContext = xParent->getAccessibleContext(); - return xParentContext; - } - - -} // namespace comphelper - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/comphelper/source/misc/accessibleselectionhelper.cxx b/comphelper/source/misc/accessibleselectionhelper.cxx index 97b75115e5e6..435655e85e1d 100644 --- a/comphelper/source/misc/accessibleselectionhelper.cxx +++ b/comphelper/source/misc/accessibleselectionhelper.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/accessibleselectionhelper.hxx> diff --git a/comphelper/source/misc/accessibletexthelper.cxx b/comphelper/source/misc/accessibletexthelper.cxx index 27747b3bca12..cc7fa4cd3d15 100644 --- a/comphelper/source/misc/accessibletexthelper.cxx +++ b/comphelper/source/misc/accessibletexthelper.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/accessibletexthelper.hxx> #include <com/sun/star/accessibility/AccessibleTextType.hpp> #include <com/sun/star/i18n/BreakIterator.hpp> diff --git a/compilerplugins/clang/mergeclasses.results b/compilerplugins/clang/mergeclasses.results index 793b6f10bef8..1682b3ea21bf 100644 --- a/compilerplugins/clang/mergeclasses.results +++ b/compilerplugins/clang/mergeclasses.results @@ -259,7 +259,6 @@ merge comphelper::ConfigurationListenerPropertyBase with comphelper::Configurati merge comphelper::ConfigurationListener_Base with comphelper::ConfigurationListener merge comphelper::MasterPropertySetInfo_Base with comphelper::MasterPropertySetInfo merge comphelper::OAccessibleComponentHelper_Base with comphelper::OAccessibleComponentHelper -merge comphelper::OAccessibleContextHelper with comphelper::OCommonAccessibleComponent merge comphelper::OAccessibleWrapper_Base with comphelper::OAccessibleWrapper merge comphelper::OAnyEnumeration_BASE with comphelper::OAnyEnumeration merge comphelper::OComponentProxyAggregation with comphelper::OAccessibleWrapper diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml index 84130521a602..cbb76417739a 100644 --- a/include/IwyuFilter_include.yaml +++ b/include/IwyuFilter_include.yaml @@ -118,11 +118,9 @@ excludelist: - com/sun/star/accessibility/XAccessibleKeyBinding.hpp include/comphelper/accessiblecomponenthelper.hxx: # base class has to be a complete type - - com/sun/star/accessibility/XAccessibleExtendedComponent.hpp - include/comphelper/accessiblecontexthelper.hxx: - # base class has to be a complete type - com/sun/star/accessibility/XAccessibleContext.hpp - com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp + - com/sun/star/accessibility/XAccessibleExtendedComponent.hpp include/comphelper/accessibleselectionhelper.hxx: # base class has to be a complete type - com/sun/star/accessibility/XAccessibleSelection.hpp diff --git a/include/comphelper/accessiblecomponenthelper.hxx b/include/comphelper/accessiblecomponenthelper.hxx index 963bea96bf17..0c738d0e6df0 100644 --- a/include/comphelper/accessiblecomponenthelper.hxx +++ b/include/comphelper/accessiblecomponenthelper.hxx @@ -21,8 +21,12 @@ #define INCLUDED_COMPHELPER_ACCESSIBLECOMPONENTHELPER_HXX #include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleContext2.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> #include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp> -#include <comphelper/accessiblecontexthelper.hxx> +#include <comphelper/accessibleeventnotifier.hxx> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/compbase2.hxx> #include <cppuhelper/implbase1.hxx> #include <comphelper/uno3.hxx> #include <comphelper/comphelperdllapi.h> @@ -34,15 +38,118 @@ namespace comphelper //= OCommonAccessibleComponent + typedef ::cppu::WeakAggComponentImplHelper2 < css::accessibility::XAccessibleContext2, + css::accessibility::XAccessibleEventBroadcaster + > OCommonAccessibleComponent_Base; + /** base class encapsulating common functionality for the helper classes implementing the XAccessibleComponent respectively XAccessibleExtendendComponent */ - class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent : public OAccessibleContextHelper + class COMPHELPER_DLLPUBLIC OCommonAccessibleComponent + :public ::cppu::BaseMutex + ,public OCommonAccessibleComponent_Base { + friend class OContextEntryGuard; + private: + css::uno::WeakReference< css::accessibility::XAccessible > m_aCreator; // the XAccessible which created our XAccessibleContext + AccessibleEventNotifier::TClientId m_nClientId; + + protected: + virtual ~OCommonAccessibleComponent( ) override; + + OCommonAccessibleComponent( ); + + /** late construction + @param _rxAccessible + the Accessible object which created this context. + <p>If your derived implementation implements the XAccessible (and does not follow the proposed + separation of XAccessible from XAccessibleContext), you may pass <code>this</code> here.</p> + + <p>The object is hold weak, so its life time is not affected.</p> + + <p>The object is needed for performance reasons: for <method>getAccessibleIndexInParent</method>, + all children (which are XAccessible's theirself) of our parent have to be asked. If we know our + XAccessible, we can compare it with all the children, instead of asking all children for their + context and comparing this context with ourself.</p> + */ + void lateInit( const css::uno::Reference< css::accessibility::XAccessible >& _rxAccessible ); + + /** retrieves the creator previously set with <method>lateInit</method> + */ + css::uno::Reference< css::accessibility::XAccessible > + getAccessibleCreator( ) const; + + public: + // XAccessibleEventBroadcaster + virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; + virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; + + // XAccessibleContext - still waiting to be overwritten + virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override = 0; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override = 0; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override = 0; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override = 0; + virtual OUString SAL_CALL getAccessibleDescription( ) override = 0; + virtual OUString SAL_CALL getAccessibleName( ) override = 0; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override = 0; + virtual sal_Int64 SAL_CALL getAccessibleStateSet( ) override = 0; + + // XAccessibleContext2 - default implementation + virtual OUString SAL_CALL getAccessibleId( ) override; + + // XAccessibleContext - default implementations + /** default implementation for retrieving the index of this object within the parent + <p>This basic implementation here returns the index <code>i</code> of the child for which + <code><parent>.getAccessibleChild( i )</code> equals our creator.</p> + */ + virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override; + /** default implementation for retrieving the locale + <p>This basic implementation returns the locale of the parent context, + as retrieved via getAccessibleParent()->getAccessibleContext.</p> + */ + virtual css::lang::Locale SAL_CALL getLocale( ) override; + + protected: + // OComponentHelper + virtual void SAL_CALL disposing() override; + protected: - /// see the respective base class ctor for an extensive comment on this, please - OCommonAccessibleComponent(); - virtual ~OCommonAccessibleComponent() override; + // helper + /** notifies all AccessibleEventListeners of a certain event + + @precond not to be called with our mutex locked + @param _nEventId + the id of the event. See AccessibleEventType + @param _rOldValue + the old value to be notified + @param _rNewValue + the new value to be notified + */ + void NotifyAccessibleEvent( + const sal_Int16 _nEventId, + const css::uno::Any& _rOldValue, + const css::uno::Any& _rNewValue + ); + + // life time control + /// checks whether the object is alive (returns <TRUE/> then) or disposed + bool isAlive() const; + /// checks for being alive. If the object is already disposed (i.e. not alive), an exception is thrown. + void ensureAlive() const; + + /** ensures that the object is disposed. + @precond + to be called from within the destructor of your derived class only! + */ + void ensureDisposed( ); + + /** shortcut for retrieving the context of the parent (returned by getAccessibleParent) + */ + css::uno::Reference< css::accessibility::XAccessibleContext > + implGetParentContext(); + + // access to the base class' broadcast helper/mutex + ::osl::Mutex& GetMutex() { return m_aMutex; } protected: /// implements the calculation of the bounding rectangle - still waiting to be overwritten diff --git a/include/comphelper/accessiblecontexthelper.hxx b/include/comphelper/accessiblecontexthelper.hxx index ea0f9b214d29..59a87a6987df 100644 --- a/include/comphelper/accessiblecontexthelper.hxx +++ b/include/comphelper/accessiblecontexthelper.hxx @@ -20,12 +20,7 @@ #ifndef INCLUDED_COMPHELPER_ACCESSIBLECONTEXTHELPER_HXX #define INCLUDED_COMPHELPER_ACCESSIBLECONTEXTHELPER_HXX -#include <cppuhelper/compbase2.hxx> -#include <cppuhelper/basemutex.hxx> -#include <com/sun/star/accessibility/XAccessibleContext2.hpp> -#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> -#include <comphelper/accessibleeventnotifier.hxx> -#include <comphelper/comphelperdllapi.h> +#include <comphelper/accessiblecomponenthelper.hxx> #include <comphelper/solarmutex.hxx> @@ -33,130 +28,13 @@ namespace comphelper { - //= OAccessibleContextHelper - - - typedef ::cppu::WeakAggComponentImplHelper2 < css::accessibility::XAccessibleContext2, - css::accessibility::XAccessibleEventBroadcaster - > OAccessibleContextHelper_Base; - - /** helper class for implementing an AccessibleContext - */ - class COMPHELPER_DLLPUBLIC OAccessibleContextHelper - :public ::cppu::BaseMutex - ,public OAccessibleContextHelper_Base - { - friend class OContextEntryGuard; - private: - css::uno::WeakReference< css::accessibility::XAccessible > m_aCreator; // the XAccessible which created our XAccessibleContext - AccessibleEventNotifier::TClientId m_nClientId; - - protected: - virtual ~OAccessibleContextHelper( ) override; - - OAccessibleContextHelper( ); - - /** late construction - @param _rxAccessible - the Accessible object which created this context. - <p>If your derived implementation implements the XAccessible (and does not follow the proposed - separation of XAccessible from XAccessibleContext), you may pass <code>this</code> here.</p> - - <p>The object is hold weak, so its life time is not affected.</p> - - <p>The object is needed for performance reasons: for <method>getAccessibleIndexInParent</method>, - all children (which are XAccessible's theirself) of our parent have to be asked. If we know our - XAccessible, we can compare it with all the children, instead of asking all children for their - context and comparing this context with ourself.</p> - */ - void lateInit( const css::uno::Reference< css::accessibility::XAccessible >& _rxAccessible ); - - /** retrieves the creator previously set with <method>lateInit</method> - */ - css::uno::Reference< css::accessibility::XAccessible > - getAccessibleCreator( ) const; - - public: - // XAccessibleEventBroadcaster - virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; - virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; - - // XAccessibleContext - still waiting to be overwritten - virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override = 0; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override = 0; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override = 0; - virtual sal_Int16 SAL_CALL getAccessibleRole( ) override = 0; - virtual OUString SAL_CALL getAccessibleDescription( ) override = 0; - virtual OUString SAL_CALL getAccessibleName( ) override = 0; - virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override = 0; - virtual sal_Int64 SAL_CALL getAccessibleStateSet( ) override = 0; - - // XAccessibleContext2 - default implementation - virtual OUString SAL_CALL getAccessibleId( ) override; - - // XAccessibleContext - default implementations - /** default implementation for retrieving the index of this object within the parent - <p>This basic implementation here returns the index <code>i</code> of the child for which - <code><parent>.getAccessibleChild( i )</code> equals our creator.</p> - */ - virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override; - /** default implementation for retrieving the locale - <p>This basic implementation returns the locale of the parent context, - as retrieved via getAccessibleParent()->getAccessibleContext.</p> - */ - virtual css::lang::Locale SAL_CALL getLocale( ) override; - - protected: - // OComponentHelper - virtual void SAL_CALL disposing() override; - - protected: - // helper - /** notifies all AccessibleEventListeners of a certain event - - @precond not to be called with our mutex locked - @param _nEventId - the id of the event. See AccessibleEventType - @param _rOldValue - the old value to be notified - @param _rNewValue - the new value to be notified - */ - void NotifyAccessibleEvent( - const sal_Int16 _nEventId, - const css::uno::Any& _rOldValue, - const css::uno::Any& _rNewValue - ); - - // life time control - /// checks whether the object is alive (returns <TRUE/> then) or disposed - bool isAlive() const; - /// checks for being alive. If the object is already disposed (i.e. not alive), an exception is thrown. - void ensureAlive() const; - - /** ensures that the object is disposed. - @precond - to be called from within the destructor of your derived class only! - */ - void ensureDisposed( ); - - /** shortcut for retrieving the context of the parent (returned by getAccessibleParent) - */ - css::uno::Reference< css::accessibility::XAccessibleContext > - implGetParentContext(); - - // access to the base class' broadcast helper/mutex - ::osl::Mutex& GetMutex() { return m_aMutex; } - }; - - //= OContextEntryGuard - /** helper class for guarding the entry into OAccessibleContextHelper methods. + /** helper class for guarding the entry into OCommonAccessibleComponent methods. <p>The class has two responsibilities: - <ul><li>it locks the mutex of an OAccessibleContextHelper instance, as long as the guard lives</li> - <li>it checks if a given OAccessibleContextHelper instance is alive, else an exception is thrown + <ul><li>it locks the mutex of an OCommonAccessibleComponent instance, as long as the guard lives</li> + <li>it checks if a given OCommonAccessibleComponent instance is alive, else an exception is thrown our of the constructor of the guard</li> </ul> <br/> @@ -176,11 +54,11 @@ namespace comphelper the context which shall be guarded @precond <arg>_pContext</arg> != NULL */ - inline OContextEntryGuard( OAccessibleContextHelper* _pContext ); + inline OContextEntryGuard( OCommonAccessibleComponent* _pContext ); }; - inline OContextEntryGuard::OContextEntryGuard( OAccessibleContextHelper* _pContext ) + inline OContextEntryGuard::OContextEntryGuard( OCommonAccessibleComponent* _pContext ) : ::osl::ClearableMutexGuard( _pContext->GetMutex() ) { _pContext->ensureAlive(); @@ -194,16 +72,16 @@ namespace comphelper ,public OContextEntryGuard { public: - inline OExternalLockGuard( OAccessibleContextHelper* _pContext ); + inline OExternalLockGuard( OCommonAccessibleComponent* _pContext ); }; - inline OExternalLockGuard::OExternalLockGuard( OAccessibleContextHelper* _pContext ) + inline OExternalLockGuard::OExternalLockGuard( OCommonAccessibleComponent* _pContext ) :osl::Guard<SolarMutex>( SolarMutex::get() ) ,OContextEntryGuard( _pContext ) { // Only lock the external mutex, - // release the ::osl::Mutex of the OAccessibleContextHelper instance. + // release the ::osl::Mutex of the OCommonAccessibleComponent instance. // If you call into another UNO object with locked ::osl::Mutex, // this may lead to dead locks. clear(); diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 972ad4cdf52f..fccf3a48d88c 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -1372,7 +1372,6 @@ comphelper/source/container/namecontainer.cxx comphelper/source/eventattachermgr/eventattachermgr.cxx comphelper/source/misc/SelectionMultiplex.cxx comphelper/source/misc/accessiblecomponenthelper.cxx -comphelper/source/misc/accessiblecontexthelper.cxx comphelper/source/misc/accessibleeventnotifier.cxx comphelper/source/misc/accessiblekeybindinghelper.cxx comphelper/source/misc/accessibleselectionhelper.cxx diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx index 5b85a5e571cc..46fe8b11ac15 100644 --- a/svx/source/accessibility/charmapacc.cxx +++ b/svx/source/accessibility/charmapacc.cxx @@ -29,6 +29,7 @@ #include <osl/interlck.h> #include <svx/dialmgr.hxx> #include <svx/strings.hrc> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/types.hxx> namespace svx diff --git a/svx/source/inc/charmapacc.hxx b/svx/source/inc/charmapacc.hxx index 1924a77578a5..3831c3485ccf 100644 --- a/svx/source/inc/charmapacc.hxx +++ b/svx/source/inc/charmapacc.hxx @@ -83,7 +83,7 @@ namespace svx virtual void SAL_CALL grabFocus( ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; - //OAccessibleContextHelper + //OCommonAccessibleComponent // XAccessibleContext - still waiting to be overwritten virtual sal_Int64 SAL_CALL getAccessibleChildCount() override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; @@ -182,7 +182,7 @@ namespace svx virtual void SAL_CALL grabFocus( ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; - //OAccessibleContextHelper + //OCommonAccessibleComponent // XAccessibleContext - still waiting to be overwritten virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; diff --git a/toolkit/inc/controls/accessiblecontrolcontext.hxx b/toolkit/inc/controls/accessiblecontrolcontext.hxx index 20065b86f101..14acfe6e3276 100644 --- a/toolkit/inc/controls/accessiblecontrolcontext.hxx +++ b/toolkit/inc/controls/accessiblecontrolcontext.hxx @@ -84,7 +84,7 @@ namespace toolkit virtual sal_Int32 SAL_CALL getBackground( ) override; // XEventListener - using comphelper::OAccessibleContextHelper::disposing; + using comphelper::OCommonAccessibleComponent::disposing; virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; // retrieves the value of a string property from the model, if the property is present diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 7fbb1ea1ccd6..aef0eb1c3852 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRelationType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> +#include <comphelper/accessiblecontexthelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <i18nlangtag/languagetag.hxx> #include <toolkit/awt/vclxaccessiblecomponent.hxx> diff --git a/toolkit/source/controls/accessiblecontrolcontext.cxx b/toolkit/source/controls/accessiblecontrolcontext.cxx index fa6d43f0b374..7df9a0c7e34d 100644 --- a/toolkit/source/controls/accessiblecontrolcontext.cxx +++ b/toolkit/source/controls/accessiblecontrolcontext.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <toolkit/helper/vclunohelper.hxx> +#include <comphelper/accessiblecontexthelper.hxx> #include <comphelper/diagnose_ex.hxx> #include <vcl/window.hxx> |