xref: /trunk/main/svx/source/unodraw/unodtabl.cxx (revision f6e50924)
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/drawing/LineDash.hpp>
27 #include <svl/itempool.hxx>
28 #include <svl/itemset.hxx>
29 
30 #include <vector>
31 #include "UnoNameItemTable.hxx"
32 #include <svx/xlndsit.hxx>
33 #include <svx/unomid.hxx>
34 
35 #include <svx/xdash.hxx>
36 #include <svx/svdmodel.hxx>
37 #include "svx/unofill.hxx"
38 
39 using namespace ::com::sun::star;
40 using namespace ::rtl;
41 using namespace ::cppu;
42 
43 class SvxUnoDashTable : public SvxUnoNameItemTable
44 {
45 public:
46 	SvxUnoDashTable( SdrModel* pModel ) throw();
47 	virtual	~SvxUnoDashTable() throw();
48 
49 	virtual NameOrIndex* createItem() const throw();
50 
51     // XServiceInfo
52     virtual OUString SAL_CALL getImplementationName(  ) throw( uno::RuntimeException );
53     virtual uno::Sequence<  OUString > SAL_CALL getSupportedServiceNames(  ) throw( uno::RuntimeException);
54 
55 	// XElementAccess
56     virtual uno::Type SAL_CALL getElementType(  ) throw( uno::RuntimeException);
57 };
58 
SvxUnoDashTable(SdrModel * pModel)59 SvxUnoDashTable::SvxUnoDashTable( SdrModel* pModel ) throw()
60 : SvxUnoNameItemTable( pModel, XATTR_LINEDASH, MID_LINEDASH )
61 {
62 }
63 
~SvxUnoDashTable()64 SvxUnoDashTable::~SvxUnoDashTable() throw()
65 {
66 }
67 
getImplementationName()68 OUString SAL_CALL SvxUnoDashTable::getImplementationName() throw( uno::RuntimeException )
69 {
70 	return OUString( RTL_CONSTASCII_USTRINGPARAM("SvxUnoDashTable") );
71 }
72 
getSupportedServiceNames()73 uno::Sequence< OUString > SAL_CALL SvxUnoDashTable::getSupportedServiceNames(  )
74 	throw( uno::RuntimeException )
75 {
76     uno::Sequence< OUString > aSNS( 1 );
77     aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.DashTable" ));
78     return aSNS;
79 }
80 
createItem() const81 NameOrIndex* SvxUnoDashTable::createItem() const throw()
82 {
83 	XLineDashItem* pNewItem = new XLineDashItem();
84 	pNewItem->SetWhich( XATTR_LINEDASH ); // set which id for pooling
85 	return pNewItem;
86 }
87 
88 // XElementAccess
getElementType()89 uno::Type SAL_CALL SvxUnoDashTable::getElementType(  )
90 	throw( uno::RuntimeException )
91 {
92 	return ::getCppuType((const struct drawing::LineDash*)0);
93 }
94 
95 /**
96  * Create a gradienttable
97  */
SvxUnoDashTable_createInstance(SdrModel * pModel)98 uno::Reference< uno::XInterface > SAL_CALL SvxUnoDashTable_createInstance( SdrModel* pModel )
99 {
100 	return *new SvxUnoDashTable(pModel);
101 }
102 
103 
104 
105