unit Document;

interface

uses
  SysUtils;

type
  EDocumentError = class(Exception);
  TDocument = class(TObject)
  private
    FFileName: string;
    FDisplayName: string;
    FSaved: Boolean;
    FChanged: Boolean;
    procedure SetFileName(AFileName: string);
  public
    property FileName: string read FFileName write SetFileName;
    property DisplayName: string read FDisplayName;
    property Saved: Boolean read FSaved write FSaved;
    property Changed: Boolean read FChanged write FChanged;
    procedure New; virtual; abstract;
    procedure Save; virtual; abstract;
    procedure Load; virtual; abstract;
    procedure Print; virtual; abstract;
  end;

implementation

procedure TDocument.SetFileName(AFileName: string);
begin
  FFileName := AFileName;
  FDisplayName := ExtractFileName(Copy(AFileName, 1, Length(AFileName) - Length(ExtractFileExt(AFileName))));
end;

end.
