home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Table / Sources / Linking.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  6.9 KB  |  223 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Linking.h
  4. //    Release Version:    $ ODF 1 $ 
  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 CBreakLinkSourceCommand;
  47. class CBreakLinkCommand;
  48. class CTableContent;
  49. class CTableSelectionContent;
  50.  
  51. //========================================================================================
  52. //    class CTableLinkSource
  53. //========================================================================================
  54.  
  55. class CTableLinkSource : public FW_CLinkSource
  56. {
  57.   public:
  58.     CTableLinkSource(Environment* ev, 
  59.                      ODUpdateID changeID, 
  60.                      FW_CPresentation* presentation,
  61.                      CTablePart* part,
  62.                      CTableContent* content,
  63.                      CTableSelection* selection);
  64.     virtual ~ CTableLinkSource();
  65.  
  66.     //--- FW_CLinkSource overrides
  67.     virtual void        LinkEstablished(Environment* ev);
  68.     virtual void        ExternalizeLinkContent(Environment* ev, ODStorageUnit* linkSU);
  69.  
  70.     virtual void        BreakLink(Environment* ev);
  71.  
  72.     virtual void        DoExternalizeLink(Environment* ev, ODStorageUnit* storageUnit,
  73.                                           FW_CCloneInfo* cloneInfo);
  74.  
  75.     virtual FW_Boolean    HasEmbeddedFrame(Environment* ev, ODFrame* odEmbeddedFrame);
  76.  
  77.     //--- FW_CLink overrides
  78.     virtual ODShape*    DoCreateLinkBorderShape(Environment* ev);
  79.     virtual void        DoDrawLinkBorder(Environment* ev, ODShape* outline, FW_CGraphicContext& gc);
  80.  
  81.     //--- May move to FW_CLinkSource
  82.     virtual CBreakLinkSourceCommand* DoLinkInfo(Environment* ev, ODFacet* facet);
  83.     virtual FW_CFrame*    GetFrameToRevealLink(Environment* ev);
  84.  
  85.     //--- Specific to Table part
  86.     void                DoSelect(Environment* ev, FW_CFrame* frame);
  87.     CCell                GetCell(Environment* ev) const;
  88.     void                SetCell(Environment* ev, const CCell& cell);
  89.  
  90.   private:
  91.     CTablePart*                fTablePart;
  92.     CTableSelectionContent*    fPublishedContent;
  93. };
  94.  
  95. //========================================================================================
  96. //    class CTableLink
  97. //========================================================================================
  98.  
  99. class CTableLink : public FW_CLinkDestination
  100. {
  101.   public:
  102.  
  103.     CTableLink(Environment* ev, 
  104.                ODLink* odLink, 
  105.                ODLinkInfo* linkInfo, 
  106.                FW_CPresentation* presentation,
  107.                CTablePart* part,
  108.                CTableContent* content,
  109.                CTableSelection* destSelection);
  110.     virtual ~ CTableLink();
  111.  
  112.     //--- FW_CLinkDestination overrides
  113.     virtual void        LinkEstablished(Environment* ev);
  114.     virtual FW_Boolean    DoUpdateLink(Environment* ev, ODStorageUnit* linkContentSU, ODPasteAsResult* embedInfo);
  115.  
  116.     virtual void        BreakLink(Environment* ev);
  117.  
  118.     virtual void        DoExternalizeLink(Environment* ev, ODStorageUnit* storageUnit,
  119.                                           FW_CCloneInfo* cloneInfo);
  120.  
  121.     //--- FW_CLink overrides
  122.     virtual ODShape*    DoCreateLinkBorderShape(Environment* ev);
  123.     virtual void        DoDrawLinkBorder(Environment* ev, ODShape* outline, FW_CGraphicContext& gc);
  124.  
  125.     //--- Could move to FW_CLinkDestination
  126.     FW_CPresentation*    GetPresentation(Environment* ev);
  127.     virtual CBreakLinkCommand* DoLinkInfo(Environment* ev, ODFacet* facet);
  128.  
  129.     //--- Specific to Table part
  130.     CCell                GetCell(Environment* ev) const;
  131.     void                SetCell(Environment* ev, const CCell& cell);
  132.  
  133.   private:
  134.     CTablePart*                fTablePart;
  135.     CTableSelectionContent*    fLinkedContent;
  136. };
  137.  
  138. //========================================================================================
  139. // CTableLink Inlines
  140. //========================================================================================
  141.  
  142. //----------------------------------------------------------------------------------------
  143. //    CTableLink::GetPresentation
  144. //----------------------------------------------------------------------------------------
  145. inline FW_CPresentation* CTableLink::GetPresentation(Environment* ev)
  146. {
  147.     return fPresentation;
  148. }
  149.  
  150. //========================================================================================
  151. //    class CTableLinkManager
  152. //========================================================================================
  153.  
  154. class CTableLinkManager : public FW_CLinkManager
  155. {
  156. //----------------------------------------------------------------------------------------
  157. //    Constructors/Destructors
  158. //
  159.   public:
  160.     CTableLinkManager(Environment* ev, CTablePart* thePart, CTableContent* tableContent);
  161.     virtual ~CTableLinkManager();
  162.  
  163. //----------------------------------------------------------------------------------------
  164. //    Override Methods
  165. //
  166.   public:
  167.   
  168.       FW_DECLARE_AUTO(CTableLinkManager)
  169.     
  170.     virtual FW_CLinkSource*    NewLinkSource(Environment* ev, 
  171.                                           ODUpdateID updateID, 
  172.                                           FW_CPresentation* presentation);
  173.     virtual FW_CLinkDestination* NewLinkDestination(Environment* ev, 
  174.                                                     ODLink* odLink,
  175.                                                     ODLinkInfo* linkInfo,
  176.                                                     FW_CPresentation* presentation);
  177.  
  178.     virtual FW_CLinkSource*    DoInternalizeOneSourceLink(Environment* ev, 
  179.                                                        ODStorageUnit* storageUnit,
  180.                                                        ODUpdateID updateID);
  181.     virtual FW_CLinkDestination* DoInternalizeOneDestLink(Environment* ev, ODStorageUnit* storageUnit,
  182.                                                           ODLink* odLink, ODLinkInfo* linkInfo);
  183.  
  184.     virtual void            DoChangeLinkStatus(Environment* ev, ODFrame* odFrame);
  185.                                 // formerly named LinkStatusChanged
  186.  
  187.     virtual ODValueType        GetSourceLinkFormat(Environment* ev);
  188.     virtual ODValueType        GetDestLinkFormat(Environment* ev);
  189.  
  190.     virtual void            RevealLink(Environment* ev, ODLinkSource* linkSource);
  191.  
  192. //----------------------------------------------------------------------------------------
  193. //    New API
  194. //
  195.   public:
  196.     void                    BreakExistingLinks(Environment* ev, const CCell& cell);
  197.     void                    MoveExistingLinks(Environment* ev,
  198.                                               const CCell& fromCell,
  199.                                               const CCell& toCell);
  200.  
  201.     CTableLinkSource*        CellToSourceLink(Environment* ev, const CCell& cell) const;
  202.     CTableLink*                CellToLink(Environment* ev, const CCell& cell) const;
  203.  
  204.     CTableLinkSource*         GetSelectedLinkSource(Environment* ev);
  205.     CTableLink*             GetSelectedLinkDest(Environment* ev);
  206.  
  207.     FW_Boolean                ShowLinkInfo(Environment* ev, ODFacet* facet);
  208.  
  209.     void                    UpdateLinkSource(Environment* ev, ODUpdateID updateID);
  210.  
  211.   private:
  212.     FW_Boolean                IsCellInLink(Environment* ev, const CCell& cell);
  213.  
  214. //----------------------------------------------------------------------------------------
  215. //    Data Members
  216. //
  217.   private:
  218.     CTablePart*        fTablePart;
  219.     CTableContent*    fTableContent;
  220. };
  221.  
  222.  
  223. #endif