Created attachment 114665 [details] Screenshot for the new option
Link to the patch - https://gerrit.libreoffice.org/#/c/15180/ It changes the gradient angle on choosing an option "Diagonal" and by Selecting Left To Right / Right To Left. Working on Export and Import of the diagonal option.
Is my understanding correct that this would be an easy and fast alternative for the selection of the corresponding angle?
New feature / improvement -> Severity: enhancement
@Andy:- Yes. By choosing the diagonal option and selecting left to right / right to left, angle is calculated accordingly. No need to calculate it manually.
(In reply to Heena Gupta from comment #4) > @Andy:- Yes. By choosing the diagonal option and selecting left to right / > right to left, angle is calculated accordingly. > No need to calculate it manually. Thanks for your very fast reply. This is a good enhancement proposal.
For Exporting gradient angle diagonally, I have added new attribute and the patch for this is:- https://gerrit.libreoffice.org/#/c/15323/
You cannot add an attribute XML_GRADIENT_DIAGONAL with the XML_NAMESPACE_DRAW, because such attribute is not defined in ODF1.2. I personally doubt, that the ODF TC will agree to such an attribute, because the attribute "draw:angle" exists. Why do you think, that such attribute is needed?
Right, so the question: How do we handle this, please? What we need is a way to track diagonal gradients. Of course, we can save as 'angles', but then, when the user reopens the file and modifies the length or width of the object the fill would no longer be diagonal. As a temporary solution, we could store 'angles' in the files and have the diagonal properties stored in the settings - but seems like those are dependent on the odf formats as well?
The problem is very complex, so I do not have a final solution. Here are some details, which need to be considered: New attributes can be handled in the namespace loext. But in addition a suggestion for ODF is needed to get such attribute into the next version of ODF. ODF does not specify how a draw:transform attribute influence the filling. Alternatives are: (1) First transform the shape and then apply the filling, or (2) first fill the shape and then apply the transformation to shape including filling. A suggestion for ODF is needed. PowerPoint has the option “Rotate with shape” which is not only available for background images, but for gradients too. LO does not have such options and ODF does not have an attribute for it. A suggestion for ODF is needed. How does such attribute interact with the gradient-tool in the "Effects"-toolbox? PowerPoint implements a gradient filling in the way, that it applies the filling to a unit shape and shows that angle in the UI. All scaling to the target size is then done on the gradient filling too. That results in the effect, that the angle shown in the dialog does not correspond to the angle which the user sees in the presentation. Is that the desired behavior for LO? LO implements it the way, that the shape is first scaled from a unit shape to the target size and then the filling is applied. That way the filling is independent from the actual shape, so that all shapes which the same gradient applied, will show the gradient with the same angle. ODF 1.2 allows svg:LinearGradient and that has a property svg:gradientUnits. Currently only value "objectBoundingBox" is allowed, but exact this value gives the effect, that the gradient is scaled together with the shape. Perhaps implementing this feature is the way to go? Having this feature would address multiple color stops too, which are needed for PowerPoint import.
Created attachment 115433 [details] Discussing the behavior of the gradient in PowerPoint, SVG and Draw The attachment and this comment are an addition to my comments in https://gerrit.libreoffice.org/#/c/15180/ When you set an angle in the UI, you can calculate it in the way, that it corresponds to the "diagonal" of the current selected shape (actual its bounding rectangle). But if the shape gets a new height or width, the gradient is no longer diagonal. The same problem arose, if you apply such gradient to another shape via format paint brush. So such options in the dialog would not help to get a similar behavior of the gradient as in PowerPoint. See the attached file for screenshots of the behavior in PowerPoint. If the goal is only a calculation help in the UI, then what is the desired behavior if nothing is selected and you only want to define a gradient, or if you want to make a style? The current suggestion in the patch generates a division by zero. Will the user be surprised, when he notice, that "diagonal" refers to the diagonal of the bounding rectangle? If it is really only about a calculation help for the current selected shape, then there is no need for a new attribute. If you want, that a new kind of gradient is implemented, which is able to adapt itself to the shape, then doing changes in the UI is not sufficient, because you need the implementation of storing and rendering. But I would vote against a new king of gradient, because the svg:linearGradient which is already possible in ODF, can do such things. Has there been any discussions about the UI, e.g several buttons vs drop-down-list (like in PowerPoint), or corner/edge cross with options, or angle wheel with snapping? Why in that dialog and not in the Interactive Gradient tool?
@Regina: Thank you! that is really good analysis/comparisons. Thoughts: a) Does ODF specify what the "angle" is? Similar to ms-office or....? b) What we need is a way to put in diagonal fills - we could do it like a UI-property and not touch the odf formats. But, like previously mentioned, it seems like the same properties are used to store UI preferences (?) c) Yes, I think some way to differentiate if the angle is related to object (if i can call that) and behave like ms-office does, i think it would be more preferred. (Rather than just 'diagonals') d) The current patch did handle it for diagonals when the objects are resized...but then...
@Regina: Its seems like MS Office does this behaviour only when you pick from "Direction" drop down and not if you plainly use the angle entry (?)
OOXML has the attribute 'scaled' for the element 'a:lin'. If it is set to 0, then the angle is used. If it is set to 1, then the square unit gradient is fit to the fill area of the shape. I don't know which UI tool you have to use to set or unset this switch; but anyway not the UI of PowerPoint is essential, but the file format. LibreOffice could solve a lot of the import problems easier, if the ODF1.2. filling 'svg:LinearGradient' would be implemented.
Setting Assignee back to default. Please assign it back to yourself if you're still working on this issue