264 lines
7.7 KiB
Plaintext
264 lines
7.7 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 Style read ReadXmlAttrStyle write WriteXmlAttrStyle;
|
|
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;
|
|
property Ole read ReadXmlAttrOle write WriteXmlAttrOle;
|
|
function ReadXmlAttrId();
|
|
function WriteXmlAttrId(_value);
|
|
function ReadXmlAttrStyle();
|
|
function WriteXmlAttrStyle(_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);
|
|
function ReadXmlAttrOle();
|
|
function WriteXmlAttrOle(_value);
|
|
|
|
// normal property
|
|
property Textbox read ReadXmlChildTextbox;
|
|
property Imagedata read ReadXmlChildImagedata;
|
|
function ReadXmlChildTextbox();
|
|
function ReadXmlChildImagedata();
|
|
|
|
public
|
|
// Attributes
|
|
XmlAttrId: OpenXmlAttribute;
|
|
XmlAttrStyle: OpenXmlAttribute;
|
|
XmlAttrSpid: OpenXmlAttribute;
|
|
XmlAttrType: OpenXmlAttribute;
|
|
XmlAttrGfxdata: OpenXmlAttribute;
|
|
XmlAttrFilled: OpenXmlAttribute;
|
|
XmlAttrStroked: OpenXmlAttribute;
|
|
XmlAttrOle: OpenXmlAttribute;
|
|
|
|
// Children
|
|
XmlChildTextbox: Textbox;
|
|
XmlChildImagedata: Imagedata;
|
|
|
|
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)),
|
|
"style": makeweakref(thisFunction(WriteXmlAttrStyle)),
|
|
"o:spid": makeweakref(thisFunction(WriteXmlAttrSpid)),
|
|
"type": makeweakref(thisFunction(WriteXmlAttrType)),
|
|
"o:gfxdata": makeweakref(thisFunction(WriteXmlAttrGfxdata)),
|
|
"filled": makeweakref(thisFunction(WriteXmlAttrFilled)),
|
|
"stroked": makeweakref(thisFunction(WriteXmlAttrStroked)),
|
|
"o:ole": makeweakref(thisFunction(WriteXmlAttrOle)),
|
|
);
|
|
sorted_child_ := array(
|
|
pre + "textbox": array(0, makeweakref(thisFunction(ReadXmlChildTextbox))),
|
|
pre + "imagedata": array(1, makeweakref(thisFunction(ReadXmlChildImagedata))),
|
|
);
|
|
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.Style) then
|
|
{self.}Style := _obj.Style;
|
|
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.Ole) then
|
|
{self.}Ole := _obj.Ole;
|
|
if not ifnil(_obj.XmlChildTextbox) then
|
|
{self.}Textbox.Copy(_obj.XmlChildTextbox);
|
|
if not ifnil(_obj.XmlChildImagedata) then
|
|
{self.}Imagedata.Copy(_obj.XmlChildImagedata);
|
|
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.ReadXmlAttrStyle();
|
|
begin
|
|
return {self.}XmlAttrStyle.Value;
|
|
end;
|
|
|
|
function Shape.WriteXmlAttrStyle(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrStyle) then
|
|
begin
|
|
{self.}XmlAttrStyle := new OpenXmlAttribute("", "style", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrStyle;
|
|
end
|
|
{self.}XmlAttrStyle.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.ReadXmlAttrOle();
|
|
begin
|
|
return {self.}XmlAttrOle.Value;
|
|
end;
|
|
|
|
function Shape.WriteXmlAttrOle(_value);
|
|
begin
|
|
if ifnil({self.}XmlAttrOle) then
|
|
begin
|
|
{self.}XmlAttrOle := new OpenXmlAttribute("o", "ole", nil);
|
|
attributes_[length(attributes_)] := {self.}XmlAttrOle;
|
|
end
|
|
{self.}XmlAttrOle.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;
|
|
|
|
function Shape.ReadXmlChildImagedata();
|
|
begin
|
|
if tslassigning and ifnil({self.}XmlChildImagedata) then
|
|
begin
|
|
{self.}XmlChildImagedata := new Imagedata(self, {self.}Prefix, "imagedata");
|
|
container_.Set({self.}XmlChildImagedata);
|
|
end
|
|
return {self.}XmlChildImagedata;
|
|
end;
|