OfficeXml/autoclass/docx/Tc@DOCX.tsf

122 lines
2.9 KiB
Plaintext

type Tc = 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: Tc);override;
public
// normal property
property TcPr read ReadXmlChildTcPr;
function ReadXmlChildTcPr();
// multi property
property Ps read ReadPs;
property Tbls read ReadTbls;
function ReadPs(_index);
function ReadTbls(_index);
function AddP(): P;
function AddTbl(): Tbl;
function AppendP(): P;
function AppendTbl(): Tbl;
public
// Children
XmlChildTcPr: TcPr;
end;
function Tc.Create();overload;
begin
{self.}Create(nil, "w", "tc");
end;
function Tc.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Tc.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 Tc.Init();override;
begin
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
attributes_ := array();
attributes_pf_ := array(
);
sorted_child_ := array(
pre + "tcPr": array(0, makeweakref(thisFunction(ReadXmlChildTcPr))),
pre + "p": array(1, makeweakref(thisFunction(AppendP))),
pre + "tbl": array(2, makeweakref(thisFunction(AppendTbl))),
);
container_ := new TSOfficeContainer(sorted_child_);
end;
function Tc.Copy(_obj: Tc);override;
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
class(OpenXmlElement).Copy(_obj);
if not ifnil(_obj.XmlChildTcPr) then
{self.}TcPr.Copy(_obj.XmlChildTcPr);
tslassigning := tslassigning_backup;
end;
function Tc.ReadXmlChildTcPr();
begin
if tslassigning and ifnil({self.}XmlChildTcPr) then
begin
{self.}XmlChildTcPr := new TcPr(self, {self.}Prefix, "tcPr");
container_.Set({self.}XmlChildTcPr);
end
return {self.}XmlChildTcPr;
end;
function Tc.ReadPs(_index);
begin
ind := ifnil(_index) ? -2 : _index;
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
return container_.Get(pre + "p", ind);
end;
function Tc.ReadTbls(_index);
begin
ind := ifnil(_index) ? -2 : _index;
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
return container_.Get(pre + "tbl", ind);
end;
function Tc.AddP(): P;
begin
obj := new P(self, {self.}Prefix, "p");
container_.Insert(obj);
return obj;
end;
function Tc.AddTbl(): Tbl;
begin
obj := new Tbl(self, {self.}Prefix, "tbl");
container_.Insert(obj);
return obj;
end;
function Tc.AppendP(): P;
begin
obj := new P(self, {self.}Prefix, "p");
container_.Append(obj);
return obj;
end;
function Tc.AppendTbl(): Tbl;
begin
obj := new Tbl(self, {self.}Prefix, "tbl");
container_.Append(obj);
return obj;
end;