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_svx.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "svx/XPropertyTable.hxx" 32*cdf0e10cSrcweir #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/drawing/LineDash.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/awt/Gradient.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/drawing/Hatch.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp> 37*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp> 38*cdf0e10cSrcweir #include <vos/mutex.hxx> 39*cdf0e10cSrcweir #include <vcl/svapp.hxx> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 42*cdf0e10cSrcweir #include "unopolyhelper.hxx" 43*cdf0e10cSrcweir #include <svx/xdef.hxx> 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include "svx/unoapi.hxx" 46*cdf0e10cSrcweir #include <editeng/unoprnms.hxx> 47*cdf0e10cSrcweir #include <basegfx/polygon/b2dpolygon.hxx> 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir using namespace com::sun::star; 50*cdf0e10cSrcweir using namespace ::cppu; 51*cdf0e10cSrcweir using namespace ::rtl; 52*cdf0e10cSrcweir using namespace ::vos; 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir class SvxUnoXPropertyTable : public WeakImplHelper2< container::XNameContainer, lang::XServiceInfo > 55*cdf0e10cSrcweir { 56*cdf0e10cSrcweir private: 57*cdf0e10cSrcweir XPropertyTable* mpTable; 58*cdf0e10cSrcweir XPropertyList* mpList; 59*cdf0e10cSrcweir sal_Int16 mnWhich; 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir long getCount() const { return mpList ? mpList->Count() : (mpTable?mpTable->Count():0); } 62*cdf0e10cSrcweir XPropertyEntry* get( long index ) const; 63*cdf0e10cSrcweir public: 64*cdf0e10cSrcweir SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw(); 65*cdf0e10cSrcweir SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyTable* pTable ) throw(); 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir virtual ~SvxUnoXPropertyTable() throw(); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw() = 0; 70*cdf0e10cSrcweir virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw() = 0; 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir // XServiceInfo 73*cdf0e10cSrcweir virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( uno::RuntimeException); 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir // XNameContainer 76*cdf0e10cSrcweir virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement ) throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException); 77*cdf0e10cSrcweir virtual void SAL_CALL removeByName( const OUString& Name ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir // XNameReplace 80*cdf0e10cSrcweir virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement ) throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir // XNameAccess 83*cdf0e10cSrcweir virtual uno::Any SAL_CALL getByName( const OUString& aName ) throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException); 84*cdf0e10cSrcweir virtual uno::Sequence< OUString > SAL_CALL getElementNames( ) throw( uno::RuntimeException); 85*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) throw( uno::RuntimeException); 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir // XElementAccess 88*cdf0e10cSrcweir virtual sal_Bool SAL_CALL hasElements( ) throw( uno::RuntimeException); 89*cdf0e10cSrcweir }; 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyTable* pTable ) throw() 92*cdf0e10cSrcweir : mpTable( pTable ), mpList( NULL ), mnWhich( nWhich ) 93*cdf0e10cSrcweir { 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw() 97*cdf0e10cSrcweir : mpTable( NULL ), mpList( pList ), mnWhich( nWhich ) 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir } 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir SvxUnoXPropertyTable::~SvxUnoXPropertyTable() throw() 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir } 104*cdf0e10cSrcweir 105*cdf0e10cSrcweir XPropertyEntry* SvxUnoXPropertyTable::get( long index ) const 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir if( mpTable ) 108*cdf0e10cSrcweir return mpTable->Get( index, 0 ); 109*cdf0e10cSrcweir else if( mpList ) 110*cdf0e10cSrcweir return mpList->Get( index, 0 ); 111*cdf0e10cSrcweir else 112*cdf0e10cSrcweir return NULL; 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir // XServiceInfo 116*cdf0e10cSrcweir sal_Bool SAL_CALL SvxUnoXPropertyTable::supportsService( const OUString& ServiceName ) 117*cdf0e10cSrcweir throw( uno::RuntimeException) 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir const uno::Sequence< OUString > aServices( getSupportedServiceNames() ); 120*cdf0e10cSrcweir const OUString* pServices = aServices.getConstArray(); 121*cdf0e10cSrcweir const sal_Int32 nCount = aServices.getLength(); 122*cdf0e10cSrcweir sal_Int32 i; 123*cdf0e10cSrcweir for( i = 0; i < nCount; i++ ) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir if( *pServices++ == ServiceName ) 126*cdf0e10cSrcweir return sal_True; 127*cdf0e10cSrcweir } 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir return sal_False; 130*cdf0e10cSrcweir } 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir // XNameContainer 133*cdf0e10cSrcweir void SAL_CALL SvxUnoXPropertyTable::insertByName( const OUString& aName, const uno::Any& aElement ) 134*cdf0e10cSrcweir throw( lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException) 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir if( NULL == mpList && NULL == mpTable ) 139*cdf0e10cSrcweir throw lang::IllegalArgumentException(); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir if( hasByName( aName ) ) 142*cdf0e10cSrcweir throw container::ElementExistException(); 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir String aInternalName; 145*cdf0e10cSrcweir SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName ); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir XPropertyEntry* pNewEntry = getEntry( aInternalName, aElement ); 148*cdf0e10cSrcweir if( NULL == pNewEntry ) 149*cdf0e10cSrcweir throw lang::IllegalArgumentException(); 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir if( mpList ) 152*cdf0e10cSrcweir mpList->Insert( pNewEntry ); 153*cdf0e10cSrcweir else 154*cdf0e10cSrcweir mpTable->Insert( mpTable->Count(), pNewEntry ); 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir void SAL_CALL SvxUnoXPropertyTable::removeByName( const OUString& Name ) 158*cdf0e10cSrcweir throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) 159*cdf0e10cSrcweir { 160*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir String aInternalName; 163*cdf0e10cSrcweir SvxUnogetInternalNameForItem( mnWhich, Name, aInternalName ); 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir const long nCount = getCount(); 166*cdf0e10cSrcweir long i; 167*cdf0e10cSrcweir XPropertyEntry* pEntry; 168*cdf0e10cSrcweir for( i = 0; i < nCount; i++ ) 169*cdf0e10cSrcweir { 170*cdf0e10cSrcweir pEntry = get( i ); 171*cdf0e10cSrcweir if( pEntry && pEntry->GetName() == aInternalName ) 172*cdf0e10cSrcweir { 173*cdf0e10cSrcweir if( mpList ) 174*cdf0e10cSrcweir delete mpList->Remove( i, 0 ); 175*cdf0e10cSrcweir else 176*cdf0e10cSrcweir delete mpTable->Remove( i, 0 ); 177*cdf0e10cSrcweir return; 178*cdf0e10cSrcweir } 179*cdf0e10cSrcweir } 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir throw container::NoSuchElementException(); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir // XNameReplace 185*cdf0e10cSrcweir void SAL_CALL SvxUnoXPropertyTable::replaceByName( const OUString& aName, const uno::Any& aElement ) 186*cdf0e10cSrcweir throw( lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) 187*cdf0e10cSrcweir { 188*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir String aInternalName; 191*cdf0e10cSrcweir SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName ); 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir const long nCount = getCount(); 194*cdf0e10cSrcweir long i; 195*cdf0e10cSrcweir XPropertyEntry* pEntry; 196*cdf0e10cSrcweir for( i = 0; i < nCount; i++ ) 197*cdf0e10cSrcweir { 198*cdf0e10cSrcweir pEntry = get( i ); 199*cdf0e10cSrcweir if( pEntry && pEntry->GetName() == aInternalName ) 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir XPropertyEntry* pNewEntry = getEntry( aInternalName, aElement ); 202*cdf0e10cSrcweir if( NULL == pNewEntry ) 203*cdf0e10cSrcweir throw lang::IllegalArgumentException(); 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir if( mpList ) 206*cdf0e10cSrcweir delete mpList->Replace( pNewEntry, i ); 207*cdf0e10cSrcweir else 208*cdf0e10cSrcweir delete mpTable->Replace( i, pNewEntry ); 209*cdf0e10cSrcweir return; 210*cdf0e10cSrcweir } 211*cdf0e10cSrcweir } 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir throw container::NoSuchElementException(); 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir // XNameAccess 217*cdf0e10cSrcweir uno::Any SAL_CALL SvxUnoXPropertyTable::getByName( const OUString& aName ) 218*cdf0e10cSrcweir throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException) 219*cdf0e10cSrcweir { 220*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir String aInternalName; 223*cdf0e10cSrcweir SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName ); 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir const long nCount = getCount(); 226*cdf0e10cSrcweir long i; 227*cdf0e10cSrcweir XPropertyEntry* pEntry; 228*cdf0e10cSrcweir for( i = 0; i < nCount; i++ ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir pEntry = get( i ); 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir if( pEntry && pEntry->GetName() == aInternalName ) 233*cdf0e10cSrcweir return getAny( pEntry ); 234*cdf0e10cSrcweir } 235*cdf0e10cSrcweir 236*cdf0e10cSrcweir throw container::NoSuchElementException(); 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoXPropertyTable::getElementNames() 240*cdf0e10cSrcweir throw( uno::RuntimeException) 241*cdf0e10cSrcweir { 242*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 243*cdf0e10cSrcweir 244*cdf0e10cSrcweir const long nCount = getCount(); 245*cdf0e10cSrcweir uno::Sequence< OUString > aNames( nCount ); 246*cdf0e10cSrcweir OUString* pNames = aNames.getArray(); 247*cdf0e10cSrcweir long i; 248*cdf0e10cSrcweir XPropertyEntry* pEntry; 249*cdf0e10cSrcweir for( i = 0; i < nCount; i++ ) 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir pEntry = get( i ); 252*cdf0e10cSrcweir 253*cdf0e10cSrcweir if( pEntry ) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir SvxUnogetApiNameForItem( mnWhich, pEntry->GetName(), *pNames ); 256*cdf0e10cSrcweir pNames++; 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir } 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir return aNames; 261*cdf0e10cSrcweir } 262*cdf0e10cSrcweir 263*cdf0e10cSrcweir sal_Bool SAL_CALL SvxUnoXPropertyTable::hasByName( const OUString& aName ) 264*cdf0e10cSrcweir throw( uno::RuntimeException) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 267*cdf0e10cSrcweir 268*cdf0e10cSrcweir String aInternalName; 269*cdf0e10cSrcweir SvxUnogetInternalNameForItem( mnWhich, aName, aInternalName ); 270*cdf0e10cSrcweir 271*cdf0e10cSrcweir const long nCount = mpList?mpList->Count():0; 272*cdf0e10cSrcweir long i; 273*cdf0e10cSrcweir XPropertyEntry* pEntry; 274*cdf0e10cSrcweir for( i = 0; i < nCount; i++ ) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir pEntry = get( i ); 277*cdf0e10cSrcweir if( pEntry && pEntry->GetName() == aInternalName ) 278*cdf0e10cSrcweir return sal_True; 279*cdf0e10cSrcweir } 280*cdf0e10cSrcweir 281*cdf0e10cSrcweir return sal_False; 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir // XElementAccess 285*cdf0e10cSrcweir sal_Bool SAL_CALL SvxUnoXPropertyTable::hasElements( ) 286*cdf0e10cSrcweir throw( uno::RuntimeException) 287*cdf0e10cSrcweir { 288*cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir return getCount() != 0; 291*cdf0e10cSrcweir } 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir class SvxUnoXColorTable : public SvxUnoXPropertyTable 296*cdf0e10cSrcweir { 297*cdf0e10cSrcweir public: 298*cdf0e10cSrcweir SvxUnoXColorTable( XPropertyTable* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINECOLOR, pTable ) {}; 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir // SvxUnoXPropertyTable 301*cdf0e10cSrcweir virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw(); 302*cdf0e10cSrcweir virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw(); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir // XElementAccess 305*cdf0e10cSrcweir virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException ); 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir // XServiceInfo 308*cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException ); 309*cdf0e10cSrcweir virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException); 310*cdf0e10cSrcweir }; 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SvxUnoXColorTable_createInstance( XPropertyTable* pTable ) throw() 313*cdf0e10cSrcweir { 314*cdf0e10cSrcweir return (OWeakObject*) new SvxUnoXColorTable( pTable ); 315*cdf0e10cSrcweir } 316*cdf0e10cSrcweir 317*cdf0e10cSrcweir // SvxUnoXPropertyTable 318*cdf0e10cSrcweir uno::Any SvxUnoXColorTable::getAny( const XPropertyEntry* pEntry ) const throw() 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir uno::Any aAny; 321*cdf0e10cSrcweir aAny <<= (sal_Int32)((XColorEntry*)pEntry)->GetColor().GetColor(); 322*cdf0e10cSrcweir return aAny; 323*cdf0e10cSrcweir } 324*cdf0e10cSrcweir 325*cdf0e10cSrcweir XPropertyEntry* SvxUnoXColorTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw() 326*cdf0e10cSrcweir { 327*cdf0e10cSrcweir sal_Int32 nColor = 0; 328*cdf0e10cSrcweir if( !(rAny >>= nColor) ) 329*cdf0e10cSrcweir return NULL; 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir const Color aColor( (ColorData)nColor ); 332*cdf0e10cSrcweir const String aName( rName ); 333*cdf0e10cSrcweir return new XColorEntry( aColor, aName ); 334*cdf0e10cSrcweir } 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir // XElementAccess 337*cdf0e10cSrcweir uno::Type SAL_CALL SvxUnoXColorTable::getElementType() 338*cdf0e10cSrcweir throw( uno::RuntimeException ) 339*cdf0e10cSrcweir { 340*cdf0e10cSrcweir return ::getCppuType((const sal_Int32*)0); 341*cdf0e10cSrcweir } 342*cdf0e10cSrcweir 343*cdf0e10cSrcweir // XServiceInfo 344*cdf0e10cSrcweir OUString SAL_CALL SvxUnoXColorTable::getImplementationName( ) throw( uno::RuntimeException ) 345*cdf0e10cSrcweir { 346*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXColorTable" ) ); 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoXColorTable::getSupportedServiceNames( ) throw( uno::RuntimeException) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.ColorTable" ) ); 352*cdf0e10cSrcweir uno::Sequence< OUString > aServices( &aServiceName, 1 ); 353*cdf0e10cSrcweir return aServices; 354*cdf0e10cSrcweir } 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 357*cdf0e10cSrcweir 358*cdf0e10cSrcweir class SvxUnoXLineEndTable : public SvxUnoXPropertyTable 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir public: 361*cdf0e10cSrcweir SvxUnoXLineEndTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINEEND, pTable ) {}; 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir // SvxUnoXPropertyTable 364*cdf0e10cSrcweir virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw(); 365*cdf0e10cSrcweir virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw(); 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir // XElementAccess 368*cdf0e10cSrcweir virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException ); 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir // XServiceInfo 371*cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException ); 372*cdf0e10cSrcweir virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException); 373*cdf0e10cSrcweir }; 374*cdf0e10cSrcweir 375*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SvxUnoXLineEndTable_createInstance( XPropertyList* pTable ) throw() 376*cdf0e10cSrcweir { 377*cdf0e10cSrcweir return (OWeakObject*)new SvxUnoXLineEndTable( pTable ); 378*cdf0e10cSrcweir } 379*cdf0e10cSrcweir 380*cdf0e10cSrcweir // SvxUnoXPropertyTable 381*cdf0e10cSrcweir uno::Any SvxUnoXLineEndTable::getAny( const XPropertyEntry* pEntry ) const throw() 382*cdf0e10cSrcweir { 383*cdf0e10cSrcweir 384*cdf0e10cSrcweir uno::Any aAny; 385*cdf0e10cSrcweir drawing::PolyPolygonBezierCoords aBezier; 386*cdf0e10cSrcweir SvxConvertB2DPolyPolygonToPolyPolygonBezier( ((XLineEndEntry*)pEntry)->GetLineEnd(), aBezier ); 387*cdf0e10cSrcweir aAny <<= aBezier; 388*cdf0e10cSrcweir return aAny; 389*cdf0e10cSrcweir } 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir XPropertyEntry* SvxUnoXLineEndTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw() 392*cdf0e10cSrcweir { 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir if( !rAny.getValue() || rAny.getValueType() != ::getCppuType((const drawing::PolyPolygonBezierCoords*)0) ) 395*cdf0e10cSrcweir return NULL; 396*cdf0e10cSrcweir 397*cdf0e10cSrcweir basegfx::B2DPolyPolygon aPolyPolygon; 398*cdf0e10cSrcweir drawing::PolyPolygonBezierCoords* pCoords = (drawing::PolyPolygonBezierCoords*)rAny.getValue(); 399*cdf0e10cSrcweir if( pCoords->Coordinates.getLength() > 0 ) 400*cdf0e10cSrcweir aPolyPolygon = SvxConvertPolyPolygonBezierToB2DPolyPolygon( pCoords ); 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir // #86265# make sure polygon is closed 403*cdf0e10cSrcweir aPolyPolygon.setClosed(true); 404*cdf0e10cSrcweir 405*cdf0e10cSrcweir const String aName( rName ); 406*cdf0e10cSrcweir return new XLineEndEntry( aPolyPolygon, aName ); 407*cdf0e10cSrcweir } 408*cdf0e10cSrcweir 409*cdf0e10cSrcweir // XElementAccess 410*cdf0e10cSrcweir uno::Type SAL_CALL SvxUnoXLineEndTable::getElementType() 411*cdf0e10cSrcweir throw( uno::RuntimeException ) 412*cdf0e10cSrcweir { 413*cdf0e10cSrcweir return ::getCppuType((const drawing::PolyPolygonBezierCoords*)0); 414*cdf0e10cSrcweir } 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir // XServiceInfo 417*cdf0e10cSrcweir OUString SAL_CALL SvxUnoXLineEndTable::getImplementationName( ) throw( uno::RuntimeException ) 418*cdf0e10cSrcweir { 419*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXLineEndTable" ) ); 420*cdf0e10cSrcweir } 421*cdf0e10cSrcweir 422*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoXLineEndTable::getSupportedServiceNames( ) throw( uno::RuntimeException) 423*cdf0e10cSrcweir { 424*cdf0e10cSrcweir const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.LineEndTable" ) ); 425*cdf0e10cSrcweir uno::Sequence< OUString > aServices( &aServiceName, 1 ); 426*cdf0e10cSrcweir return aServices; 427*cdf0e10cSrcweir } 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir class SvxUnoXDashTable : public SvxUnoXPropertyTable 432*cdf0e10cSrcweir { 433*cdf0e10cSrcweir public: 434*cdf0e10cSrcweir SvxUnoXDashTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_LINEDASH, pTable ) {}; 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir // SvxUnoXPropertyTable 437*cdf0e10cSrcweir virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw(); 438*cdf0e10cSrcweir virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw(); 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir // XElementAccess 441*cdf0e10cSrcweir virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException ); 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir // XServiceInfo 444*cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException ); 445*cdf0e10cSrcweir virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException); 446*cdf0e10cSrcweir }; 447*cdf0e10cSrcweir 448*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SvxUnoXDashTable_createInstance( XPropertyList* pTable ) throw() 449*cdf0e10cSrcweir { 450*cdf0e10cSrcweir return (OWeakObject*)new SvxUnoXDashTable( pTable ); 451*cdf0e10cSrcweir } 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir // SvxUnoXPropertyTable 454*cdf0e10cSrcweir uno::Any SvxUnoXDashTable::getAny( const XPropertyEntry* pEntry ) const throw() 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir const XDash& rXD = ((XDashEntry*)pEntry)->GetDash(); 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir drawing::LineDash aLineDash; 459*cdf0e10cSrcweir 460*cdf0e10cSrcweir aLineDash.Style = (::com::sun::star::drawing::DashStyle)((sal_uInt16)rXD.GetDashStyle()); 461*cdf0e10cSrcweir aLineDash.Dots = rXD.GetDots(); 462*cdf0e10cSrcweir aLineDash.DotLen = rXD.GetDotLen(); 463*cdf0e10cSrcweir aLineDash.Dashes = rXD.GetDashes(); 464*cdf0e10cSrcweir aLineDash.DashLen = rXD.GetDashLen(); 465*cdf0e10cSrcweir aLineDash.Distance = rXD.GetDistance(); 466*cdf0e10cSrcweir 467*cdf0e10cSrcweir uno::Any aAny; 468*cdf0e10cSrcweir aAny <<= aLineDash; 469*cdf0e10cSrcweir return aAny; 470*cdf0e10cSrcweir } 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir XPropertyEntry* SvxUnoXDashTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw() 473*cdf0e10cSrcweir { 474*cdf0e10cSrcweir drawing::LineDash aLineDash; 475*cdf0e10cSrcweir if(!(rAny >>= aLineDash)) 476*cdf0e10cSrcweir return NULL; 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir XDash aXDash; 479*cdf0e10cSrcweir 480*cdf0e10cSrcweir aXDash.SetDashStyle((XDashStyle)((sal_uInt16)(aLineDash.Style))); 481*cdf0e10cSrcweir aXDash.SetDots(aLineDash.Dots); 482*cdf0e10cSrcweir aXDash.SetDotLen(aLineDash.DotLen); 483*cdf0e10cSrcweir aXDash.SetDashes(aLineDash.Dashes); 484*cdf0e10cSrcweir aXDash.SetDashLen(aLineDash.DashLen); 485*cdf0e10cSrcweir aXDash.SetDistance(aLineDash.Distance); 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir const String aName( rName ); 488*cdf0e10cSrcweir return new XDashEntry( aXDash, aName ); 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir // XElementAccess 492*cdf0e10cSrcweir uno::Type SAL_CALL SvxUnoXDashTable::getElementType() 493*cdf0e10cSrcweir throw( uno::RuntimeException ) 494*cdf0e10cSrcweir { 495*cdf0e10cSrcweir return ::getCppuType((const drawing::LineDash*)0); 496*cdf0e10cSrcweir } 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir // XServiceInfo 499*cdf0e10cSrcweir OUString SAL_CALL SvxUnoXDashTable::getImplementationName( ) throw( uno::RuntimeException ) 500*cdf0e10cSrcweir { 501*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXDashTable" ) ); 502*cdf0e10cSrcweir } 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoXDashTable::getSupportedServiceNames( ) throw( uno::RuntimeException) 505*cdf0e10cSrcweir { 506*cdf0e10cSrcweir const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.DashTable" ) ); 507*cdf0e10cSrcweir uno::Sequence< OUString > aServices( &aServiceName, 1 ); 508*cdf0e10cSrcweir return aServices; 509*cdf0e10cSrcweir } 510*cdf0e10cSrcweir 511*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 512*cdf0e10cSrcweir 513*cdf0e10cSrcweir class SvxUnoXHatchTable : public SvxUnoXPropertyTable 514*cdf0e10cSrcweir { 515*cdf0e10cSrcweir public: 516*cdf0e10cSrcweir SvxUnoXHatchTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_FILLHATCH, pTable ) {}; 517*cdf0e10cSrcweir 518*cdf0e10cSrcweir // SvxUnoXPropertyTable 519*cdf0e10cSrcweir virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw(); 520*cdf0e10cSrcweir virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw(); 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir // XElementAccess 523*cdf0e10cSrcweir virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException ); 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir // XServiceInfo 526*cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException ); 527*cdf0e10cSrcweir virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException); 528*cdf0e10cSrcweir }; 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SvxUnoXHatchTable_createInstance( XPropertyList* pTable ) throw() 531*cdf0e10cSrcweir { 532*cdf0e10cSrcweir return (OWeakObject*)new SvxUnoXHatchTable( pTable ); 533*cdf0e10cSrcweir } 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir // SvxUnoXPropertyTable 536*cdf0e10cSrcweir uno::Any SvxUnoXHatchTable::getAny( const XPropertyEntry* pEntry ) const throw() 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir const XHatch& aHatch = ((XHatchEntry*)pEntry)->GetHatch(); 539*cdf0e10cSrcweir 540*cdf0e10cSrcweir drawing::Hatch aUnoHatch; 541*cdf0e10cSrcweir 542*cdf0e10cSrcweir aUnoHatch.Style = (drawing::HatchStyle)aHatch.GetHatchStyle(); 543*cdf0e10cSrcweir aUnoHatch.Color = aHatch.GetColor().GetColor(); 544*cdf0e10cSrcweir aUnoHatch.Distance = aHatch.GetDistance(); 545*cdf0e10cSrcweir aUnoHatch.Angle = aHatch.GetAngle(); 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir uno::Any aAny; 548*cdf0e10cSrcweir aAny <<= aUnoHatch; 549*cdf0e10cSrcweir return aAny; 550*cdf0e10cSrcweir } 551*cdf0e10cSrcweir 552*cdf0e10cSrcweir XPropertyEntry* SvxUnoXHatchTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw() 553*cdf0e10cSrcweir { 554*cdf0e10cSrcweir drawing::Hatch aUnoHatch; 555*cdf0e10cSrcweir if(!(rAny >>= aUnoHatch)) 556*cdf0e10cSrcweir return NULL; 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir XHatch aXHatch; 559*cdf0e10cSrcweir aXHatch.SetHatchStyle( (XHatchStyle)aUnoHatch.Style ); 560*cdf0e10cSrcweir aXHatch.SetColor( aUnoHatch.Color ); 561*cdf0e10cSrcweir aXHatch.SetDistance( aUnoHatch.Distance ); 562*cdf0e10cSrcweir aXHatch.SetAngle( aUnoHatch.Angle ); 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir const String aName( rName ); 565*cdf0e10cSrcweir return new XHatchEntry( aXHatch, aName ); 566*cdf0e10cSrcweir } 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir // XElementAccess 569*cdf0e10cSrcweir uno::Type SAL_CALL SvxUnoXHatchTable::getElementType() 570*cdf0e10cSrcweir throw( uno::RuntimeException ) 571*cdf0e10cSrcweir { 572*cdf0e10cSrcweir return ::getCppuType((const drawing::Hatch*)0); 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir 575*cdf0e10cSrcweir // XServiceInfo 576*cdf0e10cSrcweir OUString SAL_CALL SvxUnoXHatchTable::getImplementationName( ) throw( uno::RuntimeException ) 577*cdf0e10cSrcweir { 578*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXHatchTable" ) ); 579*cdf0e10cSrcweir } 580*cdf0e10cSrcweir 581*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoXHatchTable::getSupportedServiceNames( ) throw( uno::RuntimeException) 582*cdf0e10cSrcweir { 583*cdf0e10cSrcweir const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.HatchTable" ) ); 584*cdf0e10cSrcweir uno::Sequence< OUString > aServices( &aServiceName, 1 ); 585*cdf0e10cSrcweir return aServices; 586*cdf0e10cSrcweir } 587*cdf0e10cSrcweir 588*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 589*cdf0e10cSrcweir 590*cdf0e10cSrcweir class SvxUnoXGradientTable : public SvxUnoXPropertyTable 591*cdf0e10cSrcweir { 592*cdf0e10cSrcweir public: 593*cdf0e10cSrcweir SvxUnoXGradientTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_FILLGRADIENT, pTable ) {}; 594*cdf0e10cSrcweir 595*cdf0e10cSrcweir // SvxUnoXPropertyTable 596*cdf0e10cSrcweir virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw(); 597*cdf0e10cSrcweir virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw(); 598*cdf0e10cSrcweir 599*cdf0e10cSrcweir // XElementAccess 600*cdf0e10cSrcweir virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException ); 601*cdf0e10cSrcweir 602*cdf0e10cSrcweir // XServiceInfo 603*cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException ); 604*cdf0e10cSrcweir virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException); 605*cdf0e10cSrcweir }; 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SvxUnoXGradientTable_createInstance( XPropertyList* pTable ) throw() 608*cdf0e10cSrcweir { 609*cdf0e10cSrcweir return (OWeakObject*)new SvxUnoXGradientTable( pTable ); 610*cdf0e10cSrcweir } 611*cdf0e10cSrcweir 612*cdf0e10cSrcweir // SvxUnoXPropertyTable 613*cdf0e10cSrcweir uno::Any SvxUnoXGradientTable::getAny( const XPropertyEntry* pEntry ) const throw() 614*cdf0e10cSrcweir { 615*cdf0e10cSrcweir const XGradient& aXGradient = ((XGradientEntry*)pEntry)->GetGradient(); 616*cdf0e10cSrcweir awt::Gradient aGradient; 617*cdf0e10cSrcweir 618*cdf0e10cSrcweir aGradient.Style = (awt::GradientStyle) aXGradient.GetGradientStyle(); 619*cdf0e10cSrcweir aGradient.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor(); 620*cdf0e10cSrcweir aGradient.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor(); 621*cdf0e10cSrcweir aGradient.Angle = (short)aXGradient.GetAngle(); 622*cdf0e10cSrcweir aGradient.Border = aXGradient.GetBorder(); 623*cdf0e10cSrcweir aGradient.XOffset = aXGradient.GetXOffset(); 624*cdf0e10cSrcweir aGradient.YOffset = aXGradient.GetYOffset(); 625*cdf0e10cSrcweir aGradient.StartIntensity = aXGradient.GetStartIntens(); 626*cdf0e10cSrcweir aGradient.EndIntensity = aXGradient.GetEndIntens(); 627*cdf0e10cSrcweir aGradient.StepCount = aXGradient.GetSteps(); 628*cdf0e10cSrcweir 629*cdf0e10cSrcweir uno::Any aAny; 630*cdf0e10cSrcweir aAny <<= aGradient; 631*cdf0e10cSrcweir return aAny; 632*cdf0e10cSrcweir } 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir XPropertyEntry* SvxUnoXGradientTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw() 635*cdf0e10cSrcweir { 636*cdf0e10cSrcweir awt::Gradient aGradient; 637*cdf0e10cSrcweir if(!(rAny >>= aGradient)) 638*cdf0e10cSrcweir return NULL; 639*cdf0e10cSrcweir 640*cdf0e10cSrcweir XGradient aXGradient; 641*cdf0e10cSrcweir 642*cdf0e10cSrcweir aXGradient.SetGradientStyle( (XGradientStyle) aGradient.Style ); 643*cdf0e10cSrcweir aXGradient.SetStartColor( aGradient.StartColor ); 644*cdf0e10cSrcweir aXGradient.SetEndColor( aGradient.EndColor ); 645*cdf0e10cSrcweir aXGradient.SetAngle( aGradient.Angle ); 646*cdf0e10cSrcweir aXGradient.SetBorder( aGradient.Border ); 647*cdf0e10cSrcweir aXGradient.SetXOffset( aGradient.XOffset ); 648*cdf0e10cSrcweir aXGradient.SetYOffset( aGradient.YOffset ); 649*cdf0e10cSrcweir aXGradient.SetStartIntens( aGradient.StartIntensity ); 650*cdf0e10cSrcweir aXGradient.SetEndIntens( aGradient.EndIntensity ); 651*cdf0e10cSrcweir aXGradient.SetSteps( aGradient.StepCount ); 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir const String aName( rName ); 654*cdf0e10cSrcweir return new XGradientEntry( aXGradient, aName ); 655*cdf0e10cSrcweir } 656*cdf0e10cSrcweir 657*cdf0e10cSrcweir // XElementAccess 658*cdf0e10cSrcweir uno::Type SAL_CALL SvxUnoXGradientTable::getElementType() 659*cdf0e10cSrcweir throw( uno::RuntimeException ) 660*cdf0e10cSrcweir { 661*cdf0e10cSrcweir return ::getCppuType((const awt::Gradient*)0); 662*cdf0e10cSrcweir } 663*cdf0e10cSrcweir 664*cdf0e10cSrcweir // XServiceInfo 665*cdf0e10cSrcweir OUString SAL_CALL SvxUnoXGradientTable::getImplementationName( ) throw( uno::RuntimeException ) 666*cdf0e10cSrcweir { 667*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXGradientTable" ) ); 668*cdf0e10cSrcweir } 669*cdf0e10cSrcweir 670*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoXGradientTable::getSupportedServiceNames( ) throw( uno::RuntimeException) 671*cdf0e10cSrcweir { 672*cdf0e10cSrcweir const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.GradientTable" ) ); 673*cdf0e10cSrcweir uno::Sequence< OUString > aServices( &aServiceName, 1 ); 674*cdf0e10cSrcweir return aServices; 675*cdf0e10cSrcweir } 676*cdf0e10cSrcweir 677*cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 678*cdf0e10cSrcweir 679*cdf0e10cSrcweir class SvxUnoXBitmapTable : public SvxUnoXPropertyTable 680*cdf0e10cSrcweir { 681*cdf0e10cSrcweir public: 682*cdf0e10cSrcweir SvxUnoXBitmapTable( XPropertyList* pTable ) throw() : SvxUnoXPropertyTable( XATTR_FILLBITMAP, pTable ) {}; 683*cdf0e10cSrcweir 684*cdf0e10cSrcweir // SvxUnoXPropertyTable 685*cdf0e10cSrcweir virtual uno::Any getAny( const XPropertyEntry* pEntry ) const throw(); 686*cdf0e10cSrcweir virtual XPropertyEntry* getEntry( const OUString& rName, const uno::Any& rAny ) const throw(); 687*cdf0e10cSrcweir 688*cdf0e10cSrcweir // XElementAccess 689*cdf0e10cSrcweir virtual uno::Type SAL_CALL getElementType() throw( uno::RuntimeException ); 690*cdf0e10cSrcweir 691*cdf0e10cSrcweir // XServiceInfo 692*cdf0e10cSrcweir virtual OUString SAL_CALL getImplementationName( ) throw( uno::RuntimeException ); 693*cdf0e10cSrcweir virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw( uno::RuntimeException); 694*cdf0e10cSrcweir }; 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir uno::Reference< uno::XInterface > SAL_CALL SvxUnoXBitmapTable_createInstance( XPropertyList* pTable ) throw() 697*cdf0e10cSrcweir { 698*cdf0e10cSrcweir return (OWeakObject*)new SvxUnoXBitmapTable( pTable ); 699*cdf0e10cSrcweir } 700*cdf0e10cSrcweir 701*cdf0e10cSrcweir // SvxUnoXPropertyTable 702*cdf0e10cSrcweir uno::Any SvxUnoXBitmapTable::getAny( const XPropertyEntry* pEntry ) const throw() 703*cdf0e10cSrcweir { 704*cdf0e10cSrcweir OUString aURL( RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX)); 705*cdf0e10cSrcweir aURL += OUString::createFromAscii( ((XBitmapEntry*)pEntry)->GetXBitmap().GetGraphicObject().GetUniqueID().GetBuffer() ); 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir uno::Any aAny; 708*cdf0e10cSrcweir aAny <<= aURL; 709*cdf0e10cSrcweir return aAny; 710*cdf0e10cSrcweir } 711*cdf0e10cSrcweir 712*cdf0e10cSrcweir XPropertyEntry* SvxUnoXBitmapTable::getEntry( const OUString& rName, const uno::Any& rAny ) const throw() 713*cdf0e10cSrcweir { 714*cdf0e10cSrcweir OUString aURL; 715*cdf0e10cSrcweir if(!(rAny >>= aURL)) 716*cdf0e10cSrcweir return NULL; 717*cdf0e10cSrcweir 718*cdf0e10cSrcweir GraphicObject aGrafObj( GraphicObject::CreateGraphicObjectFromURL( aURL ) ); 719*cdf0e10cSrcweir XOBitmap aBMP( aGrafObj ); 720*cdf0e10cSrcweir 721*cdf0e10cSrcweir const String aName( rName ); 722*cdf0e10cSrcweir return new XBitmapEntry( aBMP, aName ); 723*cdf0e10cSrcweir } 724*cdf0e10cSrcweir 725*cdf0e10cSrcweir // XElementAccess 726*cdf0e10cSrcweir uno::Type SAL_CALL SvxUnoXBitmapTable::getElementType() 727*cdf0e10cSrcweir throw( uno::RuntimeException ) 728*cdf0e10cSrcweir { 729*cdf0e10cSrcweir return ::getCppuType((const OUString*)0); 730*cdf0e10cSrcweir } 731*cdf0e10cSrcweir 732*cdf0e10cSrcweir // XServiceInfo 733*cdf0e10cSrcweir OUString SAL_CALL SvxUnoXBitmapTable::getImplementationName( ) throw( uno::RuntimeException ) 734*cdf0e10cSrcweir { 735*cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxUnoXBitmapTable" ) ); 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir 738*cdf0e10cSrcweir uno::Sequence< OUString > SAL_CALL SvxUnoXBitmapTable::getSupportedServiceNames( ) throw( uno::RuntimeException) 739*cdf0e10cSrcweir { 740*cdf0e10cSrcweir const OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.BitmapTable" ) ); 741*cdf0e10cSrcweir uno::Sequence< OUString > aServices( &aServiceName, 1 ); 742*cdf0e10cSrcweir return aServices; 743*cdf0e10cSrcweir } 744