Commit 902b1a3d authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 32901

add hot key F4
parent b569c549
......@@ -824,7 +824,7 @@
var isTitle = this._isAddNameColumn(mainAdjacentCells);
objOptions.asc_setIsTitle(isTitle);
var tmpRange = mainAdjacentCells.clone();
tmpRange.r1Abs = tmpRange.c1Abs = tmpRange.r2Abs = tmpRange.c2Abs = true;
tmpRange.setAbs(true, true, true, true);
objOptions.asc_setRange(tmpRange.getName());
return objOptions;
},
......
......@@ -197,7 +197,9 @@
* @return {Range}
*/
function Range(c1, r1, c2, r2, normalize) {
if ( !(this instanceof Range) ) {return new Range(c1, r1, c2, r2, normalize);}
if (!(this instanceof Range)) {
return new Range(c1, r1, c2, r2, normalize);
}
/** @type Number */
this.c1 = c1;
......@@ -207,289 +209,318 @@
this.c2 = c2;
/** @type Number */
this.r2 = r2;
this.r1Abs = false;
this.c1Abs = false;
this.r2Abs = false;
this.c2Abs = false;
this.refType1 = referenceType.R;
this.refType2 = referenceType.R;
return normalize ? this.normalize() : this;
}
Range.prototype = {
Range.prototype.assign = function (c1, r1, c2, r2, normalize) {
if (typeOf(c1) !== kNumberL || typeOf(c2) !== kNumberL || typeOf(r1) !== kNumberL || typeOf(r2) !== kNumberL) {
throw "Error: range.assign(" + c1 + "," + r1 + "," + c2 + "," + r2 + ") - numerical args are expected";
}
this.c1 = c1;
this.r1 = r1;
this.c2 = c2;
this.r2 = r2;
return normalize ? this.normalize() : this;
};
Range.prototype.assign2 = function (range) {
return this.assign(range.c1, range.r1, range.c2, range.r2);
};
constructor: Range,
Range.prototype.clone = function (normalize) {
var oRes = new Range(this.c1, this.r1, this.c2, this.r2, normalize);
oRes.refType1 = this.refType1;
oRes.refType2 = this.refType2;
return oRes;
};
assign: function (c1, r1, c2, r2, normalize) {
if (typeOf(c1) !== kNumberL || typeOf(c2) !== kNumberL ||
typeOf(r1) !== kNumberL || typeOf(r2) !== kNumberL) {
throw "Error: range.assign("+c1+","+r1+","+c2+","+r2+") - numerical args are expected";
}
this.c1 = c1;
this.r1 = r1;
this.c2 = c2;
this.r2 = r2;
return normalize ? this.normalize() : this;
},
assign2: function (range) {
return this.assign(range.c1, range.r1, range.c2, range.r2);
},
Range.prototype.normalize = function () {
var tmp;
if (this.c1 > this.c2) {
tmp = this.c1;
this.c1 = this.c2;
this.c2 = tmp;
}
if (this.r1 > this.r2) {
tmp = this.r1;
this.r1 = this.r2;
this.r2 = tmp;
}
return this;
};
clone: function (normalize) {
var oRes = new Range(this.c1, this.r1, this.c2, this.r2, normalize);
oRes.r1Abs = this.r1Abs;
oRes.c1Abs = this.c1Abs;
oRes.r2Abs = this.r2Abs;
oRes.c2Abs = this.c2Abs;
return oRes;
},
Range.prototype.isEqual = function (range) {
return range && this.c1 === range.c1 && this.r1 === range.r1 && this.c2 === range.c2 && this.r2 === range.r2;
};
normalize: function () {
var tmp;
if (this.c1 > this.c2){
tmp = this.c1;
this.c1 = this.c2;
this.c2 = tmp;
}
if (this.r1 > this.r2){
tmp = this.r1;
this.r1 = this.r2;
this.r2 = tmp;
}
return this;
},
Range.prototype.isEqualAll = function (range) {
return this.isEqual(range) && this.refType1 === range.refType1 && this.refType2 === range.refType2;
};
isEqual: function (range) {
return range && this.c1 === range.c1 && this.r1 === range.r1 && this.c2 === range.c2 && this.r2 === range.r2;
},
Range.prototype.contains = function (c, r) {
return this.c1 <= c && c <= this.c2 && this.r1 <= r && r <= this.r2;
};
isEqualAll: function (range) {
return this.isEqual(range) && this.r1Abs === range.r1Abs && this.r2Abs === range.r2Abs && this.c1Abs === range.c1Abs && this.c2Abs === range.c2Abs;
},
Range.prototype.containsRange = function (range) {
return this.contains(range.c1, range.r1) && this.contains(range.c2, range.r2);
};
contains: function (c, r) {
return this.c1 <= c && c <= this.c2 && this.r1 <= r && r <= this.r2;
},
containsRange: function (range) {
return this.contains(range.c1, range.r1) && this.contains(range.c2, range.r2);
},
Range.prototype.containsFirstLineRange = function (range) {
return this.contains(range.c1, range.r1) && this.contains(range.c2, range.r1);
};
containsFirstLineRange: function (range) {
return this.contains(range.c1, range.r1) && this.contains(range.c2, range.r1);
},
Range.prototype.intersection = function (range) {
var s1 = this.clone(true), s2 = range instanceof Range ? range.clone(true) :
new Range(range.c1, range.r1, range.c2, range.r2, true);
intersection: function (range) {
var s1 = this.clone(true),
s2 = range instanceof Range ? range.clone(true) :
new Range(range.c1, range.r1, range.c2, range.r2, true);
if (s2.c1 > s1.c2 || s2.c2 < s1.c1 || s2.r1 > s1.r2 || s2.r2 < s1.r1) {
return null;
}
if (s2.c1 > s1.c2 || s2.c2 < s1.c1 || s2.r1 > s1.r2 || s2.r2 < s1.r1) {return null;}
return new Range(s2.c1 >= s1.c1 && s2.c1 <= s1.c2 ? s2.c1 : s1.c1, s2.r1 >= s1.r1 && s2.r1 <= s1.r2 ? s2.r1 :
s1.r1, Math.min(s1.c2, s2.c2), Math.min(s1.r2, s2.r2));
};
return new Range(
s2.c1 >= s1.c1 && s2.c1 <= s1.c2 ? s2.c1 : s1.c1,
s2.r1 >= s1.r1 && s2.r1 <= s1.r2 ? s2.r1 : s1.r1,
Math.min(s1.c2, s2.c2),
Math.min(s1.r2, s2.r2));
},
intersectionSimple: function (range) {
var oRes = null;
var r1 = Math.max(this.r1, range.r1);
var c1 = Math.max(this.c1, range.c1);
var r2 = Math.min(this.r2, range.r2);
var c2 = Math.min(this.c2, range.c2);
if(r1 <= r2 && c1 <= c2)
oRes = new Range(c1, r1, c2, r2);
return oRes;
},
isIntersect: function (range) {
var bRes = true;
if(range.r2 < this.r1 || this.r2 < range.r1)
bRes = false;
else if(range.c2 < this.c1 || this.c2 < range.c1)
bRes = false;
return bRes;
},
Range.prototype.intersectionSimple = function (range) {
var oRes = null;
var r1 = Math.max(this.r1, range.r1);
var c1 = Math.max(this.c1, range.c1);
var r2 = Math.min(this.r2, range.r2);
var c2 = Math.min(this.c2, range.c2);
if (r1 <= r2 && c1 <= c2) {
oRes = new Range(c1, r1, c2, r2);
}
return oRes;
};
isOneCell : function(){
return this.r1 == this.r2 && this.c1 == this.c2;
},
Range.prototype.isIntersect = function (range) {
var bRes = true;
if (range.r2 < this.r1 || this.r2 < range.r1) {
bRes = false;
} else if (range.c2 < this.c1 || this.c2 < range.c1) {
bRes = false;
}
return bRes;
};
union: function (range) {
var s1 = this.clone(true),
s2 = range instanceof Range ? range.clone(true) :
new Range(range.c1, range.r1, range.c2, range.r2, true);
Range.prototype.isOneCell = function () {
return this.r1 == this.r2 && this.c1 == this.c2;
};
return new Range(
Math.min(s1.c1, s2.c1), Math.min(s1.r1, s2.r1),
Math.max(s1.c2, s2.c2), Math.max(s1.r2, s2.r2));
},
union2: function (range) {
this.c1 = Math.min(this.c1, range.c1);
this.c2 = Math.max(this.c2, range.c2);
this.r1 = Math.min(this.r1, range.r1);
this.r2 = Math.max(this.r2, range.r2);
},
setOffset : function(offset){
if ( this.r1 == 0 && this.r2 == gc_nMaxRow0 && offset.offsetRow != 0 || this.c1 == 0 && this.c2 == gc_nMaxCol0 && offset.offsetCol != 0 ) {
return;
}
this.setOffsetFirst(offset);
this.setOffsetLast(offset);
},
Range.prototype.union = function (range) {
var s1 = this.clone(true), s2 = range instanceof Range ? range.clone(true) :
new Range(range.c1, range.r1, range.c2, range.r2, true);
setOffsetFirst : function(offset){
this.c1 += offset.offsetCol;
if( this.c1 < 0 ) {
this.c1 = 0;
}
if( this.c1 > gc_nMaxCol0 ) {
this.c1 = gc_nMaxCol0;
}
this.r1 += offset.offsetRow;
if( this.r1 < 0 )
this.r1 = 0;
if( this.r1 > gc_nMaxRow0 )
this.r1 = gc_nMaxRow0;
},
return new Range(Math.min(s1.c1, s2.c1), Math.min(s1.r1, s2.r1), Math.max(s1.c2, s2.c2), Math.max(s1.r2, s2.r2));
};
setOffsetLast : function(offset){
this.c2 += offset.offsetCol;
if( this.c2 < 0 )
this.c2 = 0;
if( this.c2 > gc_nMaxCol0 )
this.c2 = gc_nMaxCol0;
this.r2 += offset.offsetRow;
if( this.r2 < 0 )
this.r2 = 0;
if( this.r2 > gc_nMaxRow0 )
this.r2 = gc_nMaxRow0;
},
getName : function() {
var sRes = "";
if (0 == this.c1 && gc_nMaxCol0 == this.c2 && false == this.c1Abs && false == this.c2Abs) {
if (this.r1Abs)
sRes += "$";
sRes += (this.r1 + 1) + ":";
if (this.r2Abs)
sRes += "$";
sRes += (this.r2 + 1);
}
else if (0 == this.r1 && gc_nMaxRow0 == this.r2 && false == this.r1Abs && false == this.r2Abs) {
if (this.c1Abs)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1) + ":";
if (this.c2Abs)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
}
else {
if (this.c1Abs)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1);
if (this.r1Abs)
sRes += "$";
sRes += (this.r1 + 1);
if (!this.isOneCell()) {
sRes += ":";
if (this.c2Abs)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
if (this.r2Abs)
sRes += "$";
sRes += (this.r2 + 1);
}
}
return sRes;
},
Range.prototype.union2 = function (range) {
this.c1 = Math.min(this.c1, range.c1);
this.c2 = Math.max(this.c2, range.c2);
this.r1 = Math.min(this.r1, range.r1);
this.r2 = Math.max(this.r2, range.r2);
};
getAbsName : function() {
var sRes = "";
if (0 == this.c1 && gc_nMaxCol0 == this.c2 && false == this.c1Abs && false == this.c2Abs) {
sRes += "$";
sRes += (this.r1 + 1) + ":";
sRes += "$";
sRes += (this.r2 + 1);
}
else if (0 == this.r1 && gc_nMaxRow0 == this.r2 && false == this.r1Abs && false == this.r2Abs) {
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1) + ":";
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
}
else {
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1);
sRes += "$";
sRes += (this.r1 + 1);
if (!this.isOneCell()) {
sRes += ":";
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
sRes += "$";
sRes += (this.r2 + 1);
}
}
return sRes;
},
Range.prototype.setOffset = function (offset) {
if (this.r1 == 0 && this.r2 == gc_nMaxRow0 && offset.offsetRow != 0 ||
this.c1 == 0 && this.c2 == gc_nMaxCol0 && offset.offsetCol != 0) {
return;
}
this.setOffsetFirst(offset);
this.setOffsetLast(offset);
};
getAbsName2 : function(absCol1,absRow1,absCol2,absRow2) {
var sRes = "";
if (0 == this.c1 && gc_nMaxCol0 == this.c2 && false == this.c1Abs && false == this.c2Abs) {
if (absRow1)
sRes += "$";
sRes += (this.r1 + 1) + ":";
if (absRow2)
sRes += "$";
sRes += (this.r2 + 1);
}
else if (0 == this.r1 && gc_nMaxRow0 == this.r2 && false == this.r1Abs && false == this.r2Abs) {
if (absCol1)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1) + ":";
if (absCol2)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
}
else {
if (absCol1)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1);
if (absRow1)
sRes += "$";
sRes += (this.r1 + 1);
if (!this.isOneCell()) {
sRes += ":";
if (absCol2)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
if (absRow2)
sRes += "$";
sRes += (this.r2 + 1);
}
}
return sRes;
},
getAllRange: function () {
var result;
if (c_oAscSelectionType.RangeMax === this.type)
result = new Range(0, 0, gc_nMaxCol0, gc_nMaxRow0);
else if (c_oAscSelectionType.RangeCol === this.type)
result = new Range(this.c1, 0, this.c2, gc_nMaxRow0);
else if (c_oAscSelectionType.RangeRow === this.type)
result = new Range(0, this.r1, gc_nMaxCol0, this.r2);
else
result = this.clone();
Range.prototype.setOffsetFirst = function (offset) {
this.c1 += offset.offsetCol;
if (this.c1 < 0) {
this.c1 = 0;
}
if (this.c1 > gc_nMaxCol0) {
this.c1 = gc_nMaxCol0;
}
this.r1 += offset.offsetRow;
if (this.r1 < 0) {
this.r1 = 0;
}
if (this.r1 > gc_nMaxRow0) {
this.r1 = gc_nMaxRow0;
}
};
return result;
Range.prototype.setOffsetLast = function (offset) {
this.c2 += offset.offsetCol;
if (this.c2 < 0) {
this.c2 = 0;
}
if (this.c2 > gc_nMaxCol0) {
this.c2 = gc_nMaxCol0;
}
this.r2 += offset.offsetRow;
if (this.r2 < 0) {
this.r2 = 0;
}
if (this.r2 > gc_nMaxRow0) {
this.r2 = gc_nMaxRow0;
}
};
Range.prototype.getName = function () {
var sRes = "";
var c1Abs = this.isAbsCol(this.refType1), c2Abs = this.isAbsCol(this.refType2);
var r1Abs = this.isAbsRow(this.refType1), r2Abs = this.isAbsRow(this.refType2);
if (0 == this.c1 && gc_nMaxCol0 == this.c2 && false == c1Abs && false == c2Abs) {
if (r1Abs) {
sRes += "$";
}
sRes += (this.r1 + 1) + ":";
if (r2Abs) {
sRes += "$";
}
sRes += (this.r2 + 1);
} else if (0 == this.r1 && gc_nMaxRow0 == this.r2 && false == r1Abs && false == r2Abs) {
if (c1Abs) {
sRes += "$";
}
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1) + ":";
if (c2Abs) {
sRes += "$";
}
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
} else {
if (c1Abs) {
sRes += "$";
}
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1);
if (r1Abs) {
sRes += "$";
}
sRes += (this.r1 + 1);
if (!this.isOneCell()) {
sRes += ":";
if (c2Abs) {
sRes += "$";
}
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
if (r2Abs) {
sRes += "$";
}
sRes += (this.r2 + 1);
}
}
return sRes;
};
Range.prototype.getAbsName = function () {
var sRes = "";
var c1Abs = this.isAbsCol(this.refType1), c2Abs = this.isAbsCol(this.refType2);
var r1Abs = this.isAbsRow(this.refType1), r2Abs = this.isAbsRow(this.refType2);
if (0 == this.c1 && gc_nMaxCol0 == this.c2 && false == c1Abs && false == c2Abs) {
sRes += "$";
sRes += (this.r1 + 1) + ":";
sRes += "$";
sRes += (this.r2 + 1);
} else if (0 == this.r1 && gc_nMaxRow0 == this.r2 && false == r1Abs && false == r2Abs) {
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1) + ":";
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
} else {
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1);
sRes += "$";
sRes += (this.r1 + 1);
if (!this.isOneCell()) {
sRes += ":";
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
sRes += "$";
sRes += (this.r2 + 1);
}
}
return sRes;
};
Range.prototype.getAbsName2 = function (absCol1, absRow1, absCol2, absRow2) {
var sRes = "";
var c1Abs = this.isAbsCol(this.refType1), c2Abs = this.isAbsCol(this.refType2);
var r1Abs = this.isAbsRow(this.refType1), r2Abs = this.isAbsRow(this.refType2);
if (0 == this.c1 && gc_nMaxCol0 == this.c2 && false == c1Abs && false == c2Abs) {
if (absRow1) {
sRes += "$";
}
sRes += (this.r1 + 1) + ":";
if (absRow2) {
sRes += "$";
}
sRes += (this.r2 + 1);
} else if (0 == this.r1 && gc_nMaxRow0 == this.r2 && false == r1Abs && false == r2Abs) {
if (absCol1) {
sRes += "$";
}
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1) + ":";
if (absCol2) {
sRes += "$";
}
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
} else {
if (absCol1) {
sRes += "$";
}
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1);
if (absRow1) {
sRes += "$";
}
sRes += (this.r1 + 1);
if (!this.isOneCell()) {
sRes += ":";
if (absCol2) {
sRes += "$";
}
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
if (absRow2) {
sRes += "$";
}
sRes += (this.r2 + 1);
}
}
return sRes;
};
Range.prototype.getAllRange = function () {
var result;
if (c_oAscSelectionType.RangeMax === this.type) {
result = new Range(0, 0, gc_nMaxCol0, gc_nMaxRow0);
} else if (c_oAscSelectionType.RangeCol === this.type) {
result = new Range(this.c1, 0, this.c2, gc_nMaxRow0);
} else if (c_oAscSelectionType.RangeRow === this.type) {
result = new Range(0, this.r1, gc_nMaxCol0, this.r2);
} else {
result = this.clone();
}
return result;
};
Range.prototype.setAbs = function (absRow1, absCol1, absRow2, absCol2) {
this.refType1 = (absRow1 ? 0 : 2) + (absCol1 ? 0 : 1);
this.refType2 = (absRow2 ? 0 : 2) + (absCol2 ? 0 : 1);
};
Range.prototype.isAbsCol = function (refType) {
return (refType === referenceType.A || refType === referenceType.RRAC);
};
Range.prototype.isAbsRow = function (refType) {
return (refType === referenceType.A || refType === referenceType.ARRC);
};
Range.prototype.switchReference = function () {
this.refType1 = (this.refType1 + 1) % 4;
this.refType2 = (this.refType2 + 1) % 4;
};
/**
*
* @constructor
......@@ -502,10 +533,8 @@
var range = arguments[0];
Range3D.superclass.constructor.call(this, range.c1, range.r1, range.c2, range.r2);
// ToDo стоит пересмотреть конструкторы.
this.r1Abs = range.r1Abs;
this.c1Abs = range.c1Abs;
this.r2Abs = range.r2Abs;
this.c2Abs = range.c2Abs;
this.refType1 = range.refType1;
this.refType2 = range.refType2;
this.sheet = arguments[1];
this.sheet2 = arguments[2];
......@@ -539,10 +568,8 @@
var range = arguments[0];
ActiveRange.superclass.constructor.call(this, range.c1, range.r1, range.c2, range.r2);
// ToDo стоит пересмотреть конструкторы.
this.r1Abs = range.r1Abs;
this.c1Abs = range.c1Abs;
this.r2Abs = range.r2Abs;
this.c2Abs = range.c2Abs;
this.refType1 = range.refType1;
this.refType2 = range.refType2;
}
else if(arguments.length > 1)
ActiveRange.superclass.constructor.apply(this, arguments);
......@@ -675,18 +702,15 @@
FormulaRange.superclass.constructor.apply(this, arguments);
else
FormulaRange.superclass.constructor.call(this, 0, 0, 0, 0);
this.r1Abs = false;
this.c1Abs = false;
this.r2Abs = false;
this.c2Abs = false;
this.refType1 = referenceType.R;
this.refType2 = referenceType.R;
}
AscCommon.extendClass(FormulaRange, Range);
FormulaRange.prototype.clone = function(){
FormulaRange.prototype.clone = function () {
var oRes = new FormulaRange(FormulaRange.superclass.clone.apply(this, arguments));
oRes.r1Abs = this.r1Abs;
oRes.c1Abs = this.c1Abs;
oRes.r2Abs = this.r2Abs;
oRes.c2Abs = this.c2Abs;
oRes.refType1 = this.refType1;
oRes.refType2 = this.refType2;
return oRes;
};
FormulaRange.prototype.intersection = function () {
......@@ -706,39 +730,42 @@
};
FormulaRange.prototype.getName = function () {
var sRes = "";
var c1Abs = this.isAbsCol(this.refType1), c2Abs = this.isAbsCol(this.refType2);
var r1Abs = this.isAbsRow(this.refType1), r2Abs = this.isAbsRow(this.refType2);
if(0 == this.c1 && gc_nMaxCol0 == this.c2)
{
if(this.r1Abs)
if(r1Abs)
sRes += "$";
sRes += (this.r1 + 1) + ":";
if(this.r2Abs)
if(r2Abs)
sRes += "$";
sRes += (this.r2 + 1);
}
else if(0 == this.r1 && gc_nMaxRow0 == this.r2)
{
if(this.c1Abs)
if(c1Abs)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1) + ":";
if(this.c2Abs)
if(c2Abs)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
}
else
{
if(this.c1Abs)
if(c1Abs)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c1 + 1);
if(this.r1Abs)
if(r1Abs)
sRes += "$";
sRes += (this.r1 + 1);
if(!this.isOneCell())
{
sRes += ":";
if(this.c2Abs)
if(c2Abs)
sRes += "$";
sRes += g_oCellAddressUtils.colnumToColstr(this.c2 + 1);
if(this.r2Abs)
if(r2Abs)
sRes += "$";
sRes += (this.r2 + 1);
}
......@@ -764,134 +791,123 @@
this.offsetY = offsetY;
}
function RangeCache()
{
function RangeCache() {
this.oCache = {};
}
RangeCache.prototype = {
getAscRange : function(sRange)
{
return this._getRange(sRange, 1);
},
getRange3D : function(sRange)
{
var res = AscCommon.parserHelp.parse3DRef(sRange);
if (!res) {
return null;
RangeCache.prototype.getAscRange = function (sRange) {
return this._getRange(sRange, 1);
};
RangeCache.prototype.getRange3D = function (sRange) {
var res = AscCommon.parserHelp.parse3DRef(sRange);
if (!res) {
return null;
}
var range = this._getRange(res.range.toUpperCase(), 1);
return range ? new Range3D(range, res.sheet, res.sheet2) : null;
};
RangeCache.prototype.getActiveRange = function (sRange) {
return this._getRange(sRange, 2);
};
RangeCache.prototype.getFormulaRange = function (sRange) {
return this._getRange(sRange, 3);
};
RangeCache.prototype._getRange = function (sRange, type) {
var oRes = null;
var oCacheVal = this.oCache[sRange];
if (null == oCacheVal) {
var oFirstAddr, oLastAddr;
var bIsSingle = true;
var nIndex = sRange.indexOf(":");
if (-1 != nIndex) {
bIsSingle = false;
oFirstAddr = g_oCellAddressUtils.getCellAddress(sRange.substring(0, nIndex));
oLastAddr = g_oCellAddressUtils.getCellAddress(sRange.substring(nIndex + 1));
} else {
oFirstAddr = oLastAddr = g_oCellAddressUtils.getCellAddress(sRange);
}
var range = this._getRange(res.range.toUpperCase(), 1);
return range ? new Range3D(range, res.sheet, res.sheet2) : null;
},
getActiveRange : function(sRange)
{
return this._getRange(sRange, 2);
},
getFormulaRange : function(sRange)
{
return this._getRange(sRange, 3);
},
_getRange : function(sRange, type)
{
var oRes = null;
var oCacheVal = this.oCache[sRange];
if(null == oCacheVal)
{
var oFirstAddr, oLastAddr;
var bIsSingle = true;
var nIndex = sRange.indexOf(":");
if(-1 != nIndex)
{
bIsSingle = false;
oFirstAddr = g_oCellAddressUtils.getCellAddress(sRange.substring(0, nIndex));
oLastAddr = g_oCellAddressUtils.getCellAddress(sRange.substring(nIndex + 1));
oCacheVal = {first: null, last: null, ascRange: null, formulaRange: null, activeRange: null};
//последнее условие, чтобы не распознавалось "A", "1"(должно быть "A:A", "1:1")
if (oFirstAddr.isValid() && oLastAddr.isValid() &&
(!bIsSingle || (!oFirstAddr.getIsRow() && !oFirstAddr.getIsCol()))) {
oCacheVal.first = oFirstAddr;
oCacheVal.last = oLastAddr;
}
this.oCache[sRange] = oCacheVal;
}
if (1 == type) {
oRes = oCacheVal.ascRange;
} else if (2 == type) {
oRes = oCacheVal.activeRange;
} else {
oRes = oCacheVal.formulaRange;
}
if (null == oRes && null != oCacheVal.first && null != oCacheVal.last) {
var r1 = oCacheVal.first.getRow0(), r2 = oCacheVal.last.getRow0(), c1 = oCacheVal.first.getCol0(), c2 = oCacheVal.last.getCol0();
if (oCacheVal.first.getIsRow() && oCacheVal.last.getIsRow()) {
c1 = 0;
c2 = gc_nMaxCol0;
}
if (oCacheVal.first.getIsCol() && oCacheVal.last.getIsCol()) {
r1 = 0;
r2 = gc_nMaxRow0;
}
if (r1 > r2) {
var temp = r1;
r1 = r2;
r2 = temp;
}
if (c1 > c2) {
var temp = c1;
c1 = c2;
c2 = temp;
}
if (1 == type) {
if (null == oCacheVal.ascRange) {
var oAscRange = new Range(c1, r1, c2, r2);
oAscRange.setAbs(oCacheVal.first.getRowAbs(), oCacheVal.first.getColAbs(), oCacheVal.last.getRowAbs(),
oCacheVal.last.getColAbs());
oCacheVal.ascRange = oAscRange;
}
oRes = oCacheVal.ascRange;
} else if (2 == type) {
if (null == oCacheVal.activeRange) {
var oActiveRange = new ActiveRange(c1, r1, c2, r2);
oActiveRange.setAbs(oCacheVal.first.getRowAbs(), oCacheVal.first.getColAbs(), oCacheVal.last.getRowAbs(),
oCacheVal.last.getColAbs());
var bCol = 0 == r1 && gc_nMaxRow0 == r2;
var bRow = 0 == c1 && gc_nMaxCol0 == c2;
if (bCol && bRow) {
oActiveRange.type = c_oAscSelectionType.RangeMax;
} else if (bCol) {
oActiveRange.type = c_oAscSelectionType.RangeCol;
} else if (bRow) {
oActiveRange.type = c_oAscSelectionType.RangeRow;
} else {
oActiveRange.type = c_oAscSelectionType.RangeCells;
}
oActiveRange.startCol = oActiveRange.c1;
oActiveRange.startRow = oActiveRange.r1;
oCacheVal.activeRange = oActiveRange;
}
else
oFirstAddr = oLastAddr = g_oCellAddressUtils.getCellAddress(sRange);
oCacheVal = { first: null, last: null, ascRange: null, formulaRange: null, activeRange: null };
//последнее условие, чтобы не распознавалось "A", "1"(должно быть "A:A", "1:1")
if (oFirstAddr.isValid() && oLastAddr.isValid() && (!bIsSingle || (!oFirstAddr.getIsRow() && !oFirstAddr.getIsCol())))
{
oCacheVal.first = oFirstAddr;
oCacheVal.last = oLastAddr;
oRes = oCacheVal.activeRange;
} else {
if (null == oCacheVal.formulaRange) {
var oFormulaRange = new FormulaRange(c1, r1, c2, r2);
oFormulaRange.setAbs(oCacheVal.first.getRowAbs(), oCacheVal.first.getColAbs(), oCacheVal.last.getRowAbs(),
oCacheVal.last.getColAbs());
oCacheVal.formulaRange = oFormulaRange;
}
this.oCache[sRange] = oCacheVal;
oRes = oCacheVal.formulaRange;
}
if (1 == type)
oRes = oCacheVal.ascRange;
else if (2 == type)
oRes = oCacheVal.activeRange;
else
oRes = oCacheVal.formulaRange;
if (null == oRes && null != oCacheVal.first && null != oCacheVal.last) {
var r1 = oCacheVal.first.getRow0(), r2 = oCacheVal.last.getRow0(), c1 = oCacheVal.first.getCol0(), c2 = oCacheVal.last.getCol0();
if (oCacheVal.first.getIsRow() && oCacheVal.last.getIsRow()) {
c1 = 0;
c2 = gc_nMaxCol0;
}
if (oCacheVal.first.getIsCol() && oCacheVal.last.getIsCol()) {
r1 = 0;
r2 = gc_nMaxRow0;
}
if (r1 > r2) {
var temp = r1;
r1 = r2;
r2 = temp;
}
if (c1 > c2) {
var temp = c1;
c1 = c2;
c2 = temp;
}
if (1 == type) {
if (null == oCacheVal.ascRange) {
var oAscRange = new Range(c1, r1, c2, r2);
oAscRange.r1Abs = oCacheVal.first.getRowAbs();
oAscRange.c1Abs = oCacheVal.first.getColAbs();
oAscRange.r2Abs = oCacheVal.last.getRowAbs();
oAscRange.c2Abs = oCacheVal.last.getColAbs();
oCacheVal.ascRange = oAscRange;
}
oRes = oCacheVal.ascRange;
}
else if (2 == type) {
if (null == oCacheVal.activeRange) {
var oActiveRange = new ActiveRange(c1, r1, c2, r2);
oActiveRange.r1Abs = oCacheVal.first.getRowAbs();
oActiveRange.c1Abs = oCacheVal.first.getColAbs();
oActiveRange.r2Abs = oCacheVal.last.getRowAbs();
oActiveRange.c2Abs = oCacheVal.last.getColAbs();
var bCol = 0 == r1 && gc_nMaxRow0 == r2;
var bRow = 0 == c1 && gc_nMaxCol0 == c2;
if (bCol && bRow)
oActiveRange.type = c_oAscSelectionType.RangeMax;
else if (bCol)
oActiveRange.type = c_oAscSelectionType.RangeCol;
else if (bRow)
oActiveRange.type = c_oAscSelectionType.RangeRow;
else
oActiveRange.type = c_oAscSelectionType.RangeCells;
oActiveRange.startCol = oActiveRange.c1;
oActiveRange.startRow = oActiveRange.r1;
oCacheVal.activeRange = oActiveRange;
}
oRes = oCacheVal.activeRange;
}
else {
if (null == oCacheVal.formulaRange) {
var oFormulaRange = new FormulaRange(c1, r1, c2, r2);
oFormulaRange.r1Abs = oCacheVal.first.getRowAbs();
oFormulaRange.c1Abs = oCacheVal.first.getColAbs();
oFormulaRange.r2Abs = oCacheVal.last.getRowAbs();
oFormulaRange.c2Abs = oCacheVal.last.getColAbs();
oCacheVal.formulaRange = oFormulaRange;
}
oRes = oCacheVal.formulaRange;
}
}
return oRes;
}
return oRes;
};
var g_oRangeCache = new RangeCache();
/**
* @constructor
......
......@@ -465,43 +465,43 @@
CellEditor.prototype.canEnterCellRange = function () {
var fR = this._findRangeUnderCursor();
var isRange = (fR.range !== null && !fR.range.isName);
var prevChar = this.textRender.getChars( this.cursorPos - 1, 1 );
return isRange || this.rangeChars.indexOf( prevChar ) >= 0;
var prevChar = this.textRender.getChars(this.cursorPos - 1, 1);
return isRange || this.rangeChars.indexOf(prevChar) >= 0;
};
CellEditor.prototype.activateCellRange = function () {
var res = this._findRangeUnderCursor();
res.range ? this.handlers.trigger( "existedRange", res.range, res.wsName ) : this.handlers.trigger( "newRange" );
res.range ? this.handlers.trigger("existedRange", res.range, res.wsName) : this.handlers.trigger("newRange");
};
CellEditor.prototype.enterCellRange = function ( rangeStr ) {
CellEditor.prototype.enterCellRange = function (rangeStr) {
var res = this._findRangeUnderCursor();
if ( res.range ) {
this._moveCursor( kPosition, res.index );
this._selectChars( kPosition, res.index + res.length );
if (res.range) {
this._moveCursor(kPosition, res.index);
this._selectChars(kPosition, res.index + res.length);
}
var lastAction = this.undoList.length > 0 ? this.undoList[this.undoList.length - 1] : null;
while ( lastAction && lastAction.isRange ) {
while (lastAction && lastAction.isRange) {
this.undoList.pop();
lastAction = this.undoList.length > 0 ? this.undoList[this.undoList.length - 1] : null;
}
var tmp = this.skipTLUpdate;
this.skipTLUpdate = false;
this._addChars( rangeStr, undefined, /*isRange*/true );
this._addChars(rangeStr, undefined, /*isRange*/true);
this.skipTLUpdate = tmp;
};
CellEditor.prototype.changeCellRange = function ( range ) {
CellEditor.prototype.changeCellRange = function (range) {
var t = this;
t._moveCursor( kPosition, range.cursorePos/* -length */ );
t._selectChars( kPositionLength, range.formulaRangeLength );
t._addChars( range.getName(), undefined, /*isRange*/true );
t._moveCursor( kEndOfText );
t._moveCursor(kPosition, range.cursorePos/* -length */);
t._selectChars(kPositionLength, range.formulaRangeLength);
t._addChars(range.getName(), undefined, /*isRange*/true);
t._moveCursor(kEndOfText);
};
CellEditor.prototype.move = function ( l, t, r, b ) {
......@@ -799,8 +799,8 @@
this.skipKeyPress = false;
};
CellEditor.prototype._parseRangeStr = function ( s ) {
var range = AscCommonExcel.g_oRangeCache.getActiveRange( s );
CellEditor.prototype._parseRangeStr = function (s) {
var range = AscCommonExcel.g_oRangeCache.getActiveRange(s);
return range ? range.clone() : null;
};
......@@ -935,34 +935,31 @@
};
CellEditor.prototype._findRangeUnderCursor = function () {
var t = this,
s = t.textRender.getChars( 0, t.textRender.getCharsCount() ),
range,
arrFR = this.handlers.trigger( "getFormulaRanges" ),a;
var t = this, s = t.textRender.getChars(0, t.textRender.getCharsCount()), range, arrFR = this.handlers.trigger(
"getFormulaRanges"), a;
for ( var id = 0; id < arrFR.length; id++ ) {
for (var id = 0; id < arrFR.length; id++) {
/*так как у нас уже есть некий массив с рейнджами, которые в формуле, то пробегаемся по ним и смотрим,
* находится ли курсор в позиции над этим диапазоном, дабы не парсить всю формулу заново
* необходимо чтобы парсить случаи когда используется что-то такое sumnas2:K2 - sumnas2 невалидная ссылка.
* */
a = arrFR[id];
if ( t.cursorPos >= a.cursorePos && t.cursorPos <= a.cursorePos + a.formulaRangeLength ) {
if (t.cursorPos >= a.cursorePos && t.cursorPos <= a.cursorePos + a.formulaRangeLength) {
range = a.clone(true);
range.isName = a.isName;
return {index: a.cursorePos, length: a.formulaRangeLength, range: range };
return {index: a.cursorePos, length: a.formulaRangeLength, range: range};
}
}
/*не нашли диапазонов под курсором, парсим формулу*/
var r, offset, _e, _s, wsName = null, ret = false, refStr, isName = false, _sColorPos,
wsOPEN = this.handlers.trigger( "getCellFormulaEnterWSOpen" ),
ws = wsOPEN ? wsOPEN.model : this.handlers.trigger( "getActiveWS" );
var r, offset, _e, _s, wsName = null, ret = false, refStr, isName = false, _sColorPos, wsOPEN = this.handlers.trigger(
"getCellFormulaEnterWSOpen"), ws = wsOPEN ? wsOPEN.model : this.handlers.trigger("getActiveWS");
this._formula = new AscCommonExcel.parserFormula( s.substr( 1 ), this.options.cellName, ws );
this._formula = new AscCommonExcel.parserFormula(s.substr(1), this.options.cellName, ws);
this._formula.parse();
if ( this._formula.RefPos && this._formula.RefPos.length > 0 ) {
for ( var index = 0; index < this._formula.RefPos.length; index++ ) {
if (this._formula.RefPos && this._formula.RefPos.length > 0) {
for (var index = 0; index < this._formula.RefPos.length; index++) {
wsName = null;
r = this._formula.RefPos[index];
......@@ -970,18 +967,16 @@
_e = r.end;
_sColorPos = _s = r.start;
switch ( r.oper.type ) {
case cElementType.cell :
{
if ( wsOPEN ) {
switch (r.oper.type) {
case cElementType.cell : {
if (wsOPEN) {
wsName = wsOPEN.model.getName();
}
refStr = r.oper.value;
ret = true;
break;
}
case cElementType.cell3D :
{
case cElementType.cell3D : {
refStr = r.oper.value;
ret = true;
wsName = r.oper.ws.getName();
......@@ -989,18 +984,16 @@
_sColorPos = _e - r.oper.toString().length;
break;
}
case cElementType.cellsRange :
{
if ( wsOPEN ) {
case cElementType.cellsRange : {
if (wsOPEN) {
wsName = wsOPEN.model.getName();
}
refStr = r.oper.value;
ret = true;
break;
}
case cElementType.cellsRange3D :
{
if ( !r.oper.isSingleSheet() ) {
case cElementType.cellsRange3D : {
if (!r.oper.isSingleSheet()) {
continue;
}
ret = true;
......@@ -1010,21 +1003,20 @@
break;
}
case cElementType.table :
case cElementType.name :
{
case cElementType.name : {
var nameRef = r.oper.toRef();
if ( nameRef instanceof AscCommonExcel.cError ) continue;
switch ( nameRef.type ) {
if (nameRef instanceof AscCommonExcel.cError) {
continue;
}
switch (nameRef.type) {
case cElementType.cellsRange3D :
{
if ( !nameRef.isSingleSheet() ) {
case cElementType.cellsRange3D : {
if (!nameRef.isSingleSheet()) {
continue;
}
}
case cElementType.cellsRange :
case cElementType.cell3D :
{
case cElementType.cell3D : {
ret = true;
refStr = nameRef.value;
wsName = nameRef.getWS().getName();
......@@ -1039,10 +1031,10 @@
continue;
}
if ( ret && t.cursorPos > _s && t.cursorPos <= _s + r.oper.value.length ) {
range = t._parseRangeStr( r.oper.value );
if ( range ) {
if ( this.handlers.trigger( "getActiveWS" ) && this.handlers.trigger( "getActiveWS" ).getName() != wsName ) {
if (ret && t.cursorPos > _s && t.cursorPos <= _s + r.oper.value.length) {
range = t._parseRangeStr(r.oper.value);
if (range) {
if (this.handlers.trigger("getActiveWS") && this.handlers.trigger("getActiveWS").getName() != wsName) {
return {index: -1, length: 0, range: null};
}
range.isName = isName
......@@ -1052,10 +1044,8 @@
}
}
range ? range.isName = isName : null;
return !range ?
{index: -1, length: 0, range: null} :
return !range ? {index: -1, length: 0, range: null} :
{index: _s, length: r.oper.value.length, range: range, wsName: wsName};
};
CellEditor.prototype._updateFormulaEditMod = function ( bIsOpen ) {
......@@ -2493,6 +2483,17 @@
event.preventDefault();
}
return false;
case 115: // F4
var res = this._findRangeUnderCursor();
if (res.range) {
res.range.switchReference();
this.enterCellRange(res.range.getName());
}
event.stopPropagation();
event.preventDefault();
return false;
}
t.skipKeyPress = false;
......
......@@ -7271,10 +7271,10 @@
WorksheetView.prototype.getSelectionRangeValue = function () {
// ToDo проблема с выбором целого столбца/строки
var ar = this.activeRange.clone( true );
// ar.r1Abs = ar.c1Abs = ar.r2Abs = ar.c2Abs = true;
var ar = this.activeRange.clone(true);
var sName = ar.getAbsName();
return (c_oAscSelectionDialogType.FormatTable === this.selectionDialogType) ? sName : parserHelp.get3DRef( this.model.getName(), sName );
return (c_oAscSelectionDialogType.FormatTable === this.selectionDialogType) ? sName :
parserHelp.get3DRef(this.model.getName(), sName);
};
WorksheetView.prototype.getSelectionInfo = function ( bExt ) {
......@@ -8617,42 +8617,41 @@
return d;
};
WorksheetView.prototype.changeSelectionMoveResizeRangeHandle = function ( x, y, targetInfo, editor ) {
WorksheetView.prototype.changeSelectionMoveResizeRangeHandle = function (x, y, targetInfo, editor) {
// Возвращаемый результат
if ( !targetInfo ) {
if (!targetInfo) {
return null;
}
var indexFormulaRange = targetInfo.indexFormulaRange, d = {deltaY: 0, deltaX: 0}, newFormulaRange = null;
// Пересчитываем координаты
x *= asc_getcvt( 0/*px*/, 1/*pt*/, this._getPPIX() );
y *= asc_getcvt( 0/*px*/, 1/*pt*/, this._getPPIY() );
var ar = 0 == targetInfo.targetArr ? this.arrActiveFormulaRanges[indexFormulaRange].clone( true ) : this.arrActiveChartsRanges[indexFormulaRange].clone( true );
x *= asc_getcvt(0/*px*/, 1/*pt*/, this._getPPIX());
y *= asc_getcvt(0/*px*/, 1/*pt*/, this._getPPIY());
var ar = 0 == targetInfo.targetArr ? this.arrActiveFormulaRanges[indexFormulaRange].clone(true) :
this.arrActiveChartsRanges[indexFormulaRange].clone(true);
// Колонка по X и строка по Y
var colByX = this._findColUnderCursor( x, /*canReturnNull*/false, /*dX*/false ).col;
var rowByY = this._findRowUnderCursor( y, /*canReturnNull*/false, /*dY*/false ).row;
var colByX = this._findColUnderCursor(x, /*canReturnNull*/false, /*dX*/false).col;
var rowByY = this._findRowUnderCursor(y, /*canReturnNull*/false, /*dY*/false).row;
// Если мы только первый раз попали сюда, то копируем выделенную область
if ( null === this.startCellMoveResizeRange ) {
if ( (targetInfo.cursor == kCurNEResize || targetInfo.cursor == kCurSEResize) ) {
this.startCellMoveResizeRange = ar.clone( true );
this.startCellMoveResizeRange2 = new asc_Range( targetInfo.col, targetInfo.row, targetInfo.col, targetInfo.row, true );
}
else {
this.startCellMoveResizeRange = ar.clone( true );
if ( colByX < ar.c1 ) {
if (null === this.startCellMoveResizeRange) {
if ((targetInfo.cursor == kCurNEResize || targetInfo.cursor == kCurSEResize)) {
this.startCellMoveResizeRange = ar.clone(true);
this.startCellMoveResizeRange2 =
new asc_Range(targetInfo.col, targetInfo.row, targetInfo.col, targetInfo.row, true);
} else {
this.startCellMoveResizeRange = ar.clone(true);
if (colByX < ar.c1) {
colByX = ar.c1;
}
else if ( colByX > ar.c2 ) {
} else if (colByX > ar.c2) {
colByX = ar.c2;
}
if ( rowByY < ar.r1 ) {
if (rowByY < ar.r1) {
rowByY = ar.r1;
}
else if ( rowByY > ar.r2 ) {
} else if (rowByY > ar.r2) {
rowByY = ar.r2;
}
this.startCellMoveResizeRange2 = new asc_Range( colByX, rowByY, colByX, rowByY );
this.startCellMoveResizeRange2 = new asc_Range(colByX, rowByY, colByX, rowByY);
}
return null;
}
......@@ -8661,49 +8660,48 @@
// this.cleanSelection();
this.overlayCtx.clear();
if ( targetInfo.cursor == kCurNEResize || targetInfo.cursor == kCurSEResize ) {
if (targetInfo.cursor == kCurNEResize || targetInfo.cursor == kCurSEResize) {
if ( colByX < this.startCellMoveResizeRange2.c1 ) {
if (colByX < this.startCellMoveResizeRange2.c1) {
ar.c2 = this.startCellMoveResizeRange2.c1;
ar.c1 = colByX;
}
else if ( colByX > this.startCellMoveResizeRange2.c1 ) {
} else if (colByX > this.startCellMoveResizeRange2.c1) {
ar.c1 = this.startCellMoveResizeRange2.c1;
ar.c2 = colByX;
}
else {
} else {
ar.c1 = this.startCellMoveResizeRange2.c1;
ar.c2 = this.startCellMoveResizeRange2.c1
}
if ( rowByY < this.startCellMoveResizeRange2.r1 ) {
if (rowByY < this.startCellMoveResizeRange2.r1) {
ar.r2 = this.startCellMoveResizeRange2.r2;
ar.r1 = rowByY;
}
else if ( rowByY > this.startCellMoveResizeRange2.r1 ) {
} else if (rowByY > this.startCellMoveResizeRange2.r1) {
ar.r1 = this.startCellMoveResizeRange2.r1;
ar.r2 = rowByY;
}
else {
} else {
ar.r1 = this.startCellMoveResizeRange2.r1;
ar.r2 = this.startCellMoveResizeRange2.r1;
}
}
else {
} else {
this.startCellMoveResizeRange.normalize();
var colDelta = this.startCellMoveResizeRange.type != c_oAscSelectionType.RangeRow && this.startCellMoveResizeRange.type != c_oAscSelectionType.RangeMax ? colByX - this.startCellMoveResizeRange2.c1 : 0;
var rowDelta = this.startCellMoveResizeRange.type != c_oAscSelectionType.RangeCol && this.startCellMoveResizeRange.type != c_oAscSelectionType.RangeMax ? rowByY - this.startCellMoveResizeRange2.r1 : 0;
var colDelta = this.startCellMoveResizeRange.type != c_oAscSelectionType.RangeRow &&
this.startCellMoveResizeRange.type != c_oAscSelectionType.RangeMax ?
colByX - this.startCellMoveResizeRange2.c1 : 0;
var rowDelta = this.startCellMoveResizeRange.type != c_oAscSelectionType.RangeCol &&
this.startCellMoveResizeRange.type != c_oAscSelectionType.RangeMax ?
rowByY - this.startCellMoveResizeRange2.r1 : 0;
ar.c1 = this.startCellMoveResizeRange.c1 + colDelta;
if ( 0 > ar.c1 ) {
if (0 > ar.c1) {
colDelta -= ar.c1;
ar.c1 = 0;
}
ar.c2 = this.startCellMoveResizeRange.c2 + colDelta;
ar.r1 = this.startCellMoveResizeRange.r1 + rowDelta;
if ( 0 > ar.r1 ) {
if (0 > ar.r1) {
rowDelta -= ar.r1;
ar.r1 = 0;
}
......@@ -8711,46 +8709,41 @@
}
if ( y <= this.cellsTop + this.height_2px ) {
if (y <= this.cellsTop + this.height_2px) {
d.deltaY = -1;
}
else if ( y >= this.drawingCtx.getHeight() - this.height_2px ) {
} else if (y >= this.drawingCtx.getHeight() - this.height_2px) {
d.deltaY = 1;
}
if ( x <= this.cellsLeft + this.width_2px ) {
if (x <= this.cellsLeft + this.width_2px) {
d.deltaX = -1;
}
else if ( x >= this.drawingCtx.getWidth() - this.width_2px ) {
} else if (x >= this.drawingCtx.getWidth() - this.width_2px) {
d.deltaX = 1;
}
if ( this.startCellMoveResizeRange.type === c_oAscSelectionType.RangeRow ) {
if (this.startCellMoveResizeRange.type === c_oAscSelectionType.RangeRow) {
d.deltaX = 0;
}
else if ( this.startCellMoveResizeRange.type === c_oAscSelectionType.RangeCol ) {
} else if (this.startCellMoveResizeRange.type === c_oAscSelectionType.RangeCol) {
d.deltaY = 0;
}
else if ( this.startCellMoveResizeRange.type === c_oAscSelectionType.RangeMax ) {
} else if (this.startCellMoveResizeRange.type === c_oAscSelectionType.RangeMax) {
d.deltaX = 0;
d.deltaY = 0;
}
if ( 0 == targetInfo.targetArr ) {
if (0 == targetInfo.targetArr) {
var _p = this.arrActiveFormulaRanges[indexFormulaRange].cursorePos, _l = this.arrActiveFormulaRanges[indexFormulaRange].formulaRangeLength;
this.arrActiveFormulaRanges[indexFormulaRange] = ar.clone( true );
this.arrActiveFormulaRanges[indexFormulaRange] = ar.clone(true);
this.arrActiveFormulaRanges[indexFormulaRange].cursorePos = _p;
this.arrActiveFormulaRanges[indexFormulaRange].formulaRangeLength = _l;
newFormulaRange = this.arrActiveFormulaRanges[indexFormulaRange];
}
else {
this.arrActiveChartsRanges[indexFormulaRange] = ar.clone( true );
} else {
this.arrActiveChartsRanges[indexFormulaRange] = ar.clone(true);
this.moveRangeDrawingObjectTo = ar;
}
this._drawSelection();
if ( newFormulaRange ) {
editor.changeCellRange( newFormulaRange );
if (newFormulaRange) {
editor.changeCellRange(newFormulaRange);
}
return d;
......
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