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 #pragma once
21 
23 
24 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
25 #include <address.hxx>
26 #include <vcl/vclptr.hxx>
27 #include <vcl/customweld.hxx>
28 
29 #include <memory>
30 
31 namespace accessibility
32 {
33  class AccessibleTextHelper;
34 }
35 class EditView;
36 class ScTextWnd;
37 namespace vcl { class Window; }
38 
44  : public ScAccessibleContextBase,
45  public css::accessibility::XAccessibleSelection
46 {
47 public:
49  {
53  };
54 
56  const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
57  EditView* pEditView, vcl::Window* pWin, const OUString& rName,
58  const OUString& rDescription, EditObjectType eObjectType);
59 
60  void InitAcc(
61  const css::uno::Reference<css::accessibility::XAccessible>& rxParent,
62  EditView* pEditView, const OUString& rName, const OUString& rDescription);
63 
64 protected:
65  virtual ~ScAccessibleEditObject() override;
66 
68 
70 
71 public:
73 
74  virtual void SAL_CALL disposing() override;
75 
76  void LostFocus();
77 
78  void GotFocus();
80 
81  virtual css::uno::Any SAL_CALL queryInterface(
82  css::uno::Type const & rType ) override;
83 
84  virtual void SAL_CALL acquire() noexcept override;
85 
86  virtual void SAL_CALL release() noexcept override;
88 
89  virtual css::uno::Reference< css::accessibility::XAccessible >
90  SAL_CALL getAccessibleAtPoint(
91  const css::awt::Point& rPoint ) override;
92 
94 
95 protected:
97  virtual tools::Rectangle GetBoundingBoxOnScreen() const override;
98 
100  virtual tools::Rectangle GetBoundingBox() const override;
101 
102 public:
104 
107  virtual sal_Int32 SAL_CALL
108  getAccessibleChildCount() override;
109 
112  virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
113  getAccessibleChild(sal_Int32 nIndex) override;
114 
116  virtual css::uno::Reference<
117  css::accessibility::XAccessibleStateSet> SAL_CALL
118  getAccessibleStateSet() override;
119 
120  //===== XAccessibleSelection ============================================
121 
122  virtual void SAL_CALL selectAccessibleChild(
123  sal_Int32 nChildIndex ) override;
124  virtual sal_Bool SAL_CALL isAccessibleChildSelected(
125  sal_Int32 nChildIndex ) override;
126  virtual void SAL_CALL clearAccessibleSelection( ) override;
127  virtual void SAL_CALL selectAllAccessibleChildren( ) override;
128  virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override;
129  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
130  sal_Int32 nSelectedChildIndex ) override;
131  virtual void SAL_CALL deselectAccessibleChild(
132  sal_Int32 nSelectedChildIndex ) override;
133  virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) override;
134 protected:
136  virtual OUString
137  createAccessibleDescription() override;
138 
140  virtual OUString
141  createAccessibleName() override;
142 
143 public:
145 
149  virtual void SAL_CALL
151  const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
152 
153  // Remove an existing event listener.
154  virtual void SAL_CALL
156  const css::uno::Reference<css::accessibility::XAccessibleEventListener>& xListener) override;
157 
159 
162  virtual OUString SAL_CALL
163  getImplementationName() override;
164 
166 
169  virtual css::uno::Sequence<sal_Int8> SAL_CALL
170  getImplementationId() override;
171 
172 private:
173  std::unique_ptr<accessibility::AccessibleTextHelper> mpTextHelper;
175  VclPtr<vcl::Window> mpWindow;
176 protected:
178 private:
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 
226 {
227 public:
229 };
230 
231 /* 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 release() noexcept override
virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override
virtual void SAL_CALL acquire() noexcept override
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &rPoint) override
===== XAccessibleComponent ============================================
void InitAcc(const css::uno::Reference< css::accessibility::XAccessible > &rxParent, EditView *pEditView, const OUString &rName, const OUString &rDescription)
virtual ~ScAccessibleEditObject() override
sal_Int32 GetFgBgColor(const OUString &strPropColor)
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
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 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.