Bug 89475 - Failure to load gradients from ods file
Summary: Failure to load gradients from ods file
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Michael Stahl (CIB)
URL:
Whiteboard: odf target:7.0.0
Keywords:
Depends on:
Blocks: ODF-import
  Show dependency treegraph
 
Reported: 2015-02-19 16:53 UTC by mwelinder
Modified: 2020-05-28 16:06 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample file with 45-degree gradient (6.00 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-02-19 16:55 UTC, mwelinder
Details
Sample file with 45-degree gradient (6.02 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-02-19 16:55 UTC, mwelinder
Details
Sample file with 45-degree gradient (xlsx for reference) (6.74 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2015-02-19 16:56 UTC, mwelinder
Details
Sample file with -45-degree gradient (6.01 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-02-19 19:47 UTC, mwelinder
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mwelinder 2015-02-19 16:53:39 UTC
LibreOffice 4.1.6.2 410m0(Build:2)

The to-be-attached file contains a circle with a gradient that should go
from red to yellow in the direction from upper left to lower right.

When localc loads this file, it incorrectly sees a 4 degree angle, not
a 45 degree angle.

    <draw:gradient draw:name="Gradient-0" draw:start-color="#ffff00" draw:end-color="#ff0000" draw:style="linear" draw:angle="45"/>

The ODF 1.2 language is...

18.3.1 angle
An angle, as defined in §4.1 of [SVG]. An angle is a double value that may be followed immediately by one of the following angle unit identifiers: deg (degrees), grad (gradiants) or rad (radians). If no unit identifier is specified, the value is assumed to be in degrees.
Note: OpenDocument v1.1 did not support angle specifications that contain an angle unit identifier. Angle unit identifiers should be omitted for compatibility with OpenDocument v1.1.

Changing the "45" to "45deg" causes LO to act as-if "0" was requested.
Comment 1 mwelinder 2015-02-19 16:55:12 UTC
Created attachment 113509 [details]
Sample file with 45-degree gradient

This file uses

draw:angle="45"
Comment 2 mwelinder 2015-02-19 16:55:47 UTC
Created attachment 113510 [details]
Sample file with 45-degree gradient

This file uses

draw:angle="45deg"
Comment 3 mwelinder 2015-02-19 16:56:27 UTC
Created attachment 113511 [details]
Sample file with 45-degree gradient (xlsx for reference)
Comment 4 mwelinder 2015-02-19 19:47:00 UTC
Created attachment 113523 [details]
Sample file with -45-degree gradient

On further investigation it looks like negative angles like "-45"
are ignored.  -45 degrees is a perfectly reasonable angle and the
spec doesn't appear to rule it out.

LO should not ignore, but normalize into whatever representation it
prefers internally.
Comment 5 Buovjaga 2015-02-25 08:56:00 UTC
Reproduced.

Additional note: .xlsx has no gradient, but a solid red fill.

Win 7 Pro 64-bit, LibO Version: 4.4.0.3
Build ID: de093506bcdc5fafd9023ee680b8c60e3e0645d7
Locale: fi_FI
Comment 6 tommy27 2016-04-16 07:29:13 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2017-05-22 13:27:55 UTC Comment hidden (obsolete)
Comment 8 Michael Stahl (CIB) 2019-11-13 11:58:49 UTC
note to self: import with explicit unit should work since LO 4.4; investigate how to proceed with:

commit aadda5d17f6e422da143ea774f759bfc5f629c5b
Author:     Michael Stahl <mstahl@redhat.com>
AuthorDate: Fri Oct 9 17:51:50 2015 +0200
Commit:     Michael Stahl <mstahl@redhat.com>
CommitDate: Fri Oct 9 18:03:49 2015 +0200

    xmloff: fix ODF import of gradient draw:angle attribute a bit
    
    ODF 1.2 part 3, 18.3.1 angle, says "An angle, as defined in §4.1 of
    [SVG]" and "If no unit identifier is specified, the value is assumed to
    be in degrees."
    
    Unfortunately OOo could only read and write 10th of degree here.
    
    See also https://issues.oasis-open.org/browse/OFFICE-3774
    
    As the first step towards fixing that, implement the import for
    draw:angle values with an angle unit identifier, but leave the import
    as-is if the angle identifier is missing.
Comment 9 Commit Notification 2020-05-19 15:06:01 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/693cefb59286daf6ff86f1db16f0d64b4b9b4588

tdf#89475 xmloff: ODF import/export: continue fixing draw:angle

It will be available in 7.0.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Michael Stahl (CIB) 2020-05-20 10:52:36 UTC
okay this should be fixed now on master.

get 45º, 45º and 315º for the 3 ODF attachments now; it's normalized to [0...360].

on export by default "deg" suffix is written, for more details see the commit message.
Comment 11 Regina Henschel 2020-05-28 16:06:51 UTC
The wrong angle in "ODF 12 compatible" is acceptable. All other import/export are OK.

Tested with Version: 7.0.0.0.alpha1+ (x64)
Build ID: 0a7341c26741f16835c9062c309e7d3a7fca8209
CPU threads: 8; OS: Windows 10.0 Build 18362; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: CL