xref: /aoo42x/main/svx/source/unodraw/unogtabl.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_svx.hxx"
30 #include <com/sun/star/awt/Gradient.hpp>
31 #include <svl/itempool.hxx>
32 #include <svl/itemset.hxx>
33 #include "UnoNameItemTable.hxx"
34 
35 #include <svx/xgrad.hxx>
36 #include <svx/svdmodel.hxx>
37 #include <svx/xdef.hxx>
38 #include <svx/xflgrit.hxx>
39 #include "svx/unofill.hxx"
40 #include <svx/unomid.hxx>
41 
42 using namespace ::com::sun::star;
43 using namespace ::rtl;
44 using namespace ::cppu;
45 
46 class SvxUnoGradientTable : public SvxUnoNameItemTable
47 {
48 public:
49 	SvxUnoGradientTable( SdrModel* pModel ) throw();
50 	virtual	~SvxUnoGradientTable() throw();
51 
52 	virtual NameOrIndex* createItem() const throw();
53 
54     // XServiceInfo
55     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException );
56     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
57 
58 	// XElementAccess
59     virtual uno::Type SAL_CALL getElementType(  ) throw( uno::RuntimeException);
60 };
61 
62 SvxUnoGradientTable::SvxUnoGradientTable( SdrModel* pModel ) throw()
63     : SvxUnoNameItemTable( pModel, XATTR_FILLGRADIENT, MID_FILLGRADIENT )
64 {
65 }
66 
67 SvxUnoGradientTable::~SvxUnoGradientTable() throw()
68 {
69 }
70 
71 OUString SAL_CALL SvxUnoGradientTable::getImplementationName() throw( uno::RuntimeException )
72 {
73 	return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoGradientTable") );
74 }
75 
76 uno::Sequence< OUString > SAL_CALL SvxUnoGradientTable::getSupportedServiceNames(  )
77 	throw( uno::RuntimeException )
78 {
79     uno::Sequence< OUString > aSNS( 1 );
80     aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable" ));
81     return aSNS;
82 }
83 
84 
85 // XNameContainer
86 NameOrIndex* SvxUnoGradientTable::createItem() const throw()
87 {
88 	return new XFillGradientItem();
89 }
90 
91 // XElementAccess
92 uno::Type SAL_CALL SvxUnoGradientTable::getElementType(  )
93 	throw( uno::RuntimeException )
94 {
95 	return ::getCppuType((const struct awt::Gradient*)0);
96 }
97 
98 /**
99  * Create a gradienttable
100  */
101 uno::Reference< uno::XInterface > SAL_CALL SvxUnoGradientTable_createInstance( SdrModel* pModel )
102 {
103 	return *new SvxUnoGradientTable(pModel);
104 }
105 
106 
107 
108