OfficeXml/autoclass/docx/Compat@DOCX.tsf

276 lines
9.2 KiB
Plaintext

type Compat = 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: Compat);override;
function AddCompatSetting(): CompatSetting;
function AppendCompatSetting(): CompatSetting;
property CompatSettings read ReadCompatSettings;
function ReadCompatSettings(_index);
property SpaceForUL read ReadXmlChildSpaceForUL write WriteXmlChildSpaceForUL;
property BalanceSingleByteDoubleByteWidth read ReadXmlChildBalanceSingleByteDoubleByteWidth write WriteXmlChildBalanceSingleByteDoubleByteWidth;
property DoNotLeaveBackslashAlone read ReadXmlChildDoNotLeaveBackslashAlone write WriteXmlChildDoNotLeaveBackslashAlone;
property UlTrailSpace read ReadXmlChildUlTrailSpace write WriteXmlChildUlTrailSpace;
property DoNotExpandShiftReturn read ReadXmlChildDoNotExpandShiftReturn write WriteXmlChildDoNotExpandShiftReturn;
property AdjustLineHeightInTable read ReadXmlChildAdjustLineHeightInTable write WriteXmlChildAdjustLineHeightInTable;
property UseFELayout read ReadXmlChildUseFELayout write WriteXmlChildUseFELayout;
property CompatSetting read ReadXmlChildCompatSetting write WriteXmlChildCompatSetting;
function ReadXmlChildSpaceForUL();
function WriteXmlChildSpaceForUL(_value);
function ReadXmlChildBalanceSingleByteDoubleByteWidth();
function WriteXmlChildBalanceSingleByteDoubleByteWidth(_value);
function ReadXmlChildDoNotLeaveBackslashAlone();
function WriteXmlChildDoNotLeaveBackslashAlone(_value);
function ReadXmlChildUlTrailSpace();
function WriteXmlChildUlTrailSpace(_value);
function ReadXmlChildDoNotExpandShiftReturn();
function WriteXmlChildDoNotExpandShiftReturn(_value);
function ReadXmlChildAdjustLineHeightInTable();
function WriteXmlChildAdjustLineHeightInTable(_value);
function ReadXmlChildUseFELayout();
function WriteXmlChildUseFELayout(_value);
function ReadXmlChildCompatSetting();
function WriteXmlChildCompatSetting(_value);
public
// Attributes
// Children
XmlChildSpaceForUL: OpenXmlEmpty;
XmlChildBalanceSingleByteDoubleByteWidth: OpenXmlEmpty;
XmlChildDoNotLeaveBackslashAlone: OpenXmlEmpty;
XmlChildUlTrailSpace: OpenXmlEmpty;
XmlChildDoNotExpandShiftReturn: OpenXmlEmpty;
XmlChildAdjustLineHeightInTable: OpenXmlEmpty;
XmlChildUseFELayout: OpenXmlEmpty;
end;
function Compat.Create();overload;
begin
self.Create(nil, "w", "compat");
end;
function Compat.Create(_node: XmlNode);overload;
begin
class(OpenXmlElement).Create(_node: XmlNode);
end;
function Compat.Create(_parent: tslobj; _prefix: string; _local_name: string);overload;
begin
class(OpenXmlElement).Create(_parent, _prefix, _local_name);
end;
function Compat.Init();override;
begin
self.XmlChildSpaceForUL := new OpenXmlEmpty(self, self.Prefix, "spaceForUL");
self.XmlChildBalanceSingleByteDoubleByteWidth := new OpenXmlEmpty(self, self.Prefix, "balanceSingleByteDoubleByteWidth");
self.XmlChildDoNotLeaveBackslashAlone := new OpenXmlEmpty(self, self.Prefix, "doNotLeaveBackslashAlone");
self.XmlChildUlTrailSpace := new OpenXmlEmpty(self, self.Prefix, "ulTrailSpace");
self.XmlChildDoNotExpandShiftReturn := new OpenXmlEmpty(self, self.Prefix, "doNotExpandShiftReturn");
self.XmlChildAdjustLineHeightInTable := new OpenXmlEmpty(self, self.Prefix, "adjustLineHeightInTable");
self.XmlChildUseFELayout := new OpenXmlEmpty(self, self.Prefix, "useFELayout");
end;
function Compat.InitAttributes();override;
begin
attributes_ := array(
);
end;
function Compat.InitChildren();override;
begin
child_elements_ := array(
0: self.XmlChildSpaceForUL,
1: self.XmlChildBalanceSingleByteDoubleByteWidth,
2: self.XmlChildDoNotLeaveBackslashAlone,
3: self.XmlChildUlTrailSpace,
4: self.XmlChildDoNotExpandShiftReturn,
5: self.XmlChildAdjustLineHeightInTable,
6: self.XmlChildUseFELayout,
);
sorted_child_ := array(
"": -1,
self.XmlChildSpaceForUL.ElementName: 0,
self.XmlChildBalanceSingleByteDoubleByteWidth.ElementName: 1,
self.XmlChildDoNotLeaveBackslashAlone.ElementName: 2,
self.XmlChildUlTrailSpace.ElementName: 3,
self.XmlChildDoNotExpandShiftReturn.ElementName: 4,
self.XmlChildAdjustLineHeightInTable.ElementName: 5,
self.XmlChildUseFELayout.ElementName: 6,
);
end;
function Compat.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
pre + "compatSetting": obj := self.AppendCompatSetting();
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 Compat.Copy(_obj: Compat);override;
begin
self.XmlChildSpaceForUL.Copy(_obj.XmlChildSpaceForUL);
self.XmlChildBalanceSingleByteDoubleByteWidth.Copy(_obj.XmlChildBalanceSingleByteDoubleByteWidth);
self.XmlChildDoNotLeaveBackslashAlone.Copy(_obj.XmlChildDoNotLeaveBackslashAlone);
self.XmlChildUlTrailSpace.Copy(_obj.XmlChildUlTrailSpace);
self.XmlChildDoNotExpandShiftReturn.Copy(_obj.XmlChildDoNotExpandShiftReturn);
self.XmlChildAdjustLineHeightInTable.Copy(_obj.XmlChildAdjustLineHeightInTable);
self.XmlChildUseFELayout.Copy(_obj.XmlChildUseFELayout);
end;
function Compat.AddCompatSetting(): CompatSetting;
begin
len := length(child_elements_);
if len = 0 then i := -1;
else begin
for i:=len-1 downto 0 do
if child_elements_[i].LocalName = "compatSetting" then break;
end
obj := new CompatSetting(self, self.Prefix, "compatSetting");
self.InsertChild(obj, i+1);
return obj;
end;
function Compat.AppendCompatSetting(): CompatSetting;
begin
obj := new CompatSetting(self, self.Prefix, "compatSetting");
child_elements_[length(child_elements_)] := obj;
return obj;
end;
function Compat.ReadCompatSettings(_index);
begin
ind := ifnil(_index) ? -2 : _index;
arr := array();
for k,v in child_elements_ do
begin
if v.LocalName = "compatSetting" then
begin
arr[length(arr)] := v;
ind--;
end;
if ind = -1 then return v;
end;
return arr;
end;
function Compat.ReadXmlChildSpaceForUL();
begin
return ifnil(self.XmlChildSpaceForUL.Value) ? false : true;
end;
function Compat.WriteXmlChildSpaceForUL(_value);
begin
self.XmlChildSpaceForUL.Value := _value;
end;
function Compat.ReadXmlChildBalanceSingleByteDoubleByteWidth();
begin
return ifnil(self.XmlChildBalanceSingleByteDoubleByteWidth.Value) ? false : true;
end;
function Compat.WriteXmlChildBalanceSingleByteDoubleByteWidth(_value);
begin
self.XmlChildBalanceSingleByteDoubleByteWidth.Value := _value;
end;
function Compat.ReadXmlChildDoNotLeaveBackslashAlone();
begin
return ifnil(self.XmlChildDoNotLeaveBackslashAlone.Value) ? false : true;
end;
function Compat.WriteXmlChildDoNotLeaveBackslashAlone(_value);
begin
self.XmlChildDoNotLeaveBackslashAlone.Value := _value;
end;
function Compat.ReadXmlChildUlTrailSpace();
begin
return ifnil(self.XmlChildUlTrailSpace.Value) ? false : true;
end;
function Compat.WriteXmlChildUlTrailSpace(_value);
begin
self.XmlChildUlTrailSpace.Value := _value;
end;
function Compat.ReadXmlChildDoNotExpandShiftReturn();
begin
return ifnil(self.XmlChildDoNotExpandShiftReturn.Value) ? false : true;
end;
function Compat.WriteXmlChildDoNotExpandShiftReturn(_value);
begin
self.XmlChildDoNotExpandShiftReturn.Value := _value;
end;
function Compat.ReadXmlChildAdjustLineHeightInTable();
begin
return ifnil(self.XmlChildAdjustLineHeightInTable.Value) ? false : true;
end;
function Compat.WriteXmlChildAdjustLineHeightInTable(_value);
begin
self.XmlChildAdjustLineHeightInTable.Value := _value;
end;
function Compat.ReadXmlChildUseFELayout();
begin
return ifnil(self.XmlChildUseFELayout.Value) ? false : true;
end;
function Compat.WriteXmlChildUseFELayout(_value);
begin
self.XmlChildUseFELayout.Value := _value;
end;
function Compat.ReadXmlChildCompatSetting();
begin
return ifnil(self.XmlChildCompatSetting.Value) ? false : true;
end;
function Compat.WriteXmlChildCompatSetting(_value);
begin
self.XmlChildCompatSetting.Value := _value;
end;