Skip to content
  • Thorsten Zachmann's avatar
    Fix saving of percent values · 23898f28
    Thorsten Zachmann authored
    When saving the file odf/odp/114096.odp from calligratests invalid xml is generated:
    
    [11:37:25]: [odf/odp/114096.odp] INVALIDSTYLESXML:
    (unknown file): 62 error: value of attribute "svg:x2" is invalid; must be a string matching the regular expression "-?([0-9]+(\.[0-9]*)?|\.[0-9]+)%" or must be a string matching the regular expression "-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px))"
    (unknown file):62: error: value of attribute "svg:y1" is invalid; must be a string matching the regular expression "-?([0-9]+(\.[0-9]*)?|\.[0-9]+)%" or must be a string matching the regular expression "-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px))"
    (unknown file):65: error: value of attribute "svg:x2" is invalid; must be a string matching the regular expression "-?([0-9]+(\.[0-9]*)?|\.[0-9]+)%" or must be a string matching the regular expression "-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px))"
    (unknown file):65: error: value of attribute "svg:y1" is invalid; must be a string matching the regular expression "-?([0-9]+(\.[0-9]*)?|\.[0-9]+)%" or must be a string matching the regular expression "-?([0-9]+(\.[0-9]*)?|\.[0-9]+)((cm)|(mm)|(in)|(pt)|(pc)|(px))"
    
    The problem is that the gradient attributes are saved like:
    
    <svg:linearGradient draw:name="gradient3" svg:spreadMethod="pad" svg:x1="100%" svg:x2="-6.66134e-14%" svg:y1="5.55112e-14%" svg:y2="100%">
        <svg:stop svg:offset="0" svg:stop-color="#cc3300"/>
        <svg:stop svg:offset="1" svg:stop-color="#c7a309"/>
    </svg:linearGradient>
    
    however e-14 is not alloed in the value for precent.
    
    This patch adds a new function to add percent attributes that takes care of using the correct format.
    23898f28