Branch data Line data Source code
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 <accessibility/standard/vclxaccessibletabpagewindow.hxx>
21 : : #include <toolkit/helper/convert.hxx>
22 : : #include <vcl/tabctrl.hxx>
23 : : #include <vcl/tabpage.hxx>
24 : :
25 : :
26 : : using namespace ::com::sun::star;
27 : : using namespace ::com::sun::star::uno;
28 : : using namespace ::com::sun::star::accessibility;
29 : : using namespace ::comphelper;
30 : :
31 : :
32 : : // ----------------------------------------------------
33 : : // class VCLXAccessibleTabPageWindow
34 : : // ----------------------------------------------------
35 : :
36 : 0 : VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow )
37 : 0 : :VCLXAccessibleComponent( pVCLXWindow )
38 : : {
39 [ # # ]: 0 : m_pTabPage = static_cast< TabPage* >( GetWindow() );
40 [ # # ]: 0 : if ( m_pTabPage )
41 : : {
42 [ # # ]: 0 : Window* pParent = m_pTabPage->GetAccessibleParentWindow();
43 [ # # ][ # # ]: 0 : if ( pParent && pParent->GetType() == WINDOW_TABCONTROL )
[ # # ][ # # ]
44 : : {
45 : 0 : m_pTabControl = static_cast< TabControl* >( pParent );
46 [ # # ]: 0 : if ( m_pTabControl )
47 : : {
48 [ # # ][ # # ]: 0 : for ( sal_uInt16 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i )
49 : : {
50 [ # # ]: 0 : sal_uInt16 nPageId = m_pTabControl->GetPageId( i );
51 [ # # ][ # # ]: 0 : if ( m_pTabControl->GetTabPage( nPageId ) == m_pTabPage )
52 : 0 : m_nPageId = nPageId;
53 : : }
54 : : }
55 : : }
56 : : }
57 : 0 : }
58 : :
59 : : // -----------------------------------------------------------------------------
60 : :
61 : 0 : VCLXAccessibleTabPageWindow::~VCLXAccessibleTabPageWindow()
62 : : {
63 [ # # ]: 0 : }
64 : :
65 : : // -----------------------------------------------------------------------------
66 : : // OCommonAccessibleComponent
67 : : // -----------------------------------------------------------------------------
68 : :
69 : 0 : awt::Rectangle VCLXAccessibleTabPageWindow::implGetBounds() throw (RuntimeException)
70 : : {
71 : 0 : awt::Rectangle aBounds( 0, 0, 0, 0 );
72 : :
73 [ # # ]: 0 : if ( m_pTabControl )
74 : : {
75 [ # # ]: 0 : Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
76 [ # # ]: 0 : if ( m_pTabPage )
77 : : {
78 [ # # ][ # # ]: 0 : Rectangle aRect = Rectangle( m_pTabPage->GetPosPixel(), m_pTabPage->GetSizePixel() );
[ # # ]
79 [ # # ]: 0 : aRect.Move( -aPageRect.Left(), -aPageRect.Top() );
80 [ # # ]: 0 : aBounds = AWTRectangle( aRect );
81 : : }
82 : : }
83 : :
84 : 0 : return aBounds;
85 : : }
86 : :
87 : : // -----------------------------------------------------------------------------
88 : : // XComponent
89 : : // -----------------------------------------------------------------------------
90 : :
91 : 0 : void VCLXAccessibleTabPageWindow::disposing()
92 : : {
93 : 0 : VCLXAccessibleComponent::disposing();
94 : :
95 : 0 : m_pTabControl = NULL;
96 : 0 : m_pTabPage = NULL;
97 : 0 : }
98 : :
99 : : // -----------------------------------------------------------------------------
100 : : // XAccessibleContext
101 : : // -----------------------------------------------------------------------------
102 : :
103 : 0 : Reference< XAccessible > VCLXAccessibleTabPageWindow::getAccessibleParent( ) throw (RuntimeException)
104 : : {
105 [ # # ]: 0 : OExternalLockGuard aGuard( this );
106 : :
107 : 0 : Reference< XAccessible > xParent;
108 [ # # ]: 0 : if ( m_pTabControl )
109 : : {
110 [ # # ]: 0 : Reference< XAccessible > xAcc( m_pTabControl->GetAccessible() );
111 [ # # ]: 0 : if ( xAcc.is() )
112 : : {
113 [ # # ][ # # ]: 0 : Reference< XAccessibleContext > xCont( xAcc->getAccessibleContext() );
114 [ # # ]: 0 : if ( xCont.is() )
115 [ # # ][ # # ]: 0 : xParent = xCont->getAccessibleChild( m_pTabControl->GetPagePos( m_nPageId ) );
[ # # ][ # # ]
116 : 0 : }
117 : : }
118 : :
119 [ # # ]: 0 : return xParent;
120 : : }
121 : :
122 : : // -----------------------------------------------------------------------------
123 : :
124 : 0 : sal_Int32 VCLXAccessibleTabPageWindow::getAccessibleIndexInParent( ) throw (RuntimeException)
125 : : {
126 [ # # ]: 0 : OExternalLockGuard aGuard( this );
127 : :
128 [ # # ]: 0 : return 0;
129 : : }
130 : :
131 : : // -----------------------------------------------------------------------------
132 : :
133 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|