Date: prev next · Thread: first prev next last
2019 Archives by date, by thread · List index


Hi all,

During my work on the oox import of vert="eaVert" I encountered, that my changes in oox do not work as expected, because SdrObjCustomShape::SetVerticalWriting() is faulty. The origin of the error is in SdrObjCustomShape::SetSnapRect().

SdrObjCustomShape::SetSnapRect() has a rectangle as input and sets this rectangle as logic rectangle of the shape. But there exists some places, where similar combinations like the following are used.
https://opengrok.libreoffice.org/xref/core/svx/source/svdraw/svdundo.cxx
350          const tools::Rectangle aSnapRect = pObj->GetSnapRect();
...
385              pObj->NbcSetSnapRect(aSnapRect);

This means, that the size and position of the rotated and/or sheared object is set as new logical (which means unrotate and unsheared) rectangle. That results in wrong size and position of the object.

To try it out:
Draw a custom shape, enter some text and rotate the shape. Now change the shape e.g. the line color and make an Undo. Result: The shape changes its position and size. Or draw a custom shape in Calc, rotate it and anchor it "to Cell". Then use the item "Fit to Cell Size" from context menu. Or draw a custom shape in Impress, enter some text, then rotate the shape. Enter edit mode of the shape and switch on "Vertical Writing" mode (it is in the text formatting toolbar).

I have seen the problem in SdrObjCustomShape::SetVerticalWriting(), SdrUndoAttrObj::Undo(), SdrUndoAttrObj::Redo() and ScDrawView::FitToCellSize(). There might be other places.

So my question is:
What is SdrObjCustomShape::SetSnapRect() supposed to do?

It is not straight forward to use the input rectangle as snap rectangle, because the snap rectangle is calculated from the logic rectangle using the given rotation and shear angle, and it is possible, that there exists no logic rectangle, which would result in the input rectangle as snap rectangle.

A different approach would be, to keep the current version of SdrObjCustomShape::SetSnapRect() and change the found combinations so, that in case of a SdrObjCustomShape, not GetSnapRect() but GetLogicRect() is used.

So what to do?

Kind regards
Regina

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.