OfficeXml/autoclass/docx/Types@DOCX.tsf

130 lines
3.3 KiB
Plaintext

type Types = 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: Types);override;
public
// attributes property
property xmlns read ReadXmlAttrxmlns write WriteXmlAttrxmlns;
function ReadXmlAttrxmlns();
function WriteXmlAttrxmlns(_value);
// multi property
property Defaults read ReadDefaults;
property Overrides read ReadOverrides;
function ReadDefaults(_index);
function ReadOverrides(_index);
function AddDefault(): Default;
function AddOverride(): _Override;
function AppendDefault(): Default;
function AppendOverride(): _Override;
public
// Attributes
XmlAttrxmlns: OpenXmlAttribute;
// Children
end;
function Types.Create();overload;
begin
{self.}Create(nil, "", "Types");
end;
function Types.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Types.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 Types.Init();override;
begin
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
attributes_ := array();
attributes_pf_ := array(
"xmlns": makeweakref(thisFunction(WriteXmlAttrxmlns)),
);
sorted_child_ := array(
"Default": array(0, makeweakref(thisFunction(AppendDefault))),
"Override": array(1, makeweakref(thisFunction(AppendOverride))),
);
container_ := new TSOfficeContainer(sorted_child_);
end;
function Types.Copy(_obj: Types);override;
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
class(OpenXmlElement).Copy(_obj);
if not ifnil(_obj.xmlns) then
{self.}xmlns := _obj.xmlns;
tslassigning := tslassigning_backup;
end;
function Types.ReadXmlAttrxmlns();
begin
return {self.}XmlAttrxmlns.Value;
end;
function Types.WriteXmlAttrxmlns(_value);
begin
if ifnil({self.}XmlAttrxmlns) then
begin
{self.}XmlAttrxmlns := new OpenXmlAttribute("", "xmlns", nil);
attributes_[length(attributes_)] := {self.}XmlAttrxmlns;
end
{self.}XmlAttrxmlns.Value := _value;
end;
function Types.ReadDefaults(_index);
begin
ind := ifnil(_index) ? -2 : _index;
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
return container_.Get("Default", ind);
end;
function Types.ReadOverrides(_index);
begin
ind := ifnil(_index) ? -2 : _index;
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
return container_.Get("Override", ind);
end;
function Types.AddDefault(): Default;
begin
obj := new Default(self, "", "Default");
container_.Insert(obj);
return obj;
end;
function Types.AddOverride(): _Override;
begin
obj := new _Override(self, "", "Override");
container_.Insert(obj);
return obj;
end;
function Types.AppendDefault(): Default;
begin
obj := new Default(self, "", "Default");
container_.Append(obj);
return obj;
end;
function Types.AppendOverride(): _Override;
begin
obj := new _Override(self, "", "Override");
container_.Append(obj);
return obj;
end;