home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 January / Chip_2003-01_cd1.bin / zkuste / delphi / kolekce / d567 / FLEXCEL.ZIP / Design / UFlexCelTemplateEditor.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2002-09-26  |  1.8 KB  |  72 lines

  1. unit UFlexCelTemplateEditor;
  2.  
  3. interface
  4.  
  5. uses
  6.   {$IFDEF LINUX}
  7.     SysUtils, Classes, QGraphics, QControls, QForms, QDialogs,
  8.   {$ENDIF}
  9.   {$IFDEF WIN32}
  10.     Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  11.   {$ENDIF}
  12.   {$IFDEF ConditionalExpressions}{$if CompilerVersion >= 14}  //Delphi 6 or above
  13.     DesignIntf, DesignEditors,
  14.   {$IFEND}
  15.   {$ELSE}
  16.     DsgnIntf,
  17.   {$ENDIF}
  18.     TemplateStore, UFlxMessages, UFlxDesignHelp, UTemplateEdit;
  19. type
  20.   TFlexCelTemplateEditor = class(TComponentEditor)
  21.   private
  22.     { Private declarations }
  23.   protected
  24.     { Protected declarations }
  25.   public
  26.     { Public declarations }
  27.     function GetVerb(Index: Integer): String; override;
  28.     function GetVerbCount: Integer; override;
  29.     procedure ExecuteVerb(Index: Integer); override;
  30.   published
  31.     { Published declarations }
  32.   end;
  33.  
  34. procedure Register;
  35.  
  36. implementation
  37. function TFlexCelTemplateEditor.GetVerbCount: Integer;
  38. begin
  39.   Result := 3;
  40. end;
  41.  
  42. function TFlexCelTemplateEditor.GetVerb(Index: Integer): String;
  43.  
  44. begin
  45.   case Index of
  46.     0: Result := 'Edit Template Store...';
  47.     1: Result := 'Refresh...';
  48.     2: Result := 'About...';
  49.   end;
  50. end;
  51.  
  52. procedure TFlexCelTemplateEditor.ExecuteVerb(Index: Integer);
  53. var
  54.   IsModified: boolean;
  55. begin
  56.   IsModified:=false;
  57.   chdir(ExtractFilePath(GetActiveProjectFileName));
  58.   case Index of
  59.     0: InvokeTemplateEditor(Component as TXLSTemplateStore, IsModified);
  60.     1: begin;RefreshTemplateStore(Component as TXLSTemplateStore, IsModified);showmessage(TxtTemplateStoreRefreshed);end;
  61.     2: ShowMessage(Format(MsgAbout,[FlexCelVersion]));
  62.   end;  //case
  63.   if IsModified then Designer.Modified;
  64. end;
  65.  
  66. procedure Register;
  67. begin
  68.   RegisterComponentEditor(TXLSTemplateStore, TFlexCelTemplateEditor);
  69. end;
  70.  
  71. end.
  72.