OfficeXml/autoclass/docx/Fonts@DOCX.tsf

353 lines
10 KiB
Plaintext

type Fonts = 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 InitAttributes();override;
function InitChildren();override;
function InitNode(_node: XmlNode);override;
function Copy(_obj: Fonts);override;
function AddFont(): Font;
function AppendFont(): Font;
property Fonts read ReadFonts;
function ReadFonts(_index);
property XmlnsMc read ReadXmlAttrXmlnsMc write WriteXmlAttrXmlnsMc;
property XmlnsR read ReadXmlAttrXmlnsR write WriteXmlAttrXmlnsR;
property XmlnsW read ReadXmlAttrXmlnsW write WriteXmlAttrXmlnsW;
property XmlnsW14 read ReadXmlAttrXmlnsW14 write WriteXmlAttrXmlnsW14;
property XmlnsW15 read ReadXmlAttrXmlnsW15 write WriteXmlAttrXmlnsW15;
property XmlnsW16Cex read ReadXmlAttrXmlnsW16Cex write WriteXmlAttrXmlnsW16Cex;
property XmlnsW16Cid read ReadXmlAttrXmlnsW16Cid write WriteXmlAttrXmlnsW16Cid;
property XmlnsW16 read ReadXmlAttrXmlnsW16 write WriteXmlAttrXmlnsW16;
property XmlnsW16Du read ReadXmlAttrXmlnsW16Du write WriteXmlAttrXmlnsW16Du;
property XmlnsW16sdtdh read ReadXmlAttrXmlnsW16sdtdh write WriteXmlAttrXmlnsW16sdtdh;
property XmlnsW16se read ReadXmlAttrXmlnsW16se write WriteXmlAttrXmlnsW16se;
property McIgnorable read ReadXmlAttrMcIgnorable write WriteXmlAttrMcIgnorable;
function ReadXmlAttrXmlnsMc();
function WriteXmlAttrXmlnsMc(_value);
function ReadXmlAttrXmlnsR();
function WriteXmlAttrXmlnsR(_value);
function ReadXmlAttrXmlnsW();
function WriteXmlAttrXmlnsW(_value);
function ReadXmlAttrXmlnsW14();
function WriteXmlAttrXmlnsW14(_value);
function ReadXmlAttrXmlnsW15();
function WriteXmlAttrXmlnsW15(_value);
function ReadXmlAttrXmlnsW16Cex();
function WriteXmlAttrXmlnsW16Cex(_value);
function ReadXmlAttrXmlnsW16Cid();
function WriteXmlAttrXmlnsW16Cid(_value);
function ReadXmlAttrXmlnsW16();
function WriteXmlAttrXmlnsW16(_value);
function ReadXmlAttrXmlnsW16Du();
function WriteXmlAttrXmlnsW16Du(_value);
function ReadXmlAttrXmlnsW16sdtdh();
function WriteXmlAttrXmlnsW16sdtdh(_value);
function ReadXmlAttrXmlnsW16se();
function WriteXmlAttrXmlnsW16se(_value);
function ReadXmlAttrMcIgnorable();
function WriteXmlAttrMcIgnorable(_value);
public
// Attributes
XmlAttrXmlnsMc: OpenXmlAttribute;
XmlAttrXmlnsR: OpenXmlAttribute;
XmlAttrXmlnsW: OpenXmlAttribute;
XmlAttrXmlnsW14: OpenXmlAttribute;
XmlAttrXmlnsW15: OpenXmlAttribute;
XmlAttrXmlnsW16Cex: OpenXmlAttribute;
XmlAttrXmlnsW16Cid: OpenXmlAttribute;
XmlAttrXmlnsW16: OpenXmlAttribute;
XmlAttrXmlnsW16Du: OpenXmlAttribute;
XmlAttrXmlnsW16sdtdh: OpenXmlAttribute;
XmlAttrXmlnsW16se: OpenXmlAttribute;
XmlAttrMcIgnorable: OpenXmlAttribute;
// Children
end;
function Fonts.Create();overload;
begin
{self.}Create(nil, "w", "fonts");
end;
function Fonts.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Fonts.Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
begin
class(OpenXmlElement).Create(_parent, _prefix, _local_name);
end;
function Fonts.Init();override;
begin
{self.}XmlAttrXmlnsMc := new OpenXmlAttribute("xmlns", "mc", nil);
{self.}XmlAttrXmlnsR := new OpenXmlAttribute("xmlns", "r", nil);
{self.}XmlAttrXmlnsW := new OpenXmlAttribute("xmlns", "w", nil);
{self.}XmlAttrXmlnsW14 := new OpenXmlAttribute("xmlns", "w14", nil);
{self.}XmlAttrXmlnsW15 := new OpenXmlAttribute("xmlns", "w15", nil);
{self.}XmlAttrXmlnsW16Cex := new OpenXmlAttribute("xmlns", "w16cex", nil);
{self.}XmlAttrXmlnsW16Cid := new OpenXmlAttribute("xmlns", "w16cid", nil);
{self.}XmlAttrXmlnsW16 := new OpenXmlAttribute("xmlns", "w16", nil);
{self.}XmlAttrXmlnsW16Du := new OpenXmlAttribute("xmlns", "w16du", nil);
{self.}XmlAttrXmlnsW16sdtdh := new OpenXmlAttribute("xmlns", "w16sdtdh", nil);
{self.}XmlAttrXmlnsW16se := new OpenXmlAttribute("xmlns", "w16se", nil);
{self.}XmlAttrMcIgnorable := new OpenXmlAttribute("mc", "Ignorable", nil);
end;
function Fonts.InitAttributes();override;
begin
attributes_ := array(
{self.}XmlAttrXmlnsMc,
{self.}XmlAttrXmlnsR,
{self.}XmlAttrXmlnsW,
{self.}XmlAttrXmlnsW14,
{self.}XmlAttrXmlnsW15,
{self.}XmlAttrXmlnsW16Cex,
{self.}XmlAttrXmlnsW16Cid,
{self.}XmlAttrXmlnsW16,
{self.}XmlAttrXmlnsW16Du,
{self.}XmlAttrXmlnsW16sdtdh,
{self.}XmlAttrXmlnsW16se,
{self.}XmlAttrMcIgnorable,
);
end;
function Fonts.InitChildren();override;
begin
child_elements_ := array(
);
sorted_child_ := array(
"": -1,
);
end;
function Fonts.InitNode(_node: XmlNode);override;
begin
if ifObj({self.}XmlNode) then
for k,v in child_elements_ do v.InitNode(nil);
{self.}XmlNode := ifObj(_node) ? _node : nil;
node := ifObj(_node) ? _node.FirstChild() : nil;
flag := false;
if ifnil(child_elements_[0]) and length(child_elements_) > 0 then
begin
flag := true;
arr := child_elements_;
child_elements_ := array();
end
pre := ifString({self.}Prefix) ? {self.}Prefix + ":" : "";
while ifObj(node) do
begin
node_name := node.GetName();
pos := sorted_child_[node_name];
if ifnil(pos) or pos = -1 then
begin
obj := nil;
case node_name of
pre + "font": obj := {self.}AppendFont();
end;
if ifObj(obj) then obj.InitNode(node);
end
else if flag then
begin
obj := arr[pos];
obj.InitNode(node);
child_elements_[length(child_elements_)] := obj;
end
else begin
child_elements_[pos].InitNode(node);
end
node := node.NextElement();
end
end;
function Fonts.Copy(_obj: Fonts);override;
begin
if not ifnil(_obj.XmlAttrXmlnsMc.Value) then
{self.}XmlAttrXmlnsMc.Value := _obj.XmlAttrXmlnsMc.Value;
if not ifnil(_obj.XmlAttrXmlnsR.Value) then
{self.}XmlAttrXmlnsR.Value := _obj.XmlAttrXmlnsR.Value;
if not ifnil(_obj.XmlAttrXmlnsW.Value) then
{self.}XmlAttrXmlnsW.Value := _obj.XmlAttrXmlnsW.Value;
if not ifnil(_obj.XmlAttrXmlnsW14.Value) then
{self.}XmlAttrXmlnsW14.Value := _obj.XmlAttrXmlnsW14.Value;
if not ifnil(_obj.XmlAttrXmlnsW15.Value) then
{self.}XmlAttrXmlnsW15.Value := _obj.XmlAttrXmlnsW15.Value;
if not ifnil(_obj.XmlAttrXmlnsW16Cex.Value) then
{self.}XmlAttrXmlnsW16Cex.Value := _obj.XmlAttrXmlnsW16Cex.Value;
if not ifnil(_obj.XmlAttrXmlnsW16Cid.Value) then
{self.}XmlAttrXmlnsW16Cid.Value := _obj.XmlAttrXmlnsW16Cid.Value;
if not ifnil(_obj.XmlAttrXmlnsW16.Value) then
{self.}XmlAttrXmlnsW16.Value := _obj.XmlAttrXmlnsW16.Value;
if not ifnil(_obj.XmlAttrXmlnsW16Du.Value) then
{self.}XmlAttrXmlnsW16Du.Value := _obj.XmlAttrXmlnsW16Du.Value;
if not ifnil(_obj.XmlAttrXmlnsW16sdtdh.Value) then
{self.}XmlAttrXmlnsW16sdtdh.Value := _obj.XmlAttrXmlnsW16sdtdh.Value;
if not ifnil(_obj.XmlAttrXmlnsW16se.Value) then
{self.}XmlAttrXmlnsW16se.Value := _obj.XmlAttrXmlnsW16se.Value;
if not ifnil(_obj.XmlAttrMcIgnorable.Value) then
{self.}XmlAttrMcIgnorable.Value := _obj.XmlAttrMcIgnorable.Value;
end;
function Fonts.AddFont(): Font;
begin
len := length(child_elements_);
if len = 0 then i := -1;
else begin
for i:=len-1 downto 0 do
if child_elements_[i].LocalName = "font" then break;
end
obj := new Font(self, {self.}Prefix, "font");
{self.}InsertChild(obj, i+1);
return obj;
end;
function Fonts.AppendFont(): Font;
begin
obj := new Font(self, {self.}Prefix, "font");
child_elements_[length(child_elements_)] := obj;
return obj;
end;
function Fonts.ReadFonts(_index);
begin
ind := ifnil(_index) ? -2 : _index;
arr := array();
for k,v in child_elements_ do
begin
if v.LocalName = "font" then
begin
arr[length(arr)] := v;
ind--;
end;
if ind = -1 then return v;
end;
return arr;
end;
function Fonts.ReadXmlAttrXmlnsMc();
begin
return {self.}XmlAttrXmlnsMc.Value;
end;
function Fonts.WriteXmlAttrXmlnsMc(_value);
begin
{self.}XmlAttrXmlnsMc.Value := _value;
end;
function Fonts.ReadXmlAttrXmlnsR();
begin
return {self.}XmlAttrXmlnsR.Value;
end;
function Fonts.WriteXmlAttrXmlnsR(_value);
begin
{self.}XmlAttrXmlnsR.Value := _value;
end;
function Fonts.ReadXmlAttrXmlnsW();
begin
return {self.}XmlAttrXmlnsW.Value;
end;
function Fonts.WriteXmlAttrXmlnsW(_value);
begin
{self.}XmlAttrXmlnsW.Value := _value;
end;
function Fonts.ReadXmlAttrXmlnsW14();
begin
return {self.}XmlAttrXmlnsW14.Value;
end;
function Fonts.WriteXmlAttrXmlnsW14(_value);
begin
{self.}XmlAttrXmlnsW14.Value := _value;
end;
function Fonts.ReadXmlAttrXmlnsW15();
begin
return {self.}XmlAttrXmlnsW15.Value;
end;
function Fonts.WriteXmlAttrXmlnsW15(_value);
begin
{self.}XmlAttrXmlnsW15.Value := _value;
end;
function Fonts.ReadXmlAttrXmlnsW16Cex();
begin
return {self.}XmlAttrXmlnsW16Cex.Value;
end;
function Fonts.WriteXmlAttrXmlnsW16Cex(_value);
begin
{self.}XmlAttrXmlnsW16Cex.Value := _value;
end;
function Fonts.ReadXmlAttrXmlnsW16Cid();
begin
return {self.}XmlAttrXmlnsW16Cid.Value;
end;
function Fonts.WriteXmlAttrXmlnsW16Cid(_value);
begin
{self.}XmlAttrXmlnsW16Cid.Value := _value;
end;
function Fonts.ReadXmlAttrXmlnsW16();
begin
return {self.}XmlAttrXmlnsW16.Value;
end;
function Fonts.WriteXmlAttrXmlnsW16(_value);
begin
{self.}XmlAttrXmlnsW16.Value := _value;
end;
function Fonts.ReadXmlAttrXmlnsW16Du();
begin
return {self.}XmlAttrXmlnsW16Du.Value;
end;
function Fonts.WriteXmlAttrXmlnsW16Du(_value);
begin
{self.}XmlAttrXmlnsW16Du.Value := _value;
end;
function Fonts.ReadXmlAttrXmlnsW16sdtdh();
begin
return {self.}XmlAttrXmlnsW16sdtdh.Value;
end;
function Fonts.WriteXmlAttrXmlnsW16sdtdh(_value);
begin
{self.}XmlAttrXmlnsW16sdtdh.Value := _value;
end;
function Fonts.ReadXmlAttrXmlnsW16se();
begin
return {self.}XmlAttrXmlnsW16se.Value;
end;
function Fonts.WriteXmlAttrXmlnsW16se(_value);
begin
{self.}XmlAttrXmlnsW16se.Value := _value;
end;
function Fonts.ReadXmlAttrMcIgnorable();
begin
return {self.}XmlAttrMcIgnorable.Value;
end;
function Fonts.WriteXmlAttrMcIgnorable(_value);
begin
{self.}XmlAttrMcIgnorable.Value := _value;
end;