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.

103 lines
2.8 KiB

  1. /*++
  2. Copyright (c) 1985 - 1999, Microsoft Corporation
  3. Module Name:
  4. candpos.h
  5. Abstract:
  6. This file defines the CCandidatePosition Class.
  7. Author:
  8. Revision History:
  9. Notes:
  10. --*/
  11. #ifndef _CANDPOS_H_
  12. #define _CANDPOS_H_
  13. #include "cime.h"
  14. #include "imtls.h"
  15. #include "ctxtcomp.h"
  16. class CCandidatePosition
  17. {
  18. public:
  19. HRESULT GetCandidatePosition(OUT RECT* out_rcArea);
  20. private:
  21. HRESULT GetRectFromApp(IN IMTLS* ptls,
  22. IN IMCLock& imc,
  23. IN LANGID langid,
  24. OUT RECT* out_rcArea);
  25. HRESULT GetRectFromHIMC(IN IMCLock& imc,
  26. IN DWORD dwStyle,
  27. IN POINT* ptCurrentPos,
  28. IN RECT* rcArea,
  29. OUT RECT* out_rcArea);
  30. HRESULT GetCandidateArea(IN IMCLock& imc,
  31. IN DWORD dwStyle,
  32. IN POINT* ptCurrentPos,
  33. IN RECT* rcArea,
  34. OUT RECT* out_rcArea);
  35. HRESULT GetRectFromCompFont(IN IMTLS* ptls,
  36. IN IMCLock& imc,
  37. IN POINT* ptCurrentPos,
  38. OUT RECT* out_rcArea);
  39. HRESULT FindAttributeInCompositionString(IN IMCLock& imc,
  40. IN BYTE target_attribute,
  41. OUT CWCompCursorPos& wCursorPosition);
  42. HRESULT GetCursorPosition(IN IMCLock& imc,
  43. OUT CWCompCursorPos& wCursorPosition);
  44. HRESULT GetSelection(IN IMCLock& imc,
  45. OUT CWCompCursorPos& wStartSelection,
  46. OUT CWCompCursorPos& wEndSelection);
  47. typedef enum {
  48. DIR_LEFT_RIGHT = 0, // normal
  49. DIR_TOP_BOTTOM = 1, // vertical
  50. DIR_RIGHT_LEFT = 2, // right to left
  51. DIR_BOTTOM_TOP = 3 // vertical
  52. } DOC_DIR;
  53. DOC_DIR DocumentDirection(IN IMCLock& imc)
  54. {
  55. if (imc->lfFont.A.lfEscapement == 2700 ||
  56. imc->lfFont.A.lfEscapement == 900) {
  57. //
  58. // Vertical writting.
  59. //
  60. if (imc->lfFont.A.lfEscapement == 900 ||
  61. imc->lfFont.A.lfEscapement == 1800) {
  62. return DIR_BOTTOM_TOP;
  63. }
  64. else {
  65. return DIR_TOP_BOTTOM;
  66. }
  67. }
  68. else {
  69. //
  70. // Horizontal writting.
  71. //
  72. if (imc->lfFont.A.lfEscapement == 1800) {
  73. return DIR_RIGHT_LEFT;
  74. }
  75. else {
  76. return DIR_LEFT_RIGHT;
  77. }
  78. }
  79. }
  80. };
  81. #endif // _CANDPOS_H_