summaryrefslogtreecommitdiff
path: root/accessibility/source/standard
diff options
context:
space:
mode:
Diffstat (limited to 'accessibility/source/standard')
-rw-r--r--accessibility/source/standard/accessiblemenubasecomponent.cxx187
-rw-r--r--accessibility/source/standard/accessiblemenucomponent.cxx62
-rw-r--r--accessibility/source/standard/accessiblemenuitemcomponent.cxx34
-rw-r--r--accessibility/source/standard/floatingwindowaccessible.cxx2
-rw-r--r--accessibility/source/standard/svtaccessiblenumericfield.cxx110
-rw-r--r--accessibility/source/standard/vclxaccessiblebox.cxx122
-rw-r--r--accessibility/source/standard/vclxaccessiblebutton.cxx64
-rw-r--r--accessibility/source/standard/vclxaccessiblecheckbox.cxx45
-rw-r--r--accessibility/source/standard/vclxaccessiblecombobox.cxx7
-rw-r--r--accessibility/source/standard/vclxaccessibledropdowncombobox.cxx7
-rw-r--r--accessibility/source/standard/vclxaccessibledropdownlistbox.cxx14
-rw-r--r--accessibility/source/standard/vclxaccessibleedit.cxx92
-rw-r--r--accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx4
-rw-r--r--accessibility/source/standard/vclxaccessiblefixedtext.cxx11
-rw-r--r--accessibility/source/standard/vclxaccessibleheaderbar.cxx13
-rw-r--r--accessibility/source/standard/vclxaccessibleheaderbaritem.cxx45
-rw-r--r--accessibility/source/standard/vclxaccessiblelist.cxx152
-rw-r--r--accessibility/source/standard/vclxaccessiblelistbox.cxx4
-rw-r--r--accessibility/source/standard/vclxaccessiblelistitem.cxx144
-rw-r--r--accessibility/source/standard/vclxaccessiblemenu.cxx39
-rw-r--r--accessibility/source/standard/vclxaccessiblemenubar.cxx7
-rw-r--r--accessibility/source/standard/vclxaccessiblemenuitem.cxx102
-rw-r--r--accessibility/source/standard/vclxaccessiblemenuseparator.cxx1
-rw-r--r--accessibility/source/standard/vclxaccessiblepopupmenu.cxx7
-rw-r--r--accessibility/source/standard/vclxaccessibleradiobutton.cxx40
-rw-r--r--accessibility/source/standard/vclxaccessiblescrollbar.cxx42
-rw-r--r--accessibility/source/standard/vclxaccessiblestatusbar.cxx88
-rw-r--r--accessibility/source/standard/vclxaccessiblestatusbaritem.cxx57
-rw-r--r--accessibility/source/standard/vclxaccessibletabcontrol.cxx132
-rw-r--r--accessibility/source/standard/vclxaccessibletabpage.cxx98
-rw-r--r--accessibility/source/standard/vclxaccessibletabpagewindow.cxx5
-rw-r--r--accessibility/source/standard/vclxaccessibletextcomponent.cxx30
-rw-r--r--accessibility/source/standard/vclxaccessibletextfield.cxx17
-rw-r--r--accessibility/source/standard/vclxaccessibletoolbox.cxx212
-rw-r--r--accessibility/source/standard/vclxaccessibletoolboxitem.cxx146
35 files changed, 997 insertions, 1145 deletions
diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx
index 4dbb71c554cf..e5e390d59512 100644
--- a/accessibility/source/standard/accessiblemenubasecomponent.cxx
+++ b/accessibility/source/standard/accessiblemenubasecomponent.cxx
@@ -26,9 +26,11 @@
#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 <unotools/accessiblestatesethelper.hxx>
+#include <o3tl/safeint.hxx>
#include <vcl/menu.hxx>
+#include <vcl/vclevent.hxx>
#include <array>
@@ -52,7 +54,7 @@ OAccessibleMenuBaseComponent::OAccessibleMenuBaseComponent( Menu* pMenu )
{
if ( m_pMenu )
{
- m_aAccessibleChildren.assign( m_pMenu->GetItemCount(), Reference< XAccessible >() );
+ m_aAccessibleChildren1.assign( m_pMenu->GetItemCount(), rtl::Reference< OAccessibleMenuItemComponent >() );
m_pMenu->AddEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) );
}
}
@@ -110,7 +112,7 @@ void OAccessibleMenuBaseComponent::SetEnabled( bool bEnabled )
if ( m_bEnabled == bEnabled )
return;
- sal_Int16 nStateType=AccessibleStateType::ENABLED;
+ sal_Int64 nStateType=AccessibleStateType::ENABLED;
if (IsMenuHideDisabledEntries())
{
nStateType = AccessibleStateType::VISIBLE;
@@ -194,30 +196,22 @@ void OAccessibleMenuBaseComponent::SetChecked( bool bChecked )
void OAccessibleMenuBaseComponent::UpdateEnabled( sal_Int32 i, bool bEnabled )
{
- if ( i >= 0 && i < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren1.size() )
{
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ rtl::Reference< OAccessibleMenuBaseComponent > xChild( m_aAccessibleChildren1[i] );
if ( xChild.is() )
- {
- OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
- if ( pComp )
- pComp->SetEnabled( bEnabled );
- }
+ xChild->SetEnabled( bEnabled );
}
}
void OAccessibleMenuBaseComponent::UpdateFocused( sal_Int32 i, bool bFocused )
{
- if ( i >= 0 && i < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren1.size() )
{
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ rtl::Reference< OAccessibleMenuBaseComponent > xChild( m_aAccessibleChildren1[i] );
if ( xChild.is() )
- {
- OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
- if ( pComp )
- pComp->SetFocused( bFocused );
- }
+ xChild->SetFocused( bFocused );
}
}
@@ -225,14 +219,10 @@ void OAccessibleMenuBaseComponent::UpdateFocused( sal_Int32 i, bool bFocused )
void OAccessibleMenuBaseComponent::UpdateVisible()
{
SetVisible( IsVisible() );
- for (const Reference<XAccessible>& xChild : m_aAccessibleChildren)
+ for (const rtl::Reference<OAccessibleMenuItemComponent>& xChild : m_aAccessibleChildren1)
{
if ( xChild.is() )
- {
- OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
- if ( pComp )
- pComp->SetVisible( pComp->IsVisible() );
- }
+ xChild->SetVisible( xChild->IsVisible() );
}
}
@@ -241,39 +231,31 @@ void OAccessibleMenuBaseComponent::UpdateSelected( sal_Int32 i, bool bSelected )
{
NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
- if ( i >= 0 && i < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren1.size() )
{
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ rtl::Reference< OAccessibleMenuBaseComponent > xChild( m_aAccessibleChildren1[i] );
if ( xChild.is() )
- {
- OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
- if ( pComp )
- pComp->SetSelected( bSelected );
- }
+ xChild->SetSelected( bSelected );
}
}
void OAccessibleMenuBaseComponent::UpdateChecked( sal_Int32 i, bool bChecked )
{
- if ( i >= 0 && i < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren1.size() )
{
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ rtl::Reference< OAccessibleMenuBaseComponent > xChild( m_aAccessibleChildren1[i] );
if ( xChild.is() )
- {
- OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
- if ( pComp )
- pComp->SetChecked( bChecked );
- }
+ xChild->SetChecked( bChecked );
}
}
void OAccessibleMenuBaseComponent::UpdateAccessibleName( sal_Int32 i )
{
- if ( i >= 0 && i < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren1.size() )
{
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ rtl::Reference< OAccessibleMenuBaseComponent > xChild( m_aAccessibleChildren1[i] );
if ( xChild.is() )
{
OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xChild.get() );
@@ -283,37 +265,44 @@ void OAccessibleMenuBaseComponent::UpdateAccessibleName( sal_Int32 i )
}
}
+void OAccessibleMenuBaseComponent::UpdateItemRole(sal_Int32 i)
+{
+ if (i < 0 || o3tl::make_unsigned(i) >= m_aAccessibleChildren1.size())
+ return;
+
+ rtl::Reference<OAccessibleMenuItemComponent> xChild(m_aAccessibleChildren1[i]);
+ if (!xChild.is())
+ return;
+
+ xChild->NotifyAccessibleEvent(AccessibleEventId::ROLE_CHANGED, Any(), Any());
+}
void OAccessibleMenuBaseComponent::UpdateItemText( sal_Int32 i )
{
- if ( i >= 0 && i < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren1.size() )
{
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ rtl::Reference< OAccessibleMenuItemComponent > xChild( m_aAccessibleChildren1[i] );
if ( xChild.is() )
- {
- OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xChild.get() );
- if ( pComp )
- pComp->SetItemText( pComp->GetItemText() );
- }
+ xChild->SetItemText( xChild->GetItemText() );
}
}
-sal_Int32 OAccessibleMenuBaseComponent::GetChildCount() const
+sal_Int64 OAccessibleMenuBaseComponent::GetChildCount() const
{
- return m_aAccessibleChildren.size();
+ return m_aAccessibleChildren1.size();
}
-Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int32 i )
+Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int64 i )
{
- Reference< XAccessible > xChild = m_aAccessibleChildren[i];
+ rtl::Reference< OAccessibleMenuItemComponent > xChild = m_aAccessibleChildren1[i];
if ( !xChild.is() )
{
if ( m_pMenu )
{
// create a new child
- OAccessibleMenuBaseComponent* pChild;
+ rtl::Reference<OAccessibleMenuItemComponent> pChild;
if ( m_pMenu->GetItemType( static_cast<sal_uInt16>(i) ) == MenuItemType::SEPARATOR )
{
@@ -339,7 +328,7 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int32 i )
xChild = pChild;
// insert into menu item list
- m_aAccessibleChildren[i] = xChild;
+ m_aAccessibleChildren1[i] = xChild;
}
}
@@ -350,7 +339,7 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int32 i )
Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Point& rPoint )
{
Reference< XAccessible > xChild;
- for ( sal_uInt32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ for ( sal_Int64 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
{
Reference< XAccessible > xAcc = getAccessibleChild( i );
if ( xAcc.is() )
@@ -360,7 +349,7 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Po
{
tools::Rectangle aRect = VCLRectangle( xComp->getBounds() );
Point aPos = VCLPoint( rPoint );
- if ( aRect.IsInside( aPos ) )
+ if ( aRect.Contains( aPos ) )
{
xChild = xAcc;
break;
@@ -375,25 +364,21 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Po
void OAccessibleMenuBaseComponent::InsertChild( sal_Int32 i )
{
- if ( i > static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
- i = m_aAccessibleChildren.size();
-
if ( i < 0 )
return;
+ if ( o3tl::make_unsigned(i) > m_aAccessibleChildren1.size() )
+ i = m_aAccessibleChildren1.size();
+
// insert entry in child list
- m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() );
+ m_aAccessibleChildren1.insert( m_aAccessibleChildren1.begin() + i, rtl::Reference< OAccessibleMenuItemComponent >() );
// update item position of accessible children
- for ( sal_uInt32 j = i, nCount = m_aAccessibleChildren.size(); j < nCount; ++j )
+ for ( sal_uInt32 j = i, nCount = m_aAccessibleChildren1.size(); j < nCount; ++j )
{
- Reference< XAccessible > xAcc( m_aAccessibleChildren[j] );
+ rtl::Reference< OAccessibleMenuItemComponent > xAcc( m_aAccessibleChildren1[j] );
if ( xAcc.is() )
- {
- OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xAcc.get() );
- if ( pComp )
- pComp->SetItemPos( static_cast<sal_uInt16>(j) );
- }
+ xAcc->SetItemPos( static_cast<sal_uInt16>(j) );
}
// send accessible child event
@@ -409,37 +394,31 @@ void OAccessibleMenuBaseComponent::InsertChild( sal_Int32 i )
void OAccessibleMenuBaseComponent::RemoveChild( sal_Int32 i )
{
- if ( i < 0 || i >= static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i < 0 || o3tl::make_unsigned(i) >= m_aAccessibleChildren1.size() )
return;
// keep the accessible of the removed item
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ rtl::Reference< OAccessibleMenuItemComponent > xChild( m_aAccessibleChildren1[i] );
// remove entry in child list
- m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
+ m_aAccessibleChildren1.erase( m_aAccessibleChildren1.begin() + i );
// update item position of accessible children
- for ( sal_uInt32 j = i, nCount = m_aAccessibleChildren.size(); j < nCount; ++j )
+ for ( sal_uInt32 j = i, nCount = m_aAccessibleChildren1.size(); j < nCount; ++j )
{
- Reference< XAccessible > xAcc( m_aAccessibleChildren[j] );
+ rtl::Reference< OAccessibleMenuItemComponent > xAcc( m_aAccessibleChildren1[j] );
if ( xAcc.is() )
- {
- OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xAcc.get() );
- if ( pComp )
- pComp->SetItemPos( static_cast<sal_uInt16>(j) );
- }
+ xAcc->SetItemPos( static_cast<sal_uInt16>(j) );
}
// send accessible child event
if ( xChild.is() )
{
Any aOldValue, aNewValue;
- aOldValue <<= xChild;
+ aOldValue <<= uno::Reference<XAccessible>(xChild);
NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
- Reference< XComponent > xComponent( xChild, UNO_QUERY );
- if ( xComponent.is() )
- xComponent->dispose();
+ xChild->dispose();
}
}
@@ -454,16 +433,12 @@ bool OAccessibleMenuBaseComponent::IsChildHighlighted()
{
bool bChildHighlighted = false;
- for (const Reference<XAccessible>& xChild : m_aAccessibleChildren)
+ for (const rtl::Reference<OAccessibleMenuItemComponent>& xChild : m_aAccessibleChildren1)
{
- if ( xChild.is() )
+ if ( xChild.is() && xChild->IsHighlighted() )
{
- OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xChild.get() );
- if ( pComp && pComp->IsHighlighted() )
- {
- bChildHighlighted = true;
- break;
- }
+ bChildHighlighted = true;
+ break;
}
}
@@ -584,6 +559,11 @@ void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMen
UpdateAccessibleName( nItemPos );
}
break;
+ case VclEventId::MenuItemRoleChanged:
+ {
+ UpdateItemRole(nItemPos);
+ }
+ break;
case VclEventId::MenuItemTextChanged:
{
UpdateAccessibleName( nItemPos );
@@ -609,13 +589,12 @@ void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMen
m_pMenu = nullptr;
// dispose all menu items
- for (const Reference<XAccessible>& i : m_aAccessibleChildren)
+ for (const rtl::Reference<OAccessibleMenuItemComponent>& xComponent : m_aAccessibleChildren1)
{
- Reference< XComponent > xComponent( i, UNO_QUERY );
if ( xComponent.is() )
xComponent->dispose();
}
- m_aAccessibleChildren.clear();
+ m_aAccessibleChildren1.clear();
}
}
break;
@@ -627,18 +606,6 @@ void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMen
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleMenuBaseComponent, OAccessibleExtendedComponentHelper, OAccessibleMenuBaseComponent_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleMenuBaseComponent, OAccessibleExtendedComponentHelper, OAccessibleMenuBaseComponent_BASE )
-
-
// XComponent
@@ -654,13 +621,12 @@ void OAccessibleMenuBaseComponent::disposing()
m_pMenu = nullptr;
// dispose all menu items
- for (const Reference<XAccessible>& i : m_aAccessibleChildren)
+ for (const rtl::Reference<OAccessibleMenuItemComponent>& xComponent : m_aAccessibleChildren1)
{
- Reference< XComponent > xComponent( i, UNO_QUERY );
if ( xComponent.is() )
xComponent->dispose();
}
- m_aAccessibleChildren.clear();
+ m_aAccessibleChildren1.clear();
}
@@ -687,23 +653,22 @@ Reference< XAccessibleContext > OAccessibleMenuBaseComponent::getAccessibleConte
// XAccessibleContext
-Reference< XAccessibleStateSet > OAccessibleMenuBaseComponent::getAccessibleStateSet( )
+sal_Int64 OAccessibleMenuBaseComponent::getAccessibleStateSet( )
{
OExternalLockGuard aGuard( this );
- utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
- Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+ sal_Int64 nStateSet = 0;
if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
{
- FillAccessibleStateSet( *pStateSetHelper );
+ FillAccessibleStateSet( nStateSet );
}
else
{
- pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ nStateSet |= AccessibleStateType::DEFUNC;
}
- return xSet;
+ return nStateSet;
}
diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx
index ff927df47d14..9d86f0246a42 100644
--- a/accessibility/source/standard/accessiblemenucomponent.cxx
+++ b/accessibility/source/standard/accessiblemenucomponent.cxx
@@ -25,9 +25,9 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/awt/XDevice.hpp>
-#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <unotools/accessiblestatesethelper.hxx>
+#include <comphelper/accessiblecontexthelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
@@ -61,26 +61,26 @@ bool OAccessibleMenuComponent::IsVisible()
}
-void OAccessibleMenuComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void OAccessibleMenuComponent::FillAccessibleStateSet( sal_Int64& rStateSet )
{
if ( IsEnabled() )
{
- rStateSet.AddState( AccessibleStateType::ENABLED );
- rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ rStateSet |= AccessibleStateType::ENABLED;
+ rStateSet |= AccessibleStateType::SENSITIVE;
}
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
if ( IsFocused() )
- rStateSet.AddState( AccessibleStateType::FOCUSED );
+ rStateSet |= AccessibleStateType::FOCUSED;
if ( IsVisible() )
{
- rStateSet.AddState( AccessibleStateType::VISIBLE );
- rStateSet.AddState( AccessibleStateType::SHOWING );
+ rStateSet |= AccessibleStateType::VISIBLE;
+ rStateSet |= AccessibleStateType::SHOWING;
}
- rStateSet.AddState( AccessibleStateType::OPAQUE );
+ rStateSet |= AccessibleStateType::OPAQUE;
}
@@ -97,7 +97,7 @@ awt::Rectangle OAccessibleMenuComponent::implGetBounds()
if ( pWindow )
{
// get bounding rectangle of the window in screen coordinates
- tools::Rectangle aRect = pWindow->GetWindowExtentsRelative( nullptr );
+ AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute();
aBounds = AWTRectangle( aRect );
// get position of the accessible parent in screen coordinates
@@ -121,22 +121,10 @@ awt::Rectangle OAccessibleMenuComponent::implGetBounds()
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( OAccessibleMenuComponent, OAccessibleMenuBaseComponent, OAccessibleMenuComponent_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( OAccessibleMenuComponent, OAccessibleMenuBaseComponent, OAccessibleMenuComponent_BASE )
-
-
// XAccessibleContext
-sal_Int32 OAccessibleMenuComponent::getAccessibleChildCount()
+sal_Int64 OAccessibleMenuComponent::getAccessibleChildCount()
{
OExternalLockGuard aGuard( this );
@@ -144,7 +132,7 @@ sal_Int32 OAccessibleMenuComponent::getAccessibleChildCount()
}
-Reference< XAccessible > OAccessibleMenuComponent::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > OAccessibleMenuComponent::getAccessibleChild( sal_Int64 i )
{
OExternalLockGuard aGuard( this );
@@ -212,9 +200,7 @@ Reference< XAccessibleRelationSet > OAccessibleMenuComponent::getAccessibleRelat
{
OExternalLockGuard aGuard( this );
- utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
- Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
- return xSet;
+ return new utl::AccessibleRelationSetHelper;
}
@@ -248,7 +234,7 @@ awt::Point OAccessibleMenuComponent::getLocationOnScreen( )
vcl::Window* pWindow = m_pMenu->GetWindow();
if ( pWindow )
{
- tools::Rectangle aRect = pWindow->GetWindowExtentsRelative( nullptr );
+ AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute();
aPos = AWTPoint( aRect.TopLeft() );
}
}
@@ -307,7 +293,7 @@ Reference< awt::XFont > OAccessibleMenuComponent::getFont( )
if ( xDev.is() )
{
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- VCLXFont* pVCLXFont = new VCLXFont;
+ rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont;
pVCLXFont->Init( *xDev, rStyleSettings.GetMenuFont() );
xFont = pVCLXFont;
}
@@ -337,7 +323,7 @@ OUString OAccessibleMenuComponent::getToolTipText( )
// XAccessibleSelection
-void OAccessibleMenuComponent::selectAccessibleChild( sal_Int32 nChildIndex )
+void OAccessibleMenuComponent::selectAccessibleChild( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
@@ -348,7 +334,7 @@ void OAccessibleMenuComponent::selectAccessibleChild( sal_Int32 nChildIndex )
}
-sal_Bool OAccessibleMenuComponent::isAccessibleChildSelected( sal_Int32 nChildIndex )
+sal_Bool OAccessibleMenuComponent::isAccessibleChildSelected( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
@@ -373,13 +359,13 @@ void OAccessibleMenuComponent::selectAllAccessibleChildren( )
}
-sal_Int32 OAccessibleMenuComponent::getSelectedAccessibleChildCount( )
+sal_Int64 OAccessibleMenuComponent::getSelectedAccessibleChildCount( )
{
OExternalLockGuard aGuard( this );
- sal_Int32 nRet = 0;
+ sal_Int64 nRet = 0;
- for ( sal_Int32 i = 0, nCount = GetChildCount(); i < nCount; i++ )
+ for ( sal_Int64 i = 0, nCount = GetChildCount(); i < nCount; i++ )
{
if ( IsChildSelected( i ) )
++nRet;
@@ -389,7 +375,7 @@ sal_Int32 OAccessibleMenuComponent::getSelectedAccessibleChildCount( )
}
-Reference< XAccessible > OAccessibleMenuComponent::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+Reference< XAccessible > OAccessibleMenuComponent::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex )
{
OExternalLockGuard aGuard( this );
@@ -398,7 +384,7 @@ Reference< XAccessible > OAccessibleMenuComponent::getSelectedAccessibleChild( s
Reference< XAccessible > xChild;
- for ( sal_Int32 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ )
+ for ( sal_Int64 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ )
{
if ( IsChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
{
@@ -411,7 +397,7 @@ Reference< XAccessible > OAccessibleMenuComponent::getSelectedAccessibleChild( s
}
-void OAccessibleMenuComponent::deselectAccessibleChild( sal_Int32 nChildIndex )
+void OAccessibleMenuComponent::deselectAccessibleChild( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
index 951d913e20c3..d6b8b209a7d0 100644
--- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx
+++ b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
@@ -26,18 +26,18 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <unotools/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
+#include <comphelper/accessiblecontexthelper.hxx>
#include <comphelper/accessibletexthelper.hxx>
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <vcl/menu.hxx>
+#include <vcl/mnemonic.hxx>
#include <vcl/settings.hxx>
#include <i18nlangtag/languagetag.hxx>
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star;
using namespace ::comphelper;
@@ -131,7 +131,7 @@ void OAccessibleMenuItemComponent::Click()
// that the popup menus are executed synchronously.
AllSettings aSettings = pWindow->GetSettings();
MouseSettings aMouseSettings = aSettings.GetMouseSettings();
- sal_uLong nDelay = aMouseSettings.GetMenuDelay();
+ sal_Int32 nDelay = aMouseSettings.GetMenuDelay();
aMouseSettings.SetMenuDelay( 0 );
aSettings.SetMouseSettings( aMouseSettings );
pWindow->SetSettings( aSettings );
@@ -180,7 +180,7 @@ OUString OAccessibleMenuItemComponent::GetAccessibleName()
sName = m_pParent->GetAccessibleName( nItemId );
if ( sName.isEmpty() )
sName = m_pParent->GetItemText( nItemId );
- sName = OutputDevice::GetNonMnemonicString( sName );
+ sName = removeMnemonicFromString( sName );
#if defined(_WIN32)
if ( m_pParent->GetAccelKey( nItemId ).GetName().getLength() )
sName += "\t" + m_pParent->GetAccelKey(nItemId).GetName();
@@ -206,28 +206,28 @@ OUString OAccessibleMenuItemComponent::GetItemText()
{
OUString sText;
if ( m_pParent )
- sText = OutputDevice::GetNonMnemonicString( m_pParent->GetItemText( m_pParent->GetItemId( m_nItemPos ) ) );
+ sText = removeMnemonicFromString( m_pParent->GetItemText( m_pParent->GetItemId( m_nItemPos ) ) );
return sText;
}
-void OAccessibleMenuItemComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void OAccessibleMenuItemComponent::FillAccessibleStateSet( sal_Int64& rStateSet )
{
bool bEnabled = IsEnabled();
if ( bEnabled )
{
- rStateSet.AddState( AccessibleStateType::ENABLED );
- rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ rStateSet |= AccessibleStateType::ENABLED;
+ rStateSet |= AccessibleStateType::SENSITIVE;
}
if ( IsVisible() )
{
- rStateSet.AddState( AccessibleStateType::SHOWING );
+ rStateSet |= AccessibleStateType::SHOWING;
if( !IsMenuHideDisabledEntries() || bEnabled )
- rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet |= AccessibleStateType::VISIBLE;
}
- rStateSet.AddState( AccessibleStateType::OPAQUE );
+ rStateSet |= AccessibleStateType::OPAQUE;
}
@@ -247,7 +247,7 @@ awt::Rectangle OAccessibleMenuItemComponent::implGetBounds()
vcl::Window* pWindow = m_pParent->GetWindow();
if ( pWindow )
{
- tools::Rectangle aRect = pWindow->GetWindowExtentsRelative( nullptr );
+ AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute();
awt::Point aWindowScreenLoc = AWTPoint( aRect.TopLeft() );
// get position of accessible parent in screen coordinates
@@ -287,7 +287,7 @@ void SAL_CALL OAccessibleMenuItemComponent::disposing()
// XAccessibleContext
-sal_Int32 OAccessibleMenuItemComponent::getAccessibleChildCount()
+sal_Int64 OAccessibleMenuItemComponent::getAccessibleChildCount()
{
OExternalLockGuard aGuard( this );
@@ -295,7 +295,7 @@ sal_Int32 OAccessibleMenuItemComponent::getAccessibleChildCount()
}
-Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleChild( sal_Int64 i )
{
OExternalLockGuard aGuard( this );
@@ -314,7 +314,7 @@ Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleParent( )
}
-sal_Int32 OAccessibleMenuItemComponent::getAccessibleIndexInParent( )
+sal_Int64 OAccessibleMenuItemComponent::getAccessibleIndexInParent( )
{
OExternalLockGuard aGuard( this );
@@ -354,9 +354,7 @@ Reference< XAccessibleRelationSet > OAccessibleMenuItemComponent::getAccessibleR
{
OExternalLockGuard aGuard( this );
- utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
- Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
- return xSet;
+ return new utl::AccessibleRelationSetHelper;
}
diff --git a/accessibility/source/standard/floatingwindowaccessible.cxx b/accessibility/source/standard/floatingwindowaccessible.cxx
index aa5ef41f6c79..ebfd0c506905 100644
--- a/accessibility/source/standard/floatingwindowaccessible.cxx
+++ b/accessibility/source/standard/floatingwindowaccessible.cxx
@@ -36,7 +36,7 @@ void FloatingWindowAccessible::FillAccessibleRelationSet(utl::AccessibleRelation
vcl::Window* pParentWindow = pWindow->GetParent();
if( pParentWindow )
{
- uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pParentWindow->GetAccessible() };
+ uno::Sequence<uno::Reference<css::accessibility::XAccessible>> aSequence { pParentWindow->GetAccessible() };
rRelationSet.AddRelation( AccessibleRelation( AccessibleRelationType::SUB_WINDOW_OF, aSequence ) );
}
}
diff --git a/accessibility/source/standard/svtaccessiblenumericfield.cxx b/accessibility/source/standard/svtaccessiblenumericfield.cxx
new file mode 100644
index 000000000000..f3192d4212f0
--- /dev/null
+++ b/accessibility/source/standard/svtaccessiblenumericfield.cxx
@@ -0,0 +1,110 @@
+/* -*- 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 <standard/svtaccessiblenumericfield.hxx>
+#include <comphelper/accessiblecontexthelper.hxx>
+#include <toolkit/awt/vclxwindows.hxx>
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+SVTXAccessibleNumericField::SVTXAccessibleNumericField(VCLXWindow* pVCLWindow)
+ : ImplInheritanceHelper(pVCLWindow)
+{
+}
+
+void SVTXAccessibleNumericField::ProcessWindowEvent(const VclWindowEvent& rVclWindowEvent)
+{
+ VCLXAccessibleEdit::ProcessWindowEvent(rVclWindowEvent);
+
+ if (rVclWindowEvent.GetId() == VclEventId::EditModify)
+ {
+ css::uno::Any aNewValue = getCurrentValue();
+ NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, css::uno::Any(), aNewValue);
+ }
+}
+
+sal_Int16 SVTXAccessibleNumericField::getAccessibleRole() { return AccessibleRole::SPIN_BOX; }
+
+css::uno::Any SAL_CALL SVTXAccessibleNumericField::getCurrentValue()
+{
+ OExternalLockGuard aGuard(this);
+
+ double dValue = 0;
+ SVTXNumericField* pField = static_cast<SVTXNumericField*>(GetVCLXWindow());
+ if (pField)
+ dValue = pField->getValue();
+
+ return css::uno::Any(dValue);
+}
+
+sal_Bool SVTXAccessibleNumericField::setCurrentValue(const css::uno::Any& aNumber)
+{
+ OExternalLockGuard aGuard(this);
+
+ SVTXNumericField* pField = static_cast<SVTXNumericField*>(GetVCLXWindow());
+ if (!pField)
+ return false;
+
+ double dValue = 0;
+ aNumber >>= dValue;
+ pField->setValue(dValue);
+ return true;
+}
+
+css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMaximumValue()
+{
+ OExternalLockGuard aGuard(this);
+
+ double dValue = 0;
+ SVTXNumericField* pField = static_cast<SVTXNumericField*>(GetVCLXWindow());
+ if (pField)
+ dValue = pField->getMax();
+
+ return css::uno::Any(dValue);
+}
+
+css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMinimumValue()
+{
+ OExternalLockGuard aGuard(this);
+
+ double dValue = 0;
+ SVTXNumericField* pField = static_cast<SVTXNumericField*>(GetVCLXWindow());
+ if (pField)
+ dValue = pField->getMin();
+
+ return css::uno::Any(dValue);
+}
+
+css::uno::Any SAL_CALL SVTXAccessibleNumericField::getMinimumIncrement()
+{
+ OExternalLockGuard aGuard(this);
+
+ double dValue = 0;
+ SVTXNumericField* pField = static_cast<SVTXNumericField*>(GetVCLXWindow());
+ if (pField)
+ dValue = pField->getSpinSize();
+
+ return css::uno::Any(dValue);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index d8edd7e206bf..43b9967ed51a 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -22,7 +22,6 @@
#include <standard/vclxaccessibleedit.hxx>
#include <standard/vclxaccessiblelist.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
@@ -39,7 +38,7 @@ using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::accessibility;
VCLXAccessibleBox::VCLXAccessibleBox (VCLXWindow* pVCLWindow, BoxType aType, bool bIsDropDownBox)
- : VCLXAccessibleComponent (pVCLWindow),
+ : ImplInheritanceHelper (pVCLWindow),
m_aBoxType (aType),
m_bIsDropDownBox (bIsDropDownBox)
{
@@ -53,6 +52,8 @@ VCLXAccessibleBox::VCLXAccessibleBox (VCLXWindow* pVCLWindow, BoxType aType, boo
m_bHasTextChild = true;
}
+VCLXAccessibleBox::~VCLXAccessibleBox() {}
+
void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent )
{
uno::Any aOldValue, aNewValue;
@@ -69,26 +70,26 @@ void VCLXAccessibleBox::ProcessWindowChildEvent( const VclWindowEvent& rVclWindo
if (m_aBoxType==COMBOBOX)
{
VclPtr< ComboBox > pComboBox = GetAs< ComboBox >();
- if ( ( pComboBox != nullptr ) && ( pChildWindow != nullptr ) )
- if (pChildWindow == pComboBox->GetSubEdit())
+ if (pComboBox && pChildWindow && pChildWindow == pComboBox->GetSubEdit()
+ && m_xText.is())
+ {
+ if (rVclWindowEvent.GetId() == VclEventId::WindowShow)
{
- if (rVclWindowEvent.GetId() == VclEventId::WindowShow)
- {
- // Instantiate text field.
- getAccessibleChild (0);
- aNewValue <<= m_xText;
- }
- else
- {
- // Release text field.
- aOldValue <<= m_xText;
- m_xText = nullptr;
- }
- // Tell the listeners about the new/removed child.
- NotifyAccessibleEvent (
- AccessibleEventId::CHILD,
- aOldValue, aNewValue);
+ // Instantiate text field.
+ getAccessibleChild (0);
+ aNewValue <<= m_xText;
}
+ else
+ {
+ // Release text field.
+ aOldValue <<= m_xText;
+ m_xText = nullptr;
+ }
+ // Tell the listeners about the new/removed child.
+ NotifyAccessibleEvent (
+ AccessibleEventId::CHILD,
+ aOldValue, aNewValue);
+ }
}
}
@@ -107,15 +108,13 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
case VclEventId::ListboxSelect:
{
// Forward the call to the list child.
- VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
- if ( pList == nullptr )
+ if (!m_xList.is())
{
getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
- pList = static_cast<VCLXAccessibleList*>(m_xList.get());
}
- if ( pList != nullptr )
+ if (m_xList.is())
{
- pList->ProcessWindowEvent (rVclWindowEvent, m_bIsDropDownBox);
+ m_xList->ProcessWindowEvent(rVclWindowEvent, m_bIsDropDownBox);
#if defined(_WIN32)
if (m_bIsDropDownBox)
{
@@ -127,30 +126,26 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
}
case VclEventId::DropdownOpen:
{
- VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
- if ( pList == nullptr )
+ if (!m_xList.is())
{
getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
- pList = static_cast<VCLXAccessibleList*>(m_xList.get());
}
- if ( pList != nullptr )
+ if (m_xList.is())
{
- pList->ProcessWindowEvent (rVclWindowEvent);
- pList->HandleDropOpen();
+ m_xList->ProcessWindowEvent(rVclWindowEvent);
+ m_xList->HandleDropOpen();
}
break;
}
case VclEventId::DropdownClose:
{
- VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
- if ( pList == nullptr )
+ if (!m_xList.is())
{
getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
- pList = static_cast<VCLXAccessibleList*>(m_xList.get());
}
- if ( pList != nullptr )
+ if (m_xList.is())
{
- pList->ProcessWindowEvent (rVclWindowEvent);
+ m_xList->ProcessWindowEvent(rVclWindowEvent);
}
VclPtr<vcl::Window> pWindow = GetWindow();
if( pWindow && (pWindow->HasFocus() || pWindow->HasChildPathFocus()) )
@@ -163,8 +158,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
}
case VclEventId::ComboboxSelect:
{
- VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
- if (pList != nullptr && m_xText.is())
+ if (m_xList.is() && m_xText.is())
{
Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
if ( xText.is() )
@@ -172,7 +166,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
OUString sText = xText->getSelectedText();
if ( sText.isEmpty() )
sText = xText->getText();
- pList->UpdateSelection_Acc(sText, m_bIsDropDownBox);
+ m_xList->UpdateSelection_Acc(sText, m_bIsDropDownBox);
#if defined(_WIN32)
if (m_bIsDropDownBox || m_aBoxType==COMBOBOX)
NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, Any(), Any());
@@ -192,14 +186,12 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
case VclEventId::ComboboxItemRemoved:
{
// Forward the call to the list child.
- VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
- if ( pList == nullptr )
+ if (!m_xList.is())
{
getAccessibleChild ( m_bHasTextChild ? 1 : 0 );
- pList = static_cast<VCLXAccessibleList*>(m_xList.get());
}
- if ( pList != nullptr )
- pList->ProcessWindowEvent (rVclWindowEvent);
+ if (m_xList.is())
+ m_xList->ProcessWindowEvent(rVclWindowEvent);
break;
}
@@ -210,8 +202,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
// the same VCL object as this box does. In case of the
// combobox, however, we have to help by providing the list with
// the text of the currently selected item.
- VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
- if (pList != nullptr && m_xText.is())
+ if (m_xList.is() && m_xText.is())
{
Reference<XAccessibleText> xText (m_xText->getAccessibleContext(), UNO_QUERY);
if ( xText.is() )
@@ -219,7 +210,7 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
OUString sText = xText->getSelectedText();
if ( sText.isEmpty() )
sText = xText->getText();
- pList->UpdateSelection (sText);
+ m_xList->UpdateSelection(sText);
}
}
break;
@@ -247,9 +238,6 @@ void VCLXAccessibleBox::ProcessWindowEvent (const VclWindowEvent& rVclWindowEven
}
}
-IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleBox, VCLXAccessibleComponent, VCLXAccessibleBox_BASE)
-IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleBox, VCLXAccessibleComponent, VCLXAccessibleBox_BASE)
-
//===== XAccessible =========================================================
Reference< XAccessibleContext > SAL_CALL VCLXAccessibleBox::getAccessibleContext( )
@@ -261,7 +249,7 @@ Reference< XAccessibleContext > SAL_CALL VCLXAccessibleBox::getAccessibleContext
//===== XAccessibleContext ==================================================
-sal_Int32 VCLXAccessibleBox::getAccessibleChildCount()
+sal_Int64 VCLXAccessibleBox::getAccessibleChildCount()
{
SolarMutexGuard aSolarGuard;
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
@@ -269,12 +257,12 @@ sal_Int32 VCLXAccessibleBox::getAccessibleChildCount()
return implGetAccessibleChildCount();
}
-sal_Int32 VCLXAccessibleBox::implGetAccessibleChildCount()
+sal_Int64 VCLXAccessibleBox::implGetAccessibleChildCount()
{
// Usually a box has a text field and a list of items as its children.
// Non drop down list boxes have no text field. Additionally check
// whether the object is valid.
- sal_Int32 nCount = 0;
+ sal_Int64 nCount = 0;
if (IsValid())
nCount += (m_bHasTextChild?1:0) + (m_bHasListChild?1:0);
else
@@ -289,7 +277,7 @@ sal_Int32 VCLXAccessibleBox::implGetAccessibleChildCount()
return nCount;
}
-Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32 i)
+Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int64 i)
{
SolarMutexGuard aSolarGuard;
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
@@ -305,11 +293,10 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32
// List.
if ( ! m_xList.is())
{
- VCLXAccessibleList* pList = new VCLXAccessibleList ( GetVCLXWindow(),
+ m_xList = new VCLXAccessibleList(GetVCLXWindow(),
(m_aBoxType == LISTBOX ? VCLXAccessibleList::LISTBOX : VCLXAccessibleList::COMBOBOX),
this);
- pList->SetIndexInParent (i);
- m_xList = pList;
+ m_xList->SetIndexInParent(i);
}
xChild = m_xList;
}
@@ -376,7 +363,7 @@ sal_Bool SAL_CALL VCLXAccessibleBox::doAccessibleAction (sal_Int32 nIndex)
("VCLXAccessibleBox::doAccessibleAction: index "
+ OUString::number(nIndex) + " not among 0.."
+ OUString::number(getAccessibleActionCount())),
- static_cast<OWeakObject*>(this));
+ getXWeak());
if (m_aBoxType == COMBOBOX)
{
@@ -445,13 +432,11 @@ Any VCLXAccessibleBox::getCurrentValue( )
}
if (m_aBoxType == LISTBOX && m_bIsDropDownBox && m_xList.is() )
{
-
- VCLXAccessibleList* pList = static_cast<VCLXAccessibleList*>(m_xList.get());
- if(pList->IsInDropDown())
+ if (m_xList->IsInDropDown())
{
- if(pList->getSelectedAccessibleChildCount()>0)
+ if (m_xList->getSelectedAccessibleChildCount() > 0)
{
- Reference<XAccessibleContext> xName (pList->getSelectedAccessibleChild(sal_Int32(0)), UNO_QUERY);
+ Reference<XAccessibleContext> xName (m_xList->getSelectedAccessibleChild(sal_Int64(0)), UNO_QUERY);
if(xName.is())
{
aAny <<= xName->getAccessibleName();
@@ -486,8 +471,13 @@ Any VCLXAccessibleBox::getMinimumValue( )
return aAny;
}
+Any VCLXAccessibleBox::getMinimumIncrement( )
+{
+ return Any();
+}
+
// Set the INDETERMINATE state when there is no selected item for combobox
-void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleBox::FillAccessibleStateSet( sal_Int64& rStateSet )
{
VCLXAccessibleComponent::FillAccessibleStateSet(rStateSet);
if (m_aBoxType == COMBOBOX )
@@ -503,7 +493,7 @@ void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& r
nEntryCount = pComboBox->GetEntryCount();
}
if ( sText.isEmpty() && nEntryCount > 0 )
- rStateSet.AddState(AccessibleStateType::INDETERMINATE);
+ rStateSet |= AccessibleStateType::INDETERMINATE;
}
else if (m_aBoxType == LISTBOX && m_bIsDropDownBox)
{
@@ -512,7 +502,7 @@ void VCLXAccessibleBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& r
{
sal_Int32 nSelectedEntryCount = pListBox->GetSelectedEntryCount();
if ( nSelectedEntryCount == 0)
- rStateSet.AddState(AccessibleStateType::INDETERMINATE);
+ rStateSet |= AccessibleStateType::INDETERMINATE;
}
}
}
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx
index f0ade105ce27..7ede9e02c808 100644
--- a/accessibility/source/standard/vclxaccessiblebutton.cxx
+++ b/accessibility/source/standard/vclxaccessiblebutton.cxx
@@ -21,7 +21,7 @@
#include <helper/accresmgr.hxx>
#include <strings.hrc>
-#include <unotools/accessiblestatesethelper.hxx>
+#include <comphelper/accessiblecontexthelper.hxx>
#include <comphelper/accessiblekeybindinghelper.hxx>
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -29,14 +29,13 @@
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <strings.hxx>
-#include <vcl/button.hxx>
+#include <vcl/toolkit/button.hxx>
#include <vcl/event.hxx>
#include <vcl/vclevent.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::accessibility;
using namespace ::comphelper;
@@ -68,7 +67,7 @@ void VCLXAccessibleButton::ProcessWindowEvent( const VclWindowEvent& rVclWindowE
}
-void VCLXAccessibleButton::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleButton::FillAccessibleStateSet( sal_Int64& rStateSet )
{
VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
@@ -76,50 +75,41 @@ void VCLXAccessibleButton::FillAccessibleStateSet( utl::AccessibleStateSetHelper
if ( !pButton )
return;
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
+
+ if (pButton->isToggleButton())
+ rStateSet |= AccessibleStateType::CHECKABLE;
if ( pButton->GetState() == TRISTATE_TRUE )
- rStateSet.AddState( AccessibleStateType::CHECKED );
+ rStateSet |= AccessibleStateType::CHECKED;
if ( pButton->IsPressed() )
- rStateSet.AddState( AccessibleStateType::PRESSED );
+ rStateSet |= AccessibleStateType::PRESSED;
// IA2 CWS: if the button has a popup menu, it should has the state EXPANDABLE
if( pButton->GetType() == WindowType::MENUBUTTON )
{
- rStateSet.AddState( AccessibleStateType::EXPANDABLE );
+ rStateSet |= AccessibleStateType::EXPANDABLE;
}
if( pButton->GetStyle() & WB_DEFBUTTON )
{
- rStateSet.AddState( AccessibleStateType::DEFAULT );
+ rStateSet |= AccessibleStateType::DEFAULT;
}
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleButton, VCLXAccessibleTextComponent, VCLXAccessibleButton_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleButton, VCLXAccessibleTextComponent, VCLXAccessibleButton_BASE )
-
-
// XServiceInfo
OUString VCLXAccessibleButton::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleButton";
+ return u"com.sun.star.comp.toolkit.AccessibleButton"_ustr;
}
Sequence< OUString > VCLXAccessibleButton::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleButton" };
+ return { u"com.sun.star.awt.AccessibleButton"_ustr };
}
@@ -179,7 +169,18 @@ sal_Bool VCLXAccessibleButton::doAccessibleAction ( sal_Int32 nIndex )
VclPtr< PushButton > pButton = GetAs< PushButton >();
if ( pButton )
- pButton->Click();
+ {
+ if (pButton->isToggleButton())
+ {
+ // PushButton::Click doesn't toggle when it's a toggle button
+ pButton->Check(!pButton->IsChecked());
+ pButton->Toggle();
+ }
+ else
+ {
+ pButton->Click();
+ }
+ }
return true;
}
@@ -203,8 +204,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyB
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
- OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
- Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+ rtl::Reference<OAccessibleKeyBindingHelper> pKeyBindingHelper = new OAccessibleKeyBindingHelper();
VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
@@ -230,7 +230,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyB
}
}
- return xKeyBinding;
+ return pKeyBindingHelper;
}
@@ -297,5 +297,15 @@ Any VCLXAccessibleButton::getMinimumValue( )
return aValue;
}
+Any VCLXAccessibleButton::getMinimumIncrement( )
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= sal_Int32(1);
+
+ return aValue;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index a15ae4013ceb..018878714e8a 100644
--- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -23,7 +23,7 @@
#include <helper/accresmgr.hxx>
#include <strings.hrc>
-#include <unotools/accessiblestatesethelper.hxx>
+#include <comphelper/accessiblecontexthelper.hxx>
#include <comphelper/accessiblekeybindinghelper.hxx>
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -37,7 +37,6 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::accessibility;
using namespace ::comphelper;
@@ -46,7 +45,7 @@ using namespace ::comphelper;
VCLXAccessibleCheckBox::VCLXAccessibleCheckBox( VCLXWindow* pVCLWindow )
- :VCLXAccessibleTextComponent( pVCLWindow )
+ :ImplInheritanceHelper( pVCLWindow )
{
m_bChecked = IsChecked();
m_bIndeterminate = IsIndeterminate();
@@ -123,44 +122,33 @@ void VCLXAccessibleCheckBox::ProcessWindowEvent( const VclWindowEvent& rVclWindo
}
-void VCLXAccessibleCheckBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleCheckBox::FillAccessibleStateSet( sal_Int64& rStateSet )
{
VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::CHECKABLE;
+ rStateSet |= AccessibleStateType::FOCUSABLE;
if ( IsChecked() )
- rStateSet.AddState( AccessibleStateType::CHECKED );
+ rStateSet |= AccessibleStateType::CHECKED;
if ( IsIndeterminate() )
- rStateSet.AddState( AccessibleStateType::INDETERMINATE );
+ rStateSet |= AccessibleStateType::INDETERMINATE;
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleCheckBox, VCLXAccessibleTextComponent, VCLXAccessibleCheckBox_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleCheckBox, VCLXAccessibleTextComponent, VCLXAccessibleCheckBox_BASE )
-
-
// XServiceInfo
OUString VCLXAccessibleCheckBox::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleCheckBox";
+ return u"com.sun.star.comp.toolkit.AccessibleCheckBox"_ustr;
}
Sequence< OUString > VCLXAccessibleCheckBox::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleCheckBox" };
+ return { u"com.sun.star.awt.AccessibleCheckBox"_ustr };
}
@@ -226,8 +214,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKe
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
- OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
- Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+ rtl::Reference<OAccessibleKeyBindingHelper> pKeyBindingHelper = new OAccessibleKeyBindingHelper();
VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
@@ -253,7 +240,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKe
}
}
- return xKeyBinding;
+ return pKeyBindingHelper;
}
@@ -329,5 +316,15 @@ Any VCLXAccessibleCheckBox::getMinimumValue( )
return aValue;
}
+Any VCLXAccessibleCheckBox::getMinimumIncrement( )
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= sal_Int32(1);
+
+ return aValue;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblecombobox.cxx b/accessibility/source/standard/vclxaccessiblecombobox.cxx
index e537f7199eaa..8b239996599d 100644
--- a/accessibility/source/standard/vclxaccessiblecombobox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecombobox.cxx
@@ -18,12 +18,11 @@
*/
#include <standard/vclxaccessiblecombobox.hxx>
+#include <comphelper/sequence.hxx>
#include <vcl/window.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::accessibility;
VCLXAccessibleComboBox::VCLXAccessibleComboBox (VCLXWindow* pVCLWindow)
@@ -41,14 +40,14 @@ bool VCLXAccessibleComboBox::IsValid() const
OUString VCLXAccessibleComboBox::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleComboBox";
+ return u"com.sun.star.comp.toolkit.AccessibleComboBox"_ustr;
}
Sequence< OUString > VCLXAccessibleComboBox::getSupportedServiceNames()
{
return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(),
- Sequence<OUString>{"com.sun.star.accessibility.AccessibleComboBox"});
+ Sequence<OUString>{u"com.sun.star.accessibility.AccessibleComboBox"_ustr});
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
index 97fcebb04a2b..903e704b92bf 100644
--- a/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
+++ b/accessibility/source/standard/vclxaccessibledropdowncombobox.cxx
@@ -19,14 +19,13 @@
#include <standard/vclxaccessibledropdowncombobox.hxx>
+#include <comphelper/sequence.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <vcl/vclevent.hxx>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::accessibility;
VCLXAccessibleDropDownComboBox::VCLXAccessibleDropDownComboBox (VCLXWindow* pVCLWindow)
@@ -60,14 +59,14 @@ void VCLXAccessibleDropDownComboBox::ProcessWindowEvent (const VclWindowEvent& r
OUString VCLXAccessibleDropDownComboBox::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleDropDownComboBox";
+ return u"com.sun.star.comp.toolkit.AccessibleDropDownComboBox"_ustr;
}
Sequence< OUString > VCLXAccessibleDropDownComboBox::getSupportedServiceNames()
{
return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(),
- Sequence<OUString>{"com.sun.star.accessibility.AccessibleDropDownComboBox"});
+ Sequence<OUString>{u"com.sun.star.accessibility.AccessibleDropDownComboBox"_ustr});
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
index 2bee1b51f8fc..5d1c206f1737 100644
--- a/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
+++ b/accessibility/source/standard/vclxaccessibledropdownlistbox.cxx
@@ -17,16 +17,12 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-
#include <standard/vclxaccessibledropdownlistbox.hxx>
-
+#include <comphelper/sequence.hxx>
#include <toolkit/awt/vclxwindow.hxx>
-
using namespace ::com::sun::star;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::accessibility;
VCLXAccessibleDropDownListBox::VCLXAccessibleDropDownListBox (VCLXWindow* pVCLWindow)
@@ -34,25 +30,21 @@ VCLXAccessibleDropDownListBox::VCLXAccessibleDropDownListBox (VCLXWindow* pVCLWi
{
}
-
bool VCLXAccessibleDropDownListBox::IsValid() const
{
return GetWindow();
}
-
// XServiceInfo
-
OUString VCLXAccessibleDropDownListBox::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleDropDownListBox";
+ return u"com.sun.star.comp.toolkit.AccessibleDropDownListBox"_ustr;
}
-
Sequence< OUString > VCLXAccessibleDropDownListBox::getSupportedServiceNames()
{
return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(),
- Sequence<OUString>{"com.sun.star.accessibility.AccessibleDropDownListBox"});
+ Sequence<OUString>{u"com.sun.star.accessibility.AccessibleDropDownListBox"_ustr});
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessibleedit.cxx b/accessibility/source/standard/vclxaccessibleedit.cxx
index 56fe32010939..5943b4c8c745 100644
--- a/accessibility/source/standard/vclxaccessibleedit.cxx
+++ b/accessibility/source/standard/vclxaccessibleedit.cxx
@@ -22,16 +22,17 @@
#include <toolkit/awt/vclxwindows.hxx>
#include <toolkit/helper/convert.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#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>
+#include <vcl/mnemonic.hxx>
#include <vcl/settings.hxx>
#include <vcl/toolkit/edit.hxx>
#include <vcl/toolkit/vclmedit.hxx>
@@ -55,7 +56,7 @@ using namespace ::comphelper;
VCLXAccessibleEdit::VCLXAccessibleEdit( VCLXWindow* pVCLWindow )
- :VCLXAccessibleTextComponent( pVCLWindow )
+ :ImplInheritanceHelper( pVCLWindow )
{
m_nCaretPosition = getCaretPosition();
}
@@ -103,17 +104,22 @@ void VCLXAccessibleEdit::ProcessWindowEvent( const VclWindowEvent& rVclWindowEve
}
-void VCLXAccessibleEdit::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleEdit::FillAccessibleStateSet( sal_Int64& rStateSet )
{
VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
- VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
- if ( pVCLXEdit )
+ VCLXWindow* pVCLXWindow = GetVCLXWindow();
+ if (pVCLXWindow)
{
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
- rStateSet.AddState( AccessibleStateType::SINGLE_LINE );
- if ( pVCLXEdit->isEditable() )
- rStateSet.AddState( AccessibleStateType::EDITABLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
+
+ if (GetWindow() && GetWindow()->GetType() == WindowType::MULTILINEEDIT)
+ rStateSet |= AccessibleStateType::MULTI_LINE;
+ else
+ rStateSet |= AccessibleStateType::SINGLE_LINE;
+
+ if (isEditable())
+ rStateSet |= AccessibleStateType::EDITABLE;
}
}
@@ -128,14 +134,14 @@ OUString VCLXAccessibleEdit::implGetText()
VclPtr< Edit > pEdit = GetAs< Edit >();
if ( pEdit )
{
- aText = OutputDevice::GetNonMnemonicString( pEdit->GetText() );
+ aText = removeMnemonicFromString( pEdit->GetText() );
if ( implGetAccessibleRole() == AccessibleRole::PASSWORD_TEXT )
{
sal_Unicode cEchoChar = pEdit->GetEchoChar();
if ( !cEchoChar )
cEchoChar = '*';
- OUStringBuffer sTmp;
+ OUStringBuffer sTmp(aText.getLength());
aText = comphelper::string::padToLength(sTmp, aText.getLength(),
cEchoChar).makeStringAndClear();
}
@@ -147,47 +153,35 @@ OUString VCLXAccessibleEdit::implGetText()
void VCLXAccessibleEdit::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
{
- awt::Selection aSelection;
- VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
- if ( pVCLXEdit )
- aSelection = pVCLXEdit->getSelection();
+ Selection aSelection;
+ VclPtr<Edit> pEdit = GetAs<Edit>();
+ if (pEdit)
+ aSelection = pEdit->GetSelection();
- nStartIndex = aSelection.Min;
- nEndIndex = aSelection.Max;
+ nStartIndex = aSelection.Min();
+ nEndIndex = aSelection.Max();
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleEdit, VCLXAccessibleTextComponent, VCLXAccessibleEdit_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleEdit, VCLXAccessibleTextComponent, VCLXAccessibleEdit_BASE )
-
-
// XServiceInfo
OUString VCLXAccessibleEdit::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleEdit";
+ return u"com.sun.star.comp.toolkit.AccessibleEdit"_ustr;
}
Sequence< OUString > VCLXAccessibleEdit::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleEdit" };
+ return { u"com.sun.star.awt.AccessibleEdit"_ustr };
}
// XAccessibleContext
-sal_Int32 VCLXAccessibleEdit::getAccessibleChildCount()
+sal_Int64 VCLXAccessibleEdit::getAccessibleChildCount()
{
OExternalLockGuard aGuard( this );
@@ -195,7 +189,7 @@ sal_Int32 VCLXAccessibleEdit::getAccessibleChildCount()
}
-Reference< XAccessible > VCLXAccessibleEdit::getAccessibleChild( sal_Int32 )
+Reference< XAccessible > VCLXAccessibleEdit::getAccessibleChild( sal_Int64 )
{
throw IndexOutOfBoundsException();
}
@@ -301,6 +295,7 @@ Sequence< PropertyValue > VCLXAccessibleEdit::getCharacterAttributes( sal_Int32
{
OExternalLockGuard aGuard( this );
Sequence< PropertyValue > aProperties = VCLXAccessibleTextComponent::getCharacterAttributes( nIndex, aRequestedAttributes );
+ auto aNonConstRange = asNonConstRange(aProperties);
// Handle multiline edit character properties
VclPtr<VclMultiLineEdit> pMulitLineEdit = GetAsDynamic< VclMultiLineEdit >();
@@ -311,7 +306,7 @@ Sequence< PropertyValue > VCLXAccessibleEdit::getCharacterAttributes( sal_Int32
const TextAttribFontColor* pFontColor = static_cast<const TextAttribFontColor* >(pTextEngine->FindAttrib( aCursor, TEXTATTR_FONTCOLOR ));
if ( pFontColor )
{
- for (PropertyValue& aValue : aProperties )
+ for (PropertyValue& aValue : aNonConstRange )
{
if (aValue.Name == "CharColor")
{
@@ -323,7 +318,7 @@ Sequence< PropertyValue > VCLXAccessibleEdit::getCharacterAttributes( sal_Int32
}
// Set default character color if it is not set yet to a valid value
- for (PropertyValue& aValue : aProperties )
+ for (PropertyValue& aValue : aNonConstRange )
{
if (aValue.Name == "CharColor")
{
@@ -425,11 +420,10 @@ sal_Bool VCLXAccessibleEdit::setSelection( sal_Int32 nStartIndex, sal_Int32 nEnd
if ( !implIsValidRange( nStartIndex, nEndIndex, sText.getLength() ) )
throw IndexOutOfBoundsException();
- VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
VclPtr< Edit > pEdit = GetAs< Edit >();
- if ( pVCLXEdit && pEdit && pEdit->IsEnabled() )
+ if (pEdit && pEdit->IsEnabled())
{
- pVCLXEdit->setSelection( awt::Selection( nStartIndex, nEndIndex ) );
+ pEdit->SetSelection(Selection(nStartIndex, nEndIndex));
bReturn = true;
}
@@ -561,10 +555,12 @@ sal_Bool VCLXAccessibleEdit::replaceText( sal_Int32 nStartIndex, sal_Int32 nEndI
sal_Int32 nMinIndex = std::min( nStartIndex, nEndIndex );
sal_Int32 nMaxIndex = std::max( nStartIndex, nEndIndex );
- VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
- if ( pVCLXEdit && pVCLXEdit->isEditable() )
+
+ if (isEditable())
{
- pVCLXEdit->setText( sText.replaceAt( nMinIndex, nMaxIndex - nMinIndex, sReplacement ) );
+ VclPtr<Edit> pEdit = GetAs<Edit>();
+ assert(pEdit);
+ pEdit->SetText(sText.replaceAt(nMinIndex, nMaxIndex - nMinIndex, sReplacement));
sal_Int32 nIndex = nMinIndex + sReplacement.getLength();
setSelection( nIndex, nIndex );
bReturn = true;
@@ -591,17 +587,23 @@ sal_Bool VCLXAccessibleEdit::setText( const OUString& sText )
bool bReturn = false;
- VCLXEdit* pVCLXEdit = static_cast< VCLXEdit* >( GetVCLXWindow() );
- if ( pVCLXEdit && pVCLXEdit->isEditable() )
+ if (isEditable())
{
- pVCLXEdit->setText( sText );
+ VclPtr<Edit> pEdit = GetAs<Edit>();
+ assert(pEdit);
+ pEdit->SetText(sText);
sal_Int32 nSize = sText.getLength();
- pVCLXEdit->setSelection( awt::Selection( nSize, nSize ) );
+ pEdit->SetSelection(Selection(nSize, nSize) );
bReturn = true;
}
return bReturn;
}
+bool VCLXAccessibleEdit::isEditable()
+{
+ VclPtr<Edit> pEdit = GetAs<Edit>();
+ return pEdit && !pEdit->IsReadOnly() && pEdit->IsEnabled();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx b/accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx
index 9e2874365210..ee51ad89cddf 100644
--- a/accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx
+++ b/accessibility/source/standard/vclxaccessiblefixedhyperlink.cxx
@@ -27,12 +27,12 @@ using namespace ::com::sun::star;
OUString VCLXAccessibleFixedHyperlink::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleFixedHyperlink";
+ return u"com.sun.star.comp.toolkit.AccessibleFixedHyperlink"_ustr;
}
uno::Sequence<OUString> VCLXAccessibleFixedHyperlink::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleFixedHyperlink" };
+ return { u"com.sun.star.awt.AccessibleFixedHyperlink"_ustr };
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblefixedtext.cxx b/accessibility/source/standard/vclxaccessiblefixedtext.cxx
index b62faded5580..0bef3f3b9ffe 100644
--- a/accessibility/source/standard/vclxaccessiblefixedtext.cxx
+++ b/accessibility/source/standard/vclxaccessiblefixedtext.cxx
@@ -19,36 +19,33 @@
#include <standard/vclxaccessiblefixedtext.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
#include <vcl/window.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::accessibility;
// VCLXAccessibleFixedText
-void VCLXAccessibleFixedText::FillAccessibleStateSet(utl::AccessibleStateSetHelper& rStateSet)
+void VCLXAccessibleFixedText::FillAccessibleStateSet(sal_Int64& rStateSet)
{
VCLXAccessibleTextComponent::FillAccessibleStateSet(rStateSet);
if (GetWindow() && GetWindow()->GetStyle() & WB_WORDBREAK)
- rStateSet.AddState(AccessibleStateType::MULTI_LINE);
+ rStateSet |= AccessibleStateType::MULTI_LINE;
}
// XServiceInfo
OUString VCLXAccessibleFixedText::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleFixedText";
+ return u"com.sun.star.comp.toolkit.AccessibleFixedText"_ustr;
}
Sequence<OUString> VCLXAccessibleFixedText::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleFixedText" };
+ return { u"com.sun.star.awt.AccessibleFixedText"_ustr };
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessibleheaderbar.cxx b/accessibility/source/standard/vclxaccessibleheaderbar.cxx
index de5208b351de..2c8ad658b1ab 100644
--- a/accessibility/source/standard/vclxaccessibleheaderbar.cxx
+++ b/accessibility/source/standard/vclxaccessibleheaderbar.cxx
@@ -28,11 +28,8 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::accessibility;
-using namespace ::comphelper;
VCLXAccessibleHeaderBar::VCLXAccessibleHeaderBar(VCLXWindow* pVCLWindow)
: VCLXAccessibleComponent(pVCLWindow)
@@ -46,28 +43,28 @@ VCLXAccessibleHeaderBar::~VCLXAccessibleHeaderBar() {}
OUString VCLXAccessibleHeaderBar::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleHeaderBar";
+ return u"com.sun.star.comp.toolkit.AccessibleHeaderBar"_ustr;
}
Sequence<OUString> VCLXAccessibleHeaderBar::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleHeaderBar" };
+ return { u"com.sun.star.awt.AccessibleHeaderBar"_ustr };
}
// =======XAccessibleContext=======
-sal_Int32 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleChildCount()
+sal_Int64 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleChildCount()
{
SolarMutexGuard g;
- sal_Int32 nCount = 0;
+ sal_Int64 nCount = 0;
if (m_pHeadBar)
nCount = m_pHeadBar->GetItemCount();
return nCount;
}
css::uno::Reference<css::accessibility::XAccessible>
- SAL_CALL VCLXAccessibleHeaderBar::getAccessibleChild(sal_Int32 i)
+ SAL_CALL VCLXAccessibleHeaderBar::getAccessibleChild(sal_Int64 i)
{
SolarMutexGuard g;
diff --git a/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx b/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx
index a6fd0a7e3f8d..d3463f5cdae7 100644
--- a/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx
+++ b/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx
@@ -23,9 +23,9 @@
#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/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
@@ -52,19 +52,19 @@ VCLXAccessibleHeaderBarItem::~VCLXAccessibleHeaderBarItem()
{
}
-void VCLXAccessibleHeaderBarItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleHeaderBarItem::FillAccessibleStateSet( sal_Int64& rStateSet )
{
if ( m_pHeadBar )
{
if ( m_pHeadBar->IsEnabled() )
- rStateSet.AddState( AccessibleStateType::ENABLED );
+ rStateSet |= AccessibleStateType::ENABLED;
if ( m_pHeadBar->IsVisible() )
{
- rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet |= AccessibleStateType::VISIBLE;
}
- rStateSet.AddState( AccessibleStateType::SELECTABLE );
- rStateSet.AddState( AccessibleStateType::RESIZABLE );
+ rStateSet |= AccessibleStateType::SELECTABLE;
+ rStateSet |= AccessibleStateType::RESIZABLE;
}
}
@@ -81,18 +81,6 @@ awt::Rectangle VCLXAccessibleHeaderBarItem::implGetBounds()
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleHeaderBarItem, OAccessibleExtendedComponentHelper, VCLXAccessibleHeaderBarItem_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleHeaderBarItem, OAccessibleExtendedComponentHelper, VCLXAccessibleHeaderBarItem_BASE )
-
-
// XServiceInfo
OUString VCLXAccessibleHeaderBarItem::getImplementationName()
{
@@ -119,13 +107,13 @@ Reference< XAccessibleContext > VCLXAccessibleHeaderBarItem::getAccessibleContex
// XAccessibleContext
-sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleChildCount()
+sal_Int64 VCLXAccessibleHeaderBarItem::getAccessibleChildCount()
{
return 0;
}
-Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleChild( sal_Int64 i )
{
OExternalLockGuard aGuard( this );
@@ -150,7 +138,7 @@ Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleParent()
}
-sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleIndexInParent()
+sal_Int64 VCLXAccessibleHeaderBarItem::getAccessibleIndexInParent()
{
OExternalLockGuard aGuard( this );
return m_nIndexInParent - 1;
@@ -184,29 +172,26 @@ Reference< XAccessibleRelationSet > VCLXAccessibleHeaderBarItem::getAccessibleRe
{
OExternalLockGuard aGuard( this );
- utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
- Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
- return xSet;
+ return new utl::AccessibleRelationSetHelper;
}
-Reference< XAccessibleStateSet > VCLXAccessibleHeaderBarItem::getAccessibleStateSet( )
+sal_Int64 VCLXAccessibleHeaderBarItem::getAccessibleStateSet( )
{
OExternalLockGuard aGuard( this );
- utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
- Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+ sal_Int64 nStateSet = 0;
if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
{
- FillAccessibleStateSet( *pStateSetHelper );
+ FillAccessibleStateSet( nStateSet );
}
else
{
- pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ nStateSet |= AccessibleStateType::DEFUNC;
}
- return xSet;
+ return nStateSet;
}
diff --git a/accessibility/source/standard/vclxaccessiblelist.cxx b/accessibility/source/standard/vclxaccessiblelist.cxx
index 353312e6bbae..c001b59c42fc 100644
--- a/accessibility/source/standard/vclxaccessiblelist.cxx
+++ b/accessibility/source/standard/vclxaccessiblelist.cxx
@@ -22,12 +22,13 @@
#include <helper/listboxhelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
#include <o3tl/safeint.hxx>
#include <vcl/svapp.hxx>
#include <vcl/toolkit/combobox.hxx>
@@ -37,14 +38,13 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::accessibility;
using namespace ::accessibility;
namespace
{
/// @throws css::lang::IndexOutOfBoundsException
- void checkSelection_Impl( sal_Int32 _nIndex, const IComboListBoxHelper& _rListBox, bool bSelected )
+ void checkSelection_Impl( sal_Int64 _nIndex, const IComboListBoxHelper& _rListBox, bool bSelected )
{
sal_Int32 nCount = bSelected ? _rListBox.GetSelectedEntryCount()
: _rListBox.GetEntryCount();
@@ -55,7 +55,7 @@ namespace
VCLXAccessibleList::VCLXAccessibleList (VCLXWindow* pVCLWindow, BoxType aBoxType,
const Reference< XAccessible >& _xParent)
- : VCLXAccessibleComponent (pVCLWindow),
+ : ImplInheritanceHelper (pVCLWindow),
m_aBoxType (aBoxType),
m_nVisibleLineCount (0),
m_nIndexInParent (DEFAULT_INDEX_IN_PARENT),
@@ -107,14 +107,24 @@ void SAL_CALL VCLXAccessibleList::disposing()
{
VCLXAccessibleComponent::disposing();
+ disposeChildren();
+ m_pListBoxHelper.reset();
+}
+
+void VCLXAccessibleList::disposeChildren()
+{
// Dispose all items in the list.
- m_aAccessibleChildren.clear();
+ for (rtl::Reference<VCLXAccessibleListItem>& rxChild : m_aAccessibleChildren)
+ {
+ if (rxChild.is())
+ rxChild->dispose();
+ }
- m_pListBoxHelper.reset();
+ m_aAccessibleChildren.clear();
}
-void VCLXAccessibleList::FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet)
+void VCLXAccessibleList::FillAccessibleStateSet (sal_Int64& rStateSet)
{
SolarMutexGuard aSolarGuard;
@@ -124,8 +134,8 @@ void VCLXAccessibleList::FillAccessibleStateSet (utl::AccessibleStateSetHelper&
&& (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) == WB_DROPDOWN
&& !m_pListBoxHelper->IsInDropDown() )
{
- rStateSet.RemoveState (AccessibleStateType::VISIBLE);
- rStateSet.RemoveState (AccessibleStateType::SHOWING);
+ rStateSet &= ~AccessibleStateType::VISIBLE;
+ rStateSet &= ~AccessibleStateType::SHOWING;
m_bVisible = false;
}
@@ -135,10 +145,10 @@ void VCLXAccessibleList::FillAccessibleStateSet (utl::AccessibleStateSetHelper&
if ( m_pListBoxHelper )
{
if ( m_pListBoxHelper->IsMultiSelectionEnabled() )
- rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE);
- rStateSet.AddState (AccessibleStateType::FOCUSABLE);
+ rStateSet |= AccessibleStateType::MULTI_SELECTABLE;
+ rStateSet |= AccessibleStateType::FOCUSABLE;
// All children are transient.
- rStateSet.AddState (AccessibleStateType::MANAGES_DESCENDANTS);
+ rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS;
}
}
@@ -151,23 +161,22 @@ void VCLXAccessibleList::notifyVisibleStates(bool _bSetNew )
(_bSetNew ? aNewValue : aOldValue ) <<= AccessibleStateType::SHOWING;
NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
- ListItems::iterator aIter = m_aAccessibleChildren.begin();
+ auto aIter = m_aAccessibleChildren.begin();
UpdateVisibleLineCount();
// adjust the index inside the VCLXAccessibleListItem
for ( ; aIter != m_aAccessibleChildren.end(); )
{
- Reference< XAccessible > xHold = *aIter;
- if (!xHold.is())
+ rtl::Reference<VCLXAccessibleListItem> xChild = *aIter;
+ if (!xChild.is())
{
aIter = m_aAccessibleChildren.erase(aIter);
}
else
{
- VCLXAccessibleListItem* pItem = static_cast<VCLXAccessibleListItem*>(xHold.get());
const sal_Int32 nTopEntry = m_pListBoxHelper ? m_pListBoxHelper->GetTopEntry() : 0;
const sal_Int32 nPos = static_cast<sal_Int32>(aIter - m_aAccessibleChildren.begin());
bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) );
- pItem->SetVisible( m_bVisible && bVisible );
+ xChild->SetVisible(m_bVisible && bVisible);
++aIter;
}
@@ -206,26 +215,24 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool bHasDropDownList)
{
sal_Int32 i=0;
m_nCurSelectedPos = LISTBOX_ENTRY_NOTFOUND;
- for ( const auto& rChild : m_aAccessibleChildren )
+ for (const rtl::Reference<VCLXAccessibleListItem>& rxChild : m_aAccessibleChildren)
{
- Reference< XAccessible > xHold = rChild;
- if ( xHold.is() )
+ if (rxChild.is())
{
- VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() );
// Retrieve the item's index from the list entry.
bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i);
if (bNowSelected)
m_nCurSelectedPos = i;
- if ( bNowSelected && !pItem->IsSelected() )
+ if (bNowSelected && !rxChild->IsSelected())
{
- xNewAcc = rChild;
+ xNewAcc = rxChild;
aNewValue <<= xNewAcc;
}
- else if ( pItem->IsSelected() )
+ else if (rxChild->IsSelected())
m_nLastSelectedPos = i;
- pItem->SetSelected( bNowSelected );
+ rxChild->SetSelected(bNowSelected);
}
else
{ // it could happen that a child was not created before
@@ -248,6 +255,12 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool bHasDropDownList)
}
}
+ // since an active descendant is the UI element with keyboard focus, only send
+ // ACTIVE_DESCENDANT_CHANGED if the listbox/combobox has focus
+ vcl::Window* pWindow = GetWindow();
+ assert(pWindow);
+ const bool bFocused = pWindow->HasChildPathFocus();
+
if (m_aBoxType == COMBOBOX)
{
//VCLXAccessibleDropDownComboBox
@@ -256,10 +269,13 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool bHasDropDownList)
{
if ( aNewValue.hasValue() || aOldValue.hasValue() )
{
- NotifyAccessibleEvent(
- AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
- aOldValue,
- aNewValue );
+ if (bFocused)
+ {
+ NotifyAccessibleEvent(
+ AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+ }
NotifyListItem(aNewValue);
}
@@ -274,10 +290,13 @@ void VCLXAccessibleList::UpdateSelection_Impl_Acc(bool bHasDropDownList)
{
if ( aNewValue.hasValue() || aOldValue.hasValue() )
{
- NotifyAccessibleEvent(
- AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
- aOldValue,
- aNewValue );
+ if (bFocused)
+ {
+ NotifyAccessibleEvent(
+ AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+ aOldValue,
+ aNewValue );
+ }
NotifyListItem(aNewValue);
}
@@ -330,7 +349,7 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve
if ( nPos == LISTBOX_ENTRY_NOTFOUND )
nPos = m_pListBoxHelper->GetTopEntry();
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
- aNewValue <<= CreateChild(nPos);
+ aNewValue <<= uno::Reference<XAccessible>(CreateChild(nPos));
NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
aOldValue,
aNewValue );
@@ -399,7 +418,7 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve
if ( nPos == LISTBOX_ENTRY_NOTFOUND )
nPos = m_pListBoxHelper->GetTopEntry();
if ( nPos != LISTBOX_ENTRY_NOTFOUND )
- aNewValue <<= CreateChild(nPos);
+ aNewValue <<= Reference<XAccessible>(CreateChild(nPos));
NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
aOldValue,
aNewValue );
@@ -420,7 +439,7 @@ void VCLXAccessibleList::ProcessWindowEvent (const VclWindowEvent& rVclWindowEve
{
if (m_pListBoxHelper && (m_pListBoxHelper->GetStyle() & WB_DROPDOWN ) != WB_DROPDOWN)
{
- uno::Sequence< uno::Reference< uno::XInterface > > aSequence { pBox->GetAccessible() };
+ uno::Sequence<uno::Reference<css::accessibility::XAccessible>> aSequence { pBox->GetAccessible() };
rRelationSet.AddRelation( com::sun::star::accessibility::AccessibleRelation( com::sun::star::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
}
}
@@ -453,9 +472,9 @@ void VCLXAccessibleList::UpdateSelection (std::u16string_view sTextOfSelectedIte
}
-Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 nPos)
+rtl::Reference<VCLXAccessibleListItem> VCLXAccessibleList::CreateChild(sal_Int32 nPos)
{
- Reference<XAccessible> xChild;
+ rtl::Reference<VCLXAccessibleListItem> xChild;
if ( o3tl::make_unsigned(nPos) >= m_aAccessibleChildren.size() )
{
@@ -484,14 +503,13 @@ Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 nPos)
bNowSelected = m_pListBoxHelper->IsEntryPosSelected(nPos);
if (bNowSelected)
m_nCurSelectedPos = nPos;
- VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >(xChild.get());
- pItem->SetSelected( bNowSelected );
+ xChild->SetSelected(bNowSelected);
// Set the child's VISIBLE state.
UpdateVisibleLineCount();
const sal_Int32 nTopEntry = m_pListBoxHelper ? m_pListBoxHelper->GetTopEntry() : 0;
bool bVisible = ( nPos>=nTopEntry && nPos<( nTopEntry + m_nVisibleLineCount ) );
- pItem->SetVisible( m_bVisible && bVisible );
+ xChild->SetVisible(m_bVisible && bVisible);
}
return xChild;
@@ -500,16 +518,12 @@ Reference<XAccessible> VCLXAccessibleList::CreateChild (sal_Int32 nPos)
void VCLXAccessibleList::HandleChangedItemList()
{
- m_aAccessibleChildren.clear();
+ disposeChildren();
NotifyAccessibleEvent (
AccessibleEventId::INVALIDATE_ALL_CHILDREN,
Any(), Any());
}
-
-IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE)
-IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleList, VCLXAccessibleComponent, VCLXAccessibleList_BASE)
-
// XAccessible
Reference<XAccessibleContext> SAL_CALL
@@ -521,14 +535,14 @@ Reference<XAccessibleContext> SAL_CALL
// XAccessibleContext
-sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleChildCount()
+sal_Int64 SAL_CALL VCLXAccessibleList::getAccessibleChildCount()
{
SolarMutexGuard aSolarGuard;
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
return implGetAccessibleChildCount();
}
-sal_Int32 VCLXAccessibleList::implGetAccessibleChildCount()
+sal_Int64 VCLXAccessibleList::implGetAccessibleChildCount()
{
sal_Int32 nCount = 0;
if ( m_pListBoxHelper )
@@ -537,7 +551,7 @@ sal_Int32 VCLXAccessibleList::implGetAccessibleChildCount()
return nCount;
}
-Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int32 i)
+Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int64 i)
{
SolarMutexGuard aSolarGuard;
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
@@ -547,7 +561,7 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleList::getAccessibleChild (sal_Int3
Reference< XAccessible > xChild;
// search for the child
- if ( i >= static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( o3tl::make_unsigned(i) >= m_aAccessibleChildren.size() )
xChild = CreateChild (i);
else
{
@@ -566,7 +580,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleList::getAccessibleParent( )
return m_xParent;
}
-sal_Int32 SAL_CALL VCLXAccessibleList::getAccessibleIndexInParent()
+sal_Int64 SAL_CALL VCLXAccessibleList::getAccessibleIndexInParent()
{
if (m_nIndexInParent != DEFAULT_INDEX_IN_PARENT)
return m_nIndexInParent;
@@ -624,14 +638,14 @@ void VCLXAccessibleList::UpdateEntryRange_Impl()
for (sal_Int32 i = nBegin; (i <= nEnd); ++i)
{
bool bVisible = ( i >= nTop && i < ( nTop + m_nVisibleLineCount ) );
- Reference< XAccessible > xHold;
+ rtl::Reference<VCLXAccessibleListItem> xChild;
if ( o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
- xHold = m_aAccessibleChildren[i];
+ xChild = m_aAccessibleChildren[i];
else if ( bVisible )
- xHold = CreateChild(i);
+ xChild = CreateChild(i);
- if ( xHold.is() )
- static_cast< VCLXAccessibleListItem* >( xHold.get() )->SetVisible( m_bVisible && bVisible );
+ if (xChild.is())
+ xChild->SetVisible(m_bVisible && bVisible);
}
}
@@ -668,26 +682,24 @@ void VCLXAccessibleList::UpdateSelection_Impl(sal_Int32)
{
sal_Int32 i=0;
m_nCurSelectedPos = LISTBOX_ENTRY_NOTFOUND;
- for ( const auto& rChild : m_aAccessibleChildren )
+ for (const rtl::Reference<VCLXAccessibleListItem>& rxChild : m_aAccessibleChildren)
{
- Reference< XAccessible > xHold = rChild;
- if ( xHold.is() )
+ if (rxChild.is())
{
- VCLXAccessibleListItem* pItem = static_cast< VCLXAccessibleListItem* >( xHold.get() );
// Retrieve the item's index from the list entry.
bool bNowSelected = m_pListBoxHelper->IsEntryPosSelected (i);
if (bNowSelected)
m_nCurSelectedPos = i;
- if ( bNowSelected && !pItem->IsSelected() )
+ if (bNowSelected && !rxChild->IsSelected())
{
- xNewAcc = rChild;
+ xNewAcc = rxChild;
aNewValue <<= xNewAcc;
}
- else if ( pItem->IsSelected() )
+ else if (rxChild->IsSelected())
m_nLastSelectedPos = i;
- pItem->SetSelected( bNowSelected );
+ rxChild->SetSelected(bNowSelected);
}
else
{ // it could happen that a child was not created before
@@ -724,7 +736,7 @@ void VCLXAccessibleList::UpdateSelection_Impl(sal_Int32)
// XAccessibleSelection
-void SAL_CALL VCLXAccessibleList::selectAccessibleChild( sal_Int32 nChildIndex )
+void SAL_CALL VCLXAccessibleList::selectAccessibleChild( sal_Int64 nChildIndex )
{
bool bNotify = false;
@@ -749,7 +761,7 @@ void SAL_CALL VCLXAccessibleList::selectAccessibleChild( sal_Int32 nChildIndex )
UpdateSelection_Impl();
}
-sal_Bool SAL_CALL VCLXAccessibleList::isAccessibleChildSelected( sal_Int32 nChildIndex )
+sal_Bool SAL_CALL VCLXAccessibleList::isAccessibleChildSelected( sal_Int64 nChildIndex )
{
SolarMutexGuard aSolarGuard;
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
@@ -808,18 +820,18 @@ void SAL_CALL VCLXAccessibleList::selectAllAccessibleChildren( )
UpdateSelection_Impl();
}
-sal_Int32 SAL_CALL VCLXAccessibleList::getSelectedAccessibleChildCount( )
+sal_Int64 SAL_CALL VCLXAccessibleList::getSelectedAccessibleChildCount( )
{
SolarMutexGuard aSolarGuard;
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
- sal_Int32 nCount = 0;
+ sal_Int64 nCount = 0;
if ( m_pListBoxHelper )
nCount = m_pListBoxHelper->GetSelectedEntryCount();
return nCount;
}
-Reference< XAccessible > SAL_CALL VCLXAccessibleList::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+Reference< XAccessible > SAL_CALL VCLXAccessibleList::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex )
{
SolarMutexGuard aSolarGuard;
::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
@@ -833,7 +845,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleList::getSelectedAccessibleChild
return nullptr;
}
-void SAL_CALL VCLXAccessibleList::deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
+void SAL_CALL VCLXAccessibleList::deselectAccessibleChild( sal_Int64 nSelectedChildIndex )
{
bool bNotify = false;
diff --git a/accessibility/source/standard/vclxaccessiblelistbox.cxx b/accessibility/source/standard/vclxaccessiblelistbox.cxx
index 26602167379a..591eada5112a 100644
--- a/accessibility/source/standard/vclxaccessiblelistbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblelistbox.cxx
@@ -18,13 +18,11 @@
*/
#include <standard/vclxaccessiblelistbox.hxx>
-
+#include <comphelper/sequence.hxx>
#include <toolkit/awt/vclxwindow.hxx>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::accessibility;
VCLXAccessibleListBox::VCLXAccessibleListBox (VCLXWindow* pVCLWindow)
: VCLXAccessibleBox (pVCLWindow, VCLXAccessibleBox::LISTBOX, false)
diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx b/accessibility/source/standard/vclxaccessiblelistitem.cxx
index 7f807c5e7240..31b889ebc3b5 100644
--- a/accessibility/source/standard/vclxaccessiblelistitem.cxx
+++ b/accessibility/source/standard/vclxaccessiblelistitem.cxx
@@ -29,11 +29,11 @@
#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <cppuhelper/supportsservice.hxx>
+#include <utility>
#include <vcl/svapp.hxx>
#include <vcl/toolkit/lstbox.hxx>
#include <vcl/unohelp2.hxx>
#include <vcl/settings.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <comphelper/accessibleeventnotifier.hxx>
#include <i18nlangtag/languagetag.hxx>
@@ -41,9 +41,9 @@
namespace
{
/// @throws css::lang::IndexOutOfBoundsException
- void checkIndex_Impl( sal_Int32 _nIndex, const OUString& _sText )
+ void checkIndex_Impl( sal_Int32 _nIndex, std::u16string_view _sText )
{
- if ( _nIndex < 0 || _nIndex > _sText.getLength() )
+ if ( _nIndex < 0 || _nIndex > static_cast<sal_Int32>(_sText.size()) )
throw css::lang::IndexOutOfBoundsException();
}
}
@@ -59,13 +59,12 @@ using namespace ::com::sun::star;
// Ctor() and Dtor()
-VCLXAccessibleListItem::VCLXAccessibleListItem(sal_Int32 _nIndexInParent, const rtl::Reference< VCLXAccessibleList >& _xParent)
- : VCLXAccessibleListItem_BASE(m_aMutex)
- , m_nIndexInParent(_nIndexInParent)
+VCLXAccessibleListItem::VCLXAccessibleListItem(sal_Int32 _nIndexInParent, rtl::Reference< VCLXAccessibleList > _xParent)
+ : m_nIndexInParent(_nIndexInParent)
, m_bSelected(false)
, m_bVisible(false)
, m_nClientId(0)
- , m_xParent(_xParent)
+ , m_xParent(std::move(_xParent))
{
assert(m_xParent.is());
::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent->getListBoxHelper();
@@ -142,26 +141,25 @@ Sequence< sal_Int8 > VCLXAccessibleListItem::getImplementationId()
// XComponent
-void SAL_CALL VCLXAccessibleListItem::disposing()
+void VCLXAccessibleListItem::disposing(std::unique_lock<std::mutex>& rGuard)
{
- comphelper::AccessibleEventNotifier::TClientId nId( 0 );
- Reference< XInterface > xEventSource;
- {
- ::osl::MutexGuard aGuard( m_aMutex );
-
- VCLXAccessibleListItem_BASE::disposing();
- m_sEntryText.clear();
- m_xParent = nullptr;
+ VCLXAccessibleListItem_BASE::disposing(rGuard);
- nId = m_nClientId;
- m_nClientId = 0;
- if ( nId )
- xEventSource = *this;
- }
+ m_sEntryText.clear();
+ m_xParent = nullptr;
+ comphelper::AccessibleEventNotifier::TClientId nId = m_nClientId;
+ m_nClientId = 0;
+ Reference< XInterface > xEventSource;
+ if ( nId )
+ xEventSource = *this;
// Send a disposing to all listeners.
if ( nId )
- comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
+ {
+ rGuard.unlock();
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nId, *this );
+ rGuard.lock();
+ }
}
// XServiceInfo
@@ -192,26 +190,25 @@ Reference< XAccessibleContext > SAL_CALL VCLXAccessibleListItem::getAccessibleCo
// XAccessibleContext
-sal_Int32 SAL_CALL VCLXAccessibleListItem::getAccessibleChildCount( )
+sal_Int64 SAL_CALL VCLXAccessibleListItem::getAccessibleChildCount( )
{
return 0;
}
-Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleChild( sal_Int32 )
+Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleChild( sal_Int64 )
{
return Reference< XAccessible >();
}
Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleParent( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
- return m_xParent.get();
+ return m_xParent;
}
-sal_Int32 SAL_CALL VCLXAccessibleListItem::getAccessibleIndexInParent( )
+sal_Int64 SAL_CALL VCLXAccessibleListItem::getAccessibleIndexInParent( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
return m_nIndexInParent;
}
@@ -229,7 +226,7 @@ OUString SAL_CALL VCLXAccessibleListItem::getAccessibleDescription( )
OUString SAL_CALL VCLXAccessibleListItem::getAccessibleName( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
// entry text == accessible name
return m_sEntryText;
@@ -237,48 +234,45 @@ OUString SAL_CALL VCLXAccessibleListItem::getAccessibleName( )
Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleListItem::getAccessibleRelationSet( )
{
- utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
- Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
- return xSet;
+ return new utl::AccessibleRelationSetHelper;
}
-Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleListItem::getAccessibleStateSet( )
+sal_Int64 SAL_CALL VCLXAccessibleListItem::getAccessibleStateSet( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
- utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
- Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
+ sal_Int64 nStateSet = 0;
- if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
+ if ( !m_bDisposed )
{
- pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
+ nStateSet |= AccessibleStateType::TRANSIENT;
::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr;
if (pListBoxHelper && pListBoxHelper->IsEnabled())
{
- pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
- pStateSetHelper->AddState( AccessibleStateType::ENABLED );
- pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ nStateSet |= AccessibleStateType::SELECTABLE;
+ nStateSet |= AccessibleStateType::ENABLED;
+ nStateSet |= AccessibleStateType::SENSITIVE;
}
if ( m_bSelected )
- pStateSetHelper->AddState( AccessibleStateType::SELECTED );
+ nStateSet |= AccessibleStateType::SELECTED;
if ( m_bVisible )
{
- pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
- pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ nStateSet |= AccessibleStateType::VISIBLE;
+ nStateSet |= AccessibleStateType::SHOWING;
}
}
else
- pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ nStateSet |= AccessibleStateType::DEFUNC;
- return xStateSet;
+ return nStateSet;
}
Locale SAL_CALL VCLXAccessibleListItem::getLocale( )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
return implGetLocale();
}
@@ -288,15 +282,15 @@ Locale SAL_CALL VCLXAccessibleListItem::getLocale( )
sal_Bool SAL_CALL VCLXAccessibleListItem::containsPoint( const awt::Point& _aPoint )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
bool bInside = false;
::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr;
if (pListBoxHelper)
{
tools::Rectangle aRect(pListBoxHelper->GetBoundingRectangle(static_cast<sal_uInt16>(m_nIndexInParent)));
- aRect.Move(-aRect.TopLeft().X(),-aRect.TopLeft().Y());
- bInside = aRect.IsInside( VCLPoint( _aPoint ) );
+ aRect.Move(-aRect.Left(), -aRect.Top());
+ bInside = aRect.Contains( VCLPoint( _aPoint ) );
}
return bInside;
}
@@ -309,7 +303,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleListItem::getAccessibleAtPoint(
awt::Rectangle SAL_CALL VCLXAccessibleListItem::getBounds( )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
awt::Rectangle aRect;
::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr;
@@ -322,7 +316,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleListItem::getBounds( )
awt::Point SAL_CALL VCLXAccessibleListItem::getLocation( )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
Point aPoint(0,0);
::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr;
@@ -337,7 +331,7 @@ awt::Point SAL_CALL VCLXAccessibleListItem::getLocation( )
awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
Point aPoint(0,0);
::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr;
@@ -345,7 +339,7 @@ awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( )
{
tools::Rectangle aRect = pListBoxHelper->GetBoundingRectangle(static_cast<sal_uInt16>(m_nIndexInParent));
aPoint = aRect.TopLeft();
- aPoint += pListBoxHelper->GetWindowExtentsRelative().TopLeft();
+ aPoint += Point(pListBoxHelper->GetWindowExtentsAbsolute().TopLeft());
}
return AWTPoint( aPoint );
}
@@ -353,7 +347,7 @@ awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( )
awt::Size SAL_CALL VCLXAccessibleListItem::getSize( )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
Size aSize;
::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr;
@@ -378,7 +372,7 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getCaretPosition()
sal_Bool SAL_CALL VCLXAccessibleListItem::setCaretPosition( sal_Int32 nIndex )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if ( !implIsValidRange( nIndex, nIndex, m_sEntryText.getLength() ) )
throw IndexOutOfBoundsException();
@@ -389,7 +383,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::setCaretPosition( sal_Int32 nIndex )
sal_Unicode SAL_CALL VCLXAccessibleListItem::getCharacter( sal_Int32 nIndex )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
return OCommonAccessibleText::implGetCharacter( m_sEntryText, nIndex );
}
@@ -397,7 +391,7 @@ sal_Unicode SAL_CALL VCLXAccessibleListItem::getCharacter( sal_Int32 nIndex )
Sequence< PropertyValue > SAL_CALL VCLXAccessibleListItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< OUString >& )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if ( !implIsValidIndex( nIndex, m_sEntryText.getLength() ) )
throw IndexOutOfBoundsException();
@@ -408,7 +402,7 @@ Sequence< PropertyValue > SAL_CALL VCLXAccessibleListItem::getCharacterAttribute
awt::Rectangle SAL_CALL VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nIndex )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if ( !implIsValidIndex( nIndex, m_sEntryText.getLength() ) )
throw IndexOutOfBoundsException();
@@ -428,8 +422,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nI
sal_Int32 SAL_CALL VCLXAccessibleListItem::getCharacterCount()
{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
return m_sEntryText.getLength();
}
@@ -437,7 +430,7 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getCharacterCount()
sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aPoint )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
sal_Int32 nIndex = -1;
::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr;
@@ -456,32 +449,22 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aP
OUString SAL_CALL VCLXAccessibleListItem::getSelectedText()
{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
-
return OUString();
}
sal_Int32 SAL_CALL VCLXAccessibleListItem::getSelectionStart()
{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
-
return 0;
}
sal_Int32 SAL_CALL VCLXAccessibleListItem::getSelectionEnd()
{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
-
return 0;
}
sal_Bool SAL_CALL VCLXAccessibleListItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
if ( !implIsValidRange( nStartIndex, nEndIndex, m_sEntryText.getLength() ) )
throw IndexOutOfBoundsException();
@@ -491,8 +474,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::setSelection( sal_Int32 nStartIndex, s
OUString SAL_CALL VCLXAccessibleListItem::getText()
{
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
return m_sEntryText;
}
@@ -500,7 +482,7 @@ OUString SAL_CALL VCLXAccessibleListItem::getText()
OUString SAL_CALL VCLXAccessibleListItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
return OCommonAccessibleText::implGetTextRange( m_sEntryText, nStartIndex, nEndIndex );
}
@@ -508,7 +490,7 @@ OUString SAL_CALL VCLXAccessibleListItem::getTextRange( sal_Int32 nStartIndex, s
css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
}
@@ -516,7 +498,7 @@ css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextAtIndex(
css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
}
@@ -524,7 +506,7 @@ css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBeforeIn
css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
}
@@ -532,7 +514,7 @@ css::accessibility::TextSegment SAL_CALL VCLXAccessibleListItem::getTextBehindIn
sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
{
SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
+ std::unique_lock aGuard( m_aMutex );
checkIndex_Impl( nStartIndex, m_sEntryText );
checkIndex_Impl( nEndIndex, m_sEntryText );
@@ -545,7 +527,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_I
if ( xClipboard.is() )
{
OUString sText( getTextRange( nStartIndex, nEndIndex ) );
- vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+ rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, nullptr );
diff --git a/accessibility/source/standard/vclxaccessiblemenu.cxx b/accessibility/source/standard/vclxaccessiblemenu.cxx
index a7e31094b668..5ba208d2f368 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>
@@ -60,37 +61,25 @@ bool VCLXAccessibleMenu::IsPopupMenuOpen()
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleMenu, VCLXAccessibleMenuItem, VCLXAccessibleMenu_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleMenu, VCLXAccessibleMenuItem, VCLXAccessibleMenu_BASE )
-
-
// XServiceInfo
OUString VCLXAccessibleMenu::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleMenu";
+ return u"com.sun.star.comp.toolkit.AccessibleMenu"_ustr;
}
Sequence< OUString > VCLXAccessibleMenu::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleMenu" };
+ return { u"com.sun.star.awt.AccessibleMenu"_ustr };
}
// XAccessibleContext
-sal_Int32 VCLXAccessibleMenu::getAccessibleChildCount( )
+sal_Int64 VCLXAccessibleMenu::getAccessibleChildCount( )
{
OExternalLockGuard aGuard( this );
@@ -98,7 +87,7 @@ sal_Int32 VCLXAccessibleMenu::getAccessibleChildCount( )
}
-Reference< XAccessible > VCLXAccessibleMenu::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > VCLXAccessibleMenu::getAccessibleChild( sal_Int64 i )
{
OExternalLockGuard aGuard( this );
@@ -131,7 +120,7 @@ Reference< XAccessible > VCLXAccessibleMenu::getAccessibleAtPoint( const awt::Po
// XAccessibleSelection
-void VCLXAccessibleMenu::selectAccessibleChild( sal_Int32 nChildIndex )
+void VCLXAccessibleMenu::selectAccessibleChild( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
@@ -142,7 +131,7 @@ void VCLXAccessibleMenu::selectAccessibleChild( sal_Int32 nChildIndex )
}
-sal_Bool VCLXAccessibleMenu::isAccessibleChildSelected( sal_Int32 nChildIndex )
+sal_Bool VCLXAccessibleMenu::isAccessibleChildSelected( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
@@ -167,18 +156,18 @@ void VCLXAccessibleMenu::selectAllAccessibleChildren( )
}
-sal_Int32 VCLXAccessibleMenu::getSelectedAccessibleChildCount( )
+sal_Int64 VCLXAccessibleMenu::getSelectedAccessibleChildCount( )
{
OExternalLockGuard aGuard( this );
return implGetSelectedAccessibleChildCount();
}
-sal_Int32 VCLXAccessibleMenu::implGetSelectedAccessibleChildCount( )
+sal_Int64 VCLXAccessibleMenu::implGetSelectedAccessibleChildCount( )
{
- sal_Int32 nRet = 0;
+ sal_Int64 nRet = 0;
- for ( sal_Int32 i = 0, nCount = GetChildCount(); i < nCount; i++ )
+ for ( sal_Int64 i = 0, nCount = GetChildCount(); i < nCount; i++ )
{
if ( IsChildSelected( i ) )
++nRet;
@@ -187,7 +176,7 @@ sal_Int32 VCLXAccessibleMenu::implGetSelectedAccessibleChildCount( )
return nRet;
}
-Reference< XAccessible > VCLXAccessibleMenu::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+Reference< XAccessible > VCLXAccessibleMenu::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex )
{
OExternalLockGuard aGuard( this );
@@ -196,7 +185,7 @@ Reference< XAccessible > VCLXAccessibleMenu::getSelectedAccessibleChild( sal_Int
Reference< XAccessible > xChild;
- for ( sal_Int32 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ )
+ for ( sal_Int64 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ )
{
if ( IsChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
{
@@ -209,7 +198,7 @@ Reference< XAccessible > VCLXAccessibleMenu::getSelectedAccessibleChild( sal_Int
}
-void VCLXAccessibleMenu::deselectAccessibleChild( sal_Int32 nChildIndex )
+void VCLXAccessibleMenu::deselectAccessibleChild( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
diff --git a/accessibility/source/standard/vclxaccessiblemenubar.cxx b/accessibility/source/standard/vclxaccessiblemenubar.cxx
index 27a02607b225..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>
@@ -66,7 +67,7 @@ bool VCLXAccessibleMenuBar::IsFocused()
IMPL_LINK( VCLXAccessibleMenuBar, WindowEventListener, VclWindowEvent&, rEvent, void )
{
- OSL_ENSURE( rEvent.GetWindow(), "VCLXAccessibleMenuBar::WindowEventListener: no window!" );
+ assert( rEvent.GetWindow() );
if ( !rEvent.GetWindow()->IsAccessibilityEventsSuppressed() || ( rEvent.GetId() == VclEventId::ObjectDying ) )
{
ProcessWindowEvent( rEvent );
@@ -134,11 +135,11 @@ Sequence< OUString > VCLXAccessibleMenuBar::getSupportedServiceNames()
// XAccessibleContext
-sal_Int32 VCLXAccessibleMenuBar::getAccessibleIndexInParent( )
+sal_Int64 VCLXAccessibleMenuBar::getAccessibleIndexInParent( )
{
OExternalLockGuard aGuard( this );
- sal_Int32 nIndexInParent = -1;
+ sal_Int64 nIndexInParent = -1;
if ( m_pMenu )
{
diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx
index d278dae976e8..03bdc88c93c5 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>
@@ -28,7 +29,6 @@
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
#include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <unotools/accessiblestatesethelper.hxx>
#include <comphelper/sequence.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <vcl/event.hxx>
@@ -50,7 +50,7 @@ using namespace ::comphelper;
VCLXAccessibleMenuItem::VCLXAccessibleMenuItem( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu )
- :OAccessibleMenuItemComponent( pParent, nItemPos, pMenu )
+ :ImplInheritanceHelper( pParent, nItemPos, pMenu )
{
}
@@ -66,6 +66,14 @@ bool VCLXAccessibleMenuItem::IsSelected()
return IsHighlighted();
}
+bool VCLXAccessibleMenuItem::IsCheckable()
+{
+ if (!m_pParent)
+ return false;
+
+ const sal_uInt16 nItemId = m_pParent->GetItemId(m_nItemPos);
+ return m_pParent->IsItemCheckable(nItemId);
+}
bool VCLXAccessibleMenuItem::IsChecked()
{
@@ -93,22 +101,24 @@ bool VCLXAccessibleMenuItem::IsHighlighted()
}
-void VCLXAccessibleMenuItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleMenuItem::FillAccessibleStateSet( sal_Int64& rStateSet )
{
OAccessibleMenuItemComponent::FillAccessibleStateSet( rStateSet );
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
if ( IsFocused() )
- rStateSet.AddState( AccessibleStateType::FOCUSED );
+ rStateSet |= AccessibleStateType::FOCUSED;
- rStateSet.AddState( AccessibleStateType::SELECTABLE );
+ rStateSet |= AccessibleStateType::SELECTABLE;
if ( IsSelected() )
- rStateSet.AddState( AccessibleStateType::SELECTED );
+ rStateSet |= AccessibleStateType::SELECTED;
+ if (IsCheckable())
+ rStateSet |= AccessibleStateType::CHECKABLE;
if ( IsChecked() )
- rStateSet.AddState( AccessibleStateType::CHECKED );
+ rStateSet |= AccessibleStateType::CHECKED;
}
@@ -134,18 +144,6 @@ void VCLXAccessibleMenuItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleMenuItem, OAccessibleMenuItemComponent, VCLXAccessibleMenuItem_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleMenuItem, OAccessibleMenuItemComponent, VCLXAccessibleMenuItem_BASE )
-
-
// XServiceInfo
@@ -367,7 +365,7 @@ sal_Bool VCLXAccessibleMenuItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEnd
{
OUString sText( getTextRange( nStartIndex, nEndIndex ) );
- vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+ rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, nullptr );
@@ -429,8 +427,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKe
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
- OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
- Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+ rtl::Reference<OAccessibleKeyBindingHelper> pKeyBindingHelper = new OAccessibleKeyBindingHelper();
if ( m_pParent )
{
@@ -441,18 +438,22 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKe
// activation key
KeyEvent aKeyEvent = m_pParent->GetActivationKey( m_pParent->GetItemId( m_nItemPos ) );
vcl::KeyCode aKeyCode = aKeyEvent.GetKeyCode();
- Sequence< awt::KeyStroke > aSeq1(1);
- aSeq1[0].Modifiers = 0;
+ Sequence< awt::KeyStroke > aSeq1
+ {
+ {
+ 0, // Modifiers
+ static_cast< sal_Int16 >(aKeyCode.GetCode()),
+ aKeyEvent.GetCharCode(),
+ static_cast< sal_Int16 >( aKeyCode.GetFunction())
+ }
+ };
Reference< XAccessible > xParent( getAccessibleParent() );
if ( xParent.is() )
{
Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
if ( xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::MENU_BAR )
- aSeq1[0].Modifiers |= awt::KeyModifier::MOD2;
+ aSeq1.getArray()[0].Modifiers |= awt::KeyModifier::MOD2;
}
- aSeq1[0].KeyCode = aKeyCode.GetCode();
- aSeq1[0].KeyChar = aKeyEvent.GetCharCode();
- aSeq1[0].KeyFunc = static_cast< sal_Int16 >( aKeyCode.GetFunction() );
pKeyBindingHelper->AddKeyBinding( aSeq1 );
// complete menu activation key sequence
@@ -478,23 +479,32 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKe
vcl::KeyCode aAccelKeyCode = m_pParent->GetAccelKey( m_pParent->GetItemId( m_nItemPos ) );
if ( aAccelKeyCode.GetCode() != 0 )
{
- Sequence< awt::KeyStroke > aSeq3(1);
- aSeq3[0].Modifiers = 0;
- if ( aAccelKeyCode.IsShift() )
- aSeq3[0].Modifiers |= awt::KeyModifier::SHIFT;
- if ( aAccelKeyCode.IsMod1() )
- aSeq3[0].Modifiers |= awt::KeyModifier::MOD1;
- if ( aAccelKeyCode.IsMod2() )
- aSeq3[0].Modifiers |= awt::KeyModifier::MOD2;
- if ( aAccelKeyCode.IsMod3() )
- aSeq3[0].Modifiers |= awt::KeyModifier::MOD3;
- aSeq3[0].KeyCode = aAccelKeyCode.GetCode();
- aSeq3[0].KeyFunc = static_cast< sal_Int16 >( aAccelKeyCode.GetFunction() );
+ Sequence< awt::KeyStroke > aSeq3
+ {
+ {
+ 0, // Modifiers
+ static_cast< sal_Int16 >(aAccelKeyCode.GetCode()),
+ aKeyEvent.GetCharCode(),
+ static_cast< sal_Int16 >(aAccelKeyCode.GetFunction())
+ }
+ };
+ if (aAccelKeyCode.GetModifier() != 0)
+ {
+ auto pSeq3 = aSeq3.getArray();
+ if ( aAccelKeyCode.IsShift() )
+ pSeq3[0].Modifiers |= awt::KeyModifier::SHIFT;
+ if ( aAccelKeyCode.IsMod1() )
+ pSeq3[0].Modifiers |= awt::KeyModifier::MOD1;
+ if ( aAccelKeyCode.IsMod2() )
+ pSeq3[0].Modifiers |= awt::KeyModifier::MOD2;
+ if ( aAccelKeyCode.IsMod3() )
+ pSeq3[0].Modifiers |= awt::KeyModifier::MOD3;
+ }
pKeyBindingHelper->AddKeyBinding( aSeq3 );
}
}
- return xKeyBinding;
+ return pKeyBindingHelper;
}
@@ -555,5 +565,13 @@ Any VCLXAccessibleMenuItem::getMinimumValue( )
return aValue;
}
+Any VCLXAccessibleMenuItem::getMinimumIncrement( )
+{
+ Any aValue;
+ aValue <<= sal_Int32(1);
+
+ return aValue;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblemenuseparator.cxx b/accessibility/source/standard/vclxaccessiblemenuseparator.cxx
index 50a70df01f61..bbb73977f7c9 100644
--- a/accessibility/source/standard/vclxaccessiblemenuseparator.cxx
+++ b/accessibility/source/standard/vclxaccessiblemenuseparator.cxx
@@ -24,7 +24,6 @@
using namespace ::com::sun::star::accessibility;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
-using namespace ::comphelper;
VCLXAccessibleMenuSeparator::VCLXAccessibleMenuSeparator(Menu* pParent, sal_uInt16 nItemPos)
: OAccessibleMenuItemComponent(pParent, nItemPos, nullptr)
diff --git a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx b/accessibility/source/standard/vclxaccessiblepopupmenu.cxx
index ad3e7441e3e1..d8b840eee784 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>
@@ -41,20 +42,20 @@ bool VCLXAccessiblePopupMenu::IsFocused()
OUString VCLXAccessiblePopupMenu::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessiblePopupMenu";
+ return u"com.sun.star.comp.toolkit.AccessiblePopupMenu"_ustr;
}
Sequence< OUString > VCLXAccessiblePopupMenu::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessiblePopupMenu" };
+ return { u"com.sun.star.awt.AccessiblePopupMenu"_ustr };
}
// XAccessibleContext
-sal_Int32 VCLXAccessiblePopupMenu::getAccessibleIndexInParent( )
+sal_Int64 VCLXAccessiblePopupMenu::getAccessibleIndexInParent( )
{
OExternalLockGuard aGuard( this );
diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
index aae9c76731f7..3d66b799db0d 100644
--- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx
+++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
@@ -22,8 +22,9 @@
#include <toolkit/awt/vclxwindows.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
+#include <comphelper/accessiblecontexthelper.hxx>
#include <comphelper/accessiblekeybindinghelper.hxx>
+#include <comphelper/sequence.hxx>
#include <com/sun/star/awt/KeyModifier.hpp>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -38,7 +39,6 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::accessibility;
using namespace ::comphelper;
@@ -81,7 +81,7 @@ void VCLXAccessibleRadioButton::FillAccessibleRelationSet( utl::AccessibleRelati
std::vector< VclPtr<RadioButton> > aGroup(pRadioButton->GetRadioButtonGroup());
if (!aGroup.empty())
{
- std::vector< Reference< XInterface > > aVec;
+ std::vector<Reference<css::accessibility::XAccessible>> aVec;
aVec.reserve(aGroup.size());
std::transform(aGroup.begin(), aGroup.end(), std::back_inserter(aVec),
[](const VclPtr<RadioButton>& rxItem) { return rxItem->GetAccessible(); });
@@ -91,32 +91,21 @@ void VCLXAccessibleRadioButton::FillAccessibleRelationSet( utl::AccessibleRelati
}
-void VCLXAccessibleRadioButton::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleRadioButton::FillAccessibleStateSet( sal_Int64& rStateSet )
{
VCLXAccessibleTextComponent::FillAccessibleStateSet( rStateSet );
VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() );
if ( pVCLXRadioButton )
{
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::CHECKABLE;
+ rStateSet |= AccessibleStateType::FOCUSABLE;
if ( pVCLXRadioButton->getState() )
- rStateSet.AddState( AccessibleStateType::CHECKED );
+ rStateSet |= AccessibleStateType::CHECKED;
}
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleRadioButton, VCLXAccessibleTextComponent, VCLXAccessibleRadioButton_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleRadioButton, VCLXAccessibleTextComponent, VCLXAccessibleRadioButton_BASE )
-
-
// XServiceInfo
@@ -174,8 +163,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActio
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
- OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
- Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+ rtl::Reference<OAccessibleKeyBindingHelper> pKeyBindingHelper = new OAccessibleKeyBindingHelper();
VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
@@ -201,7 +189,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActio
}
}
- return xKeyBinding;
+ return pKeyBindingHelper;
}
@@ -268,5 +256,15 @@ Any VCLXAccessibleRadioButton::getMinimumValue( )
return aValue;
}
+Any VCLXAccessibleRadioButton::getMinimumIncrement( )
+{
+ OExternalLockGuard aGuard( this );
+
+ Any aValue;
+ aValue <<= sal_Int32(1);
+
+ return aValue;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
index 329aaec906bc..7ffc11da3390 100644
--- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx
+++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
@@ -23,12 +23,12 @@
#include <helper/accresmgr.hxx>
#include <strings.hrc>
-#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/awt/ScrollBarOrientation.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <vcl/scrbar.hxx>
+#include <comphelper/accessiblecontexthelper.hxx>
+#include <vcl/toolkit/scrbar.hxx>
#include <vcl/vclevent.hxx>
#include <strings.hxx>
@@ -36,7 +36,6 @@ using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::awt;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::accessibility;
using namespace ::comphelper;
@@ -59,7 +58,7 @@ void VCLXAccessibleScrollBar::ProcessWindowEvent( const VclWindowEvent& rVclWind
}
-void VCLXAccessibleScrollBar::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleScrollBar::FillAccessibleStateSet( sal_Int64& rStateSet )
{
VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
@@ -69,37 +68,25 @@ void VCLXAccessibleScrollBar::FillAccessibleStateSet( utl::AccessibleStateSetHel
// IA2 CWS: scroll bar should not have FOCUSABLE state.
// rStateSet.AddState( AccessibleStateType::FOCUSABLE );
if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::HORIZONTAL )
- rStateSet.AddState( AccessibleStateType::HORIZONTAL );
+ rStateSet |= AccessibleStateType::HORIZONTAL;
else if ( pVCLXScrollBar->getOrientation() == ScrollBarOrientation::VERTICAL )
- rStateSet.AddState( AccessibleStateType::VERTICAL );
+ rStateSet |= AccessibleStateType::VERTICAL;
}
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleScrollBar, VCLXAccessibleComponent, VCLXAccessibleScrollBar_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleScrollBar, VCLXAccessibleComponent, VCLXAccessibleScrollBar_BASE )
-
-
// XServiceInfo
OUString VCLXAccessibleScrollBar::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleScrollBar";
+ return u"com.sun.star.comp.toolkit.AccessibleScrollBar"_ustr;
}
Sequence< OUString > VCLXAccessibleScrollBar::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleScrollBar" };
+ return { u"com.sun.star.awt.AccessibleScrollBar"_ustr };
}
@@ -154,10 +141,10 @@ OUString VCLXAccessibleScrollBar::getAccessibleActionDescription ( sal_Int32 nIn
switch ( nIndex )
{
- case 0: sDescription = OUString(RID_STR_ACC_ACTION_DECLINE); break;
- case 1: sDescription = OUString(RID_STR_ACC_ACTION_INCLINE); break;
- case 2: sDescription = OUString(RID_STR_ACC_ACTION_DECBLOCK); break;
- case 3: sDescription = OUString(RID_STR_ACC_ACTION_INCBLOCK); break;
+ case 0: sDescription = RID_STR_ACC_ACTION_DECLINE; break;
+ case 1: sDescription = RID_STR_ACC_ACTION_INCLINE; break;
+ case 2: sDescription = RID_STR_ACC_ACTION_DECBLOCK; break;
+ case 3: sDescription = RID_STR_ACC_ACTION_INCBLOCK; break;
default: break;
}
@@ -244,6 +231,13 @@ Any VCLXAccessibleScrollBar::getMinimumValue( )
return aValue;
}
+Any VCLXAccessibleScrollBar::getMinimumIncrement( )
+{
+ OExternalLockGuard aGuard( this );
+
+ return Any();
+}
+
OUString VCLXAccessibleScrollBar::getAccessibleName( )
{
diff --git a/accessibility/source/standard/vclxaccessiblestatusbar.cxx b/accessibility/source/standard/vclxaccessiblestatusbar.cxx
index e84825ea0b3f..bbf19b4416a5 100644
--- a/accessibility/source/standard/vclxaccessiblestatusbar.cxx
+++ b/accessibility/source/standard/vclxaccessiblestatusbar.cxx
@@ -22,6 +22,8 @@
#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>
@@ -38,71 +40,59 @@ using namespace ::comphelper;
VCLXAccessibleStatusBar::VCLXAccessibleStatusBar( VCLXWindow* pVCLXWindow )
:VCLXAccessibleComponent( pVCLXWindow )
{
- m_pStatusBar = static_cast< StatusBar *>( GetWindow().get() );
+ m_pStatusBar = GetAs<StatusBar>();
if ( m_pStatusBar )
- m_aAccessibleChildren.assign( m_pStatusBar->GetItemCount(), Reference< XAccessible >() );
+ m_aAccessibleChildren.assign( m_pStatusBar->GetItemCount(), rtl::Reference< VCLXAccessibleStatusBarItem >() );
}
void VCLXAccessibleStatusBar::UpdateShowing( sal_Int32 i, bool bShowing )
{
- if ( i >= 0 && i < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
{
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
- {
- VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() );
- if ( pVCLXAccessibleStatusBarItem )
- pVCLXAccessibleStatusBarItem->SetShowing( bShowing );
- }
+ rtl::Reference< VCLXAccessibleStatusBarItem > pVCLXAccessibleStatusBarItem( m_aAccessibleChildren[i] );
+ if ( pVCLXAccessibleStatusBarItem )
+ pVCLXAccessibleStatusBarItem->SetShowing( bShowing );
}
}
void VCLXAccessibleStatusBar::UpdateItemName( sal_Int32 i )
{
- if ( i < 0 || i >= static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i < 0 || o3tl::make_unsigned(i) >= m_aAccessibleChildren.size() )
return;
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
+ rtl::Reference< VCLXAccessibleStatusBarItem > pVCLXAccessibleStatusBarItem( m_aAccessibleChildren[i] );
+ if ( pVCLXAccessibleStatusBarItem.is() )
{
- VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() );
- if ( pVCLXAccessibleStatusBarItem )
- {
- OUString sItemName = pVCLXAccessibleStatusBarItem->GetItemName();
- pVCLXAccessibleStatusBarItem->SetItemName( sItemName );
- }
+ OUString sItemName = pVCLXAccessibleStatusBarItem->GetItemName();
+ pVCLXAccessibleStatusBarItem->SetItemName( sItemName );
}
}
void VCLXAccessibleStatusBar::UpdateItemText( sal_Int32 i )
{
- if ( i < 0 || i >= static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i < 0 || o3tl::make_unsigned(i) >= m_aAccessibleChildren.size() )
return;
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
+ rtl::Reference< VCLXAccessibleStatusBarItem > pVCLXAccessibleStatusBarItem( m_aAccessibleChildren[i] );
+ if ( pVCLXAccessibleStatusBarItem.is() )
{
- VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() );
- if ( pVCLXAccessibleStatusBarItem )
- {
- OUString sItemText = pVCLXAccessibleStatusBarItem->GetItemText();
- pVCLXAccessibleStatusBarItem->SetItemText( sItemText );
- }
+ OUString sItemText = pVCLXAccessibleStatusBarItem->GetItemText();
+ pVCLXAccessibleStatusBarItem->SetItemText( sItemText );
}
}
void VCLXAccessibleStatusBar::InsertChild( sal_Int32 i )
{
- if ( i < 0 || i > static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i < 0 || o3tl::make_unsigned(i) > m_aAccessibleChildren.size() )
return;
// insert entry in child list
- m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() );
+ m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, rtl::Reference< VCLXAccessibleStatusBarItem >() );
// send accessible child event
Reference< XAccessible > xChild( getAccessibleChild( i ) );
@@ -117,7 +107,7 @@ void VCLXAccessibleStatusBar::InsertChild( sal_Int32 i )
void VCLXAccessibleStatusBar::RemoveChild( sal_Int32 i )
{
- if ( i < 0 || i >= static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i < 0 || o3tl::make_unsigned(i) >= m_aAccessibleChildren.size() )
return;
// get the accessible of the removed page
@@ -158,18 +148,16 @@ void VCLXAccessibleStatusBar::ProcessWindowEvent( const VclWindowEvent& rVclWind
{
if ( m_pStatusBar )
{
+ OExternalLockGuard aGuard( this );
+
sal_uInt16 nItemId = static_cast<sal_uInt16>(reinterpret_cast<sal_IntPtr>(rVclWindowEvent.GetData()));
- for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ for ( sal_Int64 i = 0, nCount = m_aAccessibleChildren.size(); i < nCount; ++i )
{
- Reference< XAccessible > xChild( getAccessibleChild( i ) );
- if ( xChild.is() )
+ sal_uInt16 nChildItemId = m_pStatusBar->GetItemId( static_cast<sal_uInt16>(i) );
+ if ( nChildItemId == nItemId )
{
- VCLXAccessibleStatusBarItem* pVCLXAccessibleStatusBarItem = static_cast< VCLXAccessibleStatusBarItem* >( xChild.get() );
- if ( pVCLXAccessibleStatusBarItem && pVCLXAccessibleStatusBarItem->GetItemId() == nItemId )
- {
- RemoveChild( i );
- break;
- }
+ RemoveChild( i );
+ break;
}
}
}
@@ -219,9 +207,8 @@ void VCLXAccessibleStatusBar::ProcessWindowEvent( const VclWindowEvent& rVclWind
m_pStatusBar = nullptr;
// dispose all children
- for (const Reference<XAccessible>& i : m_aAccessibleChildren)
+ for (const rtl::Reference<VCLXAccessibleStatusBarItem>& xComponent : m_aAccessibleChildren)
{
- Reference< XComponent > xComponent( i, UNO_QUERY );
if ( xComponent.is() )
xComponent->dispose();
}
@@ -250,9 +237,8 @@ void VCLXAccessibleStatusBar::disposing()
m_pStatusBar = nullptr;
// dispose all children
- for (const Reference<XAccessible>& i : m_aAccessibleChildren)
+ for (const rtl::Reference<VCLXAccessibleStatusBarItem>& xComponent : m_aAccessibleChildren)
{
- Reference< XComponent > xComponent( i, UNO_QUERY );
if ( xComponent.is() )
xComponent->dispose();
}
@@ -265,20 +251,20 @@ void VCLXAccessibleStatusBar::disposing()
OUString VCLXAccessibleStatusBar::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleStatusBar";
+ return u"com.sun.star.comp.toolkit.AccessibleStatusBar"_ustr;
}
Sequence< OUString > VCLXAccessibleStatusBar::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleStatusBar" };
+ return { u"com.sun.star.awt.AccessibleStatusBar"_ustr };
}
// XAccessibleContext
-sal_Int32 VCLXAccessibleStatusBar::getAccessibleChildCount()
+sal_Int64 VCLXAccessibleStatusBar::getAccessibleChildCount()
{
OExternalLockGuard aGuard( this );
@@ -286,14 +272,14 @@ sal_Int32 VCLXAccessibleStatusBar::getAccessibleChildCount()
}
-Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleChild( sal_Int64 i )
{
OExternalLockGuard aGuard( this );
- if ( i < 0 || i >= static_cast<sal_Int32> (m_aAccessibleChildren.size()) )
+ if ( i < 0 || o3tl::make_unsigned(i) >= m_aAccessibleChildren.size() )
throw IndexOutOfBoundsException();
- Reference< XAccessible > xChild = m_aAccessibleChildren[i];
+ rtl::Reference< VCLXAccessibleStatusBarItem > xChild = m_aAccessibleChildren[i];
if ( !xChild.is() )
{
if ( m_pStatusBar )
@@ -323,7 +309,7 @@ Reference< XAccessible > VCLXAccessibleStatusBar::getAccessibleAtPoint( const aw
{
sal_uInt16 nItemId = m_pStatusBar->GetItemId( VCLPoint( rPoint ) );
sal_Int32 nItemPos = m_pStatusBar->GetItemPos( nItemId );
- if ( nItemPos >= 0 && nItemPos < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( nItemPos >= 0 && o3tl::make_unsigned(nItemPos) < m_aAccessibleChildren.size() )
xChild = getAccessibleChild( nItemPos );
}
diff --git a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
index aee6f9e46737..db5e6cf140fe 100644
--- a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
+++ b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
@@ -27,13 +27,13 @@
#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/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/ctrl.hxx>
#include <vcl/svapp.hxx>
#include <vcl/unohelp2.hxx>
#include <vcl/status.hxx>
-#include <vcl/toolkit/controllayout.hxx>
#include <vcl/settings.hxx>
#include <i18nlangtag/languagetag.hxx>
@@ -128,15 +128,15 @@ OUString VCLXAccessibleStatusBarItem::GetItemText()
}
-void VCLXAccessibleStatusBarItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleStatusBarItem::FillAccessibleStateSet( sal_Int64& rStateSet )
{
- rStateSet.AddState( AccessibleStateType::ENABLED );
- rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ rStateSet |= AccessibleStateType::ENABLED;
+ rStateSet |= AccessibleStateType::SENSITIVE;
- rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet |= AccessibleStateType::VISIBLE;
if ( IsShowing() )
- rStateSet.AddState( AccessibleStateType::SHOWING );
+ rStateSet |= AccessibleStateType::SHOWING;
}
@@ -176,24 +176,12 @@ void VCLXAccessibleStatusBarItem::implGetSelection( sal_Int32& nStartIndex, sal_
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleStatusBarItem, AccessibleTextHelper_BASE, VCLXAccessibleStatusBarItem_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleStatusBarItem, AccessibleTextHelper_BASE, VCLXAccessibleStatusBarItem_BASE )
-
-
// XComponent
void VCLXAccessibleStatusBarItem::disposing()
{
- AccessibleTextHelper_BASE::disposing();
+ comphelper::OAccessibleTextHelper::disposing();
m_pStatusBar = nullptr;
m_sItemName.clear();
@@ -206,7 +194,7 @@ void VCLXAccessibleStatusBarItem::disposing()
OUString VCLXAccessibleStatusBarItem::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleStatusBarItem";
+ return u"com.sun.star.comp.toolkit.AccessibleStatusBarItem"_ustr;
}
@@ -218,7 +206,7 @@ sal_Bool VCLXAccessibleStatusBarItem::supportsService( const OUString& rServiceN
Sequence< OUString > VCLXAccessibleStatusBarItem::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleStatusBarItem" };
+ return { u"com.sun.star.awt.AccessibleStatusBarItem"_ustr };
}
@@ -236,7 +224,7 @@ Reference< XAccessibleContext > VCLXAccessibleStatusBarItem::getAccessibleContex
// XAccessibleContext
-sal_Int32 VCLXAccessibleStatusBarItem::getAccessibleChildCount()
+sal_Int64 VCLXAccessibleStatusBarItem::getAccessibleChildCount()
{
OExternalLockGuard aGuard( this );
@@ -244,7 +232,7 @@ sal_Int32 VCLXAccessibleStatusBarItem::getAccessibleChildCount()
}
-Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleChild( sal_Int32 )
+Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleChild( sal_Int64 )
{
throw IndexOutOfBoundsException();
}
@@ -262,11 +250,11 @@ Reference< XAccessible > VCLXAccessibleStatusBarItem::getAccessibleParent( )
}
-sal_Int32 VCLXAccessibleStatusBarItem::getAccessibleIndexInParent( )
+sal_Int64 VCLXAccessibleStatusBarItem::getAccessibleIndexInParent( )
{
OExternalLockGuard aGuard( this );
- sal_Int32 nIndexInParent = -1;
+ sal_Int64 nIndexInParent = -1;
if ( m_pStatusBar )
nIndexInParent = m_pStatusBar->GetItemPos( m_nItemId );
@@ -306,29 +294,26 @@ Reference< XAccessibleRelationSet > VCLXAccessibleStatusBarItem::getAccessibleRe
{
OExternalLockGuard aGuard( this );
- utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
- Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
- return xSet;
+ return new utl::AccessibleRelationSetHelper;
}
-Reference< XAccessibleStateSet > VCLXAccessibleStatusBarItem::getAccessibleStateSet( )
+sal_Int64 VCLXAccessibleStatusBarItem::getAccessibleStateSet( )
{
OExternalLockGuard aGuard( this );
- utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
- Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+ sal_Int64 nStateSet = 0;
if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
{
- FillAccessibleStateSet( *pStateSetHelper );
+ FillAccessibleStateSet( nStateSet );
}
else
{
- pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ nStateSet |= AccessibleStateType::DEFUNC;
}
- return xSet;
+ return nStateSet;
}
@@ -565,7 +550,7 @@ sal_Bool VCLXAccessibleStatusBarItem::copyText( sal_Int32 nStartIndex, sal_Int32
{
OUString sText( implGetTextRange( GetItemText(), nStartIndex, nEndIndex ) );
- vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+ rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, nullptr );
diff --git a/accessibility/source/standard/vclxaccessibletabcontrol.cxx b/accessibility/source/standard/vclxaccessibletabcontrol.cxx
index 26f384fbbbce..4be0e3b12378 100644
--- a/accessibility/source/standard/vclxaccessibletabcontrol.cxx
+++ b/accessibility/source/standard/vclxaccessibletabcontrol.cxx
@@ -24,8 +24,8 @@
#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 <unotools/accessiblestatesethelper.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/vclevent.hxx>
@@ -42,9 +42,9 @@ using namespace ::comphelper;
VCLXAccessibleTabControl::VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow )
- :VCLXAccessibleComponent( pVCLXWindow )
+ :ImplInheritanceHelper( pVCLXWindow )
{
- m_pTabControl = static_cast< TabControl* >( GetWindow().get() );
+ m_pTabControl = GetAs<TabControl>();
if (!m_pTabControl)
return;
if (m_pTabControl->isDisposed())
@@ -52,76 +52,60 @@ VCLXAccessibleTabControl::VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow )
m_pTabControl.clear();
return;
}
- m_aAccessibleChildren.assign( m_pTabControl->GetPageCount(), Reference< XAccessible >() );
+ m_aAccessibleChildren.assign( m_pTabControl->GetPageCount(), rtl::Reference< VCLXAccessibleTabPage >() );
}
void VCLXAccessibleTabControl::UpdateFocused()
{
- for (const Reference<XAccessible>& xChild : m_aAccessibleChildren)
+ for (const rtl::Reference<VCLXAccessibleTabPage>& pVCLXAccessibleTabPage : m_aAccessibleChildren)
{
- if ( xChild.is() )
- {
- VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() );
- if ( pVCLXAccessibleTabPage )
- pVCLXAccessibleTabPage->SetFocused( pVCLXAccessibleTabPage->IsFocused() );
- }
+ if ( pVCLXAccessibleTabPage )
+ pVCLXAccessibleTabPage->SetFocused( pVCLXAccessibleTabPage->IsFocused() );
}
}
void VCLXAccessibleTabControl::UpdateSelected( sal_Int32 i, bool bSelected )
{
- if ( i >= 0 && i < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
{
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
- {
- VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() );
- if ( pVCLXAccessibleTabPage )
- pVCLXAccessibleTabPage->SetSelected( bSelected );
- }
+ rtl::Reference< VCLXAccessibleTabPage > pVCLXAccessibleTabPage( m_aAccessibleChildren[i] );
+ if ( pVCLXAccessibleTabPage )
+ pVCLXAccessibleTabPage->SetSelected( bSelected );
}
}
void VCLXAccessibleTabControl::UpdatePageText( sal_Int32 i )
{
- if ( i >= 0 && i < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
{
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
- {
- VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() );
- if ( pVCLXAccessibleTabPage )
- pVCLXAccessibleTabPage->SetPageText( pVCLXAccessibleTabPage->GetPageText() );
- }
+ rtl::Reference< VCLXAccessibleTabPage > pVCLXAccessibleTabPage( m_aAccessibleChildren[i] );
+ if ( pVCLXAccessibleTabPage )
+ pVCLXAccessibleTabPage->SetPageText( pVCLXAccessibleTabPage->GetPageText() );
}
}
void VCLXAccessibleTabControl::UpdateTabPage( sal_Int32 i, bool bNew )
{
- if ( i >= 0 && i < static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
{
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
- {
- VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() );
- if ( pVCLXAccessibleTabPage )
- pVCLXAccessibleTabPage->Update( bNew );
- }
+ rtl::Reference< VCLXAccessibleTabPage > pVCLXAccessibleTabPage( m_aAccessibleChildren[i] );
+ if ( pVCLXAccessibleTabPage )
+ pVCLXAccessibleTabPage->Update( bNew );
}
}
void VCLXAccessibleTabControl::InsertChild( sal_Int32 i )
{
- if ( i < 0 || i > static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i < 0 || o3tl::make_unsigned(i) > m_aAccessibleChildren.size() )
return;
// insert entry in child list
- m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, Reference< XAccessible >() );
+ m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, rtl::Reference< VCLXAccessibleTabPage >() );
// send accessible child event
Reference< XAccessible > xChild( getAccessibleChild( i ) );
@@ -136,11 +120,11 @@ void VCLXAccessibleTabControl::InsertChild( sal_Int32 i )
void VCLXAccessibleTabControl::RemoveChild( sal_Int32 i )
{
- if ( i < 0 || i >= static_cast<sal_Int32>(m_aAccessibleChildren.size()) )
+ if ( i < 0 || o3tl::make_unsigned(i) >= m_aAccessibleChildren.size() )
return;
// get the accessible of the removed page
- Reference< XAccessible > xChild( m_aAccessibleChildren[i] );
+ rtl::Reference< VCLXAccessibleTabPage > xChild( m_aAccessibleChildren[i] );
// remove entry in child list
m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
@@ -149,12 +133,10 @@ void VCLXAccessibleTabControl::RemoveChild( sal_Int32 i )
if ( xChild.is() )
{
Any aOldValue, aNewValue;
- aOldValue <<= xChild;
+ aOldValue <<= uno::Reference<XAccessible>(xChild);
NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
- Reference< XComponent > xComponent( xChild, UNO_QUERY );
- if ( xComponent.is() )
- xComponent->dispose();
+ xChild->dispose();
}
}
@@ -199,18 +181,14 @@ void VCLXAccessibleTabControl::ProcessWindowEvent( const VclWindowEvent& rVclWin
{
if ( m_pTabControl )
{
+ OExternalLockGuard aGuard( this );
sal_uInt16 nPageId = static_cast<sal_uInt16>(reinterpret_cast<sal_IntPtr>(rVclWindowEvent.GetData()));
- for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ for ( sal_Int64 i = 0, nCount = m_aAccessibleChildren.size(); i < nCount; ++i )
{
- Reference< XAccessible > xChild( getAccessibleChild( i ) );
- if ( xChild.is() )
+ if ( m_aAccessibleChildren[i] && m_aAccessibleChildren[i]->GetPageId() == nPageId )
{
- VCLXAccessibleTabPage* pVCLXAccessibleTabPage = static_cast< VCLXAccessibleTabPage* >( xChild.get() );
- if ( pVCLXAccessibleTabPage && pVCLXAccessibleTabPage->GetPageId() == nPageId )
- {
- RemoveChild( i );
- break;
- }
+ RemoveChild( i );
+ break;
}
}
}
@@ -235,11 +213,10 @@ void VCLXAccessibleTabControl::ProcessWindowEvent( const VclWindowEvent& rVclWin
m_pTabControl = nullptr;
// dispose all tab pages
- for (const Reference<XAccessible>& i : m_aAccessibleChildren)
+ for (const rtl::Reference<VCLXAccessibleTabPage>& i : m_aAccessibleChildren)
{
- Reference< XComponent > xComponent( i, UNO_QUERY );
- if ( xComponent.is() )
- xComponent->dispose();
+ if (i.is())
+ i->dispose();
}
m_aAccessibleChildren.clear();
}
@@ -282,27 +259,15 @@ void VCLXAccessibleTabControl::ProcessWindowChildEvent( const VclWindowEvent& rV
}
-void VCLXAccessibleTabControl::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleTabControl::FillAccessibleStateSet( sal_Int64& rStateSet )
{
VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
if ( m_pTabControl )
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTabControl, VCLXAccessibleComponent, VCLXAccessibleTabControl_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTabControl, VCLXAccessibleComponent, VCLXAccessibleTabControl_BASE )
-
-
// XComponent
@@ -316,12 +281,9 @@ void VCLXAccessibleTabControl::disposing()
m_pTabControl = nullptr;
// dispose all tab pages
- for (const Reference<XAccessible>& i : m_aAccessibleChildren)
- {
- Reference< XComponent > xComponent( i, UNO_QUERY );
+ for (const rtl::Reference<VCLXAccessibleTabPage>& xComponent : m_aAccessibleChildren)
if ( xComponent.is() )
xComponent->dispose();
- }
m_aAccessibleChildren.clear();
}
@@ -331,20 +293,20 @@ void VCLXAccessibleTabControl::disposing()
OUString VCLXAccessibleTabControl::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleTabControl";
+ return u"com.sun.star.comp.toolkit.AccessibleTabControl"_ustr;
}
Sequence< OUString > VCLXAccessibleTabControl::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleTabControl" };
+ return { u"com.sun.star.awt.AccessibleTabControl"_ustr };
}
// XAccessibleContext
-sal_Int32 VCLXAccessibleTabControl::getAccessibleChildCount()
+sal_Int64 VCLXAccessibleTabControl::getAccessibleChildCount()
{
OExternalLockGuard aGuard( this );
@@ -352,7 +314,7 @@ sal_Int32 VCLXAccessibleTabControl::getAccessibleChildCount()
}
-Reference< XAccessible > VCLXAccessibleTabControl::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > VCLXAccessibleTabControl::getAccessibleChild( sal_Int64 i )
{
OExternalLockGuard aGuard( this );
@@ -362,9 +324,9 @@ Reference< XAccessible > VCLXAccessibleTabControl::getAccessibleChild( sal_Int32
return implGetAccessibleChild( i );
}
-Reference< XAccessible > VCLXAccessibleTabControl::implGetAccessibleChild( sal_Int32 i )
+Reference< XAccessible > VCLXAccessibleTabControl::implGetAccessibleChild( sal_Int64 i )
{
- Reference< XAccessible > xChild = m_aAccessibleChildren[i];
+ rtl::Reference< VCLXAccessibleTabPage > xChild = m_aAccessibleChildren[i];
if ( !xChild.is() )
{
sal_uInt16 nPageId = m_pTabControl ? m_pTabControl->GetPageId(static_cast<sal_uInt16>(i)) : 0;
@@ -400,7 +362,7 @@ OUString VCLXAccessibleTabControl::getAccessibleName( )
// XAccessibleSelection
-void VCLXAccessibleTabControl::selectAccessibleChild( sal_Int32 nChildIndex )
+void VCLXAccessibleTabControl::selectAccessibleChild( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
@@ -412,7 +374,7 @@ void VCLXAccessibleTabControl::selectAccessibleChild( sal_Int32 nChildIndex )
}
-sal_Bool VCLXAccessibleTabControl::isAccessibleChildSelected( sal_Int32 nChildIndex )
+sal_Bool VCLXAccessibleTabControl::isAccessibleChildSelected( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
@@ -444,7 +406,7 @@ void VCLXAccessibleTabControl::selectAllAccessibleChildren( )
}
-sal_Int32 VCLXAccessibleTabControl::getSelectedAccessibleChildCount( )
+sal_Int64 VCLXAccessibleTabControl::getSelectedAccessibleChildCount( )
{
OExternalLockGuard aGuard( this );
@@ -452,7 +414,7 @@ sal_Int32 VCLXAccessibleTabControl::getSelectedAccessibleChildCount( )
}
-Reference< XAccessible > VCLXAccessibleTabControl::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+Reference< XAccessible > VCLXAccessibleTabControl::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex )
{
OExternalLockGuard aGuard( this );
@@ -474,7 +436,7 @@ Reference< XAccessible > VCLXAccessibleTabControl::getSelectedAccessibleChild( s
}
-void VCLXAccessibleTabControl::deselectAccessibleChild( sal_Int32 nChildIndex )
+void VCLXAccessibleTabControl::deselectAccessibleChild( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
diff --git a/accessibility/source/standard/vclxaccessibletabpage.cxx b/accessibility/source/standard/vclxaccessibletabpage.cxx
index ab981634a7db..dad454ab0021 100644
--- a/accessibility/source/standard/vclxaccessibletabpage.cxx
+++ b/accessibility/source/standard/vclxaccessibletabpage.cxx
@@ -27,9 +27,10 @@
#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/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/mnemonic.hxx>
#include <vcl/svapp.hxx>
#include <vcl/unohelp2.hxx>
#include <vcl/tabctrl.hxx>
@@ -133,7 +134,7 @@ OUString VCLXAccessibleTabPage::GetPageText()
{
OUString sText;
if ( m_pTabControl )
- sText = OutputDevice::GetNonMnemonicString( m_pTabControl->GetPageText( m_nPageId ) );
+ sText = removeMnemonicFromString( m_pTabControl->GetPageText( m_nPageId ) );
return sText;
}
@@ -161,24 +162,24 @@ void VCLXAccessibleTabPage::Update( bool bNew )
}
-void VCLXAccessibleTabPage::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleTabPage::FillAccessibleStateSet( sal_Int64& rStateSet )
{
- rStateSet.AddState( AccessibleStateType::ENABLED );
- rStateSet.AddState( AccessibleStateType::SENSITIVE );
+ rStateSet |= AccessibleStateType::ENABLED;
+ rStateSet |= AccessibleStateType::SENSITIVE;
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
if ( IsFocused() )
- rStateSet.AddState( AccessibleStateType::FOCUSED );
+ rStateSet |= AccessibleStateType::FOCUSED;
- rStateSet.AddState( AccessibleStateType::VISIBLE );
+ rStateSet |= AccessibleStateType::VISIBLE;
- rStateSet.AddState( AccessibleStateType::SHOWING );
+ rStateSet |= AccessibleStateType::SHOWING;
- rStateSet.AddState( AccessibleStateType::SELECTABLE );
+ rStateSet |= AccessibleStateType::SELECTABLE;
if ( IsSelected() )
- rStateSet.AddState( AccessibleStateType::SELECTED );
+ rStateSet |= AccessibleStateType::SELECTED;
}
@@ -218,24 +219,12 @@ void VCLXAccessibleTabPage::implGetSelection( sal_Int32& nStartIndex, sal_Int32&
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTabPage, AccessibleTextHelper_BASE, VCLXAccessibleTabPage_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTabPage, AccessibleTextHelper_BASE, VCLXAccessibleTabPage_BASE )
-
-
// XComponent
void VCLXAccessibleTabPage::disposing()
{
- AccessibleTextHelper_BASE::disposing();
+ comphelper::OAccessibleTextHelper::disposing();
m_pTabControl = nullptr;
m_sPageText.clear();
@@ -247,7 +236,7 @@ void VCLXAccessibleTabPage::disposing()
OUString VCLXAccessibleTabPage::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleTabPage";
+ return u"com.sun.star.comp.toolkit.AccessibleTabPage"_ustr;
}
@@ -259,7 +248,7 @@ sal_Bool VCLXAccessibleTabPage::supportsService( const OUString& rServiceName )
Sequence< OUString > VCLXAccessibleTabPage::getSupportedServiceNames()
{
- return { "com.sun.star.awt.AccessibleTabPage" };
+ return { u"com.sun.star.awt.AccessibleTabPage"_ustr };
}
@@ -277,15 +266,15 @@ Reference< XAccessibleContext > VCLXAccessibleTabPage::getAccessibleContext( )
// XAccessibleContext
-sal_Int32 VCLXAccessibleTabPage::getAccessibleChildCount()
+sal_Int64 VCLXAccessibleTabPage::getAccessibleChildCount()
{
OExternalLockGuard aGuard( this );
return implGetAccessibleChildCount();
}
-sal_Int32 VCLXAccessibleTabPage::implGetAccessibleChildCount()
+sal_Int64 VCLXAccessibleTabPage::implGetAccessibleChildCount()
{
- sal_Int32 nCount = 0;
+ sal_Int64 nCount = 0;
if ( m_pTabControl )
{
TabPage* pTabPage = m_pTabControl->GetTabPage( m_nPageId );
@@ -297,7 +286,7 @@ sal_Int32 VCLXAccessibleTabPage::implGetAccessibleChildCount()
}
-Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleChild( sal_Int64 i )
{
OExternalLockGuard aGuard( this );
@@ -328,11 +317,11 @@ Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleParent( )
}
-sal_Int32 VCLXAccessibleTabPage::getAccessibleIndexInParent( )
+sal_Int64 VCLXAccessibleTabPage::getAccessibleIndexInParent( )
{
OExternalLockGuard aGuard( this );
- sal_Int32 nIndexInParent = -1;
+ sal_Int64 nIndexInParent = -1;
if ( m_pTabControl )
nIndexInParent = m_pTabControl->GetPagePos( m_nPageId );
@@ -372,29 +361,26 @@ Reference< XAccessibleRelationSet > VCLXAccessibleTabPage::getAccessibleRelation
{
OExternalLockGuard aGuard( this );
- utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
- Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
- return xSet;
+ return new utl::AccessibleRelationSetHelper;
}
-Reference< XAccessibleStateSet > VCLXAccessibleTabPage::getAccessibleStateSet( )
+sal_Int64 VCLXAccessibleTabPage::getAccessibleStateSet( )
{
OExternalLockGuard aGuard( this );
- utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
- Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+ sal_Int64 nStateSet = 0;
if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
{
- FillAccessibleStateSet( *pStateSetHelper );
+ FillAccessibleStateSet( nStateSet );
}
else
{
- pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ nStateSet |= AccessibleStateType::DEFUNC;
}
- return xSet;
+ return nStateSet;
}
@@ -414,7 +400,7 @@ Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleAtPoint( const awt:
OExternalLockGuard aGuard( this );
Reference< XAccessible > xChild;
- for ( sal_uInt32 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
+ for ( sal_Int64 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
{
Reference< XAccessible > xAcc = getAccessibleChild( i );
if ( xAcc.is() )
@@ -424,7 +410,7 @@ Reference< XAccessible > VCLXAccessibleTabPage::getAccessibleAtPoint( const awt:
{
tools::Rectangle aRect = VCLRectangle( xComp->getBounds() );
Point aPos = VCLPoint( rPoint );
- if ( aRect.IsInside( aPos ) )
+ if ( aRect.Contains( aPos ) )
{
xChild = xAcc;
break;
@@ -600,7 +586,7 @@ awt::Rectangle VCLXAccessibleTabPage::getCharacterBounds( sal_Int32 nIndex )
if ( m_pTabControl )
{
tools::Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
- tools::Rectangle aCharRect = m_pTabControl->GetCharacterBounds( m_nPageId, nIndex );
+ tools::Rectangle aCharRect; // m_pTabControl->GetCharacterBounds( m_nPageId, nIndex );
aCharRect.Move( -aPageRect.Left(), -aPageRect.Top() );
aBounds = AWTRectangle( aCharRect );
}
@@ -609,21 +595,21 @@ awt::Rectangle VCLXAccessibleTabPage::getCharacterBounds( sal_Int32 nIndex )
}
-sal_Int32 VCLXAccessibleTabPage::getIndexAtPoint( const awt::Point& aPoint )
+sal_Int32 VCLXAccessibleTabPage::getIndexAtPoint( const awt::Point& /*aPoint*/ )
{
OExternalLockGuard aGuard( this );
sal_Int32 nIndex = -1;
- if ( m_pTabControl )
- {
- sal_uInt16 nPageId = 0;
- tools::Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
- Point aPnt( VCLPoint( aPoint ) );
- aPnt += aPageRect.TopLeft();
- sal_Int32 nI = m_pTabControl->GetIndexForPoint( aPnt, nPageId );
- if ( nI != -1 && m_nPageId == nPageId )
- nIndex = nI;
- }
+// if ( m_pTabControl )
+// {
+// sal_uInt16 nPageId = 0;
+// tools::Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
+// Point aPnt( VCLPoint( aPoint ) );
+// aPnt += aPageRect.TopLeft();
+// sal_Int32 nI = m_pTabControl->GetIndexForPoint( aPnt, nPageId );
+// if ( nI != -1 && m_nPageId == nPageId )
+// nIndex = nI;
+// }
return nIndex;
}
@@ -653,7 +639,7 @@ sal_Bool VCLXAccessibleTabPage::copyText( sal_Int32 nStartIndex, sal_Int32 nEndI
{
OUString sText( implGetTextRange( GetPageText(), nStartIndex, nEndIndex ) );
- vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+ rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, nullptr );
diff --git a/accessibility/source/standard/vclxaccessibletabpagewindow.cxx b/accessibility/source/standard/vclxaccessibletabpagewindow.cxx
index 30dc29b34213..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>
@@ -34,7 +35,7 @@ using namespace ::comphelper;
VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow )
:VCLXAccessibleComponent( pVCLXWindow )
{
- m_pTabPage = static_cast< TabPage* >( GetWindow().get() );
+ m_pTabPage = GetAs<TabPage>();
m_pTabControl = nullptr;
m_nPageId = 0;
if ( !m_pTabPage )
@@ -122,7 +123,7 @@ Reference< XAccessible > VCLXAccessibleTabPageWindow::getAccessibleParent( )
}
-sal_Int32 VCLXAccessibleTabPageWindow::getAccessibleIndexInParent( )
+sal_Int64 VCLXAccessibleTabPageWindow::getAccessibleIndexInParent( )
{
OExternalLockGuard aGuard( this );
diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
index a84c810223c3..f876f0b9ed38 100644
--- a/accessibility/source/standard/vclxaccessibletextcomponent.cxx
+++ b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
@@ -25,7 +25,9 @@
#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>
#include <vcl/unohelp2.hxx>
#include <vcl/ctrl.hxx>
@@ -43,11 +45,11 @@ using namespace ::comphelper;
VCLXAccessibleTextComponent::VCLXAccessibleTextComponent( VCLXWindow* pVCLXWindow )
- :VCLXAccessibleComponent( pVCLXWindow )
+ :ImplInheritanceHelper( pVCLXWindow )
{
VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
- m_sText = OutputDevice::GetNonMnemonicString( pWindow->GetText() );
+ m_sText = removeMnemonicFromString( pWindow->GetText() );
}
@@ -59,6 +61,14 @@ void VCLXAccessibleTextComponent::SetText( const OUString& sText )
m_sText = sText;
NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
}
+
+ // check whether accessible name has also changed, since text is (often) used as name as well
+ const OUString sName = getAccessibleName();
+ if (sName != m_sOldName)
+ {
+ NotifyAccessibleEvent(AccessibleEventId::NAME_CHANGED, Any(m_sOldName), Any(sName));
+ m_sOldName = sName;
+ }
}
@@ -86,7 +96,7 @@ OUString VCLXAccessibleTextComponent::implGetText()
OUString aText;
VclPtr<vcl::Window> pWindow = GetWindow();
if ( pWindow )
- aText = OutputDevice::GetNonMnemonicString( pWindow->GetText() );
+ aText = removeMnemonicFromString( pWindow->GetText() );
return aText;
}
@@ -116,18 +126,6 @@ void VCLXAccessibleTextComponent::disposing()
}
-// XInterface
-
-
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleTextComponent, VCLXAccessibleComponent, VCLXAccessibleTextComponent_BASE )
-
-
-// XTypeProvider
-
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleTextComponent, VCLXAccessibleComponent, VCLXAccessibleTextComponent_BASE )
-
-
// XAccessibleText
@@ -352,7 +350,7 @@ sal_Bool VCLXAccessibleTextComponent::copyText( sal_Int32 nStartIndex, sal_Int32
{
OUString sText( OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ) );
- vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+ rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, nullptr );
diff --git a/accessibility/source/standard/vclxaccessibletextfield.cxx b/accessibility/source/standard/vclxaccessibletextfield.cxx
index c94e46e3d5ed..4f43656419b0 100644
--- a/accessibility/source/standard/vclxaccessibletextfield.cxx
+++ b/accessibility/source/standard/vclxaccessibletextfield.cxx
@@ -18,6 +18,7 @@
*/
#include <standard/vclxaccessibletextfield.hxx>
+#include <comphelper/sequence.hxx>
#include <vcl/toolkit/lstbox.hxx>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
@@ -26,12 +27,11 @@
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::accessibility;
VCLXAccessibleTextField::VCLXAccessibleTextField (VCLXWindow* pVCLWindow, const Reference< XAccessible >& _xParent) :
- VCLXAccessibleTextComponent (pVCLWindow),
+ ImplInheritanceHelper (pVCLWindow),
m_xParent( _xParent )
{
@@ -48,9 +48,6 @@ OUString VCLXAccessibleTextField::implGetText()
return aText;
}
-IMPLEMENT_FORWARD_XINTERFACE2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
-IMPLEMENT_FORWARD_XTYPEPROVIDER2(VCLXAccessibleTextField, VCLXAccessibleTextComponent, VCLXAccessible_BASE)
-
// XAccessible
@@ -63,13 +60,13 @@ Reference<XAccessibleContext> SAL_CALL
// XAccessibleContext
-sal_Int32 SAL_CALL VCLXAccessibleTextField::getAccessibleChildCount()
+sal_Int64 SAL_CALL VCLXAccessibleTextField::getAccessibleChildCount()
{
return 0;
}
-Reference<XAccessible> SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal_Int32)
+Reference<XAccessible> SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal_Int64)
{
throw IndexOutOfBoundsException();
}
@@ -77,8 +74,6 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleTextField::getAccessibleChild (sal
sal_Int16 SAL_CALL VCLXAccessibleTextField::getAccessibleRole()
{
- ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() );
-
return AccessibleRole::TEXT;
}
@@ -94,14 +89,14 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleTextField::getAccessibleParent(
OUString VCLXAccessibleTextField::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleTextField";
+ return u"com.sun.star.comp.toolkit.AccessibleTextField"_ustr;
}
Sequence< OUString > VCLXAccessibleTextField::getSupportedServiceNames()
{
return comphelper::concatSequences(VCLXAccessibleTextComponent::getSupportedServiceNames(),
- Sequence<OUString>{"com.sun.star.accessibility.AccessibleTextField"});
+ Sequence<OUString>{u"com.sun.star.accessibility.AccessibleTextField"_ustr});
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index 1b63c38b373b..9094ce357b6b 100644
--- a/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -22,19 +22,17 @@
#include <standard/vclxaccessibletoolboxitem.hxx>
#include <toolkit/helper/convert.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#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>
#include <comphelper/types.hxx>
-#include <cppuhelper/typeprovider.hxx>
using namespace ::comphelper;
using namespace ::com::sun::star;
@@ -66,38 +64,26 @@ namespace
,m_nIndexInParent(_nIndexInParent)
{
}
- virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
+ virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override;
};
- sal_Int32 SAL_CALL OToolBoxWindowItemContext::getAccessibleIndexInParent( )
+ sal_Int64 SAL_CALL OToolBoxWindowItemContext::getAccessibleIndexInParent( )
{
- ::osl::MutexGuard aGuard( m_aMutex );
return m_nIndexInParent;
}
// = OToolBoxWindowItem
- typedef ::cppu::ImplHelper1 < XUnoTunnel
- > OToolBoxWindowItem_Base;
-
/** XAccessible implementation for a toolbox item which is represented by a VCL Window
*/
- class OToolBoxWindowItem
- :public OAccessibleWrapper
- ,public OToolBoxWindowItem_Base
+ class OToolBoxWindowItem : public OAccessibleWrapper
{
private:
sal_Int32 m_nIndexInParent;
public:
- sal_Int32 getIndexInParent() const { return m_nIndexInParent; }
- void setIndexInParent( sal_Int32 _nNewIndex ) { m_nIndexInParent = _nNewIndex; }
-
- static Sequence< sal_Int8 > getUnoTunnelId();
-
- public:
OToolBoxWindowItem(sal_Int32 _nIndexInParent,
const css::uno::Reference< css::uno::XComponentContext >& _rxContext,
const css::uno::Reference< css::accessibility::XAccessible >& _rxInnerAccessible,
@@ -111,49 +97,24 @@ namespace
}
protected:
- // XInterface
- DECLARE_XINTERFACE( )
- DECLARE_XTYPEPROVIDER( )
-
// OAccessibleWrapper
- virtual OAccessibleContextWrapper* createAccessibleContext(
+ virtual rtl::Reference<OAccessibleContextWrapper> createAccessibleContext(
const css::uno::Reference< css::accessibility::XAccessibleContext >& _rxInnerContext
) override;
-
- // XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const Sequence< sal_Int8 >& aIdentifier ) override;
};
- IMPLEMENT_FORWARD_XINTERFACE2( OToolBoxWindowItem, OAccessibleWrapper, OToolBoxWindowItem_Base )
- IMPLEMENT_FORWARD_XTYPEPROVIDER2( OToolBoxWindowItem, OAccessibleWrapper, OToolBoxWindowItem_Base )
-
- OAccessibleContextWrapper* OToolBoxWindowItem::createAccessibleContext(
+ rtl::Reference<OAccessibleContextWrapper> OToolBoxWindowItem::createAccessibleContext(
const Reference< XAccessibleContext >& _rxInnerContext )
{
return new OToolBoxWindowItemContext( m_nIndexInParent, getComponentContext(), _rxInnerContext, this, getParent() );
}
-
- Sequence< sal_Int8 > OToolBoxWindowItem::getUnoTunnelId()
- {
- static ::cppu::OImplementationId implId;
-
- return implId.getImplementationId();
- }
-
- sal_Int64 SAL_CALL OToolBoxWindowItem::getSomething( const Sequence< sal_Int8 >& _rId )
- {
- if (isUnoTunnelId<OToolBoxWindowItem>(_rId))
- return reinterpret_cast< sal_Int64>( this );
-
- return 0;
- }
}
// VCLXAccessibleToolBox
VCLXAccessibleToolBox::VCLXAccessibleToolBox( VCLXWindow* pVCLXWindow ) :
- VCLXAccessibleComponent( pVCLXWindow )
+ ImplInheritanceHelper( pVCLXWindow )
{
}
@@ -172,7 +133,7 @@ VCLXAccessibleToolBoxItem* VCLXAccessibleToolBox::GetItem_Impl( ToolBox::ImplToo
//TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
// returns only toolbox buttons, not windows
if ( aIter != m_aAccessibleChildren.end() && aIter->second.is())
- pItem = static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ pItem = aIter->second.get();
}
return pItem;
@@ -200,16 +161,15 @@ void VCLXAccessibleToolBox::UpdateFocus_Impl()
if ( !bHasFocus )
return;
- sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId();
+ ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId();
sal_uInt16 nFocusCount = 0;
for ( const auto& [rPos, rxChild] : m_aAccessibleChildren )
{
- sal_uInt16 nItemId = pToolBox->GetItemId( rPos );
+ ToolBoxItemId nItemId = pToolBox->GetItemId( rPos );
if ( rxChild.is() )
{
- VCLXAccessibleToolBoxItem* pItem =
- static_cast< VCLXAccessibleToolBoxItem* >( rxChild.get() );
+ VCLXAccessibleToolBoxItem* pItem = rxChild.get();
if ( pItem->HasFocus() && nItemId != nHighlightItemId )
{
// reset the old focused item
@@ -238,8 +198,7 @@ void VCLXAccessibleToolBox::ReleaseFocus_Impl( ToolBox::ImplToolItems::size_type
//TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() )
{
- VCLXAccessibleToolBoxItem* pItem =
- static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ VCLXAccessibleToolBoxItem* pItem = aIter->second.get();
if ( pItem->HasFocus() )
pItem->SetFocus( false );
}
@@ -252,15 +211,14 @@ void VCLXAccessibleToolBox::UpdateChecked_Impl( ToolBox::ImplToolItems::size_typ
if ( !pToolBox )
return;
- sal_uInt16 nFocusId = pToolBox->GetItemId( _nPos );
+ ToolBoxItemId nFocusId = pToolBox->GetItemId( _nPos );
VCLXAccessibleToolBoxItem* pFocusItem = nullptr;
for ( const auto& [rPos, rxChild] : m_aAccessibleChildren )
{
- sal_uInt16 nItemId = pToolBox->GetItemId( rPos );
+ ToolBoxItemId nItemId = pToolBox->GetItemId( rPos );
- VCLXAccessibleToolBoxItem* pItem =
- static_cast< VCLXAccessibleToolBoxItem* >( rxChild.get() );
+ VCLXAccessibleToolBoxItem* pItem = rxChild.get();
pItem->SetChecked( pToolBox->IsItemChecked( nItemId ) );
if ( nItemId == nFocusId )
pFocusItem = pItem;
@@ -276,14 +234,13 @@ void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( ToolBox::ImplToolItems::si
if ( !pToolBox )
return;
- sal_uInt16 nItemId = pToolBox->GetItemId( _nPos );
+ ToolBoxItemId nItemId = pToolBox->GetItemId( _nPos );
ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find( _nPos );
//TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
if ( aIter != m_aAccessibleChildren.end() && aIter->second.is() )
{
- VCLXAccessibleToolBoxItem* pItem =
- static_cast< VCLXAccessibleToolBoxItem* >( aIter->second.get() );
+ VCLXAccessibleToolBoxItem* pItem = aIter->second.get();
if ( pItem )
pItem->SetIndeterminate( pToolBox->GetItemState( nItemId ) == TRISTATE_INDET );
}
@@ -292,26 +249,17 @@ void VCLXAccessibleToolBox::UpdateIndeterminate_Impl( ToolBox::ImplToolItems::si
void VCLXAccessibleToolBox::implReleaseToolboxItem( ToolBoxItemsMap::iterator const & _rMapPos,
bool _bNotifyRemoval )
{
- Reference< XAccessible > xItemAcc( _rMapPos->second );
+ rtl::Reference<VCLXAccessibleToolBoxItem> xItemAcc(_rMapPos->second);
if ( !xItemAcc.is() )
return;
if ( _bNotifyRemoval )
{
- NotifyAccessibleEvent( AccessibleEventId::CHILD, Any( xItemAcc ), Any() );
+ NotifyAccessibleEvent(AccessibleEventId::CHILD, Any(Reference<XAccessible>(xItemAcc)), Any());
}
- auto pWindowItem = comphelper::getUnoTunnelImplementation<OToolBoxWindowItem>(xItemAcc);
- if ( !pWindowItem )
- {
- static_cast< VCLXAccessibleToolBoxItem* >( xItemAcc.get() )->ReleaseToolBox();
- ::comphelper::disposeComponent( xItemAcc );
- }
- else
- {
- Reference< XAccessibleContext > xContext( pWindowItem->getContextNoCreate() );
- ::comphelper::disposeComponent( xContext );
- }
+ xItemAcc->ReleaseToolBox();
+ xItemAcc->dispose();
}
void VCLXAccessibleToolBox::UpdateItem_Impl( ToolBox::ImplToolItems::size_type _nPos)
@@ -331,24 +279,12 @@ void VCLXAccessibleToolBox::UpdateItem_Impl( ToolBox::ImplToolItems::size_type _
//TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
while ( m_aAccessibleChildren.end() != aIndexAdjust )
{
- Reference< XAccessible > xItemAcc( aIndexAdjust->second );
-
- auto pWindowItem = comphelper::getUnoTunnelImplementation<OToolBoxWindowItem>(xItemAcc);
- if ( !pWindowItem )
- {
- VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xItemAcc.get() );
- if ( pItem )
- {
- sal_Int32 nIndex = pItem->getIndexInParent( );
- nIndex++;
- pItem->setIndexInParent( nIndex );
- }
- }
- else
+ rtl::Reference<VCLXAccessibleToolBoxItem> xItem(aIndexAdjust->second);
+ if (xItem.is())
{
- sal_Int32 nIndex = pWindowItem->getIndexInParent( );
+ sal_Int32 nIndex = xItem->getIndexInParent();
nIndex++;
- pWindowItem->setIndexInParent( nIndex );
+ xItem->setIndexInParent(nIndex);
}
++aIndexAdjust;
@@ -356,7 +292,7 @@ void VCLXAccessibleToolBox::UpdateItem_Impl( ToolBox::ImplToolItems::size_type _
// TODO: we should make this dependent on the existence of event listeners
// with the current implementation, we always create accessible object
- Any aNewChild( getAccessibleChild( static_cast<sal_Int32>(_nPos) ) );
+ Any aNewChild( getAccessibleChild( static_cast<sal_Int64>(_nPos) ) );
//TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), aNewChild );
}
@@ -380,8 +316,7 @@ void VCLXAccessibleToolBox::UpdateAllItems_Impl()
for ( i = 0; i < nCount; ++i )
{
Any aNewValue;
- aNewValue <<= getAccessibleChild( static_cast<sal_Int32>(i) );
- //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
+ aNewValue <<= getAccessibleChild(i);
NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), aNewValue );
}
}
@@ -392,7 +327,7 @@ void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( vcl::Window* pWindow, b
if( !(pWindow && pToolBox) )
return;
- const sal_uInt16 nDownItem = pToolBox->GetDownItemId();
+ const ToolBoxItemId nDownItem = pToolBox->GetDownItemId();
if ( !nDownItem )
// No item is currently in down state.
// Moreover, calling GetItemPos with 0 will find a separator if there is any.
@@ -401,8 +336,7 @@ void VCLXAccessibleToolBox::UpdateCustomPopupItemp_Impl( vcl::Window* pWindow, b
Reference< XAccessible > xChild( pWindow->GetAccessible() );
if( xChild.is() )
{
- Reference< XAccessible > xChildItem( getAccessibleChild( static_cast< sal_Int32 >( pToolBox->GetItemPos( nDownItem ) ) ) );
- //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
+ Reference< XAccessible > xChildItem( getAccessibleChild(pToolBox->GetItemPos(nDownItem)));
VCLXAccessibleToolBoxItem* pItem = static_cast< VCLXAccessibleToolBoxItem* >( xChildItem.get() );
pItem->SetChild( xChild );
@@ -434,7 +368,7 @@ void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWin
&& pChildWindow->GetType() == WindowType::TOOLBOX) )
return;
- const sal_uInt16 nCurItemId( pToolBox->GetCurItemId() );
+ const ToolBoxItemId nCurItemId( pToolBox->GetCurItemId() );
if ( !nCurItemId )
// No item is currently active (might happen when opening the overflow popup).
// Moreover, calling GetItemPos with 0 will find a separator if there is any.
@@ -442,7 +376,6 @@ void VCLXAccessibleToolBox::HandleSubToolBarEvent( const VclWindowEvent& rVclWin
ToolBox::ImplToolItems::size_type nIndex = pToolBox->GetItemPos( nCurItemId );
Reference< XAccessible > xItem = getAccessibleChild( nIndex );
- //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
if ( xItem.is() )
{
Reference< XAccessible > xChild = pChildWindow->GetAccessible();
@@ -464,7 +397,6 @@ void VCLXAccessibleToolBox::ReleaseSubToolBox( ToolBox* _pSubToolBox )
return; // not found
Reference< XAccessible > xItem = getAccessibleChild( nIndex );
- //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
if ( !xItem.is() )
return;
@@ -478,18 +410,18 @@ void VCLXAccessibleToolBox::ReleaseSubToolBox( ToolBox* _pSubToolBox )
}
}
-void VCLXAccessibleToolBox::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+void VCLXAccessibleToolBox::FillAccessibleStateSet( sal_Int64& rStateSet )
{
VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox )
{
- rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+ rStateSet |= AccessibleStateType::FOCUSABLE;
if ( pToolBox->IsHorizontal() )
- rStateSet.AddState( AccessibleStateType::HORIZONTAL );
+ rStateSet |= AccessibleStateType::HORIZONTAL;
else
- rStateSet.AddState( AccessibleStateType::VERTICAL );
+ rStateSet |= AccessibleStateType::VERTICAL;
}
}
@@ -564,7 +496,6 @@ void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindow
Any aNewValue;
aNewValue <<= getAccessibleChild(nPos);
- //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
NotifyAccessibleEvent( AccessibleEventId::CHILD, Any(), aNewValue );
break;
}
@@ -593,8 +524,8 @@ void VCLXAccessibleToolBox::ProcessWindowEvent( const VclWindowEvent& rVclWindow
if ( pWin && pWin->GetParent() &&
pWin->GetParent()->GetType() == WindowType::TOOLBOX )
{
- VCLXAccessibleToolBox* pParent = static_cast< VCLXAccessibleToolBox* >(
- pWin->GetParent()->GetAccessible()->getAccessibleContext().get() );
+ auto pParentAccContext = pWin->GetParent()->GetAccessible()->getAccessibleContext();
+ VCLXAccessibleToolBox* pParent = static_cast< VCLXAccessibleToolBox* >( pParentAccContext.get() );
if ( pParent )
pParent->ReleaseSubToolBox(static_cast<ToolBox *>(pWin.get()));
}
@@ -635,12 +566,6 @@ void VCLXAccessibleToolBox::ProcessWindowChildEvent( const VclWindowEvent& rVclW
}
}
-// XInterface
-IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleToolBox, VCLXAccessibleComponent, VCLXAccessibleToolBox_BASE )
-
-// XTypeProvider
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleToolBox, VCLXAccessibleComponent, VCLXAccessibleToolBox_BASE )
-
// XComponent
void SAL_CALL VCLXAccessibleToolBox::disposing()
{
@@ -658,34 +583,33 @@ void SAL_CALL VCLXAccessibleToolBox::disposing()
// XServiceInfo
OUString VCLXAccessibleToolBox::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleToolBox";
+ return u"com.sun.star.comp.toolkit.AccessibleToolBox"_ustr;
}
Sequence< OUString > VCLXAccessibleToolBox::getSupportedServiceNames()
{
return comphelper::concatSequences(VCLXAccessibleComponent::getSupportedServiceNames(),
- Sequence<OUString>{"com.sun.star.accessibility.AccessibleToolBox"});
+ Sequence<OUString>{u"com.sun.star.accessibility.AccessibleToolBox"_ustr});
}
// XAccessibleContext
-sal_Int32 SAL_CALL VCLXAccessibleToolBox::getAccessibleChildCount( )
+sal_Int64 SAL_CALL VCLXAccessibleToolBox::getAccessibleChildCount( )
{
comphelper::OExternalLockGuard aGuard( this );
return implGetAccessibleChildCount();
}
- sal_Int32 VCLXAccessibleToolBox::implGetAccessibleChildCount( )
+ sal_Int64 VCLXAccessibleToolBox::implGetAccessibleChildCount( )
{
- sal_Int32 nCount = 0;
+ sal_Int64 nCount = 0;
VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if ( pToolBox )
nCount = pToolBox->GetItemCount();
- //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
return nCount;
}
-Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal_Int64 i )
{
comphelper::OExternalLockGuard aGuard( this );
@@ -693,30 +617,34 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal
if ( (!pToolBox) || i < 0 || o3tl::make_unsigned(i) >= pToolBox->GetItemCount() )
throw IndexOutOfBoundsException();
- Reference< XAccessible > xChild;
+ rtl::Reference< VCLXAccessibleToolBoxItem > xChild;
// search for the child
ToolBoxItemsMap::iterator aIter = m_aAccessibleChildren.find(i);
if ( m_aAccessibleChildren.end() == aIter )
{
- sal_uInt16 nItemId = pToolBox->GetItemId( i );
- sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId();
+ ToolBoxItemId nItemId = pToolBox->GetItemId( i );
+ ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId();
vcl::Window* pItemWindow = pToolBox->GetItemWindow( nItemId );
// not found -> create a new child
- VCLXAccessibleToolBoxItem* pChild = new VCLXAccessibleToolBoxItem( pToolBox, i );
- Reference< XAccessible> xParent = pChild;
+ xChild = new VCLXAccessibleToolBoxItem( pToolBox, i );
if ( pItemWindow )
{
- xChild = new OToolBoxWindowItem(0,::comphelper::getProcessComponentContext(),pItemWindow->GetAccessible(),xParent);
- pItemWindow->SetAccessible(xChild);
- pChild->SetChild( xChild );
+ Reference< XAccessible> xParent = xChild;
+ auto const xInnerAcc(pItemWindow->GetAccessible());
+ if (xInnerAcc) // else child is being disposed - avoid crashing
+ {
+ rtl::Reference<OToolBoxWindowItem> xChild2(new OToolBoxWindowItem(0,
+ ::comphelper::getProcessComponentContext(), xInnerAcc, xParent));
+ pItemWindow->SetAccessible(xChild2);
+ xChild->SetChild( xChild2 );
+ }
}
- xChild = pChild;
- if ( nHighlightItemId > 0 && nItemId == nHighlightItemId )
- pChild->SetFocus( true );
+ if ( nHighlightItemId > ToolBoxItemId(0) && nItemId == nHighlightItemId )
+ xChild->SetFocus( true );
if ( pToolBox->IsItemChecked( nItemId ) )
- pChild->SetChecked( true );
+ xChild->SetChecked( true );
if ( pToolBox->GetItemState( nItemId ) == TRISTATE_INDET )
- pChild->SetIndeterminate( true );
+ xChild->SetIndeterminate( true );
m_aAccessibleChildren.emplace( i, xChild );
}
else
@@ -738,7 +666,6 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleAtPoint( c
ToolBox::ImplToolItems::size_type nItemPos = pToolBox->GetItemPos( VCLPoint( _rPoint ) );
if ( nItemPos != ToolBox::ITEM_NOTFOUND )
xAccessible = getAccessibleChild( nItemPos );
- //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
}
return xAccessible;
@@ -754,11 +681,10 @@ Reference< XAccessible > VCLXAccessibleToolBox::GetItemWindowAccessible( const V
ToolBox::ImplToolItems::size_type nCount = pToolBox->GetItemCount();
for (ToolBox::ImplToolItems::size_type i = 0 ; i < nCount && !xReturn.is() ; ++i)
{
- sal_uInt16 nItemId = pToolBox->GetItemId( i );
+ ToolBoxItemId nItemId = pToolBox->GetItemId( i );
vcl::Window* pItemWindow = pToolBox->GetItemWindow( nItemId );
if ( pItemWindow == pChildWindow )
xReturn = getAccessibleChild(i);
- //TODO: ToolBox::ImplToolItems::size_type -> sal_Int32!
}
}
return xReturn;
@@ -774,7 +700,7 @@ Reference< XAccessible > VCLXAccessibleToolBox::GetChildAccessible( const VclWin
}
// XAccessibleSelection
-void VCLXAccessibleToolBox::selectAccessibleChild( sal_Int32 nChildIndex )
+void VCLXAccessibleToolBox::selectAccessibleChild( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
@@ -785,7 +711,7 @@ void VCLXAccessibleToolBox::selectAccessibleChild( sal_Int32 nChildIndex )
pToolBox->ChangeHighlight( nChildIndex );
}
-sal_Bool VCLXAccessibleToolBox::isAccessibleChildSelected( sal_Int32 nChildIndex )
+sal_Bool VCLXAccessibleToolBox::isAccessibleChildSelected( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
@@ -811,15 +737,15 @@ void VCLXAccessibleToolBox::selectAllAccessibleChildren( )
// intentionally empty. makes no sense for a toolbox
}
-sal_Int32 VCLXAccessibleToolBox::getSelectedAccessibleChildCount( )
+sal_Int64 VCLXAccessibleToolBox::getSelectedAccessibleChildCount( )
{
OExternalLockGuard aGuard( this );
- sal_Int32 nRet = 0;
+ sal_Int64 nRet = 0;
VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if (pToolBox)
{
- sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId();
+ ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId();
for ( size_t i = 0, nCount = pToolBox->GetItemCount(); i < nCount; i++ )
{
if ( nHighlightItemId == pToolBox->GetItemId( i ) )
@@ -833,7 +759,7 @@ sal_Int32 VCLXAccessibleToolBox::getSelectedAccessibleChildCount( )
return nRet;
}
-Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex )
{
OExternalLockGuard aGuard( this );
if ( nSelectedChildIndex != 0 )
@@ -843,8 +769,8 @@ Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_
VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
if (pToolBox)
{
- sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId();
- for ( sal_Int32 i = 0, nCount = pToolBox->GetItemCount(); i < nCount; i++ )
+ ToolBoxItemId nHighlightItemId = pToolBox->GetHighlightItemId();
+ for (ToolBox::ImplToolItems::size_type i = 0, nCount = pToolBox->GetItemCount(); i < nCount; i++ )
{
if ( nHighlightItemId == pToolBox->GetItemId( i ) )
{
@@ -860,7 +786,7 @@ Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_
return xChild;
}
-void VCLXAccessibleToolBox::deselectAccessibleChild( sal_Int32 nChildIndex )
+void VCLXAccessibleToolBox::deselectAccessibleChild( sal_Int64 nChildIndex )
{
OExternalLockGuard aGuard( this );
if ( nChildIndex < 0 || nChildIndex >= implGetAccessibleChildCount() )
diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
index 64a08300ce59..b8e489c9f610 100644
--- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
@@ -29,13 +29,13 @@
#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>
#include <vcl/unohelp2.hxx>
#include <vcl/help.hxx>
#include <vcl/settings.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
#include <strings.hxx>
#include <sal/log.hxx>
@@ -67,9 +67,9 @@ VCLXAccessibleToolBoxItem::VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_In
m_bIndeterminate( false )
{
- OSL_ENSURE( m_pToolBox, "invalid toolbox" );
+ assert( m_pToolBox );
m_nItemId = m_pToolBox->GetItemId( m_nIndexInParent );
- m_sOldName = GetText();
+ m_sOldName = implGetAccessibleName();
m_bIsChecked = m_pToolBox->IsItemChecked( m_nItemId );
m_bIndeterminate = ( m_pToolBox->GetItemState( m_nItemId ) == TRISTATE_INDET );
ToolBoxItemType eType = m_pToolBox->GetItemType( m_nIndexInParent );
@@ -114,33 +114,6 @@ VCLXAccessibleToolBoxItem::~VCLXAccessibleToolBoxItem()
{
}
-OUString VCLXAccessibleToolBoxItem::GetText()
-{
- OUString sRet;
- // no text for separators and spaces
- if ( m_pToolBox && m_nItemId > 0 )
- {
- sRet = m_pToolBox->GetItemText( m_nItemId );
- if (sRet.isEmpty())
- {
- sRet = m_pToolBox->GetQuickHelpText( m_nItemId );
- if (sRet.isEmpty())
- {
- vcl::Window* pItemWindow = m_pToolBox->GetItemWindow( m_nItemId );
- if ( m_nRole == AccessibleRole::PANEL && pItemWindow && pItemWindow->GetAccessible().is() &&
- pItemWindow->GetAccessible()->getAccessibleContext().is() )
- {
- OUString sWinText = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName();
- if (!sWinText.isEmpty())
- sRet = sWinText;
- }
- }
- }
-
- }
- return sRet;
-}
-
void VCLXAccessibleToolBoxItem::SetFocus( bool _bFocus )
{
if ( m_bHasFocus != _bFocus )
@@ -189,7 +162,7 @@ void VCLXAccessibleToolBoxItem::SetIndeterminate( bool _bIndeterminate )
void VCLXAccessibleToolBoxItem::NameChanged()
{
- OUString sNewName = implGetText();
+ OUString sNewName = implGetAccessibleName();
if ( sNewName != m_sOldName )
{
Any aOldValue, aNewValue;
@@ -242,7 +215,11 @@ awt::Rectangle VCLXAccessibleToolBoxItem::implGetBounds( )
OUString VCLXAccessibleToolBoxItem::implGetText()
{
- return GetText();
+ // no text for separators and spaces
+ if (!m_pToolBox || m_nItemId <= ToolBoxItemId(0))
+ return OUString();
+
+ return m_pToolBox->GetItemText(m_nItemId);
}
Locale VCLXAccessibleToolBoxItem::implGetLocale()
@@ -258,7 +235,6 @@ void VCLXAccessibleToolBoxItem::implGetSelection( sal_Int32& nStartIndex, sal_In
// XInterface
-IMPLEMENT_FORWARD_REFCOUNT( VCLXAccessibleToolBoxItem, AccessibleTextHelper_BASE )
Any SAL_CALL VCLXAccessibleToolBoxItem::queryInterface( const Type& _rType )
{
// #i33611# - toolbox buttons without text don't support XAccessibleText
@@ -266,21 +242,14 @@ Any SAL_CALL VCLXAccessibleToolBoxItem::queryInterface( const Type& _rType )
&& ( !m_pToolBox || m_pToolBox->GetButtonType() == ButtonType::SYMBOLONLY ) )
return Any();
- css::uno::Any aReturn = AccessibleTextHelper_BASE::queryInterface( _rType );
- if ( !aReturn.hasValue() )
- aReturn = VCLXAccessibleToolBoxItem_BASE::queryInterface( _rType );
- return aReturn;
+ return ImplInheritanceHelper::queryInterface( _rType );
}
-// XTypeProvider
-
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleToolBoxItem, AccessibleTextHelper_BASE, VCLXAccessibleToolBoxItem_BASE )
-
// XComponent
void SAL_CALL VCLXAccessibleToolBoxItem::disposing()
{
- AccessibleTextHelper_BASE::disposing();
+ comphelper::OAccessibleTextHelper::disposing();
m_pToolBox = nullptr;
}
@@ -288,7 +257,7 @@ void SAL_CALL VCLXAccessibleToolBoxItem::disposing()
OUString VCLXAccessibleToolBoxItem::getImplementationName()
{
- return "com.sun.star.comp.toolkit.AccessibleToolBoxItem";
+ return u"com.sun.star.comp.toolkit.AccessibleToolBoxItem"_ustr;
}
sal_Bool VCLXAccessibleToolBoxItem::supportsService( const OUString& rServiceName )
@@ -298,10 +267,10 @@ sal_Bool VCLXAccessibleToolBoxItem::supportsService( const OUString& rServiceNam
Sequence< OUString > VCLXAccessibleToolBoxItem::getSupportedServiceNames()
{
- return {"com.sun.star.accessibility.AccessibleContext",
- "com.sun.star.accessibility.AccessibleComponent",
- "com.sun.star.accessibility.AccessibleExtendedComponent",
- "com.sun.star.accessibility.AccessibleToolBoxItem"};
+ return {u"com.sun.star.accessibility.AccessibleContext"_ustr,
+ u"com.sun.star.accessibility.AccessibleComponent"_ustr,
+ u"com.sun.star.accessibility.AccessibleExtendedComponent"_ustr,
+ u"com.sun.star.accessibility.AccessibleToolBoxItem"_ustr};
}
// XAccessible
@@ -313,14 +282,14 @@ Reference< XAccessibleContext > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibl
// XAccessibleContext
-sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleChildCount( )
+sal_Int64 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleChildCount( )
{
OContextEntryGuard aGuard( this );
return m_xChild.is() ? 1 : 0;
}
-Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleChild( sal_Int32 i )
+Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleChild( sal_Int64 i )
{
OContextEntryGuard aGuard( this );
@@ -338,7 +307,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleParent
return m_pToolBox->GetAccessible();
}
-sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleIndexInParent( )
+sal_Int64 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleIndexInParent( )
{
OContextEntryGuard aGuard( this );
@@ -369,53 +338,73 @@ OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleDescription( )
}
}
+OUString VCLXAccessibleToolBoxItem::implGetAccessibleName()
+{
+ OUString sRet = m_pToolBox->GetAccessibleName(m_nItemId);
+ if (!sRet.isEmpty())
+ return sRet;
+
+ sRet = implGetText();
+ if (!sRet.isEmpty())
+ return sRet;
+
+ sRet = m_pToolBox->GetQuickHelpText( m_nItemId );
+ if (!sRet.isEmpty())
+ return sRet;
+
+ vcl::Window* pItemWindow = m_pToolBox->GetItemWindow( m_nItemId );
+ if ( m_nRole == AccessibleRole::PANEL && pItemWindow && pItemWindow->GetAccessible().is() &&
+ pItemWindow->GetAccessible()->getAccessibleContext().is() )
+ {
+ sRet = pItemWindow->GetAccessible()->getAccessibleContext()->getAccessibleName();
+ }
+ return sRet;
+}
+
OUString SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleName( )
{
OExternalLockGuard aGuard( this );
-
- // entry text == accessible name
- return GetText();
+ return implGetAccessibleName();
}
Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleRelationSet( )
{
OContextEntryGuard aGuard( this );
- utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
- Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
- return xSet;
+ return new utl::AccessibleRelationSetHelper;
}
-Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleStateSet( )
+sal_Int64 SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleStateSet( )
{
OExternalLockGuard aGuard( this );
- utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
- Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
+ sal_Int64 nStateSet = 0;
if ( m_pToolBox && !rBHelper.bDisposed && !rBHelper.bInDispose )
{
- pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
+ nStateSet |= AccessibleStateType::FOCUSABLE;
+ if (m_pToolBox->GetItemBits(m_nItemId) & ToolBoxItemBits::CHECKABLE)
+ nStateSet |= AccessibleStateType::CHECKABLE;
if ( m_bIsChecked && m_nRole != AccessibleRole::PANEL )
- pStateSetHelper->AddState( AccessibleStateType::CHECKED );
+ nStateSet |= AccessibleStateType::CHECKED;
if ( m_bIndeterminate )
- pStateSetHelper->AddState( AccessibleStateType::INDETERMINATE );
+ nStateSet |= AccessibleStateType::INDETERMINATE;
if ( m_pToolBox->IsEnabled() && m_pToolBox->IsItemEnabled( m_nItemId ) )
{
- pStateSetHelper->AddState( AccessibleStateType::ENABLED );
- pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+ nStateSet |= AccessibleStateType::ENABLED;
+ nStateSet |= AccessibleStateType::SENSITIVE;
}
if ( m_pToolBox->IsItemVisible( m_nItemId ) )
- pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+ nStateSet |= AccessibleStateType::VISIBLE;
if ( m_pToolBox->IsItemReallyVisible( m_nItemId ) )
- pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+ nStateSet |= AccessibleStateType::SHOWING;
if ( m_bHasFocus )
- pStateSetHelper->AddState( AccessibleStateType::FOCUSED );
+ nStateSet |= AccessibleStateType::FOCUSED;
}
else
- pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+ nStateSet |= AccessibleStateType::DEFUNC;
- return xStateSet;
+ return nStateSet;
}
// XAccessibleText
@@ -424,26 +413,26 @@ OUString VCLXAccessibleToolBoxItem::getText()
{
OExternalLockGuard aGuard( this );
- return GetText();
+ return implGetText();
}
sal_Int32 VCLXAccessibleToolBoxItem::getCharacterCount()
{
- return GetText().getLength();
+ return implGetText().getLength();
}
sal_Unicode VCLXAccessibleToolBoxItem::getCharacter( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
- return OCommonAccessibleText::implGetCharacter( GetText(), nIndex );
+ return OCommonAccessibleText::implGetCharacter(implGetText(), nIndex);
}
OUString VCLXAccessibleToolBoxItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
{
OExternalLockGuard aGuard( this );
- return OCommonAccessibleText::implGetTextRange( GetText(), nStartIndex, nEndIndex );
+ return OCommonAccessibleText::implGetTextRange(implGetText(), nStartIndex, nEndIndex);
}
sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getCaretPosition()
@@ -455,7 +444,7 @@ sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::setCaretPosition( sal_Int32 nIndex
{
OExternalLockGuard aGuard( this );
- if ( !implIsValidRange( nIndex, nIndex, GetText().getLength() ) )
+ if (!implIsValidRange(nIndex, nIndex, implGetText().getLength()))
throw IndexOutOfBoundsException();
return false;
@@ -501,7 +490,7 @@ sal_Int32 SAL_CALL VCLXAccessibleToolBoxItem::getIndexAtPoint( const awt::Point&
sal_Int32 nIndex = -1;
if ( m_pToolBox && m_pToolBox->GetButtonType() != ButtonType::SYMBOLONLY ) // symbol buttons have no character bounds
{
- sal_uInt16 nItemId = 0;
+ ToolBoxItemId nItemId;
tools::Rectangle aItemRect = m_pToolBox->GetItemRect( m_nItemId );
Point aPnt( VCLPoint( aPoint ) );
aPnt += aItemRect.TopLeft();
@@ -539,7 +528,7 @@ sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::copyText( sal_Int32 nStartIndex, sa
{
OUString sText( OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ) );
- vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+ rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
SolarMutexReleaser aReleaser;
xClipboard->setContents( pDataObj, nullptr );
@@ -728,5 +717,10 @@ Any VCLXAccessibleToolBoxItem::getMinimumValue( )
return Any(sal_Int32(0));
}
+Any VCLXAccessibleToolBoxItem::getMinimumIncrement( )
+{
+ return Any(sal_Int32(1));
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */