class Xlsxrb::Ooxml::Reader::ProtectedRangesListener
SAX2 listener for parsing <protectedRanges> element.
Attributes
Public Class Methods
Source
# File lib/xlsxrb/ooxml/reader.rb, line 3299 def initialize @ranges = [] @current = nil end
Public Instance Methods
Source
# File lib/xlsxrb/ooxml/reader.rb, line 3322 def characters(text) @sd_text << text if @in_sd end
# File lib/xlsxrb/ooxml/reader.rb, line 3326 def end_element(_uri, local_name, qname) name = element_name(local_name, qname) case name when "securityDescriptor" (@current[:security_descriptors] ||= []) << @sd_text if @current @in_sd = false when "protectedRange" @ranges << @current if @current @current = nil end end
# File lib/xlsxrb/ooxml/reader.rb, line 3304 def start_element(_uri, local_name, qname, attributes) name = element_name(local_name, qname) case name when "protectedRange" pr = {} pr[:sqref] = attributes["sqref"] if attributes["sqref"] pr[:name] = attributes["name"] if attributes["name"] pr[:algorithm_name] = attributes["algorithmName"] if attributes["algorithmName"] pr[:hash_value] = attributes["hashValue"] if attributes["hashValue"] pr[:salt_value] = attributes["saltValue"] if attributes["saltValue"] pr[:spin_count] = attributes["spinCount"].to_i if attributes["spinCount"] @current = pr when "securityDescriptor" @in_sd = true @sd_text = +"" end end