Bug 153304 - Changing as-char object properties via UNO API behaves wrong
Summary: Changing as-char object properties via UNO API behaves wrong
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard: target:7.6.0 target:7.5.1
Keywords:
Depends on:
Blocks: Writer-Images
  Show dependency treegraph
 
Reported: 2023-02-01 11:33 UTC by Mike Kaganski
Modified: 2023-05-15 17:41 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
A sample with two images (27.23 KB, application/vnd.oasis.opendocument.text)
2023-02-01 11:33 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2023-02-01 11:33:00 UTC
Created attachment 185043 [details]
A sample with two images

The attachment has first image anchored as-character to the empty second paragraph, and the second image anchored to paragraph 3, positioned to the right of the paragraph, and wrapped optimally.

Executing these two Basic commands:

  ThisComponent.GraphicObjects(0).setPropertyValue("RelativeWidth", 80)
  ThisComponent.GraphicObjects(0).setPropertyValue("RelativeHeight", 80)

is expected to make the first (as-char) image much larger, and shift the last paragraph down (presumably the second image would not fit to the first page; possibly it would need to move to the second page, together with the last paragraph, which is its anchor point).

Three problems arise:

1. The document does not get "modified" state after the macro.
2. There is no "undo" after the macro.
3. The layout of the document gets broken: the first image moves somewhere to the bottom of the first page (out from its paragraph, despite being anchored as character) - its *empty* frame is partially visible there *at some scroll positions* below the second, to-paragraph image.

It is possible that the last problem is independent from the first two.
Comment 1 Commit Notification 2023-02-02 13:01:24 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/333183d9a72d1e2b7ae65145092efec5e357ad14

tdf#153304: Add undo entries and set modified in SwXFrame::setProperty*

It will be available in 7.6.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 2 Commit Notification 2023-02-02 19:44:02 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/1c4790fbd594974d19da184077e086f70ef1e028

tdf#153304: Add undo entries and set modified in SwXFrame::setProperty*

It will be available in 7.5.1.

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 3 Buovjaga 2023-03-23 08:43:19 UTC
(In reply to Mike Kaganski from comment #0)
> Created attachment 185043 [details]
> A sample with two images
> 
> The attachment has first image anchored as-character to the empty second
> paragraph, and the second image anchored to paragraph 3, positioned to the
> right of the paragraph, and wrapped optimally.
> 
> Executing these two Basic commands:
> 
>   ThisComponent.GraphicObjects(0).setPropertyValue("RelativeWidth", 80)
>   ThisComponent.GraphicObjects(0).setPropertyValue("RelativeHeight", 80)
> 
> is expected to make the first (as-char) image much larger, and shift the
> last paragraph down (presumably the second image would not fit to the first
> page; possibly it would need to move to the second page, together with the
> last paragraph, which is its anchor point).
> 
> Three problems arise:
> 
> 1. The document does not get "modified" state after the macro.
> 2. There is no "undo" after the macro.
> 3. The layout of the document gets broken: the first image moves somewhere
> to the bottom of the first page (out from its paragraph, despite being
> anchored as character) - its *empty* frame is partially visible there *at
> some scroll positions* below the second, to-paragraph image.
> 
> It is possible that the last problem is independent from the first two.

I now only reproduce problem number 3.

Arch Linux 64-bit, X11
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 6dfa9c7c0db91a71f3787226636864161d5367ca
CPU threads: 8; OS: Linux 6.2; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 23 March 2023