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
21 import sys, os.path
22sys.path.append(os.path.dirname(__file__))
23 from odf.namespaces import DRAWNS, STYLENS, PRESENTATIONNS
24 from odf.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.element.Element
Creates a arbitrary element and is intended to be subclassed not used on its own.
Definition element.py:361
odf.draw.Hatch
Hatch(**args)
Definition draw.py:122
odf.draw.Plugin
Plugin(**args)
Definition draw.py:167
odf.draw.Param
Param(**args)
Definition draw.py:161
odf.draw.Ellipse
Ellipse(**args)
Definition draw.py:90
odf.draw.Equation
Equation(**args)
Definition draw.py:96
odf.draw.Control
Control(**args)
Definition draw.py:84
odf.draw.Measure
Measure(**args)
Definition draw.py:143
odf.draw.FillImage
FillImage(**args)
Definition draw.py:99
odf.draw.ObjectOle
ObjectOle(**args)
Definition draw.py:149
odf.draw.ImageMap
ImageMap(**args)
Definition draw.py:128
odf.draw.Gradient
Gradient(**args)
Definition draw.py:116
odf.draw.Frame
Frame(**args)
Definition draw.py:107
odf.draw.Connector
Connector(**args)
Definition draw.py:75
odf.draw.EnhancedGeometry
EnhancedGeometry(**args)
Definition draw.py:93
odf.draw.ContourPolygon
ContourPolygon(**args)
Definition draw.py:81
odf.draw.AreaCircle
AreaCircle(**args)
Definition draw.py:60
odf.draw.Object
Object(**args)
Definition draw.py:146
odf.draw.StrokeDash
StrokeDash(**args)
Definition draw.py:183
odf.draw.Path
Path(**args)
Definition draw.py:164
odf.draw.RegularPolygon
RegularPolygon(**args)
Definition draw.py:180
odf.draw.Rect
Rect(**args)
Definition draw.py:177
odf.draw.AreaPolygon
AreaPolygon(**args)
Definition draw.py:63
odf.draw.TextBox
TextBox(**args)
Definition draw.py:186
odf.draw.Opacity
Opacity(**args)
Definition draw.py:152
odf.draw.CustomShape
CustomShape(**args)
Definition draw.py:87
odf.draw.ContourPath
ContourPath(**args)
Definition draw.py:78
odf.draw.Image
Image(**args)
Definition draw.py:125
odf.draw.PageThumbnail
PageThumbnail(**args)
Definition draw.py:158
odf.draw.G
G(**args)
Definition draw.py:110
odf.draw.Applet
Applet(**args)
Definition draw.py:57
odf.draw.Circle
Circle(**args)
Definition draw.py:72
odf.draw.Polygon
Polygon(**args)
Definition draw.py:171
odf.draw.Layer
Layer(**args)
Definition draw.py:131
odf.draw.Handle
Handle(**args)
Definition draw.py:119
odf.draw.Marker
Marker(**args)
Definition draw.py:140
odf.draw.A
A(**args)
Definition draw.py:53
odf.draw.Page
Page(**args)
Definition draw.py:155
odf.draw.Line
Line(**args)
Definition draw.py:137
odf.draw.Caption
Caption(**args)
Definition draw.py:69
odf.draw.GluePoint
GluePoint(**args)
Definition draw.py:113
odf.draw.LayerSet
LayerSet(**args)
Definition draw.py:134
odf.draw.AreaRectangle
AreaRectangle(**args)
Definition draw.py:66
odf.draw.FloatingFrame
FloatingFrame(**args)
Definition draw.py:103
odf.draw.Polyline
Polyline(**args)
Definition draw.py:174
odf.element
Definition element.py:1
odf.namespaces
Definition namespaces.py:1