summaryrefslogtreecommitdiff
path: root/svtools/source
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2022-07-03 20:29:28 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-07-08 10:10:11 +0200
commit8d8e6c84e512c1a8b33aac75965b84481d1a1d13 (patch)
tree9ed209d057081d4283eb44b51c0d9af18f976eab /svtools/source
parent911ac42485b690df5cbbff6e3c04b111c1723aca (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 'svtools/source')
-rw-r--r--svtools/source/brwbox/brwbox3.cxx50
-rw-r--r--svtools/source/control/accessibleruler.cxx22
-rw-r--r--svtools/source/control/accessibleruler.hxx2
-rw-r--r--svtools/source/control/valueacc.cxx41
-rw-r--r--svtools/source/control/valueimp.hxx4
-rw-r--r--svtools/source/table/tablecontrol.cxx68
6 files changed, 90 insertions, 97 deletions
diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx
index 32401d312829..eaa558b18a00 100644
--- a/svtools/source/brwbox/brwbox3.cxx
+++ b/svtools/source/brwbox/brwbox3.cxx
@@ -20,7 +20,6 @@
#include <svtools/brwbox.hxx>
#include <vcl/AccessibleBrowseBoxObjType.hxx>
#include <vcl/accessiblefactory.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
#include <sal/log.hxx>
#include <tools/debug.hxx>
#include <tools/multisel.hxx>
@@ -37,7 +36,6 @@ using namespace ::com::sun::star::accessibility;
namespace svt
{
using namespace ::com::sun::star::lang;
- using namespace utl;
static Reference< XAccessible > getHeaderCell( BrowseBoxImpl::THeaderCellMap& _raHeaderCells,
sal_Int32 _nPos,
@@ -318,7 +316,7 @@ OUString BrowseBox::GetColumnDescription( sal_uInt16 _nColumn ) const
void BrowseBox::FillAccessibleStateSet(
- ::utl::AccessibleStateSetHelper& rStateSet,
+ sal_Int64& rStateSet,
AccessibleBrowseBoxObjType eObjType ) const
{
switch( eObjType )
@@ -326,47 +324,47 @@ void BrowseBox::FillAccessibleStateSet(
case AccessibleBrowseBoxObjType::BrowseBox:
case AccessibleBrowseBoxObjType::Table:
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
if ( HasFocus() )
- rStateSet.AddState( AccessibleStateType::FOCUSED );
+ rStateSet |= AccessibleStateType::FOCUSED;
if ( IsActive() )
- rStateSet.AddState( AccessibleStateType::ACTIVE );
+ rStateSet |= AccessibleStateType::ACTIVE;
if ( GetUpdateMode() )
- rStateSet.AddState( AccessibleStateType::EDITABLE );
+ rStateSet |= AccessibleStateType::EDITABLE;
if ( IsEnabled() )
{
- rStateSet.AddState( AccessibleStateType::ENABLED );
- rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ rStateSet |= AccessibleStateType::ENABLED;
+ rStateSet |= AccessibleStateType::SENSITIVE;
}
if ( IsReallyVisible() )
- rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet |= AccessibleStateType::VISIBLE;
if ( eObjType == AccessibleBrowseBoxObjType::Table )
- rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
break;
case AccessibleBrowseBoxObjType::RowHeaderBar:
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
- rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
+ rStateSet |= AccessibleStateType::VISIBLE;
if ( GetSelectRowCount() )
- rStateSet.AddState( AccessibleStateType::FOCUSED );
- rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ rStateSet |= AccessibleStateType::FOCUSED;
+ rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
break;
case AccessibleBrowseBoxObjType::ColumnHeaderBar:
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
- rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
+ rStateSet |= AccessibleStateType::VISIBLE;
if ( GetSelectColumnCount() )
- rStateSet.AddState( AccessibleStateType::FOCUSED );
- rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ rStateSet |= AccessibleStateType::FOCUSED;
+ rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
break;
case AccessibleBrowseBoxObjType::TableCell:
{
sal_Int32 nRow = GetCurRow();
sal_uInt16 nColumn = GetCurColumnId();
if ( IsFieldVisible(nRow,nColumn) )
- rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet |= AccessibleStateType::VISIBLE;
if ( !IsFrozen( nColumn ) )
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
- rStateSet.AddState( AccessibleStateType::TRANSIENT );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
+ rStateSet |= AccessibleStateType::TRANSIENT;
}
break;
case AccessibleBrowseBoxObjType::RowHeaderCell:
@@ -377,16 +375,16 @@ void BrowseBox::FillAccessibleStateSet(
}
}
-void BrowseBox::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet,
+void BrowseBox::FillAccessibleStateSetForCell( sal_Int64& _rStateSet,
sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const
{
//! TODO check if the state is valid for table cells
if ( IsCellVisible( _nRow, _nColumnPos ) )
- _rStateSet.AddState( AccessibleStateType::VISIBLE );
+ _rStateSet |= AccessibleStateType::VISIBLE;
if ( GetCurrRow() == _nRow && GetCurrColumn() == _nColumnPos )
- _rStateSet.AddState( AccessibleStateType::FOCUSED );
+ _rStateSet |= AccessibleStateType::FOCUSED;
else // only transient when column is not focused
- _rStateSet.AddState( AccessibleStateType::TRANSIENT );
+ _rStateSet |= AccessibleStateType::TRANSIENT;
}
diff --git a/svtools/source/control/accessibleruler.cxx b/svtools/source/control/accessibleruler.cxx
index c7718935bdbe..e7757de55c32 100644
--- a/svtools/source/control/accessibleruler.cxx
+++ b/svtools/source/control/accessibleruler.cxx
@@ -18,7 +18,6 @@
*/
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
-#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <comphelper/accessibleeventnotifier.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -194,34 +193,33 @@ uno::Reference< XAccessibleRelationSet > SAL_CALL SvtRulerAccessible::getAccessi
}
-uno::Reference< XAccessibleStateSet > SAL_CALL SvtRulerAccessible::getAccessibleStateSet()
+sal_Int64 SAL_CALL SvtRulerAccessible::getAccessibleStateSet()
{
::osl::MutexGuard aGuard( m_aMutex );
- rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
+ sal_Int64 nStateSet = 0;
if( IsAlive() )
{
- pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+ nStateSet |= AccessibleStateType::ENABLED;
- pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ nStateSet |= AccessibleStateType::SHOWING;
if( isVisible() )
- pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ nStateSet |= AccessibleStateType::VISIBLE;
if ( mpRepr->GetStyle() & WB_HORZ )
- pStateSetHelper->AddState( AccessibleStateType::HORIZONTAL );
+ nStateSet |= AccessibleStateType::HORIZONTAL;
else
- pStateSetHelper->AddState( AccessibleStateType::VERTICAL );
+ nStateSet |= AccessibleStateType::VERTICAL;
- if(pStateSetHelper->contains(AccessibleStateType::FOCUSABLE))
+ if(nStateSet & AccessibleStateType::FOCUSABLE)
{
- pStateSetHelper->RemoveState( AccessibleStateType::FOCUSABLE );
+ nStateSet &= ~AccessibleStateType::FOCUSABLE;
}
}
-
- return pStateSetHelper;
+ return nStateSet;
}
lang::Locale SAL_CALL SvtRulerAccessible::getLocale()
diff --git a/svtools/source/control/accessibleruler.hxx b/svtools/source/control/accessibleruler.hxx
index bd7d46123d2b..167816fda94a 100644
--- a/svtools/source/control/accessibleruler.hxx
+++ b/svtools/source/control/accessibleruler.hxx
@@ -113,7 +113,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/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 23d3dcde9bc6..44b6b94375fe 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <unotools/accessiblestatesethelper.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <sal/log.hxx>
@@ -211,33 +210,33 @@ uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueItemAcc::g
}
-uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueItemAcc::getAccessibleStateSet()
+sal_Int64 SAL_CALL ValueItemAcc::getAccessibleStateSet()
{
const SolarMutexGuard aSolarGuard;
- rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper;
+ sal_Int64 nStateSet = 0;
if( mpParent )
{
- pStateSet->AddState (accessibility::AccessibleStateType::ENABLED);
- pStateSet->AddState (accessibility::AccessibleStateType::SENSITIVE);
- pStateSet->AddState (accessibility::AccessibleStateType::SHOWING);
- pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE);
+ nStateSet |= accessibility::AccessibleStateType::ENABLED;
+ nStateSet |= accessibility::AccessibleStateType::SENSITIVE;
+ nStateSet |= accessibility::AccessibleStateType::SHOWING;
+ nStateSet |= accessibility::AccessibleStateType::VISIBLE;
if ( !mbIsTransientChildrenDisabled )
- pStateSet->AddState (accessibility::AccessibleStateType::TRANSIENT);
+ nStateSet |= accessibility::AccessibleStateType::TRANSIENT;
// SELECTABLE
- pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE );
+ nStateSet |= accessibility::AccessibleStateType::SELECTABLE;
// pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
// SELECTED
if( mpParent->mrParent.GetSelectedItemId() == mpParent->mnId )
{
- pStateSet->AddState( accessibility::AccessibleStateType::SELECTED );
+ nStateSet |= accessibility::AccessibleStateType::SELECTED;
// pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED );
}
}
- return pStateSet;
+ return nStateSet;
}
@@ -619,22 +618,22 @@ uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueSetAcc::ge
return mpParent->GetDrawingArea()->get_accessible_relation_set();
}
-uno::Reference< accessibility::XAccessibleStateSet > SAL_CALL ValueSetAcc::getAccessibleStateSet()
+sal_Int64 SAL_CALL ValueSetAcc::getAccessibleStateSet()
{
ThrowIfDisposed();
- rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet = new ::utl::AccessibleStateSetHelper();
+ sal_Int64 nStateSet = 0;
// Set some states.
- pStateSet->AddState (accessibility::AccessibleStateType::ENABLED);
- pStateSet->AddState (accessibility::AccessibleStateType::SENSITIVE);
- pStateSet->AddState (accessibility::AccessibleStateType::SHOWING);
- pStateSet->AddState (accessibility::AccessibleStateType::VISIBLE);
- pStateSet->AddState (accessibility::AccessibleStateType::MANAGES_DESCENDANTS);
- pStateSet->AddState (accessibility::AccessibleStateType::FOCUSABLE);
+ nStateSet |= accessibility::AccessibleStateType::ENABLED;
+ nStateSet |= accessibility::AccessibleStateType::SENSITIVE;
+ nStateSet |= accessibility::AccessibleStateType::SHOWING;
+ nStateSet |= accessibility::AccessibleStateType::VISIBLE;
+ nStateSet |= accessibility::AccessibleStateType::MANAGES_DESCENDANTS;
+ nStateSet |= accessibility::AccessibleStateType::FOCUSABLE;
if (mbIsFocused)
- pStateSet->AddState (accessibility::AccessibleStateType::FOCUSED);
+ nStateSet |= accessibility::AccessibleStateType::FOCUSED;
- return pStateSet;
+ return nStateSet;
}
diff --git a/svtools/source/control/valueimp.hxx b/svtools/source/control/valueimp.hxx
index 1eb77b763b79..3f7130caa14d 100644
--- a/svtools/source/control/valueimp.hxx
+++ b/svtools/source/control/valueimp.hxx
@@ -115,7 +115,7 @@ public:
virtual OUString SAL_CALL getAccessibleDescription( ) override;
virtual OUString SAL_CALL getAccessibleName( ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
- virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
+ virtual sal_Int64 SAL_CALL getAccessibleStateSet( ) override;
virtual css::lang::Locale SAL_CALL getLocale( ) override;
// XAccessibleComponent
@@ -229,7 +229,7 @@ public:
virtual OUString SAL_CALL getAccessibleDescription( ) override;
virtual OUString SAL_CALL getAccessibleName( ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
- virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
+ virtual sal_Int64 SAL_CALL getAccessibleStateSet( ) override;
virtual css::lang::Locale SAL_CALL getLocale( ) override;
// XAccessibleComponent
diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx
index e341b1ea47b8..5ed46f9d4d6b 100644
--- a/svtools/source/table/tablecontrol.cxx
+++ b/svtools/source/table/tablecontrol.cxx
@@ -27,7 +27,6 @@
#include <sal/log.hxx>
#include <tools/diagnose_ex.h>
-#include <unotools/accessiblestatesethelper.hxx>
#include <vcl/settings.hxx>
#include <vcl/vclevent.hxx>
@@ -35,7 +34,6 @@ using namespace ::com::sun::star::uno;
using ::com::sun::star::accessibility::XAccessible;
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::lang;
-using namespace utl;
namespace svt::table
{
@@ -400,7 +398,7 @@ namespace svt::table
void TableControl::FillAccessibleStateSet(
- ::utl::AccessibleStateSetHelper& rStateSet,
+ sal_Int64& rStateSet,
vcl::table::AccessibleTableControlObjType eObjType ) const
{
switch( eObjType )
@@ -408,63 +406,63 @@ namespace svt::table
case vcl::table::TCTYPE_GRIDCONTROL:
case vcl::table::TCTYPE_TABLE:
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
if ( m_pImpl->getSelEngine()->GetSelectionMode() == SelectionMode::Multiple )
- rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
+ rStateSet |= AccessibleStateType::MULTI_SELECTABLE;
if ( HasChildPathFocus() )
- rStateSet.AddState( AccessibleStateType::FOCUSED );
+ rStateSet |= AccessibleStateType::FOCUSED;
if ( IsActive() )
- rStateSet.AddState( AccessibleStateType::ACTIVE );
+ rStateSet |= AccessibleStateType::ACTIVE;
if ( m_pImpl->getDataWindow().IsEnabled() )
{
- rStateSet.AddState( AccessibleStateType::ENABLED );
- rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ rStateSet |= AccessibleStateType::ENABLED;
+ rStateSet |= AccessibleStateType::SENSITIVE;
}
if ( IsReallyVisible() )
- rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet |= AccessibleStateType::VISIBLE;
if ( eObjType == vcl::table::TCTYPE_TABLE )
- rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
break;
case vcl::table::TCTYPE_ROWHEADERBAR:
- rStateSet.AddState( AccessibleStateType::VISIBLE );
- rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ rStateSet |= AccessibleStateType::VISIBLE;
+ rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
break;
case vcl::table::TCTYPE_COLUMNHEADERBAR:
- rStateSet.AddState( AccessibleStateType::VISIBLE );
- rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ rStateSet |= AccessibleStateType::VISIBLE;
+ rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
break;
case vcl::table::TCTYPE_TABLECELL:
{
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
if ( HasChildPathFocus() )
- rStateSet.AddState( AccessibleStateType::FOCUSED );
- rStateSet.AddState( AccessibleStateType::ACTIVE );
- rStateSet.AddState( AccessibleStateType::TRANSIENT );
- rStateSet.AddState( AccessibleStateType::SELECTABLE);
- rStateSet.AddState( AccessibleStateType::VISIBLE );
- rStateSet.AddState( AccessibleStateType::SHOWING );
+ rStateSet |= AccessibleStateType::FOCUSED;
+ rStateSet |= AccessibleStateType::ACTIVE;
+ rStateSet |= AccessibleStateType::TRANSIENT;
+ rStateSet |= AccessibleStateType::SELECTABLE;
+ rStateSet |= AccessibleStateType::VISIBLE;
+ rStateSet |= AccessibleStateType::SHOWING;
if ( IsRowSelected( GetCurrentRow() ) )
// Hmm? Wouldn't we expect the affected row to be a parameter to this function?
- rStateSet.AddState( AccessibleStateType::SELECTED );
+ rStateSet |= AccessibleStateType::SELECTED;
}
break;
case vcl::table::TCTYPE_ROWHEADERCELL:
- rStateSet.AddState( AccessibleStateType::VISIBLE );
- rStateSet.AddState( AccessibleStateType::TRANSIENT );
+ rStateSet |= AccessibleStateType::VISIBLE;
+ rStateSet |= AccessibleStateType::TRANSIENT;
break;
case vcl::table::TCTYPE_COLUMNHEADERCELL:
- rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet |= AccessibleStateType::VISIBLE;
break;
}
}
@@ -560,20 +558,20 @@ namespace svt::table
}
- void TableControl::FillAccessibleStateSetForCell( ::utl::AccessibleStateSetHelper& _rStateSet, sal_Int32 _nRow, sal_uInt16 ) const
+ void TableControl::FillAccessibleStateSetForCell( sal_Int64& _rStateSet, sal_Int32 _nRow, sal_uInt16 ) const
{
if ( IsRowSelected( _nRow ) )
- _rStateSet.AddState( AccessibleStateType::SELECTED );
+ _rStateSet |= AccessibleStateType::SELECTED;
if ( HasChildPathFocus() )
- _rStateSet.AddState( AccessibleStateType::FOCUSED );
+ _rStateSet |= AccessibleStateType::FOCUSED;
else // only transient when column is not focused
- _rStateSet.AddState( AccessibleStateType::TRANSIENT );
+ _rStateSet |= AccessibleStateType::TRANSIENT;
- _rStateSet.AddState( AccessibleStateType::VISIBLE );
- _rStateSet.AddState( AccessibleStateType::SHOWING );
- _rStateSet.AddState( AccessibleStateType::ENABLED );
- _rStateSet.AddState( AccessibleStateType::SENSITIVE );
- _rStateSet.AddState( AccessibleStateType::ACTIVE );
+ _rStateSet |= AccessibleStateType::VISIBLE;
+ _rStateSet |= AccessibleStateType::SHOWING;
+ _rStateSet |= AccessibleStateType::ENABLED;
+ _rStateSet |= AccessibleStateType::SENSITIVE;
+ _rStateSet |= AccessibleStateType::ACTIVE;
}