openxml-drawingml 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.travis.yml +6 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +65 -0
- data/LICENSE.txt +20 -0
- data/README.md +38 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/openxml-drawingml.rb +1 -0
- data/lib/openxml/drawingml.rb +6 -0
- data/lib/openxml/drawingml/element.rb +9 -0
- data/lib/openxml/drawingml/elements.rb +12 -0
- data/lib/openxml/drawingml/elements/adjust_values_list.rb +12 -0
- data/lib/openxml/drawingml/elements/blip.rb +19 -0
- data/lib/openxml/drawingml/elements/blip_fill.rb +16 -0
- data/lib/openxml/drawingml/elements/children_extents.rb +13 -0
- data/lib/openxml/drawingml/elements/children_offset.rb +13 -0
- data/lib/openxml/drawingml/elements/extension.rb +14 -0
- data/lib/openxml/drawingml/elements/extension_list.rb +12 -0
- data/lib/openxml/drawingml/elements/extents.rb +13 -0
- data/lib/openxml/drawingml/elements/fill_rectangle.rb +15 -0
- data/lib/openxml/drawingml/elements/graphic.rb +9 -0
- data/lib/openxml/drawingml/elements/graphic_data.rb +12 -0
- data/lib/openxml/drawingml/elements/graphic_frame_locks.rb +16 -0
- data/lib/openxml/drawingml/elements/head_end.rb +27 -0
- data/lib/openxml/drawingml/elements/no_autofit.rb +11 -0
- data/lib/openxml/drawingml/elements/no_fill.rb +9 -0
- data/lib/openxml/drawingml/elements/non_visual_drawing_properties.rb +17 -0
- data/lib/openxml/drawingml/elements/non_visual_picture_drawing_properties.rb +14 -0
- data/lib/openxml/drawingml/elements/non_visual_picture_properties.rb +13 -0
- data/lib/openxml/drawingml/elements/non_visual_shape_drawing_properties.rb +15 -0
- data/lib/openxml/drawingml/elements/offset.rb +14 -0
- data/lib/openxml/drawingml/elements/outline.rb +37 -0
- data/lib/openxml/drawingml/elements/picture.rb +13 -0
- data/lib/openxml/drawingml/elements/picture_locks.rb +23 -0
- data/lib/openxml/drawingml/elements/picture_shape_properties.rb +15 -0
- data/lib/openxml/drawingml/elements/preset_geometry.rb +211 -0
- data/lib/openxml/drawingml/elements/preset_text_warp.rb +27 -0
- data/lib/openxml/drawingml/elements/round.rb +8 -0
- data/lib/openxml/drawingml/elements/shape_guide.rb +40 -0
- data/lib/openxml/drawingml/elements/solid_fill.rb +10 -0
- data/lib/openxml/drawingml/elements/source_rectangle.rb +16 -0
- data/lib/openxml/drawingml/elements/srgb_color.rb +13 -0
- data/lib/openxml/drawingml/elements/stretch.rb +12 -0
- data/lib/openxml/drawingml/elements/tail_end.rb +27 -0
- data/lib/openxml/drawingml/elements/theme_elements.rb +9 -0
- data/lib/openxml/drawingml/elements/transform_effect.rb +20 -0
- data/lib/openxml/drawingml/version.rb +5 -0
- data/openxml-drawingml.gemspec +33 -0
- metadata +208 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module DrawingML
|
3
|
+
module Elements
|
4
|
+
class ShapeGuide < OpenXml::DrawingML::Element
|
5
|
+
namespace :a
|
6
|
+
tag :gd
|
7
|
+
|
8
|
+
attribute :formula, expects: :valid_formula, displays_as: :fmla
|
9
|
+
attribute :guide_name, expects: :string, displays_as: :name
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def valid_formula(value)
|
14
|
+
raise ArgumentError unless ok_formulae.any? { |f| value =~ f }
|
15
|
+
end
|
16
|
+
|
17
|
+
def ok_formulae # Office Open XML spec section 20.1.9.11
|
18
|
+
[ /^\*\/\s[0-9a-z\-]+\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Multiply Divide formula "*/ x y z" = ((x * y) / z)
|
19
|
+
/^\+\-\s[0-9a-z\-]+\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Add Subtract formula "+- x y z" = ((x + y) - z)
|
20
|
+
/^\+\/\s[0-9a-z\-]+\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Add Divide formula "+/ x y z" = ((x + y) / z)
|
21
|
+
/^\?\:\s[0-9a-z\-]+\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # If Else formula "?: x y z" = (x > 0) ? y : z
|
22
|
+
/^abs\s[0-9a-z\-]+$/i, # Absolute Value formula "abs x" = (x < 0) -1 * x : x
|
23
|
+
/^at2\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # ArcTan formula "at2 x y" = arctan(y / x)
|
24
|
+
/^cat2\s[0-9a-z\-]+\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Cosine ArcTan formula "cat2 x y z" = (x * cos(arctan(z / y)))
|
25
|
+
/^cos\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Cosine formula "cos x y" = x * cos(y)
|
26
|
+
/^max\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Maximum Value formula "max x y" = (x > y) ? x : y
|
27
|
+
/^min\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Minimum Value formula "min x y" = (x < y) ? x : y
|
28
|
+
/^mod\s[0-9a-z\-]+\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Modulo formula "mod x y z" = sqrt(x^2 + y^2 + z^2)
|
29
|
+
/^pin\s[0-9a-z\-]+\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Pin To formula "pin x y z" = if(y < x) x elsif(y > z) z else y
|
30
|
+
/^sat2\s[0-9a-z\-]+\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Sine ArcTan formula "sat2 x y z" = (x * sin(arctan(z / y)))
|
31
|
+
/^sin\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Sine formula "sin x y" = x * sin(y)
|
32
|
+
/^sqrt\s[0-9a-z\-]+$/i, # Square Root formula "sqrt x" = sqrt(x)
|
33
|
+
/^tan\s[0-9a-z\-]+\s[0-9a-z\-]+$/i, # Tangent formula "tan x y" = x * tan(y)
|
34
|
+
/^val\s[0-9a-z\-]+$/i ] # Literal Value formula "val x" = x
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module DrawingML
|
3
|
+
module Elements
|
4
|
+
class SourceRectangle < OpenXml::DrawingML::Element
|
5
|
+
namespace :a
|
6
|
+
tag :srcRect
|
7
|
+
|
8
|
+
attribute :bottom_offset, expects: :percentage, displays_as: :b
|
9
|
+
attribute :left_offset, expects: :percentage, displays_as: :l
|
10
|
+
attribute :right_offset, expects: :percentage, displays_as: :r
|
11
|
+
attribute :top_offset, expects: :percentage, displays_as: :t
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module DrawingML
|
3
|
+
module Elements
|
4
|
+
class TailEnd < OpenXml::DrawingML::Element
|
5
|
+
|
6
|
+
attribute :length, expects: :valid_end_size, displays_as: :len
|
7
|
+
attribute :type, expects: :valid_end_type
|
8
|
+
attribute :width, expects: :valid_end_size, displays_as: :w
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def valid_end_size(value)
|
13
|
+
ok_values = %i(lg med sm)
|
14
|
+
message = "Invalid #{name} (#{value}). Valid values are: #{ok_values.join(", ")}."
|
15
|
+
raise ArgumentError, message unless ok_values.include? value
|
16
|
+
end
|
17
|
+
|
18
|
+
def valid_end_type(value)
|
19
|
+
ok_values = %i(arrow diamond none oval stealth triangle)
|
20
|
+
message = "Invalid end type (#{value}). Valid values are: #{ok_values.join(", ")}."
|
21
|
+
raise ArgumentError, message unless ok_values.include? value
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module DrawingML
|
3
|
+
module Elements
|
4
|
+
class TransformEffect < OpenXml::DrawingML::Element
|
5
|
+
include HasChildren
|
6
|
+
|
7
|
+
namespace :a
|
8
|
+
tag :xfrm
|
9
|
+
|
10
|
+
attribute :horizontal_skew, expects: :integer, displays_as: :kx
|
11
|
+
attribute :vertical_skew, expects: :integer, displays_as: :ky
|
12
|
+
attribute :horizontal_ratio, expects: :percentage, displays_as: :sx
|
13
|
+
attribute :vertical_ratio, expects: :percentage, displays_as: :sy
|
14
|
+
attribute :horizontal_shift, expects: :integer, displays_as: :tx
|
15
|
+
attribute :vertical_shift, expects: :integer, displays_as: :ty
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "openxml/drawingml/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "openxml-drawingml"
|
8
|
+
spec.version = OpenXml::DrawingML::VERSION
|
9
|
+
spec.authors = ["Amos King", "Bob Lail"]
|
10
|
+
spec.email = ["amos@binarynoggin.com", "bob.lailfamily@gmail.com"]
|
11
|
+
|
12
|
+
spec.description = %q{Build drawingml files for open xml formats}
|
13
|
+
spec.summary = %q{Implements the Office Open XML spec for DrawingML}
|
14
|
+
spec.homepage = "https://github.com/openxml/openxml-drawingml"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.required_ruby_version = "~> 2.0"
|
23
|
+
|
24
|
+
spec.add_dependency "nokogiri"
|
25
|
+
spec.add_dependency "openxml-package", "~> 0.2.9"
|
26
|
+
|
27
|
+
spec.add_development_dependency "pry"
|
28
|
+
spec.add_development_dependency "rspec"
|
29
|
+
spec.add_development_dependency "rake"
|
30
|
+
spec.add_development_dependency "rr"
|
31
|
+
spec.add_development_dependency "simplecov"
|
32
|
+
spec.add_development_dependency "timecop"
|
33
|
+
end
|
metadata
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: openxml-drawingml
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Amos King
|
8
|
+
- Bob Lail
|
9
|
+
autorequire:
|
10
|
+
bindir: exe
|
11
|
+
cert_chain: []
|
12
|
+
date: 2017-06-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: nokogiri
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: openxml-package
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 0.2.9
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 0.2.9
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: pry
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rake
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: rr
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: simplecov
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: timecop
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
description: Build drawingml files for open xml formats
|
127
|
+
email:
|
128
|
+
- amos@binarynoggin.com
|
129
|
+
- bob.lailfamily@gmail.com
|
130
|
+
executables: []
|
131
|
+
extensions: []
|
132
|
+
extra_rdoc_files: []
|
133
|
+
files:
|
134
|
+
- ".gitignore"
|
135
|
+
- ".travis.yml"
|
136
|
+
- Gemfile
|
137
|
+
- Gemfile.lock
|
138
|
+
- LICENSE.txt
|
139
|
+
- README.md
|
140
|
+
- Rakefile
|
141
|
+
- bin/console
|
142
|
+
- bin/setup
|
143
|
+
- lib/openxml-drawingml.rb
|
144
|
+
- lib/openxml/drawingml.rb
|
145
|
+
- lib/openxml/drawingml/element.rb
|
146
|
+
- lib/openxml/drawingml/elements.rb
|
147
|
+
- lib/openxml/drawingml/elements/adjust_values_list.rb
|
148
|
+
- lib/openxml/drawingml/elements/blip.rb
|
149
|
+
- lib/openxml/drawingml/elements/blip_fill.rb
|
150
|
+
- lib/openxml/drawingml/elements/children_extents.rb
|
151
|
+
- lib/openxml/drawingml/elements/children_offset.rb
|
152
|
+
- lib/openxml/drawingml/elements/extension.rb
|
153
|
+
- lib/openxml/drawingml/elements/extension_list.rb
|
154
|
+
- lib/openxml/drawingml/elements/extents.rb
|
155
|
+
- lib/openxml/drawingml/elements/fill_rectangle.rb
|
156
|
+
- lib/openxml/drawingml/elements/graphic.rb
|
157
|
+
- lib/openxml/drawingml/elements/graphic_data.rb
|
158
|
+
- lib/openxml/drawingml/elements/graphic_frame_locks.rb
|
159
|
+
- lib/openxml/drawingml/elements/head_end.rb
|
160
|
+
- lib/openxml/drawingml/elements/no_autofit.rb
|
161
|
+
- lib/openxml/drawingml/elements/no_fill.rb
|
162
|
+
- lib/openxml/drawingml/elements/non_visual_drawing_properties.rb
|
163
|
+
- lib/openxml/drawingml/elements/non_visual_picture_drawing_properties.rb
|
164
|
+
- lib/openxml/drawingml/elements/non_visual_picture_properties.rb
|
165
|
+
- lib/openxml/drawingml/elements/non_visual_shape_drawing_properties.rb
|
166
|
+
- lib/openxml/drawingml/elements/offset.rb
|
167
|
+
- lib/openxml/drawingml/elements/outline.rb
|
168
|
+
- lib/openxml/drawingml/elements/picture.rb
|
169
|
+
- lib/openxml/drawingml/elements/picture_locks.rb
|
170
|
+
- lib/openxml/drawingml/elements/picture_shape_properties.rb
|
171
|
+
- lib/openxml/drawingml/elements/preset_geometry.rb
|
172
|
+
- lib/openxml/drawingml/elements/preset_text_warp.rb
|
173
|
+
- lib/openxml/drawingml/elements/round.rb
|
174
|
+
- lib/openxml/drawingml/elements/shape_guide.rb
|
175
|
+
- lib/openxml/drawingml/elements/solid_fill.rb
|
176
|
+
- lib/openxml/drawingml/elements/source_rectangle.rb
|
177
|
+
- lib/openxml/drawingml/elements/srgb_color.rb
|
178
|
+
- lib/openxml/drawingml/elements/stretch.rb
|
179
|
+
- lib/openxml/drawingml/elements/tail_end.rb
|
180
|
+
- lib/openxml/drawingml/elements/theme_elements.rb
|
181
|
+
- lib/openxml/drawingml/elements/transform_effect.rb
|
182
|
+
- lib/openxml/drawingml/version.rb
|
183
|
+
- openxml-drawingml.gemspec
|
184
|
+
homepage: https://github.com/openxml/openxml-drawingml
|
185
|
+
licenses:
|
186
|
+
- MIT
|
187
|
+
metadata: {}
|
188
|
+
post_install_message:
|
189
|
+
rdoc_options: []
|
190
|
+
require_paths:
|
191
|
+
- lib
|
192
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
193
|
+
requirements:
|
194
|
+
- - "~>"
|
195
|
+
- !ruby/object:Gem::Version
|
196
|
+
version: '2.0'
|
197
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
202
|
+
requirements: []
|
203
|
+
rubyforge_project:
|
204
|
+
rubygems_version: 2.6.11
|
205
|
+
signing_key:
|
206
|
+
specification_version: 4
|
207
|
+
summary: Implements the Office Open XML spec for DrawingML
|
208
|
+
test_files: []
|