[Libreoffice] Clipboard handling on Windows

Kohei Yoshida kohei.yoshida at suse.com
Fri Dec 2 08:28:42 PST 2011


Hi fellow hackers,

While investigating this bug

https://bugs.freedesktop.org/show_bug.cgi?id=33100

which involves Windows' clipboard handling, I've come to the realization
that, there are two ways to communicate with the clipboard on Windows.

One is to use the regular clipboard API

http://msdn.microsoft.com/en-us/library/windows/desktop/ms648709%
28v=vs.85%29.aspx

which allows you to open, close, query the available formats, and fetch
the raw clipboard data stream for a requested format.

The other way is to obtain the IDataObject instance from the clipboard,
and fetch the clipboard data stream from that object.

http://msdn.microsoft.com/en-us/library/windows/desktop/ms688421%
28v=vs.85%29.aspx

First of all, I don't quite understand why two different ways, and what
the differences are between the two.

Our current clipboard implementation in dtrans uses the
IDataObject-based approach.

Now, as I discovered while investigating the bug, using the IDataObject
method does not necessarily return all available clipboard formats,
whereas using the regular clipboard API does.  I was thinking naively
about perhaps replacing our current IDataObject-based approach with the
clipboard API based one, but the whole data transfer code does more than
just handling the clipboard, so I don't really know how feasible
replacing it would be...

Does anyone have a better grasp on why we do it the way we do?

Feedback and suggestions very much appreciated.  Also, if anyone wants
to grab Bug 33100, s/he will be more than welcome. :-)

Thanks,

Kohei 

-- 
Kohei Yoshida, LibreOffice hacker, Calc



More information about the LibreOffice mailing list