Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/svx/AccessibleShapeTreeInfo.hxx
Line
Count
Source
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 <com/sun/star/uno/Reference.hxx>
23
#include <svx/svxdllapi.h>
24
#include <vcl/vclptr.hxx>
25
26
namespace com::sun::star {
27
    namespace accessibility { class XAccessibleComponent; }
28
    namespace document { class XShapeEventBroadcaster; }
29
    namespace frame { class XController; }
30
}
31
namespace vcl { class Window; }
32
33
class SdrView;
34
35
namespace accessibility {
36
37
class IAccessibleViewForwarder;
38
39
/** This class bundles all information that is passed down the tree of
40
    accessible shapes so that each shape has access to that info.
41
42
    There are basically four members that can be set and queried:
43
    <ul>
44
    <li>The model broadcaster is used for getting notified about shape
45
    changes.  Using this broadcaster makes in unnecessary to register at
46
    each shape separately.</li>
47
    <li>The view forwarder is responsible for transformation between
48
    coordinate systems and for providing the visible area both with respect
49
    to a specific window.</li>
50
    <li>The SdrView is used for creating accessible edit engines.</li>
51
    <li>The Window is used for creating accessible edit engines.</li>
52
    </ul>
53
*/
54
class SVX_DLLPUBLIC AccessibleShapeTreeInfo
55
{
56
public:
57
    /** Use this constructor to create an empty object that is filled later
58
        with more meaningful data.
59
    */
60
    AccessibleShapeTreeInfo();
61
62
    /** Create a copy of the given shape info.
63
        @param rInfo
64
            The shape tree info object to copy.
65
    */
66
    AccessibleShapeTreeInfo (const AccessibleShapeTreeInfo& rInfo);
67
68
    ~AccessibleShapeTreeInfo();
69
70
    AccessibleShapeTreeInfo& operator= (const AccessibleShapeTreeInfo& rInfo);
71
72
    void dispose();
73
74
    /** Deprecated.  Don't use this method.
75
    */
76
    void SetDocumentWindow (const css::uno::Reference<
77
        css::accessibility::XAccessibleComponent>& rxViewWindow);
78
79
    /** Deprecated.  Don't use this method.
80
    */
81
    const css::uno::Reference<
82
        css::accessibility::XAccessibleComponent>&
83
0
        GetDocumentWindow() const { return mxDocumentWindow;}
84
85
    /** Set a new broadcaster that sends events indicating shape changes.
86
        The broadcaster usually is or belongs to a document model.
87
        @param rxModelBroadcaster
88
            The new broadcaster.  It replaces the current one.  An empty
89
            reference may be passed to unset the broadcaster
90
    */
91
    void SetModelBroadcaster (const css::uno::Reference<
92
        css::document::XShapeEventBroadcaster>& rxModelBroadcaster);
93
94
    /** Return the current model broadcaster.
95
        @return
96
            The returned reference may be empty if the broadcaster has not
97
            been set or has been set to an empty reference.
98
    */
99
    const css::uno::Reference<
100
        css::document::XShapeEventBroadcaster>&
101
0
        GetModelBroadcaster() const { return mxModelBroadcaster;}
102
103
    /** Set the view that will be used to construct SvxTextEditSources which
104
        in turn are used to create accessible edit engines.
105
        @param pView
106
            The new SdrView that replaces the current one.  A NULL pointer
107
            may be passed to unset the view.
108
    */
109
    void SetSdrView (SdrView* pView);
110
111
    /** Return the current SdrView.
112
        @return
113
            The returned value may be NULL.
114
    */
115
0
    SdrView* GetSdrView() const { return mpView;}
116
117
    /** Set a new controller.  This will usually but not necessarily
118
        correspond to the SdrView.
119
        @param rxController
120
            The new controller that replaces the current one.  An empty
121
            reference may be passed to unset the controller.
122
    */
123
    void SetController (const css::uno::Reference<
124
        css::frame::XController>& rxController);
125
126
    /** Return the currently set controller.
127
        @return
128
            The reference to the currently set controller may be empty.
129
    */
130
    const css::uno::Reference<
131
        css::frame::XController>&
132
0
        GetController() const { return mxController;}
133
134
    /** Set the window that is used to construct SvxTextEditSources which in
135
        turn is used to create accessible edit engines.
136
    */
137
    void SetWindow(vcl::Window* pWindow);
138
139
    /** Return the current Window.
140
        @return
141
            The returned value may be NULL.
142
    */
143
    vcl::Window* GetWindow() const
144
0
    {
145
0
        return mpWindow.get();
146
0
    }
147
148
    /** The view forwarder allows the transformation between internal
149
        and pixel coordinates and can be asked for the visible area.
150
        @param pViewForwarder
151
            This view forwarder replaces the current one.
152
    */
153
    void SetViewForwarder (const IAccessibleViewForwarder* pViewForwarder);
154
155
    /** Return the current view forwarder.
156
        @return
157
            The returned pointer may be NULL.
158
    */
159
0
    const IAccessibleViewForwarder* GetViewForwarder() const { return mpViewForwarder;}
160
161
private:
162
    /** Deprecated.
163
    */
164
    css::uno::Reference<
165
        css::accessibility::XAccessibleComponent> mxDocumentWindow;
166
167
    /** this broadcaster sends events indicating shape changes.
168
        The broadcaster usually is or belongs to a document model.
169
170
        This once was named mxControllerBroadcaster.
171
    */
172
    css::uno::Reference<
173
        css::document::XShapeEventBroadcaster> mxModelBroadcaster;
174
175
    /** This view is necessary to construct an SvxTextEditSource which in
176
        turn is used to create an accessible edit engine.
177
    */
178
    SdrView* mpView;
179
180
    /** The controller is used e.g. for obtaining the selected shapes.
181
    */
182
    css::uno::Reference<
183
        css::frame::XController> mxController;
184
185
    /** This window is necessary to construct an SvxTextEditSource which in
186
        turn is used to create an accessible edit engine.
187
    */
188
    VclPtr<vcl::Window> mpWindow;
189
190
    /** The view forwarder allows the transformation between internal
191
        and pixel coordinates and can be asked for the visible area.
192
    */
193
    const IAccessibleViewForwarder* mpViewForwarder;
194
};
195
196
} // end of namespace accessibility
197
198
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */