-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathadd_topic_from_hhc.pas
More file actions
58 lines (56 loc) · 1.67 KB
/
add_topic_from_hhc.pas
File metadata and controls
58 lines (56 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
type
TThema = class(TObject)
Caption: String;
TopicLevel: Integer;
TopicID: String;
end;
var
ThemenListe: TStringList;
Thema: TThema;
i: Integer;
ParentIDs: array[0..10] of String;
begin
ThemenListe := TStringList.Create;
try
// Thema 1: Lizenz - Bitte lesen !!!
Thema := TThema.Create;
Thema.Caption := 'Lizenz - Bitte lesen !!!';
Thema.TopicLevel := 0;
ThemenListe.AddObject('Thema0', Thema);
// Thema 2: Überblich
Thema := TThema.Create;
Thema.Caption := 'Überblich';
Thema.TopicLevel := 1;
ThemenListe.AddObject('Thema1', Thema);
// Thema 3: Inhalt
Thema := TThema.Create;
Thema.Caption := 'Inhalt';
Thema.TopicLevel := 0;
ThemenListe.AddObject('Thema2', Thema);
// Thema 4: Liste der Tabellen
Thema := TThema.Create;
Thema.Caption := 'Liste der Tabellen';
Thema.TopicLevel := 1;
ThemenListe.AddObject('Thema3', Thema);
// Thema 5: Über dieses Handbuch
Thema := TThema.Create;
Thema.Caption := 'Über dieses Handbuch';
Thema.TopicLevel := 1;
ThemenListe.AddObject('Thema4', Thema);
// Jetzt alle Themen mit richtiger Hierarchie erzeugen
for i := 0 to ThemenListe.Count - 1 do
begin
Thema := TThema(ThemenListe.Objects[i]);
if Thema.TopicLevel = 0 then
Thema.TopicID := HndTopics.CreateTopic('')
else
Thema.TopicID := HndTopics.CreateTopic(ParentIDs[Thema.TopicLevel - 1]);
HndTopics.SetTopicCaption(Thema.TopicID, Thema.Caption);
ParentIDs[Thema.TopicLevel] := Thema.TopicID;
end;
finally
for i := 0 to ThemenListe.Count - 1 do
TThema(ThemenListe.Objects[i]).Free;
ThemenListe.Free;
end;
end.