unit outextract;
interface
uses
windows,SysUtils, Classes, Controls,comobj,variants;
type
outlookversion = (ovOutlook,ovOutlookExpress);
Toutextract =
class;
tcontactitem =
class
private
Fname :
string;
Foutextract : Toutextract;
function GetCount: Integer;
public
constructor Create(outextract : Toutextract);
property name :
string read Fname
write Fname;
property Count : Integer
read GetCount;
// damit geht contacts[x].Count
end;
Toutextract =
class(TComponent)
private
FList : TList;
FOutlookVersion: outlookversion;
function GetCount: Integer;
function GetItem(
Index: Integer): TContactItem;
procedure SetOutlookVersion(
const Value: outlookversion);
public
constructor create(AOwner: TComponent);
override;
destructor destroy;
override;
function Add(
const aName :
String) : tcontactitem;
procedure Clear;
property contacts[
Index : Integer]: TContactItem
read GetItem;
default;
property Count : Integer
read GetCount;
published
property OutlookVersion:outlookversion
read FOutlookVersion
write SetOutlookVersion;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
SEPT-Solutions', [Toutextract]);
end;
{ Toutextract }
function Toutextract.Add(
const aName:
String): tcontactitem;
begin
Result:=tcontactitem.Create(Self);
Result.
name:=aName;
FList.Add(Result);
end;
procedure Toutextract.Clear;
var
iCnt : Integer;
begin
For iCnt:=0
to FList.Count-1
do
TObject(FList[iCnt]).Free;
FList.Clear;
end;
constructor Toutextract.create(AOwner: TComponent);
begin
inherited Create(AOwner);
FList:=TList.Create;
end;
destructor Toutextract.destroy;
begin
FList.Free;
inherited Destroy;
end;
function Toutextract.GetCount: Integer;
begin
Result:=FList.Count;
end;
function Toutextract.GetItem(
Index: Integer): TContactItem;
begin
Result:=TContactItem(FList[
Index]);
end;
procedure Toutextract.SetOutlookVersion(
const Value: outlookversion);
begin
FOutlookVersion:=Value;
end;
{ tcontactitem }
{ tcontactitem }
constructor tcontactitem.Create(outextract: Toutextract);
begin
inherited Create;
Foutextract:=outextract;
end;
function tcontactitem.GetCount: Integer;
begin
If Assigned(Foutextract)
then
Result:=Foutextract.Count
else
Result:=-1;
// Zeigt dass das TMyListItem in keiner Liste hängt
end;
end.