148 lines
3.9 KiB
Plaintext
148 lines
3.9 KiB
Plaintext
type HyperLink = 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: HyperLink);override;
|
|
|
|
public
|
|
|
|
// attributes property
|
|
property Anchor read ReadXmlAttrAnchor write WriteXmlAttrAnchor;
|
|
property Id read ReadXmlAttrId write WriteXmlAttrId;
|
|
property History read ReadXmlAttrHistory write WriteXmlAttrHistory;
|
|
function ReadXmlAttrAnchor();
|
|
function WriteXmlAttrAnchor(_value);
|
|
function ReadXmlAttrId();
|
|
function WriteXmlAttrId(_value);
|
|
function ReadXmlAttrHistory();
|
|
function WriteXmlAttrHistory(_value);
|
|
|
|
// multi property
|
|
property Rs read ReadRs;
|
|
function ReadRs(_index);
|
|
function AddR(): R;
|
|
function AppendR(): R;
|
|
|
|
public
|
|
// Attributes
|
|
XmlAttrAnchor: OpenXmlAttribute;
|
|
XmlAttrId: OpenXmlAttribute;
|
|
XmlAttrHistory: OpenXmlAttribute;
|
|
|
|
// Children
|
|
|
|
end;
|
|
|
|
function HyperLink.Create();overload;
|
|
begin
|
|
{self.}Create(nil, "w", "hyperlink");
|
|
end;
|
|
|
|
function HyperLink.Create(_node: XmlNode);overload;
|
|
begin
|
|
class(OpenXmlElement).Create(_node: XmlNode);
|
|
end;
|
|
|
|
function HyperLink.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 HyperLink.Init();override;
|
|
begin
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
attributes_ := array();
|
|
attributes_pf_ := array(
|
|
pre + "anchor": makeweakref(thisFunction(WriteXmlAttrAnchor)),
|
|
"r:id": makeweakref(thisFunction(WriteXmlAttrId)),
|
|
pre + "history": makeweakref(thisFunction(WriteXmlAttrHistory)),
|
|
);
|
|
sorted_child_ := array(
|
|
pre + "r": array(0, makeweakref(thisFunction(AppendR))),
|
|
);
|
|
container_ := new TSOfficeContainer(sorted_child_);
|
|
end;
|
|
|
|
function HyperLink.Copy(_obj: HyperLink);override;
|
|
begin
|
|
tslassigning_backup := tslassigning;
|
|
tslassigning := 1;
|
|
class(OpenXmlElement).Copy(_obj);
|
|
if not ifnil(_obj.Anchor) then
|
|
{self.}Anchor := _obj.Anchor;
|
|
if not ifnil(_obj.Id) then
|
|
{self.}Id := _obj.Id;
|
|
if not ifnil(_obj.History) then
|
|
{self.}History := _obj.History;
|
|
tslassigning := tslassigning_backup;
|
|
end;
|
|
|
|
function HyperLink.ReadXmlAttrAnchor();
|
|
begin
|
|
return {self.}XmlAttrAnchor.Value;
|
|
end;
|
|
|
|
function HyperLink.WriteXmlAttrAnchor(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrAnchor) then
|
|
begin
|
|
{self.}XmlAttrAnchor := new OpenXmlAttribute({self.}Prefix, "anchor", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrAnchor;
|
|
end
|
|
{self.}XmlAttrAnchor.Value := _value;
|
|
end;
|
|
|
|
function HyperLink.ReadXmlAttrId();
|
|
begin
|
|
return {self.}XmlAttrId.Value;
|
|
end;
|
|
|
|
function HyperLink.WriteXmlAttrId(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrId) then
|
|
begin
|
|
{self.}XmlAttrId := new OpenXmlAttribute("r", "id", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrId;
|
|
end
|
|
{self.}XmlAttrId.Value := _value;
|
|
end;
|
|
|
|
function HyperLink.ReadXmlAttrHistory();
|
|
begin
|
|
return {self.}XmlAttrHistory.Value;
|
|
end;
|
|
|
|
function HyperLink.WriteXmlAttrHistory(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrHistory) then
|
|
begin
|
|
{self.}XmlAttrHistory := new OpenXmlAttribute({self.}Prefix, "history", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrHistory;
|
|
end
|
|
{self.}XmlAttrHistory.Value := _value;
|
|
end;
|
|
|
|
function HyperLink.ReadRs(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "r", ind);
|
|
end;
|
|
|
|
function HyperLink.AddR(): R;
|
|
begin
|
|
obj := new R(self, {self.}Prefix, "r");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function HyperLink.AppendR(): R;
|
|
begin
|
|
obj := new R(self, {self.}Prefix, "r");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|