diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2003-06-10 09:29:28 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2003-06-10 09:29:28 +0000 |
commit | af70190331b9a3ce0dd14f6cbaacc6397452133d (patch) | |
tree | 560cd46d77080d89cbd4981275a247219a684d26 | |
parent | 09c833b202d472c10a23228082dfb90b2a1816f4 (diff) |
INTEGRATION: CWS sdk02 (1.1.2); FILE ADDED
2003/05/09 11:44:39 jsc 1.1.2.1: #109045# insert new and remove example zip file
-rw-r--r-- | odk/examples/DevelopersGuide/OfficeDev/Clipboard/TextTransferable.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Clipboard/TextTransferable.java b/odk/examples/DevelopersGuide/OfficeDev/Clipboard/TextTransferable.java new file mode 100644 index 000000000000..a7661bcdc2af --- /dev/null +++ b/odk/examples/DevelopersGuide/OfficeDev/Clipboard/TextTransferable.java @@ -0,0 +1,50 @@ +import com.sun.star.datatransfer.*; +import com.sun.star.datatransfer.clipboard.*; +import com.sun.star.uno.Type; + +//--------------------------------------- +// A simple transferable containing only +// one format, unicode text +//--------------------------------------- + +public class TextTransferable implements XTransferable +{ + public TextTransferable(String aText) + { + text = aText; + } + + // XTransferable methods + + public Object getTransferData(DataFlavor aFlavor) throws UnsupportedFlavorException + { + if ( !aFlavor.MimeType.equalsIgnoreCase( UNICODE_CONTENT_TYPE ) ) + throw new UnsupportedFlavorException(); + + return text; + } + + public DataFlavor[] getTransferDataFlavors() + { + DataFlavor[] adf = new DataFlavor[1]; + + DataFlavor uniflv = new DataFlavor( + UNICODE_CONTENT_TYPE, + "Unicode Text", + new Type(String.class) ); + + adf[0] = uniflv; + + return adf; + } + + public boolean isDataFlavorSupported(DataFlavor aFlavor) + { + return aFlavor.MimeType.equalsIgnoreCase(UNICODE_CONTENT_TYPE); + } + +// members + + private final String text; + private final String UNICODE_CONTENT_TYPE = "text/plain;charset=utf-16"; +} |