forked from python-openxml/python-docx
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdml.py
More file actions
211 lines (127 loc) · 3.96 KB
/
dml.py
File metadata and controls
211 lines (127 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# encoding: utf-8
"""
Test data builders for DrawingML XML elements
"""
from ...unitdata import BaseBuilder
class CT_BlipBuilder(BaseBuilder):
__tag__ = 'a:blip'
__nspfxs__ = ('a',)
__attrs__ = ('r:embed', 'r:link', 'cstate')
class CT_BlipFillPropertiesBuilder(BaseBuilder):
__tag__ = 'pic:blipFill'
__nspfxs__ = ('pic',)
__attrs__ = ()
class CT_DrawingBuilder(BaseBuilder):
__tag__ = 'w:drawing'
__nspfxs__ = ('w',)
__attrs__ = ()
class CT_GraphicalObjectBuilder(BaseBuilder):
__tag__ = 'a:graphic'
__nspfxs__ = ('a',)
__attrs__ = ()
class CT_GraphicalObjectDataBuilder(BaseBuilder):
__tag__ = 'a:graphicData'
__nspfxs__ = ('a',)
__attrs__ = ('uri',)
class CT_GraphicalObjectFrameLockingBuilder(BaseBuilder):
__tag__ = 'a:graphicFrameLocks'
__nspfxs__ = ('a',)
__attrs__ = ('noChangeAspect',)
class CT_InlineBuilder(BaseBuilder):
__tag__ = 'wp:inline'
__nspfxs__ = ('wp',)
__attrs__ = ('distT', 'distB', 'distL', 'distR')
class CT_NonVisualDrawingPropsBuilder(BaseBuilder):
__nspfxs__ = ('wp',)
__attrs__ = ('id', 'name', 'descr', 'hidden', 'title')
def __init__(self, tag):
self.__tag__ = tag
super(CT_NonVisualDrawingPropsBuilder, self).__init__()
class CT_NonVisualGraphicFramePropertiesBuilder(BaseBuilder):
__tag__ = 'wp:cNvGraphicFramePr'
__nspfxs__ = ('wp',)
__attrs__ = ()
class CT_NonVisualPicturePropertiesBuilder(BaseBuilder):
__tag__ = 'pic:cNvPicPr'
__nspfxs__ = ('pic',)
__attrs__ = ('preferRelativeResize')
class CT_PictureBuilder(BaseBuilder):
__tag__ = 'pic:pic'
__nspfxs__ = ('pic',)
__attrs__ = ()
class CT_PictureNonVisualBuilder(BaseBuilder):
__tag__ = 'pic:nvPicPr'
__nspfxs__ = ('pic',)
__attrs__ = ()
class CT_Point2DBuilder(BaseBuilder):
__tag__ = 'a:off'
__nspfxs__ = ('a',)
__attrs__ = ('x', 'y')
class CT_PositiveSize2DBuilder(BaseBuilder):
__nspfxs__ = ()
__attrs__ = ('cx', 'cy')
def __init__(self, tag):
self.__tag__ = tag
super(CT_PositiveSize2DBuilder, self).__init__()
class CT_PresetGeometry2DBuilder(BaseBuilder):
__tag__ = 'a:prstGeom'
__nspfxs__ = ('a',)
__attrs__ = ('prst',)
class CT_RelativeRectBuilder(BaseBuilder):
__tag__ = 'a:fillRect'
__nspfxs__ = ('a',)
__attrs__ = ('l', 't', 'r', 'b')
class CT_ShapePropertiesBuilder(BaseBuilder):
__tag__ = 'pic:spPr'
__nspfxs__ = ('pic', 'a')
__attrs__ = ('bwMode',)
class CT_StretchInfoPropertiesBuilder(BaseBuilder):
__tag__ = 'a:stretch'
__nspfxs__ = ('a',)
__attrs__ = ()
class CT_Transform2DBuilder(BaseBuilder):
__tag__ = 'a:xfrm'
__nspfxs__ = ('a',)
__attrs__ = ('rot', 'flipH', 'flipV')
def a_blip():
return CT_BlipBuilder()
def a_blipFill():
return CT_BlipFillPropertiesBuilder()
def a_cNvGraphicFramePr():
return CT_NonVisualGraphicFramePropertiesBuilder()
def a_cNvPicPr():
return CT_NonVisualPicturePropertiesBuilder()
def a_cNvPr():
return CT_NonVisualDrawingPropsBuilder('pic:cNvPr')
def a_docPr():
return CT_NonVisualDrawingPropsBuilder('wp:docPr')
def a_drawing():
return CT_DrawingBuilder()
def a_fillRect():
return CT_RelativeRectBuilder()
def a_graphic():
return CT_GraphicalObjectBuilder()
def a_graphicData():
return CT_GraphicalObjectDataBuilder()
def a_graphicFrameLocks():
return CT_GraphicalObjectFrameLockingBuilder()
def a_pic():
return CT_PictureBuilder()
def a_prstGeom():
return CT_PresetGeometry2DBuilder()
def a_stretch():
return CT_StretchInfoPropertiesBuilder()
def an_ext():
return CT_PositiveSize2DBuilder('a:ext')
def an_extent():
return CT_PositiveSize2DBuilder('wp:extent')
def an_inline():
return CT_InlineBuilder()
def an_nvPicPr():
return CT_PictureNonVisualBuilder()
def an_off():
return CT_Point2DBuilder()
def an_spPr():
return CT_ShapePropertiesBuilder()
def an_xfrm():
return CT_Transform2DBuilder()