Class: OoxmlParser::Slide
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::Slide
- Includes:
- SlideHelper
- Defined in:
- lib/ooxml_parser/pptx_parser/presentation/slide.rb
Overview
Class for parsing ‘slide.xml`
Instance Attribute Summary collapse
-
#alternate_content ⇒ Object
Returns the value of attribute alternate_content.
-
#common_slide_data ⇒ CommonSlideData
readonly
Common slide data.
-
#name ⇒ String
readonly
Name of slide.
-
#note ⇒ Notes
readonly
Note of slide.
-
#relationships ⇒ Relationships
readonly
Relationships of slide.
-
#timing ⇒ Object
Returns the value of attribute timing.
-
#transition ⇒ Object
Returns the value of attribute transition.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#background ⇒ Background
Background of slide.
-
#elements ⇒ Array
List of elements on slide.
-
#initialize(parent: nil, xml_path: nil) ⇒ Slide
constructor
A new instance of Slide.
-
#parse ⇒ Slide
Parse Slide object.
-
#with_data? ⇒ True, False
Is slide with data.
Methods included from SlideHelper
#content_distribute, #content_horizontal_align, #content_vertical_align, #graphic_frames, #nonempty_elements, #transform_of_object
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil, xml_path: nil) ⇒ Slide
Returns a new instance of Slide.
26 27 28 29 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 26 def initialize(parent: nil, xml_path: nil) @xml_path = xml_path super(parent: parent) end |
Instance Attribute Details
#alternate_content ⇒ Object
Returns the value of attribute alternate_content.
16 17 18 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 16 def alternate_content @alternate_content end |
#common_slide_data ⇒ CommonSlideData (readonly)
Returns common slide data.
18 19 20 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 18 def @common_slide_data end |
#name ⇒ String (readonly)
Returns name of slide.
22 23 24 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 22 def name @name end |
#note ⇒ Notes (readonly)
Returns note of slide.
24 25 26 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 24 def note @note end |
#relationships ⇒ Relationships (readonly)
Returns relationships of slide.
20 21 22 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 20 def relationships @relationships end |
#timing ⇒ Object
Returns the value of attribute timing.
16 17 18 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 16 def timing @timing end |
#transition ⇒ Object
Returns the value of attribute transition.
16 17 18 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 16 def transition @transition end |
Instance Method Details
#background ⇒ Background
Returns background of slide.
47 48 49 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 47 def background @common_slide_data.background end |
#elements ⇒ Array
Returns List of elements on slide.
42 43 44 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 42 def elements @common_slide_data.shape_tree.elements end |
#parse ⇒ Slide
Parse Slide object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 53 def parse root_object.add_to_xmls_stack(@xml_path) @name = File.basename(@xml_path, '.*') node = parse_xml(root_object.current_xml) node.xpath('//p:sld/*').each do |node_child| case node_child.name when 'cSld' @common_slide_data = CommonSlideData.new(parent: self).parse(node_child) when 'timing' @timing = Timing.new(parent: self).parse(node_child) when 'transition' @transition = Transition.new(parent: self).parse(node_child) when 'AlternateContent' @alternate_content = PresentationAlternateContent.new(parent: self).parse(node_child) end end root_object.xmls_stack.pop @relationships = Relationships.new(parent: self).parse_file("#{root_object.unpacked_folder}#{File.dirname(@xml_path)}/_rels/#{@name}.xml.rels") parse_note self end |
#with_data? ⇒ True, False
Returns is slide with data.
32 33 34 35 36 37 38 39 |
# File 'lib/ooxml_parser/pptx_parser/presentation/slide.rb', line 32 def with_data? return true unless background.nil? elements.each do |current_element| return true if current_element.with_data? end false end |