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