527 lines
11 KiB
Plaintext
527 lines
11 KiB
Plaintext
unit DocxMLAdapters;
|
|
interface
|
|
|
|
type Tabs = class
|
|
public
|
|
function create(_obj: Tabs);
|
|
function Init();
|
|
|
|
function GetTabByVal(_key: string);
|
|
function AddTab(_value: Tab);
|
|
function RemoveTab(_value: Tab);
|
|
|
|
property TabCount: uinteger read tab_count_;
|
|
|
|
private
|
|
object_: Tabs;
|
|
tab_val_hash_: hash;
|
|
tab_count_: uinteger;
|
|
end;
|
|
|
|
type SectPr = class
|
|
public
|
|
function create(_obj: SectPr);
|
|
function Init();
|
|
|
|
function GetHeaderReferenceByType(_key: string);
|
|
function AddHeaderReference(_value: HeaderReference);
|
|
function RemoveHeaderReference(_value: HeaderReference);
|
|
function GetFooterReferenceByType(_key: string);
|
|
function AddFooterReference(_value: FooterReference);
|
|
function RemoveFooterReference(_value: FooterReference);
|
|
|
|
property HeaderReferenceCount: uinteger read headerreference_count_;
|
|
property FooterReferenceCount: uinteger read footerreference_count_;
|
|
|
|
private
|
|
object_: SectPr;
|
|
headerreference_type_hash_: hash;
|
|
headerreference_count_: uinteger;
|
|
footerreference_type_hash_: hash;
|
|
footerreference_count_: uinteger;
|
|
end;
|
|
|
|
type Endnotes = class
|
|
public
|
|
function create(_obj: Endnotes);
|
|
function Init();
|
|
|
|
function GetEndnoteById(_key: string);
|
|
function AddEndnote(_value: Endnote);
|
|
function RemoveEndnote(_value: Endnote);
|
|
|
|
property EndnoteCount: uinteger read endnote_count_;
|
|
|
|
private
|
|
object_: Endnotes;
|
|
endnote_id_hash_: hash;
|
|
endnote_count_: uinteger;
|
|
end;
|
|
|
|
type Footnotes = class
|
|
public
|
|
function create(_obj: Footnotes);
|
|
function Init();
|
|
|
|
function GetFootnoteById(_key: string);
|
|
function AddFootnote(_value: Footnote);
|
|
function RemoveFootnote(_value: Footnote);
|
|
|
|
property FootnoteCount: uinteger read footnote_count_;
|
|
|
|
private
|
|
object_: Footnotes;
|
|
footnote_id_hash_: hash;
|
|
footnote_count_: uinteger;
|
|
end;
|
|
|
|
type FootnotePr = class
|
|
public
|
|
function create(_obj: FootnotePr);
|
|
function Init();
|
|
|
|
function GetFootnoteById(_key: string);
|
|
function AddFootnote(_value: Footnote);
|
|
function RemoveFootnote(_value: Footnote);
|
|
|
|
property FootnoteCount: uinteger read footnote_count_;
|
|
|
|
private
|
|
object_: FootnotePr;
|
|
footnote_id_hash_: hash;
|
|
footnote_count_: uinteger;
|
|
end;
|
|
|
|
type EndnotePr = class
|
|
public
|
|
function create(_obj: EndnotePr);
|
|
function Init();
|
|
|
|
function GetFootnoteById(_key: string);
|
|
function AddFootnote(_value: Footnote);
|
|
function RemoveFootnote(_value: Footnote);
|
|
|
|
property FootnoteCount: uinteger read footnote_count_;
|
|
|
|
private
|
|
object_: EndnotePr;
|
|
footnote_id_hash_: hash;
|
|
footnote_count_: uinteger;
|
|
end;
|
|
|
|
type Styles = class
|
|
public
|
|
function create(_obj: Styles);
|
|
function Init();
|
|
|
|
function GetStyleByStyleId(_key: string);
|
|
function GetStyleByName(_key: string);
|
|
function AddStyle(_value: Style);
|
|
function RemoveStyle(_value: Style);
|
|
|
|
property StyleCount: uinteger read style_count_;
|
|
|
|
private
|
|
object_: Styles;
|
|
style_styleid_hash_: hash;
|
|
style_name_hash_: hash;
|
|
style_count_: uinteger;
|
|
end;
|
|
|
|
type Style = class
|
|
public
|
|
function create(_obj: Style);
|
|
function Init();
|
|
|
|
function GetTblStylePrByType(_key: string);
|
|
function AddTblStylePr(_value: TblStylePr);
|
|
function RemoveTblStylePr(_value: TblStylePr);
|
|
|
|
property TblStylePrCount: uinteger read tblstylepr_count_;
|
|
|
|
private
|
|
object_: Style;
|
|
tblstylepr_type_hash_: hash;
|
|
tblstylepr_count_: uinteger;
|
|
end;
|
|
|
|
type Numbering = class
|
|
public
|
|
function create(_obj: Numbering);
|
|
function Init();
|
|
|
|
function GetAbstractNumByAbstractNumId(_key: string);
|
|
function AddAbstractNum(_value: AbstractNum);
|
|
function RemoveAbstractNum(_value: AbstractNum);
|
|
function GetNumByNumId(_key: string);
|
|
function AddNum(_value: Num);
|
|
function RemoveNum(_value: Num);
|
|
|
|
property AbstractNumCount: uinteger read abstractnum_count_;
|
|
property NumCount: uinteger read num_count_;
|
|
|
|
private
|
|
object_: Numbering;
|
|
abstractnum_abstractnumid_hash_: hash;
|
|
abstractnum_count_: uinteger;
|
|
num_numid_hash_: hash;
|
|
num_count_: uinteger;
|
|
end;
|
|
|
|
implementation
|
|
|
|
function Tabs.create(_obj: Tabs);
|
|
begin
|
|
object_ := _obj;
|
|
tab_count_ := 0;
|
|
tab_val_hash_ := array();
|
|
{self.}Init();
|
|
end;
|
|
|
|
function Tabs.Init();
|
|
begin
|
|
elements := object_.Tabs();
|
|
tab_count_ := length(elements);
|
|
for k,v in elements do
|
|
tab_val_hash_[v.Val] := v;
|
|
end;
|
|
|
|
function Tabs.GetTabByVal(_key: string);
|
|
begin
|
|
return tab_val_hash_[_key];
|
|
end;
|
|
|
|
function Tabs.AddTab(_value: Tab);
|
|
begin
|
|
tab_val_hash_[_value.Val] := _value;
|
|
tab_count_++;
|
|
end;
|
|
|
|
function Tabs.RemoveTab(_value: Tab);
|
|
begin
|
|
reindex(tab_val_hash_, array(_value.Val: nil));
|
|
tab_count_--;
|
|
end;
|
|
|
|
function SectPr.create(_obj: SectPr);
|
|
begin
|
|
object_ := _obj;
|
|
headerreference_count_ := 0;
|
|
headerreference_type_hash_ := array();
|
|
footerreference_count_ := 0;
|
|
footerreference_type_hash_ := array();
|
|
{self.}Init();
|
|
end;
|
|
|
|
function SectPr.Init();
|
|
begin
|
|
elements := object_.HeaderReferences();
|
|
headerreference_count_ := length(elements);
|
|
for k,v in elements do
|
|
headerreference_type_hash_[v.Type] := v;
|
|
elements := object_.FooterReferences();
|
|
footerreference_count_ := length(elements);
|
|
for k,v in elements do
|
|
footerreference_type_hash_[v.Type] := v;
|
|
end;
|
|
|
|
function SectPr.GetHeaderReferenceByType(_key: string);
|
|
begin
|
|
return headerreference_type_hash_[_key];
|
|
end;
|
|
|
|
function SectPr.AddHeaderReference(_value: HeaderReference);
|
|
begin
|
|
headerreference_type_hash_[_value.Type] := _value;
|
|
headerreference_count_++;
|
|
end;
|
|
|
|
function SectPr.RemoveHeaderReference(_value: HeaderReference);
|
|
begin
|
|
reindex(headerreference_type_hash_, array(_value.Type: nil));
|
|
headerreference_count_--;
|
|
end;
|
|
|
|
function SectPr.GetFooterReferenceByType(_key: string);
|
|
begin
|
|
return footerreference_type_hash_[_key];
|
|
end;
|
|
|
|
function SectPr.AddFooterReference(_value: FooterReference);
|
|
begin
|
|
footerreference_type_hash_[_value.Type] := _value;
|
|
footerreference_count_++;
|
|
end;
|
|
|
|
function SectPr.RemoveFooterReference(_value: FooterReference);
|
|
begin
|
|
reindex(footerreference_type_hash_, array(_value.Type: nil));
|
|
footerreference_count_--;
|
|
end;
|
|
|
|
function Endnotes.create(_obj: Endnotes);
|
|
begin
|
|
object_ := _obj;
|
|
endnote_count_ := 0;
|
|
endnote_id_hash_ := array();
|
|
{self.}Init();
|
|
end;
|
|
|
|
function Endnotes.Init();
|
|
begin
|
|
elements := object_.Endnotes();
|
|
endnote_count_ := length(elements);
|
|
for k,v in elements do
|
|
endnote_id_hash_[v.Id] := v;
|
|
end;
|
|
|
|
function Endnotes.GetEndnoteById(_key: string);
|
|
begin
|
|
return endnote_id_hash_[_key];
|
|
end;
|
|
|
|
function Endnotes.AddEndnote(_value: Endnote);
|
|
begin
|
|
endnote_id_hash_[_value.Id] := _value;
|
|
endnote_count_++;
|
|
end;
|
|
|
|
function Endnotes.RemoveEndnote(_value: Endnote);
|
|
begin
|
|
reindex(endnote_id_hash_, array(_value.Id: nil));
|
|
endnote_count_--;
|
|
end;
|
|
|
|
function Footnotes.create(_obj: Footnotes);
|
|
begin
|
|
object_ := _obj;
|
|
footnote_count_ := 0;
|
|
footnote_id_hash_ := array();
|
|
{self.}Init();
|
|
end;
|
|
|
|
function Footnotes.Init();
|
|
begin
|
|
elements := object_.Footnotes();
|
|
footnote_count_ := length(elements);
|
|
for k,v in elements do
|
|
footnote_id_hash_[v.Id] := v;
|
|
end;
|
|
|
|
function Footnotes.GetFootnoteById(_key: string);
|
|
begin
|
|
return footnote_id_hash_[_key];
|
|
end;
|
|
|
|
function Footnotes.AddFootnote(_value: Footnote);
|
|
begin
|
|
footnote_id_hash_[_value.Id] := _value;
|
|
footnote_count_++;
|
|
end;
|
|
|
|
function Footnotes.RemoveFootnote(_value: Footnote);
|
|
begin
|
|
reindex(footnote_id_hash_, array(_value.Id: nil));
|
|
footnote_count_--;
|
|
end;
|
|
|
|
function FootnotePr.create(_obj: FootnotePr);
|
|
begin
|
|
object_ := _obj;
|
|
footnote_count_ := 0;
|
|
footnote_id_hash_ := array();
|
|
{self.}Init();
|
|
end;
|
|
|
|
function FootnotePr.Init();
|
|
begin
|
|
elements := object_.Footnotes();
|
|
footnote_count_ := length(elements);
|
|
for k,v in elements do
|
|
footnote_id_hash_[v.Id] := v;
|
|
end;
|
|
|
|
function FootnotePr.GetFootnoteById(_key: string);
|
|
begin
|
|
return footnote_id_hash_[_key];
|
|
end;
|
|
|
|
function FootnotePr.AddFootnote(_value: Footnote);
|
|
begin
|
|
footnote_id_hash_[_value.Id] := _value;
|
|
footnote_count_++;
|
|
end;
|
|
|
|
function FootnotePr.RemoveFootnote(_value: Footnote);
|
|
begin
|
|
reindex(footnote_id_hash_, array(_value.Id: nil));
|
|
footnote_count_--;
|
|
end;
|
|
|
|
function EndnotePr.create(_obj: EndnotePr);
|
|
begin
|
|
object_ := _obj;
|
|
footnote_count_ := 0;
|
|
footnote_id_hash_ := array();
|
|
{self.}Init();
|
|
end;
|
|
|
|
function EndnotePr.Init();
|
|
begin
|
|
elements := object_.Footnotes();
|
|
footnote_count_ := length(elements);
|
|
for k,v in elements do
|
|
footnote_id_hash_[v.Id] := v;
|
|
end;
|
|
|
|
function EndnotePr.GetFootnoteById(_key: string);
|
|
begin
|
|
return footnote_id_hash_[_key];
|
|
end;
|
|
|
|
function EndnotePr.AddFootnote(_value: Footnote);
|
|
begin
|
|
footnote_id_hash_[_value.Id] := _value;
|
|
footnote_count_++;
|
|
end;
|
|
|
|
function EndnotePr.RemoveFootnote(_value: Footnote);
|
|
begin
|
|
reindex(footnote_id_hash_, array(_value.Id: nil));
|
|
footnote_count_--;
|
|
end;
|
|
|
|
function Styles.create(_obj: Styles);
|
|
begin
|
|
object_ := _obj;
|
|
style_count_ := 0;
|
|
style_styleid_hash_ := array();
|
|
style_name_hash_ := array();
|
|
{self.}Init();
|
|
end;
|
|
|
|
function Styles.Init();
|
|
begin
|
|
elements := object_.Styles();
|
|
style_count_ := length(elements);
|
|
for k,v in elements do
|
|
begin
|
|
style_styleid_hash_[v.StyleId] := v;
|
|
style_name_hash_[v.Name.Val] := v;
|
|
end
|
|
end;
|
|
|
|
function Styles.GetStyleByStyleId(_key: string);
|
|
begin
|
|
return style_styleid_hash_[_key];
|
|
end;
|
|
|
|
function Styles.GetStyleByName(_key: string);
|
|
begin
|
|
return style_name_hash_[_key];
|
|
end;
|
|
|
|
function Styles.AddStyle(_value: Style);
|
|
begin
|
|
style_styleid_hash_[_value.StyleId] := _value;
|
|
style_name_hash_[_value.Name.Val] := _value;
|
|
style_count_++;
|
|
end;
|
|
|
|
function Styles.RemoveStyle(_value: Style);
|
|
begin
|
|
reindex(style_styleid_hash_, array(_value.StyleId: nil));
|
|
reindex(style_name_hash_, array(_value.Name.Val: nil));
|
|
style_count_--;
|
|
end;
|
|
|
|
function Style.create(_obj: Style);
|
|
begin
|
|
object_ := _obj;
|
|
tblstylepr_count_ := 0;
|
|
tblstylepr_type_hash_ := array();
|
|
{self.}Init();
|
|
end;
|
|
|
|
function Style.Init();
|
|
begin
|
|
elements := object_.TblStylePrs();
|
|
tblstylepr_count_ := length(elements);
|
|
for k,v in elements do
|
|
tblstylepr_type_hash_[v.Type] := v;
|
|
end;
|
|
|
|
function Style.GetTblStylePrByType(_key: string);
|
|
begin
|
|
return tblstylepr_type_hash_[_key];
|
|
end;
|
|
|
|
function Style.AddTblStylePr(_value: TblStylePr);
|
|
begin
|
|
tblstylepr_type_hash_[_value.Type] := _value;
|
|
tblstylepr_count_++;
|
|
end;
|
|
|
|
function Style.RemoveTblStylePr(_value: TblStylePr);
|
|
begin
|
|
reindex(tblstylepr_type_hash_, array(_value.Type: nil));
|
|
tblstylepr_count_--;
|
|
end;
|
|
|
|
function Numbering.create(_obj: Numbering);
|
|
begin
|
|
object_ := _obj;
|
|
abstractnum_count_ := 0;
|
|
abstractnum_abstractnumid_hash_ := array();
|
|
num_count_ := 0;
|
|
num_numid_hash_ := array();
|
|
{self.}Init();
|
|
end;
|
|
|
|
function Numbering.Init();
|
|
begin
|
|
elements := object_.AbstractNums();
|
|
abstractnum_count_ := length(elements);
|
|
for k,v in elements do
|
|
abstractnum_abstractnumid_hash_[v.AbstractNumId] := v;
|
|
elements := object_.Nums();
|
|
num_count_ := length(elements);
|
|
for k,v in elements do
|
|
num_numid_hash_[v.NumId] := v;
|
|
end;
|
|
|
|
function Numbering.GetAbstractNumByAbstractNumId(_key: string);
|
|
begin
|
|
return abstractnum_abstractnumid_hash_[_key];
|
|
end;
|
|
|
|
function Numbering.AddAbstractNum(_value: AbstractNum);
|
|
begin
|
|
abstractnum_abstractnumid_hash_[_value.AbstractNumId] := _value;
|
|
abstractnum_count_++;
|
|
end;
|
|
|
|
function Numbering.RemoveAbstractNum(_value: AbstractNum);
|
|
begin
|
|
reindex(abstractnum_abstractnumid_hash_, array(_value.AbstractNumId: nil));
|
|
abstractnum_count_--;
|
|
end;
|
|
|
|
function Numbering.GetNumByNumId(_key: string);
|
|
begin
|
|
return num_numid_hash_[_key];
|
|
end;
|
|
|
|
function Numbering.AddNum(_value: Num);
|
|
begin
|
|
num_numid_hash_[_value.NumId] := _value;
|
|
num_count_++;
|
|
end;
|
|
|
|
function Numbering.RemoveNum(_value: Num);
|
|
begin
|
|
reindex(num_numid_hash_, array(_value.NumId: nil));
|
|
num_count_--;
|
|
end;
|
|
|
|
end. |