type Style = 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: Style);override; public // attributes property property Type read ReadXmlAttrType write WriteXmlAttrType; property Default read ReadXmlAttrDefault write WriteXmlAttrDefault; property StyleId read ReadXmlAttrStyleId write WriteXmlAttrStyleId; function ReadXmlAttrType(); function WriteXmlAttrType(_value); function ReadXmlAttrDefault(); function WriteXmlAttrDefault(_value); function ReadXmlAttrStyleId(); function WriteXmlAttrStyleId(_value); // empty property property SemiHidden read ReadXmlChildSemiHidden write WriteXmlChildSemiHidden; property UnhideWhenUsed read ReadXmlChildUnhideWhenUsed write WriteXmlChildUnhideWhenUsed; property QFormat read ReadXmlChildQFormat write WriteXmlChildQFormat; property Rsid read ReadXmlChildRsid write WriteXmlChildRsid; function ReadXmlChildSemiHidden(); function WriteXmlChildSemiHidden(_value); function ReadXmlChildUnhideWhenUsed(); function WriteXmlChildUnhideWhenUsed(_value); function ReadXmlChildQFormat(); function WriteXmlChildQFormat(_value); function ReadXmlChildRsid(); function WriteXmlChildRsid(_value); // normal property property Name read ReadXmlChildName; property BasedOn read ReadXmlChildBasedOn; property Next read ReadXmlChildNext; property AutoRedefine read ReadXmlChildAutoRedefine; property Link read ReadXmlChildLink; property UIPriority read ReadXmlChildUIPriority; property PPr read ReadXmlChildPPr; property RPr read ReadXmlChildRPr; property TblPr read ReadXmlChildTblPr; property TrPr read ReadXmlChildTrPr; property TcPr read ReadXmlChildTcPr; function ReadXmlChildName(); function ReadXmlChildBasedOn(); function ReadXmlChildNext(); function ReadXmlChildAutoRedefine(); function ReadXmlChildLink(); function ReadXmlChildUIPriority(); function ReadXmlChildPPr(); function ReadXmlChildRPr(); function ReadXmlChildTblPr(); function ReadXmlChildTrPr(); function ReadXmlChildTcPr(); // multi property property TblStylePrs read ReadTblStylePrs; function ReadTblStylePrs(_index); function AddTblStylePr(): TblStylePr; function AppendTblStylePr(): TblStylePr; public // Attributes XmlAttrType: OpenXmlAttribute; XmlAttrDefault: OpenXmlAttribute; XmlAttrStyleId: OpenXmlAttribute; // Children XmlChildName: PureWVal; XmlChildBasedOn: PureWVal; XmlChildNext: PureWVal; XmlChildAutoRedefine: PureWVal; XmlChildLink: PureWVal; XmlChildUIPriority: PureWVal; XmlChildSemiHidden: OpenXmlEmpty; XmlChildUnhideWhenUsed: OpenXmlEmpty; XmlChildQFormat: OpenXmlEmpty; XmlChildRsid: OpenXmlEmpty; XmlChildPPr: PPr; XmlChildRPr: RPr; XmlChildTblPr: TblPr; XmlChildTrPr: TrPr; XmlChildTcPr: TcPr; end; function Style.Create();overload; begin {self.}Create(nil, "w", "style"); end; function Style.Create(_node: XmlNode);overload; begin class(OpenXmlElement).Create(_node: XmlNode); end; function Style.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 Style.Init();override; begin pre := {self.}Prefix ? {self.}Prefix + ":" : ""; attributes_ := array(); attributes_pf_ := array( pre + "type": makeweakref(thisFunction(WriteXmlAttrType)), pre + "default": makeweakref(thisFunction(WriteXmlAttrDefault)), pre + "styleId": makeweakref(thisFunction(WriteXmlAttrStyleId)), ); sorted_child_ := array( pre + "name": array(0, makeweakref(thisFunction(ReadXmlChildName))), pre + "basedOn": array(1, makeweakref(thisFunction(ReadXmlChildBasedOn))), pre + "next": array(2, makeweakref(thisFunction(ReadXmlChildNext))), pre + "autoRedefine": array(3, makeweakref(thisFunction(ReadXmlChildAutoRedefine))), pre + "link": array(4, makeweakref(thisFunction(ReadXmlChildLink))), pre + "uiPriority": array(5, makeweakref(thisFunction(ReadXmlChildUIPriority))), pre + "semiHidden": array(6, makeweakref(thisFunction(ReadXmlChildSemiHidden))), pre + "unhideWhenUsed": array(7, makeweakref(thisFunction(ReadXmlChildUnhideWhenUsed))), pre + "qFormat": array(8, makeweakref(thisFunction(ReadXmlChildQFormat))), pre + "rsid": array(9, makeweakref(thisFunction(ReadXmlChildRsid))), pre + "pPr": array(10, makeweakref(thisFunction(ReadXmlChildPPr))), pre + "rPr": array(11, makeweakref(thisFunction(ReadXmlChildRPr))), pre + "tblPr": array(12, makeweakref(thisFunction(ReadXmlChildTblPr))), pre + "trPr": array(13, makeweakref(thisFunction(ReadXmlChildTrPr))), pre + "tcPr": array(14, makeweakref(thisFunction(ReadXmlChildTcPr))), pre + "tblStylePr": array(15, makeweakref(thisFunction(AppendTblStylePr))), ); container_ := new TSOfficeContainer(sorted_child_); end; function Style.Copy(_obj: Style);override; begin tslassigning_backup := tslassigning; tslassigning := 1; class(OpenXmlElement).Copy(_obj); if not ifnil(_obj.Type) then {self.}Type := _obj.Type; if not ifnil(_obj.Default) then {self.}Default := _obj.Default; if not ifnil(_obj.StyleId) then {self.}StyleId := _obj.StyleId; if not ifnil(_obj.XmlChildName) then {self.}Name.Copy(_obj.XmlChildName); if not ifnil(_obj.XmlChildBasedOn) then {self.}BasedOn.Copy(_obj.XmlChildBasedOn); if not ifnil(_obj.XmlChildNext) then {self.}Next.Copy(_obj.XmlChildNext); if not ifnil(_obj.XmlChildAutoRedefine) then {self.}AutoRedefine.Copy(_obj.XmlChildAutoRedefine); if not ifnil(_obj.XmlChildLink) then {self.}Link.Copy(_obj.XmlChildLink); if not ifnil(_obj.XmlChildUIPriority) then {self.}UIPriority.Copy(_obj.XmlChildUIPriority); if not ifnil(_obj.XmlChildSemiHidden) then ifnil({self.}XmlChildSemiHidden) ? {self.}SemiHidden.Copy(_obj.XmlChildSemiHidden) : {self.}XmlChildSemiHidden.Copy(_obj.XmlChildSemiHidden); if not ifnil(_obj.XmlChildUnhideWhenUsed) then ifnil({self.}XmlChildUnhideWhenUsed) ? {self.}UnhideWhenUsed.Copy(_obj.XmlChildUnhideWhenUsed) : {self.}XmlChildUnhideWhenUsed.Copy(_obj.XmlChildUnhideWhenUsed); if not ifnil(_obj.XmlChildQFormat) then ifnil({self.}XmlChildQFormat) ? {self.}QFormat.Copy(_obj.XmlChildQFormat) : {self.}XmlChildQFormat.Copy(_obj.XmlChildQFormat); if not ifnil(_obj.XmlChildRsid) then ifnil({self.}XmlChildRsid) ? {self.}Rsid.Copy(_obj.XmlChildRsid) : {self.}XmlChildRsid.Copy(_obj.XmlChildRsid); if not ifnil(_obj.XmlChildPPr) then {self.}PPr.Copy(_obj.XmlChildPPr); if not ifnil(_obj.XmlChildRPr) then {self.}RPr.Copy(_obj.XmlChildRPr); if not ifnil(_obj.XmlChildTblPr) then {self.}TblPr.Copy(_obj.XmlChildTblPr); if not ifnil(_obj.XmlChildTrPr) then {self.}TrPr.Copy(_obj.XmlChildTrPr); if not ifnil(_obj.XmlChildTcPr) then {self.}TcPr.Copy(_obj.XmlChildTcPr); tslassigning := tslassigning_backup; end; function Style.ReadXmlAttrType(); begin return {self.}XmlAttrType.Value; end; function Style.WriteXmlAttrType(_value); begin if ifnil({self.}XmlAttrType) then begin {self.}XmlAttrType := new OpenXmlAttribute({self.}Prefix, "type", nil); attributes_[length(attributes_)] := {self.}XmlAttrType; end {self.}XmlAttrType.Value := _value; end; function Style.ReadXmlAttrDefault(); begin return {self.}XmlAttrDefault.Value; end; function Style.WriteXmlAttrDefault(_value); begin if ifnil({self.}XmlAttrDefault) then begin {self.}XmlAttrDefault := new OpenXmlAttribute({self.}Prefix, "default", nil); attributes_[length(attributes_)] := {self.}XmlAttrDefault; end {self.}XmlAttrDefault.Value := _value; end; function Style.ReadXmlAttrStyleId(); begin return {self.}XmlAttrStyleId.Value; end; function Style.WriteXmlAttrStyleId(_value); begin if ifnil({self.}XmlAttrStyleId) then begin {self.}XmlAttrStyleId := new OpenXmlAttribute({self.}Prefix, "styleId", nil); attributes_[length(attributes_)] := {self.}XmlAttrStyleId; end {self.}XmlAttrStyleId.Value := _value; end; function Style.ReadXmlChildSemiHidden(); begin if tslassigning and ifnil({self.}XmlChildSemiHidden) then begin {self.}XmlChildSemiHidden := new OpenXmlEmpty(self, {self.}Prefix, "semiHidden"); container_.Set({self.}XmlChildSemiHidden); return {self.}XmlChildSemiHidden; end return {self.}XmlChildSemiHidden.BoolValue(); end; function Style.WriteXmlChildSemiHidden(_value); begin if ifnil({self.}XmlChildSemiHidden) then begin {self.}XmlChildSemiHidden := new OpenXmlEmpty(self, {self.}Prefix, "semiHidden"); container_.Set({self.}XmlChildSemiHidden); end {self.}XmlChildSemiHidden.Value := _value; end; function Style.ReadXmlChildUnhideWhenUsed(); begin if tslassigning and ifnil({self.}XmlChildUnhideWhenUsed) then begin {self.}XmlChildUnhideWhenUsed := new OpenXmlEmpty(self, {self.}Prefix, "unhideWhenUsed"); container_.Set({self.}XmlChildUnhideWhenUsed); return {self.}XmlChildUnhideWhenUsed; end return {self.}XmlChildUnhideWhenUsed.BoolValue(); end; function Style.WriteXmlChildUnhideWhenUsed(_value); begin if ifnil({self.}XmlChildUnhideWhenUsed) then begin {self.}XmlChildUnhideWhenUsed := new OpenXmlEmpty(self, {self.}Prefix, "unhideWhenUsed"); container_.Set({self.}XmlChildUnhideWhenUsed); end {self.}XmlChildUnhideWhenUsed.Value := _value; end; function Style.ReadXmlChildQFormat(); begin if tslassigning and ifnil({self.}XmlChildQFormat) then begin {self.}XmlChildQFormat := new OpenXmlEmpty(self, {self.}Prefix, "qFormat"); container_.Set({self.}XmlChildQFormat); return {self.}XmlChildQFormat; end return {self.}XmlChildQFormat.BoolValue(); end; function Style.WriteXmlChildQFormat(_value); begin if ifnil({self.}XmlChildQFormat) then begin {self.}XmlChildQFormat := new OpenXmlEmpty(self, {self.}Prefix, "qFormat"); container_.Set({self.}XmlChildQFormat); end {self.}XmlChildQFormat.Value := _value; end; function Style.ReadXmlChildRsid(); begin if tslassigning and ifnil({self.}XmlChildRsid) then begin {self.}XmlChildRsid := new OpenXmlEmpty(self, {self.}Prefix, "rsid"); container_.Set({self.}XmlChildRsid); return {self.}XmlChildRsid; end return {self.}XmlChildRsid.BoolValue(); end; function Style.WriteXmlChildRsid(_value); begin if ifnil({self.}XmlChildRsid) then begin {self.}XmlChildRsid := new OpenXmlEmpty(self, {self.}Prefix, "rsid"); container_.Set({self.}XmlChildRsid); end {self.}XmlChildRsid.Value := _value; end; function Style.ReadXmlChildName(); begin if tslassigning and ifnil({self.}XmlChildName) then begin {self.}XmlChildName := new PureWVal(self, {self.}Prefix, "name"); container_.Set({self.}XmlChildName); end return {self.}XmlChildName; end; function Style.ReadXmlChildBasedOn(); begin if tslassigning and ifnil({self.}XmlChildBasedOn) then begin {self.}XmlChildBasedOn := new PureWVal(self, {self.}Prefix, "basedOn"); container_.Set({self.}XmlChildBasedOn); end return {self.}XmlChildBasedOn; end; function Style.ReadXmlChildNext(); begin if tslassigning and ifnil({self.}XmlChildNext) then begin {self.}XmlChildNext := new PureWVal(self, {self.}Prefix, "next"); container_.Set({self.}XmlChildNext); end return {self.}XmlChildNext; end; function Style.ReadXmlChildAutoRedefine(); begin if tslassigning and ifnil({self.}XmlChildAutoRedefine) then begin {self.}XmlChildAutoRedefine := new PureWVal(self, {self.}Prefix, "autoRedefine"); container_.Set({self.}XmlChildAutoRedefine); end return {self.}XmlChildAutoRedefine; end; function Style.ReadXmlChildLink(); begin if tslassigning and ifnil({self.}XmlChildLink) then begin {self.}XmlChildLink := new PureWVal(self, {self.}Prefix, "link"); container_.Set({self.}XmlChildLink); end return {self.}XmlChildLink; end; function Style.ReadXmlChildUIPriority(); begin if tslassigning and ifnil({self.}XmlChildUIPriority) then begin {self.}XmlChildUIPriority := new PureWVal(self, {self.}Prefix, "uiPriority"); container_.Set({self.}XmlChildUIPriority); end return {self.}XmlChildUIPriority; end; function Style.ReadXmlChildPPr(); begin if tslassigning and ifnil({self.}XmlChildPPr) then begin {self.}XmlChildPPr := new PPr(self, {self.}Prefix, "pPr"); container_.Set({self.}XmlChildPPr); end return {self.}XmlChildPPr; end; function Style.ReadXmlChildRPr(); begin if tslassigning and ifnil({self.}XmlChildRPr) then begin {self.}XmlChildRPr := new RPr(self, {self.}Prefix, "rPr"); container_.Set({self.}XmlChildRPr); end return {self.}XmlChildRPr; end; function Style.ReadXmlChildTblPr(); begin if tslassigning and ifnil({self.}XmlChildTblPr) then begin {self.}XmlChildTblPr := new TblPr(self, {self.}Prefix, "tblPr"); container_.Set({self.}XmlChildTblPr); end return {self.}XmlChildTblPr; end; function Style.ReadXmlChildTrPr(); begin if tslassigning and ifnil({self.}XmlChildTrPr) then begin {self.}XmlChildTrPr := new TrPr(self, {self.}Prefix, "trPr"); container_.Set({self.}XmlChildTrPr); end return {self.}XmlChildTrPr; end; function Style.ReadXmlChildTcPr(); begin if tslassigning and ifnil({self.}XmlChildTcPr) then begin {self.}XmlChildTcPr := new TcPr(self, {self.}Prefix, "tcPr"); container_.Set({self.}XmlChildTcPr); end return {self.}XmlChildTcPr; end; function Style.ReadTblStylePrs(_index); begin ind := ifnil(_index) ? -2 : _index; pre := {self.}Prefix ? {self.}Prefix + ":" : ""; return container_.Get(pre + "tblStylePr", ind); end; function Style.AddTblStylePr(): TblStylePr; begin obj := new TblStylePr(self, {self.}Prefix, "tblStylePr"); container_.Insert(obj); return obj; end; function Style.AppendTblStylePr(): TblStylePr; begin obj := new TblStylePr(self, {self.}Prefix, "tblStylePr"); container_.Append(obj); return obj; end;