1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #include "precompiled_svtools.hxx"
25 
26 #include "paneltabbarpeer.hxx"
27 #include "svtools/toolpanel/paneltabbar.hxx"
28 
29 /** === begin UNO includes === **/
30 #include <com/sun/star/lang/DisposedException.hpp>
31 /** === end UNO includes === **/
32 
33 #include <tools/diagnose_ex.h>
34 
35 //........................................................................
36 namespace svt
37 {
38 //........................................................................
39 
40 	/** === begin UNO using === **/
41 	using ::com::sun::star::uno::Reference;
42 	using ::com::sun::star::uno::XInterface;
43 	using ::com::sun::star::uno::UNO_QUERY;
44 	using ::com::sun::star::uno::UNO_QUERY_THROW;
45 	using ::com::sun::star::uno::UNO_SET_THROW;
46 	using ::com::sun::star::uno::Exception;
47 	using ::com::sun::star::uno::RuntimeException;
48 	using ::com::sun::star::uno::Any;
49 	using ::com::sun::star::uno::makeAny;
50 	using ::com::sun::star::uno::Sequence;
51 	using ::com::sun::star::uno::Type;
52     using ::com::sun::star::accessibility::XAccessibleContext;
53     using ::com::sun::star::lang::DisposedException;
54 	/** === end UNO using === **/
55 
56 	//==================================================================================================================
57 	//= PanelTabBarPeer
58 	//==================================================================================================================
59 	//------------------------------------------------------------------------------------------------------------------
PanelTabBarPeer(PanelTabBar & i_rTabBar)60     PanelTabBarPeer::PanelTabBarPeer( PanelTabBar& i_rTabBar )
61         :VCLXWindow()
62         ,m_pTabBar( &i_rTabBar )
63     {
64     }
65 
66 	//------------------------------------------------------------------------------------------------------------------
~PanelTabBarPeer()67     PanelTabBarPeer::~PanelTabBarPeer()
68     {
69     }
70 
71 	//------------------------------------------------------------------------------------------------------------------
CreateAccessibleContext()72     Reference< XAccessibleContext > PanelTabBarPeer::CreateAccessibleContext()
73     {
74         ::vos::OGuard aSolarGuard( GetMutex() );
75         if ( m_pTabBar == NULL )
76             throw DisposedException( ::rtl::OUString(), *this );
77 
78 
79 
80         Window* pAccessibleParent( m_pTabBar->GetAccessibleParentWindow() );
81         ENSURE_OR_RETURN( pAccessibleParent != NULL, "no accessible parent => no accessible context", NULL );
82         Reference< XAccessible > xAccessibleParent( pAccessibleParent->GetAccessible(), UNO_SET_THROW );
83         return m_aAccessibleFactory.getFactory().createAccessibleToolPanelTabBar( xAccessibleParent, m_pTabBar->GetPanelDeck(), *m_pTabBar );
84     }
85 
86 	//------------------------------------------------------------------------------------------------------------------
dispose()87     void SAL_CALL PanelTabBarPeer::dispose() throw(RuntimeException)
88     {
89         {
90             ::vos::OGuard aSolarGuard( GetMutex() );
91             m_pTabBar = NULL;
92         }
93         VCLXWindow::dispose();
94     }
95 
96 //........................................................................
97 } // namespace svt
98 //........................................................................
99