[oform] Add getters to document class

This commit is contained in:
KirillovIlya
2022-11-22 02:35:13 +03:00
parent 43a57dec6d
commit a188b1b65d

View File

@ -42,6 +42,7 @@
{
AscFormat.CBaseFormatObject.call(this);
// Форматная часть
this.Author = null;
this.Date = null;
this.Description = null;
@ -50,8 +51,10 @@
this.DocumentId = null;
this.FieldGroups = [];
this.Users = [];
this.Fields = [];
// Мап всех имеющихся пользователей и полей (ключ class.GetId())
this.Users = {};
this.UserMasters = {};
this.FieldMasters = {};
}
AscFormat.InitClass(CDocument, AscFormat.CBaseFormatObject, AscDFH.historyitem_type_OForm_Document);
CDocument.prototype.setAuthor = function(author)
@ -62,6 +65,10 @@
AscCommon.History.Add(new AscDFH.CChangesOFormDocumentAuthor(this, this.Author, author));
this.Author = author;
};
CDocument.prototype.getAuthor = function()
{
return this.Author;
};
CDocument.prototype.setDate = function(date)
{
if (this.Date === date)
@ -70,6 +77,10 @@
AscCommon.History.Add(new AscDFH.CChangesOFormDocumentDate(this, this.Date, date));
this.Date = date;
};
CDocument.prototype.getDate = function()
{
return this.Date;
};
CDocument.prototype.setDescription = function(description)
{
if (this.Description === description)
@ -78,6 +89,10 @@
AscCommon.History.Add(new AscDFH.CChangesOFormDocumentDescription(this, this.Description, description));
this.Description = description;
};
CDocument.prototype.getDescription = function()
{
return this.Description;
};
CDocument.prototype.setType = function(type)
{
if (this.Type === type)
@ -86,6 +101,10 @@
AscCommon.History.Add(new AscDFH.CChangesOFormDocumentType(this, this.Type, type));
this.Type = type;
};
CDocument.prototype.getType = function()
{
return this.Type;
};
CDocument.prototype.setApplication = function(app)
{
if (this.Application === app)
@ -94,6 +113,10 @@
AscCommon.History.Add(new AscDFH.CChangesOFormDocumentApplication(this, this.Application, app));
this.Application = app;
};
CDocument.prototype.getApplication = function()
{
return this.Application;
};
CDocument.prototype.setDocumentId = function(documentId)
{
if (this.DocumentId === documentId)
@ -102,6 +125,10 @@
AscCommon.History.Add(new AscDFH.CChangesOFormDocumentDocumentId(this, this.DocumentId, documentId));
this.DocumentId = documentId;
};
CDocument.prototype.getDocumentId = function()
{
return this.DocumentId;
};
CDocument.prototype.addFieldGroup = function(fieldGroup)
{
if (-1 !== this.FieldGroups.indexOf(fieldGroup))
@ -122,6 +149,17 @@
AscCommon.History.Add(new AscDFH.CChangesOFormDocumentFieldGroup(this, fieldGroup.GetId(), false));
this.FieldGroups.splice(index, 1);
};
CDocument.prototype.getFieldGroupsCount = function()
{
return this.FieldGroups.length;
};
CDocument.prototype.getFieldGroup = function(index)
{
if (index < 0 || index >= this.FieldGroups.length)
return null;
return this.FieldGroups[index];
};
CDocument.prototype.readChildXml = function(name, reader)
{
// TODO: fix me