Add _MB_CP_* defines.
[wine] / include / mlang.idl
1 /*
2  * Copyright (C) 2004 Mike McCormack
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 import "unknwn.idl";
20
21 interface IStream;
22
23 /* FIXME: LANDID is defined in winnt.h and mlang.h in the platform SDK */
24 cpp_quote("#ifndef _WINNT_")
25 typedef WORD LANGID;
26 cpp_quote("#endif")
27
28 [
29   object,
30   pointer_default(unique)
31 ]
32 interface IMLangCodePages : IUnknown
33 {
34     HRESULT GetCharCodePages(      
35         [in] WCHAR chSrc,
36         DWORD *pdwCodePages);
37     HRESULT GetStrCodePages(      
38         [in, size_is(cchSrc)] const WCHAR *pszSrc,
39         [in] long cchSrc,
40         [in] DWORD dwPriorityCodePages,
41         [out] DWORD *pdwCodePages,
42         [out] long *pcchCodePages);
43     HRESULT CodePageToCodePages(      
44         [in] UINT uCodePage,
45         [out] DWORD *pdwCodePages);
46     HRESULT CodePagesToCodePage(      
47         [in] DWORD dwCodePages,
48         [in] UINT uDefaultCodePage,
49         [out] UINT *puCodePage);
50 };
51
52 [
53   object,
54   pointer_default(unique)
55 ]
56 interface IMLangFontLink : IMLangCodePages
57 {
58     HRESULT GetFontCodePages(
59         [in] HDC hDC,
60         [in] HFONT hFont,
61         [out] DWORD *pdwCodePages );
62
63     HRESULT MapFont(      
64         [in] HDC hDC,
65         [in] DWORD dwCodePages,
66         [in] HFONT hSrcFont,
67         [out] HFONT *phDestFont);
68
69     HRESULT ReleaseFont(      
70         [in] HFONT hFont);
71
72     HRESULT ResetFontMapping();
73 };
74
75 [
76   object,
77   pointer_default(unique)
78 ]
79 interface IEnumScript : IUnknown
80 {
81     const USHORT MAX_SCRIPT_NAME = 48;
82     const USHORT MAX_MIMEFACE_NAME = 32;
83
84     typedef BYTE SCRIPT_ID;
85     typedef __int64 SCRIPT_IDS;
86
87     typedef enum tagSCRIPTCONTF
88     {
89         sidDefault = 0,
90         sidMerge = sidDefault + 1,
91         sidAsciiSym = sidMerge + 1,
92         sidAsciiLatin = sidAsciiSym + 1,
93         sidLatin = sidAsciiLatin + 1,
94         sidGreek = sidLatin + 1,
95         sidCyrillic = sidGreek + 1,
96         sidArmenian = sidCyrillic + 1,
97         sidHebrew = sidArmenian + 1,
98         sidArabic = sidHebrew + 1,
99         sidDevanagari = sidArabic + 1,
100         sidBengali = sidDevanagari + 1,
101         sidGurmukhi = sidBengali + 1,
102         sidGujarati = sidGurmukhi + 1,
103         sidOriya = sidGujarati + 1,
104         sidTamil = sidOriya + 1,
105         sidTelugu = sidTamil + 1,
106         sidKannada = sidTelugu + 1,
107         sidMalayalam = sidKannada + 1,
108         sidThai = sidMalayalam + 1,
109         sidLao = sidThai + 1,
110         sidTibetan = sidLao + 1,
111         sidGeorgian = sidTibetan + 1,
112         sidHangul = sidGeorgian + 1,
113         sidKana = sidHangul + 1,
114         sidBopomofo = sidKana + 1,
115         sidHan = sidBopomofo + 1,
116         sidEthiopic = sidHan + 1,
117         sidCanSyllabic = sidEthiopic + 1,
118         sidCherokee = sidCanSyllabic + 1,
119         sidYi = sidCherokee + 1,
120         sidBraille = sidYi + 1,
121         sidRunic = sidBraille + 1,
122         sidOgham = sidRunic + 1,
123         sidSinhala = sidOgham + 1,
124         sidSyriac = sidSinhala + 1,
125         sidBurmese = sidSyriac + 1,
126         sidKhmer = sidBurmese + 1,
127         sidThaana = sidKhmer + 1,
128         sidMongolian = sidThaana + 1,
129         sidUserDefined = sidMongolian + 1,
130         sidLim = sidUserDefined + 1,
131         sidFEFirst = sidHangul,
132         sidFELast = sidHan
133     } SCRIPTCONTF;
134
135     typedef enum tagSCRIPTFONTCONTF
136     {
137         SCRIPTCONTF_FIXED_FONT = 0x1,
138         SCRIPTCONTF_PROPORTIONAL_FONT = 0x2,
139         SCRIPTCONTF_SCRIPT_USER = 0x10000,
140         SCRIPTCONTF_SCRIPT_HIDE = 0x20000,
141         SCRIPTCONTF_SCRIPT_SYSTEM = 0x40000
142     } SCRIPTFONTCONTF;
143
144     typedef struct tagSCRIPFONTINFO
145     {
146         SCRIPT_IDS scripts;
147         WCHAR wszFont[MAX_MIMEFACE_NAME];
148     } SCRIPTFONTINFO, *PSCRIPTFONTINFO;
149
150     typedef struct tagSCRIPTINFO {
151         SCRIPT_ID ScriptId;
152         UINT uiCodePage;
153         WCHAR wszDescription[MAX_SCRIPT_NAME];
154         WCHAR wszFixedWidthFont[MAX_MIMEFACE_NAME];
155         WCHAR wszProportionalFont[MAX_MIMEFACE_NAME];
156     } SCRIPTINFO, *PSCRIPTINFO;
157
158     HRESULT Clone( 
159         [out] IEnumScript **ppEnum);
160
161     HRESULT Next(      
162         [in] ULONG celt,
163         [out] PSCRIPTINFO rgelt,
164         [out] ULONG *pceltFetched);
165
166     HRESULT Reset();
167
168     HRESULT Skip(      
169         [in] ULONG celt);
170 };
171
172 [
173   object,
174   pointer_default(unique)
175 ]
176 interface IEnumCodePage : IUnknown
177 {
178     const USHORT MAX_MIMECP_NAME = 64;
179     const USHORT MAX_MIMECSET_NAME = 50;
180
181     typedef enum tagMIMECONTF
182     {
183         MIMECONTF_MAILNEWS = 0x00000001,
184         MIMECONTF_BROWSER = 0x00000002,
185         MIMECONTF_MINIMAL = 0x00000004,
186         MIMECONTF_IMPORT = 0x00000008,
187         MIMECONTF_SAVABLE_MAILNEWS = 0x00000100,
188         MIMECONTF_SAVABLE_BROWSER = 0x00000200,
189         MIMECONTF_EXPORT = 0x00000400,
190         MIMECONTF_PRIVCONVERTER = 0x00010000,
191         MIMECONTF_VALID = 0x00020000,
192         MIMECONTF_VALID_NLS = 0x00040000,
193         MIMECONTF_MIME_IE4 = 0x10000000,
194         MIMECONTF_MIME_LATEST = 0x20000000,
195         MIMECONTF_MIME_REGISTRY = 0x40000000
196     } MIMECONTF;
197
198     typedef struct tagMIMECPINFO {
199         DWORD dwFlags;
200         UINT uiCodePage;
201         UINT uiFamilyCodePage;
202         WCHAR wszDescription[MAX_MIMECP_NAME];
203         WCHAR wszWebCharset[MAX_MIMECSET_NAME];
204         WCHAR wszHeaderCharset[MAX_MIMECSET_NAME];
205         WCHAR wszBodyCharset[MAX_MIMECSET_NAME];
206         WCHAR wszFixedWidthFont[MAX_MIMEFACE_NAME];
207         WCHAR wszProportionalFont[MAX_MIMEFACE_NAME];
208         BYTE bGDICharset;
209     } MIMECPINFO, *PMIMECPINFO;
210
211     typedef struct tagMIMECSETINFO
212     {
213         UINT uiCodePage;
214         UINT uiInternetEncoding;
215         WCHAR wszCharset[MAX_MIMECSET_NAME];
216     } MIMECSETINFO, *PMIMECSETINFO;
217
218     HRESULT Clone( 
219         [out] IEnumCodePage **ppEnum);
220
221     HRESULT Next(      
222         [in] ULONG celt,
223         [out] PMIMECPINFO rgelt,
224         [out] ULONG *pceltFetched);
225
226     HRESULT Reset();
227
228     HRESULT Skip(      
229         [in] ULONG celt);
230 };
231
232 [
233   object,
234   pointer_default(unique)
235 ]
236 interface IMLangConvertCharset : IUnknown
237 {
238     HRESULT Initialize(      
239         [in] UINT uiSrcCodePage,
240         [in] UINT uiDstCodePage,
241         [in] DWORD dwProperty);
242
243     HRESULT GetSourceCodePage(      
244         [out] UINT *puiSrcCodePage);
245
246     HRESULT GetDestinationCodePage(      
247         [out] UINT *puiDstCodePage);
248
249     HRESULT GetProperty(      
250         [out] DWORD *pdwProperty);
251
252     HRESULT DoConversion(      
253         [in] BYTE *pSrcStr,
254         [in,out] UINT *pcSrcSize,
255         [in] BYTE *pDstStr,
256         [in,out] UINT *pcDstSize);
257
258     HRESULT DoConversionToUnicode(      
259         [in] CHAR *pSrcStr,
260         [in,out] UINT *pcSrcSize,
261         [in] WCHAR *pDstStr,
262         [in,out] UINT *pcDstSize);
263
264     HRESULT DoConversionFromUnicode(      
265         [in] WCHAR *pSrcStr,
266         [in,out] UINT *pcSrcSize,
267         [in] CHAR *pDstStr,
268         [in,out] UINT *pcDstSize);
269 };
270
271 [
272   object,
273   pointer_default(unique)
274 ]
275 interface IEnumRfc1766 : IUnknown
276 {
277     typedef struct tagRFC1766INFO
278     {
279         LCID lcid;
280         WCHAR wszRfc1766[MAX_RFC1766_NAME];
281         WCHAR wszLocaleName[MAX_LOCALE_NAME];
282     } RFC1766INFO, *PRFC1766INFO;
283
284     HRESULT Clone( 
285         [out] IEnumRfc1766 **ppEnum);
286
287     HRESULT Next(      
288         [in] ULONG celt,
289         [out] PRFC1766INFO rgelt,
290         [out] ULONG *pceltFetched);
291
292     HRESULT Reset();
293
294     HRESULT Skip(      
295         [in] ULONG celt);
296 };
297
298 [
299   object,
300   pointer_default(unique)
301 ]
302 interface IMultiLanguage : IUnknown
303 {
304     HRESULT GetNumberOfCodePageInfo(      
305         [out] UINT *pcCodePage);
306
307     HRESULT GetCodePageInfo(      
308         [in] UINT uiCodePage,
309         [out] PMIMECPINFO pCodePageInfo);
310
311     HRESULT GetFamilyCodePage(      
312         [in] UINT uiCodePage,
313         [out] UINT *puiFamilyCodePage);
314
315     HRESULT EnumCodePages(      
316         [in] DWORD grfFlags,
317         [out] IEnumCodePage **ppEnumCodePage);
318
319     HRESULT GetCharsetInfo(      
320         [in] BSTR Charset,
321         [in] PMIMECSETINFO pCharsetInfo);
322
323     HRESULT IsConvertible(      
324         [in] DWORD dwSrcEncoding,
325         [in] DWORD dwDstEncoding);
326
327     HRESULT ConvertString(      
328         [in,out] DWORD *pdwMode,
329         [in] DWORD dwSrcEncoding,
330         [in] DWORD dwDstEncoding,
331         [in] BYTE *pSrcStr,
332         [in,out] UINT *pcSrcSize,
333         [in] BYTE *pDstStr,
334         [in,out] UINT *pcDstSize);
335
336     HRESULT ConvertStringToUnicode(      
337         [in,out] DWORD *pdwMode,
338         [in] DWORD dwEncoding,
339         [in] CHAR *pSrcStr,
340         [in,out] UINT *pcSrcSize,
341         [in] WCHAR *pDstStr,
342         [in,out] UINT *pcDstSize);
343
344     HRESULT ConvertStringFromUnicode(      
345         [in,out] DWORD *pdwMode,
346         [in] DWORD dwEncoding,
347         [in] WCHAR *pSrcStr,
348         [in,out] UINT *pcSrcSize,
349         [in] CHAR *pDstStr,
350         [in,out] UINT *pcDstSize);
351
352     HRESULT ConvertStringReset();
353
354     HRESULT GetRfc1766FromLcid(      
355         [in] LCID Locale,
356         [out] BSTR *pbstrRfc1766);
357
358     HRESULT GetLcidFromRfc1766(      
359         [out] LCID *pLocale,
360         [in] BSTR bstrRfc1766);
361
362     HRESULT EnumRfc1766(      
363         [out] IEnumRfc1766 **ppEnumRfc1766);
364
365     HRESULT GetRfc1766Info(      
366         [in] LCID Locale,
367         [out] PRFC1766INFO pRfc1766Info);
368
369     HRESULT CreateConvertCharset(      
370         [in] UINT uiSrcCodePage,
371         [in] UINT uiDstCodePage,
372         [in] DWORD dwProperty,
373         [out] IMLangConvertCharset **ppMLangConvertCharset);
374
375 };
376
377 [
378   object,
379   pointer_default(unique)
380 ]
381 interface IMultiLanguage2 : IUnknown
382 {
383     typedef struct tagDetectEncodingInfo
384     {
385         UINT nLangID;
386         UINT nCodePage;
387         INT nDocPercent;
388         INT nConfidence;
389     } DetectEncodingInfo, *pDetectEncodingInfo;
390
391     HRESULT GetNumberOfCodePageInfo(      
392         [out] UINT *pcCodePage);
393
394     HRESULT GetCodePageInfo(      
395         [in] UINT uiCodePage,
396         [in] LANGID LangId,
397         [out] PMIMECPINFO pCodePageInfo);
398
399     HRESULT GetFamilyCodePage(      
400         [in] UINT uiCodePage,
401         [out] UINT *puiFamilyCodePage);
402
403     HRESULT EnumCodePages(      
404         [in] DWORD grfFlags,
405         [in] LANGID LangId,
406         [out] IEnumCodePage **ppEnumCodePage);
407
408     HRESULT GetCharsetInfo(      
409         [in] BSTR Charset,
410         [in] PMIMECSETINFO pCharsetInfo);
411
412     HRESULT IsConvertible(      
413         [in] DWORD dwSrcEncoding,
414         [in] DWORD dwDstEncoding);
415
416     HRESULT ConvertString(      
417         [in,out] DWORD *pdwMode,
418         [in] DWORD dwSrcEncoding,
419         [in] DWORD dwDstEncoding,
420         [in] BYTE *pSrcStr,
421         [in,out] UINT *pcSrcSize,
422         [in] BYTE *pDstStr,
423         [in,out] UINT *pcDstSize);
424
425     HRESULT ConvertStringToUnicode(      
426         [in,out] DWORD *pdwMode,
427         [in] DWORD dwEncoding,
428         [in] CHAR *pSrcStr,
429         [in,out] UINT *pcSrcSize,
430         [in] WCHAR *pDstStr,
431         [in,out] UINT *pcDstSize);
432
433     HRESULT ConvertStringFromUnicode(      
434         [in,out] DWORD *pdwMode,
435         [in] DWORD dwEncoding,
436         [in] WCHAR *pSrcStr,
437         [in,out] UINT *pcSrcSize,
438         [in] CHAR *pDstStr,
439         [in,out] UINT *pcDstSize);
440
441     HRESULT ConvertStringReset();
442
443     HRESULT GetRfc1766FromLcid(      
444         [in] LCID Locale,
445         [out] BSTR *pbstrRfc1766);
446
447     HRESULT GetLcidFromRfc1766(      
448         [out] LCID *pLocale,
449         [in] BSTR bstrRfc1766);
450
451     HRESULT EnumRfc1766(      
452         [in] LANGID LangId,
453         [out] IEnumRfc1766 **ppEnumRfc1766);
454
455     HRESULT GetRfc1766Info(      
456         [in] LCID Locale,
457         [in] LANGID LangId,
458         [out] PRFC1766INFO pRfc1766Info);
459
460     HRESULT CreateConvertCharset(      
461         [in] UINT uiSrcCodePage,
462         [in] UINT uiDstCodePage,
463         [in] DWORD dwProperty,
464         [out] IMLangConvertCharset **ppMLangConvertCharset);
465
466     HRESULT ConvertStringInIStream(      
467         [in,out] DWORD *pdwMode,
468         [in] DWORD dwFlag,
469         [in] WCHAR *lpFallBack,
470         [in] DWORD dwSrcEncoding,
471         [in] DWORD dwDstEncoding,
472         [in] IStream *pstmIn,
473         [in] IStream *pstmOut);
474
475     HRESULT ConvertStringToUnicodeEx(      
476         [in,out] DWORD *pdwMode,
477         [in] DWORD dwEncoding,
478         [in] CHAR *pSrcStr,
479         [in,out] UINT *pcSrcSize,
480         [in] WCHAR *pDstStr,
481         [in,out] UINT *pcDstSize,
482         [in] DWORD dwFlag,
483         [in] WCHAR *lpFallBack);
484
485     HRESULT ConvertStringFromUnicodeEx(
486         [in,out] DWORD *pdwMode,
487         [in] DWORD dwEncoding,
488         [in] WCHAR *pSrcStr,
489         [in,out] UINT *pcSrcSize,
490         [in] CHAR *pDstStr,
491         [in,out] UINT *pcDstSize,
492         [in] DWORD dwFlag,
493         [in] WCHAR *lpFallBack);
494
495     HRESULT DetectCodepageInIStream(      
496         [in] DWORD dwFlag,
497         [in] DWORD dwPrefWinCodePage,
498         [in] IStream *pstmIn,
499         [in,out] DetectEncodingInfo *lpEncoding,
500         [in,out] INT *pnScores);
501
502     HRESULT DetectInputCodepage(      
503         [in] DWORD dwFlag,
504         [in] DWORD dwPrefWinCodePage,
505         [in] CHAR *pSrcStr,
506         [in,out] INT *pcSrcSize,
507         [in,out] DetectEncodingInfo *lpEncoding,
508         [in,out] INT *pnScores);
509
510     HRESULT ValidateCodePage(
511         [in] UINT uiCodePage,
512         [in] HWND hwnd);
513
514     HRESULT GetCodePageDescription(      
515         [in] UINT uiCodePage,
516         [in] LCID lcid,
517         [in,out] LPWSTR lpWideCharStr,
518         [in] int cchWideChar);
519
520     HRESULT IsCodePageInstallable(
521         [in] UINT uiCodePage);
522
523     HRESULT SetMimeDBSource(      
524         [in] MIMECONTF dwSource);
525
526     HRESULT GetNumberOfScripts(      
527         [out] UINT *pnScripts);
528
529     HRESULT EnumScripts(      
530         [in] DWORD dwFlags,
531         [in] LANGID LangId,
532         [out] IEnumScript **ppEnumScript);
533
534     HRESULT ValidateCodePageEx( /* undocumented on MSDN */
535         [in] UINT uiCodePage,
536         [in] HWND hwnd,
537         [in] DWORD dwfIODControl);
538 };
539
540 [
541     uuid(275C23E2-3747-11d0-9FEA-00AA003f8646)
542 ]
543 coclass CMultiLanguage
544 {
545     [default] interface IMultiLanguage;
546     interface IMLangCodePages;
547     interface IMLangFontLink;
548     /* interface IMLangLineBreakConsole; */
549 };
550
551 cpp_quote("STDAPI LcidToRfc1766A(LCID, LPSTR, INT);")
552 cpp_quote("STDAPI LcidToRfc1766W(LCID, LPWSTR, INT);")
553 cpp_quote("#define LcidToRfc1766 WINELIB_NAME_AW(LcidToRfc1766)")
554
555 cpp_quote("STDAPI Rfc1766ToLcidA(LCID *, LPCSTR);")
556 cpp_quote("STDAPI Rfc1766ToLcidW(LCID *, LPCWSTR);")
557 cpp_quote("#define Rfc1766ToLcid WINELIB_NAME_AW(Rfc1766ToLcid)")
558
559 cpp_quote("STDAPI GetGlobalFontLinkObject(void);")
560 cpp_quote("STDAPI IsConvertINetStringAvailable(DWORD, DWORD);")
561 cpp_quote("STDAPI ConvertINetString(LPDWORD, DWORD, DWORD, LPCSTR, LPINT, LPSTR, LPINT);")
562 cpp_quote("STDAPI ConvertINetMultiByteToUnicode(LPDWORD, DWORD, LPCSTR, LPINT, LPWSTR, LPINT);")
563 cpp_quote("STDAPI ConvertINetUnicodeToMultiByte(LPDWORD, DWORD, LPCWSTR, LPINT, LPSTR, LPINT);")
564
565 cpp_quote("DEFINE_GUID(IID_IMLangCodePages, 0x359F3443,0xBD4A,0x11D0,0xB1,0x88,0x00,0xAA,0x00,0x38,0xC9,0x69);")
566 cpp_quote("DEFINE_GUID(IID_IMLangFontLink, 0x359F3441,0xBD4A,0x11D0,0xB1,0x88,0x00,0xAA,0x00,0x38,0xC9,0x69);")
567 cpp_quote("DEFINE_GUID(IID_IMultiLanguage2, 0xDCCFC164,0x2B38,0x11d2,0xB7,0xEC,0x00,0xC0,0x4F,0x8F,0x5D,0x9A);")
568 cpp_quote("DEFINE_GUID(IID_IMultiLanguage, 0x275c23e1,0x3747,0x11d0,0x9f,0xea,0x00,0xaa,0x00,0x3f,0x86,0x46);")
569 cpp_quote("DEFINE_GUID(IID_IEnumCodePage, 0x275c23e3,0x3747,0x11d0,0x9f,0xea,0x00,0xaa,0x00,0x3f,0x86,0x46);")
570 cpp_quote("DEFINE_GUID(IID_IEnumScript, 0xae5f1430,0x388b,0x11d2,0x83,0x80,0x00,0xc0,0x4f,0x8f,0x5d,0xa1);")