update autounit

This commit is contained in:
csh 2025-03-04 15:30:08 +08:00
parent 958b62f72c
commit a816a6f835
3 changed files with 129 additions and 24 deletions

View File

@ -2376,14 +2376,23 @@ public
function Copy(_obj: SdtContent);override; function Copy(_obj: SdtContent);override;
public public
// normal property
property Sdt read ReadXmlChildSdt;
function ReadXmlChildSdt(): Sdt;
// multi property // multi property
property Ps read ReadPs; property Ps read ReadPs;
property Rs read ReadRs;
function ReadPs(_index); function ReadPs(_index);
function ReadRs(_index);
function AddP(): P; function AddP(): P;
function AddR(): R;
function AppendP(): P; function AppendP(): P;
function AppendR(): R;
public public
// Children // Children
XmlChildSdt: Sdt;
end; end;
type SectPr = class(OpenXmlElement) type SectPr = class(OpenXmlElement)
@ -3045,9 +3054,11 @@ public
property Pos read ReadXmlChildPos; property Pos read ReadXmlChildPos;
property NumFmt read ReadXmlChildNumFmt; property NumFmt read ReadXmlChildNumFmt;
property NumStart read ReadXmlChildNumStart; property NumStart read ReadXmlChildNumStart;
property NumRestart read ReadXmlChildNumRestart;
function ReadXmlChildPos(): PureWVal; function ReadXmlChildPos(): PureWVal;
function ReadXmlChildNumFmt(): PureWVal; function ReadXmlChildNumFmt(): PureWVal;
function ReadXmlChildNumStart(): PureWVal; function ReadXmlChildNumStart(): PureWVal;
function ReadXmlChildNumRestart(): PureWVal;
// multi property // multi property
property Footnotes read ReadFootnotes; property Footnotes read ReadFootnotes;
@ -3060,6 +3071,7 @@ public
XmlChildPos: PureWVal; XmlChildPos: PureWVal;
XmlChildNumFmt: PureWVal; XmlChildNumFmt: PureWVal;
XmlChildNumStart: PureWVal; XmlChildNumStart: PureWVal;
XmlChildNumRestart: PureWVal;
end; end;
type EndnotePr = class(OpenXmlElement) type EndnotePr = class(OpenXmlElement)
@ -3075,21 +3087,24 @@ public
property Pos read ReadXmlChildPos; property Pos read ReadXmlChildPos;
property NumFmt read ReadXmlChildNumFmt; property NumFmt read ReadXmlChildNumFmt;
property NumStart read ReadXmlChildNumStart; property NumStart read ReadXmlChildNumStart;
property NumRestart read ReadXmlChildNumRestart;
function ReadXmlChildPos(): PureWVal; function ReadXmlChildPos(): PureWVal;
function ReadXmlChildNumFmt(): PureWVal; function ReadXmlChildNumFmt(): PureWVal;
function ReadXmlChildNumStart(): PureWVal; function ReadXmlChildNumStart(): PureWVal;
function ReadXmlChildNumRestart(): PureWVal;
// multi property // multi property
property Endnotes read ReadEndnotes; property Footnotes read ReadFootnotes;
function ReadEndnotes(_index); function ReadFootnotes(_index);
function AddEndnote(): Endnote; function AddFootnote(): Footnote;
function AppendEndnote(): Endnote; function AppendFootnote(): Footnote;
public public
// Children // Children
XmlChildPos: PureWVal; XmlChildPos: PureWVal;
XmlChildNumFmt: PureWVal; XmlChildNumFmt: PureWVal;
XmlChildNumStart: PureWVal; XmlChildNumStart: PureWVal;
XmlChildNumRestart: PureWVal;
end; end;
type Compat = class(OpenXmlElement) type Compat = class(OpenXmlElement)
@ -3860,6 +3875,10 @@ public
function ReadXmlAttrIgnorable(); function ReadXmlAttrIgnorable();
function WriteXmlAttrIgnorable(_value); function WriteXmlAttrIgnorable(_value);
// normal property
property Sdt read ReadXmlChildSdt;
function ReadXmlChildSdt(): Sdt;
// multi property // multi property
property Ps read ReadPs; property Ps read ReadPs;
function ReadPs(_index); function ReadPs(_index);
@ -3871,6 +3890,7 @@ public
XmlAttrIgnorable: OpenXmlAttribute; XmlAttrIgnorable: OpenXmlAttribute;
// Children // Children
XmlChildSdt: Sdt;
end; end;
type Hdr = class(OpenXmlElement) type Hdr = class(OpenXmlElement)
@ -12772,6 +12792,8 @@ begin
); );
sorted_child_ := array( sorted_child_ := array(
pre + "p": array(0, makeweakref(thisFunction(AppendP))), pre + "p": array(0, makeweakref(thisFunction(AppendP))),
pre + "r": array(1, makeweakref(thisFunction(AppendR))),
pre + "sdt": array(2, makeweakref(thisFunction(ReadXmlChildSdt))),
); );
container_ := new TSOfficeContainer(sorted_child_); container_ := new TSOfficeContainer(sorted_child_);
end; end;
@ -12781,9 +12803,21 @@ begin
tslassigning_backup := tslassigning; tslassigning_backup := tslassigning;
tslassigning := 1; tslassigning := 1;
class(OpenXmlElement).Copy(_obj); class(OpenXmlElement).Copy(_obj);
if not ifnil(_obj.XmlChildSdt) then
{self.}Sdt.Copy(_obj.XmlChildSdt);
tslassigning := tslassigning_backup; tslassigning := tslassigning_backup;
end; end;
function SdtContent.ReadXmlChildSdt(): Sdt;
begin
if tslassigning and ifnil({self.}XmlChildSdt) then
begin
{self.}XmlChildSdt := new Sdt(self, {self.}Prefix, "sdt");
container_.Set({self.}XmlChildSdt);
end
return {self.}XmlChildSdt;
end;
function SdtContent.ReadPs(_index); function SdtContent.ReadPs(_index);
begin begin
ind := ifnil(_index) ? -2 : _index; ind := ifnil(_index) ? -2 : _index;
@ -12791,6 +12825,13 @@ begin
return container_.Get(pre + "p", ind); return container_.Get(pre + "p", ind);
end; end;
function SdtContent.ReadRs(_index);
begin
ind := ifnil(_index) ? -2 : _index;
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
return container_.Get(pre + "r", ind);
end;
function SdtContent.AddP(): P; function SdtContent.AddP(): P;
begin begin
obj := new P(self, {self.}Prefix, "p"); obj := new P(self, {self.}Prefix, "p");
@ -12798,6 +12839,13 @@ begin
return obj; return obj;
end; end;
function SdtContent.AddR(): R;
begin
obj := new R(self, {self.}Prefix, "r");
container_.Insert(obj);
return obj;
end;
function SdtContent.AppendP(): P; function SdtContent.AppendP(): P;
begin begin
obj := new P(self, {self.}Prefix, "p"); obj := new P(self, {self.}Prefix, "p");
@ -12805,6 +12853,13 @@ begin
return obj; return obj;
end; end;
function SdtContent.AppendR(): R;
begin
obj := new R(self, {self.}Prefix, "r");
container_.Append(obj);
return obj;
end;
function SectPr.Create();overload; function SectPr.Create();overload;
begin begin
{self.}Create(nil, "w", "sectPr"); {self.}Create(nil, "w", "sectPr");
@ -15044,7 +15099,8 @@ begin
pre + "pos": array(0, makeweakref(thisFunction(ReadXmlChildPos))), pre + "pos": array(0, makeweakref(thisFunction(ReadXmlChildPos))),
pre + "numFmt": array(1, makeweakref(thisFunction(ReadXmlChildNumFmt))), pre + "numFmt": array(1, makeweakref(thisFunction(ReadXmlChildNumFmt))),
pre + "numStart": array(2, makeweakref(thisFunction(ReadXmlChildNumStart))), pre + "numStart": array(2, makeweakref(thisFunction(ReadXmlChildNumStart))),
pre + "footnote": array(3, makeweakref(thisFunction(AppendFootnote))), pre + "numRestart": array(3, makeweakref(thisFunction(ReadXmlChildNumRestart))),
pre + "footnote": array(4, makeweakref(thisFunction(AppendFootnote))),
); );
container_ := new TSOfficeContainer(sorted_child_); container_ := new TSOfficeContainer(sorted_child_);
end; end;
@ -15060,6 +15116,8 @@ begin
{self.}NumFmt.Copy(_obj.XmlChildNumFmt); {self.}NumFmt.Copy(_obj.XmlChildNumFmt);
if not ifnil(_obj.XmlChildNumStart) then if not ifnil(_obj.XmlChildNumStart) then
{self.}NumStart.Copy(_obj.XmlChildNumStart); {self.}NumStart.Copy(_obj.XmlChildNumStart);
if not ifnil(_obj.XmlChildNumRestart) then
{self.}NumRestart.Copy(_obj.XmlChildNumRestart);
tslassigning := tslassigning_backup; tslassigning := tslassigning_backup;
end; end;
@ -15093,6 +15151,16 @@ begin
return {self.}XmlChildNumStart; return {self.}XmlChildNumStart;
end; end;
function FootnotePr.ReadXmlChildNumRestart(): PureWVal;
begin
if tslassigning and ifnil({self.}XmlChildNumRestart) then
begin
{self.}XmlChildNumRestart := new PureWVal(self, {self.}Prefix, "numRestart");
container_.Set({self.}XmlChildNumRestart);
end
return {self.}XmlChildNumRestart;
end;
function FootnotePr.ReadFootnotes(_index); function FootnotePr.ReadFootnotes(_index);
begin begin
ind := ifnil(_index) ? -2 : _index; ind := ifnil(_index) ? -2 : _index;
@ -15140,7 +15208,8 @@ begin
pre + "pos": array(0, makeweakref(thisFunction(ReadXmlChildPos))), pre + "pos": array(0, makeweakref(thisFunction(ReadXmlChildPos))),
pre + "numFmt": array(1, makeweakref(thisFunction(ReadXmlChildNumFmt))), pre + "numFmt": array(1, makeweakref(thisFunction(ReadXmlChildNumFmt))),
pre + "numStart": array(2, makeweakref(thisFunction(ReadXmlChildNumStart))), pre + "numStart": array(2, makeweakref(thisFunction(ReadXmlChildNumStart))),
pre + "endnote": array(3, makeweakref(thisFunction(AppendEndnote))), pre + "numRestart": array(3, makeweakref(thisFunction(ReadXmlChildNumRestart))),
pre + "footnote": array(4, makeweakref(thisFunction(AppendFootnote))),
); );
container_ := new TSOfficeContainer(sorted_child_); container_ := new TSOfficeContainer(sorted_child_);
end; end;
@ -15156,6 +15225,8 @@ begin
{self.}NumFmt.Copy(_obj.XmlChildNumFmt); {self.}NumFmt.Copy(_obj.XmlChildNumFmt);
if not ifnil(_obj.XmlChildNumStart) then if not ifnil(_obj.XmlChildNumStart) then
{self.}NumStart.Copy(_obj.XmlChildNumStart); {self.}NumStart.Copy(_obj.XmlChildNumStart);
if not ifnil(_obj.XmlChildNumRestart) then
{self.}NumRestart.Copy(_obj.XmlChildNumRestart);
tslassigning := tslassigning_backup; tslassigning := tslassigning_backup;
end; end;
@ -15189,23 +15260,33 @@ begin
return {self.}XmlChildNumStart; return {self.}XmlChildNumStart;
end; end;
function EndnotePr.ReadEndnotes(_index); function EndnotePr.ReadXmlChildNumRestart(): PureWVal;
begin
if tslassigning and ifnil({self.}XmlChildNumRestart) then
begin
{self.}XmlChildNumRestart := new PureWVal(self, {self.}Prefix, "numRestart");
container_.Set({self.}XmlChildNumRestart);
end
return {self.}XmlChildNumRestart;
end;
function EndnotePr.ReadFootnotes(_index);
begin begin
ind := ifnil(_index) ? -2 : _index; ind := ifnil(_index) ? -2 : _index;
pre := {self.}Prefix ? {self.}Prefix + ":" : ""; pre := {self.}Prefix ? {self.}Prefix + ":" : "";
return container_.Get(pre + "endnote", ind); return container_.Get(pre + "footnote", ind);
end; end;
function EndnotePr.AddEndnote(): Endnote; function EndnotePr.AddFootnote(): Footnote;
begin begin
obj := new Endnote(self, {self.}Prefix, "endnote"); obj := new Footnote(self, {self.}Prefix, "footnote");
container_.Insert(obj); container_.Insert(obj);
return obj; return obj;
end; end;
function EndnotePr.AppendEndnote(): Endnote; function EndnotePr.AppendFootnote(): Footnote;
begin begin
obj := new Endnote(self, {self.}Prefix, "endnote"); obj := new Footnote(self, {self.}Prefix, "footnote");
container_.Append(obj); container_.Append(obj);
return obj; return obj;
end; end;
@ -17841,6 +17922,7 @@ begin
); );
sorted_child_ := array( sorted_child_ := array(
pre + "p": array(0, makeweakref(thisFunction(AppendP))), pre + "p": array(0, makeweakref(thisFunction(AppendP))),
pre + "sdt": array(1, makeweakref(thisFunction(ReadXmlChildSdt))),
); );
container_ := new TSOfficeContainer(sorted_child_); container_ := new TSOfficeContainer(sorted_child_);
end; end;
@ -17852,6 +17934,8 @@ begin
class(OpenXmlElement).Copy(_obj); class(OpenXmlElement).Copy(_obj);
if not ifnil(_obj.Ignorable) then if not ifnil(_obj.Ignorable) then
{self.}Ignorable := _obj.Ignorable; {self.}Ignorable := _obj.Ignorable;
if not ifnil(_obj.XmlChildSdt) then
{self.}Sdt.Copy(_obj.XmlChildSdt);
tslassigning := tslassigning_backup; tslassigning := tslassigning_backup;
end; end;
@ -17870,6 +17954,16 @@ begin
{self.}XmlAttrIgnorable.Value := _value; {self.}XmlAttrIgnorable.Value := _value;
end; end;
function Ftr.ReadXmlChildSdt(): Sdt;
begin
if tslassigning and ifnil({self.}XmlChildSdt) then
begin
{self.}XmlChildSdt := new Sdt(self, {self.}Prefix, "sdt");
container_.Set({self.}XmlChildSdt);
end
return {self.}XmlChildSdt;
end;
function Ftr.ReadPs(_index); function Ftr.ReadPs(_index);
begin begin
ind := ifnil(_index) ? -2 : _index; ind := ifnil(_index) ? -2 : _index;

View File

@ -74,12 +74,12 @@ public
function Create(_obj: EndnotePr); function Create(_obj: EndnotePr);
function Init(); function Init();
function GetEndnoteById(_key: string); function GetFootnoteById(_key: string);
function SetEndnoteById(_key: string; _value: tslobj); function SetFootnoteById(_key: string; _value: tslobj);
private private
object_: EndnotePr; object_: EndnotePr;
endnote_hash_: tableArray; footnote_hash_: tableArray;
end; end;
type StylesAdapter = class type StylesAdapter = class
@ -263,25 +263,25 @@ end;
function EndnotePrAdapter.Create(_obj: EndnotePr); function EndnotePrAdapter.Create(_obj: EndnotePr);
begin begin
object_ := _obj; object_ := _obj;
endnote_hash_ := array(); footnote_hash_ := array();
{self.}Init(); {self.}Init();
end; end;
function EndnotePrAdapter.Init(); function EndnotePrAdapter.Init();
begin begin
elements := object_.Endnotes(); elements := object_.Footnotes();
for k,v in elements do for k,v in elements do
endnote_hash_[v.Id] := v; footnote_hash_[v.Id] := v;
end; end;
function EndnotePrAdapter.GetEndnoteById(_key: string); function EndnotePrAdapter.GetFootnoteById(_key: string);
begin begin
return endnote_hash_[_key]; return footnote_hash_[_key];
end; end;
function EndnotePrAdapter.SetEndnoteById(_key: string; _value: tslobj); function EndnotePrAdapter.SetFootnoteById(_key: string; _value: tslobj);
begin begin
endnote_hash_[_key] := _value; footnote_hash_[_key] := _value;
end; end;
function StylesAdapter.Create(_obj: Styles); function StylesAdapter.Create(_obj: Styles);

View File

@ -3064,6 +3064,11 @@ begin
elems := object_.Ps(); elems := object_.Ps();
for _,elem in elems do for _,elem in elems do
{self.}AppendChild(new PUnitDecorator(elem)); {self.}AppendChild(new PUnitDecorator(elem));
elems := object_.Rs();
for _,elem in elems do
{self.}AppendChild(new RUnitDecorator(elem));
if not ifnil(object_.XmlChildSdt) then
{self.}XmlChildSdt := new SdtUnitDecorator(object_.XmlChildSdt);
tslassigning := tslassigning_backup; tslassigning := tslassigning_backup;
end; end;
@ -3640,6 +3645,8 @@ begin
{self.}XmlChildNumFmt := new PureWValUnitDecorator(object_.XmlChildNumFmt); {self.}XmlChildNumFmt := new PureWValUnitDecorator(object_.XmlChildNumFmt);
if not ifnil(object_.XmlChildNumStart) then if not ifnil(object_.XmlChildNumStart) then
{self.}XmlChildNumStart := new PureWValUnitDecorator(object_.XmlChildNumStart); {self.}XmlChildNumStart := new PureWValUnitDecorator(object_.XmlChildNumStart);
if not ifnil(object_.XmlChildNumRestart) then
{self.}XmlChildNumRestart := new PureWValUnitDecorator(object_.XmlChildNumRestart);
elems := object_.Footnotes(); elems := object_.Footnotes();
for _,elem in elems do for _,elem in elems do
{self.}AppendChild(new FootnoteUnitDecorator(elem)); {self.}AppendChild(new FootnoteUnitDecorator(elem));
@ -3668,9 +3675,11 @@ begin
{self.}XmlChildNumFmt := new PureWValUnitDecorator(object_.XmlChildNumFmt); {self.}XmlChildNumFmt := new PureWValUnitDecorator(object_.XmlChildNumFmt);
if not ifnil(object_.XmlChildNumStart) then if not ifnil(object_.XmlChildNumStart) then
{self.}XmlChildNumStart := new PureWValUnitDecorator(object_.XmlChildNumStart); {self.}XmlChildNumStart := new PureWValUnitDecorator(object_.XmlChildNumStart);
elems := object_.Endnotes(); if not ifnil(object_.XmlChildNumRestart) then
{self.}XmlChildNumRestart := new PureWValUnitDecorator(object_.XmlChildNumRestart);
elems := object_.Footnotes();
for _,elem in elems do for _,elem in elems do
{self.}AppendChild(new EndnoteUnitDecorator(elem)); {self.}AppendChild(new FootnoteUnitDecorator(elem));
tslassigning := tslassigning_backup; tslassigning := tslassigning_backup;
end; end;
@ -4356,6 +4365,8 @@ begin
elems := object_.Ps(); elems := object_.Ps();
for _,elem in elems do for _,elem in elems do
{self.}AppendChild(new PUnitDecorator(elem)); {self.}AppendChild(new PUnitDecorator(elem));
if not ifnil(object_.XmlChildSdt) then
{self.}XmlChildSdt := new SdtUnitDecorator(object_.XmlChildSdt);
tslassigning := tslassigning_backup; tslassigning := tslassigning_backup;
end; end;