128 lines
3.4 KiB
Plaintext
128 lines
3.4 KiB
Plaintext
type MFont = 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: MFont);override;
|
|
|
|
public
|
|
|
|
// normal property
|
|
property Latin read ReadXmlChildLatin;
|
|
property Ea read ReadXmlChildEa;
|
|
property Cs read ReadXmlChildCs;
|
|
function ReadXmlChildLatin();
|
|
function ReadXmlChildEa();
|
|
function ReadXmlChildCs();
|
|
|
|
// multi property
|
|
property Fonts read ReadFonts;
|
|
function ReadFonts(_index);
|
|
function AddFont(): MFontFont;
|
|
function AppendFont(): MFontFont;
|
|
|
|
public
|
|
// Children
|
|
XmlChildLatin: Latin;
|
|
XmlChildEa: Latin;
|
|
XmlChildCs: Latin;
|
|
|
|
end;
|
|
|
|
function MFont.Create();overload;
|
|
begin
|
|
{self.}Create(nil, "a", "");
|
|
end;
|
|
|
|
function MFont.Create(_node: XmlNode);overload;
|
|
begin
|
|
class(OpenXmlElement).Create(_node: XmlNode);
|
|
end;
|
|
|
|
function MFont.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 MFont.Init();override;
|
|
begin
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
attributes_ := array();
|
|
attributes_pf_ := array(
|
|
);
|
|
sorted_child_ := array(
|
|
pre + "latin": array(0, makeweakref(thisFunction(ReadXmlChildLatin))),
|
|
pre + "ea": array(1, makeweakref(thisFunction(ReadXmlChildEa))),
|
|
pre + "cs": array(2, makeweakref(thisFunction(ReadXmlChildCs))),
|
|
pre + "font": array(3, makeweakref(thisFunction(AppendFont))),
|
|
);
|
|
container_ := new TSOfficeContainer(sorted_child_);
|
|
end;
|
|
|
|
function MFont.Copy(_obj: MFont);override;
|
|
begin
|
|
tslassigning_backup := tslassigning;
|
|
tslassigning := 1;
|
|
class(OpenXmlElement).Copy(_obj);
|
|
if not ifnil(_obj.XmlChildLatin) then
|
|
{self.}Latin.Copy(_obj.XmlChildLatin);
|
|
if not ifnil(_obj.XmlChildEa) then
|
|
{self.}Ea.Copy(_obj.XmlChildEa);
|
|
if not ifnil(_obj.XmlChildCs) then
|
|
{self.}Cs.Copy(_obj.XmlChildCs);
|
|
tslassigning := tslassigning_backup;
|
|
end;
|
|
|
|
function MFont.ReadXmlChildLatin();
|
|
begin
|
|
if tslassigning and ifnil({self.}XmlChildLatin) then
|
|
begin
|
|
{self.}XmlChildLatin := new Latin(self, {self.}Prefix, "latin");
|
|
container_.Set({self.}XmlChildLatin);
|
|
end
|
|
return {self.}XmlChildLatin;
|
|
end;
|
|
|
|
function MFont.ReadXmlChildEa();
|
|
begin
|
|
if tslassigning and ifnil({self.}XmlChildEa) then
|
|
begin
|
|
{self.}XmlChildEa := new Latin(self, {self.}Prefix, "ea");
|
|
container_.Set({self.}XmlChildEa);
|
|
end
|
|
return {self.}XmlChildEa;
|
|
end;
|
|
|
|
function MFont.ReadXmlChildCs();
|
|
begin
|
|
if tslassigning and ifnil({self.}XmlChildCs) then
|
|
begin
|
|
{self.}XmlChildCs := new Latin(self, {self.}Prefix, "cs");
|
|
container_.Set({self.}XmlChildCs);
|
|
end
|
|
return {self.}XmlChildCs;
|
|
end;
|
|
|
|
function MFont.ReadFonts(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "font", ind);
|
|
end;
|
|
|
|
function MFont.AddFont(): MFontFont;
|
|
begin
|
|
obj := new MFontFont(self, {self.}Prefix, "font");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function MFont.AppendFont(): MFontFont;
|
|
begin
|
|
obj := new MFontFont(self, {self.}Prefix, "font");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|