lib/axlsx/drawing/pic.rb in axlsx-1.0.10 vs lib/axlsx/drawing/pic.rb in axlsx-1.0.11
- old
+ new
@@ -24,10 +24,12 @@
# The anchor for this image
# @return [OneCellAnchor]
attr_reader :anchor
+ # The picture locking attributes for this picture
+ attr_reader :picture_locking
# Creates a new Pic(ture) object
# @param [Anchor] anchor the anchor that holds this image
# @option options [String] name
# @option options [String] descr
@@ -41,10 +43,11 @@
options.each do |o|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
end
start_at(*options[:start_at]) if options[:start_at]
yield self if block_given?
+ @picture_locking = PictureLocking.new(options)
end
def image_src=(v)
Axlsx::validate_string(v)
RestrictionValidator.validate 'Pic.image_src', ALLOWED_EXTENSIONS, File.extname(v).delete('.')
@@ -92,11 +95,11 @@
# @see width
def width=(v)
@anchor.width = v
end
-
+
# providing access to update the anchor's height attribute
# @param [Integer] v
# @see OneCellAnchor.width
def height
@anchor.height
@@ -124,10 +127,10 @@
def to_xml(xml)
xml.send('xdr:pic') {
xml.send('xdr:nvPicPr') {
xml.send('xdr:cNvPr', :id=>"2", :name=>name, :descr=>descr)
xml.send('xdr:cNvPicPr') {
- xml.send('a:picLocks', :noChangeAspect=>1)
+ picture_locking.to_xml(xml)
}
}
xml.send('xdr:blipFill') {
xml.send('a:blip', :'xmlns:r' => XML_NS_R, :'r:embed'=>"rId1")
xml.send('a:stretch') {