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 : 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() SAL_OVERRIDE;
95 :
96 : // OCommonAccessibleText
97 : virtual OUString implGetText() SAL_OVERRIDE;
98 : virtual ::com::sun::star::lang::Locale implGetLocale() SAL_OVERRIDE;
99 : virtual void implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex ) SAL_OVERRIDE;
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 : void NotifyAccessibleEvent( sal_Int16 _nEventId, const ::com::sun::star::uno::Any& _aOldValue, const ::com::sun::star::uno::Any& _aNewValue );
115 :
116 0 : inline sal_Bool IsSelected() const { return m_bSelected; }
117 : void SetSelected( sal_Bool _bSelected );
118 : void SetVisible( sal_Bool _bVisible );
119 : inline bool DecrementIndexInParent() { OSL_ENSURE(m_nIndexInParent != 0,"Invalid call!");--m_nIndexInParent; return true;}
120 : inline bool IncrementIndexInParent() { ++m_nIndexInParent; return true;}
121 :
122 : // XInterface
123 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
124 : virtual void SAL_CALL acquire( ) throw() SAL_OVERRIDE;
125 : virtual void SAL_CALL release( ) throw() SAL_OVERRIDE;
126 :
127 : // XTypeProvider
128 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
129 : virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
130 :
131 : // XServiceInfo
132 : virtual OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
133 : virtual sal_Bool SAL_CALL supportsService( const OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
134 : virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
135 :
136 : // XAccessible
137 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
138 :
139 : // XAccessibleContext
140 : virtual sal_Int32 SAL_CALL getAccessibleChildCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
141 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
143 : virtual sal_Int32 SAL_CALL getAccessibleIndexInParent( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
144 : virtual sal_Int16 SAL_CALL getAccessibleRole( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
145 : virtual OUString SAL_CALL getAccessibleDescription( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 : virtual OUString SAL_CALL getAccessibleName( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
147 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
148 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 : virtual ::com::sun::star::lang::Locale SAL_CALL getLocale( ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
150 :
151 : // XAccessibleComponent
152 : virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
153 : 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, std::exception) SAL_OVERRIDE;
154 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 : virtual ::com::sun::star::awt::Point SAL_CALL getLocation( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
156 : virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
157 : virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
158 : virtual void SAL_CALL grabFocus( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 : virtual sal_Int32 SAL_CALL getForeground (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
160 : virtual sal_Int32 SAL_CALL getBackground (void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
161 :
162 : // XAccessibleText
163 : virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
164 : virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
165 : virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
166 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 : virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
168 : virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
169 : virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
170 : virtual OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 : virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
172 : virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
173 : virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 : virtual OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
175 : virtual OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
176 : 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, std::exception) SAL_OVERRIDE;
177 : 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, std::exception) SAL_OVERRIDE;
178 : 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, std::exception) SAL_OVERRIDE;
179 : virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
180 :
181 : // XAccessibleEventBroadcaster
182 : virtual void SAL_CALL addAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
183 : virtual void SAL_CALL removeAccessibleEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
184 : };
185 :
186 : #endif // ACCESSIBILITY_STANDARD_ACCESSIBLELISTBOXENTRY_HXX
187 :
188 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|