0

I'm trying to read the mathML clipboard content from the windows Math Input Panel, but when I check getAvailableFlavors from the FlavorEvent from a FlavorListner on the results of getSystemClipboard, the list of flavors is empty.

Does this mean that there's no hope, or is there a way for me to add a new Flavor that will allow me to access the MathML content?

I'd rather stay in Java if I can, although clear C# code would be helpful if that's the only way to do it.

Witbrock
  • 502
  • 2
  • 5
  • 12
  • Take a look at [Clipboard#getAvailableDataFlavors](http://docs.oracle.com/javase/7/docs/api/java/awt/datatransfer/Clipboard.html#getAvailableDataFlavors()). Basically, you will want to list all the data favors AFTER ynhave copied something from MathML and chekc what's available – MadProgrammer May 21 '13 at 21:15
  • I had tried with but no suitable flavour:`public static void main(String[] args) { Toolkit.getDefaultToolkit().getSystemClipboard().addFlavorListener(new FlavorListener() { @Override public void flavorsChanged(FlavorEvent e) { DataFlavor[] f=((Clipboard)e.getSource()).getAvailableDataFlavors(); for (DataFlavor df: Arrays.asList(f)){ System.out.println("Flav:["+df.getHumanPresentableName()+"]" +"\n\tMime:"+df.getMimeType()); } } }); }` – Witbrock May 29 '13 at 23:09

1 Answers1

0

It's MathML Presentation. There's also simply a MathML flavor, but their contents is identical. That's as reported by ClipSpy, but I know in practice if there's a MathML-knowledgeable app beneath the MIP, it should insert properly.

afwings
  • 461
  • 3
  • 10
  • In the debugger, I can see the "MathML Presentation" and "MathML" entries in the WClipboard static flavorMap getFlavorsForNaticCache as a soft reference, but I can't see it in the nativeToFlavor map. Does this mean that I need to make a flavor for "MathML Presentation" and put it in this map? And then in the flavor I tell it what class to instantiate? I'm fine with that, but I don't really see Java allowing me to tell it that some arbitrary class can be used. Will it? – Witbrock May 30 '13 at 23:03