OfficeXml/autoclass/docx/Theme@DOCX.tsf

178 lines
5.2 KiB
Plaintext

type Theme = 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: Theme);override;
property XmlnsA read ReadXmlAttrXmlnsA write WriteXmlAttrXmlnsA;
property Name read ReadXmlAttrName write WriteXmlAttrName;
function ReadXmlAttrXmlnsA();
function WriteXmlAttrXmlnsA(_value);
function ReadXmlAttrName();
function WriteXmlAttrName(_value);
property ObjectDefaults read ReadXmlChildObjectDefaults write WriteXmlChildObjectDefaults;
property ExtraClrSchemeLst read ReadXmlChildExtraClrSchemeLst write WriteXmlChildExtraClrSchemeLst;
function ReadXmlChildObjectDefaults();
function WriteXmlChildObjectDefaults(_value);
function ReadXmlChildExtraClrSchemeLst();
function WriteXmlChildExtraClrSchemeLst(_value);
public
// Attributes
XmlAttrXmlnsA: OpenXmlAttribute;
XmlAttrName: OpenXmlAttribute;
// Children
ThemeElements: ThemeElements;
XmlChildObjectDefaults: OpenXmlEmpty;
XmlChildExtraClrSchemeLst: OpenXmlEmpty;
ExtLst: ExtLst;
end;
function Theme.Create();overload;
begin
{self.}Create(nil, "a", "theme");
end;
function Theme.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Theme.Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
begin
class(OpenXmlElement).Create(_parent, _prefix, _local_name);
end;
function Theme.Init();override;
begin
{self.}XmlAttrXmlnsA := new OpenXmlAttribute("xmlns", "a", nil);
{self.}XmlAttrName := new OpenXmlAttribute(nil, "name", nil);
{self.}ThemeElements := new ThemeElements(self, {self.}Prefix, "themeElements");
{self.}XmlChildObjectDefaults := new OpenXmlEmpty(self, {self.}Prefix, "objectDefaults");
{self.}XmlChildExtraClrSchemeLst := new OpenXmlEmpty(self, {self.}Prefix, "extraClrSchemeLst");
{self.}ExtLst := new ExtLst(self, {self.}Prefix, "extLst");
end;
function Theme.InitAttributes();override;
begin
attributes_ := array(
{self.}XmlAttrXmlnsA,
{self.}XmlAttrName,
);
end;
function Theme.InitChildren();override;
begin
child_elements_ := array(
0: {self.}ThemeElements,
1: {self.}XmlChildObjectDefaults,
2: {self.}XmlChildExtraClrSchemeLst,
3: {self.}ExtLst,
);
sorted_child_ := array(
"": -1,
{self.}ThemeElements.ElementName: 0,
{self.}XmlChildObjectDefaults.ElementName: 1,
{self.}XmlChildExtraClrSchemeLst.ElementName: 2,
{self.}ExtLst.ElementName: 3,
);
end;
function Theme.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
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 Theme.Copy(_obj: Theme);override;
begin
if not ifnil(_obj.XmlAttrXmlnsA.Value) then
{self.}XmlAttrXmlnsA.Value := _obj.XmlAttrXmlnsA.Value;
if not ifnil(_obj.XmlAttrName.Value) then
{self.}XmlAttrName.Value := _obj.XmlAttrName.Value;
{self.}ThemeElements.Copy(_obj.ThemeElements);
{self.}XmlChildObjectDefaults.Copy(_obj.XmlChildObjectDefaults);
{self.}XmlChildExtraClrSchemeLst.Copy(_obj.XmlChildExtraClrSchemeLst);
{self.}ExtLst.Copy(_obj.ExtLst);
end;
function Theme.ReadXmlAttrXmlnsA();
begin
return {self.}XmlAttrXmlnsA.Value;
end;
function Theme.WriteXmlAttrXmlnsA(_value);
begin
{self.}XmlAttrXmlnsA.Value := _value;
end;
function Theme.ReadXmlAttrName();
begin
return {self.}XmlAttrName.Value;
end;
function Theme.WriteXmlAttrName(_value);
begin
{self.}XmlAttrName.Value := _value;
end;
function Theme.ReadXmlChildObjectDefaults();
begin
return ifnil({self.}XmlChildObjectDefaults.Value) ? false : true;
end;
function Theme.WriteXmlChildObjectDefaults(_value);
begin
{self.}XmlChildObjectDefaults.Value := _value;
end;
function Theme.ReadXmlChildExtraClrSchemeLst();
begin
return ifnil({self.}XmlChildExtraClrSchemeLst.Value) ? false : true;
end;
function Theme.WriteXmlChildExtraClrSchemeLst(_value);
begin
{self.}XmlChildExtraClrSchemeLst.Value := _value;
end;