1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef __FRAMEWORK_HELPER_UICONFIGELEMENTWRAPPERBASE_HXX_ 25 #define __FRAMEWORK_HELPER_UICONFIGELEMENTWRAPPERBASE_HXX_ 26 27 //_________________________________________________________________________________________________________________ 28 // my own includes 29 //_________________________________________________________________________________________________________________ 30 31 #include <threadhelp/threadhelpbase.hxx> 32 #include <macros/generic.hxx> 33 #include <macros/xinterface.hxx> 34 #include <macros/xtypeprovider.hxx> 35 36 //_________________________________________________________________________________________________________________ 37 // interface includes 38 //_________________________________________________________________________________________________________________ 39 #include <com/sun/star/ui/XUIElement.hpp> 40 #include <com/sun/star/ui/XUIElementSettings.hpp> 41 #include <com/sun/star/ui/XUIConfigurationManager.hpp> 42 #include <com/sun/star/ui/XUIConfigurationListener.hpp> 43 #include <com/sun/star/frame/XFrame.hpp> 44 #include <com/sun/star/awt/XMenuBar.hpp> 45 #include <com/sun/star/util/XUpdatable.hpp> 46 #include <com/sun/star/lang/XInitialization.hpp> 47 #include <com/sun/star/lang/XComponent.hpp> 48 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 49 50 //_________________________________________________________________________________________________________________ 51 // other includes 52 //_________________________________________________________________________________________________________________ 53 #include <rtl/ustring.hxx> 54 #include <cppuhelper/propshlp.hxx> 55 #include <cppuhelper/interfacecontainer.hxx> 56 #include <cppuhelper/weak.hxx> 57 58 namespace framework 59 { 60 61 class UIConfigElementWrapperBase : public ::com::sun::star::lang::XTypeProvider , 62 public ::com::sun::star::ui::XUIElement , 63 public ::com::sun::star::ui::XUIElementSettings , 64 public ::com::sun::star::lang::XInitialization , 65 public ::com::sun::star::lang::XComponent , 66 public ::com::sun::star::util::XUpdatable , 67 public ::com::sun::star::ui::XUIConfigurationListener , 68 protected ThreadHelpBase , 69 public ::cppu::OBroadcastHelper , 70 public ::cppu::OPropertySetHelper , 71 public ::cppu::OWeakObject 72 { 73 //------------------------------------------------------------------------------------------------------------- 74 // public methods 75 //------------------------------------------------------------------------------------------------------------- 76 public: 77 UIConfigElementWrapperBase( sal_Int16 nType,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory ); 78 virtual ~UIConfigElementWrapperBase(); 79 80 // XInterface 81 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw( ::com::sun::star::uno::RuntimeException ); 82 virtual void SAL_CALL acquire() throw(); 83 virtual void SAL_CALL release() throw(); 84 85 // XTypeProvider 86 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() throw( ::com::sun::star::uno::RuntimeException ); 87 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw( ::com::sun::star::uno::RuntimeException ); 88 89 // XComponent 90 virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) = 0; 91 virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); 92 virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); 93 94 // XInitialization 95 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); 96 97 // XUIElementSettings 98 virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException) = 0; 99 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( sal_Bool bWriteable ) throw (::com::sun::star::uno::RuntimeException); 100 virtual void SAL_CALL setSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& UISettings ) throw (::com::sun::star::uno::RuntimeException); 101 102 // XUIElement 103 virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); 104 virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); 105 virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); 106 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException) = 0; 107 108 // XUpdatable 109 virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); 110 111 // XUIConfigurationListener 112 virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 113 virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 114 virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); 115 116 // XEventListener 117 using cppu::OPropertySetHelper::disposing; 118 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); 119 120 //------------------------------------------------------------------------------------------------------------- 121 // protected methods 122 //------------------------------------------------------------------------------------------------------------- 123 protected: 124 125 // OPropertySetHelper 126 virtual sal_Bool SAL_CALL convertFastPropertyValue ( com::sun::star::uno::Any& aConvertedValue , 127 com::sun::star::uno::Any& aOldValue , 128 sal_Int32 nHandle , 129 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ); 130 virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , 131 const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); 132 using cppu::OPropertySetHelper::getFastPropertyValue; 133 virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue , 134 sal_Int32 nHandle ) const; 135 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); 136 virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); 137 138 virtual void impl_fillNewData(); 139 140 static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); 141 142 sal_Int16 m_nType; 143 bool m_bPersistent : 1, 144 m_bInitialized : 1, 145 m_bConfigListener : 1, 146 m_bConfigListening : 1, 147 m_bDisposed : 1, 148 m_bNoClose : 1; 149 rtl::OUString m_aResourceURL; 150 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; 151 com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xConfigSource; 152 com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xConfigData; 153 com::sun::star::uno::WeakReference< com::sun::star::frame::XFrame > m_xWeakFrame; 154 com::sun::star::uno::Reference< com::sun::star::awt::XMenuBar > m_xMenuBar; 155 ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener 156 }; 157 158 } // namespace framework 159 160 #endif // __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ 161