Commit a5c23ef6 authored by Ilya Kirillov's avatar Ilya Kirillov

Implemented table description and table caption.

parent 5d5decec
......@@ -1374,6 +1374,8 @@
window['AscDFH'].historyitem_Table_Distance = window['AscDFH'].historyitem_type_Table | 23;
window['AscDFH'].historyitem_Table_Pr = window['AscDFH'].historyitem_type_Table | 24;
window['AscDFH'].historyitem_Table_TableLayout = window['AscDFH'].historyitem_type_Table | 25;
window['AscDFH'].historyitem_Table_TableDescription = window['AscDFH'].historyitem_type_Table | 26;
window['AscDFH'].historyitem_Table_TableCaption = window['AscDFH'].historyitem_type_Table | 27;
//------------------------------------------------------------------------------------------------------------------
// Типы изменений в классе CTableRow
//------------------------------------------------------------------------------------------------------------------
......
......@@ -4828,6 +4828,8 @@ function CTablePr()
this.TableInd = undefined;
this.TableW = undefined;
this.TableLayout = undefined;
this.TableDescription = undefined;
this.TableCaption = undefined;
}
CTablePr.prototype =
......@@ -4883,6 +4885,9 @@ CTablePr.prototype =
TablePr.TableLayout = this.TableLayout;
TablePr.TableDescription = this.TableDescription;
TablePr.TableCaption = this.TableCaption;
return TablePr;
},
......@@ -4943,6 +4948,12 @@ CTablePr.prototype =
if ( undefined != TablePr.TableLayout )
this.TableLayout = TablePr.TableLayout;
if (undefined !== TablePr.TableDescription)
this.TableDescription = TablePr.TableDescription;
if (undefined !== TablePr.TableCaption)
this.TableCaption = TablePr.TableCaption;
},
Is_Equal : function(TablePr)
......@@ -4989,6 +5000,8 @@ CTablePr.prototype =
this.TableInd = 0;
this.TableW = new CTableMeasurement(tblwidth_Auto, 0);
this.TableLayout = tbllayout_AutoFit;
this.TableDescription = "";
this.TableCaption = "";
},
Set_FromObject : function(TablePr)
......@@ -5104,6 +5117,9 @@ CTablePr.prototype =
this.TableW = undefined;
this.TableLayout = TablePr.TableLayout;
this.TableDescription = TablePr.TableDescription;
this.TableCaption = TablePr.TableCaption;
},
Check_PresentationPr : function(Theme)
......@@ -5260,6 +5276,18 @@ CTablePr.prototype =
Flags |= 131072;
}
if (undefined !== this.TableDescription)
{
Writer.WriteString2(this.TableDescription);
Flags |= 262144;
}
if (undefined !== this.TableCaption)
{
Writer.WriteString2(this.TableCaption);
Flags |= 524288;
}
var EndPos = Writer.GetCurPosition();
Writer.Seek( StartPos );
Writer.WriteLong( Flags );
......@@ -5364,6 +5392,12 @@ CTablePr.prototype =
if ( 131072 & Flags )
this.TableLayout = Reader.GetLong();
if (262144 & Flags)
this.TableDescription = Reader.GetString2();
if (524288 & Flags)
this.TableCaption = Reader.GetString2();
}
};
......
......@@ -810,6 +810,8 @@ CTable.prototype =
}
Pr.PercentFullWidth = this.private_RecalculatePercentWidth();
Pr.TableDescription = this.Get_TableDescription();
Pr.TableCaption = this.Get_TableCaption();
return Pr;
},
......@@ -2026,6 +2028,18 @@ CTable.prototype =
}
}
// TableDescription
if (undefined !== Props.TableDescription && null !== Props.TableDescription)
{
this.Set_TableDescription(Props.TableDescription);
}
// TableCaption
if (undefined !== Props.TableCaption && null !== Props.TableCaption)
{
this.Set_TableCaption(Props.TableCaption);
}
return true;
},
......@@ -8195,6 +8209,32 @@ CTable.prototype =
{
return this.Get_TableBorders();
},
Set_TableDescription : function(sDescription)
{
History.Add(new CChangesTableTableDescription(this, this.Pr.TableDescription, sDescription));
this.Pr.TableDescription = sDescription;
this.Recalc_CompiledPr();
},
Get_TableDescription : function()
{
var Pr = this.Get_CompiledPr(false).TablePr;
return Pr.TableDescription;
},
Set_TableCaption : function(sCaption)
{
History.Add(new CChangesTableTableCaption(this, this.Pr.TableCaption, sCaption));
this.Pr.TableCaption = sCaption;
this.Recalc_CompiledPr();
},
Get_TableCaption : function()
{
var Pr = this.Get_CompiledPr(false).TablePr;
return Pr.TableCaption;
},
//-----------------------------------------------------------------------------------
// Работаем с сеткой таблицы
//-----------------------------------------------------------------------------------
......
......@@ -62,7 +62,8 @@ AscDFH.changesFactory[AscDFH.historyitem_Table_PositionV] = CChanges
AscDFH.changesFactory[AscDFH.historyitem_Table_Distance] = CChangesTableDistance;
AscDFH.changesFactory[AscDFH.historyitem_Table_Pr] = CChangesTablePr;
AscDFH.changesFactory[AscDFH.historyitem_Table_TableLayout] = CChangesTableTableLayout;
AscDFH.changesFactory[AscDFH.historyitem_Table_TableDescription] = CChangesTableTableDescription;
AscDFH.changesFactory[AscDFH.historyitem_Table_TableCaption] = CChangesTableTableCaption;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
......@@ -165,12 +166,23 @@ AscDFH.changesRelationMap[AscDFH.historyitem_Table_Pr] = [
AscDFH.historyitem_Table_TableStyleRowBandSize,
AscDFH.historyitem_Table_TableStyleColBandSize,
AscDFH.historyitem_Table_Pr,
AscDFH.historyitem_Table_TableLayout
AscDFH.historyitem_Table_TableLayout,
AscDFH.historyitem_Table_TableDescription,
AscDFH.historyitem_Table_TableCaption
];
AscDFH.changesRelationMap[AscDFH.historyitem_Table_TableLayout] = [
AscDFH.historyitem_Table_TableLayout,
AscDFH.historyitem_Table_Pr
];
AscDFH.changesRelationMap[AscDFH.historyitem_Table_TableDescription] = [
AscDFH.historyitem_Table_TableDescription,
AscDFH.historyitem_Table_Pr
];
AscDFH.changesRelationMap[AscDFH.historyitem_Table_TableCaption] = [
AscDFH.historyitem_Table_TableCaption,
AscDFH.historyitem_Table_Pr
];
/**
* Общая функция объединения изменений, которые зависят только от себя и AscDFH.historyitem_Table_Pr
* @param oChange
......@@ -1237,6 +1249,16 @@ CChangesTablePr.prototype.Merge = function(oChange)
this.New.TableLayout = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableDescription:
{
this.New.TableDescription = oChange.New;
break;
}
case AscDFH.historyitem_Table_TableCaption:
{
this.New.TableCaption = oChange.New;
break;
}
}
return true;
......@@ -1258,3 +1280,37 @@ CChangesTableTableLayout.prototype.private_SetValue = function(Value)
oTable.Recalc_CompiledPr2();
};
CChangesTableTableLayout.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseStringProperty}
*/
function CChangesTableTableDescription(Class, Old, New, Color)
{
CChangesTableTableDescription.superclass.constructor.call(this, Class, Old, New, Color);
}
AscCommon.extendClass(CChangesTableTableDescription, AscDFH.CChangesBaseStringProperty);
CChangesTableTableDescription.prototype.Type = AscDFH.historyitem_Table_TableDescription;
CChangesTableTableDescription.prototype.private_SetValue = function(Value)
{
var oTable = this.Class;
oTable.Pr.TableDescription = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTableTableDescription.prototype.Merge = private_TableChangesOnMergePr;
/**
* @constructor
* @extends {AscDFH.CChangesBaseStringProperty}
*/
function CChangesTableTableCaption(Class, Old, New, Color)
{
CChangesTableTableCaption.superclass.constructor.call(this, Class, Old, New, Color);
}
AscCommon.extendClass(CChangesTableTableCaption, AscDFH.CChangesBaseStringProperty);
CChangesTableTableCaption.prototype.Type = AscDFH.historyitem_Table_TableCaption;
CChangesTableTableCaption.prototype.private_SetValue = function(Value)
{
var oTable = this.Class;
oTable.Pr.TableCaption = Value;
oTable.Recalc_CompiledPr2();
};
CChangesTableTableCaption.prototype.Merge = private_TableChangesOnMergePr;
\ No newline at end of file
......@@ -4399,6 +4399,8 @@ background-repeat: no-repeat;\
this.CellsWidthNotEqual = tblProp.CellsWidthNotEqual;
this.Locked = (undefined != tblProp.Locked) ? tblProp.Locked : false;
this.PercentFullWidth = tblProp.PercentFullWidth;
this.TableDescription = tblProp.TableDescription;
this.TableCaption = tblProp.TableCaption;
}
else
{
......@@ -4662,6 +4664,22 @@ background-repeat: no-repeat;\
{
return this.CellsWidthNotEqual;
};
CTableProp.prototype.get_TableDescription = function()
{
return this.TableDescription;
};
CTableProp.prototype.put_TableDescription = function(v)
{
this.TableDescription = v;
};
CTableProp.prototype.get_TableCaption = function()
{
return this.TableCaption;
};
CTableProp.prototype.put_TableCaption = function(v)
{
this.TableCaption = v;
};
function CBorders(obj)
......@@ -9129,6 +9147,10 @@ background-repeat: no-repeat;\
CTableProp.prototype['put_CellsWidth'] = CTableProp.prototype.put_CellsWidth;
CTableProp.prototype['get_PercentFullWidth'] = CTableProp.prototype.get_PercentFullWidth;
CTableProp.prototype['get_CellsWidthNotEqual'] = CTableProp.prototype.get_CellsWidthNotEqual;
CTableProp.prototype['get_TableDescription'] = CTableProp.prototype.get_TableDescription;
CTableProp.prototype['put_TableDescription'] = CTableProp.prototype.put_TableDescription;
CTableProp.prototype['get_TableCaption'] = CTableProp.prototype.get_TableCaption;
CTableProp.prototype['put_TableCaption'] = CTableProp.prototype.put_TableCaption;
window['Asc']['CBorders'] = window['Asc'].CBorders = CBorders;
CBorders.prototype['get_Left'] = CBorders.prototype.get_Left;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment