Review Request: fix saving of percentage values in gradients.

Thorsten Zachmann t.zachmann at zagge.de
Fri May 18 05:50:51 UTC 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104980/
-----------------------------------------------------------

Review request for Calligra.


Description
-------

Fix saving of precentage values in gradient styles.

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.


Diffs
-----

  libs/odf/KoGenStyle.h 8c469d6 
  libs/odf/KoGenStyle.cpp b3ac9d8 
  libs/odf/KoOdfGraphicStyles.cpp 0776848 

Diff: http://git.reviewboard.kde.org/r/104980/diff/


Testing
-------

Tested with the 114096 and the above error is gone.


Thanks,

Thorsten Zachmann

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/calligra-devel/attachments/20120518/90fe7e29/attachment.html>


More information about the calligra-devel mailing list