Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / access / accdoc.hxx
blob735dc822cd81dbaca2d0410c1a2150a62d54329c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
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>
28 // base class for SwAccessibleDocument (in this same header file) and
29 // SwAccessiblePreview
30 class SwAccessibleDocumentBase : public SwAccessibleContext
32 css::uno::Reference< css::accessibility::XAccessible> mxParent;
34 VclPtr<vcl::Window> mpChildWin; // protected by solar mutex
36 using SwAccessibleFrame::SetVisArea;
38 protected:
39 virtual ~SwAccessibleDocumentBase() override;
41 public:
42 SwAccessibleDocumentBase(std::shared_ptr<SwAccessibleMap> const& pInitMap);
44 void SetVisArea();
46 void AddChild( vcl::Window *pWin, bool bFireEvent = true );
47 void RemoveChild( vcl::Window *pWin );
49 // XAccessibleContext
51 // Return the number of currently visible children.
52 virtual sal_Int64 SAL_CALL getAccessibleChildCount() override;
54 // Return the specified child or NULL if index is invalid.
55 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
56 getAccessibleChild (sal_Int64 nIndex) override;
58 // Return a reference to the parent.
59 virtual css::uno::Reference< css::accessibility::XAccessible> SAL_CALL
60 getAccessibleParent() override;
62 // Return this objects index among the parents children.
63 virtual sal_Int64 SAL_CALL
64 getAccessibleIndexInParent() override;
66 // Return this object's description.
67 virtual OUString SAL_CALL
68 getAccessibleDescription() override;
70 virtual OUString SAL_CALL getAccessibleName() override;
72 // XAccessibleComponent
73 virtual sal_Bool SAL_CALL containsPoint(
74 const css::awt::Point& aPoint ) override;
76 virtual css::uno::Reference<
77 css::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
78 const css::awt::Point& aPoint ) override;
80 virtual css::awt::Rectangle SAL_CALL getBounds() override;
82 virtual css::awt::Point SAL_CALL getLocation() override;
84 virtual css::awt::Point SAL_CALL getLocationOnScreen() override;
86 virtual css::awt::Size SAL_CALL getSize() override;
89 /**
90 * access to an accessible Writer document
92 class SwAccessibleDocument : public SwAccessibleDocumentBase,
93 public css::accessibility::XAccessibleSelection,
94 public css::accessibility::XAccessibleExtendedAttributes
96 // Implementation for XAccessibleSelection interface
97 SwAccessibleSelectionHelper maSelectionHelper;
99 protected:
100 // Set states for getAccessibleStateSet.
101 // This derived class additionally sets MULTISELECTABLE(1)
102 virtual void GetStates( sal_Int64& rStateSet ) override;
104 virtual ~SwAccessibleDocument() override;
106 public:
107 SwAccessibleDocument(std::shared_ptr<SwAccessibleMap> const& pInitMap);
109 DECL_LINK( WindowChildEventListener, VclWindowEvent&, void );
111 // XServiceInfo
113 // Returns an identifier for the implementation of this object.
114 virtual OUString SAL_CALL
115 getImplementationName() override;
117 // Return whether the specified service is supported by this class.
118 virtual sal_Bool SAL_CALL
119 supportsService (const OUString& sServiceName) override;
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;
126 // XInterface
128 // XInterface is inherited through SwAccessibleContext and
129 // XAccessibleSelection. These methods are needed to avoid
130 // ambiguities.
132 virtual css::uno::Any SAL_CALL queryInterface(
133 const css::uno::Type& aType ) override;
135 virtual void SAL_CALL acquire( ) noexcept override
136 { SwAccessibleContext::acquire(); };
138 virtual void SAL_CALL release( ) noexcept override
139 { SwAccessibleContext::release(); };
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;
145 // XAccessibleSelection
147 virtual void SAL_CALL selectAccessibleChild(
148 sal_Int64 nChildIndex ) override;
150 virtual sal_Bool SAL_CALL isAccessibleChildSelected(
151 sal_Int64 nChildIndex ) override;
152 virtual void SAL_CALL clearAccessibleSelection( ) override;
153 virtual void SAL_CALL selectAllAccessibleChildren( ) override;
154 virtual sal_Int64 SAL_CALL getSelectedAccessibleChildCount( ) override;
155 virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild(
156 sal_Int64 nSelectedChildIndex ) override;
158 // index has to be treated as global child index.
159 virtual void SAL_CALL deselectAccessibleChild(
160 sal_Int64 nChildIndex ) override;
162 virtual css::uno::Any SAL_CALL getExtendedAttributes() override;
164 // thread safe C++ interface
166 // The object is not visible any longer and should be destroyed
167 virtual void Dispose(bool bRecursive, bool bCanSkipInvisible = true) override;
169 // XAccessibleComponent
170 sal_Int32 SAL_CALL getBackground() override;
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */