Commit 74adbc79 authored by Sergey.Konovalov's avatar Sergey.Konovalov Committed by Alexander.Trofimov

ошибки при сдвиге Vertex, выставление формулы в Vertex сделано через одну функцию

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54175 954022d7-b5bf-4e40-9824-e11837661b57
parent dcf16d15
......@@ -676,14 +676,14 @@ Vertex.prototype = {
{
return this.bbox;
},
setFormula : function(sFormula, bAddToHistory, bAddNeedRecal)
setFormula : function(sFormula, bAddToHistory, bAddNeedRecalc)
{
var cell = this.returnCell();
if(null != sFormula)
cell.setFormula(sFormula, bAddToHistory);
this.wb.dependencyFormulas.deleteMasterNodes2( this.sheetId, this.cellId );
addToArrRecalc(this.sheetId, cell);
if(bAddNeedRecal)
if(bAddNeedRecalc)
{
this.wb.needRecalc.nodes[this.nodeId] = [this.sheetId, this.cellId ];
this.wb.needRecalc.length++;
......@@ -694,10 +694,8 @@ Vertex.prototype = {
var cell = this.returnCell();
if( cell && cell.formulaParsed )
{
this.wb.dependencyFormulas.deleteMasterNodes2( wsId, cellId );
cell.formulaParsed.setRefError(wsId, cellId);
cell.setFormula(cell.formulaParsed.assemble(), true);
addToArrRecalc(wsId, cell);
this.setFormula(cell.formulaParsed.assemble(), true, false);
}
},
move : function(offset, wsId, toDelete)
......@@ -716,10 +714,8 @@ Vertex.prototype = {
cell = slave.returnCell();
if( cell && cell.formulaParsed )
{
this.wb.dependencyFormulas.deleteMasterNodes2( slave.sheetId, slave.cellId );
cell.formulaParsed.shiftCells( offset, null, this, slave.sheetId, toDelete);
cell.setFormula(cell.formulaParsed.assemble(), true);
addToArrRecalc(slave.sheetId, cell);
slave.setFormula(cell.formulaParsed.assemble(), true, false);
}
}
this.bbox = oNewBBox;
......@@ -736,10 +732,8 @@ Vertex.prototype = {
var slave = _sn[_id];
var cell = slave.returnCell();
if( cell && cell.formulaParsed ){
this.wb.dependencyFormulas.deleteMasterNodes2( slave.sheetId, slave.cellId );
cell.formulaParsed.stretchArea( this, sNewName );
cell.setFormula(cell.formulaParsed.assemble(), true);
addToArrRecalc(slave.sheetId, cell);
slave.setFormula(cell.formulaParsed.assemble(), true, false);
}
}
this.bbox = bboxTo
......
......@@ -56,6 +56,37 @@ function shiftGetBBox(bbox, bHor)
bboxGet = Asc.Range(bbox.c1, bbox.r1, bbox.c2, gc_nMaxRow0);
return bboxGet;
}
function shiftSort(a, b, bAsc, bRow)
{
var nRes = 0;
if(null == a.to || null == b.to)
{
if(null == a.to && null == b.to)
nRes = 0;
else if(null == a.to)
nRes = 1;
else if(null == b.to)
nRes = -1;
}
else
{
if(bRow)
{
if(bAsc)
nRes = a.to.r1 - b.to.r1;
else
nRes = b.to.r1 - a.to.r1;
}
else
{
if(bAsc)
nRes = a.to.c1 - b.to.c1;
else
nRes = b.to.c1 - a.to.c1;
}
}
return nRes;
}
function RgbColor(rgb)
{
this.Properties = {
......@@ -3896,37 +3927,6 @@ RangeDataManager.prototype = {
var bboxGet = shiftGetBBox(bbox, bHor);
return {bbox: bboxGet, elems: this.get(bboxGet)};
},
shiftSort : function(a, b, bAsc, bRow)
{
var nRes = 0;
if(null == a.to || null == b.to)
{
if(null == a.to && null == b.to)
nRes = 0;
else if(null == a.to)
nRes = 1;
else if(null == b.to)
nRes = -1;
}
else
{
if(bRow)
{
if(bAsc)
nRes = a.to.r1 - b.to.r1;
else
nRes = b.to.r1 - a.to.r1;
}
else
{
if(bAsc)
nRes = a.to.c1 - b.to.c1;
else
nRes = b.to.c1 - a.to.c1;
}
}
return nRes;
},
shift : function(bbox, bAdd, bHor, oGetRes)
{
var _this = this;
......@@ -4031,16 +4031,16 @@ RangeDataManager.prototype = {
if(bHor)
{
if(bAdd)
aToChange.sort(function(a, b){return _this.shiftSort(a, b, false, false);});
aToChange.sort(function(a, b){return shiftSort(a, b, false, false);});
else
aToChange.sort(function(a, b){return _this.shiftSort(a, b, true, false);});
aToChange.sort(function(a, b){return shiftSort(a, b, true, false);});
}
else
{
if(bAdd)
aToChange.sort(function(a, b){return _this.shiftSort(a, b, false, true);});
aToChange.sort(function(a, b){return shiftSort(a, b, false, true);});
else
aToChange.sort(function(a, b){return _this.shiftSort(a, b, true, true);});
aToChange.sort(function(a, b){return shiftSort(a, b, true, true);});
}
if(null != this.fChange)
{
......@@ -4240,16 +4240,16 @@ CellArea.prototype = {
if(bHor)
{
if(bAdd)
aToChange.sort(function(a, b){return b.to.c1 - a.to.c1;});
aToChange.sort(function(a, b){return shiftSort(a, b, false, false);});
else
aToChange.sort(function(a, b){return a.to.c1 - b.to.c1;});
aToChange.sort(function(a, b){return shiftSort(a, b, true, false);});
}
else
{
if(bAdd)
aToChange.sort(function(a, b){return b.to.r1 - a.to.r1;});
aToChange.sort(function(a, b){return shiftSort(a, b, false, true);});
else
aToChange.sort(function(a, b){return a.to.r1 - b.to.r1;});
aToChange.sort(function(a, b){return shiftSort(a, b, true, true);});
}
if(null != this.fChange)
{
......
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