comparison dwt/dnd/RTFTransfer.d @ 212:ab60f3309436

reverted the char[] to String and use the an alias.
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:12:38 +0200
parents 184ab53b7785
children e2affbeb686d
comparison
equal deleted inserted replaced
211:ff59aeb96cac 212:ab60f3309436
39 * </code></pre> 39 * </code></pre>
40 */ 40 */
41 public class RTFTransfer : ByteArrayTransfer { 41 public class RTFTransfer : ByteArrayTransfer {
42 42
43 private static RTFTransfer _instance; 43 private static RTFTransfer _instance;
44 private static const char[] CF_RTF = "Rich Text Format"; //$NON-NLS-1$ 44 private static const String CF_RTF = "Rich Text Format"; //$NON-NLS-1$
45 private static const int CF_RTFID; 45 private static const int CF_RTFID;
46 46
47 static this(){ 47 static this(){
48 CF_RTFID = registerType(CF_RTF); 48 CF_RTFID = registerType(CF_RTF);
49 } 49 }
78 public void javaToNative (Object object, TransferData transferData){ 78 public void javaToNative (Object object, TransferData transferData){
79 if (!checkRTF(object) || !isSupportedType(transferData)) { 79 if (!checkRTF(object) || !isSupportedType(transferData)) {
80 DND.error(DND.ERROR_INVALID_DATA); 80 DND.error(DND.ERROR_INVALID_DATA);
81 } 81 }
82 // CF_RTF is stored as a null terminated byte array 82 // CF_RTF is stored as a null terminated byte array
83 char[] string = (cast(ArrayWrapperString)object).array; 83 String string = (cast(ArrayWrapperString)object).array;
84 wchar* chars = StrToWCHARz(string); 84 wchar* chars = StrToWCHARz(string);
85 int codePage = OS.GetACP(); 85 int codePage = OS.GetACP();
86 int cchMultiByte = OS.WideCharToMultiByte(codePage, 0, chars, -1, null, 0, null, null); 86 int cchMultiByte = OS.WideCharToMultiByte(codePage, 0, chars, -1, null, 0, null, null);
87 if (cchMultiByte is 0) { 87 if (cchMultiByte is 0) {
88 transferData.stgmedium = new STGMEDIUM(); 88 transferData.stgmedium = new STGMEDIUM();
140 140
141 protected int[] getTypeIds(){ 141 protected int[] getTypeIds(){
142 return [CF_RTFID]; 142 return [CF_RTFID];
143 } 143 }
144 144
145 protected char[][] getTypeNames(){ 145 protected String[] getTypeNames(){
146 return [CF_RTF]; 146 return [CF_RTF];
147 } 147 }
148 148
149 bool checkRTF(Object object) { 149 bool checkRTF(Object object) {
150 if( auto s = cast(ArrayWrapperString)object ){ 150 if( auto s = cast(ArrayWrapperString)object ){