diff options
| author | Randy Morgan <[email protected]> | 2011-11-26 13:20:57 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2011-11-26 13:20:57 +0900 |
| commit | 11303a4d6664d9a7ff7bc408035d2ab70378a375 (patch) | |
| tree | 51c675ae3ab8cd6c1afd7087145261b1eb2ec54c /lib/axlsx/drawing/drawing.rb | |
| parent | 044afe5a35db42cefce4f18a0fecc3da90cab1b5 (diff) | |
| download | caxlsx-11303a4d6664d9a7ff7bc408035d2ab70378a375.tar.gz caxlsx-11303a4d6664d9a7ff7bc408035d2ab70378a375.zip | |
adding in support for ruby 1.9.3
release version 1.0.9
Diffstat (limited to 'lib/axlsx/drawing/drawing.rb')
| -rw-r--r-- | lib/axlsx/drawing/drawing.rb | 46 |
1 files changed, 16 insertions, 30 deletions
diff --git a/lib/axlsx/drawing/drawing.rb b/lib/axlsx/drawing/drawing.rb index 17347cd1..4fa7dc11 100644 --- a/lib/axlsx/drawing/drawing.rb +++ b/lib/axlsx/drawing/drawing.rb @@ -47,34 +47,6 @@ module Axlsx # @return [SimpleTypedList] attr_reader :anchors - # An array of charts that are associated with this drawing's anchors - # @return [Array] - attr_reader :charts - - # An array of image objects that are associated with this drawing's anchors - # @return [Array] - attr_reader :images - - # The index of this drawing in the owning workbooks's drawings collection. - # @return [Integer] - attr_reader :index - - # The relation reference id for this drawing - # @return [String] - attr_reader :rId - - # The part name for this drawing - # @return [String] - attr_reader :pn - - # The relational part name for this drawing - # @return [String] - attr_reader :rels_pn - - # The drawing's relationships. - # @return [Relationships] - attr_reader :relationships - # Creates a new Drawing object # @param [Worksheet] worksheet The worksheet that owns this drawing def initialize(worksheet) @@ -99,33 +71,47 @@ module Axlsx TwoCellAnchor.new(self, options) @anchors.last.add_chart(chart_type, options) end - + + # An array of charts that are associated with this drawing's anchors + # @return [Array] def charts charts = @anchors.select { |a| a.object.is_a?(GraphicFrame) } charts.map { |a| a.object.chart } end + # An array of image objects that are associated with this drawing's anchors + # @return [Array] def images images = @anchors.select { |a| a.object.is_a?(Pic) } images.map { |a| a.object } end + # The index of this drawing in the owning workbooks's drawings collection. + # @return [Integer] def index @worksheet.workbook.drawings.index(self) end + # The relation reference id for this drawing + # @return [String] def rId "rId#{index+1}" end + # The part name for this drawing + # @return [String] def pn "#{DRAWING_PN % (index+1)}" end - + + # The relational part name for this drawing + # @return [String] def rels_pn "#{DRAWING_RELS_PN % (index+1)}" end + # The drawing's relationships. + # @return [Relationships] def relationships r = Relationships.new charts.each do |chart| |
