Commit 4c4b4b03 authored by Alexey.Musinov's avatar Alexey.Musinov

Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into develop

* 'develop' of https://github.com/ONLYOFFICE/sdkjs:
  freeze pane m_oState revert to string
  fix bug 30245 support function SUMIFS
parents d437ac6b dd61d3ee
...@@ -268,9 +268,9 @@ var c_oAscCanChangeColWidth = { ...@@ -268,9 +268,9 @@ var c_oAscCanChangeColWidth = {
}; };
var c_oAscPaneState = { var c_oAscPaneState = {
Frozen: 0, Frozen: "frozen",
FrozenSplit: 1, FrozenSplit: "frozenSplit",
Split: 2 Split: "split"
}; };
var c_oAscFindLookIn = { var c_oAscFindLookIn = {
......
...@@ -261,7 +261,7 @@ function cACOSH() { ...@@ -261,7 +261,7 @@ function cACOSH() {
} }
cACOSH.prototype = Object.create( cBaseFunction.prototype ) cACOSH.prototype = Object.create( cBaseFunction.prototype );
cACOSH.prototype.Calculate = function ( arg ) { cACOSH.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -286,13 +286,13 @@ cACOSH.prototype.Calculate = function ( arg ) { ...@@ -286,13 +286,13 @@ cACOSH.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cACOSH.prototype.getInfo = function () { cACOSH.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cASIN() { function cASIN() {
// cBaseFunction.call( this, "ASIN" ); // cBaseFunction.call( this, "ASIN" );
...@@ -313,7 +313,7 @@ function cASIN() { ...@@ -313,7 +313,7 @@ function cASIN() {
} }
cASIN.prototype = Object.create( cBaseFunction.prototype ) cASIN.prototype = Object.create( cBaseFunction.prototype );
cASIN.prototype.Calculate = function ( arg ) { cASIN.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -338,13 +338,13 @@ cASIN.prototype.Calculate = function ( arg ) { ...@@ -338,13 +338,13 @@ cASIN.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cASIN.prototype.getInfo = function () { cASIN.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cASINH() { function cASINH() {
// cBaseFunction.call( this, "ASINH" ); // cBaseFunction.call( this, "ASINH" );
...@@ -365,7 +365,7 @@ function cASINH() { ...@@ -365,7 +365,7 @@ function cASINH() {
} }
cASINH.prototype = Object.create( cBaseFunction.prototype ) cASINH.prototype = Object.create( cBaseFunction.prototype );
cASINH.prototype.Calculate = function ( arg ) { cASINH.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -390,13 +390,13 @@ cASINH.prototype.Calculate = function ( arg ) { ...@@ -390,13 +390,13 @@ cASINH.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cASINH.prototype.getInfo = function () { cASINH.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cATAN() { function cATAN() {
// cBaseFunction.call( this, "ATAN" ); // cBaseFunction.call( this, "ATAN" );
...@@ -417,7 +417,7 @@ function cATAN() { ...@@ -417,7 +417,7 @@ function cATAN() {
} }
cATAN.prototype = Object.create( cBaseFunction.prototype ) cATAN.prototype = Object.create( cBaseFunction.prototype );
cATAN.prototype.Calculate = function ( arg ) { cATAN.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -449,7 +449,7 @@ cATAN.prototype.getInfo = function () { ...@@ -449,7 +449,7 @@ cATAN.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cATAN2() { function cATAN2() {
// cBaseFunction.call( this, "ATAN2" ); // cBaseFunction.call( this, "ATAN2" );
...@@ -470,7 +470,7 @@ function cATAN2() { ...@@ -470,7 +470,7 @@ function cATAN2() {
} }
cATAN2.prototype = Object.create( cBaseFunction.prototype ) cATAN2.prototype = Object.create( cBaseFunction.prototype );
cATAN2.prototype.Calculate = function ( arg ) { cATAN2.prototype.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1]; var arg0 = arg[0], arg1 = arg[1];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -537,13 +537,13 @@ cATAN2.prototype.Calculate = function ( arg ) { ...@@ -537,13 +537,13 @@ cATAN2.prototype.Calculate = function ( arg ) {
arg1.getValue() == 0 && arg0.getValue() == 0 ? new cError( cErrorType.division_by_zero ) : arg1.getValue() == 0 && arg0.getValue() == 0 ? new cError( cErrorType.division_by_zero ) :
new cNumber( Math.atan2( arg1.getValue(), arg0.getValue() ) ) new cNumber( Math.atan2( arg1.getValue(), arg0.getValue() ) )
) )
} };
cATAN2.prototype.getInfo = function () { cATAN2.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x, y )" args:"( x, y )"
}; };
} };
function cATANH() { function cATANH() {
// cBaseFunction.call( this, "ATANH" ); // cBaseFunction.call( this, "ATANH" );
...@@ -564,7 +564,7 @@ function cATANH() { ...@@ -564,7 +564,7 @@ function cATANH() {
} }
cATANH.prototype = Object.create( cBaseFunction.prototype ) cATANH.prototype = Object.create( cBaseFunction.prototype );
cATANH.prototype.Calculate = function ( arg ) { cATANH.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -589,13 +589,13 @@ cATANH.prototype.Calculate = function ( arg ) { ...@@ -589,13 +589,13 @@ cATANH.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cATANH.prototype.getInfo = function () { cATANH.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cCEILING() { function cCEILING() {
// cBaseFunction.call( this, "CEILING" ); // cBaseFunction.call( this, "CEILING" );
...@@ -616,7 +616,7 @@ function cCEILING() { ...@@ -616,7 +616,7 @@ function cCEILING() {
} }
cCEILING.prototype = Object.create( cBaseFunction.prototype ) cCEILING.prototype = Object.create( cBaseFunction.prototype );
cCEILING.prototype.Calculate = function ( arg ) { cCEILING.prototype.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1]; var arg0 = arg[0], arg1 = arg[1];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -697,13 +697,13 @@ cCEILING.prototype.Calculate = function ( arg ) { ...@@ -697,13 +697,13 @@ cCEILING.prototype.Calculate = function ( arg ) {
return this.value = ceilingHelper( arg0.getValue(), arg1.getValue() ); return this.value = ceilingHelper( arg0.getValue(), arg1.getValue() );
} };
cCEILING.prototype.getInfo = function () { cCEILING.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x, significance )" args:"( x, significance )"
}; };
} };
function cCOMBIN() { function cCOMBIN() {
// cBaseFunction.call( this, "COMBIN" ); // cBaseFunction.call( this, "COMBIN" );
...@@ -724,7 +724,7 @@ function cCOMBIN() { ...@@ -724,7 +724,7 @@ function cCOMBIN() {
} }
cCOMBIN.prototype = Object.create( cBaseFunction.prototype ) cCOMBIN.prototype = Object.create( cBaseFunction.prototype );
cCOMBIN.prototype.Calculate = function ( arg ) { cCOMBIN.prototype.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1]; var arg0 = arg[0], arg1 = arg[1];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -794,13 +794,13 @@ cCOMBIN.prototype.Calculate = function ( arg ) { ...@@ -794,13 +794,13 @@ cCOMBIN.prototype.Calculate = function ( arg ) {
return this.value = new cError( cErrorType.not_numeric ); return this.value = new cError( cErrorType.not_numeric );
return this.value = new cNumber( Math.binomCoeff( arg0.getValue(), arg1.getValue() ) ); return this.value = new cNumber( Math.binomCoeff( arg0.getValue(), arg1.getValue() ) );
} };
cCOMBIN.prototype.getInfo = function () { cCOMBIN.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( number , number-chosen )" args:"( number , number-chosen )"
}; };
} };
function cCOS() { function cCOS() {
// cBaseFunction.call( this, "COS" ); // cBaseFunction.call( this, "COS" );
...@@ -821,7 +821,7 @@ function cCOS() { ...@@ -821,7 +821,7 @@ function cCOS() {
} }
cCOS.prototype = Object.create( cBaseFunction.prototype ) cCOS.prototype = Object.create( cBaseFunction.prototype );
cCOS.prototype.Calculate = function ( arg ) { cCOS.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -846,13 +846,13 @@ cCOS.prototype.Calculate = function ( arg ) { ...@@ -846,13 +846,13 @@ cCOS.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cCOS.prototype.getInfo = function () { cCOS.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cCOSH() { function cCOSH() {
// cBaseFunction.call( this, "COSH" ); // cBaseFunction.call( this, "COSH" );
...@@ -873,7 +873,7 @@ function cCOSH() { ...@@ -873,7 +873,7 @@ function cCOSH() {
} }
cCOSH.prototype = Object.create( cBaseFunction.prototype ) cCOSH.prototype = Object.create( cBaseFunction.prototype );
cCOSH.prototype.Calculate = function ( arg ) { cCOSH.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -898,13 +898,13 @@ cCOSH.prototype.Calculate = function ( arg ) { ...@@ -898,13 +898,13 @@ cCOSH.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cCOSH.prototype.getInfo = function () { cCOSH.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cDEGREES() { function cDEGREES() {
// cBaseFunction.call( this, "DEGREES" ); // cBaseFunction.call( this, "DEGREES" );
...@@ -925,7 +925,7 @@ function cDEGREES() { ...@@ -925,7 +925,7 @@ function cDEGREES() {
} }
cDEGREES.prototype = Object.create( cBaseFunction.prototype ) cDEGREES.prototype = Object.create( cBaseFunction.prototype );
cDEGREES.prototype.Calculate = function ( arg ) { cDEGREES.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -951,19 +951,19 @@ cDEGREES.prototype.Calculate = function ( arg ) { ...@@ -951,19 +951,19 @@ cDEGREES.prototype.Calculate = function ( arg ) {
} }
return this.value = arg0; return this.value = arg0;
} };
cDEGREES.prototype.getInfo = function () { cDEGREES.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( angle )" args:"( angle )"
}; };
} };
function cECMA_CEILING() { function cECMA_CEILING() {
cBaseFunction.call( this, "ECMA_CEILING" ); cBaseFunction.call( this, "ECMA_CEILING" );
} }
cECMA_CEILING.prototype = Object.create( cBaseFunction.prototype ) cECMA_CEILING.prototype = Object.create( cBaseFunction.prototype );
function cEVEN() { function cEVEN() {
// cBaseFunction.call( this, "EVEN" ); // cBaseFunction.call( this, "EVEN" );
...@@ -984,7 +984,7 @@ function cEVEN() { ...@@ -984,7 +984,7 @@ function cEVEN() {
} }
cEVEN.prototype = Object.create( cBaseFunction.prototype ) cEVEN.prototype = Object.create( cBaseFunction.prototype );
cEVEN.prototype.Calculate = function ( arg ) { cEVEN.prototype.Calculate = function ( arg ) {
function evenHelper( arg ) { function evenHelper( arg ) {
...@@ -1030,13 +1030,13 @@ cEVEN.prototype.Calculate = function ( arg ) { ...@@ -1030,13 +1030,13 @@ cEVEN.prototype.Calculate = function ( arg ) {
return this.value = evenHelper( arg0 ); return this.value = evenHelper( arg0 );
} }
return this.value = new cError( cErrorType.wrong_value_type ); return this.value = new cError( cErrorType.wrong_value_type );
} };
cEVEN.prototype.getInfo = function () { cEVEN.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cEXP() { function cEXP() {
// cBaseFunction.call( this, "EXP" ); // cBaseFunction.call( this, "EXP" );
...@@ -1057,7 +1057,7 @@ function cEXP() { ...@@ -1057,7 +1057,7 @@ function cEXP() {
} }
cEXP.prototype = Object.create( cBaseFunction.prototype ) cEXP.prototype = Object.create( cBaseFunction.prototype );
cEXP.prototype.Calculate = function ( arg ) { cEXP.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -1085,13 +1085,13 @@ cEXP.prototype.Calculate = function ( arg ) { ...@@ -1085,13 +1085,13 @@ cEXP.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cEXP.prototype.getInfo = function () { cEXP.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cFACT() { function cFACT() {
// cBaseFunction.call( this, "FACT" ); // cBaseFunction.call( this, "FACT" );
...@@ -1112,7 +1112,7 @@ function cFACT() { ...@@ -1112,7 +1112,7 @@ function cFACT() {
} }
cFACT.prototype = Object.create( cBaseFunction.prototype ) cFACT.prototype = Object.create( cBaseFunction.prototype );
cFACT.prototype.Calculate = function ( arg ) { cFACT.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -1142,13 +1142,13 @@ cFACT.prototype.Calculate = function ( arg ) { ...@@ -1142,13 +1142,13 @@ cFACT.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) || a == Infinity ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) || a == Infinity ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cFACT.prototype.getInfo = function () { cFACT.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cFACTDOUBLE() { function cFACTDOUBLE() {
// cBaseFunction.call( this, "FACTDOUBLE" ); // cBaseFunction.call( this, "FACTDOUBLE" );
...@@ -1169,7 +1169,7 @@ function cFACTDOUBLE() { ...@@ -1169,7 +1169,7 @@ function cFACTDOUBLE() {
} }
cFACTDOUBLE.prototype = Object.create( cBaseFunction.prototype ) cFACTDOUBLE.prototype = Object.create( cBaseFunction.prototype );
cFACTDOUBLE.prototype.Calculate = function ( arg ) { cFACTDOUBLE.prototype.Calculate = function ( arg ) {
function factDouble( n ) { function factDouble( n ) {
if ( n == 0 ) { if ( n == 0 ) {
...@@ -1220,13 +1220,13 @@ cFACTDOUBLE.prototype.Calculate = function ( arg ) { ...@@ -1220,13 +1220,13 @@ cFACTDOUBLE.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) || a == Infinity ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) || a == Infinity ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cFACTDOUBLE.prototype.getInfo = function () { cFACTDOUBLE.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cFLOOR() { function cFLOOR() {
// cBaseFunction.call( this, "FLOOR" ); // cBaseFunction.call( this, "FLOOR" );
...@@ -1247,7 +1247,7 @@ function cFLOOR() { ...@@ -1247,7 +1247,7 @@ function cFLOOR() {
} }
cFLOOR.prototype = Object.create( cBaseFunction.prototype ) cFLOOR.prototype = Object.create( cBaseFunction.prototype );
cFLOOR.prototype.Calculate = function ( arg ) { cFLOOR.prototype.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1]; var arg0 = arg[0], arg1 = arg[1];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -1327,13 +1327,13 @@ cFLOOR.prototype.Calculate = function ( arg ) { ...@@ -1327,13 +1327,13 @@ cFLOOR.prototype.Calculate = function ( arg ) {
return this.value = new cError( cErrorType.wrong_value_type ); return this.value = new cError( cErrorType.wrong_value_type );
return this.value = floorHelper( arg0.getValue(), arg1.getValue() ); return this.value = floorHelper( arg0.getValue(), arg1.getValue() );
} };
cFLOOR.prototype.getInfo = function () { cFLOOR.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x, significance )" args:"( x, significance )"
}; };
} };
function cGCD() { function cGCD() {
// cBaseFunction.call( this, "GCD" ); // cBaseFunction.call( this, "GCD" );
...@@ -1354,7 +1354,7 @@ function cGCD() { ...@@ -1354,7 +1354,7 @@ function cGCD() {
} }
cGCD.prototype = Object.create( cBaseFunction.prototype ) cGCD.prototype = Object.create( cBaseFunction.prototype );
cGCD.prototype.Calculate = function ( arg ) { cGCD.prototype.Calculate = function ( arg ) {
var _gcd = 0; var _gcd = 0;
...@@ -1431,13 +1431,13 @@ cGCD.prototype.Calculate = function ( arg ) { ...@@ -1431,13 +1431,13 @@ cGCD.prototype.Calculate = function ( arg ) {
return this.value = new cNumber( _gcd ); return this.value = new cNumber( _gcd );
} };
cGCD.prototype.getInfo = function () { cGCD.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cINT() { function cINT() {
// cBaseFunction.call( this, "INT" ); // cBaseFunction.call( this, "INT" );
...@@ -1458,7 +1458,7 @@ function cINT() { ...@@ -1458,7 +1458,7 @@ function cINT() {
} }
cINT.prototype = Object.create( cBaseFunction.prototype ) cINT.prototype = Object.create( cBaseFunction.prototype );
cINT.prototype.Calculate = function ( arg ) { cINT.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -1483,19 +1483,19 @@ cINT.prototype.Calculate = function ( arg ) { ...@@ -1483,19 +1483,19 @@ cINT.prototype.Calculate = function ( arg ) {
} }
return this.value = new cNumber( Math.floor( arg0.getValue() ) ); return this.value = new cNumber( Math.floor( arg0.getValue() ) );
} };
cINT.prototype.getInfo = function () { cINT.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cISO_CEILING() { function cISO_CEILING() {
cBaseFunction.call( this, "ISO_CEILING" ); cBaseFunction.call( this, "ISO_CEILING" );
} }
cISO_CEILING.prototype = Object.create( cBaseFunction.prototype ) cISO_CEILING.prototype = Object.create( cBaseFunction.prototype );
function cLCM() { function cLCM() {
// cBaseFunction.call( this, "LCM" ); // cBaseFunction.call( this, "LCM" );
...@@ -1516,7 +1516,7 @@ function cLCM() { ...@@ -1516,7 +1516,7 @@ function cLCM() {
} }
cLCM.prototype = Object.create( cBaseFunction.prototype ) cLCM.prototype = Object.create( cBaseFunction.prototype );
cLCM.prototype.Calculate = function ( arg ) { cLCM.prototype.Calculate = function ( arg ) {
var _lcm = 1; var _lcm = 1;
...@@ -1597,13 +1597,13 @@ cLCM.prototype.Calculate = function ( arg ) { ...@@ -1597,13 +1597,13 @@ cLCM.prototype.Calculate = function ( arg ) {
return this.value = new cNumber( _lcm ); return this.value = new cNumber( _lcm );
} };
cLCM.prototype.getInfo = function () { cLCM.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cLN() { function cLN() {
// cBaseFunction.call( this, "LN" ); // cBaseFunction.call( this, "LN" );
...@@ -1624,7 +1624,7 @@ function cLN() { ...@@ -1624,7 +1624,7 @@ function cLN() {
} }
cLN.prototype = Object.create( cBaseFunction.prototype ) cLN.prototype = Object.create( cBaseFunction.prototype );
cLN.prototype.Calculate = function ( arg ) { cLN.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -1654,13 +1654,13 @@ cLN.prototype.Calculate = function ( arg ) { ...@@ -1654,13 +1654,13 @@ cLN.prototype.Calculate = function ( arg ) {
else else
return this.value = new cNumber( Math.log( arg0.getValue() ) ); return this.value = new cNumber( Math.log( arg0.getValue() ) );
} }
} };
cLN.prototype.getInfo = function () { cLN.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cLOG() { function cLOG() {
// cBaseFunction.call( this, "LOG" ); // cBaseFunction.call( this, "LOG" );
...@@ -1681,7 +1681,7 @@ function cLOG() { ...@@ -1681,7 +1681,7 @@ function cLOG() {
} }
cLOG.prototype = Object.create( cBaseFunction.prototype ) cLOG.prototype = Object.create( cBaseFunction.prototype );
cLOG.prototype.Calculate = function ( arg ) { cLOG.prototype.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1] ? arg[1] : new cNumber( 10 ); var arg0 = arg[0], arg1 = arg[1] ? arg[1] : new cNumber( 10 );
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -1754,13 +1754,13 @@ cLOG.prototype.Calculate = function ( arg ) { ...@@ -1754,13 +1754,13 @@ cLOG.prototype.Calculate = function ( arg ) {
return this.value = new cError( cErrorType.not_numeric ); return this.value = new cError( cErrorType.not_numeric );
return this.value = new cNumber( Math.log( arg0.getValue() ) / Math.log( arg1.getValue() ) ); return this.value = new cNumber( Math.log( arg0.getValue() ) / Math.log( arg1.getValue() ) );
} };
cLOG.prototype.getInfo = function () { cLOG.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x [ , base ] )" args:"( x [ , base ] )"
}; };
} };
function cLOG10() { function cLOG10() {
// cBaseFunction.call( this, "LOG10" ); // cBaseFunction.call( this, "LOG10" );
...@@ -1781,7 +1781,7 @@ function cLOG10() { ...@@ -1781,7 +1781,7 @@ function cLOG10() {
} }
cLOG10.prototype = Object.create( cBaseFunction.prototype ) cLOG10.prototype = Object.create( cBaseFunction.prototype );
cLOG10.prototype.Calculate = function ( arg ) { cLOG10.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -1811,13 +1811,13 @@ cLOG10.prototype.Calculate = function ( arg ) { ...@@ -1811,13 +1811,13 @@ cLOG10.prototype.Calculate = function ( arg ) {
else else
return this.value = new cNumber( Math.log10( arg0.getValue() ) ); return this.value = new cNumber( Math.log10( arg0.getValue() ) );
} }
} };
cLOG10.prototype.getInfo = function () { cLOG10.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cMDETERM() { function cMDETERM() {
// cBaseFunction.call( this, "MDETERM" ); // cBaseFunction.call( this, "MDETERM" );
...@@ -1839,7 +1839,7 @@ function cMDETERM() { ...@@ -1839,7 +1839,7 @@ function cMDETERM() {
} }
cMDETERM.prototype = Object.create( cBaseFunction.prototype ) cMDETERM.prototype = Object.create( cBaseFunction.prototype );
cMDETERM.prototype.Calculate = function ( arg ) { cMDETERM.prototype.Calculate = function ( arg ) {
function determ( A ) { function determ( A ) {
...@@ -1902,13 +1902,13 @@ cMDETERM.prototype.Calculate = function ( arg ) { ...@@ -1902,13 +1902,13 @@ cMDETERM.prototype.Calculate = function ( arg ) {
return this.value = new cNumber( arg0 ); return this.value = new cNumber( arg0 );
else else
return this.value = new cError( cErrorType.not_available ); return this.value = new cError( cErrorType.not_available );
} };
cMDETERM.prototype.getInfo = function () { cMDETERM.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( array )" args:"( array )"
}; };
} };
function cMINVERSE() { function cMINVERSE() {
// cBaseFunction.call( this, "MINVERSE" ); // cBaseFunction.call( this, "MINVERSE" );
...@@ -1930,7 +1930,7 @@ function cMINVERSE() { ...@@ -1930,7 +1930,7 @@ function cMINVERSE() {
} }
cMINVERSE.prototype = Object.create( cBaseFunction.prototype ) cMINVERSE.prototype = Object.create( cBaseFunction.prototype );
cMINVERSE.prototype.Calculate = function ( arg ) { cMINVERSE.prototype.Calculate = function ( arg ) {
function Determinant( A ) { function Determinant( A ) {
...@@ -2046,13 +2046,13 @@ cMINVERSE.prototype.Calculate = function ( arg ) { ...@@ -2046,13 +2046,13 @@ cMINVERSE.prototype.Calculate = function ( arg ) {
return this.value = new cError( cErrorType.wrong_value_type ); return this.value = new cError( cErrorType.wrong_value_type );
return this.value = InverseMatrix( arg0 ); return this.value = InverseMatrix( arg0 );
} };
cMINVERSE.prototype.getInfo = function () { cMINVERSE.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( array )" args:"( array )"
}; };
} };
function cMMULT() { function cMMULT() {
// cBaseFunction.call( this, "MMULT" ); // cBaseFunction.call( this, "MMULT" );
...@@ -2074,7 +2074,7 @@ function cMMULT() { ...@@ -2074,7 +2074,7 @@ function cMMULT() {
} }
cMMULT.prototype = Object.create( cBaseFunction.prototype ) cMMULT.prototype = Object.create( cBaseFunction.prototype );
cMMULT.prototype.Calculate = function ( arg ) { cMMULT.prototype.Calculate = function ( arg ) {
function mult( A, B ) { function mult( A, B ) {
...@@ -2125,13 +2125,13 @@ cMMULT.prototype.Calculate = function ( arg ) { ...@@ -2125,13 +2125,13 @@ cMMULT.prototype.Calculate = function ( arg ) {
return this.value = mult( arg0, arg1 ); return this.value = mult( arg0, arg1 );
} };
cMMULT.prototype.getInfo = function () { cMMULT.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( array1, array2 )" args:"( array1, array2 )"
}; };
} };
function cMOD() { function cMOD() {
// cBaseFunction.call( this, "MOD" ); // cBaseFunction.call( this, "MOD" );
...@@ -2152,7 +2152,7 @@ function cMOD() { ...@@ -2152,7 +2152,7 @@ function cMOD() {
} }
cMOD.prototype = Object.create( cBaseFunction.prototype ) cMOD.prototype = Object.create( cBaseFunction.prototype );
cMOD.prototype.Calculate = function ( arg ) { cMOD.prototype.Calculate = function ( arg ) {
var arg0 = arg[0], arg1 = arg[1]; var arg0 = arg[0], arg1 = arg[1];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -2218,13 +2218,13 @@ cMOD.prototype.Calculate = function ( arg ) { ...@@ -2218,13 +2218,13 @@ cMOD.prototype.Calculate = function ( arg ) {
return this.value = new cNumber( (arg1.getValue() < 0 ? -1 : 1) * ( Math.abs( arg0.getValue() ) % Math.abs( arg1.getValue() ) ) ); return this.value = new cNumber( (arg1.getValue() < 0 ? -1 : 1) * ( Math.abs( arg0.getValue() ) % Math.abs( arg1.getValue() ) ) );
} };
cMOD.prototype.getInfo = function () { cMOD.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x, y )" args:"( x, y )"
}; };
} };
function cMROUND() { function cMROUND() {
// cBaseFunction.call( this, "MROUND" ); // cBaseFunction.call( this, "MROUND" );
...@@ -2245,7 +2245,7 @@ function cMROUND() { ...@@ -2245,7 +2245,7 @@ function cMROUND() {
} }
cMROUND.prototype = Object.create( cBaseFunction.prototype ) cMROUND.prototype = Object.create( cBaseFunction.prototype );
cMROUND.prototype.Calculate = function ( arg ) { cMROUND.prototype.Calculate = function ( arg ) {
var multiple; var multiple;
...@@ -2329,13 +2329,13 @@ cMROUND.prototype.Calculate = function ( arg ) { ...@@ -2329,13 +2329,13 @@ cMROUND.prototype.Calculate = function ( arg ) {
multiple = arg1.getValue(); multiple = arg1.getValue();
return this.value = new cNumber( mroundHelper( arg0.getValue() + arg1.getValue() / 2 ) ); return this.value = new cNumber( mroundHelper( arg0.getValue() + arg1.getValue() / 2 ) );
} };
cMROUND.prototype.getInfo = function () { cMROUND.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x, multiple )" args:"( x, multiple )"
}; };
} };
function cMULTINOMIAL() { function cMULTINOMIAL() {
// cBaseFunction.call( this, "MULTINOMIAL" ); // cBaseFunction.call( this, "MULTINOMIAL" );
...@@ -2356,7 +2356,7 @@ function cMULTINOMIAL() { ...@@ -2356,7 +2356,7 @@ function cMULTINOMIAL() {
} }
cMULTINOMIAL.prototype = Object.create( cBaseFunction.prototype ) cMULTINOMIAL.prototype = Object.create( cBaseFunction.prototype );
cMULTINOMIAL.prototype.Calculate = function ( arg ) { cMULTINOMIAL.prototype.Calculate = function ( arg ) {
var arg0 = new cNumber( 0 ), fact = 1; var arg0 = new cNumber( 0 ), fact = 1;
...@@ -2434,13 +2434,13 @@ cMULTINOMIAL.prototype.Calculate = function ( arg ) { ...@@ -2434,13 +2434,13 @@ cMULTINOMIAL.prototype.Calculate = function ( arg ) {
return this.value = new cError( cErrorType.wrong_value_type ); return this.value = new cError( cErrorType.wrong_value_type );
return this.value = new cNumber( Math.fact( arg0.getValue() ) / fact ); return this.value = new cNumber( Math.fact( arg0.getValue() ) / fact );
} };
cMULTINOMIAL.prototype.getInfo = function () { cMULTINOMIAL.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( argument-list )" args:"( argument-list )"
}; };
} };
function cODD() { function cODD() {
// cBaseFunction.call( this, "ODD" ); // cBaseFunction.call( this, "ODD" );
...@@ -2461,7 +2461,7 @@ function cODD() { ...@@ -2461,7 +2461,7 @@ function cODD() {
} }
cODD.prototype = Object.create( cBaseFunction.prototype ) cODD.prototype = Object.create( cBaseFunction.prototype );
cODD.prototype.Calculate = function ( arg ) { cODD.prototype.Calculate = function ( arg ) {
function oddHelper( arg ) { function oddHelper( arg ) {
...@@ -2507,13 +2507,13 @@ cODD.prototype.Calculate = function ( arg ) { ...@@ -2507,13 +2507,13 @@ cODD.prototype.Calculate = function ( arg ) {
} }
return this.value = new cError( cErrorType.wrong_value_type ); return this.value = new cError( cErrorType.wrong_value_type );
} };
cODD.prototype.getInfo = function () { cODD.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cPI() { function cPI() {
// cBaseFunction.call( this, "PI" ); // cBaseFunction.call( this, "PI" );
...@@ -2534,16 +2534,16 @@ function cPI() { ...@@ -2534,16 +2534,16 @@ function cPI() {
} }
cPI.prototype = Object.create( cBaseFunction.prototype ) cPI.prototype = Object.create( cBaseFunction.prototype );
cPI.prototype.Calculate = function () { cPI.prototype.Calculate = function () {
return new cNumber( Math.PI ); return new cNumber( Math.PI );
} };
cPI.prototype.getInfo = function () { cPI.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"()" args:"()"
} }
} };
function cPOWER() { function cPOWER() {
// cBaseFunction.call( this, "POWER" ); // cBaseFunction.call( this, "POWER" );
...@@ -2564,7 +2564,7 @@ function cPOWER() { ...@@ -2564,7 +2564,7 @@ function cPOWER() {
} }
cPOWER.prototype = Object.create( cBaseFunction.prototype ) cPOWER.prototype = Object.create( cBaseFunction.prototype );
cPOWER.prototype.Calculate = function ( arg ) { cPOWER.prototype.Calculate = function ( arg ) {
function powerHelper( a, b ) { function powerHelper( a, b ) {
...@@ -2627,13 +2627,13 @@ cPOWER.prototype.Calculate = function ( arg ) { ...@@ -2627,13 +2627,13 @@ cPOWER.prototype.Calculate = function ( arg ) {
return this.value = powerHelper( arg0.getValue(), arg1.getValue() ); return this.value = powerHelper( arg0.getValue(), arg1.getValue() );
} };
cPOWER.prototype.getInfo = function () { cPOWER.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x, y )" args:"( x, y )"
}; };
} };
function cPRODUCT() { function cPRODUCT() {
// cBaseFunction.call( this, "PRODUCT" ); // cBaseFunction.call( this, "PRODUCT" );
...@@ -2714,7 +2714,7 @@ function cQUOTIENT() { ...@@ -2714,7 +2714,7 @@ function cQUOTIENT() {
} }
cQUOTIENT.prototype = Object.create( cBaseFunction.prototype ) cQUOTIENT.prototype = Object.create( cBaseFunction.prototype );
cQUOTIENT.prototype.Calculate = function ( arg ) { cQUOTIENT.prototype.Calculate = function ( arg ) {
function quotient( a, b ) { function quotient( a, b ) {
...@@ -2780,7 +2780,7 @@ cQUOTIENT.prototype.getInfo = function () { ...@@ -2780,7 +2780,7 @@ cQUOTIENT.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"( dividend , divisor )" args:"( dividend , divisor )"
}; };
} };
function cRADIANS() { function cRADIANS() {
// cBaseFunction.call( this, "RADIANS" ); // cBaseFunction.call( this, "RADIANS" );
...@@ -2801,7 +2801,7 @@ function cRADIANS() { ...@@ -2801,7 +2801,7 @@ function cRADIANS() {
} }
cRADIANS.prototype = Object.create( cBaseFunction.prototype ) cRADIANS.prototype = Object.create( cBaseFunction.prototype );
cRADIANS.prototype.Calculate = function ( arg ) { cRADIANS.prototype.Calculate = function ( arg ) {
function radiansHelper( ang ) { function radiansHelper( ang ) {
...@@ -2836,7 +2836,7 @@ cRADIANS.prototype.getInfo = function () { ...@@ -2836,7 +2836,7 @@ cRADIANS.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"( angle )" args:"( angle )"
}; };
} };
function cRAND() { function cRAND() {
// cBaseFunction.call( this, "RAND" ); // cBaseFunction.call( this, "RAND" );
...@@ -2857,16 +2857,16 @@ function cRAND() { ...@@ -2857,16 +2857,16 @@ function cRAND() {
} }
cRAND.prototype = Object.create( cBaseFunction.prototype ) cRAND.prototype = Object.create( cBaseFunction.prototype );
cRAND.prototype.Calculate = function () { cRAND.prototype.Calculate = function () {
return this.setCA( new cNumber( Math.random() ), true ); return this.setCA( new cNumber( Math.random() ), true );
} };
cRAND.prototype.getInfo = function () { cRAND.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"()" args:"()"
}; };
} };
function cRANDBETWEEN() { function cRANDBETWEEN() {
// cBaseFunction.call( this, "RANDBETWEEN" ); // cBaseFunction.call( this, "RANDBETWEEN" );
...@@ -2887,7 +2887,7 @@ function cRANDBETWEEN() { ...@@ -2887,7 +2887,7 @@ function cRANDBETWEEN() {
} }
cRANDBETWEEN.prototype = Object.create( cBaseFunction.prototype ) cRANDBETWEEN.prototype = Object.create( cBaseFunction.prototype );
cRANDBETWEEN.prototype.Calculate = function ( arg ) { cRANDBETWEEN.prototype.Calculate = function ( arg ) {
function randBetween( a, b ) { function randBetween( a, b ) {
...@@ -2950,7 +2950,7 @@ cRANDBETWEEN.prototype.getInfo = function () { ...@@ -2950,7 +2950,7 @@ cRANDBETWEEN.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"( lower-bound , upper-bound )" args:"( lower-bound , upper-bound )"
}; };
} };
function cROMAN() { function cROMAN() {
// cBaseFunction.call( this, "ROMAN" ); // cBaseFunction.call( this, "ROMAN" );
...@@ -2971,7 +2971,7 @@ function cROMAN() { ...@@ -2971,7 +2971,7 @@ function cROMAN() {
} }
cROMAN.prototype = Object.create( cBaseFunction.prototype ) cROMAN.prototype = Object.create( cBaseFunction.prototype );
cROMAN.prototype.Calculate = function ( arg ) { cROMAN.prototype.Calculate = function ( arg ) {
function roman( num, mode ) { function roman( num, mode ) {
if ( (mode >= 0) && (mode < 5) && (num >= 0) && (num < 4000) ) { if ( (mode >= 0) && (mode < 5) && (num >= 0) && (num < 4000) ) {
...@@ -3069,13 +3069,13 @@ cROMAN.prototype.Calculate = function ( arg ) { ...@@ -3069,13 +3069,13 @@ cROMAN.prototype.Calculate = function ( arg ) {
return this.value = roman( arg0.getValue(), arg1.getValue() ); return this.value = roman( arg0.getValue(), arg1.getValue() );
} };
cROMAN.prototype.getInfo = function () { cROMAN.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( number, form )" args:"( number, form )"
}; };
} };
function cROUND() { function cROUND() {
// cBaseFunction.call( this, "ROUND" ); // cBaseFunction.call( this, "ROUND" );
...@@ -3096,7 +3096,7 @@ function cROUND() { ...@@ -3096,7 +3096,7 @@ function cROUND() {
} }
cROUND.prototype = Object.create( cBaseFunction.prototype ) cROUND.prototype = Object.create( cBaseFunction.prototype );
cROUND.prototype.Calculate = function ( arg ) { cROUND.prototype.Calculate = function ( arg ) {
function SignZeroPositive( number ) { function SignZeroPositive( number ) {
...@@ -3221,13 +3221,13 @@ cROUND.prototype.Calculate = function ( arg ) { ...@@ -3221,13 +3221,13 @@ cROUND.prototype.Calculate = function ( arg ) {
return this.value = roundHelper( number, num_digits ); return this.value = roundHelper( number, num_digits );
} };
cROUND.prototype.getInfo = function () { cROUND.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x , number-digits )" args:"( x , number-digits )"
}; };
} };
function cROUNDDOWN() { function cROUNDDOWN() {
// cBaseFunction.call( this, "ROUNDDOWN" ); // cBaseFunction.call( this, "ROUNDDOWN" );
...@@ -3248,7 +3248,7 @@ function cROUNDDOWN() { ...@@ -3248,7 +3248,7 @@ function cROUNDDOWN() {
} }
cROUNDDOWN.prototype = Object.create( cBaseFunction.prototype ) cROUNDDOWN.prototype = Object.create( cBaseFunction.prototype );
cROUNDDOWN.prototype.Calculate = function ( arg ) { cROUNDDOWN.prototype.Calculate = function ( arg ) {
function rounddownHelper( number, num_digits ) { function rounddownHelper( number, num_digits ) {
if ( num_digits > AscCommonExcel.cExcelMaxExponent ) { if ( num_digits > AscCommonExcel.cExcelMaxExponent ) {
...@@ -3346,13 +3346,13 @@ cROUNDDOWN.prototype.Calculate = function ( arg ) { ...@@ -3346,13 +3346,13 @@ cROUNDDOWN.prototype.Calculate = function ( arg ) {
var number = arg0.getValue(), num_digits = arg1.getValue(); var number = arg0.getValue(), num_digits = arg1.getValue();
return this.value = rounddownHelper( number, num_digits ); return this.value = rounddownHelper( number, num_digits );
} };
cROUNDDOWN.prototype.getInfo = function () { cROUNDDOWN.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x , number-digits )" args:"( x , number-digits )"
}; };
} };
function cROUNDUP() { function cROUNDUP() {
// cBaseFunction.call( this, "ROUNDUP" ); // cBaseFunction.call( this, "ROUNDUP" );
...@@ -3373,7 +3373,7 @@ function cROUNDUP() { ...@@ -3373,7 +3373,7 @@ function cROUNDUP() {
} }
cROUNDUP.prototype = Object.create( cBaseFunction.prototype ) cROUNDUP.prototype = Object.create( cBaseFunction.prototype );
cROUNDUP.prototype.Calculate = function ( arg ) { cROUNDUP.prototype.Calculate = function ( arg ) {
function roundupHelper( number, num_digits ) { function roundupHelper( number, num_digits ) {
if ( num_digits > AscCommonExcel.cExcelMaxExponent ) { if ( num_digits > AscCommonExcel.cExcelMaxExponent ) {
...@@ -3471,13 +3471,13 @@ cROUNDUP.prototype.Calculate = function ( arg ) { ...@@ -3471,13 +3471,13 @@ cROUNDUP.prototype.Calculate = function ( arg ) {
var number = arg0.getValue(), num_digits = arg1.getValue(); var number = arg0.getValue(), num_digits = arg1.getValue();
return this.value = roundupHelper( number, num_digits ); return this.value = roundupHelper( number, num_digits );
} };
cROUNDUP.prototype.getInfo = function () { cROUNDUP.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x , number-digits )" args:"( x , number-digits )"
}; };
} };
function cSERIESSUM() { function cSERIESSUM() {
// cBaseFunction.call( this, "SERIESSUM" ); // cBaseFunction.call( this, "SERIESSUM" );
...@@ -3498,7 +3498,7 @@ function cSERIESSUM() { ...@@ -3498,7 +3498,7 @@ function cSERIESSUM() {
} }
cSERIESSUM.prototype = Object.create( cBaseFunction.prototype ) cSERIESSUM.prototype = Object.create( cBaseFunction.prototype );
cSERIESSUM.prototype.Calculate = function ( arg ) { cSERIESSUM.prototype.Calculate = function ( arg ) {
function SERIESSUM( x, n, m, a ) { function SERIESSUM( x, n, m, a ) {
...@@ -3554,13 +3554,13 @@ cSERIESSUM.prototype.Calculate = function ( arg ) { ...@@ -3554,13 +3554,13 @@ cSERIESSUM.prototype.Calculate = function ( arg ) {
return this.value = SERIESSUM( arg0, arg1, arg2, arg3 ); return this.value = SERIESSUM( arg0, arg1, arg2, arg3 );
} };
cSERIESSUM.prototype.getInfo = function () { cSERIESSUM.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( input-value , initial-power , step , coefficients )" args:"( input-value , initial-power , step , coefficients )"
}; };
} };
function cSIGN() { function cSIGN() {
// cBaseFunction.call( this, "SIGN" ); // cBaseFunction.call( this, "SIGN" );
...@@ -3581,7 +3581,7 @@ function cSIGN() { ...@@ -3581,7 +3581,7 @@ function cSIGN() {
} }
cSIGN.prototype = Object.create( cBaseFunction.prototype ) cSIGN.prototype = Object.create( cBaseFunction.prototype );
cSIGN.prototype.Calculate = function ( arg ) { cSIGN.prototype.Calculate = function ( arg ) {
function signHelper( arg ) { function signHelper( arg ) {
...@@ -3624,7 +3624,7 @@ cSIGN.prototype.getInfo = function () { ...@@ -3624,7 +3624,7 @@ cSIGN.prototype.getInfo = function () {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cSIN() { function cSIN() {
// cBaseFunction.call( this, "SIN" ); // cBaseFunction.call( this, "SIN" );
...@@ -3645,7 +3645,7 @@ function cSIN() { ...@@ -3645,7 +3645,7 @@ function cSIN() {
} }
cSIN.prototype = Object.create( cBaseFunction.prototype ) cSIN.prototype = Object.create( cBaseFunction.prototype );
cSIN.prototype.Calculate = function ( arg ) { cSIN.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -3670,13 +3670,13 @@ cSIN.prototype.Calculate = function ( arg ) { ...@@ -3670,13 +3670,13 @@ cSIN.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cSIN.prototype.getInfo = function () { cSIN.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cSINH() { function cSINH() {
// cBaseFunction.call( this, "SINH" ); // cBaseFunction.call( this, "SINH" );
...@@ -3697,7 +3697,7 @@ function cSINH() { ...@@ -3697,7 +3697,7 @@ function cSINH() {
} }
cSINH.prototype = Object.create( cBaseFunction.prototype ) cSINH.prototype = Object.create( cBaseFunction.prototype );
cSINH.prototype.Calculate = function ( arg ) { cSINH.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -3722,13 +3722,13 @@ cSINH.prototype.Calculate = function ( arg ) { ...@@ -3722,13 +3722,13 @@ cSINH.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cSINH.prototype.getInfo = function () { cSINH.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cSQRT() { function cSQRT() {
// cBaseFunction.call( this, "SQRT" ); // cBaseFunction.call( this, "SQRT" );
...@@ -3749,7 +3749,7 @@ function cSQRT() { ...@@ -3749,7 +3749,7 @@ function cSQRT() {
} }
cSQRT.prototype = Object.create( cBaseFunction.prototype ) cSQRT.prototype = Object.create( cBaseFunction.prototype );
cSQRT.prototype.Calculate = function ( arg ) { cSQRT.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -3774,13 +3774,13 @@ cSQRT.prototype.Calculate = function ( arg ) { ...@@ -3774,13 +3774,13 @@ cSQRT.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cSQRT.prototype.getInfo = function () { cSQRT.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
function cSQRTPI() { function cSQRTPI() {
// cBaseFunction.call( this, "SQRTPI" ); // cBaseFunction.call( this, "SQRTPI" );
...@@ -3801,7 +3801,7 @@ function cSQRTPI() { ...@@ -3801,7 +3801,7 @@ function cSQRTPI() {
} }
cSQRTPI.prototype = Object.create( cBaseFunction.prototype ) cSQRTPI.prototype = Object.create( cBaseFunction.prototype );
cSQRTPI.prototype.Calculate = function ( arg ) { cSQRTPI.prototype.Calculate = function ( arg ) {
var arg0 = arg[0]; var arg0 = arg[0];
if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) { if ( arg0 instanceof cArea || arg0 instanceof cArea3D ) {
...@@ -3826,14 +3826,15 @@ cSQRTPI.prototype.Calculate = function ( arg ) { ...@@ -3826,14 +3826,15 @@ cSQRTPI.prototype.Calculate = function ( arg ) {
return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a ); return this.value = isNaN( a ) ? new cError( cErrorType.not_numeric ) : new cNumber( a );
} }
return this.value = arg0; return this.value = arg0;
} };
cSQRTPI.prototype.getInfo = function () { cSQRTPI.prototype.getInfo = function () {
return { return {
name:this.name, name:this.name,
args:"( x )" args:"( x )"
}; };
} };
/** @constructor */
function cSUBTOTAL() { function cSUBTOTAL() {
cBaseFunction.call(this, "SUBTOTAL"); cBaseFunction.call(this, "SUBTOTAL");
this.setArgumentsMin(1); this.setArgumentsMin(1);
...@@ -3913,6 +3914,7 @@ cSQRTPI.prototype.getInfo = function () { ...@@ -3913,6 +3914,7 @@ cSQRTPI.prototype.getInfo = function () {
}; };
}; };
/** @constructor */
function cSUM() { function cSUM() {
this.name = "SUM"; this.name = "SUM";
this.type = cElementType.func; this.type = cElementType.func;
...@@ -3971,6 +3973,7 @@ cSQRTPI.prototype.getInfo = function () { ...@@ -3971,6 +3973,7 @@ cSQRTPI.prototype.getInfo = function () {
}; };
}; };
/** @constructor */
function cSUMIF() { function cSUMIF() {
this.name = "SUMIF"; this.name = "SUMIF";
this.type = cElementType.func; this.type = cElementType.func;
...@@ -4013,7 +4016,7 @@ cSQRTPI.prototype.getInfo = function () { ...@@ -4013,7 +4016,7 @@ cSQRTPI.prototype.getInfo = function () {
} }
if (cElementType.cellsRange === arg1.type || cElementType.cellsRange3D === arg1.type) { if (cElementType.cellsRange === arg1.type || cElementType.cellsRange3D === arg1.type) {
arg1 = arg1.cross(arguments[1].first); arg1 = arg1.cross(arg1.first);
} else if (arg1 instanceof cArray) { } else if (arg1 instanceof cArray) {
arg1 = arg1.getElementRowCol(0, 0); arg1 = arg1.getElementRowCol(0, 0);
} }
...@@ -4025,7 +4028,7 @@ cSQRTPI.prototype.getInfo = function () { ...@@ -4025,7 +4028,7 @@ cSQRTPI.prototype.getInfo = function () {
} }
arg1 = arg1.toString(); arg1 = arg1.toString();
var match = arg1.match(this.operatorRE), search, oper, val; var match = arg1.match(this.operatorRE), search, oper;
if (match) { if (match) {
search = arg1.substr(match[0].length); search = arg1.substr(match[0].length);
oper = match[0].replace(this.spaceRE, ""); oper = match[0].replace(this.spaceRE, "");
...@@ -4034,28 +4037,17 @@ cSQRTPI.prototype.getInfo = function () { ...@@ -4034,28 +4037,17 @@ cSQRTPI.prototype.getInfo = function () {
} }
valueForSearching = AscCommonExcel.parseNum(search) ? new cNumber(search) : new cString(search); valueForSearching = AscCommonExcel.parseNum(search) ? new cNumber(search) : new cString(search);
if (cElementType.cellsRange === arg0.type) { if (cElementType.cellsRange === arg0.type) {
var arg0Matrix = arg0.getMatrix(), arg2Matrix = arg2.getMatrix(), valMatrix0, valMatrix2; var arg0Matrix = arg0.getMatrix(), arg2Matrix = arg2.getMatrix(), valMatrix2;
for (var i = 0; i < arg0Matrix.length; i++) { for (var i = 0; i < arg0Matrix.length; i++) {
for (var j = 0; j < arg0Matrix[i].length; j++) { for (var j = 0; j < arg0Matrix[i].length; j++) {
valMatrix0 = arg0Matrix[i][j]; if (arg2Matrix[i] && (valMatrix2 = arg2Matrix[i][j]) && cElementType.number === valMatrix2.type &&
valMatrix2 = arg2Matrix[i] ? (arg2Matrix[i][j] ? arg2Matrix[i][j] : new cEmpty()) : new cEmpty(); AscCommonExcel.matching(arg0Matrix[i][j], valueForSearching, oper)) {
if (AscCommonExcel.matching(valMatrix0, valueForSearching, oper)) { _sum += valMatrix2.getValue();
if (cElementType.number === valMatrix2.type) {
_sum += valMatrix2.getValue();
}
} }
} }
} }
} else { } else {
val = arg0.getValue(); return this.value = new cError(cErrorType.wrong_value_type);
if (AscCommonExcel.matching(val, valueForSearching, oper)) {
var r = arg0.getRange(), ws = arg0.getWS(), r1 = r.first.getRow0() + 0, c1 = arg2.getRange().first
.getCol0();
r = new cRef(ws.getRange3(r1, c1, r1, c1).getName(), ws);
if (cElementType.number === r.getValue().type) {
_sum += r.getValue().getValue();
}
}
} }
return this.value = new cNumber(_sum); return this.value = new cNumber(_sum);
...@@ -4066,11 +4058,107 @@ cSQRTPI.prototype.getInfo = function () { ...@@ -4066,11 +4058,107 @@ cSQRTPI.prototype.getInfo = function () {
}; };
}; };
/** @constructor */
function cSUMIFS() { function cSUMIFS() {
cBaseFunction.call(this, "SUMIFS"); this.name = "SUMIFS";
this.type = cElementType.func;
this.value = null;
this.argumentsMin = 3;
this.argumentsCurrent = 0;
this.argumentsMax = 255;
this.formatType = {
def: -1, //подразумевается формат первой ячейки входящей в формулу.
noneFormat: -2
};
this.numFormat = this.formatType.def;
this.operatorRE = new RegExp("^ *[<=> ]+ *");
this.spaceRE = /\s/g;
} }
cSUMIFS.prototype = Object.create(cBaseFunction.prototype); cSUMIFS.prototype = Object.create(cBaseFunction.prototype);
cSUMIFS.prototype.Calculate = function (arg) {
var arg0 = arg[0];
if (cElementType.cell !== arg0.type && cElementType.cell3D !== arg0.type && cElementType.cellsRange !== arg0.type) {
if (cElementType.cellsRange3D === arg0.type) {
arg0 = arg0.tocArea();
if (!arg0) {
return this.value = new cError(cErrorType.wrong_value_type);
}
} else {
return this.value = new cError(cErrorType.wrong_value_type);
}
}
var _sum = 0;
var arg0Matrix = arg0.getMatrix();
var i, j, arg1, arg2, valueForSearching, match, search, oper = null;
for (var k = 1; k < arg.length; k += 2) {
arg1 = arg[k];
arg2 = arg[k + 1];
if (cElementType.cell !== arg1.type && cElementType.cell3D !== arg1.type && cElementType.cellsRange !== arg1.type) {
if (cElementType.cellsRange3D === arg1.type) {
arg1 = arg1.tocArea();
if (!arg1) {
return this.value = new cError(cErrorType.wrong_value_type);
}
} else {
return this.value = new cError(cErrorType.wrong_value_type);
}
}
if (cElementType.cellsRange === arg2.type || cElementType.cellsRange3D === arg2.type) {
arg2 = arg2.cross(arg2.first);
} else if (cElementType.array === arg2.type) {
arg2 = arg2.getElementRowCol(0, 0);
}
arg2 = arg2.tocString();
if (cElementType.string !== arg2.type) {
return this.value = new cError(cErrorType.wrong_value_type);
}
arg2 = arg2.toString();
match = arg2.match(this.operatorRE);
if (match) {
search = arg2.substr(match[0].length);
oper = match[0].replace(this.spaceRE, "");
} else {
search = arg2;
oper = null;
}
valueForSearching = AscCommonExcel.parseNum(search) ? new cNumber(search) : new cString(search);
if (cElementType.cellsRange === arg1.type) {
var arg1Matrix = arg1.getMatrix();
for (i = 0; i < arg1Matrix.length; i++) {
for (j = 0; j < arg1Matrix[i].length; j++) {
if (arg0Matrix[i][j] && !AscCommonExcel.matching(arg1Matrix[i][j], valueForSearching, oper)) {
arg0Matrix[i][j] = null;
}
}
}
} else {
return this.value = new cError(cErrorType.wrong_value_type);
}
}
var valMatrix0;
for (i = 0; i < arg0Matrix.length; i++) {
for (j = 0; j < arg0Matrix[i].length; j++) {
if ((valMatrix0 = arg0Matrix[i][j]) && cElementType.number === valMatrix0.type) {
_sum += valMatrix0.getValue();
}
}
}
return this.value = new cNumber(_sum);
};
cSUMIFS.prototype.getInfo = function () {
return {
name: this.name, args: "(sum-range, criteria_range1, criteria1, [criteria_range2, criteria2], ...)"
};
};
function cSUMPRODUCT() { function cSUMPRODUCT() {
// cBaseFunction.call( this, "SUMPRODUCT" ); // cBaseFunction.call( this, "SUMPRODUCT" );
......
...@@ -1072,7 +1072,7 @@ cArea.prototype.foreach = function ( action ) { ...@@ -1072,7 +1072,7 @@ cArea.prototype.foreach = function ( action ) {
} }
}; };
cArea.prototype.getMatrix = function () { cArea.prototype.getMatrix = function () {
var t = this, arr = [], r = this.getRange(); var arr = [], r = this.getRange();
r._foreach2(function (cell, i, j, r1, c1) { r._foreach2(function (cell, i, j, r1, c1) {
if (!arr[i - r1]) { if (!arr[i - r1]) {
arr[i - r1] = []; arr[i - r1] = [];
...@@ -1082,7 +1082,7 @@ cArea.prototype.foreach = function ( action ) { ...@@ -1082,7 +1082,7 @@ cArea.prototype.foreach = function ( action ) {
return arr; return arr;
}; };
cArea.prototype.getValuesNoEmpty = function () { cArea.prototype.getValuesNoEmpty = function () {
var t = this, arr = [], r = this.getRange(); var arr = [], r = this.getRange();
r._foreachNoEmpty(function (cell) { r._foreachNoEmpty(function (cell) {
arr.push(checkTypeCell(cell)); arr.push(checkTypeCell(cell));
}); });
...@@ -2943,28 +2943,28 @@ var cFormulaOperators = { ...@@ -2943,28 +2943,28 @@ var cFormulaOperators = {
В методе Calculate необходимо отслеживать тип принимаемых аргументов. Для примера, если мы обращаемся к ячейке A1, в которой лежит 123, то этот аргумент будет числом. Если же там лежит "123", то это уже строка. Для более подробной информации смотреть спецификацию. В методе Calculate необходимо отслеживать тип принимаемых аргументов. Для примера, если мы обращаемся к ячейке A1, в которой лежит 123, то этот аргумент будет числом. Если же там лежит "123", то это уже строка. Для более подробной информации смотреть спецификацию.
Метод getInfo является обязательным, ибо через этот метод в интерфейс передается информация о реализованных функциях. Метод getInfo является обязательным, ибо через этот метод в интерфейс передается информация о реализованных функциях.
*/ */
var cFormulaFunctionGroup = {}; var cFormulaFunctionGroup = {};
var cFormulaFunction = {}; var cFormulaFunction = {};
var cAllFormulaFunction = {}; var cAllFormulaFunction = {};
function getFormulasInfo() { function getFormulasInfo() {
var list = [], a, b, f; var list = [], a, b, f;
for ( var type in cFormulaFunctionGroup ) { for (var type in cFormulaFunctionGroup) {
b = new AscCommon.asc_CFormulaGroup(type); b = new AscCommon.asc_CFormulaGroup(type);
for ( var i = 0; i < cFormulaFunctionGroup[type].length; ++i ) { for (var i = 0; i < cFormulaFunctionGroup[type].length; ++i) {
a = new cFormulaFunctionGroup[type][i](); a = new cFormulaFunctionGroup[type][i]();
if ( a.getInfo ) { if (a.getInfo) {
f = new AscCommon.asc_CFormula(a.getInfo()); f = new AscCommon.asc_CFormula(a.getInfo());
b.asc_addFormulaElement( f ); b.asc_addFormulaElement(f);
cFormulaFunction[f.asc_getName()] = cFormulaFunctionGroup[type][i]; cFormulaFunction[f.asc_getName()] = cFormulaFunctionGroup[type][i];
} }
cAllFormulaFunction[a.name] = cFormulaFunctionGroup[type][i]; cAllFormulaFunction[a.name] = cFormulaFunctionGroup[type][i];
} }
list.push( b ); list.push(b);
} }
return list; return list;
} }
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
......
...@@ -630,11 +630,10 @@ ...@@ -630,11 +630,10 @@
/** @enum */ /** @enum */
var c_oSer_Pane = { var c_oSer_Pane = {
ActivePane : 0, ActivePane : 0,
//State : 1, State : 1,
TopLeftCell : 2, TopLeftCell : 2,
XSplit : 3, XSplit : 3,
YSplit : 4, YSplit : 4
State : 5
}; };
/** @enum */ /** @enum */
var c_oSer_Selection = { var c_oSer_Selection = {
...@@ -2653,7 +2652,7 @@ ...@@ -2653,7 +2652,7 @@
var oThis = this; var oThis = this;
//this.bs.WriteItem(c_oSer_Pane.ActivePane, function(){oThis.memory.WriteByte();}); //this.bs.WriteItem(c_oSer_Pane.ActivePane, function(){oThis.memory.WriteByte();});
// Всегда пишем Frozen // Всегда пишем Frozen
this.bs.WriteItem(c_oSer_Pane.State, function(){oThis.memory.WriteByte(AscCommonExcel.c_oAscPaneState.Frozen);}); this.bs.WriteItem(c_oSer_Pane.State, function(){oThis.memory.WriteString3(AscCommonExcel.c_oAscPaneState.Frozen);});
this.bs.WriteItem(c_oSer_Pane.TopLeftCell, function(){oThis.memory.WriteString3(oPane.topLeftFrozenCell.getID());}); this.bs.WriteItem(c_oSer_Pane.TopLeftCell, function(){oThis.memory.WriteString3(oPane.topLeftFrozenCell.getID());});
var col = oPane.topLeftFrozenCell.getCol0(); var col = oPane.topLeftFrozenCell.getCol0();
...@@ -6589,7 +6588,7 @@ ...@@ -6589,7 +6588,7 @@
if (c_oSer_Pane.ActivePane === type) if (c_oSer_Pane.ActivePane === type)
this.stream.GetUChar(); this.stream.GetUChar();
else if (c_oSer_Pane.State === type) else if (c_oSer_Pane.State === type)
oPane.state = this.stream.GetUChar(); oPane.state = this.stream.GetString2LE(length);
else if (c_oSer_Pane.TopLeftCell === type) else if (c_oSer_Pane.TopLeftCell === type)
oPane.topLeftCell = this.stream.GetString2LE(length); oPane.topLeftCell = this.stream.GetString2LE(length);
else if (c_oSer_Pane.XSplit === type) else if (c_oSer_Pane.XSplit === type)
......
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