xref: /AOO41X/main/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx (revision 67e470dafe1997e73f56ff7ff4878983707e3e07)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX
24 #define ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX
25 
26 #include <comphelper/accessibletexthelper.hxx>
27 #include <cppuhelper/implbase2.hxx>
28 #include "accessibility/extended/AccessibleGridControlBase.hxx"
29 #include <svtools/accessibletable.hxx>
30 
31 namespace accessibility
32 {
33     class AccessibleGridControlCell : public AccessibleGridControlBase
34     {
35     private:
36         sal_Int32               m_nRowPos;      // the row number of the table cell
37         sal_Int32               m_nColPos;      // the column id of the table cell
38 
39     protected:
40         // attribute access
getRowPos() const41         inline sal_Int32    getRowPos( ) const { return m_nRowPos; }
getColumnPos() const42         inline sal_Int32    getColumnPos( ) const { return m_nColPos; }
43 
44         // XAccessibleComponent
45         virtual void SAL_CALL grabFocus() throw ( ::com::sun::star::uno::RuntimeException );
46 
47     protected:
48         AccessibleGridControlCell(
49             const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
50             ::svt::table::IAccessibleTable& _rTable,
51             sal_Int32 _nRowPos,
52             sal_uInt16 _nColPos,
53             ::svt::table::AccessibleTableControlObjType _eType
54         );
55 
56         virtual ~AccessibleGridControlCell();
57 
58     private:
59         AccessibleGridControlCell();                                                    // never implemented
60         AccessibleGridControlCell( const AccessibleGridControlCell& );              // never implemented
61         AccessibleGridControlCell& operator=( const AccessibleGridControlCell& );   // never implemented
62     };
63 
64     typedef ::cppu::ImplHelper2 <   ::com::sun::star::accessibility::XAccessibleText
65                                 ,   ::com::sun::star::accessibility::XAccessible
66                                 >   AccessibleTextHelper_BASE;
67     // implementation of a table cell of GridControl
68     class AccessibleGridControlTableCell    :public AccessibleGridControlCell
69                                         ,public AccessibleTextHelper_BASE
70                                         ,public ::comphelper::OCommonAccessibleText
71     {
72     protected:
73         // OCommonAccessibleText
74         virtual ::rtl::OUString                 implGetText();
75         virtual ::com::sun::star::lang::Locale  implGetLocale();
76         virtual void                            implGetSelection( sal_Int32& nStartIndex, sal_Int32& nEndIndex );
77         virtual Rectangle implGetBoundingBox();
78         virtual Rectangle implGetBoundingBoxOnScreen();
79 
80     public:
81         AccessibleGridControlTableCell( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _rxParent,
82                                     ::svt::table::IAccessibleTable& _rTable,
83                                     sal_Int32 _nRowId,
84                                     sal_uInt16 _nColId,
85                                     svt::table::AccessibleTableControlObjType  eObjType);
86 
87         // XInterface -------------------------------------------------------------
88 
89         /** Queries for a new interface. */
90         ::com::sun::star::uno::Any SAL_CALL queryInterface(
91                 const ::com::sun::star::uno::Type& rType )
92             throw ( ::com::sun::star::uno::RuntimeException );
93 
94         /** Aquires the object (calls acquire() on base class). */
95         virtual void SAL_CALL acquire() throw ();
96 
97         /** Releases the object (calls release() on base class). */
98         virtual void SAL_CALL release() throw ();
99 
100         /** @return  The index of this object among the parent's children. */
101         virtual sal_Int32 SAL_CALL getAccessibleIndexInParent()
102             throw ( ::com::sun::star::uno::RuntimeException );
103 
104         /** @return
105                 The name of this class.
106         */
107         virtual ::rtl::OUString SAL_CALL getImplementationName()
108             throw ( ::com::sun::star::uno::RuntimeException );
109 
110         /** @return
111                 The count of visible children.
112         */
113         virtual sal_Int32 SAL_CALL getAccessibleChildCount()
114             throw ( ::com::sun::star::uno::RuntimeException );
115 
116         /** @return
117                 The XAccessible interface of the specified child.
118         */
119         virtual ::com::sun::star::uno::Reference<
120             ::com::sun::star::accessibility::XAccessible > SAL_CALL
121             getAccessibleChild( sal_Int32 nChildIndex )
122                 throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
123                         ::com::sun::star::uno::RuntimeException );
124 
125         /** Creates a new AccessibleStateSetHelper and fills it with states of the
126             current object.
127             @return
128                 A filled AccessibleStateSetHelper.
129         */
130         ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
131 
132         // XAccessible ------------------------------------------------------------
133 
134         /** @return  The XAccessibleContext interface of this object. */
135         virtual ::com::sun::star::uno::Reference<
136             ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
137         getAccessibleContext()
138             throw ( ::com::sun::star::uno::RuntimeException );
139 
140         // XAccessibleText
141         virtual sal_Int32 SAL_CALL getCaretPosition() throw (::com::sun::star::uno::RuntimeException);
142         virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
143         virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
144         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);
145         virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
146         virtual sal_Int32 SAL_CALL getCharacterCount() throw (::com::sun::star::uno::RuntimeException);
147         virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
148         virtual ::rtl::OUString SAL_CALL getSelectedText() throw (::com::sun::star::uno::RuntimeException);
149         virtual sal_Int32 SAL_CALL getSelectionStart() throw (::com::sun::star::uno::RuntimeException);
150         virtual sal_Int32 SAL_CALL getSelectionEnd() throw (::com::sun::star::uno::RuntimeException);
151         virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
152         virtual ::rtl::OUString SAL_CALL getText() throw (::com::sun::star::uno::RuntimeException);
153         virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
154         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);
155         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);
156         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);
157         virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
158     };
159 }
160 #endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX
161 
162