Non-standard mimetype handling in clipboard on Windows

Artem Popov artfwo at commonsmachinery.se
Wed Oct 23 13:20:19 CEST 2013


Hi all,

I'm working with Commons Machinery [1] on developing free software
that aims to provide ways of easily attributing digital works (in
existing tools too). As part of this, we've made a prototype
LibreOffice extension [2] that enables pasting images together with
metadata into Writer. We also have a Firefox add-on that can copy both
metadata and image to clipboard [3]. The metadata is copied alongside
the image as an additional clipboard object of mimetype
"application/rdf+xml".

This actually works pretty well on Linux, where the initial prototype
was developed. RDF data is accessible from the extension as a
ByteSequence object wrapped in a DataFlavor returned by the clipboard
instance. However, on Windows, the metadata is unavailable, apparently
because the clipboard only shows DataFlavors which have been
successfully processed by CDataFormatTranslator class in dtrans.

After some hacking, I found out that adding "application/rdf+xml"
mimetype to translation table in
dtrans/source/win32/ftransl/ftransl.cxx makes the type appear among
the data flavors on Windows. The solution doens't look very elegant,
so first, I'd like to know if there exists a better way to access
non-standard data in clipboard under Windows.

If no such way exists, I wonder, if dtrans could be patched to support
"application/rdf+xml" mimetype upstream? Or if there is a more general
solution? I found a related discussion from 2011 [4][5], but there
doesn't seem to be any conclusion to that.

I'd appreciate any feedback and thoughts on the matter.

Thanks,
--Artem

[1] http://commonsmachinery.se/
[2] https://github.com/commonsmachinery/lo-paste-with-credit
[3] https://addons.mozilla.org/en-US/firefox/addon/copy-rdfa-metadata/
[4] http://lists.freedesktop.org/archives/libreoffice/2011-December/021711.html
[5] http://thread.gmane.org/gmane.comp.documentfoundation.libreoffice.devel/20078/


More information about the LibreOffice mailing list