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