Coverage Report

Created: 2026-02-14 09:37

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