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 #ifndef _SFX_PROPBAG_HXX 24 #define _SFX_PROPBAG_HXX 25 26 #include <svl/svarray.hxx> 27 #ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HXX_ 28 #include <com/sun/star/beans/PropertyValue.hpp> 29 #endif 30 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HXX_ 31 #include <com/sun/star/beans/XPropertySet.hpp> 32 #endif 33 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSETINFO_HXX_ 34 #include <com/sun/star/beans/XPropertySetInfo.hpp> 35 #endif 36 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYACCESS_HXX_ 37 #include <com/sun/star/beans/XPropertyAccess.hpp> 38 #endif 39 #ifndef _COM_SUN_STAR_BEANS_XPROPERTYCONTAINER_HXX_ 40 #include <com/sun/star/beans/XPropertyContainer.hpp> 41 #endif 42 #include <cppuhelper/implbase1.hxx> 43 #include <cppuhelper/implbase2.hxx> 44 45 #define NS_BEANS ::com::sun::star::beans 46 #define NS_LANG ::com::sun::star::lang 47 #define NS_UNO ::com::sun::star::uno 48 49 typedef NS_BEANS::PropertyValue* SbPropertyValuePtr; 50 SV_DECL_PTRARR( SbPropertyValueArr_Impl, SbPropertyValuePtr, 4, 4 ) 51 52 typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySet, 53 NS_BEANS::XPropertyAccess > SbPropertyValuesHelper; 54 55 56 //========================================================================== 57 58 class SbPropertyValues: public SbPropertyValuesHelper 59 { 60 SbPropertyValueArr_Impl _aPropVals; 61 NS_UNO::Reference< ::com::sun::star::beans::XPropertySetInfo > _xInfo; 62 63 private: 64 sal_Int32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const; 65 66 public: 67 SbPropertyValues(); 68 virtual ~SbPropertyValues(); 69 70 // XPropertySet 71 virtual NS_UNO::Reference< NS_BEANS::XPropertySetInfo > SAL_CALL 72 getPropertySetInfo(void); 73 virtual void SAL_CALL setPropertyValue( 74 const ::rtl::OUString& aPropertyName, 75 const NS_UNO::Any& aValue); 76 virtual NS_UNO::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ); 77 virtual void SAL_CALL addPropertyChangeListener( 78 const ::rtl::OUString& aPropertyName, 79 const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& ) 80 throw (); 81 virtual void SAL_CALL removePropertyChangeListener( 82 const ::rtl::OUString& aPropertyName, 83 const NS_UNO::Reference< NS_BEANS::XPropertyChangeListener >& ) 84 throw (); 85 virtual void SAL_CALL addVetoableChangeListener( 86 const ::rtl::OUString& aPropertyName, 87 const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& ) 88 throw (); 89 virtual void SAL_CALL removeVetoableChangeListener( 90 const ::rtl::OUString& aPropertyName, 91 const NS_UNO::Reference< NS_BEANS::XVetoableChangeListener >& ) 92 throw (); 93 94 // XPropertyAccess 95 virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void); 96 virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_); 97 }; 98 99 //========================================================================== 100 101 typedef ::cppu::WeakImplHelper1< NS_BEANS::XPropertySetInfo > SbPropertySetInfoHelper; 102 103 // AB 20.3.2000 Help Class for XPropertySetInfo implementation 104 class PropertySetInfoImpl 105 { 106 friend class SbPropertySetInfo; 107 friend class SbPropertyContainer; 108 109 NS_UNO::Sequence< NS_BEANS::Property > _aProps; 110 111 sal_Int32 GetIndex_Impl( const ::rtl::OUString &rPropName ) const; 112 113 public: 114 PropertySetInfoImpl(); 115 PropertySetInfoImpl( NS_UNO::Sequence< NS_BEANS::Property >& rProps ); 116 117 // XPropertySetInfo 118 NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void) throw (); 119 NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name); 120 sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name); 121 }; 122 123 class SbPropertySetInfo: public SbPropertySetInfoHelper 124 { 125 PropertySetInfoImpl aImpl; 126 127 public: 128 SbPropertySetInfo(); 129 SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals ); 130 virtual ~SbPropertySetInfo(); 131 132 // XPropertySetInfo 133 virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void); 134 virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name); 135 virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name); 136 }; 137 138 //========================================================================== 139 140 typedef ::cppu::WeakImplHelper2< NS_BEANS::XPropertySetInfo, NS_BEANS::XPropertyContainer > SbPropertyContainerHelper; 141 142 class SbPropertyContainer: public SbPropertyContainerHelper 143 { 144 PropertySetInfoImpl aImpl; 145 146 public: 147 SbPropertyContainer(); 148 virtual ~SbPropertyContainer(); 149 150 // XPropertyContainer 151 virtual void SAL_CALL addProperty( const ::rtl::OUString& Name, 152 sal_Int16 Attributes, 153 const NS_UNO::Any& DefaultValue); 154 virtual void SAL_CALL removeProperty(const ::rtl::OUString& Name); 155 156 // XPropertySetInfo 157 virtual NS_UNO::Sequence< NS_BEANS::Property > SAL_CALL getProperties(void) throw(); 158 virtual NS_BEANS::Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name); 159 virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name); 160 161 // XPropertyAccess 162 virtual NS_UNO::Sequence< NS_BEANS::PropertyValue > SAL_CALL getPropertyValues(void); 163 virtual void SAL_CALL setPropertyValues(const NS_UNO::Sequence< NS_BEANS::PropertyValue >& PropertyValues_); 164 }; 165 166 //========================================================================= 167 168 class StarBASIC; 169 class SbxArray; 170 171 void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ); 172 173 174 #undef NS_BEANS 175 #undef NS_LANG 176 #undef NS_UNO 177 178 179 180 #endif 181