Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTITEM_HXX
21 : : #define ACCESSIBILITY_STANDARD_VCLXACCESSIBLELISTITEM_HXX
22 : :
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 <comphelper/broadcasthelper.hxx>
32 : : #include <comphelper/accessibletexthelper.hxx>
33 : :
34 : : // forward ---------------------------------------------------------------
35 : :
36 : : namespace com { namespace sun { namespace star { namespace awt {
37 : : struct Point;
38 : : struct Rectangle;
39 : : struct Size;
40 : : class XFocusListener;
41 : : } } } }
42 : :
43 : : namespace accessibility
44 : : {
45 : : class IComboListBoxHelper;
46 : : }
47 : :
48 : : // class VCLXAccessibleListItem ------------------------------------------
49 : :
50 : : typedef ::cppu::WeakAggComponentImplHelper6< ::com::sun::star::accessibility::XAccessible
51 : : , ::com::sun::star::accessibility::XAccessibleContext
52 : : , ::com::sun::star::accessibility::XAccessibleComponent
53 : : , ::com::sun::star::accessibility::XAccessibleEventBroadcaster
54 : : , ::com::sun::star::accessibility::XAccessibleText
55 : : , ::com::sun::star::lang::XServiceInfo > VCLXAccessibleListItem_BASE;
56 : :
57 : : /** the class OAccessibleListBoxEntry represents the base class for an accessible object of a listbox entry
58 : : */
59 : : class VCLXAccessibleListItem : public ::comphelper::OBaseMutex,
60 : : public ::comphelper::OCommonAccessibleText,
61 : : public VCLXAccessibleListItem_BASE
62 : : {
63 : : private:
64 : : ::rtl::OUString m_sEntryText;
65 : : sal_Int32 m_nIndexInParent;
66 : : sal_Bool m_bSelected;
67 : : sal_Bool m_bVisible;
68 : :
69 : : protected:
70 : : /// client id in the AccessibleEventNotifier queue
71 : : sal_uInt32 m_nClientId;
72 : : ::accessibility::IComboListBoxHelper* m_pListBoxHelper;
73 : :
74 : : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xParent;
75 : : ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > m_xParentContext;
76 : :
77 : : private:
78 : : /** notifies all listeners that this object has changed
79 : : @param _nEventId
80 : : is the event id
81 : : @param _aOldValue
82 : : is the old value
83 : : @param _aNewValue
84 : : is the new value
85 : : */
86 : : void NotifyAccessibleEvent( sal_Int16 _nEventId,
87 : : const ::com::sun::star::uno::Any& _aOldValue,
88 : : const ::com::sun::star::uno::Any& _aNewValue );
89 : :
90 : : protected:
91 : : virtual ~VCLXAccessibleListItem();
92 : : /** this function is called upon disposing the component
93 : : */
94 : : virtual void SAL_CALL disposing();
95 : :
96 : : // OCommonAccessibleText
97 : : virtual ::rtl::OUString implGetText();
98 : : virtual ::com::sun::star::lang::Locale implGetLocale();
99 : : virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
100 : :
101 : : public:
102 : : /** OAccessibleBase needs a valid view
103 : : @param _pListBoxHelper
104 : : is the list- or combobox for which we implement an accessible object
105 : : @param _nIndexInParent
106 : : is the position of the entry inside the listbox
107 : : @param _xParent
108 : : is our parent accessible object
109 : : */
110 : : VCLXAccessibleListItem( ::accessibility::IComboListBoxHelper* _pListBoxHelper,
111 : : sal_Int32 _nIndexInParent,
112 : : const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent );
113 : :
114 : :
115 : 0 : inline sal_Bool IsSelected() const { return m_bSelected; }
116 : : void SetSelected( sal_Bool _bSelected );
117 : : void SetVisible( sal_Bool _bVisible );
118 : 0 : inline bool DecrementIndexInParent() { OSL_ENSURE(m_nIndexInParent != 0,"Invalid call!");--m_nIndexInParent; return true;}
119 : 0 : inline bool IncrementIndexInParent() { ++m_nIndexInParent; return true;}
120 : :
121 : : // XInterface
122 : : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
123 : : virtual void SAL_CALL acquire( ) throw();
124 : : virtual void SAL_CALL release( ) throw();
125 : :
126 : : // XTypeProvider
127 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException);
128 : : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
129 : :
130 : : // XServiceInfo
131 : : virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
132 : : virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
133 : : virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
134 : :
135 : : // XAccessible
136 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException);
137 : :
138 : : // XAccessibleContext
139 : : virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException);
140 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException);
141 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException);
142 : : virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException);
143 : : virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException);
144 : : virtual ::rtl::OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException);
145 : : virtual ::rtl::OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException);
146 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
147 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException);
148 : : virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
149 : :
150 : : // XAccessibleComponent
151 : : virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
152 : : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
153 : : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException);
154 : : virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException);
155 : : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException);
156 : : virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException);
157 : : virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException);
158 : : virtual sal_Int32 SAL_CALL getForeground (void) throw (::com::sun::star::uno::RuntimeException);
159 : : virtual sal_Int32 SAL_CALL getBackground (void) throw (::com::sun::star::uno::RuntimeException);
160 : :
161 : : // XAccessibleText
162 : : virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
163 : : virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
164 : : virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
165 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
166 : : virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
167 : : virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
168 : : virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
169 : : virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
170 : : virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
171 : : virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
172 : : virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
173 : : virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
174 : : virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
175 : : virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
176 : : virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
177 : : virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
178 : : virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
179 : :
180 : : // XAccessibleEventBroadcaster
181 : : using cppu::WeakAggComponentImplHelperBase::addEventListener;
182 : : using cppu::WeakAggComponentImplHelperBase::removeEventListener;
183 : : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
184 : : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
185 : : };
186 : :
187 : : #endif // ACCESSIBILITY_STANDARD_ACCESSIBLELISTBOXENTRY_HXX
188 : :
189 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|