home *** CD-ROM | disk | FTP | other *** search
/ PC World Plus! (NZ) 2001 June / HDC50.iso / Runimage / Delphi50 / Ocx / Servers / BINDER97.PAS < prev    next >
Pascal/Delphi Source File  |  1999-08-11  |  38KB  |  935 lines

  1. unit Binder97;
  2.  
  3. // ************************************************************************ //
  4. // WARNING                                                                    
  5. // -------                                                                    
  6. // The types declared in this file were generated from data read from a       
  7. // Type Library. If this type library is explicitly or indirectly (via        
  8. // another type library referring to this type library) re-imported, or the   
  9. // 'Refresh' command of the Type Library Editor activated while editing the   
  10. // Type Library, the contents of this file will be regenerated and all        
  11. // manual modifications will be lost.                                         
  12. // ************************************************************************ //
  13.  
  14. // PASTLWTR : $Revision:   1.5  $
  15. // File generated on 6/3/99 9:50:09 PM from Type Library described below.
  16.  
  17. // ************************************************************************ //
  18. // Type Lib: typelibraries\msbdr8.olb (1)
  19. // IID\LCID: {D0237635-6A9A-101B-B5A0-00AA004A2F7E}\409
  20. // Helpfile: D:\tp\typelib\typelibraries\vbabdr8.hlp
  21. // DepndLst: 
  22. //   (1) v2.0 stdole, (C:\WINNT\System32\STDOLE2.TLB)
  23. //   (2) v4.0 StdVCL, (C:\WINNT\System32\STDVCL40.DLL)
  24. // Errors:
  25. //   Hint: Member 'Object' of 'Section' changed to 'Object_'
  26. //   Hint: Member 'Type' of 'Section' changed to 'Type_'
  27. //   Hint: Parameter 'Type' of Sections.Add changed to 'Type_'
  28. //   Hint: Member 'Object' of 'Section' changed to 'Object_'
  29. //   Hint: Member 'Type' of 'Section' changed to 'Type_'
  30. // ************************************************************************ //
  31. interface
  32.  
  33. uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL;
  34.  
  35. // *********************************************************************//
  36. // GUIDS declared in the TypeLibrary. Following prefixes are used:        
  37. //   Type Libraries     : LIBID_xxxx                                      
  38. //   CoClasses          : CLASS_xxxx                                      
  39. //   DISPInterfaces     : DIID_xxxx                                       
  40. //   Non-DISP interfaces: IID_xxxx                                        
  41. // *********************************************************************//
  42. const
  43.   // TypeLibrary Major and minor versions
  44.   OfficeBinderMajorVersion = 8;
  45.   OfficeBinderMinorVersion = 0;
  46.  
  47.   LIBID_OfficeBinder: TGUID = '{D0237635-6A9A-101B-B5A0-00AA004A2F7E}';
  48.  
  49.   IID__Binder: TGUID = '{D02375D0-6A9A-101B-B5A0-00AA004A2F7E}';
  50.   IID_Section: TGUID = '{4E3B07C8-7F20-101B-B5BC-00AA004A2F7E}';
  51.   IID_Sections: TGUID = '{E842DBF0-849F-101B-B5CB-00AA004A2F7E}';
  52.   IID_PageSetup: TGUID = '{9F136940-E95C-11CE-9733-00AA00B8CD01}';
  53.   CLASS_Binder: TGUID = '{59850400-6664-101B-B21C-00AA004BA90B}';
  54.  
  55. // *********************************************************************//
  56. // Declaration of Enumerations defined in Type Library                    
  57. // *********************************************************************//
  58. // BindPrintWhat constants
  59. type
  60.   BindPrintWhat = TOleEnum;
  61. const
  62.   bindPrintActiveSection = $00000001;
  63.   bindPrintVisibleSections = $00000002;
  64.   bindPrintSelectedSections = $00000003;
  65.   bindPrintSectionSubset = $00000004;
  66.  
  67. // BindPageSetupPrintWhat constants
  68. type
  69.   BindPageSetupPrintWhat = TOleEnum;
  70. const
  71.   bindPageSetupVisibleSections = $00000002;
  72.   bindPageSetupSelectedSections = $00000003;
  73.  
  74. // BindPrintNumbering constants
  75. type
  76.   BindPrintNumbering = TOleEnum;
  77. const
  78.   bindConsecutivePages = $00000001;
  79.   bindRestartEachSection = $00000002;
  80.  
  81. // BindSaveOption constants
  82. type
  83.   BindSaveOption = TOleEnum;
  84. const
  85.   bindFailIfFileExists = $00000001;
  86.   bindOverwriteExisting = $00000002;
  87.   bindDisplayDialog = $00000003;
  88.  
  89. type
  90.  
  91. // *********************************************************************//
  92. // Forward declaration of types defined in TypeLibrary                    
  93. // *********************************************************************//
  94.   _Binder = interface;
  95.   _BinderDisp = dispinterface;
  96.   Section = interface;
  97.   SectionDisp = dispinterface;
  98.   Sections = interface;
  99.   SectionsDisp = dispinterface;
  100.   PageSetup = interface;
  101.   PageSetupDisp = dispinterface;
  102.  
  103. // *********************************************************************//
  104. // Declaration of CoClasses defined in Type Library                       
  105. // (NOTE: Here we map each CoClass to its Default Interface)              
  106. // *********************************************************************//
  107.   Binder = _Binder;
  108.  
  109.  
  110. // *********************************************************************//
  111. // Interface: _Binder
  112. // Flags:     (4416) Dual OleAutomation Dispatchable
  113. // GUID:      {D02375D0-6A9A-101B-B5A0-00AA004A2F7E}
  114. // *********************************************************************//
  115.   _Binder = interface(IDispatch)
  116.     ['{D02375D0-6A9A-101B-B5A0-00AA004A2F7E}']
  117.     function  Get_Name: WideString; safecall;
  118.     function  Get_Path: WideString; safecall;
  119.     function  Get_ActiveSection: Section; safecall;
  120.     function  Get_Sections: Sections; safecall;
  121.     procedure Open(const FileName: WideString; OpenAsTemplate: OleVariant); safecall;
  122.     procedure Save; safecall;
  123.     function  SaveAs(FileName: OleVariant; SaveOption: BindSaveOption): WordBool; safecall;
  124.     procedure PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; FirstPage: OleVariant; 
  125.                        Sections: OleVariant; FileName: OleVariant; PrinterName: OleVariant; 
  126.                        DriverName: OleVariant; NoPrinting: OleVariant); safecall;
  127.     function  Get_SelectedSectionNames: OleVariant; safecall;
  128.     procedure Set_SelectedSectionNames(pvarSASectionNames: OleVariant); safecall;
  129.     function  Get_Visible: WordBool; safecall;
  130.     procedure Set_Visible(pboolVisible: WordBool); safecall;
  131.     function  Get_LeftPane: WordBool; safecall;
  132.     procedure Set_LeftPane(pboolLeftPane: WordBool); safecall;
  133.     function  Get_BuiltinDocumentProperties: IDispatch; safecall;
  134.     function  Get_CustomDocumentProperties: IDispatch; safecall;
  135.     function  Get_PageSetup: PageSetup; safecall;
  136.     function  Get_DisplayStatusBar: WordBool; safecall;
  137.     procedure Set_DisplayStatusBar(pboolStatusBar: WordBool); safecall;
  138.     function  Get_DisplayAlerts: WordBool; safecall;
  139.     procedure Set_DisplayAlerts(pboolAlerts: WordBool); safecall;
  140.     function  Get_DisplayLeftPaneAndButton: WordBool; safecall;
  141.     procedure Set_DisplayLeftPaneAndButton(pboolLeftPane: WordBool); safecall;
  142.     function  Get_DefaultFilePath: WideString; safecall;
  143.     procedure Set_DefaultFilePath(const pbstrBinderPath: WideString); safecall;
  144.     function  Get_SinglePrintJob: WordBool; safecall;
  145.     procedure Set_SinglePrintJob(pboolSinglePrintJobState: WordBool); safecall;
  146.     procedure Close(SaveChanges: OleVariant; FileName: OleVariant); safecall;
  147.     procedure ViewOpenMode; safecall;
  148.     procedure ExitOpenMode; safecall;
  149.     property Name: WideString read Get_Name;
  150.     property Path: WideString read Get_Path;
  151.     property ActiveSection: Section read Get_ActiveSection;
  152.     property Sections: Sections read Get_Sections;
  153.     property SelectedSectionNames: OleVariant read Get_SelectedSectionNames write Set_SelectedSectionNames;
  154.     property Visible: WordBool read Get_Visible write Set_Visible;
  155.     property LeftPane: WordBool read Get_LeftPane write Set_LeftPane;
  156.     property BuiltinDocumentProperties: IDispatch read Get_BuiltinDocumentProperties;
  157.     property CustomDocumentProperties: IDispatch read Get_CustomDocumentProperties;
  158.     property PageSetup: PageSetup read Get_PageSetup;
  159.     property DisplayStatusBar: WordBool read Get_DisplayStatusBar write Set_DisplayStatusBar;
  160.     property DisplayAlerts: WordBool read Get_DisplayAlerts write Set_DisplayAlerts;
  161.     property DisplayLeftPaneAndButton: WordBool read Get_DisplayLeftPaneAndButton write Set_DisplayLeftPaneAndButton;
  162.     property DefaultFilePath: WideString read Get_DefaultFilePath write Set_DefaultFilePath;
  163.     property SinglePrintJob: WordBool read Get_SinglePrintJob write Set_SinglePrintJob;
  164.   end;
  165.  
  166. // *********************************************************************//
  167. // DispIntf:  _BinderDisp
  168. // Flags:     (4416) Dual OleAutomation Dispatchable
  169. // GUID:      {D02375D0-6A9A-101B-B5A0-00AA004A2F7E}
  170. // *********************************************************************//
  171.   _BinderDisp = dispinterface
  172.     ['{D02375D0-6A9A-101B-B5A0-00AA004A2F7E}']
  173.     property Name: WideString readonly dispid 0;
  174.     property Path: WideString readonly dispid 1610743809;
  175.     property ActiveSection: Section readonly dispid 1610743810;
  176.     property Sections: Sections readonly dispid 1610743811;
  177.     procedure Open(const FileName: WideString; OpenAsTemplate: OleVariant); dispid 1610743812;
  178.     procedure Save; dispid 1610743813;
  179.     function  SaveAs(FileName: OleVariant; SaveOption: BindSaveOption): WordBool; dispid 1610743814;
  180.     procedure PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; FirstPage: OleVariant; 
  181.                        Sections: OleVariant; FileName: OleVariant; PrinterName: OleVariant; 
  182.                        DriverName: OleVariant; NoPrinting: OleVariant); dispid 1610743815;
  183.     property SelectedSectionNames: OleVariant dispid 1610743816;
  184.     property Visible: WordBool dispid 1610743818;
  185.     property LeftPane: WordBool dispid 1610743820;
  186.     property BuiltinDocumentProperties: IDispatch readonly dispid 1610743822;
  187.     property CustomDocumentProperties: IDispatch readonly dispid 1610743823;
  188.     property PageSetup: PageSetup readonly dispid 1610743824;
  189.     property DisplayStatusBar: WordBool dispid 1610743825;
  190.     property DisplayAlerts: WordBool dispid 1610743827;
  191.     property DisplayLeftPaneAndButton: WordBool dispid 1610743829;
  192.     property DefaultFilePath: WideString dispid 1610743831;
  193.     property SinglePrintJob: WordBool dispid 1610743833;
  194.     procedure Close(SaveChanges: OleVariant; FileName: OleVariant); dispid 1610743835;
  195.     procedure ViewOpenMode; dispid 1610743836;
  196.     procedure ExitOpenMode; dispid 1610743837;
  197.   end;
  198.  
  199. // *********************************************************************//
  200. // Interface: Section
  201. // Flags:     (4416) Dual OleAutomation Dispatchable
  202. // GUID:      {4E3B07C8-7F20-101B-B5BC-00AA004A2F7E}
  203. // *********************************************************************//
  204.   Section = interface(IDispatch)
  205.     ['{4E3B07C8-7F20-101B-B5BC-00AA004A2F7E}']
  206.     procedure PrintOut; safecall;
  207.     function  Get_Parent: _Binder; safecall;
  208.     procedure Delete; safecall;
  209.     function  Get_Index: SYSINT; safecall;
  210.     function  Get_Visible: WordBool; safecall;
  211.     procedure Set_Visible(pboolVisible: WordBool); safecall;
  212.     function  Get_Name: WideString; safecall;
  213.     procedure Set_Name(const pbstrSectionName: WideString); safecall;
  214.     function  Get_Object_: IDispatch; safecall;
  215.     procedure Activate; safecall;
  216.     procedure Move(Before: OleVariant; After: OleVariant); safecall;
  217.     function  Copy(Before: OleVariant; After: OleVariant): Section; safecall;
  218.     procedure SaveAs(const FileName: WideString); safecall;
  219.     function  Get_Type_: WideString; safecall;
  220.     procedure Update; safecall;
  221.     function  Get_HasBinderHeaderFooter: WordBool; safecall;
  222.     procedure Set_HasBinderHeaderFooter(pboolHdrFtr: WordBool); safecall;
  223.     function  Get_SupportsBinderHeaderFooter: WordBool; safecall;
  224.     property Parent: _Binder read Get_Parent;
  225.     property Index: SYSINT read Get_Index;
  226.     property Visible: WordBool read Get_Visible write Set_Visible;
  227.     property Name: WideString read Get_Name write Set_Name;
  228.     property Object_: IDispatch read Get_Object_;
  229.     property Type_: WideString read Get_Type_;
  230.     property HasBinderHeaderFooter: WordBool read Get_HasBinderHeaderFooter write Set_HasBinderHeaderFooter;
  231.     property SupportsBinderHeaderFooter: WordBool read Get_SupportsBinderHeaderFooter;
  232.   end;
  233.  
  234. // *********************************************************************//
  235. // DispIntf:  SectionDisp
  236. // Flags:     (4416) Dual OleAutomation Dispatchable
  237. // GUID:      {4E3B07C8-7F20-101B-B5BC-00AA004A2F7E}
  238. // *********************************************************************//
  239.   SectionDisp = dispinterface
  240.     ['{4E3B07C8-7F20-101B-B5BC-00AA004A2F7E}']
  241.     procedure PrintOut; dispid 1610743808;
  242.     property Parent: _Binder readonly dispid 1610743809;
  243.     procedure Delete; dispid 1610743810;
  244.     property Index: SYSINT readonly dispid 1610743811;
  245.     property Visible: WordBool dispid 1610743812;
  246.     property Name: WideString dispid 0;
  247.     property Object_: IDispatch readonly dispid 1610743816;
  248.     procedure Activate; dispid 1610743817;
  249.     procedure Move(Before: OleVariant; After: OleVariant); dispid 1610743818;
  250.     function  Copy(Before: OleVariant; After: OleVariant): Section; dispid 1610743819;
  251.     procedure SaveAs(const FileName: WideString); dispid 1610743820;
  252.     property Type_: WideString readonly dispid 1610743821;
  253.     procedure Update; dispid 1610743822;
  254.     property HasBinderHeaderFooter: WordBool dispid 1610743823;
  255.     property SupportsBinderHeaderFooter: WordBool readonly dispid 1610743825;
  256.   end;
  257.  
  258. // *********************************************************************//
  259. // Interface: Sections
  260. // Flags:     (4416) Dual OleAutomation Dispatchable
  261. // GUID:      {E842DBF0-849F-101B-B5CB-00AA004A2F7E}
  262. // *********************************************************************//
  263.   Sections = interface(IDispatch)
  264.     ['{E842DBF0-849F-101B-B5CB-00AA004A2F7E}']
  265.     function  Get_Count: SYSINT; safecall;
  266.     function  Get_Parent: _Binder; safecall;
  267.     function  Get_Item(Index: OleVariant): Section; safecall;
  268.     function  Get__NewEnum: IUnknown; safecall;
  269.     function  Add(Type_: OleVariant; FileName: OleVariant; Before: OleVariant; After: OleVariant): Section; safecall;
  270.     property Count: SYSINT read Get_Count;
  271.     property Parent: _Binder read Get_Parent;
  272.     property Item[Index: OleVariant]: Section read Get_Item; default;
  273.     property _NewEnum: IUnknown read Get__NewEnum;
  274.   end;
  275.  
  276. // *********************************************************************//
  277. // DispIntf:  SectionsDisp
  278. // Flags:     (4416) Dual OleAutomation Dispatchable
  279. // GUID:      {E842DBF0-849F-101B-B5CB-00AA004A2F7E}
  280. // *********************************************************************//
  281.   SectionsDisp = dispinterface
  282.     ['{E842DBF0-849F-101B-B5CB-00AA004A2F7E}']
  283.     property Count: SYSINT readonly dispid 1610743808;
  284.     property Parent: _Binder readonly dispid 1610743809;
  285.     property Item[Index: OleVariant]: Section readonly dispid 0; default;
  286.     property _NewEnum: IUnknown readonly dispid -4;
  287.     function  Add(Type_: OleVariant; FileName: OleVariant; Before: OleVariant; After: OleVariant): Section; dispid 1610743812;
  288.   end;
  289.  
  290. // *********************************************************************//
  291. // Interface: PageSetup
  292. // Flags:     (4416) Dual OleAutomation Dispatchable
  293. // GUID:      {9F136940-E95C-11CE-9733-00AA00B8CD01}
  294. // *********************************************************************//
  295.   PageSetup = interface(IDispatch)
  296.     ['{9F136940-E95C-11CE-9733-00AA00B8CD01}']
  297.     function  Get_Parent: _Binder; safecall;
  298.     function  Get_PrintWhat: BindPageSetupPrintWhat; safecall;
  299.     procedure Set_PrintWhat(pWhat: BindPageSetupPrintWhat); safecall;
  300.     function  Get_Numbering: BindPrintNumbering; safecall;
  301.     procedure Set_Numbering(pNumbering: BindPrintNumbering); safecall;
  302.     function  Get_FirstPage: Integer; safecall;
  303.     procedure Set_FirstPage(pFirstPage: Integer); safecall;
  304.     function  Get_LeftHeader: WideString; safecall;
  305.     procedure Set_LeftHeader(const pbstrHdr: WideString); safecall;
  306.     function  Get_CenterHeader: WideString; safecall;
  307.     procedure Set_CenterHeader(const pbstrHdr: WideString); safecall;
  308.     function  Get_RightHeader: WideString; safecall;
  309.     procedure Set_RightHeader(const pbstrHdr: WideString); safecall;
  310.     function  Get_LeftFooter: WideString; safecall;
  311.     procedure Set_LeftFooter(const pbstrFtr: WideString); safecall;
  312.     function  Get_CenterFooter: WideString; safecall;
  313.     procedure Set_CenterFooter(const pbstrFtr: WideString); safecall;
  314.     function  Get_RightFooter: WideString; safecall;
  315.     procedure Set_RightFooter(const pbstrFtr: WideString); safecall;
  316.     property Parent: _Binder read Get_Parent;
  317.     property PrintWhat: BindPageSetupPrintWhat read Get_PrintWhat write Set_PrintWhat;
  318.     property Numbering: BindPrintNumbering read Get_Numbering write Set_Numbering;
  319.     property FirstPage: Integer read Get_FirstPage write Set_FirstPage;
  320.     property LeftHeader: WideString read Get_LeftHeader write Set_LeftHeader;
  321.     property CenterHeader: WideString read Get_CenterHeader write Set_CenterHeader;
  322.     property RightHeader: WideString read Get_RightHeader write Set_RightHeader;
  323.     property LeftFooter: WideString read Get_LeftFooter write Set_LeftFooter;
  324.     property CenterFooter: WideString read Get_CenterFooter write Set_CenterFooter;
  325.     property RightFooter: WideString read Get_RightFooter write Set_RightFooter;
  326.   end;
  327.  
  328. // *********************************************************************//
  329. // DispIntf:  PageSetupDisp
  330. // Flags:     (4416) Dual OleAutomation Dispatchable
  331. // GUID:      {9F136940-E95C-11CE-9733-00AA00B8CD01}
  332. // *********************************************************************//
  333.   PageSetupDisp = dispinterface
  334.     ['{9F136940-E95C-11CE-9733-00AA00B8CD01}']
  335.     property Parent: _Binder readonly dispid 1610743808;
  336.     property PrintWhat: BindPageSetupPrintWhat dispid 1610743809;
  337.     property Numbering: BindPrintNumbering dispid 1610743811;
  338.     property FirstPage: Integer dispid 1610743813;
  339.     property LeftHeader: WideString dispid 1610743815;
  340.     property CenterHeader: WideString dispid 1610743817;
  341.     property RightHeader: WideString dispid 1610743819;
  342.     property LeftFooter: WideString dispid 1610743821;
  343.     property CenterFooter: WideString dispid 1610743823;
  344.     property RightFooter: WideString dispid 1610743825;
  345.   end;
  346.  
  347. // *********************************************************************//
  348. // The Class CoBinder provides a Create and CreateRemote method to          
  349. // create instances of the default interface _Binder exposed by              
  350. // the CoClass Binder. The functions are intended to be used by             
  351. // clients wishing to automate the CoClass objects exposed by the         
  352. // server of this typelibrary.                                            
  353. // *********************************************************************//
  354.   CoBinder = class
  355.     class function Create: _Binder;
  356.     class function CreateRemote(const MachineName: string): _Binder;
  357.   end;
  358.  
  359.  
  360. // *********************************************************************//
  361. // OLE Server Proxy class declaration
  362. // Server Object    : TBinder
  363. // Help String      : 
  364. // Default Interface: _Binder
  365. // Def. Intf. DISP? : No
  366. // Event   Interface: 
  367. // TypeFlags        : (2) CanCreate
  368. // *********************************************************************//
  369. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  370.   TBinderProperties= class;
  371. {$ENDIF}
  372.   TBinder = class(TOleServer)
  373.   private
  374.     FIntf:        _Binder;
  375. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  376.     FProps:       TBinderProperties;
  377.     function      GetServerProperties: TBinderProperties;
  378. {$ENDIF}
  379.     function      GetDefaultInterface: _Binder;
  380.   protected
  381.     procedure InitServerData; override;
  382.     function  Get_Name: WideString;
  383.     function  Get_Path: WideString;
  384.     function  Get_ActiveSection: Section;
  385.     function  Get_Sections: Sections;
  386.     function  Get_SelectedSectionNames: OleVariant;
  387.     procedure Set_SelectedSectionNames(pvarSASectionNames: OleVariant);
  388.     function  Get_Visible: WordBool;
  389.     procedure Set_Visible(pboolVisible: WordBool);
  390.     function  Get_LeftPane: WordBool;
  391.     procedure Set_LeftPane(pboolLeftPane: WordBool);
  392.     function  Get_BuiltinDocumentProperties: IDispatch;
  393.     function  Get_CustomDocumentProperties: IDispatch;
  394.     function  Get_PageSetup: PageSetup;
  395.     function  Get_DisplayStatusBar: WordBool;
  396.     procedure Set_DisplayStatusBar(pboolStatusBar: WordBool);
  397.     function  Get_DisplayAlerts: WordBool;
  398.     procedure Set_DisplayAlerts(pboolAlerts: WordBool);
  399.     function  Get_DisplayLeftPaneAndButton: WordBool;
  400.     procedure Set_DisplayLeftPaneAndButton(pboolLeftPane: WordBool);
  401.     function  Get_DefaultFilePath: WideString;
  402.     procedure Set_DefaultFilePath(const pbstrBinderPath: WideString);
  403.     function  Get_SinglePrintJob: WordBool;
  404.     procedure Set_SinglePrintJob(pboolSinglePrintJobState: WordBool);
  405.   public
  406.     constructor Create(AOwner: TComponent); override;
  407.     destructor  Destroy; override;
  408.     procedure Connect; override;
  409.     procedure ConnectTo(svrIntf: _Binder);
  410.     procedure Disconnect; override;
  411.     procedure Open(const FileName: WideString); overload;
  412.     procedure Open(const FileName: WideString; OpenAsTemplate: OleVariant); overload;
  413.     procedure Save;
  414.     function  SaveAs(FileName: OleVariant; SaveOption: BindSaveOption): WordBool;
  415.     procedure PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering); overload;
  416.     procedure PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; FirstPage: OleVariant); overload;
  417.     procedure PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; FirstPage: OleVariant; 
  418.                        Sections: OleVariant); overload;
  419.     procedure PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; FirstPage: OleVariant; 
  420.                        Sections: OleVariant; FileName: OleVariant); overload;
  421.     procedure PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; FirstPage: OleVariant; 
  422.                        Sections: OleVariant; FileName: OleVariant; PrinterName: OleVariant); overload;
  423.     procedure PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; FirstPage: OleVariant; 
  424.                        Sections: OleVariant; FileName: OleVariant; PrinterName: OleVariant; 
  425.                        DriverName: OleVariant); overload;
  426.     procedure PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; FirstPage: OleVariant; 
  427.                        Sections: OleVariant; FileName: OleVariant; PrinterName: OleVariant; 
  428.                        DriverName: OleVariant; NoPrinting: OleVariant); overload;
  429.     procedure Close; overload;
  430.     procedure Close(SaveChanges: OleVariant); overload;
  431.     procedure Close(SaveChanges: OleVariant; FileName: OleVariant); overload;
  432.     procedure ViewOpenMode;
  433.     procedure ExitOpenMode;
  434.     property  DefaultInterface: _Binder read GetDefaultInterface;
  435.     property Name: WideString read Get_Name;
  436.     property Path: WideString read Get_Path;
  437.     property ActiveSection: Section read Get_ActiveSection;
  438.     property Sections: Sections read Get_Sections;
  439.     property SelectedSectionNames: OleVariant read Get_SelectedSectionNames write Set_SelectedSectionNames;
  440.     property BuiltinDocumentProperties: IDispatch read Get_BuiltinDocumentProperties;
  441.     property CustomDocumentProperties: IDispatch read Get_CustomDocumentProperties;
  442.     property PageSetup: PageSetup read Get_PageSetup;
  443.     property Visible: WordBool read Get_Visible write Set_Visible;
  444.     property LeftPane: WordBool read Get_LeftPane write Set_LeftPane;
  445.     property DisplayStatusBar: WordBool read Get_DisplayStatusBar write Set_DisplayStatusBar;
  446.     property DisplayAlerts: WordBool read Get_DisplayAlerts write Set_DisplayAlerts;
  447.     property DisplayLeftPaneAndButton: WordBool read Get_DisplayLeftPaneAndButton write Set_DisplayLeftPaneAndButton;
  448.     property DefaultFilePath: WideString read Get_DefaultFilePath write Set_DefaultFilePath;
  449.     property SinglePrintJob: WordBool read Get_SinglePrintJob write Set_SinglePrintJob;
  450.   published
  451. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  452.     property Server: TBinderProperties read GetServerProperties;
  453. {$ENDIF}
  454.   end;
  455.  
  456. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  457. // *********************************************************************//
  458. // OLE Server Properties Proxy Class
  459. // Server Object    : TBinder
  460. // (This object is used by the IDE's Property Inspector to allow editing
  461. //  of the properties of this server)
  462. // *********************************************************************//
  463.  TBinderProperties = class(TPersistent)
  464.   private
  465.     FServer:    TBinder;
  466.     function    GetDefaultInterface: _Binder;
  467.     constructor Create(AServer: TBinder);
  468.   protected
  469.     function  Get_Name: WideString;
  470.     function  Get_Path: WideString;
  471.     function  Get_ActiveSection: Section;
  472.     function  Get_Sections: Sections;
  473.     function  Get_SelectedSectionNames: OleVariant;
  474.     procedure Set_SelectedSectionNames(pvarSASectionNames: OleVariant);
  475.     function  Get_Visible: WordBool;
  476.     procedure Set_Visible(pboolVisible: WordBool);
  477.     function  Get_LeftPane: WordBool;
  478.     procedure Set_LeftPane(pboolLeftPane: WordBool);
  479.     function  Get_BuiltinDocumentProperties: IDispatch;
  480.     function  Get_CustomDocumentProperties: IDispatch;
  481.     function  Get_PageSetup: PageSetup;
  482.     function  Get_DisplayStatusBar: WordBool;
  483.     procedure Set_DisplayStatusBar(pboolStatusBar: WordBool);
  484.     function  Get_DisplayAlerts: WordBool;
  485.     procedure Set_DisplayAlerts(pboolAlerts: WordBool);
  486.     function  Get_DisplayLeftPaneAndButton: WordBool;
  487.     procedure Set_DisplayLeftPaneAndButton(pboolLeftPane: WordBool);
  488.     function  Get_DefaultFilePath: WideString;
  489.     procedure Set_DefaultFilePath(const pbstrBinderPath: WideString);
  490.     function  Get_SinglePrintJob: WordBool;
  491.     procedure Set_SinglePrintJob(pboolSinglePrintJobState: WordBool);
  492.   public
  493.     property DefaultInterface: _Binder read GetDefaultInterface;
  494.   published
  495.     property Visible: WordBool read Get_Visible write Set_Visible;
  496.     property LeftPane: WordBool read Get_LeftPane write Set_LeftPane;
  497.     property DisplayStatusBar: WordBool read Get_DisplayStatusBar write Set_DisplayStatusBar;
  498.     property DisplayAlerts: WordBool read Get_DisplayAlerts write Set_DisplayAlerts;
  499.     property DisplayLeftPaneAndButton: WordBool read Get_DisplayLeftPaneAndButton write Set_DisplayLeftPaneAndButton;
  500.     property DefaultFilePath: WideString read Get_DefaultFilePath write Set_DefaultFilePath;
  501.     property SinglePrintJob: WordBool read Get_SinglePrintJob write Set_SinglePrintJob;
  502.   end;
  503. {$ENDIF}
  504.  
  505.  
  506. procedure Register;
  507.  
  508. implementation
  509.  
  510. uses ComObj;
  511.  
  512. class function CoBinder.Create: _Binder;
  513. begin
  514.   Result := CreateComObject(CLASS_Binder) as _Binder;
  515. end;
  516.  
  517. class function CoBinder.CreateRemote(const MachineName: string): _Binder;
  518. begin
  519.   Result := CreateRemoteComObject(MachineName, CLASS_Binder) as _Binder;
  520. end;
  521.  
  522. procedure TBinder.InitServerData;
  523. const
  524.   CServerData: TServerData = (
  525.     ClassID:   '{59850400-6664-101B-B21C-00AA004BA90B}';
  526.     IntfIID:   '{D02375D0-6A9A-101B-B5A0-00AA004A2F7E}';
  527.     EventIID:  '';
  528.     LicenseKey: nil;
  529.     Version: 500);
  530. begin
  531.   ServerData := @CServerData;
  532. end;
  533.  
  534. procedure TBinder.Connect;
  535. var
  536.   punk: IUnknown;
  537. begin
  538.   if FIntf = nil then
  539.   begin
  540.     punk := GetServer;
  541.     Fintf:= punk as _Binder;
  542.   end;
  543. end;
  544.  
  545. procedure TBinder.ConnectTo(svrIntf: _Binder);
  546. begin
  547.   Disconnect;
  548.   FIntf := svrIntf;
  549. end;
  550.  
  551. procedure TBinder.DisConnect;
  552. begin
  553.   if Fintf <> nil then
  554.   begin
  555.     FIntf := nil;
  556.   end;
  557. end;
  558.  
  559. function TBinder.GetDefaultInterface: _Binder;
  560. begin
  561.   if FIntf = nil then
  562.     Connect;
  563.   Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
  564.   Result := FIntf;
  565. end;
  566.  
  567. constructor TBinder.Create(AOwner: TComponent);
  568. begin
  569.   inherited Create(AOwner);
  570. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  571.   FProps := TBinderProperties.Create(Self);
  572. {$ENDIF}
  573. end;
  574.  
  575. destructor TBinder.Destroy;
  576. begin
  577. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  578.   FProps.Free;
  579. {$ENDIF}
  580.   inherited Destroy;
  581. end;
  582.  
  583. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  584. function TBinder.GetServerProperties: TBinderProperties;
  585. begin
  586.   Result := FProps;
  587. end;
  588. {$ENDIF}
  589.  
  590. function  TBinder.Get_Name: WideString;
  591. begin
  592.   Result := DefaultInterface.Get_Name;
  593. end;
  594.  
  595. function  TBinder.Get_Path: WideString;
  596. begin
  597.   Result := DefaultInterface.Get_Path;
  598. end;
  599.  
  600. function  TBinder.Get_ActiveSection: Section;
  601. begin
  602.   Result := DefaultInterface.Get_ActiveSection;
  603. end;
  604.  
  605. function  TBinder.Get_Sections: Sections;
  606. begin
  607.   Result := DefaultInterface.Get_Sections;
  608. end;
  609.  
  610. function  TBinder.Get_SelectedSectionNames: OleVariant;
  611. begin
  612.   Result := DefaultInterface.Get_SelectedSectionNames;
  613. end;
  614.  
  615. procedure TBinder.Set_SelectedSectionNames(pvarSASectionNames: OleVariant);
  616. begin
  617.   DefaultInterface.Set_SelectedSectionNames(pvarSASectionNames);
  618. end;
  619.  
  620. function  TBinder.Get_Visible: WordBool;
  621. begin
  622.   Result := DefaultInterface.Get_Visible;
  623. end;
  624.  
  625. procedure TBinder.Set_Visible(pboolVisible: WordBool);
  626. begin
  627.   DefaultInterface.Set_Visible(pboolVisible);
  628. end;
  629.  
  630. function  TBinder.Get_LeftPane: WordBool;
  631. begin
  632.   Result := DefaultInterface.Get_LeftPane;
  633. end;
  634.  
  635. procedure TBinder.Set_LeftPane(pboolLeftPane: WordBool);
  636. begin
  637.   DefaultInterface.Set_LeftPane(pboolLeftPane);
  638. end;
  639.  
  640. function  TBinder.Get_BuiltinDocumentProperties: IDispatch;
  641. begin
  642.   Result := DefaultInterface.Get_BuiltinDocumentProperties;
  643. end;
  644.  
  645. function  TBinder.Get_CustomDocumentProperties: IDispatch;
  646. begin
  647.   Result := DefaultInterface.Get_CustomDocumentProperties;
  648. end;
  649.  
  650. function  TBinder.Get_PageSetup: PageSetup;
  651. begin
  652.   Result := DefaultInterface.Get_PageSetup;
  653. end;
  654.  
  655. function  TBinder.Get_DisplayStatusBar: WordBool;
  656. begin
  657.   Result := DefaultInterface.Get_DisplayStatusBar;
  658. end;
  659.  
  660. procedure TBinder.Set_DisplayStatusBar(pboolStatusBar: WordBool);
  661. begin
  662.   DefaultInterface.Set_DisplayStatusBar(pboolStatusBar);
  663. end;
  664.  
  665. function  TBinder.Get_DisplayAlerts: WordBool;
  666. begin
  667.   Result := DefaultInterface.Get_DisplayAlerts;
  668. end;
  669.  
  670. procedure TBinder.Set_DisplayAlerts(pboolAlerts: WordBool);
  671. begin
  672.   DefaultInterface.Set_DisplayAlerts(pboolAlerts);
  673. end;
  674.  
  675. function  TBinder.Get_DisplayLeftPaneAndButton: WordBool;
  676. begin
  677.   Result := DefaultInterface.Get_DisplayLeftPaneAndButton;
  678. end;
  679.  
  680. procedure TBinder.Set_DisplayLeftPaneAndButton(pboolLeftPane: WordBool);
  681. begin
  682.   DefaultInterface.Set_DisplayLeftPaneAndButton(pboolLeftPane);
  683. end;
  684.  
  685. function  TBinder.Get_DefaultFilePath: WideString;
  686. begin
  687.   Result := DefaultInterface.Get_DefaultFilePath;
  688. end;
  689.  
  690. procedure TBinder.Set_DefaultFilePath(const pbstrBinderPath: WideString);
  691. begin
  692.   DefaultInterface.Set_DefaultFilePath(pbstrBinderPath);
  693. end;
  694.  
  695. function  TBinder.Get_SinglePrintJob: WordBool;
  696. begin
  697.   Result := DefaultInterface.Get_SinglePrintJob;
  698. end;
  699.  
  700. procedure TBinder.Set_SinglePrintJob(pboolSinglePrintJobState: WordBool);
  701. begin
  702.   DefaultInterface.Set_SinglePrintJob(pboolSinglePrintJobState);
  703. end;
  704.  
  705. procedure TBinder.Open(const FileName: WideString);
  706. begin
  707.   DefaultInterface.Open(FileName, EmptyParam);
  708. end;
  709.  
  710. procedure TBinder.Open(const FileName: WideString; OpenAsTemplate: OleVariant);
  711. begin
  712.   DefaultInterface.Open(FileName, OpenAsTemplate);
  713. end;
  714.  
  715. procedure TBinder.Save;
  716. begin
  717.   DefaultInterface.Save;
  718. end;
  719.  
  720. function  TBinder.SaveAs(FileName: OleVariant; SaveOption: BindSaveOption): WordBool;
  721. begin
  722.   Result := DefaultInterface.SaveAs(FileName, SaveOption);
  723. end;
  724.  
  725. procedure TBinder.PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering);
  726. begin
  727.   DefaultInterface.PrintOut(What, Numbering, EmptyParam, EmptyParam, EmptyParam, EmptyParam, 
  728.                             EmptyParam, EmptyParam);
  729. end;
  730.  
  731. procedure TBinder.PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; FirstPage: OleVariant);
  732. begin
  733.   DefaultInterface.PrintOut(What, Numbering, FirstPage, EmptyParam, EmptyParam, EmptyParam, 
  734.                             EmptyParam, EmptyParam);
  735. end;
  736.  
  737. procedure TBinder.PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; 
  738.                            FirstPage: OleVariant; Sections: OleVariant);
  739. begin
  740.   DefaultInterface.PrintOut(What, Numbering, FirstPage, Sections, EmptyParam, EmptyParam, 
  741.                             EmptyParam, EmptyParam);
  742. end;
  743.  
  744. procedure TBinder.PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; 
  745.                            FirstPage: OleVariant; Sections: OleVariant; FileName: OleVariant);
  746. begin
  747.   DefaultInterface.PrintOut(What, Numbering, FirstPage, Sections, FileName, EmptyParam, EmptyParam, 
  748.                             EmptyParam);
  749. end;
  750.  
  751. procedure TBinder.PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; 
  752.                            FirstPage: OleVariant; Sections: OleVariant; FileName: OleVariant; 
  753.                            PrinterName: OleVariant);
  754. begin
  755.   DefaultInterface.PrintOut(What, Numbering, FirstPage, Sections, FileName, PrinterName, 
  756.                             EmptyParam, EmptyParam);
  757. end;
  758.  
  759. procedure TBinder.PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; 
  760.                            FirstPage: OleVariant; Sections: OleVariant; FileName: OleVariant; 
  761.                            PrinterName: OleVariant; DriverName: OleVariant);
  762. begin
  763.   DefaultInterface.PrintOut(What, Numbering, FirstPage, Sections, FileName, PrinterName, 
  764.                             DriverName, EmptyParam);
  765. end;
  766.  
  767. procedure TBinder.PrintOut(What: BindPrintWhat; Numbering: BindPrintNumbering; 
  768.                            FirstPage: OleVariant; Sections: OleVariant; FileName: OleVariant; 
  769.                            PrinterName: OleVariant; DriverName: OleVariant; NoPrinting: OleVariant);
  770. begin
  771.   DefaultInterface.PrintOut(What, Numbering, FirstPage, Sections, FileName, PrinterName, 
  772.                             DriverName, NoPrinting);
  773. end;
  774.  
  775. procedure TBinder.Close;
  776. begin
  777.   DefaultInterface.Close(EmptyParam, EmptyParam);
  778. end;
  779.  
  780. procedure TBinder.Close(SaveChanges: OleVariant);
  781. begin
  782.   DefaultInterface.Close(SaveChanges, EmptyParam);
  783. end;
  784.  
  785. procedure TBinder.Close(SaveChanges: OleVariant; FileName: OleVariant);
  786. begin
  787.   DefaultInterface.Close(SaveChanges, FileName);
  788. end;
  789.  
  790. procedure TBinder.ViewOpenMode;
  791. begin
  792.   DefaultInterface.ViewOpenMode;
  793. end;
  794.  
  795. procedure TBinder.ExitOpenMode;
  796. begin
  797.   DefaultInterface.ExitOpenMode;
  798. end;
  799.  
  800. {$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
  801. constructor TBinderProperties.Create(AServer: TBinder);
  802. begin
  803.   inherited Create;
  804.   FServer := AServer;
  805. end;
  806.  
  807. function TBinderProperties.GetDefaultInterface: _Binder;
  808. begin
  809.   Result := FServer.DefaultInterface;
  810. end;
  811.  
  812. function  TBinderProperties.Get_Name: WideString;
  813. begin
  814.   Result := DefaultInterface.Get_Name;
  815. end;
  816.  
  817. function  TBinderProperties.Get_Path: WideString;
  818. begin
  819.   Result := DefaultInterface.Get_Path;
  820. end;
  821.  
  822. function  TBinderProperties.Get_ActiveSection: Section;
  823. begin
  824.   Result := DefaultInterface.Get_ActiveSection;
  825. end;
  826.  
  827. function  TBinderProperties.Get_Sections: Sections;
  828. begin
  829.   Result := DefaultInterface.Get_Sections;
  830. end;
  831.  
  832. function  TBinderProperties.Get_SelectedSectionNames: OleVariant;
  833. begin
  834.   Result := DefaultInterface.Get_SelectedSectionNames;
  835. end;
  836.  
  837. procedure TBinderProperties.Set_SelectedSectionNames(pvarSASectionNames: OleVariant);
  838. begin
  839.   DefaultInterface.Set_SelectedSectionNames(pvarSASectionNames);
  840. end;
  841.  
  842. function  TBinderProperties.Get_Visible: WordBool;
  843. begin
  844.   Result := DefaultInterface.Get_Visible;
  845. end;
  846.  
  847. procedure TBinderProperties.Set_Visible(pboolVisible: WordBool);
  848. begin
  849.   DefaultInterface.Set_Visible(pboolVisible);
  850. end;
  851.  
  852. function  TBinderProperties.Get_LeftPane: WordBool;
  853. begin
  854.   Result := DefaultInterface.Get_LeftPane;
  855. end;
  856.  
  857. procedure TBinderProperties.Set_LeftPane(pboolLeftPane: WordBool);
  858. begin
  859.   DefaultInterface.Set_LeftPane(pboolLeftPane);
  860. end;
  861.  
  862. function  TBinderProperties.Get_BuiltinDocumentProperties: IDispatch;
  863. begin
  864.   Result := DefaultInterface.Get_BuiltinDocumentProperties;
  865. end;
  866.  
  867. function  TBinderProperties.Get_CustomDocumentProperties: IDispatch;
  868. begin
  869.   Result := DefaultInterface.Get_CustomDocumentProperties;
  870. end;
  871.  
  872. function  TBinderProperties.Get_PageSetup: PageSetup;
  873. begin
  874.   Result := DefaultInterface.Get_PageSetup;
  875. end;
  876.  
  877. function  TBinderProperties.Get_DisplayStatusBar: WordBool;
  878. begin
  879.   Result := DefaultInterface.Get_DisplayStatusBar;
  880. end;
  881.  
  882. procedure TBinderProperties.Set_DisplayStatusBar(pboolStatusBar: WordBool);
  883. begin
  884.   DefaultInterface.Set_DisplayStatusBar(pboolStatusBar);
  885. end;
  886.  
  887. function  TBinderProperties.Get_DisplayAlerts: WordBool;
  888. begin
  889.   Result := DefaultInterface.Get_DisplayAlerts;
  890. end;
  891.  
  892. procedure TBinderProperties.Set_DisplayAlerts(pboolAlerts: WordBool);
  893. begin
  894.   DefaultInterface.Set_DisplayAlerts(pboolAlerts);
  895. end;
  896.  
  897. function  TBinderProperties.Get_DisplayLeftPaneAndButton: WordBool;
  898. begin
  899.   Result := DefaultInterface.Get_DisplayLeftPaneAndButton;
  900. end;
  901.  
  902. procedure TBinderProperties.Set_DisplayLeftPaneAndButton(pboolLeftPane: WordBool);
  903. begin
  904.   DefaultInterface.Set_DisplayLeftPaneAndButton(pboolLeftPane);
  905. end;
  906.  
  907. function  TBinderProperties.Get_DefaultFilePath: WideString;
  908. begin
  909.   Result := DefaultInterface.Get_DefaultFilePath;
  910. end;
  911.  
  912. procedure TBinderProperties.Set_DefaultFilePath(const pbstrBinderPath: WideString);
  913. begin
  914.   DefaultInterface.Set_DefaultFilePath(pbstrBinderPath);
  915. end;
  916.  
  917. function  TBinderProperties.Get_SinglePrintJob: WordBool;
  918. begin
  919.   Result := DefaultInterface.Get_SinglePrintJob;
  920. end;
  921.  
  922. procedure TBinderProperties.Set_SinglePrintJob(pboolSinglePrintJobState: WordBool);
  923. begin
  924.   DefaultInterface.Set_SinglePrintJob(pboolSinglePrintJobState);
  925. end;
  926.  
  927. {$ENDIF}
  928.  
  929. procedure Register;
  930. begin
  931.   RegisterComponents('Servers',[TBinder]);
  932. end;
  933.  
  934. end.
  935.