Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
3.2 KiB

  1. //
  2. // proputil.h
  3. //
  4. #ifndef PROPUTIL_H
  5. #define PROPUTIL_H
  6. #include "private.h"
  7. #include "catutil.h"
  8. HRESULT HrVariantToBlob(VARIANT *pv, void *value, ULONG *cbvalue, VARTYPE vt);
  9. HRESULT HrBlobToVariant(const void *value, ULONG cbvalue, VARIANT *pv, VARTYPE vt);
  10. HRESULT GetGUIDPropertyData(TfEditCookie ec, ITfProperty *pProp, ITfRange *pRange, TfGuidAtom *pguidatom);
  11. HRESULT SetGUIDPropertyData(LIBTHREAD *plt, TfEditCookie ec, ITfProperty *pProp, ITfRange *pRange, REFGUID rguid);
  12. HRESULT GetDWORDPropertyData(TfEditCookie ec, ITfProperty *pProp, ITfRange *pRange, DWORD *pdw);
  13. HRESULT SetDWORDPropertyData(TfEditCookie ec, ITfProperty *pProp, ITfRange *pRange, DWORD dw);
  14. HRESULT GetReadingStrPropertyData(TfEditCookie ec, ITfProperty *pProp, ITfRange *pRange, BSTR *pbtr);
  15. HRESULT GetBSTRPropertyData(TfEditCookie ec, ITfProperty *pProp, ITfRange *pRange, BSTR *pbstr);
  16. HRESULT SetBSTRPropertyData(TfEditCookie ec, ITfProperty *pProp, ITfRange *pRange, BSTR bstr);
  17. HRESULT GetUnknownPropertyData(TfEditCookie ec, ITfProperty *pProp, ITfRange *pRange, IUnknown **ppunk);
  18. HRESULT SetUnknownPropertyData(TfEditCookie ec, ITfProperty *pProp, ITfRange *pRange, IUnknown *punk);
  19. #define GetLangIdPropertyData(ec, pProp, pPropRange, plangid) {DWORD dw = 0; GetDWORDPropertyData(ec, pProp, pPropRange, &dw); *plangid = (WORD)dw;}
  20. #define SetLangIdPropertyData(ec, pProp, pPropRange, langid) SetDWORDPropertyData(ec, pProp, pPropRange, (WORD)langid)
  21. #define GetAttrPropertyData GetGUIDPropertyData
  22. #define SetAttrPropertyData SetGUIDPropertyData
  23. inline HRESULT HrVariantToGUID(VARIANT *pv, GUID *pguid)
  24. {
  25. ULONG cb = sizeof(GUID);
  26. HRESULT hr = HrVariantToBlob(pv, (void *)pguid, &cb, VT_I4);
  27. Assert(FAILED(hr) || (cb == sizeof(GUID) / 4));
  28. return hr;
  29. }
  30. inline HRESULT HrGUIDToVariant(REFGUID rguid, VARIANT *pv)
  31. {
  32. return HrBlobToVariant((const void *)&rguid, sizeof(GUID) / 4, pv, VT_I4);
  33. }
  34. void SetIntAttribute(IXMLDOMElement *pElem, WCHAR *pszTag, int nData);
  35. void SetCharAttribute(IXMLDOMElement *pElem, WCHAR *pszTag, WCHAR *pszData);
  36. HRESULT GetIntAttribute(IXMLDOMElement *pElem, WCHAR *pszTag, int *pnRet);
  37. HRESULT GetCharAttribute(IXMLDOMElement *pElem, WCHAR *pszTag, WCHAR *pszData, int nSize);
  38. HRESULT SetTextAndProperty(LIBTHREAD *plt, TfEditCookie ec, ITfContext *pic, ITfRange *pRange, const WCHAR *pchText, LONG cchText, LANGID langid, const GUID *pattr);
  39. HRESULT SetTextAndReading(LIBTHREAD *plt, TfEditCookie ec, ITfContext *pic, ITfRange *pRange, const WCHAR *pchText, LONG cchText, LANGID langid, const WCHAR *pszRead);
  40. BOOL IsOwnerAndFocus(LIBTHREAD *plt, TfEditCookie ec, REFCLSID rclsid, ITfReadOnlyProperty *pProp, ITfRange *pRange);
  41. HRESULT EnumTrackTextAndFocus(TfEditCookie ec, ITfContext *pic, ITfRange *pRange, ITfReadOnlyProperty **ppProp, IEnumTfRanges **ppEnumTrack);
  42. BOOL IsGUIDProp(LIBTHREAD *plt, TfEditCookie ec, REFGUID rclsid, ITfProperty *pProp, ITfRange *pRange);
  43. HRESULT AdjustRangeByTextOwner(TfEditCookie ec, ITfContext *pic, ITfRange *pRange, ITfRange **ppRange, REFGUID rguid);
  44. HRESULT AdjustRangeByAttribute(LIBTHREAD *plt, TfEditCookie ec, ITfContext *pic, ITfRange *pRange, ITfRange **ppRange, const GUID *rgRGuid, int cGuid);
  45. #endif // PROPUTIL_H