OfficeXml/autoclass/docx/DocPr@DOCX.tsf

119 lines
3.1 KiB
Plaintext

type DocPr = 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: DocPr);override;
public
// attributes property
property Id read ReadXmlAttrId write WriteXmlAttrId;
property Name read ReadXmlAttrName write WriteXmlAttrName;
property Descr read ReadXmlAttrDescr write WriteXmlAttrDescr;
function ReadXmlAttrId();
function WriteXmlAttrId(_value);
function ReadXmlAttrName();
function WriteXmlAttrName(_value);
function ReadXmlAttrDescr();
function WriteXmlAttrDescr(_value);
public
// Attributes
XmlAttrId: OpenXmlAttribute;
XmlAttrName: OpenXmlAttribute;
XmlAttrDescr: OpenXmlAttribute;
end;
function DocPr.Create();overload;
begin
{self.}Create(nil, "w", "docPr");
end;
function DocPr.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function DocPr.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 DocPr.Init();override;
begin
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
attributes_ := array();
attributes_pf_ := array(
"id": makeweakref(thisFunction(WriteXmlAttrId)),
"name": makeweakref(thisFunction(WriteXmlAttrName)),
"descr": makeweakref(thisFunction(WriteXmlAttrDescr)),
);
sorted_child_ := array(
);
container_ := new TSOfficeContainer(sorted_child_);
end;
function DocPr.Copy(_obj: DocPr);override;
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
class(OpenXmlElement).Copy(_obj);
if not ifnil(_obj.Id) then
{self.}Id := _obj.Id;
if not ifnil(_obj.Name) then
{self.}Name := _obj.Name;
if not ifnil(_obj.Descr) then
{self.}Descr := _obj.Descr;
tslassigning := tslassigning_backup;
end;
function DocPr.ReadXmlAttrId();
begin
return {self.}XmlAttrId.Value;
end;
function DocPr.WriteXmlAttrId(_value);
begin
if ifnil({self.}XmlAttrId) then
begin
{self.}XmlAttrId := new OpenXmlAttribute("", "id", nil);
attributes_[length(attributes_)] := {self.}XmlAttrId;
end
{self.}XmlAttrId.Value := _value;
end;
function DocPr.ReadXmlAttrName();
begin
return {self.}XmlAttrName.Value;
end;
function DocPr.WriteXmlAttrName(_value);
begin
if ifnil({self.}XmlAttrName) then
begin
{self.}XmlAttrName := new OpenXmlAttribute("", "name", nil);
attributes_[length(attributes_)] := {self.}XmlAttrName;
end
{self.}XmlAttrName.Value := _value;
end;
function DocPr.ReadXmlAttrDescr();
begin
return {self.}XmlAttrDescr.Value;
end;
function DocPr.WriteXmlAttrDescr(_value);
begin
if ifnil({self.}XmlAttrDescr) then
begin
{self.}XmlAttrDescr := new OpenXmlAttribute("", "descr", nil);
attributes_[length(attributes_)] := {self.}XmlAttrDescr;
end
{self.}XmlAttrDescr.Value := _value;
end;