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
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8fffe8f73f341bd34a310c3e47d666cad68d00d3
4
+ data.tar.gz: abd19d696357d1e612053b2a1f48ff848755936e
5
+ SHA512:
6
+ metadata.gz: 2ec5003011c55b1b79e1157ab348215538cf8b3c0a3f03314882892e5c4f5f4f1f930f842b672dfd0916e599987648617337927de138e5f7a337710fcca9727c
7
+ data.tar.gz: b2d4ca42102ee57943d5744a0f3f737f80891726f649a8a5b5250292277fcf74753027adb084c33a476bacc63e0fcf7f01e8cc9256f9260212f8a65afd3f4bed
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .ruby-version
2
+ .DS_Store
3
+ rocx-0.1.0.gem
4
+ *.gem
5
+ .rspec-local
6
+ /coverage
7
+ TODO.md
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ # .travis.yml
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.0
5
+ script:
6
+ - bundle exec rake spec
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ # Optional: use the development version of openxml-package
6
+ # gem "openxml-package", github: "openxml/openxml-package", branch: "master"
data/Gemfile.lock ADDED
@@ -0,0 +1,65 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ openxml-drawingml (0.1.0)
5
+ nokogiri
6
+ openxml-package (~> 0.2.9)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ coderay (1.1.1)
12
+ diff-lcs (1.3)
13
+ docile (1.1.5)
14
+ json (2.1.0)
15
+ method_source (0.8.2)
16
+ mini_portile2 (2.2.0)
17
+ nokogiri (1.8.0)
18
+ mini_portile2 (~> 2.2.0)
19
+ openxml-package (0.2.9)
20
+ nokogiri
21
+ ox
22
+ rubyzip (~> 1.2.1)
23
+ ox (2.5.0)
24
+ pry (0.10.4)
25
+ coderay (~> 1.1.0)
26
+ method_source (~> 0.8.1)
27
+ slop (~> 3.4)
28
+ rake (12.0.0)
29
+ rr (1.2.0)
30
+ rspec (3.6.0)
31
+ rspec-core (~> 3.6.0)
32
+ rspec-expectations (~> 3.6.0)
33
+ rspec-mocks (~> 3.6.0)
34
+ rspec-core (3.6.0)
35
+ rspec-support (~> 3.6.0)
36
+ rspec-expectations (3.6.0)
37
+ diff-lcs (>= 1.2.0, < 2.0)
38
+ rspec-support (~> 3.6.0)
39
+ rspec-mocks (3.6.0)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.6.0)
42
+ rspec-support (3.6.0)
43
+ rubyzip (1.2.1)
44
+ simplecov (0.14.1)
45
+ docile (~> 1.1.0)
46
+ json (>= 1.8, < 3)
47
+ simplecov-html (~> 0.10.0)
48
+ simplecov-html (0.10.1)
49
+ slop (3.6.0)
50
+ timecop (0.8.1)
51
+
52
+ PLATFORMS
53
+ ruby
54
+
55
+ DEPENDENCIES
56
+ openxml-drawingml!
57
+ pry
58
+ rake
59
+ rr
60
+ rspec
61
+ simplecov
62
+ timecop
63
+
64
+ BUNDLED WITH
65
+ 1.14.6
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Gene Doyel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # OpenXml::DrawingML
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/openxml-drawingml.svg)](https://rubygems.org/gems/openxml-drawingml)
4
+ [![Code Climate](https://codeclimate.com/github/openxml/openxml-drawingml.svg)](https://codeclimate.com/github/openxml/openxml-drawingml)
5
+ [![Build Status](https://travis-ci.org/openxml/openxml-drawingml.svg)](https://travis-ci.org/openxml/openxml-drawingml)
6
+
7
+ OpenXml::DrawingML is a gem for constructing DrawingML (Office Open XML).
8
+
9
+
10
+ ## Installation
11
+
12
+ Add this line to your application's Gemfile:
13
+
14
+ ```ruby
15
+ gem 'openxml-drawingml'
16
+ ```
17
+
18
+ And then execute:
19
+
20
+ $ bundle
21
+
22
+ Or install it yourself as:
23
+
24
+ $ gem install openxml-drawingml
25
+
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ Reference for WordprocessingML can be found in Part 1 of the Fourth Edition of [ECMA-376](http://www.ecma-international.org/publications/standards/Ecma-376.htm) (the Office Open XML Standard).
32
+
33
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
34
+
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/openxml/openxml-drawingml.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "rspec/core/rake_task"
2
+
3
+ RSpec::Core::RakeTask.new
4
+ task default: :spec
5
+ task test: :spec
6
+ require "bundler/gem_tasks"
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "openxml/drawingml"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1 @@
1
+ require "openxml/drawingml"
@@ -0,0 +1,6 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ end
4
+ end
5
+
6
+ require "openxml/drawingml/elements"
@@ -0,0 +1,9 @@
1
+ require "openxml/element"
2
+
3
+ module OpenXml
4
+ module DrawingML
5
+ class Element < ::OpenXml::Element
6
+ namespace :a
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ end
5
+ end
6
+ end
7
+
8
+ require "openxml/drawingml/element"
9
+ require "openxml/has_children"
10
+ Dir.glob("#{File.join(File.dirname(__FILE__), "elements", "*.rb")}").each do |file|
11
+ require file
12
+ end
@@ -0,0 +1,12 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class AdjustValuesList < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ tag :avLst
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,19 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class Blip < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ tag :blip
8
+
9
+ attribute :compression_state, one_of: %i(email hqprint none print screen), displays_as: :cstate
10
+
11
+ with_namespace :r do
12
+ attribute :embed, expects: :string
13
+ attribute :link, expects: :string
14
+ end
15
+
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,16 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class BlipFill < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ namespace :pic
8
+ tag :blipFill
9
+
10
+ attribute :dpi, expects: :integer
11
+ attribute :rotate_with_shape, expects: :boolean, displays_as: :rotWithShape
12
+
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class ChildrenExtents < OpenXml::DrawingML::Element
5
+ tag :chExt
6
+
7
+ attribute :extent_length, expects: :positive_integer, displays_as: :cx
8
+ attribute :extent_width, expects: :positive_integer, displays_as: :cy
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class ChildrenOffset < OpenXml::DrawingML::Element
5
+ tag :chOff
6
+
7
+ attribute :x, expects: :integer
8
+ attribute :y, expects: :integer
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class Extension < OpenXml::DrawingML::Element
5
+ tag :ext
6
+
7
+ attribute :uri, expects: :string
8
+ attribute :x, displays_as: :cx, expects: :integer
9
+ attribute :y, displays_as: :cy, expects: :integer
10
+
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,12 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class ExtensionList < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ tag :extLst
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class Extents < OpenXml::DrawingML::Element
5
+ tag :ext
6
+
7
+ attribute :extent_length, expects: :positive_integer, displays_as: :cx
8
+ attribute :extent_width, expects: :positive_integer, displays_as: :cy
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class FillRectangle < OpenXml::DrawingML::Element
5
+ tag :fillRect
6
+
7
+ attribute :bottom_offset, expects: :percentage, displays_as: :b
8
+ attribute :left_offset, expects: :percentage, displays_as: :l
9
+ attribute :right_offset, expects: :percentage, displays_as: :r
10
+ attribute :top_offset, expects: :percentage, displays_as: :t
11
+
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class Graphic < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,12 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class GraphicData < OpenXml::DrawingML::Element
5
+ include HasChildren
6
+
7
+ attribute :uri, expects: :string
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,16 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class GraphicFrameLocks < OpenXml::DrawingML::Element
5
+
6
+ attribute :disallow_aspect_ratio_changes, expects: :boolean, displays_as: :noChangeAspect
7
+ attribute :disallow_drilldown, expects: :boolean, displays_as: :noDrilldown
8
+ attribute :disallow_grouping, expects: :boolean, displays_as: :noGrp
9
+ attribute :disallow_moving, expects: :boolean, displays_as: :noMove
10
+ attribute :disallow_resizing, expects: :boolean, displays_as: :noResize
11
+ attribute :disallow_selection, expects: :boolean, displays_as: :noSelect
12
+
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,27 @@
1
+ module OpenXml
2
+ module DrawingML
3
+ module Elements
4
+ class HeadEnd < 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