Issue 94515

Summary: XTransferable.getTransferDataFlavors() of writer documents lists unsupported DataFlavors
Product: App Dev Reporter: clutz <chrlutz>
Component: apiAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: issues, nesshof
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description clutz 2008-10-01 08:03:30 UTC
I have got a small codesnippet that tries to call
XTransferable.getTransferData(flavor) for all flavors listed in
XTransferable.getTransferDataFlavors() for a TextDocument.

The DataFlavor "Star Embed Source (XML)" is listed in the list of supported
DataFlavors for this Component, but trying to get the respective transfer data
throws an UnsupportedFlavorException.

So please either remove "Star Embed Source (XML)" from the list of supported
DataFlavors or enable this functionality that the exception is not thrown.

 
To reproduce, I used the following snippet:

  byte[] buffy;

  XTransferable transferable = (XTransferable)
UnoRuntime.queryInterface(XTransferable.class, UNO.desktop.getCurrentComponent());

  DataFlavor[] flavors = transferable.getTransferDataFlavors();

  for (DataFlavor fl : flavors) {
    System.out.println(fl.HumanPresentableName + " (" + fl.MimeType + ") " +
fl.DataType);
    try {

      buffy = (byte[]) transferable.getTransferData(fl);

    } catch (Exception e) {
      e.printStackTrace();
    }
  }


The output of the snippet is:


Windows MetaFile (application/x-openoffice-wmf;windows_formatname="Image WMF")
Type[[]byte]
Star Object Descriptor (XML)
(application/x-openoffice-objectdescriptor-xml;windows_formatname="Star Object
Descriptor (XML)") Type[[]byte]
Star Embed Source (XML)
(application/x-openoffice-embed-source-xml;windows_formatname="Star Embed Source
(XML)") Type[[]byte]
com.sun.star.datatransfer.UnsupportedFlavorException: 
	at
com.sun.star.lib.uno.environments.remote.Job.remoteUnoRequestRaisedException(Job.java:187)
	at com.sun.star.lib.uno.environments.remote.Job.execute(Job.java:153)
	at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:349)
	at com.sun.star.lib.uno.environments.remote.JobQueue.enter(JobQueue.java:318)
	at
com.sun.star.lib.uno.environments.remote.JavaThreadPool.enter(JavaThreadPool.java:106)
	at
com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:657)
	at
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.request(ProxyFactory.java:159)
	at
com.sun.star.lib.uno.bridges.java_remote.ProxyFactory$Handler.invoke(ProxyFactory.java:141)
	at $Proxy17.getTransferData(Unknown Source)
	at TransferableText.main(TransferableText.java:32)
Bitmap (application/x-openoffice-bitmap;windows_formatname="Bitmap") Type[[]byte]
PNG (image/png) Type[[]byte]
Comment 1 jsc 2008-10-01 08:58:49 UTC
seems to be a writer issue or maybe related to the framework.  
Comment 2 thomas.lange 2010-07-02 07:32:47 UTC
.
Comment 3 thomas.lange 2010-08-20 11:48:42 UTC
tl->cd: SwXTextDocument inherits the XTransferable interface from SfxBaseModel,
thus please take over. Thanks!