Source code of Windows XP (NT5)
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.

138 lines
4.5 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-2000, 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. class CTxtRange;
  17. /*
  18. * @enum return values for HandleClick
  19. */
  20. enum ClickStatus
  21. {
  22. CLICK_IGNORED = 0,
  23. CLICK_OBJDEACTIVATED = 1,
  24. CLICK_SHOULDDRAG = 2,
  25. CLICK_OBJSELECTED = 3
  26. };
  27. typedef CArray<COleObject *> ObjectArray;
  28. /*
  29. * CObjectMgr
  30. *
  31. * @class keeps track of a collection of OLE embedded objects as well as
  32. * various state tidbits
  33. */
  34. class CObjectMgr
  35. {
  36. public:
  37. LONG GetObjectCount(); //@cmember count # of objects
  38. LONG GetLinkCount(); //@cmember count # of links
  39. COleObject * GetObjectFromCp(LONG cp); //@cmember fetch object ptr
  40. COleObject * GetObjectFromIndex(LONG index); //@cmember fetch obj ptr
  41. //@cmember insert object
  42. HRESULT InsertObject(CTxtRange *prg, REOBJECT *preobj,
  43. IUndoBuilder *publdr);
  44. //@cmember re-inserts the given
  45. // object
  46. HRESULT RestoreObject(COleObject *pobj);
  47. IRichEditOleCallback *GetRECallback() //@cmember return the callback
  48. {return _precall;}
  49. //@cmember set the OLE callback
  50. void SetRECallback(IRichEditOleCallback *precall);
  51. //@cmember sets a temporary flag
  52. // indicating whether or not
  53. // a UI update is pending.
  54. void SetShowUIPending(BOOL fPending)
  55. {_fShowUIPending = fPending;}
  56. BOOL GetShowUIPending() //@cmember get _fShowUIPending
  57. {return _fShowUIPending;}
  58. //@cmember sets the inplace
  59. // active object
  60. void SetInPlaceActiveObject(COleObject *pobj)
  61. { _pobjactive = pobj; }
  62. COleObject * GetInPlaceActiveObject() //@cmember get the active obj
  63. { return _pobjactive; }
  64. BOOL GetHelpMode() //@cmember in help mode?
  65. { return _fInHelpMode; }
  66. void SetHelpMode(BOOL fHelp) //@cmember set the help mode
  67. { _fInHelpMode = fHelp; }
  68. //@cmember Set the host names
  69. HRESULT SetHostNames(LPWSTR pszApp, LPWSTR pszDoc);
  70. LPWSTR GetAppName() //@cmember get the app name
  71. { return _pszApp; }
  72. LPWSTR GetDocName() //@cmember get the doc name
  73. { return _pszDoc; }
  74. //@cmember activate an object
  75. //if appropriate
  76. BOOL HandleDoubleClick(CTxtEdit *ped, const POINTUV &pt, DWORD flags);
  77. //@cmember an object may be
  78. // selected or de-activated.
  79. ClickStatus HandleClick(CTxtEdit *ped, const POINTUV &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. LONG FindIndexForCp(LONG cp); //@cmember does a binary search for cp
  103. //@cmember find an object near a point
  104. #ifdef DEBUG
  105. void DbgDump(void);
  106. #endif
  107. CObjectMgr(); //@cmember constructor
  108. ~CObjectMgr(); //@cmember destructor
  109. private:
  110. ObjectArray _objarray; //@cmember Array of embedded objects
  111. LONG _lastindex; //@cmember Last index used
  112. // (lookup optimization)
  113. IRichEditOleCallback *_precall; //@cmember Callback for various OLE
  114. // operations.
  115. COleObject * _pobjactive; //@cmember Object that is currently
  116. // inplace active
  117. COleObject * _pobjselect; //@cmember Object that is currently
  118. // individually selected (not active)
  119. LPWSTR _pszApp; //@cmember Name of app
  120. LPWSTR _pszDoc; //@cmember Name of "document"
  121. unsigned int _fShowUIPending:1;//@cmember a UI update is pending
  122. unsigned int _fInHelpMode:1; //@cmember in context sensitive help mode?
  123. };
  124. #endif //__OBJMGR_H__