195 lines
5.4 KiB
Plaintext
195 lines
5.4 KiB
Plaintext
type Shapetype = 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: Shapetype);override;
|
|
|
|
property AnchorId read ReadXmlAttrAnchorId write WriteXmlAttrAnchorId;
|
|
property Id read ReadXmlAttrId write WriteXmlAttrId;
|
|
property Coordsize read ReadXmlAttrCoordsize write WriteXmlAttrCoordsize;
|
|
property Spt read ReadXmlAttrSpt write WriteXmlAttrSpt;
|
|
property Path read ReadXmlAttrPath write WriteXmlAttrPath;
|
|
function ReadXmlAttrAnchorId();
|
|
function WriteXmlAttrAnchorId(_value);
|
|
function ReadXmlAttrId();
|
|
function WriteXmlAttrId(_value);
|
|
function ReadXmlAttrCoordsize();
|
|
function WriteXmlAttrCoordsize(_value);
|
|
function ReadXmlAttrSpt();
|
|
function WriteXmlAttrSpt(_value);
|
|
function ReadXmlAttrPath();
|
|
function WriteXmlAttrPath(_value);
|
|
|
|
public
|
|
// Attributes
|
|
XmlAttrAnchorId: OpenXmlAttribute;
|
|
XmlAttrId: OpenXmlAttribute;
|
|
XmlAttrCoordsize: OpenXmlAttribute;
|
|
XmlAttrSpt: OpenXmlAttribute;
|
|
XmlAttrPath: OpenXmlAttribute;
|
|
|
|
// Children
|
|
Stroke: Stroke;
|
|
Path: Path;
|
|
|
|
end;
|
|
|
|
function Shapetype.Create();overload;
|
|
begin
|
|
{self.}Create(nil, "v", "shapetype");
|
|
end;
|
|
|
|
function Shapetype.Create(_node: XmlNode);overload;
|
|
begin
|
|
class(OpenXmlElement).Create(_node: XmlNode);
|
|
end;
|
|
|
|
function Shapetype.Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
|
|
begin
|
|
class(OpenXmlElement).Create(_parent, _prefix, _local_name);
|
|
end;
|
|
|
|
function Shapetype.Init();override;
|
|
begin
|
|
{self.}XmlAttrAnchorId := new OpenXmlAttribute("w14", "anchorId", nil);
|
|
{self.}XmlAttrId := new OpenXmlAttribute(nil, "id", nil);
|
|
{self.}XmlAttrCoordsize := new OpenXmlAttribute(nil, "coordsize", nil);
|
|
{self.}XmlAttrSpt := new OpenXmlAttribute("o", "spt", nil);
|
|
{self.}XmlAttrPath := new OpenXmlAttribute(nil, "path", nil);
|
|
{self.}Stroke := new Stroke(self, {self.}Prefix, "stroke");
|
|
{self.}Path := new Path(self, {self.}Prefix, "path");
|
|
end;
|
|
|
|
function Shapetype.InitAttributes();override;
|
|
begin
|
|
attributes_ := array(
|
|
{self.}XmlAttrAnchorId,
|
|
{self.}XmlAttrId,
|
|
{self.}XmlAttrCoordsize,
|
|
{self.}XmlAttrSpt,
|
|
{self.}XmlAttrPath,
|
|
);
|
|
end;
|
|
|
|
function Shapetype.InitChildren();override;
|
|
begin
|
|
child_elements_ := array(
|
|
0: {self.}Stroke,
|
|
1: {self.}Path,
|
|
);
|
|
sorted_child_ := array(
|
|
"": -1,
|
|
{self.}Stroke.ElementName: 0,
|
|
{self.}Path.ElementName: 1,
|
|
);
|
|
end;
|
|
|
|
function Shapetype.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 Shapetype.Copy(_obj: Shapetype);override;
|
|
begin
|
|
if not ifnil(_obj.XmlAttrAnchorId.Value) then
|
|
{self.}XmlAttrAnchorId.Value := _obj.XmlAttrAnchorId.Value;
|
|
if not ifnil(_obj.XmlAttrId.Value) then
|
|
{self.}XmlAttrId.Value := _obj.XmlAttrId.Value;
|
|
if not ifnil(_obj.XmlAttrCoordsize.Value) then
|
|
{self.}XmlAttrCoordsize.Value := _obj.XmlAttrCoordsize.Value;
|
|
if not ifnil(_obj.XmlAttrSpt.Value) then
|
|
{self.}XmlAttrSpt.Value := _obj.XmlAttrSpt.Value;
|
|
if not ifnil(_obj.XmlAttrPath.Value) then
|
|
{self.}XmlAttrPath.Value := _obj.XmlAttrPath.Value;
|
|
{self.}Stroke.Copy(_obj.Stroke);
|
|
{self.}Path.Copy(_obj.Path);
|
|
end;
|
|
|
|
function Shapetype.ReadXmlAttrAnchorId();
|
|
begin
|
|
return {self.}XmlAttrAnchorId.Value;
|
|
end;
|
|
|
|
function Shapetype.WriteXmlAttrAnchorId(_value);
|
|
begin
|
|
{self.}XmlAttrAnchorId.Value := _value;
|
|
end;
|
|
|
|
function Shapetype.ReadXmlAttrId();
|
|
begin
|
|
return {self.}XmlAttrId.Value;
|
|
end;
|
|
|
|
function Shapetype.WriteXmlAttrId(_value);
|
|
begin
|
|
{self.}XmlAttrId.Value := _value;
|
|
end;
|
|
|
|
function Shapetype.ReadXmlAttrCoordsize();
|
|
begin
|
|
return {self.}XmlAttrCoordsize.Value;
|
|
end;
|
|
|
|
function Shapetype.WriteXmlAttrCoordsize(_value);
|
|
begin
|
|
{self.}XmlAttrCoordsize.Value := _value;
|
|
end;
|
|
|
|
function Shapetype.ReadXmlAttrSpt();
|
|
begin
|
|
return {self.}XmlAttrSpt.Value;
|
|
end;
|
|
|
|
function Shapetype.WriteXmlAttrSpt(_value);
|
|
begin
|
|
{self.}XmlAttrSpt.Value := _value;
|
|
end;
|
|
|
|
function Shapetype.ReadXmlAttrPath();
|
|
begin
|
|
return {self.}XmlAttrPath.Value;
|
|
end;
|
|
|
|
function Shapetype.WriteXmlAttrPath(_value);
|
|
begin
|
|
{self.}XmlAttrPath.Value := _value;
|
|
end;
|