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