OfficeXml/autoclass/docx/Cache@DOCX.tsf

114 lines
3.0 KiB
Plaintext

type Cache = 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: Cache);override;
public
// pcdata property
property FormatCode read ReadXmlChildFormatCode;
function ReadXmlChildFormatCode();
// normal property
property PtCount read ReadXmlChildPtCount;
function ReadXmlChildPtCount();
// multi property
property Pts read ReadPts;
function ReadPts(_index);
function AddPt(): Pt;
function AppendPt(): Pt;
public
// Children
XmlChildFormatCode: OpenXmlPcdata;
XmlChildPtCount: PureVal;
end;
function Cache.Create();overload;
begin
{self.}Create(nil, "c", "");
end;
function Cache.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Cache.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 Cache.Init();override;
begin
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
attributes_ := array();
attributes_pf_ := array(
);
sorted_child_ := array(
pre + "formatCode": array(0, makeweakref(thisFunction(ReadXmlChildFormatCode))),
pre + "ptCount": array(1, makeweakref(thisFunction(ReadXmlChildPtCount))),
pre + "pt": array(2, makeweakref(thisFunction(AppendPt))),
);
container_ := new TSOfficeContainer(sorted_child_);
end;
function Cache.Copy(_obj: Cache);override;
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
class(OpenXmlElement).Copy(_obj);
if not ifnil(_obj.XmlChildFormatCode) then
{self.}FormatCode.Copy(_obj.XmlChildFormatCode);
if not ifnil(_obj.XmlChildPtCount) then
{self.}PtCount.Copy(_obj.XmlChildPtCount);
tslassigning := tslassigning_backup;
end;
function Cache.ReadXmlChildFormatCode();
begin
if tslassigning and ifnil({self.}XmlChildFormatCode) then
begin
{self.}XmlChildFormatCode := new OpenXmlPcdata(self, {self.}Prefix, "formatCode");
container_.Set({self.}XmlChildFormatCode);
end
return {self.}XmlChildFormatCode;
end;
function Cache.ReadXmlChildPtCount();
begin
if tslassigning and ifnil({self.}XmlChildPtCount) then
begin
{self.}XmlChildPtCount := new PureVal(self, {self.}Prefix, "ptCount");
container_.Set({self.}XmlChildPtCount);
end
return {self.}XmlChildPtCount;
end;
function Cache.ReadPts(_index);
begin
ind := ifnil(_index) ? -2 : _index;
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
return container_.Get(pre + "pt", ind);
end;
function Cache.AddPt(): Pt;
begin
obj := new Pt(self, {self.}Prefix, "pt");
container_.Insert(obj);
return obj;
end;
function Cache.AppendPt(): Pt;
begin
obj := new Pt(self, {self.}Prefix, "pt");
container_.Append(obj);
return obj;
end;