Issue 123407 - Paste as bitmap from MS Paint does not paste anything
Summary: Paste as bitmap from MS Paint does not paste anything
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: 4.0.1
Hardware: All Windows, all
: P3 Normal (vote)
Target Milestone: 4.1.0
Assignee: Armin Le Grand
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-02 12:54 UTC by Ariel Constenla-Haile
Modified: 2017-05-20 10:35 UTC (History)
8 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ariel Constenla-Haile 2013-10-02 12:54:33 UTC
Download image from attachment 50595 [details] in bug 84905

1) open Paint
2) open the attached graphic with Paint
3) in Paint choose "select all" and copy the graphic to the clipboard
4) Open a new blank page in Writer
5) Open the drop-down menu from the Paste toolbar icon. There are three options:
- "Imagen de Paintbrush" (OS UI is in Spanish)
- GDI metafile
- Bitmap
Paste the image as Bitmap

Bug: nothing is pasted.

* The same happens with the dialogue from menu Edit - Paste special...

* Does not happen in Draw with the dialogue from menu Edit - Paste special... (unrelated bug: the Paste toolbar icon does not have a drop-down menu; this is inconsistent with Writer behaviour)
Comment 1 Edwin Sharp 2013-10-02 13:03:31 UTC
Confirmed with Rev. 1525015 Win 7.

PS OK in Draw.
Comment 2 Francesca 2013-10-02 17:11:44 UTC
Had the same issue while commenting on <a href="https://issues.apache.org/ooo/show_bug.cgi?id=84905">bug 84905</a>, until I closed Paint, and then I was able to paste the image as a bitmap--still a serious bug, obviously.
Comment 3 Armin Le Grand 2013-10-11 10:15:19 UTC
ALG: Could not reproduce in AOO401 and trunk, may have to do with a clipboard task fixed for AOO401. COuld you try with AOO401, please?
Comment 4 Ariel Constenla-Haile 2013-10-11 18:47:57 UTC
(In reply to Armin Le Grand from comment #3)
> ALG: Could not reproduce in AOO401 and trunk, may have to do with a
> clipboard task fixed for AOO401. COuld you try with AOO401, please?

Still reproducible with Rev. 1531366

May be not relevant, but I close every application and leave only Paint and AOO opened.
As stated in comment 2, if I close paint, paste as bitmap works.
Comment 5 Kenil 2013-10-11 21:24:21 UTC
Title: Paste as bitmap from MS Paint does not paste anything

Description: Pasting an image from Microsoft Paint to OpenOffice Writer does not work. Application remains responsive and does not crash, however, the action is not performed. Copied a picture from a Word document and doing a normal paste or a paste special as a GDI Metafile into Writer both work but not pasting as a bitmap.

Status: CONFIRMED

OS: Windows 8 Professional 32-bit 

Replication: Same as original report.

If you select Bitmap from the Paste Special dialog box, the object is painted faster and it becomes a static object unlike regular paste where image is linked and embedded. Therefore, resolution of this bug is important for the users.
Comment 6 Armin Le Grand 2013-10-14 16:38:46 UTC
ALG: Strange, works in draw/impress, but not in writer and/or calc. Taking a look...
Comment 7 Armin Le Grand 2013-10-15 09:13:57 UTC
ALG: For the unrelated bug (the Paste toolbar icon does not have a drop-down menu; this is inconsistent with Writer behaviour): I get a drop-down as soon as I copy something to the clipboard which offers multiple formats (here: image in Paint). It seems to dynamically react on the list of possible formats in the paste list, thus being not an error but evtl. too much optimized.
Comment 8 Armin Le Grand 2013-10-15 09:20:31 UTC
ALG: I checked the difference between the apps, in draw/impress there is a fallback when no bitmap (CF_DIB) can be achieved, a fallback will try to create one from fallbacks, e.g. metafile. Indeed debugging shows that Paint offers CF_DIB, but does not deliver it when AOO tries to get it. I tried the same with Paint.NET and there a CF_DIB si fetched with the same CFormatEtc which does not get a bitmap in the case of Paint.
Thus, draw/impress works due to the fallback when the clipboard offers CF_DIB but does not deliver it. The same fallback could be added to Writer and Calc, but first I will check older AOO versions...
Comment 9 Armin Le Grand 2013-10-15 09:59:50 UTC
ALG: Comparing with AOO34 where it works; there, CF_DIB is fetched from clipboard (8) instead of CF_DIBV5 (17). MS says in its docu that CF_DIB is converted to CF_DIBV5 if that is asked for (see http://msdn.microsoft.com/en-us/library/windows/desktop/ms649013%28v=vs.85%29.aspx). This does not happen in case of Paint clipboard content; a CF_DIB has to be fetched.
The decision depends on the table in ftransl.cxx (see CDataFormatTranslator::initTranslationTable()). Maybe CF_DIBV5 shoubd be removed again; it seems to lead to problems. Thus there are two possible fixes:

(a) Add fallbacks to read other clipboard formats in Writer and Calc
(b) Put CF_DIBV5 behind CF_DIB in tables
Comment 10 Armin Le Grand 2013-10-15 10:45:38 UTC
ALG: Found (c), in CDOTransferable::getTransferData do try CF_DIB when CF_DIBV5 failed. This seems promising and a good fallback, also only system-dependent on win systems. Tried that works well. Doing some more checks...
Comment 11 SVN Robot 2013-10-15 10:54:44 UTC
"alg" committed SVN revision 1532285 into trunk:
i123407 Do not insist on CF_DIBV5 for clipboard data, also accept CF_DIB
Comment 12 Armin Le Grand 2013-10-15 10:55:10 UTC
ALG: Works as expected, committed, done.
Comment 13 John 2014-01-26 14:10:11 UTC
Armin
Could you possibly have a look at https://issues.apache.org/ooo/show_bug.cgi?id=124085 -  Image copied out of OpenOffice 4.0.1 (Writer, Calc and Draw) is corrupted when pasted into image editors - which I recently posted.

I am not a developer but it seems very similar to this one - confusion between CF_DIB and CF_DIBV5 causing corruption when copied image is pasted into some (IrfanView, Paint.NET) but not all (MS Paint, GIMP) image editors, and I think it will be very simple to fix.
Thanks
Comment 14 Armin Le Grand 2014-01-28 17:44:56 UTC
Hi John, this one was about pasting from external to AOO, the solution is to check for DIBv5 first and then try DIB if that fails. The other one is about providing DIBv5 to the clipboard for external apps, more or less vice-versa. I am aware of this one.
Comment 15 zhaoshzh 2014-04-09 05:23:58 UTC
verified on on AOO410m15(Build:9761)  -  Rev. 1585021