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