Bug 65631 - importing visio OLE causes scaling of WMF/EMF preview image of the object
Summary: importing visio OLE causes scaling of WMF/EMF preview image of the object
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
4.0.3.3 release
Hardware: Other Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:4.3.0 target:4.2.5
Keywords: regression
Depends on:
Blocks:
 
Reported: 2013-06-11 06:05 UTC by Winfried Donkers
Modified: 2014-05-15 10:51 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
word document with visio object (38.00 KB, application/msword)
2013-06-11 06:05 UTC, Winfried Donkers
Details
writer document with import results (95.34 KB, application/vnd.oasis.opendocument.text)
2013-06-11 06:06 UTC, Winfried Donkers
Details
sample document 2 (102.70 KB, application/vnd.oasis.opendocument.text)
2013-07-03 07:52 UTC, Winfried Donkers
Details
visio document -sampleb (126.00 KB, application/vnd.visio)
2013-09-26 07:00 UTC, Winfried Donkers (retired)
Details
writer document with visio sampleb inserted (175.65 KB, application/vnd.oasis.opendocument.text)
2013-09-26 07:06 UTC, Winfried Donkers (retired)
Details
writer document with visio sampleb after dummy edit (180.85 KB, application/vnd.oasis.opendocument.text)
2013-09-26 07:13 UTC, Winfried Donkers (retired)
Details
backtrace of exception (17.83 KB, text/plain)
2014-05-12 09:37 UTC, Winfried Donkers (retired)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Winfried Donkers 2013-06-11 06:05:48 UTC
Created attachment 80650 [details]
word document with visio object

steps to reproduce problem:
(O/S needs to be Windows, MS Visio needs te be installed)

1. open word document with visio object in word or LibreOffice (see attachment)
2. select visio object and copy
3. open new writer document
4. paste visio object
5a. when copied from word: the pasted object only fills part of the frame. changing the page size in visio with 5mm makes the object fill the frame as it should.
5b. when copied from writer: the pasted object fills te frame as it should be, but when double clicking the object to edit and closing visio without changing anything, the object only fills part of the frame.

The result of the paste actions and the following actions described under step 5 are in the second attachment (writer document with import results).

used software:
LibreOffice version 4.0.3.3, MS Windows 7-64 Professional (NL), MS Visio 2007, MS Office 2000.
Comment 1 Winfried Donkers 2013-06-11 06:06:46 UTC
Created attachment 80651 [details]
writer document with import results
Comment 2 Winfried Donkers 2013-07-03 07:52:52 UTC
Created attachment 81943 [details]
sample document 2

Attachment shows several cases of Visio-objects that are shown scaled or distorted.
The document explains how the objects are created.

Document is made with LibreOffice version 4.0.4 on Windows 7. Vision is version 2007.
Comment 3 Winfried Donkers (retired) 2013-07-04 10:51:17 UTC
To make matters worse:
opening attachment 81943 [details] with version 3.6.5 causes LibreOffice to hang.
Comment 4 Winfried Donkers (retired) 2013-08-05 06:55:59 UTC
Colleagues assure me that this problem did not exist in previous versions (definitively not in v3).
Comment 5 Winfried Donkers (retired) 2013-08-26 07:21:44 UTC
Problem still present in version 4.0.5.2
Comment 6 Winfried Donkers (retired) 2013-08-26 08:10:00 UTC
Problem still present in version 4.1.1.2
Comment 7 Winfried Donkers (retired) 2013-09-26 06:31:52 UTC
Problem still present in version 4.1.2.2

Additional information:
When inserting a Visio object via copy in Visio and paste special in Libreoffice, the object is inserted correctly, and then changed to a distorted version within a second.
Double clicking on the object and performing a bogus change (e.g. change a text by replacing a character (with the same)) makes the distortion go away.

I will ask permission to upload the visio object with which I can reproduce this behaviour.
Comment 8 Winfried Donkers (retired) 2013-09-26 07:00:27 UTC
Created attachment 86616 [details]
visio document -sampleb
Comment 9 Winfried Donkers (retired) 2013-09-26 07:06:42 UTC
Created attachment 86617 [details]
writer document with visio sampleb inserted

Steps to reproduce (I used Windows 7):
-open new writer document (I used version 4.1.2.RC2)
-open visio document with visio (I used visio 2007)
-select all in visio document
-copy (Ctrl C)
-go to writer document
-paste special (Shift Ctrl V)
-select Visio object, OK
-the object is inserted and shows OK, but within (half) a second the object is changed to parts of the original image (see attachment)
Comment 10 Winfried Donkers (retired) 2013-09-26 07:13:33 UTC
Created attachment 86618 [details]
writer document with visio sampleb after dummy edit

Steps to reproduce:
-start with steps in previous comment
-double click on object to edit
-Visio opens with the correct image
-change one little thing (e.g. replace a character in a text)
-close Visio
-the object in the writer document shows OK now

Note:
My colleagues report that somewhat similar behaviour sometimes also occurs with other inserted objects, e.g. calc graphs or other (non-Visio) images. I have not been able to reproduce that, but it may be that the cause is not in the libvisio part but in the mebedded object part of LibreOffice.
Comment 11 Winfried Donkers (retired) 2014-01-17 06:33:55 UTC
Problem still present in version 4.2.0.2 with Windows 7
Comment 12 Michael Stahl (CIB) 2014-05-12 08:38:33 UTC
cannot reproduce comment #9 on master, can reproduce on 4.2.3.3

cannot reproduce anything from description on master [build from Friday];
after loading the files indeed some OLE previews have those problems,
but after activating and editing them in Visio they look fine,
whether or not i change anything in Visio.
(_but_ i don't have Word installed on that VM so haven't tested
 what happens when copying from Word as in "5a")

Winfried, can you please download a tinderbox master build and see
which of the problems you still see there?
http://dev-builds.libreoffice.org/daily/

oh, master does mis-render some fonts in the WMF images, which 4.2
does properly, but that should be tracked in a separate bug,
not in this one.


InsertOleObject: aSz 11906 11040
Comment 13 Winfried Donkers (retired) 2014-05-12 08:48:20 UTC
(In reply to comment #12)

> Winfried, can you please download a tinderbox master build and see
> which of the problems you still see there?
> http://dev-builds.libreoffice.org/daily/

Michael, will do so asap.

BTW, the trick to open the object in Visio and close it again to 'fix' the scaling is the workaround we use.
Comment 14 Winfried Donkers (retired) 2014-05-12 09:37:37 UTC
Created attachment 98892 [details]
backtrace of exception

Michael:

Just tested steps 1 - 5a with master build from May 11 on Windows7-64 (NL) machine with Visio 2007 and Word 2000:
-when pasting, an exception occurs (see attached backtrace). When ignoring the exception, the imported object fills the frame as it should be.

Also tested with 5b: the fonts in the object are distorted when opening the doc file with writer and when pasting the Visio object in a new writer document, but they look OK after open/close in Visio. Probably the same as you experienced.

(I 'hi-jacked' a machine with Word and Visio and installed LODev and windbg; will uninstall soon, as regular user will be back tomorrow. So if you want me to do more tests on this set, let me know.)
Comment 15 Michael Stahl (CIB) 2014-05-12 13:22:06 UTC
(In reply to comment #14)
> Just tested steps 1 - 5a with master build from May 11 on Windows7-64 (NL)
> machine with Visio 2007 and Word 2000:
> -when pasting, an exception occurs (see attached backtrace). When ignoring
> the exception, the imported object fills the frame as it should be.

probably some issue with the RTF import abusing cursors,
not related to this bug, good to hear you could work-around it.

> Also tested with 5b: the fonts in the object are distorted when opening the
> doc file with writer and when pasting the Visio object in a new writer
> document, but they look OK after open/close in Visio. Probably the same as
> you experienced.

right, have filed bug 78603 about that now

> (I 'hi-jacked' a machine with Word and Visio and installed LODev and windbg;
> will uninstall soon, as regular user will be back tomorrow. So if you want
> me to do more tests on this set, let me know.)

now the problem is to find out what has fixed this between 4.2 and master;
unfortunately without bibisect for Windows it's going to be difficult...
Comment 16 Commit Notification 2014-05-12 16:43:33 UTC
Jan Holesovsky committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4bf27036d6b8ff56bdc76325a874f17ad8f9ddcb&h=libreoffice-4-2

OLE: Turn an OSL_ENSURE() into a real condition (related: fdo#65631)


It will be available in LibreOffice 4.2.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 17 Michael Stahl (CIB) 2014-05-12 16:46:35 UTC
was thinking that this might fix it but it's in 4.2.4.2 already:

commit 2a7fdf2a7bb7345c49c988dfd1fcdb41cebb8a1e
Author:     Miklos Vajna <vmiklos@collabora.co.uk>
AuthorDate: Mon Apr 7 16:51:29 2014 +0200

    fdo#77140 embeddedobj: avoid unneeded conversion in ConvertBufferToFormat()


ah have found another commit from Kendy, that one seems
to change things on master, pushed it to 4.2; i cannot build 4.2
branch easily, Winfried please check in the 4.2 dailies if there
are still problems.
Comment 18 Winfried Donkers (retired) 2014-05-13 05:49:54 UTC
(In reply to comment #17)
> [...] Winfried please check in the 4.2 dailies if there
> are still problems.

Will do, as soon as a daily including Kendy's patch is available.
Comment 19 Winfried Donkers (retired) 2014-05-14 05:48:45 UTC
(In reply to comment #17)
> [...] Winfried please check in the 4.2 dailies if there
> are still problems.

Tested with 4.2.5.0.0 daily build 2014-05-13-14.56.24, on Windows7-32 (NL) machine with Visio 2007 and Word 2000:
steps 1 - 5a: when pasting, the imported object fills the frame as it should be.
steps 1 - 5b: when pasting, the imported object fills the frame as it should be.

IOW, looks good :-)

BTW, neither test shows distorted fonts.
Comment 20 Michael Stahl (CIB) 2014-05-15 10:51:50 UTC
great, so this one looks fixed now.