//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright 1992 - 1998 Microsoft Corporation.
//
//  File: mlang.idl
//
//  Contents: IMultiLanguage interface definition
//
//
//--------------------------------------------------------------------------

cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("// MLang.h                                                                    ")
cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("// (C) Copyright 1995 - 1998 Microsoft Corporation.  All Rights Reserved.       ")
cpp_quote("//                                                                            ")
cpp_quote("// THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF        ")
cpp_quote("// ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO        ")
cpp_quote("// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A             ")
cpp_quote("// PARTICULAR PURPOSE.                                                        ")
cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("                                                                              ")
cpp_quote("#pragma comment(lib,\"uuid.lib\")                                             ")
cpp_quote("                                                                              ")
cpp_quote("//----------------------------------------------------------------------------")
cpp_quote("// IMultiLanguage Interfaces.                                                 ")
cpp_quote("                                                                              ")

#ifndef DO_NO_IMPORTS
import "unknwn.idl";
#endif

[
    uuid(275c23e0-3747-11d0-9fea-00aa003f8646),
    helpstring("MultiLanguage Object Model"),
    lcid(0x0000),
    version(0.2)
]
library MultiLanguage
{
    importlib("stdole2.tlb");

    typedef enum tagMLSTR_FLAGS
    {
        MLSTR_READ                  = 1,
        MLSTR_WRITE                 = 2
    } MLSTR_FLAGS;

    [
        uuid(D24ACD21-BA72-11D0-B188-00AA0038C969),
        helpstring("IMLangStringBufW Interface"),
        pointer_default(unique)
    ]
    interface IMLangStringBufW : IUnknown
    {
        [helpstring("method GetStatus")] HRESULT GetStatus([out] long* plFlags, [out] long* pcchBuf);
        [helpstring("method LockBuf")] HRESULT LockBuf([in] long cchOffset, [in] long cchMaxLock, [out, size_is(,*pcchBuf)] WCHAR** ppszBuf, [out] long* pcchBuf);
        [helpstring("method UnlockBuf")] HRESULT UnlockBuf([in, size_is(cchWrite - cchOffset)] const WCHAR* pszBuf, [in] long cchOffset, [in] long cchWrite);
        [helpstring("method Insert")] HRESULT Insert([in] long cchOffset, [in] long cchMaxInsert, [out] long* pcchActual);
        [helpstring("method Delete")] HRESULT Delete([in] long cchOffset, [in] long cchDelete);
    };

    [
        uuid(D24ACD23-BA72-11D0-B188-00AA0038C969),
        helpstring("IMLangStringBufA Interface"),
        pointer_default(unique)
    ]
    interface IMLangStringBufA : IUnknown
    {
        [helpstring("method GetStatus")] HRESULT GetStatus([out] long* plFlags, [out] long* pcchBuf);
        [helpstring("method LockBuf")] HRESULT LockBuf([in] long cchOffset, [in] long cchMaxLock, [out, size_is(,*pcchBuf)] CHAR** ppszBuf, [out] long* pcchBuf);
        [helpstring("method UnlockBuf")] HRESULT UnlockBuf([in, size_is(cchWrite - cchOffset)] const CHAR* pszBuf, [in] long cchOffset, [in] long cchWrite);
        [helpstring("method Insert")] HRESULT Insert([in] long cchOffset, [in] long cchMaxInsert, [out] long* pcchActual);
        [helpstring("method Delete")] HRESULT Delete([in] long cchOffset, [in] long cchDelete);
    };

    [
        uuid(C04D65CE-B70D-11D0-B188-00AA0038C969),
        helpstring("IMLangString Interface"),
        pointer_default(unique)
    ]
    interface IMLangString : IUnknown
    {
        [helpstring("method Sync")] HRESULT Sync([in] BOOL fNoAccess);
        [helpstring("method GetLength")] HRESULT GetLength([out, retval] long* plLen);
        [helpstring("method SetMLStr")] HRESULT SetMLStr([in] long lDestPos, [in] long lDestLen, [in] IUnknown* pSrcMLStr, [in] long lSrcPos, [in] long lSrcLen);
        [helpstring("method GetMLStr")] HRESULT GetMLStr([in] long lSrcPos, [in] long lSrcLen, [in] IUnknown* pUnkOuter, [in] DWORD dwClsContext, [in] const IID* piid, [out] IUnknown** ppDestMLStr, [out] long* plDestPos, [out] long* plDestLen);
    };

    [
        uuid(C04D65D0-B70D-11D0-B188-00AA0038C969),
        helpstring("IMLangStringWStr Interface"),
        pointer_default(unique)
    ]
    interface IMLangStringWStr : IMLangString
    {
        [helpstring("method SetWStr")] HRESULT SetWStr([in] long lDestPos, [in] long lDestLen, [in, size_is(cchSrc)] const WCHAR* pszSrc, [in] long cchSrc, [out] long* pcchActual, [out] long* plActualLen);
        [helpstring("method SetStrBufW")] HRESULT SetStrBufW([in] long lDestPos, [in] long lDestLen, [in] IMLangStringBufW* pSrcBuf, [out] long* pcchActual, [out] long* plActualLen);
        [helpstring("method GetWStr")] HRESULT GetWStr([in] long lSrcPos, [in] long lSrcLen, [out, size_is(cchDest)] WCHAR* pszDest, [in] long cchDest, [out] long* pcchActual, [out] long* plActualLen);
        [helpstring("method GetStrBufW")] HRESULT GetStrBufW([in] long lSrcPos, [in] long lSrcMaxLen, [out] IMLangStringBufW** ppDestBuf, [out] long* plDestLen);
        [helpstring("method LockWStr")] HRESULT LockWStr([in] long lSrcPos, [in] long lSrcLen, [in] long lFlags, [in] long cchRequest, [out, size_is(,*pcchDest)] WCHAR** ppszDest, [out] long* pcchDest, [out] long* plDestLen);
        [helpstring("method UnlockWStr")] HRESULT UnlockWStr([in, size_is(cchSrc)] const WCHAR* pszSrc, [in] long cchSrc, [out] long* pcchActual, [out] long* plActualLen);
        [helpstring("method SetLocale")] HRESULT SetLocale([in] long lDestPos, [in] long lDestLen, [in] LCID locale);
        [helpstring("method GetLocale")] HRESULT GetLocale([in] long lSrcPos, [in] long lSrcMaxLen, [out] LCID* plocale, [out] long* plLocalePos, [out] long* plLocaleLen);
    };

    [
        uuid(C04D65D2-B70D-11D0-B188-00AA0038C969),
        helpstring("IMLangStringAStr Interface"),
        pointer_default(unique)
    ]
    interface IMLangStringAStr : IMLangString
    {
        [helpstring("method SetAStr")] HRESULT SetAStr([in] long lDestPos, [in] long lDestLen, [in] UINT uCodePage, [in, size_is(cchSrc)] const CHAR* pszSrc, [in] long cchSrc, [out] long* pcchActual, [out] long* plActualLen);
        [helpstring("method SetStrBufA")] HRESULT SetStrBufA([in] long lDestPos, [in] long lDestLen, [in] UINT uCodePage, [in] IMLangStringBufA* pSrcBuf, [out] long* pcchActual, [out] long* plActualLen);
        [helpstring("method GetAStr")] HRESULT GetAStr([in] long lSrcPos, [in] long lSrcLen, [in] UINT uCodePageIn, [out] UINT* puCodePageOut, [out, size_is(cchDest)] CHAR* pszDest, [in] long cchDest, [out] long* pcchActual, [out] long* plActualLen);
        [helpstring("method GetStrBufA")] HRESULT GetStrBufA([in] long lSrcPos, [in] long lSrcMaxLen, [out] UINT* puDestCodePage, [out] IMLangStringBufA** ppDestBuf, [out] long* plDestLen);
        [helpstring("method LockAStr")] HRESULT LockAStr([in] long lSrcPos, [in] long lSrcLen, [in] long lFlags, [in] UINT uCodePageIn, [in] long cchRequest, [out] UINT* puCodePageOut, [out, size_is(,*pcchDest)] CHAR** ppszDest, [out] long* pcchDest,
 [out] long* plDestLen);
        [helpstring("method UnlockAStr")] HRESULT UnlockAStr([in, size_is(cchSrc)] const CHAR* pszSrc, [in] long cchSrc, [out] long* pcchActual, [out] long* plActualLen);
        [helpstring("method SetLocale")] HRESULT SetLocale([in] long lDestPos, [in] long lDestLen, [in] LCID locale);
        [helpstring("method GetLocale")] HRESULT GetLocale([in] long lSrcPos, [in] long lSrcMaxLen, [out] LCID* plocale, [out] long* plLocalePos, [out] long* plLocaleLen);
    };

    [
        uuid(C04D65CF-B70D-11D0-B188-00AA0038C969),
        helpstring("MLangString Class")
    ]
    coclass CMLangString
    {
        [default] interface IMLangString;
        interface IMLangStringWStr;
        interface IMLangStringAStr;
    };

    [
        uuid(F5BE2EE1-BFD7-11D0-B188-00AA0038C969),
        helpstring("IMLangLineBreakConsole Interface"),
        pointer_default(unique)
    ]
    interface IMLangLineBreakConsole : IUnknown
    {
        [helpstring("method BreakLineML")] HRESULT BreakLineML([in] IMLangString* pSrcMLStr, [in] long lSrcPos, [in] long lSrcLen, [in] long cMinColumns, [in] long cMaxColumns, [out] long* plLineLen, [out] long* plSkipLen);
        [helpstring("method BreakLineW")] HRESULT BreakLineW([in] LCID locale, [in, size_is(cchSrc)] const WCHAR* pszSrc, [in] long cchSrc, [in] long cMaxColumns, [out] long* pcchLine, [out] long* pcchSkip);
        [helpstring("method BreakLineA")] HRESULT BreakLineA([in] LCID locale, [in] UINT uCodePage, [in, size_is(cchSrc)] const CHAR* pszSrc, [in] long cchSrc, [in] long cMaxColumns, [out] long* pcchLine, [out] long* pcchSkip);
    };

    [
      object,
      uuid(275c23e3-3747-11d0-9fea-00aa003f8646),
      pointer_default(unique)
    ]
    interface IEnumCodePage : IUnknown
    {
        const USHORT MAX_MIMECP_NAME    = 64;
        const USHORT MAX_MIMECSET_NAME  = 50;
        const USHORT MAX_MIMEFACE_NAME  = 32;

        typedef enum tagMIMECONTF
        {
            MIMECONTF_MAILNEWS          = 0x00000001,
            MIMECONTF_BROWSER           = 0x00000002,
            MIMECONTF_MINIMAL           = 0x00000004,
            MIMECONTF_SAVABLE_MAILNEWS  = 0x00000100,
            MIMECONTF_SAVABLE_BROWSER   = 0x00000200,
            MIMECONTF_PRIVCONVERTER     = 0x00010000,
            MIMECONTF_VALID             = 0x00020000
        } MIMECONTF;

        typedef struct tagMIMECPINFO
        {
            DWORD   dwFlags;
            UINT    uiCodePage;
            UINT    uiFamilyCodePage;
            WCHAR   wszDescription[MAX_MIMECP_NAME];
            WCHAR   wszWebCharset[MAX_MIMECSET_NAME];
            WCHAR   wszHeaderCharset[MAX_MIMECSET_NAME];
            WCHAR   wszBodyCharset[MAX_MIMECSET_NAME];
            WCHAR   wszFixedWidthFont[MAX_MIMEFACE_NAME];
            WCHAR   wszProportionalFont[MAX_MIMEFACE_NAME];
            BYTE    bGDICharset;
        } MIMECPINFO, *PMIMECPINFO;

        typedef struct tagMIMECSETINFO
        {
            UINT    uiCodePage;
            UINT    uiInternetEncoding;
            WCHAR   wszCharset[MAX_MIMECSET_NAME];
        } MIMECSETINFO, *PMIMECSETINFO;

        typedef [unique] IEnumCodePage *LPENUMCODEPAGE;

        HRESULT Clone
        (
            [out] IEnumCodePage **ppEnum
        );

        HRESULT Next
        (
            [in]  ULONG         celt,
            [out] PMIMECPINFO   rgelt,
            [out] ULONG         *pceltFetched
        );

        HRESULT Reset();

        HRESULT Skip
        (
            [in]  ULONG         celt
        );
    };

    [
      object,
      uuid(3dc39d1d-c030-11d0-b81b-00c04fc9b31f),
      pointer_default(unique)
    ]
    interface IEnumRfc1766 : IUnknown
    {
        const USHORT MAX_RFC1766_NAME   = 6;
        const USHORT MAX_LOCALE_NAME    = 32;

        typedef struct tagRFC1766INFO
        {
            LCID    lcid;
            WCHAR   wszRfc1766[MAX_RFC1766_NAME];
            WCHAR   wszLocaleName[MAX_LOCALE_NAME];
        } RFC1766INFO, *PRFC1766INFO;

        typedef [unique] IEnumRfc1766 *LPENUMRFC1766;

        HRESULT Clone
        (
            [out] IEnumRfc1766 **ppEnum
        );

        HRESULT Next
        (
            [in]  ULONG         celt,
            [out] PRFC1766INFO  rgelt,
            [out] ULONG         *pceltFetched
        );

        HRESULT Reset();

        HRESULT Skip
        (
            [in]  ULONG         celt
        );
    };

    [
      object,
      uuid(d66d6f98-cdaa-11d0-b822-00c04fc9b31f),
      pointer_default(unique)
    ]
    interface IMLangConvertCharset : IUnknown
    {
        typedef enum tagMLCONVCHARF
        {
            MLCONVCHARF_AUTODETECT      = 1,
            MLCONVCHARF_ENTITIZE        = 2
        } MLCONVCHAR;

        typedef [unique] IMLangConvertCharset *LPMLANGCONVERTCHARSET;

        HRESULT Initialize
        (
            [in]  UINT  uiSrcCodePage,
            [in]  UINT  uiDstCodePage,
            [in]  DWORD dwProperty
        );

        HRESULT GetSourceCodePage
        (
            [out] UINT  *puiSrcCodePage
        );

        HRESULT GetDestinationCodePage
        (
            [out] UINT  *puiDstCodePage
        );

        HRESULT GetProperty
        (
            [out] DWORD *pdwProperty
        );

        HRESULT DoConversion
        (
            [in]  BYTE          *pSrcStr,
            [in,out]  UINT      *pcSrcSize,
            [in]  BYTE          *pDstStr,
            [in,out]  UINT      *pcDstSize
        );

        HRESULT DoConversionToUnicode
        (
            [in]  CHAR          *pSrcStr,
            [in,out]  UINT      *pcSrcSize,
            [in]  WCHAR         *pDstStr,
            [in,out]  UINT      *pcDstSize
        );

        HRESULT DoConversionFromUnicode
        (
            [in]  WCHAR         *pSrcStr,
            [in,out]  UINT      *pcSrcSize,
            [in]  CHAR          *pDstStr,
            [in,out]  UINT      *pcDstSize
        );

    };

    [
      uuid(d66d6f99-cdaa-11d0-b822-00c04fc9b31f),
    ]
    coclass CMLangConvertCharset
    {
        [default] interface IMLangConvertCharset;
    };

    [
      object,
      uuid(275c23e1-3747-11d0-9fea-00aa003f8646),
      pointer_default(unique)
    ]
    interface IMultiLanguage : IUnknown
    {
        typedef [unique] IMultiLanguage *LPMULTILANGUAGE;

        HRESULT GetNumberOfCodePageInfo
        (
            [out] UINT          *pcCodePage
        );

        HRESULT GetCodePageInfo
        (
            [in]  UINT          uiCodePage,
            [out] PMIMECPINFO   pCodePageInfo
        );

        HRESULT GetFamilyCodePage
        (
            [in]  UINT          uiCodePage,
            [out] UINT          *puiFamilyCodePage
        );

        HRESULT EnumCodePages
        (
            [in]  DWORD         grfFlags,
            [out] IEnumCodePage **ppEnumCodePage
        );

        HRESULT GetCharsetInfo
        (
            [in]  BSTR          Charset,
            [out] PMIMECSETINFO pCharsetInfo
        );

        HRESULT IsConvertible
        (
            [in]  DWORD         dwSrcEncoding,
            [in]  DWORD         dwDstEncoding
        );

        HRESULT ConvertString
        (
            [in,out]  DWORD     *pdwMode,
            [in]  DWORD         dwSrcEncoding,
            [in]  DWORD         dwDstEncoding,
            [in]  BYTE          *pSrcStr,
            [in,out]  UINT      *pcSrcSize,
            [in]  BYTE          *pDstStr,
            [in,out]  UINT      *pcDstSize
        );

        HRESULT ConvertStringToUnicode
        (
            [in,out]  DWORD     *pdwMode,
            [in]  DWORD         dwEncoding,
            [in]  CHAR          *pSrcStr,
            [in,out]  UINT      *pcSrcSize,
            [in]  WCHAR         *pDstStr,
            [in,out]  UINT      *pcDstSize
        );

        HRESULT ConvertStringFromUnicode
        (
            [in,out]  DWORD     *pdwMode,
            [in]  DWORD         dwEncoding,
            [in]  WCHAR         *pSrcStr,
            [in,out]  UINT      *pcSrcSize,
            [in]  CHAR          *pDstStr,
            [in,out]  UINT      *pcDstSize
        );

        HRESULT ConvertStringReset();

        HRESULT GetRfc1766FromLcid
        (
            [in]  LCID          Locale,
            [out] BSTR          *pbstrRfc1766
        );

        HRESULT GetLcidFromRfc1766
        (
            [out] LCID          *pLocale,
            [in]  BSTR          bstrRfc1766
        );

        HRESULT EnumRfc1766
        (
            [out] IEnumRfc1766 **ppEnumRfc1766
        );

        HRESULT GetRfc1766Info
        (
            [in]  LCID          Locale,
            [out] PRFC1766INFO  pRfc1766Info
        );

        HRESULT CreateConvertCharset
        (
            [in]  UINT          uiSrcCodePage,
            [in]  UINT          uiDstCodePage,
            [in]  DWORD         dwProperty,
            [out] IMLangConvertCharset **ppMLangConvertCharset
        );

    };

    [
        uuid(359F3443-BD4A-11D0-B188-00AA0038C969),
        helpstring("IMLangCodePages Interface"),
        pointer_default(unique)
    ]
    interface IMLangCodePages : IUnknown
    {
        typedef [unique] IMLangCodePages* PMLANGCODEPAGES;

        [helpstring("method GetCharCodePages")] HRESULT GetCharCodePages([in] WCHAR chSrc, [out] DWORD* pdwCodePages);
        [helpstring("method GetStrCodePages")] HRESULT GetStrCodePages([in, size_is(cchSrc)] const WCHAR* pszSrc, [in] long cchSrc, [in] DWORD dwPriorityCodePages, [out] DWORD* pdwCodePages, [out] long* pcchCodePages);
        [helpstring("method CodePageToCodePages")] HRESULT CodePageToCodePages([in] UINT uCodePage, [out] DWORD* pdwCodePages);
        [helpstring("method CodePagesToCodePage")] HRESULT CodePagesToCodePage([in] DWORD dwCodePages, [in] UINT uDefaultCodePage, [out] UINT* puCodePage);
    };

    [
        uuid(359F3441-BD4A-11D0-B188-00AA0038C969),
        helpstring("IMLangFontLink Interface"),
        pointer_default(unique)
    ]
    interface IMLangFontLink : IMLangCodePages
    {
        typedef [unique] IMLangFontLink* PMLANGFONTLINK;

        [helpstring("method GetFontCodePages")] HRESULT GetFontCodePages([in] HDC hDC, [in] HFONT hFont, [out] DWORD* pdwCodePages);
        [helpstring("method MapFont")] HRESULT MapFont([in] HDC hDC, [in] DWORD dwCodePages, [in] HFONT hSrcFont, [out] HFONT* phDestFont);
        [helpstring("method ReleaseFont")] HRESULT ReleaseFont([in] HFONT hFont);
        [helpstring("method ResetFontMapping")] HRESULT ResetFontMapping();
    };

    [
      uuid(275c23e2-3747-11d0-9fea-00aa003f8646),
    ]
    coclass CMultiLanguage
    {
        [default] interface IMultiLanguage;
        interface IMLangCodePages;
        interface IMLangFontLink;
        interface IMLangLineBreakConsole;
    };

}


cpp_quote("#ifndef _MLANG_H_API_DEF_                                                     ")
cpp_quote("#define _MLANG_H_API_DEF_                                                     ")
cpp_quote("                                                                              ")
cpp_quote("// APIs prototypes                                                            ")
cpp_quote("STDAPI LcidToRfc1766A(LCID Locale, LPSTR pszRfc1766, int iMaxLength);         ")
cpp_quote("STDAPI LcidToRfc1766W(LCID Locale, LPWSTR pszRfc1766, int nChar);             ")
cpp_quote("#ifdef UNICODE                                                                ")
cpp_quote("#define LcidToRfc1766        LcidToRfc1766W                                   ")
cpp_quote("#else                                                                         ")
cpp_quote("#define LcidToRfc1766        LcidToRfc1766A                                   ")
cpp_quote("#endif                                                                        ")
cpp_quote("STDAPI Rfc1766ToLcidA(LCID *pLocale, LPCSTR pszRfc1766);                      ")
cpp_quote("STDAPI Rfc1766ToLcidW(LCID *pLocale, LPCWSTR pszRfc1766);                     ")
cpp_quote("#ifdef UNICODE                                                                ")
cpp_quote("#define Rfc1766ToLcid        Rfc1766ToLcidW                                   ")
cpp_quote("#else                                                                         ")
cpp_quote("#define Rfc1766ToLcid        Rfc1766ToLcidA                                   ")
cpp_quote("#endif                                                                        ")
cpp_quote("                                                                              ")
cpp_quote("STDAPI IsConvertINetStringAvailable(DWORD dwSrcEncoding, DWORD dwDstEncoding);")
cpp_quote("STDAPI ConvertINetString(LPDWORD lpdwMode, DWORD dwSrcEncoding, DWORD dwDstEncoding, LPCSTR lpSrcStr, LPINT lpnSrcSize, LPSTR lpDstStr, LPINT lpnDstSize);   ")
cpp_quote("STDAPI ConvertINetMultiByteToUnicode(LPDWORD lpdwMode, DWORD dwEncoding, LPCSTR lpSrcStr, LPINT lpnMultiCharCount, LPWSTR lpDstStr, LPINT lpnWideCharCount); ")
cpp_quote("STDAPI ConvertINetUnicodeToMultiByte(LPDWORD lpdwMode, DWORD dwEncoding, LPCWSTR lpSrcStr, LPINT lpnWideCharCount, LPSTR lpDstStr, LPINT lpnMultiCharCount); ")
cpp_quote("                                                                              ")
cpp_quote("#endif // _MLANG_H_API_DEF_                                                   ")
