ODFPY 1.2.0 |

All Classes Namespaces Files Functions Variables
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
21 import sys, os.path
22 sys.path.append(os.path.dirname(__file__))
23 from namespaces import DRAWNS, STYLENS, PRESENTATIONNS
24 from element import Element
25
26 def 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
46 def 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
53 def A(**args):
54 args.setdefault('type', 'simple')
55 return Element(qname = (DRAWNS,'a'), **args)
56
57 def Applet(**args):
58 return Element(qname = (DRAWNS,'applet'), **args)
59
60 def AreaCircle(**args):
61 return Element(qname = (DRAWNS,'area-circle'), **args)
62
63 def AreaPolygon(**args):
64 return Element(qname = (DRAWNS,'area-polygon'), **args)
65
66 def AreaRectangle(**args):
67 return Element(qname = (DRAWNS,'area-rectangle'), **args)
68
69 def Caption(**args):
70 return StyleRefElement(qname = (DRAWNS,'caption'), **args)
71
72 def Circle(**args):
73 return StyleRefElement(qname = (DRAWNS,'circle'), **args)
74
75 def Connector(**args):
76 return StyleRefElement(qname = (DRAWNS,'connector'), **args)
77
78 def ContourPath(**args):
79 return Element(qname = (DRAWNS,'contour-path'), **args)
80
81 def ContourPolygon(**args):
82 return Element(qname = (DRAWNS,'contour-polygon'), **args)
83
84 def Control(**args):
85 return StyleRefElement(qname = (DRAWNS,'control'), **args)
86
87 def CustomShape(**args):
88 return StyleRefElement(qname = (DRAWNS,'custom-shape'), **args)
89
90 def Ellipse(**args):
91 return StyleRefElement(qname = (DRAWNS,'ellipse'), **args)
92
93 def EnhancedGeometry(**args):
94 return Element(qname = (DRAWNS,'enhanced-geometry'), **args)
95
96 def Equation(**args):
97 return Element(qname = (DRAWNS,'equation'), **args)
98
99 def FillImage(**args):
100 args.setdefault('type', 'simple')
101 return DrawElement(qname = (DRAWNS,'fill-image'), **args)
102
103 def FloatingFrame(**args):
104 args.setdefault('type', 'simple')
105 return Element(qname = (DRAWNS,'floating-frame'), **args)
106
107 def Frame(**args):
108 return StyleRefElement(qname = (DRAWNS,'frame'), **args)
109
110 def G(**args):
111 return StyleRefElement(qname = (DRAWNS,'g'), **args)
112
113 def GluePoint(**args):
114 return Element(qname = (DRAWNS,'glue-point'), **args)
115
116 def Gradient(**args):
117 return DrawElement(qname = (DRAWNS,'gradient'), **args)
118
119 def Handle(**args):
120 return Element(qname = (DRAWNS,'handle'), **args)
121
122 def Hatch(**args):
123 return DrawElement(qname = (DRAWNS,'hatch'), **args)
124
125 def Image(**args):
126 return Element(qname = (DRAWNS,'image'), **args)
127
128 def ImageMap(**args):
129 return Element(qname = (DRAWNS,'image-map'), **args)
130
131 def Layer(**args):
132 return Element(qname = (DRAWNS,'layer'), **args)
133
134 def LayerSet(**args):
135 return Element(qname = (DRAWNS,'layer-set'), **args)
136
137 def Line(**args):
138 return StyleRefElement(qname = (DRAWNS,'line'), **args)
139
140 def Marker(**args):
141 return DrawElement(qname = (DRAWNS,'marker'), **args)
142
143 def Measure(**args):
144 return StyleRefElement(qname = (DRAWNS,'measure'), **args)
145
146 def Object(**args):
147 return Element(qname = (DRAWNS,'object'), **args)
148
149 def ObjectOle(**args):
150 return Element(qname = (DRAWNS,'object-ole'), **args)
151
152 def Opacity(**args):
153 return DrawElement(qname = (DRAWNS,'opacity'), **args)
154
155 def Page(**args):
156 return Element(qname = (DRAWNS,'page'), **args)
157
158 def PageThumbnail(**args):
159 return StyleRefElement(qname = (DRAWNS,'page-thumbnail'), **args)
160
161 def Param(**args):
162 return Element(qname = (DRAWNS,'param'), **args)
163
164 def Path(**args):
165 return StyleRefElement(qname = (DRAWNS,'path'), **args)
166
167 def Plugin(**args):
168 args.setdefault('type', 'simple')
169 return Element(qname = (DRAWNS,'plugin'), **args)
170
171 def Polygon(**args):
172 return StyleRefElement(qname = (DRAWNS,'polygon'), **args)
173
174 def Polyline(**args):
175 return StyleRefElement(qname = (DRAWNS,'polyline'), **args)
176
177 def Rect(**args):
178 return StyleRefElement(qname = (DRAWNS,'rect'), **args)
179
180 def RegularPolygon(**args):
181 return StyleRefElement(qname = (DRAWNS,'regular-polygon'), **args)
182
183 def StrokeDash(**args):
184 return DrawElement(qname = (DRAWNS,'stroke-dash'), **args)
185
186 def TextBox(**args):
187 return Element(qname = (DRAWNS,'text-box'), **args)
188
odf.draw.ContourPath
def ContourPath
Definition: draw.py:78
odf.draw.LayerSet
def LayerSet
Definition: draw.py:134
odf.draw.ObjectOle
def ObjectOle
Definition: draw.py:149
odf.draw.AreaCircle
def AreaCircle
Definition: draw.py:60
odf.draw.FloatingFrame
def FloatingFrame
Definition: draw.py:103
odf.draw.Plugin
def Plugin
Definition: draw.py:167
odf.draw.ImageMap
def ImageMap
Definition: draw.py:128
odf.draw.Measure
def Measure
Definition: draw.py:143
odf.draw.DrawElement
def DrawElement
Definition: draw.py:46
odf.draw.StrokeDash
def StrokeDash
Definition: draw.py:183
odf.draw.G
def G
Definition: draw.py:110
odf.draw.Opacity
def Opacity
Definition: draw.py:152
odf.draw.Hatch
def Hatch
Definition: draw.py:122
odf.draw.AreaPolygon
def AreaPolygon
Definition: draw.py:63
odf.draw.Layer
def Layer
Definition: draw.py:131
odf.draw.Control
def Control
Definition: draw.py:84
odf.draw.Frame
def Frame
Definition: draw.py:107
odf.draw.Circle
def Circle
Definition: draw.py:72
odf.draw.Rect
def Rect
Definition: draw.py:177
odf.draw.AreaRectangle
def AreaRectangle
Definition: draw.py:66
odf.draw.ContourPolygon
def ContourPolygon
Definition: draw.py:81
odf.draw.StyleRefElement
def StyleRefElement
Definition: draw.py:26
odf.draw.Path
def Path
Definition: draw.py:164
odf.draw.Image
def Image
Definition: draw.py:125
odf.draw.PageThumbnail
def PageThumbnail
Definition: draw.py:158
odf.draw.EnhancedGeometry
def EnhancedGeometry
Definition: draw.py:93
odf.draw.Gradient
def Gradient
Definition: draw.py:116
odf.draw.Polyline
def Polyline
Definition: draw.py:174
odf.draw.Object
def Object
Definition: draw.py:146
odf.draw.CustomShape
def CustomShape
Definition: draw.py:87
odf.draw.Line
def Line
Definition: draw.py:137
odf.draw.Connector
def Connector
Definition: draw.py:75
odf.draw.TextBox
def TextBox
Definition: draw.py:186
odf.draw.Caption
def Caption
Definition: draw.py:69
odf.draw.RegularPolygon
def RegularPolygon
Definition: draw.py:180
odf.draw.A
def A
Definition: draw.py:53
odf.draw.Handle
def Handle
Definition: draw.py:119
odf.draw.Equation
def Equation
Definition: draw.py:96
odf.draw.FillImage
def FillImage
Definition: draw.py:99
odf.draw.Ellipse
def Ellipse
Definition: draw.py:90
odf.draw.Marker
def Marker
Definition: draw.py:140
odf.draw.Param
def Param
Definition: draw.py:161
odf.draw.Applet
def Applet
Definition: draw.py:57
odf.draw.GluePoint
def GluePoint
Definition: draw.py:113
odf.draw.Polygon
def Polygon
Definition: draw.py:171
odf.draw.Page
def Page
Definition: draw.py:155