bump product version to 4.1.6.2
[LibreOffice.git] / sd / source / ui / toolpanel / ToolPanel.cxx
blobc89d64847fafacb14f5c82d99ddfff6f3e76b2fb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "ToolPanel.hxx"
22 #include "MethodGuard.hxx"
23 #include <taskpane/TaskPaneTreeNode.hxx>
25 #include <com/sun/star/lang/DisposedException.hpp>
27 #include <vcl/window.hxx>
29 //......................................................................................................................
30 namespace sd { namespace toolpanel
32 //......................................................................................................................
34 using ::com::sun::star::uno::Reference;
35 using ::com::sun::star::uno::XInterface;
36 using ::com::sun::star::uno::UNO_QUERY;
37 using ::com::sun::star::uno::UNO_QUERY_THROW;
38 using ::com::sun::star::uno::UNO_SET_THROW;
39 using ::com::sun::star::uno::Exception;
40 using ::com::sun::star::uno::RuntimeException;
41 using ::com::sun::star::uno::Any;
42 using ::com::sun::star::uno::makeAny;
43 using ::com::sun::star::uno::Sequence;
44 using ::com::sun::star::uno::Type;
45 using ::com::sun::star::lang::DisposedException;
46 using ::com::sun::star::awt::XWindow;
47 using ::com::sun::star::accessibility::XAccessible;
49 typedef MethodGuard< ToolPanel > ToolPanelGuard;
51 //==================================================================================================================
52 //= ToolPanel
53 //==================================================================================================================
54 //------------------------------------------------------------------------------------------------------------------
55 SAL_WNODEPRECATED_DECLARATIONS_PUSH
56 ToolPanel::ToolPanel( ::std::auto_ptr< TreeNode >& i_rControl )
57 :ToolPanel_Base( m_aMutex )
58 ,m_pControl( i_rControl )
61 SAL_WNODEPRECATED_DECLARATIONS_POP
63 //------------------------------------------------------------------------------------------------------------------
64 ToolPanel::~ToolPanel()
68 //------------------------------------------------------------------------------------------------------------------
69 void ToolPanel::checkDisposed()
71 if ( m_pControl.get() == NULL )
72 throw DisposedException( OUString(), *this );
75 //------------------------------------------------------------------------------------------------------------------
76 Reference< XWindow > SAL_CALL ToolPanel::getWindow() throw (RuntimeException)
78 ToolPanelGuard aGuard( *this );
79 return Reference< XWindow >( m_pControl->GetWindow()->GetComponentInterface(), UNO_QUERY_THROW );
82 //------------------------------------------------------------------------------------------------------------------
83 Reference< XAccessible > SAL_CALL ToolPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException)
85 ToolPanelGuard aGuard( *this );
86 Reference< XAccessible > xAccessible( m_pControl->GetWindow()->GetAccessible( sal_False ) );
87 if ( !xAccessible.is() )
89 xAccessible.set( m_pControl->CreateAccessibleObject( i_rParentAccessible ) );
90 m_pControl->GetWindow()->SetAccessible( xAccessible );
92 return xAccessible;
95 //------------------------------------------------------------------------------------------------------------------
96 void SAL_CALL ToolPanel::disposing()
98 m_pControl.reset();
101 //......................................................................................................................
102 } } // namespace sd::toolpanel
103 //......................................................................................................................
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */