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.

143 lines
4.8 KiB

  1. /*
  2. * @doc INTERNAL
  3. *
  4. * @module _objmgr.h Class declaration for the object manager class |
  5. *
  6. * Author: alexgo 11/4/95
  7. *
  8. * Copyright (c) 1995-1997, Microsoft Corporation. All rights reserved.
  9. */
  10. #ifndef __OBJMGR_H__
  11. #define __OBJMGR_H__
  12. #include "_coleobj.h"
  13. #include "_array.h"
  14. #include "_m_undo.h"
  15. class CTxtEdit;
  16. /*
  17. * @enum return values for HandleClick
  18. */
  19. enum ClickStatus
  20. {
  21. CLICK_IGNORED = 0,
  22. CLICK_OBJDEACTIVATED = 1,
  23. CLICK_SHOULDDRAG = 2,
  24. CLICK_OBJSELECTED = 3
  25. };
  26. typedef CArray<COleObject *> ObjectArray;
  27. /*
  28. * CObjectMgr
  29. *
  30. * @class keeps track of a collection of OLE embedded objects as well as
  31. * various state tidbits
  32. */
  33. class CObjectMgr
  34. {
  35. public:
  36. LONG GetObjectCount(); //@cmember count # of objects
  37. LONG GetLinkCount(); //@cmember count # of links
  38. COleObject * GetObjectFromCp(LONG cp); //@cmember fetch object ptr
  39. COleObject * GetObjectFromIndex(LONG index); //@cmember fetch obj ptr
  40. //@cmember insert object
  41. HRESULT InsertObject(LONG cp, REOBJECT *preobj,
  42. IUndoBuilder *publdr);
  43. //@cmember re-inserts the given
  44. // object
  45. HRESULT RestoreObject(COleObject *pobj);
  46. IRichEditOleCallback *GetRECallback() //@cmember return the callback
  47. {return _precall;}
  48. //@cmember set the OLE callback
  49. void SetRECallback(IRichEditOleCallback *precall);
  50. //@cmember sets a temporary flag
  51. // indicating whether or not
  52. // a UI update is pending.
  53. void SetShowUIPending(BOOL fPending)
  54. {_fShowUIPending = fPending;}
  55. BOOL GetShowUIPending() //@cmember get _fShowUIPending
  56. {return _fShowUIPending;}
  57. //@cmember sets the inplace
  58. // active object
  59. void SetInPlaceActiveObject(COleObject *pobj)
  60. { _pobjactive = pobj; }
  61. COleObject * GetInPlaceActiveObject() //@cmember get the active obj
  62. { return _pobjactive; }
  63. BOOL GetHelpMode() //@cmember in help mode?
  64. { return _fInHelpMode; }
  65. void SetHelpMode(BOOL fHelp) //@cmember set the help mode
  66. { _fInHelpMode = fHelp; }
  67. //@cmember Set the host names
  68. HRESULT SetHostNames(LPWSTR pszApp, LPWSTR pszDoc);
  69. LPWSTR GetAppName() //@cmember get the app name
  70. { return _pszApp; }
  71. LPWSTR GetDocName() //@cmember get the doc name
  72. { return _pszDoc; }
  73. //@cmember activate an object
  74. //if appropriate
  75. BOOL HandleDoubleClick(CTxtEdit *ped, const POINT &pt,
  76. DWORD flags);
  77. //@cmember an object may be
  78. // selected or de-activated.
  79. ClickStatus HandleClick(CTxtEdit *ped, const POINT &pt);
  80. //@cmember an object may be
  81. // selected or deselected.
  82. void HandleSingleSelect(CTxtEdit *ped, LONG cp, BOOL fHiLite);
  83. //@cmember an object is
  84. // being selected by itself.
  85. COleObject * GetSingleSelect(void) {return _pobjselect;}
  86. //@cmember Count cObject
  87. LONG CountObjects(LONG& rcObject,// objects up to cchMax
  88. LONG cp); // chars away
  89. //@cmember Handles the deletion
  90. // of objects.
  91. void ReplaceRange(LONG cp, LONG cchDel,
  92. IUndoBuilder *publdr);
  93. //@cmember Count the number
  94. //of objects in a range.
  95. LONG CountObjectsInRange(LONG cpMin, LONG cpMost);
  96. //@cmember Get the first
  97. //object in a range.
  98. COleObject * GetFirstObjectInRange(LONG cpMin, LONG cpMost);
  99. //@cmember activate objects of one class as
  100. //as another
  101. HRESULT ActivateObjectsAs(REFCLSID rclsid, REFCLSID rclsidAs);
  102. //@cmember inform objects
  103. // that scrolling has
  104. // occured.
  105. void ScrollObjects(LONG dx, LONG dy, LPCRECT prcScroll);
  106. LONG FindIndexForCp(LONG cp); //@cmember does a binary search for cp
  107. //@cmember find an object near a point
  108. #ifdef DEBUG
  109. void DbgDump(void);
  110. #endif
  111. CObjectMgr(); //@cmember constructor
  112. ~CObjectMgr(); //@cmember destructor
  113. private:
  114. ObjectArray _objarray; //@cmember Array of embedded objects
  115. LONG _lastindex; //@cmember Last index used
  116. // (lookup optimization)
  117. IRichEditOleCallback *_precall; //@cmember Callback for various OLE
  118. // operations.
  119. COleObject * _pobjactive; //@cmember Object that is currently
  120. // inplace active
  121. COleObject * _pobjselect; //@cmember Object that is currently
  122. // individually selected (not active)
  123. LPWSTR _pszApp; //@cmember Name of app
  124. LPWSTR _pszDoc; //@cmember Name of "document"
  125. unsigned int _fShowUIPending:1;//@cmember a UI update is pending
  126. unsigned int _fInHelpMode:1; //@cmember in context sensitive help mode?
  127. };
  128. #endif //__OBJMGR_H__