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