Class: RubyPoint::ContentTypes::XML

Inherits:
File show all
Defined in:
lib/rubypoint/content_types_xml.rb

Defined Under Namespace

Classes: Slide

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) ⇒ XML

Returns a new instance of XML.



4
5
6
7
# File 'lib/rubypoint/content_types_xml.rb', line 4

def initialize(presentation)
  @presentation = presentation
  @file_path = presentation.file_directory + "/[Content_Types].xml"
end

Instance Method Details

#before_writeObject



9
10
11
12
13
# File 'lib/rubypoint/content_types_xml.rb', line 9

def before_write
  self.slides.each do |s|
    self << Slide.new(s)
  end
end

#docObject



19
20
21
# File 'lib/rubypoint/content_types_xml.rb', line 19

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

#rawObject



23
24
25
26
27
28
# File 'lib/rubypoint/content_types_xml.rb', line 23

def raw
  raw = <<EOF
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Override PartName="/ppt/slideLayouts/slideLayout8.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/><Override PartName="/ppt/slideLayouts/slideLayout9.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/><Override PartName="/ppt/slideLayouts/slideLayout11.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/><Override PartName="/ppt/slideLayouts/slideLayout4.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/ppt/slideLayouts/slideLayout2.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/><Override PartName="/ppt/tableStyles.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/ppt/viewProps.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"/><Override PartName="/ppt/slideLayouts/slideLayout1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/><Override PartName="/ppt/slideMasters/slideMaster1.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"/><Override PartName="/ppt/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/><Override PartName="/ppt/slideLayouts/slideLayout6.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/><Default Extension="bin" ContentType="application/vnd.openxmlformats-officedocument.presentationml.printerSettings"/><Override PartName="/ppt/presentation.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Override PartName="/ppt/slideLayouts/slideLayout7.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/><Override PartName="/ppt/presProps.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.presProps+xml"/><Default Extension="jpeg" ContentType="image/jpeg"/><Override PartName="/ppt/slideLayouts/slideLayout3.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/><Override PartName="/ppt/slideLayouts/slideLayout5.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/><Override PartName="/ppt/slideLayouts/slideLayout10.xml" ContentType="application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"/></Types>
EOF
end

#slidesObject



15
16
17
# File 'lib/rubypoint/content_types_xml.rb', line 15

def slides
  @presentation.slides
end