388 lines
11 KiB
Plaintext
388 lines
11 KiB
Plaintext
type P = 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: P);override;
|
|
|
|
public
|
|
|
|
// attributes property
|
|
property W14ParaId read ReadXmlAttrW14ParaId write WriteXmlAttrW14ParaId;
|
|
property W14TextId read ReadXmlAttrW14TextId write WriteXmlAttrW14TextId;
|
|
property WRsidR read ReadXmlAttrWRsidR write WriteXmlAttrWRsidR;
|
|
property WRsidRPr read ReadXmlAttrWRsidRPr write WriteXmlAttrWRsidRPr;
|
|
property WRsidRDefault read ReadXmlAttrWRsidRDefault write WriteXmlAttrWRsidRDefault;
|
|
property WRsidP read ReadXmlAttrWRsidP write WriteXmlAttrWRsidP;
|
|
function ReadXmlAttrW14ParaId();
|
|
function WriteXmlAttrW14ParaId(_value);
|
|
function ReadXmlAttrW14TextId();
|
|
function WriteXmlAttrW14TextId(_value);
|
|
function ReadXmlAttrWRsidR();
|
|
function WriteXmlAttrWRsidR(_value);
|
|
function ReadXmlAttrWRsidRPr();
|
|
function WriteXmlAttrWRsidRPr(_value);
|
|
function ReadXmlAttrWRsidRDefault();
|
|
function WriteXmlAttrWRsidRDefault(_value);
|
|
function ReadXmlAttrWRsidP();
|
|
function WriteXmlAttrWRsidP(_value);
|
|
|
|
// normal property
|
|
property PPr read ReadXmlChildPPr;
|
|
function ReadXmlChildPPr();
|
|
|
|
// multi property
|
|
property Rs read ReadRs;
|
|
property CommentRangeStarts read ReadCommentRangeStarts;
|
|
property CommentRangeEnds read ReadCommentRangeEnds;
|
|
property BookmarkStarts read ReadBookmarkStarts;
|
|
property BookmarkEnds read ReadBookmarkEnds;
|
|
property Hyperlinks read ReadHyperlinks;
|
|
property FldSimples read ReadFldSimples;
|
|
function ReadRs(_index);
|
|
function ReadCommentRangeStarts(_index);
|
|
function ReadCommentRangeEnds(_index);
|
|
function ReadBookmarkStarts(_index);
|
|
function ReadBookmarkEnds(_index);
|
|
function ReadHyperlinks(_index);
|
|
function ReadFldSimples(_index);
|
|
function AddR(): R;
|
|
function AddCommentRangeStart(): CommentRange;
|
|
function AddCommentRangeEnd(): CommentRange;
|
|
function AddBookmarkStart(): Bookmark;
|
|
function AddBookmarkEnd(): Bookmark;
|
|
function AddHyperLink(): HyperLink;
|
|
function AddFldSimple(): FldSimple;
|
|
function AppendR(): R;
|
|
function AppendCommentRangeStart(): CommentRange;
|
|
function AppendCommentRangeEnd(): CommentRange;
|
|
function AppendBookmarkStart(): Bookmark;
|
|
function AppendBookmarkEnd(): Bookmark;
|
|
function AppendHyperLink(): HyperLink;
|
|
function AppendFldSimple(): FldSimple;
|
|
|
|
public
|
|
// Attributes
|
|
XmlAttrW14ParaId: OpenXmlAttribute;
|
|
XmlAttrW14TextId: OpenXmlAttribute;
|
|
XmlAttrWRsidR: OpenXmlAttribute;
|
|
XmlAttrWRsidRPr: OpenXmlAttribute;
|
|
XmlAttrWRsidRDefault: OpenXmlAttribute;
|
|
XmlAttrWRsidP: OpenXmlAttribute;
|
|
|
|
// Children
|
|
XmlChildPPr: PPr;
|
|
|
|
end;
|
|
|
|
function P.Create();overload;
|
|
begin
|
|
{self.}Create(nil, "w", "p");
|
|
end;
|
|
|
|
function P.Create(_node: XmlNode);overload;
|
|
begin
|
|
class(OpenXmlElement).Create(_node: XmlNode);
|
|
end;
|
|
|
|
function P.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 P.Init();override;
|
|
begin
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
attributes_ := array();
|
|
attributes_pf_ := array(
|
|
"w14:paraId": makeweakref(thisFunction(WriteXmlAttrW14ParaId)),
|
|
"w14:textId": makeweakref(thisFunction(WriteXmlAttrW14TextId)),
|
|
"w:rsidR": makeweakref(thisFunction(WriteXmlAttrWRsidR)),
|
|
"w:rsidRPr": makeweakref(thisFunction(WriteXmlAttrWRsidRPr)),
|
|
"w:rsidRDefault": makeweakref(thisFunction(WriteXmlAttrWRsidRDefault)),
|
|
"w:rsidP": makeweakref(thisFunction(WriteXmlAttrWRsidP)),
|
|
);
|
|
sorted_child_ := array(
|
|
pre + "pPr": array(0, makeweakref(thisFunction(ReadXmlChildPPr))),
|
|
pre + "r": array(1, makeweakref(thisFunction(AppendR))),
|
|
pre + "commentRangeStart": array(2, makeweakref(thisFunction(AppendCommentRangeStart))),
|
|
pre + "commentRangeEnd": array(3, makeweakref(thisFunction(AppendCommentRangeEnd))),
|
|
pre + "bookmarkStart": array(4, makeweakref(thisFunction(AppendBookmarkStart))),
|
|
pre + "bookmarkEnd": array(5, makeweakref(thisFunction(AppendBookmarkEnd))),
|
|
pre + "hyperlink": array(6, makeweakref(thisFunction(AppendHyperLink))),
|
|
pre + "fldSimple": array(7, makeweakref(thisFunction(AppendFldSimple))),
|
|
);
|
|
container_ := new TSOfficeContainer(sorted_child_);
|
|
end;
|
|
|
|
function P.Copy(_obj: P);override;
|
|
begin
|
|
tslassigning_backup := tslassigning;
|
|
tslassigning := 1;
|
|
class(OpenXmlElement).Copy(_obj);
|
|
if not ifnil(_obj.W14ParaId) then
|
|
{self.}W14ParaId := _obj.W14ParaId;
|
|
if not ifnil(_obj.W14TextId) then
|
|
{self.}W14TextId := _obj.W14TextId;
|
|
if not ifnil(_obj.WRsidR) then
|
|
{self.}WRsidR := _obj.WRsidR;
|
|
if not ifnil(_obj.WRsidRPr) then
|
|
{self.}WRsidRPr := _obj.WRsidRPr;
|
|
if not ifnil(_obj.WRsidRDefault) then
|
|
{self.}WRsidRDefault := _obj.WRsidRDefault;
|
|
if not ifnil(_obj.WRsidP) then
|
|
{self.}WRsidP := _obj.WRsidP;
|
|
if not ifnil(_obj.XmlChildPPr) then
|
|
{self.}PPr.Copy(_obj.XmlChildPPr);
|
|
tslassigning := tslassigning_backup;
|
|
end;
|
|
|
|
function P.ReadXmlAttrW14ParaId();
|
|
begin
|
|
return {self.}XmlAttrW14ParaId.Value;
|
|
end;
|
|
|
|
function P.WriteXmlAttrW14ParaId(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrW14ParaId) then
|
|
begin
|
|
{self.}XmlAttrW14ParaId := new OpenXmlAttribute("w14", "paraId", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrW14ParaId;
|
|
end
|
|
{self.}XmlAttrW14ParaId.Value := _value;
|
|
end;
|
|
|
|
function P.ReadXmlAttrW14TextId();
|
|
begin
|
|
return {self.}XmlAttrW14TextId.Value;
|
|
end;
|
|
|
|
function P.WriteXmlAttrW14TextId(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrW14TextId) then
|
|
begin
|
|
{self.}XmlAttrW14TextId := new OpenXmlAttribute("w14", "textId", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrW14TextId;
|
|
end
|
|
{self.}XmlAttrW14TextId.Value := _value;
|
|
end;
|
|
|
|
function P.ReadXmlAttrWRsidR();
|
|
begin
|
|
return {self.}XmlAttrWRsidR.Value;
|
|
end;
|
|
|
|
function P.WriteXmlAttrWRsidR(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrWRsidR) then
|
|
begin
|
|
{self.}XmlAttrWRsidR := new OpenXmlAttribute("w", "rsidR", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrWRsidR;
|
|
end
|
|
{self.}XmlAttrWRsidR.Value := _value;
|
|
end;
|
|
|
|
function P.ReadXmlAttrWRsidRPr();
|
|
begin
|
|
return {self.}XmlAttrWRsidRPr.Value;
|
|
end;
|
|
|
|
function P.WriteXmlAttrWRsidRPr(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrWRsidRPr) then
|
|
begin
|
|
{self.}XmlAttrWRsidRPr := new OpenXmlAttribute("w", "rsidRPr", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrWRsidRPr;
|
|
end
|
|
{self.}XmlAttrWRsidRPr.Value := _value;
|
|
end;
|
|
|
|
function P.ReadXmlAttrWRsidRDefault();
|
|
begin
|
|
return {self.}XmlAttrWRsidRDefault.Value;
|
|
end;
|
|
|
|
function P.WriteXmlAttrWRsidRDefault(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrWRsidRDefault) then
|
|
begin
|
|
{self.}XmlAttrWRsidRDefault := new OpenXmlAttribute("w", "rsidRDefault", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrWRsidRDefault;
|
|
end
|
|
{self.}XmlAttrWRsidRDefault.Value := _value;
|
|
end;
|
|
|
|
function P.ReadXmlAttrWRsidP();
|
|
begin
|
|
return {self.}XmlAttrWRsidP.Value;
|
|
end;
|
|
|
|
function P.WriteXmlAttrWRsidP(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrWRsidP) then
|
|
begin
|
|
{self.}XmlAttrWRsidP := new OpenXmlAttribute("w", "rsidP", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrWRsidP;
|
|
end
|
|
{self.}XmlAttrWRsidP.Value := _value;
|
|
end;
|
|
|
|
function P.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 P.ReadRs(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "r", ind);
|
|
end;
|
|
|
|
function P.ReadCommentRangeStarts(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "commentRangeStart", ind);
|
|
end;
|
|
|
|
function P.ReadCommentRangeEnds(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "commentRangeEnd", ind);
|
|
end;
|
|
|
|
function P.ReadBookmarkStarts(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "bookmarkStart", ind);
|
|
end;
|
|
|
|
function P.ReadBookmarkEnds(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "bookmarkEnd", ind);
|
|
end;
|
|
|
|
function P.ReadHyperlinks(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "hyperlink", ind);
|
|
end;
|
|
|
|
function P.ReadFldSimples(_index);
|
|
begin
|
|
ind := ifnil(_index) ? -2 : _index;
|
|
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
|
|
return container_.Get(pre + "fldSimple", ind);
|
|
end;
|
|
|
|
function P.AddR(): R;
|
|
begin
|
|
obj := new R(self, {self.}Prefix, "r");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AddCommentRangeStart(): CommentRange;
|
|
begin
|
|
obj := new CommentRange(self, {self.}Prefix, "commentRangeStart");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AddCommentRangeEnd(): CommentRange;
|
|
begin
|
|
obj := new CommentRange(self, {self.}Prefix, "commentRangeEnd");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AddBookmarkStart(): Bookmark;
|
|
begin
|
|
obj := new Bookmark(self, {self.}Prefix, "bookmarkStart");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AddBookmarkEnd(): Bookmark;
|
|
begin
|
|
obj := new Bookmark(self, {self.}Prefix, "bookmarkEnd");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AddHyperLink(): HyperLink;
|
|
begin
|
|
obj := new HyperLink(self, {self.}Prefix, "hyperlink");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AddFldSimple(): FldSimple;
|
|
begin
|
|
obj := new FldSimple(self, {self.}Prefix, "fldSimple");
|
|
container_.Insert(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AppendR(): R;
|
|
begin
|
|
obj := new R(self, {self.}Prefix, "r");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AppendCommentRangeStart(): CommentRange;
|
|
begin
|
|
obj := new CommentRange(self, {self.}Prefix, "commentRangeStart");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AppendCommentRangeEnd(): CommentRange;
|
|
begin
|
|
obj := new CommentRange(self, {self.}Prefix, "commentRangeEnd");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AppendBookmarkStart(): Bookmark;
|
|
begin
|
|
obj := new Bookmark(self, {self.}Prefix, "bookmarkStart");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AppendBookmarkEnd(): Bookmark;
|
|
begin
|
|
obj := new Bookmark(self, {self.}Prefix, "bookmarkEnd");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AppendHyperLink(): HyperLink;
|
|
begin
|
|
obj := new HyperLink(self, {self.}Prefix, "hyperlink");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|
|
|
|
function P.AppendFldSimple(): FldSimple;
|
|
begin
|
|
obj := new FldSimple(self, {self.}Prefix, "fldSimple");
|
|
container_.Append(obj);
|
|
return obj;
|
|
end;
|