home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warphead.zip / H / BINDNGH.H < prev    next >
C/C++ Source or Header  |  1997-02-28  |  12KB  |  304 lines

  1. /* @(#)Z 1.7 com/src/binding/BindngH.h, odconfig, od96os2, odos29646d 96/11/15 15:29:15 (96/10/29 09:15:07) */
  2. /*====START_GENERATED_PROLOG======================================
  3.  */
  4. /*
  5.  *   COMPONENT_NAME: odconfig
  6.  *
  7.  *   CLASSES:   Binding
  8.  *
  9.  *   ORIGINS: 82,27
  10.  *
  11.  *
  12.  *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13.  *   All Rights Reserved
  14.  *   Licensed Materials - Property of IBM
  15.  *   US Government Users Restricted Rights - Use, duplication or
  16.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17.  *
  18.  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19.  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20.  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21.  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22.  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23.  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24.  *   OR PERFORMANCE OF THIS SOFTWARE.
  25.  */
  26. /*====END_GENERATED_PROLOG========================================
  27.  */
  28.  
  29. /********************************************************************/
  30. /*  Licensed Materials - Property of IBM                            */
  31. /*                                                                  */
  32. /*                                                                  */
  33. /* Copyright (C) International Business Machines Corp., 1994.       */
  34. /* Copyright (C) Apple Computer, Inc., 1994                         */
  35. /*                                                                  */
  36. /*  US Government Users Restricted Rights -                         */
  37. /*  Use, duplication, or disclosure restricted                      */
  38. /*  by GSA ADP Schedule Contract with IBM Corp.                     */
  39. /*                                                                  */
  40. /*  IBM Change History (most recent first):                         */
  41. /*  142527 11/01/95 jso Added fields to track partreg.bto           */
  42. /*  140177 10/13/95 ced make extern C function EXPENTRY             */
  43. /*  <OS2>  08/22/95 aml 133968 Port DR3                             */
  44. /*                                                                  */
  45. /********************************************************************/
  46. /*
  47.   File:    BindngH.h
  48.  
  49.   Contains:  Class definition for Binding helper object
  50.  
  51.   Owned by:  Caia Grisar
  52.  
  53.   Copyright:  ⌐ 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  54.  
  55.   Change History (most recent first):
  56.  
  57.      <4>   6/16/95  CC    1259719: Added ChangeEditor and
  58.                   ChangeKindAndEditor.
  59.      <3>   5/18/95  CG    #1249263 BB: BndNSUtl.cpp does not compile
  60.                   standalone.
  61.      <2>   4/27/95  CC    1243813: Removed ShowAlert and
  62.                   BindingDialogFilter; replaced by ShowAlert
  63.                   in DlogUtil.
  64.      <1>   4/13/95  CG    first checked in
  65.      <8>  12/13/94  CG    #1193522: Added Binding Alert.
  66.      <7>   8/24/94  CG    #1181622: Updated ownership info.
  67.      <6>   8/17/94  CG    #1181440: ViewNameSpace now return
  68.                   ODObjectNameSpace.  Made methods
  69.                   nonvirtual.
  70.      <5>   7/29/94  CG    NameSpace API changes.
  71.      <4>   7/26/94  jpa    Don't inherit from ODObject.
  72.      <3>   6/27/94  CG    Moved IsEditorLoaded here from Prefs,
  73.                   Removed fEv
  74.      <2>   6/23/94  eeh    remove EditorSet and ODEditorSetIterator
  75.      <1>   6/15/94  CG    first checked in
  76.      <1>    6/1/94  CG    first checked in
  77.     <14>   5/27/94  CG    #1165186: Abstracted out preferences from
  78.                   Binding object.
  79.     <13>   4/13/94  Té    #1147222: Fix the View As popup in the Part
  80.                   Frame Info dialog.  Also fix the Category
  81.                   text, and the Kind & Editor popups to show
  82.                   the current kind & editor respectively.
  83.                   Made one method public for PtFrInfo.cpp to
  84.                   use.
  85.     <12>    4/4/94  CC    GetKindsSupported() and
  86.                   GetCategoriesOfKind() return ODTypeList
  87.                   (1153046).
  88.     <11>   3/26/94  NP    1152831. Move private functions here.
  89.     <10>   3/23/94  CG    Added VerifyPrefFileVersion() and
  90.                   UpdatePrefFileVersion() private methods.
  91.      <9>   3/15/94  MB    Changes to support SCpp/ASLM builds,
  92.                   #1150864.
  93.      <8>   3/14/94  CC    Added GetCurrentEditorForPart() (#1150376);
  94.                   Made EditorSupportsKind() and
  95.                   GetKindsSupported() public for
  96.                   LinkDlgs.cpp.
  97.      <7>   3/11/94  CG    Bug # 1150204 - NMAPs are now loaded
  98.                   whenever mod date of registered library
  99.                   folder changes.
  100.      <6>   2/17/94  eeh    bug #1143340: made various private methods
  101.                   public (to call from EdPrfInf.cpp)
  102.      <5>    2/3/94  CG    Added fHeap field.
  103.      <4>   1/12/94  CG    Removed ODCategorySet.
  104.      <3>  12/16/93  Té    moved typedef of ODEditor to PlfmType.h
  105.      <2>  12/10/93  CG    Added ASLM class id definition for the
  106.                   ODBinding object.
  107.      <1>   11/7/93  Té    first checked in
  108.   To Do:
  109. */
  110.  
  111. #ifndef _BINDNGH_
  112. #define _BINDNGH_
  113.  
  114. #ifdef _PLATFORM_AIX_
  115. #define EXPENTRY
  116. #endif
  117.  
  118. #ifndef _PLFMDEF_
  119. #include "PlfmDef.h"
  120. #endif
  121.  
  122. #ifndef _ODOBJ_
  123. #include "ODObject.xh"
  124. #endif
  125.  
  126. #ifndef _ODTYPES_
  127. #include "ODTypes.h"
  128. #endif
  129.  
  130.  
  131. //=====================================================================================
  132. // Theory of Operation
  133. //=====================================================================================
  134.  
  135. /*
  136.   This file describes the ODBinding class.
  137.   ODBinding is a system service that is used to bind part data to part editors.
  138.   ODBinding also includes a number of utility functions, including mapping content
  139.   kinds to categories, providing a list of part editors supporting a given kind, and
  140.   routines to access and set system-wide editor preferences.
  141. */
  142.  
  143.  
  144. //=====================================================================================
  145. // Classes defined in this interface
  146. //=====================================================================================
  147. class Binding;
  148.  
  149. //=====================================================================================
  150. // Classes used by this interface
  151. //=====================================================================================
  152. class EditorSet;
  153. class ODDraft;
  154. class ODFile;
  155. class ODNameSpaceManager;
  156. class ODObjectNameSpace;
  157. class ODSession;
  158. class ODStorageUnit;
  159. class ODTypeList;
  160. class OrderedCollection;
  161. class OrderedCollectionIterator;
  162. class ODPartHandlerRegistryInt;
  163. class RegistryManager;
  164. class ODPart;
  165.  
  166. //==============================================================================
  167. // function prototypes
  168. //==============================================================================
  169.  
  170. #ifdef __cplusplus
  171. extern "C" {
  172. #endif
  173.  
  174.  
  175. ODBoolean EXPENTRY  IsNoPart(Environment* ev, ODPart* rootPart);
  176. ODEditor  EXPENTRY  GetCurrentEditorForPart(ODPart* part );
  177. void    EXPENTRY ChangeKindAndEditor (Environment *ev,
  178.                                       ODPart* part,
  179.                                       ODType newKind,
  180.                                       ODEditor newEditor,
  181.                                       ODNameSpaceManager* nsm);
  182.  
  183.  
  184. #ifdef __cplusplus
  185. }
  186. #endif
  187.  
  188. //=====================================================================================
  189. // Class Binding
  190. //=====================================================================================
  191.  
  192. class Binding
  193. {
  194. public:
  195.  
  196.   Binding();
  197.  
  198.     // ODSession creates one instance of Binding
  199.     // which is then shared among clients within the process.
  200.  
  201.   ODVMethod ~Binding();
  202.  
  203.   ODNVMethod void InitBinding(ODSession* session);
  204.  
  205.   ODNVMethod ODSize Purge(ODSize size);
  206.  
  207.   //---------------------------------
  208.   // Direct editor bindings
  209.  
  210.     // Returns the "best" available editor for the part
  211.     // may invoke automatic translation
  212.   ODNVMethod ODEditor ChooseEditorForPart
  213.                 (ODStorageUnit* thePartSU, ODType newKind );
  214.  
  215.     // Returns the "best" available editor for a non-opendoc  part
  216.     // i.e. bitmap, metafile, etc
  217.   ODNVMethod ODEditor ChooseEditorForOSType
  218.                 (ODStorageUnit* thePartSU );
  219.  
  220.     // Returns the "best" available editor for a non-opendoc  part
  221.     // based od file extension
  222.   ODNVMethod ODEditor ChooseEditorForOSfilenameFilter
  223.                 (ODStorageUnit* thePartSU );
  224.  
  225.     // attempt to intelligently translate one of the kinds in the part into
  226.     // a kind which an available editor supports, and return that editor
  227.   ODNVMethod ODEditor TranslateAndChooseEditorForPart
  228.                 (ODStorageUnit* thePartSU);
  229.  
  230.   //---------------------------------
  231.   // Editor related utility methods
  232.  
  233.     // Returns the set of data types supported (without translation) by the
  234.     // argument editor.
  235.   ODNVMethod ODTypeList* GetKindsSupported(ODEditor editor);
  236.  
  237.   ODNVMethod ODContainerSuite GetContainerSuite(ODContainerType containerType);
  238.  
  239.     // Returns true if the argument editor is present on this machine.
  240.   ODNVMethod ODBoolean EditorExists(ODEditor editor);
  241.  
  242.   ODNVMethod ODBoolean  IsEditorLoaded(ODEditor editor);
  243.  
  244.  
  245. private:
  246.  
  247.     // Returns the "best" available editor for the part
  248.     // without translation.
  249.   ODNVMethod ODEditor ChooseDirectEditorForPart
  250.                 (ODStorageUnit* thePartSU, ODType newKind );
  251.  
  252.     // Returns the "best" available editor which supports kind aKind of the part
  253.     // without translation.
  254.   ODNVMethod ODEditor ChooseDirectEditorForKind
  255.                 (ODType aKind, ODStorageUnit* thePartSU);
  256.  
  257.   //---------------------------------
  258.   // Editor related utility methods
  259.  
  260.     // Returns the editor that last externalized the argument storage unit.
  261.     // Null is returned if that editor is not present on the current machine.
  262.     // noPrefEditor is set to true if no kODPropPreferredEditor property
  263.     // exists in the SU
  264.   ODNVMethod ODEditor GetPreferredEditorForPart
  265.                 (ODStorageUnit* thePartSU, ODBoolean* noPrefEditor);
  266.  
  267.     // Returns the (alphanum preferred editor over viewer) from
  268.     // the set of Editors
  269.   ODNVMethod ODEditor AlphaNumChooseEditor(EditorSet* editorSet);
  270.  
  271.     // Returns the (alphanum preferred editor over viewer) of the two editors
  272.   ODNVMethod ODEditor AlphaNumChooseAnEditorFromTwo(ODEditor e1, ODEditor e2);
  273.  
  274.     // Returns true if the argument draft restricts the editors that may be
  275.     // used in this document.
  276.   ODNVMethod ODBoolean DraftRestrictsEditors(ODDraft* draft);
  277.  
  278.     // returns subset of restricted editors of draft which support kind.
  279.   ODNVMethod EditorSet* GetAllRestrictedEditorsForKind
  280.                 (ODDraft* draft, ODType kind);
  281.  
  282.   //---------------------------------
  283.   // Category and kind mappings
  284.  
  285.   ODNVMethod ODObjectNameSpace*    ViewerNameSpace();
  286.  
  287.   //---------------------------------
  288.   // Alert Utilities
  289.   ODNVMethod void BindingWarning();
  290.  
  291.  // Fields:
  292.   enum  { MAX_FILE_SIZE = 256};
  293.   ODSession*                    fSession;
  294.   RegistryManager*              fRManager;
  295.   ODPartHandlerRegistryInt*     fODRegistry;
  296.   long                          lastPrefUpdate;
  297.   long                          lastRegUpdate;
  298.   char                          completeRegFileName[MAX_FILE_SIZE];
  299.   Environment*                  fev;
  300.  
  301. };
  302.  
  303. #endif // _BINDNGH_
  304.