Branch data 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 "ToolPanelUIElement.hxx"
22 : : #include "MethodGuard.hxx"
23 : :
24 : : #include <com/sun/star/ui/UIElementType.hpp>
25 : : #include <com/sun/star/lang/XComponent.hpp>
26 : :
27 : : #include <tools/diagnose_ex.h>
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::frame::XFrame;
47 : : using ::com::sun::star::lang::XComponent;
48 : : using ::com::sun::star::ui::XToolPanel;
49 : : using ::com::sun::star::lang::DisposedException;
50 : : /** === end UNO using === **/
51 : : namespace UIElementType = ::com::sun::star::ui::UIElementType;
52 : :
53 : : typedef MethodGuard< ToolPanelUIElement > UIElementMethodGuard;
54 : :
55 : : //==================================================================================================================
56 : : //= ToolPanelUIElement
57 : : //==================================================================================================================
58 : : //------------------------------------------------------------------------------------------------------------------
59 : 32 : ToolPanelUIElement::ToolPanelUIElement( const Reference< XFrame >& i_rFrame, const ::rtl::OUString& i_rResourceURL,
60 : : const Reference< XToolPanel >& i_rToolPanel )
61 : : :ToolPanelUIElement_Base( m_aMutex )
62 : : ,m_xFrame( i_rFrame )
63 : : ,m_sResourceURL( i_rResourceURL )
64 : 32 : ,m_xToolPanel( i_rToolPanel )
65 : : {
66 : 32 : }
67 : :
68 : : //------------------------------------------------------------------------------------------------------------------
69 [ + - ]: 32 : ToolPanelUIElement::~ToolPanelUIElement()
70 : : {
71 [ - + ]: 64 : }
72 : :
73 : : //------------------------------------------------------------------------------------------------------------------
74 : 32 : void ToolPanelUIElement::checkDisposed()
75 : : {
76 [ - + ]: 32 : if ( !m_xToolPanel.is() )
77 [ # # ][ # # ]: 0 : throw DisposedException( ::rtl::OUString(), *this );
78 : 32 : }
79 : :
80 : : //------------------------------------------------------------------------------------------------------------------
81 : 0 : Reference< XFrame > SAL_CALL ToolPanelUIElement::getFrame() throw (RuntimeException)
82 : : {
83 [ # # ]: 0 : UIElementMethodGuard aGuard( *this );
84 [ # # ]: 0 : return m_xFrame;
85 : : }
86 : :
87 : : //------------------------------------------------------------------------------------------------------------------
88 : 0 : ::rtl::OUString SAL_CALL ToolPanelUIElement::getResourceURL() throw (RuntimeException)
89 : : {
90 [ # # ]: 0 : UIElementMethodGuard aGuard( *this );
91 [ # # ]: 0 : return m_sResourceURL;
92 : : }
93 : :
94 : : //------------------------------------------------------------------------------------------------------------------
95 : 0 : ::sal_Int16 SAL_CALL ToolPanelUIElement::getType() throw (RuntimeException)
96 : : {
97 [ # # ]: 0 : UIElementMethodGuard aGuard( *this );
98 [ # # ]: 0 : return UIElementType::TOOLPANEL;
99 : : }
100 : :
101 : : //------------------------------------------------------------------------------------------------------------------
102 : 32 : Reference< XInterface > SAL_CALL ToolPanelUIElement::getRealInterface( ) throw (RuntimeException)
103 : : {
104 [ + - ]: 32 : UIElementMethodGuard aGuard( *this );
105 [ + - ][ + - ]: 32 : return m_xToolPanel.get();
[ + - ]
106 : : }
107 : :
108 : : //------------------------------------------------------------------------------------------------------------------
109 : 32 : void SAL_CALL ToolPanelUIElement::disposing()
110 : : {
111 : : try
112 : : {
113 [ + - ]: 32 : Reference< XComponent > xPanelComponent( m_xToolPanel, UNO_QUERY_THROW );
114 [ + - ][ + - ]: 32 : xPanelComponent->dispose();
[ # # ]
115 : : }
116 : 0 : catch( const Exception& )
117 : : {
118 : : DBG_UNHANDLED_EXCEPTION();
119 : : }
120 : 32 : }
121 : :
122 : : //......................................................................................................................
123 : : } } // namespace sd::toolpanel
124 : : //......................................................................................................................
125 : :
126 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|