1f6e50924SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3f6e50924SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4f6e50924SAndrew Rist * or more contributor license agreements. See the NOTICE file 5f6e50924SAndrew Rist * distributed with this work for additional information 6f6e50924SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7f6e50924SAndrew Rist * to you under the Apache License, Version 2.0 (the 8f6e50924SAndrew Rist * "License"); you may not use this file except in compliance 9f6e50924SAndrew Rist * with the License. You may obtain a copy of the License at 10f6e50924SAndrew Rist * 11f6e50924SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12f6e50924SAndrew Rist * 13f6e50924SAndrew Rist * Unless required by applicable law or agreed to in writing, 14f6e50924SAndrew Rist * software distributed under the License is distributed on an 15f6e50924SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16f6e50924SAndrew Rist * KIND, either express or implied. See the License for the 17f6e50924SAndrew Rist * specific language governing permissions and limitations 18f6e50924SAndrew Rist * under the License. 19f6e50924SAndrew Rist * 20f6e50924SAndrew Rist *************************************************************/ 21f6e50924SAndrew Rist 22f6e50924SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_svx.hxx" 26cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 27cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_PROPERTYSTATE_HDL_ 28cdf0e10cSrcweir #include <com/sun/star/beans/PropertyState.hpp> 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <comphelper/propertysetinfo.hxx> 32cdf0e10cSrcweir #include <rtl/uuid.h> 33cdf0e10cSrcweir #include <vos/mutex.hxx> 34cdf0e10cSrcweir #include <vcl/svapp.hxx> 35cdf0e10cSrcweir #include "svx/unopool.hxx" 36cdf0e10cSrcweir #include <svx/svdmodel.hxx> 37cdf0e10cSrcweir #include <svx/svdpool.hxx> 38cdf0e10cSrcweir #include <svx/unoprov.hxx> 39cdf0e10cSrcweir #include <svx/svdobj.hxx> 40cdf0e10cSrcweir #include <svx/unoshprp.hxx> 41cdf0e10cSrcweir #include <svx/xflbstit.hxx> 42cdf0e10cSrcweir #include <svx/xflbmtit.hxx> 43cdf0e10cSrcweir #include <svx/unopage.hxx> 44cdf0e10cSrcweir #include <svx/svdetc.hxx> 45cdf0e10cSrcweir #include <editeng/editeng.hxx> 46cdf0e10cSrcweir 47cdf0e10cSrcweir #include "svx/unoapi.hxx" 48cdf0e10cSrcweir #include <memory> 49cdf0e10cSrcweir 50cdf0e10cSrcweir using namespace ::com::sun::star; 51cdf0e10cSrcweir using namespace ::rtl; 52cdf0e10cSrcweir using namespace ::cppu; 53cdf0e10cSrcweir 54cdf0e10cSrcweir SvxUnoDrawPool::SvxUnoDrawPool( SdrModel* pModel, sal_Int32 nServiceId ) throw() 55cdf0e10cSrcweir : PropertySetHelper( SvxPropertySetInfoPool::getOrCreate( nServiceId ) ), mpModel( pModel ) 56cdf0e10cSrcweir { 57cdf0e10cSrcweir init(); 58cdf0e10cSrcweir } 59cdf0e10cSrcweir 60cdf0e10cSrcweir /* deprecated */ 61cdf0e10cSrcweir SvxUnoDrawPool::SvxUnoDrawPool( SdrModel* pModel ) throw() 62cdf0e10cSrcweir : PropertySetHelper( SvxPropertySetInfoPool::getOrCreate( SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS ) ), mpModel( pModel ) 63cdf0e10cSrcweir { 64cdf0e10cSrcweir init(); 65cdf0e10cSrcweir } 66cdf0e10cSrcweir 67cdf0e10cSrcweir SvxUnoDrawPool::~SvxUnoDrawPool() throw() 68cdf0e10cSrcweir { 69*e262f9e6SJian Fang Zhang // memory leak #119991: to release the secondary pool created in function SvxUnoDrawPool::init() 70*e262f9e6SJian Fang Zhang SfxItemPool* pSecondaryPool=mpDefaultsPool->GetSecondaryPool(); 71*e262f9e6SJian Fang Zhang if (pSecondaryPool != NULL) 72*e262f9e6SJian Fang Zhang SfxItemPool::Free(pSecondaryPool); 73*e262f9e6SJian Fang Zhang // memory leak #119991 74*e262f9e6SJian Fang Zhang 75cdf0e10cSrcweir SfxItemPool::Free(mpDefaultsPool); 76cdf0e10cSrcweir } 77cdf0e10cSrcweir 78cdf0e10cSrcweir void SvxUnoDrawPool::init() 79cdf0e10cSrcweir { 80cdf0e10cSrcweir mpDefaultsPool = new SdrItemPool(); 81cdf0e10cSrcweir SfxItemPool* pOutlPool=EditEngine::CreatePool(); 82cdf0e10cSrcweir mpDefaultsPool->SetSecondaryPool(pOutlPool); 83cdf0e10cSrcweir 84cdf0e10cSrcweir SdrModel::SetTextDefaults( mpDefaultsPool, SdrEngineDefaults::GetFontHeight() ); 85cdf0e10cSrcweir mpDefaultsPool->SetDefaultMetric((SfxMapUnit)SdrEngineDefaults::GetMapUnit()); 86cdf0e10cSrcweir mpDefaultsPool->FreezeIdRanges(); 87cdf0e10cSrcweir } 88cdf0e10cSrcweir 89cdf0e10cSrcweir SfxItemPool* SvxUnoDrawPool::getModelPool( sal_Bool bReadOnly ) throw() 90cdf0e10cSrcweir { 91cdf0e10cSrcweir if( mpModel ) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir return &mpModel->GetItemPool(); 94cdf0e10cSrcweir } 95cdf0e10cSrcweir else 96cdf0e10cSrcweir { 97cdf0e10cSrcweir if( bReadOnly ) 98cdf0e10cSrcweir return mpDefaultsPool; 99cdf0e10cSrcweir else 100cdf0e10cSrcweir return NULL; 101cdf0e10cSrcweir } 102cdf0e10cSrcweir } 103cdf0e10cSrcweir 104cdf0e10cSrcweir void SvxUnoDrawPool::getAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, uno::Any& rValue ) 105cdf0e10cSrcweir throw(beans::UnknownPropertyException) 106cdf0e10cSrcweir { 107cdf0e10cSrcweir switch( pEntry->mnHandle ) 108cdf0e10cSrcweir { 109cdf0e10cSrcweir case OWN_ATTR_FILLBMP_MODE: 110cdf0e10cSrcweir { 111cdf0e10cSrcweir XFillBmpStretchItem* pStretchItem = (XFillBmpStretchItem*)&pPool->GetDefaultItem(XATTR_FILLBMP_STRETCH); 112cdf0e10cSrcweir XFillBmpTileItem* pTileItem = (XFillBmpTileItem*)&pPool->GetDefaultItem(XATTR_FILLBMP_TILE); 113cdf0e10cSrcweir if( pTileItem && pTileItem->GetValue() ) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir rValue <<= drawing::BitmapMode_REPEAT; 116cdf0e10cSrcweir } 117cdf0e10cSrcweir else if( pStretchItem && pStretchItem->GetValue() ) 118cdf0e10cSrcweir { 119cdf0e10cSrcweir rValue <<= drawing::BitmapMode_STRETCH; 120cdf0e10cSrcweir } 121cdf0e10cSrcweir else 122cdf0e10cSrcweir { 123cdf0e10cSrcweir rValue <<= drawing::BitmapMode_NO_REPEAT; 124cdf0e10cSrcweir } 125cdf0e10cSrcweir break; 126cdf0e10cSrcweir } 127cdf0e10cSrcweir default: 128cdf0e10cSrcweir { 129cdf0e10cSrcweir const SfxMapUnit eMapUnit = pPool ? pPool->GetMetric((sal_uInt16)pEntry->mnHandle) : SFX_MAPUNIT_100TH_MM; 130cdf0e10cSrcweir 131cdf0e10cSrcweir sal_uInt8 nMemberId = pEntry->mnMemberId & (~SFX_METRIC_ITEM); 132cdf0e10cSrcweir if( eMapUnit == SFX_MAPUNIT_100TH_MM ) 133cdf0e10cSrcweir nMemberId &= (~CONVERT_TWIPS); 134cdf0e10cSrcweir 135cdf0e10cSrcweir // DVO, OD 10.10.2003 #i18732# 136cdf0e10cSrcweir // Assure, that ID is a Which-ID (it could be a Slot-ID.) 137cdf0e10cSrcweir // Thus, convert handle to Which-ID. 138cdf0e10cSrcweir pPool->GetDefaultItem( pPool->GetWhich( (sal_uInt16)pEntry->mnHandle ) ).QueryValue( rValue, nMemberId ); 139cdf0e10cSrcweir } 140cdf0e10cSrcweir } 141cdf0e10cSrcweir 142cdf0e10cSrcweir 143cdf0e10cSrcweir // check for needed metric translation 144cdf0e10cSrcweir const SfxMapUnit eMapUnit = pPool->GetMetric((sal_uInt16)pEntry->mnHandle); 145cdf0e10cSrcweir if(pEntry->mnMemberId & SFX_METRIC_ITEM && eMapUnit != SFX_MAPUNIT_100TH_MM) 146cdf0e10cSrcweir { 147cdf0e10cSrcweir SvxUnoConvertToMM( eMapUnit, rValue ); 148cdf0e10cSrcweir } 149cdf0e10cSrcweir // convert int32 to correct enum type if needed 150cdf0e10cSrcweir else if ( pEntry->mpType->getTypeClass() == uno::TypeClass_ENUM && rValue.getValueType() == ::getCppuType((const sal_Int32*)0) ) 151cdf0e10cSrcweir { 152cdf0e10cSrcweir sal_Int32 nEnum; 153cdf0e10cSrcweir rValue >>= nEnum; 154cdf0e10cSrcweir 155cdf0e10cSrcweir rValue.setValue( &nEnum, *pEntry->mpType ); 156cdf0e10cSrcweir } 157cdf0e10cSrcweir } 158cdf0e10cSrcweir 159cdf0e10cSrcweir void SvxUnoDrawPool::putAny( SfxItemPool* pPool, const comphelper::PropertyMapEntry* pEntry, const uno::Any& rValue ) 160cdf0e10cSrcweir throw(beans::UnknownPropertyException, lang::IllegalArgumentException) 161cdf0e10cSrcweir { 162cdf0e10cSrcweir uno::Any aValue( rValue ); 163cdf0e10cSrcweir 164cdf0e10cSrcweir const SfxMapUnit eMapUnit = pPool->GetMetric((sal_uInt16)pEntry->mnHandle); 165cdf0e10cSrcweir if(pEntry->mnMemberId & SFX_METRIC_ITEM && eMapUnit != SFX_MAPUNIT_100TH_MM) 166cdf0e10cSrcweir { 167cdf0e10cSrcweir SvxUnoConvertFromMM( eMapUnit, aValue ); 168cdf0e10cSrcweir } 169cdf0e10cSrcweir 170cdf0e10cSrcweir // DVO, OD 10.10.2003 #i18732# 171cdf0e10cSrcweir // Assure, that ID is a Which-ID (it could be a Slot-ID.) 172cdf0e10cSrcweir // Thus, convert handle to Which-ID. 173cdf0e10cSrcweir const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle ); 174cdf0e10cSrcweir switch( nWhich ) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir case OWN_ATTR_FILLBMP_MODE: 177cdf0e10cSrcweir do 178cdf0e10cSrcweir { 179cdf0e10cSrcweir drawing::BitmapMode eMode; 180cdf0e10cSrcweir if(!(aValue >>= eMode) ) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir sal_Int32 nMode = 0; 183cdf0e10cSrcweir if(!(aValue >>= nMode)) 184cdf0e10cSrcweir throw lang::IllegalArgumentException(); 185cdf0e10cSrcweir 186cdf0e10cSrcweir eMode = (drawing::BitmapMode)nMode; 187cdf0e10cSrcweir } 188cdf0e10cSrcweir 189cdf0e10cSrcweir pPool->SetPoolDefaultItem( XFillBmpStretchItem( eMode == drawing::BitmapMode_STRETCH ) ); 190cdf0e10cSrcweir pPool->SetPoolDefaultItem( XFillBmpTileItem( eMode == drawing::BitmapMode_REPEAT ) ); 191cdf0e10cSrcweir return; 192cdf0e10cSrcweir } 193cdf0e10cSrcweir while(0); 194cdf0e10cSrcweir 195cdf0e10cSrcweir default: 196cdf0e10cSrcweir { 197cdf0e10cSrcweir ::std::auto_ptr<SfxPoolItem> pNewItem( pPool->GetDefaultItem( nWhich ).Clone() ); 198cdf0e10cSrcweir sal_uInt8 nMemberId = pEntry->mnMemberId & (~SFX_METRIC_ITEM); 199cdf0e10cSrcweir if( !pPool || (pPool->GetMetric(nWhich) == SFX_MAPUNIT_100TH_MM) ) 200cdf0e10cSrcweir nMemberId &= (~CONVERT_TWIPS); 201cdf0e10cSrcweir 202cdf0e10cSrcweir if( !pNewItem->PutValue( aValue, nMemberId ) ) 203cdf0e10cSrcweir throw lang::IllegalArgumentException(); 204cdf0e10cSrcweir 205cdf0e10cSrcweir pPool->SetPoolDefaultItem( *pNewItem ); 206cdf0e10cSrcweir } 207cdf0e10cSrcweir } 208cdf0e10cSrcweir } 209cdf0e10cSrcweir 210cdf0e10cSrcweir void SvxUnoDrawPool::_setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const uno::Any* pValues ) 211cdf0e10cSrcweir throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException ) 212cdf0e10cSrcweir { 213cdf0e10cSrcweir vos::OGuard aGuard( Application::GetSolarMutex() ); 214cdf0e10cSrcweir 215cdf0e10cSrcweir SfxItemPool* pPool = getModelPool( sal_False ); 216cdf0e10cSrcweir 217cdf0e10cSrcweir DBG_ASSERT( pPool, "I need a SfxItemPool!" ); 218cdf0e10cSrcweir if( NULL == pPool ) 219cdf0e10cSrcweir throw beans::UnknownPropertyException(); 220cdf0e10cSrcweir 221cdf0e10cSrcweir while( *ppEntries ) 222cdf0e10cSrcweir putAny( pPool, *ppEntries++, *pValues++ ); 223cdf0e10cSrcweir } 224cdf0e10cSrcweir 225cdf0e10cSrcweir void SvxUnoDrawPool::_getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, uno::Any* pValue ) 226cdf0e10cSrcweir throw(beans::UnknownPropertyException, lang::WrappedTargetException ) 227cdf0e10cSrcweir { 228cdf0e10cSrcweir vos::OGuard aGuard( Application::GetSolarMutex() ); 229cdf0e10cSrcweir 230cdf0e10cSrcweir SfxItemPool* pPool = getModelPool( sal_True ); 231cdf0e10cSrcweir 232cdf0e10cSrcweir DBG_ASSERT( pPool, "I need a SfxItemPool!" ); 233cdf0e10cSrcweir if( NULL == pPool ) 234cdf0e10cSrcweir throw beans::UnknownPropertyException(); 235cdf0e10cSrcweir 236cdf0e10cSrcweir while( *ppEntries ) 237cdf0e10cSrcweir getAny( pPool, *ppEntries++, *pValue++ ); 238cdf0e10cSrcweir } 239cdf0e10cSrcweir 240cdf0e10cSrcweir void SvxUnoDrawPool::_getPropertyStates( const comphelper::PropertyMapEntry** ppEntries, beans::PropertyState* pStates ) 241cdf0e10cSrcweir throw(beans::UnknownPropertyException ) 242cdf0e10cSrcweir { 243cdf0e10cSrcweir vos::OGuard aGuard( Application::GetSolarMutex() ); 244cdf0e10cSrcweir 245cdf0e10cSrcweir SfxItemPool* pPool = getModelPool( sal_True ); 246cdf0e10cSrcweir 247cdf0e10cSrcweir if( pPool && pPool != mpDefaultsPool ) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir while( *ppEntries ) 250cdf0e10cSrcweir { 251cdf0e10cSrcweir // OD 13.10.2003 #i18732# 252cdf0e10cSrcweir // Assure, that ID is a Which-ID (it could be a Slot-ID.) 253cdf0e10cSrcweir // Thus, convert handle to Which-ID. 254cdf0e10cSrcweir const sal_uInt16 nWhich = pPool->GetWhich( ((sal_uInt16)(*ppEntries)->mnHandle) ); 255cdf0e10cSrcweir 256cdf0e10cSrcweir switch( nWhich ) 257cdf0e10cSrcweir { 258cdf0e10cSrcweir case OWN_ATTR_FILLBMP_MODE: 259cdf0e10cSrcweir { 260cdf0e10cSrcweir // use method <IsStaticDefaultItem(..)> instead of using 261cdf0e10cSrcweir // probably incompatible item pool <mpDefaultPool>. 262cdf0e10cSrcweir if ( IsStaticDefaultItem( &(pPool->GetDefaultItem( XATTR_FILLBMP_STRETCH )) ) || 263cdf0e10cSrcweir IsStaticDefaultItem( &(pPool->GetDefaultItem( XATTR_FILLBMP_TILE )) ) ) 264cdf0e10cSrcweir { 265cdf0e10cSrcweir *pStates = beans::PropertyState_DEFAULT_VALUE; 266cdf0e10cSrcweir } 267cdf0e10cSrcweir else 268cdf0e10cSrcweir { 269cdf0e10cSrcweir *pStates = beans::PropertyState_DIRECT_VALUE; 270cdf0e10cSrcweir } 271cdf0e10cSrcweir } 272cdf0e10cSrcweir break; 273cdf0e10cSrcweir default: 274cdf0e10cSrcweir // OD 13.10.2003 #i18732# - correction: 275cdf0e10cSrcweir // use method <IsStaticDefaultItem(..)> instead of using probably 276cdf0e10cSrcweir // incompatible item pool <mpDefaultPool>. 277cdf0e10cSrcweir const SfxPoolItem& r1 = pPool->GetDefaultItem( nWhich ); 278cdf0e10cSrcweir //const SfxPoolItem& r2 = mpDefaultPool->GetDefaultItem( nWhich ); 279cdf0e10cSrcweir 280cdf0e10cSrcweir if ( IsStaticDefaultItem( &r1 ) ) 281cdf0e10cSrcweir { 282cdf0e10cSrcweir *pStates = beans::PropertyState_DEFAULT_VALUE; 283cdf0e10cSrcweir } 284cdf0e10cSrcweir else 285cdf0e10cSrcweir { 286cdf0e10cSrcweir *pStates = beans::PropertyState_DIRECT_VALUE; 287cdf0e10cSrcweir } 288cdf0e10cSrcweir } 289cdf0e10cSrcweir 290cdf0e10cSrcweir pStates++; 291cdf0e10cSrcweir ppEntries++; 292cdf0e10cSrcweir } 293cdf0e10cSrcweir } 294cdf0e10cSrcweir else 295cdf0e10cSrcweir { 296cdf0e10cSrcweir // as long as we have no model, all properties are default 297cdf0e10cSrcweir while( *ppEntries++ ) 298cdf0e10cSrcweir *pStates++ = beans::PropertyState_DEFAULT_VALUE; 299cdf0e10cSrcweir return; 300cdf0e10cSrcweir } 301cdf0e10cSrcweir } 302cdf0e10cSrcweir 303cdf0e10cSrcweir void SvxUnoDrawPool::_setPropertyToDefault( const comphelper::PropertyMapEntry* pEntry ) 304cdf0e10cSrcweir throw(beans::UnknownPropertyException ) 305cdf0e10cSrcweir { 306cdf0e10cSrcweir vos::OGuard aGuard( Application::GetSolarMutex() ); 307cdf0e10cSrcweir 308cdf0e10cSrcweir SfxItemPool* pPool = getModelPool( sal_True ); 309cdf0e10cSrcweir 310cdf0e10cSrcweir // OD 10.10.2003 #i18732# 311cdf0e10cSrcweir // Assure, that ID is a Which-ID (it could be a Slot-ID.) 312cdf0e10cSrcweir // Thus, convert handle to Which-ID. 313cdf0e10cSrcweir const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle ); 314cdf0e10cSrcweir if ( pPool && pPool != mpDefaultsPool ) 315cdf0e10cSrcweir { 316cdf0e10cSrcweir // OD 13.10.2003 #i18732# - use method <ResetPoolDefaultItem(..)> 317cdf0e10cSrcweir // instead of using probably incompatible item pool <mpDefaultsPool>. 318cdf0e10cSrcweir pPool->ResetPoolDefaultItem( nWhich ); 319cdf0e10cSrcweir } 320cdf0e10cSrcweir } 321cdf0e10cSrcweir 322cdf0e10cSrcweir uno::Any SvxUnoDrawPool::_getPropertyDefault( const comphelper::PropertyMapEntry* pEntry ) 323cdf0e10cSrcweir throw(beans::UnknownPropertyException, lang::WrappedTargetException ) 324cdf0e10cSrcweir { 325cdf0e10cSrcweir vos::OGuard aGuard( Application::GetSolarMutex() ); 326cdf0e10cSrcweir 327cdf0e10cSrcweir // OD 13.10.2003 #i18732# - use method <GetPoolDefaultItem(..)> instead of 328cdf0e10cSrcweir // using probably incompatible item pool <mpDefaultsPool> 329cdf0e10cSrcweir uno::Any aAny; 330cdf0e10cSrcweir SfxItemPool* pPool = getModelPool( sal_True ); 331cdf0e10cSrcweir const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle ); 332cdf0e10cSrcweir const SfxPoolItem *pItem = pPool->GetPoolDefaultItem ( nWhich ); 333cdf0e10cSrcweir pItem->QueryValue( aAny, pEntry->mnMemberId ); 334cdf0e10cSrcweir 335cdf0e10cSrcweir return aAny; 336cdf0e10cSrcweir } 337cdf0e10cSrcweir 338cdf0e10cSrcweir // XInterface 339cdf0e10cSrcweir 340cdf0e10cSrcweir uno::Any SAL_CALL SvxUnoDrawPool::queryInterface( const uno::Type & rType ) 341cdf0e10cSrcweir throw( uno::RuntimeException ) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir return OWeakAggObject::queryInterface( rType ); 344cdf0e10cSrcweir } 345cdf0e10cSrcweir 346cdf0e10cSrcweir uno::Any SAL_CALL SvxUnoDrawPool::queryAggregation( const uno::Type & rType ) 347cdf0e10cSrcweir throw(uno::RuntimeException) 348cdf0e10cSrcweir { 349cdf0e10cSrcweir uno::Any aAny; 350cdf0e10cSrcweir 351cdf0e10cSrcweir if( rType == ::getCppuType((const uno::Reference< lang::XServiceInfo >*)0) ) 352cdf0e10cSrcweir aAny <<= uno::Reference< lang::XServiceInfo >(this); 353cdf0e10cSrcweir else if( rType == ::getCppuType((const uno::Reference< lang::XTypeProvider >*)0) ) 354cdf0e10cSrcweir aAny <<= uno::Reference< lang::XTypeProvider >(this); 355cdf0e10cSrcweir else if( rType == ::getCppuType((const uno::Reference< beans::XPropertySet >*)0) ) 356cdf0e10cSrcweir aAny <<= uno::Reference< beans::XPropertySet >(this); 357cdf0e10cSrcweir else if( rType == ::getCppuType((const uno::Reference< beans::XPropertyState >*)0) ) 358cdf0e10cSrcweir aAny <<= uno::Reference< beans::XPropertyState >(this); 359cdf0e10cSrcweir else if( rType == ::getCppuType((const uno::Reference< beans::XMultiPropertySet >*)0) ) 360cdf0e10cSrcweir aAny <<= uno::Reference< beans::XMultiPropertySet >(this); 361cdf0e10cSrcweir else 362cdf0e10cSrcweir aAny <<= OWeakAggObject::queryAggregation( rType ); 363cdf0e10cSrcweir 364cdf0e10cSrcweir return aAny; 365cdf0e10cSrcweir } 366cdf0e10cSrcweir 367cdf0e10cSrcweir void SAL_CALL SvxUnoDrawPool::acquire() throw ( ) 368cdf0e10cSrcweir { 369cdf0e10cSrcweir OWeakAggObject::acquire(); 370cdf0e10cSrcweir } 371cdf0e10cSrcweir 372cdf0e10cSrcweir void SAL_CALL SvxUnoDrawPool::release() throw ( ) 373cdf0e10cSrcweir { 374cdf0e10cSrcweir OWeakAggObject::release(); 375cdf0e10cSrcweir } 376cdf0e10cSrcweir 377cdf0e10cSrcweir uno::Sequence< uno::Type > SAL_CALL SvxUnoDrawPool::getTypes() 378cdf0e10cSrcweir throw (uno::RuntimeException) 379cdf0e10cSrcweir { 380cdf0e10cSrcweir uno::Sequence< uno::Type > aTypes( 6 ); 381cdf0e10cSrcweir uno::Type* pTypes = aTypes.getArray(); 382cdf0e10cSrcweir 383cdf0e10cSrcweir *pTypes++ = ::getCppuType((const uno::Reference< uno::XAggregation>*)0); 384cdf0e10cSrcweir *pTypes++ = ::getCppuType((const uno::Reference< lang::XServiceInfo>*)0); 385cdf0e10cSrcweir *pTypes++ = ::getCppuType((const uno::Reference< lang::XTypeProvider>*)0); 386cdf0e10cSrcweir *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertySet>*)0); 387cdf0e10cSrcweir *pTypes++ = ::getCppuType((const uno::Reference< beans::XPropertyState>*)0); 388cdf0e10cSrcweir *pTypes++ = ::getCppuType((const uno::Reference< beans::XMultiPropertySet>*)0); 389cdf0e10cSrcweir 390cdf0e10cSrcweir return aTypes; 391cdf0e10cSrcweir } 392cdf0e10cSrcweir 393cdf0e10cSrcweir uno::Sequence< sal_Int8 > SAL_CALL SvxUnoDrawPool::getImplementationId() 394cdf0e10cSrcweir throw (uno::RuntimeException) 395cdf0e10cSrcweir { 396cdf0e10cSrcweir vos::OGuard aGuard( Application::GetSolarMutex() ); 397cdf0e10cSrcweir 398cdf0e10cSrcweir static uno::Sequence< sal_Int8 > aId; 399cdf0e10cSrcweir if( aId.getLength() == 0 ) 400cdf0e10cSrcweir { 401cdf0e10cSrcweir aId.realloc( 16 ); 402cdf0e10cSrcweir rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); 403cdf0e10cSrcweir } 404cdf0e10cSrcweir return aId; 405cdf0e10cSrcweir } 406cdf0e10cSrcweir 407cdf0e10cSrcweir // XServiceInfo 408cdf0e10cSrcweir 409cdf0e10cSrcweir sal_Bool SAL_CALL SvxUnoDrawPool::supportsService( const OUString& ServiceName ) throw(uno::RuntimeException) 410cdf0e10cSrcweir { 411cdf0e10cSrcweir uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); 412cdf0e10cSrcweir const OUString * pArray = aSNL.getConstArray(); 413cdf0e10cSrcweir 414cdf0e10cSrcweir for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) 415cdf0e10cSrcweir if( pArray[i] == ServiceName ) 416cdf0e10cSrcweir return sal_True; 417cdf0e10cSrcweir 418cdf0e10cSrcweir return sal_False; 419cdf0e10cSrcweir } 420cdf0e10cSrcweir 421cdf0e10cSrcweir OUString SAL_CALL SvxUnoDrawPool::getImplementationName() throw( uno::RuntimeException ) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoDrawPool") ); 424cdf0e10cSrcweir } 425cdf0e10cSrcweir 426cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoDrawPool::getSupportedServiceNames( ) 427cdf0e10cSrcweir throw( uno::RuntimeException ) 428cdf0e10cSrcweir { 429cdf0e10cSrcweir uno::Sequence< OUString > aSNS( 1 ); 430cdf0e10cSrcweir aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.Defaults" )); 431cdf0e10cSrcweir return aSNS; 432cdf0e10cSrcweir } 433