xref: /aoo4110/main/svx/source/unodraw/unogtabl.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_svx.hxx"
26 #include <com/sun/star/awt/Gradient.hpp>
27 #include <svl/itempool.hxx>
28 #include <svl/itemset.hxx>
29 #include "UnoNameItemTable.hxx"
30 
31 #include <svx/xgrad.hxx>
32 #include <svx/svdmodel.hxx>
33 #include <svx/xdef.hxx>
34 #include <svx/xflgrit.hxx>
35 #include "svx/unofill.hxx"
36 #include <svx/unomid.hxx>
37 
38 using namespace ::com::sun::star;
39 using namespace ::rtl;
40 using namespace ::cppu;
41 
42 class SvxUnoGradientTable : public SvxUnoNameItemTable
43 {
44 public:
45 	SvxUnoGradientTable( SdrModel* pModel ) throw();
46 	virtual	~SvxUnoGradientTable() throw();
47 
48 	virtual NameOrIndex* createItem() const throw();
49 
50     // XServiceInfo
51     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException );
52     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
53 
54 	// XElementAccess
55     virtual uno::Type SAL_CALL getElementType(  ) throw( uno::RuntimeException);
56 };
57 
SvxUnoGradientTable(SdrModel * pModel)58 SvxUnoGradientTable::SvxUnoGradientTable( SdrModel* pModel ) throw()
59     : SvxUnoNameItemTable( pModel, XATTR_FILLGRADIENT, MID_FILLGRADIENT )
60 {
61 }
62 
~SvxUnoGradientTable()63 SvxUnoGradientTable::~SvxUnoGradientTable() throw()
64 {
65 }
66 
getImplementationName()67 OUString SAL_CALL SvxUnoGradientTable::getImplementationName() throw( uno::RuntimeException )
68 {
69 	return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoGradientTable") );
70 }
71 
getSupportedServiceNames()72 uno::Sequence< OUString > SAL_CALL SvxUnoGradientTable::getSupportedServiceNames(  )
73 	throw( uno::RuntimeException )
74 {
75     uno::Sequence< OUString > aSNS( 1 );
76     aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GradientTable" ));
77     return aSNS;
78 }
79 
80 
81 // XNameContainer
createItem() const82 NameOrIndex* SvxUnoGradientTable::createItem() const throw()
83 {
84 	return new XFillGradientItem();
85 }
86 
87 // XElementAccess
getElementType()88 uno::Type SAL_CALL SvxUnoGradientTable::getElementType(  )
89 	throw( uno::RuntimeException )
90 {
91 	return ::getCppuType((const struct awt::Gradient*)0);
92 }
93 
94 /**
95  * Create a gradienttable
96  */
SvxUnoGradientTable_createInstance(SdrModel * pModel)97 uno::Reference< uno::XInterface > SAL_CALL SvxUnoGradientTable_createInstance( SdrModel* pModel )
98 {
99 	return *new SvxUnoGradientTable(pModel);
100 }
101 
102 
103 
104