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 / Table / Sources / Linking.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  6.6 KB  |  213 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Linking.h
  4. //    Release Version:    $ ODF 2 $  
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef LINKING_H
  11. #define LINKING_H
  12.  
  13. #ifndef CELL_H
  14. #include "Cell.h"
  15. #endif
  16.  
  17. // ----- Framework Layer -----
  18.  
  19. #ifndef FWLNKDST_H
  20. #include "FWLnkDst.h"
  21. #endif
  22.  
  23. #ifndef FWLNKSRC_H
  24. #include "FWLnkSrc.h"
  25. #endif
  26.  
  27. #ifndef FWLNKMGR_H
  28. #include "FWLnkMgr.h"
  29. #endif
  30.  
  31. #ifndef FWPOINT_H
  32. #include "FWPoint.h"
  33. #endif
  34.  
  35. //========================================================================================
  36. //    Forward Declarations
  37. //========================================================================================
  38.  
  39. class CTablePart;
  40. class FW_CPart;
  41. class FW_CPresentation;
  42. class CTableSelection;
  43. class FW_CFrame;
  44. class ODPart;
  45. class ODDraft;
  46. class CTablePartContent;
  47. class CTableSelectionContent;
  48.  
  49. //========================================================================================
  50. //    class CTableLinkSource
  51. //========================================================================================
  52.  
  53. class CTableLinkSource : public FW_CLinkSource
  54. {
  55.   public:
  56.     CTableLinkSource(Environment* ev, 
  57.                      ODUpdateID changeID, 
  58.                      FW_CPresentation* presentation,
  59.                      CTablePart* part,
  60.                      CTablePartContent* content,
  61.                      CTableSelection* selection);
  62.     virtual ~ CTableLinkSource();
  63.  
  64.     //--- FW_CLinkSource overrides
  65.     virtual void        LinkEstablished(Environment* ev);
  66.     virtual void        ExternalizeLinkContent(Environment* ev, ODStorageUnit* linkSU);
  67.  
  68.     virtual void        BreakLink(Environment* ev);
  69.  
  70.     virtual void        DoExternalizeLink(Environment* ev, ODStorageUnit* storageUnit,
  71.                                           FW_CCloneInfo* cloneInfo);
  72.  
  73.     virtual FW_Boolean    HasEmbeddedFrame(Environment* ev, ODFrame* odEmbeddedFrame);
  74.     virtual void        RevealLinkSource(Environment* ev, FW_CFrame* frame);
  75.  
  76.     //--- FW_CLink overrides
  77.     virtual ODShape*    DoCreateLinkBorderShape(Environment* ev);
  78.     virtual void        DoDrawLinkBorder(Environment* ev, ODShape* outline, FW_CGraphicContext& gc);
  79.  
  80.     //--- Specific to Table part
  81.     CCell                GetCell(Environment* ev) const;
  82.     void                SetCell(Environment* ev, const CCell& cell);
  83.     virtual void  RestoreLink(Environment* ev, FW_CPart* part); //Override
  84.  
  85.  
  86.   private:
  87.     CTablePart*                fTablePart;
  88.     CTableSelectionContent*    fPublishedContent;
  89. };
  90.  
  91. //========================================================================================
  92. //    class CTableLink
  93. //========================================================================================
  94.  
  95. class CTableLink : public FW_CLinkDestination
  96. {
  97.   public:
  98.     CTableLink(Environment* ev, 
  99.                ODLink* odLink, 
  100.                ODLinkInfo* linkInfo, 
  101.                FW_CPresentation* presentation,
  102.                CTablePart* part,
  103.                CTablePartContent* content,
  104.                CTableSelection* destSelection);
  105.     virtual ~ CTableLink();
  106.  
  107.     //--- FW_CLinkDestination overrides
  108.     virtual void        LinkEstablished(Environment* ev);
  109.     virtual FW_Boolean    DoUpdateLink(Environment* ev, ODStorageUnit* linkContentSU, ODPasteAsResult* embedInfo);
  110.  
  111.     virtual void        BreakLink(Environment* ev);
  112.  
  113.     virtual void        DoExternalizeLink(Environment* ev, ODStorageUnit* storageUnit,
  114.                                           FW_CCloneInfo* cloneInfo);
  115.  
  116.     virtual FW_CFrame*    GetContainingFrame(Environment* ev, ODFrame* odEmbeddedFrame);
  117.  
  118.     //--- FW_CLink overrides
  119.     virtual ODShape*    DoCreateLinkBorderShape(Environment* ev);
  120.     virtual void        DoDrawLinkBorder(Environment* ev, ODShape* outline, FW_CGraphicContext& gc);
  121.  
  122.     //--- Could move to FW_CLinkDestination
  123.     FW_CPresentation*    GetPresentation(Environment* ev);
  124.  
  125.     //--- Specific to Table part
  126.     CCell                GetCell(Environment* ev) const;
  127.     void                SetCell(Environment* ev, const CCell& cell);
  128.  
  129.   private:
  130.     CTablePart*                fTablePart;
  131.     CTableSelectionContent*    fLinkedContent;
  132. };
  133.  
  134. //========================================================================================
  135. // CTableLink Inlines
  136. //========================================================================================
  137.  
  138. //----------------------------------------------------------------------------------------
  139. //    CTableLink::GetPresentation
  140. //----------------------------------------------------------------------------------------
  141. inline FW_CPresentation* CTableLink::GetPresentation(Environment*)
  142. {
  143.     return fPresentation;
  144. }
  145.  
  146. //========================================================================================
  147. //    class CTableLinkManager
  148. //========================================================================================
  149.  
  150. class CTableLinkManager : public FW_CLinkManager
  151. {
  152. //----------------------------------------------------------------------------------------
  153. //    Constructors/Destructors
  154. //
  155.   public:
  156.     CTableLinkManager(Environment* ev, CTablePart* thePart, CTablePartContent* tableContent);
  157.     virtual ~CTableLinkManager();
  158.  
  159. //----------------------------------------------------------------------------------------
  160. //    Override Methods
  161. //
  162.   public:
  163.   
  164.       FW_DECLARE_AUTO(CTableLinkManager)
  165.     
  166.     virtual FW_CLinkSource*    NewLinkSource(Environment* ev, 
  167.                                           ODUpdateID updateID, 
  168.                                           FW_CPresentation* presentation);
  169.     virtual FW_CLinkDestination* NewLinkDestination(Environment* ev, 
  170.                                                     ODLink* odLink,
  171.                                                     ODLinkInfo* linkInfo,
  172.                                                     FW_CPresentation* presentation);
  173.  
  174.     virtual FW_CLinkSource*    DoInternalizeOneSourceLink(Environment* ev, 
  175.                                                        ODStorageUnit* storageUnit,
  176.                                                        ODUpdateID updateID);
  177.     virtual FW_CLinkDestination* DoInternalizeOneDestLink(Environment* ev, ODStorageUnit* storageUnit,
  178.                                                           ODLink* odLink, ODLinkInfo* linkInfo);
  179.  
  180.     virtual void            DoChangeLinkStatus(Environment* ev, ODFrame* odFrame);
  181.                                 // formerly named LinkStatusChanged
  182.  
  183.     virtual ODValueType        GetSourceLinkFormat(Environment* ev);
  184.     virtual ODValueType        GetDestLinkFormat(Environment* ev);
  185.  
  186. //----------------------------------------------------------------------------------------
  187. //    New API
  188. //
  189.   public:
  190.     void                    BreakExistingLinks(Environment* ev, const CCell& cell);
  191.     void                    MoveExistingLinks(Environment* ev,
  192.                                               const CCell& fromCell,
  193.                                               const CCell& toCell);
  194.  
  195.     CTableLinkSource*        CellToSourceLink(Environment* ev, const CCell& cell) const;
  196.     CTableLink*                CellToLink(Environment* ev, const CCell& cell) const;
  197.  
  198.     CTableLinkSource*        GetSelectedLinkSource(Environment* ev);
  199.     void                    UpdateLinkSource(Environment* ev, ODUpdateID updateID);
  200.  
  201.   private:
  202.     FW_Boolean                IsCellInLink(Environment* ev, const CCell& cell);
  203.  
  204. //----------------------------------------------------------------------------------------
  205. //    Data Members
  206. //
  207.   private:
  208.     CTablePart*        fTablePart;
  209.     CTablePartContent*    fTableContent;
  210. };
  211.  
  212.  
  213. #endif