1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 #include "SidebarWinAcc.hxx"
21 #include <AnnotationWin.hxx>
25 #include <vcl/svapp.hxx>
27 #include <com/sun/star/accessibility/AccessibleRole.hpp>
29 namespace sw::sidebarwindows
31 SidebarWinAccessible::SidebarWinAccessible(sw::annotation::SwAnnotationWin
& rSidebarWin
,
32 SwViewShell
& rViewShell
,
33 const SwAnnotationItem
& rSidebarItem
)
34 : ImplInheritanceHelper(&rSidebarWin
)
35 , mrViewShell(rViewShell
)
36 , mpAnchorFrame(rSidebarItem
.maLayoutInfo
.mpAnchorFrame
)
38 rSidebarWin
.SetAccessibleRole(css::accessibility::AccessibleRole::COMMENT
);
41 SidebarWinAccessible::~SidebarWinAccessible() {}
43 void SidebarWinAccessible::ChangeSidebarItem(const SwAnnotationItem
& rSidebarItem
)
45 SolarMutexGuard aGuard
;
47 mpAnchorFrame
= rSidebarItem
.maLayoutInfo
.mpAnchorFrame
;
50 css::uno::Reference
<css::accessibility::XAccessibleContext
>
51 SidebarWinAccessible::getAccessibleContext()
58 css::uno::Reference
<css::accessibility::XAccessible
> SidebarWinAccessible::getAccessibleParent()
60 SolarMutexGuard aGuard
;
62 css::uno::Reference
<css::accessibility::XAccessible
> xAccParent
;
64 if (mpAnchorFrame
&& mrViewShell
.GetAccessibleMap())
66 xAccParent
= mrViewShell
.GetAccessibleMap()->GetContext(mpAnchorFrame
, false);
72 sal_Int64 SAL_CALL
SidebarWinAccessible::getAccessibleIndexInParent()
74 SolarMutexGuard aGuard
;
78 if (mpAnchorFrame
&& GetWindow() && mrViewShell
.GetAccessibleMap())
80 nIndex
= mrViewShell
.GetAccessibleMap()->GetChildIndex(*mpAnchorFrame
, *GetWindow());
86 } // end of namespace sw::sidebarwindows
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */