diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-07-03 20:29:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-07-08 10:10:11 +0200 |
commit | 8d8e6c84e512c1a8b33aac75965b84481d1a1d13 (patch) | |
tree | 9ed209d057081d4283eb44b51c0d9af18f976eab /sd/source | |
parent | 911ac42485b690df5cbbff6e3c04b111c1723aca (diff) |
[API CHANGE] Drop css::accessibility::XAccessibleStateSet
which is internal API, unused (as far as I can tell) by external
users.
This state is purely a bitset
(as implemented by utl::AccessibleStateSetHelper)
so we can just return it as a 64-bit value.
This shaves significant time off the performance profiles
of code that loads very complex shapes, because this state
is frequently used, and we no longer need to allocate a return
value on the heap for every call.
Change-Id: Icf1b3bd367c256646ae9015f9127025f59459c2c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136786
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source')
4 files changed, 26 insertions, 31 deletions
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx index 13fc60db0ab8..55629979d52d 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx @@ -34,7 +34,6 @@ #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <comphelper/accessibleeventnotifier.hxx> #include <cppuhelper/supportsservice.hxx> -#include <unotools/accessiblestatesethelper.hxx> #include <sal/log.hxx> #include <sdpage.hxx> @@ -180,33 +179,33 @@ Reference<XAccessibleRelationSet> SAL_CALL return Reference<XAccessibleRelationSet>(); } -Reference<XAccessibleStateSet> SAL_CALL +sal_Int64 SAL_CALL AccessibleSlideSorterObject::getAccessibleStateSet() { ThrowIfDisposed(); const SolarMutexGuard aSolarGuard; - rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper(); + sal_Int64 nStateSet = 0; if (mxParent.is()) { // Unconditional states. - pStateSet->AddState(AccessibleStateType::SELECTABLE); - pStateSet->AddState(AccessibleStateType::FOCUSABLE); - pStateSet->AddState(AccessibleStateType::ENABLED); - pStateSet->AddState(AccessibleStateType::VISIBLE); - pStateSet->AddState(AccessibleStateType::SHOWING); - pStateSet->AddState(AccessibleStateType::ACTIVE); - pStateSet->AddState(AccessibleStateType::SENSITIVE); + nStateSet |= AccessibleStateType::SELECTABLE; + nStateSet |= AccessibleStateType::FOCUSABLE; + nStateSet |= AccessibleStateType::ENABLED; + nStateSet |= AccessibleStateType::VISIBLE; + nStateSet |= AccessibleStateType::SHOWING; + nStateSet |= AccessibleStateType::ACTIVE; + nStateSet |= AccessibleStateType::SENSITIVE; // Conditional states. if (mrSlideSorter.GetController().GetPageSelector().IsPageSelected(mnPageNumber)) - pStateSet->AddState(AccessibleStateType::SELECTED); + nStateSet |= AccessibleStateType::SELECTED; if (mrSlideSorter.GetController().GetFocusManager().GetFocusedPageIndex() == mnPageNumber) if (mrSlideSorter.GetController().GetFocusManager().IsFocusShowing()) - pStateSet->AddState(AccessibleStateType::FOCUSED); + nStateSet |= AccessibleStateType::FOCUSED; } - return pStateSet; + return nStateSet; } lang::Locale SAL_CALL AccessibleSlideSorterObject::getLocale() diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx index 87eea89d2199..6a569171cb67 100644 --- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx +++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx @@ -43,7 +43,6 @@ #include <comphelper/accessibleeventnotifier.hxx> #include <cppuhelper/supportsservice.hxx> #include <o3tl/safeint.hxx> -#include <unotools/accessiblestatesethelper.hxx> #include <rtl/ref.hxx> #include <sal/log.hxx> #include <i18nlangtag/languagetag.hxx> @@ -280,28 +279,27 @@ Reference<XAccessibleRelationSet> SAL_CALL return Reference<XAccessibleRelationSet>(); } -Reference<XAccessibleStateSet > SAL_CALL - AccessibleSlideSorterView::getAccessibleStateSet() +sal_Int64 SAL_CALL AccessibleSlideSorterView::getAccessibleStateSet() { ThrowIfDisposed(); const SolarMutexGuard aSolarGuard; - rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper(); - - pStateSet->AddState(AccessibleStateType::FOCUSABLE); - pStateSet->AddState(AccessibleStateType::SELECTABLE); - pStateSet->AddState(AccessibleStateType::ENABLED); - pStateSet->AddState(AccessibleStateType::ACTIVE); - pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE); - pStateSet->AddState(AccessibleStateType::OPAQUE); + sal_Int64 nStateSet = 0; + + nStateSet |= AccessibleStateType::FOCUSABLE; + nStateSet |= AccessibleStateType::SELECTABLE; + nStateSet |= AccessibleStateType::ENABLED; + nStateSet |= AccessibleStateType::ACTIVE; + nStateSet |= AccessibleStateType::MULTI_SELECTABLE; + nStateSet |= AccessibleStateType::OPAQUE; if (mpContentWindow!=nullptr) { if (mpContentWindow->IsVisible()) - pStateSet->AddState(AccessibleStateType::VISIBLE); + nStateSet |= AccessibleStateType::VISIBLE; if (mpContentWindow->IsReallyVisible()) - pStateSet->AddState(AccessibleStateType::SHOWING); + nStateSet |= AccessibleStateType::SHOWING; } - return pStateSet; + return nStateSet; } lang::Locale SAL_CALL AccessibleSlideSorterView::getLocale() diff --git a/sd/source/ui/inc/AccessibleSlideSorterObject.hxx b/sd/source/ui/inc/AccessibleSlideSorterObject.hxx index 6da56a15236a..31ba6cc4d053 100644 --- a/sd/source/ui/inc/AccessibleSlideSorterObject.hxx +++ b/sd/source/ui/inc/AccessibleSlideSorterObject.hxx @@ -114,7 +114,7 @@ public: virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet() override; - virtual css::uno::Reference< css::accessibility::XAccessibleStateSet> SAL_CALL + virtual sal_Int64 SAL_CALL getAccessibleStateSet() override; virtual css::lang::Locale SAL_CALL diff --git a/sd/source/ui/inc/AccessibleSlideSorterView.hxx b/sd/source/ui/inc/AccessibleSlideSorterView.hxx index 85003b72d138..ab5c316f77eb 100644 --- a/sd/source/ui/inc/AccessibleSlideSorterView.hxx +++ b/sd/source/ui/inc/AccessibleSlideSorterView.hxx @@ -132,9 +132,7 @@ public: getAccessibleRelationSet() override; /// Return the set of current states. - virtual css::uno::Reference< - css::accessibility::XAccessibleStateSet> SAL_CALL - getAccessibleStateSet() override; + virtual sal_Int64 SAL_CALL getAccessibleStateSet() override; /** Return the parents locale or throw exception if this object has no parent yet/anymore. |