Commit 61da51cb authored by Sergey Konovalov's avatar Sergey Konovalov

remove unused

parent bb7bd881
......@@ -4554,166 +4554,6 @@ RangeDataManager.prototype = {
}
};
function CellAreaElem(row, col, data)
{
this.row = row;
this.col = col;
this.data = data;
}
function CellArea(fChange)
{
this.rows = new TreeRB();
this.fChange = fChange;
}
CellArea.prototype = {
add : function(row, col, value)
{
var oNewNode = new TreeRBNode(row, null);
var oStoredNode = this.rows.insertOrGet(oNewNode);
if(oStoredNode == oNewNode)
oStoredNode.storedValue = new TreeRB();
var oNewRow = oStoredNode.storedValue;
var oNewColNode = new TreeRBNode(col, null);
var oStoredColNode = oNewRow.insertOrGet(oNewColNode);
var storedValue = new RangeDataManagerElem(new Asc.Range(col, row, col, row), value);
oNewColNode.storedValue = storedValue;
if(null != this.fChange)
this.fChange.call(this, storedValue.data, null, storedValue.bbox);
},
get : function(bbox)
{
var aRes = [];
var aRows = this.rows.enumerate(bbox.r1, bbox.r2);
for(var i = 0, length = aRows.length; i < length; i++)
{
var row = aRows[i];
var aCells = row.storedValue.enumerate(bbox.c1, bbox.c2);
for(var j = 0, length2 = aCells.length; j < length2; j++)
aRes.push(aCells[j].storedValue);
}
return aRes;
},
remove : function(bbox)
{
var aElems = this.get(bbox);
for(var i = 0, length = aElems.length; i < length; ++i)
{
var elem = aElems[i];
this.removeElement(elem);
}
},
removeElement : function(elem)
{
var rowElem = this.rows.getElem(elem.bbox.r1);
if(rowElem)
{
var row = rowElem.storedValue;
var cellElem = row.getElem(elem.bbox.c1);
if(cellElem)
{
row.deleteNode(cellElem);
if(row.isEmpty())
this.rows.deleteNode(rowElem);
if(null != this.fChange)
this.fChange.call(this, cellElem.storedValue.data, cellElem.storedValue.bbox, null);
}
}
},
removeAll : function()
{
this.remove(new Asc.Range(0, 0, gc_nMaxCol0, gc_nMaxRow0));
//todo
this.oIntervalTreeRB = new IntervalTreeRB();
},
shiftGet : function(bbox, bHor)
{
var bboxGet = shiftGetBBox(bbox, bHor);
return {bbox: bboxGet, elems: this.get(bboxGet)};
},
shift: function (bbox, bAdd, bHor, oGetRes)
{
var _this = this;
if (null == oGetRes)
oGetRes = this.shiftGet(bbox, bHor);
var offset;
if (bHor)
offset = { offsetRow: 0, offsetCol: bbox.c2 - bbox.c1 + 1 };
else
offset = { offsetRow: bbox.r2 - bbox.r1 + 1, offsetCol: 0 };
if (!bAdd) {
offset.offsetRow = -offset.offsetRow;
offset.offsetCol = -offset.offsetCol;
}
this._shiftmove(true, bbox, offset, oGetRes.elems);
},
move: function (from, to)
{
var offset = { offsetRow: to.r1 - from.r1, offsetCol: to.c1 - from.c1 };
var oGetRes = this.get(from);
this._shiftmove(false, from, offset, oGetRes);
},
_shiftmove: function (bShift, bbox, offset, elems) {
var aToChange = [];
//сдвигаем inner
if (elems.length > 0) {
var bboxAsc = Asc.Range(bbox.c1, bbox.r1, bbox.c2, bbox.r2);
var bAdd = offset.offsetRow > 0 || offset.offsetCol > 0;
for (var i = 0, length = elems.length; i < length; i++) {
var elem = elems[i];
var to = null;
if (!bShift || bAdd || !bboxAsc.containsRange(elem.bbox)) {
to = elem.bbox.clone();
to.setOffset(offset);
}
aToChange.push({ elem: elem, to: to });
}
}
//сначала сортируем чтобы не было конфликтов при сдвиге
aToChange.sort(function (a, b) { return shiftSort(a, b, offset); });
if (null != this.fChange) {
for (var i = 0, length = aToChange.length; i < length; ++i) {
var item = aToChange[i];
this.fChange.call(this, item.elem.data, item.elem.bbox, item.to);
}
}
//убираем fChange, чтобы потом послать его только на одну операцию, а не 2
var fOldChange = this.fChange;
this.fChange = null;
//сначала удаляем все чтобы не было конфликтов
for (var i = 0, length = aToChange.length; i < length; ++i) {
var item = aToChange[i];
var elem = item.elem;
this.removeElement(elem);
}
//добавляем измененные ячейки
for (var i = 0, length = aToChange.length; i < length; ++i) {
var item = aToChange[i];
if (null != item.to)
this.add(item.to.r1, item.to.c1, item.elem.data);
}
this.fChange = fOldChange;
},
getAll : function(){
var aRes = [];
var oRows = this.rows.getNodeAll();
for(var i = 0, length = oRows.length; i < length; i++)
{
var row = oRows[i];
if(row.storedValue)
{
var cells = row.storedValue.getNodeAll();
for(var j = 0, length2 = cells.length; j < length2; j++)
{
var elem = cells[j];
aRes.push(elem.storedValue);
}
}
}
return aRes;
}
};
/** @constructor */
function sparklineGroup(addId) {
// attributes
......@@ -7528,7 +7368,6 @@ AutoFilterDateElem.prototype.convertDateGroupItemToRange = function(oDateGroupIt
window['AscCommonExcel'].CCellValue = CCellValue;
window['AscCommonExcel'].RangeDataManagerElem = RangeDataManagerElem;
window['AscCommonExcel'].RangeDataManager = RangeDataManager;
window['AscCommonExcel'].CellArea = CellArea;
window["Asc"]["sparklineGroup"] = window['AscCommonExcel'].sparklineGroup = sparklineGroup;
prot = sparklineGroup.prototype;
prot["asc_getId"] = prot.asc_getId;
......
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