LibreOffice Module accessibility (master) 1
vclxaccessibletabpagewindow.cxx
Go to the documentation of this file.
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
23#include <vcl/tabctrl.hxx>
24#include <vcl/tabpage.hxx>
25#include <sal/log.hxx>
26
27using namespace ::com::sun::star;
28using namespace ::com::sun::star::uno;
29using namespace ::com::sun::star::accessibility;
30using namespace ::comphelper;
31
32
33
34
36 :VCLXAccessibleComponent( pVCLXWindow )
37{
38 m_pTabPage = GetAs<TabPage>();
39 m_pTabControl = nullptr;
40 m_nPageId = 0;
41 if ( !m_pTabPage )
42 return;
43
44 vcl::Window* pParent = m_pTabPage->GetAccessibleParentWindow();
45 if ( !(pParent && pParent->GetType() == WindowType::TABCONTROL) )
46 return;
47
48 m_pTabControl = static_cast< TabControl* >( pParent );
49 if ( m_pTabControl )
50 {
51 for ( sal_uInt16 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i )
52 {
53 sal_uInt16 nPageId = m_pTabControl->GetPageId( i );
54 if ( m_pTabControl->GetTabPage( nPageId ) == m_pTabPage.get() )
56 }
57 }
58}
59
60
61// OCommonAccessibleComponent
62
63
65{
66 awt::Rectangle aBounds( 0, 0, 0, 0 );
67
68 if ( m_pTabControl )
69 {
70 tools::Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
71 if ( m_pTabPage )
72 {
73 tools::Rectangle aRect( m_pTabPage->GetPosPixel(), m_pTabPage->GetSizePixel() );
74 aRect.Move( -aPageRect.Left(), -aPageRect.Top() );
75 aBounds = AWTRectangle( aRect );
76 }
77 }
78
79 return aBounds;
80}
81
82
83// XComponent
84
85
87{
88 VCLXAccessibleComponent::disposing();
89
90 m_pTabControl = nullptr;
91 m_pTabPage = nullptr;
92}
93
94
95// XAccessibleContext
96
97
99{
100 OExternalLockGuard aGuard( this );
101
103 if ( m_pTabControl )
104 {
105 Reference< XAccessible > xAcc( m_pTabControl->GetAccessible() );
106 if ( xAcc.is() )
107 {
108 Reference< XAccessibleContext > xCont( xAcc->getAccessibleContext() );
109 if ( xCont.is() )
110 {
111 sal_uInt16 const nPagePos(m_pTabControl->GetPagePos(m_nPageId));
112 SAL_WARN_IF(nPagePos == TAB_PAGE_NOTFOUND, "accessibility",
113 "getAccessibleParent(): no tab page");
114 if (nPagePos != TAB_PAGE_NOTFOUND)
115 {
116 xParent = xCont->getAccessibleChild(nPagePos);
117 }
118 }
119 }
120 }
121
122 return xParent;
123}
124
125
127{
128 OExternalLockGuard aGuard( this );
129
130 return 0;
131}
132
133
134/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 nPageId
virtual sal_Int64 SAL_CALL getAccessibleIndexInParent() override
VCLXAccessibleTabPageWindow(VCLXWindow *pVCLXWindow)
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
virtual void SAL_CALL disposing() override
virtual css::awt::Rectangle implGetBounds() override
reference_type * get() const
constexpr tools::Long Top() const
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Left() const
WindowType GetType() const
css::awt::Rectangle AWTRectangle(const ::tools::Rectangle &rVCLRect)
int nCount
#define SAL_WARN_IF(condition, area, stream)
int i
#define TAB_PAGE_NOTFOUND