openxml-pptx 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +6 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +92 -0
- data/Guardfile +16 -0
- data/LICENSE.txt +21 -0
- data/README.md +46 -0
- data/Rakefile +6 -0
- data/bin/build_fixtures +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/bin/zipflip +56 -0
- data/lib/openxml/pptx.rb +52 -0
- data/lib/openxml/pptx/elements.rb +12 -0
- data/lib/openxml/pptx/package.rb +33 -0
- data/lib/openxml/pptx/parts.rb +12 -0
- data/lib/openxml/pptx/parts/image.rb +32 -0
- data/lib/openxml/pptx/parts/presentation.rb +142 -0
- data/lib/openxml/pptx/parts/presentation_properties.rb +38 -0
- data/lib/openxml/pptx/parts/slide.rb +87 -0
- data/lib/openxml/pptx/parts/slide_layout.rb +88 -0
- data/lib/openxml/pptx/parts/slide_master.rb +132 -0
- data/lib/openxml/pptx/parts/theme.rb +61 -0
- data/lib/openxml/pptx/properties.rb +21 -0
- data/lib/openxml/pptx/properties/background.rb +19 -0
- data/lib/openxml/pptx/properties/background_properties.rb +30 -0
- data/lib/openxml/pptx/properties/background_reference.rb +23 -0
- data/lib/openxml/pptx/properties/blip_fill.rb +11 -0
- data/lib/openxml/pptx/properties/color_mapping.rb +11 -0
- data/lib/openxml/pptx/properties/color_mapping_override.rb +11 -0
- data/lib/openxml/pptx/properties/common_slide_data.rb +21 -0
- data/lib/openxml/pptx/properties/connection_shape.rb +16 -0
- data/lib/openxml/pptx/properties/content_part.rb +13 -0
- data/lib/openxml/pptx/properties/control.rb +36 -0
- data/lib/openxml/pptx/properties/control_list.rb +14 -0
- data/lib/openxml/pptx/properties/custom_show.rb +18 -0
- data/lib/openxml/pptx/properties/custom_show_list.rb +14 -0
- data/lib/openxml/pptx/properties/customer_data.rb +13 -0
- data/lib/openxml/pptx/properties/customer_data_container.rb +12 -0
- data/lib/openxml/pptx/properties/customer_data_list.rb +14 -0
- data/lib/openxml/pptx/properties/data_tags.rb +13 -0
- data/lib/openxml/pptx/properties/default_text_style.rb +24 -0
- data/lib/openxml/pptx/properties/embedded_font.rb +18 -0
- data/lib/openxml/pptx/properties/embedded_font_list.rb +14 -0
- data/lib/openxml/pptx/properties/extension.rb +14 -0
- data/lib/openxml/pptx/properties/extension_list.rb +14 -0
- data/lib/openxml/pptx/properties/font.rb +32 -0
- data/lib/openxml/pptx/properties/font_reference.rb +12 -0
- data/lib/openxml/pptx/properties/font_reference_bold.rb +13 -0
- data/lib/openxml/pptx/properties/font_reference_bold_italic.rb +13 -0
- data/lib/openxml/pptx/properties/font_reference_italic.rb +13 -0
- data/lib/openxml/pptx/properties/font_reference_regular.rb +13 -0
- data/lib/openxml/pptx/properties/graphic_frame.rb +20 -0
- data/lib/openxml/pptx/properties/group_shape_properties.rb +34 -0
- data/lib/openxml/pptx/properties/handout_master_id.rb +18 -0
- data/lib/openxml/pptx/properties/handout_master_id_list.rb +14 -0
- data/lib/openxml/pptx/properties/non_visual_connection_shape_drawing_properties.rb +18 -0
- data/lib/openxml/pptx/properties/non_visual_connection_shape_properties.rb +16 -0
- data/lib/openxml/pptx/properties/non_visual_drawing_properties.rb +30 -0
- data/lib/openxml/pptx/properties/non_visual_graphic_frame_drawing_properties.rb +15 -0
- data/lib/openxml/pptx/properties/non_visual_graphic_frame_properties.rb +16 -0
- data/lib/openxml/pptx/properties/non_visual_group_shape_drawing_properties.rb +15 -0
- data/lib/openxml/pptx/properties/non_visual_group_shape_properties.rb +16 -0
- data/lib/openxml/pptx/properties/non_visual_picture_properties.rb +16 -0
- data/lib/openxml/pptx/properties/non_visual_picutre_drawing_properties.rb +18 -0
- data/lib/openxml/pptx/properties/non_visual_properties.rb +29 -0
- data/lib/openxml/pptx/properties/non_visual_shape_drawing_properties.rb +18 -0
- data/lib/openxml/pptx/properties/non_visual_shape_properties.rb +16 -0
- data/lib/openxml/pptx/properties/notes_master_id.rb +18 -0
- data/lib/openxml/pptx/properties/notes_master_id_list.rb +14 -0
- data/lib/openxml/pptx/properties/notes_size.rb +14 -0
- data/lib/openxml/pptx/properties/photo_album.rb +19 -0
- data/lib/openxml/pptx/properties/picture.rb +30 -0
- data/lib/openxml/pptx/properties/placeholder.rb +20 -0
- data/lib/openxml/pptx/properties/shape.rb +34 -0
- data/lib/openxml/pptx/properties/shape_group.rb +18 -0
- data/lib/openxml/pptx/properties/shape_properties.rb +11 -0
- data/lib/openxml/pptx/properties/shape_style.rb +11 -0
- data/lib/openxml/pptx/properties/shape_tree.rb +13 -0
- data/lib/openxml/pptx/properties/shapes_container.rb +18 -0
- data/lib/openxml/pptx/properties/simple_boolean_property.rb +16 -0
- data/lib/openxml/pptx/properties/simple_property_container_property.rb +14 -0
- data/lib/openxml/pptx/properties/slide_id.rb +29 -0
- data/lib/openxml/pptx/properties/slide_id_list.rb +14 -0
- data/lib/openxml/pptx/properties/slide_layout_id.rb +26 -0
- data/lib/openxml/pptx/properties/slide_layout_id_list.rb +14 -0
- data/lib/openxml/pptx/properties/slide_list.rb +14 -0
- data/lib/openxml/pptx/properties/slide_master_id.rb +29 -0
- data/lib/openxml/pptx/properties/slide_master_id_list.rb +14 -0
- data/lib/openxml/pptx/properties/slide_reference.rb +15 -0
- data/lib/openxml/pptx/properties/slide_size.rb +16 -0
- data/lib/openxml/pptx/properties/smart_tags.rb +15 -0
- data/lib/openxml/pptx/properties/text_body.rb +11 -0
- data/lib/openxml/pptx/properties/text_style_body.rb +11 -0
- data/lib/openxml/pptx/properties/text_style_other.rb +11 -0
- data/lib/openxml/pptx/properties/text_style_title.rb +11 -0
- data/lib/openxml/pptx/properties/text_styles.rb +17 -0
- data/lib/openxml/pptx/properties/transform.rb +11 -0
- data/lib/openxml/pptx/properties/transparent_container_property.rb +14 -0
- data/lib/openxml/pptx/relatable_part.rb +100 -0
- data/lib/openxml/pptx/version.rb +5 -0
- data/openxml-pptx.gemspec +33 -0
- metadata +258 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literals: true
|
2
|
+
require "openxml/drawingml/parts/theme"
|
3
|
+
|
4
|
+
module OpenXml
|
5
|
+
module Pptx
|
6
|
+
module Parts
|
7
|
+
class Theme < OpenXml::DrawingML::Parts::Theme
|
8
|
+
include OpenXml::RelatablePart
|
9
|
+
|
10
|
+
relationship_type "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"
|
11
|
+
content_type "application/vnd.openxmlformats-officedocument.theme+xml"
|
12
|
+
default_path "ppt/theme/theme.xml"
|
13
|
+
|
14
|
+
def relationships_path; end
|
15
|
+
|
16
|
+
# Default theme
|
17
|
+
def self.office_theme
|
18
|
+
new.tap do |theme|
|
19
|
+
theme.theme_name = "Office Theme"
|
20
|
+
theme.theme_elements.color_scheme.tap do |scheme|
|
21
|
+
scheme.scheme_name = "Office"
|
22
|
+
scheme.dark_one.system_color = :windowText
|
23
|
+
scheme.dark_one.system_color.last_color = "000000"
|
24
|
+
scheme.light_one.system_color = :window
|
25
|
+
scheme.light_one.system_color.last_color = "FFFFFF"
|
26
|
+
scheme.dark_two.rgb = "44546A"
|
27
|
+
scheme.light_two.rgb = "E7E6E6"
|
28
|
+
scheme.accent_one.rgb = "4472C4"
|
29
|
+
scheme.accent_two.rgb = "ED7D31"
|
30
|
+
scheme.accent_three.rgb = "A5A5A5"
|
31
|
+
scheme.accent_four.rgb = "FFC000"
|
32
|
+
scheme.accent_five.rgb = "5B9BD5"
|
33
|
+
scheme.accent_six.rgb = "70AD47"
|
34
|
+
scheme.hyperlink.rgb = "0563C1"
|
35
|
+
scheme.followed_hyperlink.rgb = "954F72"
|
36
|
+
end
|
37
|
+
theme.theme_elements.font_scheme.tap do |scheme|
|
38
|
+
scheme.scheme_name = "Office"
|
39
|
+
scheme.major_font.latin_font = "Calibri Light"
|
40
|
+
scheme.major_font.east_asian_font = ""
|
41
|
+
scheme.major_font.complex_script_font = ""
|
42
|
+
scheme.minor_font.latin_font = "Calibri"
|
43
|
+
scheme.minor_font.east_asian_font = ""
|
44
|
+
scheme.minor_font.complex_script_font = ""
|
45
|
+
end
|
46
|
+
theme.theme_elements.format_scheme.tap do |scheme|
|
47
|
+
scheme.scheme_name = "Office"
|
48
|
+
3.times do
|
49
|
+
scheme.fill_style_list << OpenXml::DrawingML::Properties::FillNone.new(true)
|
50
|
+
scheme.line_style_list << OpenXml::DrawingML::Properties::Outline.new
|
51
|
+
scheme.effect_style_list << OpenXml::DrawingML::Properties::EffectStyle.new.tap(&:effect_list)
|
52
|
+
scheme.background_fill_style_list << OpenXml::DrawingML::Properties::FillNone.new(true)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
end
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
require "openxml/properties"
|
9
|
+
require "openxml/has_properties"
|
10
|
+
require "openxml/has_children"
|
11
|
+
require "openxml/has_attributes"
|
12
|
+
require "openxml/contains_properties"
|
13
|
+
require "openxml/render_when_empty"
|
14
|
+
|
15
|
+
require "openxml/pptx/properties/simple_boolean_property"
|
16
|
+
require "openxml/pptx/properties/simple_property_container_property"
|
17
|
+
require "openxml/pptx/properties/transparent_container_property"
|
18
|
+
|
19
|
+
Dir.glob("#{File.join(File.dirname(__FILE__), "properties", "*.rb")}").each do |file|
|
20
|
+
require file
|
21
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class Background < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :bg
|
8
|
+
|
9
|
+
attribute :bw_mode, one_of: OpenXml::Pptx::ST_BlackWhiteMode
|
10
|
+
|
11
|
+
property_choice do
|
12
|
+
property :background_properties
|
13
|
+
property :background_reference
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class BackgroundProperties < OpenXml::Properties::ComplexProperty
|
5
|
+
include ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :bgPr
|
8
|
+
|
9
|
+
attribute :shade_to_title, displays_as: :shadeToTitle, expects: :boolean
|
10
|
+
|
11
|
+
property_choice do
|
12
|
+
value_property :no_fill, klass: OpenXml::DrawingML::Properties::FillNone
|
13
|
+
property :solid_fill, klass: OpenXml::DrawingML::Properties::FillSolid
|
14
|
+
property :gradient_fill, klass: OpenXml::DrawingML::Properties::FillGradient
|
15
|
+
property :pattern_fill, klass: OpenXml::DrawingML::Properties::FillPattern
|
16
|
+
property :blip_fill, klass: OpenXml::DrawingML::Properties::FillBlip
|
17
|
+
value_property :inherit_group_fill, klass: OpenXml::DrawingML::Properties::FillGroup
|
18
|
+
end
|
19
|
+
|
20
|
+
property_choice do
|
21
|
+
property :effect_list, klass: OpenXml::DrawingML::Properties::EffectList
|
22
|
+
property :effect_dag, klass: OpenXml::DrawingML::Properties::EffectDag
|
23
|
+
end
|
24
|
+
|
25
|
+
property :extension_list
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class BackgroundReference < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :bgRef
|
8
|
+
|
9
|
+
attribute :index, displays_as: :idx, expects: :positive_integer, required: true
|
10
|
+
|
11
|
+
property_choice required: true do
|
12
|
+
property :component_rgb, klass: OpenXml::DrawingML::Properties::ColorComponentRgb
|
13
|
+
value_property :rgb, klass: OpenXml::DrawingML::Properties::ColorHexRgb
|
14
|
+
property :hsl, klass: OpenXml::DrawingML::Properties::ColorHsl
|
15
|
+
value_property :system_color, klass: OpenXml::DrawingML::Properties::ColorSystemColor
|
16
|
+
value_property :scheme_color, klass: OpenXml::DrawingML::Properties::ColorSchemeColor
|
17
|
+
value_property :preset_color, klass: OpenXml::DrawingML::Properties::ColorPresetColor
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class CommonSlideData < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
include OpenXml::RenderWhenEmpty
|
7
|
+
namespace :p
|
8
|
+
tag :cSld
|
9
|
+
|
10
|
+
attribute :slide_name, displays_as: :name, expects: :string
|
11
|
+
|
12
|
+
property :background
|
13
|
+
property :shape_tree, required: true
|
14
|
+
property :customer_data_list
|
15
|
+
property :control_list
|
16
|
+
property :extension_list
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class ConnectionShape < SimplePropertyContainerProperty
|
5
|
+
namespace :p
|
6
|
+
tag :cxnSp
|
7
|
+
|
8
|
+
property :non_visual_connection_shape_properties, required: true
|
9
|
+
property :shape_properties, required: true
|
10
|
+
property :shape_style
|
11
|
+
property :extension_list
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class ContentPart < OpenXml::Properties::ComplexProperty
|
5
|
+
namespace :p
|
6
|
+
tag :contentPart
|
7
|
+
|
8
|
+
attribute :rid, displays_as: :id, namespace: :r, expects: :string, required: true
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class Control < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :control
|
8
|
+
|
9
|
+
attribute :control_name, displays_as: :name, expects: :string
|
10
|
+
attribute :show_as_icon, displays_as: :showAsIcon, expects: :boolean
|
11
|
+
attribute :rid, displays_as: :id, namespace: :r, expects: :string
|
12
|
+
attribute :image_width, displays_as: :imgW, expects: :positive_coordinate
|
13
|
+
attribute :image_height, displays_as: :imgH, expects: :positive_coordinate
|
14
|
+
|
15
|
+
property :extension_list
|
16
|
+
property :picture
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def positive_coordinate(value)
|
21
|
+
message = "Invalid: must be a positive integer or include a unit"
|
22
|
+
raise ArgumentError, message unless positive_integer?(value) || positive_universal_measure?(value)
|
23
|
+
end
|
24
|
+
|
25
|
+
def positive_integer?(value)
|
26
|
+
value.is_a?(Integer) && value >= 0
|
27
|
+
end
|
28
|
+
|
29
|
+
def positive_universal_measure?(value)
|
30
|
+
value.is_a?(String) && value =~ OpenXml::DrawingML::ST_PositiveUniversalMeasure
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class CustomShow < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :custShow
|
8
|
+
|
9
|
+
attribute :id, expects: :positive_integer, required: true
|
10
|
+
attribute :show_name, displays_as: :name, expects: :string, required: true
|
11
|
+
|
12
|
+
property :slide_list, required: true
|
13
|
+
property :extension_list
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "openxml/pptx/properties/custom_show"
|
2
|
+
|
3
|
+
module OpenXml
|
4
|
+
module Pptx
|
5
|
+
module Properties
|
6
|
+
class CustomShowList < OpenXml::Properties::ContainerProperty
|
7
|
+
namespace :p
|
8
|
+
tag :custShowLst
|
9
|
+
child_class :custom_show
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class CustomerData < OpenXml::Properties::ComplexProperty
|
5
|
+
namespace :p
|
6
|
+
tag :custData
|
7
|
+
|
8
|
+
attribute :rid, displays_as: :id, namespace: :r, expects: :string, required: true
|
9
|
+
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class CustomerDataList < SimplePropertyContainerProperty
|
5
|
+
namespace :p
|
6
|
+
tag :custDataLst
|
7
|
+
|
8
|
+
property :data, as: :customer_data_container
|
9
|
+
property :tags, as: :data_tags
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class DefaultTextStyle < SimplePropertyContainerProperty
|
5
|
+
namespace :p
|
6
|
+
tag :defaultTextStyle
|
7
|
+
|
8
|
+
property :default_paragraph_properties, klass: OpenXml::DrawingML::Properties::DefaultParagraphProperties
|
9
|
+
property :level1_paragraph_properties, klass: OpenXml::DrawingML::Properties::Level1ParagraphProperties
|
10
|
+
property :level2_paragraph_properties, klass: OpenXml::DrawingML::Properties::Level2ParagraphProperties
|
11
|
+
property :level3_paragraph_properties, klass: OpenXml::DrawingML::Properties::Level3ParagraphProperties
|
12
|
+
property :level4_paragraph_properties, klass: OpenXml::DrawingML::Properties::Level4ParagraphProperties
|
13
|
+
property :level5_paragraph_properties, klass: OpenXml::DrawingML::Properties::Level5ParagraphProperties
|
14
|
+
property :level6_paragraph_properties, klass: OpenXml::DrawingML::Properties::Level6ParagraphProperties
|
15
|
+
property :level7_paragraph_properties, klass: OpenXml::DrawingML::Properties::Level7ParagraphProperties
|
16
|
+
property :level8_paragraph_properties, klass: OpenXml::DrawingML::Properties::Level8ParagraphProperties
|
17
|
+
property :level9_paragraph_properties, klass: OpenXml::DrawingML::Properties::Level9ParagraphProperties
|
18
|
+
|
19
|
+
property :extension_list
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class EmbeddedFont < SimplePropertyContainerProperty
|
5
|
+
namespace :p
|
6
|
+
tag :embeddedFont
|
7
|
+
|
8
|
+
value_property :font, required: true, default_value: "Calibri"
|
9
|
+
|
10
|
+
property :regular, as: :font_reference_regular
|
11
|
+
property :bold, as: :font_reference_bold
|
12
|
+
property :italic, as: :font_reference_italic
|
13
|
+
property :bold_italic, as: :font_reference_italic
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|