From 87c3aa75f7598e1b5e88fd8256ad95b9c67ae05a Mon Sep 17 00:00:00 2001 From: csh Date: Wed, 5 Mar 2025 11:33:33 +0800 Subject: [PATCH] update autounit --- autounit/DocxML.tsf | 56 ++++++++++++++++++++++++-------- autounit/DocxMLUnitDecorator.tsf | 3 ++ 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/autounit/DocxML.tsf b/autounit/DocxML.tsf index e615779..f9a2c1c 100644 --- a/autounit/DocxML.tsf +++ b/autounit/DocxML.tsf @@ -1387,6 +1387,12 @@ public function ReadXmlChildObject(): Object; function ReadXmlChildFootnoteReference(): FootnoteReference; + // multi property + property Rs read ReadRs; + function ReadRs(_index); + function AddR(): R; + function AppendR(): R; + public // Attributes XmlAttrWRsidRPr: OpenXmlAttribute; @@ -9258,20 +9264,21 @@ begin "w:history": makeweakref(thisFunction(WriteXmlAttrHistory)), ); sorted_child_ := array( - pre + "rPr": array(0, makeweakref(thisFunction(ReadXmlChildRPr))), - pre + "br": array(1, makeweakref(thisFunction(ReadXmlChildBr))), - pre + "fldChar": array(2, makeweakref(thisFunction(ReadXmlChildFldChar))), - pre + "instrText": array(3, makeweakref(thisFunction(ReadXmlChildInstrText))), - pre + "separator": array(4, makeweakref(thisFunction(ReadXmlChildSeparator))), - pre + "continuationSeparator": array(5, makeweakref(thisFunction(ReadXmlChildContinuationSeparator))), - pre + "lastRenderedPageBreak": array(6, makeweakref(thisFunction(ReadXmlChildLastRenderedPageBreak))), - "mc:AlternateContent": array(7, makeweakref(thisFunction(ReadXmlChildAlternateContent))), - pre + "drawing": array(8, makeweakref(thisFunction(ReadXmlChildDrawing))), - pre + "pict": array(9, makeweakref(thisFunction(ReadXmlChildPict))), - pre + "t": array(10, makeweakref(thisFunction(ReadXmlChildT))), - pre + "object": array(11, makeweakref(thisFunction(ReadXmlChildObject))), - pre + "footnoteReference": array(12, makeweakref(thisFunction(ReadXmlChildFootnoteReference))), - pre + "footnoteRef": array(13, makeweakref(thisFunction(ReadXmlChildFootnoteRef))), + pre + "r": array(0, makeweakref(thisFunction(AppendR))), + pre + "rPr": array(1, makeweakref(thisFunction(ReadXmlChildRPr))), + pre + "br": array(2, makeweakref(thisFunction(ReadXmlChildBr))), + pre + "fldChar": array(3, makeweakref(thisFunction(ReadXmlChildFldChar))), + pre + "instrText": array(4, makeweakref(thisFunction(ReadXmlChildInstrText))), + pre + "separator": array(5, makeweakref(thisFunction(ReadXmlChildSeparator))), + pre + "continuationSeparator": array(6, makeweakref(thisFunction(ReadXmlChildContinuationSeparator))), + pre + "lastRenderedPageBreak": array(7, makeweakref(thisFunction(ReadXmlChildLastRenderedPageBreak))), + "mc:AlternateContent": array(8, makeweakref(thisFunction(ReadXmlChildAlternateContent))), + pre + "drawing": array(9, makeweakref(thisFunction(ReadXmlChildDrawing))), + pre + "pict": array(10, makeweakref(thisFunction(ReadXmlChildPict))), + pre + "t": array(11, makeweakref(thisFunction(ReadXmlChildT))), + pre + "object": array(12, makeweakref(thisFunction(ReadXmlChildObject))), + pre + "footnoteReference": array(13, makeweakref(thisFunction(ReadXmlChildFootnoteReference))), + pre + "footnoteRef": array(14, makeweakref(thisFunction(ReadXmlChildFootnoteRef))), ); container_ := new TSOfficeContainer(sorted_child_); end; @@ -9559,6 +9566,27 @@ begin return {self.}XmlChildFootnoteReference; end; +function R.ReadRs(_index); +begin + ind := ifnil(_index) ? -2 : _index; + pre := {self.}Prefix ? {self.}Prefix + ":" : ""; + return container_.Get(pre + "r", ind); +end; + +function R.AddR(): R; +begin + obj := new R(self, {self.}Prefix, "r"); + container_.Insert(obj); + return obj; +end; + +function R.AppendR(): R; +begin + obj := new R(self, {self.}Prefix, "r"); + container_.Append(obj); + return obj; +end; + function Object.Create();overload; begin {self.}Create(nil, "w", "object"); diff --git a/autounit/DocxMLUnitDecorator.tsf b/autounit/DocxMLUnitDecorator.tsf index 36b9ccc..f46dfa9 100644 --- a/autounit/DocxMLUnitDecorator.tsf +++ b/autounit/DocxMLUnitDecorator.tsf @@ -2139,6 +2139,9 @@ begin {self.}Anchor := object_.XmlAttrAnchor.Value; if not ifnil(object_.XmlAttrHistory) then {self.}History := object_.XmlAttrHistory.Value; + elems := object_.Rs(); + for _,elem in elems do + {self.}AppendChild(new RUnitDecorator(elem)); if not ifnil(object_.XmlChildRPr) then {self.}XmlChildRPr := new RPrUnitDecorator(object_.XmlChildRPr); if not ifnil(object_.XmlChildBr) then