home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / Examples / Draw / Sources / DrawPrxy.cpp < prev    next >
Encoding:
Text File  |  1995-11-08  |  20.3 KB  |  647 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                DrawPrxy.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:    © 1993, 1995 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #include "ODFDraw.hpp"
  13.  
  14. #ifndef DRAWPRXY_H
  15. #include "DrawPrxy.h"
  16. #endif
  17.  
  18. #ifndef DRAWPART_H
  19. #include "DrawPart.h"
  20. #endif
  21.  
  22. #ifndef DRAWFRM_H
  23. #include "DrawFrm.h"
  24. #endif
  25.  
  26. #ifndef BASESHP_H
  27. #include "BaseShp.h"
  28. #endif
  29.  
  30. #ifndef BOUNDSHP_H
  31. #include "BoundShp.h"
  32. #endif
  33.  
  34. #ifndef LINESHP_H
  35. #include "LineShp.h"
  36. #endif
  37.  
  38. #ifndef OVALSHP_H
  39. #include "OvalShp.h"
  40. #endif
  41.  
  42. #ifndef RECTSHP_H
  43. #include "RectShp.h"
  44. #endif
  45.  
  46. #ifndef RRECTSHP_H
  47. #include "RRectShp.h"
  48. #endif
  49.  
  50. #ifndef TEXTSHP_H
  51. #include "TextShp.h"
  52. #endif
  53.  
  54. #ifndef DRAWCLIP_H
  55. #include "DrawClip.h"
  56. #endif
  57.  
  58. #ifndef UTILS_H
  59. #include "Utils.h"
  60. #endif
  61.  
  62. // ----- Part Layer -----
  63.  
  64. #ifndef FWUTIL_H
  65. #include "FWUtil.h"
  66. #endif
  67.  
  68. #ifndef FWPART_H
  69. #include "FWPart.h"
  70. #endif
  71.  
  72. #ifndef FWPRTITE_H
  73. #include "FWPrtIte.h"
  74. #endif
  75.  
  76. #ifndef FWPRESEN_H
  77. #include "FWPresen.h"
  78. #endif
  79.  
  80. #ifndef FWPXYFRM_H
  81. #include "FWPxyFrm.h"
  82. #endif
  83.  
  84. // ----- OS Layer -----
  85.  
  86. #ifndef FWRECT_H
  87. #include "FWRect.h"
  88. #endif
  89.  
  90. #ifndef FWODGEOM_H
  91. #include "FWODGeom.h"
  92. #endif
  93.  
  94. #ifndef FWEVENT_H
  95. #include "FWEvent.h"
  96. #endif
  97.  
  98. // ----- Foundation Includes -----
  99.  
  100. #ifndef FWSTREAM_H
  101. #include "FWStream.h"
  102. #endif
  103.  
  104. // ----- OpenDoc Includes -----
  105.  
  106. #ifndef SOM_ODShape_xh
  107. #include <Shape.xh>
  108. #endif
  109.  
  110. #ifndef SOM_ODTransform_xh
  111. #include <Trnsform.xh>
  112. #endif
  113.  
  114. //========================================================================================
  115. //    Runtime Information
  116. //========================================================================================
  117.  
  118. #ifdef FW_BUILD_MAC
  119. #pragma segment odfdraw
  120. #endif
  121.  
  122. FW_DEFINE_CLASS_M2(CProxyShape, CRectShape, FW_MProxy)
  123.  
  124. FW_REGISTER_ARCHIVABLE_CLASS(LProxyShape, CProxyShape, CProxyShape::Read, CBaseShape::Write)
  125.  
  126. //========================================================================================
  127. // globals
  128. //========================================================================================
  129.  
  130. unsigned long CProxyShape::gProxyCount = 0;
  131.  
  132. //========================================================================================
  133. //    CProxyShape
  134. //========================================================================================
  135.  
  136. //----------------------------------------------------------------------------------------
  137. //    CProxyShape::CProxyShape
  138. //----------------------------------------------------------------------------------------
  139.  
  140. CProxyShape::CProxyShape(Environment* ev, const FW_CRect& rect, CDrawPart* drawPart) :
  141.     CRectShape(kProxyShape, kFillOnly),
  142.     FW_MProxy(ev, drawPart, drawPart->GetMainPresentation()),
  143.     fDrawPart(drawPart),
  144.     fFrozen(FALSE),
  145.     fFrameRect(rect)
  146. {
  147.     SetRectGeometry(rect);
  148.     CProxyShape::gProxyCount++;
  149. }
  150.  
  151. //----------------------------------------------------------------------------------------
  152. // CProxyShape::CProxyShape
  153. //----------------------------------------------------------------------------------------
  154.  
  155. CProxyShape::CProxyShape(Environment* ev, CDrawPart* drawPart, FW_CReadableStream& archive) :
  156.     CRectShape(archive),
  157.     FW_MProxy(ev, drawPart, drawPart->GetMainPresentation()),
  158.     fDrawPart(drawPart),
  159.     fFrozen(FALSE)
  160. {
  161.     archive >> fFrameRect;
  162.  
  163.     CProxyShape::gProxyCount++;
  164. }
  165.  
  166. //----------------------------------------------------------------------------------------
  167. // CProxyShape::~CProxyShape
  168. //----------------------------------------------------------------------------------------
  169.  
  170. CProxyShape::~CProxyShape()
  171. {
  172.     CProxyShape::gProxyCount--;
  173. }
  174.     
  175. //----------------------------------------------------------------------------------------
  176. //    CProxyShape::FrameShapeRequested
  177. //----------------------------------------------------------------------------------------
  178.  
  179. ODShape* CProxyShape::FrameShapeRequested(Environment* ev, 
  180.                                         ODFrame* odEmbeddedFrame, 
  181.                                         ODShape* frameShape)
  182. {
  183.     // ----- get the bounding box of the asked frame shape
  184.     FW_CRect frameRect = FW_GetShapeBoundingBox(ev, frameShape);
  185.     
  186.     fFrameRect.right = fFrameRect.left + frameRect.Width();
  187.     fFrameRect.bottom = fFrameRect.top + frameRect.Height();
  188.  
  189.     // ----- Invalidate the old used Shape in case the embedded frame doesn't do it-----
  190.     FW_CAcquiredODShape aqUsedShape = odEmbeddedFrame->AcquireUsedShape(ev, NULL);
  191.     odEmbeddedFrame->Invalidate(ev, aqUsedShape, NULL);
  192.     
  193.     // ----- Don't forget to bump the refcount
  194.     frameShape->Acquire(ev);
  195.     return frameShape;
  196. }
  197.  
  198. //----------------------------------------------------------------------------------------
  199. //    CProxyShape::UsedShapeChanged
  200. //----------------------------------------------------------------------------------------
  201.  
  202. void CProxyShape::UsedShapeChanged(Environment* ev, FW_CEmbeddingFrame* embeddingFrame, ODFrame* odEmbeddedFrame)
  203. {
  204.     FW_CAcquiredODShape aqFrameShape = odEmbeddedFrame->AcquireFrameShape(ev, NULL);
  205.     FW_CAcquiredODShape aqUsedShape = odEmbeddedFrame->AcquireUsedShape(ev, NULL);
  206.     
  207.     FW_CRect usedShapeRect = FW_GetShapeBoundingBox(ev, aqUsedShape);
  208.     FW_CRect newShapeRect = FW_GetShapeBoundingBox(ev, aqFrameShape);
  209.  
  210.     newShapeRect.Intersection(usedShapeRect);    
  211.     newShapeRect.Offset(fFrameRect.left, fFrameRect.top);
  212.  
  213.     // ----- Get previous update shape -----
  214.     FW_CAcquiredODShape aqInvalidShape = ::FW_NewODShape(ev);
  215.     GetUpdateBox(ev, aqInvalidShape);
  216.  
  217.     // ----- Set the geometry of the shape -----
  218.     SetRectGeometry(newShapeRect);
  219.         
  220.     // ----- Calculate the shape to update union minus intersection
  221.     {
  222.         FW_CAcquiredODShape aqNewUpdateBox = ::FW_NewODShape(ev);
  223.         GetUpdateBox(ev, aqNewUpdateBox);
  224.         
  225.         FW_CAcquiredODShape aqIntersect(aqInvalidShape->Copy(ev));
  226.         aqIntersect->Intersect(ev, aqNewUpdateBox);
  227.         
  228.         aqInvalidShape->Union(ev, aqNewUpdateBox);
  229.         
  230.         // ----- Clip our embedded facets using the union
  231.         CDrawFacetClipper facetClipper(ev, fDrawPart);
  232.         facetClipper.Clip(ev, embeddingFrame, aqInvalidShape);
  233.  
  234.         aqInvalidShape->Subtract(ev, aqIntersect);
  235.     }
  236.     
  237.     fDrawPart->GetMainPresentation()->Invalidate(ev, aqInvalidShape);
  238.     
  239.     // ----- Invalidate the difference
  240.     embeddingFrame->Invalidate(ev, aqInvalidShape);
  241. }
  242.  
  243. //----------------------------------------------------------------------------------------
  244. //    CProxyShape::MoveBefore
  245. //----------------------------------------------------------------------------------------
  246.  
  247. void CProxyShape::MoveBefore(Environment* ev, CProxyShape* before)
  248. {
  249.     FW_CPresentationFacetIterator ite(ev, fDrawPart->GetMainPresentation());
  250.     for (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
  251.     {
  252.         FW_CFacetIterator ite1(ev, facet, kODChildrenOnly, kODFrontToBack);
  253.         for (ODFacet* facet1 = ite1.First(ev); ite1.IsNotComplete(ev); facet1 = ite1.Next(ev))
  254.         {
  255.             FW_CAcquiredODPart aqODPart = facet1->GetFrame(ev)->AcquirePart(ev);
  256.             if (aqODPart == GetEmbeddedPart(ev))
  257.             {
  258.                 FW_CFacetIterator ite2(ev, facet, kODChildrenOnly, kODFrontToBack);
  259.                 for (ODFacet* facet2 = ite2.First(ev); ite2.IsNotComplete(ev); facet2 = ite2.Next(ev))
  260.                 {
  261.                     FW_CAcquiredODPart aqODPart2 = facet2->GetFrame(ev)->AcquirePart(ev);
  262.                     if (aqODPart2 == before->GetEmbeddedPart(ev))
  263.                     {
  264.                         facet->MoveBefore(ev, facet1, facet2);
  265.                         break;
  266.                     }
  267.                 }
  268.             }
  269.         }
  270.     }
  271. }
  272.  
  273. //----------------------------------------------------------------------------------------
  274. //    CProxyShape::MoveBehind
  275. //----------------------------------------------------------------------------------------
  276.  
  277. void CProxyShape::MoveBehind(Environment* ev, CProxyShape* behind)
  278. {    
  279.     FW_CPresentationFacetIterator ite(ev, fDrawPart->GetMainPresentation());
  280.     for (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
  281.     {
  282.         FW_CFacetIterator ite1(ev, facet, kODChildrenOnly, kODFrontToBack);
  283.         for (ODFacet* facet1 = ite1.First(ev); ite1.IsNotComplete(ev); facet1 = ite1.Next(ev))
  284.         {
  285.             FW_CAcquiredODPart aqODPart = facet1->GetFrame(ev)->AcquirePart(ev);
  286.             if (aqODPart == GetEmbeddedPart(ev))
  287.             {
  288.                 FW_CFacetIterator ite2(ev, facet1, kODChildrenOnly, kODFrontToBack);
  289.                 for (ODFacet* facet2 = ite2.First(ev); ite2.IsNotComplete(ev); facet2 = ite2.Next(ev))
  290.                 {
  291.                     FW_CAcquiredODPart aqODPart2 = facet2->GetFrame(ev)->AcquirePart(ev);
  292.                     if (aqODPart2 == behind->GetEmbeddedPart(ev))
  293.                     {
  294.                         facet->MoveBehind(ev, facet1, facet2);
  295.                         break;
  296.                     }
  297.                 }
  298.             }
  299.         }
  300.     }
  301. }
  302.  
  303. //----------------------------------------------------------------------------------------
  304. // CProxyShape::RestoreShape
  305. //----------------------------------------------------------------------------------------
  306.  
  307. void CProxyShape::RestoreShape(Environment *ev, CDrawPart* drawPart)
  308. {
  309.     CRectShape::RestoreShape(ev, drawPart);
  310.     
  311.     AttachEmbeddedFrames(ev);
  312. }
  313.  
  314. //----------------------------------------------------------------------------------------
  315. // CProxyShape::Removed
  316. //----------------------------------------------------------------------------------------
  317.  
  318. void CProxyShape::Removed(Environment* ev)
  319. {
  320.     CRectShape::Removed(ev);
  321.     
  322.     DetachEmbeddedFrames(ev);
  323. }
  324.  
  325. //----------------------------------------------------------------------------------------
  326. // CProxyShape::Deleted
  327. //----------------------------------------------------------------------------------------
  328.  
  329. void CProxyShape::Deleted(Environment* ev)
  330. {
  331.     CRectShape::Deleted(ev);
  332.     
  333.     RemoveEmbeddedFrames(ev);
  334. }
  335.  
  336. //----------------------------------------------------------------------------------------
  337. // CProxyShape::Flatten
  338. //----------------------------------------------------------------------------------------
  339.  
  340. void CProxyShape::Flatten(FW_CWritableStream& archive)
  341. {    
  342.     CRectShape::Flatten(archive);
  343.     
  344.     archive << fFrameRect;
  345.  
  346.     // [HLX] I know it's bad but I know I am archiving to a storage unit
  347.     CDrawWritableStream* drawArchive = (CDrawWritableStream*)&archive;
  348.     Externalize(drawArchive->GetEnvironment(), drawArchive->GetStorageUnitView(), drawArchive->GetCloneInfo());
  349. }
  350.  
  351. //----------------------------------------------------------------------------------------
  352. // CProxyShape::RenderShape
  353. //----------------------------------------------------------------------------------------
  354. //    Because there can be multiple CProxyShape pointing on an embedded
  355. //    frame, I only draw those belonging to this frame.
  356.  
  357. void CProxyShape::RenderShape(Environment *ev, ODFacet* facet, FW_CGraphicContext& gc)
  358. {
  359.     FW_CAcquiredODShape aqTempShape = ::FW_NewODShape(ev);
  360.     FW_CAcquiredODShape aqTempClipShape(gc.GetClip());    // GetClip returns a copy in content coordinate
  361.  
  362.     // ----- Because we are calling the draw method of an embedded facet, we want
  363.     // ----- to save our context. The embedded facet will be using the same grafport 
  364.     // ----- and may not be restoring it.    
  365.     FW_CSaveRestoreContext src(gc);
  366.     
  367.     FW_CEmbeddedODFacetsIterator ite(ev, this, facet, kODFrontToBack);
  368.     for (ODFacet *embeddedODFacet = ite.First(ev); ite.IsNotComplete(ev); embeddedODFacet = ite.Next(ev))
  369.     {    
  370.         aqTempShape->CopyFrom(ev, aqTempClipShape);
  371.         
  372.         {
  373.             FW_CAcquiredODTransform aqFrameTransform = embeddedODFacet->AcquireExternalTransform(ev, NULL);
  374.             aqTempShape->InverseTransform(ev, aqFrameTransform);    // parent content (me) -> embedded frame
  375.         }
  376.                 
  377. #ifdef FW_BUILD_WIN
  378.         // [HLX] bug in windows? the invalidShape is expected to be in pixels instead of points
  379.         aqTempShape->Outset(ev, ff(1));    // [HLX] Because of rounding errors
  380.         FW_CGraphicDevice *device = gc.GetGraphicDevice();
  381.         device->PointToPixel(ev, aqTempShape);
  382. #endif
  383.     
  384.         embeddedODFacet->Draw(ev, aqTempShape, NULL);
  385.         embeddedODFacet->DrawChildren(ev, aqTempShape, NULL);
  386.         
  387.         {
  388.             FW_CAcquiredODShape aqClipShape = embeddedODFacet->AcquireClipShape(ev, NULL);
  389.             aqTempShape->CopyFrom(ev, aqClipShape);
  390.         }
  391.         
  392.         {
  393.             FW_CAcquiredODTransform aqExternalTransform = embeddedODFacet->AcquireExternalTransform(ev, NULL);
  394.             aqTempShape->Transform(ev, aqExternalTransform);
  395.         }
  396.         
  397.         aqTempClipShape->Subtract(ev, aqTempShape);
  398.     }
  399. }
  400.  
  401. //----------------------------------------------------------------------------------------
  402. // CProxyShape::GetHandleCenter
  403. //----------------------------------------------------------------------------------------
  404.  
  405. void CProxyShape::GetHandleCenter(short whichHandle, FW_CPoint& center) const
  406. {
  407.     const FW_CFixed fxHalf = FW_ODFixedToFixed(0x00008000);
  408.  
  409.     switch (whichHandle)
  410.     {
  411.         case kInTopLeftCorner:
  412.             center.x = fRect.left;
  413.             center.y = fRect.top;
  414.             break;
  415.         case kInTopRightCorner:
  416.             center.x = fRect.right - fxHalf;
  417.             center.y = fRect.top;
  418.             break;
  419.         case kInBottomLeftCorner:
  420.             center.x = fRect.left;
  421.             center.y = fRect.bottom - fxHalf;
  422.             break;
  423.         case kInBottomRightCorner:
  424.             center.x = fRect.right - fxHalf;
  425.             center.y = fRect.bottom - fxHalf;
  426.             break;
  427.     }
  428. }
  429.  
  430. //----------------------------------------------------------------------------------------
  431. // CProxyShape::MapShape
  432. //----------------------------------------------------------------------------------------
  433.  
  434. void CProxyShape::MapShape(Environment *ev, CDrawPart* part, const FW_CRect& srcRect, const FW_CRect& dstRect)
  435. {
  436.     CRectShape::MapShape(ev, part, srcRect, dstRect);    
  437.     
  438.     GetRectGeometry(fFrameRect);
  439.         
  440.     // ----- Resize every embedded frames -----
  441.     ChangeExternalTransforms(ev, fFrameRect.left, fFrameRect.top);
  442.     ChangeFrameShapes(ev, fFrameRect.right - fFrameRect.left, fFrameRect.bottom - fFrameRect.top);    
  443. }
  444.  
  445. //----------------------------------------------------------------------------------------
  446. // CProxyShape::OffsetShape
  447. //----------------------------------------------------------------------------------------
  448.  
  449. void CProxyShape::OffsetShape(Environment *ev, FW_CFixed xDelta, FW_CFixed yDelta)
  450. {    
  451.     CRectShape::OffsetShape(ev, xDelta, yDelta);
  452.     
  453.     fFrameRect.Offset(xDelta, yDelta);
  454.     
  455.     // ----- Change the external transform of all embedded facets -----
  456.     ChangeExternalTransforms(ev, fFrameRect.left, fFrameRect.top);
  457. }
  458.         
  459. //----------------------------------------------------------------------------------------
  460. // CProxyShape::SelectShape
  461. //----------------------------------------------------------------------------------------
  462.  
  463. void CProxyShape::SelectShape(Environment *ev, FW_Boolean state)
  464. {
  465.     CBaseShape::SelectShape(ev, state);
  466.     
  467.     // ----- Select all the embedded facet ----
  468.     SetSelectState(ev, state);
  469. }
  470.  
  471. //----------------------------------------------------------------------------------------
  472. // CProxyShape::MovedAfter
  473. //----------------------------------------------------------------------------------------
  474. //    shape has been moved after this
  475.  
  476. void CProxyShape::MovedAfter(Environment *ev, CBaseShape* shape)
  477. {
  478.     if (shape->GetShapeType() == kProxyShape)
  479.     {
  480.         ((CProxyShape*)shape)->MoveBehind(ev, this);
  481.     }
  482. }
  483.  
  484. //----------------------------------------------------------------------------------------
  485. // CProxyShape::MovedBefore
  486. //----------------------------------------------------------------------------------------
  487. //    shape has been moved before this
  488.  
  489. void CProxyShape::MovedBefore(Environment *ev, CBaseShape* shape)
  490. {
  491.     if (shape->GetShapeType() == kProxyShape)
  492.     {
  493.         ((CProxyShape*)shape)->MoveBefore(ev, this);
  494.     }
  495. }
  496.  
  497. //----------------------------------------------------------------------------------------
  498. // CProxyShape::MovedFirst
  499. //----------------------------------------------------------------------------------------
  500. //    this has been moved First
  501.  
  502. void CProxyShape::MovedFirst(Environment *ev)
  503. {
  504.     FW_CPresentationFacetIterator ite(ev, fDrawPart->GetMainPresentation());
  505.     for (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
  506.     {
  507.         FW_CFacetIterator ite1(ev, facet, kODChildrenOnly, kODFrontToBack);
  508.         for (ODFacet* facet1 = ite1.First(ev); ite1.IsNotComplete(ev); facet1 = ite1.Next(ev))
  509.         {
  510.             FW_CAcquiredODPart aqODPart = facet1->GetFrame(ev)->AcquirePart(ev);
  511.             if (aqODPart == GetEmbeddedPart(ev))
  512.                 facet->MoveBefore(ev, facet1, NULL);
  513.         }
  514.     }
  515. }
  516.  
  517. //----------------------------------------------------------------------------------------
  518. // CProxyShape::MovedLast
  519. //----------------------------------------------------------------------------------------
  520. //    this has been moved Last
  521.  
  522. void CProxyShape::MovedLast(Environment *ev)
  523. {
  524.     FW_CPresentationFacetIterator ite(ev, fDrawPart->GetMainPresentation());
  525.     for (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
  526.     {
  527.         FW_CFacetIterator ite1(ev, facet, kODChildrenOnly, kODFrontToBack);
  528.         for (ODFacet* facet1 = ite1.First(ev); ite1.IsNotComplete(ev); facet1 = ite1.Next(ev))
  529.         {
  530.             FW_CAcquiredODPart aqODPart = facet1->GetFrame(ev)->AcquirePart(ev);
  531.             if (aqODPart == GetEmbeddedPart(ev))
  532.                 facet->MoveBehind(ev, facet1, NULL);
  533.         }
  534.     }
  535. }
  536.  
  537. //----------------------------------------------------------------------------------------
  538. // CProxyShape::SetFrozen
  539. //----------------------------------------------------------------------------------------
  540.  
  541. FW_Boolean CProxyShape::SetFrozen(FW_Boolean state)
  542. {
  543.     if (fFrozen != state)
  544.     {
  545.         fFrozen = state;    
  546.         return TRUE;
  547.     }
  548.     
  549.     return FALSE;
  550. }
  551.  
  552. //----------------------------------------------------------------------------------------
  553. // CProxyShape::IsFrozen
  554. //----------------------------------------------------------------------------------------
  555.  
  556. FW_Boolean CProxyShape::IsFrozen() const
  557. {
  558.     return fFrozen;
  559. }
  560.  
  561. //----------------------------------------------------------------------------------------
  562. // CProxyShape::Read
  563. //----------------------------------------------------------------------------------------
  564.  
  565. void* CProxyShape::Read(FW_CReadableStream& archive)
  566. {
  567.     // [HLX] This is a hack until I can register object with the archiver
  568.     CDrawReadableStream *drawArchive = (CDrawReadableStream*)&archive;
  569.     CProxyShape* proxyShape = new CProxyShape(drawArchive->GetEnvironment(), drawArchive->GetDrawPart(), archive);
  570.     
  571.     proxyShape->Internalize(drawArchive->GetEnvironment(), drawArchive->GetStorageUnitView(), drawArchive->GetCloneInfo());
  572.     
  573.     return proxyShape;
  574. }
  575.  
  576. //----------------------------------------------------------------------------------------
  577. // CProxyShape::SubtractToWindowClip
  578. //----------------------------------------------------------------------------------------
  579. //    ATTENTION: windowClip is in Window coordinates. tempShape is just a working shape. It is
  580. //    used by CBaseShape so I don't have to allocate a shape every time.
  581.  
  582. void CProxyShape::SubtractToWindowClip(Environment *ev, 
  583.                                         CDrawFacetClipper* facetClipper, 
  584.                                         ODFacet* containingFacet, 
  585.                                         ODShape* windowClip, ODShape* tempShape)
  586. {
  587. FW_UNUSED(tempShape);
  588.  
  589.     FW_CEmbeddedODFacetsIterator ite(ev, this, containingFacet, kODFrontToBack);
  590.     for (ODFacet *embeddedODFacet = ite.First(ev); ite.IsNotComplete(ev); embeddedODFacet = ite.Next(ev))
  591.     {
  592.         facetClipper->ClipOneEmbeddedFacet(ev, embeddedODFacet, windowClip);
  593.     }
  594. }
  595.  
  596. //----------------------------------------------------------------------------------------
  597. // CProxyShape::ChangeRenderVerb
  598. //----------------------------------------------------------------------------------------
  599.  
  600. void CProxyShape::ChangeRenderVerb(Environment *ev, CDrawPart* part, unsigned short renderVerb)
  601. {
  602. FW_UNUSED(ev);
  603. FW_UNUSED(part);
  604. FW_UNUSED(renderVerb);
  605.  
  606.     // We don't do anything
  607. }
  608.  
  609. //----------------------------------------------------------------------------------------
  610. // CProxyShape::SetSubscribeLink
  611. //----------------------------------------------------------------------------------------
  612.  
  613. void CProxyShape::SetSubscribeLink(Environment* ev, CDrawSubscribeLink *subscribeLink)
  614. {
  615.     CBaseShape::SetSubscribeLink(ev, subscribeLink);
  616.     ChangeLinkStatus(ev, kODInLinkDestination);
  617. }
  618.  
  619. //----------------------------------------------------------------------------------------
  620. // CProxyShape::SetPublishLink
  621. //----------------------------------------------------------------------------------------
  622.  
  623. void CProxyShape::SetPublishLink(Environment* ev, CDrawPublishLink *subscribeLink)
  624. {
  625.     CBaseShape::SetPublishLink(ev, subscribeLink);
  626.     ChangeLinkStatus(ev, kODInLinkSource);
  627. }
  628.  
  629. //----------------------------------------------------------------------------------------
  630. // CProxyShape::ChangeLinkStatus
  631. //----------------------------------------------------------------------------------------
  632.  
  633. void CProxyShape::ChangeLinkStatus(Environment* ev, ODLinkStatus linkStatus)
  634. {
  635.     FW_CProxyProxyFrameIterator iter(this);
  636.     for (FW_CProxyFrame* frame = iter.First(); iter.IsNotComplete(); frame = iter.Next())
  637.     {
  638.         if (linkStatus == kODInLinkSource)
  639.         {    // if frame is already in a destination, leave its status alone
  640.             if (frame->GetFrame(ev)->GetLinkStatus(ev) != kODInLinkDestination)
  641.                 frame->GetFrame(ev)->ChangeLinkStatus(ev, linkStatus);
  642.         }
  643.         else
  644.             frame->GetFrame(ev)->ChangeLinkStatus(ev, linkStatus);
  645.     }
  646. }
  647.