Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 : : *
5 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
6 : : *
7 : : * OpenOffice.org - a multi-platform office productivity suite
8 : : *
9 : : * This file is part of OpenOffice.org.
10 : : *
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.
14 : : *
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).
20 : : *
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.
25 : : *
26 : : ************************************************************************/
27 : :
28 : :
29 : : #include "ToolPanel.hxx"
30 : : #include "MethodGuard.hxx"
31 : : #include <taskpane/TaskPaneTreeNode.hxx>
32 : :
33 : : #include <com/sun/star/lang/DisposedException.hpp>
34 : :
35 : : #include <vcl/window.hxx>
36 : :
37 : : //......................................................................................................................
38 : : namespace sd { namespace toolpanel
39 : : {
40 : : //......................................................................................................................
41 : :
42 : : /** === begin UNO using === **/
43 : : using ::com::sun::star::uno::Reference;
44 : : using ::com::sun::star::uno::XInterface;
45 : : using ::com::sun::star::uno::UNO_QUERY;
46 : : using ::com::sun::star::uno::UNO_QUERY_THROW;
47 : : using ::com::sun::star::uno::UNO_SET_THROW;
48 : : using ::com::sun::star::uno::Exception;
49 : : using ::com::sun::star::uno::RuntimeException;
50 : : using ::com::sun::star::uno::Any;
51 : : using ::com::sun::star::uno::makeAny;
52 : : using ::com::sun::star::uno::Sequence;
53 : : using ::com::sun::star::uno::Type;
54 : : using ::com::sun::star::lang::DisposedException;
55 : : using ::com::sun::star::awt::XWindow;
56 : : using ::com::sun::star::accessibility::XAccessible;
57 : : /** === end UNO using === **/
58 : :
59 : : typedef MethodGuard< ToolPanel > ToolPanelGuard;
60 : :
61 : : //==================================================================================================================
62 : : //= ToolPanel
63 : : //==================================================================================================================
64 : : //------------------------------------------------------------------------------------------------------------------
65 : : SAL_WNODEPRECATED_DECLARATIONS_PUSH
66 : 32 : ToolPanel::ToolPanel( ::std::auto_ptr< TreeNode >& i_rControl )
67 : : :ToolPanel_Base( m_aMutex )
68 : 32 : ,m_pControl( i_rControl )
69 : : {
70 : 32 : }
71 : : SAL_WNODEPRECATED_DECLARATIONS_POP
72 : :
73 : : //------------------------------------------------------------------------------------------------------------------
74 [ + - ][ + - ]: 32 : ToolPanel::~ToolPanel()
75 : : {
76 [ - + ]: 64 : }
77 : :
78 : : //------------------------------------------------------------------------------------------------------------------
79 : 32 : void ToolPanel::checkDisposed()
80 : : {
81 [ - + ]: 32 : if ( m_pControl.get() == NULL )
82 [ # # ][ # # ]: 0 : throw DisposedException( ::rtl::OUString(), *this );
83 : 32 : }
84 : :
85 : : //------------------------------------------------------------------------------------------------------------------
86 : 32 : Reference< XWindow > SAL_CALL ToolPanel::getWindow() throw (RuntimeException)
87 : : {
88 [ + - ]: 32 : ToolPanelGuard aGuard( *this );
89 [ + - ][ + - ]: 32 : return Reference< XWindow >( m_pControl->GetWindow()->GetComponentInterface(), UNO_QUERY_THROW );
[ + - ][ + - ]
90 : : }
91 : :
92 : : //------------------------------------------------------------------------------------------------------------------
93 : 0 : Reference< XAccessible > SAL_CALL ToolPanel::createAccessible( const Reference< XAccessible >& i_rParentAccessible ) throw (RuntimeException)
94 : : {
95 [ # # ]: 0 : ToolPanelGuard aGuard( *this );
96 [ # # ][ # # ]: 0 : Reference< XAccessible > xAccessible( m_pControl->GetWindow()->GetAccessible( sal_False ) );
97 [ # # ]: 0 : if ( !xAccessible.is() )
98 : : {
99 [ # # ][ # # ]: 0 : xAccessible.set( m_pControl->CreateAccessibleObject( i_rParentAccessible ) );
100 [ # # ][ # # ]: 0 : m_pControl->GetWindow()->SetAccessible( xAccessible );
101 : : }
102 [ # # ]: 0 : return xAccessible;
103 : : }
104 : :
105 : : //------------------------------------------------------------------------------------------------------------------
106 : 32 : void SAL_CALL ToolPanel::disposing()
107 : : {
108 : 32 : m_pControl.reset();
109 : 32 : }
110 : :
111 : : //......................................................................................................................
112 : : } } // namespace sd::toolpanel
113 : : //......................................................................................................................
114 : :
115 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|