1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "svx/XPropertyTable.hxx"
22 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
23 #include <com/sun/star/drawing/LineDash.hpp>
24 #include <com/sun/star/awt/Gradient.hpp>
25 #include <com/sun/star/drawing/Hatch.hpp>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/container/XNameContainer.hpp>
28 #include <osl/mutex.hxx>
29 #include <vcl/svapp.hxx>
31 #include <cppuhelper/implbase2.hxx>
32 #include <svx/xdef.hxx>
34 #include "svx/unoapi.hxx"
35 #include <editeng/unoprnms.hxx>
36 #include <basegfx/polygon/b2dpolygon.hxx>
37 #include <basegfx/tools/unotools.hxx>
39 using namespace com::sun::star
;
40 using namespace ::cppu
;
41 using namespace ::rtl
;
43 class SvxUnoXPropertyTable
: public WeakImplHelper2
< container::XNameContainer
, lang::XServiceInfo
>
46 XPropertyList
* mpList
;
49 long getCount() const { return mpList
? mpList
->Count() : 0; }
50 XPropertyEntry
* get( long index
) const;
52 SvxUnoXPropertyTable( sal_Int16 nWhich
, XPropertyList
* pList
) throw();
54 virtual ~SvxUnoXPropertyTable() throw();
56 virtual uno::Any
getAny( const XPropertyEntry
* pEntry
) const throw() = 0;
57 virtual XPropertyEntry
* getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw() = 0;
60 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) throw( uno::RuntimeException
);
63 virtual void SAL_CALL
insertByName( const OUString
& aName
, const uno::Any
& aElement
) throw( lang::IllegalArgumentException
, container::ElementExistException
, lang::WrappedTargetException
, uno::RuntimeException
);
64 virtual void SAL_CALL
removeByName( const OUString
& Name
) throw( container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
);
67 virtual void SAL_CALL
replaceByName( const OUString
& aName
, const uno::Any
& aElement
) throw( lang::IllegalArgumentException
, container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
);
70 virtual uno::Any SAL_CALL
getByName( const OUString
& aName
) throw( container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
);
71 virtual uno::Sequence
< OUString
> SAL_CALL
getElementNames( ) throw( uno::RuntimeException
);
72 virtual sal_Bool SAL_CALL
hasByName( const OUString
& aName
) throw( uno::RuntimeException
);
75 virtual sal_Bool SAL_CALL
hasElements( ) throw( uno::RuntimeException
);
78 SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich
, XPropertyList
* pList
) throw()
79 : mpList( pList
), mnWhich( nWhich
)
83 SvxUnoXPropertyTable::~SvxUnoXPropertyTable() throw()
87 XPropertyEntry
* SvxUnoXPropertyTable::get( long index
) const
90 return mpList
->Get( index
, 0 );
96 sal_Bool SAL_CALL
SvxUnoXPropertyTable::supportsService( const OUString
& ServiceName
)
97 throw( uno::RuntimeException
)
99 const uno::Sequence
< OUString
> aServices( getSupportedServiceNames() );
100 const OUString
* pServices
= aServices
.getConstArray();
101 const sal_Int32 nCount
= aServices
.getLength();
103 for( i
= 0; i
< nCount
; i
++ )
105 if( *pServices
++ == ServiceName
)
113 void SAL_CALL
SvxUnoXPropertyTable::insertByName( const OUString
& aName
, const uno::Any
& aElement
)
114 throw( lang::IllegalArgumentException
, container::ElementExistException
, lang::WrappedTargetException
, uno::RuntimeException
)
116 SolarMutexGuard aGuard
;
119 throw lang::IllegalArgumentException();
121 if( hasByName( aName
) )
122 throw container::ElementExistException();
124 OUString aInternalName
= SvxUnogetInternalNameForItem(mnWhich
, aName
);
126 XPropertyEntry
* pNewEntry
= getEntry( aInternalName
, aElement
);
127 if( NULL
== pNewEntry
)
128 throw lang::IllegalArgumentException();
131 mpList
->Insert( pNewEntry
);
134 void SAL_CALL
SvxUnoXPropertyTable::removeByName( const OUString
& Name
)
135 throw( container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
137 SolarMutexGuard aGuard
;
139 OUString aInternalName
= SvxUnogetInternalNameForItem(mnWhich
, Name
);
141 const long nCount
= getCount();
143 XPropertyEntry
* pEntry
;
144 for( i
= 0; i
< nCount
; i
++ )
147 if (pEntry
&& aInternalName
.equals(pEntry
->GetName()))
150 delete mpList
->Remove( i
);
155 throw container::NoSuchElementException();
159 void SAL_CALL
SvxUnoXPropertyTable::replaceByName( const OUString
& aName
, const uno::Any
& aElement
)
160 throw( lang::IllegalArgumentException
, container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
162 SolarMutexGuard aGuard
;
164 OUString aInternalName
= SvxUnogetInternalNameForItem(mnWhich
, aName
);
166 const long nCount
= getCount();
168 XPropertyEntry
* pEntry
;
169 for( i
= 0; i
< nCount
; i
++ )
172 if (pEntry
&& aInternalName
.equals(pEntry
->GetName()))
174 XPropertyEntry
* pNewEntry
= getEntry( aInternalName
, aElement
);
175 if( NULL
== pNewEntry
)
176 throw lang::IllegalArgumentException();
179 delete mpList
->Replace( pNewEntry
, i
);
184 throw container::NoSuchElementException();
188 uno::Any SAL_CALL
SvxUnoXPropertyTable::getByName( const OUString
& aName
)
189 throw( container::NoSuchElementException
, lang::WrappedTargetException
, uno::RuntimeException
)
191 SolarMutexGuard aGuard
;
193 OUString aInternalName
= SvxUnogetInternalNameForItem(mnWhich
, aName
);
195 const long nCount
= getCount();
197 XPropertyEntry
* pEntry
;
198 for( i
= 0; i
< nCount
; i
++ )
202 if (pEntry
&& aInternalName
.equals(pEntry
->GetName()))
203 return getAny( pEntry
);
206 throw container::NoSuchElementException();
209 uno::Sequence
< OUString
> SAL_CALL
SvxUnoXPropertyTable::getElementNames()
210 throw( uno::RuntimeException
)
212 SolarMutexGuard aGuard
;
214 const long nCount
= getCount();
215 uno::Sequence
< OUString
> aNames( nCount
);
216 OUString
* pNames
= aNames
.getArray();
218 XPropertyEntry
* pEntry
;
219 for( i
= 0; i
< nCount
; i
++ )
224 *pNames
++ = SvxUnogetApiNameForItem(mnWhich
, pEntry
->GetName());
230 sal_Bool SAL_CALL
SvxUnoXPropertyTable::hasByName( const OUString
& aName
)
231 throw( uno::RuntimeException
)
233 SolarMutexGuard aGuard
;
235 OUString aInternalName
= SvxUnogetInternalNameForItem(mnWhich
, aName
);
237 const long nCount
= mpList
?mpList
->Count():0;
239 XPropertyEntry
* pEntry
;
240 for( i
= 0; i
< nCount
; i
++ )
243 if (pEntry
&& aInternalName
.equals(pEntry
->GetName()))
251 sal_Bool SAL_CALL
SvxUnoXPropertyTable::hasElements( )
252 throw( uno::RuntimeException
)
254 SolarMutexGuard aGuard
;
256 return getCount() != 0;
259 ///////////////////////////////////////////////////////////////////////
261 class SvxUnoXColorTable
: public SvxUnoXPropertyTable
264 SvxUnoXColorTable( XPropertyList
* pList
) throw() : SvxUnoXPropertyTable( XATTR_LINECOLOR
, pList
) {};
266 // SvxUnoXPropertyTable
267 virtual uno::Any
getAny( const XPropertyEntry
* pEntry
) const throw();
268 virtual XPropertyEntry
* getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw();
271 virtual uno::Type SAL_CALL
getElementType() throw( uno::RuntimeException
);
274 virtual OUString SAL_CALL
getImplementationName( ) throw( uno::RuntimeException
);
275 virtual uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw( uno::RuntimeException
);
278 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoXColorTable_createInstance( XPropertyList
* pList
) throw()
280 return (OWeakObject
*) new SvxUnoXColorTable( pList
);
283 // SvxUnoXPropertyTable
284 uno::Any
SvxUnoXColorTable::getAny( const XPropertyEntry
* pEntry
) const throw()
287 aAny
<<= (sal_Int32
)((XColorEntry
*)pEntry
)->GetColor().GetColor();
291 XPropertyEntry
* SvxUnoXColorTable::getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw()
293 sal_Int32 nColor
= 0;
294 if( !(rAny
>>= nColor
) )
297 const Color
aColor( (ColorData
)nColor
);
298 const String
aName( rName
);
299 return new XColorEntry( aColor
, aName
);
303 uno::Type SAL_CALL
SvxUnoXColorTable::getElementType()
304 throw( uno::RuntimeException
)
306 return ::getCppuType((const sal_Int32
*)0);
310 OUString SAL_CALL
SvxUnoXColorTable::getImplementationName( ) throw( uno::RuntimeException
)
312 return OUString( "SvxUnoXColorTable" );
315 uno::Sequence
< OUString
> SAL_CALL
SvxUnoXColorTable::getSupportedServiceNames( ) throw( uno::RuntimeException
)
317 const OUString
aServiceName( "com.sun.star.drawing.ColorTable" );
318 uno::Sequence
< OUString
> aServices( &aServiceName
, 1 );
322 ///////////////////////////////////////////////////////////////////////
324 class SvxUnoXLineEndTable
: public SvxUnoXPropertyTable
327 SvxUnoXLineEndTable( XPropertyList
* pTable
) throw() : SvxUnoXPropertyTable( XATTR_LINEEND
, pTable
) {};
329 // SvxUnoXPropertyTable
330 virtual uno::Any
getAny( const XPropertyEntry
* pEntry
) const throw();
331 virtual XPropertyEntry
* getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw();
334 virtual uno::Type SAL_CALL
getElementType() throw( uno::RuntimeException
);
337 virtual OUString SAL_CALL
getImplementationName( ) throw( uno::RuntimeException
);
338 virtual uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw( uno::RuntimeException
);
341 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoXLineEndTable_createInstance( XPropertyList
* pTable
) throw()
343 return (OWeakObject
*)new SvxUnoXLineEndTable( pTable
);
346 // SvxUnoXPropertyTable
347 uno::Any
SvxUnoXLineEndTable::getAny( const XPropertyEntry
* pEntry
) const throw()
351 drawing::PolyPolygonBezierCoords aBezier
;
352 basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier( ((XLineEndEntry
*)pEntry
)->GetLineEnd(),
358 XPropertyEntry
* SvxUnoXLineEndTable::getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw()
361 if( !rAny
.getValue() || rAny
.getValueType() != ::getCppuType((const drawing::PolyPolygonBezierCoords
*)0) )
364 basegfx::B2DPolyPolygon aPolyPolygon
;
365 drawing::PolyPolygonBezierCoords
* pCoords
= (drawing::PolyPolygonBezierCoords
*)rAny
.getValue();
366 if( pCoords
->Coordinates
.getLength() > 0 )
367 aPolyPolygon
= basegfx::unotools::polyPolygonBezierToB2DPolyPolygon( *pCoords
);
369 // #86265# make sure polygon is closed
370 aPolyPolygon
.setClosed(true);
372 const String
aName( rName
);
373 return new XLineEndEntry( aPolyPolygon
, aName
);
377 uno::Type SAL_CALL
SvxUnoXLineEndTable::getElementType()
378 throw( uno::RuntimeException
)
380 return ::getCppuType((const drawing::PolyPolygonBezierCoords
*)0);
384 OUString SAL_CALL
SvxUnoXLineEndTable::getImplementationName( ) throw( uno::RuntimeException
)
386 return OUString( "SvxUnoXLineEndTable" );
389 uno::Sequence
< OUString
> SAL_CALL
SvxUnoXLineEndTable::getSupportedServiceNames( ) throw( uno::RuntimeException
)
391 const OUString
aServiceName( "com.sun.star.drawing.LineEndTable" );
392 uno::Sequence
< OUString
> aServices( &aServiceName
, 1 );
396 ///////////////////////////////////////////////////////////////////////
398 class SvxUnoXDashTable
: public SvxUnoXPropertyTable
401 SvxUnoXDashTable( XPropertyList
* pTable
) throw() : SvxUnoXPropertyTable( XATTR_LINEDASH
, pTable
) {};
403 // SvxUnoXPropertyTable
404 virtual uno::Any
getAny( const XPropertyEntry
* pEntry
) const throw();
405 virtual XPropertyEntry
* getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw();
408 virtual uno::Type SAL_CALL
getElementType() throw( uno::RuntimeException
);
411 virtual OUString SAL_CALL
getImplementationName( ) throw( uno::RuntimeException
);
412 virtual uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw( uno::RuntimeException
);
415 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoXDashTable_createInstance( XPropertyList
* pTable
) throw()
417 return (OWeakObject
*)new SvxUnoXDashTable( pTable
);
420 // SvxUnoXPropertyTable
421 uno::Any
SvxUnoXDashTable::getAny( const XPropertyEntry
* pEntry
) const throw()
423 const XDash
& rXD
= ((XDashEntry
*)pEntry
)->GetDash();
425 drawing::LineDash aLineDash
;
427 aLineDash
.Style
= (::com::sun::star::drawing::DashStyle
)((sal_uInt16
)rXD
.GetDashStyle());
428 aLineDash
.Dots
= rXD
.GetDots();
429 aLineDash
.DotLen
= rXD
.GetDotLen();
430 aLineDash
.Dashes
= rXD
.GetDashes();
431 aLineDash
.DashLen
= rXD
.GetDashLen();
432 aLineDash
.Distance
= rXD
.GetDistance();
439 XPropertyEntry
* SvxUnoXDashTable::getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw()
441 drawing::LineDash aLineDash
;
442 if(!(rAny
>>= aLineDash
))
447 aXDash
.SetDashStyle((XDashStyle
)((sal_uInt16
)(aLineDash
.Style
)));
448 aXDash
.SetDots(aLineDash
.Dots
);
449 aXDash
.SetDotLen(aLineDash
.DotLen
);
450 aXDash
.SetDashes(aLineDash
.Dashes
);
451 aXDash
.SetDashLen(aLineDash
.DashLen
);
452 aXDash
.SetDistance(aLineDash
.Distance
);
454 const String
aName( rName
);
455 return new XDashEntry( aXDash
, aName
);
459 uno::Type SAL_CALL
SvxUnoXDashTable::getElementType()
460 throw( uno::RuntimeException
)
462 return ::getCppuType((const drawing::LineDash
*)0);
466 OUString SAL_CALL
SvxUnoXDashTable::getImplementationName( ) throw( uno::RuntimeException
)
468 return OUString( "SvxUnoXDashTable" );
471 uno::Sequence
< OUString
> SAL_CALL
SvxUnoXDashTable::getSupportedServiceNames( ) throw( uno::RuntimeException
)
473 const OUString
aServiceName( "com.sun.star.drawing.DashTable" );
474 uno::Sequence
< OUString
> aServices( &aServiceName
, 1 );
478 ///////////////////////////////////////////////////////////////////////
480 class SvxUnoXHatchTable
: public SvxUnoXPropertyTable
483 SvxUnoXHatchTable( XPropertyList
* pTable
) throw() : SvxUnoXPropertyTable( XATTR_FILLHATCH
, pTable
) {};
485 // SvxUnoXPropertyTable
486 virtual uno::Any
getAny( const XPropertyEntry
* pEntry
) const throw();
487 virtual XPropertyEntry
* getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw();
490 virtual uno::Type SAL_CALL
getElementType() throw( uno::RuntimeException
);
493 virtual OUString SAL_CALL
getImplementationName( ) throw( uno::RuntimeException
);
494 virtual uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw( uno::RuntimeException
);
497 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoXHatchTable_createInstance( XPropertyList
* pTable
) throw()
499 return (OWeakObject
*)new SvxUnoXHatchTable( pTable
);
502 // SvxUnoXPropertyTable
503 uno::Any
SvxUnoXHatchTable::getAny( const XPropertyEntry
* pEntry
) const throw()
505 const XHatch
& aHatch
= ((XHatchEntry
*)pEntry
)->GetHatch();
507 drawing::Hatch aUnoHatch
;
509 aUnoHatch
.Style
= (drawing::HatchStyle
)aHatch
.GetHatchStyle();
510 aUnoHatch
.Color
= aHatch
.GetColor().GetColor();
511 aUnoHatch
.Distance
= aHatch
.GetDistance();
512 aUnoHatch
.Angle
= aHatch
.GetAngle();
519 XPropertyEntry
* SvxUnoXHatchTable::getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw()
521 drawing::Hatch aUnoHatch
;
522 if(!(rAny
>>= aUnoHatch
))
526 aXHatch
.SetHatchStyle( (XHatchStyle
)aUnoHatch
.Style
);
527 aXHatch
.SetColor( aUnoHatch
.Color
);
528 aXHatch
.SetDistance( aUnoHatch
.Distance
);
529 aXHatch
.SetAngle( aUnoHatch
.Angle
);
531 const String
aName( rName
);
532 return new XHatchEntry( aXHatch
, aName
);
536 uno::Type SAL_CALL
SvxUnoXHatchTable::getElementType()
537 throw( uno::RuntimeException
)
539 return ::getCppuType((const drawing::Hatch
*)0);
543 OUString SAL_CALL
SvxUnoXHatchTable::getImplementationName( ) throw( uno::RuntimeException
)
545 return OUString( "SvxUnoXHatchTable" );
548 uno::Sequence
< OUString
> SAL_CALL
SvxUnoXHatchTable::getSupportedServiceNames( ) throw( uno::RuntimeException
)
550 const OUString
aServiceName( "com.sun.star.drawing.HatchTable" );
551 uno::Sequence
< OUString
> aServices( &aServiceName
, 1 );
555 ///////////////////////////////////////////////////////////////////////
557 class SvxUnoXGradientTable
: public SvxUnoXPropertyTable
560 SvxUnoXGradientTable( XPropertyList
* pTable
) throw() : SvxUnoXPropertyTable( XATTR_FILLGRADIENT
, pTable
) {};
562 // SvxUnoXPropertyTable
563 virtual uno::Any
getAny( const XPropertyEntry
* pEntry
) const throw();
564 virtual XPropertyEntry
* getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw();
567 virtual uno::Type SAL_CALL
getElementType() throw( uno::RuntimeException
);
570 virtual OUString SAL_CALL
getImplementationName( ) throw( uno::RuntimeException
);
571 virtual uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw( uno::RuntimeException
);
574 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoXGradientTable_createInstance( XPropertyList
* pTable
) throw()
576 return (OWeakObject
*)new SvxUnoXGradientTable( pTable
);
579 // SvxUnoXPropertyTable
580 uno::Any
SvxUnoXGradientTable::getAny( const XPropertyEntry
* pEntry
) const throw()
582 const XGradient
& aXGradient
= ((XGradientEntry
*)pEntry
)->GetGradient();
583 awt::Gradient aGradient
;
585 aGradient
.Style
= (awt::GradientStyle
) aXGradient
.GetGradientStyle();
586 aGradient
.StartColor
= (sal_Int32
)aXGradient
.GetStartColor().GetColor();
587 aGradient
.EndColor
= (sal_Int32
)aXGradient
.GetEndColor().GetColor();
588 aGradient
.Angle
= (short)aXGradient
.GetAngle();
589 aGradient
.Border
= aXGradient
.GetBorder();
590 aGradient
.XOffset
= aXGradient
.GetXOffset();
591 aGradient
.YOffset
= aXGradient
.GetYOffset();
592 aGradient
.StartIntensity
= aXGradient
.GetStartIntens();
593 aGradient
.EndIntensity
= aXGradient
.GetEndIntens();
594 aGradient
.StepCount
= aXGradient
.GetSteps();
601 XPropertyEntry
* SvxUnoXGradientTable::getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw()
603 awt::Gradient aGradient
;
604 if(!(rAny
>>= aGradient
))
607 XGradient aXGradient
;
609 aXGradient
.SetGradientStyle( (XGradientStyle
) aGradient
.Style
);
610 aXGradient
.SetStartColor( aGradient
.StartColor
);
611 aXGradient
.SetEndColor( aGradient
.EndColor
);
612 aXGradient
.SetAngle( aGradient
.Angle
);
613 aXGradient
.SetBorder( aGradient
.Border
);
614 aXGradient
.SetXOffset( aGradient
.XOffset
);
615 aXGradient
.SetYOffset( aGradient
.YOffset
);
616 aXGradient
.SetStartIntens( aGradient
.StartIntensity
);
617 aXGradient
.SetEndIntens( aGradient
.EndIntensity
);
618 aXGradient
.SetSteps( aGradient
.StepCount
);
620 const String
aName( rName
);
621 return new XGradientEntry( aXGradient
, aName
);
625 uno::Type SAL_CALL
SvxUnoXGradientTable::getElementType()
626 throw( uno::RuntimeException
)
628 return ::getCppuType((const awt::Gradient
*)0);
632 OUString SAL_CALL
SvxUnoXGradientTable::getImplementationName( ) throw( uno::RuntimeException
)
634 return OUString( "SvxUnoXGradientTable" );
637 uno::Sequence
< OUString
> SAL_CALL
SvxUnoXGradientTable::getSupportedServiceNames( ) throw( uno::RuntimeException
)
639 const OUString
aServiceName( "com.sun.star.drawing.GradientTable" );
640 uno::Sequence
< OUString
> aServices( &aServiceName
, 1 );
644 ///////////////////////////////////////////////////////////////////////
646 class SvxUnoXBitmapTable
: public SvxUnoXPropertyTable
649 SvxUnoXBitmapTable( XPropertyList
* pTable
) throw() : SvxUnoXPropertyTable( XATTR_FILLBITMAP
, pTable
) {};
651 // SvxUnoXPropertyTable
652 virtual uno::Any
getAny( const XPropertyEntry
* pEntry
) const throw();
653 virtual XPropertyEntry
* getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw();
656 virtual uno::Type SAL_CALL
getElementType() throw( uno::RuntimeException
);
659 virtual OUString SAL_CALL
getImplementationName( ) throw( uno::RuntimeException
);
660 virtual uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) throw( uno::RuntimeException
);
663 uno::Reference
< uno::XInterface
> SAL_CALL
SvxUnoXBitmapTable_createInstance( XPropertyList
* pTable
) throw()
665 return (OWeakObject
*)new SvxUnoXBitmapTable( pTable
);
668 // SvxUnoXPropertyTable
669 uno::Any
SvxUnoXBitmapTable::getAny( const XPropertyEntry
* pEntry
) const throw()
671 OUString
aURL( UNO_NAME_GRAPHOBJ_URLPREFIX
);
672 const GraphicObject
& rGraphicObject(((XBitmapEntry
*)pEntry
)->GetGraphicObject());
673 aURL
+= OStringToOUString(rGraphicObject
.GetUniqueID(), RTL_TEXTENCODING_ASCII_US
);
680 XPropertyEntry
* SvxUnoXBitmapTable::getEntry( const OUString
& rName
, const uno::Any
& rAny
) const throw()
686 const GraphicObject
aGrafObj(GraphicObject::CreateGraphicObjectFromURL(aURL
));
687 const String
aName(rName
);
689 return new XBitmapEntry(aGrafObj
, aName
);
693 uno::Type SAL_CALL
SvxUnoXBitmapTable::getElementType()
694 throw( uno::RuntimeException
)
696 return ::getCppuType((const OUString
*)0);
700 OUString SAL_CALL
SvxUnoXBitmapTable::getImplementationName( ) throw( uno::RuntimeException
)
702 return OUString( "SvxUnoXBitmapTable" );
705 uno::Sequence
< OUString
> SAL_CALL
SvxUnoXBitmapTable::getSupportedServiceNames( ) throw( uno::RuntimeException
)
707 const OUString
aServiceName( "com.sun.star.drawing.BitmapTable" );
708 uno::Sequence
< OUString
> aServices( &aServiceName
, 1 );
712 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */