110 lines
3.1 KiB
Plaintext
110 lines
3.1 KiB
Plaintext
type FontScheme = 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: FontScheme);override;
|
|
|
|
public
|
|
|
|
// attributes property
|
|
property Name read ReadXmlAttrName write WriteXmlAttrName;
|
|
function ReadXmlAttrName();
|
|
function WriteXmlAttrName(_value);
|
|
|
|
// normal property
|
|
property Majorfont read ReadXmlChildMajorfont;
|
|
property Minorfont read ReadXmlChildMinorfont;
|
|
function ReadXmlChildMajorfont();
|
|
function ReadXmlChildMinorfont();
|
|
|
|
public
|
|
// Attributes
|
|
XmlAttrName: OpenXmlAttribute;
|
|
|
|
// Children
|
|
XmlChildMajorfont: Mfont;
|
|
XmlChildMinorfont: Mfont;
|
|
|
|
end;
|
|
|
|
function FontScheme.Create();overload;
|
|
begin
|
|
{self.}Create(nil, "a", "fontScheme");
|
|
end;
|
|
|
|
function FontScheme.Create(_node: XmlNode);overload;
|
|
begin
|
|
class(OpenXmlElement).Create(_node: XmlNode);
|
|
end;
|
|
|
|
function FontScheme.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 FontScheme.Init();override;
|
|
begin
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
attributes_ := array();
|
|
attributes_pf_ := array(
|
|
"name": makeweakref(thisFunction(WriteXmlAttrName)),
|
|
);
|
|
sorted_child_ := array(
|
|
pre + "majorFont": array(0, makeweakref(thisFunction(ReadXmlChildMajorfont))),
|
|
pre + "minorFont": array(1, makeweakref(thisFunction(ReadXmlChildMinorfont))),
|
|
);
|
|
container_ := new TSOfficeContainer(sorted_child_);
|
|
end;
|
|
|
|
function FontScheme.Copy(_obj: FontScheme);override;
|
|
begin
|
|
tslassigning_backup := tslassigning;
|
|
tslassigning := 1;
|
|
class(OpenXmlElement).Copy(_obj);
|
|
if not ifnil(_obj.Name) then
|
|
{self.}Name := _obj.Name;
|
|
if not ifnil(_obj.XmlChildMajorfont) then
|
|
{self.}Majorfont.Copy(_obj.XmlChildMajorfont);
|
|
if not ifnil(_obj.XmlChildMinorfont) then
|
|
{self.}Minorfont.Copy(_obj.XmlChildMinorfont);
|
|
tslassigning := tslassigning_backup;
|
|
end;
|
|
|
|
function FontScheme.ReadXmlAttrName();
|
|
begin
|
|
return {self.}XmlAttrName.Value;
|
|
end;
|
|
|
|
function FontScheme.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 FontScheme.ReadXmlChildMajorfont();
|
|
begin
|
|
if tslassigning and ifnil({self.}XmlChildMajorfont) then
|
|
begin
|
|
{self.}XmlChildMajorfont := new Mfont(self, {self.}Prefix, "majorFont");
|
|
container_.Set({self.}XmlChildMajorfont);
|
|
end
|
|
return {self.}XmlChildMajorfont;
|
|
end;
|
|
|
|
function FontScheme.ReadXmlChildMinorfont();
|
|
begin
|
|
if tslassigning and ifnil({self.}XmlChildMinorfont) then
|
|
begin
|
|
{self.}XmlChildMinorfont := new Mfont(self, {self.}Prefix, "minorFont");
|
|
container_.Set({self.}XmlChildMinorfont);
|
|
end
|
|
return {self.}XmlChildMinorfont;
|
|
end;
|