Created attachment 157246 [details] File to reproduce the error The file format has a draw:transform attribute, which can express horizontal and vertical flip. It can be done with values scale() or matrix(), see attached file. In case an ellipse or a circle of kind "arc", "cut" or "section" is used, the start- and the end-angle needs to be flipped too. That works without problems, if flipping is done via UI. But is fails, if flipping is part of the file. In the attached file, the right, green shape should be a horizontal flip of the red shape; and the lower, blue shape should be a vertical flip of the red shape. The error is in file https://opengrok.libreoffice.org/xref/core/xmloff/source/draw/ximpshap.cxx The transformation is applied before the kind of circle or ellipse is set. Therefore the methods of SdrCircObj get the default kind SdrCircKind::Full and skip all calculating on angles. A unit test can go to /core/svx/qa/unit/classicshapes.cxx. Re-Saving will change the draw:transform attribute. LibreOffice does not write flipping as draw:transform attribute, but writes the changed angles. So be careful to use a file similar to the attached file for testing. The attached file contains only the kind "section", but you can change it in file to "cut" or "arc" for the other cases. I propose it as easyHack. In case you think it is not suitable, remove the keyword.
Moving to NEW
I have run into the following problem working on this. If the call to SetTransformation() is moved to after the circle section properties are set, this causes problems. In particular, test Tdf99497_keepAppearanceOfCircleKind in sd/qa/unit/export-tests-ooxml3.cxx (CppunitTest_sd_export_tests-ooxml3) fails because the size and shape of some circle sections, cuts, and arcs changes. I will try to figure out what is going on here.
Created attachment 177257 [details] Examples with small sector The examples have angles in a way, that the actual outline rectangle is smaller than width x height. (BTW, the fact that the text is rotated 180deg in case of vertical flip is no error but intended.)
Created attachment 177280 [details] Example for comment in gerrit This is an example, why the change to SdrCircObj::NbcSetSnapRect in https://gerrit.libreoffice.org/c/core/+/127853 will not work.
Dhiraj Holden committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/207d202ed2f1f44e5b62157b5a92ee5e8cc2c3e5 tdf#130076 Fixed flip not working properly from file It will be available in 7.4.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.
Created attachment 177426 [details] Before vs After the fix
Verified in Version: 7.4.0.0.alpha0+ / LibreOffice Community Build ID: bf883027ee62ece0844730572305094f53daa521 CPU threads: 4; OS: Linux 5.10; UI render: default; VCL: gtk3 Locale: en-US (en_US.UTF-8); UI: en-US Calc: threaded @Dhiraj Holden, thanks for fixing this issue!!
Dhiraj Holden committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/core/commit/7c51b1129c67b2c8bc85a4560b36555b83adeeb3 tdf#130076 Fixed flip not working properly from file It will be available in 7.3.0.2. 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.