Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / accessibility / inc / standard / vclxaccessiblelistitem.hxx
blob02eb11641755beba00b8f69dca01a7f7263175e7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_ACCESSIBILITY_INC_STANDARD_VCLXACCESSIBLELISTITEM_HXX
21 #define INCLUDED_ACCESSIBILITY_INC_STANDARD_VCLXACCESSIBLELISTITEM_HXX
23 #include <com/sun/star/accessibility/XAccessible.hpp>
24 #include <com/sun/star/accessibility/XAccessibleComponent.hpp>
25 #include <com/sun/star/accessibility/XAccessibleContext.hpp>
26 #include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
27 #include <com/sun/star/accessibility/XAccessibleText.hpp>
28 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
29 #include <com/sun/star/lang/XServiceInfo.hpp>
30 #include <cppuhelper/compbase6.hxx>
31 #include <cppuhelper/basemutex.hxx>
32 #include <comphelper/accessibletexthelper.hxx>
33 #include <standard/vclxaccessiblelist.hxx>
35 // forward ---------------------------------------------------------------
37 namespace com { namespace sun { namespace star { namespace awt {
38 struct Point;
39 struct Rectangle;
40 struct Size;
41 class XFocusListener;
42 } } } }
44 // class VCLXAccessibleListItem ------------------------------------------
46 typedef ::cppu::WeakAggComponentImplHelper6< css::accessibility::XAccessible
47 , css::accessibility::XAccessibleContext
48 , css::accessibility::XAccessibleComponent
49 , css::accessibility::XAccessibleEventBroadcaster
50 , css::accessibility::XAccessibleText
51 , css::lang::XServiceInfo > VCLXAccessibleListItem_BASE;
53 /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry
55 class VCLXAccessibleListItem final : public ::cppu::BaseMutex,
56 public ::comphelper::OCommonAccessibleText,
57 public VCLXAccessibleListItem_BASE
59 private:
60 OUString m_sEntryText;
61 sal_Int32 m_nIndexInParent;
62 bool m_bSelected;
63 bool m_bVisible;
65 /// client id in the AccessibleEventNotifier queue
66 sal_uInt32 m_nClientId;
68 rtl::Reference< VCLXAccessibleList > m_xParent;
69 css::uno::Reference< css::accessibility::XAccessibleContext > m_xParentContext;
71 virtual ~VCLXAccessibleListItem() override = default;
72 /** this function is called upon disposing the component
74 virtual void SAL_CALL disposing() override;
76 // OCommonAccessibleText
77 virtual OUString implGetText() override;
78 virtual css::lang::Locale implGetLocale() override;
79 virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) override;
81 public:
82 /** OAccessibleBase needs a valid view
83 @param _nIndexInParent
84 is the position of the entry inside the listbox
85 @param _xParent
86 is our parent accessible object
88 VCLXAccessibleListItem(sal_Int32 _nIndexInParent,
89 const rtl::Reference< VCLXAccessibleList >& _xParent);
91 void NotifyAccessibleEvent( sal_Int16 _nEventId, const css::uno::Any& _aOldValue, const css::uno::Any& _aNewValue );
93 bool IsSelected() const { return m_bSelected; }
94 void SetSelected( bool _bSelected );
95 void SetVisible( bool _bVisible );
97 // XTypeProvider
98 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
100 // XServiceInfo
101 virtual OUString SAL_CALL getImplementationName() override;
102 virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) override;
103 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
105 // XAccessible
106 virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) override;
108 // XAccessibleContext
109 virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) override;
110 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) override;
111 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) override;
112 virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) override;
113 virtual sal_Int16 SAL_CALL getAccessibleRole( ) override;
114 virtual OUString SAL_CALL getAccessibleDescription( ) override;
115 virtual OUString SAL_CALL getAccessibleName( ) override;
116 virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
117 virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) override;
118 virtual css::lang::Locale SAL_CALL getLocale( ) override;
120 // XAccessibleComponent
121 virtual sal_Bool SAL_CALL containsPoint( const css::awt::Point& aPoint ) override;
122 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const css::awt::Point& aPoint ) override;
123 virtual css::awt::Rectangle SAL_CALL getBounds( ) override;
124 virtual css::awt::Point SAL_CALL getLocation( ) override;
125 virtual css::awt::Point SAL_CALL getLocationOnScreen( ) override;
126 virtual css::awt::Size SAL_CALL getSize( ) override;
127 virtual void SAL_CALL grabFocus( ) override;
128 virtual sal_Int32 SAL_CALL getForeground() override;
129 virtual sal_Int32 SAL_CALL getBackground() override;
131 // XAccessibleText
132 virtual sal_Int32 SAL_CALL getCaretPosition() override;
133 virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) override;
134 virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) override;
135 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const css::uno::Sequence< OUString >& aRequestedAttributes ) override;
136 virtual css::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) override;
137 virtual sal_Int32 SAL_CALL getCharacterCount() override;
138 virtual sal_Int32 SAL_CALL getIndexAtPoint( const css::awt::Point& aPoint ) override;
139 virtual OUString SAL_CALL getSelectedText() override;
140 virtual sal_Int32 SAL_CALL getSelectionStart() override;
141 virtual sal_Int32 SAL_CALL getSelectionEnd() override;
142 virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
143 virtual OUString SAL_CALL getText() override;
144 virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
145 virtual css::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
146 virtual css::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
147 virtual css::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) override;
148 virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
150 // XAccessibleEventBroadcaster
151 virtual void SAL_CALL addAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
152 virtual void SAL_CALL removeAccessibleEventListener( const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override;
155 #endif // ACCESSIBILITY_STANDARD_ACCESSIBLELISTBOXENTRY_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */