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

delete formatType from all functions

delete numFormat from all functions -> move to prototype
parent 59d8975a
This diff is collapsed.
...@@ -32,143 +32,100 @@ ...@@ -32,143 +32,100 @@
"use strict"; "use strict";
( (/**
/** * @param {Window} window
* @param {Window} window * @param {undefined} undefined
* @param {undefined} undefined
*/ */
function (window, undefined) { function (window, undefined) {
var cElementType = AscCommonExcel.cElementType; var cElementType = AscCommonExcel.cElementType;
var cBaseFunction = AscCommonExcel.cBaseFunction; var cBaseFunction = AscCommonExcel.cBaseFunction;
var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup; var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup;
cFormulaFunctionGroup['Cube'] = cFormulaFunctionGroup['Cube'] || []; cFormulaFunctionGroup['Cube'] = cFormulaFunctionGroup['Cube'] || [];
cFormulaFunctionGroup['Cube'].push( cFormulaFunctionGroup['Cube'].push(cCUBEKPIMEMBER, cCUBEMEMBER, cCUBEMEMBERPROPERTY, cCUBERANKEDMEMBER, cCUBESET,
cCUBEKPIMEMBER, cCUBESETCOUNT, cCUBEVALUE);
cCUBEMEMBER,
cCUBEMEMBERPROPERTY, /** @constructor */
cCUBERANKEDMEMBER, function cCUBEKPIMEMBER() {
cCUBESET, this.name = "CUBEKPIMEMBER";
cCUBESETCOUNT, this.type = cElementType.func;
cCUBEVALUE this.value = null;
); this.argumentsMin = 0;
this.argumentsCurrent = 0;
function cCUBEKPIMEMBER() { this.argumentsMax = 255;
this.name = "CUBEKPIMEMBER"; }
this.type = cElementType.func;
this.value = null; cCUBEKPIMEMBER.prototype = Object.create(cBaseFunction.prototype);
this.argumentsMin = 0;
this.argumentsCurrent = 0; /** @constructor */
this.argumentsMax = 255; function cCUBEMEMBER() {
this.formatType = { this.name = "CUBEMEMBER";
def:-1, //подразумевается формат первой ячейки входящей в формулу. this.type = cElementType.func;
noneFormat:-2 this.value = null;
}; this.argumentsMin = 0;
this.numFormat = this.formatType.def; this.argumentsCurrent = 0;
this.argumentsMax = 255;
} }
cCUBEKPIMEMBER.prototype = Object.create( cBaseFunction.prototype ); cCUBEMEMBER.prototype = Object.create(cBaseFunction.prototype);
function cCUBEMEMBER() { /** @constructor */
this.name = "CUBEMEMBER"; function cCUBEMEMBERPROPERTY() {
this.type = cElementType.func; this.name = "CUBEMEMBERPROPERTY";
this.value = null; this.type = cElementType.func;
this.argumentsMin = 0; this.value = null;
this.argumentsCurrent = 0; this.argumentsMin = 0;
this.argumentsMax = 255; this.argumentsCurrent = 0;
this.formatType = { this.argumentsMax = 255;
def:-1, //подразумевается формат первой ячейки входящей в формулу. }
noneFormat:-2
}; cCUBEMEMBERPROPERTY.prototype = Object.create(cBaseFunction.prototype);
this.numFormat = this.formatType.def;
/** @constructor */
} function cCUBERANKEDMEMBER() {
this.name = "CUBERANKEDMEMBER";
cCUBEMEMBER.prototype = Object.create( cBaseFunction.prototype ); this.type = cElementType.func;
this.value = null;
function cCUBEMEMBERPROPERTY() { this.argumentsMin = 0;
this.name = "CUBEMEMBERPROPERTY"; this.argumentsCurrent = 0;
this.type = cElementType.func; this.argumentsMax = 255;
this.value = null; }
this.argumentsMin = 0;
this.argumentsCurrent = 0; cCUBERANKEDMEMBER.prototype = Object.create(cBaseFunction.prototype);
this.argumentsMax = 255;
this.formatType = { /** @constructor */
def:-1, //подразумевается формат первой ячейки входящей в формулу. function cCUBESET() {
noneFormat:-2 this.name = "CUBESET";
}; this.type = cElementType.func;
this.numFormat = this.formatType.def; this.value = null;
this.argumentsMin = 0;
} this.argumentsCurrent = 0;
this.argumentsMax = 255;
cCUBEMEMBERPROPERTY.prototype = Object.create( cBaseFunction.prototype ); }
function cCUBERANKEDMEMBER() { cCUBESET.prototype = Object.create(cBaseFunction.prototype);
this.name = "CUBERANKEDMEMBER";
this.type = cElementType.func; /** @constructor */
this.value = null; function cCUBESETCOUNT() {
this.argumentsMin = 0; this.name = "CUBESETCOUNT";
this.argumentsCurrent = 0; this.type = cElementType.func;
this.argumentsMax = 255; this.value = null;
this.formatType = { this.argumentsMin = 0;
def:-1, //подразумевается формат первой ячейки входящей в формулу. this.argumentsCurrent = 0;
noneFormat:-2 this.argumentsMax = 255;
}; }
this.numFormat = this.formatType.def;
cCUBESETCOUNT.prototype = Object.create(cBaseFunction.prototype);
}
/** @constructor */
cCUBERANKEDMEMBER.prototype = Object.create( cBaseFunction.prototype ); function cCUBEVALUE() {
this.name = "CUBEVALUE";
function cCUBESET() { this.type = cElementType.func;
this.name = "CUBESET"; this.value = null;
this.type = cElementType.func; this.argumentsMin = 0;
this.value = null; this.argumentsCurrent = 0;
this.argumentsMin = 0; this.argumentsMax = 255;
this.argumentsCurrent = 0; }
this.argumentsMax = 255;
this.formatType = { cCUBEVALUE.prototype = Object.create(cBaseFunction.prototype);
def:-1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat:-2
};
this.numFormat = this.formatType.def;
}
cCUBESET.prototype = Object.create( cBaseFunction.prototype );
function cCUBESETCOUNT() {
this.name = "CUBESETCOUNT";
this.type = cElementType.func;
this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0;
this.argumentsMax = 255;
this.formatType = {
def:-1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat:-2
};
this.numFormat = this.formatType.def;
}
cCUBESETCOUNT.prototype = Object.create( cBaseFunction.prototype );
function cCUBEVALUE() {
this.name = "CUBEVALUE";
this.type = cElementType.func;
this.value = null;
this.argumentsMin = 0;
this.argumentsCurrent = 0;
this.argumentsMax = 255;
this.formatType = {
def:-1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat:-2
};
this.numFormat = this.formatType.def;
}
cCUBEVALUE.prototype = Object.create( cBaseFunction.prototype );
})(window); })(window);
...@@ -32,100 +32,99 @@ ...@@ -32,100 +32,99 @@
"use strict"; "use strict";
( (/**
/** * @param {Window} window
* @param {Window} window * @param {undefined} undefined
* @param {undefined} undefined */
*/ function (window, undefined) {
function (window, undefined) { var cBaseFunction = AscCommonExcel.cBaseFunction;
var cBaseFunction = AscCommonExcel.cBaseFunction; var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup;
var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup;
cFormulaFunctionGroup['Database'] = cFormulaFunctionGroup['Database'] || []; cFormulaFunctionGroup['Database'] = cFormulaFunctionGroup['Database'] || [];
cFormulaFunctionGroup['Database'].push( cFormulaFunctionGroup['Database'].push(cDAVERAGE, cDCOUNT, cDCOUNTA, cDGET, cDMAX, cDMIN, cDPRODUCT, cDSTDEV,
cDAVERAGE, cDSTDEVP, cDSUM, cDVAR, cDVARP);
cDCOUNT,
cDCOUNTA,
cDGET,
cDMAX,
cDMIN,
cDPRODUCT,
cDSTDEV,
cDSTDEVP,
cDSUM,
cDVAR,
cDVARP
);
function cDAVERAGE() { /** @constructor */
cBaseFunction.call( this, "DAVERAGE" ); function cDAVERAGE() {
} cBaseFunction.call(this, "DAVERAGE");
}
cDAVERAGE.prototype = Object.create( cBaseFunction.prototype ); cDAVERAGE.prototype = Object.create(cBaseFunction.prototype);
function cDCOUNT() { /** @constructor */
cBaseFunction.call( this, "DCOUNT" ); function cDCOUNT() {
} cBaseFunction.call(this, "DCOUNT");
}
cDCOUNT.prototype = Object.create( cBaseFunction.prototype ); cDCOUNT.prototype = Object.create(cBaseFunction.prototype);
function cDCOUNTA() { /** @constructor */
cBaseFunction.call( this, "DCOUNTA" ); function cDCOUNTA() {
} cBaseFunction.call(this, "DCOUNTA");
}
cDCOUNTA.prototype = Object.create( cBaseFunction.prototype ); cDCOUNTA.prototype = Object.create(cBaseFunction.prototype);
function cDGET() { /** @constructor */
cBaseFunction.call( this, "DGET" ); function cDGET() {
} cBaseFunction.call(this, "DGET");
}
cDGET.prototype = Object.create( cBaseFunction.prototype ); cDGET.prototype = Object.create(cBaseFunction.prototype);
function cDMAX() { /** @constructor */
cBaseFunction.call( this, "DMAX" ); function cDMAX() {
} cBaseFunction.call(this, "DMAX");
}
cDMAX.prototype = Object.create( cBaseFunction.prototype ); cDMAX.prototype = Object.create(cBaseFunction.prototype);
function cDMIN() { /** @constructor */
cBaseFunction.call( this, "DMIN" ); function cDMIN() {
} cBaseFunction.call(this, "DMIN");
}
cDMIN.prototype = Object.create( cBaseFunction.prototype ); cDMIN.prototype = Object.create(cBaseFunction.prototype);
function cDPRODUCT() { /** @constructor */
cBaseFunction.call( this, "DPRODUCT" ); function cDPRODUCT() {
} cBaseFunction.call(this, "DPRODUCT");
}
cDPRODUCT.prototype = Object.create( cBaseFunction.prototype ); cDPRODUCT.prototype = Object.create(cBaseFunction.prototype);
function cDSTDEV() { /** @constructor */
cBaseFunction.call( this, "DSTDEV" ); function cDSTDEV() {
} cBaseFunction.call(this, "DSTDEV");
}
cDSTDEV.prototype = Object.create( cBaseFunction.prototype ); cDSTDEV.prototype = Object.create(cBaseFunction.prototype);
function cDSTDEVP() { /** @constructor */
cBaseFunction.call( this, "DSTDEVP" ); function cDSTDEVP() {
} cBaseFunction.call(this, "DSTDEVP");
}
cDSTDEVP.prototype = Object.create( cBaseFunction.prototype ); cDSTDEVP.prototype = Object.create(cBaseFunction.prototype);
function cDSUM() { /** @constructor */
cBaseFunction.call( this, "DSUM" ); function cDSUM() {
} cBaseFunction.call(this, "DSUM");
}
cDSUM.prototype = Object.create( cBaseFunction.prototype ); cDSUM.prototype = Object.create(cBaseFunction.prototype);
function cDVAR() { /** @constructor */
cBaseFunction.call( this, "DVAR" ); function cDVAR() {
} cBaseFunction.call(this, "DVAR");
}
cDVAR.prototype = Object.create( cBaseFunction.prototype ); cDVAR.prototype = Object.create(cBaseFunction.prototype);
function cDVARP() { /** @constructor */
cBaseFunction.call( this, "DVARP" ); function cDVARP() {
} cBaseFunction.call(this, "DVARP");
}
cDVARP.prototype = Object.create( cBaseFunction.prototype ); cDVARP.prototype = Object.create(cBaseFunction.prototype);
})(window); })(window);
...@@ -102,11 +102,6 @@ ...@@ -102,11 +102,6 @@
this.argumentsMin = 2; this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 5; this.argumentsMax = 5;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cADDRESS.prototype = Object.create(cBaseFunction.prototype); cADDRESS.prototype = Object.create(cBaseFunction.prototype);
...@@ -231,11 +226,6 @@ ...@@ -231,11 +226,6 @@
this.argumentsMin = 2; this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 30; this.argumentsMax = 30;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cCHOOSE.prototype = Object.create(cBaseFunction.prototype); cCHOOSE.prototype = Object.create(cBaseFunction.prototype);
...@@ -275,11 +265,6 @@ ...@@ -275,11 +265,6 @@
this.argumentsMin = 0; this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1; this.argumentsMax = 1;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cCOLUMN.prototype = Object.create(cBaseFunction.prototype); cCOLUMN.prototype = Object.create(cBaseFunction.prototype);
...@@ -311,11 +296,6 @@ ...@@ -311,11 +296,6 @@
this.argumentsMin = 1; this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1; this.argumentsMax = 1;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cCOLUMNS.prototype = Object.create(cBaseFunction.prototype); cCOLUMNS.prototype = Object.create(cBaseFunction.prototype);
...@@ -352,11 +332,6 @@ ...@@ -352,11 +332,6 @@
this.argumentsMin = 3; this.argumentsMin = 3;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 4; this.argumentsMax = 4;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cHLOOKUP.prototype = Object.create(cBaseFunction.prototype); cHLOOKUP.prototype = Object.create(cBaseFunction.prototype);
...@@ -473,11 +448,6 @@ ...@@ -473,11 +448,6 @@
this.argumentsMin = 2; this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 4; this.argumentsMax = 4;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cINDEX.prototype = Object.create(cBaseFunction.prototype); cINDEX.prototype = Object.create(cBaseFunction.prototype);
...@@ -560,11 +530,6 @@ ...@@ -560,11 +530,6 @@
this.argumentsMin = 1; this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 2; this.argumentsMax = 2;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cINDIRECT.prototype = Object.create(cBaseFunction.prototype); cINDIRECT.prototype = Object.create(cBaseFunction.prototype);
...@@ -640,11 +605,6 @@ ...@@ -640,11 +605,6 @@
this.argumentsMin = 2; this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 3; this.argumentsMax = 3;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cLOOKUP.prototype = Object.create(cBaseFunction.prototype); cLOOKUP.prototype = Object.create(cBaseFunction.prototype);
...@@ -791,11 +751,6 @@ ...@@ -791,11 +751,6 @@
this.argumentsMin = 2; this.argumentsMin = 2;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 3; this.argumentsMax = 3;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cMATCH.prototype = Object.create(cBaseFunction.prototype); cMATCH.prototype = Object.create(cBaseFunction.prototype);
...@@ -902,11 +857,6 @@ ...@@ -902,11 +857,6 @@
this.argumentsMin = 3; this.argumentsMin = 3;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 5; this.argumentsMax = 5;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cOFFSET.prototype = Object.create(cBaseFunction.prototype); cOFFSET.prototype = Object.create(cBaseFunction.prototype);
...@@ -1008,11 +958,6 @@ ...@@ -1008,11 +958,6 @@
this.argumentsMin = 0; this.argumentsMin = 0;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1; this.argumentsMax = 1;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cROW.prototype = Object.create(cBaseFunction.prototype); cROW.prototype = Object.create(cBaseFunction.prototype);
...@@ -1044,11 +989,6 @@ ...@@ -1044,11 +989,6 @@
this.argumentsMin = 1; this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1; this.argumentsMax = 1;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cROWS.prototype = Object.create(cBaseFunction.prototype); cROWS.prototype = Object.create(cBaseFunction.prototype);
...@@ -1085,14 +1025,10 @@ ...@@ -1085,14 +1025,10 @@
this.argumentsMin = 1; this.argumentsMin = 1;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 1; this.argumentsMax = 1;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.noneFormat;
} }
cTRANSPOSE.prototype = Object.create(cBaseFunction.prototype); cTRANSPOSE.prototype = Object.create(cBaseFunction.prototype);
cTRANSPOSE.prototype.numFormat = AscCommonExcel.cNumFormatNone;
cTRANSPOSE.prototype.Calculate = function (arg) { cTRANSPOSE.prototype.Calculate = function (arg) {
function TransposeMatrix(A) { function TransposeMatrix(A) {
...@@ -1223,11 +1159,6 @@ ...@@ -1223,11 +1159,6 @@
this.argumentsMin = 3; this.argumentsMin = 3;
this.argumentsCurrent = 0; this.argumentsCurrent = 0;
this.argumentsMax = 4; this.argumentsMax = 4;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
} }
cVLOOKUP.prototype = Object.create(cBaseFunction.prototype); cVLOOKUP.prototype = Object.create(cBaseFunction.prototype);
......
This diff is collapsed.
...@@ -5263,12 +5263,11 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){ ...@@ -5263,12 +5263,11 @@ Woorksheet.prototype.isApplyFilterBySheet = function(){
Cell.prototype._adjustCellFormat = function() { Cell.prototype._adjustCellFormat = function() {
if (this.formulaParsed && this.formulaParsed.value && this.formulaParsed.outStack) { if (this.formulaParsed && this.formulaParsed.value && this.formulaParsed.outStack) {
var valueCalc = this.formulaParsed.value; var valueCalc = this.formulaParsed.value;
if (valueCalc.numFormat !== undefined && valueCalc.numFormat >= 0) { if (0 <= valueCalc.numFormat) {
if (aStandartNumFormatsId[this.getNumFormatStr()] == 0) { if (aStandartNumFormatsId[this.getNumFormatStr()] == 0) {
this.setNumFormat(aStandartNumFormats[valueCalc.numFormat]); this.setNumFormat(aStandartNumFormats[valueCalc.numFormat]);
} }
} } else if (AscCommonExcel.cNumFormatFirstCell === valueCalc.numFormat) {
else if (valueCalc.numFormat !== undefined && valueCalc.numFormat == -1) {
// ищет в формуле первый рэндж и устанавливает формат ячейки как формат первой ячейки в рэндже // ищет в формуле первый рэндж и устанавливает формат ячейки как формат первой ячейки в рэндже
for (var i = 0, length = this.formulaParsed.outStack.length; i < length; i++) { for (var i = 0, length = this.formulaParsed.outStack.length; i < length; i++) {
var elem = this.formulaParsed.outStack[i]; var elem = this.formulaParsed.outStack[i];
......
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