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