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 :
21 : #include "ToolPanel.hxx"
22 : #include "MethodGuard.hxx"
23 : #include <taskpane/TaskPaneTreeNode.hxx>
24 :
25 : #include <com/sun/star/lang/DisposedException.hpp>
26 :
27 : #include <vcl/window.hxx>
28 :
29 : //......................................................................................................................
30 : namespace sd { namespace toolpanel
31 : {
32 : //......................................................................................................................
33 :
34 : /** === begin UNO using === **/
35 : using ::com::sun::star::uno::Reference;
36 : using ::com::sun::star::uno::XInterface;
37 : using ::com::sun::star::uno::UNO_QUERY;
38 : using ::com::sun::star::uno::UNO_QUERY_THROW;
39 : using ::com::sun::star::uno::UNO_SET_THROW;
40 : using ::com::sun::star::uno::Exception;
41 : using ::com::sun::star::uno::RuntimeException;
42 : using ::com::sun::star::uno::Any;
43 : using ::com::sun::star::uno::makeAny;
44 : using ::com::sun::star::uno::Sequence;
45 : using ::com::sun::star::uno::Type;
46 : using ::com::sun::star::lang::DisposedException;
47 : using ::com::sun::star::awt::XWindow;
48 : using ::com::sun::star::accessibility::XAccessible;
49 : /** === end UNO using === **/
50 :
51 : typedef MethodGuard< ToolPanel > ToolPanelGuard;
52 :
53 : //==================================================================================================================
54 : //= ToolPanel
55 : //==================================================================================================================
56 : //------------------------------------------------------------------------------------------------------------------
57 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
58 0 : ToolPanel::ToolPanel( ::std::auto_ptr< TreeNode >& i_rControl )
59 : :ToolPanel_Base( m_aMutex )
60 0 : ,m_pControl( i_rControl )
61 : {
62 0 : }
63 : SAL_WNODEPRECATED_DECLARATIONS_POP
64 :
65 : //------------------------------------------------------------------------------------------------------------------
66 0 : ToolPanel::~ToolPanel()
67 : {
68 0 : }
69 :
70 : //------------------------------------------------------------------------------------------------------------------
71 0 : void ToolPanel::checkDisposed()
72 : {
73 0 : if ( m_pControl.get() == NULL )
74 0 : throw DisposedException( ::rtl::OUString(), *this );
75 0 : }
76 :
77 : //------------------------------------------------------------------------------------------------------------------
78 0 : Reference< XWindow > SAL_CALL ToolPanel::getWindow() throw (RuntimeException)
79 : {
80 0 : ToolPanelGuard aGuard( *this );
81 0 : return Reference< XWindow >( m_pControl->GetWindow()->GetComponentInterface(), UNO_QUERY_THROW );
82 : }
83 :
84 : //------------------------------------------------------------------------------------------------------------------
85 0 : Reference< XAccessible > SAL_CALL ToolPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException)
86 : {
87 0 : ToolPanelGuard aGuard( *this );
88 0 : Reference< XAccessible > xAccessible( m_pControl->GetWindow()->GetAccessible( sal_False ) );
89 0 : if ( !xAccessible.is() )
90 : {
91 0 : xAccessible.set( m_pControl->CreateAccessibleObject( i_rParentAccessible ) );
92 0 : m_pControl->GetWindow()->SetAccessible( xAccessible );
93 : }
94 0 : return xAccessible;
95 : }
96 :
97 : //------------------------------------------------------------------------------------------------------------------
98 0 : void SAL_CALL ToolPanel::disposing()
99 : {
100 0 : m_pControl.reset();
101 0 : }
102 :
103 : //......................................................................................................................
104 : } } // namespace sd::toolpanel
105 : //......................................................................................................................
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|