1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_accessibility.hxx"
30 #include <accessibility/standard/vclxaccessibletabpagewindow.hxx>
31 #include <toolkit/helper/convert.hxx>
32 #include <vcl/tabctrl.hxx>
33 #include <vcl/tabpage.hxx>
36 using namespace ::com::sun::star
;
37 using namespace ::com::sun::star::uno
;
38 using namespace ::com::sun::star::accessibility
;
39 using namespace ::comphelper
;
42 // ----------------------------------------------------
43 // class VCLXAccessibleTabPageWindow
44 // ----------------------------------------------------
46 VCLXAccessibleTabPageWindow::VCLXAccessibleTabPageWindow( VCLXWindow
* pVCLXWindow
)
47 :VCLXAccessibleComponent( pVCLXWindow
)
49 m_pTabPage
= static_cast< TabPage
* >( GetWindow() );
52 Window
* pParent
= m_pTabPage
->GetAccessibleParentWindow();
53 if ( pParent
&& pParent
->GetType() == WINDOW_TABCONTROL
)
55 m_pTabControl
= static_cast< TabControl
* >( pParent
);
58 for ( sal_uInt16 i
= 0, nCount
= m_pTabControl
->GetPageCount(); i
< nCount
; ++i
)
60 sal_uInt16 nPageId
= m_pTabControl
->GetPageId( i
);
61 if ( m_pTabControl
->GetTabPage( nPageId
) == m_pTabPage
)
69 // -----------------------------------------------------------------------------
71 VCLXAccessibleTabPageWindow::~VCLXAccessibleTabPageWindow()
75 // -----------------------------------------------------------------------------
76 // OCommonAccessibleComponent
77 // -----------------------------------------------------------------------------
79 awt::Rectangle
VCLXAccessibleTabPageWindow::implGetBounds() throw (RuntimeException
)
81 awt::Rectangle
aBounds( 0, 0, 0, 0 );
85 Rectangle aPageRect
= m_pTabControl
->GetTabBounds( m_nPageId
);
88 Rectangle aRect
= Rectangle( m_pTabPage
->GetPosPixel(), m_pTabPage
->GetSizePixel() );
89 aRect
.Move( -aPageRect
.Left(), -aPageRect
.Top() );
90 aBounds
= AWTRectangle( aRect
);
97 // -----------------------------------------------------------------------------
99 // -----------------------------------------------------------------------------
101 void VCLXAccessibleTabPageWindow::disposing()
103 VCLXAccessibleComponent::disposing();
105 m_pTabControl
= NULL
;
109 // -----------------------------------------------------------------------------
110 // XAccessibleContext
111 // -----------------------------------------------------------------------------
113 Reference
< XAccessible
> VCLXAccessibleTabPageWindow::getAccessibleParent( ) throw (RuntimeException
)
115 OExternalLockGuard
aGuard( this );
117 Reference
< XAccessible
> xParent
;
120 Reference
< XAccessible
> xAcc( m_pTabControl
->GetAccessible() );
123 Reference
< XAccessibleContext
> xCont( xAcc
->getAccessibleContext() );
125 xParent
= xCont
->getAccessibleChild( m_pTabControl
->GetPagePos( m_nPageId
) );
132 // -----------------------------------------------------------------------------
134 sal_Int32
VCLXAccessibleTabPageWindow::getAccessibleIndexInParent( ) throw (RuntimeException
)
136 OExternalLockGuard
aGuard( this );
141 // -----------------------------------------------------------------------------