openxml-pptx 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.travis.yml +6 -0
  4. data/Gemfile +8 -0
  5. data/Gemfile.lock +92 -0
  6. data/Guardfile +16 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +46 -0
  9. data/Rakefile +6 -0
  10. data/bin/build_fixtures +10 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/bin/zipflip +56 -0
  14. data/lib/openxml/pptx.rb +52 -0
  15. data/lib/openxml/pptx/elements.rb +12 -0
  16. data/lib/openxml/pptx/package.rb +33 -0
  17. data/lib/openxml/pptx/parts.rb +12 -0
  18. data/lib/openxml/pptx/parts/image.rb +32 -0
  19. data/lib/openxml/pptx/parts/presentation.rb +142 -0
  20. data/lib/openxml/pptx/parts/presentation_properties.rb +38 -0
  21. data/lib/openxml/pptx/parts/slide.rb +87 -0
  22. data/lib/openxml/pptx/parts/slide_layout.rb +88 -0
  23. data/lib/openxml/pptx/parts/slide_master.rb +132 -0
  24. data/lib/openxml/pptx/parts/theme.rb +61 -0
  25. data/lib/openxml/pptx/properties.rb +21 -0
  26. data/lib/openxml/pptx/properties/background.rb +19 -0
  27. data/lib/openxml/pptx/properties/background_properties.rb +30 -0
  28. data/lib/openxml/pptx/properties/background_reference.rb +23 -0
  29. data/lib/openxml/pptx/properties/blip_fill.rb +11 -0
  30. data/lib/openxml/pptx/properties/color_mapping.rb +11 -0
  31. data/lib/openxml/pptx/properties/color_mapping_override.rb +11 -0
  32. data/lib/openxml/pptx/properties/common_slide_data.rb +21 -0
  33. data/lib/openxml/pptx/properties/connection_shape.rb +16 -0
  34. data/lib/openxml/pptx/properties/content_part.rb +13 -0
  35. data/lib/openxml/pptx/properties/control.rb +36 -0
  36. data/lib/openxml/pptx/properties/control_list.rb +14 -0
  37. data/lib/openxml/pptx/properties/custom_show.rb +18 -0
  38. data/lib/openxml/pptx/properties/custom_show_list.rb +14 -0
  39. data/lib/openxml/pptx/properties/customer_data.rb +13 -0
  40. data/lib/openxml/pptx/properties/customer_data_container.rb +12 -0
  41. data/lib/openxml/pptx/properties/customer_data_list.rb +14 -0
  42. data/lib/openxml/pptx/properties/data_tags.rb +13 -0
  43. data/lib/openxml/pptx/properties/default_text_style.rb +24 -0
  44. data/lib/openxml/pptx/properties/embedded_font.rb +18 -0
  45. data/lib/openxml/pptx/properties/embedded_font_list.rb +14 -0
  46. data/lib/openxml/pptx/properties/extension.rb +14 -0
  47. data/lib/openxml/pptx/properties/extension_list.rb +14 -0
  48. data/lib/openxml/pptx/properties/font.rb +32 -0
  49. data/lib/openxml/pptx/properties/font_reference.rb +12 -0
  50. data/lib/openxml/pptx/properties/font_reference_bold.rb +13 -0
  51. data/lib/openxml/pptx/properties/font_reference_bold_italic.rb +13 -0
  52. data/lib/openxml/pptx/properties/font_reference_italic.rb +13 -0
  53. data/lib/openxml/pptx/properties/font_reference_regular.rb +13 -0
  54. data/lib/openxml/pptx/properties/graphic_frame.rb +20 -0
  55. data/lib/openxml/pptx/properties/group_shape_properties.rb +34 -0
  56. data/lib/openxml/pptx/properties/handout_master_id.rb +18 -0
  57. data/lib/openxml/pptx/properties/handout_master_id_list.rb +14 -0
  58. data/lib/openxml/pptx/properties/non_visual_connection_shape_drawing_properties.rb +18 -0
  59. data/lib/openxml/pptx/properties/non_visual_connection_shape_properties.rb +16 -0
  60. data/lib/openxml/pptx/properties/non_visual_drawing_properties.rb +30 -0
  61. data/lib/openxml/pptx/properties/non_visual_graphic_frame_drawing_properties.rb +15 -0
  62. data/lib/openxml/pptx/properties/non_visual_graphic_frame_properties.rb +16 -0
  63. data/lib/openxml/pptx/properties/non_visual_group_shape_drawing_properties.rb +15 -0
  64. data/lib/openxml/pptx/properties/non_visual_group_shape_properties.rb +16 -0
  65. data/lib/openxml/pptx/properties/non_visual_picture_properties.rb +16 -0
  66. data/lib/openxml/pptx/properties/non_visual_picutre_drawing_properties.rb +18 -0
  67. data/lib/openxml/pptx/properties/non_visual_properties.rb +29 -0
  68. data/lib/openxml/pptx/properties/non_visual_shape_drawing_properties.rb +18 -0
  69. data/lib/openxml/pptx/properties/non_visual_shape_properties.rb +16 -0
  70. data/lib/openxml/pptx/properties/notes_master_id.rb +18 -0
  71. data/lib/openxml/pptx/properties/notes_master_id_list.rb +14 -0
  72. data/lib/openxml/pptx/properties/notes_size.rb +14 -0
  73. data/lib/openxml/pptx/properties/photo_album.rb +19 -0
  74. data/lib/openxml/pptx/properties/picture.rb +30 -0
  75. data/lib/openxml/pptx/properties/placeholder.rb +20 -0
  76. data/lib/openxml/pptx/properties/shape.rb +34 -0
  77. data/lib/openxml/pptx/properties/shape_group.rb +18 -0
  78. data/lib/openxml/pptx/properties/shape_properties.rb +11 -0
  79. data/lib/openxml/pptx/properties/shape_style.rb +11 -0
  80. data/lib/openxml/pptx/properties/shape_tree.rb +13 -0
  81. data/lib/openxml/pptx/properties/shapes_container.rb +18 -0
  82. data/lib/openxml/pptx/properties/simple_boolean_property.rb +16 -0
  83. data/lib/openxml/pptx/properties/simple_property_container_property.rb +14 -0
  84. data/lib/openxml/pptx/properties/slide_id.rb +29 -0
  85. data/lib/openxml/pptx/properties/slide_id_list.rb +14 -0
  86. data/lib/openxml/pptx/properties/slide_layout_id.rb +26 -0
  87. data/lib/openxml/pptx/properties/slide_layout_id_list.rb +14 -0
  88. data/lib/openxml/pptx/properties/slide_list.rb +14 -0
  89. data/lib/openxml/pptx/properties/slide_master_id.rb +29 -0
  90. data/lib/openxml/pptx/properties/slide_master_id_list.rb +14 -0
  91. data/lib/openxml/pptx/properties/slide_reference.rb +15 -0
  92. data/lib/openxml/pptx/properties/slide_size.rb +16 -0
  93. data/lib/openxml/pptx/properties/smart_tags.rb +15 -0
  94. data/lib/openxml/pptx/properties/text_body.rb +11 -0
  95. data/lib/openxml/pptx/properties/text_style_body.rb +11 -0
  96. data/lib/openxml/pptx/properties/text_style_other.rb +11 -0
  97. data/lib/openxml/pptx/properties/text_style_title.rb +11 -0
  98. data/lib/openxml/pptx/properties/text_styles.rb +17 -0
  99. data/lib/openxml/pptx/properties/transform.rb +11 -0
  100. data/lib/openxml/pptx/properties/transparent_container_property.rb +14 -0
  101. data/lib/openxml/pptx/relatable_part.rb +100 -0
  102. data/lib/openxml/pptx/version.rb +5 -0
  103. data/openxml-pptx.gemspec +33 -0
  104. metadata +258 -0
@@ -0,0 +1,14 @@
1
+ require "openxml/pptx/properties/embedded_font"
2
+
3
+ module OpenXml
4
+ module Pptx
5
+ module Properties
6
+ class EmbeddedFontList < OpenXml::Properties::ContainerProperty
7
+ namespace :p
8
+ tag :embeddedFontLst
9
+ child_class :embedded_font
10
+
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class Extension < OpenXml::Properties::ComplexProperty
5
+ include HasChildren
6
+ namespace :p
7
+ tag :ext
8
+
9
+ attribute :uri, expects: :string
10
+
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,14 @@
1
+ require "openxml/pptx/properties/extension"
2
+
3
+ module OpenXml
4
+ module Pptx
5
+ module Properties
6
+ class ExtensionList < OpenXml::Properties::ContainerProperty
7
+ namespace :p
8
+ tag :extLst
9
+ child_class :extension
10
+
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,32 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class Font < OpenXml::Properties::ComplexProperty
5
+ namespace :p
6
+ tag :font
7
+
8
+ # TODO: Add charset, panose, and pitchFamily attributes
9
+ attribute :typeface, expects: :string, required: true
10
+
11
+ def initialize(value)
12
+ super()
13
+ raise ArgumentError, invalid_message unless value.is_a?(String)
14
+ self.typeface = value
15
+ end
16
+
17
+ def invalid_message
18
+ "Invalid font: value must be a string indicating the typeface"
19
+ end
20
+
21
+ private
22
+
23
+ # Overridden since typeface _can_ be a zero-length string
24
+ def string(value)
25
+ message = "Invalid typeface: must be a string"
26
+ raise ArgumentError, message unless value.is_a?(String)
27
+ end
28
+
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,12 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class FontReference < OpenXml::Properties::ComplexProperty
5
+ with_namespace :r do
6
+ attribute :rid, displays_as: :id, expects: :string
7
+ end
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ require "openxml/pptx/properties/font_reference"
2
+
3
+ module OpenXml
4
+ module Pptx
5
+ module Properties
6
+ class FontReferenceBold < FontReference
7
+ namespace :p
8
+ tag :bold
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require "openxml/pptx/properties/font_reference"
2
+
3
+ module OpenXml
4
+ module Pptx
5
+ module Properties
6
+ class FontReferenceBoldItalic < FontReference
7
+ namespace :p
8
+ tag :boldItalic
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require "openxml/pptx/properties/font_reference"
2
+
3
+ module OpenXml
4
+ module Pptx
5
+ module Properties
6
+ class FontReferenceItalic < FontReference
7
+ namespace :p
8
+ tag :italic
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ require "openxml/pptx/properties/font_reference"
2
+
3
+ module OpenXml
4
+ module Pptx
5
+ module Properties
6
+ class FontReferenceRegular < FontReference
7
+ namespace :p
8
+ tag :regular
9
+
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,20 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class GraphicFrame < OpenXml::Properties::ComplexProperty
5
+ include OpenXml::ContainsProperties
6
+ namespace :p
7
+ tag :graphicFrame
8
+
9
+ attribute :bw_mode, one_of: OpenXml::Pptx::ST_BlackWhiteMode
10
+
11
+ property :non_visual_graphic_frame_properties, required: true
12
+ property :transform, required: true
13
+ property :graphic, klass: OpenXml::DrawingML::Properties::Graphic, required: true
14
+
15
+ property :extension_list
16
+
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,34 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class GroupShapeProperties < OpenXml::Properties::ComplexProperty
5
+ include OpenXml::ContainsProperties
6
+ include OpenXml::RenderWhenEmpty
7
+ namespace :p
8
+ tag :grpSpPr
9
+
10
+ attribute :bw_mode, one_of: OpenXml::Pptx::ST_BlackWhiteMode
11
+
12
+ property :transform, klass: OpenXml::DrawingML::Properties::GroupTransform
13
+
14
+ property_choice do
15
+ value_property :no_fill, klass: OpenXml::DrawingML::Properties::FillNone
16
+ property :solid_fill, klass: OpenXml::DrawingML::Properties::FillSolid
17
+ property :gradient_fill, klass: OpenXml::DrawingML::Properties::FillGradient
18
+ property :pattern_fill, klass: OpenXml::DrawingML::Properties::FillPattern
19
+ property :blip_fill, klass: OpenXml::DrawingML::Properties::FillBlip
20
+ value_property :inherit_group_fill, klass: OpenXml::DrawingML::Properties::FillGroup
21
+ end
22
+
23
+ property_choice do
24
+ property :effect_list, klass: OpenXml::DrawingML::Properties::EffectList
25
+ property :effect_dag, klass: OpenXml::DrawingML::Properties::EffectDag
26
+ end
27
+
28
+ property :scene_3d, klass: OpenXml::DrawingML::Properties::Scene3d
29
+ property :extension_list, klass: OpenXml::DrawingML::Properties::ExtensionList
30
+
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,18 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class HandoutMasterId < OpenXml::Properties::ComplexProperty
5
+ include OpenXml::ContainsProperties
6
+ namespace :p
7
+ tag :handoutMasterId
8
+
9
+ with_namespace :r do
10
+ attribute :rid, displays_as: :id, expects: :string, required: true
11
+ end
12
+
13
+ property :extension_list
14
+
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,14 @@
1
+ require "openxml/pptx/properties/handout_master_id"
2
+
3
+ module OpenXml
4
+ module Pptx
5
+ module Properties
6
+ class HandoutMasterIdList < OpenXml::Properties::ContainerProperty
7
+ namespace :p
8
+ tag :handoutMasterIdLst
9
+ child_class :handout_master_id
10
+
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class NonVisualConnectionShapeDrawingProperties < SimplePropertyContainerProperty
5
+ include OpenXml::RenderWhenEmpty
6
+ namespace :p
7
+ tag :cNvCxnSpPr
8
+
9
+ property :connection_shape_locks, klass: OpenXml::DrawingML::Properties::ConnectionShapeLocks
10
+ property :connection_start, klass: OpenXml::DrawingML::Properties::ConnectionStart
11
+ property :connection_end, klass: OpenXml::DrawingML::Properties::ConnectionEnd
12
+
13
+ property :extension_list, klass: OpenXml::DrawingML::Properties::ExtensionList
14
+
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class NonVisualConnectionShapeProperties < SimplePropertyContainerProperty
5
+ include OpenXml::RenderWhenEmpty
6
+ namespace :p
7
+ tag :nvCxnSpPr
8
+
9
+ property :non_visual_drawing_properties, required: true
10
+ property :non_visual_connection_shape_drawing_properties, required: true
11
+ property :non_visual_properties, required: true
12
+
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,30 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class NonVisualDrawingProperties < OpenXml::Properties::ComplexProperty
5
+ include OpenXml::ContainsProperties
6
+ include OpenXml::RenderWhenEmpty
7
+ namespace :p
8
+ tag :cNvPr
9
+
10
+ attribute :description, displays_as: :descr, expects: :string
11
+ attribute :hidden, expects: :boolean
12
+ attribute :id, expects: :positive_integer, required: true
13
+ attribute :object_name, displays_as: :name, expects: :string_or_blank, required: true
14
+ attribute :title, expects: :string
15
+
16
+ property :hyperlink_click, klass: OpenXml::DrawingML::Properties::HyperlinkClick
17
+ property :hyperlink_hover, klass: OpenXml::DrawingML::Properties::HyperlinkHover
18
+
19
+ property :extension_list, klass: OpenXml::DrawingML::Properties::ExtensionList
20
+
21
+ def build_required_properties
22
+ super
23
+ self.object_name ||= ""
24
+ self.id ||= object_id % OpenXml::Pptx::MAX_ID
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,15 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class NonVisualGraphicFrameDrawingProperties < SimplePropertyContainerProperty
5
+ include OpenXml::RenderWhenEmpty
6
+ namespace :p
7
+ tag :cNvGraphicFramePr
8
+
9
+ property :graphic_frame_locks, klass: OpenXml::DrawingML::Properties::GraphicFrameLocks
10
+ property :extension_list, klass: OpenXml::DrawingML::Properties::ExtensionList
11
+
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class NonVisualGraphicFrameProperties < SimplePropertyContainerProperty
5
+ include OpenXml::RenderWhenEmpty
6
+ namespace :p
7
+ tag :nvGraphicFramePr
8
+
9
+ property :non_visual_drawing_properties, required: true
10
+ property :non_visual_graphic_frame_drawing_properties, required: true
11
+ property :non_visual_properties, required: true
12
+
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,15 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class NonVisualGroupShapeDrawingProperties < SimplePropertyContainerProperty
5
+ include OpenXml::RenderWhenEmpty
6
+ namespace :p
7
+ tag :cNvGrpSpPr
8
+
9
+ property :group_shape_locks, klass: OpenXml::DrawingML::Properties::GroupShapeLocks
10
+ property :extension_list, klass: OpenXml::DrawingML::Properties::ExtensionList
11
+
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class NonVisualGroupShapeProperties < SimplePropertyContainerProperty
5
+ include OpenXml::RenderWhenEmpty
6
+ namespace :p
7
+ tag :nvGrpSpPr
8
+
9
+ property :non_visual_drawing_properties, required: true
10
+ property :non_visual_group_shape_drawing_properties, required: true
11
+ property :non_visual_properties, required: true
12
+
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class NonVisualPictureProperties < SimplePropertyContainerProperty
5
+ include OpenXml::RenderWhenEmpty
6
+ namespace :p
7
+ tag :nvPicPr
8
+
9
+ property :non_visual_drawing_properties, required: true
10
+ property :non_visual_picture_drawing_properties, required: true
11
+ property :non_visual_properties, required: true
12
+
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class NonVisualPictureDrawingProperties < OpenXml::Properties::ComplexProperty
5
+ include OpenXml::ContainsProperties
6
+ include OpenXml::RenderWhenEmpty
7
+ namespace :p
8
+ tag :cNvPicPr
9
+
10
+ attribute :prefer_relative_resizing, displays_as: :preferRelativeResize, expects: :boolean
11
+
12
+ property :picture_locks, klass: OpenXml::DrawingML::Properties::PictureLocks
13
+ property :extension_list, klass: OpenXml::DrawingML::Properties::ExtensionList
14
+
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,29 @@
1
+ module OpenXml
2
+ module Pptx
3
+ module Properties
4
+ class NonVisualProperties < OpenXml::Properties::ComplexProperty
5
+ include OpenXml::ContainsProperties
6
+ include OpenXml::RenderWhenEmpty
7
+ namespace :p
8
+ tag :nvPr
9
+
10
+ attribute :is_photo, displays_as: :isPhoto, expects: :boolean
11
+ attribute :user_drawn, displays_as: :userDrawn, expects: :boolean
12
+
13
+ property :placeholder
14
+
15
+ property_choice do
16
+ property :audio_cd, klass: OpenXml::DrawingML::Properties::AudioCd
17
+ property :wav_audio_file, klass: OpenXml::DrawingML::Properties::WavAudioFile
18
+ property :audio_file, klass: OpenXml::DrawingML::Properties::AudioFile
19
+ property :video_file, klass: OpenXml::DrawingML::Properties::VideoFile
20
+ property :quick_time_file, klass: OpenXml::DrawingML::Properties::QuickTimeFile
21
+ end
22
+
23
+ property :customer_data_list
24
+ property :extension_list
25
+
26
+ end
27
+ end
28
+ end
29
+ end