Bug 138623 - FILESAVE: RTF: Cropped images are lost after RT
Summary: FILESAVE: RTF: Cropped images are lost after RT
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.3.0.4 release
Hardware: All All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, dataLoss, regression
Depends on:
Blocks: OOXML-support-crop-shape-regressions
  Show dependency treegraph
 
Reported: 2020-12-02 16:38 UTC by Xisco Faulí
Modified: 2022-08-25 14:00 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2020-12-02 16:38:28 UTC
+++ This bug was initially created as a clone of Bug #128501 +++

Steps to reproduce:
1. Open attachment 46861 [details] from bug 37315
2. Save it as RTF file
3. Open the new created file

-> all the images are gone

Reproduced in

Version: 6.4.0.0.alpha1+
Build ID: 2d0a4182712673d8f7a5abe919cd2a1d5ece4a77
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

[Bug found by office-interoperability-tools]
Comment 1 Xisco Faulí 2020-12-02 16:38:58 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=f4ba484183a1e7b9824f10580d633466c266828f

author	Tamas Bunth <tamas.bunth@collabora.co.uk>	2019-05-13 01:02:07 +0200
committer	Tamás Bunth <btomi96@gmail.com>	2019-05-13 18:14:26 +0200
commit f4ba484183a1e7b9824f10580d633466c266828f (patch)
tree 5795d2c442e3dbb3496fcfd5ac6f5bd8ddc39e15
parent 8401a26363bf7cb3c30bf783b3f8978f4b69e4c4 (diff)
ooxml import: supprt cropping to shape

Bisected with: bibisect-linux64-6.3

Adding Cc: to Tamas Bunth
Comment 2 Justin L 2021-12-21 08:07:34 UTC
I'm not sure how much I would call this a regression. This is a DOCX file being imported, and the code change is about import. However, the bug report is about RTF export.

The image is now imported as a customShape. I assume that RTF doesn't know how to export custom shapes. If true, this would be an enhancement request to start supporting that.

The linked bug reports provide export support added for PPT and DOC formats, so that should be rather helpful.
Comment 3 Miklos Vajna 2021-12-21 08:12:14 UTC
Agreed, a "your regression is my feature" case. :-)

RTF export has some support for custom shapes, see code around https://github.com/libreoffice/core/blob/6698f0267496d1b9f625294aaacdd608036b799d/sw/source/filter/ww8/rtfsdrexport.cxx#L368-L377 -- but when I did that, I only had hand-drawing (pencil commands like move-to, line-to, curve-to) in mind, probably that needs extending to handle bitmap fill.
Comment 4 Justin L 2022-08-25 14:00:42 UTC
Getting an exception
sw/source/filter/ww8/rtfsdrexport.cxx:507: failed to fetch graphic.
com.sun.star.beans.UnknownPropertyException message: "Graphic at svx/source/unodraw/unoshape.cxx:1701"

A hack fix that at least preserves the pictures (without any fancy cropping) could be a fallback attempt to:
    xPropertySet->getPropertyValue("FillBitmap") >>= xGraphic;