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 : #ifndef INCLUDED_FRAMEWORK_INC_HELPER_UIELEMENTWRAPPERBASE_HXX
21 : #define INCLUDED_FRAMEWORK_INC_HELPER_UIELEMENTWRAPPERBASE_HXX
22 :
23 : #include <macros/generic.hxx>
24 : #include <macros/xinterface.hxx>
25 : #include <macros/xtypeprovider.hxx>
26 :
27 : #include <com/sun/star/ui/XUIElement.hpp>
28 : #include <com/sun/star/lang/XInitialization.hpp>
29 : #include <com/sun/star/lang/XComponent.hpp>
30 : #include <com/sun/star/frame/XFrame.hpp>
31 : #include <com/sun/star/util/XUpdatable.hpp>
32 :
33 : #include <rtl/ustring.hxx>
34 : #include <cppuhelper/basemutex.hxx>
35 : #include <cppuhelper/propshlp.hxx>
36 : #include <cppuhelper/implbase4.hxx>
37 :
38 : namespace framework
39 : {
40 :
41 : typedef ::cppu::WeakImplHelper4<
42 : ::com::sun::star::ui::XUIElement,
43 : ::com::sun::star::lang::XInitialization,
44 : ::com::sun::star::lang::XComponent,
45 : ::com::sun::star::util::XUpdatable > UIElementWrapperBase_BASE;
46 :
47 : class UIElementWrapperBase : private cppu::BaseMutex,
48 : public ::cppu::OBroadcastHelper ,
49 : public ::cppu::OPropertySetHelper ,
50 : public UIElementWrapperBase_BASE
51 : {
52 :
53 : // public methods
54 :
55 : public:
56 : UIElementWrapperBase( sal_Int16 nType );
57 : virtual ~UIElementWrapperBase();
58 :
59 : // XInterface
60 0 : virtual void SAL_CALL acquire() throw () SAL_OVERRIDE
61 0 : { OWeakObject::acquire(); }
62 0 : virtual void SAL_CALL release() throw () SAL_OVERRIDE
63 0 : { OWeakObject::release(); }
64 : virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& type) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
65 :
66 : // XTypeProvider
67 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
68 :
69 : // XComponent
70 : virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE = 0;
71 : virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
72 : virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
73 :
74 : // XInitialization
75 : virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
76 :
77 : // XUpdatable
78 : virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
79 :
80 : // XUIElement
81 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
82 : virtual OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 : virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
84 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE = 0;
85 :
86 : // protected methods
87 :
88 : protected:
89 :
90 : // OPropertySetHelper
91 : virtual sal_Bool SAL_CALL convertFastPropertyValue ( com::sun::star::uno::Any& aConvertedValue ,
92 : com::sun::star::uno::Any& aOldValue ,
93 : sal_Int32 nHandle ,
94 : const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ) SAL_OVERRIDE;
95 : virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
96 : const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception, std::exception ) SAL_OVERRIDE;
97 : using cppu::OPropertySetHelper::getFastPropertyValue;
98 : virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue ,
99 : sal_Int32 nHandle ) const SAL_OVERRIDE;
100 : virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE;
101 : virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
102 :
103 : static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor();
104 :
105 : ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
106 : OUString m_aResourceURL;
107 : com::sun::star::uno::WeakReference< com::sun::star::frame::XFrame > m_xWeakFrame;
108 : sal_Int16 m_nType;
109 : bool m_bInitialized : 1,
110 : m_bDisposed;
111 : };
112 :
113 : } // namespace framework
114 :
115 : #endif // INCLUDED_FRAMEWORK_INC_HELPER_UIELEMENTWRAPPERBASE_HXX
116 :
117 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|