diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2025-01-29 10:50:16 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2025-01-29 15:50:08 +0100 |
commit | 0ebf8c832ff4fe3b44801067a5994a4b122215a0 (patch) | |
tree | 4001f577528d536f87e537df59fbbd431803c007 | |
parent | 375c3952c09feb328b08a874e7658b4c7ca90d57 (diff) |
vcl a11y: Drop namespace "accessibility"
Drop the "accessibility" namespace in which the classes
moved to vcl from the earlier separate accessibility
module were, see
commit 9283da858506fe3b4383e4cfe0506e470a4356f6
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Tue Dec 17 12:04:04 2024 +0100
a11y: Merge accessibility module into vcl
In an upcoming Gerrit change [1] that namespace was
now causing ambiguity in source files using
using namespace css::uno;
because a simple `accessibility` namespace specifier
could now be for either the `accessibility` namespace
removed with this commit or `css::uno::accessibility`.
Sample from Windows CI failure [2]:
C:/cygwin64/home/tdf/jenkins/workspace/gerrit_windows/vcl/source/accessibility/vclxaccessiblecomponent.cxx(112): error C2872: 'accessibility': ambiguous symbol
C:\cygwin64\home\tdf\jenkins\workspace\gerrit_windows\vcl\inc\accessibility/accessibletablistbox.hxx(29): note: could be 'accessibility'
C:\cygwin64\home\tdf\jenkins\workspace\gerrit_windows\include\vcl/accessibility/vclxaccessiblecomponent.hxx(31): note: or 'com::sun::star::accessibility'
C:/cygwin64/home/tdf/jenkins/workspace/gerrit_windows/vcl/source/accessibility/vclxaccessiblecomponent.cxx(112): error C2039: 'XAccessibleContext': is not a member of 'accessibility'
Drop the namespace to avoid having to always specify
the whole namespace (`css::uno::accessibility` vs `::accessibility`).
(`git show --ignore-space-change` shows the "actual
changes" more clearly as some code was using an
extra indentation level due to the namespace
that has been removed along with the namespace.)
[1] https://gerrit.libreoffice.org/c/core/+/180848
[2] https://ci.libreoffice.org/job/gerrit_windows/192770/consoleFull#1759204403cbd6b0d4-2729-45f4-a019-828721d0af3e
Change-Id: I6ca85c2660c001f9bc45700f2f13bd0b6707f8ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180870
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
43 files changed, 3339 insertions, 3570 deletions
diff --git a/vcl/inc/accessibility/AccessibleBrowseBox.hxx b/vcl/inc/accessibility/AccessibleBrowseBox.hxx index ed78bb407044..c8edc8a89341 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBox.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBox.hxx @@ -25,10 +25,8 @@ #include <vcl/accessibletableprovider.hxx> #include <mutex> -namespace accessibility { - - class AccessibleBrowseBoxHeaderBar; - class AccessibleBrowseBoxTable; +class AccessibleBrowseBoxHeaderBar; +class AccessibleBrowseBoxTable; /** This class represents the complete accessible BrowseBox object. */ @@ -260,9 +258,4 @@ private: AccessibleBrowseBoxAccess& operator=( const AccessibleBrowseBoxAccess& ) = delete; }; - -} // namespace accessibility - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxBase.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxBase.hxx index 43d03d42a906..b8758c4aeac5 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxBase.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxBase.hxx @@ -46,8 +46,6 @@ namespace vcl { class IAccessibleTableProvider; } -namespace accessibility { - typedef ::cppu::WeakComponentImplHelper< css::accessibility::XAccessibleContext, css::accessibility::XAccessibleComponent, @@ -383,8 +381,4 @@ inline void AccessibleBrowseBoxBase::implSetName( maName = rName; } -} // namespace accessibility - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxCheckBoxCell.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxCheckBoxCell.hxx index b1b44cc25e26..e26bbd90463c 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxCheckBoxCell.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxCheckBoxCell.hxx @@ -23,57 +23,54 @@ #include <accessibility/accessiblebrowseboxcell.hxx> #include <cppuhelper/implbase2.hxx> -namespace accessibility -{ - typedef ::cppu::ImplHelper2 < css::accessibility::XAccessible, - css::accessibility::XAccessibleValue - > AccessibleCheckBoxCell_BASE; +typedef ::cppu::ImplHelper2 < css::accessibility::XAccessible, + css::accessibility::XAccessibleValue + > AccessibleCheckBoxCell_BASE; - class AccessibleCheckBoxCell final : public AccessibleBrowseBoxCell - ,public AccessibleCheckBoxCell_BASE - { - private: - TriState m_eState; - bool m_bIsTriState; +class AccessibleCheckBoxCell final : public AccessibleBrowseBoxCell + ,public AccessibleCheckBoxCell_BASE +{ +private: + TriState m_eState; + bool m_bIsTriState; - virtual ~AccessibleCheckBoxCell() override {} + virtual ~AccessibleCheckBoxCell() override {} - virtual sal_Int64 implCreateStateSet() override; + virtual sal_Int64 implCreateStateSet() override; - public: - AccessibleCheckBoxCell(const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, - ::vcl::IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos, - const TriState& _eState, - bool _bIsTriState); +public: + AccessibleCheckBoxCell(const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, + ::vcl::IAccessibleTableProvider& _rBrowseBox, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos, + const TriState& _eState, + bool _bIsTriState); - // XInterface - DECLARE_XINTERFACE( ) - // XTypeProvider - DECLARE_XTYPEPROVIDER( ) + // XInterface + DECLARE_XINTERFACE( ) + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) - // XAccessible - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; - // XAccessibleContext - virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; - virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) override; + // XAccessibleContext + virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Int64 SAL_CALL getAccessibleIndexInParent( ) 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; - virtual css::uno::Any SAL_CALL getMinimumIncrement( ) 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; + virtual css::uno::Any SAL_CALL getMinimumIncrement( ) override; - // internal - void SetChecked( bool _bChecked ); - }; -} + // internal + void SetChecked( bool _bChecked ); +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxHeaderBar.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxHeaderBar.hxx index fdd37cbe3173..791f3548535d 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxHeaderBar.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxHeaderBar.hxx @@ -25,9 +25,6 @@ #include <com/sun/star/accessibility/XAccessibleSelection.hpp> -namespace accessibility { - - typedef ::cppu::ImplHelper1< css::accessibility::XAccessibleSelection > AccessibleBrowseBoxHeaderBarImplHelper; @@ -210,9 +207,4 @@ inline bool AccessibleBrowseBoxHeaderBar::isColumnBar() const return getType() == AccessibleBrowseBoxObjType::ColumnHeaderBar; } - -} // namespace accessibility - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxHeaderCell.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxHeaderCell.hxx index be60bee26c5a..aa9a0d8672d4 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxHeaderCell.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxHeaderCell.hxx @@ -20,49 +20,45 @@ #include <accessibility/AccessibleBrowseBoxBase.hxx> -namespace accessibility +class AccessibleBrowseBoxHeaderCell final : public BrowseBoxAccessibleElement { - class AccessibleBrowseBoxHeaderCell final : public BrowseBoxAccessibleElement - { - sal_Int32 m_nColumnRowId; - public: - AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnRowId, - const css::uno::Reference< css::accessibility::XAccessible >& rxParent, - ::vcl::IAccessibleTableProvider& _rBrowseBox, - AccessibleBrowseBoxObjType _eObjType); - /** @return The count of visible children. */ - virtual sal_Int64 SAL_CALL getAccessibleChildCount() override; - - /** @return The XAccessible interface of the specified child. */ - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int64 nChildIndex ) override; + sal_Int32 m_nColumnRowId; +public: + AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnRowId, + const css::uno::Reference< css::accessibility::XAccessible >& rxParent, + ::vcl::IAccessibleTableProvider& _rBrowseBox, + AccessibleBrowseBoxObjType _eObjType); + /** @return The count of visible children. */ + virtual sal_Int64 SAL_CALL getAccessibleChildCount() override; - /** @return The index of this object among the parent's children. */ - virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override; + /** @return The XAccessible interface of the specified child. */ + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int64 nChildIndex ) override; - /** Grabs the focus to the BrowseBox. */ - virtual void SAL_CALL grabFocus() override; + /** @return The index of this object among the parent's children. */ + virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override; - bool isRowBarCell() const - { - return getType() == AccessibleBrowseBoxObjType::RowHeaderCell; - } + /** Grabs the focus to the BrowseBox. */ + virtual void SAL_CALL grabFocus() override; - /** @return - The name of this class. - */ - virtual OUString SAL_CALL getImplementationName() override; + bool isRowBarCell() const + { + return getType() == AccessibleBrowseBoxObjType::RowHeaderCell; + } - /** Return a bitset of states of the current object. - */ - sal_Int64 implCreateStateSet() override; + /** @return + The name of this class. + */ + virtual OUString SAL_CALL getImplementationName() override; - private: - virtual tools::Rectangle implGetBoundingBox() override; + /** Return a bitset of states of the current object. + */ + sal_Int64 implCreateStateSet() override; - virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; - }; -} +private: + virtual tools::Rectangle implGetBoundingBox() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxTable.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxTable.hxx index abff6092fcff..69d3b21ac1de 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxTable.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxTable.hxx @@ -23,8 +23,6 @@ #include <accessibility/AccessibleBrowseBoxTableBase.hxx> -namespace accessibility { - /** This class represents the accessible object of the data table of a BrowseBox control. */ class AccessibleBrowseBoxTable : public AccessibleBrowseBoxTableBase @@ -121,9 +119,4 @@ protected: implGetHeaderBar( sal_Int32 nChildIndex ); }; - -} // namespace accessibility - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxTableBase.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxTableBase.hxx index ac7f1dd00362..208f9765fff7 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxTableBase.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxTableBase.hxx @@ -25,8 +25,6 @@ #include <com/sun/star/accessibility/XAccessibleTable.hpp> -namespace accessibility { - typedef cppu::ImplInheritanceHelper<BrowseBoxAccessibleElement, css::accessibility::XAccessibleTable> AccessibleBrowseBoxTableImplHelper; @@ -210,9 +208,4 @@ protected: void ensureIsValidIndex( sal_Int64 nChildIndex ); }; - -} // namespace accessibility - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/AccessibleBrowseBoxTableCell.hxx b/vcl/inc/accessibility/AccessibleBrowseBoxTableCell.hxx index 3a49ad9eeb59..a7fa5bcfc3ef 100644 --- a/vcl/inc/accessibility/AccessibleBrowseBoxTableCell.hxx +++ b/vcl/inc/accessibility/AccessibleBrowseBoxTableCell.hxx @@ -23,96 +23,93 @@ #include <cppuhelper/implbase2.hxx> #include <com/sun/star/accessibility/AccessibleScrollType.hpp> -namespace accessibility +typedef ::cppu::ImplHelper2 < css::accessibility::XAccessibleText + , css::accessibility::XAccessible + > AccessibleTextHelper_BASE; + +// implementation of a table cell of BrowseBox +class AccessibleBrowseBoxTableCell final : public AccessibleBrowseBoxCell + ,public AccessibleTextHelper_BASE + ,public ::comphelper::OCommonAccessibleText { - typedef ::cppu::ImplHelper2 < css::accessibility::XAccessibleText - , css::accessibility::XAccessible - > AccessibleTextHelper_BASE; - - // implementation of a table cell of BrowseBox - class AccessibleBrowseBoxTableCell final : public AccessibleBrowseBoxCell - ,public AccessibleTextHelper_BASE - ,public ::comphelper::OCommonAccessibleText - { - private: - sal_Int32 m_nOffset; - - // OCommonAccessibleText - virtual OUString implGetText() final override; - virtual css::lang::Locale implGetLocale() override; - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; - - public: - AccessibleBrowseBoxTableCell( const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, - ::vcl::IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowId, - sal_uInt16 _nColId, - sal_Int32 _nOffset ); - - // XInterface ------------------------------------------------------------- - - /** Queries for a new interface. */ - css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override; - - /** Acquires the object (calls acquire() on base class). */ - virtual void SAL_CALL acquire() noexcept override; - - /** Releases the object (calls release() on base class). */ - virtual void SAL_CALL release() noexcept override; - - // XEventListener - using AccessibleBrowseBoxBase::disposing; - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - - /** @return The index of this object among the parent's children. */ - virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override; - - /** @return - The name of this class. - */ - virtual OUString SAL_CALL getImplementationName() override; - - /** @return - The count of visible children. - */ - virtual sal_Int64 SAL_CALL getAccessibleChildCount() override; - - /** @return - The XAccessible interface of the specified child. - */ - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL - getAccessibleChild( sal_Int64 nChildIndex ) override; - - /** Return a bitset of states of the current object. - */ - sal_Int64 implCreateStateSet() override; - - // XAccessible ------------------------------------------------------------ - - /** @return The XAccessibleContext interface of this object. */ - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL - getAccessibleContext() 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() 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; - }; -} +private: + sal_Int32 m_nOffset; + + // OCommonAccessibleText + virtual OUString implGetText() final override; + virtual css::lang::Locale implGetLocale() override; + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; + +public: + AccessibleBrowseBoxTableCell( const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, + ::vcl::IAccessibleTableProvider& _rBrowseBox, + sal_Int32 _nRowId, + sal_uInt16 _nColId, + sal_Int32 _nOffset ); + + // XInterface ------------------------------------------------------------- + + /** Queries for a new interface. */ + css::uno::Any SAL_CALL queryInterface( const css::uno::Type& rType ) override; + + /** Acquires the object (calls acquire() on base class). */ + virtual void SAL_CALL acquire() noexcept override; + + /** Releases the object (calls release() on base class). */ + virtual void SAL_CALL release() noexcept override; + + // XEventListener + using AccessibleBrowseBoxBase::disposing; + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + /** @return The index of this object among the parent's children. */ + virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override; + + /** @return + The name of this class. + */ + virtual OUString SAL_CALL getImplementationName() override; + + /** @return + The count of visible children. + */ + virtual sal_Int64 SAL_CALL getAccessibleChildCount() override; + + /** @return + The XAccessible interface of the specified child. + */ + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int64 nChildIndex ) override; + + /** Return a bitset of states of the current object. + */ + sal_Int64 implCreateStateSet() override; + + // XAccessible ------------------------------------------------------------ + + /** @return The XAccessibleContext interface of this object. */ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL + getAccessibleContext() 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() 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; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/AccessibleIconView.hxx b/vcl/inc/accessibility/AccessibleIconView.hxx index 5accfbdfe4c5..a128af5009e4 100644 --- a/vcl/inc/accessibility/AccessibleIconView.hxx +++ b/vcl/inc/accessibility/AccessibleIconView.hxx @@ -13,8 +13,6 @@ #include "accessiblelistbox.hxx" -namespace accessibility -{ class AccessibleIconView final : public AccessibleListBox { public: @@ -25,6 +23,5 @@ protected: // VCLXAccessibleComponent virtual void ProcessWindowEvent(const VclWindowEvent& rVclWindowEvent) override; }; -} // namespace accessibility /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/accessibility/IComboListBoxHelper.hxx b/vcl/inc/accessibility/IComboListBoxHelper.hxx index 43d30aadab74..46cda9f9adad 100644 --- a/vcl/inc/accessibility/IComboListBoxHelper.hxx +++ b/vcl/inc/accessibility/IComboListBoxHelper.hxx @@ -32,38 +32,36 @@ class AbsoluteScreenPixelRectangle; class Point; namespace tools { class Rectangle; } namespace vcl { class Window; } -namespace accessibility + +class IComboListBoxHelper { - class IComboListBoxHelper - { - public: - virtual ~IComboListBoxHelper() = 0; +public: + virtual ~IComboListBoxHelper() = 0; - virtual OUString GetEntry( sal_Int32 nPos ) const = 0; - virtual tools::Rectangle GetDropDownPosSizePixel( ) const = 0; - virtual tools::Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const = 0; - virtual AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() = 0; - virtual bool IsEnabled() const = 0; - virtual bool IsEntryVisible( sal_Int32 nPos ) const = 0; - virtual sal_uInt16 GetDisplayLineCount() const = 0; - virtual void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const = 0; - virtual WinBits GetStyle() const = 0; - virtual bool IsMultiSelectionEnabled() const = 0; - virtual sal_Int32 GetTopEntry() const = 0; - virtual bool IsEntryPosSelected( sal_Int32 nPos ) const = 0; - virtual sal_Int32 GetEntryCount() const = 0; - virtual void Select() = 0; - virtual void SelectEntryPos( sal_Int32 nPos, bool bSelect = true ) = 0; - virtual sal_Int32 GetSelectedEntryCount() const = 0; - virtual void SetNoSelection() = 0; - virtual sal_Int32 GetSelectedEntryPos( sal_Int32 nSelIndex ) const = 0; - virtual bool IsInDropDown() const = 0; - virtual tools::Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const = 0; - virtual tools::Long GetIndexForPoint( const Point& rPoint, sal_Int32 & nPos ) const = 0; - virtual css::uno::Reference< css::datatransfer::clipboard::XClipboard > - GetClipboard() = 0; - }; -} + virtual OUString GetEntry( sal_Int32 nPos ) const = 0; + virtual tools::Rectangle GetDropDownPosSizePixel( ) const = 0; + virtual tools::Rectangle GetBoundingRectangle( sal_uInt16 nItem ) const = 0; + virtual AbsoluteScreenPixelRectangle GetWindowExtentsAbsolute() = 0; + virtual bool IsEnabled() const = 0; + virtual bool IsEntryVisible( sal_Int32 nPos ) const = 0; + virtual sal_uInt16 GetDisplayLineCount() const = 0; + virtual void GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const = 0; + virtual WinBits GetStyle() const = 0; + virtual bool IsMultiSelectionEnabled() const = 0; + virtual sal_Int32 GetTopEntry() const = 0; + virtual bool IsEntryPosSelected( sal_Int32 nPos ) const = 0; + virtual sal_Int32 GetEntryCount() const = 0; + virtual void Select() = 0; + virtual void SelectEntryPos( sal_Int32 nPos, bool bSelect = true ) = 0; + virtual sal_Int32 GetSelectedEntryCount() const = 0; + virtual void SetNoSelection() = 0; + virtual sal_Int32 GetSelectedEntryPos( sal_Int32 nSelIndex ) const = 0; + virtual bool IsInDropDown() const = 0; + virtual tools::Rectangle GetEntryCharacterBounds( const sal_Int32 _nEntryPos, const sal_Int32 _nCharacterIndex ) const = 0; + virtual tools::Long GetIndexForPoint( const Point& rPoint, sal_Int32 & nPos ) const = 0; + virtual css::uno::Reference< css::datatransfer::clipboard::XClipboard > + GetClipboard() = 0; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/accessiblebrowseboxcell.hxx b/vcl/inc/accessibility/accessiblebrowseboxcell.hxx index c209619dce6c..7cf98875df04 100644 --- a/vcl/inc/accessibility/accessiblebrowseboxcell.hxx +++ b/vcl/inc/accessibility/accessiblebrowseboxcell.hxx @@ -22,53 +22,45 @@ #include <accessibility/AccessibleBrowseBoxBase.hxx> #include <vcl/AccessibleBrowseBoxObjType.hxx> -namespace accessibility -{ - - - // = AccessibleBrowseBoxCell - - /** common accessibility-functionality for browse box elements which occupy a cell - */ - class AccessibleBrowseBoxCell : public AccessibleBrowseBoxBase - { - private: - sal_Int32 m_nRowPos; // the row number of the table cell - sal_uInt16 m_nColPos; // the column id of the table cell - - protected: - // attribute access - sal_Int32 getRowPos( ) const { return m_nRowPos; } - sal_Int32 getColumnPos( ) const { return m_nColPos; } - - protected: - // AccessibleBrowseBoxBase overridables - virtual tools::Rectangle implGetBoundingBox() override; - virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; - - // XAccessibleComponent - virtual void SAL_CALL grabFocus() override; - - protected: - AccessibleBrowseBoxCell( - const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, - ::vcl::IAccessibleTableProvider& _rBrowseBox, - const css::uno::Reference< css::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos, - AccessibleBrowseBoxObjType _eType = AccessibleBrowseBoxObjType::TableCell - ); - - virtual ~AccessibleBrowseBoxCell() override; - - private: - AccessibleBrowseBoxCell( const AccessibleBrowseBoxCell& ) = delete; - AccessibleBrowseBoxCell& operator=( const AccessibleBrowseBoxCell& ) = delete; - }; - - -} // namespace accessibility +// = AccessibleBrowseBoxCell +/** common accessibility-functionality for browse box elements which occupy a cell +*/ +class AccessibleBrowseBoxCell : public AccessibleBrowseBoxBase +{ +private: + sal_Int32 m_nRowPos; // the row number of the table cell + sal_uInt16 m_nColPos; // the column id of the table cell + +protected: + // attribute access + sal_Int32 getRowPos( ) const { return m_nRowPos; } + sal_Int32 getColumnPos( ) const { return m_nColPos; } + +protected: + // AccessibleBrowseBoxBase overridables + virtual tools::Rectangle implGetBoundingBox() override; + virtual AbsoluteScreenPixelRectangle implGetBoundingBoxOnScreen() override; + + // XAccessibleComponent + virtual void SAL_CALL grabFocus() override; + +protected: + AccessibleBrowseBoxCell( + const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, + ::vcl::IAccessibleTableProvider& _rBrowseBox, + const css::uno::Reference< css::awt::XWindow >& _xFocusWindow, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos, + AccessibleBrowseBoxObjType _eType = AccessibleBrowseBoxObjType::TableCell + ); + + virtual ~AccessibleBrowseBoxCell() override; + +private: + AccessibleBrowseBoxCell( const AccessibleBrowseBoxCell& ) = delete; + AccessibleBrowseBoxCell& operator=( const AccessibleBrowseBoxCell& ) = delete; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/accessibleeditbrowseboxcell.hxx b/vcl/inc/accessibility/accessibleeditbrowseboxcell.hxx index b137eace05cc..cb4d424bb72c 100644 --- a/vcl/inc/accessibility/accessibleeditbrowseboxcell.hxx +++ b/vcl/inc/accessibility/accessibleeditbrowseboxcell.hxx @@ -23,109 +23,105 @@ #include <comphelper/compbase.hxx> #include <comphelper/accessiblewrapper.hxx> -namespace accessibility + +// = EditBrowseBoxTableCell + +class EditBrowseBoxTableCell final : public AccessibleBrowseBoxCell + ,public ::comphelper::OAccessibleContextWrapperHelper { +public: + EditBrowseBoxTableCell( + const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, + const css::uno::Reference< css::accessibility::XAccessible >& _rxOwningAccessible, + const css::uno::Reference< css::accessibility::XAccessibleContext >& _xControlChild, + ::vcl::IAccessibleTableProvider& _rBrowseBox, + const css::uno::Reference< css::awt::XWindow >& _xFocusWindow, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos + ); + +private: + virtual ~EditBrowseBoxTableCell() override; + + // XAccessibleComponent + virtual sal_Int32 SAL_CALL getForeground( ) override ; + virtual sal_Int32 SAL_CALL getBackground( ) override ; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + + // XInterface + DECLARE_XINTERFACE( ) + // XTypeProvider + DECLARE_XTYPEPROVIDER( ) + + // XAccessibleContext + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) 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 sal_Int64 SAL_CALL getAccessibleStateSet( ) override; + + sal_Int16 SAL_CALL getAccessibleRole() override; - // = EditBrowseBoxTableCell - - class EditBrowseBoxTableCell final : public AccessibleBrowseBoxCell - ,public ::comphelper::OAccessibleContextWrapperHelper - { - public: - EditBrowseBoxTableCell( - const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, - const css::uno::Reference< css::accessibility::XAccessible >& _rxOwningAccessible, - const css::uno::Reference< css::accessibility::XAccessibleContext >& _xControlChild, - ::vcl::IAccessibleTableProvider& _rBrowseBox, - const css::uno::Reference< css::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos - ); - - private: - virtual ~EditBrowseBoxTableCell() override; - - // XAccessibleComponent - virtual sal_Int32 SAL_CALL getForeground( ) override ; - virtual sal_Int32 SAL_CALL getBackground( ) override ; - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - - // XInterface - DECLARE_XINTERFACE( ) - // XTypeProvider - DECLARE_XTYPEPROVIDER( ) - - // XAccessibleContext - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) 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 sal_Int64 SAL_CALL getAccessibleStateSet( ) override; - - sal_Int16 SAL_CALL getAccessibleRole() override; - - virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; - - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - - // OComponentHelper - virtual void SAL_CALL disposing() override; - - // XComponent/OComponentProxyAggregationHelper (needs to be disambiguated) - virtual void SAL_CALL dispose() final override; - - // OAccessibleContextWrapperHelper(); - void notifyTranslatedEvent( const css::accessibility::AccessibleEventObject& _rEvent ) override; - - EditBrowseBoxTableCell( const EditBrowseBoxTableCell& ) = delete; - EditBrowseBoxTableCell& operator=( const EditBrowseBoxTableCell& ) = delete; - }; - - - // = EditBrowseBoxTableCell - - // XAccessible providing an EditBrowseBoxTableCell - class EditBrowseBoxTableCellAccess final : - public comphelper::WeakComponentImplHelper<css::accessibility::XAccessible> - { - css::uno::WeakReference< css::accessibility::XAccessibleContext > - m_aContext; - css::uno::Reference< css::accessibility::XAccessible > - m_xParent; - css::uno::Reference< css::accessibility::XAccessible > - m_xControlAccessible; - css::uno::Reference< css::awt::XWindow > - m_xFocusWindow; - ::vcl::IAccessibleTableProvider* m_pBrowseBox; - sal_Int32 m_nRowPos; - sal_uInt16 m_nColPos; - - public: - EditBrowseBoxTableCellAccess( - css::uno::Reference< css::accessibility::XAccessible > _xParent, - css::uno::Reference< css::accessibility::XAccessible > _xControlAccessible, - css::uno::Reference< css::awt::XWindow > _xFocusWindow, - ::vcl::IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos - ); - - private: - virtual ~EditBrowseBoxTableCellAccess() override; - - // XAccessible - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; - - // XComponent/WeakComponentImplHelper - virtual void disposing(std::unique_lock<std::mutex>&) override; - - EditBrowseBoxTableCellAccess( const EditBrowseBoxTableCellAccess& ) = delete; - EditBrowseBoxTableCellAccess& operator=( const EditBrowseBoxTableCellAccess& ) = delete; - }; -} + virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // OComponentHelper + virtual void SAL_CALL disposing() override; + + // XComponent/OComponentProxyAggregationHelper (needs to be disambiguated) + virtual void SAL_CALL dispose() final override; + + // OAccessibleContextWrapperHelper(); + void notifyTranslatedEvent( const css::accessibility::AccessibleEventObject& _rEvent ) override; + + EditBrowseBoxTableCell( const EditBrowseBoxTableCell& ) = delete; + EditBrowseBoxTableCell& operator=( const EditBrowseBoxTableCell& ) = delete; +}; + + +// = EditBrowseBoxTableCell + +// XAccessible providing an EditBrowseBoxTableCell +class EditBrowseBoxTableCellAccess final : + public comphelper::WeakComponentImplHelper<css::accessibility::XAccessible> +{ + css::uno::WeakReference< css::accessibility::XAccessibleContext > + m_aContext; + css::uno::Reference< css::accessibility::XAccessible > + m_xParent; + css::uno::Reference< css::accessibility::XAccessible > + m_xControlAccessible; + css::uno::Reference< css::awt::XWindow > + m_xFocusWindow; + ::vcl::IAccessibleTableProvider* m_pBrowseBox; + sal_Int32 m_nRowPos; + sal_uInt16 m_nColPos; + +public: + EditBrowseBoxTableCellAccess( + css::uno::Reference< css::accessibility::XAccessible > _xParent, + css::uno::Reference< css::accessibility::XAccessible > _xControlAccessible, + css::uno::Reference< css::awt::XWindow > _xFocusWindow, + ::vcl::IAccessibleTableProvider& _rBrowseBox, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos + ); + +private: + virtual ~EditBrowseBoxTableCellAccess() override; + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // XComponent/WeakComponentImplHelper + virtual void disposing(std::unique_lock<std::mutex>&) override; + + EditBrowseBoxTableCellAccess( const EditBrowseBoxTableCellAccess& ) = delete; + EditBrowseBoxTableCellAccess& operator=( const EditBrowseBoxTableCellAccess& ) = delete; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/accessibleiconchoicectrl.hxx b/vcl/inc/accessibility/accessibleiconchoicectrl.hxx index 8cf4e343670f..7a5f8dd33204 100644 --- a/vcl/inc/accessibility/accessibleiconchoicectrl.hxx +++ b/vcl/inc/accessibility/accessibleiconchoicectrl.hxx @@ -28,67 +28,60 @@ class SvtIconChoiceCtrl; -namespace accessibility +/** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry +*/ +class AccessibleIconChoiceCtrl final : + public cppu::ImplInheritanceHelper< + VCLXAccessibleComponent, + css::accessibility::XAccessible, + css::accessibility::XAccessibleSelection> { - /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry - */ - class AccessibleIconChoiceCtrl final : - public cppu::ImplInheritanceHelper< - VCLXAccessibleComponent, - css::accessibility::XAccessible, - css::accessibility::XAccessibleSelection> - { - css::uno::Reference< css::accessibility::XAccessible > m_xParent; - - virtual ~AccessibleIconChoiceCtrl() override = default; - - /** this function is called upon disposing the component */ - virtual void SAL_CALL disposing() override; - - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; - virtual void FillAccessibleStateSet( sal_Int64& rStateSet ) override; - - VclPtr< SvtIconChoiceCtrl > getCtrl() const; + css::uno::Reference< css::accessibility::XAccessible > m_xParent; - public: - /** OAccessibleBase needs a valid view - @param _rIconCtrl - is the box for which we implement an accessible object - @param _xParent - is our parent accessible object - */ - AccessibleIconChoiceCtrl( - SvtIconChoiceCtrl& _rIconCtrl, - const css::uno::Reference<css::accessibility::XAccessible>& _xParent); + virtual ~AccessibleIconChoiceCtrl() override = default; - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + /** this function is called upon disposing the component */ + virtual void SAL_CALL disposing() override; - // XAccessible - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; - - // XAccessibleContext - virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 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; - - // XAccessibleSelection - void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override; - sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override; - void SAL_CALL clearAccessibleSelection( ) override; - void SAL_CALL selectAllAccessibleChildren( ) override; - sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override; - css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override; - void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) override; - }; - - -}// namespace accessibility + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual void FillAccessibleStateSet( sal_Int64& rStateSet ) override; + VclPtr< SvtIconChoiceCtrl > getCtrl() const; +public: + /** OAccessibleBase needs a valid view + @param _rIconCtrl + is the box for which we implement an accessible object + @param _xParent + is our parent accessible object + */ + AccessibleIconChoiceCtrl( + SvtIconChoiceCtrl& _rIconCtrl, + const css::uno::Reference<css::accessibility::XAccessible>& _xParent); + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() 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_Int64 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 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; + + // XAccessibleSelection + void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override; + sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override; + void SAL_CALL clearAccessibleSelection( ) override; + void SAL_CALL selectAllAccessibleChildren( ) override; + sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override; + css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override; + void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) override; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/accessibleiconchoicectrlentry.hxx b/vcl/inc/accessibility/accessibleiconchoicectrlentry.hxx index 30ac955caf9c..87e5e1e82db0 100644 --- a/vcl/inc/accessibility/accessibleiconchoicectrlentry.hxx +++ b/vcl/inc/accessibility/accessibleiconchoicectrlentry.hxx @@ -38,127 +38,118 @@ class SvxIconChoiceCtrlEntry; class SvtIconChoiceCtrl; -namespace accessibility +typedef ::cppu::ImplInheritanceHelper< comphelper::OAccessibleComponentHelper + , css::accessibility::XAccessible + , css::accessibility::XAccessibleText + , css::accessibility::XAccessibleAction + , css::lang::XServiceInfo + , css::lang::XEventListener > AccessibleIconChoiceCtrlEntry_BASE; + +/** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ +class AccessibleIconChoiceCtrlEntry final : public AccessibleIconChoiceCtrlEntry_BASE, + public ::comphelper::OCommonAccessibleText { - - - typedef ::cppu::ImplInheritanceHelper< comphelper::OAccessibleComponentHelper - , css::accessibility::XAccessible - , css::accessibility::XAccessibleText - , css::accessibility::XAccessibleAction - , css::lang::XServiceInfo - , css::lang::XEventListener > AccessibleIconChoiceCtrlEntry_BASE; - - /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ - class AccessibleIconChoiceCtrlEntry final : public AccessibleIconChoiceCtrlEntry_BASE, - public ::comphelper::OCommonAccessibleText - { - /** The treelistbox control */ - VclPtr<SvtIconChoiceCtrl> m_pIconCtrl; - sal_Int32 m_nIndex; - - css::uno::Reference< css::accessibility::XAccessible > m_xParent; - - tools::Rectangle GetBoundingBox_Impl() const; - AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen_Impl() const; - bool IsAlive_Impl() const; - bool IsShowing_Impl() const; - - /// @throws css::lang::DisposedException - /// @throws css::uno::RuntimeException - AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen(); - /// @throws css::lang::DisposedException - void EnsureIsAlive() const; - - virtual ~AccessibleIconChoiceCtrlEntry() override; - /** this function is called upon disposing the component - */ - virtual void SAL_CALL disposing() override; - - // 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 final; - - public: - /** Ctor() - @param _rIconCtrl - the icon control - @param _nPos - the entry number - @param _xParent - is our parent accessible object - */ - AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl, - sal_Int32 _nPos, - const css::uno::Reference< css::accessibility::XAccessible >& _xParent ); - - // 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& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - - // XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; - - // XAccessible - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; - - // XAccessibleContext - virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; - virtual sal_Int64 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 sal_Int64 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 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; - - // 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; - - // 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; - }; - - -}// namespace accessibility - - + /** The treelistbox control */ + VclPtr<SvtIconChoiceCtrl> m_pIconCtrl; + sal_Int32 m_nIndex; + + css::uno::Reference< css::accessibility::XAccessible > m_xParent; + + tools::Rectangle GetBoundingBox_Impl() const; + AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen_Impl() const; + bool IsAlive_Impl() const; + bool IsShowing_Impl() const; + + /// @throws css::lang::DisposedException + /// @throws css::uno::RuntimeException + AbsoluteScreenPixelRectangle GetBoundingBoxOnScreen(); + /// @throws css::lang::DisposedException + void EnsureIsAlive() const; + + virtual ~AccessibleIconChoiceCtrlEntry() override; + /** this function is called upon disposing the component + */ + virtual void SAL_CALL disposing() override; + + // 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 final; + +public: + /** Ctor() + @param _rIconCtrl + the icon control + @param _nPos + the entry number + @param _xParent + is our parent accessible object + */ + AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl, + sal_Int32 _nPos, + const css::uno::Reference< css::accessibility::XAccessible >& _xParent ); + + // 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& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; + + // XAccessibleContext + virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int64 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 sal_Int64 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 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; + + // 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; + + // 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; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/accessiblelistbox.hxx b/vcl/inc/accessibility/accessiblelistbox.hxx index dd7f63c51fd4..746ef60ae006 100644 --- a/vcl/inc/accessibility/accessiblelistbox.hxx +++ b/vcl/inc/accessibility/accessiblelistbox.hxx @@ -28,91 +28,83 @@ // class AccessibleListBox ----------------------------------------------- +class AccessibleListBoxEntry; class SvTreeListBox; class SvTreeListEntry; -namespace accessibility +/** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry +*/ +class AccessibleListBox : + public cppu::ImplInheritanceHelper< + VCLXAccessibleComponent, + css::accessibility::XAccessible, + css::accessibility::XAccessibleSelection> { - class AccessibleListBoxEntry; - /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry - */ - class AccessibleListBox : - public cppu::ImplInheritanceHelper< - VCLXAccessibleComponent, - css::accessibility::XAccessible, - css::accessibility::XAccessibleSelection> - { - - css::uno::Reference< css::accessibility::XAccessible > m_xParent; - // OComponentHelper overridables - /** this function is called upon disposing the component */ - virtual void SAL_CALL disposing() override; - - protected: - // VCLXAccessibleComponent - virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; - virtual void FillAccessibleStateSet( sal_Int64& rStateSet ) override; - - private: - VclPtr< SvTreeListBox > getListBox() const; + css::uno::Reference< css::accessibility::XAccessible > m_xParent; + // OComponentHelper overridables + /** this function is called upon disposing the component */ + virtual void SAL_CALL disposing() override; - void RemoveChildEntries(SvTreeListEntry*); +protected: + // VCLXAccessibleComponent + virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) override; + virtual void FillAccessibleStateSet( sal_Int64& rStateSet ) override; - sal_Int32 GetRoleType() const; +private: + VclPtr< SvTreeListBox > getListBox() const; - public: - /** OAccessibleBase needs a valid view - @param _rListBox - is the box for which we implement an accessible object - @param _xParent - is our parent accessible object - */ - AccessibleListBox(SvTreeListBox& _rListBox, - const css::uno::Reference< css::accessibility::XAccessible >& _xParent ); + void RemoveChildEntries(SvTreeListEntry*); - virtual ~AccessibleListBox() override; + sal_Int32 GetRoleType() const; - rtl::Reference<AccessibleListBoxEntry> implGetAccessible(SvTreeListEntry & rEntry); - - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - - // XAccessible - virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; +public: + /** OAccessibleBase needs a valid view + @param _rListBox + is the box for which we implement an accessible object + @param _xParent + is our parent accessible object + */ + AccessibleListBox(SvTreeListBox& _rListBox, + const css::uno::Reference< css::accessibility::XAccessible >& _xParent ); - // XAccessibleContext - virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 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 ~AccessibleListBox() override; - // XAccessibleSelection - void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override; - sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override; - void SAL_CALL clearAccessibleSelection( ) override; - void SAL_CALL selectAllAccessibleChildren( ) override; - sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override; - css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override; - void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) override; + rtl::Reference<AccessibleListBoxEntry> implGetAccessible(SvTreeListEntry & rEntry); - private: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - typedef std::unordered_map<SvTreeListEntry*, rtl::Reference<AccessibleListBoxEntry>> MAP_ENTRY; - MAP_ENTRY m_mapEntry; + // XAccessible + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override; - rtl::Reference<AccessibleListBoxEntry> m_xFocusedEntry; + // XAccessibleContext + virtual sal_Int64 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 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; - accessibility::AccessibleListBoxEntry* GetCurEventEntry( const VclWindowEvent& rVclWindowEvent ); + // XAccessibleSelection + void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override; + sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override; + void SAL_CALL clearAccessibleSelection( ) override; + void SAL_CALL selectAllAccessibleChildren( ) override; + sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override; + css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override; + void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) override; - }; +private: + typedef std::unordered_map<SvTreeListEntry*, rtl::Reference<AccessibleListBoxEntry>> MAP_ENTRY; + MAP_ENTRY m_mapEntry; -}// namespace accessibility + rtl::Reference<AccessibleListBoxEntry> m_xFocusedEntry; + AccessibleListBoxEntry* GetCurEventEntry( const VclWindowEvent& rVclWindowEvent ); +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/accessiblelistboxentry.hxx b/vcl/inc/accessibility/accessiblelistboxentry.hxx index 87bab1a0cdb7..3cafc35055b1 100644 --- a/vcl/inc/accessibility/accessiblelistboxentry.hxx +++ b/vcl/inc/accessibility/accessiblelistboxentry.hxx @@ -45,152 +45,143 @@ namespace com::sun::star::awt { class XFocusListener; } +class AccessibleListBox; class SvTreeListBox; class SvTreeListEntry; - -namespace accessibility -{ - class AccessibleListBox; - // class AccessibleListBoxEntry ------------------------------------------ - typedef cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper - , css::accessibility::XAccessible - , css::accessibility::XAccessibleAction - , css::accessibility::XAccessibleSelection - , css::accessibility::XAccessibleText - , css::accessibility::XAccessibleValue - , css::lang::XServiceInfo > AccessibleListBoxEntry_BASE; - - /** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ - class AccessibleListBoxEntry final : public AccessibleListBoxEntry_BASE - ,public ::comphelper::OCommonAccessibleText - { - friend class AccessibleListBox; - - private: - VclPtr<SvTreeListBox> m_pTreeListBox; - /** The treelistbox control */ - std::deque< sal_Int32 > m_aEntryPath; - SvTreeListEntry* m_pSvLBoxEntry; // Needed for a11y focused item... - - unotools::WeakReference<AccessibleListBox> m_wListBox; - - tools::Rectangle GetBoundingBox_Impl() const; - bool IsAlive_Impl() const; - bool IsShowing_Impl() const; - - /// @throws css::lang::IndexOutOfBoundsException - void CheckActionIndex(sal_Int32 nIndex); - /// @throws css::lang::DisposedException - void EnsureIsAlive() const; - - /** this function is called upon disposing the component - */ - virtual void SAL_CALL disposing() override; - - DECL_LINK( WindowEventListener, VclWindowEvent&, void ); - - // OCommonAccessibleText - virtual OUString implGetText() override; - virtual css::lang::Locale implGetLocale() override; - virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; - - public: - /** Ctor() - @param _rListBox - the view control - @param rEntry - the entry - @param rListBox - the a11y object for _rListBox - */ - AccessibleListBoxEntry( SvTreeListBox& _rListBox, - SvTreeListEntry& rEntry, - AccessibleListBox & rListBox); - - SvTreeListEntry* GetSvLBoxEntry() const { return m_pSvLBoxEntry; } - - protected: - virtual css::awt::Rectangle implGetBounds() override; - - private: - // XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 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_Int64 SAL_CALL getAccessibleChildCount( ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; - virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; - virtual sal_Int64 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 sal_Int64 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; - - // 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; - - // 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; - - // XAccessibleSelection - void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override; - sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override; - void SAL_CALL clearAccessibleSelection( ) override; - void SAL_CALL selectAllAccessibleChildren( ) override; - sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override; - css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override; - void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) 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; - virtual css::uno::Any SAL_CALL getMinimumIncrement( ) override; - - css::uno::Reference< css::accessibility::XAccessible > implGetParentAccessible( ) const; - SvTreeListEntry* GetRealChild(sal_Int32 nIndex); - sal_Int32 GetRoleType() const; - }; - - -}// namespace accessibility - - +typedef cppu::ImplInheritanceHelper<comphelper::OAccessibleComponentHelper + , css::accessibility::XAccessible + , css::accessibility::XAccessibleAction + , css::accessibility::XAccessibleSelection + , css::accessibility::XAccessibleText + , css::accessibility::XAccessibleValue + , css::lang::XServiceInfo > AccessibleListBoxEntry_BASE; + +/** the class AccessibleListBoxEntry represents the class for an accessible object of a listbox entry */ +class AccessibleListBoxEntry final : public AccessibleListBoxEntry_BASE + ,public ::comphelper::OCommonAccessibleText +{ +friend class AccessibleListBox; + +private: + VclPtr<SvTreeListBox> m_pTreeListBox; + /** The treelistbox control */ + std::deque< sal_Int32 > m_aEntryPath; + SvTreeListEntry* m_pSvLBoxEntry; // Needed for a11y focused item... + + unotools::WeakReference<AccessibleListBox> m_wListBox; + + tools::Rectangle GetBoundingBox_Impl() const; + bool IsAlive_Impl() const; + bool IsShowing_Impl() const; + + /// @throws css::lang::IndexOutOfBoundsException + void CheckActionIndex(sal_Int32 nIndex); + /// @throws css::lang::DisposedException + void EnsureIsAlive() const; + + /** this function is called upon disposing the component + */ + virtual void SAL_CALL disposing() override; + + DECL_LINK( WindowEventListener, VclWindowEvent&, void ); + + // OCommonAccessibleText + virtual OUString implGetText() override; + virtual css::lang::Locale implGetLocale() override; + virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override; + +public: + /** Ctor() + @param _rListBox + the view control + @param rEntry + the entry + @param rListBox + the a11y object for _rListBox + */ + AccessibleListBoxEntry( SvTreeListBox& _rListBox, + SvTreeListEntry& rEntry, + AccessibleListBox & rListBox); + + SvTreeListEntry* GetSvLBoxEntry() const { return m_pSvLBoxEntry; } + +protected: + virtual css::awt::Rectangle implGetBounds() override; + +private: + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) 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_Int64 SAL_CALL getAccessibleChildCount( ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int64 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override; + virtual sal_Int64 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 sal_Int64 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; + + // 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; + + // 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; + + // XAccessibleSelection + void SAL_CALL selectAccessibleChild( sal_Int64 nChildIndex ) override; + sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int64 nChildIndex ) override; + void SAL_CALL clearAccessibleSelection( ) override; + void SAL_CALL selectAllAccessibleChildren( ) override; + sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override; + css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) override; + void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) 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; + virtual css::uno::Any SAL_CALL getMinimumIncrement( ) override; + + css::uno::Reference< css::accessibility::XAccessible > implGetParentAccessible( ) const; + SvTreeListEntry* GetRealChild(sal_Int32 nIndex); + sal_Int32 GetRoleType() const; +}; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/accessibletablistbox.hxx b/vcl/inc/accessibility/accessibletablistbox.hxx index ebd532a55bca..85b74e6743aa 100644 --- a/vcl/inc/accessibility/accessibletablistbox.hxx +++ b/vcl/inc/accessibility/accessibletablistbox.hxx @@ -23,12 +23,8 @@ #include <cppuhelper/implbase1.hxx> #include <vcl/accessibletableprovider.hxx> -class SvHeaderTabListBox; - - -namespace accessibility { - class AccessibleBrowseBoxTable; +class SvHeaderTabListBox; typedef ::cppu::ImplHelper1 < css::accessibility::XAccessible > AccessibleTabListBox_Base; @@ -94,9 +90,4 @@ private: virtual rtl::Reference<AccessibleBrowseBoxTable> createAccessibleTable() override; }; - -} // namespace accessibility - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/accessibletablistboxtable.hxx b/vcl/inc/accessibility/accessibletablistboxtable.hxx index ec36d413acbe..8fa543e63ea4 100644 --- a/vcl/inc/accessibility/accessibletablistboxtable.hxx +++ b/vcl/inc/accessibility/accessibletablistboxtable.hxx @@ -26,9 +26,6 @@ class SvHeaderTabListBox; - -namespace accessibility { - typedef ::cppu::ImplHelper1< css::accessibility::XAccessibleSelection > AccessibleTabListBoxTableImplHelper; @@ -100,9 +97,4 @@ public: void SAL_CALL deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) override; }; - -} // namespace accessibility - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/listboxhelper.hxx b/vcl/inc/accessibility/listboxhelper.hxx index af9c301fcaf8..5fd43e6eedd1 100644 --- a/vcl/inc/accessibility/listboxhelper.hxx +++ b/vcl/inc/accessibility/listboxhelper.hxx @@ -32,7 +32,7 @@ const sal_Int32 DEFAULT_INDEX_IN_PARENT = -1; -template< class T > class VCLListBoxHelper final : public ::accessibility::IComboListBoxHelper +template< class T > class VCLListBoxHelper final : public IComboListBoxHelper { private: T& m_aComboListBox; diff --git a/vcl/inc/accessibility/textwindowaccessibility.hxx b/vcl/inc/accessibility/textwindowaccessibility.hxx index 1a6fa921bb7d..09e527ff2780 100644 --- a/vcl/inc/accessibility/textwindowaccessibility.hxx +++ b/vcl/inc/accessibility/textwindowaccessibility.hxx @@ -47,9 +47,6 @@ class TextEngine; class TextView; -namespace accessibility -{ - class Document; class SfxListenerGuard @@ -570,7 +567,4 @@ private: bool m_bInParagraphNotificationsHandler = false; }; -} - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/accessibility/vclxaccessiblelist.hxx b/vcl/inc/accessibility/vclxaccessiblelist.hxx index b0389c06692c..54a214021632 100644 --- a/vcl/inc/accessibility/vclxaccessiblelist.hxx +++ b/vcl/inc/accessibility/vclxaccessiblelist.hxx @@ -25,14 +25,9 @@ #include <cppuhelper/implbase.hxx> #include <vcl/accessibility/vclxaccessiblecomponent.hxx> +class IComboListBoxHelper; class VCLXAccessibleListItem; -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 @@ -111,10 +106,10 @@ public: void UpdateSelection_Impl_Acc (bool b_IsDropDownList); static void NotifyListItem(css::uno::Any const & val); - ::accessibility::IComboListBoxHelper* getListBoxHelper() { return m_pListBoxHelper.get(); } + IComboListBoxHelper* getListBoxHelper() { return m_pListBoxHelper.get(); } private: BoxType m_aBoxType; - std::unique_ptr<::accessibility::IComboListBoxHelper> m_pListBoxHelper; + std::unique_ptr<IComboListBoxHelper> m_pListBoxHelper; std::vector<rtl::Reference<VCLXAccessibleListItem>> m_aAccessibleChildren; sal_Int32 m_nVisibleLineCount; /// Index in parent. This is settable from the outside. diff --git a/vcl/source/accessibility/AccessibleBrowseBox.cxx b/vcl/source/accessibility/AccessibleBrowseBox.cxx index 86a955889f54..31585f66bfa1 100644 --- a/vcl/source/accessibility/AccessibleBrowseBox.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBox.cxx @@ -28,9 +28,6 @@ #include <sal/types.h> -namespace accessibility -{ - using namespace ::com::sun::star::uno; using namespace ::com::sun::star; using namespace ::com::sun::star::lang; @@ -299,8 +296,4 @@ css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL Accessibl return m_xContext; } - - -} // namespace accessibility - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/AccessibleBrowseBoxBase.cxx b/vcl/source/accessibility/AccessibleBrowseBoxBase.cxx index 9ba89b3d2b2b..592fc6743b61 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxBase.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxBase.cxx @@ -41,9 +41,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using namespace ::comphelper; - -namespace accessibility { - using namespace com::sun::star::accessibility::AccessibleStateType; @@ -535,8 +532,4 @@ BrowseBoxAccessibleElement::~BrowseBoxAccessibleElement( ) { } - -} // namespace accessibility - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/AccessibleBrowseBoxCheckBoxCell.cxx b/vcl/source/accessibility/AccessibleBrowseBoxCheckBoxCell.cxx index ede8dfd8df4e..34862ed95d1e 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxCheckBoxCell.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxCheckBoxCell.cxx @@ -23,138 +23,135 @@ #include <vcl/accessibletableprovider.hxx> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -namespace accessibility +using namespace com::sun::star::accessibility; +using namespace com::sun::star::uno; + +AccessibleCheckBoxCell::AccessibleCheckBoxCell(const Reference<XAccessible >& _rxParent, + vcl::IAccessibleTableProvider& _rBrowseBox, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos + ,const TriState& _eState, + bool _bIsTriState) + :AccessibleBrowseBoxCell(_rxParent, _rBrowseBox, nullptr, _nRowPos, _nColPos, AccessibleBrowseBoxObjType::CheckBoxCell) + ,m_eState(_eState) + ,m_bIsTriState(_bIsTriState) { - using namespace com::sun::star::accessibility; - using namespace com::sun::star::uno; - - AccessibleCheckBoxCell::AccessibleCheckBoxCell(const Reference<XAccessible >& _rxParent, - vcl::IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos - ,const TriState& _eState, - bool _bIsTriState) - :AccessibleBrowseBoxCell(_rxParent, _rBrowseBox, nullptr, _nRowPos, _nColPos, AccessibleBrowseBoxObjType::CheckBoxCell) - ,m_eState(_eState) - ,m_bIsTriState(_bIsTriState) - { - } - IMPLEMENT_FORWARD_XINTERFACE2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE ) +} +IMPLEMENT_FORWARD_XINTERFACE2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE ) - IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE ) +IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleCheckBoxCell, AccessibleBrowseBoxCell, AccessibleCheckBoxCell_BASE ) - Reference< XAccessibleContext > SAL_CALL AccessibleCheckBoxCell::getAccessibleContext( ) - { - osl::MutexGuard aGuard( getMutex() ); - ensureIsAlive(); - return this; - } +Reference< XAccessibleContext > SAL_CALL AccessibleCheckBoxCell::getAccessibleContext( ) +{ + osl::MutexGuard aGuard( getMutex() ); + ensureIsAlive(); + return this; +} - sal_Int64 AccessibleCheckBoxCell::implCreateStateSet() +sal_Int64 AccessibleCheckBoxCell::implCreateStateSet() +{ + sal_Int64 nStateSet = AccessibleBrowseBoxCell::implCreateStateSet(); + if( isAlive() ) { - sal_Int64 nStateSet = AccessibleBrowseBoxCell::implCreateStateSet(); - if( isAlive() ) - { - nStateSet |= AccessibleStateType::CHECKABLE; - mpBrowseBox->FillAccessibleStateSetForCell( - nStateSet, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); - if ( m_eState == TRISTATE_TRUE ) - nStateSet |= AccessibleStateType::CHECKED; - } - return nStateSet; + nStateSet |= AccessibleStateType::CHECKABLE; + mpBrowseBox->FillAccessibleStateSetForCell( + nStateSet, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); + if ( m_eState == TRISTATE_TRUE ) + nStateSet |= AccessibleStateType::CHECKED; } + return nStateSet; +} - // XAccessibleValue +// XAccessibleValue - Any SAL_CALL AccessibleCheckBoxCell::getCurrentValue( ) - { - ::osl::MutexGuard aGuard( getMutex() ); - - sal_Int32 nValue = 0; - switch( m_eState ) - { - case TRISTATE_FALSE: - nValue = 0; - break; - case TRISTATE_TRUE: - nValue = 1; - break; - case TRISTATE_INDET: - nValue = 2; - break; - } - return Any(nValue); - } +Any SAL_CALL AccessibleCheckBoxCell::getCurrentValue( ) +{ + ::osl::MutexGuard aGuard( getMutex() ); - sal_Bool SAL_CALL AccessibleCheckBoxCell::setCurrentValue( const Any& ) + sal_Int32 nValue = 0; + switch( m_eState ) { - return false; + case TRISTATE_FALSE: + nValue = 0; + break; + case TRISTATE_TRUE: + nValue = 1; + break; + case TRISTATE_INDET: + nValue = 2; + break; } + return Any(nValue); +} - Any SAL_CALL AccessibleCheckBoxCell::getMaximumValue( ) - { - ::osl::MutexGuard aGuard( getMutex() ); +sal_Bool SAL_CALL AccessibleCheckBoxCell::setCurrentValue( const Any& ) +{ + return false; +} - Any aValue; +Any SAL_CALL AccessibleCheckBoxCell::getMaximumValue( ) +{ + ::osl::MutexGuard aGuard( getMutex() ); - if ( m_bIsTriState ) - aValue <<= sal_Int32(2); - else - aValue <<= sal_Int32(1); + Any aValue; - return aValue; - } + if ( m_bIsTriState ) + aValue <<= sal_Int32(2); + else + aValue <<= sal_Int32(1); - Any SAL_CALL AccessibleCheckBoxCell::getMinimumValue( ) - { - Any aValue; - aValue <<= sal_Int32(0); + return aValue; +} - return aValue; - } +Any SAL_CALL AccessibleCheckBoxCell::getMinimumValue( ) +{ + Any aValue; + aValue <<= sal_Int32(0); - Any SAL_CALL AccessibleCheckBoxCell::getMinimumIncrement( ) - { - Any aValue; - aValue <<= sal_Int32(1); + return aValue; +} - return aValue; - } +Any SAL_CALL AccessibleCheckBoxCell::getMinimumIncrement( ) +{ + Any aValue; + aValue <<= sal_Int32(1); - // XAccessibleContext - sal_Int64 SAL_CALL AccessibleCheckBoxCell::getAccessibleChildCount( ) - { - return 0; - } + return aValue; +} - css::uno::Reference< css::accessibility::XAccessible > SAL_CALL AccessibleCheckBoxCell::getAccessibleChild( sal_Int64 ) - { - throw css::lang::IndexOutOfBoundsException(); - } +// XAccessibleContext +sal_Int64 SAL_CALL AccessibleCheckBoxCell::getAccessibleChildCount( ) +{ + return 0; +} - OUString SAL_CALL AccessibleCheckBoxCell::getImplementationName() - { - return u"com.sun.star.comp.svtools.TableCheckBoxCell"_ustr; - } +css::uno::Reference< css::accessibility::XAccessible > SAL_CALL AccessibleCheckBoxCell::getAccessibleChild( sal_Int64 ) +{ + throw css::lang::IndexOutOfBoundsException(); +} - sal_Int64 SAL_CALL AccessibleCheckBoxCell::getAccessibleIndexInParent() - { - ::osl::MutexGuard aGuard( getMutex() ); - ensureIsAlive(); +OUString SAL_CALL AccessibleCheckBoxCell::getImplementationName() +{ + return u"com.sun.star.comp.svtools.TableCheckBoxCell"_ustr; +} - return (static_cast<sal_Int64>(getRowPos()) * static_cast<sal_Int64>(mpBrowseBox->GetColumnCount())) + getColumnPos(); - } +sal_Int64 SAL_CALL AccessibleCheckBoxCell::getAccessibleIndexInParent() +{ + ::osl::MutexGuard aGuard( getMutex() ); + ensureIsAlive(); - void AccessibleCheckBoxCell::SetChecked( bool _bChecked ) - { - m_eState = _bChecked ? TRISTATE_TRUE : TRISTATE_FALSE; - Any aOldValue, aNewValue; - if ( _bChecked ) - aNewValue <<= AccessibleStateType::CHECKED; - else - aOldValue <<= AccessibleStateType::CHECKED; - commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); - } + return (static_cast<sal_Int64>(getRowPos()) * static_cast<sal_Int64>(mpBrowseBox->GetColumnCount())) + getColumnPos(); +} + +void AccessibleCheckBoxCell::SetChecked( bool _bChecked ) +{ + m_eState = _bChecked ? TRISTATE_TRUE : TRISTATE_FALSE; + Any aOldValue, aNewValue; + if ( _bChecked ) + aNewValue <<= AccessibleStateType::CHECKED; + else + aOldValue <<= AccessibleStateType::CHECKED; + commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx b/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx index 14e4f20ceda4..a9c60e47df65 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxHeaderBar.cxx @@ -30,9 +30,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; -namespace accessibility { - - // Ctor/Dtor/disposing -------------------------------------------------------- AccessibleBrowseBoxHeaderBar::AccessibleBrowseBoxHeaderBar( @@ -358,8 +355,4 @@ void AccessibleBrowseBoxHeaderBar::ensureIsValidHeaderIndex( sal_Int32 nIndex ) ensureIsValidColumn( nIndex ); } - -} // namespace accessibility - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx b/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx index 816ace862b61..db5319663d41 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxHeaderCell.cxx @@ -23,11 +23,9 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -namespace accessibility -{ - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::uno; AccessibleBrowseBoxHeaderCell::AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnRowId, const Reference< XAccessible >& rxParent, @@ -147,7 +145,4 @@ sal_Int64 SAL_CALL AccessibleBrowseBoxHeaderCell::getAccessibleIndexInParent() return nIndex; } -} // namespace accessibility - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx b/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx index b368ce2af0fe..0aa1e1ad08e4 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxTable.cxx @@ -30,9 +30,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; -namespace accessibility { - - // Ctor/Dtor/disposing -------------------------------------------------------- AccessibleBrowseBoxTable::AccessibleBrowseBoxTable( @@ -228,8 +225,4 @@ Reference< XAccessibleTable > AccessibleBrowseBoxTable::implGetHeaderBar( return Reference< XAccessibleTable >( xRet, uno::UNO_QUERY ); } - -} // namespace accessibility - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/AccessibleBrowseBoxTableBase.cxx b/vcl/source/accessibility/AccessibleBrowseBoxTableBase.cxx index e245e3351abf..7ea6fc865f34 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxTableBase.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxTableBase.cxx @@ -32,9 +32,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; -namespace accessibility { - - // Ctor/Dtor/disposing -------------------------------------------------------- AccessibleBrowseBoxTableBase::AccessibleBrowseBoxTableBase( @@ -252,8 +249,4 @@ void AccessibleBrowseBoxTableBase::ensureIsValidIndex( sal_Int64 nChildIndex ) throw lang::IndexOutOfBoundsException( u"child index is invalid"_ustr, *this ); } - -} // namespace accessibility - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/AccessibleBrowseBoxTableCell.cxx b/vcl/source/accessibility/AccessibleBrowseBoxTableCell.cxx index 1175ed72a779..90e025d59fee 100644 --- a/vcl/source/accessibility/AccessibleBrowseBoxTableCell.cxx +++ b/vcl/source/accessibility/AccessibleBrowseBoxTableCell.cxx @@ -25,312 +25,308 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -namespace accessibility +namespace { - namespace + /// @throws css::lang::IndexOutOfBoundsException + void checkIndex_Impl( sal_Int32 _nIndex, std::u16string_view _sText ) { - /// @throws css::lang::IndexOutOfBoundsException - void checkIndex_Impl( sal_Int32 _nIndex, std::u16string_view _sText ) - { - if ( _nIndex >= static_cast<sal_Int32>(_sText.size()) ) - throw css::lang::IndexOutOfBoundsException(); - } - - sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount ) - { - return _nRow * _nColumnCount + _nColumn; - } - } - using namespace ::com::sun::star::lang; - using namespace comphelper; - using namespace ::com::sun::star::uno; - using ::com::sun::star::accessibility::XAccessible; - using namespace ::com::sun::star::accessibility; - - - // implementation of a table cell - OUString AccessibleBrowseBoxTableCell::implGetText() - { - return mpBrowseBox->GetAccessibleCellText( getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); + if ( _nIndex >= static_cast<sal_Int32>(_sText.size()) ) + throw css::lang::IndexOutOfBoundsException(); } - css::lang::Locale AccessibleBrowseBoxTableCell::implGetLocale() + sal_Int32 getIndex_Impl( sal_Int32 _nRow, sal_uInt16 _nColumn, sal_uInt16 _nColumnCount ) { - return mpBrowseBox->GetAccessible()->getAccessibleContext()->getLocale(); + return _nRow * _nColumnCount + _nColumn; } +} +using namespace ::com::sun::star::lang; +using namespace comphelper; +using namespace ::com::sun::star::uno; +using ::com::sun::star::accessibility::XAccessible; +using namespace ::com::sun::star::accessibility; - void AccessibleBrowseBoxTableCell::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) - { - nStartIndex = 0; - nEndIndex = 0; - } - AccessibleBrowseBoxTableCell::AccessibleBrowseBoxTableCell(const Reference<XAccessible >& _rxParent, - vcl::IAccessibleTableProvider& _rBrowseBox, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos, - sal_Int32 _nOffset ) - :AccessibleBrowseBoxCell(_rxParent, _rBrowseBox, nullptr, _nRowPos, _nColPos) - { - m_nOffset = ( _nOffset == OFFSET_DEFAULT ) ? sal_Int32(vcl::BBINDEX_FIRSTCONTROL) : _nOffset; - sal_Int32 nIndex = getIndex_Impl( _nRowPos, _nColPos, _rBrowseBox.GetColumnCount() ); - setAccessibleName( _rBrowseBox.GetAccessibleObjectName( AccessibleBrowseBoxObjType::TableCell, nIndex ) ); - setAccessibleDescription( _rBrowseBox.GetAccessibleObjectDescription( AccessibleBrowseBoxObjType::TableCell, nIndex ) ); - // Need to register as event listener - Reference< XComponent > xComponent(_rxParent, UNO_QUERY); - if( xComponent.is() ) - xComponent->addEventListener(static_cast< XEventListener *> (this)); - } +// implementation of a table cell +OUString AccessibleBrowseBoxTableCell::implGetText() +{ + return mpBrowseBox->GetAccessibleCellText( getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); +} - // XInterface ------------------------------------------------------------- +css::lang::Locale AccessibleBrowseBoxTableCell::implGetLocale() +{ + return mpBrowseBox->GetAccessible()->getAccessibleContext()->getLocale(); +} - /** Queries for a new interface. */ - css::uno::Any SAL_CALL AccessibleBrowseBoxTableCell::queryInterface( const css::uno::Type& rType ) - { - Any aRet = AccessibleBrowseBoxCell::queryInterface(rType); - if ( !aRet.hasValue() ) - aRet = AccessibleTextHelper_BASE::queryInterface(rType); - return aRet; - } +void AccessibleBrowseBoxTableCell::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) +{ + nStartIndex = 0; + nEndIndex = 0; +} - /** Acquires the object (calls acquire() on base class). */ - void SAL_CALL AccessibleBrowseBoxTableCell::acquire() noexcept - { - AccessibleBrowseBoxCell::acquire(); - } +AccessibleBrowseBoxTableCell::AccessibleBrowseBoxTableCell(const Reference<XAccessible >& _rxParent, + vcl::IAccessibleTableProvider& _rBrowseBox, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos, + sal_Int32 _nOffset ) + :AccessibleBrowseBoxCell(_rxParent, _rBrowseBox, nullptr, _nRowPos, _nColPos) +{ + m_nOffset = ( _nOffset == OFFSET_DEFAULT ) ? sal_Int32(vcl::BBINDEX_FIRSTCONTROL) : _nOffset; + sal_Int32 nIndex = getIndex_Impl( _nRowPos, _nColPos, _rBrowseBox.GetColumnCount() ); + setAccessibleName( _rBrowseBox.GetAccessibleObjectName( AccessibleBrowseBoxObjType::TableCell, nIndex ) ); + setAccessibleDescription( _rBrowseBox.GetAccessibleObjectDescription( AccessibleBrowseBoxObjType::TableCell, nIndex ) ); + // Need to register as event listener + Reference< XComponent > xComponent(_rxParent, UNO_QUERY); + if( xComponent.is() ) + xComponent->addEventListener(static_cast< XEventListener *> (this)); +} - /** Releases the object (calls release() on base class). */ - void SAL_CALL AccessibleBrowseBoxTableCell::release() noexcept - { - AccessibleBrowseBoxCell::release(); - } +// XInterface ------------------------------------------------------------- - css::awt::Rectangle SAL_CALL AccessibleBrowseBoxTableCell::getCharacterBounds( sal_Int32 nIndex ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +/** Queries for a new interface. */ +css::uno::Any SAL_CALL AccessibleBrowseBoxTableCell::queryInterface( const css::uno::Type& rType ) +{ + Any aRet = AccessibleBrowseBoxCell::queryInterface(rType); + if ( !aRet.hasValue() ) + aRet = AccessibleTextHelper_BASE::queryInterface(rType); + return aRet; +} - css::awt::Rectangle aRect; +/** Acquires the object (calls acquire() on base class). */ +void SAL_CALL AccessibleBrowseBoxTableCell::acquire() noexcept +{ + AccessibleBrowseBoxCell::acquire(); +} - if ( mpBrowseBox ) - { - if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); +/** Releases the object (calls release() on base class). */ +void SAL_CALL AccessibleBrowseBoxTableCell::release() noexcept +{ + AccessibleBrowseBoxCell::release(); +} - aRect = vcl::unohelper::ConvertToAWTRect( - mpBrowseBox->GetFieldCharacterBounds(getRowPos(), getColumnPos(), nIndex)); - } +css::awt::Rectangle SAL_CALL AccessibleBrowseBoxTableCell::getCharacterBounds( sal_Int32 nIndex ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return aRect; - } + css::awt::Rectangle aRect; - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getIndexAtPoint( const css::awt::Point& _aPoint ) + if ( mpBrowseBox ) { - //! TODO CTL bidi - // OSL_FAIL("Need to be done by base class!"); - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); - return mpBrowseBox->GetFieldIndexAtPoint(getRowPos(), getColumnPos(), - vcl::unohelper::ConvertToVCLPoint(_aPoint)); + aRect = vcl::unohelper::ConvertToAWTRect( + mpBrowseBox->GetFieldCharacterBounds(getRowPos(), getColumnPos(), nIndex)); } - /** @return - The name of this class. - */ - OUString SAL_CALL AccessibleBrowseBoxTableCell::getImplementationName() - { - return u"com.sun.star.comp.svtools.AccessibleBrowseBoxTableCell"_ustr; - } + return aRect; +} - /** @return The count of visible children. */ - sal_Int64 SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleChildCount() - { - return 0; - } +sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getIndexAtPoint( const css::awt::Point& _aPoint ) +{ + //! TODO CTL bidi + // OSL_FAIL("Need to be done by base class!"); + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - /** @return The XAccessible interface of the specified child. */ - css::uno::Reference< css::accessibility::XAccessible > SAL_CALL - AccessibleBrowseBoxTableCell::getAccessibleChild( sal_Int64 ) - { - throw css::lang::IndexOutOfBoundsException(); - } + return mpBrowseBox->GetFieldIndexAtPoint(getRowPos(), getColumnPos(), + vcl::unohelper::ConvertToVCLPoint(_aPoint)); +} - /** Return a bitset of states of the current object. - */ - sal_Int64 AccessibleBrowseBoxTableCell::implCreateStateSet() - { - SolarMethodGuard aGuard(getMutex()); +/** @return + The name of this class. +*/ +OUString SAL_CALL AccessibleBrowseBoxTableCell::getImplementationName() +{ + return u"com.sun.star.comp.svtools.AccessibleBrowseBoxTableCell"_ustr; +} + +/** @return The count of visible children. */ +sal_Int64 SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleChildCount() +{ + return 0; +} - sal_Int64 nStateSet = 0; +/** @return The XAccessible interface of the specified child. */ +css::uno::Reference< css::accessibility::XAccessible > SAL_CALL + AccessibleBrowseBoxTableCell::getAccessibleChild( sal_Int64 ) +{ + throw css::lang::IndexOutOfBoundsException(); +} - if( isAlive() ) - { - // SHOWING done with mxParent - if( implIsShowing() ) - nStateSet |= AccessibleStateType::SHOWING; +/** Return a bitset of states of the current object. +*/ +sal_Int64 AccessibleBrowseBoxTableCell::implCreateStateSet() +{ + SolarMethodGuard aGuard(getMutex()); - mpBrowseBox->FillAccessibleStateSetForCell( nStateSet, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); - } - else - nStateSet |= AccessibleStateType::DEFUNC; + sal_Int64 nStateSet = 0; + + if( isAlive() ) + { + // SHOWING done with mxParent + if( implIsShowing() ) + nStateSet |= AccessibleStateType::SHOWING; - return nStateSet; + mpBrowseBox->FillAccessibleStateSetForCell( nStateSet, getRowPos(), static_cast< sal_uInt16 >( getColumnPos() ) ); } + else + nStateSet |= AccessibleStateType::DEFUNC; + return nStateSet; +} - // XAccessible ------------------------------------------------------------ - /** @return The XAccessibleContext interface of this object. */ - Reference< XAccessibleContext > SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleContext() - { - osl::MutexGuard aGuard( getMutex() ); - ensureIsAlive(); - return this; - } +// XAccessible ------------------------------------------------------------ - // XAccessibleContext ----------------------------------------------------- +/** @return The XAccessibleContext interface of this object. */ +Reference< XAccessibleContext > SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleContext() +{ + osl::MutexGuard aGuard( getMutex() ); + ensureIsAlive(); + return this; +} - sal_Int64 SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleIndexInParent() - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +// XAccessibleContext ----------------------------------------------------- - return /*vcl::BBINDEX_FIRSTCONTROL*/ m_nOffset + (static_cast<sal_Int64>(getRowPos()) * static_cast<sal_Int64>(mpBrowseBox->GetColumnCount())) + getColumnPos(); - } +sal_Int64 SAL_CALL AccessibleBrowseBoxTableCell::getAccessibleIndexInParent() +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCaretPosition( ) - { - return -1; - } + return /*vcl::BBINDEX_FIRSTCONTROL*/ m_nOffset + (static_cast<sal_Int64>(getRowPos()) * static_cast<sal_Int64>(mpBrowseBox->GetColumnCount())) + getColumnPos(); +} - sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::setCaretPosition ( sal_Int32 nIndex ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCaretPosition( ) +{ + return -1; +} - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); +sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::setCaretPosition ( sal_Int32 nIndex ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return false; - } - sal_Unicode SAL_CALL AccessibleBrowseBoxTableCell::getCharacter( sal_Int32 nIndex ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); - return OCommonAccessibleText::implGetCharacter( implGetText(), nIndex ); - } - css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleBrowseBoxTableCell::getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + return false; +} +sal_Unicode SAL_CALL AccessibleBrowseBoxTableCell::getCharacter( sal_Int32 nIndex ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - OUString sText( implGetText() ); + return OCommonAccessibleText::implGetCharacter( implGetText(), nIndex ); +} +css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleBrowseBoxTableCell::getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); + OUString sText( implGetText() ); - return css::uno::Sequence< css::beans::PropertyValue >(); - } - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCharacterCount( ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + if ( !implIsValidIndex( nIndex, sText.getLength() ) ) + throw IndexOutOfBoundsException(); - return implGetText().getLength(); - } + return css::uno::Sequence< css::beans::PropertyValue >(); +} +sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getCharacterCount( ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - OUString SAL_CALL AccessibleBrowseBoxTableCell::getSelectedText( ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + return implGetText().getLength(); +} - return OCommonAccessibleText::getSelectedText( ); - } - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getSelectionStart( ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +OUString SAL_CALL AccessibleBrowseBoxTableCell::getSelectedText( ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return OCommonAccessibleText::getSelectionStart( ); - } - sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getSelectionEnd( ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + return OCommonAccessibleText::getSelectedText( ); +} +sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getSelectionStart( ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return OCommonAccessibleText::getSelectionEnd( ); - } - sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + return OCommonAccessibleText::getSelectionStart( ); +} +sal_Int32 SAL_CALL AccessibleBrowseBoxTableCell::getSelectionEnd( ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); + return OCommonAccessibleText::getSelectionEnd( ); +} +sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return false; - } - OUString SAL_CALL AccessibleBrowseBoxTableCell::getText( ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); - return implGetText( ); - } - OUString SAL_CALL AccessibleBrowseBoxTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + return false; +} +OUString SAL_CALL AccessibleBrowseBoxTableCell::getText( ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ); - } - css::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + return implGetText( ); +} +OUString SAL_CALL AccessibleBrowseBoxTableCell::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); - } - css::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + return OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ); +} +css::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); - } - css::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); +} +css::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); - } - sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); + return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); +} +css::accessibility::TextSegment SAL_CALL AccessibleBrowseBoxTableCell::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - OUString sText = implGetText(); - checkIndex_Impl( nStartIndex, sText ); - checkIndex_Impl( nEndIndex, sText ); + return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); +} +sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - //!!! don't know how to put a string into the clipboard - return false; - } - sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType ) - { - return false; - } - void AccessibleBrowseBoxTableCell::disposing( const EventObject& _rSource ) - { - if ( _rSource.Source == mxParent ) - { - dispose(); - } - } + OUString sText = implGetText(); + checkIndex_Impl( nStartIndex, sText ); + checkIndex_Impl( nEndIndex, sText ); + //!!! don't know how to put a string into the clipboard + return false; +} +sal_Bool SAL_CALL AccessibleBrowseBoxTableCell::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType ) +{ + return false; +} +void AccessibleBrowseBoxTableCell::disposing( const EventObject& _rSource ) +{ + if ( _rSource.Source == mxParent ) + { + dispose(); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/AccessibleIconView.cxx b/vcl/source/accessibility/AccessibleIconView.cxx index eeb4b3ee3e6f..0ee1b253b90d 100644 --- a/vcl/source/accessibility/AccessibleIconView.cxx +++ b/vcl/source/accessibility/AccessibleIconView.cxx @@ -16,8 +16,6 @@ #include <accessibility/AccessibleIconView.hxx> -namespace accessibility -{ AccessibleIconView::AccessibleIconView( SvTreeListBox& _rListBox, const css::uno::Reference<css::accessibility::XAccessible>& _xParent) : AccessibleListBox(_rListBox, _xParent) @@ -48,6 +46,5 @@ void AccessibleIconView::ProcessWindowEvent(const VclWindowEvent& rVclWindowEven AccessibleListBox::ProcessWindowEvent(rVclWindowEvent); } } -} // namespace accessibility /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/accessibility/IComboListBoxHelper.cxx b/vcl/source/accessibility/IComboListBoxHelper.cxx index 5b8ac834ba1b..2b7ccf060797 100644 --- a/vcl/source/accessibility/IComboListBoxHelper.cxx +++ b/vcl/source/accessibility/IComboListBoxHelper.cxx @@ -9,9 +9,6 @@ #include <accessibility/IComboListBoxHelper.hxx> -namespace accessibility -{ IComboListBoxHelper::~IComboListBoxHelper() {} -} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/acc_factory.cxx b/vcl/source/accessibility/acc_factory.cxx index 010110d9941c..06d38a00492c 100644 --- a/vcl/source/accessibility/acc_factory.cxx +++ b/vcl/source/accessibility/acc_factory.cxx @@ -57,7 +57,6 @@ #include <vcl/toolkit/fixedhyper.hxx> #include <vcl/accessibility/vclxaccessiblecomponent.hxx> -using namespace ::accessibility; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::awt; using namespace ::com::sun::star::accessibility; diff --git a/vcl/source/accessibility/accessiblebrowseboxcell.cxx b/vcl/source/accessibility/accessiblebrowseboxcell.cxx index 1ec8b363bbe2..9eab8fa3a82c 100644 --- a/vcl/source/accessibility/accessiblebrowseboxcell.cxx +++ b/vcl/source/accessibility/accessiblebrowseboxcell.cxx @@ -21,49 +21,46 @@ #include <vcl/accessibletableprovider.hxx> #include <accessibility/accessiblebrowseboxcell.hxx> -namespace accessibility -{ - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::awt; +using namespace ::com::sun::star::accessibility; - // AccessibleBrowseBoxCell - AccessibleBrowseBoxCell::AccessibleBrowseBoxCell( - const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, ::vcl::IAccessibleTableProvider& _rBrowseBox, - const css::uno::Reference< css::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleBrowseBoxObjType _eType ) - :AccessibleBrowseBoxBase( _rxParent, _rBrowseBox, _xFocusWindow, _eType ) - ,m_nRowPos( _nRowPos ) - ,m_nColPos( _nColPos ) - { - // set accessible name here, because for that we need the position of the cell - // and so the base class isn't capable of doing this - sal_Int32 nPos = _nRowPos * _rBrowseBox.GetColumnCount() + _nColPos; - OUString aAccName = _rBrowseBox.GetAccessibleObjectName( AccessibleBrowseBoxObjType::TableCell, nPos ); - implSetName( aAccName ); - } +// AccessibleBrowseBoxCell +AccessibleBrowseBoxCell::AccessibleBrowseBoxCell( + const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, ::vcl::IAccessibleTableProvider& _rBrowseBox, + const css::uno::Reference< css::awt::XWindow >& _xFocusWindow, + sal_Int32 _nRowPos, sal_uInt16 _nColPos, AccessibleBrowseBoxObjType _eType ) + :AccessibleBrowseBoxBase( _rxParent, _rBrowseBox, _xFocusWindow, _eType ) + ,m_nRowPos( _nRowPos ) + ,m_nColPos( _nColPos ) +{ + // set accessible name here, because for that we need the position of the cell + // and so the base class isn't capable of doing this + sal_Int32 nPos = _nRowPos * _rBrowseBox.GetColumnCount() + _nColPos; + OUString aAccName = _rBrowseBox.GetAccessibleObjectName( AccessibleBrowseBoxObjType::TableCell, nPos ); + implSetName( aAccName ); +} - AccessibleBrowseBoxCell::~AccessibleBrowseBoxCell() - { - } +AccessibleBrowseBoxCell::~AccessibleBrowseBoxCell() +{ +} - void SAL_CALL AccessibleBrowseBoxCell::grabFocus() - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +void SAL_CALL AccessibleBrowseBoxCell::grabFocus() +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - mpBrowseBox->GoToCell( m_nRowPos, m_nColPos ); - } + mpBrowseBox->GoToCell( m_nRowPos, m_nColPos ); +} - ::tools::Rectangle AccessibleBrowseBoxCell::implGetBoundingBox() - { - return mpBrowseBox->GetFieldRectPixel( m_nRowPos, m_nColPos, false, /*bOnScreen*/false ); - } +::tools::Rectangle AccessibleBrowseBoxCell::implGetBoundingBox() +{ + return mpBrowseBox->GetFieldRectPixel( m_nRowPos, m_nColPos, false, /*bOnScreen*/false ); +} - AbsoluteScreenPixelRectangle AccessibleBrowseBoxCell::implGetBoundingBoxOnScreen() - { - return AbsoluteScreenPixelRectangle(mpBrowseBox->GetFieldRectPixel( m_nRowPos, m_nColPos, false, /*bOnScreen*/true )); - } -} // namespace accessibility +AbsoluteScreenPixelRectangle AccessibleBrowseBoxCell::implGetBoundingBoxOnScreen() +{ + return AbsoluteScreenPixelRectangle(mpBrowseBox->GetFieldRectPixel( m_nRowPos, m_nColPos, false, /*bOnScreen*/true )); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/accessibleeditbrowseboxcell.cxx b/vcl/source/accessibility/accessibleeditbrowseboxcell.cxx index afd4e514a368..9fdb8a24df7b 100644 --- a/vcl/source/accessibility/accessibleeditbrowseboxcell.cxx +++ b/vcl/source/accessibility/accessibleeditbrowseboxcell.cxx @@ -25,216 +25,213 @@ #include <utility> #include <comphelper/diagnose_ex.hxx> -namespace accessibility -{ - using namespace com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::awt; - using namespace ::comphelper; - - EditBrowseBoxTableCell::EditBrowseBoxTableCell( - const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, - const css::uno::Reference< css::accessibility::XAccessible >& _rxOwningAccessible, - const css::uno::Reference< css::accessibility::XAccessibleContext >& _xControlChild, - ::vcl::IAccessibleTableProvider& _rBrowseBox, - const css::uno::Reference< css::awt::XWindow >& _xFocusWindow, - sal_Int32 _nRowPos, - sal_uInt16 _nColPos) - :AccessibleBrowseBoxCell( _rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos ) - ,OAccessibleContextWrapperHelper( ::comphelper::getProcessComponentContext(), rBHelper, _xControlChild, _rxOwningAccessible, _rxParent ) - { - aggregateProxy( m_refCount, *this ); - } +using namespace com::sun::star::accessibility; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::awt; +using namespace ::comphelper; + +EditBrowseBoxTableCell::EditBrowseBoxTableCell( + const css::uno::Reference< css::accessibility::XAccessible >& _rxParent, + const css::uno::Reference< css::accessibility::XAccessible >& _rxOwningAccessible, + const css::uno::Reference< css::accessibility::XAccessibleContext >& _xControlChild, + ::vcl::IAccessibleTableProvider& _rBrowseBox, + const css::uno::Reference< css::awt::XWindow >& _xFocusWindow, + sal_Int32 _nRowPos, + sal_uInt16 _nColPos) + :AccessibleBrowseBoxCell( _rxParent, _rBrowseBox, _xFocusWindow, _nRowPos, _nColPos ) + ,OAccessibleContextWrapperHelper( ::comphelper::getProcessComponentContext(), rBHelper, _xControlChild, _rxOwningAccessible, _rxParent ) +{ + aggregateProxy( m_refCount, *this ); +} - EditBrowseBoxTableCell::~EditBrowseBoxTableCell() +EditBrowseBoxTableCell::~EditBrowseBoxTableCell() +{ + if ( !rBHelper.bDisposed ) { - if ( !rBHelper.bDisposed ) - { - acquire(); // to prevent duplicate dtor calls - dispose(); - } + acquire(); // to prevent duplicate dtor calls + dispose(); } +} - OUString SAL_CALL EditBrowseBoxTableCell::getImplementationName() - { - return u"com.sun.star.comp.svtools.TableCellProxy"_ustr; - } +OUString SAL_CALL EditBrowseBoxTableCell::getImplementationName() +{ + return u"com.sun.star.comp.svtools.TableCellProxy"_ustr; +} - IMPLEMENT_FORWARD_XINTERFACE2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper ) +IMPLEMENT_FORWARD_XINTERFACE2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper ) - IMPLEMENT_FORWARD_XTYPEPROVIDER2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper ) +IMPLEMENT_FORWARD_XTYPEPROVIDER2( EditBrowseBoxTableCell, AccessibleBrowseBoxCell, OAccessibleContextWrapperHelper ) - void EditBrowseBoxTableCell::notifyTranslatedEvent( const AccessibleEventObject& _rEvent ) - { - commitEvent( _rEvent.EventId, _rEvent.NewValue, _rEvent.OldValue ); - } +void EditBrowseBoxTableCell::notifyTranslatedEvent( const AccessibleEventObject& _rEvent ) +{ + commitEvent( _rEvent.EventId, _rEvent.NewValue, _rEvent.OldValue ); +} - // css::accessibility::XAccessibleComponent - sal_Int32 SAL_CALL EditBrowseBoxTableCell::getForeground( ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +// css::accessibility::XAccessibleComponent +sal_Int32 SAL_CALL EditBrowseBoxTableCell::getForeground( ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - css::uno::Reference< css::accessibility::XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY ); - if ( xAccComp.is() ) - return xAccComp->getForeground(); - return 0; - } + css::uno::Reference< css::accessibility::XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY ); + if ( xAccComp.is() ) + return xAccComp->getForeground(); + return 0; +} - sal_Int32 SAL_CALL EditBrowseBoxTableCell::getBackground( ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +sal_Int32 SAL_CALL EditBrowseBoxTableCell::getBackground( ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - css::uno::Reference< css::accessibility::XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY ); - if ( xAccComp.is() ) - return xAccComp->getBackground(); - return 0; - } + css::uno::Reference< css::accessibility::XAccessibleComponent > xAccComp( m_xInnerContext, UNO_QUERY ); + if ( xAccComp.is() ) + return xAccComp->getBackground(); + return 0; +} - css::uno::Reference< css::accessibility::XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleParent( ) - { - return m_xParentAccessible; - } +css::uno::Reference< css::accessibility::XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleParent( ) +{ + return m_xParentAccessible; +} - OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleDescription() - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleDescription() +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return m_xInnerContext->getAccessibleDescription(); - } + return m_xInnerContext->getAccessibleDescription(); +} - OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleName() - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +OUString SAL_CALL EditBrowseBoxTableCell::getAccessibleName() +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return VclResId(RID_STR_ACC_COLUMN_NUM).replaceAll("%COLUMNNUMBER", OUString::number(getColumnPos()-1)) + ", " - + VclResId(RID_STR_ACC_ROW_NUM).replaceAll("%ROWNUMBER", OUString::number(getRowPos())); - } + return VclResId(RID_STR_ACC_COLUMN_NUM).replaceAll("%COLUMNNUMBER", OUString::number(getColumnPos()-1)) + ", " + + VclResId(RID_STR_ACC_ROW_NUM).replaceAll("%ROWNUMBER", OUString::number(getRowPos())); +} - css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleRelationSet() - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL EditBrowseBoxTableCell::getAccessibleRelationSet() +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return baseGetAccessibleRelationSet( ); - } + return baseGetAccessibleRelationSet( ); +} - sal_Int64 SAL_CALL EditBrowseBoxTableCell::getAccessibleStateSet() - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +sal_Int64 SAL_CALL EditBrowseBoxTableCell::getAccessibleStateSet() +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return m_xInnerContext->getAccessibleStateSet(); - // TODO: shouldn't we add an ACTIVE here? Isn't the EditBrowseBoxTableCell always ACTIVE? - } + return m_xInnerContext->getAccessibleStateSet(); + // TODO: shouldn't we add an ACTIVE here? Isn't the EditBrowseBoxTableCell always ACTIVE? +} - sal_Int64 SAL_CALL EditBrowseBoxTableCell::getAccessibleChildCount( ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +sal_Int64 SAL_CALL EditBrowseBoxTableCell::getAccessibleChildCount( ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return baseGetAccessibleChildCount(); - } + return baseGetAccessibleChildCount(); +} - css::uno::Reference< css::accessibility::XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleChild( sal_Int64 i ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +css::uno::Reference< css::accessibility::XAccessible > SAL_CALL EditBrowseBoxTableCell::getAccessibleChild( sal_Int64 i ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return baseGetAccessibleChild( i ); - } + return baseGetAccessibleChild( i ); +} - sal_Int16 SAL_CALL EditBrowseBoxTableCell::getAccessibleRole() - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +sal_Int16 SAL_CALL EditBrowseBoxTableCell::getAccessibleRole() +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - return m_xInnerContext->getAccessibleRole( ); - } + return m_xInnerContext->getAccessibleRole( ); +} - void SAL_CALL EditBrowseBoxTableCell::dispose() - { - // simply disambiguate. Note that the OComponentHelper base in AccessibleBrowseBoxCell - // will call our "disposing()", which will call "dispose()" on the OAccessibleContextWrapperHelper - // so there is no need to do this here. - AccessibleBrowseBoxCell::dispose(); - } +void SAL_CALL EditBrowseBoxTableCell::dispose() +{ + // simply disambiguate. Note that the OComponentHelper base in AccessibleBrowseBoxCell + // will call our "disposing()", which will call "dispose()" on the OAccessibleContextWrapperHelper + // so there is no need to do this here. + AccessibleBrowseBoxCell::dispose(); +} - void SAL_CALL EditBrowseBoxTableCell::disposing( const css::lang::EventObject& _rSource ) - { - AccessibleBrowseBoxCell::disposing( _rSource ); - OAccessibleContextWrapperHelper::disposing( _rSource ); - } +void SAL_CALL EditBrowseBoxTableCell::disposing( const css::lang::EventObject& _rSource ) +{ + AccessibleBrowseBoxCell::disposing( _rSource ); + OAccessibleContextWrapperHelper::disposing( _rSource ); +} - void SAL_CALL EditBrowseBoxTableCell::disposing() - { - SolarMethodGuard aGuard(getMutex()); +void SAL_CALL EditBrowseBoxTableCell::disposing() +{ + SolarMethodGuard aGuard(getMutex()); + + OAccessibleContextWrapperHelper::dispose(); + // TODO: do we need to dispose our inner object? The base class does this, but is it a good idea? + AccessibleBrowseBoxCell::disposing(); +} + +// EditBrowseBoxTableCell +EditBrowseBoxTableCellAccess::EditBrowseBoxTableCellAccess( + css::uno::Reference< css::accessibility::XAccessible > _xParent, css::uno::Reference< css::accessibility::XAccessible > _xControlAccessible, + css::uno::Reference< css::awt::XWindow > _xFocusWindow, + ::vcl::IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowPos, sal_uInt16 _nColPos ) + :m_xParent(std::move( _xParent )) + ,m_xControlAccessible(std::move( _xControlAccessible )) + ,m_xFocusWindow(std::move( _xFocusWindow )) + ,m_pBrowseBox( &_rBrowseBox ) + ,m_nRowPos( _nRowPos ) + ,m_nColPos( _nColPos ) +{ +} - OAccessibleContextWrapperHelper::dispose(); - // TODO: do we need to dispose our inner object? The base class does this, but is it a good idea? - AccessibleBrowseBoxCell::disposing(); - } +EditBrowseBoxTableCellAccess::~EditBrowseBoxTableCellAccess( ) +{ +} - // EditBrowseBoxTableCell - EditBrowseBoxTableCellAccess::EditBrowseBoxTableCellAccess( - css::uno::Reference< css::accessibility::XAccessible > _xParent, css::uno::Reference< css::accessibility::XAccessible > _xControlAccessible, - css::uno::Reference< css::awt::XWindow > _xFocusWindow, - ::vcl::IAccessibleTableProvider& _rBrowseBox, sal_Int32 _nRowPos, sal_uInt16 _nColPos ) - :m_xParent(std::move( _xParent )) - ,m_xControlAccessible(std::move( _xControlAccessible )) - ,m_xFocusWindow(std::move( _xFocusWindow )) - ,m_pBrowseBox( &_rBrowseBox ) - ,m_nRowPos( _nRowPos ) - ,m_nColPos( _nColPos ) +css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL EditBrowseBoxTableCellAccess::getAccessibleContext( ) +{ + if ( !m_pBrowseBox || !m_xControlAccessible.is() ) + throw DisposedException(); + css::uno::Reference< css::accessibility::XAccessibleContext > xMyContext( m_aContext ); + if ( !xMyContext.is() ) { - } + css::uno::Reference< css::accessibility::XAccessibleContext > xInnerContext = m_xControlAccessible->getAccessibleContext(); + css::uno::Reference< css::accessibility::XAccessible > xMe( this ); - EditBrowseBoxTableCellAccess::~EditBrowseBoxTableCellAccess( ) - { + xMyContext = new EditBrowseBoxTableCell( xMe, m_xParent, xInnerContext, *m_pBrowseBox, m_xFocusWindow, m_nRowPos, m_nColPos ); + m_aContext = xMyContext; } + return xMyContext; +} - css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL EditBrowseBoxTableCellAccess::getAccessibleContext( ) +void EditBrowseBoxTableCellAccess::disposing(std::unique_lock<std::mutex>&) +{ + // dispose our context, if it still alive + css::uno::Reference< XComponent > xMyContext( m_aContext.get(), UNO_QUERY ); + if ( xMyContext.is() ) { - if ( !m_pBrowseBox || !m_xControlAccessible.is() ) - throw DisposedException(); - css::uno::Reference< css::accessibility::XAccessibleContext > xMyContext( m_aContext ); - if ( !xMyContext.is() ) + try { - css::uno::Reference< css::accessibility::XAccessibleContext > xInnerContext = m_xControlAccessible->getAccessibleContext(); - css::uno::Reference< css::accessibility::XAccessible > xMe( this ); - - xMyContext = new EditBrowseBoxTableCell( xMe, m_xParent, xInnerContext, *m_pBrowseBox, m_xFocusWindow, m_nRowPos, m_nColPos ); - m_aContext = xMyContext; + xMyContext->dispose(); } - return xMyContext; - } - - void EditBrowseBoxTableCellAccess::disposing(std::unique_lock<std::mutex>&) - { - // dispose our context, if it still alive - css::uno::Reference< XComponent > xMyContext( m_aContext.get(), UNO_QUERY ); - if ( xMyContext.is() ) + catch( const Exception& ) { - try - { - xMyContext->dispose(); - } - catch( const Exception& ) - { - TOOLS_WARN_EXCEPTION( "accessibility", "EditBrowseBoxTableCellAccess::disposing: caught an exception while disposing the context!" ); - } + TOOLS_WARN_EXCEPTION( "accessibility", "EditBrowseBoxTableCellAccess::disposing: caught an exception while disposing the context!" ); } - - m_pBrowseBox = nullptr; - m_xControlAccessible.clear(); - m_aContext.clear(); - // NO dispose of the inner object there: it is the css::accessibility::XAccessible of a window, and disposing - // it would delete the respective VCL window } -} // namespace accessibility + + m_pBrowseBox = nullptr; + m_xControlAccessible.clear(); + m_aContext.clear(); + // NO dispose of the inner object there: it is the css::accessibility::XAccessible of a window, and disposing + // it would delete the respective VCL window +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/accessibleiconchoicectrl.cxx b/vcl/source/accessibility/accessibleiconchoicectrl.cxx index dbd7f89d1397..7289b48868ba 100644 --- a/vcl/source/accessibility/accessibleiconchoicectrl.cxx +++ b/vcl/source/accessibility/accessibleiconchoicectrl.cxx @@ -26,281 +26,273 @@ #include <comphelper/accessiblecontexthelper.hxx> #include <vcl/toolkit/ivctrl.hxx> +// class AccessibleIconChoiceCtrl ---------------------------------------------- -namespace accessibility -{ - - - // class AccessibleIconChoiceCtrl ---------------------------------------------- +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star; - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; +// Ctor() and Dtor() - // Ctor() and Dtor() +AccessibleIconChoiceCtrl::AccessibleIconChoiceCtrl(SvtIconChoiceCtrl& _rIconCtrl, + const Reference<XAccessible>& _xParent) + : ImplInheritanceHelper(&_rIconCtrl) + , m_xParent(_xParent) +{ +} - AccessibleIconChoiceCtrl::AccessibleIconChoiceCtrl(SvtIconChoiceCtrl& _rIconCtrl, - const Reference<XAccessible>& _xParent) - : ImplInheritanceHelper(&_rIconCtrl) - , m_xParent(_xParent) - { - } +void AccessibleIconChoiceCtrl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) +{ + if ( !isAlive() ) + return; - void AccessibleIconChoiceCtrl::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) + switch ( rVclWindowEvent.GetId() ) { - if ( !isAlive() ) - return; - - switch ( rVclWindowEvent.GetId() ) + case VclEventId::ListboxSelect : { - case VclEventId::ListboxSelect : - { - // First send an event that tells the listeners of a - // modified selection. The active descendant event is - // send after that so that the receiving AT has time to - // read the text or name of the active child. + // First send an event that tells the listeners of a + // modified selection. The active descendant event is + // send after that so that the receiving AT has time to + // read the text or name of the active child. // NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - if ( getCtrl() && getCtrl()->HasFocus() ) + if ( getCtrl() && getCtrl()->HasFocus() ) + { + SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() ); + if ( pEntry ) { - SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) - { - sal_Int32 nPos = getCtrl()->GetEntryListPos( pEntry ); - Reference< XAccessible > xChild = new AccessibleIconChoiceCtrlEntry( *getCtrl(), nPos, this ); - uno::Any aOldValue, aNewValue; - aNewValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue ); - - NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOldValue, aNewValue ); - - } + sal_Int32 nPos = getCtrl()->GetEntryListPos( pEntry ); + Reference< XAccessible > xChild = new AccessibleIconChoiceCtrlEntry( *getCtrl(), nPos, this ); + uno::Any aOldValue, aNewValue; + aNewValue <<= xChild; + NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue ); + + NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOldValue, aNewValue ); + } - break; } - case VclEventId::WindowGetFocus : + break; + } + case VclEventId::WindowGetFocus : + { + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); + if ( pCtrl && pCtrl->HasFocus() ) { - VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); - if ( pCtrl && pCtrl->HasFocus() ) + SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() ); + if ( pEntry == nullptr ) + { + pEntry = getCtrl()->GetSelectedEntry(); + } + if ( pEntry ) { - SvxIconChoiceCtrlEntry* pEntry = static_cast< SvxIconChoiceCtrlEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry == nullptr ) - { - pEntry = getCtrl()->GetSelectedEntry(); - } - if ( pEntry ) - { - sal_Int32 nPos = pCtrl->GetEntryListPos( pEntry ); - Reference< XAccessible > xChild = new AccessibleIconChoiceCtrlEntry( *pCtrl, nPos, this ); - uno::Any aOldValue, aNewValue; - aNewValue <<= xChild; - NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue ); - NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOldValue, aNewValue ); - } + sal_Int32 nPos = pCtrl->GetEntryListPos( pEntry ); + Reference< XAccessible > xChild = new AccessibleIconChoiceCtrlEntry( *pCtrl, nPos, this ); + uno::Any aOldValue, aNewValue; + aNewValue <<= xChild; + NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue ); + NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOldValue, aNewValue ); } - break; } - default: - VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent); + break; } + default: + VCLXAccessibleComponent::ProcessWindowChildEvent (rVclWindowEvent); } +} - // XComponent +// XComponent - void SAL_CALL AccessibleIconChoiceCtrl::disposing() - { - ::osl::MutexGuard aGuard( m_aMutex ); +void SAL_CALL AccessibleIconChoiceCtrl::disposing() +{ + ::osl::MutexGuard aGuard( m_aMutex ); - m_xParent = nullptr; - } + m_xParent = nullptr; +} - // XServiceInfo +// XServiceInfo - OUString SAL_CALL AccessibleIconChoiceCtrl::getImplementationName() - { - return u"com.sun.star.comp.svtools.AccessibleIconChoiceControl"_ustr; - } +OUString SAL_CALL AccessibleIconChoiceCtrl::getImplementationName() +{ + return u"com.sun.star.comp.svtools.AccessibleIconChoiceControl"_ustr; +} - Sequence< OUString > SAL_CALL AccessibleIconChoiceCtrl::getSupportedServiceNames() - { - return {u"com.sun.star.accessibility.AccessibleContext"_ustr, - u"com.sun.star.accessibility.AccessibleComponent"_ustr, - u"com.sun.star.awt.AccessibleIconChoiceControl"_ustr}; - } +Sequence< OUString > SAL_CALL AccessibleIconChoiceCtrl::getSupportedServiceNames() +{ + return {u"com.sun.star.accessibility.AccessibleContext"_ustr, + u"com.sun.star.accessibility.AccessibleComponent"_ustr, + u"com.sun.star.awt.AccessibleIconChoiceControl"_ustr}; +} - // XAccessible +// XAccessible - Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleContext( ) - { - ensureAlive(); - return this; - } +Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleContext( ) +{ + ensureAlive(); + return this; +} - // XAccessibleContext +// XAccessibleContext - sal_Int64 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleChildCount( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +sal_Int64 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleChildCount( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - return getCtrl()->GetEntryCount(); - } + return getCtrl()->GetEntryCount(); +} - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleChild( sal_Int64 i ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleChild( sal_Int64 i ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - if (i < 0 || i >= getAccessibleChildCount()) - throw IndexOutOfBoundsException(); + if (i < 0 || i >= getAccessibleChildCount()) + throw IndexOutOfBoundsException(); - VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); - return new AccessibleIconChoiceCtrlEntry( *pCtrl, i, this ); - } + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); + return new AccessibleIconChoiceCtrlEntry( *pCtrl, i, this ); +} - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleParent( ) - { - ::osl::MutexGuard aGuard( m_aMutex ); +Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getAccessibleParent( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); - ensureAlive(); - return m_xParent; - } + ensureAlive(); + return m_xParent; +} - sal_Int16 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleRole( ) - { - //return AccessibleRole::TREE; - return AccessibleRole::LIST; - } +sal_Int16 SAL_CALL AccessibleIconChoiceCtrl::getAccessibleRole( ) +{ + //return AccessibleRole::TREE; + return AccessibleRole::LIST; +} - OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleDescription( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleDescription( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - return getCtrl()->GetAccessibleDescription(); - } + return getCtrl()->GetAccessibleDescription(); +} - OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleName( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +OUString SAL_CALL AccessibleIconChoiceCtrl::getAccessibleName( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - return getCtrl()->GetAccessibleName(); - } + return getCtrl()->GetAccessibleName(); +} - // XAccessibleSelection +// XAccessibleSelection - void SAL_CALL AccessibleIconChoiceCtrl::selectAccessibleChild( sal_Int64 nChildIndex ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +void SAL_CALL AccessibleIconChoiceCtrl::selectAccessibleChild( sal_Int64 nChildIndex ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) - throw IndexOutOfBoundsException(); + if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) + throw IndexOutOfBoundsException(); - VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); - SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); + SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex ); + if ( !pEntry ) + throw IndexOutOfBoundsException(); - pCtrl->SetCursor( pEntry ); - } + pCtrl->SetCursor( pEntry ); +} - sal_Bool SAL_CALL AccessibleIconChoiceCtrl::isAccessibleChildSelected( sal_Int64 nChildIndex ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +sal_Bool SAL_CALL AccessibleIconChoiceCtrl::isAccessibleChildSelected( sal_Int64 nChildIndex ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) - throw IndexOutOfBoundsException(); + if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) + throw IndexOutOfBoundsException(); - VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); - SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); + SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( nChildIndex ); + if ( !pEntry ) + throw IndexOutOfBoundsException(); - return ( pCtrl->GetCursor() == pEntry ); - } + return ( pCtrl->GetCursor() == pEntry ); +} - void SAL_CALL AccessibleIconChoiceCtrl::clearAccessibleSelection( ) - { - // one entry should always be selected, so don't unselect - } +void SAL_CALL AccessibleIconChoiceCtrl::clearAccessibleSelection( ) +{ + // one entry should always be selected, so don't unselect +} - void SAL_CALL AccessibleIconChoiceCtrl::selectAllAccessibleChildren( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +void SAL_CALL AccessibleIconChoiceCtrl::selectAllAccessibleChildren( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - // don't do anything if there are no or multiple entries, as only - // a single one can be selected - VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); - sal_Int32 nCount = pCtrl->GetEntryCount(); - if (nCount != 1) - return; + // don't do anything if there are no or multiple entries, as only + // a single one can be selected + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); + sal_Int32 nCount = pCtrl->GetEntryCount(); + if (nCount != 1) + return; - pCtrl->SetCursor(pCtrl->GetEntry(0)); - } + pCtrl->SetCursor(pCtrl->GetEntry(0)); +} - sal_Int64 SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibleChildCount( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +sal_Int64 SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibleChildCount( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); - if (pCtrl->GetCursor()) - return 1; + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); + if (pCtrl->GetCursor()) + return 1; - return 0; - } + return 0; +} - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrl::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); + if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) + throw IndexOutOfBoundsException(); - Reference< XAccessible > xChild; - sal_Int32 nSelCount = 0; - VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); - sal_Int32 nCount = pCtrl->GetEntryCount(); - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i ); - if ( pCtrl->GetCursor() == pEntry ) - ++nSelCount; + Reference< XAccessible > xChild; + sal_Int32 nSelCount = 0; + VclPtr<SvtIconChoiceCtrl> pCtrl = getCtrl(); + sal_Int32 nCount = pCtrl->GetEntryCount(); + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + SvxIconChoiceCtrlEntry* pEntry = pCtrl->GetEntry( i ); + if ( pCtrl->GetCursor() == pEntry ) + ++nSelCount; - if ( nSelCount == ( nSelectedChildIndex + 1 ) ) - { - xChild = new AccessibleIconChoiceCtrlEntry( *pCtrl, i, this ); - break; - } + if ( nSelCount == ( nSelectedChildIndex + 1 ) ) + { + xChild = new AccessibleIconChoiceCtrlEntry( *pCtrl, i, this ); + break; } - - return xChild; } - void SAL_CALL AccessibleIconChoiceCtrl::deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) - { - ::comphelper::OExternalLockGuard aGuard( this ); + return xChild; +} - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getAccessibleChildCount() ) - throw IndexOutOfBoundsException(); +void SAL_CALL AccessibleIconChoiceCtrl::deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - // one entry should always be selected, so don't unselect - } + if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getAccessibleChildCount() ) + throw IndexOutOfBoundsException(); - void AccessibleIconChoiceCtrl::FillAccessibleStateSet( sal_Int64& rStateSet ) - { - VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); - if ( isAlive() ) - { - rStateSet |= AccessibleStateType::FOCUSABLE; - rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS; - } - } + // one entry should always be selected, so don't unselect +} - VclPtr< SvtIconChoiceCtrl > AccessibleIconChoiceCtrl::getCtrl() const +void AccessibleIconChoiceCtrl::FillAccessibleStateSet( sal_Int64& rStateSet ) +{ + VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); + if ( isAlive() ) { - return GetAs<SvtIconChoiceCtrl >(); + rStateSet |= AccessibleStateType::FOCUSABLE; + rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS; } +} -}// namespace accessibility - +VclPtr< SvtIconChoiceCtrl > AccessibleIconChoiceCtrl::getCtrl() const +{ + return GetAs<SvtIconChoiceCtrl >(); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/accessibleiconchoicectrlentry.cxx b/vcl/source/accessibility/accessibleiconchoicectrlentry.cxx index bc5a1e079657..5d45a6be45d9 100644 --- a/vcl/source/accessibility/accessibleiconchoicectrlentry.cxx +++ b/vcl/source/accessibility/accessibleiconchoicectrlentry.cxx @@ -45,568 +45,560 @@ namespace } } +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star; -namespace accessibility -{ - - - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; +// Ctor() and Dtor() - // Ctor() and Dtor() - - AccessibleIconChoiceCtrlEntry::AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl, - sal_Int32 _nPos, - const Reference< XAccessible >& _xParent ) : - m_pIconCtrl ( &_rIconCtrl ), - m_nIndex ( _nPos ), - m_xParent ( _xParent ) +AccessibleIconChoiceCtrlEntry::AccessibleIconChoiceCtrlEntry( SvtIconChoiceCtrl& _rIconCtrl, + sal_Int32 _nPos, + const Reference< XAccessible >& _xParent ) : + m_pIconCtrl ( &_rIconCtrl ), + m_nIndex ( _nPos ), + m_xParent ( _xParent ) +{ + osl_atomic_increment( &m_refCount ); { - osl_atomic_increment( &m_refCount ); - { - Reference< XComponent > xComp( m_xParent, UNO_QUERY ); - if ( xComp.is() ) - xComp->addEventListener( this ); - } - osl_atomic_decrement( &m_refCount ); + Reference< XComponent > xComp( m_xParent, UNO_QUERY ); + if ( xComp.is() ) + xComp->addEventListener( this ); } + osl_atomic_decrement( &m_refCount ); +} - void AccessibleIconChoiceCtrlEntry::disposing( const css::lang::EventObject& _rSource ) +void AccessibleIconChoiceCtrlEntry::disposing( const css::lang::EventObject& _rSource ) +{ + if ( _rSource.Source == m_xParent ) { - if ( _rSource.Source == m_xParent ) - { - dispose(); - OSL_ENSURE( !m_xParent.is() && ( m_pIconCtrl == nullptr ), "" ); - } + dispose(); + OSL_ENSURE( !m_xParent.is() && ( m_pIconCtrl == nullptr ), "" ); } +} - AccessibleIconChoiceCtrlEntry::~AccessibleIconChoiceCtrlEntry() +AccessibleIconChoiceCtrlEntry::~AccessibleIconChoiceCtrlEntry() +{ + if ( IsAlive_Impl() ) { - if ( IsAlive_Impl() ) - { - // increment ref count to prevent double call of Dtor - osl_atomic_increment( &m_refCount ); - dispose(); - } + // increment ref count to prevent double call of Dtor + osl_atomic_increment( &m_refCount ); + dispose(); } +} - tools::Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBox_Impl() const - { - tools::Rectangle aRect; - SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); - if ( pEntry ) - aRect = m_pIconCtrl->GetBoundingBox( pEntry ); +tools::Rectangle AccessibleIconChoiceCtrlEntry::GetBoundingBox_Impl() const +{ + tools::Rectangle aRect; + SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); + if ( pEntry ) + aRect = m_pIconCtrl->GetBoundingBox( pEntry ); - return aRect; - } + return aRect; +} - AbsoluteScreenPixelRectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const - { - SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); - if ( !pEntry ) - return AbsoluteScreenPixelRectangle(); - tools::Rectangle aRect = m_pIconCtrl->GetBoundingBox( pEntry ); - AbsoluteScreenPixelPoint aTopLeft = m_pIconCtrl->GetWindowExtentsAbsolute().TopLeft(); - aTopLeft += AbsoluteScreenPixelPoint(aRect.TopLeft()); - return AbsoluteScreenPixelRectangle( aTopLeft, aRect.GetSize() ); - } +AbsoluteScreenPixelRectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen_Impl() const +{ + SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); + if ( !pEntry ) + return AbsoluteScreenPixelRectangle(); + tools::Rectangle aRect = m_pIconCtrl->GetBoundingBox( pEntry ); + AbsoluteScreenPixelPoint aTopLeft = m_pIconCtrl->GetWindowExtentsAbsolute().TopLeft(); + aTopLeft += AbsoluteScreenPixelPoint(aRect.TopLeft()); + return AbsoluteScreenPixelRectangle( aTopLeft, aRect.GetSize() ); +} - bool AccessibleIconChoiceCtrlEntry::IsAlive_Impl() const - { - return ( !rBHelper.bDisposed && !rBHelper.bInDispose && m_pIconCtrl ); - } +bool AccessibleIconChoiceCtrlEntry::IsAlive_Impl() const +{ + return ( !rBHelper.bDisposed && !rBHelper.bInDispose && m_pIconCtrl ); +} - bool AccessibleIconChoiceCtrlEntry::IsShowing_Impl() const +bool AccessibleIconChoiceCtrlEntry::IsShowing_Impl() const +{ + bool bShowing = false; + Reference< XAccessibleContext > xParentContext = + m_xParent.is() ? m_xParent->getAccessibleContext() : Reference< XAccessibleContext >(); + if( xParentContext.is() ) { - bool bShowing = false; - Reference< XAccessibleContext > xParentContext = - m_xParent.is() ? m_xParent->getAccessibleContext() : Reference< XAccessibleContext >(); - if( xParentContext.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParentContext, uno::UNO_QUERY ); - if( xParentComp.is() ) - bShowing = GetBoundingBox_Impl().Overlaps( - vcl::unohelper::ConvertToVCLRect(xParentComp->getBounds())); - } - - return bShowing; + Reference< XAccessibleComponent > xParentComp( xParentContext, uno::UNO_QUERY ); + if( xParentComp.is() ) + bShowing = GetBoundingBox_Impl().Overlaps( + vcl::unohelper::ConvertToVCLRect(xParentComp->getBounds())); } - AbsoluteScreenPixelRectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return bShowing; +} - EnsureIsAlive(); - return GetBoundingBoxOnScreen_Impl(); - } +AbsoluteScreenPixelRectangle AccessibleIconChoiceCtrlEntry::GetBoundingBoxOnScreen() +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - void AccessibleIconChoiceCtrlEntry::EnsureIsAlive() const - { - if ( !IsAlive_Impl() ) - throw lang::DisposedException(); - } + EnsureIsAlive(); + return GetBoundingBoxOnScreen_Impl(); +} - css::awt::Rectangle AccessibleIconChoiceCtrlEntry::implGetBounds() - { - return vcl::unohelper::ConvertToAWTRect(GetBoundingBox_Impl()); - } +void AccessibleIconChoiceCtrlEntry::EnsureIsAlive() const +{ + if ( !IsAlive_Impl() ) + throw lang::DisposedException(); +} - OUString AccessibleIconChoiceCtrlEntry::implGetText() - { - SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); - if (pEntry) - return pEntry->GetDisplayText(); - return OUString(); - } +css::awt::Rectangle AccessibleIconChoiceCtrlEntry::implGetBounds() +{ + return vcl::unohelper::ConvertToAWTRect(GetBoundingBox_Impl()); +} - Locale AccessibleIconChoiceCtrlEntry::implGetLocale() - { - return Application::GetSettings().GetUILanguageTag().getLocale(); - } - void AccessibleIconChoiceCtrlEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) - { - nStartIndex = 0; - nEndIndex = 0; - } +OUString AccessibleIconChoiceCtrlEntry::implGetText() +{ + SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); + if (pEntry) + return pEntry->GetDisplayText(); + return OUString(); +} - // XTypeProvider +Locale AccessibleIconChoiceCtrlEntry::implGetLocale() +{ + return Application::GetSettings().GetUILanguageTag().getLocale(); +} +void AccessibleIconChoiceCtrlEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) +{ + nStartIndex = 0; + nEndIndex = 0; +} +// XTypeProvider - Sequence< sal_Int8 > AccessibleIconChoiceCtrlEntry::getImplementationId() - { - return css::uno::Sequence<sal_Int8>(); - } - // XComponent +Sequence< sal_Int8 > AccessibleIconChoiceCtrlEntry::getImplementationId() +{ + return css::uno::Sequence<sal_Int8>(); +} + +// XComponent - void SAL_CALL AccessibleIconChoiceCtrlEntry::disposing() - { - ::osl::MutexGuard aGuard( m_aMutex ); +void SAL_CALL AccessibleIconChoiceCtrlEntry::disposing() +{ + ::osl::MutexGuard aGuard( m_aMutex ); - comphelper::OAccessibleComponentHelper::disposing(); + comphelper::OAccessibleComponentHelper::disposing(); - Reference< XComponent > xComp( m_xParent, UNO_QUERY ); - if ( xComp.is() ) - xComp->removeEventListener( this ); + Reference< XComponent > xComp( m_xParent, UNO_QUERY ); + if ( xComp.is() ) + xComp->removeEventListener( this ); - m_pIconCtrl = nullptr; - m_xParent = nullptr; - } + m_pIconCtrl = nullptr; + m_xParent = nullptr; +} - // XServiceInfo +// XServiceInfo - OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getImplementationName() - { - return u"com.sun.star.comp.svtools.AccessibleIconChoiceControlEntry"_ustr; - } +OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getImplementationName() +{ + return u"com.sun.star.comp.svtools.AccessibleIconChoiceControlEntry"_ustr; +} - Sequence< OUString > SAL_CALL AccessibleIconChoiceCtrlEntry::getSupportedServiceNames() - { - return {u"com.sun.star.accessibility.AccessibleContext"_ustr, - u"com.sun.star.accessibility.AccessibleComponent"_ustr, - u"com.sun.star.awt.AccessibleIconChoiceControlEntry"_ustr}; - } +Sequence< OUString > SAL_CALL AccessibleIconChoiceCtrlEntry::getSupportedServiceNames() +{ + return {u"com.sun.star.accessibility.AccessibleContext"_ustr, + u"com.sun.star.accessibility.AccessibleComponent"_ustr, + u"com.sun.star.awt.AccessibleIconChoiceControlEntry"_ustr}; +} - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::supportsService( const OUString& _rServiceName ) - { - return cppu::supportsService(this, _rServiceName); - } +sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::supportsService( const OUString& _rServiceName ) +{ + return cppu::supportsService(this, _rServiceName); +} - // XAccessible +// XAccessible - Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleContext( ) - { - EnsureIsAlive(); - return this; - } +Reference< XAccessibleContext > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleContext( ) +{ + EnsureIsAlive(); + return this; +} - // XAccessibleContext +// XAccessibleContext - sal_Int64 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChildCount( ) - { - return 0; // no children - } +sal_Int64 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChildCount( ) +{ + return 0; // no children +} - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChild( sal_Int64 ) - { - throw IndexOutOfBoundsException(); - } +Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleChild( sal_Int64 ) +{ + throw IndexOutOfBoundsException(); +} - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleParent( ) - { - ::osl::MutexGuard aGuard( m_aMutex ); +Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleParent( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return m_xParent; - } + EnsureIsAlive(); + return m_xParent; +} - sal_Int64 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleIndexInParent( ) - { - return m_nIndex; - } +sal_Int64 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleIndexInParent( ) +{ + return m_nIndex; +} - sal_Int16 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRole( ) - { - //return AccessibleRole::LABEL; - return AccessibleRole::LIST_ITEM; - } +sal_Int16 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRole( ) +{ + //return AccessibleRole::LABEL; + return AccessibleRole::LIST_ITEM; +} - OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleDescription( ) - { - // no description for every item - return OUString(); - } +OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleDescription( ) +{ + // no description for every item + return OUString(); +} - OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleName( ) - { - ::osl::MutexGuard aGuard( m_aMutex ); +OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleName( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return implGetText(); - } + EnsureIsAlive(); + return implGetText(); +} - Reference< XAccessibleRelationSet > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRelationSet( ) - { - return new utl::AccessibleRelationSetHelper; - } +Reference< XAccessibleRelationSet > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleRelationSet( ) +{ + return new utl::AccessibleRelationSetHelper; +} - sal_Int64 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleStateSet( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); +sal_Int64 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleStateSet( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - sal_Int64 nStateSet = 0; + sal_Int64 nStateSet = 0; - if ( IsAlive_Impl() ) + if ( IsAlive_Impl() ) + { + nStateSet |= AccessibleStateType::FOCUSABLE; + nStateSet |= AccessibleStateType::TRANSIENT; + nStateSet |= AccessibleStateType::SELECTABLE; + nStateSet |= AccessibleStateType::ENABLED; + nStateSet |= AccessibleStateType::SENSITIVE; + if ( IsShowing_Impl() ) { - nStateSet |= AccessibleStateType::FOCUSABLE; - nStateSet |= AccessibleStateType::TRANSIENT; - nStateSet |= AccessibleStateType::SELECTABLE; - nStateSet |= AccessibleStateType::ENABLED; - nStateSet |= AccessibleStateType::SENSITIVE; - if ( IsShowing_Impl() ) - { - nStateSet |= AccessibleStateType::SHOWING; - nStateSet |= AccessibleStateType::VISIBLE; - } - - if ( m_pIconCtrl && m_pIconCtrl->GetCursor() == m_pIconCtrl->GetEntry( m_nIndex ) ) - { - nStateSet |= AccessibleStateType::SELECTED; - if (m_pIconCtrl->HasChildPathFocus()) - nStateSet |= AccessibleStateType::FOCUSED; - } + nStateSet |= AccessibleStateType::SHOWING; + nStateSet |= AccessibleStateType::VISIBLE; } - else - nStateSet |= AccessibleStateType::DEFUNC; - return nStateSet; + if ( m_pIconCtrl && m_pIconCtrl->GetCursor() == m_pIconCtrl->GetEntry( m_nIndex ) ) + { + nStateSet |= AccessibleStateType::SELECTED; + if (m_pIconCtrl->HasChildPathFocus()) + nStateSet |= AccessibleStateType::FOCUSED; + } } + else + nStateSet |= AccessibleStateType::DEFUNC; - Locale SAL_CALL AccessibleIconChoiceCtrlEntry::getLocale( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return nStateSet; +} - return implGetLocale(); - } +Locale SAL_CALL AccessibleIconChoiceCtrlEntry::getLocale( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - // XAccessibleComponent + return implGetLocale(); +} - Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleAtPoint( const awt::Point& ) - { - return Reference< XAccessible >(); - } +// XAccessibleComponent - awt::Point SAL_CALL AccessibleIconChoiceCtrlEntry::getLocationOnScreen( ) - { - return vcl::unohelper::ConvertToAWTPoint( GetBoundingBoxOnScreen().TopLeft() ); - } +Reference< XAccessible > SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleAtPoint( const awt::Point& ) +{ + return Reference< XAccessible >(); +} - void SAL_CALL AccessibleIconChoiceCtrlEntry::grabFocus( ) - { - // do nothing, because no focus for each item - } +awt::Point SAL_CALL AccessibleIconChoiceCtrlEntry::getLocationOnScreen( ) +{ + return vcl::unohelper::ConvertToAWTPoint( GetBoundingBoxOnScreen().TopLeft() ); +} - sal_Int32 AccessibleIconChoiceCtrlEntry::getForeground( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); +void SAL_CALL AccessibleIconChoiceCtrlEntry::grabFocus( ) +{ + // do nothing, because no focus for each item +} - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getForeground(); - } +sal_Int32 AccessibleIconChoiceCtrlEntry::getForeground( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - return nColor; + sal_Int32 nColor = 0; + Reference< XAccessible > xParent = getAccessibleParent(); + if ( xParent.is() ) + { + Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); + if ( xParentComp.is() ) + nColor = xParentComp->getForeground(); } - sal_Int32 AccessibleIconChoiceCtrlEntry::getBackground( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return nColor; +} - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getBackground(); - } +sal_Int32 AccessibleIconChoiceCtrlEntry::getBackground( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - return nColor; + sal_Int32 nColor = 0; + Reference< XAccessible > xParent = getAccessibleParent(); + if ( xParent.is() ) + { + Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); + if ( xParentComp.is() ) + nColor = xParentComp->getBackground(); } - // XAccessibleText + return nColor; +} +// XAccessibleText - awt::Rectangle SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterBounds( sal_Int32 _nIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - if ( ( 0 > _nIndex ) || ( implGetText().getLength() <= _nIndex ) ) - throw IndexOutOfBoundsException(); +awt::Rectangle SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterBounds( sal_Int32 _nIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - awt::Rectangle aBounds( 0, 0, 0, 0 ); - if ( m_pIconCtrl ) - { - tools::Rectangle aItemRect = GetBoundingBox_Impl(); - tools::Rectangle aCharRect = m_pIconCtrl->GetEntryCharacterBounds( m_nIndex, _nIndex ); - aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); - } + if ( ( 0 > _nIndex ) || ( implGetText().getLength() <= _nIndex ) ) + throw IndexOutOfBoundsException(); - return aBounds; + awt::Rectangle aBounds( 0, 0, 0, 0 ); + if ( m_pIconCtrl ) + { + tools::Rectangle aItemRect = GetBoundingBox_Impl(); + tools::Rectangle aCharRect = m_pIconCtrl->GetEntryCharacterBounds( m_nIndex, _nIndex ); + aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); + aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); } - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getIndexAtPoint( const awt::Point& aPoint ) + return aBounds; +} + +sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getIndexAtPoint( const awt::Point& aPoint ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + + sal_Int32 nIndex = -1; + if ( m_pIconCtrl ) { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + vcl::ControlLayoutData aLayoutData; + tools::Rectangle aItemRect = GetBoundingBox_Impl(); + m_pIconCtrl->RecordLayoutData( &aLayoutData, aItemRect ); + Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); + aPnt += aItemRect.TopLeft(); + nIndex = aLayoutData.GetIndexForPoint( aPnt ); - sal_Int32 nIndex = -1; - if ( m_pIconCtrl ) + tools::Long nLen = aLayoutData.m_aUnicodeBoundRects.size(); + for ( tools::Long i = 0; i < nLen; ++i ) { - vcl::ControlLayoutData aLayoutData; - tools::Rectangle aItemRect = GetBoundingBox_Impl(); - m_pIconCtrl->RecordLayoutData( &aLayoutData, aItemRect ); - Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); - aPnt += aItemRect.TopLeft(); - nIndex = aLayoutData.GetIndexForPoint( aPnt ); - - tools::Long nLen = aLayoutData.m_aUnicodeBoundRects.size(); - for ( tools::Long i = 0; i < nLen; ++i ) - { - tools::Rectangle aRect = aLayoutData.GetCharacterBounds(i); - bool bInside = aRect.Contains( aPnt ); - - if ( bInside ) - break; - } - } + tools::Rectangle aRect = aLayoutData.GetCharacterBounds(i); + bool bInside = aRect.Contains( aPnt ); - return nIndex; + if ( bInside ) + break; + } } - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - - OUString sText = implGetText(); - if ( ( 0 > nStartIndex ) || ( sText.getLength() <= nStartIndex ) - || ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) ) - throw IndexOutOfBoundsException(); - - if (!m_pIconCtrl) - return false; + return nIndex; +} - sal_Int32 nLen = nEndIndex - nStartIndex + 1; - css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipBoard = m_pIconCtrl->GetClipboard(); - vcl::unohelper::TextDataObject::CopyStringTo(sText.copy(nStartIndex, nLen), xClipBoard); +sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - return true; - } + OUString sText = implGetText(); + if ( ( 0 > nStartIndex ) || ( sText.getLength() <= nStartIndex ) + || ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) ) + throw IndexOutOfBoundsException(); - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType ) - { + if (!m_pIconCtrl) return false; - } - // XAccessibleEventBroadcaster + sal_Int32 nLen = nEndIndex - nStartIndex + 1; + css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipBoard = m_pIconCtrl->GetClipboard(); + vcl::unohelper::TextDataObject::CopyStringTo(sText.copy(nStartIndex, nLen), xClipBoard); - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCaretPosition( ) - { - return -1; - } - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setCaretPosition ( sal_Int32 nIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); + return true; +} - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); +sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType ) +{ + return false; +} - return false; - } - sal_Unicode SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacter( sal_Int32 nIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::implGetCharacter( implGetText(), nIndex ); - } - css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); +// XAccessibleEventBroadcaster - OUString sText( implGetText() ); +sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCaretPosition( ) +{ + return -1; +} +sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setCaretPosition ( sal_Int32 nIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); + if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); - return css::uno::Sequence< css::beans::PropertyValue >(); - } - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterCount( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return implGetText().getLength(); - } + return false; +} +sal_Unicode SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacter( sal_Int32 nIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return OCommonAccessibleText::implGetCharacter( implGetText(), nIndex ); +} +css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectedText( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OUString(); - } - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionStart( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return 0; - } - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionEnd( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return 0; - } - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); + OUString sText( implGetText() ); - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); + if ( !implIsValidIndex( nIndex, sText.getLength() ) ) + throw IndexOutOfBoundsException(); - return false; - } - OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getText( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return implGetText( ); - } - OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ); - } - css::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); - } - css::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); - } - css::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); + return css::uno::Sequence< css::beans::PropertyValue >(); +} +sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getCharacterCount( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return implGetText().getLength(); +} - return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); - } +OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectedText( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return OUString(); +} +sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionStart( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return 0; +} +sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getSelectionEnd( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return 0; +} +sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); - // XAccessibleAction + return false; +} +OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getText( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return implGetText( ); +} +OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ); +} +css::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); +} +css::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); +} +css::accessibility::TextSegment SAL_CALL AccessibleIconChoiceCtrlEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionCount( ) - { - // three actions supported - return ACCESSIBLE_ACTION_COUNT; - } + return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); +} - sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::doAccessibleAction( sal_Int32 nIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - bool bRet = false; - checkActionIndex_Impl( nIndex ); - EnsureIsAlive(); +// XAccessibleAction - SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); - if ( pEntry && !pEntry->IsSelected() ) - { - m_pIconCtrl->SetCursor( pEntry ); - bRet = true; - } +sal_Int32 SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionCount( ) +{ + // three actions supported + return ACCESSIBLE_ACTION_COUNT; +} - return bRet; - } +sal_Bool SAL_CALL AccessibleIconChoiceCtrlEntry::doAccessibleAction( sal_Int32 nIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionDescription( sal_Int32 nIndex ) + bool bRet = false; + checkActionIndex_Impl( nIndex ); + EnsureIsAlive(); + + SvxIconChoiceCtrlEntry* pEntry = m_pIconCtrl->GetEntry( m_nIndex ); + if ( pEntry && !pEntry->IsSelected() ) { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + m_pIconCtrl->SetCursor( pEntry ); + bRet = true; + } - checkActionIndex_Impl( nIndex ); - EnsureIsAlive(); + return bRet; +} - return u"Select"_ustr; - } +OUString SAL_CALL AccessibleIconChoiceCtrlEntry::getAccessibleActionDescription( sal_Int32 nIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - Reference< XAccessibleKeyBinding > AccessibleIconChoiceCtrlEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) - { - Reference< XAccessibleKeyBinding > xRet; - checkActionIndex_Impl( nIndex ); - // ... which key? - return xRet; - } + checkActionIndex_Impl( nIndex ); + EnsureIsAlive(); -}// namespace accessibility + return u"Select"_ustr; +} +Reference< XAccessibleKeyBinding > AccessibleIconChoiceCtrlEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) +{ + Reference< XAccessibleKeyBinding > xRet; + checkActionIndex_Impl( nIndex ); + // ... which key? + return xRet; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/accessiblelistbox.cxx b/vcl/source/accessibility/accessiblelistbox.cxx index fdea478ecaa6..0de3d1c8f49d 100644 --- a/vcl/source/accessibility/accessiblelistbox.cxx +++ b/vcl/source/accessibility/accessiblelistbox.cxx @@ -28,478 +28,471 @@ #include <comphelper/accessiblecontexthelper.hxx> -namespace accessibility -{ - +// class AccessibleListBox ----------------------------------------------------- - // class AccessibleListBox ----------------------------------------------------- +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star; - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; +// Ctor() and Dtor() - // Ctor() and Dtor() +AccessibleListBox::AccessibleListBox(SvTreeListBox& _rListBox, const Reference< XAccessible >& _xParent) + : ImplInheritanceHelper(&_rListBox), + m_xParent( _xParent ) +{ +} - AccessibleListBox::AccessibleListBox(SvTreeListBox& _rListBox, const Reference< XAccessible >& _xParent) - : ImplInheritanceHelper(&_rListBox), - m_xParent( _xParent ) +AccessibleListBox::~AccessibleListBox() +{ + if ( isAlive() ) { + // increment ref count to prevent double call of Dtor + osl_atomic_increment( &m_refCount ); + dispose(); } +} - AccessibleListBox::~AccessibleListBox() - { - if ( isAlive() ) - { - // increment ref count to prevent double call of Dtor - osl_atomic_increment( &m_refCount ); - dispose(); - } - } +void AccessibleListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) +{ + if ( !isAlive() ) + return; - void AccessibleListBox::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) + switch ( rVclWindowEvent.GetId() ) { - if ( !isAlive() ) - return; - - switch ( rVclWindowEvent.GetId() ) + case VclEventId::CheckboxToggle : { - case VclEventId::CheckboxToggle : + if ( !getListBox() || !getListBox()->HasFocus() ) { - if ( !getListBox() || !getListBox()->HasFocus() ) - { - return; - } - AccessibleListBoxEntry* pCurOpEntry = GetCurEventEntry(rVclWindowEvent); - if(!pCurOpEntry) - { - return ; - } - uno::Any aValue; - aValue <<= AccessibleStateType::CHECKED; - - if ( getListBox()->GetCheckButtonState( pCurOpEntry->GetSvLBoxEntry() ) == SvButtonState::Checked ) - { - pCurOpEntry->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, uno::Any(), aValue ); - } - else - { - pCurOpEntry->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aValue,uno::Any() ); - } - break; + return; } - - case VclEventId::ListboxSelect : + AccessibleListBoxEntry* pCurOpEntry = GetCurEventEntry(rVclWindowEvent); + if(!pCurOpEntry) { - OSL_FAIL("Debug: Treelist shouldn't use VclEventId::ListboxSelect"); - break; + return ; } + uno::Any aValue; + aValue <<= AccessibleStateType::CHECKED; - case VclEventId::ListboxTreeSelect: + if ( getListBox()->GetCheckButtonState( pCurOpEntry->GetSvLBoxEntry() ) == SvButtonState::Checked ) { - if ( getListBox() && getListBox()->HasFocus() ) - { - if (m_xFocusedEntry.is()) - { - m_xFocusedEntry->NotifyAccessibleEvent(AccessibleEventId::SELECTION_CHANGED, Any(), Any()); - } - } + pCurOpEntry->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, uno::Any(), aValue ); + } + else + { + pCurOpEntry->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aValue,uno::Any() ); } break; - case VclEventId::ListboxTreeFocus: + } + + case VclEventId::ListboxSelect : + { + OSL_FAIL("Debug: Treelist shouldn't use VclEventId::ListboxSelect"); + break; + } + + case VclEventId::ListboxTreeSelect: + { + if ( getListBox() && getListBox()->HasFocus() ) { - VclPtr<SvTreeListBox> pBox = getListBox(); - if( pBox && pBox->HasFocus() ) + if (m_xFocusedEntry.is()) { - uno::Any aNewValue; - SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) - { - if (m_xFocusedEntry.is() && m_xFocusedEntry->GetSvLBoxEntry() == pEntry) - { - aNewValue <<= uno::Reference<XAccessible>(m_xFocusedEntry);; - NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, uno::Any(), aNewValue ); - return ; - } - uno::Any aOldValue; - aOldValue <<= uno::Reference<XAccessible>(m_xFocusedEntry);; - - m_xFocusedEntry = implGetAccessible(*pEntry); - - aNewValue <<= uno::Reference<XAccessible>(m_xFocusedEntry); - NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue ); - } - else - { - aNewValue <<= AccessibleStateType::FOCUSED; - NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, uno::Any(), aNewValue ); - } + m_xFocusedEntry->NotifyAccessibleEvent(AccessibleEventId::SELECTION_CHANGED, Any(), Any()); } } - break; - case VclEventId::ListboxItemRemoved: + } + break; + case VclEventId::ListboxTreeFocus: + { + VclPtr<SvTreeListBox> pBox = getListBox(); + if( pBox && pBox->HasFocus() ) { + uno::Any aNewValue; SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); if ( pEntry ) { - RemoveChildEntries(pEntry); + if (m_xFocusedEntry.is() && m_xFocusedEntry->GetSvLBoxEntry() == pEntry) + { + aNewValue <<= uno::Reference<XAccessible>(m_xFocusedEntry);; + NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, uno::Any(), aNewValue ); + return ; + } + uno::Any aOldValue; + aOldValue <<= uno::Reference<XAccessible>(m_xFocusedEntry);; + + m_xFocusedEntry = implGetAccessible(*pEntry); + + aNewValue <<= uno::Reference<XAccessible>(m_xFocusedEntry); + NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue ); } else { - // NULL means Clear() - for (auto const& entry : m_mapEntry) - { - uno::Any aNewValue; - uno::Any aOldValue; - aOldValue <<= uno::Reference<XAccessible>(entry.second); - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - } - for (auto const& entry : m_mapEntry) - { // release references ... - entry.second->dispose(); - } - m_mapEntry.clear(); + aNewValue <<= AccessibleStateType::FOCUSED; + NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, uno::Any(), aNewValue ); } } - break; + } + break; + case VclEventId::ListboxItemRemoved: + { + SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); + if ( pEntry ) + { + RemoveChildEntries(pEntry); + } + else + { + // NULL means Clear() + for (auto const& entry : m_mapEntry) + { + uno::Any aNewValue; + uno::Any aOldValue; + aOldValue <<= uno::Reference<XAccessible>(entry.second); + NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); + } + for (auto const& entry : m_mapEntry) + { // release references ... + entry.second->dispose(); + } + m_mapEntry.clear(); + } + } + break; - // #i92103# - case VclEventId::ItemExpanded : - case VclEventId::ItemCollapsed : + // #i92103# + case VclEventId::ItemExpanded : + case VclEventId::ItemCollapsed : + { + SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); + if ( pEntry ) { - SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) + Reference<XAccessible> const xChild(implGetAccessible(*pEntry)); + const short nAccEvent = + ( rVclWindowEvent.GetId() == VclEventId::ItemExpanded ) + ? AccessibleEventId::LISTBOX_ENTRY_EXPANDED + : AccessibleEventId::LISTBOX_ENTRY_COLLAPSED; + uno::Any aListBoxEntry; + aListBoxEntry <<= xChild; + NotifyAccessibleEvent( nAccEvent, Any(), aListBoxEntry ); + if ( getListBox() && getListBox()->HasFocus() ) { - Reference<XAccessible> const xChild(implGetAccessible(*pEntry)); - const short nAccEvent = - ( rVclWindowEvent.GetId() == VclEventId::ItemExpanded ) - ? AccessibleEventId::LISTBOX_ENTRY_EXPANDED - : AccessibleEventId::LISTBOX_ENTRY_COLLAPSED; - uno::Any aListBoxEntry; - aListBoxEntry <<= xChild; - NotifyAccessibleEvent( nAccEvent, Any(), aListBoxEntry ); - if ( getListBox() && getListBox()->HasFocus() ) - { - NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), aListBoxEntry ); - } + NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), aListBoxEntry ); } } - break; - default: - VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); } + break; + default: + VCLXAccessibleComponent::ProcessWindowEvent (rVclWindowEvent); } +} - AccessibleListBoxEntry* AccessibleListBox::GetCurEventEntry( const VclWindowEvent& rVclWindowEvent ) - { - SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); - if ( !pEntry ) - pEntry = getListBox()->GetCurEntry(); +AccessibleListBoxEntry* AccessibleListBox::GetCurEventEntry( const VclWindowEvent& rVclWindowEvent ) +{ + SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); + if ( !pEntry ) + pEntry = getListBox()->GetCurEntry(); - if (m_xFocusedEntry.is() && pEntry && pEntry != m_xFocusedEntry->GetSvLBoxEntry()) - { - AccessibleListBoxEntry *const pAccCurOptionEntry = implGetAccessible(*pEntry).get(); - uno::Any aNewValue; - aNewValue <<= uno::Reference<XAccessible>(pAccCurOptionEntry); - NotifyAccessibleEvent( AccessibleEventId::CHILD, uno::Any(), aNewValue );//Add + if (m_xFocusedEntry.is() && pEntry && pEntry != m_xFocusedEntry->GetSvLBoxEntry()) + { + AccessibleListBoxEntry *const pAccCurOptionEntry = implGetAccessible(*pEntry).get(); + uno::Any aNewValue; + aNewValue <<= uno::Reference<XAccessible>(pAccCurOptionEntry); + NotifyAccessibleEvent( AccessibleEventId::CHILD, uno::Any(), aNewValue );//Add - return pAccCurOptionEntry; - } - else - { - return m_xFocusedEntry.get(); - } + return pAccCurOptionEntry; + } + else + { + return m_xFocusedEntry.get(); } +} - void AccessibleListBox::RemoveChildEntries(SvTreeListEntry* pEntry) +void AccessibleListBox::RemoveChildEntries(SvTreeListEntry* pEntry) +{ + MAP_ENTRY::iterator mi = m_mapEntry.find(pEntry); + if ( mi != m_mapEntry.end() ) { - MAP_ENTRY::iterator mi = m_mapEntry.find(pEntry); - if ( mi != m_mapEntry.end() ) - { - uno::Any aNewValue; - uno::Any aOldValue; - aOldValue <<= uno::Reference<XAccessible>(mi->second); - NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); + uno::Any aNewValue; + uno::Any aOldValue; + aOldValue <<= uno::Reference<XAccessible>(mi->second); + NotifyAccessibleEvent( AccessibleEventId::CHILD, aOldValue, aNewValue ); - m_mapEntry.erase(mi); - } + m_mapEntry.erase(mi); + } - VclPtr<SvTreeListBox> pBox = getListBox(); - SvTreeListEntry* pEntryChild = pBox->FirstChild(pEntry); - while (pEntryChild) - { - RemoveChildEntries(pEntryChild); - pEntryChild = pEntryChild->NextSibling(); - } + VclPtr<SvTreeListBox> pBox = getListBox(); + SvTreeListEntry* pEntryChild = pBox->FirstChild(pEntry); + while (pEntryChild) + { + RemoveChildEntries(pEntryChild); + pEntryChild = pEntryChild->NextSibling(); } +} - // XComponent +// XComponent - void SAL_CALL AccessibleListBox::disposing() - { - ::osl::MutexGuard aGuard( m_aMutex ); +void SAL_CALL AccessibleListBox::disposing() +{ + ::osl::MutexGuard aGuard( m_aMutex ); - m_mapEntry.clear(); - VCLXAccessibleComponent::disposing(); - m_xParent = nullptr; - } + m_mapEntry.clear(); + VCLXAccessibleComponent::disposing(); + m_xParent = nullptr; +} - // XServiceInfo +// XServiceInfo - OUString SAL_CALL AccessibleListBox::getImplementationName() - { - return u"com.sun.star.comp.svtools.AccessibleTreeListBox"_ustr; - } +OUString SAL_CALL AccessibleListBox::getImplementationName() +{ + return u"com.sun.star.comp.svtools.AccessibleTreeListBox"_ustr; +} - Sequence< OUString > SAL_CALL AccessibleListBox::getSupportedServiceNames() - { - return {u"com.sun.star.accessibility.AccessibleContext"_ustr, - u"com.sun.star.accessibility.AccessibleComponent"_ustr, - u"com.sun.star.awt.AccessibleTreeListBox"_ustr}; - } +Sequence< OUString > SAL_CALL AccessibleListBox::getSupportedServiceNames() +{ + return {u"com.sun.star.accessibility.AccessibleContext"_ustr, + u"com.sun.star.accessibility.AccessibleComponent"_ustr, + u"com.sun.star.awt.AccessibleTreeListBox"_ustr}; +} - // XAccessible +// XAccessible - Reference< XAccessibleContext > SAL_CALL AccessibleListBox::getAccessibleContext( ) - { - ensureAlive(); - return this; - } +Reference< XAccessibleContext > SAL_CALL AccessibleListBox::getAccessibleContext( ) +{ + ensureAlive(); + return this; +} - // XAccessibleContext +// XAccessibleContext - sal_Int64 SAL_CALL AccessibleListBox::getAccessibleChildCount( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +sal_Int64 SAL_CALL AccessibleListBox::getAccessibleChildCount( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - sal_Int32 nCount = 0; - VclPtr<SvTreeListBox> pSvTreeListBox = getListBox(); - if ( pSvTreeListBox ) - nCount = pSvTreeListBox->GetLevelChildCount( nullptr ); + sal_Int32 nCount = 0; + VclPtr<SvTreeListBox> pSvTreeListBox = getListBox(); + if ( pSvTreeListBox ) + nCount = pSvTreeListBox->GetLevelChildCount( nullptr ); - return nCount; - } + return nCount; +} - Reference< XAccessible > SAL_CALL AccessibleListBox::getAccessibleChild( sal_Int64 i ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +Reference< XAccessible > SAL_CALL AccessibleListBox::getAccessibleChild( sal_Int64 i ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - SvTreeListEntry* pEntry = getListBox()->GetEntry(i); - if ( !pEntry ) - throw IndexOutOfBoundsException(); + SvTreeListEntry* pEntry = getListBox()->GetEntry(i); + if ( !pEntry ) + throw IndexOutOfBoundsException(); - // Solution: Set the parameter of the parent to null to let entry determine the parent by itself - //return new AccessibleListBoxEntry( *getListBox(), pEntry, this ); - //return new AccessibleListBoxEntry( *getListBox(), pEntry, nullptr ); - return implGetAccessible(*pEntry); - } + // Solution: Set the parameter of the parent to null to let entry determine the parent by itself + //return new AccessibleListBoxEntry( *getListBox(), pEntry, this ); + //return new AccessibleListBoxEntry( *getListBox(), pEntry, nullptr ); + return implGetAccessible(*pEntry); +} - Reference< XAccessible > SAL_CALL AccessibleListBox::getAccessibleParent( ) - { - ::osl::MutexGuard aGuard( m_aMutex ); +Reference< XAccessible > SAL_CALL AccessibleListBox::getAccessibleParent( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); - ensureAlive(); - return m_xParent; - } + ensureAlive(); + return m_xParent; +} - sal_Int32 AccessibleListBox::GetRoleType() const +sal_Int32 AccessibleListBox::GetRoleType() const +{ + sal_Int32 nCase = 0; + SvTreeListEntry* pEntry = getListBox()->GetEntry(0); + if ( pEntry ) { - sal_Int32 nCase = 0; - SvTreeListEntry* pEntry = getListBox()->GetEntry(0); - if ( pEntry ) + if( pEntry->HasChildrenOnDemand() || getListBox()->GetChildCount(pEntry) > 0 ) { - if( pEntry->HasChildrenOnDemand() || getListBox()->GetChildCount(pEntry) > 0 ) - { - nCase = 1; - return nCase; - } + nCase = 1; + return nCase; } - - bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0; - if( !(getListBox()->GetTreeFlags() & SvTreeFlags::CHKBTN) ) - { - if( bHasButtons ) - nCase = 1; - } - else - { - if( bHasButtons ) - nCase = 2; - else - nCase = 3; - } - return nCase; } - sal_Int16 SAL_CALL AccessibleListBox::getAccessibleRole() + bool bHasButtons = (getListBox()->GetStyle() & WB_HASBUTTONS)!=0; + if( !(getListBox()->GetTreeFlags() & SvTreeFlags::CHKBTN) ) { - ::comphelper::OExternalLockGuard aGuard( this ); - - VclPtr<SvTreeListBox> pListBox = getListBox(); - if (!pListBox) - return AccessibleRole::LIST; + if( bHasButtons ) + nCase = 1; + } + else + { + if( bHasButtons ) + nCase = 2; + else + nCase = 3; + } + return nCase; +} - //o is: return AccessibleRole::TREE; - bool bHasButtons = (pListBox->GetStyle() & WB_HASBUTTONS) != 0; - if (!bHasButtons && (pListBox->GetTreeFlags() & SvTreeFlags::CHKBTN)) +sal_Int16 SAL_CALL AccessibleListBox::getAccessibleRole() +{ + ::comphelper::OExternalLockGuard aGuard( this ); + + VclPtr<SvTreeListBox> pListBox = getListBox(); + if (!pListBox) + return AccessibleRole::LIST; + + //o is: return AccessibleRole::TREE; + bool bHasButtons = (pListBox->GetStyle() & WB_HASBUTTONS) != 0; + if (!bHasButtons && (pListBox->GetTreeFlags() & SvTreeFlags::CHKBTN)) + return AccessibleRole::LIST; + else + if (GetRoleType() == 0) return AccessibleRole::LIST; else - if (GetRoleType() == 0) - return AccessibleRole::LIST; - else - return AccessibleRole::TREE; - } + return AccessibleRole::TREE; +} - OUString SAL_CALL AccessibleListBox::getAccessibleDescription( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +OUString SAL_CALL AccessibleListBox::getAccessibleDescription( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - return getListBox()->GetAccessibleDescription(); - } + return getListBox()->GetAccessibleDescription(); +} - OUString SAL_CALL AccessibleListBox::getAccessibleName( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +OUString SAL_CALL AccessibleListBox::getAccessibleName( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - return getListBox()->GetAccessibleName(); - } + return getListBox()->GetAccessibleName(); +} - // XAccessibleSelection +// XAccessibleSelection - void SAL_CALL AccessibleListBox::selectAccessibleChild( sal_Int64 nChildIndex ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +void SAL_CALL AccessibleListBox::selectAccessibleChild( sal_Int64 nChildIndex ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - SvTreeListEntry* pEntry = getListBox()->GetEntry( nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); + SvTreeListEntry* pEntry = getListBox()->GetEntry( nChildIndex ); + if ( !pEntry ) + throw IndexOutOfBoundsException(); - getListBox()->Select( pEntry ); - } + getListBox()->Select( pEntry ); +} - sal_Bool SAL_CALL AccessibleListBox::isAccessibleChildSelected( sal_Int64 nChildIndex ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +sal_Bool SAL_CALL AccessibleListBox::isAccessibleChildSelected( sal_Int64 nChildIndex ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) - throw IndexOutOfBoundsException(); + if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) + throw IndexOutOfBoundsException(); - SvTreeListEntry* pEntry = getListBox()->GetEntry( nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); + SvTreeListEntry* pEntry = getListBox()->GetEntry( nChildIndex ); + if ( !pEntry ) + throw IndexOutOfBoundsException(); - return getListBox()->IsSelected( pEntry ); - } + return getListBox()->IsSelected( pEntry ); +} - void SAL_CALL AccessibleListBox::clearAccessibleSelection( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +void SAL_CALL AccessibleListBox::clearAccessibleSelection( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - sal_Int32 nCount = getListBox()->GetLevelChildCount( nullptr ); - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - SvTreeListEntry* pEntry = getListBox()->GetEntry( i ); - if ( getListBox()->IsSelected( pEntry ) ) - getListBox()->Select( pEntry, false ); - } + sal_Int32 nCount = getListBox()->GetLevelChildCount( nullptr ); + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + SvTreeListEntry* pEntry = getListBox()->GetEntry( i ); + if ( getListBox()->IsSelected( pEntry ) ) + getListBox()->Select( pEntry, false ); } +} - void SAL_CALL AccessibleListBox::selectAllAccessibleChildren( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +void SAL_CALL AccessibleListBox::selectAllAccessibleChildren( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - sal_Int32 nCount = getListBox()->GetLevelChildCount( nullptr ); - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - SvTreeListEntry* pEntry = getListBox()->GetEntry( i ); - if ( !getListBox()->IsSelected( pEntry ) ) - getListBox()->Select( pEntry ); - } + sal_Int32 nCount = getListBox()->GetLevelChildCount( nullptr ); + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + SvTreeListEntry* pEntry = getListBox()->GetEntry( i ); + if ( !getListBox()->IsSelected( pEntry ) ) + getListBox()->Select( pEntry ); } +} - sal_Int64 SAL_CALL AccessibleListBox::getSelectedAccessibleChildCount( ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +sal_Int64 SAL_CALL AccessibleListBox::getSelectedAccessibleChildCount( ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - return getListBox()->GetSelectionCount(); - } + return getListBox()->GetSelectionCount(); +} - Reference< XAccessible > SAL_CALL AccessibleListBox::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) - { - ::comphelper::OExternalLockGuard aGuard( this ); +Reference< XAccessible > SAL_CALL AccessibleListBox::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); + if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) + throw IndexOutOfBoundsException(); - Reference< XAccessible > xChild; - sal_Int64 nSelCount= 0; - sal_Int32 nCount = getListBox()->GetLevelChildCount( nullptr ); - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - SvTreeListEntry* pEntry = getListBox()->GetEntry( i ); - if ( getListBox()->IsSelected( pEntry ) ) - ++nSelCount; + Reference< XAccessible > xChild; + sal_Int64 nSelCount= 0; + sal_Int32 nCount = getListBox()->GetLevelChildCount( nullptr ); + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + SvTreeListEntry* pEntry = getListBox()->GetEntry( i ); + if ( getListBox()->IsSelected( pEntry ) ) + ++nSelCount; - if ( nSelCount == ( nSelectedChildIndex + 1 ) ) - { - // Solution: Set the parameter of the parent to null to let entry determine the parent by itself - //xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this ); - //xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, nullptr ); - xChild = implGetAccessible(*pEntry).get(); - break; - } + if ( nSelCount == ( nSelectedChildIndex + 1 ) ) + { + // Solution: Set the parameter of the parent to null to let entry determine the parent by itself + //xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, this ); + //xChild = new AccessibleListBoxEntry( *getListBox(), pEntry, nullptr ); + xChild = implGetAccessible(*pEntry).get(); + break; } - - return xChild; } - void SAL_CALL AccessibleListBox::deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) - { - ::comphelper::OExternalLockGuard aGuard( this ); + return xChild; +} - SvTreeListEntry* pEntry = getListBox()->GetEntry( nSelectedChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); +void SAL_CALL AccessibleListBox::deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) +{ + ::comphelper::OExternalLockGuard aGuard( this ); - getListBox()->Select( pEntry, false ); - } + SvTreeListEntry* pEntry = getListBox()->GetEntry( nSelectedChildIndex ); + if ( !pEntry ) + throw IndexOutOfBoundsException(); - void AccessibleListBox::FillAccessibleStateSet( sal_Int64& rStateSet ) + getListBox()->Select( pEntry, false ); +} + +void AccessibleListBox::FillAccessibleStateSet( sal_Int64& rStateSet ) +{ + VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); + if ( getListBox() && isAlive() ) { - VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet ); - if ( getListBox() && isAlive() ) - { - rStateSet |= AccessibleStateType::FOCUSABLE; - rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS; - if ( getListBox()->GetSelectionMode() == SelectionMode::Multiple ) - rStateSet |= AccessibleStateType::MULTI_SELECTABLE; - } + rStateSet |= AccessibleStateType::FOCUSABLE; + rStateSet |= AccessibleStateType::MANAGES_DESCENDANTS; + if ( getListBox()->GetSelectionMode() == SelectionMode::Multiple ) + rStateSet |= AccessibleStateType::MULTI_SELECTABLE; } +} - rtl::Reference<AccessibleListBoxEntry> AccessibleListBox::implGetAccessible(SvTreeListEntry & rEntry) +rtl::Reference<AccessibleListBoxEntry> AccessibleListBox::implGetAccessible(SvTreeListEntry & rEntry) +{ + rtl::Reference<AccessibleListBoxEntry> pAccessible; + auto const it = m_mapEntry.find(&rEntry); + if (it != m_mapEntry.end()) { - rtl::Reference<AccessibleListBoxEntry> pAccessible; - auto const it = m_mapEntry.find(&rEntry); - if (it != m_mapEntry.end()) - { - pAccessible = it->second; - } - else - { - pAccessible = new AccessibleListBoxEntry(*getListBox(), rEntry, *this); - m_mapEntry.emplace(&rEntry, pAccessible); - } - assert(pAccessible.is()); - return pAccessible; + pAccessible = it->second; } - - VclPtr< SvTreeListBox > AccessibleListBox::getListBox() const + else { - return GetAs< SvTreeListBox >(); + pAccessible = new AccessibleListBoxEntry(*getListBox(), rEntry, *this); + m_mapEntry.emplace(&rEntry, pAccessible); } + assert(pAccessible.is()); + return pAccessible; +} -}// namespace accessibility - +VclPtr< SvTreeListBox > AccessibleListBox::getListBox() const +{ + return GetAs< SvTreeListBox >(); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/accessiblelistboxentry.cxx b/vcl/source/accessibility/accessiblelistboxentry.cxx index 993627bcc4f1..16db22110cbb 100644 --- a/vcl/source/accessibility/accessiblelistboxentry.cxx +++ b/vcl/source/accessibility/accessiblelistboxentry.cxx @@ -39,1047 +39,1042 @@ #include <svdata.hxx> #include <strings.hrc> -namespace accessibility -{ - // class AccessibleListBoxEntry ----------------------------------------------------- +// class AccessibleListBoxEntry ----------------------------------------------------- - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; - using namespace ::comphelper; +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star; +using namespace ::comphelper; - // Ctor() and Dtor() +// Ctor() and Dtor() - AccessibleListBoxEntry::AccessibleListBoxEntry( SvTreeListBox& _rListBox, - SvTreeListEntry& rEntry, - AccessibleListBox & rListBox) - : AccessibleListBoxEntry_BASE() +AccessibleListBoxEntry::AccessibleListBoxEntry( SvTreeListBox& _rListBox, + SvTreeListEntry& rEntry, + AccessibleListBox & rListBox) + : AccessibleListBoxEntry_BASE() - , m_pTreeListBox( &_rListBox ) - , m_pSvLBoxEntry(&rEntry) - , m_wListBox(&rListBox) - { - m_pTreeListBox->AddEventListener( LINK( this, AccessibleListBoxEntry, WindowEventListener ) ); - _rListBox.FillEntryPath( m_pSvLBoxEntry, m_aEntryPath ); - } + , m_pTreeListBox( &_rListBox ) + , m_pSvLBoxEntry(&rEntry) + , m_wListBox(&rListBox) +{ + m_pTreeListBox->AddEventListener( LINK( this, AccessibleListBoxEntry, WindowEventListener ) ); + _rListBox.FillEntryPath( m_pSvLBoxEntry, m_aEntryPath ); +} - IMPL_LINK( AccessibleListBoxEntry, WindowEventListener, VclWindowEvent&, rEvent, void ) - { - OSL_ENSURE( rEvent.GetWindow() , "AccessibleListBoxEntry::WindowEventListener: no event window!" ); - OSL_ENSURE( rEvent.GetWindow() == m_pTreeListBox, "AccessibleListBoxEntry::WindowEventListener: where did this come from?" ); +IMPL_LINK( AccessibleListBoxEntry, WindowEventListener, VclWindowEvent&, rEvent, void ) +{ + OSL_ENSURE( rEvent.GetWindow() , "AccessibleListBoxEntry::WindowEventListener: no event window!" ); + OSL_ENSURE( rEvent.GetWindow() == m_pTreeListBox, "AccessibleListBoxEntry::WindowEventListener: where did this come from?" ); - if ( m_pTreeListBox == nullptr ) - return; + if ( m_pTreeListBox == nullptr ) + return; - switch ( rEvent.GetId() ) + switch ( rEvent.GetId() ) + { + case VclEventId::CheckboxToggle: { - case VclEventId::CheckboxToggle: - { - // assert this object is represented as a checkbox on a11y layer (LABEL role is used for - // SvButtonState::Tristate, s. AccessibleListBoxEntry::getAccessibleRole) - assert(getAccessibleRole() == AccessibleRole::CHECK_BOX - || getAccessibleRole() == AccessibleRole::LABEL); - Any aOldValue; - Any aNewValue; - if (getAccessibleStateSet() & AccessibleStateType::CHECKED) - aNewValue <<= AccessibleStateType::CHECKED; - else - aOldValue <<= AccessibleStateType::CHECKED; - - NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue); - break; - } - case VclEventId::ObjectDying : - { - if ( m_pTreeListBox ) - m_pTreeListBox->RemoveEventListener( LINK( this, AccessibleListBoxEntry, WindowEventListener ) ); - m_pTreeListBox = nullptr; - dispose(); - break; - } - default: break; - } - } + // assert this object is represented as a checkbox on a11y layer (LABEL role is used for + // SvButtonState::Tristate, s. AccessibleListBoxEntry::getAccessibleRole) + assert(getAccessibleRole() == AccessibleRole::CHECK_BOX + || getAccessibleRole() == AccessibleRole::LABEL); + Any aOldValue; + Any aNewValue; + if (getAccessibleStateSet() & AccessibleStateType::CHECKED) + aNewValue <<= AccessibleStateType::CHECKED; + else + aOldValue <<= AccessibleStateType::CHECKED; - tools::Rectangle AccessibleListBoxEntry::GetBoundingBox_Impl() const - { - tools::Rectangle aRect; - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) + NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue); + break; + } + case VclEventId::ObjectDying : { - aRect = m_pTreeListBox->GetBoundingRect( pEntry ); - SvTreeListEntry* pParent = m_pTreeListBox->GetParent( pEntry ); - if ( pParent ) - { - // position relative to parent entry - Point aTopLeft = aRect.TopLeft(); - aTopLeft -= m_pTreeListBox->GetBoundingRect( pParent ).TopLeft(); - aRect = tools::Rectangle( aTopLeft, aRect.GetSize() ); - } + if ( m_pTreeListBox ) + m_pTreeListBox->RemoveEventListener( LINK( this, AccessibleListBoxEntry, WindowEventListener ) ); + m_pTreeListBox = nullptr; + dispose(); + break; } - - return aRect; - } - - bool AccessibleListBoxEntry::IsAlive_Impl() const - { - return !rBHelper.bDisposed && !rBHelper.bInDispose && (m_pTreeListBox != nullptr); + default: break; } +} - bool AccessibleListBoxEntry::IsShowing_Impl() const +tools::Rectangle AccessibleListBoxEntry::GetBoundingBox_Impl() const +{ + tools::Rectangle aRect; + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + if ( pEntry ) { - Reference< XAccessible > xParent = implGetParentAccessible( ); - - bool bShowing = false; - Reference< XAccessibleContext > xParentContext = - xParent.is() ? xParent->getAccessibleContext() : Reference< XAccessibleContext >(); - if( xParentContext.is() ) + aRect = m_pTreeListBox->GetBoundingRect( pEntry ); + SvTreeListEntry* pParent = m_pTreeListBox->GetParent( pEntry ); + if ( pParent ) { - Reference< XAccessibleComponent > xParentComp( xParentContext, uno::UNO_QUERY ); - if( xParentComp.is() ) - bShowing = GetBoundingBox_Impl().Overlaps( - vcl::unohelper::ConvertToVCLRect(xParentComp->getBounds())); + // position relative to parent entry + Point aTopLeft = aRect.TopLeft(); + aTopLeft -= m_pTreeListBox->GetBoundingRect( pParent ).TopLeft(); + aRect = tools::Rectangle( aTopLeft, aRect.GetSize() ); } - - return bShowing; } - void AccessibleListBoxEntry::CheckActionIndex(sal_Int32 nIndex) - { - if (nIndex < 0 || nIndex >= getAccessibleActionCount()) - throw css::lang::IndexOutOfBoundsException(); - } + return aRect; +} - void AccessibleListBoxEntry::EnsureIsAlive() const - { - if ( !IsAlive_Impl() ) - throw lang::DisposedException(); - } - - OUString AccessibleListBoxEntry::implGetText() - { - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - if (pEntry) - return SvTreeListBox::SearchEntryTextWithHeadTitle(pEntry); - return OUString(); - } +bool AccessibleListBoxEntry::IsAlive_Impl() const +{ + return !rBHelper.bDisposed && !rBHelper.bInDispose && (m_pTreeListBox != nullptr); +} - Locale AccessibleListBoxEntry::implGetLocale() - { - return Application::GetSettings().GetUILanguageTag().getLocale(); - } - void AccessibleListBoxEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) - { - nStartIndex = 0; - nEndIndex = 0; - } +bool AccessibleListBoxEntry::IsShowing_Impl() const +{ + Reference< XAccessible > xParent = implGetParentAccessible( ); - css::awt::Rectangle AccessibleListBoxEntry::implGetBounds() + bool bShowing = false; + Reference< XAccessibleContext > xParentContext = + xParent.is() ? xParent->getAccessibleContext() : Reference< XAccessibleContext >(); + if( xParentContext.is() ) { - return vcl::unohelper::ConvertToAWTRect(GetBoundingBox_Impl()); + Reference< XAccessibleComponent > xParentComp( xParentContext, uno::UNO_QUERY ); + if( xParentComp.is() ) + bShowing = GetBoundingBox_Impl().Overlaps( + vcl::unohelper::ConvertToVCLRect(xParentComp->getBounds())); } + return bShowing; +} - // XComponent +void AccessibleListBoxEntry::CheckActionIndex(sal_Int32 nIndex) +{ + if (nIndex < 0 || nIndex >= getAccessibleActionCount()) + throw css::lang::IndexOutOfBoundsException(); +} - void SAL_CALL AccessibleListBoxEntry::disposing() - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); +void AccessibleListBoxEntry::EnsureIsAlive() const +{ + if ( !IsAlive_Impl() ) + throw lang::DisposedException(); +} - Reference< XAccessible > xKeepAlive( this ); +OUString AccessibleListBoxEntry::implGetText() +{ + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + if (pEntry) + return SvTreeListBox::SearchEntryTextWithHeadTitle(pEntry); + return OUString(); +} - OAccessibleComponentHelper::disposing(); +Locale AccessibleListBoxEntry::implGetLocale() +{ + return Application::GetSettings().GetUILanguageTag().getLocale(); +} +void AccessibleListBoxEntry::implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) +{ + nStartIndex = 0; + nEndIndex = 0; +} - // clean up - m_wListBox.clear(); +css::awt::Rectangle AccessibleListBoxEntry::implGetBounds() +{ + return vcl::unohelper::ConvertToAWTRect(GetBoundingBox_Impl()); +} - if ( m_pTreeListBox ) - m_pTreeListBox->RemoveEventListener( LINK( this, AccessibleListBoxEntry, WindowEventListener ) ); - m_pTreeListBox = nullptr; - } - // XServiceInfo +// XComponent - OUString SAL_CALL AccessibleListBoxEntry::getImplementationName() - { - return u"com.sun.star.comp.svtools.AccessibleTreeListBoxEntry"_ustr; - } +void SAL_CALL AccessibleListBoxEntry::disposing() +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - Sequence< OUString > SAL_CALL AccessibleListBoxEntry::getSupportedServiceNames() - { - return {u"com.sun.star.accessibility.AccessibleContext"_ustr, - u"com.sun.star.accessibility.AccessibleComponent"_ustr, - u"com.sun.star.awt.AccessibleTreeListBoxEntry"_ustr}; - } + Reference< XAccessible > xKeepAlive( this ); - sal_Bool SAL_CALL AccessibleListBoxEntry::supportsService( const OUString& _rServiceName ) - { - return cppu::supportsService(this, _rServiceName); - } + OAccessibleComponentHelper::disposing(); - // XAccessible + // clean up + m_wListBox.clear(); - Reference< XAccessibleContext > SAL_CALL AccessibleListBoxEntry::getAccessibleContext( ) - { - EnsureIsAlive(); - return this; - } + if ( m_pTreeListBox ) + m_pTreeListBox->RemoveEventListener( LINK( this, AccessibleListBoxEntry, WindowEventListener ) ); + m_pTreeListBox = nullptr; +} - // XAccessibleContext +// XServiceInfo - sal_Int64 SAL_CALL AccessibleListBoxEntry::getAccessibleChildCount( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); +OUString SAL_CALL AccessibleListBoxEntry::getImplementationName() +{ + return u"com.sun.star.comp.svtools.AccessibleTreeListBoxEntry"_ustr; +} - EnsureIsAlive(); - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - sal_Int32 nCount = 0; - if ( pEntry ) - nCount = m_pTreeListBox->GetLevelChildCount( pEntry ); +Sequence< OUString > SAL_CALL AccessibleListBoxEntry::getSupportedServiceNames() +{ + return {u"com.sun.star.accessibility.AccessibleContext"_ustr, + u"com.sun.star.accessibility.AccessibleComponent"_ustr, + u"com.sun.star.awt.AccessibleTreeListBoxEntry"_ustr}; +} - return nCount; - } +sal_Bool SAL_CALL AccessibleListBoxEntry::supportsService( const OUString& _rServiceName ) +{ + return cppu::supportsService(this, _rServiceName); +} - Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleChild( sal_Int64 i ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); +// XAccessible - SvTreeListEntry* pEntry = GetRealChild(i); - if ( !pEntry ) - throw IndexOutOfBoundsException(); +Reference< XAccessibleContext > SAL_CALL AccessibleListBoxEntry::getAccessibleContext( ) +{ + EnsureIsAlive(); + return this; +} - rtl::Reference<AccessibleListBox> xListBox(m_wListBox); - assert(xListBox.is()); +// XAccessibleContext - return xListBox->implGetAccessible(*pEntry); - } +sal_Int64 SAL_CALL AccessibleListBoxEntry::getAccessibleChildCount( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - Reference< XAccessible > AccessibleListBoxEntry::implGetParentAccessible( ) const - { - Reference< XAccessible > xParent; - assert( m_aEntryPath.size() ); // invalid path - if ( m_aEntryPath.size() == 1 ) - { // we're a top level entry - // -> our parent is the tree listbox itself - if ( m_pTreeListBox ) - xParent = m_pTreeListBox->GetAccessible( ); - } - else - { // we have an entry as parent -> get its accessible - - // shorten our access path by one - std::deque< sal_Int32 > aParentPath( m_aEntryPath ); - aParentPath.pop_back(); - - // get the entry for this shortened access path - SvTreeListEntry* pParentEntry = m_pTreeListBox->GetEntryFromPath( aParentPath ); - assert(pParentEntry && "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!"); - if ( pParentEntry ) - { - rtl::Reference<AccessibleListBox> xListBox(m_wListBox); - assert(xListBox.is()); - return xListBox->implGetAccessible(*pParentEntry); - // the AccessibleListBoxEntry class will create its parent - // when needed - } - } + EnsureIsAlive(); + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + sal_Int32 nCount = 0; + if ( pEntry ) + nCount = m_pTreeListBox->GetLevelChildCount( pEntry ); - return xParent; - } + return nCount; +} +Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleChild( sal_Int64 i ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleParent( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); + SvTreeListEntry* pEntry = GetRealChild(i); + if ( !pEntry ) + throw IndexOutOfBoundsException(); - return implGetParentAccessible( ); - } + rtl::Reference<AccessibleListBox> xListBox(m_wListBox); + assert(xListBox.is()); - sal_Int64 SAL_CALL AccessibleListBoxEntry::getAccessibleIndexInParent( ) - { - ::osl::MutexGuard aGuard( m_aMutex ); + return xListBox->implGetAccessible(*pEntry); +} - OSL_ENSURE( !m_aEntryPath.empty(), "empty path" ); - return m_aEntryPath.empty() ? -1 : m_aEntryPath.back(); +Reference< XAccessible > AccessibleListBoxEntry::implGetParentAccessible( ) const +{ + Reference< XAccessible > xParent; + assert( m_aEntryPath.size() ); // invalid path + if ( m_aEntryPath.size() == 1 ) + { // we're a top level entry + // -> our parent is the tree listbox itself + if ( m_pTreeListBox ) + xParent = m_pTreeListBox->GetAccessible( ); } + else + { // we have an entry as parent -> get its accessible - sal_Int32 AccessibleListBoxEntry::GetRoleType() const - { - sal_Int32 nCase = 0; - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry(0); - if ( pEntry ) - { - if( pEntry->HasChildrenOnDemand() || m_pTreeListBox->GetChildCount(pEntry) > 0 ) - { - nCase = 1; - return nCase; - } - } + // shorten our access path by one + std::deque< sal_Int32 > aParentPath( m_aEntryPath ); + aParentPath.pop_back(); - bool bHasButtons = (m_pTreeListBox->GetStyle() & WB_HASBUTTONS)!=0; - if( !(m_pTreeListBox->GetTreeFlags() & SvTreeFlags::CHKBTN) ) - { - if( bHasButtons ) - nCase = 1; - } - else + // get the entry for this shortened access path + SvTreeListEntry* pParentEntry = m_pTreeListBox->GetEntryFromPath( aParentPath ); + assert(pParentEntry && "AccessibleListBoxEntry::implGetParentAccessible: could not obtain a parent entry!"); + if ( pParentEntry ) { - if( bHasButtons ) - nCase = 2; - else - nCase = 3; + rtl::Reference<AccessibleListBox> xListBox(m_wListBox); + assert(xListBox.is()); + return xListBox->implGetAccessible(*pParentEntry); + // the AccessibleListBoxEntry class will create its parent + // when needed } - return nCase; } - sal_Int16 SAL_CALL AccessibleListBoxEntry::getAccessibleRole( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return xParent; +} - SvTreeListBox* pBox = m_pTreeListBox; - if(!pBox) - return AccessibleRole::UNKNOWN; - SvTreeFlags treeFlag = pBox->GetTreeFlags(); - if(treeFlag & SvTreeFlags::CHKBTN ) - { - SvTreeListEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath ); - SvButtonState eState = pBox->GetCheckButtonState( pEntry ); - switch( eState ) - { - case SvButtonState::Checked: - case SvButtonState::Unchecked: - return AccessibleRole::CHECK_BOX; - case SvButtonState::Tristate: - default: - return AccessibleRole::LABEL; - } - } - if (GetRoleType() == 0) - return AccessibleRole::LIST_ITEM; - else - //o is: return AccessibleRole::LABEL; - return AccessibleRole::TREE_ITEM; - } +Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleParent( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return implGetParentAccessible( ); +} + +sal_Int64 SAL_CALL AccessibleListBoxEntry::getAccessibleIndexInParent( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + OSL_ENSURE( !m_aEntryPath.empty(), "empty path" ); + return m_aEntryPath.empty() ? -1 : m_aEntryPath.back(); +} - if( getAccessibleRole() == AccessibleRole::TREE_ITEM ) +sal_Int32 AccessibleListBoxEntry::GetRoleType() const +{ + sal_Int32 nCase = 0; + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry(0); + if ( pEntry ) + { + if( pEntry->HasChildrenOnDemand() || m_pTreeListBox->GetChildCount(pEntry) > 0 ) { - return OUString(); + nCase = 1; + return nCase; } - return m_pTreeListBox->GetEntryAccessibleDescription( - m_pTreeListBox->GetEntryFromPath(m_aEntryPath)); } - OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName( ) + bool bHasButtons = (m_pTreeListBox->GetStyle() & WB_HASBUTTONS)!=0; + if( !(m_pTreeListBox->GetTreeFlags() & SvTreeFlags::CHKBTN) ) + { + if( bHasButtons ) + nCase = 1; + } + else { - ::osl::MutexGuard aGuard( m_aMutex ); + if( bHasButtons ) + nCase = 2; + else + nCase = 3; + } + return nCase; +} - EnsureIsAlive(); +sal_Int16 SAL_CALL AccessibleListBoxEntry::getAccessibleRole( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - return implGetText(); - } + SvTreeListBox* pBox = m_pTreeListBox; + if(!pBox) + return AccessibleRole::UNKNOWN; - Reference< XAccessibleRelationSet > SAL_CALL AccessibleListBoxEntry::getAccessibleRelationSet( ) + SvTreeFlags treeFlag = pBox->GetTreeFlags(); + if(treeFlag & SvTreeFlags::CHKBTN ) { - Reference< XAccessibleRelationSet > xRelSet; - Reference< XAccessible > xParent; - if ( m_aEntryPath.size() > 1 ) // not a root entry - xParent = implGetParentAccessible(); - if ( xParent.is() ) + SvTreeListEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath ); + SvButtonState eState = pBox->GetCheckButtonState( pEntry ); + switch( eState ) { - rtl::Reference<utl::AccessibleRelationSetHelper> pRelationSetHelper = new utl::AccessibleRelationSetHelper; - Sequence<Reference<XAccessible>> aSequence { xParent }; - pRelationSetHelper->AddRelation( - AccessibleRelation( AccessibleRelationType_NODE_CHILD_OF, aSequence ) ); - xRelSet = pRelationSetHelper; + case SvButtonState::Checked: + case SvButtonState::Unchecked: + return AccessibleRole::CHECK_BOX; + case SvButtonState::Tristate: + default: + return AccessibleRole::LABEL; } - return xRelSet; } + if (GetRoleType() == 0) + return AccessibleRole::LIST_ITEM; + else + //o is: return AccessibleRole::LABEL; + return AccessibleRole::TREE_ITEM; +} + +OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - sal_Int64 SAL_CALL AccessibleListBoxEntry::getAccessibleStateSet( ) + if( getAccessibleRole() == AccessibleRole::TREE_ITEM ) { - ::osl::MutexGuard aGuard( m_aMutex ); + return OUString(); + } + return m_pTreeListBox->GetEntryAccessibleDescription( + m_pTreeListBox->GetEntryFromPath(m_aEntryPath)); +} + +OUString SAL_CALL AccessibleListBoxEntry::getAccessibleName( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + EnsureIsAlive(); - sal_Int64 nStateSet = 0; + return implGetText(); +} - if ( IsAlive_Impl() ) +Reference< XAccessibleRelationSet > SAL_CALL AccessibleListBoxEntry::getAccessibleRelationSet( ) +{ + Reference< XAccessibleRelationSet > xRelSet; + Reference< XAccessible > xParent; + if ( m_aEntryPath.size() > 1 ) // not a root entry + xParent = implGetParentAccessible(); + if ( xParent.is() ) + { + rtl::Reference<utl::AccessibleRelationSetHelper> pRelationSetHelper = new utl::AccessibleRelationSetHelper; + Sequence<Reference<XAccessible>> aSequence { xParent }; + pRelationSetHelper->AddRelation( + AccessibleRelation( AccessibleRelationType_NODE_CHILD_OF, aSequence ) ); + xRelSet = pRelationSetHelper; + } + return xRelSet; +} + +sal_Int64 SAL_CALL AccessibleListBoxEntry::getAccessibleStateSet( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + sal_Int64 nStateSet = 0; + + if ( IsAlive_Impl() ) + { + switch(getAccessibleRole()) { - switch(getAccessibleRole()) - { - case AccessibleRole::LABEL: - nStateSet |= AccessibleStateType::TRANSIENT; - nStateSet |= AccessibleStateType::SELECTABLE; - nStateSet |= AccessibleStateType::ENABLED; - if (m_pTreeListBox->IsInplaceEditingEnabled()) - nStateSet |= AccessibleStateType::EDITABLE; - if (IsShowing_Impl()) - nStateSet |= AccessibleStateType::SHOWING; - break; - case AccessibleRole::CHECK_BOX: - nStateSet |= AccessibleStateType::TRANSIENT; - nStateSet |= AccessibleStateType::SELECTABLE; - nStateSet |= AccessibleStateType::ENABLED; - if (IsShowing_Impl()) - nStateSet |= AccessibleStateType::SHOWING; - break; - } - SvTreeListEntry *pEntry = m_pTreeListBox->GetEntryFromPath(m_aEntryPath); - if (pEntry) - m_pTreeListBox->FillAccessibleEntryStateSet(pEntry, nStateSet); + case AccessibleRole::LABEL: + nStateSet |= AccessibleStateType::TRANSIENT; + nStateSet |= AccessibleStateType::SELECTABLE; + nStateSet |= AccessibleStateType::ENABLED; + if (m_pTreeListBox->IsInplaceEditingEnabled()) + nStateSet |= AccessibleStateType::EDITABLE; + if (IsShowing_Impl()) + nStateSet |= AccessibleStateType::SHOWING; + break; + case AccessibleRole::CHECK_BOX: + nStateSet |= AccessibleStateType::TRANSIENT; + nStateSet |= AccessibleStateType::SELECTABLE; + nStateSet |= AccessibleStateType::ENABLED; + if (IsShowing_Impl()) + nStateSet |= AccessibleStateType::SHOWING; + break; } - else - nStateSet |= AccessibleStateType::DEFUNC; - - return nStateSet; + SvTreeListEntry *pEntry = m_pTreeListBox->GetEntryFromPath(m_aEntryPath); + if (pEntry) + m_pTreeListBox->FillAccessibleEntryStateSet(pEntry, nStateSet); } + else + nStateSet |= AccessibleStateType::DEFUNC; - Locale SAL_CALL AccessibleListBoxEntry::getLocale( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return nStateSet; +} - return implGetLocale(); - } +Locale SAL_CALL AccessibleListBoxEntry::getLocale( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - // XAccessibleComponent + return implGetLocale(); +} - Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleAtPoint( const awt::Point& _aPoint ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - EnsureIsAlive(); - SvTreeListEntry* pEntry - = m_pTreeListBox->GetEntry(vcl::unohelper::ConvertToVCLPoint(_aPoint)); - if ( !pEntry ) - throw RuntimeException(u"AccessibleListBoxEntry::getAccessibleAtPoint - pEntry cannot be empty!"_ustr); - - Reference< XAccessible > xAcc; - rtl::Reference<AccessibleListBox> xListBox(m_wListBox); - assert(xListBox.is()); - auto pAccEntry = xListBox->implGetAccessible(*pEntry); - tools::Rectangle aRect = pAccEntry->GetBoundingBox_Impl(); - if (aRect.Contains(vcl::unohelper::ConvertToVCLPoint(_aPoint))) - xAcc = pAccEntry.get(); - return xAcc; - } +// XAccessibleComponent + +Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getAccessibleAtPoint( const awt::Point& _aPoint ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + + EnsureIsAlive(); + SvTreeListEntry* pEntry + = m_pTreeListBox->GetEntry(vcl::unohelper::ConvertToVCLPoint(_aPoint)); + if ( !pEntry ) + throw RuntimeException(u"AccessibleListBoxEntry::getAccessibleAtPoint - pEntry cannot be empty!"_ustr); + + Reference< XAccessible > xAcc; + rtl::Reference<AccessibleListBox> xListBox(m_wListBox); + assert(xListBox.is()); + auto pAccEntry = xListBox->implGetAccessible(*pEntry); + tools::Rectangle aRect = pAccEntry->GetBoundingBox_Impl(); + if (aRect.Contains(vcl::unohelper::ConvertToVCLPoint(_aPoint))) + xAcc = pAccEntry.get(); + return xAcc; +} + +void SAL_CALL AccessibleListBoxEntry::grabFocus( ) +{ + // do nothing, because no focus for each item +} - void SAL_CALL AccessibleListBoxEntry::grabFocus( ) +sal_Int32 AccessibleListBoxEntry::getForeground( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + + sal_Int32 nColor = 0; + Reference< XAccessible > xParent = getAccessibleParent(); + if ( xParent.is() ) { - // do nothing, because no focus for each item + Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); + if ( xParentComp.is() ) + nColor = xParentComp->getForeground(); } - sal_Int32 AccessibleListBoxEntry::getForeground( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return nColor; +} - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getForeground(); - } +sal_Int32 AccessibleListBoxEntry::getBackground( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - return nColor; + sal_Int32 nColor = 0; + Reference< XAccessible > xParent = getAccessibleParent(); + if ( xParent.is() ) + { + Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); + if ( xParentComp.is() ) + nColor = xParentComp->getBackground(); } - sal_Int32 AccessibleListBoxEntry::getBackground( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return nColor; +} - sal_Int32 nColor = 0; - Reference< XAccessible > xParent = getAccessibleParent(); - if ( xParent.is() ) - { - Reference< XAccessibleComponent > xParentComp( xParent->getAccessibleContext(), UNO_QUERY ); - if ( xParentComp.is() ) - nColor = xParentComp->getBackground(); - } +// XAccessibleText - return nColor; - } - // XAccessibleText +awt::Rectangle SAL_CALL AccessibleListBoxEntry::getCharacterBounds( sal_Int32 nIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - awt::Rectangle SAL_CALL AccessibleListBoxEntry::getCharacterBounds( sal_Int32 nIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); - EnsureIsAlive(); + awt::Rectangle aBounds( 0, 0, 0, 0 ); + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + if ( pEntry ) + { + vcl::ControlLayoutData aLayoutData; + tools::Rectangle aItemRect = GetBoundingBox_Impl(); + m_pTreeListBox->RecordLayoutData( &aLayoutData, aItemRect ); + tools::Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex ); + aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); + aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); + } - if ( !implIsValidIndex( nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); + return aBounds; +} - awt::Rectangle aBounds( 0, 0, 0, 0 ); - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) - { - vcl::ControlLayoutData aLayoutData; - tools::Rectangle aItemRect = GetBoundingBox_Impl(); - m_pTreeListBox->RecordLayoutData( &aLayoutData, aItemRect ); - tools::Rectangle aCharRect = aLayoutData.GetCharacterBounds( nIndex ); - aCharRect.Move( -aItemRect.Left(), -aItemRect.Top() ); - aBounds = vcl::unohelper::ConvertToAWTRect(aCharRect); - } +sal_Int32 SAL_CALL AccessibleListBoxEntry::getIndexAtPoint( const awt::Point& aPoint ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + if(aPoint.X==0 && aPoint.Y==0) return 0; - return aBounds; + sal_Int32 nIndex = -1; + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + if ( pEntry ) + { + vcl::ControlLayoutData aLayoutData; + tools::Rectangle aItemRect = GetBoundingBox_Impl(); + m_pTreeListBox->RecordLayoutData( &aLayoutData, aItemRect ); + Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); + aPnt += aItemRect.TopLeft(); + nIndex = aLayoutData.GetIndexForPoint( aPnt ); } - sal_Int32 SAL_CALL AccessibleListBoxEntry::getIndexAtPoint( const awt::Point& aPoint ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - if(aPoint.X==0 && aPoint.Y==0) return 0; + return nIndex; +} - sal_Int32 nIndex = -1; - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) - { - vcl::ControlLayoutData aLayoutData; - tools::Rectangle aItemRect = GetBoundingBox_Impl(); - m_pTreeListBox->RecordLayoutData( &aLayoutData, aItemRect ); - Point aPnt(vcl::unohelper::ConvertToVCLPoint(aPoint)); - aPnt += aItemRect.TopLeft(); - nIndex = aLayoutData.GetIndexForPoint( aPnt ); - } +sal_Bool SAL_CALL AccessibleListBoxEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - return nIndex; - } + OUString sText = implGetText(); + if ( ( 0 > nStartIndex ) || ( sText.getLength() <= nStartIndex ) + || ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) ) + throw IndexOutOfBoundsException(); - sal_Bool SAL_CALL AccessibleListBoxEntry::copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); + if (!m_pTreeListBox) + return false; + + sal_Int32 nLen = nEndIndex - nStartIndex + 1; + css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipBoard = m_pTreeListBox->GetClipboard(); + vcl::unohelper::TextDataObject::CopyStringTo(sText.copy(nStartIndex, nLen), xClipBoard); - OUString sText = implGetText(); - if ( ( 0 > nStartIndex ) || ( sText.getLength() <= nStartIndex ) - || ( 0 > nEndIndex ) || ( sText.getLength() <= nEndIndex ) ) - throw IndexOutOfBoundsException(); + return true; +} - if (!m_pTreeListBox) - return false; +sal_Bool SAL_CALL AccessibleListBoxEntry::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType ) +{ + return false; +} - sal_Int32 nLen = nEndIndex - nStartIndex + 1; - css::uno::Reference<css::datatransfer::clipboard::XClipboard> xClipBoard = m_pTreeListBox->GetClipboard(); - vcl::unohelper::TextDataObject::CopyStringTo(sText.copy(nStartIndex, nLen), xClipBoard); +// XAccessibleAction - return true; - } +sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleActionCount( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); - sal_Bool SAL_CALL AccessibleListBoxEntry::scrollSubstringTo( sal_Int32, sal_Int32, AccessibleScrollType ) + // three actions supported + SvTreeFlags treeFlag = m_pTreeListBox->GetTreeFlags(); + bool bHasButtons = (m_pTreeListBox->GetStyle() & WB_HASBUTTONS)!=0; + if( (treeFlag & SvTreeFlags::CHKBTN) && !bHasButtons) { - return false; + sal_Int16 role = getAccessibleRole(); + if ( role == AccessibleRole::CHECK_BOX ) + return 2; + else if ( role == AccessibleRole::LABEL ) + return 0; } + else + return 1; + return 0; +} - // XAccessibleAction +sal_Bool SAL_CALL AccessibleListBoxEntry::doAccessibleAction( sal_Int32 nIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - sal_Int32 SAL_CALL AccessibleListBoxEntry::getAccessibleActionCount( ) - { - ::osl::MutexGuard aGuard( m_aMutex ); + bool bRet = false; + CheckActionIndex(nIndex); + EnsureIsAlive(); - // three actions supported - SvTreeFlags treeFlag = m_pTreeListBox->GetTreeFlags(); - bool bHasButtons = (m_pTreeListBox->GetStyle() & WB_HASBUTTONS)!=0; - if( (treeFlag & SvTreeFlags::CHKBTN) && !bHasButtons) + SvTreeFlags treeFlag = m_pTreeListBox->GetTreeFlags(); + if( nIndex == 0 && (treeFlag & SvTreeFlags::CHKBTN) ) + { + if(getAccessibleRole() == AccessibleRole::CHECK_BOX) { - sal_Int16 role = getAccessibleRole(); - if ( role == AccessibleRole::CHECK_BOX ) - return 2; - else if ( role == AccessibleRole::LABEL ) - return 0; + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + SvButtonState state = m_pTreeListBox->GetCheckButtonState( pEntry ); + if ( state == SvButtonState::Checked ) + m_pTreeListBox->SetCheckButtonState(pEntry, SvButtonState::Unchecked); + else if (state == SvButtonState::Unchecked) + m_pTreeListBox->SetCheckButtonState(pEntry, SvButtonState::Checked); } - else - return 1; - return 0; } - - sal_Bool SAL_CALL AccessibleListBoxEntry::doAccessibleAction( sal_Int32 nIndex ) + else if( (nIndex == 1 && (treeFlag & SvTreeFlags::CHKBTN) ) || (nIndex == 0) ) { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - - bool bRet = false; - CheckActionIndex(nIndex); - EnsureIsAlive(); - - SvTreeFlags treeFlag = m_pTreeListBox->GetTreeFlags(); - if( nIndex == 0 && (treeFlag & SvTreeFlags::CHKBTN) ) - { - if(getAccessibleRole() == AccessibleRole::CHECK_BOX) - { - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - SvButtonState state = m_pTreeListBox->GetCheckButtonState( pEntry ); - if ( state == SvButtonState::Checked ) - m_pTreeListBox->SetCheckButtonState(pEntry, SvButtonState::Unchecked); - else if (state == SvButtonState::Unchecked) - m_pTreeListBox->SetCheckButtonState(pEntry, SvButtonState::Checked); - } - } - else if( (nIndex == 1 && (treeFlag & SvTreeFlags::CHKBTN) ) || (nIndex == 0) ) + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + if ( pEntry ) { - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) - { - if ( m_pTreeListBox->IsExpanded( pEntry ) ) - m_pTreeListBox->Collapse( pEntry ); - else - m_pTreeListBox->Expand( pEntry ); - bRet = true; - } + if ( m_pTreeListBox->IsExpanded( pEntry ) ) + m_pTreeListBox->Collapse( pEntry ); + else + m_pTreeListBox->Expand( pEntry ); + bRet = true; } - - return bRet; } - OUString SAL_CALL AccessibleListBoxEntry::getAccessibleActionDescription( sal_Int32 nIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return bRet; +} - CheckActionIndex(nIndex); - EnsureIsAlive(); +OUString SAL_CALL AccessibleListBoxEntry::getAccessibleActionDescription( sal_Int32 nIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - SvButtonState state = m_pTreeListBox->GetCheckButtonState( pEntry ); - SvTreeFlags treeFlag = m_pTreeListBox->GetTreeFlags(); - if(nIndex == 0 && (treeFlag & SvTreeFlags::CHKBTN)) + CheckActionIndex(nIndex); + EnsureIsAlive(); + + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + SvButtonState state = m_pTreeListBox->GetCheckButtonState( pEntry ); + SvTreeFlags treeFlag = m_pTreeListBox->GetTreeFlags(); + if(nIndex == 0 && (treeFlag & SvTreeFlags::CHKBTN)) + { + if(getAccessibleRole() == AccessibleRole::CHECK_BOX) { - if(getAccessibleRole() == AccessibleRole::CHECK_BOX) - { - if ( state == SvButtonState::Checked ) - return u"UnCheck"_ustr; - else if (state == SvButtonState::Unchecked) - return u"Check"_ustr; - } - else - { - //Sometimes, a List or Tree may have both checkbox and label at the same time - return OUString(); - } + if ( state == SvButtonState::Checked ) + return u"UnCheck"_ustr; + else if (state == SvButtonState::Unchecked) + return u"Check"_ustr; } - else if( (nIndex == 1 && (treeFlag & SvTreeFlags::CHKBTN)) || nIndex == 0 ) + else { - if( pEntry && (pEntry->HasChildren() || pEntry->HasChildrenOnDemand()) ) - return m_pTreeListBox->IsExpanded( pEntry ) ? - VclResId(STR_SVT_ACC_ACTION_COLLAPSE) : - VclResId(STR_SVT_ACC_ACTION_EXPAND); + //Sometimes, a List or Tree may have both checkbox and label at the same time return OUString(); - } - throw IndexOutOfBoundsException(); } - - Reference< XAccessibleKeyBinding > AccessibleListBoxEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) + else if( (nIndex == 1 && (treeFlag & SvTreeFlags::CHKBTN)) || nIndex == 0 ) { - Reference< XAccessibleKeyBinding > xRet; - CheckActionIndex(nIndex); - // ... which key? - return xRet; + if( pEntry && (pEntry->HasChildren() || pEntry->HasChildrenOnDemand()) ) + return m_pTreeListBox->IsExpanded( pEntry ) ? + VclResId(STR_SVT_ACC_ACTION_COLLAPSE) : + VclResId(STR_SVT_ACC_ACTION_EXPAND); + return OUString(); + } + throw IndexOutOfBoundsException(); +} - // XAccessibleSelection +Reference< XAccessibleKeyBinding > AccessibleListBoxEntry::getAccessibleActionKeyBinding( sal_Int32 nIndex ) +{ + Reference< XAccessibleKeyBinding > xRet; + CheckActionIndex(nIndex); + // ... which key? + return xRet; +} - void SAL_CALL AccessibleListBoxEntry::selectAccessibleChild( sal_Int64 nChildIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); +// XAccessibleSelection - EnsureIsAlive(); +void SAL_CALL AccessibleListBoxEntry::selectAccessibleChild( sal_Int64 nChildIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) - throw IndexOutOfBoundsException(); + EnsureIsAlive(); - SvTreeListEntry* pEntry = GetRealChild(nChildIndex); - if ( !pEntry ) - throw IndexOutOfBoundsException(); + if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) + throw IndexOutOfBoundsException(); - m_pTreeListBox->Select( pEntry ); - } + SvTreeListEntry* pEntry = GetRealChild(nChildIndex); + if ( !pEntry ) + throw IndexOutOfBoundsException(); - sal_Bool SAL_CALL AccessibleListBoxEntry::isAccessibleChildSelected( sal_Int64 nChildIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + m_pTreeListBox->Select( pEntry ); +} - EnsureIsAlive(); +sal_Bool SAL_CALL AccessibleListBoxEntry::isAccessibleChildSelected( sal_Int64 nChildIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) - throw IndexOutOfBoundsException(); + EnsureIsAlive(); - SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, nChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); + if (nChildIndex < 0 || nChildIndex >= getAccessibleChildCount()) + throw IndexOutOfBoundsException(); - return m_pTreeListBox->IsSelected( pEntry ); - } + SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, nChildIndex ); + if ( !pEntry ) + throw IndexOutOfBoundsException(); - void SAL_CALL AccessibleListBoxEntry::clearAccessibleSelection( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return m_pTreeListBox->IsSelected( pEntry ); +} - EnsureIsAlive(); +void SAL_CALL AccessibleListBoxEntry::clearAccessibleSelection( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - if ( !pParent ) - throw RuntimeException(u"AccessibleListBoxEntry::clearAccessibleSelection - pParent cannot be empty!"_ustr); - sal_Int32 nCount = m_pTreeListBox->GetLevelChildCount( pParent ); - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, i ); - if ( m_pTreeListBox->IsSelected( pEntry ) ) - m_pTreeListBox->Select( pEntry, false ); - } - } + EnsureIsAlive(); - void SAL_CALL AccessibleListBoxEntry::selectAllAccessibleChildren( ) + SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + if ( !pParent ) + throw RuntimeException(u"AccessibleListBoxEntry::clearAccessibleSelection - pParent cannot be empty!"_ustr); + sal_Int32 nCount = m_pTreeListBox->GetLevelChildCount( pParent ); + for ( sal_Int32 i = 0; i < nCount; ++i ) { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, i ); + if ( m_pTreeListBox->IsSelected( pEntry ) ) + m_pTreeListBox->Select( pEntry, false ); + } +} - EnsureIsAlive(); +void SAL_CALL AccessibleListBoxEntry::selectAllAccessibleChildren( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - if ( !pParent ) - throw RuntimeException(u"AccessibleListBoxEntry::selectAllAccessibleChildren - pParent cannot be empty!"_ustr); - sal_Int32 nCount = m_pTreeListBox->GetLevelChildCount( pParent ); - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, i ); - if ( !m_pTreeListBox->IsSelected( pEntry ) ) - m_pTreeListBox->Select( pEntry ); - } - } + EnsureIsAlive(); - sal_Int64 SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChildCount( ) + SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + if ( !pParent ) + throw RuntimeException(u"AccessibleListBoxEntry::selectAllAccessibleChildren - pParent cannot be empty!"_ustr); + sal_Int32 nCount = m_pTreeListBox->GetLevelChildCount( pParent ); + for ( sal_Int32 i = 0; i < nCount; ++i ) { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, i ); + if ( !m_pTreeListBox->IsSelected( pEntry ) ) + m_pTreeListBox->Select( pEntry ); + } +} - EnsureIsAlive(); +sal_Int64 SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChildCount( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - sal_Int64 nSelCount = 0; + EnsureIsAlive(); - SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - if ( !pParent ) - throw RuntimeException(u"AccessibleListBoxEntry::getSelectedAccessibleChildCount - pParent cannot be empty!"_ustr); - sal_Int32 nCount = m_pTreeListBox->GetLevelChildCount( pParent ); - for (sal_Int32 i = 0; i < nCount; ++i ) - { - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, i ); - if ( m_pTreeListBox->IsSelected( pEntry ) ) - ++nSelCount; - } + sal_Int64 nSelCount = 0; - return nSelCount; + SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + if ( !pParent ) + throw RuntimeException(u"AccessibleListBoxEntry::getSelectedAccessibleChildCount - pParent cannot be empty!"_ustr); + sal_Int32 nCount = m_pTreeListBox->GetLevelChildCount( pParent ); + for (sal_Int32 i = 0; i < nCount; ++i ) + { + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, i ); + if ( m_pTreeListBox->IsSelected( pEntry ) ) + ++nSelCount; } - Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return nSelCount; +} - EnsureIsAlive(); +Reference< XAccessible > SAL_CALL AccessibleListBoxEntry::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + + EnsureIsAlive(); + + if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) + throw IndexOutOfBoundsException(); - if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) - throw IndexOutOfBoundsException(); + Reference< XAccessible > xChild; + sal_Int64 nSelCount = 0; - Reference< XAccessible > xChild; - sal_Int64 nSelCount = 0; + SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + if ( !pParent ) + throw RuntimeException(u"AccessibleListBoxEntry::getSelectedAccessibleChild - pParent cannot be empty!"_ustr); + sal_Int32 nCount = m_pTreeListBox->GetLevelChildCount( pParent ); + for (sal_Int32 i = 0; i < nCount; ++i ) + { + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, i ); + if ( m_pTreeListBox->IsSelected( pEntry ) ) + ++nSelCount; - SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - if ( !pParent ) - throw RuntimeException(u"AccessibleListBoxEntry::getSelectedAccessibleChild - pParent cannot be empty!"_ustr); - sal_Int32 nCount = m_pTreeListBox->GetLevelChildCount( pParent ); - for (sal_Int32 i = 0; i < nCount; ++i ) + if ( nSelCount == ( nSelectedChildIndex + 1 ) ) { - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, i ); - if ( m_pTreeListBox->IsSelected( pEntry ) ) - ++nSelCount; - - if ( nSelCount == ( nSelectedChildIndex + 1 ) ) - { - rtl::Reference<AccessibleListBox> xListBox(m_wListBox); - assert(xListBox.is()); - xChild = xListBox->implGetAccessible(*pEntry).get(); - break; - } + rtl::Reference<AccessibleListBox> xListBox(m_wListBox); + assert(xListBox.is()); + xChild = xListBox->implGetAccessible(*pEntry).get(); + break; } - - return xChild; } - void SAL_CALL AccessibleListBoxEntry::deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); + return xChild; +} - EnsureIsAlive(); +void SAL_CALL AccessibleListBoxEntry::deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); - if (nSelectedChildIndex < 0 || nSelectedChildIndex >= getAccessibleChildCount()) - throw IndexOutOfBoundsException(); + EnsureIsAlive(); - SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, nSelectedChildIndex ); - if ( !pEntry ) - throw IndexOutOfBoundsException(); + if (nSelectedChildIndex < 0 || nSelectedChildIndex >= getAccessibleChildCount()) + throw IndexOutOfBoundsException(); - m_pTreeListBox->Select( pEntry, false ); - } - sal_Int32 SAL_CALL AccessibleListBoxEntry::getCaretPosition( ) - { - return -1; - } - sal_Bool SAL_CALL AccessibleListBoxEntry::setCaretPosition ( sal_Int32 nIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); + SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + SvTreeListEntry* pEntry = m_pTreeListBox->GetEntry( pParent, nSelectedChildIndex ); + if ( !pEntry ) + throw IndexOutOfBoundsException(); - if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); + m_pTreeListBox->Select( pEntry, false ); +} +sal_Int32 SAL_CALL AccessibleListBoxEntry::getCaretPosition( ) +{ + return -1; +} +sal_Bool SAL_CALL AccessibleListBoxEntry::setCaretPosition ( sal_Int32 nIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - return false; - } - sal_Unicode SAL_CALL AccessibleListBoxEntry::getCharacter( sal_Int32 nIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::implGetCharacter( implGetText(), nIndex ); - } - css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleListBoxEntry::getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); + if ( !implIsValidRange( nIndex, nIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); - OUString sText( implGetText() ); + return false; +} +sal_Unicode SAL_CALL AccessibleListBoxEntry::getCharacter( sal_Int32 nIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return OCommonAccessibleText::implGetCharacter( implGetText(), nIndex ); +} +css::uno::Sequence< css::beans::PropertyValue > SAL_CALL AccessibleListBoxEntry::getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - if ( !implIsValidIndex( nIndex, sText.getLength() ) ) - throw IndexOutOfBoundsException(); + OUString sText( implGetText() ); - return css::uno::Sequence< css::beans::PropertyValue >(); - } - sal_Int32 SAL_CALL AccessibleListBoxEntry::getCharacterCount( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return implGetText().getLength(); - } + if ( !implIsValidIndex( nIndex, sText.getLength() ) ) + throw IndexOutOfBoundsException(); - OUString SAL_CALL AccessibleListBoxEntry::getSelectedText( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OUString(); - } - sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionStart( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return 0; - } - sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionEnd( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return 0; - } - sal_Bool SAL_CALL AccessibleListBoxEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); + return css::uno::Sequence< css::beans::PropertyValue >(); +} +sal_Int32 SAL_CALL AccessibleListBoxEntry::getCharacterCount( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return implGetText().getLength(); +} - if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) - throw IndexOutOfBoundsException(); +OUString SAL_CALL AccessibleListBoxEntry::getSelectedText( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return OUString(); +} +sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionStart( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return 0; +} +sal_Int32 SAL_CALL AccessibleListBoxEntry::getSelectionEnd( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return 0; +} +sal_Bool SAL_CALL AccessibleListBoxEntry::setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - return false; - } - OUString SAL_CALL AccessibleListBoxEntry::getText( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return implGetText( ); - } - OUString SAL_CALL AccessibleListBoxEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ); - } - css::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); - } - css::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); - return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); - } - css::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( m_aMutex ); - EnsureIsAlive(); + if ( !implIsValidRange( nStartIndex, nEndIndex, implGetText().getLength() ) ) + throw IndexOutOfBoundsException(); - return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); - } + return false; +} +OUString SAL_CALL AccessibleListBoxEntry::getText( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return implGetText( ); +} +OUString SAL_CALL AccessibleListBoxEntry::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ); +} +css::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return OCommonAccessibleText::getTextAtIndex( nIndex ,aTextType); +} +css::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); + return OCommonAccessibleText::getTextBeforeIndex( nIndex ,aTextType); +} +css::accessibility::TextSegment SAL_CALL AccessibleListBoxEntry::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( m_aMutex ); + EnsureIsAlive(); - // XAccessibleValue + return OCommonAccessibleText::getTextBehindIndex( nIndex ,aTextType); +} +// XAccessibleValue - Any AccessibleListBoxEntry::getCurrentValue( ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - Any aValue; - sal_Int32 level = static_cast<sal_Int32>(m_aEntryPath.size()) - 1; - level = level < 0 ? 0: level; - aValue <<= level; - return aValue; - } +Any AccessibleListBoxEntry::getCurrentValue( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + Any aValue; + sal_Int32 level = static_cast<sal_Int32>(m_aEntryPath.size()) - 1; + level = level < 0 ? 0: level; + aValue <<= level; + return aValue; +} - sal_Bool AccessibleListBoxEntry::setCurrentValue( const Any& aNumber ) - { - ::osl::MutexGuard aGuard( m_aMutex ); +sal_Bool AccessibleListBoxEntry::setCurrentValue( const Any& aNumber ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); - bool bReturn = false; - SvTreeListBox* pBox = m_pTreeListBox; - if(getAccessibleRole() == AccessibleRole::CHECK_BOX) + + bool bReturn = false; + SvTreeListBox* pBox = m_pTreeListBox; + if(getAccessibleRole() == AccessibleRole::CHECK_BOX) + { + SvTreeListEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath ); + if ( pEntry ) { - SvTreeListEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath ); - if ( pEntry ) - { - sal_Int32 nValue(0), nValueMin(0), nValueMax(0); - aNumber >>= nValue; - getMinimumValue() >>= nValueMin; - getMaximumValue() >>= nValueMax; - - if ( nValue < nValueMin ) - nValue = nValueMin; - else if ( nValue > nValueMax ) - nValue = nValueMax; - - pBox->SetCheckButtonState(pEntry, static_cast<SvButtonState>(nValue) ); - bReturn = true; - } + sal_Int32 nValue(0), nValueMin(0), nValueMax(0); + aNumber >>= nValue; + getMinimumValue() >>= nValueMin; + getMaximumValue() >>= nValueMax; + + if ( nValue < nValueMin ) + nValue = nValueMin; + else if ( nValue > nValueMax ) + nValue = nValueMax; + + pBox->SetCheckButtonState(pEntry, static_cast<SvButtonState>(nValue) ); + bReturn = true; } - - return bReturn; } + return bReturn; +} - Any AccessibleListBoxEntry::getMaximumValue( ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - Any aValue; - // SvTreeListBox* pBox = m_pTreeListBox; - switch(getAccessibleRole()) - { - case AccessibleRole::CHECK_BOX: - aValue <<= sal_Int32(1); - break; - case AccessibleRole::LABEL: - default: - break; - } +Any AccessibleListBoxEntry::getMaximumValue( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); - return aValue; + Any aValue; + // SvTreeListBox* pBox = m_pTreeListBox; + switch(getAccessibleRole()) + { + case AccessibleRole::CHECK_BOX: + aValue <<= sal_Int32(1); + break; + case AccessibleRole::LABEL: + default: + break; } + return aValue; +} - Any AccessibleListBoxEntry::getMinimumValue( ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - Any aValue; - // SvTreeListBox* pBox = m_pTreeListBox; - switch(getAccessibleRole()) - { - case AccessibleRole::CHECK_BOX: - aValue <<= sal_Int32(0); - break; - case AccessibleRole::LABEL: - default: - break; - } +Any AccessibleListBoxEntry::getMinimumValue( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); - return aValue; + Any aValue; + // SvTreeListBox* pBox = m_pTreeListBox; + switch(getAccessibleRole()) + { + case AccessibleRole::CHECK_BOX: + aValue <<= sal_Int32(0); + break; + case AccessibleRole::LABEL: + default: + break; } - Any AccessibleListBoxEntry::getMinimumIncrement( ) - { - ::osl::MutexGuard aGuard( m_aMutex ); + return aValue; +} - Any aValue; - switch(getAccessibleRole()) - { - case AccessibleRole::CHECK_BOX: - aValue <<= sal_Int32(1); - break; - case AccessibleRole::LABEL: - default: - break; - } +Any AccessibleListBoxEntry::getMinimumIncrement( ) +{ + ::osl::MutexGuard aGuard( m_aMutex ); - return aValue; + Any aValue; + switch(getAccessibleRole()) + { + case AccessibleRole::CHECK_BOX: + aValue <<= sal_Int32(1); + break; + case AccessibleRole::LABEL: + default: + break; } - SvTreeListEntry* AccessibleListBoxEntry::GetRealChild(sal_Int32 nIndex) + return aValue; +} + +SvTreeListEntry* AccessibleListBoxEntry::GetRealChild(sal_Int32 nIndex) +{ + SvTreeListEntry* pEntry = nullptr; + SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); + if (pParent) { - SvTreeListEntry* pEntry = nullptr; - SvTreeListEntry* pParent = m_pTreeListBox->GetEntryFromPath( m_aEntryPath ); - if (pParent) + pEntry = m_pTreeListBox->GetEntry( pParent, nIndex ); + if ( !pEntry && getAccessibleChildCount() > 0 ) { + m_pTreeListBox->RequestingChildren(pParent); pEntry = m_pTreeListBox->GetEntry( pParent, nIndex ); - if ( !pEntry && getAccessibleChildCount() > 0 ) - { - m_pTreeListBox->RequestingChildren(pParent); - pEntry = m_pTreeListBox->GetEntry( pParent, nIndex ); - } } - return pEntry; } - -}// namespace accessibility - + return pEntry; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/accessibletablistbox.cxx b/vcl/source/accessibility/accessibletablistbox.cxx index 5a93ee8a5620..1902556f62c2 100644 --- a/vcl/source/accessibility/accessibletablistbox.cxx +++ b/vcl/source/accessibility/accessibletablistbox.cxx @@ -22,91 +22,83 @@ #include <vcl/toolkit/svtabbx.hxx> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -namespace accessibility -{ - - - // class AccessibleTabListBox ----------------------------------------------------- +// class AccessibleTabListBox ----------------------------------------------------- - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star; - // Ctor() and Dtor() +// Ctor() and Dtor() - AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) - :AccessibleBrowseBox( rxParent, nullptr, rBox ) - ,m_pTabListBox( &rBox ) +AccessibleTabListBox::AccessibleTabListBox( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) + :AccessibleBrowseBox( rxParent, nullptr, rBox ) + ,m_pTabListBox( &rBox ) +{ + osl_atomic_increment( &m_refCount ); { - osl_atomic_increment( &m_refCount ); - { - setCreator( this ); - } - osl_atomic_decrement( &m_refCount ); + setCreator( this ); } + osl_atomic_decrement( &m_refCount ); +} - AccessibleTabListBox::~AccessibleTabListBox() - { - if ( isAlive() ) - { - // increment ref count to prevent double call of Dtor - osl_atomic_increment( &m_refCount ); - dispose(); - } - } - - rtl::Reference<AccessibleBrowseBoxTable> AccessibleTabListBox::createAccessibleTable() +AccessibleTabListBox::~AccessibleTabListBox() +{ + if ( isAlive() ) { - return new AccessibleTabListBoxTable( this, *m_pTabListBox ); + // increment ref count to prevent double call of Dtor + osl_atomic_increment( &m_refCount ); + dispose(); } +} - // XInterface ----------------------------------------------------------------- - IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base ) - - // XTypeProvider -------------------------------------------------------------- - IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base ) +rtl::Reference<AccessibleBrowseBoxTable> AccessibleTabListBox::createAccessibleTable() +{ + return new AccessibleTabListBoxTable( this, *m_pTabListBox ); +} - // XAccessibleContext --------------------------------------------------------- +// XInterface ----------------------------------------------------------------- +IMPLEMENT_FORWARD_XINTERFACE2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base ) - sal_Int64 SAL_CALL AccessibleTabListBox::getAccessibleChildCount() - { - return 2; // header and table - } +// XTypeProvider -------------------------------------------------------------- +IMPLEMENT_FORWARD_XTYPEPROVIDER2( AccessibleTabListBox, AccessibleBrowseBox, AccessibleTabListBox_Base ) - Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext() - { - return this; - } +// XAccessibleContext --------------------------------------------------------- - Reference< XAccessible > SAL_CALL - AccessibleTabListBox::getAccessibleChild( sal_Int64 nChildIndex ) - { - SolarMethodGuard aGuard(getMutex()); - ensureIsAlive(); +sal_Int64 SAL_CALL AccessibleTabListBox::getAccessibleChildCount() +{ + return 2; // header and table +} - if ( nChildIndex < 0 || nChildIndex > 1 ) - throw IndexOutOfBoundsException(); +Reference< XAccessibleContext > SAL_CALL AccessibleTabListBox::getAccessibleContext() +{ + return this; +} - Reference< XAccessible > xRet; - if (nChildIndex == 0) - { - //! so far the actual implementation object only supports column headers - xRet = implGetHeaderBar( AccessibleBrowseBoxObjType::ColumnHeaderBar ); - } - else if (nChildIndex == 1) - xRet = implGetTable(); +Reference< XAccessible > SAL_CALL +AccessibleTabListBox::getAccessibleChild( sal_Int64 nChildIndex ) +{ + SolarMethodGuard aGuard(getMutex()); + ensureIsAlive(); - if ( !xRet.is() ) - throw RuntimeException(u"getAccessibleChild called with NULL xRet"_ustr,getXWeak()); + if ( nChildIndex < 0 || nChildIndex > 1 ) + throw IndexOutOfBoundsException(); - return xRet; + Reference< XAccessible > xRet; + if (nChildIndex == 0) + { + //! so far the actual implementation object only supports column headers + xRet = implGetHeaderBar( AccessibleBrowseBoxObjType::ColumnHeaderBar ); } + else if (nChildIndex == 1) + xRet = implGetTable(); + if ( !xRet.is() ) + throw RuntimeException(u"getAccessibleChild called with NULL xRet"_ustr,getXWeak()); -}// namespace accessibility - + return xRet; +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/accessibletablistboxtable.cxx b/vcl/source/accessibility/accessibletablistboxtable.cxx index 91f3dbec8f4b..3d29c8d15e6c 100644 --- a/vcl/source/accessibility/accessibletablistboxtable.cxx +++ b/vcl/source/accessibility/accessibletablistboxtable.cxx @@ -25,324 +25,316 @@ #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <vcl/toolkit/svtabbx.hxx> -namespace accessibility -{ - +// class AccessibleTabListBoxTable --------------------------------------------- - // class AccessibleTabListBoxTable --------------------------------------------- +using namespace ::com::sun::star::accessibility; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star; - using namespace ::com::sun::star::accessibility; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star; +// Ctor() and Dtor() - // Ctor() and Dtor() +AccessibleTabListBoxTable::AccessibleTabListBoxTable( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) : - AccessibleTabListBoxTable::AccessibleTabListBoxTable( const Reference< XAccessible >& rxParent, SvHeaderTabListBox& rBox ) : + AccessibleBrowseBoxTable( rxParent, rBox ), - AccessibleBrowseBoxTable( rxParent, rBox ), + m_pTabListBox ( &rBox ) - m_pTabListBox ( &rBox ) +{ + m_pTabListBox->AddEventListener( LINK( this, AccessibleTabListBoxTable, WindowEventListener ) ); +} +AccessibleTabListBoxTable::~AccessibleTabListBoxTable() +{ + if ( isAlive() ) { - m_pTabListBox->AddEventListener( LINK( this, AccessibleTabListBoxTable, WindowEventListener ) ); + m_pTabListBox = nullptr; + + // increment ref count to prevent double call of Dtor + osl_atomic_increment( &m_refCount ); + dispose(); } +} + +void AccessibleTabListBoxTable::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) +{ + if ( !isAlive() ) + return; - AccessibleTabListBoxTable::~AccessibleTabListBoxTable() + switch ( VclEventId nEventId = rVclWindowEvent.GetId(); nEventId ) { - if ( isAlive() ) + case VclEventId::ObjectDying : { + m_pTabListBox->RemoveEventListener( LINK( this, AccessibleTabListBoxTable, WindowEventListener ) ); m_pTabListBox = nullptr; - - // increment ref count to prevent double call of Dtor - osl_atomic_increment( &m_refCount ); - dispose(); + break; } - } - - void AccessibleTabListBoxTable::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) - { - if ( !isAlive() ) - return; - switch ( VclEventId nEventId = rVclWindowEvent.GetId(); nEventId ) + case VclEventId::ControlGetFocus : + case VclEventId::ControlLoseFocus : { - case VclEventId::ObjectDying : - { - m_pTabListBox->RemoveEventListener( LINK( this, AccessibleTabListBoxTable, WindowEventListener ) ); - m_pTabListBox = nullptr; - break; - } + uno::Any aOldValue, aNewValue; + if ( nEventId == VclEventId::ControlGetFocus ) + aNewValue <<= AccessibleStateType::FOCUSED; + else + aOldValue <<= AccessibleStateType::FOCUSED; + commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); + break; + } - case VclEventId::ControlGetFocus : - case VclEventId::ControlLoseFocus : + case VclEventId::ListboxSelect : + { + // First send an event that tells the listeners of a + // modified selection. The active descendant event is + // send after that so that the receiving AT has time to + // read the text or name of the active child. + commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); + if ( m_pTabListBox && m_pTabListBox->HasFocus() ) { - uno::Any aOldValue, aNewValue; - if ( nEventId == VclEventId::ControlGetFocus ) - aNewValue <<= AccessibleStateType::FOCUSED; - else - aOldValue <<= AccessibleStateType::FOCUSED; - commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); - break; + SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); + if ( pEntry ) + { + sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry ); + sal_uInt16 nCol = m_pTabListBox->GetCurrColumn(); + Reference< XAccessible > xChild = + m_pTabListBox->CreateAccessibleCell( nRow, nCol ); + uno::Any aOldValue, aNewValue; + aNewValue <<= xChild; + commitEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aNewValue, aOldValue ); + } } + break; + } + case VclEventId::WindowGetFocus : + { + uno::Any aOldValue, aNewValue; + aNewValue <<= AccessibleStateType::FOCUSED; + commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); + break; - case VclEventId::ListboxSelect : + } + case VclEventId::WindowLoseFocus : + { + uno::Any aOldValue, aNewValue; + aOldValue <<= AccessibleStateType::FOCUSED; + commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); + break; + } + case VclEventId::ListboxTreeSelect: { - // First send an event that tells the listeners of a - // modified selection. The active descendant event is - // send after that so that the receiving AT has time to - // read the text or name of the active child. - commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - if ( m_pTabListBox && m_pTabListBox->HasFocus() ) + SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); + if (pEntry) { - SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) + sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry ); + Reference< XAccessible > xChild = m_pTabListBox->CreateAccessibleCell( nRow, m_pTabListBox->GetCurrColumn() ); + TriState eState = TRISTATE_INDET; + if ( m_pTabListBox->IsCellCheckBox( nRow, m_pTabListBox->GetCurrColumn(), eState ) ) { - sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry ); - sal_uInt16 nCol = m_pTabListBox->GetCurrColumn(); - Reference< XAccessible > xChild = - m_pTabListBox->CreateAccessibleCell( nRow, nCol ); - uno::Any aOldValue, aNewValue; - aNewValue <<= xChild; - commitEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aNewValue, aOldValue ); + AccessibleCheckBoxCell* pCell = static_cast< AccessibleCheckBoxCell* >( xChild.get() ); + pCell->commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); + } + else + { + AccessibleBrowseBoxTableCell* pCell = static_cast< AccessibleBrowseBoxTableCell* >( xChild.get() ); + pCell->commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); } } - break; } - case VclEventId::WindowGetFocus : + break; + case VclEventId::ListboxTreeFocus: { - uno::Any aOldValue, aNewValue; - aNewValue <<= AccessibleStateType::FOCUSED; - commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); - break; - - } - case VclEventId::WindowLoseFocus : - { - uno::Any aOldValue, aNewValue; - aOldValue <<= AccessibleStateType::FOCUSED; - commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue, aOldValue ); - break; - } - case VclEventId::ListboxTreeSelect: + if ( m_pTabListBox && m_pTabListBox->HasFocus() ) { + uno::Any aOldValue, aNewValue; SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); - if (pEntry) + if ( pEntry ) { sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry ); - Reference< XAccessible > xChild = m_pTabListBox->CreateAccessibleCell( nRow, m_pTabListBox->GetCurrColumn() ); - TriState eState = TRISTATE_INDET; - if ( m_pTabListBox->IsCellCheckBox( nRow, m_pTabListBox->GetCurrColumn(), eState ) ) - { - AccessibleCheckBoxCell* pCell = static_cast< AccessibleCheckBoxCell* >( xChild.get() ); - pCell->commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - } - else - { - AccessibleBrowseBoxTableCell* pCell = static_cast< AccessibleBrowseBoxTableCell* >( xChild.get() ); - pCell->commitEvent( AccessibleEventId::SELECTION_CHANGED, Any(), Any() ); - } + m_xCurChild = m_pTabListBox->CreateAccessibleCell( nRow, m_pTabListBox->GetCurrColumn() ); + aNewValue <<= m_xCurChild; + commitEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aNewValue ,aOldValue); } - } - break; - case VclEventId::ListboxTreeFocus: - { - if ( m_pTabListBox && m_pTabListBox->HasFocus() ) + else { - uno::Any aOldValue, aNewValue; - SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) - { - sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry ); - m_xCurChild = m_pTabListBox->CreateAccessibleCell( nRow, m_pTabListBox->GetCurrColumn() ); - aNewValue <<= m_xCurChild; - commitEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aNewValue ,aOldValue); - } - else - { - aNewValue <<= AccessibleStateType::FOCUSED; - commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue ,aOldValue); - } + aNewValue <<= AccessibleStateType::FOCUSED; + commitEvent( AccessibleEventId::STATE_CHANGED, aNewValue ,aOldValue); } } - break; + } + break; - case VclEventId::CheckboxToggle : + case VclEventId::CheckboxToggle : + { + if ( m_pTabListBox && m_pTabListBox->HasFocus() ) { - if ( m_pTabListBox && m_pTabListBox->HasFocus() ) + SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); + if ( pEntry ) { - SvTreeListEntry* pEntry = static_cast< SvTreeListEntry* >( rVclWindowEvent.GetData() ); - if ( pEntry ) + sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry ); + sal_uInt16 nCol = m_pTabListBox->GetCurrColumn(); + TriState eState = TRISTATE_INDET; + if ( m_pTabListBox->IsCellCheckBox( nRow, nCol, eState ) ) { - sal_Int32 nRow = m_pTabListBox->GetEntryPos( pEntry ); - sal_uInt16 nCol = m_pTabListBox->GetCurrColumn(); - TriState eState = TRISTATE_INDET; - if ( m_pTabListBox->IsCellCheckBox( nRow, nCol, eState ) ) - { - Reference< XAccessible > xChild = - m_pTabListBox->CreateAccessibleCell( nRow, nCol ); - AccessibleCheckBoxCell* pCell = - static_cast< AccessibleCheckBoxCell* >( xChild.get() ); - pCell->SetChecked( SvHeaderTabListBox::IsItemChecked( pEntry, nCol ) ); - } + Reference< XAccessible > xChild = + m_pTabListBox->CreateAccessibleCell( nRow, nCol ); + AccessibleCheckBoxCell* pCell = + static_cast< AccessibleCheckBoxCell* >( xChild.get() ); + pCell->SetChecked( SvHeaderTabListBox::IsItemChecked( pEntry, nCol ) ); } } - break; } - - default: break; + break; } - } - IMPL_LINK( AccessibleTabListBoxTable, WindowEventListener, VclWindowEvent&, rEvent, void ) - { - OSL_ENSURE( rEvent.GetWindow() && m_pTabListBox, "no event window" ); - ProcessWindowEvent( rEvent ); + default: break; } - // helpers -------------------------------------------------------------------- +} - void AccessibleTabListBoxTable::ensureValidIndex( sal_Int64 _nIndex ) const - { - if ( ( _nIndex < 0 ) || ( _nIndex >= static_cast<sal_Int64>((implGetRowCount()) * static_cast<sal_Int64>(implGetColumnCount())))) - throw IndexOutOfBoundsException(); - } +IMPL_LINK( AccessibleTabListBoxTable, WindowEventListener, VclWindowEvent&, rEvent, void ) +{ + OSL_ENSURE( rEvent.GetWindow() && m_pTabListBox, "no event window" ); + ProcessWindowEvent( rEvent ); +} +// helpers -------------------------------------------------------------------- - void AccessibleTabListBoxTable::implSelectRow( sal_Int32 _nRow, bool _bSelect ) - { - if ( m_pTabListBox ) - m_pTabListBox->SelectRow(_nRow, _bSelect); - } +void AccessibleTabListBoxTable::ensureValidIndex( sal_Int64 _nIndex ) const +{ + if ( ( _nIndex < 0 ) || ( _nIndex >= static_cast<sal_Int64>((implGetRowCount()) * static_cast<sal_Int64>(implGetColumnCount())))) + throw IndexOutOfBoundsException(); +} - sal_Int32 AccessibleTabListBoxTable::implGetRowCount() const - { - return m_pTabListBox ? m_pTabListBox->GetEntryCount() : 0; - } +void AccessibleTabListBoxTable::implSelectRow( sal_Int32 _nRow, bool _bSelect ) +{ + if ( m_pTabListBox ) + m_pTabListBox->SelectRow(_nRow, _bSelect); +} - sal_Int32 AccessibleTabListBoxTable::implGetColumnCount() const - { - return m_pTabListBox ? m_pTabListBox->GetColumnCount() : 0; - } +sal_Int32 AccessibleTabListBoxTable::implGetRowCount() const +{ + return m_pTabListBox ? m_pTabListBox->GetEntryCount() : 0; +} - sal_Int32 AccessibleTabListBoxTable::implGetSelRowCount() const - { - return m_pTabListBox ? m_pTabListBox->GetSelectionCount() : 0; - } +sal_Int32 AccessibleTabListBoxTable::implGetColumnCount() const +{ + return m_pTabListBox ? m_pTabListBox->GetColumnCount() : 0; +} + +sal_Int32 AccessibleTabListBoxTable::implGetSelRowCount() const +{ + return m_pTabListBox ? m_pTabListBox->GetSelectionCount() : 0; +} - sal_Int32 AccessibleTabListBoxTable::implGetSelRow( sal_Int32 nSelRow ) const +sal_Int32 AccessibleTabListBoxTable::implGetSelRow( sal_Int32 nSelRow ) const +{ + if ( m_pTabListBox ) { - if ( m_pTabListBox ) + sal_Int32 nRow = 0; + SvTreeListEntry* pEntry = m_pTabListBox->FirstSelected(); + while ( pEntry ) { - sal_Int32 nRow = 0; - SvTreeListEntry* pEntry = m_pTabListBox->FirstSelected(); - while ( pEntry ) - { - if ( nRow == nSelRow ) - return m_pTabListBox->GetEntryPos( pEntry ); - pEntry = m_pTabListBox->NextSelected( pEntry ); - ++nRow; - } + if ( nRow == nSelRow ) + return m_pTabListBox->GetEntryPos( pEntry ); + pEntry = m_pTabListBox->NextSelected( pEntry ); + ++nRow; } - - return 0; } - // XInterface & XTypeProvider - - IMPLEMENT_FORWARD_XINTERFACE2(AccessibleTabListBoxTable, AccessibleBrowseBoxTable, AccessibleTabListBoxTableImplHelper) - IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleTabListBoxTable, AccessibleBrowseBoxTable, AccessibleTabListBoxTableImplHelper) + return 0; +} - // XServiceInfo +// XInterface & XTypeProvider - OUString AccessibleTabListBoxTable::getImplementationName() - { - return u"com.sun.star.comp.svtools.AccessibleTabListBoxTable"_ustr; - } +IMPLEMENT_FORWARD_XINTERFACE2(AccessibleTabListBoxTable, AccessibleBrowseBoxTable, AccessibleTabListBoxTableImplHelper) +IMPLEMENT_FORWARD_XTYPEPROVIDER2(AccessibleTabListBoxTable, AccessibleBrowseBoxTable, AccessibleTabListBoxTableImplHelper) - // XAccessibleSelection - - void SAL_CALL AccessibleTabListBoxTable::selectAccessibleChild( sal_Int64 nChildIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getMutex() ); +// XServiceInfo - ensureIsAlive(); - ensureValidIndex( nChildIndex ); +OUString AccessibleTabListBoxTable::getImplementationName() +{ + return u"com.sun.star.comp.svtools.AccessibleTabListBoxTable"_ustr; +} - implSelectRow( implGetRow( nChildIndex ), true ); - } +// XAccessibleSelection - sal_Bool SAL_CALL AccessibleTabListBoxTable::isAccessibleChildSelected( sal_Int64 nChildIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getMutex() ); +void SAL_CALL AccessibleTabListBoxTable::selectAccessibleChild( sal_Int64 nChildIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( getMutex() ); - ensureIsAlive(); - ensureValidIndex( nChildIndex ); + ensureIsAlive(); + ensureValidIndex( nChildIndex ); - return m_pTabListBox && m_pTabListBox->IsRowSelected(implGetRow(nChildIndex)); - } + implSelectRow( implGetRow( nChildIndex ), true ); +} - void SAL_CALL AccessibleTabListBoxTable::clearAccessibleSelection( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getMutex() ); +sal_Bool SAL_CALL AccessibleTabListBoxTable::isAccessibleChildSelected( sal_Int64 nChildIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( getMutex() ); - ensureIsAlive(); + ensureIsAlive(); + ensureValidIndex( nChildIndex ); - m_pTabListBox->SetNoSelection(); - } + return m_pTabListBox && m_pTabListBox->IsRowSelected(implGetRow(nChildIndex)); +} - void SAL_CALL AccessibleTabListBoxTable::selectAllAccessibleChildren( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getMutex() ); +void SAL_CALL AccessibleTabListBoxTable::clearAccessibleSelection( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( getMutex() ); - ensureIsAlive(); + ensureIsAlive(); - m_pTabListBox->SelectAll(); - } + m_pTabListBox->SetNoSelection(); +} - sal_Int64 SAL_CALL AccessibleTabListBoxTable::getSelectedAccessibleChildCount( ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getMutex() ); +void SAL_CALL AccessibleTabListBoxTable::selectAllAccessibleChildren( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( getMutex() ); - ensureIsAlive(); + ensureIsAlive(); - return static_cast<sal_Int64>(implGetColumnCount()) * static_cast<sal_Int64>(implGetSelRowCount()); - } + m_pTabListBox->SelectAll(); +} - Reference< XAccessible > SAL_CALL AccessibleTabListBoxTable::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getMutex() ); +sal_Int64 SAL_CALL AccessibleTabListBoxTable::getSelectedAccessibleChildCount( ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( getMutex() ); - ensureIsAlive(); + ensureIsAlive(); - const sal_Int32 nColCount = implGetColumnCount(); + return static_cast<sal_Int64>(implGetColumnCount()) * static_cast<sal_Int64>(implGetSelRowCount()); +} - if (nColCount == 0) - throw IndexOutOfBoundsException(); +Reference< XAccessible > SAL_CALL AccessibleTabListBoxTable::getSelectedAccessibleChild( sal_Int64 nSelectedChildIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( getMutex() ); - const sal_Int32 nRow = implGetSelRow(nSelectedChildIndex / nColCount); - const sal_Int32 nColumn = nSelectedChildIndex % nColCount; - return getAccessibleCellAt( nRow, nColumn ); - } + ensureIsAlive(); - void SAL_CALL AccessibleTabListBoxTable::deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) - { - SolarMutexGuard aSolarGuard; - ::osl::MutexGuard aGuard( getMutex() ); + const sal_Int32 nColCount = implGetColumnCount(); - ensureIsAlive(); - ensureValidIndex( nSelectedChildIndex ); + if (nColCount == 0) + throw IndexOutOfBoundsException(); - implSelectRow( implGetRow( nSelectedChildIndex ), false ); - } + const sal_Int32 nRow = implGetSelRow(nSelectedChildIndex / nColCount); + const sal_Int32 nColumn = nSelectedChildIndex % nColCount; + return getAccessibleCellAt( nRow, nColumn ); +} +void SAL_CALL AccessibleTabListBoxTable::deselectAccessibleChild( sal_Int64 nSelectedChildIndex ) +{ + SolarMutexGuard aSolarGuard; + ::osl::MutexGuard aGuard( getMutex() ); -}// namespace accessibility + ensureIsAlive(); + ensureValidIndex( nSelectedChildIndex ); + implSelectRow( implGetRow( nSelectedChildIndex ), false ); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/textwindowaccessibility.cxx b/vcl/source/accessibility/textwindowaccessibility.cxx index 2868e865b35a..432142d99dff 100644 --- a/vcl/source/accessibility/textwindowaccessibility.cxx +++ b/vcl/source/accessibility/textwindowaccessibility.cxx @@ -48,8 +48,6 @@ #include <numeric> #include <vector> -namespace accessibility -{ void SfxListenerGuard::startListening(::SfxBroadcaster & rNotifier) { assert(m_pNotifier == nullptr && "called more than once"); @@ -2221,6 +2219,4 @@ css::uno::Any Document::mapFontWeight(::FontWeight nWeight) : WEIGHT_BLACK; } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/accessibility/vclxaccessiblelistitem.cxx b/vcl/source/accessibility/vclxaccessiblelistitem.cxx index 6a8827e78eeb..6465f627a717 100644 --- a/vcl/source/accessibility/vclxaccessiblelistitem.cxx +++ b/vcl/source/accessibility/vclxaccessiblelistitem.cxx @@ -67,7 +67,7 @@ VCLXAccessibleListItem::VCLXAccessibleListItem(sal_Int32 _nIndexInParent, rtl::R , m_xParent(std::move(_xParent)) { assert(m_xParent.is()); - ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent->getListBoxHelper(); + IComboListBoxHelper* pListBoxHelper = m_xParent->getListBoxHelper(); if (pListBoxHelper) m_sEntryText = pListBoxHelper->GetEntry(static_cast<sal_uInt16>(_nIndexInParent)); } @@ -246,7 +246,7 @@ sal_Int64 SAL_CALL VCLXAccessibleListItem::getAccessibleStateSet( ) { nStateSet |= AccessibleStateType::TRANSIENT; - ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; + IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; if (pListBoxHelper && pListBoxHelper->IsEnabled()) { nStateSet |= AccessibleStateType::SELECTABLE; @@ -284,7 +284,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::containsPoint( const awt::Point& _aPoi std::unique_lock aGuard( m_aMutex ); bool bInside = false; - ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; + IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; if (pListBoxHelper) { tools::Rectangle aRect(pListBoxHelper->GetBoundingRectangle(static_cast<sal_uInt16>(m_nIndexInParent))); @@ -305,7 +305,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleListItem::getBounds( ) std::unique_lock aGuard( m_aMutex ); awt::Rectangle aRect; - ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; + IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; if (pListBoxHelper) aRect = vcl::unohelper::ConvertToAWTRect( pListBoxHelper->GetBoundingRectangle(static_cast<sal_uInt16>(m_nIndexInParent))); @@ -319,7 +319,7 @@ awt::Point SAL_CALL VCLXAccessibleListItem::getLocation( ) std::unique_lock aGuard( m_aMutex ); Point aPoint(0,0); - ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; + IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; if (pListBoxHelper) { tools::Rectangle aRect = pListBoxHelper->GetBoundingRectangle( static_cast<sal_uInt16>(m_nIndexInParent) ); @@ -334,7 +334,7 @@ awt::Point SAL_CALL VCLXAccessibleListItem::getLocationOnScreen( ) std::unique_lock aGuard( m_aMutex ); Point aPoint(0,0); - ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; + IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; if (pListBoxHelper) { tools::Rectangle aRect = pListBoxHelper->GetBoundingRectangle(static_cast<sal_uInt16>(m_nIndexInParent)); @@ -350,7 +350,7 @@ awt::Size SAL_CALL VCLXAccessibleListItem::getSize( ) std::unique_lock aGuard( m_aMutex ); Size aSize; - ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; + IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; if (pListBoxHelper) aSize = pListBoxHelper->GetBoundingRectangle( static_cast<sal_uInt16>(m_nIndexInParent) ).GetSize(); @@ -408,7 +408,7 @@ awt::Rectangle SAL_CALL VCLXAccessibleListItem::getCharacterBounds( sal_Int32 nI throw IndexOutOfBoundsException(); awt::Rectangle aBounds( 0, 0, 0, 0 ); - ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; + IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; if (pListBoxHelper) { tools::Rectangle aCharRect = pListBoxHelper->GetEntryCharacterBounds( m_nIndexInParent, nIndex ); @@ -433,7 +433,7 @@ sal_Int32 SAL_CALL VCLXAccessibleListItem::getIndexAtPoint( const awt::Point& aP std::unique_lock aGuard( m_aMutex ); sal_Int32 nIndex = -1; - ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; + IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; if (pListBoxHelper) { sal_Int32 nPos = LISTBOX_ENTRY_NOTFOUND; @@ -525,7 +525,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_I checkIndex_Impl( nEndIndex, m_sEntryText ); bool bRet = false; - ::accessibility::IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; + IComboListBoxHelper* pListBoxHelper = m_xParent.is() ? m_xParent->getListBoxHelper() : nullptr; if (pListBoxHelper) { Reference< datatransfer::clipboard::XClipboard > xClipboard = pListBoxHelper->GetClipboard(); diff --git a/vcl/source/treelist/svtabbx.cxx b/vcl/source/treelist/svtabbx.cxx index 4fc5a1b5d838..238b04848c13 100644 --- a/vcl/source/treelist/svtabbx.cxx +++ b/vcl/source/treelist/svtabbx.cxx @@ -1165,7 +1165,7 @@ Reference< XAccessible > SvHeaderTabListBox::CreateAccessible() Reference< XAccessible > xAccParent = pParent->GetAccessible(); if ( xAccParent.is() ) { - m_pAccessible = new accessibility::AccessibleTabListBox(xAccParent, *this); + m_pAccessible = new AccessibleTabListBox(xAccParent, *this); xAccessible = m_pAccessible->getMyself(); } } |