openxml-drawingml 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/.travis.yml +6 -0
  4. data/Gemfile +6 -0
  5. data/Gemfile.lock +65 -0
  6. data/LICENSE.txt +20 -0
  7. data/README.md +38 -0
  8. data/Rakefile +6 -0
  9. data/bin/console +14 -0
  10. data/bin/setup +8 -0
  11. data/lib/openxml-drawingml.rb +1 -0
  12. data/lib/openxml/drawingml.rb +6 -0
  13. data/lib/openxml/drawingml/element.rb +9 -0
  14. data/lib/openxml/drawingml/elements.rb +12 -0
  15. data/lib/openxml/drawingml/elements/adjust_values_list.rb +12 -0
  16. data/lib/openxml/drawingml/elements/blip.rb +19 -0
  17. data/lib/openxml/drawingml/elements/blip_fill.rb +16 -0
  18. data/lib/openxml/drawingml/elements/children_extents.rb +13 -0
  19. data/lib/openxml/drawingml/elements/children_offset.rb +13 -0
  20. data/lib/openxml/drawingml/elements/extension.rb +14 -0
  21. data/lib/openxml/drawingml/elements/extension_list.rb +12 -0
  22. data/lib/openxml/drawingml/elements/extents.rb +13 -0
  23. data/lib/openxml/drawingml/elements/fill_rectangle.rb +15 -0
  24. data/lib/openxml/drawingml/elements/graphic.rb +9 -0
  25. data/lib/openxml/drawingml/elements/graphic_data.rb +12 -0
  26. data/lib/openxml/drawingml/elements/graphic_frame_locks.rb +16 -0
  27. data/lib/openxml/drawingml/elements/head_end.rb +27 -0
  28. data/lib/openxml/drawingml/elements/no_autofit.rb +11 -0
  29. data/lib/openxml/drawingml/elements/no_fill.rb +9 -0
  30. data/lib/openxml/drawingml/elements/non_visual_drawing_properties.rb +17 -0
  31. data/lib/openxml/drawingml/elements/non_visual_picture_drawing_properties.rb +14 -0
  32. data/lib/openxml/drawingml/elements/non_visual_picture_properties.rb +13 -0
  33. data/lib/openxml/drawingml/elements/non_visual_shape_drawing_properties.rb +15 -0
  34. data/lib/openxml/drawingml/elements/offset.rb +14 -0
  35. data/lib/openxml/drawingml/elements/outline.rb +37 -0
  36. data/lib/openxml/drawingml/elements/picture.rb +13 -0
  37. data/lib/openxml/drawingml/elements/picture_locks.rb +23 -0
  38. data/lib/openxml/drawingml/elements/picture_shape_properties.rb +15 -0
  39. data/lib/openxml/drawingml/elements/preset_geometry.rb +211 -0
  40. data/lib/openxml/drawingml/elements/preset_text_warp.rb +27 -0
  41. data/lib/openxml/drawingml/elements/round.rb +8 -0
  42. data/lib/openxml/drawingml/elements/shape_guide.rb +40 -0
  43. data/lib/openxml/drawingml/elements/solid_fill.rb +10 -0
  44. data/lib/openxml/drawingml/elements/source_rectangle.rb +16 -0
  45. data/lib/openxml/drawingml/elements/srgb_color.rb +13 -0
  46. data/lib/openxml/drawingml/elements/stretch.rb +12 -0
  47. data/lib/openxml/drawingml/elements/tail_end.rb +27 -0
  48. data/lib/openxml/drawingml/elements/theme_elements.rb +9 -0
  49. data/lib/openxml/drawingml/elements/transform_effect.rb +20 -0
  50. data/lib/openxml/drawingml/version.rb +5 -0
  51. data/openxml-drawingml.gemspec +33 -0
  52. metadata +208 -0
@@ -0,0 +1,11 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class NoAutofit < OpenXml::DrawingML::Element
5
+
6
+ tag :noAutofit
7
+
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class NoFill < OpenXml::DrawingML::Element
5
+ tag :noFill
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class NonVisualDrawingProperties < OpenXml::DrawingML::Element
5
+ namespace :pic
6
+ tag :cNvPr
7
+
8
+ attribute :description, expects: :string, displays_as: :descr
9
+ attribute :hidden, expects: :boolean
10
+ attribute :id, expects: :positive_integer
11
+ attribute :picture_name, expects: :string, displays_as: :name
12
+ attribute :title, expects: :string
13
+
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,14 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class NonVisualPictureDrawingProperties < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ namespace :pic
8
+ tag :cNvPicPr
9
+
10
+ attribute :preferRelativeResize, expects: :boolean
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class NonVisualPictureProperties < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ namespace :pic
8
+ tag :nvPicPr
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class NonVisualShapeDrawingProperties < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ namespace :wps
8
+ tag :cNvSpPr
9
+
10
+ attribute :textbox, expects: :boolean, displays_as: :txBox
11
+
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class Offset < OpenXml::DrawingML::Element
5
+ namespace :a
6
+ tag :off
7
+
8
+ attribute :x, expects: :integer
9
+ attribute :y, expects: :integer
10
+
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,37 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class Outline < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ tag :ln
8
+
9
+ attribute :alignment, expects: :valid_stroke_alignment, displays_as: :algn
10
+ attribute :cap, expects: :valid_cap_type
11
+ attribute :compound_type, expects: :valid_compound_type, displays_as: :cmpd
12
+ attribute :width, expects: :positive_integer, displays_as: :w
13
+
14
+ private
15
+
16
+ def valid_stroke_alignment(value)
17
+ ok_values = %i(ctr in)
18
+ message = "Invalid stroke alignment (#{value}). Valid values are: #{ok_values.join(", ")}."
19
+ raise ArgumentError, message unless ok_values.include? value
20
+ end
21
+
22
+ def valid_cap_type(value)
23
+ ok_values = %i(flat rnd sq)
24
+ message = "Invalid line cap type (#{value}). Valid values are: #{ok_values.join(", ")}."
25
+ raise ArgumentError, message unless ok_values.include? value
26
+ end
27
+
28
+ def valid_compound_type(value)
29
+ ok_values = %i(dbl sng thickThin thinThick tri)
30
+ message = "Invalid compound line type (#{value}). Valid values are: #{ok_values.join(", ")}."
31
+ raise ArgumentError, message unless ok_values.include? value
32
+ end
33
+
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,13 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class Picture < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ namespace :pic
8
+ tag :pic
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,23 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class PictureLocks < OpenXml::DrawingML::Element
5
+ namespace :a
6
+ tag :picLocks
7
+
8
+ attribute :hide_adjust_handles, expects: :boolean, displays_as: :noAdjustHandles
9
+ attribute :disallow_arrowhead_changes, expects: :boolean, displays_as: :noChangeArrowheads
10
+ attribute :disallow_aspect_ratio_changes, expects: :boolean, displays_as: :noChangeAspect
11
+ attribute :disallow_shape_type_changes, expects: :boolean, displays_as: :noChangeShapeType
12
+ attribute :disallow_cropping, expects: :boolean, displays_as: :noCrop
13
+ attribute :disallow_editing_points, expects: :boolean, displays_as: :noEditPoints
14
+ attribute :disallow_grouping, expects: :boolean, displays_as: :noGrp
15
+ attribute :disallow_moving, expects: :boolean, displays_as: :noMove
16
+ attribute :disallow_resizing, expects: :boolean, displays_as: :noResize
17
+ attribute :disallow_rotation, expects: :boolean, displays_as: :noRot
18
+ attribute :disallow_selection, expects: :boolean, displays_as: :noSelect
19
+
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,15 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class PictureShapeProperties < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ namespace :pic
8
+ tag :spPr
9
+
10
+ attribute :black_and_white_mode, one_of: %i(auto black blackGray blackWhite clr gray grayWhite hidden invGray ltGray white), displays_as: :bwMode
11
+
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,211 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class PresetGeometry < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ tag :prstGeom
8
+
9
+ attribute :preset, expects: :valid_geometry_preset, displays_as: :prst
10
+
11
+ private
12
+
13
+ def valid_geometry_preset(value)
14
+ message = "Invalid preset geometry: #{value}"
15
+ raise ArgumentError, message unless ok_values.include? value
16
+ end
17
+
18
+ def ok_values
19
+ %i( accentBorderCallout1
20
+ accentBorderCallout2
21
+ accentBorderCallout3
22
+ accentCallout1
23
+ accentCallout2
24
+ accentCallout3
25
+ actionButtonBackPrevious
26
+ actionButtonBeginning
27
+ actionButtonBlank
28
+ actionButtonDocument
29
+ actionButtonEnd
30
+ actionButtonForwardNext
31
+ actionButtonHelp
32
+ actionButtonHome
33
+ actionButtonInformation
34
+ actionButtonMovie
35
+ actionButtonReturn
36
+ actionButtonSound
37
+ arc
38
+ bentArrow
39
+ bentConnector2
40
+ bentConnector3
41
+ bentConnector4
42
+ bentConnector5
43
+ bentUpArrow
44
+ bevel
45
+ blockArc
46
+ borderCallout1
47
+ borderCallout2
48
+ borderCallout3
49
+ bracePair
50
+ bracketPair
51
+ callout1
52
+ callout2
53
+ callout3
54
+ can
55
+ chartPlus
56
+ chartStar
57
+ chartX
58
+ chevron
59
+ chord
60
+ circularArrow
61
+ cloud
62
+ cloudCallout
63
+ corner
64
+ cornerTabs
65
+ cube
66
+ curvedConnector2
67
+ curvedConnector3
68
+ curvedConnector4
69
+ curvedConnector5
70
+ curvedDownArrow
71
+ curvedLeftArrow
72
+ curvedRightArrow
73
+ curvedUpArrow
74
+ decagon
75
+ diagStripe
76
+ diamond
77
+ dodecagon
78
+ donut
79
+ doubleWave
80
+ downArrow
81
+ downArrowCallout
82
+ ellipse
83
+ ellipseRibbon
84
+ ellipseRibbon2
85
+ flowChartAlternateProcess
86
+ flowChartCollate
87
+ flowChartConnector
88
+ flowChartDecision
89
+ flowChartDelay
90
+ flowChartDisplay
91
+ flowChartDocument
92
+ flowChartExtract
93
+ flowChartInputOutput
94
+ flowChartInternalStorage
95
+ flowChartMagneticDisk
96
+ flowChartMagneticDrum
97
+ flowChartMagneticTape
98
+ flowChartManualInput
99
+ flowChartManualOperation
100
+ flowChartMerge
101
+ flowChartMultidocument
102
+ flowChartOfflineStorage
103
+ flowChartOffpageConnector
104
+ flowChartOnlineStorage
105
+ flowChartOr
106
+ flowChartPredefinedProcess
107
+ flowChartPreparation
108
+ flowChartProcess
109
+ flowChartPunchedCard
110
+ flowChartPunchedTape
111
+ flowChartSort
112
+ flowChartSummingJunction
113
+ flowChartTerminator
114
+ foldedCorner
115
+ frame
116
+ funnel
117
+ gear6
118
+ gear9
119
+ halfFrame
120
+ heart
121
+ heptagon
122
+ hexagon
123
+ homePlate
124
+ horizontalScroll
125
+ irregularSeal1
126
+ irregularSeal2
127
+ leftArrow
128
+ leftArrowCallout
129
+ leftBrace
130
+ leftBracket
131
+ leftCircularArrow
132
+ leftRightArrow
133
+ leftRightArrowCallout
134
+ leftRightCircularArrow
135
+ leftRightRibbon
136
+ leftRightUpArrow
137
+ leftUpArrow
138
+ lightningBolt
139
+ line
140
+ lineInv
141
+ mathDivide
142
+ mathEqual
143
+ mathMinus
144
+ mathMultiply
145
+ mathNotEqual
146
+ mathPlus
147
+ moon
148
+ nonIsoscelesTrapazoid
149
+ noSmoking
150
+ notchedRightArrow
151
+ octagon
152
+ parallelogram
153
+ pentagon
154
+ pie
155
+ pieWedge
156
+ plaque
157
+ plaqueTabs
158
+ plus
159
+ quadArrow
160
+ quadArrowCallout
161
+ rect
162
+ ribbon
163
+ ribbon2
164
+ rightArrow
165
+ rightArrowCallout
166
+ rightBrace
167
+ rightBracket
168
+ round1Rect
169
+ round2DiagRect
170
+ round2SameRect
171
+ roundRect
172
+ rtTriangle
173
+ smileyFace
174
+ snip1Rect
175
+ snip2DiagRect
176
+ snip2SameRect
177
+ snipRoundRect
178
+ squareTabs
179
+ star10
180
+ star12
181
+ star16
182
+ star24
183
+ star32
184
+ star4
185
+ star5
186
+ star6
187
+ star7
188
+ star8
189
+ straightConnector1
190
+ stripedRightArrow
191
+ sun
192
+ swooshArrow
193
+ teardrop
194
+ trapezoid
195
+ triangle
196
+ upArrow
197
+ upArrowCallout
198
+ upDownArrow
199
+ upDownArrowCallout
200
+ uturnArrow
201
+ verticalScroll
202
+ wave
203
+ wedgeEllipseCallout
204
+ wedgeRectCallout
205
+ wedgeRoundRectCallout ) # Office Open XML spec section 20.1.10.55
206
+ end
207
+
208
+ end
209
+ end
210
+ end
211
+ end
@@ -0,0 +1,27 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class PresetTextWarp < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ namespace :a
8
+ tag :prstTxWarp
9
+
10
+ attribute :preset, one_of: %i(textArchDown textArchDownPour textArchUp
11
+ textArchUpPour textButton textButtonPour
12
+ textCanDown textCanUp textCascadeDown
13
+ textCascadeUp textChevron textChevronInverted
14
+ textCircle textCirclePour textCurveDown
15
+ textCurveUp textDeflate textDeflateBottom
16
+ textDeflateInflate textDeflateTop
17
+ textDoubleWave1 textFadeDown textFadeLeft
18
+ textFadeRight textFadeUp textInflate
19
+ textInflateBottom textInflateTop textNoShape
20
+ textPlain textRingInside textRingOutside
21
+ textSlantDown textSlantUp textStop textTriangle
22
+ textTriangleInverted textWave1 textWave2
23
+ textWave4), displays_as: :prst
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class Round < OpenXml::DrawingML::Element
5
+ end
6
+ end
7
+ end
8
+ end