Non-standard mimetype handling in clipboard on Windows
artfwo at commonsmachinery.se
Wed Oct 23 13:20:19 CEST 2013
I'm working with Commons Machinery  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  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 . The metadata is copied alongside
the image as an additional clipboard object of mimetype
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 , but there
doesn't seem to be any conclusion to that.
I'd appreciate any feedback and thoughts on the matter.
More information about the LibreOffice