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,18 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class NonVisualShapeDrawingProperties < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
include OpenXml::RenderWhenEmpty
|
7
|
+
namespace :p
|
8
|
+
tag :cNvSpPr
|
9
|
+
|
10
|
+
attribute :is_textbox, displays_as: :txBox, expects: :boolean
|
11
|
+
|
12
|
+
property :shape_locks, klass: OpenXml::DrawingML::Properties::ShapeLocks
|
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 NonVisualShapeProperties < SimplePropertyContainerProperty
|
5
|
+
include OpenXml::RenderWhenEmpty
|
6
|
+
namespace :p
|
7
|
+
tag :nvSpPr
|
8
|
+
|
9
|
+
property :non_visual_drawing_properties, required: true
|
10
|
+
property :non_visual_shape_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 NotesMasterId < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :notesMasterId
|
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/notes_master_id"
|
2
|
+
|
3
|
+
module OpenXml
|
4
|
+
module Pptx
|
5
|
+
module Properties
|
6
|
+
class NotesMasterIdList < OpenXml::Properties::ContainerProperty
|
7
|
+
namespace :p
|
8
|
+
tag :notesMasterIdLst
|
9
|
+
child_class :notes_master_id
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class NotesSize < OpenXml::Properties::ComplexProperty
|
5
|
+
namespace :p
|
6
|
+
tag :notesSz
|
7
|
+
|
8
|
+
attribute :length, displays_as: :cx, expects: :positive_integer, required: true
|
9
|
+
attribute :width, displays_as: :cy, expects: :positive_integer, required: true
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class PhotoAlbum < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :photoAlbum
|
8
|
+
|
9
|
+
attribute :black_and_white, displays_as: :bw, expects: :boolean
|
10
|
+
attribute :frame, one_of: OpenXml::Pptx::ST_PhotoAlbumFrameShape
|
11
|
+
attribute :layout, one_of: OpenXml::Pptx::ST_PhotoAlbumLayout
|
12
|
+
attribute :show_captions, expects: :boolean
|
13
|
+
|
14
|
+
property :extension_list
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
|
3
|
+
module OpenXml
|
4
|
+
module Pptx
|
5
|
+
module Properties
|
6
|
+
class Picture < SimplePropertyContainerProperty
|
7
|
+
extend Forwardable
|
8
|
+
namespace :p
|
9
|
+
tag :pic
|
10
|
+
|
11
|
+
property :non_visual_picture_properties, required: true
|
12
|
+
property :blip_fill, required: true
|
13
|
+
property :shape_properties, required: true
|
14
|
+
property :shape_style
|
15
|
+
property :extension_list
|
16
|
+
|
17
|
+
# Convenience Accessors
|
18
|
+
def_delegator :non_visual_picture_properties, :non_visual_drawing_properties
|
19
|
+
def_delegator :non_visual_drawing_properties, :object_name, :picture_name
|
20
|
+
def_delegator :non_visual_drawing_properties, :object_name=, :picture_name=
|
21
|
+
def_delegator :non_visual_drawing_properties, :id, :picture_id
|
22
|
+
def_delegator :non_visual_drawing_properties, :id=, :picture_id=
|
23
|
+
def_delegator :shape_properties, :transform
|
24
|
+
def_delegator :transform, :offset
|
25
|
+
def_delegator :transform, :extent
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class Placeholder < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :ph
|
8
|
+
|
9
|
+
attribute :type, one_of: OpenXml::Pptx::ST_PlaceholderType
|
10
|
+
attribute :orientation, one_of: OpenXml::Pptx::ST_Direction
|
11
|
+
attribute :size, one_of: OpenXml::Pptx::ST_PlaceholderSize
|
12
|
+
attribute :index, displays_as: :idx, expects: :positive_integer
|
13
|
+
attribute :has_custom_prompt, displays_as: :hasCustomPrompt, expects: :boolean
|
14
|
+
|
15
|
+
property :extension_list
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
|
3
|
+
module OpenXml
|
4
|
+
module Pptx
|
5
|
+
module Properties
|
6
|
+
class Shape < OpenXml::Properties::ComplexProperty
|
7
|
+
include OpenXml::ContainsProperties
|
8
|
+
extend Forwardable
|
9
|
+
namespace :p
|
10
|
+
tag :sp
|
11
|
+
|
12
|
+
attribute :use_background_fill, displays_as: :useBgFill, expects: :boolean
|
13
|
+
|
14
|
+
property :non_visual_shape_properties, required: true
|
15
|
+
property :shape_properties, required: true
|
16
|
+
property :style, as: :shape_style
|
17
|
+
property :text_body
|
18
|
+
|
19
|
+
property :extension_list
|
20
|
+
|
21
|
+
# Convenience Accessors
|
22
|
+
def_delegator :non_visual_shape_properties, :non_visual_drawing_properties
|
23
|
+
def_delegator :non_visual_drawing_properties, :object_name, :shape_name
|
24
|
+
def_delegator :non_visual_drawing_properties, :object_name=, :shape_name=
|
25
|
+
def_delegator :non_visual_drawing_properties, :id, :shape_id
|
26
|
+
def_delegator :non_visual_drawing_properties, :id=, :shape_id=
|
27
|
+
def_delegator :shape_properties, :transform
|
28
|
+
def_delegator :transform, :offset
|
29
|
+
def_delegator :transform, :extent
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class ShapeGroup < SimplePropertyContainerProperty
|
5
|
+
namespace :p
|
6
|
+
tag :grpSp
|
7
|
+
|
8
|
+
property :non_visual_group_shape_properties, required: true
|
9
|
+
property :group_shape_properties, required: true
|
10
|
+
|
11
|
+
property :shapes, as: :shapes_container
|
12
|
+
|
13
|
+
property :extension_list
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "openxml/pptx/properties/shape"
|
2
|
+
require "openxml/pptx/properties/shape_group"
|
3
|
+
require "openxml/pptx/properties/graphic_frame"
|
4
|
+
require "openxml/pptx/properties/connection_shape"
|
5
|
+
require "openxml/pptx/properties/picture"
|
6
|
+
require "openxml/pptx/properties/content_part"
|
7
|
+
|
8
|
+
module OpenXml
|
9
|
+
module Pptx
|
10
|
+
module Properties
|
11
|
+
class ShapesContainer < TransparentContainerProperty
|
12
|
+
child_classes :shape, :shape_group, :graphic_frame, :connection_shape,
|
13
|
+
:picture, :content_part
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class SimpleBooleanProperty < OpenXml::Properties::BooleanProperty
|
5
|
+
|
6
|
+
def to_xml(xml)
|
7
|
+
return unless value
|
8
|
+
apply_namespace(xml).public_send(tag) do
|
9
|
+
yield xml if block_given?
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class SlideId < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :sldId
|
8
|
+
|
9
|
+
attribute :id, expects: :integer, in_range: OpenXml::Pptx::SLIDE_ID_RANGE, required: true
|
10
|
+
|
11
|
+
with_namespace :r do
|
12
|
+
attribute :rid, displays_as: :id, expects: :string, required: true
|
13
|
+
end
|
14
|
+
|
15
|
+
property :extension_list
|
16
|
+
|
17
|
+
def initialize(*_args)
|
18
|
+
super
|
19
|
+
generate_id
|
20
|
+
end
|
21
|
+
|
22
|
+
def generate_id
|
23
|
+
self.id = object_id % OpenXml::Pptx::SLIDE_ID_RANGE.end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class SlideLayoutId < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :sldLayoutId
|
8
|
+
|
9
|
+
attribute :id, expects: :integer, in_range: OpenXml::Pptx::MASTER_LAYOUT_ID_RANGE
|
10
|
+
attribute :rid, displays_as: :id, namespace: :r, expects: :string, required: true
|
11
|
+
|
12
|
+
property :extension_list
|
13
|
+
|
14
|
+
def initialize(*_args)
|
15
|
+
super
|
16
|
+
generate_id
|
17
|
+
end
|
18
|
+
|
19
|
+
def generate_id
|
20
|
+
self.id = OpenXml::Pptx::MASTER_LAYOUT_ID_RANGE.begin + object_id % OpenXml::Pptx::MASTER_LAYOUT_ID_RANGE.begin
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "openxml/pptx/properties/slide_layout_id"
|
2
|
+
|
3
|
+
module OpenXml
|
4
|
+
module Pptx
|
5
|
+
module Properties
|
6
|
+
class SlideLayoutIdList < OpenXml::Properties::ContainerProperty
|
7
|
+
namespace :p
|
8
|
+
tag :sldLayoutIdLst
|
9
|
+
child_class :slide_layout_id
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module OpenXml
|
2
|
+
module Pptx
|
3
|
+
module Properties
|
4
|
+
class SlideMasterId < OpenXml::Properties::ComplexProperty
|
5
|
+
include OpenXml::ContainsProperties
|
6
|
+
namespace :p
|
7
|
+
tag :sldMasterId
|
8
|
+
|
9
|
+
attribute :id, expects: :integer, in_range: OpenXml::Pptx::MASTER_LAYOUT_ID_RANGE
|
10
|
+
|
11
|
+
with_namespace :r do
|
12
|
+
attribute :rid, displays_as: :id, expects: :string, required: true
|
13
|
+
end
|
14
|
+
|
15
|
+
property :extension_list
|
16
|
+
|
17
|
+
def initialize(*_args)
|
18
|
+
super
|
19
|
+
generate_id
|
20
|
+
end
|
21
|
+
|
22
|
+
def generate_id
|
23
|
+
self.id = OpenXml::Pptx::MASTER_LAYOUT_ID_RANGE.begin + object_id % OpenXml::Pptx::MASTER_LAYOUT_ID_RANGE.begin
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|