summaryrefslogtreecommitdiff
path: root/accessibility/source/standard
diff options
context:
space:
mode:
Diffstat (limited to 'accessibility/source/standard')
-rw-r--r--accessibility/source/standard/accessiblemenubasecomponent.cxx674
-rw-r--r--accessibility/source/standard/accessiblemenucomponent.cxx382
-rw-r--r--accessibility/source/standard/accessiblemenuitemcomponent.cxx452
-rw-r--r--accessibility/source/standard/vclxaccessiblemenu.cxx222
-rw-r--r--accessibility/source/standard/vclxaccessiblemenubar.cxx188
-rw-r--r--accessibility/source/standard/vclxaccessiblemenuitem.cxx577
-rw-r--r--accessibility/source/standard/vclxaccessiblemenuseparator.cxx49
-rw-r--r--accessibility/source/standard/vclxaccessiblepopupmenu.cxx85
8 files changed, 0 insertions, 2629 deletions
diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx
deleted file mode 100644
index dbedd1daff30..000000000000
--- a/accessibility/source/standard/accessiblemenubasecomponent.cxx
+++ /dev/null
@@ -1,674 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <standard/accessiblemenubasecomponent.hxx>
-#include <standard/vclxaccessiblemenu.hxx>
-#include <standard/vclxaccessiblemenuitem.hxx>
-#include <standard/vclxaccessiblemenuseparator.hxx>
-
-#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <comphelper/accessiblecontexthelper.hxx>
-#include <cppuhelper/supportsservice.hxx>
-#include <o3tl/safeint.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/unohelp.hxx>
-#include <vcl/vclevent.hxx>
-
-#include <array>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::accessibility;
-using namespace ::comphelper;
-
-
-// OAccessibleMenuBaseComponent
-
-
-OAccessibleMenuBaseComponent::OAccessibleMenuBaseComponent( Menu* pMenu )
- :m_pMenu( pMenu )
- ,m_bEnabled( false )
- ,m_bFocused( false )
- ,m_bVisible( false )
- ,m_bSelected( false )
- ,m_bChecked( false )
-{
- if ( m_pMenu )
- {
- m_aAccessibleChildren.assign( m_pMenu->GetItemCount(), rtl::Reference< OAccessibleMenuItemComponent >() );
- m_pMenu->AddEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) );
- }
-}
-
-
-OAccessibleMenuBaseComponent::~OAccessibleMenuBaseComponent()
-{
- if ( m_pMenu )
- m_pMenu->RemoveEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) );
-}
-
-
-bool OAccessibleMenuBaseComponent::IsEnabled()
-{
- return false;
-}
-
-
-bool OAccessibleMenuBaseComponent::IsFocused()
-{
- return false;
-}
-
-
-bool OAccessibleMenuBaseComponent::IsVisible()
-{
- return false;
-}
-
-
-bool OAccessibleMenuBaseComponent::IsSelected()
-{
- return false;
-}
-
-
-bool OAccessibleMenuBaseComponent::IsChecked()
-{
- return false;
-}
-
-
-void OAccessibleMenuBaseComponent::SetStates()
-{
- m_bEnabled = IsEnabled();
- m_bFocused = IsFocused();
- m_bVisible = IsVisible();
- m_bSelected = IsSelected();
- m_bChecked = IsChecked();
-}
-
-
-void OAccessibleMenuBaseComponent::SetEnabled( bool bEnabled )
-{
- if ( m_bEnabled == bEnabled )
- return;
-
- sal_Int64 nStateType=AccessibleStateType::ENABLED;
- if (IsMenuHideDisabledEntries())
- {
- nStateType = AccessibleStateType::VISIBLE;
- }
- std::array<Any, 2> aOldValue, aNewValue;
- if ( m_bEnabled )
- {
- aOldValue[0] <<= AccessibleStateType::SENSITIVE;
- aOldValue[1] <<= nStateType;
- }
- else
- {
- aNewValue[0] <<= nStateType;
- aNewValue[1] <<= AccessibleStateType::SENSITIVE;
- }
- m_bEnabled = bEnabled;
- NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[0], aNewValue[0] );
- NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue[1], aNewValue[1] );
-}
-
-
-void OAccessibleMenuBaseComponent::SetFocused( bool bFocused )
-{
- if ( m_bFocused != bFocused )
- {
- Any aOldValue, aNewValue;
- if ( m_bFocused )
- aOldValue <<= AccessibleStateType::FOCUSED;
- else
- aNewValue <<= AccessibleStateType::FOCUSED;
- m_bFocused = bFocused;
- NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
- }
-}
-
-
-void OAccessibleMenuBaseComponent::SetVisible( bool bVisible )
-{
- if ( m_bVisible != bVisible )
- {
- Any aOldValue, aNewValue;
- if ( m_bVisible )
- aOldValue <<= AccessibleStateType::VISIBLE;
- else
- aNewValue <<= AccessibleStateType::VISIBLE;
- m_bVisible = bVisible;
- NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
- }
-}
-
-
-void OAccessibleMenuBaseComponent::SetSelected( bool bSelected )
-{
- if ( m_bSelected != bSelected )
- {
- Any aOldValue, aNewValue;
- if ( m_bSelected )
- aOldValue <<= AccessibleStateType::SELECTED;
- else
- aNewValue <<= AccessibleStateType::SELECTED;
- m_bSelected = bSelected;
- NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
- }
-}
-
-
-void OAccessibleMenuBaseComponent::SetChecked( bool bChecked )
-{
- if ( m_bChecked != bChecked )
- {
- Any aOldValue, aNewValue;
- if ( m_bChecked )
- aOldValue <<= AccessibleStateType::CHECKED;
- else
- aNewValue <<= AccessibleStateType::CHECKED;
- m_bChecked = bChecked;
- NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
- }
-}
-
-
-void OAccessibleMenuBaseComponent::UpdateEnabled( sal_Int32 i, bool bEnabled )
-{
- if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
- {
- rtl::Reference< OAccessibleMenuBaseComponent > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
- xChild->SetEnabled( bEnabled );
- }
-}
-
-
-void OAccessibleMenuBaseComponent::UpdateFocused( sal_Int32 i, bool bFocused )
-{
- if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
- {
- rtl::Reference< OAccessibleMenuBaseComponent > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
- xChild->SetFocused( bFocused );
- }
-}
-
-
-void OAccessibleMenuBaseComponent::UpdateVisible()
-{
- SetVisible( IsVisible() );
- for (const rtl::Reference<OAccessibleMenuItemComponent>& xChild : m_aAccessibleChildren)
- {
- if ( xChild.is() )
- xChild->SetVisible( xChild->IsVisible() );
- }
-}
-
-
-void OAccessibleMenuBaseComponent::UpdateSelected( sal_Int32 i, bool bSelected )
-{
- NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() );
-
- if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
- {
- rtl::Reference< OAccessibleMenuBaseComponent > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
- xChild->SetSelected( bSelected );
- }
-}
-
-
-void OAccessibleMenuBaseComponent::UpdateChecked( sal_Int32 i, bool bChecked )
-{
- if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
- {
- rtl::Reference< OAccessibleMenuBaseComponent > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
- xChild->SetChecked( bChecked );
- }
-}
-
-
-void OAccessibleMenuBaseComponent::UpdateAccessibleName( sal_Int32 i )
-{
- if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
- {
- rtl::Reference< OAccessibleMenuBaseComponent > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
- {
- OAccessibleMenuItemComponent* pComp = static_cast< OAccessibleMenuItemComponent* >( xChild.get() );
- if ( pComp )
- pComp->SetAccessibleName( pComp->GetAccessibleName() );
- }
- }
-}
-
-void OAccessibleMenuBaseComponent::UpdateItemRole(sal_Int32 i)
-{
- if (i < 0 || o3tl::make_unsigned(i) >= m_aAccessibleChildren.size())
- return;
-
- rtl::Reference<OAccessibleMenuItemComponent> xChild(m_aAccessibleChildren[i]);
- if (!xChild.is())
- return;
-
- xChild->NotifyAccessibleEvent(AccessibleEventId::ROLE_CHANGED, Any(), Any());
-}
-
-void OAccessibleMenuBaseComponent::UpdateItemText( sal_Int32 i )
-{
- if ( i >= 0 && o3tl::make_unsigned(i) < m_aAccessibleChildren.size() )
- {
- rtl::Reference< OAccessibleMenuItemComponent > xChild( m_aAccessibleChildren[i] );
- if ( xChild.is() )
- xChild->SetItemText( xChild->GetItemText() );
- }
-}
-
-
-sal_Int64 OAccessibleMenuBaseComponent::GetChildCount() const
-{
- return m_aAccessibleChildren.size();
-}
-
-
-Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int64 i )
-{
- rtl::Reference< OAccessibleMenuItemComponent > xChild = m_aAccessibleChildren[i];
- if ( !xChild.is() )
- {
- if ( m_pMenu )
- {
- // create a new child
- if ( m_pMenu->GetItemType( static_cast<sal_uInt16>(i) ) == MenuItemType::SEPARATOR )
- {
- xChild = new VCLXAccessibleMenuSeparator(m_pMenu, static_cast<sal_uInt16>(i));
- }
- else
- {
- PopupMenu* pPopupMenu = m_pMenu->GetPopupMenu( m_pMenu->GetItemId( static_cast<sal_uInt16>(i) ) );
- if ( pPopupMenu )
- {
- xChild = new VCLXAccessibleMenu(m_pMenu, static_cast<sal_uInt16>(i), pPopupMenu);
- pPopupMenu->SetAccessible(xChild);
- }
- else
- {
- xChild = new VCLXAccessibleMenuItem(m_pMenu, static_cast<sal_uInt16>(i));
- }
- }
-
- // set states
- xChild->SetStates();
-
- // insert into menu item list
- m_aAccessibleChildren[i] = xChild;
- }
- }
-
- return xChild;
-}
-
-
-Reference< XAccessible > OAccessibleMenuBaseComponent::GetChildAt( const awt::Point& rPoint )
-{
- for ( sal_Int64 i = 0, nCount = getAccessibleChildCount(); i < nCount; ++i )
- {
- Reference< XAccessible > xAcc = getAccessibleChild( i );
- if ( xAcc.is() )
- {
- Reference< XAccessibleComponent > xComp( xAcc->getAccessibleContext(), UNO_QUERY );
- if ( xComp.is() )
- {
- tools::Rectangle aRect = vcl::unohelper::ConvertToVCLRect(xComp->getBounds());
- Point aPos = vcl::unohelper::ConvertToVCLPoint(rPoint);
- if ( aRect.Contains( aPos ) )
- {
- return xAcc;
- }
- }
- }
- }
-
- return nullptr;
-}
-
-
-void OAccessibleMenuBaseComponent::InsertChild( sal_Int32 i )
-{
- if ( i < 0 )
- return;
-
- if ( o3tl::make_unsigned(i) > m_aAccessibleChildren.size() )
- i = m_aAccessibleChildren.size();
-
- // insert entry in child list
- m_aAccessibleChildren.insert( m_aAccessibleChildren.begin() + i, rtl::Reference< OAccessibleMenuItemComponent >() );
-
- // update item position of accessible children
- for ( sal_uInt32 j = i, nCount = m_aAccessibleChildren.size(); j < nCount; ++j )
- {
- rtl::Reference< OAccessibleMenuItemComponent > xAcc( m_aAccessibleChildren[j] );
- if ( xAcc.is() )
- xAcc->SetItemPos( static_cast<sal_uInt16>(j) );
- }
-
- // send accessible child event
- Reference< XAccessible > xChild( GetChild( i ) );
- if ( xChild.is() )
- {
- Any aOldValue, aNewValue;
- aNewValue <<= xChild;
- NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
- }
-}
-
-
-void OAccessibleMenuBaseComponent::RemoveChild( sal_Int32 i )
-{
- if ( i < 0 || o3tl::make_unsigned(i) >= m_aAccessibleChildren.size() )
- return;
-
- // keep the accessible of the removed item
- rtl::Reference< OAccessibleMenuItemComponent > xChild( m_aAccessibleChildren[i] );
-
- // remove entry in child list
- m_aAccessibleChildren.erase( m_aAccessibleChildren.begin() + i );
-
- // update item position of accessible children
- for ( sal_uInt32 j = i, nCount = m_aAccessibleChildren.size(); j < nCount; ++j )
- {
- rtl::Reference< OAccessibleMenuItemComponent > xAcc( m_aAccessibleChildren[j] );
- if ( xAcc.is() )
- xAcc->SetItemPos( static_cast<sal_uInt16>(j) );
- }
-
- // send accessible child event
- if ( xChild.is() )
- {
- Any aOldValue, aNewValue;
- aOldValue <<= uno::Reference<XAccessible>(xChild);
- NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue );
-
- xChild->dispose();
- }
-}
-
-
-bool OAccessibleMenuBaseComponent::IsHighlighted()
-{
- return false;
-}
-
-
-bool OAccessibleMenuBaseComponent::IsChildHighlighted()
-{
- bool bChildHighlighted = false;
-
- for (const rtl::Reference<OAccessibleMenuItemComponent>& xChild : m_aAccessibleChildren)
- {
- if ( xChild.is() && xChild->IsHighlighted() )
- {
- bChildHighlighted = true;
- break;
- }
- }
-
- return bChildHighlighted;
-}
-
-
-void OAccessibleMenuBaseComponent::SelectChild( sal_Int32 i )
-{
- // open the menu
- if ( getAccessibleRole() == AccessibleRole::MENU && !IsPopupMenuOpen() )
- Click();
-
- // highlight the child
- if ( m_pMenu )
- m_pMenu->HighlightItem( static_cast<sal_uInt16>(i) );
-}
-
-
-void OAccessibleMenuBaseComponent::DeSelectAll()
-{
- if ( m_pMenu )
- m_pMenu->DeHighlight();
-}
-
-
-bool OAccessibleMenuBaseComponent::IsChildSelected( sal_Int32 i )
-{
- bool bSelected = false;
-
- if ( m_pMenu && m_pMenu->IsHighlighted( static_cast<sal_uInt16>(i) ) )
- bSelected = true;
-
- return bSelected;
-}
-
-
-void OAccessibleMenuBaseComponent::Click()
-{
-}
-
-
-bool OAccessibleMenuBaseComponent::IsPopupMenuOpen()
-{
- return false;
-}
-
-
-IMPL_LINK( OAccessibleMenuBaseComponent, MenuEventListener, VclMenuEvent&, rEvent, void )
-{
- OSL_ENSURE( rEvent.GetMenu(), "OAccessibleMenuBaseComponent - Menu?" );
- ProcessMenuEvent( rEvent );
-}
-
-
-void OAccessibleMenuBaseComponent::ProcessMenuEvent( const VclMenuEvent& rVclMenuEvent )
-{
- sal_uInt16 nItemPos = rVclMenuEvent.GetItemPos();
-
- switch ( rVclMenuEvent.GetId() )
- {
- case VclEventId::MenuShow:
- case VclEventId::MenuHide:
- {
- UpdateVisible();
- }
- break;
- case VclEventId::MenuHighlight:
- {
- SetFocused( false );
- UpdateFocused( nItemPos, true );
- UpdateSelected( nItemPos, true );
- }
- break;
- case VclEventId::MenuDehighlight:
- {
- UpdateFocused( nItemPos, false );
- UpdateSelected( nItemPos, false );
- }
- break;
- case VclEventId::MenuSubmenuActivate:
- {
- }
- break;
- case VclEventId::MenuSubmenuDeactivate:
- {
- UpdateFocused( nItemPos, true );
- }
- break;
- case VclEventId::MenuEnable:
- {
- UpdateEnabled( nItemPos, true );
- }
- break;
- case VclEventId::MenuDisable:
- {
- UpdateEnabled( nItemPos, false );
- }
- break;
- case VclEventId::MenuSubmenuChanged:
- {
- RemoveChild( nItemPos );
- InsertChild( nItemPos );
- }
- break;
- case VclEventId::MenuInsertItem:
- {
- InsertChild( nItemPos );
- }
- break;
- case VclEventId::MenuRemoveItem:
- {
- RemoveChild( nItemPos );
- }
- break;
- case VclEventId::MenuAccessibleNameChanged:
- {
- UpdateAccessibleName( nItemPos );
- }
- break;
- case VclEventId::MenuItemRoleChanged:
- {
- UpdateItemRole(nItemPos);
- }
- break;
- case VclEventId::MenuItemTextChanged:
- {
- UpdateAccessibleName( nItemPos );
- UpdateItemText( nItemPos );
- }
- break;
- case VclEventId::MenuItemChecked:
- {
- UpdateChecked( nItemPos, true );
- }
- break;
- case VclEventId::MenuItemUnchecked:
- {
- UpdateChecked( nItemPos, false );
- }
- break;
- case VclEventId::ObjectDying:
- {
- if ( m_pMenu )
- {
- m_pMenu->RemoveEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) );
-
- m_pMenu = nullptr;
-
- // dispose all menu items
- for (const rtl::Reference<OAccessibleMenuItemComponent>& xComponent : m_aAccessibleChildren)
- {
- if ( xComponent.is() )
- xComponent->dispose();
- }
- m_aAccessibleChildren.clear();
- }
- }
- break;
- default:
- {
- }
- break;
- }
-}
-
-
-// XComponent
-
-
-void OAccessibleMenuBaseComponent::disposing()
-{
- OAccessibleExtendedComponentHelper::disposing();
-
- if ( !m_pMenu )
- return;
-
- m_pMenu->RemoveEventListener( LINK( this, OAccessibleMenuBaseComponent, MenuEventListener ) );
-
- m_pMenu = nullptr;
-
- // dispose all menu items
- for (const rtl::Reference<OAccessibleMenuItemComponent>& xComponent : m_aAccessibleChildren)
- {
- if ( xComponent.is() )
- xComponent->dispose();
- }
- m_aAccessibleChildren.clear();
-}
-
-
-// XServiceInfo
-
-
-sal_Bool OAccessibleMenuBaseComponent::supportsService( const OUString& rServiceName )
-{
- return cppu::supportsService(this, rServiceName);
-}
-
-
-// XAccessible
-
-
-Reference< XAccessibleContext > OAccessibleMenuBaseComponent::getAccessibleContext( )
-{
- OExternalLockGuard aGuard( this );
-
- return this;
-}
-
-
-// XAccessibleContext
-
-
-sal_Int64 OAccessibleMenuBaseComponent::getAccessibleStateSet( )
-{
- OExternalLockGuard aGuard( this );
-
- sal_Int64 nStateSet = 0;
-
- if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
- {
- FillAccessibleStateSet( nStateSet );
- }
- else
- {
- nStateSet |= AccessibleStateType::DEFUNC;
- }
-
- return nStateSet;
-}
-
-
-bool OAccessibleMenuBaseComponent::IsMenuHideDisabledEntries()
-{
- return false;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx
deleted file mode 100644
index 7fe594721294..000000000000
--- a/accessibility/source/standard/accessiblemenucomponent.cxx
+++ /dev/null
@@ -1,382 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <standard/accessiblemenucomponent.hxx>
-
-#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/XVclWindowPeer.hpp>
-#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <comphelper/accessiblecontexthelper.hxx>
-#include <unotools/accessiblerelationsethelper.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/window.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/settings.hxx>
-#include <vcl/unohelp.hxx>
-#include <i18nlangtag/languagetag.hxx>
-
-using namespace ::com::sun::star::accessibility;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star;
-using namespace ::comphelper;
-
-
-
-
-bool OAccessibleMenuComponent::IsEnabled()
-{
- return true;
-}
-
-
-bool OAccessibleMenuComponent::IsVisible()
-{
- bool bVisible = false;
-
- if ( m_pMenu )
- bVisible = m_pMenu->IsMenuVisible();
-
- return bVisible;
-}
-
-
-void OAccessibleMenuComponent::FillAccessibleStateSet( sal_Int64& rStateSet )
-{
- if ( IsEnabled() )
- {
- rStateSet |= AccessibleStateType::ENABLED;
- rStateSet |= AccessibleStateType::SENSITIVE;
- }
-
- rStateSet |= AccessibleStateType::FOCUSABLE;
-
- if ( IsFocused() )
- rStateSet |= AccessibleStateType::FOCUSED;
-
- if ( IsVisible() )
- {
- rStateSet |= AccessibleStateType::VISIBLE;
- rStateSet |= AccessibleStateType::SHOWING;
- }
-
- rStateSet |= AccessibleStateType::OPAQUE;
-}
-
-
-// OCommonAccessibleComponent
-
-
-awt::Rectangle OAccessibleMenuComponent::implGetBounds()
-{
- awt::Rectangle aBounds( 0, 0, 0, 0 );
-
- if ( m_pMenu )
- {
- vcl::Window* pWindow = m_pMenu->GetWindow();
- if ( pWindow )
- {
- // get bounding rectangle of the window in screen coordinates
- AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute();
- aBounds = vcl::unohelper::ConvertToAWTRect(aRect);
-
- // get position of the accessible parent in screen coordinates
- Reference< XAccessible > xParent = getAccessibleParent();
- if ( xParent.is() )
- {
- Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY );
- if ( xParentComponent.is() )
- {
- awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen();
-
- // calculate position of the window relative to the accessible parent
- aBounds.X -= aParentScreenLoc.X;
- aBounds.Y -= aParentScreenLoc.Y;
- }
- }
- }
- }
-
- return aBounds;
-}
-
-
-// XAccessibleContext
-
-
-sal_Int64 OAccessibleMenuComponent::getAccessibleChildCount()
-{
- OExternalLockGuard aGuard( this );
-
- return GetChildCount();
-}
-
-
-Reference< XAccessible > OAccessibleMenuComponent::getAccessibleChild( sal_Int64 i )
-{
- OExternalLockGuard aGuard( this );
-
- if ( i < 0 || i >= GetChildCount() )
- throw IndexOutOfBoundsException();
-
- return GetChild( i );
-}
-
-
-Reference< XAccessible > OAccessibleMenuComponent::getAccessibleParent( )
-{
- OExternalLockGuard aGuard( this );
-
- Reference< XAccessible > xParent;
-
- if ( m_pMenu )
- {
- vcl::Window* pWindow = m_pMenu->GetWindow();
- if ( pWindow )
- {
- vcl::Window* pParent = pWindow->GetAccessibleParentWindow();
- if ( pParent )
- xParent = pParent->GetAccessible();
- }
- }
-
- return xParent;
-}
-
-
-sal_Int16 OAccessibleMenuComponent::getAccessibleRole( )
-{
- OExternalLockGuard aGuard( this );
-
- return AccessibleRole::UNKNOWN;
-}
-
-
-OUString OAccessibleMenuComponent::getAccessibleDescription( )
-{
- OExternalLockGuard aGuard( this );
-
- OUString sDescription;
- if ( m_pMenu )
- {
- vcl::Window* pWindow = m_pMenu->GetWindow();
- if ( pWindow )
- sDescription = pWindow->GetAccessibleDescription();
- }
-
- return sDescription;
-}
-
-
-OUString OAccessibleMenuComponent::getAccessibleName( )
-{
- OExternalLockGuard aGuard( this );
-
- return OUString();
-}
-
-
-Reference< XAccessibleRelationSet > OAccessibleMenuComponent::getAccessibleRelationSet( )
-{
- OExternalLockGuard aGuard( this );
-
- return new utl::AccessibleRelationSetHelper;
-}
-
-
-Locale OAccessibleMenuComponent::getLocale( )
-{
- OExternalLockGuard aGuard( this );
-
- return Application::GetSettings().GetLanguageTag().getLocale();
-}
-
-
-// XAccessibleComponent
-
-
-Reference< XAccessible > OAccessibleMenuComponent::getAccessibleAtPoint( const awt::Point& rPoint )
-{
- OExternalLockGuard aGuard( this );
-
- return GetChildAt( rPoint );
-}
-
-
-awt::Point OAccessibleMenuComponent::getLocationOnScreen( )
-{
- OExternalLockGuard aGuard( this );
-
- awt::Point aPos;
-
- if ( m_pMenu )
- {
- vcl::Window* pWindow = m_pMenu->GetWindow();
- if ( pWindow )
- {
- AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute();
- aPos = vcl::unohelper::ConvertToAWTPoint(aRect.TopLeft());
- }
- }
-
- return aPos;
-}
-
-
-void OAccessibleMenuComponent::grabFocus( )
-{
- OExternalLockGuard aGuard( this );
-
- if ( m_pMenu )
- {
- vcl::Window* pWindow = m_pMenu->GetWindow();
- if ( pWindow )
- pWindow->GrabFocus();
- }
-}
-
-
-sal_Int32 OAccessibleMenuComponent::getForeground( )
-{
- OExternalLockGuard aGuard( this );
-
- const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
- Color nColor = rStyleSettings.GetMenuTextColor();
-
- return sal_Int32(nColor);
-}
-
-
-sal_Int32 OAccessibleMenuComponent::getBackground( )
-{
- OExternalLockGuard aGuard( this );
-
- return 0;
-}
-
-
-// XAccessibleExtendedComponent
-
-OUString OAccessibleMenuComponent::getTitledBorderText( )
-{
- OExternalLockGuard aGuard( this );
-
- return OUString();
-}
-
-
-OUString OAccessibleMenuComponent::getToolTipText( )
-{
- OExternalLockGuard aGuard( this );
-
- return OUString();
-}
-
-
-// XAccessibleSelection
-
-
-void OAccessibleMenuComponent::selectAccessibleChild( sal_Int64 nChildIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
- throw IndexOutOfBoundsException();
-
- SelectChild( nChildIndex );
-}
-
-
-sal_Bool OAccessibleMenuComponent::isAccessibleChildSelected( sal_Int64 nChildIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
- throw IndexOutOfBoundsException();
-
- return IsChildSelected( nChildIndex );
-}
-
-
-void OAccessibleMenuComponent::clearAccessibleSelection( )
-{
- OExternalLockGuard aGuard( this );
-
- DeSelectAll();
-}
-
-
-void OAccessibleMenuComponent::selectAllAccessibleChildren( )
-{
- // This method makes no sense in a menu, and so does nothing.
-}
-
-
-sal_Int64 OAccessibleMenuComponent::getSelectedAccessibleChildCount( )
-{
- OExternalLockGuard aGuard( this );
-
- sal_Int64 nRet = 0;
-
- for ( sal_Int64 i = 0, nCount = GetChildCount(); i < nCount; i++ )
- {
- if ( IsChildSelected( i ) )
- ++nRet;
- }
-
- return nRet;
-}
-
-
-Reference< XAccessible > OAccessibleMenuComponent::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
- throw IndexOutOfBoundsException();
-
- Reference< XAccessible > xChild;
-
- for ( sal_Int64 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ )
- {
- if ( IsChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
- {
- xChild = GetChild( i );
- break;
- }
- }
-
- return xChild;
-}
-
-
-void OAccessibleMenuComponent::deselectAccessibleChild( sal_Int64 nChildIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
- throw IndexOutOfBoundsException();
-
- DeSelectAll();
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
deleted file mode 100644
index 0d171e64ccaa..000000000000
--- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx
+++ /dev/null
@@ -1,452 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <standard/accessiblemenuitemcomponent.hxx>
-
-#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <unotools/accessiblerelationsethelper.hxx>
-#include <comphelper/accessiblecontexthelper.hxx>
-#include <comphelper/accessibletexthelper.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/unohelp.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::lang;
-using namespace ::com::sun::star;
-using namespace ::comphelper;
-
-
-
-
-OAccessibleMenuItemComponent::OAccessibleMenuItemComponent( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu )
- :OAccessibleMenuBaseComponent( pMenu )
- ,m_pParent( pParent )
- ,m_nItemPos( nItemPos )
-{
- m_sAccessibleName = GetAccessibleName();
- m_sItemText = GetItemText();
-}
-
-OAccessibleMenuItemComponent::~OAccessibleMenuItemComponent()
-{
-}
-
-bool OAccessibleMenuItemComponent::IsEnabled()
-{
- OExternalLockGuard aGuard( this );
-
- bool bEnabled = false;
- if ( m_pParent )
- bEnabled = m_pParent->IsItemEnabled( m_pParent->GetItemId( m_nItemPos ) );
-
- return bEnabled;
-}
-
-
-bool OAccessibleMenuItemComponent::IsVisible()
-{
- bool bVisible = false;
-
- if ( m_pParent )
- bVisible = m_pParent->IsItemPosVisible( m_nItemPos );
-
- return bVisible;
-}
-
-
-void OAccessibleMenuItemComponent::Select()
-{
- // open the parent menu
- Reference< XAccessible > xParent( getAccessibleParent() );
- if ( xParent.is() )
- {
- OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() );
- if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() )
- pComp->Click();
- }
-
- // highlight the menu item
- if ( m_pParent )
- m_pParent->HighlightItem( m_nItemPos );
-}
-
-
-void OAccessibleMenuItemComponent::DeSelect()
-{
- if ( m_pParent && IsSelected() )
- m_pParent->DeHighlight();
-}
-
-
-void OAccessibleMenuItemComponent::Click()
-{
- // open the parent menu
- Reference< XAccessible > xParent( getAccessibleParent() );
- if ( xParent.is() )
- {
- OAccessibleMenuBaseComponent* pComp = static_cast< OAccessibleMenuBaseComponent* >( xParent.get() );
- if ( pComp && pComp->getAccessibleRole() == AccessibleRole::MENU && !pComp->IsPopupMenuOpen() )
- pComp->Click();
- }
-
- // click the menu item
- if ( !m_pParent )
- return;
-
- vcl::Window* pWindow = m_pParent->GetWindow();
- if ( !pWindow )
- return;
-
- // #102438# Menu items are not selectable
- // Popup menus are executed asynchronously, triggered by a timer.
- // As Menu::SelectItem only works, if the corresponding menu window is
- // already created, we have to set the menu delay to 0, so
- // that the popup menus are executed synchronously.
- AllSettings aSettings = pWindow->GetSettings();
- MouseSettings aMouseSettings = aSettings.GetMouseSettings();
- sal_Int32 nDelay = aMouseSettings.GetMenuDelay();
- aMouseSettings.SetMenuDelay( 0 );
- aSettings.SetMouseSettings( aMouseSettings );
- pWindow->SetSettings( aSettings );
-
- m_pParent->SelectItem( m_pParent->GetItemId( m_nItemPos ) );
-
- // meanwhile the window pointer may be invalid
- pWindow = m_pParent->GetWindow();
- if ( pWindow )
- {
- // set the menu delay back to the old value
- aSettings = pWindow->GetSettings();
- aMouseSettings = aSettings.GetMouseSettings();
- aMouseSettings.SetMenuDelay( nDelay );
- aSettings.SetMouseSettings( aMouseSettings );
- pWindow->SetSettings( aSettings );
- }
-}
-
-
-void OAccessibleMenuItemComponent::SetItemPos( sal_uInt16 nItemPos )
-{
- m_nItemPos = nItemPos;
-}
-
-
-void OAccessibleMenuItemComponent::SetAccessibleName( const OUString& sAccessibleName )
-{
- if ( m_sAccessibleName != sAccessibleName )
- {
- Any aOldValue, aNewValue;
- aOldValue <<= m_sAccessibleName;
- aNewValue <<= sAccessibleName;
- m_sAccessibleName = sAccessibleName;
- NotifyAccessibleEvent( AccessibleEventId::NAME_CHANGED, aOldValue, aNewValue );
- }
-}
-
-
-OUString OAccessibleMenuItemComponent::GetAccessibleName()
-{
- OUString sName;
- if ( m_pParent )
- {
- sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
- sName = m_pParent->GetAccessibleName( nItemId );
- if ( sName.isEmpty() )
- sName = m_pParent->GetItemText( nItemId );
- sName = removeMnemonicFromString( sName );
-#if defined(_WIN32)
- if ( m_pParent->GetAccelKey( nItemId ).GetName().getLength() )
- sName += "\t" + m_pParent->GetAccelKey(nItemId).GetName();
-#endif
- }
-
- return sName;
-}
-
-
-void OAccessibleMenuItemComponent::SetItemText( const OUString& sItemText )
-{
- Any aOldValue, aNewValue;
- if ( OCommonAccessibleText::implInitTextChangedEvent( m_sItemText, sItemText, aOldValue, aNewValue ) )
- {
- m_sItemText = sItemText;
- NotifyAccessibleEvent( AccessibleEventId::TEXT_CHANGED, aOldValue, aNewValue );
- }
-}
-
-
-OUString OAccessibleMenuItemComponent::GetItemText()
-{
- OUString sText;
- if ( m_pParent )
- sText = removeMnemonicFromString( m_pParent->GetItemText( m_pParent->GetItemId( m_nItemPos ) ) );
-
- return sText;
-}
-
-
-void OAccessibleMenuItemComponent::FillAccessibleStateSet( sal_Int64& rStateSet )
-{
- bool bEnabled = IsEnabled();
- if ( bEnabled )
- {
- rStateSet |= AccessibleStateType::ENABLED;
- rStateSet |= AccessibleStateType::SENSITIVE;
- }
-
- if ( IsVisible() )
- {
- rStateSet |= AccessibleStateType::SHOWING;
- if( !IsMenuHideDisabledEntries() || bEnabled )
- rStateSet |= AccessibleStateType::VISIBLE;
- }
- rStateSet |= AccessibleStateType::OPAQUE;
-}
-
-
-// OCommonAccessibleComponent
-
-
-awt::Rectangle OAccessibleMenuItemComponent::implGetBounds()
-{
- awt::Rectangle aBounds( 0, 0, 0, 0 );
-
- if ( m_pParent )
- {
- // get bounding rectangle of the item relative to the containing window
- aBounds = vcl::unohelper::ConvertToAWTRect(m_pParent->GetBoundingRectangle(m_nItemPos));
-
- // get position of containing window in screen coordinates
- vcl::Window* pWindow = m_pParent->GetWindow();
- if ( pWindow )
- {
- AbsoluteScreenPixelRectangle aRect = pWindow->GetWindowExtentsAbsolute();
- awt::Point aWindowScreenLoc = vcl::unohelper::ConvertToAWTPoint(aRect.TopLeft());
-
- // get position of accessible parent in screen coordinates
- Reference< XAccessible > xParent = getAccessibleParent();
- if ( xParent.is() )
- {
- Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), UNO_QUERY );
- if ( xParentComponent.is() )
- {
- awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen();
-
- // calculate bounding rectangle of the item relative to the accessible parent
- aBounds.X += aWindowScreenLoc.X - aParentScreenLoc.X;
- aBounds.Y += aWindowScreenLoc.Y - aParentScreenLoc.Y;
- }
- }
- }
- }
-
- return aBounds;
-}
-
-
-// XComponent
-
-
-void SAL_CALL OAccessibleMenuItemComponent::disposing()
-{
- OAccessibleMenuBaseComponent::disposing();
-
- m_pParent = nullptr;
- m_sAccessibleName.clear();
- m_sItemText.clear();
-}
-
-
-// XAccessibleContext
-
-
-sal_Int64 OAccessibleMenuItemComponent::getAccessibleChildCount()
-{
- OExternalLockGuard aGuard( this );
-
- return 0;
-}
-
-
-Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleChild( sal_Int64 i )
-{
- OExternalLockGuard aGuard( this );
-
- if ( i < 0 || i >= getAccessibleChildCount() )
- throw IndexOutOfBoundsException();
-
- return Reference< XAccessible >();
-}
-
-
-Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleParent( )
-{
- OExternalLockGuard aGuard( this );
-
- return m_pParent->GetAccessible();
-}
-
-
-sal_Int64 OAccessibleMenuItemComponent::getAccessibleIndexInParent( )
-{
- OExternalLockGuard aGuard( this );
-
- return m_nItemPos;
-}
-
-
-sal_Int16 OAccessibleMenuItemComponent::getAccessibleRole( )
-{
- OExternalLockGuard aGuard( this );
-
- return AccessibleRole::UNKNOWN;
-}
-
-
-OUString OAccessibleMenuItemComponent::getAccessibleDescription( )
-{
- OExternalLockGuard aGuard( this );
-
- OUString sDescription;
- if ( m_pParent )
- sDescription = m_pParent->GetAccessibleDescription( m_pParent->GetItemId( m_nItemPos ) );
-
- return sDescription;
-}
-
-
-OUString OAccessibleMenuItemComponent::getAccessibleName( )
-{
- OExternalLockGuard aGuard( this );
-
- return m_sAccessibleName;
-}
-
-
-Reference< XAccessibleRelationSet > OAccessibleMenuItemComponent::getAccessibleRelationSet( )
-{
- OExternalLockGuard aGuard( this );
-
- return new utl::AccessibleRelationSetHelper;
-}
-
-
-Locale OAccessibleMenuItemComponent::getLocale( )
-{
- OExternalLockGuard aGuard( this );
-
- return Application::GetSettings().GetLanguageTag().getLocale();
-}
-
-
-// XAccessibleComponent
-
-
-Reference< XAccessible > OAccessibleMenuItemComponent::getAccessibleAtPoint( const awt::Point& )
-{
- OExternalLockGuard aGuard( this );
-
- return Reference< XAccessible >();
-}
-
-
-void OAccessibleMenuItemComponent::grabFocus( )
-{
- // no focus for items
-}
-
-
-sal_Int32 OAccessibleMenuItemComponent::getForeground( )
-{
- OExternalLockGuard aGuard( this );
-
- sal_Int32 nColor = 0;
- Reference< XAccessible > xParent = getAccessibleParent();
- if ( xParent.is() )
- {
- Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
- if ( xParentComp.is() )
- nColor = xParentComp->getForeground();
- }
-
- return nColor;
-}
-
-
-sal_Int32 OAccessibleMenuItemComponent::getBackground( )
-{
- OExternalLockGuard aGuard( this );
-
- sal_Int32 nColor = 0;
- Reference< XAccessible > xParent = getAccessibleParent();
- if ( xParent.is() )
- {
- Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY );
- if ( xParentComp.is() )
- nColor = xParentComp->getBackground();
- }
-
- return nColor;
-}
-
-
-// XAccessibleExtendedComponent
-
-OUString OAccessibleMenuItemComponent::getTitledBorderText( )
-{
- OExternalLockGuard aGuard( this );
-
- return OUString();
-}
-
-
-OUString OAccessibleMenuItemComponent::getToolTipText( )
-{
- OExternalLockGuard aGuard( this );
-
- OUString sRet;
- if ( m_pParent )
- sRet = m_pParent->GetTipHelpText( m_pParent->GetItemId( m_nItemPos ) );
-
- return sRet;
-}
-
-
-bool OAccessibleMenuItemComponent::IsMenuHideDisabledEntries()
-{
- if (m_pParent )
- {
- if( m_pParent->GetMenuFlags() & MenuFlags::HideDisabledEntries)
- {
- return true;
- }
- }
- return false;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblemenu.cxx b/accessibility/source/standard/vclxaccessiblemenu.cxx
deleted file mode 100644
index 5ba208d2f368..000000000000
--- a/accessibility/source/standard/vclxaccessiblemenu.cxx
+++ /dev/null
@@ -1,222 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <standard/vclxaccessiblemenu.hxx>
-
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
-#include <comphelper/accessiblecontexthelper.hxx>
-#include <vcl/menu.hxx>
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::accessibility;
-using namespace ::comphelper;
-
-
-// VCLXAccessibleMenu
-
-
-bool VCLXAccessibleMenu::IsFocused()
-{
- bool bFocused = false;
-
- if ( IsHighlighted() && !IsChildHighlighted() )
- bFocused = true;
-
- return bFocused;
-}
-
-
-bool VCLXAccessibleMenu::IsPopupMenuOpen()
-{
- bool bPopupMenuOpen = false;
-
- if ( m_pParent )
- {
- PopupMenu* pPopupMenu = m_pParent->GetPopupMenu( m_pParent->GetItemId( m_nItemPos ) );
- if ( pPopupMenu && pPopupMenu->IsMenuVisible() )
- bPopupMenuOpen = true;
- }
-
- return bPopupMenuOpen;
-}
-
-
-// XServiceInfo
-
-
-OUString VCLXAccessibleMenu::getImplementationName()
-{
- return u"com.sun.star.comp.toolkit.AccessibleMenu"_ustr;
-}
-
-
-Sequence< OUString > VCLXAccessibleMenu::getSupportedServiceNames()
-{
- return { u"com.sun.star.awt.AccessibleMenu"_ustr };
-}
-
-
-// XAccessibleContext
-
-
-sal_Int64 VCLXAccessibleMenu::getAccessibleChildCount( )
-{
- OExternalLockGuard aGuard( this );
-
- return GetChildCount();
-}
-
-
-Reference< XAccessible > VCLXAccessibleMenu::getAccessibleChild( sal_Int64 i )
-{
- OExternalLockGuard aGuard( this );
-
- if ( i < 0 || i >= GetChildCount() )
- throw IndexOutOfBoundsException();
-
- return GetChild( i );
-}
-
-
-sal_Int16 VCLXAccessibleMenu::getAccessibleRole( )
-{
- OExternalLockGuard aGuard( this );
-
- return AccessibleRole::MENU;
-}
-
-
-// XAccessibleComponent
-
-
-Reference< XAccessible > VCLXAccessibleMenu::getAccessibleAtPoint( const awt::Point& rPoint )
-{
- OExternalLockGuard aGuard( this );
-
- return GetChildAt( rPoint );
-}
-
-
-// XAccessibleSelection
-
-
-void VCLXAccessibleMenu::selectAccessibleChild( sal_Int64 nChildIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
- throw IndexOutOfBoundsException();
-
- SelectChild( nChildIndex );
-}
-
-
-sal_Bool VCLXAccessibleMenu::isAccessibleChildSelected( sal_Int64 nChildIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
- throw IndexOutOfBoundsException();
-
- return IsChildSelected( nChildIndex );
-}
-
-
-void VCLXAccessibleMenu::clearAccessibleSelection( )
-{
- OExternalLockGuard aGuard( this );
-
- DeSelectAll();
-}
-
-
-void VCLXAccessibleMenu::selectAllAccessibleChildren( )
-{
- // This method makes no sense in a menu, and so does nothing.
-}
-
-
-sal_Int64 VCLXAccessibleMenu::getSelectedAccessibleChildCount( )
-{
- OExternalLockGuard aGuard( this );
-
- return implGetSelectedAccessibleChildCount();
-}
-
-sal_Int64 VCLXAccessibleMenu::implGetSelectedAccessibleChildCount( )
-{
- sal_Int64 nRet = 0;
-
- for ( sal_Int64 i = 0, nCount = GetChildCount(); i < nCount; i++ )
- {
- if ( IsChildSelected( i ) )
- ++nRet;
- }
-
- return nRet;
-}
-
-Reference< XAccessible > VCLXAccessibleMenu::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() )
- throw IndexOutOfBoundsException();
-
- Reference< XAccessible > xChild;
-
- for ( sal_Int64 i = 0, j = 0, nCount = GetChildCount(); i < nCount; i++ )
- {
- if ( IsChildSelected( i ) && ( j++ == nSelectedChildIndex ) )
- {
- xChild = GetChild( i );
- break;
- }
- }
-
- return xChild;
-}
-
-
-void VCLXAccessibleMenu::deselectAccessibleChild( sal_Int64 nChildIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nChildIndex < 0 || nChildIndex >= GetChildCount() )
- throw IndexOutOfBoundsException();
-
- DeSelectAll();
-}
-
-
-OUString VCLXAccessibleMenu::getAccessibleActionDescription ( sal_Int32 nIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
- throw IndexOutOfBoundsException();
-
- return OUString( );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblemenubar.cxx b/accessibility/source/standard/vclxaccessiblemenubar.cxx
deleted file mode 100644
index 9664254fa543..000000000000
--- a/accessibility/source/standard/vclxaccessiblemenubar.cxx
+++ /dev/null
@@ -1,188 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <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>
-#include <vcl/settings.hxx>
-
-using namespace ::com::sun::star::accessibility;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star;
-using namespace ::comphelper;
-
-
-
-
-VCLXAccessibleMenuBar::VCLXAccessibleMenuBar( Menu* pMenu )
- :OAccessibleMenuComponent( pMenu )
-{
- if ( pMenu )
- {
- m_pWindow = pMenu->GetWindow();
-
- if ( m_pWindow )
- m_pWindow->AddEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
- }
-}
-
-
-VCLXAccessibleMenuBar::~VCLXAccessibleMenuBar()
-{
- if ( m_pWindow )
- m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
-}
-
-
-bool VCLXAccessibleMenuBar::IsFocused()
-{
- bool bFocused = false;
-
- if ( m_pWindow && m_pWindow->HasFocus() && !IsChildHighlighted() )
- bFocused = true;
-
- return bFocused;
-}
-
-
-IMPL_LINK( VCLXAccessibleMenuBar, WindowEventListener, VclWindowEvent&, rEvent, void )
-{
- assert( rEvent.GetWindow() );
- if ( !rEvent.GetWindow()->IsAccessibilityEventsSuppressed() || ( rEvent.GetId() == VclEventId::ObjectDying ) )
- {
- ProcessWindowEvent( rEvent );
- }
-}
-
-
-void VCLXAccessibleMenuBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
-{
- switch ( rVclWindowEvent.GetId() )
- {
- case VclEventId::WindowGetFocus:
- case VclEventId::WindowLoseFocus:
- {
- SetFocused( rVclWindowEvent.GetId() == VclEventId::WindowGetFocus );
- }
- break;
- case VclEventId::ObjectDying:
- {
- if ( m_pWindow )
- {
- m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
- m_pWindow = nullptr;
- }
- }
- break;
- default:
- {
- }
- break;
- }
-}
-
-
-// XComponent
-
-
-void VCLXAccessibleMenuBar::disposing()
-{
- OAccessibleMenuComponent::disposing();
-
- if ( m_pWindow )
- {
- m_pWindow->RemoveEventListener( LINK( this, VCLXAccessibleMenuBar, WindowEventListener ) );
- m_pWindow = nullptr;
- }
-}
-
-
-// XServiceInfo
-
-
-OUString VCLXAccessibleMenuBar::getImplementationName()
-{
- return u"com.sun.star.comp.toolkit.AccessibleMenuBar"_ustr;
-}
-
-
-Sequence< OUString > VCLXAccessibleMenuBar::getSupportedServiceNames()
-{
- return { u"com.sun.star.awt.AccessibleMenuBar"_ustr };
-}
-
-
-// XAccessibleContext
-
-
-sal_Int64 VCLXAccessibleMenuBar::getAccessibleIndexInParent( )
-{
- OExternalLockGuard aGuard( this );
-
- sal_Int64 nIndexInParent = -1;
-
- if ( m_pMenu )
- {
- vcl::Window* pWindow = m_pMenu->GetWindow();
- if ( pWindow )
- {
- vcl::Window* pParent = pWindow->GetAccessibleParentWindow();
- if ( pParent )
- {
- for ( sal_uInt16 n = pParent->GetAccessibleChildWindowCount(); n; )
- {
- vcl::Window* pChild = pParent->GetAccessibleChildWindow( --n );
- if ( pChild == pWindow )
- {
- nIndexInParent = n;
- break;
- }
- }
- }
- }
- }
-
- return nIndexInParent;
-}
-
-
-sal_Int16 VCLXAccessibleMenuBar::getAccessibleRole( )
-{
- OExternalLockGuard aGuard( this );
-
- return AccessibleRole::MENU_BAR;
-}
-
-
-// XAccessibleExtendedComponent
-
-
-sal_Int32 VCLXAccessibleMenuBar::getBackground( )
-{
- OExternalLockGuard aGuard( this );
-
- return sal_Int32(Application::GetSettings().GetStyleSettings().GetMenuBarColor());
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx
deleted file mode 100644
index a1491c99bc4c..000000000000
--- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx
+++ /dev/null
@@ -1,577 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <standard/vclxaccessiblemenuitem.hxx>
-#include <comphelper/accessiblecontexthelper.hxx>
-#include <comphelper/accessiblekeybindinghelper.hxx>
-#include <com/sun/star/awt/KeyModifier.hpp>
-
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#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/sequence.hxx>
-#include <i18nlangtag/languagetag.hxx>
-#include <vcl/accessibility/characterattributeshelper.hxx>
-#include <vcl/accessibility/strings.hxx>
-#include <vcl/event.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/window.hxx>
-#include <vcl/menu.hxx>
-#include <vcl/unohelp.hxx>
-#include <vcl/unohelp2.hxx>
-#include <vcl/settings.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;
-
-
-
-
-VCLXAccessibleMenuItem::VCLXAccessibleMenuItem( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu )
- :ImplInheritanceHelper( pParent, nItemPos, pMenu )
-{
-}
-
-
-bool VCLXAccessibleMenuItem::IsFocused()
-{
- return IsHighlighted();
-}
-
-
-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()
-{
- bool bChecked = false;
-
- if ( m_pParent )
- {
- sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
- if ( m_pParent->IsItemChecked( nItemId ) )
- bChecked = true;
- }
-
- return bChecked;
-}
-
-
-bool VCLXAccessibleMenuItem::IsHighlighted()
-{
- bool bHighlighted = false;
-
- if ( m_pParent && m_pParent->IsHighlighted( m_nItemPos ) )
- bHighlighted = true;
-
- return bHighlighted;
-}
-
-
-void VCLXAccessibleMenuItem::FillAccessibleStateSet( sal_Int64& rStateSet )
-{
- OAccessibleMenuItemComponent::FillAccessibleStateSet( rStateSet );
-
- rStateSet |= AccessibleStateType::FOCUSABLE;
-
- if ( IsFocused() )
- rStateSet |= AccessibleStateType::FOCUSED;
-
- rStateSet |= AccessibleStateType::SELECTABLE;
-
- if ( IsSelected() )
- rStateSet |= AccessibleStateType::SELECTED;
-
- if (IsCheckable())
- rStateSet |= AccessibleStateType::CHECKABLE;
- if ( IsChecked() )
- rStateSet |= AccessibleStateType::CHECKED;
-}
-
-
-// OCommonAccessibleText
-
-
-OUString VCLXAccessibleMenuItem::implGetText()
-{
- return m_sItemText;
-}
-
-
-Locale VCLXAccessibleMenuItem::implGetLocale()
-{
- return Application::GetSettings().GetLanguageTag().getLocale();
-}
-
-
-void VCLXAccessibleMenuItem::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex )
-{
- nStartIndex = 0;
- nEndIndex = 0;
-}
-
-
-// XServiceInfo
-
-
-OUString VCLXAccessibleMenuItem::getImplementationName()
-{
- return u"com.sun.star.comp.toolkit.AccessibleMenuItem"_ustr;
-}
-
-
-Sequence< OUString > VCLXAccessibleMenuItem::getSupportedServiceNames()
-{
- return { u"com.sun.star.awt.AccessibleMenuItem"_ustr };
-}
-
-
-// XAccessibleContext
-
-
-sal_Int16 VCLXAccessibleMenuItem::getAccessibleRole( )
-{
- OExternalLockGuard aGuard( this );
- // IA2 CWS. MT: We had the additional roles in UAA for ever, but never used them anywhere.
- // Looks reasonable, but need to verify in Orca and VoiceOver.
- sal_Int16 nRole = AccessibleRole::MENU_ITEM;
- if ( m_pParent )
- {
- sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
- MenuItemBits nItemBits = m_pParent->GetItemBits(nItemId);
- if( nItemBits & MenuItemBits::RADIOCHECK)
- nRole = AccessibleRole::RADIO_MENU_ITEM;
- else if( nItemBits & MenuItemBits::CHECKABLE)
- nRole = AccessibleRole::CHECK_MENU_ITEM;
- }
- return nRole;
-}
-
-
-// XAccessibleText
-
-
-sal_Int32 VCLXAccessibleMenuItem::getCaretPosition()
-{
- return -1;
-}
-
-
-sal_Bool VCLXAccessibleMenuItem::setCaretPosition( sal_Int32 nIndex )
-{
-
- OExternalLockGuard aGuard( this );
-
- if ( !implIsValidRange( nIndex, nIndex, m_sItemText.getLength() ) )
- throw IndexOutOfBoundsException();
-
- return false;
-}
-
-
-sal_Unicode VCLXAccessibleMenuItem::getCharacter( sal_Int32 nIndex )
-{
- OExternalLockGuard aGuard( this );
-
- return OCommonAccessibleText::implGetCharacter( implGetText(), nIndex );
-}
-
-
-Sequence< PropertyValue > VCLXAccessibleMenuItem::getCharacterAttributes( sal_Int32 nIndex, const Sequence< OUString >& aRequestedAttributes )
-{
- OExternalLockGuard aGuard( this );
-
- if ( !implIsValidIndex( nIndex, m_sItemText.getLength() ) )
- throw IndexOutOfBoundsException();
-
- vcl::Font aFont = Application::GetSettings().GetStyleSettings().GetMenuFont();
- sal_Int32 nBackColor = getBackground();
- sal_Int32 nColor = getForeground();
- return CharacterAttributesHelper( aFont, nBackColor, nColor )
- .GetCharacterAttributes( aRequestedAttributes );
-}
-
-
-awt::Rectangle VCLXAccessibleMenuItem::getCharacterBounds( sal_Int32 nIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( !implIsValidIndex( nIndex, m_sItemText.getLength() ) )
- throw IndexOutOfBoundsException();
-
- awt::Rectangle aBounds( 0, 0, 0, 0 );
- if ( m_pParent )
- {
- sal_uInt16 nItemId = m_pParent->GetItemId( m_nItemPos );
- tools::Rectangle aItemRect = m_pParent->GetBoundingRectangle( m_nItemPos );
- tools::Rectangle aCharRect = m_pParent->GetCharacterBounds( nItemId, nIndex );
- aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() );
- aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect);
- }
-
- return aBounds;
-}
-
-
-sal_Int32 VCLXAccessibleMenuItem::getCharacterCount()
-{
- OExternalLockGuard aGuard( this );
-
- return m_sItemText.getLength();
-}
-
-
-sal_Int32 VCLXAccessibleMenuItem::getIndexAtPoint( const awt::Point& aPoint )
-{
- OExternalLockGuard aGuard( this );
-
- sal_Int32 nIndex = -1;
- if ( m_pParent )
- {
- sal_uInt16 nItemId = 0;
- tools::Rectangle aItemRect = m_pParent->GetBoundingRectangle( m_nItemPos );
- Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint));
- aPnt += aItemRect.TopLeft();
- sal_Int32 nI = m_pParent->GetIndexForPoint( aPnt, nItemId );
- if ( nI != -1 && m_pParent->GetItemId( m_nItemPos ) == nItemId )
- nIndex = nI;
- }
-
- return nIndex;
-}
-
-
-OUString VCLXAccessibleMenuItem::getSelectedText()
-{
- OExternalLockGuard aGuard( this );
-
- return OUString();
-}
-
-
-sal_Int32 VCLXAccessibleMenuItem::getSelectionStart()
-{
- OExternalLockGuard aGuard( this );
-
- return 0;
-}
-
-
-sal_Int32 VCLXAccessibleMenuItem::getSelectionEnd()
-{
- OExternalLockGuard aGuard( this );
-
- return 0;
-}
-
-
-sal_Bool VCLXAccessibleMenuItem::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( !implIsValidRange( nStartIndex, nEndIndex, m_sItemText.getLength() ) )
- throw IndexOutOfBoundsException();
-
- return false;
-}
-
-
-OUString VCLXAccessibleMenuItem::getText()
-{
- OExternalLockGuard aGuard( this );
-
- return m_sItemText;
-}
-
-
-OUString VCLXAccessibleMenuItem::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
-{
- OExternalLockGuard aGuard( this );
-
- return OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex );
-}
-
-
-css::accessibility::TextSegment VCLXAccessibleMenuItem::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType )
-{
- OExternalLockGuard aGuard( this );
-
- return OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
-}
-
-
-css::accessibility::TextSegment VCLXAccessibleMenuItem::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType )
-{
- OExternalLockGuard aGuard( this );
-
- return OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
-}
-
-
-css::accessibility::TextSegment VCLXAccessibleMenuItem::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType )
-{
- OExternalLockGuard aGuard( this );
-
- return OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
-}
-
-
-sal_Bool VCLXAccessibleMenuItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
-{
- OExternalLockGuard aGuard( this );
-
- bool bReturn = false;
-
- if ( m_pParent )
- {
- vcl::Window* pWindow = m_pParent->GetWindow();
- if ( pWindow )
- {
- Reference< datatransfer::clipboard::XClipboard > xClipboard = pWindow->GetClipboard();
- if ( xClipboard.is() )
- {
- OUString sText( getTextRange( nStartIndex, nEndIndex ) );
-
- rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
-
- SolarMutexReleaser aReleaser;
- xClipboard->setContents( pDataObj, nullptr );
- Reference< datatransfer::clipboard::XFlushableClipboard > xFlushableClipboard( xClipboard, uno::UNO_QUERY );
- if( xFlushableClipboard.is() )
- xFlushableClipboard->flushClipboard();
-
- bReturn = true;
- }
- }
- }
-
- return bReturn;
-}
-
-sal_Bool VCLXAccessibleMenuItem::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType )
-{
- return false;
-}
-
-
-// XAccessibleAction
-
-
-sal_Int32 VCLXAccessibleMenuItem::getAccessibleActionCount( )
-{
- return 1;
-}
-
-
-sal_Bool VCLXAccessibleMenuItem::doAccessibleAction ( sal_Int32 nIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nIndex != 0 )
- throw IndexOutOfBoundsException();
-
- Click();
-
- return true;
-}
-
-
-OUString VCLXAccessibleMenuItem::getAccessibleActionDescription ( sal_Int32 nIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nIndex != 0 )
- throw IndexOutOfBoundsException();
-
- return RID_STR_ACC_ACTION_SELECT;
-}
-
-
-Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKeyBinding( sal_Int32 nIndex )
-{
- OExternalLockGuard aGuard( this );
-
- if ( nIndex != 0 )
- throw IndexOutOfBoundsException();
-
- rtl::Reference<OAccessibleKeyBindingHelper> pKeyBindingHelper = new OAccessibleKeyBindingHelper();
-
- if ( m_pParent )
- {
- // create auto mnemonics
- if (!(m_pParent->GetMenuFlags() & MenuFlags::NoAutoMnemonics))
- m_pParent->CreateAutoMnemonics();
-
- // activation key
- KeyEvent aKeyEvent = m_pParent->GetActivationKey( m_pParent->GetItemId( m_nItemPos ) );
- vcl::KeyCode aKeyCode = aKeyEvent.GetKeyCode();
- 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.getArray()[0].Modifiers |= awt::KeyModifier::MOD2;
- }
- pKeyBindingHelper->AddKeyBinding( aSeq1 );
-
- // complete menu activation key sequence
- Sequence< awt::KeyStroke > aSeq;
- if ( xParent.is() )
- {
- Reference< XAccessibleContext > xParentContext( xParent->getAccessibleContext() );
- if ( xParentContext.is() && xParentContext->getAccessibleRole() == AccessibleRole::MENU )
- {
- Reference< XAccessibleAction > xAction( xParentContext, UNO_QUERY );
- if ( xAction.is() && xAction->getAccessibleActionCount() > 0 )
- {
- Reference< XAccessibleKeyBinding > xKeyB( xAction->getAccessibleActionKeyBinding( 0 ) );
- if ( xKeyB.is() && xKeyB->getAccessibleKeyBindingCount() > 1 )
- aSeq = xKeyB->getAccessibleKeyBinding( 1 );
- }
- }
- }
- Sequence< awt::KeyStroke > aSeq2 = ::comphelper::concatSequences( aSeq, aSeq1 );
- pKeyBindingHelper->AddKeyBinding( aSeq2 );
-
- // accelerator key
- vcl::KeyCode aAccelKeyCode = m_pParent->GetAccelKey( m_pParent->GetItemId( m_nItemPos ) );
- if ( aAccelKeyCode.GetCode() != 0 )
- {
- 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 pKeyBindingHelper;
-}
-
-
-// XAccessibleValue
-
-
-Any VCLXAccessibleMenuItem::getCurrentValue( )
-{
- OExternalLockGuard aGuard( this );
-
- Any aValue;
- if ( IsSelected() )
- aValue <<= sal_Int32(1);
- else
- aValue <<= sal_Int32(0);
-
- return aValue;
-}
-
-
-sal_Bool VCLXAccessibleMenuItem::setCurrentValue( const Any& aNumber )
-{
- OExternalLockGuard aGuard( this );
-
- bool bReturn = false;
- sal_Int32 nValue = 0;
- OSL_VERIFY( aNumber >>= nValue );
-
- if ( nValue <= 0 )
- {
- DeSelect();
- bReturn = true;
- }
- else if ( nValue >= 1 )
- {
- Select();
- bReturn = true;
- }
-
- return bReturn;
-}
-
-
-Any VCLXAccessibleMenuItem::getMaximumValue( )
-{
- Any aValue;
- aValue <<= sal_Int32(1);
-
- return aValue;
-}
-
-
-Any VCLXAccessibleMenuItem::getMinimumValue( )
-{
- Any aValue;
- aValue <<= sal_Int32(0);
-
- 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
deleted file mode 100644
index d64ccb0baa25..000000000000
--- a/accessibility/source/standard/vclxaccessiblemenuseparator.cxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <standard/vclxaccessiblemenuseparator.hxx>
-
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-
-using namespace ::com::sun::star::accessibility;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star;
-
-VCLXAccessibleMenuSeparator::VCLXAccessibleMenuSeparator(Menu* pParent, sal_uInt16 nItemPos)
- : OAccessibleMenuItemComponent(pParent, nItemPos, nullptr)
-{
-}
-
-// XServiceInfo
-
-OUString VCLXAccessibleMenuSeparator::getImplementationName()
-{
- return u"com.sun.star.comp.toolkit.AccessibleMenuSeparator"_ustr;
-}
-
-Sequence<OUString> VCLXAccessibleMenuSeparator::getSupportedServiceNames()
-{
- return { u"com.sun.star.awt.AccessibleMenuSeparator"_ustr };
-}
-
-// XAccessibleContext
-
-sal_Int16 VCLXAccessibleMenuSeparator::getAccessibleRole() { return AccessibleRole::SEPARATOR; }
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx b/accessibility/source/standard/vclxaccessiblepopupmenu.cxx
deleted file mode 100644
index d8b840eee784..000000000000
--- a/accessibility/source/standard/vclxaccessiblepopupmenu.cxx
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <standard/vclxaccessiblepopupmenu.hxx>
-
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <comphelper/accessiblecontexthelper.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/settings.hxx>
-
-using namespace ::com::sun::star::accessibility;
-using namespace ::com::sun::star::uno;
-using namespace ::comphelper;
-
-
-
-
-bool VCLXAccessiblePopupMenu::IsFocused()
-{
- return !IsChildHighlighted();
-}
-
-
-// XServiceInfo
-
-
-OUString VCLXAccessiblePopupMenu::getImplementationName()
-{
- return u"com.sun.star.comp.toolkit.AccessiblePopupMenu"_ustr;
-}
-
-
-Sequence< OUString > VCLXAccessiblePopupMenu::getSupportedServiceNames()
-{
- return { u"com.sun.star.awt.AccessiblePopupMenu"_ustr };
-}
-
-
-// XAccessibleContext
-
-
-sal_Int64 VCLXAccessiblePopupMenu::getAccessibleIndexInParent( )
-{
- OExternalLockGuard aGuard( this );
-
- return 0;
-}
-
-
-sal_Int16 VCLXAccessiblePopupMenu::getAccessibleRole( )
-{
- OExternalLockGuard aGuard( this );
-
- return AccessibleRole::POPUP_MENU;
-}
-
-
-// XAccessibleExtendedComponent
-
-
-sal_Int32 VCLXAccessiblePopupMenu::getBackground( )
-{
- OExternalLockGuard aGuard( this );
-
- return sal_Int32(Application::GetSettings().GetStyleSettings().GetMenuColor());
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */