OfficeXml/autoclass/docx/Anchor@DOCX.tsf

380 lines
12 KiB
Plaintext

type Anchor = 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: Anchor);override;
property DistT read ReadXmlAttrDistT write WriteXmlAttrDistT;
property DistB read ReadXmlAttrDistB write WriteXmlAttrDistB;
property DistL read ReadXmlAttrDistL write WriteXmlAttrDistL;
property DistR read ReadXmlAttrDistR write WriteXmlAttrDistR;
property SimplePos read ReadXmlAttrSimplePos write WriteXmlAttrSimplePos;
property RelativeHeight read ReadXmlAttrRelativeHeight write WriteXmlAttrRelativeHeight;
property BehindDoc read ReadXmlAttrBehindDoc write WriteXmlAttrBehindDoc;
property Locked read ReadXmlAttrLocked write WriteXmlAttrLocked;
property LayoutInCell read ReadXmlAttrLayoutInCell write WriteXmlAttrLayoutInCell;
property AllowOverlap read ReadXmlAttrAllowOverlap write WriteXmlAttrAllowOverlap;
property AnchorId read ReadXmlAttrAnchorId write WriteXmlAttrAnchorId;
property EditId read ReadXmlAttrEditId write WriteXmlAttrEditId;
function ReadXmlAttrDistT();
function WriteXmlAttrDistT(_value);
function ReadXmlAttrDistB();
function WriteXmlAttrDistB(_value);
function ReadXmlAttrDistL();
function WriteXmlAttrDistL(_value);
function ReadXmlAttrDistR();
function WriteXmlAttrDistR(_value);
function ReadXmlAttrSimplePos();
function WriteXmlAttrSimplePos(_value);
function ReadXmlAttrRelativeHeight();
function WriteXmlAttrRelativeHeight(_value);
function ReadXmlAttrBehindDoc();
function WriteXmlAttrBehindDoc(_value);
function ReadXmlAttrLocked();
function WriteXmlAttrLocked(_value);
function ReadXmlAttrLayoutInCell();
function WriteXmlAttrLayoutInCell(_value);
function ReadXmlAttrAllowOverlap();
function WriteXmlAttrAllowOverlap(_value);
function ReadXmlAttrAnchorId();
function WriteXmlAttrAnchorId(_value);
function ReadXmlAttrEditId();
function WriteXmlAttrEditId(_value);
property WrapNone read ReadXmlChildWrapNone write WriteXmlChildWrapNone;
function ReadXmlChildWrapNone();
function WriteXmlChildWrapNone(_value);
public
// Attributes
XmlAttrDistT: OpenXmlAttribute;
XmlAttrDistB: OpenXmlAttribute;
XmlAttrDistL: OpenXmlAttribute;
XmlAttrDistR: OpenXmlAttribute;
XmlAttrSimplePos: OpenXmlAttribute;
XmlAttrRelativeHeight: OpenXmlAttribute;
XmlAttrBehindDoc: OpenXmlAttribute;
XmlAttrLocked: OpenXmlAttribute;
XmlAttrLayoutInCell: OpenXmlAttribute;
XmlAttrAllowOverlap: OpenXmlAttribute;
XmlAttrAnchorId: OpenXmlAttribute;
XmlAttrEditId: OpenXmlAttribute;
// Children
SimplePos: XY;
PositionH: PositionH;
PositionV: PositionV;
Extent: CXY;
EffectExtent: EffectExtent;
XmlChildWrapNone: OpenXmlEmpty;
DocPr: DocPr;
CNvGraphicFramePr: CNvGraphicFramePr;
Graphic: Graphic;
SizeRelH: SizeRelH;
SizeRelV: SizeRelV;
end;
function Anchor.Create();overload;
begin
{self.}Create(nil, "wp", "anchor");
end;
function Anchor.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Anchor.Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
begin
class(OpenXmlElement).Create(_parent, _prefix, _local_name);
end;
function Anchor.Init();override;
begin
{self.}XmlAttrDistT := new OpenXmlAttribute(nil, "distT", nil);
{self.}XmlAttrDistB := new OpenXmlAttribute(nil, "distB", nil);
{self.}XmlAttrDistL := new OpenXmlAttribute(nil, "distL", nil);
{self.}XmlAttrDistR := new OpenXmlAttribute(nil, "distR", nil);
{self.}XmlAttrSimplePos := new OpenXmlAttribute(nil, "simplePos", nil);
{self.}XmlAttrRelativeHeight := new OpenXmlAttribute(nil, "relativeHeight", nil);
{self.}XmlAttrBehindDoc := new OpenXmlAttribute(nil, "behindDoc", nil);
{self.}XmlAttrLocked := new OpenXmlAttribute(nil, "locked", nil);
{self.}XmlAttrLayoutInCell := new OpenXmlAttribute(nil, "layoutInCell", nil);
{self.}XmlAttrAllowOverlap := new OpenXmlAttribute(nil, "allowOverlap", nil);
{self.}XmlAttrAnchorId := new OpenXmlAttribute("wp14", "anchorId", nil);
{self.}XmlAttrEditId := new OpenXmlAttribute("wp14", "editId", nil);
{self.}SimplePos := new XY(self, {self.}Prefix, "simplePos");
{self.}PositionH := new PositionH(self, {self.}Prefix, "positionH");
{self.}PositionV := new PositionV(self, {self.}Prefix, "positionV");
{self.}Extent := new CXY(self, {self.}Prefix, "extent");
{self.}EffectExtent := new EffectExtent(self, {self.}Prefix, "effectExtent");
{self.}XmlChildWrapNone := new OpenXmlEmpty(self, {self.}Prefix, "wrapNone");
{self.}DocPr := new DocPr(self, {self.}Prefix, "docPr");
{self.}CNvGraphicFramePr := new CNvGraphicFramePr(self, {self.}Prefix, "cNvGraphicFramePr");
{self.}Graphic := new Graphic(self, "a", "graphic");
{self.}SizeRelH := new SizeRelH(self, "wp14", "sizeRelH");
{self.}SizeRelV := new SizeRelV(self, "wp14", "sizeRelV");
end;
function Anchor.InitAttributes();override;
begin
attributes_ := array(
{self.}XmlAttrDistT,
{self.}XmlAttrDistB,
{self.}XmlAttrDistL,
{self.}XmlAttrDistR,
{self.}XmlAttrSimplePos,
{self.}XmlAttrRelativeHeight,
{self.}XmlAttrBehindDoc,
{self.}XmlAttrLocked,
{self.}XmlAttrLayoutInCell,
{self.}XmlAttrAllowOverlap,
{self.}XmlAttrAnchorId,
{self.}XmlAttrEditId,
);
end;
function Anchor.InitChildren();override;
begin
child_elements_ := array(
0: {self.}SimplePos,
1: {self.}PositionH,
2: {self.}PositionV,
3: {self.}Extent,
4: {self.}EffectExtent,
5: {self.}XmlChildWrapNone,
6: {self.}DocPr,
7: {self.}CNvGraphicFramePr,
8: {self.}Graphic,
9: {self.}SizeRelH,
10: {self.}SizeRelV,
);
sorted_child_ := array(
"": -1,
{self.}SimplePos.ElementName: 0,
{self.}PositionH.ElementName: 1,
{self.}PositionV.ElementName: 2,
{self.}Extent.ElementName: 3,
{self.}EffectExtent.ElementName: 4,
{self.}XmlChildWrapNone.ElementName: 5,
{self.}DocPr.ElementName: 6,
{self.}CNvGraphicFramePr.ElementName: 7,
{self.}Graphic.ElementName: 8,
{self.}SizeRelH.ElementName: 9,
{self.}SizeRelV.ElementName: 10,
);
end;
function Anchor.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 Anchor.Copy(_obj: Anchor);override;
begin
if not ifnil(_obj.XmlAttrDistT.Value) then
{self.}XmlAttrDistT.Value := _obj.XmlAttrDistT.Value;
if not ifnil(_obj.XmlAttrDistB.Value) then
{self.}XmlAttrDistB.Value := _obj.XmlAttrDistB.Value;
if not ifnil(_obj.XmlAttrDistL.Value) then
{self.}XmlAttrDistL.Value := _obj.XmlAttrDistL.Value;
if not ifnil(_obj.XmlAttrDistR.Value) then
{self.}XmlAttrDistR.Value := _obj.XmlAttrDistR.Value;
if not ifnil(_obj.XmlAttrSimplePos.Value) then
{self.}XmlAttrSimplePos.Value := _obj.XmlAttrSimplePos.Value;
if not ifnil(_obj.XmlAttrRelativeHeight.Value) then
{self.}XmlAttrRelativeHeight.Value := _obj.XmlAttrRelativeHeight.Value;
if not ifnil(_obj.XmlAttrBehindDoc.Value) then
{self.}XmlAttrBehindDoc.Value := _obj.XmlAttrBehindDoc.Value;
if not ifnil(_obj.XmlAttrLocked.Value) then
{self.}XmlAttrLocked.Value := _obj.XmlAttrLocked.Value;
if not ifnil(_obj.XmlAttrLayoutInCell.Value) then
{self.}XmlAttrLayoutInCell.Value := _obj.XmlAttrLayoutInCell.Value;
if not ifnil(_obj.XmlAttrAllowOverlap.Value) then
{self.}XmlAttrAllowOverlap.Value := _obj.XmlAttrAllowOverlap.Value;
if not ifnil(_obj.XmlAttrAnchorId.Value) then
{self.}XmlAttrAnchorId.Value := _obj.XmlAttrAnchorId.Value;
if not ifnil(_obj.XmlAttrEditId.Value) then
{self.}XmlAttrEditId.Value := _obj.XmlAttrEditId.Value;
{self.}SimplePos.Copy(_obj.SimplePos);
{self.}PositionH.Copy(_obj.PositionH);
{self.}PositionV.Copy(_obj.PositionV);
{self.}Extent.Copy(_obj.Extent);
{self.}EffectExtent.Copy(_obj.EffectExtent);
{self.}XmlChildWrapNone.Copy(_obj.XmlChildWrapNone);
{self.}DocPr.Copy(_obj.DocPr);
{self.}CNvGraphicFramePr.Copy(_obj.CNvGraphicFramePr);
{self.}Graphic.Copy(_obj.Graphic);
{self.}SizeRelH.Copy(_obj.SizeRelH);
{self.}SizeRelV.Copy(_obj.SizeRelV);
end;
function Anchor.ReadXmlAttrDistT();
begin
return {self.}XmlAttrDistT.Value;
end;
function Anchor.WriteXmlAttrDistT(_value);
begin
{self.}XmlAttrDistT.Value := _value;
end;
function Anchor.ReadXmlAttrDistB();
begin
return {self.}XmlAttrDistB.Value;
end;
function Anchor.WriteXmlAttrDistB(_value);
begin
{self.}XmlAttrDistB.Value := _value;
end;
function Anchor.ReadXmlAttrDistL();
begin
return {self.}XmlAttrDistL.Value;
end;
function Anchor.WriteXmlAttrDistL(_value);
begin
{self.}XmlAttrDistL.Value := _value;
end;
function Anchor.ReadXmlAttrDistR();
begin
return {self.}XmlAttrDistR.Value;
end;
function Anchor.WriteXmlAttrDistR(_value);
begin
{self.}XmlAttrDistR.Value := _value;
end;
function Anchor.ReadXmlAttrSimplePos();
begin
return {self.}XmlAttrSimplePos.Value;
end;
function Anchor.WriteXmlAttrSimplePos(_value);
begin
{self.}XmlAttrSimplePos.Value := _value;
end;
function Anchor.ReadXmlAttrRelativeHeight();
begin
return {self.}XmlAttrRelativeHeight.Value;
end;
function Anchor.WriteXmlAttrRelativeHeight(_value);
begin
{self.}XmlAttrRelativeHeight.Value := _value;
end;
function Anchor.ReadXmlAttrBehindDoc();
begin
return {self.}XmlAttrBehindDoc.Value;
end;
function Anchor.WriteXmlAttrBehindDoc(_value);
begin
{self.}XmlAttrBehindDoc.Value := _value;
end;
function Anchor.ReadXmlAttrLocked();
begin
return {self.}XmlAttrLocked.Value;
end;
function Anchor.WriteXmlAttrLocked(_value);
begin
{self.}XmlAttrLocked.Value := _value;
end;
function Anchor.ReadXmlAttrLayoutInCell();
begin
return {self.}XmlAttrLayoutInCell.Value;
end;
function Anchor.WriteXmlAttrLayoutInCell(_value);
begin
{self.}XmlAttrLayoutInCell.Value := _value;
end;
function Anchor.ReadXmlAttrAllowOverlap();
begin
return {self.}XmlAttrAllowOverlap.Value;
end;
function Anchor.WriteXmlAttrAllowOverlap(_value);
begin
{self.}XmlAttrAllowOverlap.Value := _value;
end;
function Anchor.ReadXmlAttrAnchorId();
begin
return {self.}XmlAttrAnchorId.Value;
end;
function Anchor.WriteXmlAttrAnchorId(_value);
begin
{self.}XmlAttrAnchorId.Value := _value;
end;
function Anchor.ReadXmlAttrEditId();
begin
return {self.}XmlAttrEditId.Value;
end;
function Anchor.WriteXmlAttrEditId(_value);
begin
{self.}XmlAttrEditId.Value := _value;
end;
function Anchor.ReadXmlChildWrapNone();
begin
return ifnil({self.}XmlChildWrapNone.Value) ? false : true;
end;
function Anchor.WriteXmlChildWrapNone(_value);
begin
{self.}XmlChildWrapNone.Value := _value;
end;