/src/libreoffice/sw/source/uibase/docvw/SidebarWinAcc.cxx
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 | | #include "SidebarWinAcc.hxx" |
21 | | #include <AnnotationWin.hxx> |
22 | | |
23 | | #include <viewsh.hxx> |
24 | | #include <accmap.hxx> |
25 | | #include <vcl/svapp.hxx> |
26 | | |
27 | | #include <com/sun/star/accessibility/AccessibleRole.hpp> |
28 | | |
29 | | namespace sw::sidebarwindows |
30 | | { |
31 | | SidebarWinAccessible::SidebarWinAccessible(sw::annotation::SwAnnotationWin& rSidebarWin, |
32 | | SwViewShell& rViewShell, |
33 | | const SwAnnotationItem& rSidebarItem) |
34 | 0 | : VCLXAccessibleComponent(&rSidebarWin) |
35 | 0 | , mrViewShell(rViewShell) |
36 | 0 | , mpAnchorFrame(rSidebarItem.maLayoutInfo.mpAnchorFrame) |
37 | 0 | { |
38 | 0 | rSidebarWin.SetAccessibleRole(css::accessibility::AccessibleRole::COMMENT); |
39 | 0 | } |
40 | | |
41 | 0 | SidebarWinAccessible::~SidebarWinAccessible() {} |
42 | | |
43 | | void SidebarWinAccessible::ChangeSidebarItem(const SwAnnotationItem& rSidebarItem) |
44 | 0 | { |
45 | 0 | SolarMutexGuard aGuard; |
46 | |
|
47 | 0 | mpAnchorFrame = rSidebarItem.maLayoutInfo.mpAnchorFrame; |
48 | 0 | } |
49 | | |
50 | | css::uno::Reference<css::accessibility::XAccessible> SidebarWinAccessible::getAccessibleParent() |
51 | 0 | { |
52 | 0 | SolarMutexGuard aGuard; |
53 | |
|
54 | 0 | css::uno::Reference<css::accessibility::XAccessible> xAccParent; |
55 | |
|
56 | 0 | if (mpAnchorFrame && mrViewShell.GetAccessibleMap()) |
57 | 0 | { |
58 | 0 | xAccParent = mrViewShell.GetAccessibleMap()->GetContext(mpAnchorFrame, false); |
59 | 0 | } |
60 | |
|
61 | 0 | return xAccParent; |
62 | 0 | } |
63 | | |
64 | | sal_Int64 SAL_CALL SidebarWinAccessible::getAccessibleIndexInParent() |
65 | 0 | { |
66 | 0 | SolarMutexGuard aGuard; |
67 | |
|
68 | 0 | sal_Int64 nIndex(-1); |
69 | |
|
70 | 0 | if (mpAnchorFrame && GetWindow() && mrViewShell.GetAccessibleMap()) |
71 | 0 | { |
72 | 0 | nIndex = mrViewShell.GetAccessibleMap()->GetChildIndex(*mpAnchorFrame, *GetWindow()); |
73 | 0 | } |
74 | |
|
75 | 0 | return nIndex; |
76 | 0 | } |
77 | | |
78 | | } // end of namespace sw::sidebarwindows |
79 | | |
80 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |