148 lines
3.6 KiB
Plaintext
148 lines
3.6 KiB
Plaintext
type Body = class(OpenXmlElement)
|
|
public
|
|
function Create();overload;
|
|
function Create(_node: XmlNode);overload;
|
|
function Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
|
|
function Init();override;
|
|
function Copy(_obj: Body);override;
|
|
|
|
public
|
|
|
|
// normal property
|
|
property SectPr read ReadXmlChildSectPr;
|
|
function ReadXmlChildSectPr();
|
|
|
|
// multi property
|
|
property Ps read ReadPs;
|
|
property Tbls read ReadTbls;
|
|
property Sdts read ReadSdts;
|
|
function ReadPs(_index);
|
|
function ReadTbls(_index);
|
|
function ReadSdts(_index);
|
|
function AddP(): P;
|
|
function AddTbl(): Tbl;
|
|
function AddSdt(): Sdt;
|
|
function AppendP(): P;
|
|
function AppendTbl(): Tbl;
|
|
function AppendSdt(): Sdt;
|
|
|
|
public
|
|
// Children
|
|
XmlChildSectPr: SectPr;
|
|
|
|
end;
|
|
|
|
function Body.Create();overload;
|
|
begin
|
|
{self.}Create(nil, "w", "body");
|
|
end;
|
|
|
|
function Body.Create(_node: XmlNode);overload;
|
|
begin
|
|
class(OpenXmlElement).Create(_node: XmlNode);
|
|
end;
|
|
|
|
function Body.Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
|
|
begin
|
|
setsysparam(pn_calcctrlword(), getsysparam(pn_calcctrlword()) .| 0x200);
|
|
class(OpenXmlElement).Create(_parent, _prefix, _local_name);
|
|
end;
|
|
|
|
function Body.Init();override;
|
|
begin
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
attributes_ := array();
|
|
attributes_pf_ := array(
|
|
);
|
|
sorted_child_ := array(
|
|
pre + "p": array(0, makeweakref(thisFunction(AppendP))),
|
|
pre + "tbl": array(1, makeweakref(thisFunction(AppendTbl))),
|
|
pre + "sdt": array(2, makeweakref(thisFunction(AppendSdt))),
|
|
pre + "sectPr": array(-1, makeweakref(thisFunction(ReadXmlChildSectPr))),
|
|
);
|
|
container_ := new TSOfficeContainer(sorted_child_);
|
|
end;
|
|
|
|
function Body.Copy(_obj: Body);override;
|
|
begin
|
|
tslassigning_backup := tslassigning;
|
|
tslassigning := 1;
|
|
class(OpenXmlElement).Copy(_obj);
|
|
if not ifnil(_obj.XmlChildSectPr) then
|
|
{self.}SectPr.Copy(_obj.XmlChildSectPr);
|
|
tslassigning := tslassigning_backup;
|
|
end;
|
|
|
|
function Body.ReadXmlChildSectPr();
|
|
begin
|
|
if tslassigning and ifnil({self.}XmlChildSectPr) then
|
|
begin
|
|
{self.}XmlChildSectPr := new SectPr(self, {self.}Prefix, "sectPr");
|
|
container_.Append({self.}XmlChildSectPr);
|
|
end
|
|
return {self.}XmlChildSectPr;
|
|
end;
|
|
|
|
function Body.ReadPs(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "p", ind);
|
|
end;
|
|
|
|
function Body.ReadTbls(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "tbl", ind);
|
|
end;
|
|
|
|
function Body.ReadSdts(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "sdt", ind);
|
|
end;
|
|
|
|
function Body.AddP(): P;
|
|
begin
|
|
obj := new P(self, {self.}Prefix, "p");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function Body.AddTbl(): Tbl;
|
|
begin
|
|
obj := new Tbl(self, {self.}Prefix, "tbl");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function Body.AddSdt(): Sdt;
|
|
begin
|
|
obj := new Sdt(self, {self.}Prefix, "sdt");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function Body.AppendP(): P;
|
|
begin
|
|
obj := new P(self, {self.}Prefix, "p");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function Body.AppendTbl(): Tbl;
|
|
begin
|
|
obj := new Tbl(self, {self.}Prefix, "tbl");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function Body.AppendSdt(): Sdt;
|
|
begin
|
|
obj := new Sdt(self, {self.}Prefix, "sdt");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|