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