OfficeXml/autoclass/docx/Endnote@DOCX.tsf

126 lines
3.2 KiB
Plaintext

type Endnote = 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: Endnote);override;
public
// attributes property
property Type read ReadXmlAttrType write WriteXmlAttrType;
property Id read ReadXmlAttrId write WriteXmlAttrId;
function ReadXmlAttrType();
function WriteXmlAttrType(_value);
function ReadXmlAttrId();
function WriteXmlAttrId(_value);
// multi property
property Ps read ReadPs;
function ReadPs(_index);
function AddP(): P;
function AppendP(): P;
public
// Attributes
XmlAttrType: OpenXmlAttribute;
XmlAttrId: OpenXmlAttribute;
// Children
end;
function Endnote.Create();overload;
begin
{self.}Create(nil, "w", "endnote");
end;
function Endnote.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Endnote.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 Endnote.Init();override;
begin
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
attributes_ := array();
attributes_pf_ := array(
pre + "type": makeweakref(thisFunction(WriteXmlAttrType)),
pre + "id": makeweakref(thisFunction(WriteXmlAttrId)),
);
sorted_child_ := array(
pre + "p": array(0, makeweakref(thisFunction(AppendP))),
);
container_ := new TSOfficeContainer(sorted_child_);
end;
function Endnote.Copy(_obj: Endnote);override;
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
class(OpenXmlElement).Copy(_obj);
if not ifnil(_obj.Type) then
{self.}Type := _obj.Type;
if not ifnil(_obj.Id) then
{self.}Id := _obj.Id;
tslassigning := tslassigning_backup;
end;
function Endnote.ReadXmlAttrType();
begin
return {self.}XmlAttrType.Value;
end;
function Endnote.WriteXmlAttrType(_value);
begin
if ifnil({self.}XmlAttrType) then
begin
{self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil);
attributes_[length(attributes_)] := {self.}XmlAttrType;
end
{self.}XmlAttrType.Value := _value;
end;
function Endnote.ReadXmlAttrId();
begin
return {self.}XmlAttrId.Value;
end;
function Endnote.WriteXmlAttrId(_value);
begin
if ifnil({self.}XmlAttrId) then
begin
{self.}XmlAttrId := new OpenXmlAttribute({self.}Prefix, "id", nil);
attributes_[length(attributes_)] := {self.}XmlAttrId;
end
{self.}XmlAttrId.Value := _value;
end;
function Endnote.ReadPs(_index);
begin
ind := ifnil(_index) ? -2 : _index;
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
return container_.Get(pre + "p", ind);
end;
function Endnote.AddP(): P;
begin
obj := new P(self, {self.}Prefix, "p");
container_.Insert(obj);
return obj;
end;
function Endnote.AppendP(): P;
begin
obj := new P(self, {self.}Prefix, "p");
container_.Append(obj);
return obj;
end;