ODFPY 1.2.0
 
Loading...
Searching...
No Matches
draw.py
Go to the documentation of this file.
1# -*- coding: utf-8 -*-
2# Copyright (C) 2006-2007 Søren Roug, European Environment Agency
3#
4# This library is free software; you can redistribute it and/or
5# modify it under the terms of the GNU Lesser General Public
6# License as published by the Free Software Foundation; either
7# version 2.1 of the License, or (at your option) any later version.
8#
9# This library is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12# Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public
15# License along with this library; if not, write to the Free Software
16# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17#
18# Contributor(s):
19#
20
21import sys, os.path
22sys.path.append(os.path.dirname(__file__))
23from odf.namespaces import DRAWNS, STYLENS, PRESENTATIONNS
24from odf.element import Element
25
26def StyleRefElement(stylename=None, classnames=None, **args):
27 qattrs = {}
28 if stylename is not None:
29 f = stylename.getAttrNS(STYLENS, 'family')
30 if f == 'graphic':
31 qattrs[(DRAWNS,u'style-name')]= stylename
32 elif f == 'presentation':
33 qattrs[(PRESENTATIONNS,u'style-name')]= stylename
34 else:
35 raise ValueError( "Style's family must be either 'graphic' or 'presentation'")
36 if classnames is not None:
37 f = classnames[0].getAttrNS(STYLENS, 'family')
38 if f == 'graphic':
39 qattrs[(DRAWNS,u'class-names')]= classnames
40 elif f == 'presentation':
41 qattrs[(PRESENTATIONNS,u'class-names')]= classnames
42 else:
43 raise ValueError( "Style's family must be either 'graphic' or 'presentation'")
44 return Element(qattributes=qattrs, **args)
45
46def DrawElement(name=None, **args):
47 e = Element(name=name, **args)
48 if 'displayname' not in args:
49 e.setAttrNS(DRAWNS,'display-name', name)
50 return e
51
52# Autogenerated
53def A(**args):
54 args.setdefault('type', 'simple')
55 return Element(qname = (DRAWNS,'a'), **args)
56
57def Applet(**args):
58 return Element(qname = (DRAWNS,'applet'), **args)
59
60def AreaCircle(**args):
61 return Element(qname = (DRAWNS,'area-circle'), **args)
62
63def AreaPolygon(**args):
64 return Element(qname = (DRAWNS,'area-polygon'), **args)
65
66def AreaRectangle(**args):
67 return Element(qname = (DRAWNS,'area-rectangle'), **args)
68
69def Caption(**args):
70 return StyleRefElement(qname = (DRAWNS,'caption'), **args)
71
72def Circle(**args):
73 return StyleRefElement(qname = (DRAWNS,'circle'), **args)
74
75def Connector(**args):
76 return StyleRefElement(qname = (DRAWNS,'connector'), **args)
77
78def ContourPath(**args):
79 return Element(qname = (DRAWNS,'contour-path'), **args)
80
81def ContourPolygon(**args):
82 return Element(qname = (DRAWNS,'contour-polygon'), **args)
83
84def Control(**args):
85 return StyleRefElement(qname = (DRAWNS,'control'), **args)
86
87def CustomShape(**args):
88 return StyleRefElement(qname = (DRAWNS,'custom-shape'), **args)
89
90def Ellipse(**args):
91 return StyleRefElement(qname = (DRAWNS,'ellipse'), **args)
92
93def EnhancedGeometry(**args):
94 return Element(qname = (DRAWNS,'enhanced-geometry'), **args)
95
96def Equation(**args):
97 return Element(qname = (DRAWNS,'equation'), **args)
98
99def FillImage(**args):
100 args.setdefault('type', 'simple')
101 return DrawElement(qname = (DRAWNS,'fill-image'), **args)
102
103def FloatingFrame(**args):
104 args.setdefault('type', 'simple')
105 return Element(qname = (DRAWNS,'floating-frame'), **args)
106
107def Frame(**args):
108 return StyleRefElement(qname = (DRAWNS,'frame'), **args)
109
110def G(**args):
111 return StyleRefElement(qname = (DRAWNS,'g'), **args)
112
113def GluePoint(**args):
114 return Element(qname = (DRAWNS,'glue-point'), **args)
115
116def Gradient(**args):
117 return DrawElement(qname = (DRAWNS,'gradient'), **args)
118
119def Handle(**args):
120 return Element(qname = (DRAWNS,'handle'), **args)
121
122def Hatch(**args):
123 return DrawElement(qname = (DRAWNS,'hatch'), **args)
124
125def Image(**args):
126 return Element(qname = (DRAWNS,'image'), **args)
127
128def ImageMap(**args):
129 return Element(qname = (DRAWNS,'image-map'), **args)
130
131def Layer(**args):
132 return Element(qname = (DRAWNS,'layer'), **args)
133
134def LayerSet(**args):
135 return Element(qname = (DRAWNS,'layer-set'), **args)
136
137def Line(**args):
138 return StyleRefElement(qname = (DRAWNS,'line'), **args)
139
140def Marker(**args):
141 return DrawElement(qname = (DRAWNS,'marker'), **args)
142
143def Measure(**args):
144 return StyleRefElement(qname = (DRAWNS,'measure'), **args)
145
146def Object(**args):
147 return Element(qname = (DRAWNS,'object'), **args)
148
149def ObjectOle(**args):
150 return Element(qname = (DRAWNS,'object-ole'), **args)
151
152def Opacity(**args):
153 return DrawElement(qname = (DRAWNS,'opacity'), **args)
154
155def Page(**args):
156 return Element(qname = (DRAWNS,'page'), **args)
157
158def PageThumbnail(**args):
159 return StyleRefElement(qname = (DRAWNS,'page-thumbnail'), **args)
160
161def Param(**args):
162 return Element(qname = (DRAWNS,'param'), **args)
163
164def Path(**args):
165 return StyleRefElement(qname = (DRAWNS,'path'), **args)
166
167def Plugin(**args):
168 args.setdefault('type', 'simple')
169 return Element(qname = (DRAWNS,'plugin'), **args)
170
171def Polygon(**args):
172 return StyleRefElement(qname = (DRAWNS,'polygon'), **args)
173
174def Polyline(**args):
175 return StyleRefElement(qname = (DRAWNS,'polyline'), **args)
176
177def Rect(**args):
178 return StyleRefElement(qname = (DRAWNS,'rect'), **args)
179
180def RegularPolygon(**args):
181 return StyleRefElement(qname = (DRAWNS,'regular-polygon'), **args)
182
183def StrokeDash(**args):
184 return DrawElement(qname = (DRAWNS,'stroke-dash'), **args)
185
186def TextBox(**args):
187 return Element(qname = (DRAWNS,'text-box'), **args)
188
Creates a arbitrary element and is intended to be subclassed not used on its own.
Definition element.py:361
Hatch(**args)
Definition draw.py:122
Plugin(**args)
Definition draw.py:167
Param(**args)
Definition draw.py:161
Ellipse(**args)
Definition draw.py:90
Equation(**args)
Definition draw.py:96
Control(**args)
Definition draw.py:84
Measure(**args)
Definition draw.py:143
FillImage(**args)
Definition draw.py:99
ObjectOle(**args)
Definition draw.py:149
ImageMap(**args)
Definition draw.py:128
Gradient(**args)
Definition draw.py:116
Frame(**args)
Definition draw.py:107
Connector(**args)
Definition draw.py:75
EnhancedGeometry(**args)
Definition draw.py:93
DrawElement(name=None, **args)
Definition draw.py:46
ContourPolygon(**args)
Definition draw.py:81
AreaCircle(**args)
Definition draw.py:60
Object(**args)
Definition draw.py:146
StrokeDash(**args)
Definition draw.py:183
StyleRefElement(stylename=None, classnames=None, **args)
Definition draw.py:26
Path(**args)
Definition draw.py:164
RegularPolygon(**args)
Definition draw.py:180
Rect(**args)
Definition draw.py:177
AreaPolygon(**args)
Definition draw.py:63
TextBox(**args)
Definition draw.py:186
Opacity(**args)
Definition draw.py:152
CustomShape(**args)
Definition draw.py:87
ContourPath(**args)
Definition draw.py:78
Image(**args)
Definition draw.py:125
PageThumbnail(**args)
Definition draw.py:158
G(**args)
Definition draw.py:110
Applet(**args)
Definition draw.py:57
Circle(**args)
Definition draw.py:72
Polygon(**args)
Definition draw.py:171
Layer(**args)
Definition draw.py:131
Handle(**args)
Definition draw.py:119
Marker(**args)
Definition draw.py:140
A(**args)
Definition draw.py:53
Page(**args)
Definition draw.py:155
Line(**args)
Definition draw.py:137
Caption(**args)
Definition draw.py:69
GluePoint(**args)
Definition draw.py:113
LayerSet(**args)
Definition draw.py:134
AreaRectangle(**args)
Definition draw.py:66
FloatingFrame(**args)
Definition draw.py:103
Polyline(**args)
Definition draw.py:174