OfficeXml/autoclass/docx/Font@DOCX.tsf

174 lines
5.2 KiB
Plaintext

type Font = 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: Font);override;
public
// attributes property
property Name read ReadXmlAttrName write WriteXmlAttrName;
function ReadXmlAttrName();
function WriteXmlAttrName(_value);
// normal property
property AltName read ReadXmlChildAltName;
property Panosel read ReadXmlChildPanosel;
property Charset read ReadXmlChildCharset;
property Family read ReadXmlChildFamily;
property Pitch read ReadXmlChildPitch;
property Sig read ReadXmlChildSig;
function ReadXmlChildAltName();
function ReadXmlChildPanosel();
function ReadXmlChildCharset();
function ReadXmlChildFamily();
function ReadXmlChildPitch();
function ReadXmlChildSig();
public
// Attributes
XmlAttrName: OpenXmlAttribute;
// Children
XmlChildAltName: PureWVal;
XmlChildPanosel: PureWVal;
XmlChildCharset: PureWVal;
XmlChildFamily: PureWVal;
XmlChildPitch: PureWVal;
XmlChildSig: Sig;
end;
function Font.Create();overload;
begin
{self.}Create(nil, "w", "font");
end;
function Font.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Font.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 Font.Init();override;
begin
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
attributes_ := array();
attributes_pf_ := array(
pre + "name": makeweakref(thisFunction(WriteXmlAttrName)),
);
sorted_child_ := array(
pre + "altName": array(0, makeweakref(thisFunction(ReadXmlChildAltName))),
pre + "panosel": array(1, makeweakref(thisFunction(ReadXmlChildPanosel))),
pre + "charset": array(2, makeweakref(thisFunction(ReadXmlChildCharset))),
pre + "family": array(3, makeweakref(thisFunction(ReadXmlChildFamily))),
pre + "pitch": array(4, makeweakref(thisFunction(ReadXmlChildPitch))),
pre + "sig": array(5, makeweakref(thisFunction(ReadXmlChildSig))),
);
container_ := new TSOfficeContainer(sorted_child_);
end;
function Font.Copy(_obj: Font);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.XmlChildAltName) then
{self.}AltName.Copy(_obj.XmlChildAltName);
if not ifnil(_obj.XmlChildPanosel) then
{self.}Panosel.Copy(_obj.XmlChildPanosel);
if not ifnil(_obj.XmlChildCharset) then
{self.}Charset.Copy(_obj.XmlChildCharset);
if not ifnil(_obj.XmlChildFamily) then
{self.}Family.Copy(_obj.XmlChildFamily);
if not ifnil(_obj.XmlChildPitch) then
{self.}Pitch.Copy(_obj.XmlChildPitch);
if not ifnil(_obj.XmlChildSig) then
{self.}Sig.Copy(_obj.XmlChildSig);
tslassigning := tslassigning_backup;
end;
function Font.ReadXmlAttrName();
begin
return {self.}XmlAttrName.Value;
end;
function Font.WriteXmlAttrName(_value);
begin
if ifnil({self.}XmlAttrName) then
begin
{self.}XmlAttrName := new OpenXmlAttribute({self.}Prefix, "name", nil);
attributes_[length(attributes_)] := {self.}XmlAttrName;
end
{self.}XmlAttrName.Value := _value;
end;
function Font.ReadXmlChildAltName();
begin
if tslassigning and ifnil({self.}XmlChildAltName) then
begin
{self.}XmlChildAltName := new PureWVal(self, {self.}Prefix, "altName");
container_.Set({self.}XmlChildAltName);
end
return {self.}XmlChildAltName;
end;
function Font.ReadXmlChildPanosel();
begin
if tslassigning and ifnil({self.}XmlChildPanosel) then
begin
{self.}XmlChildPanosel := new PureWVal(self, {self.}Prefix, "panosel");
container_.Set({self.}XmlChildPanosel);
end
return {self.}XmlChildPanosel;
end;
function Font.ReadXmlChildCharset();
begin
if tslassigning and ifnil({self.}XmlChildCharset) then
begin
{self.}XmlChildCharset := new PureWVal(self, {self.}Prefix, "charset");
container_.Set({self.}XmlChildCharset);
end
return {self.}XmlChildCharset;
end;
function Font.ReadXmlChildFamily();
begin
if tslassigning and ifnil({self.}XmlChildFamily) then
begin
{self.}XmlChildFamily := new PureWVal(self, {self.}Prefix, "family");
container_.Set({self.}XmlChildFamily);
end
return {self.}XmlChildFamily;
end;
function Font.ReadXmlChildPitch();
begin
if tslassigning and ifnil({self.}XmlChildPitch) then
begin
{self.}XmlChildPitch := new PureWVal(self, {self.}Prefix, "pitch");
container_.Set({self.}XmlChildPitch);
end
return {self.}XmlChildPitch;
end;
function Font.ReadXmlChildSig();
begin
if tslassigning and ifnil({self.}XmlChildSig) then
begin
{self.}XmlChildSig := new Sig(self, {self.}Prefix, "sig");
container_.Set({self.}XmlChildSig);
end
return {self.}XmlChildSig;
end;