1c82f2877SAndrew Rist /**************************************************************
2*15466770Smseidel *
3c82f2877SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4c82f2877SAndrew Rist * or more contributor license agreements. See the NOTICE file
5c82f2877SAndrew Rist * distributed with this work for additional information
6c82f2877SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7c82f2877SAndrew Rist * to you under the Apache License, Version 2.0 (the
8c82f2877SAndrew Rist * "License"); you may not use this file except in compliance
9c82f2877SAndrew Rist * with the License. You may obtain a copy of the License at
10*15466770Smseidel *
11c82f2877SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*15466770Smseidel *
13c82f2877SAndrew Rist * Unless required by applicable law or agreed to in writing,
14c82f2877SAndrew Rist * software distributed under the License is distributed on an
15c82f2877SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c82f2877SAndrew Rist * KIND, either express or implied. See the License for the
17c82f2877SAndrew Rist * specific language governing permissions and limitations
18c82f2877SAndrew Rist * under the License.
19*15466770Smseidel *
20c82f2877SAndrew Rist *************************************************************/
21c82f2877SAndrew Rist
22c82f2877SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_accessibility.hxx"
26cdf0e10cSrcweir #include <accessibility/standard/vclxaccessibletabpagewindow.hxx>
27cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
28cdf0e10cSrcweir #include <vcl/tabctrl.hxx>
29cdf0e10cSrcweir #include <vcl/tabpage.hxx>
30cdf0e10cSrcweir
31cdf0e10cSrcweir
32cdf0e10cSrcweir using namespace ::com::sun::star;
33cdf0e10cSrcweir using namespace ::com::sun::star::uno;
34cdf0e10cSrcweir using namespace ::com::sun::star::accessibility;
35cdf0e10cSrcweir using namespace ::comphelper;
36cdf0e10cSrcweir
37cdf0e10cSrcweir
38cdf0e10cSrcweir // ----------------------------------------------------
39cdf0e10cSrcweir // class VCLXAccessibleTabPageWindow
40cdf0e10cSrcweir // ----------------------------------------------------
41cdf0e10cSrcweir
VCLXAccessibleTabPageWindow(VCLXWindow * pVCLXWindow)42cdf0e10cSrcweir VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow* pVCLXWindow )
43cdf0e10cSrcweir :VCLXAccessibleComponent( pVCLXWindow )
44cdf0e10cSrcweir {
45*15466770Smseidel m_pTabPage = static_cast< TabPage* >( GetWindow() );
46*15466770Smseidel if ( m_pTabPage )
47*15466770Smseidel {
48*15466770Smseidel Window* pParent = m_pTabPage->GetAccessibleParentWindow();
49*15466770Smseidel if ( pParent && pParent->GetType() == WINDOW_TABCONTROL )
50*15466770Smseidel {
51*15466770Smseidel m_pTabControl = static_cast< TabControl* >( pParent );
52*15466770Smseidel if ( m_pTabControl )
53*15466770Smseidel {
54*15466770Smseidel for ( sal_uInt16 i = 0, nCount = m_pTabControl->GetPageCount(); i < nCount; ++i )
55*15466770Smseidel {
56*15466770Smseidel sal_uInt16 nPageId = m_pTabControl->GetPageId( i );
57*15466770Smseidel if ( m_pTabControl->GetTabPage( nPageId ) == m_pTabPage )
58*15466770Smseidel m_nPageId = nPageId;
59*15466770Smseidel }
60*15466770Smseidel }
61*15466770Smseidel }
62*15466770Smseidel }
63cdf0e10cSrcweir }
64cdf0e10cSrcweir
65cdf0e10cSrcweir // -----------------------------------------------------------------------------
66cdf0e10cSrcweir
~VCLXAccessibleTabPageWindow()67cdf0e10cSrcweir VCLXAccessibleTabPageWindow::~VCLXAccessibleTabPageWindow()
68cdf0e10cSrcweir {
69cdf0e10cSrcweir }
70cdf0e10cSrcweir
71cdf0e10cSrcweir // -----------------------------------------------------------------------------
72*15466770Smseidel // OCommonAccessibleComponent
73cdf0e10cSrcweir // -----------------------------------------------------------------------------
74cdf0e10cSrcweir
implGetBounds()75cdf0e10cSrcweir awt::Rectangle VCLXAccessibleTabPageWindow::implGetBounds() throw (RuntimeException)
76cdf0e10cSrcweir {
77*15466770Smseidel awt::Rectangle aBounds( 0, 0, 0, 0 );
78*15466770Smseidel
79*15466770Smseidel if ( m_pTabControl )
80*15466770Smseidel {
81*15466770Smseidel Rectangle aPageRect = m_pTabControl->GetTabBounds( m_nPageId );
82*15466770Smseidel if ( m_pTabPage )
83*15466770Smseidel {
84*15466770Smseidel Rectangle aRect = Rectangle( m_pTabPage->GetPosPixel(), m_pTabPage->GetSizePixel() );
85*15466770Smseidel aRect.Move( -aPageRect.Left(), -aPageRect.Top() );
86*15466770Smseidel aBounds = AWTRectangle( aRect );
87*15466770Smseidel }
88*15466770Smseidel }
89cdf0e10cSrcweir
90cdf0e10cSrcweir return aBounds;
91cdf0e10cSrcweir }
92cdf0e10cSrcweir
93cdf0e10cSrcweir // -----------------------------------------------------------------------------
94cdf0e10cSrcweir // XComponent
95cdf0e10cSrcweir // -----------------------------------------------------------------------------
96cdf0e10cSrcweir
disposing()97cdf0e10cSrcweir void VCLXAccessibleTabPageWindow::disposing()
98cdf0e10cSrcweir {
99cdf0e10cSrcweir VCLXAccessibleComponent::disposing();
100cdf0e10cSrcweir
101*15466770Smseidel m_pTabControl = NULL;
102*15466770Smseidel m_pTabPage = NULL;
103cdf0e10cSrcweir }
104cdf0e10cSrcweir
105cdf0e10cSrcweir // -----------------------------------------------------------------------------
106cdf0e10cSrcweir // XAccessibleContext
107cdf0e10cSrcweir // -----------------------------------------------------------------------------
108cdf0e10cSrcweir
getAccessibleParent()109cdf0e10cSrcweir Reference< XAccessible > VCLXAccessibleTabPageWindow::getAccessibleParent( ) throw (RuntimeException)
110cdf0e10cSrcweir {
111*15466770Smseidel OExternalLockGuard aGuard( this );
112cdf0e10cSrcweir
113cdf0e10cSrcweir Reference< XAccessible > xParent;
114*15466770Smseidel if ( m_pTabControl )
115*15466770Smseidel {
116*15466770Smseidel Reference< XAccessible > xAcc( m_pTabControl->GetAccessible() );
117*15466770Smseidel if ( xAcc.is() )
118*15466770Smseidel {
119*15466770Smseidel Reference< XAccessibleContext > xCont( xAcc->getAccessibleContext() );
120*15466770Smseidel if ( xCont.is() )
121*15466770Smseidel xParent = xCont->getAccessibleChild( m_pTabControl->GetPagePos( m_nPageId ) );
122*15466770Smseidel }
123*15466770Smseidel }
124cdf0e10cSrcweir
125cdf0e10cSrcweir return xParent;
126cdf0e10cSrcweir }
127cdf0e10cSrcweir
128cdf0e10cSrcweir // -----------------------------------------------------------------------------
129cdf0e10cSrcweir
getAccessibleIndexInParent()130cdf0e10cSrcweir sal_Int32 VCLXAccessibleTabPageWindow::getAccessibleIndexInParent( ) throw (RuntimeException)
131cdf0e10cSrcweir {
132cdf0e10cSrcweir OExternalLockGuard aGuard( this );
133cdf0e10cSrcweir
134*15466770Smseidel return 0;
135cdf0e10cSrcweir }
136cdf0e10cSrcweir
137cdf0e10cSrcweir // -----------------------------------------------------------------------------
138