OfficeXml/autoclass/docx/Shape@DOCX.tsf

204 lines
5.8 KiB
Plaintext

type Shape = 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: Shape);override;
public
// attributes property
property Id read ReadXmlAttrId write WriteXmlAttrId;
property Spid read ReadXmlAttrSpid write WriteXmlAttrSpid;
property Type read ReadXmlAttrType write WriteXmlAttrType;
property Gfxdata read ReadXmlAttrGfxdata write WriteXmlAttrGfxdata;
property Filled read ReadXmlAttrFilled write WriteXmlAttrFilled;
property Stroked read ReadXmlAttrStroked write WriteXmlAttrStroked;
function ReadXmlAttrId();
function WriteXmlAttrId(_value);
function ReadXmlAttrSpid();
function WriteXmlAttrSpid(_value);
function ReadXmlAttrType();
function WriteXmlAttrType(_value);
function ReadXmlAttrGfxdata();
function WriteXmlAttrGfxdata(_value);
function ReadXmlAttrFilled();
function WriteXmlAttrFilled(_value);
function ReadXmlAttrStroked();
function WriteXmlAttrStroked(_value);
// normal property
property Textbox read ReadXmlChildTextbox;
function ReadXmlChildTextbox();
public
// Attributes
XmlAttrId: OpenXmlAttribute;
XmlAttrSpid: OpenXmlAttribute;
XmlAttrType: OpenXmlAttribute;
XmlAttrGfxdata: OpenXmlAttribute;
XmlAttrFilled: OpenXmlAttribute;
XmlAttrStroked: OpenXmlAttribute;
// Children
XmlChildTextbox: Textbox;
end;
function Shape.Create();overload;
begin
{self.}Create(nil, "v", "shape");
end;
function Shape.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Shape.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 Shape.Init();override;
begin
pre := {self.}Prefix ? {self.}Prefix + ":" : "";
attributes_ := array();
attributes_pf_ := array(
"id": makeweakref(thisFunction(WriteXmlAttrId)),
"o:spid": makeweakref(thisFunction(WriteXmlAttrSpid)),
"type": makeweakref(thisFunction(WriteXmlAttrType)),
"o:gfxdata": makeweakref(thisFunction(WriteXmlAttrGfxdata)),
"filled": makeweakref(thisFunction(WriteXmlAttrFilled)),
"stroked": makeweakref(thisFunction(WriteXmlAttrStroked)),
);
sorted_child_ := array(
pre + "textbox": array(0, makeweakref(thisFunction(ReadXmlChildTextbox))),
);
container_ := new TSOfficeContainer(sorted_child_);
end;
function Shape.Copy(_obj: Shape);override;
begin
tslassigning_backup := tslassigning;
tslassigning := 1;
class(OpenXmlElement).Copy(_obj);
if not ifnil(_obj.Id) then
{self.}Id := _obj.Id;
if not ifnil(_obj.Spid) then
{self.}Spid := _obj.Spid;
if not ifnil(_obj.Type) then
{self.}Type := _obj.Type;
if not ifnil(_obj.Gfxdata) then
{self.}Gfxdata := _obj.Gfxdata;
if not ifnil(_obj.Filled) then
{self.}Filled := _obj.Filled;
if not ifnil(_obj.Stroked) then
{self.}Stroked := _obj.Stroked;
if not ifnil(_obj.XmlChildTextbox) then
{self.}Textbox.Copy(_obj.XmlChildTextbox);
tslassigning := tslassigning_backup;
end;
function Shape.ReadXmlAttrId();
begin
return {self.}XmlAttrId.Value;
end;
function Shape.WriteXmlAttrId(_value);
begin
if ifnil({self.}XmlAttrId) then
begin
{self.}XmlAttrId := new OpenXmlAttribute("", "id", nil);
attributes_[length(attributes_)] := {self.}XmlAttrId;
end
{self.}XmlAttrId.Value := _value;
end;
function Shape.ReadXmlAttrSpid();
begin
return {self.}XmlAttrSpid.Value;
end;
function Shape.WriteXmlAttrSpid(_value);
begin
if ifnil({self.}XmlAttrSpid) then
begin
{self.}XmlAttrSpid := new OpenXmlAttribute("o", "spid", nil);
attributes_[length(attributes_)] := {self.}XmlAttrSpid;
end
{self.}XmlAttrSpid.Value := _value;
end;
function Shape.ReadXmlAttrType();
begin
return {self.}XmlAttrType.Value;
end;
function Shape.WriteXmlAttrType(_value);
begin
if ifnil({self.}XmlAttrType) then
begin
{self.}XmlAttrType := new OpenXmlAttribute("", "type", nil);
attributes_[length(attributes_)] := {self.}XmlAttrType;
end
{self.}XmlAttrType.Value := _value;
end;
function Shape.ReadXmlAttrGfxdata();
begin
return {self.}XmlAttrGfxdata.Value;
end;
function Shape.WriteXmlAttrGfxdata(_value);
begin
if ifnil({self.}XmlAttrGfxdata) then
begin
{self.}XmlAttrGfxdata := new OpenXmlAttribute("o", "gfxdata", nil);
attributes_[length(attributes_)] := {self.}XmlAttrGfxdata;
end
{self.}XmlAttrGfxdata.Value := _value;
end;
function Shape.ReadXmlAttrFilled();
begin
return {self.}XmlAttrFilled.Value;
end;
function Shape.WriteXmlAttrFilled(_value);
begin
if ifnil({self.}XmlAttrFilled) then
begin
{self.}XmlAttrFilled := new OpenXmlAttribute("", "filled", nil);
attributes_[length(attributes_)] := {self.}XmlAttrFilled;
end
{self.}XmlAttrFilled.Value := _value;
end;
function Shape.ReadXmlAttrStroked();
begin
return {self.}XmlAttrStroked.Value;
end;
function Shape.WriteXmlAttrStroked(_value);
begin
if ifnil({self.}XmlAttrStroked) then
begin
{self.}XmlAttrStroked := new OpenXmlAttribute("", "stroked", nil);
attributes_[length(attributes_)] := {self.}XmlAttrStroked;
end
{self.}XmlAttrStroked.Value := _value;
end;
function Shape.ReadXmlChildTextbox();
begin
if tslassigning and ifnil({self.}XmlChildTextbox) then
begin
{self.}XmlChildTextbox := new Textbox(self, {self.}Prefix, "textbox");
container_.Set({self.}XmlChildTextbox);
end
return {self.}XmlChildTextbox;
end;