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 <standard/vclxaccessibletabpagewindow.hxx>
21 #include <comphelper/accessiblecontexthelper.hxx>
22 #include <vcl/tabctrl.hxx>
23 #include <vcl/tabpage.hxx>
24 #include <vcl/unohelp.hxx>
25 #include <sal/log.hxx>
27 using namespace ::com::sun::star
;
28 using namespace ::com::sun::star::uno
;
29 using namespace ::com::sun::star::accessibility
;
30 using namespace ::comphelper
;
35 VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow(vcl::Window
* pWindow
)
36 : VCLXAccessibleComponent(pWindow
)
38 m_pTabPage
= GetAs
<TabPage
>();
39 m_pTabControl
= nullptr;
44 vcl::Window
* pParent
= m_pTabPage
->GetAccessibleParentWindow();
45 if ( !(pParent
&& pParent
->GetType() == WindowType::TABCONTROL
) )
48 m_pTabControl
= static_cast< TabControl
* >( pParent
);
51 for ( sal_uInt16 i
= 0, nCount
= m_pTabControl
->GetPageCount(); i
< nCount
; ++i
)
53 sal_uInt16 nPageId
= m_pTabControl
->GetPageId( i
);
54 if ( m_pTabControl
->GetTabPage( nPageId
) == m_pTabPage
.get() )
61 // OCommonAccessibleComponent
64 awt::Rectangle
VCLXAccessibleTabPageWindow::implGetBounds()
66 awt::Rectangle
aBounds( 0, 0, 0, 0 );
70 tools::Rectangle aPageRect
= m_pTabControl
->GetTabBounds( m_nPageId
);
73 tools::Rectangle
aRect( m_pTabPage
->GetPosPixel(), m_pTabPage
->GetSizePixel() );
74 aRect
.Move( -aPageRect
.Left(), -aPageRect
.Top() );
75 aBounds
= vcl::unohelper::ConvertToAWTRect(aRect
);
86 void VCLXAccessibleTabPageWindow::disposing()
88 VCLXAccessibleComponent::disposing();
90 m_pTabControl
= nullptr;
98 Reference
< XAccessible
> VCLXAccessibleTabPageWindow::getAccessibleParent( )
100 OExternalLockGuard
aGuard( this );
102 Reference
< XAccessible
> xParent
;
105 Reference
< XAccessible
> xAcc( m_pTabControl
->GetAccessible() );
108 Reference
< XAccessibleContext
> xCont( xAcc
->getAccessibleContext() );
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
)
116 xParent
= xCont
->getAccessibleChild(nPagePos
);
126 sal_Int64
VCLXAccessibleTabPageWindow::getAccessibleIndexInParent( )
128 OExternalLockGuard
aGuard( this );
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */