Commit b6fcf95b authored by GoshaZotov's avatar GoshaZotov

Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into develop

parents a7c5b29c 2ff49bbc
......@@ -74,7 +74,7 @@ var c_oAscError = Asc.c_oAscError;
DesktopOfflineUpdateLocalName(this);
this.onUpdateDocumentModified(AscCommon.History.Is_Modified());
this.onUpdateDocumentModified(AscCommon.History.Have_Changes());
};
asc['spreadsheet_api'].prototype._onNeedParams = function(data, opt_isPassword)
......@@ -162,7 +162,7 @@ AscCommon.CHistory.prototype.Reset_SavedIndex = function(IsUserSave)
}
};
AscCommon.CHistory.prototype.Is_Modified = function(IsNotUserSave, IsNoSavedNoModifyed)
AscCommon.CHistory.prototype.Have_Changes = function(IsNotUserSave, IsNoSavedNoModifyed)
{
var checkIndex = (this.Is_UserSaveMode() && !IsNotUserSave) ? this.UserSavedIndex : this.SavedIndex;
if (-1 === this.Index && null === checkIndex && false === this.ForceSave)
......@@ -198,7 +198,7 @@ window["Asc"]['spreadsheet_api'].prototype.onUpdateDocumentModified = function(b
this._onUpdateDocumentCanSave();
if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["onDocumentModifiedChanged"](AscCommon.History ? AscCommon.History.Is_Modified(undefined, true) : bValue);
window["AscDesktopEditor"]["onDocumentModifiedChanged"](AscCommon.History ? AscCommon.History.Have_Changes(undefined, true) : bValue);
}
}
};
......@@ -260,7 +260,7 @@ window["DesktopOfflineAppDocumentEndSave"] = function(error)
else
AscCommon.History.UserSavedIndex = window["Asc"]["editor"].LastUserSavedIndex;
window["Asc"]["editor"].onUpdateDocumentModified(AscCommon.History.Is_Modified());
window["Asc"]["editor"].onUpdateDocumentModified(AscCommon.History.Have_Changes());
window["Asc"]["editor"].LastUserSavedIndex = undefined;
if (2 == error)
......
......@@ -874,8 +874,8 @@ var editor;
if (!this.canSave || this.asc_getCellEditMode()) {
// Пока идет сохранение или редактирование ячейки, мы не закрываем документ
return true;
} else if (History && History.Is_Modified) {
return History.Is_Modified();
} else if (History && History.Have_Changes) {
return History.Have_Changes();
}
return false;
};
......@@ -1532,7 +1532,7 @@ var editor;
t.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.Save);
// Обновляем состояние возможности сохранения документа
t.onUpdateDocumentModified(History.Is_Modified());
t.onUpdateDocumentModified(History.Have_Changes());
if (undefined !== window["AscDesktopEditor"]) {
window["AscDesktopEditor"]["OnSave"]();
......@@ -2612,10 +2612,19 @@ var editor;
};
// Frozen pane
spreadsheet_api.prototype.asc_freezePane = function() {
spreadsheet_api.prototype.asc_freezePane = function () {
this.wb.getWorksheet().freezePane();
};
spreadsheet_api.prototype.asc_setSparklineGroup = function (id, oSparklineGroup) {
var changedSparkline = AscCommon.g_oTableId.Get_ById(id);
if (changedSparkline) {
changedSparkline.set(oSparklineGroup);
this.wb._onWSSelectionChanged();
this.wb.getWorksheet().draw();
}
};
// Cell interface
spreadsheet_api.prototype.asc_getCellInfo = function() {
return this.wb.getSelectionInfo();
......@@ -3044,7 +3053,7 @@ var editor;
!History.IsEndTransaction() || !this.canSave) {
return;
}
if (!History.Is_Modified(true) && !(this.collaborativeEditing.getCollaborativeEditing() && 0 !== this.collaborativeEditing.getOwnLocksLength())) {
if (!History.Have_Changes(true) && !(this.collaborativeEditing.getCollaborativeEditing() && 0 !== this.collaborativeEditing.getOwnLocksLength())) {
if (this.collaborativeEditing.getFast() && this.collaborativeEditing.haveOtherChanges()) {
AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();
......@@ -3071,7 +3080,7 @@ var editor;
spreadsheet_api.prototype._onUpdateDocumentCanSave = function() {
// Можно модифицировать это условие на более быстрое (менять самим состояние в аргументах, а не запрашивать каждый раз)
var tmp = History.Is_Modified() || (this.collaborativeEditing.getCollaborativeEditing() && 0 !== this.collaborativeEditing.getOwnLocksLength());
var tmp = History.Have_Changes() || (this.collaborativeEditing.getCollaborativeEditing() && 0 !== this.collaborativeEditing.getOwnLocksLength());
if (tmp !== this.isDocumentCanSave) {
this.isDocumentCanSave = tmp;
this.handlers.trigger('asc_onDocumentCanSaveChanged', this.isDocumentCanSave);
......@@ -3532,6 +3541,9 @@ var editor;
// Frozen pane
prot["asc_freezePane"] = prot.asc_freezePane;
// Sparklines
prot["asc_setSparklineGroup"] = prot.asc_setSparklineGroup;
// Cell interface
prot["asc_getCellInfo"] = prot.asc_getCellInfo;
prot["asc_getActiveCellCoord"] = prot.asc_getActiveCellCoord;
......
......@@ -378,34 +378,6 @@ var c_oAscPopUpSelectorType = {
Custom: 2
};
var c_oAscSparklineAttributes = {
type: 1,
lineWeight: 2,
displayEmptyCellsAs: 4,
markers: 8,
high: 16,
low: 32,
first: 64,
last: 128,
negative: 256,
displayXAxis: 512,
displayHidden: 1024,
minAxisType: 2048,
maxAxisType: 4096,
rightToLeft: 8192
};
var c_oAscSparklineColors = {
Series: 1,
Negative: 2,
Axis: 4,
Markers: 8,
First: 16,
Last: 32,
High: 64,
Low: 128
};
//----------------------------------------------------------export----------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
window['AscCommonExcel'].c_oAscAlignType = c_oAscAlignType;
......@@ -593,30 +565,4 @@ var c_oAscPopUpSelectorType = {
prot['Individual'] = prot.Individual;
prot['Group'] = prot.Group;
prot['Custom'] = prot.Custom;
window['Asc']['c_oAscSparklineAttributes'] = window['Asc'].c_oAscSparklineAttributes = c_oAscSparklineAttributes;
prot = c_oAscSparklineAttributes;
prot['type'] = prot.type;
prot['lineWeight'] = prot.lineWeight;
prot['displayEmptyCellsAs'] = prot.displayEmptyCellsAs;
prot['markers'] = prot.markers;
prot['high'] = prot.high;
prot['low'] = prot.low;
prot['first'] = prot.first;
prot['last'] = prot.last;
prot['negative'] = prot.negative;
prot['displayXAxis'] = prot.displayXAxis;
prot['displayHidden'] = prot.displayHidden;
prot['minAxisType'] = prot.minAxisType;
prot['maxAxisType'] = prot.maxAxisType;
prot['rightToLeft'] = prot.rightToLeft;
window['Asc']['c_oAscSparklineColors'] = window['Asc'].c_oAscSparklineColors = c_oAscSparklineColors;
prot = c_oAscSparklineColors;
prot['Series'] = prot.Series;
prot['Negative'] = prot.Negative;
prot['Axis'] = prot.Axis;
prot['Markers'] = prot.Markers;
prot['First'] = prot.First;
prot['Last'] = prot.Last;
prot['High'] = prot.High;
prot['Low'] = prot.Low;
})(window);
......@@ -173,6 +173,12 @@ CHistory.prototype.init = function(workbook) {
CHistory.prototype.Is_UserSaveMode = function() {
return this.UserSaveMode;
};
CHistory.prototype.Is_Clear = function() {
if ( this.Points.length <= 0 )
return true;
return false;
};
CHistory.prototype.Clear = function()
{
this.Index = -1;
......@@ -709,7 +715,7 @@ CHistory.prototype._sendCanUndoRedo = function()
{
this.workbook.handlers.trigger("setCanUndo", this.Can_Undo());
this.workbook.handlers.trigger("setCanRedo", this.Can_Redo());
this.workbook.handlers.trigger("setDocumentModified", this.Is_Modified());
this.workbook.handlers.trigger("setDocumentModified", this.Have_Changes());
};
CHistory.prototype.SetSelection = function(range)
{
......@@ -835,7 +841,7 @@ CHistory.prototype.Get_DeleteIndex = function () {
return DeleteIndex;
};
/** @returns {boolean} */
CHistory.prototype.Is_Modified = function(IsNotUserSave) {
CHistory.prototype.Have_Changes = function(IsNotUserSave) {
var checkIndex = (this.Is_UserSaveMode() && !IsNotUserSave) ? this.UserSavedIndex : this.SavedIndex;
if (-1 === this.Index && null === checkIndex && false === this.ForceSave) {
return false;
......
......@@ -6663,7 +6663,7 @@
var oThis = this;
var res = c_oSerConstants.ReadOk;
if (c_oSer_Sparkline.SparklineGroup === type) {
var newSparklineGroup = new AscCommonExcel.sparklineGroup();
var newSparklineGroup = new AscCommonExcel.sparklineGroup(true);
res = this.bcr.Read1(length, function (t, l) {
return oThis.ReadSparklineGroup(t, l, newSparklineGroup);
});
......
......@@ -4580,90 +4580,25 @@ CellArea.prototype = {
};
/** @constructor */
function propertyChanges() {
this.propertyObj = {};
}
propertyChanges.prototype.getType = function () {
return AscCommonExcel.UndoRedoDataTypes.PropertyChanges;
};
propertyChanges.prototype.getProperties = function () {
var res = {};
for (var i in this.propertyObj) {
res[i] = i;
}
return res;
};
propertyChanges.prototype.getProperty = function (nType) {
return this.propertyObj[nType];
};
propertyChanges.prototype.setProperty = function (nType, value) {
this.propertyObj[nType] = value;
};
/** @constructor */
function sparklineChanges() {
this.Properties = {
attributes: 0,
colors: 1
};
this.attributes = new propertyChanges();
this.colors = new propertyChanges();
}
sparklineChanges.prototype.getType = function () {
return AscCommonExcel.UndoRedoDataTypes.SparklineProps;
};
sparklineChanges.prototype.getProperties = function () {
return this.Properties;
};
sparklineChanges.prototype.getProperty = function (nType) {
switch (nType) {
case this.Properties.attributes:
return this.attributes;
break;
case this.Properties.colors:
return this.colors;
break;
}
return null;
};
sparklineChanges.prototype.setProperty = function (nType, value) {
switch (nType) {
case this.Properties.attributes:
this.attributes = value;
break;
case this.Properties.colors:
this.colors = value;
break;
}
};
sparklineChanges.prototype.setAttribute = function (type, value) {
this.attributes.setProperty(type, value);
};
sparklineChanges.prototype.setColor = function (type, value) {
this.colors.setProperty(type, value);
};
/** @constructor */
function sparklineGroup() {
function sparklineGroup(addId) {
// attributes
this.type = Asc.c_oAscSparklineType.Line;
this.lineWeight = 0.75;
this.displayEmptyCellsAs = Asc.c_oAscEDispBlanksAs.Zero;
this.markers = false;
this.high = false;
this.low = false;
this.first = false;
this.last = false;
this.negative = false;
this.displayXAxis = false;
this.displayHidden = false;
this.minAxisType = Asc.c_oAscSparklineAxisMinMax.Individual;
this.maxAxisType = Asc.c_oAscSparklineAxisMinMax.Individual;
this.rightToLeft = false;
this.type = null;
this.lineWeight = null;
this.displayEmptyCellsAs = null;
this.markers = null;
this.high = null;
this.low = null;
this.first = null;
this.last = null;
this.negative = null;
this.displayXAxis = null;
this.displayHidden = null;
this.minAxisType = null;
this.maxAxisType = null;
this.rightToLeft = null;
this.manualMax = null;
this.manualMin = null;
this.manualMax = undefined;
this.manualMin = undefined;
this.dateAxis = false;
// elements
......@@ -4684,14 +4619,82 @@ CellArea.prototype = {
this.canvas = null;
this.sparklineView = null;
// for changes
this.sparklineChanges = null;
this.Id = null;
if (addId) {
this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add(this, this.Id);
}
}
sparklineGroup.prototype.Get_Id = function () {
return this.Id;
};
sparklineGroup.prototype.default = function () {
this.type = Asc.c_oAscSparklineType.Line;
this.lineWeight = 0.75;
this.displayEmptyCellsAs = Asc.c_oAscEDispBlanksAs.Zero;
this.markers = false;
this.high = false;
this.low = false;
this.first = false;
this.last = false;
this.negative = false;
this.displayXAxis = false;
this.displayHidden = false;
this.minAxisType = Asc.c_oAscSparklineAxisMinMax.Individual;
this.maxAxisType = Asc.c_oAscSparklineAxisMinMax.Individual;
this.rightToLeft = false;
this.manualMax = null;
this.manualMin = null;
// elements
var defaultSeriesColor = 3629202;
var defaultOtherColor = 13631488;
this.colorSeries = new AscCommonExcel.RgbColor(defaultSeriesColor);
this.colorNegative = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorAxis = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorMarkers = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorFirst = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorLast = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorHigh = new AscCommonExcel.RgbColor(defaultOtherColor);
this.colorLow = new AscCommonExcel.RgbColor(defaultOtherColor);
};
sparklineGroup.prototype.set = function (val) {
this.lineWeight = null !== val.lineWeight ? val.lineWeight : this.lineWeight;
this.type = null !== val.type ? val.type : this.type;
this.dateAxis = null !== val.dateAxis ? val.dateAxis : this.dateAxis;
this.displayEmptyCellsAs = null !== val.displayEmptyCellsAs ? val.displayEmptyCellsAs : this.displayEmptyCellsAs;
this.markers = null !== val.markers ? val.markers : this.markers;
this.high = null !== val.high ? val.high : this.high;
this.low = null !== val.low ? val.low : this.low;
this.first = null !== val.first ? val.first : this.first;
this.last = null !== val.last ? val.last : this.last;
this.negative = null !== val.negative ? val.negative : this.negative;
this.displayXAxis = null !== val.displayXAxis ? val.displayXAxis : this.displayXAxis;
this.displayHidden = null !== val.displayHidden ? val.displayHidden : this.displayHidden;
this.minAxisType = null !== val.minAxisType ? val.minAxisType : this.minAxisType;
this.maxAxisType = null !== val.maxAxisType ? val.maxAxisType : this.maxAxisType;
this.rightToLeft = null !== val.rightToLeft ? val.rightToLeft : this.rightToLeft;
this.manualMax = null !== val.manualMax ? val.manualMax : this.manualMax;
this.manualMin = null !== val.manualMin ? val.manualMin : this.manualMin;
var getColor = function (color) {
return color instanceof Asc.asc_CColor ? AscCommonExcel.CorrectAscColor(color) : color;
};
this.colorSeries = null !== val.colorSeries ? getColor(val.colorSeries) : this.colorSeries;
this.colorNegative = null !== val.colorNegative ? getColor(val.colorNegative) : this.colorNegative;
this.colorAxis = null !== val.colorAxis ? getColor(val.colorAxis) : this.colorAxis;
this.colorMarkers = null !== val.colorMarkers ? getColor(val.colorMarkers) : this.colorMarkers;
this.colorFirst = null !== val.colorFirst ? getColor(val.colorFirst) : this.colorFirst;
this.colorLast = null !== val.colorLast ? getColor(val.colorLast) : this.colorLast;
this.colorHigh = null !== val.colorHigh ? getColor(val.colorHigh) : this.colorHigh;
this.colorLow = null !== val.colorLow ? getColor(val.colorLow) : this.colorLow;
this.cleanCache();
};
sparklineGroup.prototype.clone = function (onlyProps) {
var res = new sparklineGroup();
res.manualMax = this.manualMax;
res.manualMin = this.manualMin;
var res = new sparklineGroup(!onlyProps);
res.Id = this.Id;
res.lineWeight = this.lineWeight;
res.type = this.type;
res.dateAxis = this.dateAxis;
......@@ -4707,15 +4710,17 @@ CellArea.prototype = {
res.minAxisType = this.minAxisType;
res.maxAxisType = this.maxAxisType;
res.rightToLeft = this.rightToLeft;
res.manualMax = this.manualMax;
res.manualMin = this.manualMin;
res.colorSeries = this.colorSeries ? this.colorSeries.clone() : null;
res.colorNegative = this.colorNegative ? this.colorNegative.clone() : null;
res.colorAxis = this.colorAxis ? this.colorAxis : null;
res.colorMarkers = this.colorMarkers ? this.colorMarkers : null;
res.colorFirst = this.colorFirst ? this.colorFirst : null;
res.colorLast = this.colorLast ? this.colorLast : null;
res.colorHigh = this.colorHigh ? this.colorHigh : null;
res.colorLow = this.colorLow ? this.colorLow : null;
res.colorAxis = this.colorAxis ? this.colorAxis.clone() : null;
res.colorMarkers = this.colorMarkers ? this.colorMarkers.clone() : null;
res.colorFirst = this.colorFirst ? this.colorFirst.clone() : null;
res.colorLast = this.colorLast ? this.colorLast.clone() : null;
res.colorHigh = this.colorHigh ? this.colorHigh.clone() : null;
res.colorLow = this.colorLow ? this.colorLow.clone() : null;
res.f = this.f;
if (!onlyProps) {
......@@ -4762,19 +4767,8 @@ CellArea.prototype = {
}
return -1;
};
sparklineGroup.prototype.asc_setAttribute = function (type, value) {
if (!this.sparklineChanges) {
this.sparklineChanges = new sparklineChanges();
}
this.sparklineChanges.setAttribute(type, value);
};
sparklineGroup.prototype.asc_setColor = function (type, value) {
if (!this.sparklineChanges) {
this.sparklineChanges = new sparklineChanges();
}
this.sparklineChanges.setColor(type, value);
sparklineGroup.prototype.asc_getId = function () {
return this.Id;
};
sparklineGroup.prototype.asc_getType = function () {
return this.type;
......@@ -4818,6 +4812,12 @@ CellArea.prototype = {
sparklineGroup.prototype.asc_getRightToLeft = function () {
return this.rightToLeft;
};
sparklineGroup.prototype.asc_getManualMax = function () {
return this.manualMax;
};
sparklineGroup.prototype.asc_getManualMin = function () {
return this.manualMin;
};
sparklineGroup.prototype.asc_getColorSeries = function () {
return this.colorSeries ? Asc.colorObjToAscColor(this.colorSeries) : this.colorSeries;
};
......@@ -4842,6 +4842,78 @@ CellArea.prototype = {
sparklineGroup.prototype.asc_getColorLow = function () {
return this.colorLow ? Asc.colorObjToAscColor(this.colorLow) : this.colorLow;
};
sparklineGroup.prototype.asc_setType = function (val) {
this.type = val;
};
sparklineGroup.prototype.asc_setLineWeight = function (val) {
this.lineWeight = val;
};
sparklineGroup.prototype.asc_setDisplayEmpty = function (val) {
this.displayEmptyCellsAs = val;
};
sparklineGroup.prototype.asc_setMarkersPoint = function (val) {
this.markers = val;
};
sparklineGroup.prototype.asc_setHighPoint = function (val) {
this.high = val;
};
sparklineGroup.prototype.asc_setLowPoint = function (val) {
this.low = val;
};
sparklineGroup.prototype.asc_setFirstPoint = function (val) {
this.first = val;
};
sparklineGroup.prototype.asc_setLastPoint = function (val) {
this.last = val;
};
sparklineGroup.prototype.asc_setNegativePoint = function (val) {
this.negative = val;
};
sparklineGroup.prototype.asc_setDisplayXAxis = function (val) {
this.displayXAxis = val;
};
sparklineGroup.prototype.asc_setDisplayHidden = function (val) {
this.displayHidden = val;
};
sparklineGroup.prototype.asc_setMinAxisType = function (val) {
this.minAxisType = val;
};
sparklineGroup.prototype.asc_setMaxAxisType = function (val) {
this.maxAxisType = val;
};
sparklineGroup.prototype.asc_setRightToLeft = function (val) {
this.rightToLeft = val;
};
sparklineGroup.prototype.asc_setManualMax = function (val) {
this.manualMax = val;
};
sparklineGroup.prototype.asc_setManualMin = function (val) {
this.manualMin = val;
};
sparklineGroup.prototype.asc_setColorSeries = function (val) {
this.colorSeries = val;
};
sparklineGroup.prototype.asc_setColorNegative = function (val) {
this.colorNegative = val;
};
sparklineGroup.prototype.asc_setColorAxis = function (val) {
this.colorAxis = val;
};
sparklineGroup.prototype.asc_setColorMarkers = function (val) {
this.colorMarkers = val;
};
sparklineGroup.prototype.asc_setColorFirst = function (val) {
this.colorFirst = val;
};
sparklineGroup.prototype.asc_setColorLast = function (val) {
this.colorLast = val;
};
sparklineGroup.prototype.asc_setColorHigh = function (val) {
this.colorHigh = val;
};
sparklineGroup.prototype.asc_setColorLow = function (val) {
this.colorLow = val;
};
sparklineGroup.prototype.createExcellColor = function(aColor) {
var oExcellColor = null;
......@@ -4856,10 +4928,10 @@ CellArea.prototype = {
return oExcellColor;
};
sparklineGroup.prototype.asc_createSparklineGroupByStyle = function(nStyleIndex){
sparklineGroup.prototype.asc_createSparklineGroupByStyle = function (nStyleIndex) {
var oSparklineGroup = this.clone(true);
var oStyle = AscFormat.aSparklinesStyles[nStyleIndex];
if(oStyle) {
if (oStyle) {
oSparklineGroup.colorSeries = this.createExcellColor(oStyle[0]);
oSparklineGroup.colorNegative = this.createExcellColor(oStyle[1]);
oSparklineGroup.colorAxis = this.createExcellColor(0xff000000);
......@@ -4959,18 +5031,17 @@ CellArea.prototype = {
return true;
};
sparklineGroup.prototype.asc_getStyles = function()
{
sparklineGroup.prototype.asc_getStyles = function () {
var aRet = [];
var nStyleIndex = -1;
for(var i = 0; i < 36; ++i){
var nStyleIndex = -1;
for (var i = 0; i < 36; ++i) {
var oSparklineGroup = this.asc_createSparklineGroupByStyle(i);
if(nStyleIndex === -1 && this.isEqualColors(oSparklineGroup)){
nStyleIndex = i;
}
if (nStyleIndex === -1 && this.isEqualColors(oSparklineGroup)) {
nStyleIndex = i;
}
aRet.push(this.asc_getThumbBySparklineGroup(oSparklineGroup));
}
aRet.push(nStyleIndex);
aRet.push(nStyleIndex);
return aRet;
};
......@@ -7185,11 +7256,9 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr
window['AscCommonExcel'].RangeDataManagerElem = RangeDataManagerElem;
window['AscCommonExcel'].RangeDataManager = RangeDataManager;
window['AscCommonExcel'].CellArea = CellArea;
window["AscCommonExcel"].sparklineChanges = sparklineChanges;
window['AscCommonExcel'].sparklineGroup = sparklineGroup;
window["Asc"]["sparklineGroup"] = window['AscCommonExcel'].sparklineGroup = sparklineGroup;
prot = sparklineGroup.prototype;
prot["asc_setAttribute"] = prot.asc_setAttribute;
prot["asc_setColor"] = prot.asc_setColor;
prot["asc_getId"] = prot.asc_getId;
prot["asc_getType"] = prot.asc_getType;
prot["asc_getLineWeight"] = prot.asc_getLineWeight;
prot["asc_getDisplayEmpty"] = prot.asc_getDisplayEmpty;
......@@ -7204,6 +7273,8 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr
prot["asc_getMinAxisType"] = prot.asc_getMinAxisType;
prot["asc_getMaxAxisType"] = prot.asc_getMaxAxisType;
prot["asc_getRightToLeft"] = prot.asc_getRightToLeft;
prot["asc_getManualMax"] = prot.asc_getManualMax;
prot["asc_getManualMin"] = prot.asc_getManualMin;
prot["asc_getColorSeries"] = prot.asc_getColorSeries;
prot["asc_getColorNegative"] = prot.asc_getColorNegative;
prot["asc_getColorAxis"] = prot.asc_getColorAxis;
......@@ -7212,6 +7283,30 @@ function getCurrencyFormat(opt_cultureInfo, opt_fraction, opt_currency, opt_curr
prot["asc_getColorLast"] = prot.asc_getColorLast;
prot["asc_getColorHigh"] = prot.asc_getColorHigh;
prot["asc_getColorLow"] = prot.asc_getColorLow;
prot["asc_setType"] = prot.asc_setType;
prot["asc_setLineWeight"] = prot.asc_setLineWeight;
prot["asc_setDisplayEmpty"] = prot.asc_setDisplayEmpty;
prot["asc_setMarkersPoint"] = prot.asc_setMarkersPoint;
prot["asc_setHighPoint"] = prot.asc_setHighPoint;
prot["asc_setLowPoint"] = prot.asc_setLowPoint;
prot["asc_setFirstPoint"] = prot.asc_setFirstPoint;
prot["asc_setLastPoint"] = prot.asc_setLastPoint;
prot["asc_setNegativePoint"] = prot.asc_setNegativePoint;
prot["asc_setDisplayXAxis"] = prot.asc_setDisplayXAxis;
prot["asc_setDisplayHidden"] = prot.asc_setDisplayHidden;
prot["asc_setMinAxisType"] = prot.asc_setMinAxisType;
prot["asc_setMaxAxisType"] = prot.asc_setMaxAxisType;
prot["asc_setRightToLeft"] = prot.asc_setRightToLeft;
prot["asc_setManualMax"] = prot.asc_setManualMax;
prot["asc_setManualMin"] = prot.asc_setManualMin;
prot["asc_setColorSeries"] = prot.asc_setColorSeries;
prot["asc_setColorNegative"] = prot.asc_setColorNegative;
prot["asc_setColorAxis"] = prot.asc_setColorAxis;
prot["asc_setColorMarkers"] = prot.asc_setColorMarkers;
prot["asc_setColorFirst"] = prot.asc_setColorFirst;
prot["asc_setColorLast"] = prot.asc_setColorLast;
prot["asc_setColorHigh"] = prot.asc_setColorHigh;
prot["asc_setColorLow"] = prot.asc_setColorLow;
prot["asc_createSparklineGroupByStyle"] = prot.asc_createSparklineGroupByStyle;
prot["asc_getThumbBySparklineGroup"] = prot.asc_getThumbBySparklineGroup;
prot["asc_getStyles"] = prot.asc_getStyles;
......
......@@ -691,7 +691,7 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou
var val_ax_props = new AscCommon.asc_ValAxisSettings();
if(settings.type !== c_oAscChartTypeSettings.barStackedPer)
{
if(oSparklineGroup.minAxisType === Asc.c_oAscSparklineAxisMinMax.Custom && oSparklineGroup.manualMin != null)
if(oSparklineGroup.minAxisType === Asc.c_oAscSparklineAxisMinMax.Custom && oSparklineGroup.manualMin !== null)
{
val_ax_props.putMinValRule(c_oAscValAxisRule.fixed);
val_ax_props.putMinVal(oSparklineGroup.manualMin);
......@@ -700,7 +700,7 @@ CSparklineView.prototype.initFromSparkline = function(oSparkline, oSparklineGrou
{
val_ax_props.putMinValRule(c_oAscValAxisRule.auto);
}
if(oSparklineGroup.maxAxisType === Asc.c_oAscSparklineAxisMinMax.Custom && oSparklineGroup.manualMax != null)
if(oSparklineGroup.maxAxisType === Asc.c_oAscSparklineAxisMinMax.Custom && oSparklineGroup.manualMax !== null)
{
val_ax_props.putMinValRule(c_oAscValAxisRule.fixed);
val_ax_props.putMinVal(oSparklineGroup.manualMax);
......
......@@ -589,14 +589,21 @@
this.CoAuthoringApi.onSession = function(data) {
var code = data["code"];
var reason = data["reason"];
var interval = data["interval"];
var extendSession = true;
if (c_oCloseCode.sessionIdle == code) {
extendSession = false;
var lastTime = new Date().getTime();
var idleTime = new Date().getTime() - lastTime;
if (idleTime < interval) {
t.CoAuthoringApi.extendSession(idleTime);
} else {
extendSession = false;
}
} else if (c_oCloseCode.sessionAbsolute == code) {
extendSession = false;
}
if (!extendSession) {
if (true != History.Is_Clear()) {
if (History.Have_Changes()) {
//enter view mode because save async
t.sendEvent('asc_onCoAuthoringDisconnect');
t.asc_setViewMode(true);
......@@ -606,8 +613,13 @@
t.CoAuthoringApi.disconnect(code, reason);
};
AscCommon.CollaborativeEditing.Apply_Changes();
AscCommon.CollaborativeEditing.Send_Changes();
if (t.collaborativeEditing.applyChanges) {
t.collaborativeEditing.applyChanges();
t.collaborativeEditing.sendChanges();
} else {
AscCommon.CollaborativeEditing.Apply_Changes();
AscCommon.CollaborativeEditing.Send_Changes();
}
} else {
t.CoAuthoringApi.disconnect(code, reason);
}
......@@ -619,19 +631,19 @@
* @param {Bool} isDisconnectAtAll окончательно ли отсоединяемся(true) или будем пробовать сделать reconnect(false) + сами отключились
* @param {Bool} isCloseCoAuthoring
*/
this.CoAuthoringApi.onDisconnect = function(e, isDisconnectAtAll, isCloseCoAuthoring)
this.CoAuthoringApi.onDisconnect = function(e, errorCode)
{
if (AscCommon.ConnectionState.None === t.CoAuthoringApi.get_state())
{
t.asyncServerIdEndLoaded();
}
if (isDisconnectAtAll)
if (null != errorCode)
{
// Посылаем наверх эвент об отключении от сервера
t.sendEvent('asc_onCoAuthoringDisconnect');
// И переходим в режим просмотра т.к. мы не можем сохранить файл
t.asc_setViewMode(true);
t.sendEvent('asc_onError', isCloseCoAuthoring ? c_oAscError.ID.UserDrop : c_oAscError.ID.CoAuthoringDisconnect, c_oAscError.Level.NoCritical);
t.sendEvent('asc_onError', errorCode, c_oAscError.Level.NoCritical);
}
};
this.CoAuthoringApi.onDocumentOpen = function(inputWrap)
......
......@@ -102,8 +102,8 @@
this._CoAuthoringApi.onLocksReleasedEnd = function() {
t.callback_OnLocksReleasedEnd();
};
this._CoAuthoringApi.onDisconnect = function(e, isDisconnectAtAll, isCloseCoAuthoring) {
t.callback_OnDisconnect(e, isDisconnectAtAll, isCloseCoAuthoring);
this._CoAuthoringApi.onDisconnect = function(e, errorCode) {
t.callback_OnDisconnect(e, errorCode);
};
this._CoAuthoringApi.onWarning = function(e) {
t.callback_OnWarning(e);
......@@ -328,9 +328,9 @@
}
};
CDocsCoApi.prototype.extendSession = function() {
CDocsCoApi.prototype.extendSession = function(idleTime) {
if (this._CoAuthoringApi && this._onlineWork) {
this._CoAuthoringApi.extendSession();
this._CoAuthoringApi.extendSession(idleTime);
}
};
......@@ -394,9 +394,9 @@
* @param {Bool} isDisconnectAtAll окончательно ли отсоединяемся(true) или будем пробовать сделать reconnect(false) + сами отключились
* @param {Bool} isCloseCoAuthoring
*/
CDocsCoApi.prototype.callback_OnDisconnect = function(e, isDisconnectAtAll, isCloseCoAuthoring) {
CDocsCoApi.prototype.callback_OnDisconnect = function(e, errorCode) {
if (this.onDisconnect) {
this.onDisconnect(e, isDisconnectAtAll, isCloseCoAuthoring);
this.onDisconnect(e, errorCode);
}
};
......@@ -786,8 +786,8 @@
}
};
DocsCoApi.prototype.extendSession = function() {
this._send({'type': 'extendSession'});
DocsCoApi.prototype.extendSession = function(idleTime) {
this._send({'type': 'extendSession', 'idletime': idleTime});
};
DocsCoApi.prototype.openDocument = function(data) {
......@@ -1162,7 +1162,7 @@
DocsCoApi.prototype._onDrop = function(data) {
this.disconnect();
this.onDisconnect(data ? data['description'] : '', true, this.isCloseCoAuthoring);
this.onDisconnect(data ? data['description'] : '', this._getDisconnectErrorCode());
};
DocsCoApi.prototype._onWarning = function(data) {
......@@ -1301,6 +1301,7 @@
'block': this.ownedLockBlocks,
'sessionId': this._id,
'sessionTimeConnect': this._sessionTimeConnect,
'sessionTimeIdle': 0,
'documentFormatSave': this._documentFormatSave,
'view': this._isViewer,
'isCloseCoAuthoring': this.isCloseCoAuthoring,
......@@ -1404,11 +1405,13 @@
t._state = ConnectionState.Reconnect;
var bIsDisconnectAtAll = (c_oCloseCode.serverShutdown === evt.code || c_oCloseCode.sessionIdle === evt.code ||
c_oCloseCode.sessionAbsolute === evt.code || t.attemptCount >= t.maxAttemptCount);
var errorCode = null;
if (bIsDisconnectAtAll) {
t._state = ConnectionState.ClosedAll;
errorCode = t._getDisconnectErrorCode(evt.code);
}
if (t.onDisconnect) {
t.onDisconnect(evt.reason, bIsDisconnectAtAll, t.isCloseCoAuthoring);
t.onDisconnect(evt.reason, errorCode);
}
//Try reconect
if (!bIsDisconnectAtAll) {
......@@ -1437,6 +1440,17 @@
return window['SockJS'] ? window['SockJS'] : require('sockjs');
};
DocsCoApi.prototype._getDisconnectErrorCode = function(opt_closeCode) {
if(c_oCloseCode.serverShutdown === opt_closeCode) {
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
} else if(c_oCloseCode.sessionIdle === opt_closeCode){
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
} else if(c_oCloseCode.sessionAbsolute === opt_closeCode){
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
}
return this.isCloseCoAuthoring ? Asc.c_oAscError.ID.UserDrop : Asc.c_oAscError.ID.CoAuthoringDisconnect;
};
//----------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].CDocsCoApi = CDocsCoApi;
......
......@@ -318,25 +318,24 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
} else {
bEndLoadChanges = true;
}
if (window['IS_NATIVE_EDITOR']) {
result = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
var url;
var nIndex = sFileUrl.lastIndexOf("/");
url = (-1 !== nIndex) ? sFileUrl.substring(0, nIndex + 1) : sFileUrl;
if (0 < result.length) {
oResult.bSerFormat = Signature === result.substring(0, Signature.length);
oResult.data = result;
oResult.url = url;
} else {
bError = true;
}
bEndLoadFile = true;
onEndOpen();
}
if (window['IS_NATIVE_EDITOR']) {
var result = window["native"]["openFileCommand"](sFileUrl, changesUrl, Signature);
var url;
var nIndex = sFileUrl.lastIndexOf("/");
url = (-1 !== nIndex) ? sFileUrl.substring(0, nIndex + 1) : sFileUrl;
if (0 < result.length) {
oResult.bSerFormat = Signature === result.substring(0, Signature.length);
oResult.data = result;
oResult.url = url;
} else {
bError = true;
}
bEndLoadFile = true;
onEndOpen();
}
}
function sendCommand(editor, fCallback, rdata, dataContainer) {
//json не должен превышать размера 2097152, иначе при его чтении будет exception
......@@ -2708,7 +2707,12 @@ CUserCacheColor.prototype.init = function(nColor) {
script.type = 'text/javascript';
script.src = url;
script.onreadystatechange = callback;
script.onreadystatechange = function () {
if (this.readyState === 'complete' || this.readyState === 'loaded') {
script.onreadystatechange = null;
setTimeout(callback, 0);
}
};
script.onload = callback;
// Fire the loading
......
......@@ -432,7 +432,7 @@
}
}
var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + value + "})();";
var _script = "(function(){ var Api = window.g_asc_plugins.api;\n" + value + "\n})();";
eval(_script);
if (pluginData.getAttribute("recalculate") == true)
......
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