LibreOffice Module sw (master)  1
accdoc.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_SW_SOURCE_CORE_ACCESS_ACCDOC_HXX
21 #define INCLUDED_SW_SOURCE_CORE_ACCESS_ACCDOC_HXX
22 
23 #include "acccontext.hxx"
24 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
25 #include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
26 #include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
27 #include "accselectionhelper.hxx"
28 
29 // base class for SwAccessibleDocument (in this same header file) and
30 // SwAccessiblePreview
32 {
33  css::uno::Reference< css::accessibility::XAccessible> mxParent;
34 
35  VclPtr<vcl::Window> mpChildWin; // protected by solar mutex
36 
38 
39 protected:
40  virtual ~SwAccessibleDocumentBase() override;
41 
42 public:
43  SwAccessibleDocumentBase(std::shared_ptr<SwAccessibleMap> const& pInitMap);
44 
45  void SetVisArea();
46 
47  void AddChild( vcl::Window *pWin, bool bFireEvent = true );
48  void RemoveChild( vcl::Window *pWin );
49 
50  // XAccessibleContext
51 
52  // Return the number of currently visible children.
53  virtual sal_Int32 SAL_CALL getAccessibleChildCount() override;
54 
55  // Return the specified child or NULL if index is invalid.
56  virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
57  getAccessibleChild (sal_Int32 nIndex) override;
58 
59  // Return a reference to the parent.
60  virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
61  getAccessibleParent() override;
62 
63  // Return this objects index among the parents children.
64  virtual sal_Int32 SAL_CALL
65  getAccessibleIndexInParent() override;
66 
67  // Return this object's description.
68  virtual OUString SAL_CALL
69  getAccessibleDescription() override;
70 
71  virtual OUString SAL_CALL getAccessibleName() override;
72 
73  // XAccessibleComponent
74  virtual sal_Bool SAL_CALL containsPoint(
75  const css::awt::Point& aPoint ) override;
76 
77  virtual css::uno::Reference<
78  css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
79  const css::awt::Point& aPoint ) override;
80 
81  virtual css::awt::Rectangle SAL_CALL getBounds() override;
82 
83  virtual css::awt::Point SAL_CALL getLocation() override;
84 
85  virtual css::awt::Point SAL_CALL getLocationOnScreen() override;
86 
87  virtual css::awt::Size SAL_CALL getSize() override;
88 };
89 
94  public css::accessibility::XAccessibleSelection,
95  public css::accessibility::XAccessibleExtendedAttributes,
96  public css::accessibility::XAccessibleGetAccFlowTo
97 {
98  // Implementation for XAccessibleSelection interface
100 
101 protected:
102  // Set states for getAccessibleStateSet.
103  // This derived class additionally sets MULTISELECTABLE(1)
104  virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet ) override;
105 
106  virtual ~SwAccessibleDocument() override;
107 
108 public:
109  SwAccessibleDocument(std::shared_ptr<SwAccessibleMap> const& pInitMap);
110 
111  DECL_LINK( WindowChildEventListener, VclWindowEvent&, void );
112 
113  // XServiceInfo
114 
115  // Returns an identifier for the implementation of this object.
116  virtual OUString SAL_CALL
117  getImplementationName() override;
118 
119  // Return whether the specified service is supported by this class.
120  virtual sal_Bool SAL_CALL
121  supportsService (const OUString& sServiceName) override;
122 
123  // Returns a list of all supported services. In this case that is just
124  // the AccessibleContext service.
125  virtual css::uno::Sequence< OUString> SAL_CALL
126  getSupportedServiceNames() override;
127 
128  // XInterface
129 
130  // XInterface is inherited through SwAccessibleContext and
131  // XAccessibleSelection. These methods are needed to avoid
132  // ambiguities.
133 
134  virtual css::uno::Any SAL_CALL queryInterface(
135  const css::uno::Type& aType ) override;
136 
137  virtual void SAL_CALL acquire( ) throw () override
138  { SwAccessibleContext::acquire(); };
139 
140  virtual void SAL_CALL release( ) throw () override
141  { SwAccessibleContext::release(); };
142 
143  // XTypeProvider
144  virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
145  virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override;
146 
147  // XAccessibleSelection
148 
149  virtual void SAL_CALL selectAccessibleChild(
150  sal_Int32 nChildIndex ) override;
151 
152  virtual sal_Bool SAL_CALL isAccessibleChildSelected(
153  sal_Int32 nChildIndex ) override;
154  virtual void SAL_CALL clearAccessibleSelection( ) override;
155  virtual void SAL_CALL selectAllAccessibleChildren( ) override;
156  virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) override;
157  virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
158  sal_Int32 nSelectedChildIndex ) override;
159 
160  // index has to be treated as global child index.
161  virtual void SAL_CALL deselectAccessibleChild(
162  sal_Int32 nChildIndex ) override;
163 
164  virtual css::uno::Any SAL_CALL getExtendedAttributes() override;
165 
166  // thread safe C++ interface
167 
168  // The object is not visible any longer and should be destroyed
169  virtual void Dispose(bool bRecursive, bool bCanSkipInvisible = true) override;
170 
171  // XAccessibleComponent
172  sal_Int32 SAL_CALL getBackground() override;
173 
174  // XAccessibleGetAccFlowTo
175  css::uno::Sequence< css::uno::Any >
176  SAL_CALL getAccFlowTo(const css::uno::Any& rAny, sal_Int32 nType) override;
177 };
178 
179 #endif
180 
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Bool SAL_CALL containsPoint(const css::awt::Point &aPoint) override
Definition: accdoc.cxx:299
virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount() override
Definition: accdoc.cxx:503
SwAccessibleDocumentBase(std::shared_ptr< SwAccessibleMap > const &pInitMap)
Definition: accdoc.cxx:72
virtual css::awt::Point SAL_CALL getLocationOnScreen() override
Definition: accdoc.cxx:267
virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nChildIndex) override
Definition: accdoc.cxx:515
SwAccessibleSelectionHelper maSelectionHelper
Definition: accdoc.hxx:99
void AddChild(vcl::Window *pWin, bool bFireEvent=true)
Definition: accdoc.cxx:101
virtual void SAL_CALL clearAccessibleSelection() override
Definition: accdoc.cxx:494
virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) override
Definition: accdoc.cxx:488
virtual css::awt::Point SAL_CALL getLocation() override
Definition: accdoc.cxx:251
virtual OUString SAL_CALL getAccessibleDescription() override
Definition: accdoc.cxx:195
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: accdoc.cxx:468
virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) override
Definition: accdoc.cxx:482
sal_Int32 SAL_CALL getBackground() override
Definition: accdoc.cxx:750
virtual ~SwAccessibleDocumentBase() override
Definition: accdoc.cxx:81
DECL_LINK(WindowChildEventListener, VclWindowEvent &, void)
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Return whether the specified service is supported by this class.
Definition: accdoc.cxx:431
virtual sal_Int32 SAL_CALL getAccessibleChildCount() override
Definition: accdoc.cxx:136
virtual css::awt::Rectangle SAL_CALL getBounds() override
Definition: accdoc.cxx:227
virtual css::awt::Size SAL_CALL getSize() override
Definition: accdoc.cxx:283
virtual void SAL_CALL selectAllAccessibleChildren() override
Definition: accdoc.cxx:498
SwAccessibleDocument(std::shared_ptr< SwAccessibleMap > const &pInitMap)
Definition: accdoc.cxx:352
unsigned char sal_Bool
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Definition: accdoc.cxx:167
void SetVisArea(const SwRect &rNewVisArea)
Definition: accframe.hxx:131
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(const css::awt::Point &aPoint) override
Definition: accdoc.cxx:317
css::uno::Sequence< css::uno::Any > SAL_CALL getAccFlowTo(const css::uno::Any &rAny, sal_Int32 nType) override
Definition: accdoc.cxx:757
access to an accessible Writer document
Definition: accdoc.hxx:93
virtual ~SwAccessibleDocument() override
Definition: accdoc.cxx:373
virtual css::uno::Any SAL_CALL getExtendedAttributes() override
Definition: accdoc.cxx:521
virtual OUString SAL_CALL getImplementationName() override
Definition: accdoc.cxx:426
virtual void SAL_CALL release() override
Definition: accdoc.hxx:140
void RemoveChild(vcl::Window *pWin)
Definition: accdoc.cxx:120
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: accdoc.cxx:475
virtual void SAL_CALL acquire() override
Definition: accdoc.hxx:137
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &aType) override
Definition: accdoc.cxx:443
virtual OUString SAL_CALL getAccessibleName() override
Definition: accdoc.cxx:200
VclPtr< vcl::Window > mpChildWin
Definition: accdoc.hxx:35
virtual void GetStates(::utl::AccessibleStateSetHelper &rStateSet) override
Definition: accdoc.cxx:342
virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override
Definition: accdoc.cxx:172
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: accdoc.cxx:436
css::uno::Reference< css::accessibility::XAccessible > mxParent
Definition: accdoc.hxx:33
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(sal_Int32 nSelectedChildIndex) override
Definition: accdoc.cxx:508
const sal_Char sServiceName[]
Definition: accdoc.cxx:61
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild(sal_Int32 nIndex) override
Definition: accdoc.cxx:150
virtual void Dispose(bool bRecursive, bool bCanSkipInvisible=true) override
Definition: accdoc.cxx:380