OfficeXml/autoclass/docx/Object@DOCX.tsf

170 lines
5.1 KiB
Plaintext

type Object = 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: Object);override;
public
// attributes property
property DxaOrig read ReadXmlAttrDxaOrig write WriteXmlAttrDxaOrig;
property DyaOrig read ReadXmlAttrDyaOrig write WriteXmlAttrDyaOrig;
property AnchorId read ReadXmlAttrAnchorId write WriteXmlAttrAnchorId;
function ReadXmlAttrDxaOrig();
function WriteXmlAttrDxaOrig(_value);
function ReadXmlAttrDyaOrig();
function WriteXmlAttrDyaOrig(_value);
function ReadXmlAttrAnchorId();
function WriteXmlAttrAnchorId(_value);
// normal property
property Shapetype read ReadXmlChildShapetype;
property Shape read ReadXmlChildShape;
property OLEObject read ReadXmlChildOLEObject;
function ReadXmlChildShapetype();
function ReadXmlChildShape();
function ReadXmlChildOLEObject();
public
// Attributes
XmlAttrDxaOrig: OpenXmlAttribute;
XmlAttrDyaOrig: OpenXmlAttribute;
XmlAttrAnchorId: OpenXmlAttribute;
// Children
XmlChildShapetype: Shapetype;
XmlChildShape: Shape;
XmlChildOLEObject: OLEObject;
end;
function Object.Create();overload;
begin
{self.}Create(nil, "w", "object");
end;
function Object.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Object.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 Object.Init();override;
begin
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
attributes_ := array();
attributes_pf_ := array(
pre + "dxaOrig": makeweakref(thisFunction(WriteXmlAttrDxaOrig)),
pre + "dyaOrig": makeweakref(thisFunction(WriteXmlAttrDyaOrig)),
"w14:anchorId": makeweakref(thisFunction(WriteXmlAttrAnchorId)),
);
sorted_child_ := array(
"v:shapetype": array(0, makeweakref(thisFunction(ReadXmlChildShapetype))),
"v:shape": array(1, makeweakref(thisFunction(ReadXmlChildShape))),
"o:OLEObject": array(2, makeweakref(thisFunction(ReadXmlChildOLEObject))),
);
container_ := new TSOfficeContainer(sorted_child_);
end;
function Object.Copy(_obj: Object);override;
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
class(OpenXmlElement).Copy(_obj);
if not ifnil(_obj.DxaOrig) then
{self.}DxaOrig := _obj.DxaOrig;
if not ifnil(_obj.DyaOrig) then
{self.}DyaOrig := _obj.DyaOrig;
if not ifnil(_obj.AnchorId) then
{self.}AnchorId := _obj.AnchorId;
if not ifnil(_obj.XmlChildShapetype) then
{self.}Shapetype.Copy(_obj.XmlChildShapetype);
if not ifnil(_obj.XmlChildShape) then
{self.}Shape.Copy(_obj.XmlChildShape);
if not ifnil(_obj.XmlChildOLEObject) then
{self.}OLEObject.Copy(_obj.XmlChildOLEObject);
tslassigning := tslassigning_backup;
end;
function Object.ReadXmlAttrDxaOrig();
begin
return {self.}XmlAttrDxaOrig.Value;
end;
function Object.WriteXmlAttrDxaOrig(_value);
begin
if ifnil({self.}XmlAttrDxaOrig) then
begin
{self.}XmlAttrDxaOrig := new OpenXmlAttribute({self.}Prefix, "dxaOrig", nil);
attributes_[length(attributes_)] := {self.}XmlAttrDxaOrig;
end
{self.}XmlAttrDxaOrig.Value := _value;
end;
function Object.ReadXmlAttrDyaOrig();
begin
return {self.}XmlAttrDyaOrig.Value;
end;
function Object.WriteXmlAttrDyaOrig(_value);
begin
if ifnil({self.}XmlAttrDyaOrig) then
begin
{self.}XmlAttrDyaOrig := new OpenXmlAttribute({self.}Prefix, "dyaOrig", nil);
attributes_[length(attributes_)] := {self.}XmlAttrDyaOrig;
end
{self.}XmlAttrDyaOrig.Value := _value;
end;
function Object.ReadXmlAttrAnchorId();
begin
return {self.}XmlAttrAnchorId.Value;
end;
function Object.WriteXmlAttrAnchorId(_value);
begin
if ifnil({self.}XmlAttrAnchorId) then
begin
{self.}XmlAttrAnchorId := new OpenXmlAttribute("w14", "anchorId", nil);
attributes_[length(attributes_)] := {self.}XmlAttrAnchorId;
end
{self.}XmlAttrAnchorId.Value := _value;
end;
function Object.ReadXmlChildShapetype();
begin
if tslassigning and ifnil({self.}XmlChildShapetype) then
begin
{self.}XmlChildShapetype := new Shapetype(self, "v", "shapetype");
container_.Set({self.}XmlChildShapetype);
end
return {self.}XmlChildShapetype;
end;
function Object.ReadXmlChildShape();
begin
if tslassigning and ifnil({self.}XmlChildShape) then
begin
{self.}XmlChildShape := new Shape(self, "v", "shape");
container_.Set({self.}XmlChildShape);
end
return {self.}XmlChildShape;
end;
function Object.ReadXmlChildOLEObject();
begin
if tslassigning and ifnil({self.}XmlChildOLEObject) then
begin
{self.}XmlChildOLEObject := new OLEObject(self, "o", "OLEObject");
container_.Set({self.}XmlChildOLEObject);
end
return {self.}XmlChildOLEObject;
end;