Class: OpenXml::Pptx::Parts::SlideMaster
- Inherits:
-
OpenXml::Part
- Object
- OpenXml::Part
- OpenXml::Pptx::Parts::SlideMaster
show all
- Includes:
- ContainsProperties, HasAttributes, RelatablePart
- Defined in:
- lib/openxml/pptx/parts/slide_master.rb
Instance Attribute Summary collapse
#parent
Instance Method Summary
collapse
#add_child_part, #add_override, #add_part, #add_relationship, #content_type, #file_name, included, #indexed_path, #path, #path=, #relationship_type, #relationships, #relationships_by_path, #relationships_path
Constructor Details
Returns a new instance of SlideMaster.
31
32
33
34
35
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 31
def initialize(*_args)
super
@layouts = []
@images = []
end
|
Instance Attribute Details
#images ⇒ Object
Returns the value of attribute images.
10
11
12
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 10
def images
@images
end
|
#layouts ⇒ Object
Returns the value of attribute layouts.
10
11
12
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 10
def layouts
@layouts
end
|
#theme ⇒ Object
Returns the value of attribute theme.
10
11
12
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 10
def theme
@theme
end
|
Instance Method Details
#add_image(image_part) ⇒ Object
63
64
65
66
67
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 63
def add_image(image_part)
images.push(image_part)
index = (parent && parent.next_image_index) || images.count
add_child_part(image_part, with_index: index)
end
|
#add_slide_layout(layout) ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 47
def add_slide_layout(layout)
layouts.push(layout)
add_child_part(layout, with_index: layouts.count)
slide_layout_id_list << OpenXml::Pptx::Properties::SlideLayoutId.new.tap do |layout_id|
layout_id.rid = relationships_by_path[layout.path].id
end
end
|
#background_properties ⇒ Object
100
101
102
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 100
def background_properties
common_slide_data.background.background_properties
end
|
#build_image_part(path) ⇒ Object
69
70
71
72
73
74
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 69
def build_image_part(path)
path = Pathname.new(path)
OpenXml::Pptx::Parts::Image.new(path.read, extension: path.extname).tap do |image|
add_image(image)
end
end
|
#build_required_properties ⇒ Object
88
89
90
91
92
93
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 88
def build_required_properties
super
DEFAULT_COLOR_MAPPING.each do |key, value|
color_mapping.public_send(:"#{key}=", value)
end
end
|
#build_slide_layout(named: nil) ⇒ Object
55
56
57
58
59
60
61
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 55
def build_slide_layout(named: nil)
OpenXml::Pptx::Parts::SlideLayout.new.tap do |layout|
layout.set_slide_master(self)
layout.common_slide_data.slide_name = named unless named.nil?
add_slide_layout(layout)
end
end
|
#name ⇒ Object
Necessary for HasAttributes
38
39
40
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 38
def name
"slide_master"
end
|
#next_image_index ⇒ Object
76
77
78
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 76
def next_image_index
@image_index = (parent && parent.next_image_index) || @image_index + 1
end
|
#set_theme(theme) ⇒ Object
42
43
44
45
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 42
def set_theme(theme)
@theme = theme
add_relationship theme.relationship_type, theme.path
end
|
#shapes ⇒ Object
96
97
98
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 96
def shapes
common_slide_data.shape_tree.shapes
end
|
#to_xml ⇒ Object
80
81
82
83
84
85
86
|
# File 'lib/openxml/pptx/parts/slide_master.rb', line 80
def to_xml
build_standalone_xml do |xml|
xml[:p].sldMaster(namespaces.merge(xml_attributes)) do
property_xml(xml)
end
end
end
|