Bug 119191 - FILEOPEN, FILESAVE The object rotates and switches position to a different cell everytime I Open/Close again.
Summary: FILEOPEN, FILESAVE The object rotates and switches position to a different ce...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1 all versions
Hardware: All All
: medium normal
Assignee: Regina Henschel
URL:
Whiteboard: target:7.0.0 target:6.4.2
Keywords: bibisected, bisected, regression
: 94625 116892 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-08-10 06:41 UTC by wawa
Modified: 2020-02-07 19:55 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample file (9.83 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-08-10 06:41 UTC, wawa
Details
Document to test .uno:FitToCellSize (10.23 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-12-03 00:32 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wawa 2018-08-10 06:41:50 UTC
Created attachment 144082 [details]
Sample file

Experienced behavior:

Place some objects on the spreadsheet (like triangle, arrow, square).
Rotate this object by some degrees.
Set the anchor for the object.
Save the file.
Close the file.
Open the file.

--> The object rotates and switches position to a different cell everytime I Open/Close again.
Comment 1 Timur 2018-08-10 08:52:01 UTC
Wrong with 6.2+. Also size.
Before confirming, did you search for existing bugs?
Comment 2 Timur 2018-08-10 08:53:15 UTC
Like Bug 111448
Comment 3 raal 2018-08-13 20:55:26 UTC Comment hidden (obsolete)
Comment 4 Noel Grandin 2018-08-14 12:14:36 UTC
@raal are you sure about that, that's a KDE-specific commit?
Comment 5 QA Administrators 2019-08-19 06:55:50 UTC Comment hidden (obsolete)
Comment 6 Regina Henschel 2019-11-18 18:30:30 UTC
The problem still exists in Version: 6.5.0.0.alpha0+ (x64)
Build ID: 3a8d16ba8ca7ef7349e893f2bf1c7e12d9a8d7ae
CPU threads: 8; OS: Windows 10.0 Build 18362; UI render: default; VCL: win; 
Locale: de-DE (en_US); UI-Language: en-US
Calc: CL

The problem is triggered in drw.layer.cxx#1041 with the call pObj->SetSnapRect(rData.getShapeRect());

The error itself is in svdoashp.cxx#1464
void SdrObjCustomShape::NbcSetLogicRect( const tools::Rectangle& rRect )
{
    maRect = rRect;
    ImpJustifyRect(maRect);
    InvalidateRenderGeometry();
    AdaptTextMinSize();
    SetRectsDirty();
    SetChanged();
}

Here the to be "Snap"-Rectangle rRect is directly copied to maRect, which is the "Logic"-Rectangle of the custom shape. A "Logic"-Rectangle is the rectangle of the shape without rotation and shearing and "Snap"-Rectangle is including rotation ans shearing.

We had some discussion, see https://lists.freedesktop.org/archives/libreoffice/2019-November/083710.html
I thought it would be possible to solve it, by changing the callers to use a logic rectangle as input and have adapted two places. But it seems, there exist much more situations. So I need to re-think, how to solve the problems directly in SdrObjCustomShape::NbcSetLogicRect.
Comment 7 Regina Henschel 2019-11-18 18:52:54 UTC
Ups, wrong quote, here the correct one from line #1441:
void SdrObjCustomShape::NbcSetSnapRect( const tools::Rectangle& rRect )
{
    maRect = rRect;
    ImpJustifyRect(maRect);
    InvalidateRenderGeometry();
    AdaptTextMinSize();
    ImpCheckShear();
    SetRectsDirty();
    SetChanged();
}
Comment 8 Regina Henschel 2019-12-03 00:32:08 UTC
Created attachment 156255 [details]
Document to test .uno:FitToCellSize

Open the file. Apply "Fit to Cell Size" to the shape. Find the command in the context menu of the shape.
Expected: The shape shrinks so that it fits into its anchor cell.
Observed: The shape gets totally wrong size and position.

The fix for this problem is the same as for the wrong position and size on loading. Therefore I have not written a separate bug report.

The proposed fix is currently in https://gerrit.libreoffice.org/#/c/84216/ for review.
Comment 9 Luke 2019-12-08 02:44:43 UTC
The bisect is likely wrong. From Bug 116892, the cause of this is likely 

https://cgit.freedesktop.org/libreoffice/core/commit/?id=2b1aa949539d2fcbb3d349be3c279996630d83fc
    fdo#56276 - resize/reposition rotated shapes in a sensible way
Comment 10 Regina Henschel 2019-12-08 13:21:49 UTC
I know how to fix it, but I need some time for the unit tests.
Comment 11 Commit Notification 2019-12-11 22:43:43 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/f44140bebb9c493d97ba5aef26c9692c53a6b93f

tdf#119191 Implement SdrObjCustomShape::AdjustToMaxRect

It will be available in 6.5.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 12 Xisco Faulí 2019-12-12 11:27:05 UTC
*** Bug 116892 has been marked as a duplicate of this bug. ***
Comment 13 Xisco Faulí 2020-01-20 14:24:45 UTC
A polite ping to Regina Henschel:
Is this bug fixed? if so, could you please close it as RESOLVED FIXED ?
Otherwise, Could you please explain what's missing?
Thanks
Comment 14 Regina Henschel 2020-01-20 15:36:57 UTC
It turned out, that the problem in bug 129339 is different, because the file contains already faulty information in the shape. So yes, this is fixed.
Comment 15 Xisco Faulí 2020-01-21 09:14:20 UTC
*** Bug 94625 has been marked as a duplicate of this bug. ***
Comment 16 Xisco Faulí 2020-02-07 17:39:31 UTC
Verified in

Version: 7.0.0.0.alpha0+
Build ID: c81c383be787ec5f9acbca51f75ea5b28b63c63a
CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded

@Regina, thanks for fixing this issue!!
Comment 17 Commit Notification 2020-02-07 17:42:34 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/7efd182997cb29ed4820145efc99a6c18e2c3303

tdf#119191 Implement SdrObjCustomShape::AdjustToMaxRect

It will be available in 6.4.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.