xref: /AOO41X/main/sc/source/ui/inc/AccessibleEditObject.hxx (revision 54628ca40d27d15cc98fe861da7fff7e60c2f7d6)
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 
24 
25 #ifndef _SC_ACCESSIBLEEDITOBJECT_HXX
26 #define _SC_ACCESSIBLEEDITOBJECT_HXX
27 
28 #include "AccessibleContextBase.hxx"
29 
30 namespace accessibility
31 {
32     class AccessibleTextHelper;
33 }
34 class EditView;
35 class Window;
36 
37 enum EditObjectType
38 {
39     CellInEditMode,
40     EditLine,
41     EditControl
42 };
43 
44 /** @descr
45         This base class provides an implementation of the
46         <code>AccessibleCell</code> service.
47 */
48 class ScAccessibleEditObject
49     :   public  ScAccessibleContextBase
50 {
51 public:
52     //=====  internal  ========================================================
53     ScAccessibleEditObject(
54         const ::com::sun::star::uno::Reference<
55         ::com::sun::star::accessibility::XAccessible>& rxParent,
56         EditView* pEditView, Window* pWin, const rtl::OUString& rName,
57         const rtl::OUString& rDescription, EditObjectType eObjectType);
58 
59 protected:
60     virtual ~ScAccessibleEditObject();
61 
62     using ScAccessibleContextBase::IsDefunc;
63 
64 public:
65     using ScAccessibleContextBase::addEventListener;
66     using ScAccessibleContextBase::removeEventListener;
67     using ScAccessibleContextBase::disposing;
68 
69     virtual void SAL_CALL disposing();
70 
71     virtual void LostFocus();
72 
73     virtual void GotFocus();
74 
75     ///=====  XAccessibleComponent  ============================================
76 
77     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
78         SAL_CALL getAccessibleAtPoint(
79         const ::com::sun::star::awt::Point& rPoint )
80         throw (::com::sun::star::uno::RuntimeException);
81 
82 protected:
83     /// Return the object's current bounding box relative to the desktop.
84     virtual Rectangle GetBoundingBoxOnScreen(void) const
85         throw (::com::sun::star::uno::RuntimeException);
86 
87     /// Return the object's current bounding box relative to the parent object.
88     virtual Rectangle GetBoundingBox(void) const
89         throw (::com::sun::star::uno::RuntimeException);
90 
91 public:
92     ///=====  XAccessibleContext  ==============================================
93 
94     /// Return the number of currently visible children.
95     // is overloaded to calculate this on demand
96     virtual sal_Int32 SAL_CALL
97         getAccessibleChildCount(void)
98                     throw (::com::sun::star::uno::RuntimeException);
99 
100     /// Return the specified child or NULL if index is invalid.
101     // is overloaded to calculate this on demand
102     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
103         getAccessibleChild(sal_Int32 nIndex)
104         throw (::com::sun::star::uno::RuntimeException,
105                 ::com::sun::star::lang::IndexOutOfBoundsException);
106 
107     /// Return the set of current states.
108     virtual ::com::sun::star::uno::Reference<
109             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
110         getAccessibleStateSet(void)
111         throw (::com::sun::star::uno::RuntimeException);
112 
113 protected:
114     /// Return this object's description.
115     virtual ::rtl::OUString SAL_CALL
116         createAccessibleDescription(void)
117         throw (::com::sun::star::uno::RuntimeException);
118 
119     /// Return the object's current name.
120     virtual ::rtl::OUString SAL_CALL
121         createAccessibleName(void)
122         throw (::com::sun::star::uno::RuntimeException);
123 
124 public:
125     ///=====  XAccessibleEventBroadcaster  =====================================
126 
127     /** Add listener that is informed of future changes of name,
128         description and so on events.
129     */
130     virtual void SAL_CALL
131         addEventListener(
132             const ::com::sun::star::uno::Reference<
133                 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
134         throw (com::sun::star::uno::RuntimeException);
135 
136     //  Remove an existing event listener.
137     virtual void SAL_CALL
138         removeEventListener(
139             const ::com::sun::star::uno::Reference<
140                 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
141         throw (com::sun::star::uno::RuntimeException);
142 
143     ///=====  XServiceInfo  ====================================================
144 
145     /** Returns an identifier for the implementation of this object.
146     */
147     virtual ::rtl::OUString SAL_CALL
148         getImplementationName(void)
149         throw (::com::sun::star::uno::RuntimeException);
150 
151     ///=====  XTypeProvider  ===================================================
152 
153     /** Returns a implementation id.
154     */
155     virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
156         getImplementationId(void)
157         throw (::com::sun::star::uno::RuntimeException);
158 
159 private:
160     accessibility::AccessibleTextHelper* mpTextHelper;
161     EditView* mpEditView;
162     Window* mpWindow;
163     EditObjectType meObjectType;
164     sal_Bool mbHasFocus;
165 
166     sal_Bool IsDefunc(
167         const com::sun::star::uno::Reference<
168         ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
169 
170     void CreateTextHelper();
171 };
172 
173 
174 #endif
175