//+-------------------------------------------------------------------------
//
//  Microsoft Windows
//  Copyright (C) Microsoft Corporation, 1992-2001.
//
//  File: ctffunc.idl
//
//  Contents: Text Framework function interfaces.
//
//
//--------------------------------------------------------------------------

cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("// ctffunc.h")
cpp_quote("")
cpp_quote("")
cpp_quote("// Text Framework function interfaces.")
cpp_quote("")
cpp_quote("//=--------------------------------------------------------------------------=")
cpp_quote("// (C) Copyright 1995-2001 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("#ifndef CTFFUNC_DEFINED")
cpp_quote("#define CTFFUNC_DEFINED")
cpp_quote("")
cpp_quote("#include <windows.h>")
cpp_quote("")
cpp_quote("#ifdef __cplusplus")
cpp_quote("extern \"C\" {")
cpp_quote("#endif /* __cplusplus */")
cpp_quote("")


cpp_quote("#ifdef __cplusplus")
cpp_quote("}")
cpp_quote("#endif  /* __cplusplus */")

import "oaidl.idl";
import "msctf.idl";

cpp_quote("#define TF_E_NOCONVERSION     MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0x0600)")

//
// exported CLSID
//
cpp_quote("EXTERN_C const CLSID CLSID_SapiLayr;")

//
// ITfCandidateString
//
[
  object,
  uuid(581f317e-fd9d-443f-b972-ed00467c5d40),
  pointer_default(unique)
]
interface ITfCandidateString : IUnknown
{
    HRESULT GetString([out] BSTR *pbstr);

    HRESULT GetIndex([out] ULONG *pnIndex);
}

//
// IEnumTfCandidates
//
[
  object,
  uuid(defb1926-6c80-4ce8-87d4-d6b72b812bde),
  pointer_default(unique)
]
interface IEnumTfCandidates : IUnknown
{
    HRESULT Clone([out] IEnumTfCandidates **ppEnum);

    HRESULT Next([in] ULONG ulCount, 
                 [out, size_is(ulCount), length_is(*pcFetched)] ITfCandidateString **ppCand, 
                 [out] ULONG *pcFetched);

    HRESULT Reset();

    HRESULT Skip([in] ULONG ulCount);
}

//
// ITfCandidateList
//
[
  object,
  uuid(a3ad50fb-9bdb-49e3-a843-6c76520fbf5d),
  pointer_default(unique)
]
interface ITfCandidateList : IUnknown
{
    HRESULT EnumCandidates([out] IEnumTfCandidates **ppEnum);

    HRESULT GetCandidate([in] ULONG nIndex, 
                         [out] ITfCandidateString **ppCand);

    HRESULT GetCandidateNum([out] ULONG *pnCnt);

    typedef [uuid(baa898f2-0207-4643-92ca-f3f7b0cf6f80)] enum
    { 
        CAND_FINALIZED = 0x0, 
        CAND_SELECTED  = 0x1, 
        CAND_CANCELED  = 0x2,   
    } TfCandidateResult;

    HRESULT SetResult([in] ULONG nIndex, 
                      [in] TfCandidateResult imcr);
}



//
// ITfFnReconversion
//
[
  object,
  uuid(4cea93c0-0a58-11d3-8df0-00105a2799b5),
  pointer_default(unique)
]
interface ITfFnReconversion : ITfFunction
{
    HRESULT QueryRange([in] ITfRange *pRange, 
                       [in, out, unique] ITfRange **ppNewRange, 
                       [out] BOOL *pfConvertable);

    HRESULT GetReconversion([in] ITfRange *pRange, 
                            [out] ITfCandidateList **ppCandList);

    HRESULT Reconvert([in] ITfRange *pRange);
}

// --- Data formats
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SAPI_AUDIO;")
cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_DICTATIONSTAT;")

cpp_quote("#define TF_DICTATION_ON          0x00000001")
cpp_quote("#define TF_DICTATION_ENABLED     0x00000002")
cpp_quote("#define TF_COMMANDING_ENABLED    0x00000004")
cpp_quote("#define TF_COMMANDING_ON         0x00000008")
cpp_quote("#define TF_SPEECHUI_SHOWN        0x00000010")
cpp_quote("")

cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_UI_STATUS;")

cpp_quote("#define TF_SHOW_BALLOON          0x00000001")
cpp_quote("#define TF_DISABLE_BALLOON       0x00000002")

cpp_quote("EXTERN_C const GUID GUID_COMPARTMENT_SPEECH_CFGMENU;")
cpp_quote("#define TF_MENUREADY          0x00000001")

cpp_quote("EXTERN_C const GUID GUID_LBI_SAPILAYR_CFGMENUBUTTON;")

cpp_quote("")


//
// ITfFnPlayBack
//
[
  object,
  uuid(a3a416a4-0f64-11d3-b5b7-00c04fc324a1),
  pointer_default(unique)
]
interface ITfFnPlayBack : ITfFunction
{
    HRESULT QueryRange([in] ITfRange *pRange, 
                       [out] ITfRange **ppNewRange, 
                       [out] BOOL *pfPlayable);

    HRESULT Play([in] ITfRange *pRange);
}


//
// ITfLangProfileUtil
//
[
  object,
  uuid(A87A8574-A6C1-4E15-99F0-3D3965F548EB),
  pointer_default(unique)
]
interface ITfFnLangProfileUtil : ITfFunction
{
    HRESULT RegisterActiveProfiles();

    HRESULT IsProfileAvailableForLang([in]  LANGID langid, 
                                      [out] BOOL *pfAvailable);
}

//
// ITfFnConfigure
//
[
  object,
  uuid(88f567c6-1757-49f8-a1b2-89234c1eeff9),
  pointer_default(unique)
]
interface ITfFnConfigure : ITfFunction
{
    //
    // Show() 
    //
    HRESULT Show([in] HWND hwndParent, 
                 [in] LANGID langid,
                 [in] REFGUID rguidProfile);
}

//
// ITfFnConfigureRegisterWord
//
[
  object,
  uuid(bb95808a-6d8f-4bca-8400-5390b586aedf),
  pointer_default(unique)
]
interface ITfFnConfigureRegisterWord : ITfFunction
{
    //
    // Show() 
    //
    HRESULT Show([in] HWND hwndParent,
                 [in] LANGID langid,
                 [in] REFGUID rguidProfile,
                 [in, unique] BSTR bstrRegistered);

}

//
// ITfFnConfigureRegisterEudc
//
[
  object,
  uuid(b5e26ff5-d7ad-4304-913f-21a2ed95a1b0),
  pointer_default(unique)
]
interface ITfFnConfigureRegisterEudc : ITfFunction
{
    //
    // Show() 
    //
    HRESULT Show([in] HWND hwndParent,
                 [in] LANGID langid,
                 [in] REFGUID rguidProfile,
                 [in, unique] BSTR bstrRegistered);

}

//
// ITfFnShowHelp
//
[
  object,
  uuid(5AB1D30C-094D-4C29-8EA5-0BF59BE87BF3),
  pointer_default(unique)
]
interface ITfFnShowHelp : ITfFunction
{
    HRESULT Show([in] HWND hwndParent);

}

//
// ITfFnBalloon
//
[
  object,
  uuid(3BAB89E4-5FBE-45F4-A5BC-DCA36AD225A8),
  pointer_default(unique)
]
interface ITfFnBalloon : IUnknown
{
    HRESULT UpdateBalloon([in] TfLBBalloonStyle style,
                          [in, size_is(cch)] const WCHAR *pch,
                          [in] ULONG cch);
}

//
// ITfFnGetSAPIObject
//
typedef [uuid(36adb6d9-da1f-45d8-a499-86167e0f936b)] enum
{ 
    GETIF_RESMGR                  = 0x0, 
    GETIF_RECOCONTEXT             = 0x1, 
    GETIF_RECOGNIZER              = 0x2, 
    GETIF_VOICE                   = 0x3, 
    GETIF_DICTGRAM                = 0x4 ,
    GETIF_RECOGNIZERNOINIT        = 0x5 , // for candidate UI
} TfSapiObject;

[
  object,
  uuid(5c0ab7ea-167d-4f59-bfb5-4693755e90ca),
  pointer_default(unique)
]
interface  ITfFnGetSAPIObject : ITfFunction
{
    HRESULT Get([in] TfSapiObject sObj,
                [out] IUnknown **ppunk);
}

//
// ITfFnPropertyUIStatus
//
[
  object,
  uuid(2338AC6E-2B9D-44C0-A75E-EE64F256B3BD),
  pointer_default(unique)
]
interface  ITfFnPropertyUIStatus : ITfFunction
{
    HRESULT GetStatus([in] REFGUID refguidProp, [out] DWORD *pdw);
    HRESULT SetStatus([in] REFGUID refguidProp, [in] DWORD dw);
}

// --- bit flag for ITfFnPropertyUIStatus 
cpp_quote("")
cpp_quote("#define TF_PROPUI_STATUS_SAVETOFILE  0x00000001")
cpp_quote("")


//
// Customize Commands processor and speech command provider
//

//
// IEnumSpeechCommands
//
[
  object,
  uuid(8c5dac4f-083c-4b85-a4c9-71746048adca),
  pointer_default(unique)
]
interface IEnumSpeechCommands : IUnknown
{
    HRESULT Clone([out] IEnumSpeechCommands **ppEnum);

    HRESULT Next([in] ULONG ulCount,
                 [out, size_is(ulCount), length_is(*pcFetched)] WCHAR **pSpCmds,
                 [out] ULONG *pcFetched);

    HRESULT Reset();

    HRESULT Skip([in] ULONG ulCount);
}

//
// ISpeechCommandProvider
//
[
  object,
  uuid(38e09d4c-586d-435a-b592-c8a86691dec6),
  pointer_default(unique)
]

interface ISpeechCommandProvider : IUnknown 
{
    HRESULT  EnumSpeechCommands([in]  LANGID  langid, [out] IEnumSpeechCommands **ppEnum); 

    HRESULT  ProcessCommand([in, size_is(cch)] const WCHAR *pszCommand, [in] ULONG cch, [in] LANGID langid);
}

//
// ITfFnCustomSpeechCommand
//
[
  object,
  uuid(fca6c349-a12f-43a3-8dd6-5a5a4282577b),
  pointer_default(unique)
]

interface ITfFnCustomSpeechCommand : ITfFunction
{
    HRESULT SetSpeechCommandProvider([in] IUnknown *pspcmdProvider);
}

//
// LM sharing interface definitions
//

cpp_quote("EXTERN_C const GUID GUID_TFCAT_TIP_MASTERLM;")
cpp_quote("EXTERN_C const GUID GUID_MASTERLM_FUNCTIONPROVIDER;")
cpp_quote("EXTERN_C const GUID GUID_LMLATTICE_VER1_0;")
cpp_quote("EXTERN_C const GUID GUID_PROP_LMLATTICE;")
//
// ITfFnLMProcessor
//
[
  object,
  uuid(7AFBF8E7-AC4B-4082-B058-890899D3A010),
  pointer_default(unique)
]

interface ITfFnLMProcessor : ITfFunction
{
    HRESULT QueryRange([in]    ITfRange *pRange,
                       [out]   ITfRange **ppNewRange,
                       [out]   BOOL     *pfAccepted);

    HRESULT QueryLangID([in]   LANGID langid,
                        [out]  BOOL   *pfAccepted);

    HRESULT GetReconversion([in]    ITfRange *pRange,   
                            [out]   ITfCandidateList **ppCandList);

    HRESULT Reconvert([in]    ITfRange *pRange);

    HRESULT QueryKey ([in]    BOOL   fUp,
                      [in]    WPARAM vKey,
                      [in]    LPARAM lparamKeydata,
                      [out]   BOOL *pfInterested);

    HRESULT InvokeKey([in]    BOOL fUp,
                      [in]    WPARAM vKey,
                      [in]    LPARAM lparamKeyData);
                     
    HRESULT InvokeFunc([in]   ITfContext *pic,
                       [in]   REFGUID refguidFunc);
}

//
// ITfFnLMInternal
//
[
  object,
  uuid(04B825B1-AC9A-4F7B-B5AD-C7168F1EE445),
  pointer_default(unique)
]//
interface ITfFnLMInternal : ITfFnLMProcessor
{
    HRESULT ProcessLattice([in]    ITfRange *pRange);
}


//
// TFLMLATTELEMENT
//
//
typedef [uuid(1b646efe-3ce3-4ce2-b41f-35b93fe5552f)] struct TF_LMLATTELEMENT
{
    DWORD dwFrameStart;
    DWORD dwFrameLen;

    DWORD dwFlags;
    [switch_type(DWORD), switch_is(dwFlags)] union
    {
        [case(0)]   INT     iCost;
    };

    BSTR bstrText;
} TF_LMLATTELEMENT;

//
// IEnumTfLatticeElements
//
//
[
  object,
  uuid(56988052-47DA-4A05-911A-E3D941F17145),
  pointer_default(unique)
]
interface IEnumTfLatticeElements : IUnknown
{
    HRESULT Clone([out] IEnumTfLatticeElements **ppEnum);

    HRESULT Next([in] ULONG ulCount,
                 [out, size_is(ulCount), length_is(*pcFetched)] TF_LMLATTELEMENT *rgsElements,
                 [out] ULONG *pcFetched);

    HRESULT Reset();

    HRESULT Skip([in] ULONG ulCount);
}


//
// ITfLMLattice
//
//
[
  object,
  uuid(D4236675-A5BF-4570-9D42-5D6D7B02D59B),
  pointer_default(unique)
]
interface ITfLMLattice : IUnknown
{
    HRESULT QueryType([in] REFGUID rguidType, [out] BOOL *pfSupported);

    HRESULT EnumLatticeElements([in] DWORD dwFrameStart,
                                [in] REFGUID rguidType,
                                [out] IEnumTfLatticeElements **ppEnum);
}

//
// ITfFnAdviseText
//
[
  object,
  uuid(3527268B-7D53-4DD9-92B7-7296AE461249),
  pointer_default(unique)
]
interface ITfFnAdviseText : ITfFunction
{
    HRESULT OnTextUpdate([in] ITfRange *pRange, 
                         [in, size_is(cch)] const WCHAR *pchText,
                         [in] LONG cch);

    HRESULT OnLatticeUpdate([in] ITfRange *pRange,
                            [in] ITfLMLattice *pLattice);

}

cpp_quote("#endif // CTFFUNC_DEFINED")

