Class: RubyPoint::PresentationRel

Inherits:
File show all
Defined in:
lib/rubypoint/ppt/rels/presentation_rel.rb

Defined Under Namespace

Classes: PresProps, PrinterSettings, Slide, SlideMaster, TableStyles, Theme, ViewProps

Instance Attribute Summary

Attributes inherited from File

#file_path

Attributes inherited from Element

#objects, #parent, #presentation

Instance Method Summary collapse

Methods inherited from File

#<<, #write

Methods inherited from Element

class_attributes

Constructor Details

#initialize(presentation) ⇒ PresentationRel

Returns a new instance of PresentationRel.



3
4
5
6
7
# File 'lib/rubypoint/ppt/rels/presentation_rel.rb', line 3

def initialize(presentation)
  @presentation = presentation
  @file_path = presentation.file_directory + "/ppt/_rels/presentation.xml.rels"
  @rel_id = 1
end

Instance Method Details

#add_relationship_for(object) ⇒ Object



21
22
23
24
25
# File 'lib/rubypoint/ppt/rels/presentation_rel.rb', line 21

def add_relationship_for(object)
  slide_rel = RubyPoint::PresentationRel::Slide.new(self, object)
  self.objects << slide_rel
  slide_rel
end

#before_writeObject



9
10
11
12
13
14
15
# File 'lib/rubypoint/ppt/rels/presentation_rel.rb', line 9

def before_write
  self.objects << RubyPoint::PresentationRel::PrinterSettings.new(self)
  self.objects << RubyPoint::PresentationRel::PresProps.new(self)
  self.objects << RubyPoint::PresentationRel::ViewProps.new(self)
  self.objects << RubyPoint::PresentationRel::Theme.new(self)
  self.objects << RubyPoint::PresentationRel::TableStyles.new(self)
end

#docObject



27
28
29
# File 'lib/rubypoint/ppt/rels/presentation_rel.rb', line 27

def doc
  @doc ||= Hpricot::XML(raw)
end

#next_rel_idObject



17
18
19
# File 'lib/rubypoint/ppt/rels/presentation_rel.rb', line 17

def next_rel_id
  @rel_id += 1
end

#rawObject



31
32
33
34
35
36
# File 'lib/rubypoint/ppt/rels/presentation_rel.rb', line 31

def raw
  raw = <<EOF
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster" Target="slideMasters/slideMaster1.xml"/></Relationships>
EOF
end