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 / Content.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  5.4 KB  |  181 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Content.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef CONTENT_H
  11. #define CONTENT_H
  12.  
  13. // ----- FrameWork Includes -----
  14.  
  15. #ifndef FWCONTNG_H
  16. #include "FWContng.h"
  17. #endif
  18.  
  19. #ifndef FWSCPTBL_H
  20. #include "FWScptbl.h"
  21. #endif
  22.  
  23. #ifndef BASESHP_H
  24. #include "BaseShp.h"
  25. #endif
  26.  
  27. //========================================================================================
  28. //    Forward Declarations
  29. //========================================================================================
  30.  
  31. class CDrawPart;
  32. class CShapeCollection;
  33. class CProxyShape;
  34.  
  35. //========================================================================================
  36. //    class CDrawContent
  37. //========================================================================================
  38.  
  39. class CDrawContent : public FW_CEmbeddingContent
  40. {
  41. public:
  42.     friend class CDrawContentShapeIterator;
  43.     friend class CSemanticShapeElementIterator;
  44.     friend class CAllShapeIterator;
  45.     
  46. //----------------------------------------------------------------------------------------
  47. //    Initialization/Destruction
  48. //
  49.   public:
  50.     FW_DECLARE_AUTO(CDrawContent)
  51.     
  52.     CDrawContent(Environment* ev, CDrawPart* part, const FW_CRect& contentRect);
  53.     CDrawContent(Environment* ev, CDrawPart* part, CDrawContent* other);
  54.  
  55.     virtual ~CDrawContent();
  56.  
  57. //----------------------------------------------------------------------------------------
  58. //    Inherited API
  59. //
  60.   public:
  61.     virtual FW_MProxy*    IsDataOnlyOneProxy(Environment* ev) const;
  62.  
  63.     virtual void        ExternalizeKind(Environment* ev,
  64.                             ODStorageUnit* storageUnit,
  65.                             FW_CKind* kind,
  66.                             FW_StorageKinds storageKind,
  67.                             FW_CPromise* promise,
  68.                             FW_CCloneInfo* cloneInfo);
  69.     virtual FW_Boolean    InternalizeKind(Environment* ev,
  70.                             ODStorageUnit* storageUnit, 
  71.                             FW_CKind* kind,
  72.                             FW_StorageKinds storageKind,
  73.                             FW_CCloneInfo* cloneInfo);
  74.                             
  75. //----------------------------------------------------------------------------------------
  76. //    Overridable API
  77. //
  78.   public:
  79.     virtual FW_Boolean    IsOKtoWrite(Environment* ev, CBaseShape* shape);
  80.     virtual void        PostInternalizeShape(Environment* ev, const FW_CPoint& offset, CBaseShape* shape, short index);
  81.  
  82. //----------------------------------------------------------------------------------------
  83. //    New API
  84. //
  85.   public:
  86.     CProxyShape*        AddSingleEmbeddedFrame(Environment* ev,
  87.                                         FW_CEmbeddingFrame* scopeFrame,
  88.                                         ODPart* odEmbeddedPart, 
  89.                                         ODFrame* odEmbeddedFrame,
  90.                                         ODShape* suggestedShape,
  91.                                         ODTypeToken viewType);
  92.  
  93.  
  94.     void                AddShape(Environment* ev, CBaseShape* shape, CBaseShape* nextShape=NULL);
  95.     void                RemoveShape(Environment* ev, CBaseShape* shape);
  96.     void                RemoveShapeFromContent(Environment* ev, CBaseShape* shape);
  97.  
  98.     void                EmptyShapes(Environment* ev);
  99.  
  100.     ODShape*            CalcUpdateShape(Environment* ev);
  101.     void                OffsetShapes(Environment* ev, const FW_CPoint& offset);
  102.     void                RedrawShapes(Environment* ev);
  103.     void                RedrawShape(Environment* ev, CBaseShape* shape);
  104.     void                RedrawShape(Environment* ev, ODShape* odShape);
  105.  
  106. protected:
  107.     void                ExternalizeShapeList(Environment* ev,
  108.                                         ODStorageUnit* storageUnit, 
  109.                                         FW_CCloneInfo* cloneInfo,
  110.                                         FW_Fixed offsetX,
  111.                                         FW_Fixed offsetY);
  112.     void                InternalizeShapeList(Environment* ev,
  113.                                             ODStorageUnit* storageUnit, 
  114.                                             FW_CCloneInfo* cloneInfo);
  115.  
  116. //----------------------------------------------------------------------------------------
  117. //    Getters & Setters
  118. //
  119.   public:
  120.     unsigned long        CountShapes() const;
  121.     FW_Boolean            IsEmpty() const;
  122.  
  123.     CBaseShape*            GetFirstShape() const;
  124.     CBaseShape*            GetShapeAfter(CBaseShape* shape) const;
  125.  
  126.     unsigned short        GetProxyShapeCount() const
  127.                             {return fProxyShapeCount;}
  128.     
  129. //----------------------------------------------------------------------------------------
  130. //    Data Members
  131. //
  132.   protected:
  133.     CShapeCollection*    fShapeList;    // list of CBaseShape*
  134.     CDrawPart*            fDrawPart;
  135.     unsigned short         fProxyShapeCount;
  136.     FW_CRect            fContentRect;
  137. };
  138.  
  139. //========================================================================================
  140. //    class CDrawContentShapeIterator
  141. //========================================================================================
  142.  
  143. class CDrawContentShapeIterator : public CShapeCollectionIterator
  144. {
  145. public:
  146.     FW_DECLARE_AUTO(CDrawContentShapeIterator)
  147.  
  148. public:
  149.     CDrawContentShapeIterator(CDrawContent* content);
  150.     ~CDrawContentShapeIterator();
  151. };
  152.  
  153. //========================================================================================
  154. //    class CSemanticShapeElementIterator
  155. //========================================================================================
  156.  
  157. class CSemanticShapeElementIterator : public FW_CElementIterator
  158. {
  159. public:
  160.     FW_DECLARE_AUTO(CSemanticShapeElementIterator)
  161.     
  162.     CSemanticShapeElementIterator(CDrawContent* content, ODDescType desiredClass);
  163.     ~CSemanticShapeElementIterator();
  164.  
  165. private:
  166.     CSemanticShapeElementIterator(const CSemanticShapeElementIterator& other);
  167.     
  168. public:
  169.     virtual FW_MScriptable* First();
  170.     virtual FW_MScriptable* Next();
  171.     virtual Boolean IsNotComplete()    { return fImplementation.IsNotComplete(); }
  172.     
  173.     Boolean IsDesiredClass(FW_MScriptable* element) const;
  174.     
  175. private:
  176.     CShapeCollectionIterator     fImplementation;
  177.     ODDescType                    fDesiredClass;
  178. };
  179.  
  180. #endif
  181.