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