Sha256: fbbd4dc9f24addb260de3254cacbec448e45554a536c0419d6f0bdcebcbda616

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require_relative 'transition/sound_action'
require_relative 'transition_properties/transition_properties'
module OoxmlParser
  class Transition < OOXMLDocumentObject
    attr_accessor :speed, :properties, :sound_action, :advance_on_click, :delay, :duration

    def initialize(properties = TransitionProperties.new)
      @properties = properties
    end

    def self.parse(transition_node)
      transition = Transition.new
      transition_node.xpath('*').each do |transition_node_child|
        transition.properties = TransitionProperties.parse(transition_node_child)
        transition.sound_action = SoundAction.parse(transition_node_child)
      end
      transition_node.attributes.each do |key, value|
        case key
        when 'spd'
          transition.speed = value.value.to_sym
        when 'advClick'
          transition.advance_on_click = OOXMLDocumentObject.option_enabled?(transition_node, key)
        when 'advTm'
          transition.delay = value.value.to_f / 1_000.0
        when 'dur'
          transition.duration = value.value.to_f / 1_000.0
        end
      end
      transition
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ooxml_parser-0.1.2 lib/ooxml_parser/pptx_parser/pptx_data/presentation/slide/transition/transition.rb