LibreOffice Module sc (master)  1
AccessibleEditObject.hxx
Go to the documentation of this file.
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 INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLEEDITOBJECT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_ACCESSIBLEEDITOBJECT_HXX
22 
24 
25 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
26 #include <address.hxx>
27 #include <vcl/vclptr.hxx>
28 #include <vcl/customweld.hxx>
29 
30 #include <memory>
31 
32 namespace accessibility
33 {
34  class AccessibleTextHelper;
35 }
36 class EditView;
37 class ScTextWnd;
38 namespace vcl { class Window; }
39 
45  : public ScAccessibleContextBase,
46  public css::accessibility::XAccessibleSelection
47 {
48 public:
50  {
54  };
55 
57  const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
58  EditView* pEditView, vcl::Window* pWin, const OUString& rName,
59  const OUString& rDescription, EditObjectType eObjectType);
60 
61  void InitAcc(
62  const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
63  EditView* pEditView, vcl::Window* pWin, ScTextWnd* pTextWnd,
64  const OUString& rName, const OUString& rDescription);
65 
66 protected:
67  virtual ~ScAccessibleEditObject() override;
68 
70 
72 
73 public:
75 
76  virtual void SAL_CALL disposing() override;
77 
78  void LostFocus();
79 
80  void GotFocus();
82 
83  virtual css::uno::Any SAL_CALL queryInterface(
84  css::uno::Type const & rType ) override;
85 
86  virtual void SAL_CALL acquire() throw () override;
87 
88  virtual void SAL_CALL release() throw () override;
90 
91  virtual css::uno::Reference< css::accessibility::XAccessible >
92  SAL_CALL getAccessibleAtPoint(
93  const css::awt::Point& rPoint ) override;
94 
96 
97 protected:
99  virtual tools::Rectangle GetBoundingBoxOnScreen() const override;
100 
102  virtual tools::Rectangle GetBoundingBox() const override;
103 
104 public:
106 
109  virtual sal_Int32 SAL_CALL
110  getAccessibleChildCount() override;
111 
114  virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
115  getAccessibleChild(sal_Int32 nIndex) override;
116 
118  virtual css::uno::Reference<
119  css::accessibility::XAccessibleStateSet> SAL_CALL
120  getAccessibleStateSet() override;
121 
122  //===== XAccessibleSelection ============================================
123 
124  virtual void SAL_CALL selectAccessibleChild(
125  sal_Int32 nChildIndex ) override;
126  virtual sal_Bool SAL_CALL isAccessibleChildSelected(
127  sal_Int32 nChildIndex ) override;
128  virtual void SAL_CALL clearAccessibleSelection( ) override;
129  virtual void SAL_CALL selectAllAccessibleChildren( ) override;
130  virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override;
131  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
132  sal_Int32 nSelectedChildIndex ) override;
133  virtual void SAL_CALL deselectAccessibleChild(
134  sal_Int32 nSelectedChildIndex ) override;
135  virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
136 protected:
138  virtual OUString
139  createAccessibleDescription() override;
140 
142  virtual OUString
143  createAccessibleName() override;
144 
145 public:
147 
151  virtual void SAL_CALL
153  const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
154 
155  // Remove an existing event listener.
156  virtual void SAL_CALL
158  const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
159 
161 
164  virtual OUString SAL_CALL
165  getImplementationName() override;
166 
168 
171  virtual css::uno::Sequence<sal_Int8> SAL_CALL
172  getImplementationId() override;
173 
174 private:
175  std::unique_ptr<accessibility::AccessibleTextHelper> mpTextHelper;
177  VclPtr<vcl::Window> mpWindow;
181 
182  bool IsDefunc(
183  const css::uno::Reference<css::accessibility::XAccessibleStateSet>& rxParentStates);
184 
185  void CreateTextHelper();
188 
190  virtual sal_Int32 SAL_CALL getForeground( ) override;
191 
192  virtual sal_Int32 SAL_CALL getBackground( ) override;
193 
194  sal_Int32 GetFgBgColor( const OUString &strPropColor) ;
195 };
196 
198 {
199 private:
201 
202 protected:
204  virtual tools::Rectangle GetBoundingBoxOnScreen() const override;
205 
207  virtual tools::Rectangle GetBoundingBox() const override;
208 
209 public:
211  : ScAccessibleEditObject(eObjectType)
212  , m_pController(pController)
213  {
214  }
215 
216  virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
217 
218  // for mapping positions/sizes within the TextView to a11y
219  virtual OutputDevice* GetOutputDeviceForView() override;
220 
222  virtual void SAL_CALL disposing() override;
223 };
224 
225 #endif
226 
227 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual OUString createAccessibleDescription() override
Return this object's description.
virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nSelectedChildIndex) override
signed char sal_Int8
virtual void SAL_CALL clearAccessibleSelection() override
virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
virtual ~ScAccessibleEditObject() override
sal_Int32 GetFgBgColor(const OUString &strPropColor)
virtual void SAL_CALL release() override
weld::CustomWidgetController * m_pController
virtual tools::Rectangle GetBoundingBox() const override
Return the object's current bounding box relative to the parent object.
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Return the specified child or NULL if index is invalid.
virtual css::uno::Any SAL_CALL queryInterface(css::uno::Type const &rType) override
===== XInterface =====================================================
virtual OutputDevice * GetOutputDeviceForView()
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) override
unsigned char sal_Bool
virtual OUString createAccessibleName() override
Return the object's current name.
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
===== XTypeProvider ===================================================
virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override
Return NULL to indicate that an empty relation set.
std::unique_ptr< accessibility::AccessibleTextHelper > mpTextHelper
void InitAcc(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, EditView *pEditView, vcl::Window *pWin, ScTextWnd *pTextWnd, const OUString &rName, const OUString &rDescription)
virtual OUString SAL_CALL getImplementationName() override
===== XServiceInfo ====================================================
virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override
Return the set of current states.
ScAccessibleEditControlObject(weld::CustomWidgetController *pController, EditObjectType eObjectType)
virtual void SAL_CALL disposing() override
virtual void SAL_CALL acquire() override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL addAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
===== XAccessibleEventBroadcaster =====================================
VclPtr< vcl::Window > mpWindow
virtual void SAL_CALL selectAllAccessibleChildren() override
virtual sal_Int32 SAL_CALL getBackground() override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex) override
virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override
virtual sal_Int32 SAL_CALL getForeground() override
===== XAccessibleComponent ============================================
virtual void SAL_CALL removeAccessibleEventListener(const css::uno::Reference< css::accessibility::XAccessibleEventListener > &xListener) override
virtual tools::Rectangle GetBoundingBoxOnScreen() const override
Return the object's current bounding box relative to the desktop.
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
===== XAccessibleContext ==============================================
ScAccessibleEditObject(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, EditView *pEditView, vcl::Window *pWin, const OUString &rName, const OUString &rDescription, EditObjectType eObjectType)
This base class provides an implementation of the AccessibleCell service.