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.

192 lines
6.1 KiB

  1. //
  2. // DRAWOBJ.HPP
  3. // Drawing objects: point, openpolyline, closepolyline, ellipse
  4. //
  5. // Copyright Microsoft 1998-
  6. //
  7. #ifndef __DRAWOBJ_HPP_
  8. #define __DRAWOBJ_HPP_
  9. //
  10. // Maximum number of points in a freehand object
  11. //
  12. #define MAX_FREEHAND_POINTS 65535
  13. #define MAX_POINT_LIST_VALUES 255
  14. BOOL EllipseHit(LPCRECT lpEllipseRect, BOOL bBorderHit, UINT uPenWidth, LPCRECT lpHitRect );
  15. void GetDrawingDestinationAddress(DrawingDestinationAddress *destinationAddress, PUINT workspaceHandle, PUINT planeID);
  16. typedef struct tagCOLOR_PRESENT
  17. {
  18. BOOL m_bIsPresent;
  19. RGBTRIPLE m_color;
  20. }COLOR;
  21. class DrawObj : public T126Obj
  22. {
  23. public:
  24. DCDWordArray * m_points; // List of consecutive points including anchor point
  25. DrawObj (UINT drawingType, UINT toolType);
  26. DrawObj ( DrawingCreatePDU * pdrawingCreatePDU );
  27. void DrawEditObj ( DrawingEditPDU * pdrawingEditPDU );
  28. ~DrawObj( void );
  29. void Draw(HDC hDC = NULL, BOOL bForcedDraw = FALSE, BOOL bPrinting = FALSE);
  30. BOOL PolyLineHit(LPCRECT pRectHit);
  31. BOOL CheckReallyHit(LPCRECT pRectHit);
  32. //
  33. // PDU stuff
  34. //
  35. void CreateDrawingCreatePDU(DrawingCreatePDU *);
  36. void CreateDrawingEditPDU(DrawingEditPDU *);
  37. void CreateDrawingDeletePDU(DrawingDeletePDU*);
  38. void SetDrawingAttrib(PDrawingCreatePDU_attributes *attributes);
  39. void AllocateAttrib(PDrawingCreatePDU_attributes *pattributes);
  40. //
  41. // Get/Set drawing type
  42. //
  43. void SetDrawingType(UINT type){m_drawingType = type;};
  44. UINT GetDrawingType(void) {return m_drawingType;}
  45. //
  46. // Get/set the pen style
  47. //
  48. void SetLineStyle(UINT lineStyle){m_lineStyle = lineStyle; ChangedLineStyle();};
  49. UINT GetLineStyle(void) { return m_lineStyle;}
  50. //
  51. // Get/set pen Color
  52. //
  53. void SetPenColor(COLORREF rgb, BOOL isPresent);
  54. BOOL GetPenColor(COLORREF * rgb);
  55. BOOL GetPenColor(RGBTRIPLE* rgb);
  56. //
  57. // Get/set fill Color
  58. //
  59. BOOL HasFillColor(void){return m_bIsFillColorPresent;}
  60. void SetFillColor(COLORREF rgb, BOOL isPresent);
  61. BOOL GetFillColor(COLORREF * rgb);
  62. BOOL GetFillColor(RGBTRIPLE* rgb);
  63. //
  64. //
  65. // Get/set pen nib
  66. //
  67. void SetPenNib(UINT nib){m_penNib = nib;ChangedPenNib();};
  68. UINT GetPenNib(void){return m_penNib;}
  69. //
  70. // Get/set highlight
  71. //
  72. void SetHighlight(BOOL bHighlight){m_bHighlight = bHighlight; ChangedHighlight();};
  73. BOOL GetHighlight(void){return m_bHighlight;}
  74. BOOL AddPoint(POINT point);
  75. void AddPointToBounds(int x, int y);
  76. // JOSEF add functionality
  77. void SetEnd(POINT){};
  78. void UnDraw(void);
  79. void SetViewHandle(UINT viewHandle){};
  80. //
  81. // Get/set flag telling that this drawing is completed
  82. //
  83. void SetIsCompleted(BOOL isCompleted) {m_isDrawingCompleted = isCompleted;}
  84. BOOL GetIsCompleted(void){return m_isDrawingCompleted;}
  85. //
  86. // Get the UI tool from a drawing pdu
  87. //
  88. void SetUIToolType(void);
  89. //
  90. // Mask 0x000008FF (penColor_chosen = 1... DrawingAttribute_zOrder_chosen = 8)
  91. //
  92. void ChangedPenColor(void){m_dwChangedAttrib |=
  93. (1 << (penColor_chosen-1)) | (DrawingEditPDU_attributeEdits_present << 4);}
  94. void ChangedFillColor(void){m_dwChangedAttrib |=
  95. (1 << (fillColor_chosen-1)) | (DrawingEditPDU_attributeEdits_present << 4);}
  96. void ChangedPenThickness(void){m_dwChangedAttrib |=
  97. (1 << (penThickness_chosen-1)) | (DrawingEditPDU_attributeEdits_present << 4);}
  98. void ChangedPenNib(void){m_dwChangedAttrib |=
  99. (1 << (penNib_chosen-1)) | (DrawingEditPDU_attributeEdits_present << 4);}
  100. void ChangedLineStyle(void){m_dwChangedAttrib |=
  101. (1 << (lineStyle_chosen-1)) | (DrawingEditPDU_attributeEdits_present << 4);}
  102. void ChangedHighlight(void){m_dwChangedAttrib |=
  103. (1 << (highlight_chosen-1)) | (DrawingEditPDU_attributeEdits_present << 4);}
  104. void ChangedViewState(void){m_dwChangedAttrib |=
  105. (1 << (DrawingAttribute_viewState_chosen-1)) | (DrawingEditPDU_attributeEdits_present << 4);}
  106. void ChangedZOrder(void){m_dwChangedAttrib |=
  107. (1 << (DrawingAttribute_zOrder_chosen-1)) | (DrawingEditPDU_attributeEdits_present << 4);}
  108. BOOL HasPenColorChanged(void){return (m_dwChangedAttrib & (1 << (penColor_chosen - 1)));}
  109. BOOL HasFillColorChanged(void){return (m_dwChangedAttrib & (1 << (fillColor_chosen - 1)));}
  110. BOOL HasPenThicknessChanged(void){return (m_dwChangedAttrib & (1 << (penThickness_chosen - 1)));}
  111. BOOL HasPenNibChanged(void){return (m_dwChangedAttrib & (1 << (penNib_chosen - 1)));}
  112. BOOL HasLineStyleChanged(void){return (m_dwChangedAttrib & (1 << (lineStyle_chosen - 1)));}
  113. BOOL HasHighlightChanged(void){return (m_dwChangedAttrib & (1 << (highlight_chosen - 1)));}
  114. BOOL HasViewStateChanged(void){return (m_dwChangedAttrib & (1 << (DrawingAttribute_viewState_chosen - 1)));}
  115. BOOL HasZOrderChanged(void){return (m_dwChangedAttrib & (1 << (DrawingAttribute_zOrder_chosen - 1)));}
  116. //
  117. // Mask 0x000000700 bits (pointListEdits_present = 0x10... DrawingEditPDU_anchorPointEdit_present = 0x40)
  118. //
  119. void ChangedPointList(void) { m_dwChangedAttrib |= pointListEdits_present << 4;}
  120. void ChangedRotation(void) { m_dwChangedAttrib |= rotationEdit_present << 4;}
  121. void ChangedAnchorPoint(void) { m_dwChangedAttrib |= DrawingEditPDU_anchorPointEdit_present << 4;}
  122. BOOL HasPointListChanged(void) { return (m_dwChangedAttrib & pointListEdits_present << 4);}
  123. BOOL HasRotationChanged(void) { return (m_dwChangedAttrib & rotationEdit_present << 4);}
  124. BOOL HasAnchorPointChanged(void) { return (m_dwChangedAttrib & DrawingEditPDU_anchorPointEdit_present << 4);}
  125. DWORD GetPresentAttribs(void){return ((m_dwChangedAttrib & 0x0F00)>> 4);}
  126. void ResetAttrib(void){m_dwChangedAttrib = 0;}
  127. void SetAllAttribs(void){m_dwChangedAttrib = 0x08FF;}
  128. void OnObjectEdit(void);
  129. void OnObjectDelete(void);
  130. void SendNewObjectToT126Apps(void);
  131. void GetEncodedCreatePDU(ASN1_BUF *pBuf);
  132. protected:
  133. //
  134. // T126 Drawing and UI specific
  135. //
  136. DWORD m_dwChangedAttrib;
  137. UINT m_drawingType;
  138. UINT m_lineStyle;
  139. BOOL m_bIsPenColorPresent;
  140. BOOL m_bIsFillColorPresent;
  141. RGBTRIPLE m_penColor;
  142. RGBTRIPLE m_fillColor;
  143. UINT m_penNib;
  144. BOOL m_bHighlight;
  145. BOOL m_isDrawingCompleted;
  146. UINT GetSubsequentPoints(UINT choice, POINT * initialPoint, PointList * pointList);
  147. void GetDrawingAttrib(PVOID pAttribPDU);
  148. };
  149. #endif // __DRAWOBJ_HPP_