Class: OpenXml::Pptx::Parts::SlideLayout
- Inherits:
-
OpenXml::Part
- Object
- OpenXml::Part
- OpenXml::Pptx::Parts::SlideLayout
- Includes:
- ContainsProperties, HasAttributes, RelatablePart
- Defined in:
- lib/openxml/pptx/parts/slide_layout.rb
Instance Attribute Summary collapse
-
#images ⇒ Object
readonly
Returns the value of attribute images.
Attributes included from RelatablePart
Instance Method Summary collapse
- #add_image(image_part) ⇒ Object
- #background_properties ⇒ Object
- #build_image_part(path) ⇒ Object
-
#initialize(*_args) ⇒ SlideLayout
constructor
A new instance of SlideLayout.
-
#name ⇒ Object
Necessary for HasAttributes.
- #set_slide_master(master) ⇒ Object
-
#shapes ⇒ Object
Convenience accessors.
- #to_xml ⇒ Object
Methods included from RelatablePart
#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
#initialize(*_args) ⇒ SlideLayout
Returns a new instance of SlideLayout.
33 34 35 36 |
# File 'lib/openxml/pptx/parts/slide_layout.rb', line 33 def initialize(*_args) super @images = [] end |
Instance Attribute Details
#images ⇒ Object (readonly)
Returns the value of attribute images.
10 11 12 |
# File 'lib/openxml/pptx/parts/slide_layout.rb', line 10 def images @images end |
Instance Method Details
#add_image(image_part) ⇒ Object
47 48 49 50 51 |
# File 'lib/openxml/pptx/parts/slide_layout.rb', line 47 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 |
#background_properties ⇒ Object
73 74 75 |
# File 'lib/openxml/pptx/parts/slide_layout.rb', line 73 def background_properties .background.background_properties end |
#build_image_part(path) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/openxml/pptx/parts/slide_layout.rb', line 53 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 |
#name ⇒ Object
Necessary for HasAttributes
39 40 41 |
# File 'lib/openxml/pptx/parts/slide_layout.rb', line 39 def name "slide_layout" end |
#set_slide_master(master) ⇒ Object
43 44 45 |
# File 'lib/openxml/pptx/parts/slide_layout.rb', line 43 def (master) add_relationship master.relationship_type, master.path end |
#shapes ⇒ Object
Convenience accessors
69 70 71 |
# File 'lib/openxml/pptx/parts/slide_layout.rb', line 69 def shapes .shape_tree.shapes end |
#to_xml ⇒ Object
60 61 62 63 64 65 66 |
# File 'lib/openxml/pptx/parts/slide_layout.rb', line 60 def to_xml build_standalone_xml do |xml| xml[:p].sldLayout(namespaces.merge(xml_attributes)) do property_xml(xml) end end end |