Commit 13777c44 authored by Sergey.Konovalov's avatar Sergey.Konovalov

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

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