diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 16:51:28 +0000 |
commit | 940b4d1848e8c70ab7642901a68594e8016caffc (patch) | |
tree | eb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /accessibility/inc/standard | |
parent | Initial commit. (diff) | |
download | libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip |
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'accessibility/inc/standard')
33 files changed, 2900 insertions, 0 deletions
diff --git a/accessibility/inc/standard/accessiblemenubasecomponent.hxx b/accessibility/inc/standard/accessiblemenubasecomponent.hxx new file mode 100644 index 000000000..d6f4713cc --- /dev/null +++ b/accessibility/inc/standard/accessiblemenubasecomponent.hxx @@ -0,0 +1,137 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <comphelper/accessiblecomponenthelper.hxx> +#include <cppuhelper/implbase2.hxx> +#include <tools/link.hxx> +#include <vcl/vclptr.hxx> + +#include <vector> + +class Menu; +class VclSimpleEvent; +class VclMenuEvent; + +namespace utl { +class AccessibleStateSetHelper; +} + + + +typedef ::cppu::ImplHelper2< + css::accessibility::XAccessible, + css::lang::XServiceInfo > OAccessibleMenuBaseComponent_BASE; + +class OAccessibleMenuBaseComponent : public comphelper::OAccessibleExtendedComponentHelper, + public OAccessibleMenuBaseComponent_BASE +{ + friend class OAccessibleMenuItemComponent; + friend class VCLXAccessibleMenuItem; + friend class VCLXAccessibleMenu; + +protected: + typedef std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren; + + AccessibleChildren m_aAccessibleChildren; + VclPtr<Menu> m_pMenu; + + bool m_bEnabled; + bool m_bFocused; + bool m_bVisible; + bool m_bSelected; + bool m_bChecked; + + virtual bool IsEnabled(); + virtual bool IsFocused(); + virtual bool IsVisible(); + virtual bool IsSelected(); + virtual bool IsChecked(); + + void SetEnabled( bool bEnabled ); + void SetFocused( bool bFocused ); + void SetVisible( bool bVisible ); + void SetSelected( bool bSelected ); + void SetChecked( bool bChecked ); + + void UpdateEnabled( sal_Int32 i, bool bEnabled ); + void UpdateFocused( sal_Int32 i, bool bFocused ); + void UpdateVisible(); + void UpdateSelected( sal_Int32 i, bool bSelected ); + void UpdateChecked( sal_Int32 i, bool bChecked ); + void UpdateAccessibleName( sal_Int32 i ); + void UpdateItemText( sal_Int32 i ); + + sal_Int32 GetChildCount() const; + + css::uno::Reference< css::accessibility::XAccessible > GetChild( sal_Int32 i ); + css::uno::Reference< css::accessibility::XAccessible > GetChildAt( const css::awt::Point& rPoint ); + + void InsertChild( sal_Int32 i ); + void RemoveChild( sal_Int32 i ); + + virtual bool IsHighlighted(); + bool IsChildHighlighted(); + + virtual bool IsMenuHideDisabledEntries(); + + void SelectChild( sal_Int32 i ); + void DeSelectAll(); + bool IsChildSelected( sal_Int32 i ); + + virtual void Click(); + virtual bool IsPopupMenuOpen(); + + DECL_LINK( MenuEventListener, VclMenuEvent&, void ); + + void ProcessMenuEvent( const VclMenuEvent& rVclMenuEvent ); + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) = 0; + + // XComponent + virtual void SAL_CALL disposing() override; + +public: + OAccessibleMenuBaseComponent( Menu* pMenu ); + virtual ~OAccessibleMenuBaseComponent() override; + + void SetStates(); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // XAccessibleContext + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/accessiblemenucomponent.hxx b/accessibility/inc/standard/accessiblemenucomponent.hxx new file mode 100644 index 000000000..f1559a46f --- /dev/null +++ b/accessibility/inc/standard/accessiblemenucomponent.hxx @@ -0,0 +1,86 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/accessiblemenubasecomponent.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <cppuhelper/implbase1.hxx> + + + +typedef ::cppu::ImplHelper1< + css::accessibility::XAccessibleSelection > OAccessibleMenuComponent_BASE; + +class OAccessibleMenuComponent : public OAccessibleMenuBaseComponent, + public OAccessibleMenuComponent_BASE +{ +protected: + virtual bool IsEnabled() override; + virtual bool IsVisible() override; + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + + // OCommonAccessibleComponent + virtual css::awt::Rectangle implGetBounds( ) override; + + using OAccessibleMenuBaseComponent::OAccessibleMenuBaseComponent; + +public: + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + virtual OUString SAL_CALL getAccessibleDescription( ) override; + virtual OUString SAL_CALL getAccessibleName( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; + virtual css::lang::Locale SAL_CALL getLocale( ) override; + + // XAccessibleComponent + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override; + virtual void SAL_CALL grabFocus( ) override; + virtual sal_Int32 SAL_CALL getForeground( ) override; + virtual sal_Int32 SAL_CALL getBackground( ) override; + + // XAccessibleExtendedComponent + virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; + virtual OUString SAL_CALL getTitledBorderText( ) override; + virtual OUString SAL_CALL getToolTipText( ) override; + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override; + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override; + virtual void SAL_CALL clearAccessibleSelection( ) override; + virtual void SAL_CALL selectAllAccessibleChildren( ) override; + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override; + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/accessiblemenuitemcomponent.hxx b/accessibility/inc/standard/accessiblemenuitemcomponent.hxx new file mode 100644 index 000000000..cad61500d --- /dev/null +++ b/accessibility/inc/standard/accessiblemenuitemcomponent.hxx @@ -0,0 +1,87 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/accessiblemenubasecomponent.hxx> + + + + +class OAccessibleMenuItemComponent : public OAccessibleMenuBaseComponent +{ + friend class OAccessibleMenuBaseComponent; + +protected: + VclPtr<Menu> m_pParent; + sal_uInt16 m_nItemPos; + OUString m_sAccessibleName; + OUString m_sItemText; + + virtual bool IsEnabled() override; + virtual bool IsVisible() override; + void Select(); + void DeSelect(); + virtual void Click() override; + + void SetItemPos( sal_uInt16 nItemPos ); + void SetAccessibleName( const OUString& sAccessibleName ); + OUString GetAccessibleName(); + void SetItemText( const OUString& sItemText ); + OUString GetItemText(); + + virtual bool IsMenuHideDisabledEntries() override; + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + + // OCommonAccessibleComponent + virtual css::awt::Rectangle implGetBounds( ) override; + + // XComponent + virtual void SAL_CALL disposing() override; + +public: + OAccessibleMenuItemComponent( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu ); + virtual ~OAccessibleMenuItemComponent() override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + virtual OUString SAL_CALL getAccessibleDescription( ) override; + virtual OUString SAL_CALL getAccessibleName( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; + virtual css::lang::Locale SAL_CALL getLocale( ) override; + + // XAccessibleComponent + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + virtual void SAL_CALL grabFocus( ) override; + virtual sal_Int32 SAL_CALL getForeground( ) override; + virtual sal_Int32 SAL_CALL getBackground( ) override; + + // XAccessibleExtendedComponent + virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; + virtual OUString SAL_CALL getTitledBorderText( ) override; + virtual OUString SAL_CALL getToolTipText( ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblebox.hxx b/accessibility/inc/standard/vclxaccessiblebox.hxx new file mode 100644 index 000000000..f475e4f04 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblebox.hxx @@ -0,0 +1,157 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <cppuhelper/implbase3.hxx> + + +typedef ::cppu::ImplHelper3< + css::accessibility::XAccessible, + css::accessibility::XAccessibleValue, + css::accessibility::XAccessibleAction + > VCLXAccessibleBox_BASE; + + +/** Base class for list- and combo boxes. This class manages the box' + children. The classed derived from this one have only to implement the + IsValid method and return the correct implementation name. +*/ +class VCLXAccessibleBox + : public VCLXAccessibleComponent, + public VCLXAccessibleBox_BASE +{ +public: + enum BoxType {COMBOBOX, LISTBOX}; + + /** The constructor is initialized with the box type which may be + either COMBOBOX or LISTBOX and a flag + indicating whether the box is a drop down box. + */ + VCLXAccessibleBox (VCLXWindow* pVCLXindow, BoxType aType, bool bIsDropDownBox); + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XInterface + DECLARE_XINTERFACE() + + + // XAccessible + + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext( ) override; + + // XAccessibleContext + + /** Each object has one or two children: an optional text field and the + actual list. The text field is not provided for non drop down list + boxes. + */ + sal_Int32 SAL_CALL getAccessibleChildCount() final override; + /** For drop down list boxes the text field is a not editable + VCLXAccessibleTextField, for combo boxes it is an + editable VLCAccessibleEdit. + */ + css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int32 i) override; + /** The role is always AccessibleRole::COMBO_BOX. + */ + sal_Int16 SAL_CALL getAccessibleRole() override; + + // XAccessibleAction + + /** There is one action for drop down boxes and none for others. + */ + virtual sal_Int32 SAL_CALL getAccessibleActionCount() final override; + /** The action for drop down boxes lets the user toggle the visibility of the + popup menu. + */ + virtual sal_Bool SAL_CALL doAccessibleAction (sal_Int32 nIndex) override; + /** The returned string is associated with resource + RID_STR_ACC_ACTION_TOGGLEPOPUP. + */ + virtual OUString SAL_CALL getAccessibleActionDescription (sal_Int32 nIndex) override; + /** No keybinding returned so far. + */ + virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL + getAccessibleActionKeyBinding( sal_Int32 nIndex ) override; + + // XAccessibleValue + + virtual css::uno::Any SAL_CALL getCurrentValue( ) override; + + virtual sal_Bool SAL_CALL setCurrentValue( + const css::uno::Any& aNumber ) override; + + virtual css::uno::Any SAL_CALL getMaximumValue( ) override; + + virtual css::uno::Any SAL_CALL getMinimumValue( ) override; +protected: + /** Specifies whether the box is a combo box or a list box. List boxes + have multi selection. + */ + BoxType m_aBoxType; + + /// Specifies whether the box is a drop down box and thus has an action. + bool m_bIsDropDownBox; + + /// The child that represents the text field if there is one. + css::uno::Reference< css::accessibility::XAccessible> + m_xText; + + /// The child that contains the items of this box. + css::uno::Reference< css::accessibility::XAccessible> + m_xList; + + /** This flag specifies whether an object has a text field as child + regardless of whether that child being currently instantiated or + not. + */ + bool m_bHasTextChild; + + /** This flag specifies whether an object has a list as child regardless + of whether that child being currently instantiated or not. This + flag is always true in the current implementation because the list + child is just another wrapper around this object and thus has the + same life time. + */ + bool m_bHasListChild; + + virtual ~VCLXAccessibleBox() override = default; + + /** Returns true when the object is valid. + */ + virtual bool IsValid() const = 0; + + virtual void ProcessWindowChildEvent (const VclWindowEvent& rVclWindowEvent) override; + virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) override; + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + + sal_Int32 implGetAccessibleChildCount(); +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblebutton.hxx b/accessibility/inc/standard/vclxaccessiblebutton.hxx new file mode 100644 index 000000000..c96e098f6 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblebutton.hxx @@ -0,0 +1,74 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessibletextcomponent.hxx> + +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include <cppuhelper/implbase2.hxx> + + + + +typedef ::cppu::ImplHelper2< + css::accessibility::XAccessibleAction, + css::accessibility::XAccessibleValue > VCLXAccessibleButton_BASE; + +class VCLXAccessibleButton final : public VCLXAccessibleTextComponent, + public VCLXAccessibleButton_BASE +{ + virtual ~VCLXAccessibleButton() override = default; + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + +public: + using VCLXAccessibleTextComponent::VCLXAccessibleTextComponent; + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleContext + virtual OUString SAL_CALL getAccessibleName( ) override; + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override; + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override; + virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override; + + // XAccessibleValue + virtual css::uno::Any SAL_CALL getCurrentValue( ) override; + virtual sal_Bool SAL_CALL setCurrentValue( const css::uno::Any& aNumber ) override; + virtual css::uno::Any SAL_CALL getMaximumValue( ) override; + virtual css::uno::Any SAL_CALL getMinimumValue( ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblecheckbox.hxx b/accessibility/inc/standard/vclxaccessiblecheckbox.hxx new file mode 100644 index 000000000..766400bb3 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblecheckbox.hxx @@ -0,0 +1,83 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessibletextcomponent.hxx> + +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include <cppuhelper/implbase2.hxx> + + + + +typedef ::cppu::ImplHelper2< + css::accessibility::XAccessibleAction, + css::accessibility::XAccessibleValue > VCLXAccessibleCheckBox_BASE; + +class VCLXAccessibleCheckBox final : public VCLXAccessibleTextComponent, + public VCLXAccessibleCheckBox_BASE +{ +private: + bool m_bChecked; + bool m_bIndeterminate; + + virtual ~VCLXAccessibleCheckBox() override = default; + + sal_Int32 implGetMaximumValue(); + + bool IsChecked() const; + bool IsIndeterminate() const; + + void SetChecked( bool bChecked ); + void SetIndeterminate( bool bIndeterminate ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + +public: + VCLXAccessibleCheckBox( VCLXWindow* pVCLXindow ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override; + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override; + virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override; + + // XAccessibleValue + virtual css::uno::Any SAL_CALL getCurrentValue( ) override; + virtual sal_Bool SAL_CALL setCurrentValue( const css::uno::Any& aNumber ) override; + virtual css::uno::Any SAL_CALL getMaximumValue( ) override; + virtual css::uno::Any SAL_CALL getMinimumValue( ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblecombobox.hxx b/accessibility/inc/standard/vclxaccessiblecombobox.hxx new file mode 100644 index 000000000..af38cdcba --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblecombobox.hxx @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessiblebox.hxx> + + +/** The accessible combobox has two children. The first is the text field + represented by an object of the VCLXAccessibleEdit class. + The second is the list containing all items and is represented by an + object of the VCLXAccessibleList class which does not + support selection at the moment. +*/ +class VCLXAccessibleComboBox final + : public VCLXAccessibleBox +{ +public: + VCLXAccessibleComboBox (VCLXWindow* pVCLXindow); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + // Return combo box specific services. + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + +private: + virtual ~VCLXAccessibleComboBox() override = default; + + virtual bool IsValid() const override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibledropdowncombobox.hxx b/accessibility/inc/standard/vclxaccessibledropdowncombobox.hxx new file mode 100644 index 000000000..627cc0888 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibledropdowncombobox.hxx @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessiblebox.hxx> + +/** The accessible drop down combobox has two children. The first is the + text field represented by an object of the + VCLXAccessibleEdit class. The second is the list + containing all items and is represented by an object of the + VCLXAccessibleList class which does not support selection + at the moment. +*/ +class VCLXAccessibleDropDownComboBox final : public VCLXAccessibleBox +{ +public: + VCLXAccessibleDropDownComboBox (VCLXWindow* pVCLXindow); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + // Return drop down combo box specific services. + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + +private: + virtual ~VCLXAccessibleDropDownComboBox() override = default; + + virtual bool IsValid() const override; + virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibledropdownlistbox.hxx b/accessibility/inc/standard/vclxaccessibledropdownlistbox.hxx new file mode 100644 index 000000000..d61f525e9 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibledropdownlistbox.hxx @@ -0,0 +1,50 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessiblebox.hxx> + +/** The accessible drop down combobox has two children. The first is the + text field represented by an object of the + VCLXAccessibleTextField class which can not be edited. The + second is the list containing all items and is represented by an object + of the VCLXAccessibleListBoxList class which does support + selection. +*/ +class VCLXAccessibleDropDownListBox final : public VCLXAccessibleBox +{ +public: + VCLXAccessibleDropDownListBox (VCLXWindow* pVCLXindow); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + // Return drop down list box specific services. + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + +private: + virtual ~VCLXAccessibleDropDownListBox() override = default; + + virtual bool IsValid() const override; + +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibleedit.hxx b/accessibility/inc/standard/vclxaccessibleedit.hxx new file mode 100644 index 000000000..a02d03319 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibleedit.hxx @@ -0,0 +1,109 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessibletextcomponent.hxx> +#include <com/sun/star/accessibility/AccessibleScrollType.hpp> +#include <com/sun/star/accessibility/XAccessibleEditableText.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> + +#include <cppuhelper/implbase2.hxx> + + + + +typedef ::cppu::ImplHelper2< + css::accessibility::XAccessibleAction, + css::accessibility::XAccessibleEditableText > VCLXAccessibleEdit_BASE; + +class VCLXAccessibleEdit final : public VCLXAccessibleTextComponent, + public VCLXAccessibleEdit_BASE +{ + friend class VCLXAccessibleBox; + +private: + sal_Int32 m_nCaretPosition; + + virtual ~VCLXAccessibleEdit() override = default; + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + sal_Int16 implGetAccessibleRole(); + + // OCommonAccessibleText + virtual OUString implGetText() override; + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; + +public: + VCLXAccessibleEdit( VCLXWindow* pVCLXindow ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override; + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override; + virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override; + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition( ) override; + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override; + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override; + virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getCharacterCount( ) override; + virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override; + virtual OUString SAL_CALL getSelectedText( ) override; + virtual sal_Int32 SAL_CALL getSelectionStart( ) override; + virtual sal_Int32 SAL_CALL getSelectionEnd( ) override; + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual OUString SAL_CALL getText( ) override; + virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override; + + // XAccessibleEditableText + virtual sal_Bool SAL_CALL cutText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL pasteText( sal_Int32 nIndex ) override; + virtual sal_Bool SAL_CALL deleteText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL insertText( const OUString& sText, sal_Int32 nIndex ) override; + virtual sal_Bool SAL_CALL replaceText( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const OUString& sReplacement ) override; + virtual sal_Bool SAL_CALL setAttributes( sal_Int32 nStartIndex, sal_Int32 nEndIndex, const css::uno::Sequence< css::beans::PropertyValue >& aAttributeSet ) override; + virtual sal_Bool SAL_CALL setText( const OUString& sText ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblefixedhyperlink.hxx b/accessibility/inc/standard/vclxaccessiblefixedhyperlink.hxx new file mode 100644 index 000000000..b0cc9024f --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblefixedhyperlink.hxx @@ -0,0 +1,40 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessibletextcomponent.hxx> + + + + +class VCLXAccessibleFixedHyperlink final : public VCLXAccessibleTextComponent +{ + virtual ~VCLXAccessibleFixedHyperlink() override = default; + +public: + using VCLXAccessibleTextComponent::VCLXAccessibleTextComponent; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblefixedtext.hxx b/accessibility/inc/standard/vclxaccessiblefixedtext.hxx new file mode 100644 index 000000000..9a6a2d8e4 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblefixedtext.hxx @@ -0,0 +1,42 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessibletextcomponent.hxx> + + + + +class VCLXAccessibleFixedText final : public VCLXAccessibleTextComponent +{ + virtual ~VCLXAccessibleFixedText() override = default; + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + +public: + using VCLXAccessibleTextComponent::VCLXAccessibleTextComponent; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibleheaderbar.hxx b/accessibility/inc/standard/vclxaccessibleheaderbar.hxx new file mode 100644 index 000000000..3f284d7f0 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibleheaderbar.hxx @@ -0,0 +1,57 @@ +/* -*- 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 . + */ +#pragma once + +#include <vcl/headbar.hxx> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <toolkit/awt/vclxwindow.hxx> + + +typedef std::vector< css::uno::WeakReference< css::accessibility::XAccessible > > + ListItems; + +class VCLXAccessibleHeaderBar final : public VCLXAccessibleComponent +{ + + VclPtr<HeaderBar> m_pHeadBar; +public: + virtual ~VCLXAccessibleHeaderBar() override; + + VCLXAccessibleHeaderBar( VCLXWindow* pVCLXindow ); + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +public: + virtual void SAL_CALL disposing() override; + css::uno::Reference< css::accessibility::XAccessible > CreateChild(sal_Int32 i); + +private: + ListItems m_aAccessibleChildren; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibleheaderbaritem.hxx b/accessibility/inc/standard/vclxaccessibleheaderbaritem.hxx new file mode 100644 index 000000000..c7a460770 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibleheaderbaritem.hxx @@ -0,0 +1,100 @@ +/* -*- 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 . + */ +#pragma once + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/accessiblecomponenthelper.hxx> +#include <cppuhelper/implbase2.hxx> + +#include <vcl/vclptr.hxx> + +class HeaderBar; +class VclSimpleEvent; +class VclWindowEvent; + +namespace utl { +class AccessibleStateSetHelper; +} + + +// ---------------------------------------------------- +// class VCLXAccessibleHeaderBarItem +// ---------------------------------------------------- + +typedef ::cppu::ImplHelper2< + css::accessibility::XAccessible, + css::lang::XServiceInfo > VCLXAccessibleHeaderBarItem_BASE; + +class VCLXAccessibleHeaderBarItem final : public comphelper::OAccessibleExtendedComponentHelper, + public VCLXAccessibleHeaderBarItem_BASE +{ +private: + VclPtr<HeaderBar> m_pHeadBar; + sal_Int32 m_nIndexInParent; + + void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual css::awt::Rectangle implGetBounds( ) override; + +public: + VCLXAccessibleHeaderBarItem( HeaderBar* pHeadBar, sal_Int32 _nIndexInParent ); + virtual ~VCLXAccessibleHeaderBarItem() override; + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + virtual OUString SAL_CALL getAccessibleDescription( ) override; + virtual OUString SAL_CALL getAccessibleName( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; + virtual css::lang::Locale SAL_CALL getLocale( ) override; + + // XAccessibleComponent + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + virtual void SAL_CALL grabFocus( ) override {}; + virtual sal_Int32 SAL_CALL getForeground() override; + virtual sal_Int32 SAL_CALL getBackground() override; + + // XAccessibleExtendedComponent + virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; + virtual OUString SAL_CALL getTitledBorderText( ) override; + virtual OUString SAL_CALL getToolTipText( ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblelist.hxx b/accessibility/inc/standard/vclxaccessiblelist.hxx new file mode 100644 index 000000000..05c432301 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblelist.hxx @@ -0,0 +1,185 @@ +/* -*- 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 . + */ + +#pragma once + +#include <memory> +#include <vector> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <cppuhelper/implbase2.hxx> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +typedef ::cppu::ImplHelper2< + css::accessibility::XAccessible, + css::accessibility::XAccessibleSelection + > VCLXAccessibleList_BASE; + +typedef std::vector< css::uno::WeakReference< css::accessibility::XAccessible > > + ListItems; + +namespace accessibility +{ + class IComboListBoxHelper; +} + + +/** Base class for the list contained in list- and combo boxes. This class + does not support selection because lists of combo boxes give no direct + access to their underlying list implementation. Look into derived + classes for selection. +*/ +class VCLXAccessibleList final + : public VCLXAccessibleComponent, + public VCLXAccessibleList_BASE +{ +public: + enum BoxType {COMBOBOX, LISTBOX}; + + VCLXAccessibleList (VCLXWindow* pVCLXindow, BoxType aBoxType, + const css::uno::Reference< + css::accessibility::XAccessible >& _xParent); + + /** The index that is passed to this method is returned on following + calls to getAccessibleIndexInParent. + */ + void SetIndexInParent (sal_Int32 nIndex); + + /** Process some of the events and delegate the rest to the base classes. + */ + virtual void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent) override; + virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ) override; + + /** Called on reception of selection events this method checks all known + list items for a possible change in their selection state and + updates that accordingly. No accessibility events are send because + the XAccessibleSelection interface is not supported and the items + are transient. + @param sTextOfSelectedItem + This string contains the text of the currently selected + item. It is used to retrieve the index of that item. + */ + void UpdateSelection (const OUString& sTextOfSelectedItem); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL + getAccessibleContext() override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount() override final; + css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int32 i) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL + getAccessibleParent( ) override; + + /** The index returned as index in parent is always the one set with the + SetIndexInParent() method. + */ + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override; + virtual sal_Int16 SAL_CALL getAccessibleRole() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + // Return list specific services. + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override; + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override; + virtual void SAL_CALL clearAccessibleSelection( ) override; + virtual void SAL_CALL selectAllAccessibleChildren( ) override; + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override; + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nSelectedChildIndex ) override; + + virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override; + bool IsInDropDown() const; + void HandleDropOpen(); + void ProcessWindowEvent (const VclWindowEvent& rVclWindowEvent, bool b_IsDropDownList); + void UpdateSelection_Acc (const OUString& sTextOfSelectedItem, bool b_IsDropDownList); + void UpdateSelection_Impl_Acc (bool b_IsDropDownList); + + static void NotifyListItem(css::uno::Any const & val); + ::accessibility::IComboListBoxHelper* getListBoxHelper() { return m_pListBoxHelper.get(); } +private: + BoxType m_aBoxType; + std::unique_ptr<::accessibility::IComboListBoxHelper> m_pListBoxHelper; + ListItems m_aAccessibleChildren; + sal_Int32 m_nVisibleLineCount; + /// Index in parent. This is settable from the outside. + sal_Int32 m_nIndexInParent; + sal_Int32 m_nLastTopEntry; + sal_Int32 m_nLastSelectedPos; + bool m_bDisableProcessEvent; + bool m_bVisible; + sal_Int32 m_nCurSelectedPos; + + + virtual ~VCLXAccessibleList() override = default; + + sal_Int32 implGetAccessibleChildCount(); + + /** This function is called from the implementation helper during a + XComponent::dispose call. Free the list of items and the items themselves. + */ + virtual void SAL_CALL disposing() override; + + /** This method adds the states + AccessibleStateType::FOCUSABLE and possibly + AccessibleStateType::MULTI_SELECTABLE to the state set + of the base classes. + */ + virtual void FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet) override; + + /** Create the specified child and insert it into the list of children. + Sets the child's states. + */ + css::uno::Reference< css::accessibility::XAccessible > + CreateChild (sal_Int32 i); + + /** Call this method when the item list has been changed, i.e. items + have been deleted or inserted. + */ + void HandleChangedItemList(); + + // VCLXAccessibleComponent + virtual css::awt::Rectangle implGetBounds( ) override; + + /** We need to save the accessible parent to return it in getAccessibleParent(), + because this method of the base class returns the wrong parent. + */ + css::uno::Reference< css::accessibility::XAccessible > m_xParent; + + void UpdateEntryRange_Impl(); + void UpdateSelection_Impl(sal_Int32 nPos = 0); + bool checkEntrySelected(sal_Int32 _nPos, + css::uno::Any& _rNewValue, + css::uno::Reference< css::accessibility::XAccessible >& _rxNewAcc); + void notifyVisibleStates(bool _bSetNew ); + void UpdateVisibleLineCount(); +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblelistbox.hxx b/accessibility/inc/standard/vclxaccessiblelistbox.hxx new file mode 100644 index 000000000..aee3e62d2 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblelistbox.hxx @@ -0,0 +1,48 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessiblebox.hxx> + + +/** The accessible drop down combobox has one children. It is the list + containing all items and is represented by an object of the + VCLXAccessibleListBoxList class which does support + selection. +*/ +class VCLXAccessibleListBox final : public VCLXAccessibleBox +{ +public: + VCLXAccessibleListBox (VCLXWindow* pVCLXindow); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + // Return list box specific services. + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + +private: + virtual ~VCLXAccessibleListBox() override = default; + + virtual bool IsValid() const override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblelistitem.hxx b/accessibility/inc/standard/vclxaccessiblelistitem.hxx new file mode 100644 index 000000000..4af3c5afd --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblelistitem.hxx @@ -0,0 +1,156 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/accessibility/AccessibleScrollType.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include <com/sun/star/accessibility/XAccessibleText.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/compbase6.hxx> +#include <cppuhelper/basemutex.hxx> +#include <comphelper/accessibletexthelper.hxx> +#include <standard/vclxaccessiblelist.hxx> + +// forward --------------------------------------------------------------- + +namespace com::sun::star::awt { + struct Point; + struct Rectangle; + struct Size; + class XFocusListener; +} + +// class VCLXAccessibleListItem ------------------------------------------ + +typedef ::cppu::WeakAggComponentImplHelper6< css::accessibility::XAccessible + , css::accessibility::XAccessibleContext + , css::accessibility::XAccessibleComponent + , css::accessibility::XAccessibleEventBroadcaster + , css::accessibility::XAccessibleText + , css::lang::XServiceInfo > VCLXAccessibleListItem_BASE; + +/** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry +*/ +class VCLXAccessibleListItem final : public ::cppu::BaseMutex, + public ::comphelper::OCommonAccessibleText, + public VCLXAccessibleListItem_BASE +{ +private: + OUString m_sEntryText; + sal_Int32 m_nIndexInParent; + bool m_bSelected; + bool m_bVisible; + + /// client id in the AccessibleEventNotifier queue + sal_uInt32 m_nClientId; + + rtl::Reference< VCLXAccessibleList > m_xParent; + + virtual ~VCLXAccessibleListItem() override = default; + /** this function is called upon disposing the component + */ + virtual void SAL_CALL disposing() override; + + // OCommonAccessibleText + virtual OUString implGetText() override; + virtual css::lang::Locale implGetLocale() override; + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; + +public: + /** OAccessibleBase needs a valid view + @param _nIndexInParent + is the position of the entry inside the listbox + @param _xParent + is our parent accessible object + */ + VCLXAccessibleListItem(sal_Int32 _nIndexInParent, + const rtl::Reference< VCLXAccessibleList >& _xParent); + + void NotifyAccessibleEvent( sal_Int16 _nEventId, const css::uno::Any& _aOldValue, const css::uno::Any& _aNewValue ); + + bool IsSelected() const { return m_bSelected; } + void SetSelected( bool _bSelected ); + void SetVisible( bool _bVisible ); + + // XTypeProvider + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + virtual OUString SAL_CALL getAccessibleDescription( ) override; + virtual OUString SAL_CALL getAccessibleName( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; + virtual css::lang::Locale SAL_CALL getLocale( ) override; + + // XAccessibleComponent + virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + virtual css::awt::Rectangle SAL_CALL getBounds( ) override; + virtual css::awt::Point SAL_CALL getLocation( ) override; + virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override; + virtual css::awt::Size SAL_CALL getSize( ) override; + virtual void SAL_CALL grabFocus( ) override; + virtual sal_Int32 SAL_CALL getForeground() override; + virtual sal_Int32 SAL_CALL getBackground() override; + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() override; + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override; + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override; + virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getCharacterCount() override; + virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override; + virtual OUString SAL_CALL getSelectedText() override; + virtual sal_Int32 SAL_CALL getSelectionStart() override; + virtual sal_Int32 SAL_CALL getSelectionEnd() override; + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual OUString SAL_CALL getText() override; + virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override; + + // XAccessibleEventBroadcaster + virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; + virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblemenu.hxx b/accessibility/inc/standard/vclxaccessiblemenu.hxx new file mode 100644 index 000000000..34524eb0b --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblemenu.hxx @@ -0,0 +1,76 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessiblemenuitem.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> + +#include <cppuhelper/implbase1.hxx> + + + + +typedef ::cppu::ImplHelper1 < + css::accessibility::XAccessibleSelection > VCLXAccessibleMenu_BASE; + +class VCLXAccessibleMenu : public VCLXAccessibleMenuItem, + public VCLXAccessibleMenu_BASE +{ +protected: + virtual bool IsFocused() override; + virtual bool IsPopupMenuOpen() override; + sal_Int32 implGetSelectedAccessibleChildCount(); + +public: + using VCLXAccessibleMenuItem::VCLXAccessibleMenuItem; + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + + // XAccessibleComponent + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override; + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override; + virtual void SAL_CALL clearAccessibleSelection( ) override; + virtual void SAL_CALL selectAllAccessibleChildren( ) override; + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override; + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) override; + + // XAccessibleAction + virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblemenubar.hxx b/accessibility/inc/standard/vclxaccessiblemenubar.hxx new file mode 100644 index 000000000..a81f0457f --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblemenubar.hxx @@ -0,0 +1,62 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/accessiblemenucomponent.hxx> +#include <vcl/vclptr.hxx> + +class VclSimpleEvent; +class VclWindowEvent; +namespace vcl { class Window; } + + + + +class VCLXAccessibleMenuBar final : public OAccessibleMenuComponent +{ + VclPtr<vcl::Window> m_pWindow; + + virtual bool IsFocused() override; + + DECL_LINK( WindowEventListener, VclWindowEvent&, void ); + + void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ); + + // XComponent + virtual void SAL_CALL disposing() override; + +public: + VCLXAccessibleMenuBar( Menu* pMenu ); + virtual ~VCLXAccessibleMenuBar() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + + // XAccessibleExtendedComponent + virtual sal_Int32 SAL_CALL getBackground( ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblemenuitem.hxx b/accessibility/inc/standard/vclxaccessiblemenuitem.hxx new file mode 100644 index 000000000..2c32418c5 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblemenuitem.hxx @@ -0,0 +1,107 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/accessiblemenuitemcomponent.hxx> + +#include <com/sun/star/accessibility/AccessibleScrollType.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include <cppuhelper/implbase3.hxx> +#include <comphelper/accessibletexthelper.hxx> + + + + +typedef ::cppu::ImplHelper3< + css::accessibility::XAccessibleText, + css::accessibility::XAccessibleAction, + css::accessibility::XAccessibleValue > VCLXAccessibleMenuItem_BASE; + +class VCLXAccessibleMenuItem : public OAccessibleMenuItemComponent, + public ::comphelper::OCommonAccessibleText, + public VCLXAccessibleMenuItem_BASE +{ +protected: + virtual bool IsFocused() override; + virtual bool IsSelected() override; + virtual bool IsChecked() override; + + virtual bool IsHighlighted() override; + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + + // OCommonAccessibleText + virtual OUString implGetText() final override; + virtual css::lang::Locale implGetLocale() override; + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override final; + +public: + VCLXAccessibleMenuItem( Menu* pParent, sal_uInt16 nItemPos, Menu* pMenu = nullptr ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleContext + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() override; + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override; + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) final override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override; + virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getCharacterCount() final override; + virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override; + virtual OUString SAL_CALL getSelectedText() override final; + virtual sal_Int32 SAL_CALL getSelectionStart() override final; + virtual sal_Int32 SAL_CALL getSelectionEnd() override final; + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual OUString SAL_CALL getText() final override; + virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override; + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) final override; + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override; + virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override; + + // XAccessibleValue + virtual css::uno::Any SAL_CALL getCurrentValue( ) override; + virtual sal_Bool SAL_CALL setCurrentValue( const css::uno::Any& aNumber ) override; + virtual css::uno::Any SAL_CALL getMaximumValue( ) override; + virtual css::uno::Any SAL_CALL getMinimumValue( ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblemenuseparator.hxx b/accessibility/inc/standard/vclxaccessiblemenuseparator.hxx new file mode 100644 index 000000000..bb14b952e --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblemenuseparator.hxx @@ -0,0 +1,42 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/accessiblemenuitemcomponent.hxx> + + + + +class VCLXAccessibleMenuSeparator final : public OAccessibleMenuItemComponent +{ +public: + VCLXAccessibleMenuSeparator( Menu* pParent, sal_uInt16 nItemPos ); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleContext + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; +}; + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblepopupmenu.hxx b/accessibility/inc/standard/vclxaccessiblepopupmenu.hxx new file mode 100644 index 000000000..3374ef450 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblepopupmenu.hxx @@ -0,0 +1,47 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/accessiblemenucomponent.hxx> + + + + +class VCLXAccessiblePopupMenu final : public OAccessibleMenuComponent +{ + virtual bool IsFocused() override; + +public: + using OAccessibleMenuComponent::OAccessibleMenuComponent; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + + // XAccessibleExtendedComponent + virtual sal_Int32 SAL_CALL getBackground( ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibleradiobutton.hxx b/accessibility/inc/standard/vclxaccessibleradiobutton.hxx new file mode 100644 index 000000000..b4773946d --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibleradiobutton.hxx @@ -0,0 +1,72 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessibletextcomponent.hxx> + +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include <cppuhelper/implbase2.hxx> + + + + +typedef ::cppu::ImplHelper2< + css::accessibility::XAccessibleAction, + css::accessibility::XAccessibleValue > VCLXAccessibleRadioButton_BASE; + +class VCLXAccessibleRadioButton final : public VCLXAccessibleTextComponent, + public VCLXAccessibleRadioButton_BASE +{ + virtual ~VCLXAccessibleRadioButton() override = default; + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet ) override; + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + +public: + using VCLXAccessibleTextComponent::VCLXAccessibleTextComponent; + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override; + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override; + virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override; + + // XAccessibleValue + virtual css::uno::Any SAL_CALL getCurrentValue( ) override; + virtual sal_Bool SAL_CALL setCurrentValue( const css::uno::Any& aNumber ) override; + virtual css::uno::Any SAL_CALL getMaximumValue( ) override; + virtual css::uno::Any SAL_CALL getMinimumValue( ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblescrollbar.hxx b/accessibility/inc/standard/vclxaccessiblescrollbar.hxx new file mode 100644 index 000000000..8d81c60cc --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblescrollbar.hxx @@ -0,0 +1,75 @@ +/* -*- 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 . + */ + +#pragma once + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> + +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> + +#include <cppuhelper/implbase2.hxx> + + + + +typedef ::cppu::ImplHelper2< + css::accessibility::XAccessibleAction, + css::accessibility::XAccessibleValue > VCLXAccessibleScrollBar_BASE; + +class VCLXAccessibleScrollBar final : public VCLXAccessibleComponent, + public VCLXAccessibleScrollBar_BASE +{ + virtual ~VCLXAccessibleScrollBar() override = default; + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + +public: + using VCLXAccessibleComponent::VCLXAccessibleComponent; + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override; + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override; + virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override; + + // XAccessibleValue + virtual css::uno::Any SAL_CALL getCurrentValue( ) override; + virtual sal_Bool SAL_CALL setCurrentValue( const css::uno::Any& aNumber ) override; + virtual css::uno::Any SAL_CALL getMaximumValue( ) override; + virtual css::uno::Any SAL_CALL getMinimumValue( ) override; + + // XAccessibleContext + OUString SAL_CALL getAccessibleName( ) override; + +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblestatusbar.hxx b/accessibility/inc/standard/vclxaccessiblestatusbar.hxx new file mode 100644 index 000000000..bae4ed9d0 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblestatusbar.hxx @@ -0,0 +1,68 @@ +/* -*- 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 . + */ + +#pragma once + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <vcl/status.hxx> +#include <vcl/vclptr.hxx> + +#include <vector> + + + + +class VCLXAccessibleStatusBar final : public VCLXAccessibleComponent +{ +private: + typedef std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren; + + AccessibleChildren m_aAccessibleChildren; + VclPtr<StatusBar> m_pStatusBar; + + void UpdateShowing( sal_Int32 i, bool bShowing ); + void UpdateItemName( sal_Int32 i ); + void UpdateItemText( sal_Int32 i ); + + void InsertChild( sal_Int32 i ); + void RemoveChild( sal_Int32 i ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + + // XComponent + virtual void SAL_CALL disposing() override; + +public: + VCLXAccessibleStatusBar( VCLXWindow* pVCLXWindow ); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + + // XAccessibleComponent + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; +}; + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx b/accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx new file mode 100644 index 000000000..92c39dbd8 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessiblestatusbaritem.hxx @@ -0,0 +1,133 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/accessibility/AccessibleScrollType.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/accessibletexthelper.hxx> +#include <cppuhelper/implbase2.hxx> +#include <vcl/status.hxx> +#include <vcl/vclptr.hxx> + +namespace utl { +class AccessibleStateSetHelper; +} + + + + +typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE; + +typedef ::cppu::ImplHelper2< + css::accessibility::XAccessible, + css::lang::XServiceInfo > VCLXAccessibleStatusBarItem_BASE; + +class VCLXAccessibleStatusBarItem final : public AccessibleTextHelper_BASE, + public VCLXAccessibleStatusBarItem_BASE +{ + friend class VCLXAccessibleStatusBar; + +private: + VclPtr<StatusBar> m_pStatusBar; + sal_uInt16 m_nItemId; + OUString m_sItemName; + OUString m_sItemText; + bool m_bShowing; + + bool IsShowing(); + void SetShowing( bool bShowing ); + void SetItemName( const OUString& sItemName ); + OUString GetItemName(); + void SetItemText( const OUString& sItemText ); + OUString GetItemText(); + sal_uInt16 GetItemId() const { return m_nItemId; } + + void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual css::awt::Rectangle implGetBounds( ) override; + + // OCommonAccessibleText + virtual OUString implGetText() override; + virtual css::lang::Locale implGetLocale() override; + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; + + // XComponent + virtual void SAL_CALL disposing() override; + +public: + VCLXAccessibleStatusBarItem( StatusBar* pStatusBar, sal_uInt16 nItemId ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + virtual OUString SAL_CALL getAccessibleDescription( ) override; + virtual OUString SAL_CALL getAccessibleName( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; + virtual css::lang::Locale SAL_CALL getLocale( ) override; + + // XAccessibleComponent + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + virtual void SAL_CALL grabFocus( ) override; + virtual sal_Int32 SAL_CALL getForeground( ) override; + virtual sal_Int32 SAL_CALL getBackground( ) override; + + // XAccessibleExtendedComponent + virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; + virtual OUString SAL_CALL getTitledBorderText( ) override; + virtual OUString SAL_CALL getToolTipText( ) override; + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() override; + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override; + virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override; + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual OUString SAL_CALL getText() override; + virtual sal_Int32 SAL_CALL getCharacterCount() override; + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override; + virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override; + virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override; + +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibletabcontrol.hxx b/accessibility/inc/standard/vclxaccessibletabcontrol.hxx new file mode 100644 index 000000000..7511e03eb --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibletabcontrol.hxx @@ -0,0 +1,94 @@ +/* -*- 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 . + */ + +#pragma once + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <vcl/tabctrl.hxx> +#include <vcl/vclptr.hxx> + +#include <vector> + + + + +typedef ::cppu::ImplHelper1 < + css::accessibility::XAccessibleSelection > VCLXAccessibleTabControl_BASE; + +class VCLXAccessibleTabControl final : public VCLXAccessibleComponent, + public VCLXAccessibleTabControl_BASE +{ +private: + typedef std::vector< css::uno::Reference< css::accessibility::XAccessible > > AccessibleChildren; + + AccessibleChildren m_aAccessibleChildren; + VclPtr<TabControl> m_pTabControl; + + css::uno::Reference< css::accessibility::XAccessible > implGetAccessibleChild( sal_Int32 i ); + bool implIsAccessibleChildSelected( sal_Int32 nChildIndex ); + + + void UpdateFocused(); + void UpdateSelected( sal_Int32 i, bool bSelected ); + void UpdatePageText( sal_Int32 i ); + void UpdateTabPage( sal_Int32 i, bool bNew ); + + void InsertChild( sal_Int32 i ); + void RemoveChild( sal_Int32 i ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + + // XComponent + virtual void SAL_CALL disposing() override; + +public: + VCLXAccessibleTabControl( VCLXWindow* pVCLXWindow ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + virtual OUString SAL_CALL getAccessibleName( ) override; + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override; + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override; + virtual void SAL_CALL clearAccessibleSelection( ) override; + virtual void SAL_CALL selectAllAccessibleChildren( ) override; + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override; + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) override; +}; + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibletabpage.hxx b/accessibility/inc/standard/vclxaccessibletabpage.hxx new file mode 100644 index 000000000..8e3c3c8f6 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibletabpage.hxx @@ -0,0 +1,141 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/accessibility/AccessibleScrollType.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <comphelper/accessibletexthelper.hxx> +#include <cppuhelper/implbase2.hxx> +#include <vcl/vclptr.hxx> + + +class TabControl; + +namespace utl { +class AccessibleStateSetHelper; +} + + + + +typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE; + +typedef ::cppu::ImplHelper2< + css::accessibility::XAccessible, + css::lang::XServiceInfo > VCLXAccessibleTabPage_BASE; + +class VCLXAccessibleTabPage final : public AccessibleTextHelper_BASE, + public VCLXAccessibleTabPage_BASE +{ + friend class VCLXAccessibleTabControl; + +private: + VclPtr<TabControl> m_pTabControl; + sal_uInt16 m_nPageId; + bool m_bFocused; + bool m_bSelected; + OUString m_sPageText; + + sal_Int32 implGetAccessibleChildCount(); + + bool IsFocused() const; + bool IsSelected() const; + + void SetFocused( bool bFocused ); + void SetSelected( bool bSelected ); + void SetPageText( const OUString& sPageText ); + OUString GetPageText(); + + void Update( bool bNew ); + + sal_uInt16 GetPageId() const { return m_nPageId; } + + void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ); + + // OCommonAccessibleComponent + virtual css::awt::Rectangle implGetBounds( ) override; + + // OCommonAccessibleText + virtual OUString implGetText() override; + virtual css::lang::Locale implGetLocale() override; + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; + + // XComponent + virtual void SAL_CALL disposing() override; + +public: + VCLXAccessibleTabPage( TabControl* pTabControl, sal_uInt16 nPageId ); + virtual ~VCLXAccessibleTabPage() override; + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + virtual OUString SAL_CALL getAccessibleDescription( ) override; + virtual OUString SAL_CALL getAccessibleName( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; + virtual css::lang::Locale SAL_CALL getLocale( ) override; + + // XAccessibleComponent + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + virtual void SAL_CALL grabFocus( ) override; + virtual sal_Int32 SAL_CALL getForeground( ) override; + virtual sal_Int32 SAL_CALL getBackground( ) override; + + // XAccessibleExtendedComponent + virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; + virtual OUString SAL_CALL getTitledBorderText( ) override; + virtual OUString SAL_CALL getToolTipText( ) override; + + // XAccessibleText + virtual OUString SAL_CALL getText() override; + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getCharacterCount() override; + virtual sal_Int32 SAL_CALL getCaretPosition() override; + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override; + virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override; + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual OUString SAL_CALL getTextRange(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override; + virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibletabpagewindow.hxx b/accessibility/inc/standard/vclxaccessibletabpagewindow.hxx new file mode 100644 index 000000000..36254ceec --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibletabpagewindow.hxx @@ -0,0 +1,53 @@ +/* -*- 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 . + */ + +#pragma once + +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <vcl/tabctrl.hxx> +#include <vcl/tabpage.hxx> +#include <vcl/vclptr.hxx> + + + + +class VCLXAccessibleTabPageWindow final : public VCLXAccessibleComponent +{ +private: + VclPtr<TabControl> m_pTabControl; + VclPtr<TabPage> m_pTabPage; + sal_uInt16 m_nPageId; + + // OCommonAccessibleComponent + virtual css::awt::Rectangle implGetBounds( ) override; + + // XComponent + virtual void SAL_CALL disposing() override; + +public: + VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow ); + + // XAccessibleContext + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; +}; + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibletextcomponent.hxx b/accessibility/inc/standard/vclxaccessibletextcomponent.hxx new file mode 100644 index 000000000..205af38d5 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibletextcomponent.hxx @@ -0,0 +1,83 @@ +/* -*- 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 . + */ + +#pragma once + +#include <com/sun/star/accessibility/AccessibleScrollType.hpp> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <comphelper/accessibletexthelper.hxx> + + + + +typedef ::cppu::ImplHelper1 < + css::accessibility::XAccessibleText > VCLXAccessibleTextComponent_BASE; + +class VCLXAccessibleTextComponent : public VCLXAccessibleComponent, + public ::comphelper::OCommonAccessibleText, + public VCLXAccessibleTextComponent_BASE +{ + OUString m_sText; + +protected: + void SetText( const OUString& sText ); + + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + + // OCommonAccessibleText + virtual OUString implGetText() override; + virtual css::lang::Locale implGetLocale() override; + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; + + // XComponent + virtual void SAL_CALL disposing() override; + +public: + VCLXAccessibleTextComponent( VCLXWindow* pVCLXWindow ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XAccessibleText + virtual sal_Int32 SAL_CALL getCaretPosition() override; + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override; + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override; + virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getCharacterCount() override; + virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override; + virtual OUString SAL_CALL getSelectedText() override; + virtual sal_Int32 SAL_CALL getSelectionStart() override; + virtual sal_Int32 SAL_CALL getSelectionEnd() override; + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual OUString SAL_CALL getText() override; + virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override; + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override; +}; + + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibletextfield.hxx b/accessibility/inc/standard/vclxaccessibletextfield.hxx new file mode 100644 index 000000000..5d29de766 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibletextfield.hxx @@ -0,0 +1,82 @@ +/* -*- 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 . + */ + +#pragma once + +#include <standard/vclxaccessibletextcomponent.hxx> + +#include <cppuhelper/implbase1.hxx> + +typedef ::cppu::ImplHelper1< css::accessibility::XAccessible > VCLXAccessible_BASE; + + +/** This class represents non editable text fields. The object passed to + the constructor is expected to be a list (a ListBox to be + more specific). From this always the selected item is token to be made + accessible by this class. When the selected item changes then also the + exported text changes. +*/ +class VCLXAccessibleTextField final : + public VCLXAccessibleTextComponent, + public VCLXAccessible_BASE +{ +public: + VCLXAccessibleTextField (VCLXWindow* pVCLXindow, + const css::uno::Reference< css::accessibility::XAccessible >& _xParent); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XAccessible + css::uno::Reference< css::accessibility::XAccessibleContext> SAL_CALL + getAccessibleContext() override; + + // XAccessibleContext + sal_Int32 SAL_CALL getAccessibleChildCount() override; + css::uno::Reference< css::accessibility::XAccessible> SAL_CALL + getAccessibleChild (sal_Int32 i) override; + sal_Int16 SAL_CALL getAccessibleRole() override; + css::uno::Reference< css::accessibility::XAccessible > SAL_CALL + getAccessibleParent( ) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + // Return text field specific services. + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedServiceNames() override; + +private: + virtual ~VCLXAccessibleTextField() override = default; + + /** With this method the text of the currently selected item is made + available to the VCLXAccessibleTextComponent base class. + */ + OUString implGetText() override; + + /** We need to save the accessible parent to return it in getAccessibleParent(), + because this method of the base class returns the wrong parent. + */ + css::uno::Reference< css::accessibility::XAccessible > m_xParent; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibletoolbox.hxx b/accessibility/inc/standard/vclxaccessibletoolbox.hxx new file mode 100644 index 000000000..89bf0a99a --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibletoolbox.hxx @@ -0,0 +1,103 @@ +/* -*- 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 . + */ +#pragma once + +#include <map> +#include <toolkit/awt/vclxaccessiblecomponent.hxx> +#include <vcl/toolbox.hxx> +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> + + + + +typedef ::cppu::ImplHelper1 < css::accessibility::XAccessibleSelection > VCLXAccessibleToolBox_BASE; + +typedef std::map< sal_Int32, css::uno::Reference< css::accessibility::XAccessible > > ToolBoxItemsMap; + +class VCLXAccessibleToolBoxItem; +class ToolBox; + +class VCLXAccessibleToolBox final : public VCLXAccessibleComponent, public VCLXAccessibleToolBox_BASE +{ +private: + ToolBoxItemsMap m_aAccessibleChildren; + + VCLXAccessibleToolBoxItem* GetItem_Impl( ToolBox::ImplToolItems::size_type _nPos ); + + void UpdateFocus_Impl(); + void ReleaseFocus_Impl( ToolBox::ImplToolItems::size_type _nPos ); + void UpdateChecked_Impl( ToolBox::ImplToolItems::size_type _nPos ); + void UpdateIndeterminate_Impl( ToolBox::ImplToolItems::size_type _nPos ); + void UpdateItem_Impl( ToolBox::ImplToolItems::size_type _nPos ); + void UpdateAllItems_Impl(); + void UpdateItemName_Impl( ToolBox::ImplToolItems::size_type _nPos ); + void UpdateItemEnabled_Impl( ToolBox::ImplToolItems::size_type _nPos ); + void UpdateCustomPopupItemp_Impl( vcl::Window* pWindow, bool bOpen ); + void HandleSubToolBarEvent( const VclWindowEvent& rVclWindowEvent ); + void ReleaseSubToolBox( ToolBox* _pSubToolBox ); + sal_Int32 implGetAccessibleChildCount(); + + virtual ~VCLXAccessibleToolBox() override; + + virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet ) override; + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual void ProcessWindowChildEvent( const VclWindowEvent& rVclWindowEvent ) override; + + virtual css::uno::Reference< css::accessibility::XAccessible > GetChildAccessible( const VclWindowEvent& rVclWindowEvent ) override; + css::uno::Reference< css::accessibility::XAccessible > GetItemWindowAccessible( const VclWindowEvent& rVclWindowEvent ); + + // XComponent + virtual void SAL_CALL disposing() override; + +public: + VCLXAccessibleToolBox( VCLXWindow* pVCLXWindow ); + + // XInterface + DECLARE_XINTERFACE( ) + + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + + // XAccessibleSelection + virtual void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) override; + virtual sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) override; + virtual void SAL_CALL clearAccessibleSelection( ) override; + virtual void SAL_CALL selectAllAccessibleChildren( ) override; + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) override; + virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) override; + +private: + void implReleaseToolboxItem( + ToolBoxItemsMap::iterator const & _rMapPos, + bool _bNotifyRemoval + ); +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx b/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx new file mode 100644 index 000000000..544be1770 --- /dev/null +++ b/accessibility/inc/standard/vclxaccessibletoolboxitem.hxx @@ -0,0 +1,151 @@ +/* -*- 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 . + */ +#pragma once + +#include <com/sun/star/accessibility/AccessibleScrollType.hpp> +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include <com/sun/star/accessibility/XAccessibleValue.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase4.hxx> +#include <comphelper/accessibletexthelper.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/vclptr.hxx> + + +typedef ::comphelper::OAccessibleTextHelper AccessibleTextHelper_BASE; +typedef ::cppu::ImplHelper4 < css::accessibility::XAccessible, + css::accessibility::XAccessibleAction, + css::accessibility::XAccessibleValue, + css::lang::XServiceInfo > VCLXAccessibleToolBoxItem_BASE; + +class VCLXAccessibleToolBoxItem final : public AccessibleTextHelper_BASE, + public VCLXAccessibleToolBoxItem_BASE +{ +private: + OUString m_sOldName; + VclPtr<ToolBox> m_pToolBox; + sal_Int32 m_nIndexInParent; + sal_Int16 m_nRole; + sal_uInt16 m_nItemId; + bool m_bHasFocus; + bool m_bIsChecked; + bool m_bIndeterminate; + + css::uno::Reference< css::accessibility::XAccessible > m_xChild; + OUString GetText(); + +public: + sal_Int32 getIndexInParent() const { return m_nIndexInParent; } + void setIndexInParent( sal_Int32 _nNewIndex ) { m_nIndexInParent = _nNewIndex; } + +private: + virtual ~VCLXAccessibleToolBoxItem() override; + + virtual void SAL_CALL disposing() override; + + /// implements the calculation of the bounding rectangle + virtual css::awt::Rectangle implGetBounds( ) override; + + // OCommonAccessibleText + virtual OUString implGetText() override; + virtual css::lang::Locale implGetLocale() override; + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; + +public: + VCLXAccessibleToolBoxItem( ToolBox* _pToolBox, sal_Int32 _nPos ); + + void SetFocus( bool _bFocus ); + bool HasFocus() const { return m_bHasFocus; } + void SetChecked( bool _bCheck ); + void SetIndeterminate( bool _bIndeterminate ); + void ReleaseToolBox() { m_pToolBox = nullptr; } + void NameChanged(); + void SetChild( const css::uno::Reference< css::accessibility::XAccessible >& _xChild ); + const css::uno::Reference< css::accessibility::XAccessible >& + GetChild() const { return m_xChild; } + void NotifyChildEvent( const css::uno::Reference< css::accessibility::XAccessible >& _xChild, bool _bShow ); + + void ToggleEnableState(); + + // XInterface + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // XAccessibleContext + virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override; + virtual sal_Int16 SAL_CALL getAccessibleRole( ) override; + virtual OUString SAL_CALL getAccessibleDescription( ) override; + virtual OUString SAL_CALL getAccessibleName( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override; + + // XAccessibleText + virtual OUString SAL_CALL getText() override; + virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getCharacterCount() override; + virtual sal_Int32 SAL_CALL getCaretPosition() override; + virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override; + virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override; + virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override; + virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override; + virtual sal_Bool SAL_CALL scrollSubstringTo( sal_Int32 nStartIndex, sal_Int32 nEndIndex, css::accessibility::AccessibleScrollType aScrollType) override; + + // XAccessibleComponent + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + virtual void SAL_CALL grabFocus( ) override; + virtual sal_Int32 SAL_CALL getForeground( ) override; + virtual sal_Int32 SAL_CALL getBackground( ) override; + + // XAccessibleExtendedComponent + virtual css::uno::Reference< css::awt::XFont > SAL_CALL getFont( ) override; + virtual OUString SAL_CALL getTitledBorderText( ) override; + virtual OUString SAL_CALL getToolTipText( ) override; + + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override; + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override; + virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override; + + // XAccessibleValue + virtual css::uno::Any SAL_CALL getCurrentValue( ) override; + virtual sal_Bool SAL_CALL setCurrentValue( const css::uno::Any& aNumber ) override; + virtual css::uno::Any SAL_CALL getMaximumValue( ) override; + virtual css::uno::Any SAL_CALL getMinimumValue( ) override; +}; + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |