Update ooo320-m1
[ooovba.git] / framework / inc / helper / uiconfigelementwrapperbase.hxx
blobcffe6f6777f1e776c20cebefa753acd2f92f830a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: uiconfigelementwrapperbase.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef __FRAMEWORK_HELPER_UICONFIGELEMENTWRAPPERBASE_HXX_
32 #define __FRAMEWORK_HELPER_UICONFIGELEMENTWRAPPERBASE_HXX_
34 //_________________________________________________________________________________________________________________
35 // my own includes
36 //_________________________________________________________________________________________________________________
38 #include <threadhelp/threadhelpbase.hxx>
39 #include <macros/generic.hxx>
40 #include <macros/xinterface.hxx>
41 #include <macros/xtypeprovider.hxx>
43 //_________________________________________________________________________________________________________________
44 // interface includes
45 //_________________________________________________________________________________________________________________
46 #include <com/sun/star/ui/XUIElement.hpp>
47 #include <com/sun/star/ui/XUIElementSettings.hpp>
48 #include <com/sun/star/ui/XUIConfigurationManager.hpp>
49 #include <com/sun/star/ui/XUIConfigurationListener.hpp>
50 #include <com/sun/star/frame/XFrame.hpp>
51 #include <com/sun/star/awt/XMenuBar.hpp>
52 #include <com/sun/star/util/XUpdatable.hpp>
53 #include <com/sun/star/lang/XInitialization.hpp>
54 #include <com/sun/star/lang/XComponent.hpp>
55 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
57 //_________________________________________________________________________________________________________________
58 // other includes
59 //_________________________________________________________________________________________________________________
60 #include <rtl/ustring.hxx>
61 #include <cppuhelper/propshlp.hxx>
62 #include <cppuhelper/interfacecontainer.hxx>
63 #include <cppuhelper/weak.hxx>
65 namespace framework
68 class UIConfigElementWrapperBase : public ::com::sun::star::lang::XTypeProvider ,
69 public ::com::sun::star::ui::XUIElement ,
70 public ::com::sun::star::ui::XUIElementSettings ,
71 public ::com::sun::star::lang::XInitialization ,
72 public ::com::sun::star::lang::XComponent ,
73 public ::com::sun::star::util::XUpdatable ,
74 public ::com::sun::star::ui::XUIConfigurationListener ,
75 protected ThreadHelpBase ,
76 public ::cppu::OBroadcastHelper ,
77 public ::cppu::OPropertySetHelper ,
78 public ::cppu::OWeakObject
80 //-------------------------------------------------------------------------------------------------------------
81 // public methods
82 //-------------------------------------------------------------------------------------------------------------
83 public:
84 UIConfigElementWrapperBase( sal_Int16 nType,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory );
85 virtual ~UIConfigElementWrapperBase();
87 //---------------------------------------------------------------------------------------------------------
88 // XInterface, XTypeProvider
89 //---------------------------------------------------------------------------------------------------------
90 FWK_DECLARE_XINTERFACE
91 FWK_DECLARE_XTYPEPROVIDER
93 // XComponent
94 virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) = 0;
95 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
96 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
98 // XInitialization
99 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);
101 // XUIElementSettings
102 virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException) = 0;
103 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( sal_Bool bWriteable ) throw (::com::sun::star::uno::RuntimeException);
104 virtual void SAL_CALL setSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& UISettings ) throw (::com::sun::star::uno::RuntimeException);
106 // XUIElement
107 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException) = 0;
109 // XUpdatable
110 virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException);
112 // XUIConfigurationListener
113 virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
114 virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
115 virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException);
117 // XEventListener
118 using cppu::OPropertySetHelper::disposing;
119 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException);
121 //-------------------------------------------------------------------------------------------------------------
122 // protected methods
123 //-------------------------------------------------------------------------------------------------------------
124 protected:
126 // OPropertySetHelper
127 virtual sal_Bool SAL_CALL convertFastPropertyValue ( com::sun::star::uno::Any& aConvertedValue ,
128 com::sun::star::uno::Any& aOldValue ,
129 sal_Int32 nHandle ,
130 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException );
131 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle ,
132 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception );
133 using cppu::OPropertySetHelper::getFastPropertyValue;
134 virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue ,
135 sal_Int32 nHandle ) const;
136 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
137 virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException);
139 virtual void impl_fillNewData();
141 static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor();
143 sal_Int16 m_nType;
144 bool m_bPersistent : 1,
145 m_bInitialized : 1,
146 m_bConfigListener : 1,
147 m_bConfigListening : 1,
148 m_bDisposed : 1,
149 m_bNoClose : 1;
150 rtl::OUString m_aResourceURL;
151 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory;
152 com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xConfigSource;
153 com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xConfigData;
154 com::sun::star::uno::WeakReference< com::sun::star::frame::XFrame > m_xWeakFrame;
155 com::sun::star::uno::Reference< com::sun::star::awt::XMenuBar > m_xMenuBar;
156 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener
159 } // namespace framework
161 #endif // __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_