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.

248 lines
7.0 KiB

  1. //
  2. // T126OBJ.HPP
  3. // Drawing objects: point, openpolyline, closepolyline, ellipse
  4. //
  5. // Copyright Microsoft 1998-
  6. //
  7. void GetDestinationAddress(DrawingDestinationAddress *DestinationAddress, PUINT workspaceHandle, PUINT planeID);
  8. void NormalizeRect(LPRECT lprc);
  9. void CreateNonStandardPDU(NonStandardParameter * sipdu, LPSTR NonStandardString);
  10. void TimeToGetGCCHandles(ULONG numberOfGccHandles);
  11. //
  12. // Member ID
  13. //
  14. #define MAKE_MEMBER_ID(nid,uid) (MAKELONG((nid),(uid)))
  15. #define GET_NODE_ID_FROM_MEMBER_ID(id) (LOWORD(id))
  16. #define GET_USER_ID_FROM_MEMBER_ID(id) (HIWORD(id))
  17. typedef ULONG MEMBER_ID; // loword = node_id, hiword = user_id
  18. extern ULONG g_MyMemberID;
  19. typedef struct
  20. {
  21. BYTE bCountryCode;
  22. BYTE bExtension;
  23. WORD wManufacturerCode;
  24. BYTE nonstandardString;
  25. } T126_VENDORINFO, *PT126_VENDORINFO;
  26. class T126Obj
  27. {
  28. public:
  29. virtual ~T126Obj(){};
  30. virtual void Draw(HDC hdc = NULL, BOOL bForcedDraw = FALSE, BOOL bPrinting = FALSE) = 0;
  31. virtual void UnDraw(void) = 0;
  32. virtual BOOL CheckReallyHit(LPCRECT pRectHit) = 0;
  33. BOOL RectangleHit(BOOL borderHit, LPCRECT pRectHit);
  34. virtual void SetPenColor(COLORREF rgb, BOOL isPresent) = 0;
  35. virtual BOOL GetPenColor(COLORREF * pcr) = 0;
  36. virtual BOOL GetPenColor(RGBTRIPLE * prgb) = 0;
  37. virtual BOOL HasFillColor(void) = 0;
  38. virtual void SetFillColor(COLORREF rgb, BOOL isPresent) = 0;
  39. virtual BOOL GetFillColor(COLORREF * pcr) = 0;
  40. virtual BOOL GetFillColor(RGBTRIPLE * prgb) = 0;
  41. virtual UINT GraphicTool(void) { return m_ToolType;}
  42. virtual void SetViewHandle(UINT viewHandle) = 0;
  43. //
  44. // Edit stuff
  45. //
  46. virtual void ChangedAnchorPoint(void) = 0;
  47. virtual BOOL HasAnchorPointChanged(void) = 0;
  48. virtual void ChangedZOrder(void) = 0;
  49. virtual BOOL HasZOrderChanged(void) = 0;
  50. virtual void ChangedViewState(void) = 0;
  51. virtual BOOL HasViewStateChanged(void) = 0;
  52. virtual void ResetAttrib(void) = 0;
  53. virtual void SetAllAttribs(void) = 0;
  54. virtual void ChangedPenThickness(void) = 0;
  55. virtual void OnObjectEdit(void) = 0;
  56. virtual void OnObjectDelete(void) = 0;
  57. virtual void SendNewObjectToT126Apps(void) = 0;
  58. virtual void GetEncodedCreatePDU(ASN1_BUF *pBuf) = 0;
  59. void GotGCCHandle(ULONG gccHandle);
  60. //
  61. // Draw, bitmap, or workspace object
  62. //
  63. UINT GetType(void){return m_T126ObjectType;};
  64. void SetType(UINT type){m_T126ObjectType = type;};
  65. //
  66. // Workspace stuff
  67. //
  68. UINT GetWorkspaceHandle(void) {return m_workspaceHandle;};
  69. void SetWorkspaceHandle(UINT handle) {m_workspaceHandle = handle;};
  70. //
  71. // Get/set plane id
  72. //
  73. void SetPlaneID(UINT planeID){m_planeID = planeID;}
  74. UINT GetPlaneID(void) { return m_planeID; }
  75. //
  76. // This object's handle
  77. //
  78. UINT GetThisObjectHandle(void) {return m_thisObjectHandle;};
  79. void SetThisObjectHandle(UINT handle) {m_thisObjectHandle = handle; TRACE_DEBUG(("Object 0x%08x Handle = %d", this, handle));};
  80. //
  81. // Get/set view state
  82. //
  83. void SetViewState(UINT viewState){m_viewState = viewState; ChangedViewState();}
  84. UINT GetViewState(void) { return m_viewState;}
  85. //
  86. // Get/set zorder
  87. //
  88. void SetZOrder(ZOrder zorder);
  89. ZOrder GetZOrder(void) { return m_zOrder; }
  90. //
  91. // Get/set anchor Point
  92. //
  93. void SetAnchorPoint(LONG x, LONG y);
  94. void GetAnchorPoint(LPPOINT lpPoint) { *lpPoint = m_anchorPoint; }
  95. //
  96. // Get/set the bounding rectangle of the graphic object (in logical
  97. // co-ordinates).
  98. //
  99. void SetRect(LPCRECT lprc);
  100. void GetRect(LPRECT lprc);
  101. void SetRectPts(POINT point1, POINT point2);
  102. void SetBoundRectPts(POINT point1, POINT point2);
  103. void GetBoundsRect(LPRECT lprc);
  104. void SetBoundsRect(LPCRECT lprc);
  105. BOOL PointInBounds(POINT point);
  106. //
  107. // Get/set the width of the pen used to draw the object
  108. //
  109. void SetPenThickness(UINT penThickness);
  110. UINT GetPenThickness(void) { return m_penThickness;}
  111. //
  112. // Get/set penROP
  113. //
  114. void SetROP(UINT penROP) {m_penROP = penROP;}
  115. UINT GetROP(void){return m_penROP;}
  116. void MoveBy(int cx, int cy);
  117. void MoveTo(int x, int y);
  118. WBPOSITION m_MyPosition; // Returns this objects position in the list it is located
  119. WBPOSITION GetMyPosition(void){return m_MyPosition;}
  120. void SetMyPosition(WBPOSITION pos){m_MyPosition = pos;}
  121. WorkspaceObj * m_pMyWorkspace;
  122. WorkspaceObj * GetMyWorkspace(void){return m_pMyWorkspace;}
  123. void SetMyWorkspace(WorkspaceObj * pWorkspace){m_pMyWorkspace = pWorkspace;}
  124. void CalculateInvalidationRect(void);
  125. void DrawMarker(LPCRECT pMarkerRect );
  126. void DrawRect(void);
  127. void SelectDrawingObject(void);
  128. void UndrawMarker(LPCRECT pMarkerRect );
  129. void UnselectDrawingObject(void);
  130. void MoveBy(LONG x , LONG y);
  131. void CreatedLocally(void){m_bCreatedLocally = TRUE;}
  132. BOOL WasCreatedLocally(void){return m_bCreatedLocally;}
  133. void ClearCreationFlags(void){m_bCreatedLocally = FALSE;}
  134. void SelectedLocally(void);
  135. void SelectedRemotely(void);
  136. BOOL WasSelectedLocally(){return m_bSelectedLocally;}
  137. BOOL WasSelectedRemotely(){return m_bSelectedRemotely;}
  138. BOOL IsSelected(void){return (m_bSelectedLocally || m_bSelectedRemotely);}
  139. void ClearSelectionFlags(void){m_bSelectedLocally = FALSE; m_bSelectedRemotely = FALSE;}
  140. void EditedLocally(void){m_bEditedLocally = TRUE;}
  141. BOOL WasEditedLocally(void){return m_bEditedLocally;}
  142. void ClearEditionFlags(void){m_bEditedLocally = FALSE;}
  143. void DeletedLocally(void){m_bDeleteLocally = TRUE;}
  144. BOOL WasDeletedLocally(void){return m_bDeleteLocally;}
  145. void ClearDeletionFlags(void){m_bDeleteLocally = FALSE;}
  146. void SetOwnerID(ULONG ID){
  147. m_OwnerID = GET_NODE_ID_FROM_MEMBER_ID(ID);
  148. TRACE_DEBUG(("SetOwnerID ID= %x",m_OwnerID));
  149. }
  150. ULONG GetOwnerID(void){return m_OwnerID;}
  151. BOOL IAmTheOwner(void){return m_OwnerID == GET_NODE_ID_FROM_MEMBER_ID(g_MyMemberID);}
  152. void AddToWorkspace();
  153. protected:
  154. UINT m_ToolType; // Tool type from UI
  155. BOOL m_bCreatedLocally;
  156. BOOL m_bSelectedLocally;
  157. BOOL m_bSelectedRemotely;
  158. BOOL m_bEditedLocally;
  159. BOOL m_bDeleteLocally;
  160. RECT m_boundsRect;
  161. RECT m_rect;
  162. private:
  163. ULONG m_OwnerID; // The owner of this selected object
  164. UINT m_T126ObjectType;
  165. UINT m_planeID; // Destination plane in workspace
  166. UINT m_workspaceHandle; // Destination workspace for this object
  167. UINT m_thisObjectHandle; // My own handle assigned by GCC
  168. UINT m_viewState;
  169. ZOrder m_zOrder;
  170. POINT m_anchorPoint;
  171. UINT m_penThickness;
  172. UINT m_penROP;
  173. };
  174. class DCDWordArray
  175. {
  176. public:
  177. DCDWordArray(void);
  178. ~DCDWordArray(void);
  179. void Add(POINT point);
  180. BOOL ReallocateArray(void);
  181. POINT* GetBuffer(void) { return m_pData; }
  182. void SetSize(UINT size);
  183. UINT GetSize(void);
  184. POINT* operator[](UINT index){return &(m_pData[index]);}
  185. private:
  186. POINT* m_pData;
  187. UINT m_Size;
  188. UINT m_MaxSize;
  189. };