Commit 92ad517f authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Переделал отрисовку и добавление закрепленных областей.

asc_freezePane с параметром c_oAscFreezePane
Переделал хранение в истории для закрепленных областей.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55181 954022d7-b5bf-4e40-9824-e11837661b57
parent b8c4234d
...@@ -2674,33 +2674,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -2674,33 +2674,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
asyncImageEndLoadedBackground: function() { asyncImageEndLoadedBackground: function() {
}, },
// Frozen pane // Frozen pane
asc_clearFrozenCell: function() { asc_freezePane: function (type) {
if ( this.wb ) { if (this.wb) {
var ws = this.wb.getWorksheet(); this.wb.getWorksheet().freezePane(type);
ws.clearFrozenCell();
}
},
asc_setSelectedFrozenCell: function() {
if ( this.wb ) {
var ws = this.wb.getWorksheet();
ws.setSelectedFrozenCell();
}
},
asc_setFirstFrozenCol: function() {
if ( this.wb ) {
var ws = this.wb.getWorksheet();
ws.setFirstFrozenCol();
}
},
asc_setFirstFrozenRow: function() {
if ( this.wb ) {
var ws = this.wb.getWorksheet();
ws.setFirstFrozenRow();
} }
}, },
...@@ -3717,10 +3695,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -3717,10 +3695,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_changeShapeImageFromFile"] = prot.asc_changeShapeImageFromFile; prot["asc_changeShapeImageFromFile"] = prot.asc_changeShapeImageFromFile;
// Frozen pane // Frozen pane
prot["asc_clearFrozenCell"] = prot.asc_clearFrozenCell; prot["asc_freezePane"] = prot.asc_freezePane;
prot["asc_setSelectedFrozenCell"] = prot.asc_setSelectedFrozenCell;
prot["asc_setFirstFrozenCol"] = prot.asc_setFirstFrozenCol;
prot["asc_setFirstFrozenRow"] = prot.asc_setFirstFrozenRow;
// Cell interface // Cell interface
prot["asc_getCellInfo"] = prot.asc_getCellInfo; prot["asc_getCellInfo"] = prot.asc_getCellInfo;
......
...@@ -476,6 +476,13 @@ var c_oAscPaneState = { ...@@ -476,6 +476,13 @@ var c_oAscPaneState = {
Frozen : "frozen", Frozen : "frozen",
FrozenSplit : "frozenSplit" FrozenSplit : "frozenSplit"
}; };
var c_oAscFreezePane = {
FreezeSheetPanes : 1,
FreezeTopRow : 2,
FreezeFirstColumn : 3,
FreezeClean : 4
};
var c_oAscCoAuthoringMeBorderColor = new window.CColor(22, 156, 0); var c_oAscCoAuthoringMeBorderColor = new window.CColor(22, 156, 0);
var c_oAscCoAuthoringOtherBorderColor = new window.CColor(238, 53, 37); var c_oAscCoAuthoringOtherBorderColor = new window.CColor(238, 53, 37);
......
...@@ -922,19 +922,19 @@ ...@@ -922,19 +922,19 @@
break; break;
} }
case "td_set_fixed_area":{ case "td_set_fixed_area":{
api.asc_setSelectedFrozenCell(); api.asc_freezePane(c_oAscFreezePane.FreezeSheetPanes);
break; break;
} }
case "td_clean_fixed_area":{ case "td_clean_fixed_area":{
api.asc_clearFrozenCell(); api.asc_freezePane(c_oAscFreezePane.FreezeClean);
break; break;
} }
case "td_set_fixed_col":{ case "td_set_fixed_col":{
api.asc_setFirstFrozenCol(); api.asc_freezePane(c_oAscFreezePane.FreezeFirstColumn);
break; break;
} }
case "td_set_fixed_row":{ case "td_set_fixed_row":{
api.asc_setFirstFrozenRow(); api.asc_freezePane(c_oAscFreezePane.FreezeTopRow);
break; break;
} }
} }
......
...@@ -37,9 +37,7 @@ var historyitem_Worksheet_RemoveCellFormula = 24; ...@@ -37,9 +37,7 @@ var historyitem_Worksheet_RemoveCellFormula = 24;
var historyitem_Worksheet_ChangeMerge = 25; var historyitem_Worksheet_ChangeMerge = 25;
var historyitem_Worksheet_ChangeHyperlink = 26; var historyitem_Worksheet_ChangeHyperlink = 26;
// Frozen cell // Frozen cell
var historyitem_Worksheet_AddFrozenCell = 30; var historyitem_Worksheet_ChangeFrozenCell = 30;
var historyitem_Worksheet_ChangeFrozenCell = 31;
var historyitem_Worksheet_RemoveFrozenCell = 32;
var historyitem_RowCol_Fontname = 1; var historyitem_RowCol_Fontname = 1;
var historyitem_RowCol_Fontsize = 2; var historyitem_RowCol_Fontsize = 2;
......
...@@ -357,8 +357,6 @@ var UndoRedoDataTypes = new function() { ...@@ -357,8 +357,6 @@ var UndoRedoDataTypes = new function() {
this.DocContentParaItemId = 66; this.DocContentParaItemId = 66;
this.ParagraphAddParaItem = 67; this.ParagraphAddParaItem = 67;
this.ParagraphParaItemAdd = 68; this.ParagraphParaItemAdd = 68;
this.FrozenCell = 69;
this.CompositeFrozenCell = 70;
this.Create = function(nType) this.Create = function(nType)
{ {
...@@ -429,79 +427,11 @@ var UndoRedoDataTypes = new function() { ...@@ -429,79 +427,11 @@ var UndoRedoDataTypes = new function() {
case this.GOSetAdjustmentValue: return new UndoRedoDataSetAdjustmentValue(); case this.GOSetAdjustmentValue: return new UndoRedoDataSetAdjustmentValue();
case this.ParagraphAddParaItem: return new UndoRedoDataAddParaItem(); case this.ParagraphAddParaItem: return new UndoRedoDataAddParaItem();
case this.ParagraphParaItemAdd: return new UndoRedoData_historyitem_Paragraph_AddItem(); case this.ParagraphParaItemAdd: return new UndoRedoData_historyitem_Paragraph_AddItem();
case this.FrozenCell: return new UndoRedoData_FrozenCell();
case this.CompositeFrozenCell: return new UndoRedoData_CompositeFrozenCell();
} }
return null; return null;
}; };
}; };
//
function UndoRedoData_FrozenCell(nRow, nCol) {
this.Properties = {
Row: 0,
Col: 1
};
this.nRow = nRow;
this.nCol = nCol;
}
UndoRedoData_FrozenCell.prototype = {
getType : function() {
return UndoRedoDataTypes.FrozenCell;
},
getProperties : function() {
return this.Properties;
},
getProperty : function(nType) {
switch(nType) {
case this.Properties.Row: return this.nRow; break;
case this.Properties.Col: return this.nCol; break;
}
return null;
},
setProperty : function(nType, value) {
switch(nType) {
case this.Properties.Row: this.nRow = value; break;
case this.Properties.Col: this.nCol = value; break;
}
}
};
function UndoRedoData_CompositeFrozenCell(frozenBefore, frozenAfter) {
this.frozenBefore = frozenBefore;
this.frozenAfter = frozenAfter;
this.Properties = {
frozenBefore: 0,
frozenAfter: 1
};
}
UndoRedoData_CompositeFrozenCell.prototype = {
getType: function() {
return UndoRedoDataTypes.CompositeFrozenCell;
},
getProperties: function() {
return this.Properties;
},
getProperty: function(nType) {
switch (nType) {
case this.Properties.frozenBefore: return this.frozenBefore; break;
case this.Properties.frozenAfter: return this.frozenAfter; break;
}
return null;
},
setProperty: function(nType, value) {
switch (nType) {
case this.Properties.frozenBefore: this.frozenBefore = value; break;
case this.Properties.frozenAfter: this.frozenAfter = value; break;
}
}
};
//
function UndoRedoData_CellSimpleData(nRow, nCol, oOldVal, oNewVal, sFormula){ function UndoRedoData_CellSimpleData(nRow, nCol, oOldVal, oNewVal, sFormula){
this.Properties = { this.Properties = {
Row: 0, Row: 0,
...@@ -2992,20 +2922,20 @@ UndoRedoWoorksheet.prototype = { ...@@ -2992,20 +2922,20 @@ UndoRedoWoorksheet.prototype = {
}, },
UndoRedo : function(Type, Data, nSheetId, bUndo) UndoRedo : function(Type, Data, nSheetId, bUndo)
{ {
var api = window["Asc"]["editor"]; var worksheetView, nRow, nCol, oLockInfo, cell, index, from, to, range, r1, c1, r2, c2, temp, i, length, data;
var ws = this.wb.getWorksheetById(nSheetId); var ws = this.wb.getWorksheetById(nSheetId);
if(null == ws) if(null == ws)
return; return;
var collaborativeEditing = this.wb.oApi.collaborativeEditing; var collaborativeEditing = this.wb.oApi.collaborativeEditing;
if(historyitem_Worksheet_RemoveCell == Type) if(historyitem_Worksheet_RemoveCell == Type)
{ {
var nRow = Data.nRow; nRow = Data.nRow;
var nCol = Data.nCol; nCol = Data.nCol;
if(false != this.wb.bCollaborativeChanges) if(false != this.wb.bCollaborativeChanges)
{ {
nRow = collaborativeEditing.getLockOtherRow2(nSheetId, nRow); nRow = collaborativeEditing.getLockOtherRow2(nSheetId, nRow);
nCol = collaborativeEditing.getLockOtherColumn2(nSheetId, nCol); nCol = collaborativeEditing.getLockOtherColumn2(nSheetId, nCol);
var oLockInfo = new Asc.asc_CLockInfo(); oLockInfo = new Asc.asc_CLockInfo();
oLockInfo["sheetId"] = nSheetId; oLockInfo["sheetId"] = nSheetId;
oLockInfo["type"] = c_oAscLockTypeElem.Range; oLockInfo["type"] = c_oAscLockTypeElem.Range;
oLockInfo["rangeOrObjectId"] = new Asc.Range(nCol, nRow, nCol, nRow); oLockInfo["rangeOrObjectId"] = new Asc.Range(nCol, nRow, nCol, nRow);
...@@ -3015,7 +2945,7 @@ UndoRedoWoorksheet.prototype = { ...@@ -3015,7 +2945,7 @@ UndoRedoWoorksheet.prototype = {
{ {
var oValue = Data.oOldVal.value; var oValue = Data.oOldVal.value;
var oStyle = Data.oOldVal.style; var oStyle = Data.oOldVal.style;
var cell = ws._getCell(nRow, nCol); cell = ws._getCell(nRow, nCol);
cell.setValueData(oValue); cell.setValueData(oValue);
if(null != oStyle) if(null != oStyle)
cell.setStyle(oStyle); cell.setStyle(oStyle);
...@@ -3026,11 +2956,11 @@ UndoRedoWoorksheet.prototype = { ...@@ -3026,11 +2956,11 @@ UndoRedoWoorksheet.prototype = {
ws._removeCell(nRow, nCol); ws._removeCell(nRow, nCol);
} }
else if(historyitem_Worksheet_RemoveCellFormula == Type){ else if(historyitem_Worksheet_RemoveCellFormula == Type){
var nRow = Data.nRow; nRow = Data.nRow;
var nCol = Data.nCol; nCol = Data.nCol;
if(bUndo) if(bUndo)
{ {
var cell = ws._getCellNoEmpty(nRow, nCol); cell = ws._getCellNoEmpty(nRow, nCol);
if(cell) if(cell)
{ {
var node = ws.workbook.dependencyFormulas.getNode(ws.getId(), cell.getName()); var node = ws.workbook.dependencyFormulas.getNode(ws.getId(), cell.getName());
...@@ -3041,11 +2971,11 @@ UndoRedoWoorksheet.prototype = { ...@@ -3041,11 +2971,11 @@ UndoRedoWoorksheet.prototype = {
} }
else if(historyitem_Worksheet_ColProp == Type) else if(historyitem_Worksheet_ColProp == Type)
{ {
var index = Data.index; index = Data.index;
if(false != this.wb.bCollaborativeChanges) if(false != this.wb.bCollaborativeChanges)
{ {
index = collaborativeEditing.getLockOtherColumn2(nSheetId, index); index = collaborativeEditing.getLockOtherColumn2(nSheetId, index);
var oLockInfo = new Asc.asc_CLockInfo(); oLockInfo = new Asc.asc_CLockInfo();
oLockInfo["sheetId"] = nSheetId; oLockInfo["sheetId"] = nSheetId;
oLockInfo["type"] = c_oAscLockTypeElem.Range; oLockInfo["type"] = c_oAscLockTypeElem.Range;
oLockInfo["rangeOrObjectId"] = new Asc.Range(index, 0, index, gc_nMaxRow0); oLockInfo["rangeOrObjectId"] = new Asc.Range(index, 0, index, gc_nMaxRow0);
...@@ -3059,11 +2989,11 @@ UndoRedoWoorksheet.prototype = { ...@@ -3059,11 +2989,11 @@ UndoRedoWoorksheet.prototype = {
} }
else if(historyitem_Worksheet_RowProp == Type) else if(historyitem_Worksheet_RowProp == Type)
{ {
var index = Data.index; index = Data.index;
if(false != this.wb.bCollaborativeChanges) if(false != this.wb.bCollaborativeChanges)
{ {
index = collaborativeEditing.getLockOtherRow2(nSheetId, index); index = collaborativeEditing.getLockOtherRow2(nSheetId, index);
var oLockInfo = new Asc.asc_CLockInfo(); oLockInfo = new Asc.asc_CLockInfo();
oLockInfo["sheetId"] = nSheetId; oLockInfo["sheetId"] = nSheetId;
oLockInfo["type"] = c_oAscLockTypeElem.Range; oLockInfo["type"] = c_oAscLockTypeElem.Range;
oLockInfo["rangeOrObjectId"] = new Asc.Range(0, index, gc_nMaxCol0, index); oLockInfo["rangeOrObjectId"] = new Asc.Range(0, index, gc_nMaxCol0, index);
...@@ -3077,22 +3007,22 @@ UndoRedoWoorksheet.prototype = { ...@@ -3077,22 +3007,22 @@ UndoRedoWoorksheet.prototype = {
} }
else if(historyitem_Worksheet_AddRows == Type || historyitem_Worksheet_RemoveRows == Type) else if(historyitem_Worksheet_AddRows == Type || historyitem_Worksheet_RemoveRows == Type)
{ {
var from = Data.from; from = Data.from;
var to = Data.to; to = Data.to;
if(false != this.wb.bCollaborativeChanges) if(false != this.wb.bCollaborativeChanges)
{ {
from = collaborativeEditing.getLockOtherRow2(nSheetId, from); from = collaborativeEditing.getLockOtherRow2(nSheetId, from);
to = collaborativeEditing.getLockOtherRow2(nSheetId, to); to = collaborativeEditing.getLockOtherRow2(nSheetId, to);
if(false == ((true == bUndo && historyitem_Worksheet_AddRows == Type) || (false == bUndo && historyitem_Worksheet_RemoveRows == Type))) if(false == ((true == bUndo && historyitem_Worksheet_AddRows == Type) || (false == bUndo && historyitem_Worksheet_RemoveRows == Type)))
{ {
var oLockInfo = new Asc.asc_CLockInfo(); oLockInfo = new Asc.asc_CLockInfo();
oLockInfo["sheetId"] = nSheetId; oLockInfo["sheetId"] = nSheetId;
oLockInfo["type"] = c_oAscLockTypeElem.Range; oLockInfo["type"] = c_oAscLockTypeElem.Range;
oLockInfo["rangeOrObjectId"] = new Asc.Range(0, from, gc_nMaxCol0, to); oLockInfo["rangeOrObjectId"] = new Asc.Range(0, from, gc_nMaxCol0, to);
this.wb.aCollaborativeChangeElements.push(oLockInfo); this.wb.aCollaborativeChangeElements.push(oLockInfo);
} }
} }
var range = Asc.Range(0, from, gc_nMaxCol0, to); range = Asc.Range(0, from, gc_nMaxCol0, to);
if((true == bUndo && historyitem_Worksheet_AddRows == Type) || (false == bUndo && historyitem_Worksheet_RemoveRows == Type)) if((true == bUndo && historyitem_Worksheet_AddRows == Type) || (false == bUndo && historyitem_Worksheet_RemoveRows == Type))
ws.workbook.handlers.trigger("deleteCell", nSheetId, c_oAscDeleteOptions.DeleteRows, range); ws.workbook.handlers.trigger("deleteCell", nSheetId, c_oAscDeleteOptions.DeleteRows, range);
else else
...@@ -3104,15 +3034,15 @@ UndoRedoWoorksheet.prototype = { ...@@ -3104,15 +3034,15 @@ UndoRedoWoorksheet.prototype = {
} }
else if(historyitem_Worksheet_AddCols == Type || historyitem_Worksheet_RemoveCols == Type) else if(historyitem_Worksheet_AddCols == Type || historyitem_Worksheet_RemoveCols == Type)
{ {
var from = Data.from; from = Data.from;
var to = Data.to; to = Data.to;
if(false != this.wb.bCollaborativeChanges) if(false != this.wb.bCollaborativeChanges)
{ {
from = collaborativeEditing.getLockOtherColumn2(nSheetId, from); from = collaborativeEditing.getLockOtherColumn2(nSheetId, from);
to = collaborativeEditing.getLockOtherColumn2(nSheetId, to); to = collaborativeEditing.getLockOtherColumn2(nSheetId, to);
if(false == ((true == bUndo && historyitem_Worksheet_AddCols == Type) || (false == bUndo && historyitem_Worksheet_RemoveCols == Type))) if(false == ((true == bUndo && historyitem_Worksheet_AddCols == Type) || (false == bUndo && historyitem_Worksheet_RemoveCols == Type)))
{ {
var oLockInfo = new Asc.asc_CLockInfo(); oLockInfo = new Asc.asc_CLockInfo();
oLockInfo["sheetId"] = nSheetId; oLockInfo["sheetId"] = nSheetId;
oLockInfo["type"] = c_oAscLockTypeElem.Range; oLockInfo["type"] = c_oAscLockTypeElem.Range;
oLockInfo["rangeOrObjectId"] = new Asc.Range(from, 0, to, gc_nMaxRow0); oLockInfo["rangeOrObjectId"] = new Asc.Range(from, 0, to, gc_nMaxRow0);
...@@ -3120,7 +3050,7 @@ UndoRedoWoorksheet.prototype = { ...@@ -3120,7 +3050,7 @@ UndoRedoWoorksheet.prototype = {
} }
} }
var range = Asc.Range(from, 0, to, gc_nMaxRow0); range = Asc.Range(from, 0, to, gc_nMaxRow0);
if((true == bUndo && historyitem_Worksheet_AddCols == Type) || (false == bUndo && historyitem_Worksheet_RemoveCols == Type)) if((true == bUndo && historyitem_Worksheet_AddCols == Type) || (false == bUndo && historyitem_Worksheet_RemoveCols == Type))
ws.workbook.handlers.trigger("deleteCell", nSheetId, c_oAscDeleteOptions.DeleteColumns, range); ws.workbook.handlers.trigger("deleteCell", nSheetId, c_oAscDeleteOptions.DeleteColumns, range);
else else
...@@ -3132,10 +3062,10 @@ UndoRedoWoorksheet.prototype = { ...@@ -3132,10 +3062,10 @@ UndoRedoWoorksheet.prototype = {
} }
else if(historyitem_Worksheet_ShiftCellsLeft == Type || historyitem_Worksheet_ShiftCellsRight == Type) else if(historyitem_Worksheet_ShiftCellsLeft == Type || historyitem_Worksheet_ShiftCellsRight == Type)
{ {
var r1 = Data.r1; r1 = Data.r1;
var c1 = Data.c1; c1 = Data.c1;
var r2 = Data.r2; r2 = Data.r2;
var c2 = Data.c2; c2 = Data.c2;
if(false != this.wb.bCollaborativeChanges) if(false != this.wb.bCollaborativeChanges)
{ {
r1 = collaborativeEditing.getLockOtherRow2(nSheetId, r1); r1 = collaborativeEditing.getLockOtherRow2(nSheetId, r1);
...@@ -3144,7 +3074,7 @@ UndoRedoWoorksheet.prototype = { ...@@ -3144,7 +3074,7 @@ UndoRedoWoorksheet.prototype = {
c2 = collaborativeEditing.getLockOtherColumn2(nSheetId, c2); c2 = collaborativeEditing.getLockOtherColumn2(nSheetId, c2);
if(false == ((true == bUndo && historyitem_Worksheet_ShiftCellsLeft == Type) || (false == bUndo && historyitem_Worksheet_ShiftCellsRight == Type))) if(false == ((true == bUndo && historyitem_Worksheet_ShiftCellsLeft == Type) || (false == bUndo && historyitem_Worksheet_ShiftCellsRight == Type)))
{ {
var oLockInfo = new Asc.asc_CLockInfo(); oLockInfo = new Asc.asc_CLockInfo();
oLockInfo["sheetId"] = nSheetId; oLockInfo["sheetId"] = nSheetId;
oLockInfo["type"] = c_oAscLockTypeElem.Range; oLockInfo["type"] = c_oAscLockTypeElem.Range;
oLockInfo["rangeOrObjectId"] = new Asc.Range(c1, r1, c2, r2); oLockInfo["rangeOrObjectId"] = new Asc.Range(c1, r1, c2, r2);
...@@ -3158,10 +3088,10 @@ UndoRedoWoorksheet.prototype = { ...@@ -3158,10 +3088,10 @@ UndoRedoWoorksheet.prototype = {
} }
else if(historyitem_Worksheet_ShiftCellsTop == Type || historyitem_Worksheet_ShiftCellsBottom == Type) else if(historyitem_Worksheet_ShiftCellsTop == Type || historyitem_Worksheet_ShiftCellsBottom == Type)
{ {
var r1 = Data.r1; r1 = Data.r1;
var c1 = Data.c1; c1 = Data.c1;
var r2 = Data.r2; r2 = Data.r2;
var c2 = Data.c2; c2 = Data.c2;
if(false != this.wb.bCollaborativeChanges) if(false != this.wb.bCollaborativeChanges)
{ {
r1 = collaborativeEditing.getLockOtherRow2(nSheetId, r1); r1 = collaborativeEditing.getLockOtherRow2(nSheetId, r1);
...@@ -3170,7 +3100,7 @@ UndoRedoWoorksheet.prototype = { ...@@ -3170,7 +3100,7 @@ UndoRedoWoorksheet.prototype = {
c2 = collaborativeEditing.getLockOtherColumn2(nSheetId, c2); c2 = collaborativeEditing.getLockOtherColumn2(nSheetId, c2);
if(false == ((true == bUndo && historyitem_Worksheet_ShiftCellsTop == Type) || (false == bUndo && historyitem_Worksheet_ShiftCellsBottom == Type))) if(false == ((true == bUndo && historyitem_Worksheet_ShiftCellsTop == Type) || (false == bUndo && historyitem_Worksheet_ShiftCellsBottom == Type)))
{ {
var oLockInfo = new Asc.asc_CLockInfo(); oLockInfo = new Asc.asc_CLockInfo();
oLockInfo["sheetId"] = nSheetId; oLockInfo["sheetId"] = nSheetId;
oLockInfo["type"] = c_oAscLockTypeElem.Range; oLockInfo["type"] = c_oAscLockTypeElem.Range;
oLockInfo["rangeOrObjectId"] = new Asc.Range(c1, r1, c2, r2); oLockInfo["rangeOrObjectId"] = new Asc.Range(c1, r1, c2, r2);
...@@ -3192,31 +3122,31 @@ UndoRedoWoorksheet.prototype = { ...@@ -3192,31 +3122,31 @@ UndoRedoWoorksheet.prototype = {
bbox.c1 = collaborativeEditing.getLockOtherColumn2(nSheetId, bbox.c1); bbox.c1 = collaborativeEditing.getLockOtherColumn2(nSheetId, bbox.c1);
bbox.r2 = collaborativeEditing.getLockOtherRow2(nSheetId, bbox.r2); bbox.r2 = collaborativeEditing.getLockOtherRow2(nSheetId, bbox.r2);
bbox.c2 = collaborativeEditing.getLockOtherColumn2(nSheetId, bbox.c2); bbox.c2 = collaborativeEditing.getLockOtherColumn2(nSheetId, bbox.c2);
for(var i = 0, length = Data.places.length; i < length; ++i) for(i = 0, length = Data.places.length; i < length; ++i)
{ {
var place = Data.places[i]; var place = Data.places[i];
place.from = collaborativeEditing.getLockOtherRow2(nSheetId, place.from); place.from = collaborativeEditing.getLockOtherRow2(nSheetId, place.from);
place.to = collaborativeEditing.getLockOtherRow2(nSheetId, place.to); place.to = collaborativeEditing.getLockOtherRow2(nSheetId, place.to);
var oLockInfo = new Asc.asc_CLockInfo(); oLockInfo = new Asc.asc_CLockInfo();
oLockInfo["sheetId"] = nSheetId; oLockInfo["sheetId"] = nSheetId;
oLockInfo["type"] = c_oAscLockTypeElem.Range; oLockInfo["type"] = c_oAscLockTypeElem.Range;
oLockInfo["rangeOrObjectId"] = new Asc.Range(bbox.c1, place.from, bbox.c2, place.from); oLockInfo["rangeOrObjectId"] = new Asc.Range(bbox.c1, place.from, bbox.c2, place.from);
this.wb.aCollaborativeChangeElements.push(oLockInfo); this.wb.aCollaborativeChangeElements.push(oLockInfo);
} }
} }
var range = ws.getRange(new CellAddress(bbox.r1, bbox.c1, 0), new CellAddress(bbox.r2, bbox.c2, 0)); range = ws.getRange(new CellAddress(bbox.r1, bbox.c1, 0), new CellAddress(bbox.r2, bbox.c2, 0));
range._sortByArray(bbox, places); range._sortByArray(bbox, places);
} }
else if(historyitem_Worksheet_MoveRange == Type) else if(historyitem_Worksheet_MoveRange == Type)
{ {
//todo worksheetView.autoFilters._moveAutoFilters(worksheetView ,null, null, g_oUndoRedoAutoFiltersMoveData); //todo worksheetView.autoFilters._moveAutoFilters(worksheetView ,null, null, g_oUndoRedoAutoFiltersMoveData);
var from = Asc.Range(Data.from.c1, Data.from.r1, Data.from.c2, Data.from.r2); from = Asc.Range(Data.from.c1, Data.from.r1, Data.from.c2, Data.from.r2);
var to = Asc.Range(Data.to.c1, Data.to.r1, Data.to.c2, Data.to.r2); to = Asc.Range(Data.to.c1, Data.to.r1, Data.to.c2, Data.to.r2);
var copyRange = Data.copyRange; var copyRange = Data.copyRange;
if(bUndo) if(bUndo)
{ {
var temp = from; temp = from;
from = to; from = to;
to = temp; to = temp;
} }
...@@ -3240,7 +3170,7 @@ UndoRedoWoorksheet.prototype = { ...@@ -3240,7 +3170,7 @@ UndoRedoWoorksheet.prototype = {
else{ else{
ws._moveRange(from, to, copyRange); ws._moveRange(from, to, copyRange);
} }
var worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId); worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
if(bUndo)//если на Undo перемещается диапазон из форматированной таблицы - стиль форматированной таблицы не должен цепляться if(bUndo)//если на Undo перемещается диапазон из форматированной таблицы - стиль форматированной таблицы не должен цепляться
{ {
worksheetView.autoFilters._clearFormatTableStyle(to); worksheetView.autoFilters._clearFormatTableStyle(to);
...@@ -3260,10 +3190,10 @@ UndoRedoWoorksheet.prototype = { ...@@ -3260,10 +3190,10 @@ UndoRedoWoorksheet.prototype = {
{ {
if(historyitem_Worksheet_Unmerge == Type) if(historyitem_Worksheet_Unmerge == Type)
bUndo = !bUndo; bUndo = !bUndo;
var r1 = Data.r1; r1 = Data.r1;
var c1 = Data.c1; c1 = Data.c1;
var r2 = Data.r2; r2 = Data.r2;
var c2 = Data.c2; c2 = Data.c2;
if(false != this.wb.bCollaborativeChanges) if(false != this.wb.bCollaborativeChanges)
{ {
r1 = collaborativeEditing.getLockOtherRow2(nSheetId, r1); r1 = collaborativeEditing.getLockOtherRow2(nSheetId, r1);
...@@ -3271,7 +3201,7 @@ UndoRedoWoorksheet.prototype = { ...@@ -3271,7 +3201,7 @@ UndoRedoWoorksheet.prototype = {
r2 = collaborativeEditing.getLockOtherRow2(nSheetId, r2); r2 = collaborativeEditing.getLockOtherRow2(nSheetId, r2);
c2 = collaborativeEditing.getLockOtherColumn2(nSheetId, c2); c2 = collaborativeEditing.getLockOtherColumn2(nSheetId, c2);
} }
var range = ws.getRange(new CellAddress(r1, c1, 0), new CellAddress(r2, c2, 0)); range = ws.getRange(new CellAddress(r1, c1, 0), new CellAddress(r2, c2, 0));
if(bUndo) if(bUndo)
range.unmerge(); range.unmerge();
else else
...@@ -3285,10 +3215,10 @@ UndoRedoWoorksheet.prototype = { ...@@ -3285,10 +3215,10 @@ UndoRedoWoorksheet.prototype = {
if(false != this.wb.bCollaborativeChanges) if(false != this.wb.bCollaborativeChanges)
{ {
var bboxRef = Data.Ref.getBBox0(); var bboxRef = Data.Ref.getBBox0();
var r1 = collaborativeEditing.getLockOtherRow2(nSheetId, bboxRef.r1); r1 = collaborativeEditing.getLockOtherRow2(nSheetId, bboxRef.r1);
var c1 = collaborativeEditing.getLockOtherColumn2(nSheetId, bboxRef.c1); c1 = collaborativeEditing.getLockOtherColumn2(nSheetId, bboxRef.c1);
var r2 = collaborativeEditing.getLockOtherRow2(nSheetId, bboxRef.r2); r2 = collaborativeEditing.getLockOtherRow2(nSheetId, bboxRef.r2);
var c2 = collaborativeEditing.getLockOtherColumn2(nSheetId, bboxRef.c2); c2 = collaborativeEditing.getLockOtherColumn2(nSheetId, bboxRef.c2);
Ref.setOffsetFirst({offsetCol: c1 - bboxRef.c1, offsetRow: r1 - bboxRef.r1}); Ref.setOffsetFirst({offsetCol: c1 - bboxRef.c1, offsetRow: r1 - bboxRef.r1});
Ref.setOffsetLast({offsetCol: c2 - bboxRef.c2, offsetRow: r2 - bboxRef.r2}); Ref.setOffsetLast({offsetCol: c2 - bboxRef.c2, offsetRow: r2 - bboxRef.r2});
} }
...@@ -3350,22 +3280,22 @@ UndoRedoWoorksheet.prototype = { ...@@ -3350,22 +3280,22 @@ UndoRedoWoorksheet.prototype = {
ws.setSheetViewSettings(bUndo ? Data.from : Data.to); ws.setSheetViewSettings(bUndo ? Data.from : Data.to);
} }
else if(historyitem_Worksheet_ChangeMerge === Type){ else if(historyitem_Worksheet_ChangeMerge === Type){
var from = null; from = null;
if(null != Data.from) if(null != Data.from)
from = new Asc.Range(Data.from.c1, Data.from.r1, Data.from.c2, Data.from.r2); from = new Asc.Range(Data.from.c1, Data.from.r1, Data.from.c2, Data.from.r2);
var to = null; to = null;
if(null != Data.to) if(null != Data.to)
to = new Asc.Range(Data.to.c1, Data.to.r1, Data.to.c2, Data.to.r2); to = new Asc.Range(Data.to.c1, Data.to.r1, Data.to.c2, Data.to.r2);
if(bUndo) if(bUndo)
{ {
var temp = from; temp = from;
from = to; from = to;
to = temp; to = temp;
} }
if(null != from && null != from.r1 && null != from.c1 && null != from.r2 && null != from.c2) if(null != from && null != from.r1 && null != from.c1 && null != from.r2 && null != from.c2)
{ {
var aMerged = ws.mergeManager.get(from); var aMerged = ws.mergeManager.get(from);
for(var i in aMerged.inner) for(i in aMerged.inner)
{ {
var merged = aMerged.inner[i]; var merged = aMerged.inner[i];
if(merged.bbox.isEqual(from)) if(merged.bbox.isEqual(from))
...@@ -3375,29 +3305,29 @@ UndoRedoWoorksheet.prototype = { ...@@ -3375,29 +3305,29 @@ UndoRedoWoorksheet.prototype = {
} }
} }
} }
var data = 1; data = 1;
if(null != to && null != to.r1 && null != to.c1 && null != to.r2 && null != to.c2) if(null != to && null != to.r1 && null != to.c1 && null != to.r2 && null != to.c2)
ws.mergeManager.add(to, data); ws.mergeManager.add(to, data);
} }
else if(historyitem_Worksheet_ChangeHyperlink === Type){ else if(historyitem_Worksheet_ChangeHyperlink === Type){
var from = null; from = null;
if(null != Data.from) if(null != Data.from)
from = new Asc.Range(Data.from.c1, Data.from.r1, Data.from.c2, Data.from.r2); from = new Asc.Range(Data.from.c1, Data.from.r1, Data.from.c2, Data.from.r2);
var to = null; to = null;
if(null != Data.to) if(null != Data.to)
to = new Asc.Range(Data.to.c1, Data.to.r1, Data.to.c2, Data.to.r2); to = new Asc.Range(Data.to.c1, Data.to.r1, Data.to.c2, Data.to.r2);
if(bUndo) if(bUndo)
{ {
var temp = from; temp = from;
from = to; from = to;
to = temp; to = temp;
} }
//не делаем clone потому что предполагаем, что здесь могут быть только операции изменения рзмеров, перемещение или удаления одной ссылки //не делаем clone потому что предполагаем, что здесь могут быть только операции изменения рзмеров, перемещение или удаления одной ссылки
var data = null; data = null;
if(null != from && null != from.r1 && null != from.c1 && null != from.r2 && null != from.c2) if(null != from && null != from.r1 && null != from.c1 && null != from.r2 && null != from.c2)
{ {
var aHyperlinks = ws.hyperlinkManager.get(from); var aHyperlinks = ws.hyperlinkManager.get(from);
for(var i in aHyperlinks.inner) for(i in aHyperlinks.inner)
{ {
var hyp = aHyperlinks.inner[i]; var hyp = aHyperlinks.inner[i];
if(hyp.bbox.isEqual(from)) if(hyp.bbox.isEqual(from))
...@@ -3415,54 +3345,10 @@ UndoRedoWoorksheet.prototype = { ...@@ -3415,54 +3345,10 @@ UndoRedoWoorksheet.prototype = {
data.Ref = ws.getRange3(to.r1, to.c1, to.r2, to.c2); data.Ref = ws.getRange3(to.r1, to.c1, to.r2, to.c2);
ws.hyperlinkManager.add(to, data); ws.hyperlinkManager.add(to, data);
} }
} } else if (historyitem_Worksheet_ChangeFrozenCell === Type) {
// Frozen anchor worksheetView = this.wb.oApi.wb.getWorksheetById(nSheetId);
else if (historyitem_Worksheet_AddFrozenCell === Type) { var updateData = bUndo ? Data.from : Data.to;
if ( !api.wb ) worksheetView._updateFreezePane(updateData.c1, updateData.r1, /*lockDraw*/true);
return;
var wsView = api.wb.getWorksheetById(nSheetId);
if ( bUndo ) {
wsView.topLeftFrozenCell = null;
wsView.visibleRange.c1 = 0;
wsView.visibleRange.r1 = 0;
}
else {
wsView.topLeftFrozenCell = new CellAddress(Data.nRow, Data.nCol, 0);
wsView.visibleRange.c1 = Data.nCol;
wsView.visibleRange.r1 = Data.nRow;
}
wsView.objectRender.drawingArea.init();
}
else if (historyitem_Worksheet_ChangeFrozenCell === Type) {
if ( !api.wb )
return;
var wsView = api.wb.getWorksheetById(nSheetId);
if ( bUndo ) {
wsView.topLeftFrozenCell = new CellAddress(Data.frozenBefore.nRow, Data.frozenBefore.nCol, 0);
wsView.visibleRange.c1 = Data.frozenBefore.nCol;
wsView.visibleRange.r1 = Data.frozenBefore.nRow;
}
else {
wsView.topLeftFrozenCell = new CellAddress(Data.frozenAfter.nRow, Data.frozenAfter.nCol, 0);
wsView.visibleRange.c1 = Data.frozenAfter.nCol;
wsView.visibleRange.r1 = Data.frozenAfter.nRow;
}
wsView.objectRender.drawingArea.init();
}
else if (historyitem_Worksheet_RemoveFrozenCell === Type) {
if ( bUndo ) {
wsView.topLeftFrozenCell = new CellAddress(Data.nRow, Data.nCol, 0);
wsView.visibleRange.c1 = Data.nCol;
wsView.visibleRange.r1 = Data.nRow;
}
else {
wsView.topLeftFrozenCell = null;
wsView.visibleRange.c1 = 0;
wsView.visibleRange.r1 = 0;
}
wsView.objectRender.drawingArea.init();
} }
} }
}; };
......
...@@ -1020,7 +1020,8 @@ ...@@ -1020,7 +1020,8 @@
var res = new asc_CPane(); var res = new asc_CPane();
res.state = this.state; res.state = this.state;
res.topLeftCell = this.topLeftCell; res.topLeftCell = this.topLeftCell;
res.topLeftFrozenCell = this.topLeftFrozenCell ? new CellAddress(this.topLeftFrozenCell.id) : null; res.topLeftFrozenCell = this.topLeftFrozenCell ?
new CellAddress(this.topLeftFrozenCell.row, this.topLeftFrozenCell.col) : null;
return res; return res;
}; };
asc_CPane.prototype.init = function() { asc_CPane.prototype.init = function() {
......
...@@ -714,9 +714,9 @@ ...@@ -714,9 +714,9 @@
if (isResizeModeMove) { if (isResizeModeMove) {
ws.objectRender.saveSizeDrawingObjects(); ws.objectRender.saveSizeDrawingObjects();
if (target.target === "colresize") { if (target.target === "colresize") {
ws.changeColumnWidth(target.col, x, target.mouseX); ws.changeColumnWidth(target.col, x, target.mouseX);
} else if (target.target === "rowresize") { } else if (target.target === "rowresize") {
ws.changeRowHeight(target.row, y, target.mouseY); ws.changeRowHeight(target.row, y, target.mouseY);
} }
ws.objectRender.updateSizeDrawingObjects(); ws.objectRender.updateSizeDrawingObjects();
ws.cellCommentator.updateCommentPosition(); ws.cellCommentator.updateCommentPosition();
...@@ -768,15 +768,13 @@ ...@@ -768,15 +768,13 @@
// Frozen anchor // Frozen anchor
WorkbookView.prototype._onMoveFrozenAnchorHandle = function (x, y, targetInfo) { WorkbookView.prototype._onMoveFrozenAnchorHandle = function (x, y, targetInfo) {
var ws = this.getWorksheet(); var ws = this.getWorksheet();
if ( ws ) ws.drawFrozenGuides(x, y, targetInfo);
ws._applyFrozenAnchor(x, y, targetInfo, true);
}; };
WorkbookView.prototype._onMoveFrozenAnchorHandleDone = function (x, y, targetInfo) { WorkbookView.prototype._onMoveFrozenAnchorHandleDone = function (x, y, targetInfo) {
// Закрепляем область // Закрепляем область
var ws = this.getWorksheet(); var ws = this.getWorksheet();
if ( ws ) ws.applyFrozenAnchor(x, y, targetInfo);
ws._applyFrozenAnchor(x, y, targetInfo, false);
}; };
WorkbookView.prototype._onAutoFiltersClick = function (idFilter) { WorkbookView.prototype._onAutoFiltersClick = function (idFilter) {
......
...@@ -159,8 +159,7 @@ ...@@ -159,8 +159,7 @@
var kNewLine = "\n"; var kNewLine = "\n";
var kPaneStateFrozen = "frozen"; var klockNameFrozenPane = "frozenPane";
var kPaneStateFrozenSplit = "frozenSplit";
function calcDecades(num) { function calcDecades(num) {
return Math.abs(num) < 10 ? 1 : 1 + calcDecades( asc_floor(num * 0.1) ); return Math.abs(num) < 10 ? 1 : 1 + calcDecades( asc_floor(num * 0.1) );
...@@ -228,7 +227,7 @@ ...@@ -228,7 +227,7 @@
this.fillHandleBorderColorSelect = new CColor(255, 255, 255, 1); this.fillHandleBorderColorSelect = new CColor(255, 255, 255, 1);
// Цвет закрепленных областей // Цвет закрепленных областей
this.frozenColor = new CColor(0, 0, 0, 1); this.frozenColor = new CColor(105, 119, 62, 1);
return this; return this;
} }
...@@ -2979,60 +2978,58 @@ ...@@ -2979,60 +2978,58 @@
/** Рисует закрепление областей */ /** Рисует закрепление областей */
WorksheetView.prototype._drawFrozenPaneLines = function (canvas) { WorksheetView.prototype._drawFrozenPaneLines = function (canvas) {
// ToDo заделать отрисовку lock области
var _this = this; if (this.topLeftFrozenCell) {
var callback = function(result) { var ctx = canvas ? canvas : this.drawingCtx;
var color = _this.settings.activeCellBorderColor; var row = this.topLeftFrozenCell.getRow0();
if ( !result ) var col = this.topLeftFrozenCell.getCol0();
color = c_oAscCoAuthoringOtherBorderColor; ctx.setLineWidth(1).setStrokeStyle(this.settings.frozenColor).beginPath();
if (0 < row) {
function drawAnchor(x, y, w, h, bVertical) { ctx.lineHor(0, this.rows[row].top - this.height_1px, ctx.getWidth());
_this.drawingCtx.beginPath().setStrokeStyle(color); }
if ( bVertical ) if (0 < col) {
_this.drawingCtx.dashLineCleverVer(x, y, y + h); ctx.lineVer(this.cols[col].left - this.width_1px, 0, ctx.getHeight());
else }
_this.drawingCtx.dashLineCleverHor(x, y, x + w); ctx.stroke();
_this.drawingCtx.stroke(); }
} };
// Anchor WorksheetView.prototype.drawFrozenGuides = function (x, y, targetInfo) {
if ( _this.model.sheetViews[0].asc_getShowRowColHeaders() ) { if (!targetInfo)
var frozenCell = _this.topLeftFrozenCell ? _this.topLeftFrozenCell : new CellAddress(0, 0, 0); return;
// vertical var data, offsetFrozen;
var _x = _this.getCellLeft(frozenCell.getCol0(), 1) - 0.5; var ctx = this.overlayCtx;
var _y = _this.headersTop;
var w = 0; ctx.clear();
var h = _this.headersHeight; this._drawSelection();
drawAnchor(_x, _y, w, h, true);
switch (targetInfo.target) {
// horizontal case "frozenAnchorV":
_x = _this.headersLeft; x *= asc_getcvt(0/*px*/, 1/*pt*/, this._getPPIX());
_y = _this.getCellTop(frozenCell.getRow0(), 1) - 0.5; data = this._findColUnderCursor(x, true);
w = _this.headersWidth - 0.5; if (data && 0 <= data.col) {
h = 0; var h = ctx.getHeight();
drawAnchor(_x, _y, w, h, false); var offsetX = this.cols[this.visibleRange.c1].left - this.cellsLeft;
offsetFrozen = this.getFrozenPaneOffset(false, true);
offsetX -= offsetFrozen.offsetX;
ctx.setFillPattern(this.ptrnLineDotted1)
.fillRect(this.cols[data.col].left - offsetX - this.width_1px, 0, this.width_1px, h);
} }
break;
// Lines case "frozenAnchorH":
if (_this.topLeftFrozenCell) { y *= asc_getcvt(0/*px*/, 1/*pt*/, this._getPPIY());
var ctx = canvas ? canvas : _this.drawingCtx; data = this._findRowUnderCursor(y, true);
var row = _this.topLeftFrozenCell.getRow0(); if (data && 0 <= data.row) {
var col = _this.topLeftFrozenCell.getCol0(); var w = ctx.getWidth();
ctx.setLineWidth(1).setStrokeStyle(color).beginPath(); var offsetY = this.rows[this.visibleRange.r1].top - this.cellsTop;
if (0 < row) { offsetFrozen = this.getFrozenPaneOffset(true, false);
ctx.dashLineCleverHor(0, _this.rows[row].top - _this.height_1px, ctx.getWidth()); offsetY -= offsetFrozen.offsetY;
} ctx.setFillPattern(this.ptrnLineDotted1)
if (0 < col) { .fillRect(0, this.rows[data.row].top - offsetY - this.height_1px, w, this.height_1px);
ctx.dashLineCleverVer(_this.cols[col].left - _this.width_1px, 0, ctx.getHeight());
}
ctx.stroke();
} }
} break;
_this.objectRender.objectLocker.reset(); }
_this.objectRender.objectLocker.bLock = false;
_this.objectRender.objectLocker.addObjectId(_this.getFrozenCellId());
_this.objectRender.objectLocker.checkObjects(callback);
}; };
WorksheetView.prototype._isFrozenAnchor = function(x, y) { WorksheetView.prototype._isFrozenAnchor = function(x, y) {
...@@ -3078,119 +3075,99 @@ ...@@ -3078,119 +3075,99 @@
return result; return result;
}; };
WorksheetView.prototype._applyFrozenAnchor = function(x, y, targetInfo, bMove) { WorksheetView.prototype.applyFrozenAnchor = function(x, y, targetInfo) {
if ( !targetInfo ) if (!targetInfo)
return; return;
var _this = this; var t = this;
var col = 0, row = 0; var onChangeFrozenCallback = function (isSuccess) {
var ctx = _this.overlayCtx; if (false === isSuccess) {
if ( bMove ) t.overlayCtx.clear();
ctx.clear(); t._drawSelection();
return;
x *= asc_getcvt(0/*px*/, 1/*pt*/, this._getPPIX());
y *= asc_getcvt(0/*px*/, 1/*pt*/, this._getPPIY());
switch (targetInfo.target) {
case "frozenAnchorV":
var _col = _this._findColUnderCursor(x, true);
if ( _col && (_col.col >= 0) ) {
col = _col.col;
if ( bMove ) {
ctx.setLineWidth(1).setStrokeStyle(_this.settings.activeCellBorderColor).beginPath();
ctx.dashLineCleverVer(_this.cols[col].left - _this.width_1px, 0, ctx.getHeight());
ctx.stroke();
}
else {
if ( _this.topLeftFrozenCell )
_this.setFrozenCell(col, _this.topLeftFrozenCell.getRow0(), false, true);
else
_this.setFrozenCell(col, 0, true, true);
}
}
break;
case "frozenAnchorH":
var _row = _this._findRowUnderCursor(y, true);
if ( _row && (_row.row >= 0) ) {
row = _row.row;
if ( bMove ) {
ctx.setLineWidth(1).setStrokeStyle(_this.settings.activeCellBorderColor).beginPath();
ctx.dashLineCleverHor(0, _this.rows[row].top - _this.height_1px, ctx.getWidth());
ctx.stroke();
}
else {
if ( _this.topLeftFrozenCell )
_this.setFrozenCell(_this.topLeftFrozenCell.getCol0(), row, false, true);
else
_this.setFrozenCell(0, row, true, true);
}
}
break;
}
};
WorksheetView.prototype.setFrozenCell = function(col, row, bNew, bRedraw) {
var _this = this;
var callback = function(result) {
if ( result ) {
if ( bNew ) {
History.Create_NewPoint();
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_AddFrozenCell, _this.model.getId(), null, new UndoRedoData_FrozenCell(row, col));
_this.topLeftFrozenCell = new CellAddress(row, col, 0);
_this.visibleRange.c1 = col;
_this.visibleRange.r1 = row;
}
else {
var compositeFroze = new UndoRedoData_CompositeFrozenCell(new UndoRedoData_FrozenCell(_this.topLeftFrozenCell.getRow0(), _this.topLeftFrozenCell.getCol0()), new UndoRedoData_FrozenCell(row, col));
History.Create_NewPoint();
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeFrozenCell, _this.model.getId(), null, compositeFroze);
_this.topLeftFrozenCell = new CellAddress(row, col, 0);
_this.visibleRange.c1 = col;
_this.visibleRange.r1 = row;
}
_this.objectRender.drawingArea.init();
if ( bRedraw )
_this.draw();
} }
else { var lastCol = 0, lastRow = 0, data;
_this.overlayCtx.clear(); if (t.topLeftFrozenCell) {
_this._drawSelection(); lastCol = t.topLeftFrozenCell.getCol0();
lastRow = t.topLeftFrozenCell.getRow0();
}
switch (targetInfo.target) {
case "frozenAnchorV":
x *= asc_getcvt(0/*px*/, 1/*pt*/, t._getPPIX());
data = t._findColUnderCursor(x, true);
if (data && 0 <= data.col)
lastCol = data.col;
break;
case "frozenAnchorH":
y *= asc_getcvt(0/*px*/, 1/*pt*/, t._getPPIY());
data = t._findRowUnderCursor(y, true);
if (data && 0 <= data.row)
lastRow = data.row;
break;
} }
} t._updateFreezePane(lastCol, lastRow);
};
_this.objectRender.objectLocker.reset();
_this.objectRender.objectLocker.addObjectId(_this.getFrozenCellId()); this._isLockedFrozenPane (onChangeFrozenCallback);
_this.objectRender.objectLocker.checkObjects(callback);
};
WorksheetView.prototype.getFrozenCellId = function() {
return "frozenCell_" + this.model.Id;
}; };
/** Для api закрепленных областей */ /** Для api закрепленных областей */
WorksheetView.prototype.clearFrozenCell = function() { WorksheetView.prototype.freezePane = function (type) {
this.topLeftFrozenCell = null; var t = this;
this.visibleRange.c1 = 0; var onChangeFreezePane = function (isSuccess) {
this.visibleRange.r1 = 0; if (false === isSuccess)
this.objectRender.drawingArea.init(); return;
this.draw(); var col, row;
}; switch(type) {
case c_oAscFreezePane.FreezeSheetPanes:
WorksheetView.prototype.setSelectedFrozenCell = function() { col = t.getSelectedColumnIndex();
this.setFrozenCell(this.getSelectedColumnIndex(), this.getSelectedRowIndex(), true, true); row = t.getSelectedRowIndex();
}; break;
case c_oAscFreezePane.FreezeFirstColumn:
WorksheetView.prototype.setFirstFrozenCol = function() { col = 1;
this.setFrozenCell(1, 0, true, true); row = 0;
break;
case c_oAscFreezePane.FreezeTopRow:
col = 0;
row = 1;
break;
case c_oAscFreezePane.FreezeClean:
col = 0;
row = 0;
break;
}
t._updateFreezePane(col, row);
};
return this._isLockedFrozenPane(onChangeFreezePane);
}; };
WorksheetView.prototype.setFirstFrozenRow = function() { WorksheetView.prototype._updateFreezePane = function(col, row, lockDraw) {
this.setFrozenCell(0, 1, true, true); var lastCol = 0, lastRow = 0;
if (this.topLeftFrozenCell) {
lastCol = this.topLeftFrozenCell.getCol0();
lastRow = this.topLeftFrozenCell.getRow0();
}
History.Create_NewPoint();
var oData = new UndoRedoData_FromTo(new UndoRedoData_BBox(new asc_Range(lastCol, lastRow, lastCol, lastRow)),
new UndoRedoData_BBox(new asc_Range(col, row, col, row)), null);
History.Add(g_oUndoRedoWorksheet, historyitem_Worksheet_ChangeFrozenCell, this.model.getId(), null, oData);
if (0 === col && 0 === row) {
// Очистка
this.topLeftFrozenCell = this.model.sheetViews[0].pane = null;
} else {
// Создание
var pane = this.model.sheetViews[0].pane = new asc.asc_CPane();
this.topLeftFrozenCell = pane.topLeftFrozenCell = new CellAddress(row, col, 0);
}
this.visibleRange.c1 = col;
this.visibleRange.r1 = row;
this.objectRender.drawingArea.init();
if (!lockDraw)
this.draw();
}; };
/** */ /** */
...@@ -5477,7 +5454,7 @@ ...@@ -5477,7 +5454,7 @@
var frozenCursor = this._isFrozenAnchor(x, y); var frozenCursor = this._isFrozenAnchor(x, y);
if (frozenCursor.result) { if (frozenCursor.result) {
lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, null, sheetId, this.getFrozenCellId()); lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, null, sheetId, klockNameFrozenPane);
isLocked = this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false); isLocked = this.collaborativeEditing.getLockIntersection(lockInfo, c_oAscLockTypes.kLockTypeOther, false);
if (false !== isLocked) { if (false !== isLocked) {
// Кто-то сделал lock // Кто-то сделал lock
...@@ -8773,6 +8750,38 @@ ...@@ -8773,6 +8750,38 @@
return arnFor; return arnFor;
}; };
// Залочена ли панель для закрепления
WorksheetView.prototype._isLockedFrozenPane = function (callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
// Запрещено совместное редактирование
asc_applyFunction(callback, true);
return;
}
var sheetId = this.model.getId();
var lockInfo = this.collaborativeEditing.getLockInfo(c_oAscLockTypeElem.Object, null, sheetId, klockNameFrozenPane);
if (false === this.collaborativeEditing.getCollaborativeEditing()) {
// Пользователь редактирует один: не ждем ответа, а сразу продолжаем редактирование
asc_applyFunction(callback, true);
callback = undefined;
}
if (false !== this.collaborativeEditing.getLockIntersection(lockInfo,
c_oAscLockTypes.kLockTypeMine, /*bCheckOnlyLockAll*/false)) {
// Редактируем сами
asc_applyFunction(callback, true);
return;
} else if (false !== this.collaborativeEditing.getLockIntersection(lockInfo,
c_oAscLockTypes.kLockTypeOther, /*bCheckOnlyLockAll*/false)) {
// Уже ячейку кто-то редактирует
asc_applyFunction(callback, false);
return;
}
this.collaborativeEditing.onStartCheckLock();
this.collaborativeEditing.addCheckLock(lockInfo);
this.collaborativeEditing.onEndCheckLock(callback);
};
// Залочен ли весь лист // Залочен ли весь лист
WorksheetView.prototype._isLockedAll = function (callback) { WorksheetView.prototype._isLockedAll = function (callback) {
if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) { if (false === this.collaborativeEditing.isCoAuthoringExcellEnable()) {
......
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