Bug 118140 - FILEOPEN: DOCX: images incorrectly cropped
Summary: FILEOPEN: DOCX: images incorrectly cropped
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.1.0.0.alpha1+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, filter:docx, regression
: 120508 (view as bug list)
Depends on:
Blocks: Regressions-imageHandling
  Show dependency treegraph
 
Reported: 2018-06-13 11:50 UTC by Xisco Faulí
Modified: 2019-10-22 10:20 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
comparison MSO 2010 and LibreOffice 6.2 (627.81 KB, image/png)
2018-06-13 11:50 UTC, Xisco Faulí
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2018-06-13 11:50:31 UTC
Created attachment 142701 [details]
comparison MSO 2010 and LibreOffice 6.2

Steps to reproduce:
1. Open attachment 82686 [details] from bug 67087

Observed behaviour -> Both images on page 1 and 2 are smaller than they should be. Check attached screenshot.

Reproduced in

Version: 6.2.0.0.alpha0+
Build ID: 4c6e11886a9d396bf7be18e9e3209a73c6e303ad
CPU threads: 4; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded

[Bug found by office-interoperability-tools]
Comment 1 Xisco Faulí 2018-06-13 11:52:38 UTC
Regression introduced by:

author	Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>	2018-05-11 00:22:06 +0900
committer	Tomaž Vajngerl <quikee@gmail.com>	2018-05-12 10:07:09 +0200
commit 8484e52675052848d2d3ffe07378ce2ad29fd288 (patch)
tree 61745cc72ae36c6a04572021e6ccac1638a12c35
parent 3e2fdcf48055572dd0f6bb7d73b14c1832622f24 (diff)
tdf#117427 missing API for determining and loading linked graphic
This adds 2 properties to GraphicDescriptor:
"Linked" - to indicate if the graphic is a linked one
"OriginURL" - the URL of the location from where the graphic was
or will be loaded (and is linked to)

Additionally GraphicProvider was extended with a "LoadAsLink"
(media)property, which can be passed using queryGraphic method.
If "LoadAsLink" is set to true, then the Graphic will be created
as a linked one.

In addition the tests for this API was added to VCL (home of this
API implementors).

Bisected with: bibisect-linux64-6.1

Adding Cc: to Tomaž Vajngerl
Comment 2 Xisco Faulí 2018-10-11 13:42:34 UTC
*** Bug 120508 has been marked as a duplicate of this bug. ***
Comment 3 Xisco Faulí 2018-10-11 13:43:05 UTC
@Miklos, I thought you could be interested in this issue...
Comment 4 Xisco Faulí 2019-05-29 15:42:44 UTC
attachment 151401 [details] from bug 125281 is also affected
Comment 5 Xisco Faulí 2019-05-29 20:54:18 UTC
*** Bug 118036 has been marked as a duplicate of this bug. ***
Comment 6 Xisco Faulí 2019-05-29 20:55:32 UTC
I think I have a fix for this issue based on miklos' commit: https://gerrit.libreoffice.org/plugins/gitiles/core/+/69b62cfcbd364d7f62142149c2f690104b217ca1%5E%21

Tomorrow I'll submit it to gerrit along with a unittest :D
Comment 7 Xisco Faulí 2019-05-30 10:21:52 UTC
I tried to fix it in a similar way to bug 125281

diff --git a/vcl/source/graphic/UnoGraphicProvider.cxx b/vcl/source/graphic/UnoGraphicProvider.cxx
index 95292ee13186..3ed73c6cf0bb 100644
--- a/vcl/source/graphic/UnoGraphicProvider.cxx
+++ b/vcl/source/graphic/UnoGraphicProvider.cxx
@@ -408,6 +408,11 @@ uno::Reference< ::graphic::XGraphic > SAL_CALL GraphicProvider::queryGraphic( co
             if (bLazyRead)
             {
                 Graphic aGraphic = rFilter.ImportUnloadedGraphic(*pIStm);
+                Size aPrefSize;
+                aPrefSize.setWidth ( nExtWidth );
+                aPrefSize.setHeight ( nExtHeight );
+                // Size available in metafile header, set that here.
+                aGraphic.SetPrefSize(aPrefSize);
                 if (!aGraphic.IsNone())
                     aVCLGraphic = aGraphic;
             }

but then testImageLazyRead fails, so I don't really know how to fix it...
@Miklos, feel free to take it, I guess you can fix it in 2 minutes
Comment 8 Xisco Faulí 2019-10-22 10:19:32 UTC
No longer reproducible in

Version: 6.4.0.0.alpha1+
Build ID: de4839e66d3d195315729b95cc144cdab96b6e74
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

nor in

Versión: 6.3.3.1 (x86)
Id. de compilación: f41f4c7f9507aeca13cb9df51f34d80e8ba30a99
Subprocs. CPU: 1; SO: Windows 6.1; Repres. IU: predet.; VCL: win; 
Configuración regional: es-ES (es_ES); Idioma de IU: es-ES
Calc: threaded

Issued fixed by https://cgit.freedesktop.org/libreoffice/core/commit/?id=6369cab9b1e16275c8700692bb717aec3c42d346

@Luke Deller, Thanks for fixing this issue!