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 / ODF / Framewrk / FWSemEvt / Include / FWSemInt.h < prev    next >
Encoding:
Text File  |  1996-08-16  |  6.6 KB  |  209 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWSemInt.h
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWSEMINT_H
  11. #define FWSEMINT_H
  12.  
  13. #ifndef FWDESC_H
  14. #include "FWDesc.h"
  15. #endif
  16.  
  17. #ifndef _ODTYPES_
  18. #include "ODTypes.h"
  19. #endif
  20.  
  21. #ifndef FWEXCLIB_H
  22. #include "FWExcLib.h"
  23. #endif
  24.  
  25. #include "FWTMap.tpp"
  26.  
  27. //========================================================================================
  28. //    Forward Declarations
  29. //========================================================================================
  30.  
  31. class ODExtension;
  32. class FW_MScriptable;
  33. class FW_CPart;
  34. class FW_CAppleEvent;
  35. class FW_CSemanticInterface;
  36. class FW_MPartScriptable;
  37. class FW_OSemanticInterface;
  38. class ODNameResolver;
  39. class ODSession;
  40. class ODOSLToken;
  41. class FW_CFrame;
  42.  
  43. //========================================================================================
  44. //    Private Map Types
  45. //========================================================================================
  46.  
  47. typedef void (*CoercionFunc)(Environment *ev,
  48.                                     const FW_CSemanticInterface* semInt, 
  49.                                     const FW_CDesc& theDesc, 
  50.                                     ODDescType toType, 
  51.                                     FW_CDesc& theResult);
  52.  
  53. typedef FW_TMap<ODDescType, CoercionFunc> FW_CPrivDescTypeToFunctionMap;
  54. typedef FW_TPair<ODDescType, CoercionFunc> FW_CPrivDescTypeToFunctionPair;
  55.  
  56. //========================================================================================
  57. // class FW_CSemanticInterface
  58. //========================================================================================
  59.  
  60. class FW_CSemanticInterface
  61. {
  62. public:
  63.     FW_DECLARE_AUTO(FW_CSemanticInterface)
  64.  
  65. public:
  66.                                 FW_CSemanticInterface(Environment* ev, FW_CPart* part);
  67.     virtual                     ~FW_CSemanticInterface();
  68.  
  69.     //--------------------------------------------------------------------------
  70.     // Coercion callback registration
  71.     
  72.     void                            RegisterCoercionFunction(Environment* ev,
  73.                                                             ODDescType toType,
  74.                                                             CoercionFunc func);
  75.                                                             
  76.     //--------------------------------------------------------------------------
  77.     // SOM Semantic Interface Factory
  78.  
  79.     virtual FW_OSemanticInterface*     CreateSOMInterface(Environment* ev, 
  80.                                                     FW_CPart* part, 
  81.                                                     const char* name,
  82.                                                     void* refCon);
  83.                                                                                                         
  84.     FW_OSemanticInterface*            AcquireSOMInterface(Environment* ev);
  85.         
  86.     //--------------------------------------------------------------------------
  87.     // Register callbacks
  88.     
  89.     virtual void                    RegisterCallbacks(Environment* ev);
  90.  
  91.  
  92.     //--------------------------------------------------------------------------
  93.     // Virtual Semantic Interface Methods
  94.         
  95.     virtual void                     CallEventHandler(Environment* ev, 
  96.                                         FW_CAppleEvent& appleEvent,
  97.                                         FW_CAppleEvent& reply);
  98.     
  99.     void                            CallCoercionHandler(Environment* ev,
  100.                                         const FW_CDesc& theDesc,
  101.                                         ODDescType toType,
  102.                                         FW_CDesc& theResult);                                                
  103.  
  104.     virtual void                    CallPredispatchProc(Environment* ev,
  105.                                         FW_CAppleEvent& appleEvent,
  106.                                         FW_CAppleEvent& reply);
  107.  
  108.     virtual void                    CallObjectAccessor(Environment* ev,
  109.                                         ODDescType desiredClass,
  110.                                         ODOSLToken* container,
  111.                                         ODDescType containerClass,
  112.                                         ODDescType form,
  113.                                         FW_CDesc& selectionData,
  114.                                         ODOSLToken* value);
  115.                                                     
  116.     virtual void                    CallCompareProc(Environment* ev,
  117.                                         ODDescType oper,
  118.                                         ODOSLToken* obj1,
  119.                                         ODOSLToken* obj2,
  120.                                         ODBoolean* result);
  121.                                                     
  122.     virtual void                    CallCountProc(Environment* ev,
  123.                                         ODDescType desiredType,
  124.                                         ODDescType containerClass,
  125.                                         ODOSLToken* container,
  126.                                         ODSLong* result);    
  127.  
  128.     virtual void                    CallDisposeTokenProc(Environment* ev,
  129.                                         ODOSLToken* unneededToken);
  130.                                                         
  131.     virtual void                    CallGetErrDescProc(Environment* ev,
  132.                                         ODDesc** errDesc);
  133.                                                     
  134.     virtual void                    CallGetMarkTokenProc(Environment* ev,
  135.                                         ODOSLToken* dContainerToken,
  136.                                         ODDescType    containerClass,
  137.                                         ODOSLToken* result);
  138.                                                         
  139.     virtual void                    CallMarkProc(Environment* ev,
  140.                                         ODOSLToken* objectToMarkToken,
  141.                                         ODOSLToken* markingListToken,
  142.                                         ODSLong index);
  143.     
  144.     virtual void                    CallAdjustMarksProc(Environment* ev,
  145.                                                         ODSLong newStart,
  146.                                                         ODSLong newStop,
  147.                                                         ODOSLToken* markToken);
  148.         
  149.     ODSShort                        GetOSLSupportFlags(Environment* ev);
  150.  
  151.     void                            SetOSLSupportFlags(Environment* ev, ODSShort flags);
  152.                                                     
  153.     virtual void                    UsingPredispatchProc(Environment* ev, ODBoolean usingNotUsing);
  154.     
  155.     virtual FW_Boolean                TypeIsSemanticObject(Environment* ev, ODDescType type) const;
  156.     
  157.     ODDesc*                            GetDescFromToken(Environment* ev, ODOSLToken* token) const;
  158.     
  159.     virtual FW_MScriptable*            GetTargetObject(Environment* ev, FW_CAppleEvent& event);
  160.                                                                                         
  161.     virtual void                    Resolve(Environment *ev,
  162.                                             const FW_CDesc& objectSpec,
  163.                                             FW_CDesc& odfToken,
  164.                                             ODPart* contextPart = NULL) const;
  165.     
  166.     virtual FW_MScriptable*            GetScriptableFromToken(Environment* ev, const FW_CDesc& odfToken) const;
  167.                                                                 
  168.     inline void                     SetDefaultContainer(FW_MPartScriptable* defaultContainer)
  169.                                         { fDefaultContainer = defaultContainer; }
  170.  
  171.     inline FW_MPartScriptable*        GetDefaultContainer() const { return fDefaultContainer; }
  172.     
  173.     inline FW_CPart*                 GetPart() const { return fPart; }
  174.  
  175.     //--------------------------------------------------------------------------
  176.     // Private registration and creation
  177.  
  178.     static ODExtension*             PrivCreate(Environment* ev, FW_CPart* part, const char* name, void* refCon);
  179.  
  180. protected:
  181.     FW_MScriptable*                    CreateCollectionFromList(Environment* ev,
  182.                                                             FW_CPart* part,
  183.                                                             const FW_CDesc& objectList,
  184.                                                             ODDescType whichProperty = keyNoKey) const;
  185. private:    
  186.     static void                        PrivCoerceToSemanticObject(Environment* ev,
  187.                                                             const FW_CSemanticInterface* semInt,
  188.                                                             const FW_CDesc& theDesc,
  189.                                                             ODDescType toType,
  190.                                                             FW_CDesc& theResult);
  191. private:
  192.     FW_MPartScriptable*                fDefaultContainer;
  193.     FW_CPart*                        fPart;
  194.     ODNameResolver*                    fResolver;
  195.     
  196.     short                            fOSLFlags;
  197.     FW_Boolean                        fUsingPredispatchProc;
  198.     
  199.     FW_CPrivDescTypeToFunctionMap*    fCoercionFuncMap;
  200. };
  201.  
  202. //========================================================================================
  203. // Debugging Utilities
  204. //========================================================================================
  205.  
  206. void FW_DebugIdentifyPart(Environment* ev, FW_CFrame* frame, const FW_CColor& color);
  207.  
  208. #endif // FWSEMINT_H
  209.