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 "toolpaneldeckpeer.hxx"
27 #include "svtools/toolpanel/toolpaneldeck.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 	//= ToolPanelDeckPeer
58 	//==================================================================================================================
59 	//------------------------------------------------------------------------------------------------------------------
ToolPanelDeckPeer(ToolPanelDeck & i_rDeck)60     ToolPanelDeckPeer::ToolPanelDeckPeer( ToolPanelDeck& i_rDeck )
61         :VCLXWindow()
62         ,m_pDeck( &i_rDeck )
63     {
64     }
65 
66 	//------------------------------------------------------------------------------------------------------------------
~ToolPanelDeckPeer()67     ToolPanelDeckPeer::~ToolPanelDeckPeer()
68     {
69     }
70 
71 	//------------------------------------------------------------------------------------------------------------------
CreateAccessibleContext()72     Reference< XAccessibleContext > ToolPanelDeckPeer::CreateAccessibleContext()
73     {
74         ::vos::OGuard aSolarGuard( GetMutex() );
75         if ( m_pDeck == NULL )
76             throw DisposedException( ::rtl::OUString(), *this );
77 
78         Window* pAccessibleParent( m_pDeck->GetAccessibleParentWindow() );
79         ENSURE_OR_RETURN( pAccessibleParent != NULL, "no accessible parent => no accessible context", NULL );
80         Reference< XAccessible > xAccessibleParent( pAccessibleParent->GetAccessible(), UNO_SET_THROW );
81         return m_aAccessibleFactory.getFactory().createAccessibleToolPanelDeck( xAccessibleParent, *m_pDeck );
82     }
83 
84 	//------------------------------------------------------------------------------------------------------------------
dispose()85     void SAL_CALL ToolPanelDeckPeer::dispose() throw(RuntimeException)
86     {
87         {
88             ::vos::OGuard aSolarGuard( GetMutex() );
89             m_pDeck = NULL;
90         }
91         VCLXWindow::dispose();
92     }
93 
94 //......................................................................................................................
95 } // namespace svt
96 //......................................................................................................................
97