1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "ToolPanelUIElement.hxx"
22 #include "MethodGuard.hxx"
24 #include <com/sun/star/ui/UIElementType.hpp>
25 #include <com/sun/star/lang/XComponent.hpp>
27 #include <tools/diagnose_ex.h>
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::frame::XFrame
;
46 using ::com::sun::star::lang::XComponent
;
47 using ::com::sun::star::ui::XToolPanel
;
48 using ::com::sun::star::lang::DisposedException
;
50 namespace UIElementType
= ::com::sun::star::ui::UIElementType
;
52 typedef MethodGuard
< ToolPanelUIElement
> UIElementMethodGuard
;
54 //==================================================================================================================
55 //= ToolPanelUIElement
56 //==================================================================================================================
57 //------------------------------------------------------------------------------------------------------------------
58 ToolPanelUIElement::ToolPanelUIElement( const Reference
< XFrame
>& i_rFrame
, const OUString
& i_rResourceURL
,
59 const Reference
< XToolPanel
>& i_rToolPanel
)
60 :ToolPanelUIElement_Base( m_aMutex
)
62 ,m_sResourceURL( i_rResourceURL
)
63 ,m_xToolPanel( i_rToolPanel
)
67 //------------------------------------------------------------------------------------------------------------------
68 ToolPanelUIElement::~ToolPanelUIElement()
72 //------------------------------------------------------------------------------------------------------------------
73 void ToolPanelUIElement::checkDisposed()
75 if ( !m_xToolPanel
.is() )
76 throw DisposedException( OUString(), *this );
79 //------------------------------------------------------------------------------------------------------------------
80 Reference
< XFrame
> SAL_CALL
ToolPanelUIElement::getFrame() throw (RuntimeException
)
82 UIElementMethodGuard
aGuard( *this );
86 //------------------------------------------------------------------------------------------------------------------
87 OUString SAL_CALL
ToolPanelUIElement::getResourceURL() throw (RuntimeException
)
89 UIElementMethodGuard
aGuard( *this );
90 return m_sResourceURL
;
93 //------------------------------------------------------------------------------------------------------------------
94 ::sal_Int16 SAL_CALL
ToolPanelUIElement::getType() throw (RuntimeException
)
96 UIElementMethodGuard
aGuard( *this );
97 return UIElementType::TOOLPANEL
;
100 //------------------------------------------------------------------------------------------------------------------
101 Reference
< XInterface
> SAL_CALL
ToolPanelUIElement::getRealInterface( ) throw (RuntimeException
)
103 UIElementMethodGuard
aGuard( *this );
104 return m_xToolPanel
.get();
107 //------------------------------------------------------------------------------------------------------------------
108 void SAL_CALL
ToolPanelUIElement::disposing()
112 Reference
< XComponent
> xPanelComponent( m_xToolPanel
, UNO_QUERY_THROW
);
113 xPanelComponent
->dispose();
115 catch( const Exception
& )
117 DBG_UNHANDLED_EXCEPTION();
121 //......................................................................................................................
122 } } // namespace sd::toolpanel
123 //......................................................................................................................
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */