home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Draw / Sources / DrawClip.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.3 KB  |  141 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                DrawClip.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #include "ODFDraw.hpp"
  13.  
  14. #ifndef DRAWCLIP_H
  15. #include "DrawClip.h"
  16. #endif
  17.  
  18. #ifndef DRAWPART_H
  19. #include "DrawPart.h"
  20. #endif
  21.  
  22. #ifndef BASESHP_H
  23. #include "BaseShp.h"
  24. #endif
  25.  
  26. #ifndef BOUNDSHP_H
  27. #include "BoundShp.h"
  28. #endif
  29.  
  30. #ifndef LINESHP_H
  31. #include "LineShp.h"
  32. #endif
  33.  
  34. #ifndef OVALSHP_H
  35. #include "OvalShp.h"
  36. #endif
  37.  
  38. #ifndef RECTSHP_H
  39. #include "RectShp.h"
  40. #endif
  41.  
  42. #ifndef RRECTSHP_H
  43. #include "RRectShp.h"
  44. #endif
  45.  
  46. #ifndef TEXTSHP_H
  47. #include "TextShp.h"
  48. #endif
  49.  
  50. #ifndef DRAWFRM_H
  51. #include "DrawFrm.h"
  52. #endif
  53.  
  54. #ifndef DRAWPRXY_H
  55. #include "DrawPrxy.h"
  56. #endif
  57.  
  58. #ifndef DRAWCONT_H
  59. #include "DrawCont.h"
  60. #endif
  61.  
  62. #ifndef GROUPSHP_H
  63. #include "GroupShp.h"
  64. #endif
  65.  
  66. // ----- Part Includes -----
  67.  
  68. #ifndef FWUTIL_H
  69. #include "FWUtil.h"
  70. #endif
  71.  
  72. // ----- OS Includes -----
  73.  
  74. #ifndef FWODGEOM_H
  75. #include "FWODGeom.h"
  76. #endif
  77.  
  78. // ----- OpenDoc Includes -----
  79.  
  80. #ifndef SOM_ODShape_xh
  81. #include <Shape.xh>
  82. #endif
  83.  
  84. //========================================================================================
  85. // RunTime Info
  86. //========================================================================================
  87.  
  88. #ifdef FW_BUILD_MAC
  89. #pragma segment odfdraw
  90. #endif
  91.  
  92. //========================================================================================
  93. //    class CDrawFacetClipper
  94. //========================================================================================
  95.  
  96. //---------------------------------------------------------------------------------------
  97. //    CDrawFacetClipper::CDrawFacetClipper
  98. //---------------------------------------------------------------------------------------
  99.  
  100. CDrawFacetClipper::CDrawFacetClipper(CDrawPart* part):
  101.     FW_CFacetClipper(),
  102.     fDrawPart(part)
  103. {
  104. }
  105.  
  106. //---------------------------------------------------------------------------------------
  107. //    CDrawFacetClipper::~CDrawFacetClipper
  108. //---------------------------------------------------------------------------------------
  109.  
  110. CDrawFacetClipper::~CDrawFacetClipper()
  111. {
  112. }
  113.  
  114. //----------------------------------------------------------------------------------------
  115. // CDrawFacetClipper::ClipEmbeddedFacets
  116. //----------------------------------------------------------------------------------------
  117.  
  118. void CDrawFacetClipper::ClipEmbeddedFacets(Environment *ev, 
  119.                                             FW_CEmbeddingFrame* embeddingFrame, 
  120.                                             ODFacet* containingFacet, 
  121.                                             ODShape* limitShape)
  122. {
  123.     // ----- If no proxy shape we don't have anything to do -----
  124.     if (fDrawPart->GetDrawContent()->GetProxyShapeCount() == 0)
  125.         return;
  126.         
  127.     // ----- Create a temporary shape -----
  128.     FW_CAcquiredODShape aqTempShape = ::FW_NewODShape(ev);
  129.     aqTempShape->SetGeometryMode(ev, kODLoseGeometry);
  130.     
  131.     // ----- Create the working clip -----
  132.     FW_CAcquiredODShape aqWorkingClip = AcquireWorkingClip(ev, embeddingFrame, containingFacet);
  133.     
  134.     // ----- Go through my shapes (backward) ------
  135.     CAllShapeIterator ite(fDrawPart->GetDrawContent());
  136.     for (CBaseShape* shape = ite.Last(); ite.IsNotComplete(); shape = ite.Previous())
  137.     {
  138.         shape->SubtractToWorkingClip(ev, this, containingFacet, aqWorkingClip, aqTempShape, limitShape);
  139.     }
  140. }
  141.