Commit 62201310 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add Range3D

parent 866d6037
...@@ -4555,22 +4555,22 @@ sparklineGroup.prototype.draw = function(oDrawingContext) { ...@@ -4555,22 +4555,22 @@ sparklineGroup.prototype.draw = function(oDrawingContext) {
} }
}; };
sparklineGroup.prototype.updateCache = function(sheet, ranges) { sparklineGroup.prototype.updateCache = function(sheet, ranges) {
var sparklineRange;
for (var i = 0; i < this.arrSparklines.length; ++i) { for (var i = 0; i < this.arrSparklines.length; ++i) {
if (sheet === this.arrSparklines[i].fSheet) { sparklineRange = this.arrSparklines[i]._f;
for (var j = 0; j < ranges.length; ++j) { for (var j = 0; j < ranges.length; ++j) {
if (ranges[j].intersectionSimple(this.arrSparklines[i].fRange)) { if (sparklineRange.isIntersect(ranges[j], sheet)) {
this.arrCachedSparklines[i] = null; this.arrCachedSparklines[i] = null;
break; break;
} }
} }
} }
}
}; };
/** @constructor */ /** @constructor */
function sparkline() { function sparkline() {
this.sqref = null; this.sqref = null;
this.f = null; this.f = null;
this.fRange = null; this._f = null;
this.fSheet = null; this.fSheet = null;
} }
sparkline.prototype.setSqref = function(sqref) { sparkline.prototype.setSqref = function(sqref) {
...@@ -4578,11 +4578,7 @@ sparkline.prototype.setSqref = function(sqref) { ...@@ -4578,11 +4578,7 @@ sparkline.prototype.setSqref = function(sqref) {
}; };
sparkline.prototype.setF = function(f) { sparkline.prototype.setF = function(f) {
this.f = f; this.f = f;
var res = parserHelp.parse3DRef(this.f); this._f = AscCommonExcel.g_oRangeCache.getRange3D(this.f);
if (res) {
this.fSheet = res.sheet;
this.fRange = AscCommonExcel.g_oRangeCache.getAscRange(res.range);
}
}; };
sparkline.prototype.checkInRange = function(range) { sparkline.prototype.checkInRange = function(range) {
return this.sqref ? range.isIntersect(this.sqref) : false; return this.sqref ? range.isIntersect(this.sqref) : false;
......
...@@ -447,6 +447,40 @@ ...@@ -447,6 +447,40 @@
} }
}; };
/**
*
* @constructor
* @extends {Range}
*/
function Range3D() {
this.sheet = '';
if (2 == arguments.length) {
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.sheet = arguments[1];
} else if (arguments.length > 1) {
ActiveRange.superclass.constructor.apply(this, arguments);
} else {
ActiveRange.superclass.constructor.call(this, 0, 0, 0, 0);
}
}
AscCommon.extendClass(Range3D, Range);
Range3D.prototype.isIntersect = function () {
var oRes = true;
if (2 == arguments.length) {
oRes = this.sheet === arguments[1];
}
return oRes && Range3D.superclass.isIntersect.apply(this, arguments);
};
/** /**
* *
* @constructor * @constructor
...@@ -680,6 +714,15 @@ ...@@ -680,6 +714,15 @@
{ {
return this._getRange(sRange, 1); return this._getRange(sRange, 1);
}, },
getRange3D : function(sRange)
{
var res = AscCommon.parserHelp.parse3DRef(sRange);
if (!res) {
return null;
}
var range = this._getRange(res.range, 1);
return range ? new Range3D(range, res.sheet) : null;
},
getActiveRange : function(sRange) getActiveRange : function(sRange)
{ {
return this._getRange(sRange, 2); return this._getRange(sRange, 2);
...@@ -1561,6 +1604,7 @@ ...@@ -1561,6 +1604,7 @@
window["Asc"].getEndValueRange = getEndValueRange; window["Asc"].getEndValueRange = getEndValueRange;
window["Asc"].Range = Range; window["Asc"].Range = Range;
window["AscCommonExcel"].Range3D = Range3D;
window["AscCommonExcel"].ActiveRange = ActiveRange; window["AscCommonExcel"].ActiveRange = ActiveRange;
window["AscCommonExcel"].FormulaRange = FormulaRange; window["AscCommonExcel"].FormulaRange = FormulaRange;
window["AscCommonExcel"].VisibleRange = VisibleRange; window["AscCommonExcel"].VisibleRange = VisibleRange;
......
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