xref: /trunk/main/accessibility/inc/accessibility/extended/AccessibleGridControlTableCell.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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();
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 
93         /** Aquires the object (calls acquire() on base class). */
94         virtual void SAL_CALL acquire() throw ();
95 
96         /** Releases the object (calls release() on base class). */
97         virtual void SAL_CALL release() throw ();
98 
99         /** @return  The index of this object among the parent's children. */
100         virtual sal_Int32 SAL_CALL getAccessibleIndexInParent();
101 
102         /** @return
103                 The name of this class.
104         */
105         virtual ::rtl::OUString SAL_CALL getImplementationName();
106 
107         /** @return
108                 The count of visible children.
109         */
110         virtual sal_Int32 SAL_CALL getAccessibleChildCount();
111 
112         /** @return
113                 The XAccessible interface of the specified child.
114         */
115         virtual ::com::sun::star::uno::Reference<
116             ::com::sun::star::accessibility::XAccessible > SAL_CALL
117             getAccessibleChild( sal_Int32 nChildIndex );
118 
119         /** Creates a new AccessibleStateSetHelper and fills it with states of the
120             current object.
121             @return
122                 A filled AccessibleStateSetHelper.
123         */
124         ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
125 
126         // XAccessible ------------------------------------------------------------
127 
128         /** @return  The XAccessibleContext interface of this object. */
129         virtual ::com::sun::star::uno::Reference<
130             ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL
131         getAccessibleContext();
132 
133         // XAccessibleText
134         virtual sal_Int32 SAL_CALL getCaretPosition();
135         virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex );
136         virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex );
137         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 );
138         virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex );
139         virtual sal_Int32 SAL_CALL getCharacterCount();
140         virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint );
141         virtual ::rtl::OUString SAL_CALL getSelectedText();
142         virtual sal_Int32 SAL_CALL getSelectionStart();
143         virtual sal_Int32 SAL_CALL getSelectionEnd();
144         virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
145         virtual ::rtl::OUString SAL_CALL getText();
146         virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
147         virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType );
148         virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType );
149         virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType );
150         virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex );
151     };
152 }
153 #endif // ACCESSIBILITY_EXT_ACCESSIBILEGRIDCONTROLTABLECELL_HXX
154