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.

133 lines
3.1 KiB

  1. /*
  2. *
  3. * @doc INTERNAL
  4. *
  5. * @module TextNot.cpp -- forwards notification to Message Filter
  6. *
  7. * Purpose:
  8. *
  9. * Author: <nl>
  10. * 1/12/99 honwch
  11. *
  12. * Copyright (c) 1995-2000, Microsoft Corporation. All rights reserved.
  13. */
  14. #include "_common.h"
  15. #include "_edit.h"
  16. #include "_textnot.h"
  17. /*
  18. * CTextNotify::~CTextNotify()
  19. *
  20. * @mfunc
  21. * CTextNotify Destructor
  22. *
  23. */
  24. CTextNotify::~CTextNotify()
  25. {
  26. CNotifyMgr *pnm;
  27. if (_ped && _pMsgFilterNotify)
  28. {
  29. // Remove from this object from the notification link
  30. _pMsgFilterNotify = NULL;
  31. pnm = _ped->GetNotifyMgr();
  32. if(pnm)
  33. pnm->Remove(this);
  34. _ped = NULL;
  35. }
  36. }
  37. /*
  38. * void CTextNotify::OnPreReplaceRange(cp, cchDel, cchNew, cpFormatMin, cpFormatMax, pNotifyData)
  39. *
  40. * @mfunc
  41. * Forwards PreReplaceRange to Message Filter
  42. */
  43. void CTextNotify::OnPreReplaceRange(
  44. LONG cp, //@parm cp where ReplaceRange starts ("cpMin")
  45. LONG cchDel, //@parm Count of chars after cp that are deleted
  46. LONG cchNew, //@parm Count of chars inserted after cp
  47. LONG cpFormatMin, //@parm cpMin for a formatting change
  48. LONG cpFormatMax, //@parm cpMost for a formatting change
  49. NOTIFY_DATA *pNotifyData) //@parm special data to indicate changes
  50. {
  51. if (_ped && _ped->_pMsgFilter && _pMsgFilterNotify)
  52. _pMsgFilterNotify->OnPreReplaceRange(cp, cchDel, cchNew, cpFormatMin, cpFormatMax, pNotifyData);
  53. }
  54. /*
  55. * void CTextNotify::OnPostReplaceRange(cp, cchDel, cchNew, cpFormatMin, cpFormatMax, pNotifyData)
  56. *
  57. * @mfunc
  58. * Forwards OnPostReplaceRange to Message Filter
  59. */
  60. void CTextNotify::OnPostReplaceRange(
  61. LONG cp, //@parm cp where ReplaceRange starts ("cpMin")
  62. LONG cchDel, //@parm Count of chars after cp that are deleted
  63. LONG cchNew, //@parm Count of chars inserted after cp
  64. LONG cpFormatMin, //@parm cpMin for a formatting change
  65. LONG cpFormatMax, //@parm cpMost for a formatting change
  66. NOTIFY_DATA *pNotifyData) //@parm special data to indicate changes
  67. {
  68. if (_ped && _ped->_pMsgFilter && _pMsgFilterNotify)
  69. _pMsgFilterNotify->OnPostReplaceRange(cp, cchDel, cchNew, cpFormatMin, cpFormatMax, pNotifyData);
  70. }
  71. /*
  72. * void CTextNotify::Add(pMsgFilterNotify)
  73. *
  74. * @mfunc
  75. * Setup Message Filter notification. Need to add this object to Notifcation link
  76. *
  77. * @rdesc
  78. * FALSE if we cant get the Notification manager
  79. */
  80. BOOL CTextNotify::Add(ITxNotify *pMsgFilterNotify)
  81. {
  82. CNotifyMgr *pnm;
  83. if (!_ped)
  84. return FALSE;
  85. if (!_pMsgFilterNotify)
  86. {
  87. pnm = _ped->GetNotifyMgr();
  88. if(pnm)
  89. pnm->Add(this);
  90. else
  91. return FALSE;
  92. }
  93. _pMsgFilterNotify = pMsgFilterNotify;
  94. return TRUE;
  95. }
  96. /*
  97. * void CTextNotify::Remove(pMsgFilterNotify)
  98. *
  99. * @mfunc
  100. * Remove Message Filter notification. Remove this object from Notifcation link
  101. *
  102. * @rdesc
  103. * FALSE if we cant get the Notification manager
  104. */
  105. BOOL CTextNotify::Remove(ITxNotify *pMsgFilterNotify)
  106. {
  107. CNotifyMgr *pnm;
  108. if (!_ped)
  109. return FALSE;
  110. if (_pMsgFilterNotify == pMsgFilterNotify)
  111. {
  112. _pMsgFilterNotify = NULL;
  113. pnm = _ped->GetNotifyMgr();
  114. if(pnm)
  115. pnm->Remove(this);
  116. }
  117. return TRUE;
  118. }