Class: RubyPoint::TextField

Inherits:
Element
  • Object
show all
Defined in:
lib/rubypoint/textfield.rb

Instance Attribute Summary collapse

Attributes inherited from Element

#objects, #parent, #presentation

Instance Method Summary collapse

Methods inherited from Element

class_attributes

Constructor Details

#initialize(text = "", x = 3200400, y = 4572000, w = 3200400, h = 572000) ⇒ TextField

Returns a new instance of TextField.



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

def initialize(text="",x=3200400, y=4572000, w=3200400, h=572000)
  @dirty = true
  @text = text
  @x, @y, @width, @height = x, y, w, h
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



2
3
4
# File 'lib/rubypoint/textfield.rb', line 2

def height
  @height
end

#textObject

Returns the value of attribute text.



2
3
4
# File 'lib/rubypoint/textfield.rb', line 2

def text
  @text
end

#widthObject

Returns the value of attribute width.



2
3
4
# File 'lib/rubypoint/textfield.rb', line 2

def width
  @width
end

#xObject

Returns the value of attribute x.



2
3
4
# File 'lib/rubypoint/textfield.rb', line 2

def x
  @x
end

#yObject

Returns the value of attribute y.



2
3
4
# File 'lib/rubypoint/textfield.rb', line 2

def y
  @y
end

Instance Method Details

#rawObject



14
15
16
17
18
# File 'lib/rubypoint/textfield.rb', line 14

def raw
  raw = "<p:sp><p:nvSpPr><p:cNvPr id=\"\#{self.object_id}\" name=\"TextBox \#{self.object_id}\"/><p:cNvSpPr txBox=\"1\"/><p:nvPr/></p:nvSpPr><p:spPr><a:xfrm><a:off x=\"\#{self.x}\" y=\"\#{self.y}\"/><a:ext cx=\"\#{self.width}\" cy=\"\#{self.height}\"/></a:xfrm><a:prstGeom prst=\"rect\"><a:avLst/></a:prstGeom><a:noFill/></p:spPr><p:txBody><a:bodyPr wrap=\"square\" rtlCol=\"0\"><a:spAutoFit/></a:bodyPr><a:lstStyle/><a:p><a:r><a:rPr lang=\"en-US\" dirty=\"0\" smtClean=\"0\"/><a:t>\#{self.text}</a:t></a:r></a:p></p:txBody></p:sp>\n" 
end

#writeObject



10
11
12
# File 'lib/rubypoint/textfield.rb', line 10

def write
  @parent.doc.search('//p:spTree').append(self.raw)
end