1*e1f63238SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*e1f63238SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*e1f63238SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*e1f63238SAndrew Rist * distributed with this work for additional information 6*e1f63238SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*e1f63238SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*e1f63238SAndrew Rist * "License"); you may not use this file except in compliance 9*e1f63238SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*e1f63238SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*e1f63238SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*e1f63238SAndrew Rist * software distributed under the License is distributed on an 15*e1f63238SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*e1f63238SAndrew Rist * KIND, either express or implied. See the License for the 17*e1f63238SAndrew Rist * specific language governing permissions and limitations 18*e1f63238SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*e1f63238SAndrew Rist *************************************************************/ 21*e1f63238SAndrew Rist 22*e1f63238SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_basic.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "propacc.hxx" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include <tools/urlobj.hxx> 30cdf0e10cSrcweir #include <tools/errcode.hxx> 31cdf0e10cSrcweir #include <svl/svarray.hxx> 32cdf0e10cSrcweir #include <basic/sbstar.hxx> 33cdf0e10cSrcweir #include <sbunoobj.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir using com::sun::star::uno::Reference; 36cdf0e10cSrcweir using namespace com::sun::star::uno; 37cdf0e10cSrcweir using namespace com::sun::star::lang; 38cdf0e10cSrcweir using namespace com::sun::star::beans; 39cdf0e10cSrcweir using namespace cppu; 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir //======================================================================== 43cdf0e10cSrcweir 44cdf0e10cSrcweir // Declaration conversion from Sbx to UNO with known target type 45cdf0e10cSrcweir Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty = NULL ); 46cdf0e10cSrcweir 47cdf0e10cSrcweir //======================================================================== 48cdf0e10cSrcweir 49cdf0e10cSrcweir #ifdef WNT 50cdf0e10cSrcweir #define CDECL _cdecl 51cdf0e10cSrcweir #endif 52cdf0e10cSrcweir #if defined(UNX) || defined(OS2) 53cdf0e10cSrcweir #define CDECL 54cdf0e10cSrcweir #endif 55cdf0e10cSrcweir 56cdf0e10cSrcweir int CDECL SbCompare_PropertyValues_Impl( const void *arg1, const void *arg2 ) 57cdf0e10cSrcweir { 58cdf0e10cSrcweir return ((PropertyValue*)arg1)->Name.compareTo( ((PropertyValue*)arg2)->Name ); 59cdf0e10cSrcweir } 60cdf0e10cSrcweir 61cdf0e10cSrcweir extern "C" int CDECL SbCompare_UString_PropertyValue_Impl( const void *arg1, const void *arg2 ) 62cdf0e10cSrcweir { 63cdf0e10cSrcweir const ::rtl::OUString *pArg1 = (::rtl::OUString*) arg1; 64cdf0e10cSrcweir const PropertyValue **pArg2 = (const PropertyValue**) arg2; 65cdf0e10cSrcweir return pArg1->compareTo( (*pArg2)->Name ); 66cdf0e10cSrcweir } 67cdf0e10cSrcweir 68cdf0e10cSrcweir int CDECL SbCompare_Properties_Impl( const void *arg1, const void *arg2 ) 69cdf0e10cSrcweir { 70cdf0e10cSrcweir return ((Property*)arg1)->Name.compareTo( ((Property*)arg2)->Name ); 71cdf0e10cSrcweir } 72cdf0e10cSrcweir 73cdf0e10cSrcweir extern "C" int CDECL SbCompare_UString_Property_Impl( const void *arg1, const void *arg2 ) 74cdf0e10cSrcweir { 75cdf0e10cSrcweir const ::rtl::OUString *pArg1 = (::rtl::OUString*) arg1; 76cdf0e10cSrcweir const Property *pArg2 = (Property*) arg2; 77cdf0e10cSrcweir return pArg1->compareTo( pArg2->Name ); 78cdf0e10cSrcweir } 79cdf0e10cSrcweir 80cdf0e10cSrcweir //---------------------------------------------------------------------------- 81cdf0e10cSrcweir 82cdf0e10cSrcweir SbPropertyValues::SbPropertyValues() 83cdf0e10cSrcweir { 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir //---------------------------------------------------------------------------- 87cdf0e10cSrcweir 88cdf0e10cSrcweir SbPropertyValues::~SbPropertyValues() 89cdf0e10cSrcweir { 90cdf0e10cSrcweir _xInfo = Reference< XPropertySetInfo >(); 91cdf0e10cSrcweir 92cdf0e10cSrcweir for ( sal_uInt16 n = 0; n < _aPropVals.Count(); ++n ) 93cdf0e10cSrcweir delete _aPropVals.GetObject( n ); 94cdf0e10cSrcweir } 95cdf0e10cSrcweir 96cdf0e10cSrcweir //---------------------------------------------------------------------------- 97cdf0e10cSrcweir 98cdf0e10cSrcweir Reference< XPropertySetInfo > SbPropertyValues::getPropertySetInfo(void) throw( RuntimeException ) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir // create on demand? 101cdf0e10cSrcweir if ( !_xInfo.is() ) 102cdf0e10cSrcweir { 103cdf0e10cSrcweir SbPropertySetInfo *pInfo = new SbPropertySetInfo( _aPropVals ); 104cdf0e10cSrcweir ((SbPropertyValues*)this)->_xInfo = (XPropertySetInfo*)pInfo; 105cdf0e10cSrcweir } 106cdf0e10cSrcweir return _xInfo; 107cdf0e10cSrcweir } 108cdf0e10cSrcweir 109cdf0e10cSrcweir //------------------------------------------------------------------------- 110cdf0e10cSrcweir 111cdf0e10cSrcweir sal_Int32 SbPropertyValues::GetIndex_Impl( const ::rtl::OUString &rPropName ) const 112cdf0e10cSrcweir { 113cdf0e10cSrcweir PropertyValue **ppPV; 114cdf0e10cSrcweir ppPV = (PropertyValue **) 115cdf0e10cSrcweir bsearch( &rPropName, _aPropVals.GetData(), _aPropVals.Count(), 116cdf0e10cSrcweir sizeof( PropertyValue* ), 117cdf0e10cSrcweir SbCompare_UString_PropertyValue_Impl ); 118cdf0e10cSrcweir return ppPV ? ( (ppPV-_aPropVals.GetData()) / sizeof(ppPV) ) : USHRT_MAX; 119cdf0e10cSrcweir } 120cdf0e10cSrcweir 121cdf0e10cSrcweir //---------------------------------------------------------------------------- 122cdf0e10cSrcweir 123cdf0e10cSrcweir void SbPropertyValues::setPropertyValue( 124cdf0e10cSrcweir const ::rtl::OUString& aPropertyName, 125cdf0e10cSrcweir const Any& aValue) 126cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 127cdf0e10cSrcweir ::com::sun::star::beans::PropertyVetoException, 128cdf0e10cSrcweir ::com::sun::star::lang::IllegalArgumentException, 129cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 130cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException) 131cdf0e10cSrcweir { 132cdf0e10cSrcweir sal_Int32 nIndex = GetIndex_Impl( aPropertyName ); 133cdf0e10cSrcweir PropertyValue *pPropVal = _aPropVals.GetObject( 134cdf0e10cSrcweir sal::static_int_cast< sal_uInt16 >(nIndex)); 135cdf0e10cSrcweir pPropVal->Value = aValue; 136cdf0e10cSrcweir } 137cdf0e10cSrcweir 138cdf0e10cSrcweir //---------------------------------------------------------------------------- 139cdf0e10cSrcweir 140cdf0e10cSrcweir Any SbPropertyValues::getPropertyValue( 141cdf0e10cSrcweir const ::rtl::OUString& aPropertyName) 142cdf0e10cSrcweir throw(::com::sun::star::beans::UnknownPropertyException, 143cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 144cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException) 145cdf0e10cSrcweir { 146cdf0e10cSrcweir sal_Int32 nIndex = GetIndex_Impl( aPropertyName ); 147cdf0e10cSrcweir if ( nIndex != USHRT_MAX ) 148cdf0e10cSrcweir return _aPropVals.GetObject( 149cdf0e10cSrcweir sal::static_int_cast< sal_uInt16 >(nIndex))->Value; 150cdf0e10cSrcweir return Any(); 151cdf0e10cSrcweir } 152cdf0e10cSrcweir 153cdf0e10cSrcweir //---------------------------------------------------------------------------- 154cdf0e10cSrcweir 155cdf0e10cSrcweir void SbPropertyValues::addPropertyChangeListener( 156cdf0e10cSrcweir const ::rtl::OUString& aPropertyName, 157cdf0e10cSrcweir const Reference< XPropertyChangeListener >& ) 158cdf0e10cSrcweir throw () 159cdf0e10cSrcweir { 160cdf0e10cSrcweir (void)aPropertyName; 161cdf0e10cSrcweir } 162cdf0e10cSrcweir 163cdf0e10cSrcweir //---------------------------------------------------------------------------- 164cdf0e10cSrcweir 165cdf0e10cSrcweir void SbPropertyValues::removePropertyChangeListener( 166cdf0e10cSrcweir const ::rtl::OUString& aPropertyName, 167cdf0e10cSrcweir const Reference< XPropertyChangeListener >& ) 168cdf0e10cSrcweir throw () 169cdf0e10cSrcweir { 170cdf0e10cSrcweir (void)aPropertyName; 171cdf0e10cSrcweir } 172cdf0e10cSrcweir 173cdf0e10cSrcweir //---------------------------------------------------------------------------- 174cdf0e10cSrcweir 175cdf0e10cSrcweir void SbPropertyValues::addVetoableChangeListener( 176cdf0e10cSrcweir const ::rtl::OUString& aPropertyName, 177cdf0e10cSrcweir const Reference< XVetoableChangeListener >& ) 178cdf0e10cSrcweir throw() 179cdf0e10cSrcweir { 180cdf0e10cSrcweir (void)aPropertyName; 181cdf0e10cSrcweir } 182cdf0e10cSrcweir 183cdf0e10cSrcweir //---------------------------------------------------------------------------- 184cdf0e10cSrcweir 185cdf0e10cSrcweir void SbPropertyValues::removeVetoableChangeListener( 186cdf0e10cSrcweir const ::rtl::OUString& aPropertyName, 187cdf0e10cSrcweir const Reference< XVetoableChangeListener >& ) 188cdf0e10cSrcweir throw() 189cdf0e10cSrcweir { 190cdf0e10cSrcweir (void)aPropertyName; 191cdf0e10cSrcweir } 192cdf0e10cSrcweir 193cdf0e10cSrcweir //---------------------------------------------------------------------------- 194cdf0e10cSrcweir 195cdf0e10cSrcweir Sequence< PropertyValue > SbPropertyValues::getPropertyValues(void) throw (::com::sun::star::uno::RuntimeException) 196cdf0e10cSrcweir { 197cdf0e10cSrcweir Sequence<PropertyValue> aRet( _aPropVals.Count()); 198cdf0e10cSrcweir for ( sal_uInt16 n = 0; n < _aPropVals.Count(); ++n ) 199cdf0e10cSrcweir aRet.getArray()[n] = *_aPropVals.GetObject(n); 200cdf0e10cSrcweir return aRet; 201cdf0e10cSrcweir } 202cdf0e10cSrcweir 203cdf0e10cSrcweir //---------------------------------------------------------------------------- 204cdf0e10cSrcweir 205cdf0e10cSrcweir void SbPropertyValues::setPropertyValues(const Sequence< PropertyValue >& rPropertyValues ) 206cdf0e10cSrcweir throw (::com::sun::star::beans::UnknownPropertyException, 207cdf0e10cSrcweir ::com::sun::star::beans::PropertyVetoException, 208cdf0e10cSrcweir ::com::sun::star::lang::IllegalArgumentException, 209cdf0e10cSrcweir ::com::sun::star::lang::WrappedTargetException, 210cdf0e10cSrcweir ::com::sun::star::uno::RuntimeException) 211cdf0e10cSrcweir { 212cdf0e10cSrcweir if ( _aPropVals.Count() ) 213cdf0e10cSrcweir throw PropertyExistException(); 214cdf0e10cSrcweir 215cdf0e10cSrcweir const PropertyValue *pPropVals = rPropertyValues.getConstArray(); 216cdf0e10cSrcweir for ( sal_Int16 n = 0; n < rPropertyValues.getLength(); ++n ) 217cdf0e10cSrcweir { 218cdf0e10cSrcweir PropertyValue *pPropVal = new PropertyValue(pPropVals[n]); 219cdf0e10cSrcweir _aPropVals.Insert( pPropVal, n ); 220cdf0e10cSrcweir } 221cdf0e10cSrcweir } 222cdf0e10cSrcweir 223cdf0e10cSrcweir //============================================================================ 224cdf0e10cSrcweir //PropertySetInfoImpl 225cdf0e10cSrcweir 226cdf0e10cSrcweir PropertySetInfoImpl::PropertySetInfoImpl() 227cdf0e10cSrcweir { 228cdf0e10cSrcweir } 229cdf0e10cSrcweir 230cdf0e10cSrcweir sal_Int32 PropertySetInfoImpl::GetIndex_Impl( const ::rtl::OUString &rPropName ) const 231cdf0e10cSrcweir { 232cdf0e10cSrcweir Property *pP; 233cdf0e10cSrcweir pP = (Property*) 234cdf0e10cSrcweir bsearch( &rPropName, _aProps.getConstArray(), _aProps.getLength(), 235cdf0e10cSrcweir sizeof( Property ), 236cdf0e10cSrcweir SbCompare_UString_Property_Impl ); 237cdf0e10cSrcweir return pP ? sal::static_int_cast<sal_Int32>( (pP-_aProps.getConstArray()) / sizeof(pP) ) : -1; 238cdf0e10cSrcweir } 239cdf0e10cSrcweir 240cdf0e10cSrcweir Sequence< Property > PropertySetInfoImpl::getProperties(void) throw() 241cdf0e10cSrcweir { 242cdf0e10cSrcweir return _aProps; 243cdf0e10cSrcweir } 244cdf0e10cSrcweir 245cdf0e10cSrcweir Property PropertySetInfoImpl::getPropertyByName(const ::rtl::OUString& Name) throw( RuntimeException ) 246cdf0e10cSrcweir { 247cdf0e10cSrcweir sal_Int32 nIndex = GetIndex_Impl( Name ); 248cdf0e10cSrcweir if( USHRT_MAX != nIndex ) 249cdf0e10cSrcweir return _aProps.getConstArray()[ nIndex ]; 250cdf0e10cSrcweir return Property(); 251cdf0e10cSrcweir } 252cdf0e10cSrcweir 253cdf0e10cSrcweir sal_Bool PropertySetInfoImpl::hasPropertyByName(const ::rtl::OUString& Name) throw( RuntimeException ) 254cdf0e10cSrcweir { 255cdf0e10cSrcweir sal_Int32 nIndex = GetIndex_Impl( Name ); 256cdf0e10cSrcweir return USHRT_MAX != nIndex; 257cdf0e10cSrcweir } 258cdf0e10cSrcweir 259cdf0e10cSrcweir 260cdf0e10cSrcweir //============================================================================ 261cdf0e10cSrcweir 262cdf0e10cSrcweir SbPropertySetInfo::SbPropertySetInfo() 263cdf0e10cSrcweir { 264cdf0e10cSrcweir } 265cdf0e10cSrcweir 266cdf0e10cSrcweir //---------------------------------------------------------------------------- 267cdf0e10cSrcweir 268cdf0e10cSrcweir SbPropertySetInfo::SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals ) 269cdf0e10cSrcweir { 270cdf0e10cSrcweir aImpl._aProps.realloc( rPropVals.Count() ); 271cdf0e10cSrcweir for ( sal_uInt16 n = 0; n < rPropVals.Count(); ++n ) 272cdf0e10cSrcweir { 273cdf0e10cSrcweir Property &rProp = aImpl._aProps.getArray()[n]; 274cdf0e10cSrcweir const PropertyValue &rPropVal = *rPropVals.GetObject(n); 275cdf0e10cSrcweir rProp.Name = rPropVal.Name; 276cdf0e10cSrcweir rProp.Handle = rPropVal.Handle; 277cdf0e10cSrcweir rProp.Type = getCppuVoidType(); 278cdf0e10cSrcweir rProp.Attributes = 0; 279cdf0e10cSrcweir } 280cdf0e10cSrcweir } 281cdf0e10cSrcweir 282cdf0e10cSrcweir //---------------------------------------------------------------------------- 283cdf0e10cSrcweir 284cdf0e10cSrcweir SbPropertySetInfo::~SbPropertySetInfo() 285cdf0e10cSrcweir { 286cdf0e10cSrcweir } 287cdf0e10cSrcweir 288cdf0e10cSrcweir //------------------------------------------------------------------------- 289cdf0e10cSrcweir 290cdf0e10cSrcweir Sequence< Property > SbPropertySetInfo::getProperties(void) throw( RuntimeException ) 291cdf0e10cSrcweir { 292cdf0e10cSrcweir return aImpl.getProperties(); 293cdf0e10cSrcweir } 294cdf0e10cSrcweir 295cdf0e10cSrcweir Property SbPropertySetInfo::getPropertyByName(const ::rtl::OUString& Name) 296cdf0e10cSrcweir throw( RuntimeException ) 297cdf0e10cSrcweir { 298cdf0e10cSrcweir return aImpl.getPropertyByName( Name ); 299cdf0e10cSrcweir } 300cdf0e10cSrcweir 301cdf0e10cSrcweir sal_Bool SbPropertySetInfo::hasPropertyByName(const ::rtl::OUString& Name) 302cdf0e10cSrcweir throw( RuntimeException ) 303cdf0e10cSrcweir { 304cdf0e10cSrcweir return aImpl.hasPropertyByName( Name ); 305cdf0e10cSrcweir } 306cdf0e10cSrcweir 307cdf0e10cSrcweir 308cdf0e10cSrcweir //---------------------------------------------------------------------------- 309cdf0e10cSrcweir 310cdf0e10cSrcweir SbPropertyContainer::SbPropertyContainer() 311cdf0e10cSrcweir { 312cdf0e10cSrcweir } 313cdf0e10cSrcweir 314cdf0e10cSrcweir //---------------------------------------------------------------------------- 315cdf0e10cSrcweir 316cdf0e10cSrcweir SbPropertyContainer::~SbPropertyContainer() 317cdf0e10cSrcweir { 318cdf0e10cSrcweir } 319cdf0e10cSrcweir 320cdf0e10cSrcweir //---------------------------------------------------------------------------- 321cdf0e10cSrcweir void SbPropertyContainer::addProperty(const ::rtl::OUString& Name, 322cdf0e10cSrcweir sal_Int16 Attributes, 323cdf0e10cSrcweir const Any& DefaultValue) 324cdf0e10cSrcweir throw( PropertyExistException, IllegalTypeException, 325cdf0e10cSrcweir IllegalArgumentException, RuntimeException ) 326cdf0e10cSrcweir { 327cdf0e10cSrcweir (void)Name; 328cdf0e10cSrcweir (void)Attributes; 329cdf0e10cSrcweir (void)DefaultValue; 330cdf0e10cSrcweir } 331cdf0e10cSrcweir 332cdf0e10cSrcweir //---------------------------------------------------------------------------- 333cdf0e10cSrcweir void SbPropertyContainer::removeProperty(const ::rtl::OUString& Name) 334cdf0e10cSrcweir throw( UnknownPropertyException, RuntimeException ) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir (void)Name; 337cdf0e10cSrcweir } 338cdf0e10cSrcweir 339cdf0e10cSrcweir //---------------------------------------------------------------------------- 340cdf0e10cSrcweir // XPropertySetInfo 341cdf0e10cSrcweir Sequence< Property > SbPropertyContainer::getProperties(void) throw () 342cdf0e10cSrcweir { 343cdf0e10cSrcweir return aImpl.getProperties(); 344cdf0e10cSrcweir } 345cdf0e10cSrcweir 346cdf0e10cSrcweir Property SbPropertyContainer::getPropertyByName(const ::rtl::OUString& Name) 347cdf0e10cSrcweir throw( RuntimeException ) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir return aImpl.getPropertyByName( Name ); 350cdf0e10cSrcweir } 351cdf0e10cSrcweir 352cdf0e10cSrcweir sal_Bool SbPropertyContainer::hasPropertyByName(const ::rtl::OUString& Name) 353cdf0e10cSrcweir throw( RuntimeException ) 354cdf0e10cSrcweir { 355cdf0e10cSrcweir return aImpl.hasPropertyByName( Name ); 356cdf0e10cSrcweir } 357cdf0e10cSrcweir 358cdf0e10cSrcweir //---------------------------------------------------------------------------- 359cdf0e10cSrcweir 360cdf0e10cSrcweir Sequence< PropertyValue > SbPropertyContainer::getPropertyValues(void) 361cdf0e10cSrcweir { 362cdf0e10cSrcweir return Sequence<PropertyValue>(); 363cdf0e10cSrcweir } 364cdf0e10cSrcweir 365cdf0e10cSrcweir //---------------------------------------------------------------------------- 366cdf0e10cSrcweir 367cdf0e10cSrcweir void SbPropertyContainer::setPropertyValues(const Sequence< PropertyValue >& PropertyValues_) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir (void)PropertyValues_; 370cdf0e10cSrcweir } 371cdf0e10cSrcweir 372cdf0e10cSrcweir //---------------------------------------------------------------------------- 373cdf0e10cSrcweir 374cdf0e10cSrcweir void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, sal_Bool bWrite ) 375cdf0e10cSrcweir { 376cdf0e10cSrcweir (void)pBasic; 377cdf0e10cSrcweir (void)bWrite; 378cdf0e10cSrcweir 379cdf0e10cSrcweir // We need at least one parameter 380cdf0e10cSrcweir // TODO: In this case < 2 is not correct ;-) 381cdf0e10cSrcweir if ( rPar.Count() < 2 ) 382cdf0e10cSrcweir { 383cdf0e10cSrcweir StarBASIC::Error( SbERR_BAD_ARGUMENT ); 384cdf0e10cSrcweir return; 385cdf0e10cSrcweir } 386cdf0e10cSrcweir 387cdf0e10cSrcweir // Get class names of struct 388cdf0e10cSrcweir String aServiceName( RTL_CONSTASCII_USTRINGPARAM("stardiv.uno.beans.PropertySet") ); 389cdf0e10cSrcweir 390cdf0e10cSrcweir #if 0 391cdf0e10cSrcweir // Service suchen und instanzieren 392cdf0e10cSrcweir Reference< XMultiServiceFactory > xServiceManager = getProcessServiceFactory(); 393cdf0e10cSrcweir Reference< XInterface > xInterface; 394cdf0e10cSrcweir if( xProv.is() ) 395cdf0e10cSrcweir xInterface = xProv->newInstance(); 396cdf0e10cSrcweir #else 397cdf0e10cSrcweir Reference< XInterface > xInterface = (OWeakObject*) new SbPropertyValues(); 398cdf0e10cSrcweir #endif 399cdf0e10cSrcweir 400cdf0e10cSrcweir SbxVariableRef refVar = rPar.Get(0); 401cdf0e10cSrcweir if( xInterface.is() ) 402cdf0e10cSrcweir { 403cdf0e10cSrcweir // Set PropertyValues 404cdf0e10cSrcweir Any aArgAsAny = sbxToUnoValue( rPar.Get(1), 405cdf0e10cSrcweir getCppuType( (Sequence<PropertyValue>*)0 ) ); 406cdf0e10cSrcweir Sequence<PropertyValue> *pArg = 407cdf0e10cSrcweir (Sequence<PropertyValue>*) aArgAsAny.getValue(); 408cdf0e10cSrcweir Reference< XPropertyAccess > xPropAcc = Reference< XPropertyAccess >::query( xInterface ); 409cdf0e10cSrcweir xPropAcc->setPropertyValues( *pArg ); 410cdf0e10cSrcweir 411cdf0e10cSrcweir // Build a SbUnoObject and return it 412cdf0e10cSrcweir Any aAny; 413cdf0e10cSrcweir aAny <<= xInterface; 414cdf0e10cSrcweir SbUnoObjectRef xUnoObj = new SbUnoObject( aServiceName, aAny ); 415cdf0e10cSrcweir if( xUnoObj->getUnoAny().getValueType().getTypeClass() != TypeClass_VOID ) 416cdf0e10cSrcweir { 417cdf0e10cSrcweir // Return object 418cdf0e10cSrcweir refVar->PutObject( (SbUnoObject*)xUnoObj ); 419cdf0e10cSrcweir return; 420cdf0e10cSrcweir } 421cdf0e10cSrcweir } 422cdf0e10cSrcweir 423cdf0e10cSrcweir // Object could not be created 424cdf0e10cSrcweir refVar->PutObject( NULL ); 425cdf0e10cSrcweir } 426cdf0e10cSrcweir 427