class PPTX::Shapes::Picture

Public Class Methods

new(transform, relationship_id) click to toggle source
Calls superclass method
# File lib/pptx/shapes/picture.rb, line 4
def initialize(transform, relationship_id)
  super(transform)
  @relationship_id = relationship_id
end

Public Instance Methods

base_xml() click to toggle source
# File lib/pptx/shapes/picture.rb, line 9
def base_xml
  # TODO replace cNvPr descr, id and name
  """
    <p:pic xmlns:a='http://schemas.openxmlformats.org/drawingml/2006/main'
           xmlns:p='http://schemas.openxmlformats.org/presentationml/2006/main'>
      <p:nvPicPr>
          <p:cNvPr descr='test_photo.jpg' id='2' name='Picture 1'/>
          <p:cNvPicPr>
              <a:picLocks noChangeAspect='1'/>
          </p:cNvPicPr>
          <p:nvPr/>
      </p:nvPicPr>
      <p:blipFill>
          <a:blip r:embed='REPLACEME'/>
          <a:stretch>
              <a:fillRect/>
          </a:stretch>
      </p:blipFill>
      <p:spPr>
      </p:spPr>
  </p:pic>
  """
end
build_node() click to toggle source
# File lib/pptx/shapes/picture.rb, line 33
def build_node
  base_node.tap do |node|
    node.xpath('.//a:blip', a: DRAWING_NS).first['r:embed'] = @relationship_id
  end
end