Commit a10f0edb 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:
  Implemented removing an content control function in Api. Implemented a lock of block level content control class for collaborative editing.
  delete functions from _xlfn
  extend clone functions
  add tests for EXPON.DIST
  add EXPON.DIST function
  add GAUSS function
parents fd3eb2a9 a74c3acd
......@@ -1106,6 +1106,19 @@ $( function () {
strictEqual( oParser.calculate().getValue().toFixed(6) - 0, 0.068094, "GAMMADIST(A2,A3,A4,TRUE)" );
} );
test( "Test: \"EXPON.DIST\"", function () {
ws.getRange2( "A2" ).setValue( "0.2" );
ws.getRange2( "A3" ).setValue( "10" );
oParser = new parserFormula( "EXPON.DIST(A2,A3,TRUE)", "A1", ws );
ok( oParser.parse(), "EXPON.DIST(A2,A3,TRUE)" );
strictEqual( oParser.calculate().getValue().toFixed(8) - 0, 0.86466472, "EXPON.DIST(A2,A3,TRUE)" );
oParser = new parserFormula( "EXPON.DIST(0.2,10,FALSE)", "A1", ws );
ok( oParser.parse(), "EXPON.DIST(0.2,10,FALSE)" );
strictEqual( oParser.calculate().getValue().toFixed(8) - 0, 1.35335283, "EXPON.DIST(0.2,10,FALSE)" );
} );
test( "Test: \"CHIDIST\"", function () {
ws.getRange2( "A2" ).setValue( "18.307" );
ws.getRange2( "A3" ).setValue( "10" );
......@@ -1115,6 +1128,12 @@ $( function () {
strictEqual( oParser.calculate().getValue().toFixed(7) - 0, 0.0500006, "CHIDIST(A2,A3)" );
} );
test( "Test: \"GAUSS\"", function () {
oParser = new parserFormula( "GAUSS(2)", "A1", ws );
ok( oParser.parse(), "GAUSS(2)" );
strictEqual( oParser.calculate().getValue().toFixed(5) - 0, 0.47725, "GAUSS(2)" );
} );
test( "Test: \"CHISQ.DIST.RT\"", function () {
ws.getRange2( "A2" ).setValue( "18.307" );
ws.getRange2( "A3" ).setValue( "10" );
......
......@@ -54,16 +54,16 @@
cFormulaFunctionGroup['Engineering'].push(cBITAND, cBITLSHIFT, cBITOR, cBITRSHIFT, cBITXOR, cERF_PRECISE,
cERFC_PRECISE);
cFormulaFunctionGroup['TextAndData'] = cFormulaFunctionGroup['TextAndData'] || [];
cFormulaFunctionGroup['TextAndData'].push(cDBCS, cNUMBERVALUE, cUNICHAR, cUNICODE);
cFormulaFunctionGroup['TextAndData'].push(cDBCS, cUNICHAR, cUNICODE);
cFormulaFunctionGroup['Statistical'] = cFormulaFunctionGroup['Statistical'] || [];
cFormulaFunctionGroup['Statistical'].push(cBETA_DIST, cBETA_INV, cBINOM_DIST, cBINOM_DIST_RANGE, cBINOM_INV,
cCHISQ_DIST, cCHISQ_DIST_RT, cCHISQ_INV, cCHISQ_INV_RT, cCHISQ_TEST, cCONFIDENCE_NORM, cCONFIDENCE_T,
cCOVARIANCE_P, cCOVARIANCE_S, cEXPON_DIST, cF_DIST, cF_DIST_RT, cF_INV, cF_INV_RT, cF_TEST, cFORECAST_ETS,
cFORECAST_ETS_CONFINT, cFORECAST_ETS_SEASONALITY, cFORECAST_ETS_STAT, cFORECAST_LINEAR, cGAMMA, cGAMMA_DIST,
cGAMMA_INV, cGAMMALN_PRECISE, cGAUSS, cHYPGEOM_DIST, cLOGNORM_DIST, cLOGNORM_INV, cMODE_MULT, cMODE_SNGL,
cFormulaFunctionGroup['Statistical'].push(cBINOM_DIST, cBINOM_DIST_RANGE, cBINOM_INV,
cCHISQ_TEST, cCONFIDENCE_NORM, cCONFIDENCE_T,
cCOVARIANCE_P, cCOVARIANCE_S, cF_TEST, cFORECAST_ETS,
cFORECAST_ETS_CONFINT, cFORECAST_ETS_SEASONALITY, cFORECAST_ETS_STAT, cFORECAST_LINEAR,
cHYPGEOM_DIST, cMODE_MULT, cMODE_SNGL,
cNEGBINOM_DIST, cNORM_DIST, cNORM_INV, cNORM_S_DIST, cNORM_S_INV, cPERCENTILE_EXC, cPERCENTILE_INC,
cPERCENTRANK_EXC, cPERCENTRANK_INC, cPERMUTATIONA, cPHI, cPOISSON_DIST, cQUARTILE_EXC, cQUARTILE_INC, cRANK_AVG,
cRANK_EQ, cSKEW_P, cSTDEV_P, cSTDEV_S, cT_DIST, cT_DIST_2T, cT_DIST_RT, cT_INV, cT_INV_2T, cT_TEST, cVAR_P,
cRANK_EQ, cSKEW_P, cSTDEV_P, cSTDEV_S, cT_TEST, cVAR_P,
cVAR_S, cWEIBULL_DIST, cZ_TEST);
cFormulaFunctionGroup['Financial'] = cFormulaFunctionGroup['Financial'] || [];
cFormulaFunctionGroup['Financial'].push(cPDURATION, cRRI);
......@@ -86,30 +86,6 @@
cAGGREGATE.prototype = Object.create(cBaseFunction.prototype);
cAGGREGATE.prototype.constructor = cAGGREGATE;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cBETA_DIST() {
cBaseFunction.call(this, "BETA.DIST");
this.isXLFN = true;
}
cBETA_DIST.prototype = Object.create(cBaseFunction.prototype);
cBETA_DIST.prototype.constructor = cBETA_DIST;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cBETA_INV() {
cBaseFunction.call(this, "BETA.INV");
this.isXLFN = true;
}
cBETA_INV.prototype = Object.create(cBaseFunction.prototype);
cBETA_INV.prototype.constructor = cBETA_INV;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -206,54 +182,6 @@
cBITXOR.prototype = Object.create(cBaseFunction.prototype);
cBITXOR.prototype.constructor = cBITXOR;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCHISQ_DIST() {
cBaseFunction.call(this, "CHISQ.DIST");
this.isXLFN = true;
}
cCHISQ_DIST.prototype = Object.create(cBaseFunction.prototype);
cCHISQ_DIST.prototype.constructor = cCHISQ_DIST;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCHISQ_DIST_RT() {
cBaseFunction.call(this, "CHISQ.DIST.RT");
this.isXLFN = true;
}
cCHISQ_DIST_RT.prototype = Object.create(cBaseFunction.prototype);
cCHISQ_DIST_RT.prototype.constructor = cCHISQ_DIST_RT;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCHISQ_INV() {
cBaseFunction.call(this, "CHISQ.INV");
this.isXLFN = true;
}
cCHISQ_INV.prototype = Object.create(cBaseFunction.prototype);
cCHISQ_INV.prototype.constructor = cCHISQ_INV;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cCHISQ_INV_RT() {
cBaseFunction.call(this, "CHISQ.INV.RT");
this.isXLFN = true;
}
cCHISQ_INV_RT.prototype = Object.create(cBaseFunction.prototype);
cCHISQ_INV_RT.prototype.constructor = cCHISQ_INV_RT;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -374,66 +302,6 @@
cERFC_PRECISE.prototype = Object.create(cBaseFunction.prototype);
cERFC_PRECISE.prototype.constructor = cERFC_PRECISE;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cEXPON_DIST() {
cBaseFunction.call(this, "EXPON.DIST");
this.isXLFN = true;
}
cEXPON_DIST.prototype = Object.create(cBaseFunction.prototype);
cEXPON_DIST.prototype.constructor = cEXPON_DIST;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cF_DIST() {
cBaseFunction.call(this, "F.DIST");
this.isXLFN = true;
}
cF_DIST.prototype = Object.create(cBaseFunction.prototype);
cF_DIST.prototype.constructor = cF_DIST;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cF_DIST_RT() {
cBaseFunction.call(this, "F.DIST.RT");
this.isXLFN = true;
}
cF_DIST_RT.prototype = Object.create(cBaseFunction.prototype);
cF_DIST_RT.prototype.constructor = cF_DIST_RT;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cF_INV() {
cBaseFunction.call(this, "F.INV");
this.isXLFN = true;
}
cF_INV.prototype = Object.create(cBaseFunction.prototype);
cF_INV.prototype.constructor = cF_INV;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cF_INV_RT() {
cBaseFunction.call(this, "F.INV.RT");
this.isXLFN = true;
}
cF_INV_RT.prototype = Object.create(cBaseFunction.prototype);
cF_INV_RT.prototype.constructor = cF_INV_RT;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -530,66 +398,6 @@
cFORMULATEXT.prototype = Object.create(cBaseFunction.prototype);
cFORMULATEXT.prototype.constructor = cFORMULATEXT;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cGAMMA() {
cBaseFunction.call(this, "GAMMA");
this.isXLFN = true;
}
cGAMMA.prototype = Object.create(cBaseFunction.prototype);
cGAMMA.prototype.constructor = cGAMMA;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cGAMMA_DIST() {
cBaseFunction.call(this, "GAMMA.DIST");
this.isXLFN = true;
}
cGAMMA_DIST.prototype = Object.create(cBaseFunction.prototype);
cGAMMA_DIST.prototype.constructor = cGAMMA_DIST;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cGAMMA_INV() {
cBaseFunction.call(this, "GAMMA.INV");
this.isXLFN = true;
}
cGAMMA_INV.prototype = Object.create(cBaseFunction.prototype);
cGAMMA_INV.prototype.constructor = cGAMMA_INV;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cGAMMALN_PRECISE() {
cBaseFunction.call(this, "GAMMALN.PRECISE");
this.isXLFN = true;
}
cGAMMALN_PRECISE.prototype = Object.create(cBaseFunction.prototype);
cGAMMALN_PRECISE.prototype.constructor = cGAMMALN_PRECISE;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cGAUSS() {
cBaseFunction.call(this, "GAUSS");
this.isXLFN = true;
}
cGAUSS.prototype = Object.create(cBaseFunction.prototype);
cGAUSS.prototype.constructor = cGAUSS;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -626,30 +434,6 @@
cISOWEEKNUM.prototype = Object.create(cBaseFunction.prototype);
cISOWEEKNUM.prototype.constructor = cISOWEEKNUM;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cLOGNORM_DIST() {
cBaseFunction.call(this, "LOGNORM.DIST");
this.isXLFN = true;
}
cLOGNORM_DIST.prototype = Object.create(cBaseFunction.prototype);
cLOGNORM_DIST.prototype.constructor = cLOGNORM_DIST;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cLOGNORM_INV() {
cBaseFunction.call(this, "LOGNORM.INV");
this.isXLFN = true;
}
cLOGNORM_INV.prototype = Object.create(cBaseFunction.prototype);
cLOGNORM_INV.prototype.constructor = cLOGNORM_INV;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -746,18 +530,6 @@
cNORM_S_INV.prototype = Object.create(cBaseFunction.prototype);
cNORM_S_INV.prototype.constructor = cNORM_S_INV;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cNUMBERVALUE() {
cBaseFunction.call(this, "NUMBERVALUE");
this.isXLFN = true;
}
cNUMBERVALUE.prototype = Object.create(cBaseFunction.prototype);
cNUMBERVALUE.prototype.constructor = cNUMBERVALUE;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -986,66 +758,6 @@
cSTDEV_S.prototype = Object.create(cBaseFunction.prototype);
cSTDEV_S.prototype.constructor = cSTDEV_S;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cT_DIST() {
cBaseFunction.call(this, "T.DIST");
this.isXLFN = true;
}
cT_DIST.prototype = Object.create(cBaseFunction.prototype);
cT_DIST.prototype.constructor = cT_DIST;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cT_DIST_2T() {
cBaseFunction.call(this, "T.DIST.2T");
this.isXLFN = true;
}
cT_DIST_2T.prototype = Object.create(cBaseFunction.prototype);
cT_DIST_2T.prototype.constructor = cT_DIST_2T;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cT_DIST_RT() {
cBaseFunction.call(this, "T.DIST.RT");
this.isXLFN = true;
}
cT_DIST_RT.prototype = Object.create(cBaseFunction.prototype);
cT_DIST_RT.prototype.constructor = cT_DIST_RT;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cT_INV() {
cBaseFunction.call(this, "T.INV");
this.isXLFN = true;
}
cT_INV.prototype = Object.create(cBaseFunction.prototype);
cT_INV.prototype.constructor = cT_INV;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cT_INV_2T() {
cBaseFunction.call(this, "T.INV.2T");
this.isXLFN = true;
}
cT_INV_2T.prototype = Object.create(cBaseFunction.prototype);
cT_INV_2T.prototype.constructor = cT_INV_2T;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......
......@@ -62,8 +62,8 @@
cFormulaFunctionGroup['Statistical'] = cFormulaFunctionGroup['Statistical'] || [];
cFormulaFunctionGroup['Statistical'].push(cAVEDEV, cAVERAGE, cAVERAGEA, cAVERAGEIF, cAVERAGEIFS, cBETADIST, cBETA_DIST,
cBETA_INV, cBINOMDIST, cCHIDIST, cCHIINV, cCHISQ_DIST, cCHISQ_DIST_RT, cCHISQ_INV, cCHISQ_INV_RT, cCHITEST, cCONFIDENCE, cCORREL, cCOUNT, cCOUNTA, cCOUNTBLANK, cCOUNTIF,
cCOUNTIFS, cCOVAR, cCRITBINOM, cDEVSQ, cEXPONDIST, cFDIST, cF_DIST, cF_DIST_RT, cF_INV, cF_INV_RT, cFINV, cFISHER, cFISHERINV, cFORECAST, cFREQUENCY,
cFTEST, cGAMMA, cGAMMADIST, cGAMMAINV, cGAMMA_DIST, cGAMMA_INV, cGAMMALN, cGAMMALN_PRECISE, cGEOMEAN, cGROWTH, cHARMEAN, cHYPGEOMDIST, cINTERCEPT, cKURT, cLARGE,
cCOUNTIFS, cCOVAR, cCRITBINOM, cDEVSQ, cEXPON_DIST, cEXPONDIST, cFDIST, cF_DIST, cF_DIST_RT, cF_INV, cFINV, cF_INV_RT, cFISHER, cFISHERINV, cFORECAST, cFREQUENCY,
cFTEST, cGAMMA, cGAMMA_DIST, cGAMMADIST, cGAMMA_INV, cGAMMAINV, cGAMMALN, cGAMMALN_PRECISE, cGAUSS, cGEOMEAN, cGROWTH, cHARMEAN, cHYPGEOMDIST, cINTERCEPT, cKURT, cLARGE,
cLINEST, cLOGEST, cLOGINV, cLOGNORM_DIST, cLOGNORM_INV, cLOGNORMDIST, cMAX, cMAXA, cMEDIAN, cMIN, cMINA, cMODE, cNEGBINOMDIST, cNORMDIST,
cNORMINV, cNORMSDIST, cNORMSINV, cPEARSON, cPERCENTILE, cPERCENTRANK, cPERMUT, cPOISSON, cPROB, cQUARTILE,
cRANK, cRSQ, cSKEW, cSLOPE, cSMALL, cSTANDARDIZE, cSTDEV, cSTDEVA, cSTDEVP, cSTDEVPA, cSTEYX, cTDIST, cT_DIST,
......@@ -1421,6 +1421,7 @@
cBETA_DIST.prototype.constructor = cBETA_DIST;
cBETA_DIST.prototype.argumentsMin = 4;
cBETA_DIST.prototype.argumentsMax = 6;
cBETA_DIST.prototype.isXLFN = true;
cBETA_DIST.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -1485,6 +1486,7 @@
cBETA_INV.prototype.constructor = cBETA_INV;
cBETA_INV.prototype.argumentsMin = 3;
cBETA_INV.prototype.argumentsMax = 5;
cBETA_INV.prototype.isXLFN = true;
cBETA_INV.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -1725,6 +1727,7 @@
cCHISQ_DIST.prototype.constructor = cCHISQ_DIST;
cCHISQ_DIST.prototype.argumentsMin = 3;
cCHISQ_DIST.prototype.argumentsMax = 3;
cCHISQ_DIST.prototype.isXLFN = true;
cCHISQ_DIST.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -1771,48 +1774,16 @@
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
* @extends {cCHIDIST}
*/
//clone cCHIDIST function
function cCHISQ_DIST_RT() {
cBaseFunction.call(this, "CHISQ.DIST.RT");
cCHIDIST.call(this);
this.name = "CHISQ.DIST.RT";
}
cCHISQ_DIST_RT.prototype = Object.create(cBaseFunction.prototype);
cCHISQ_DIST_RT.prototype = Object.create(cCHIDIST.prototype);
cCHISQ_DIST_RT.prototype.constructor = cCHISQ_DIST_RT;
cCHISQ_DIST_RT.prototype.argumentsMin = 2;
cCHISQ_DIST_RT.prototype.argumentsMax = 2;
cCHISQ_DIST_RT.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
argClone[0] = argClone[0].tocNumber();
argClone[1] = argClone[1].tocNumber();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var calcTDist = function(argArray){
var fChi = argArray[0];
var fDF = parseInt(argArray[1]);
if ( fDF < 1 || fChi < 0 || fDF > Math.pow(10, 10)){
return new cError(cErrorType.not_numeric);
}
var res = getChiDist( fChi, fDF);
return null !== res && !isNaN(res) ? new cNumber(res) : new cError(cErrorType.wrong_value_type);
};
return this.value = this._findArrayInNumberArguments(oArguments, calcTDist);
};
cCHISQ_DIST_RT.prototype.getInfo = function () {
return {
name: this.name, args: "(x, deg_freedom)"
};
};
cCHISQ_DIST_RT.prototype.isXLFN = true;
/**
* @constructor
......@@ -1826,6 +1797,7 @@
cCHISQ_INV.prototype.constructor = cCHISQ_INV;
cCHISQ_INV.prototype.argumentsMin = 2;
cCHISQ_INV.prototype.argumentsMax = 2;
cCHISQ_INV.prototype.isXLFN = true;
cCHISQ_INV.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -1878,6 +1850,7 @@
cCHISQ_INV_RT.prototype.constructor = cCHISQ_INV_RT;
cCHISQ_INV_RT.prototype.argumentsMin = 2;
cCHISQ_INV_RT.prototype.argumentsMax = 2;
cCHISQ_INV_RT.prototype.isXLFN = true;
cCHISQ_INV_RT.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -2598,6 +2571,60 @@
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cEXPON_DIST() {
this.name = "EXPON.DIST";
this.value = null;
this.argumentsCurrent = 0;
}
cEXPON_DIST.prototype = Object.create(cBaseFunction.prototype);
cEXPON_DIST.prototype.constructor = cEXPON_DIST;
cEXPON_DIST.prototype.argumentsMin = 3;
cEXPON_DIST.prototype.argumentsMax = 3;
cEXPON_DIST.prototype.isXLFN = true;
cEXPON_DIST.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
argClone[0] = argClone[0].tocNumber();
argClone[1] = argClone[1].tocNumber();
argClone[2] = argClone[2].tocNumber();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var calcFDist = function(argArray){
var arg0 = argArray[0];
var arg1 = argArray[1];
var arg2 = argArray[2];
if (arg0 < 0 || arg1 <= 0) {
return new cError(cErrorType.not_numeric);
}
var res = null;
if (arg2) {
res = 1 - Math.exp(-arg1 * arg0);
} else {
res = arg1 * Math.exp(-arg1 * arg0);
}
return null !== res && !isNaN(res) ? new cNumber(res) : new cError(cErrorType.wrong_value_type);
};
return this.value = this._findArrayInNumberArguments(oArguments, calcFDist);
};
cEXPON_DIST.prototype.getInfo = function () {
return {
name: this.name, args: "( x , lambda , cumulative-flag )"
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -2686,6 +2713,7 @@
cF_DIST.prototype.constructor = cF_DIST;
cF_DIST.prototype.argumentsMin = 3;
cF_DIST.prototype.argumentsMax = 4;
cF_DIST.prototype.isXLFN = true;
cF_DIST.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -2743,6 +2771,7 @@
cF_DIST_RT.prototype.constructor = cF_DIST_RT;
cF_DIST_RT.prototype.argumentsMin = 3;
cF_DIST_RT.prototype.argumentsMax = 3;
cF_DIST_RT.prototype.isXLFN = true;
cF_DIST_RT.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -2793,6 +2822,7 @@
cF_INV.prototype.constructor = cF_INV;
cF_INV.prototype.argumentsMin = 3;
cF_INV.prototype.argumentsMax = 3;
cF_INV.prototype.isXLFN = true;
cF_INV.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -2839,64 +2869,6 @@
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cF_INV_RT() {
cBaseFunction.call(this, "F.INV.RT");
}
//clone cFINV formula
cF_INV_RT.prototype = Object.create(cBaseFunction.prototype);
cF_INV_RT.prototype.constructor = cF_INV_RT;
cF_INV_RT.prototype.argumentsMin = 3;
cF_INV_RT.prototype.argumentsMax = 3;
cF_INV_RT.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
argClone[0] = argClone[0].tocNumber();
argClone[1] = argClone[1].tocNumber();
argClone[2] = argClone[2].tocNumber();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var calcFDist = function(argArray){
var fP = argArray[0];
var fF1 = parseInt(argArray[1]);
var fF2 = parseInt(argArray[2]);
if (fP <= 0 || fF1 < 1 || fF2 < 1 || fF1 >= 1.0E10 || fF2 >= 1.0E10 || fP > 1){
return new cError(cErrorType.not_numeric);
}
var aFunc = new FDISTFUNCTION(fP, fF1, fF2);
var oVal = iterateInverse( aFunc, fF1*0.5, fF1 );
var bConvError = oVal.bError;
if (bConvError){
return new cError(cErrorType.not_numeric);
}
var res = oVal.val;
return null !== res && !isNaN(res) ? new cNumber(res) : new cError(cErrorType.wrong_value_type);
};
if (argClone[1].getValue() < 1 ){
return this.value = new cError(cErrorType.not_numeric);
}
return this.value = this._findArrayInNumberArguments(oArguments, calcFDist);
};
cF_INV_RT.prototype.getInfo = function () {
return {
name: this.name, args: "(probability, deg_freedom1, deg_freedom2)"
};
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -2955,6 +2927,19 @@
};
};
/**
* @constructor
* @extends {cFINV}
*/
function cF_INV_RT() {
cFINV.call(this);
this.name = "F.INV.RT";
}
cF_INV_RT.prototype = Object.create(cFINV.prototype);
cF_INV_RT.prototype.constructor = cF_INV_RT;
cF_INV_RT.prototype.isXLFN = true;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -3291,125 +3276,6 @@
return {name: this.name, args: "(number)"}
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
//CLONE cGAMMA_DIST FUNCTION
function cGAMMADIST() {
this.name = "GAMMADIST";
this.value = null;
this.argumentsCurrent = 0;
}
cGAMMADIST.prototype = Object.create(cBaseFunction.prototype);
cGAMMADIST.prototype.constructor = cGAMMADIST;
cGAMMADIST.prototype.argumentsMin = 4;
cGAMMADIST.prototype.argumentsMax = 4;
cGAMMADIST.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
argClone[0] = argClone[0].tocNumber();
argClone[1] = argClone[1].tocNumber();
argClone[2] = argClone[2].tocNumber();
argClone[3] = argClone[3].tocNumber();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var calcGamma = function(argArray){
var fX = argArray[0];
var fAlpha = argArray[1];
var fBeta = argArray[2];
var bCumulative = argArray[3];
var res = null;
if ((fX < 0) || fAlpha <= 0 || fBeta <= 0){
return new cError(cErrorType.not_numeric);
}
else
{
if (bCumulative) {
res = getGammaDist( fX, fAlpha, fBeta );
}else {
res = getGammaDistPDF( fX, fAlpha, fBeta );
}
}
return null !== res && !isNaN(res) ? new cNumber(res) : new cError(cErrorType.wrong_value_type);
};
return this.value = this._findArrayInNumberArguments(oArguments, calcGamma);
};
cGAMMADIST.prototype.getInfo = function () {
return {name: this.name, args: "(x, alpha, beta, cumulative )"}
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
//CLONE cGAMMA_INV FUNCTION
function cGAMMAINV() {
this.name = "GAMMAINV";
this.value = null;
this.argumentsCurrent = 0;
}
cGAMMAINV.prototype = Object.create(cBaseFunction.prototype);
cGAMMAINV.prototype.constructor = cGAMMAINV;
cGAMMAINV.prototype.argumentsMin = 3;
cGAMMAINV.prototype.argumentsMax = 3;
cGAMMAINV.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
argClone[0] = argClone[0].tocNumber();
argClone[1] = argClone[1].tocNumber();
argClone[2] = argClone[2].tocNumber();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var calcGamma = function(argArray){
var fP = argArray[0];
var fAlpha = argArray[1];
var fBeta = argArray[2];
if (fAlpha <= 0 || fBeta <= 0 || fP < 0 || fP >= 1 ){
return new cError(cErrorType.not_numeric);
}
var res = null;
if (fP === 0){
res = 0;
}else {
var aFunc = new GAMMADISTFUNCTION(fP, fAlpha, fBeta);
var fStart = fAlpha * fBeta;
var oVal = iterateInverse(aFunc, fStart * 0.5, fStart);
var bConvError = oVal.bError;
if (bConvError){
return new cError(cErrorType.not_numeric);
//SetError(FormulaError::NoConvergence);
}
res = oVal.val;
}
return null !== res && !isNaN(res) ? new cNumber(res) : new cError(cErrorType.wrong_value_type);
};
return this.value = this._findArrayInNumberArguments(oArguments, calcGamma);
};
cGAMMAINV.prototype.getInfo = function () {
return {name: this.name, args: "(probability, alpha, beta )"}
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -3424,6 +3290,7 @@
cGAMMA_DIST.prototype.constructor = cGAMMA_DIST;
cGAMMA_DIST.prototype.argumentsMin = 4;
cGAMMA_DIST.prototype.argumentsMax = 4;
cGAMMA_DIST.prototype.isXLFN = true;
cGAMMA_DIST.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -3466,6 +3333,18 @@
return {name: this.name, args: "(x, alpha, beta, cumulative )"}
};
/**
* @constructor
* @extends {cGAMMA_DIST}
*/
function cGAMMADIST() {
cGAMMA_DIST.call(this);
this.name = "GAMMADIST";
}
cGAMMADIST.prototype = Object.create(cGAMMA_DIST.prototype);
cGAMMADIST.prototype.constructor = cGAMMADIST;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -3480,6 +3359,7 @@
cGAMMA_INV.prototype.constructor = cGAMMA_INV;
cGAMMA_INV.prototype.argumentsMin = 3;
cGAMMA_INV.prototype.argumentsMax = 3;
cGAMMA_INV.prototype.isXLFN = true;
cGAMMA_INV.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -3527,6 +3407,18 @@
return {name: this.name, args: "(probability, alpha, beta )"}
};
/**
* @constructor
* @extends {cGAMMA_INV}
*/
function cGAMMAINV() {
cGAMMA_INV.call(this);
this.name = "GAMMAINV";
}
cGAMMAINV.prototype = Object.create(cGAMMA_INV.prototype);
cGAMMAINV.prototype.constructor = cGAMMAINV;
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -3590,6 +3482,7 @@
cGAMMALN_PRECISE.prototype.constructor = cGAMMALN_PRECISE;
cGAMMALN_PRECISE.prototype.argumentsMin = 1;
cGAMMALN_PRECISE.prototype.argumentsMax = 1;
cGAMMALN_PRECISE.prototype.isXLFN = true;
cGAMMALN_PRECISE.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -3612,6 +3505,43 @@
return {name: this.name, args: "(number)"}
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cGAUSS() {
this.name = "GAUSS";
this.value = null;
this.argumentsCurrent = 0;
}
cGAUSS.prototype = Object.create(cBaseFunction.prototype);
cGAUSS.prototype.constructor = cGAUSS;
cGAUSS.prototype.argumentsMin = 1;
cGAUSS.prototype.argumentsMax = 1;
cGAUSS.prototype.isXLFN = true;
cGAUSS.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
argClone[0] = argClone[0].tocNumber();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var calcGauss = function(argArray) {
var res = gauss(argArray[0]);
return isNaN(res) ? new cError(cErrorType.not_numeric) : new cNumber(res);
};
return this.value = this._findArrayInNumberArguments(oArguments, calcGauss);
};
cGAUSS.prototype.getInfo = function () {
return {name: this.name, args: "(number)"}//в документации аргумент называется Z
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -4215,6 +4145,7 @@
cLOGNORM_DIST.prototype.constructor = cLOGNORM_DIST;
cLOGNORM_DIST.prototype.argumentsMin = 4;
cLOGNORM_DIST.prototype.argumentsMax = 4;
cLOGNORM_DIST.prototype.isXLFN = true;
cLOGNORM_DIST.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -4278,6 +4209,7 @@
cLOGNORM_INV.prototype.constructor = cLOGNORM_INV;
cLOGNORM_INV.prototype.argumentsMin = 3;
cLOGNORM_INV.prototype.argumentsMax = 3;
cLOGNORM_INV.prototype.isXLFN = true;
cLOGNORM_INV.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -6749,6 +6681,7 @@
cT_DIST.prototype.constructor = cT_DIST;
cT_DIST.prototype.argumentsMin = 3;
cT_DIST.prototype.argumentsMax = 3;
cT_DIST.prototype.isXLFN = true;
cT_DIST.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -6795,6 +6728,7 @@
cT_DIST_2T.prototype.constructor = cT_DIST_2T;
cT_DIST_2T.prototype.argumentsMin = 2;
cT_DIST_2T.prototype.argumentsMax = 2;
cT_DIST_2T.prototype.isXLFN = true;
cT_DIST_2T.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -6839,6 +6773,7 @@
cT_DIST_RT.prototype.constructor = cT_DIST_RT;
cT_DIST_RT.prototype.argumentsMin = 2;
cT_DIST_RT.prototype.argumentsMax = 2;
cT_DIST_RT.prototype.isXLFN = true;
cT_DIST_RT.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -6887,6 +6822,7 @@
cT_INV.prototype.constructor = cT_INV;
cT_INV.prototype.argumentsMin = 2;
cT_INV.prototype.argumentsMax = 2;
cT_INV.prototype.isXLFN = true;
cT_INV.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -6949,6 +6885,7 @@
cT_INV_2T.prototype.constructor = cT_INV_2T;
cT_INV_2T.prototype.argumentsMin = 2;
cT_INV_2T.prototype.argumentsMax = 2;
cT_INV_2T.prototype.isXLFN = true;
cT_INV_2T.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
......@@ -6992,56 +6929,15 @@
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
* @extends {cT_INV_2T}
*/
function cTINV() {
cBaseFunction.call(this, "TINV");
cT_INV_2T.call(this);
this.name = "TINV";
}
//clone T.INV.2T
cTINV.prototype = Object.create(cBaseFunction.prototype);
cTINV.prototype.constructor = cTINV;
cTINV.prototype.argumentsMin = 2;
cTINV.prototype.argumentsMax = 2;
cTINV.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
argClone[0] = argClone[0].tocNumber();
argClone[1] = argClone[1].tocNumber();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var calcTDist = function(argArray){
var fP = argArray[0];
var fDF = parseInt(argArray[1]);
//ms игнорирует услвие fP > 1. сделал как в документации
if ( fDF < 1.0 || fP <= 0 || fP > 1 ){
return new cError(cErrorType.not_numeric);
}
var aFunc = new TDISTFUNCTION(fP, fDF, 2);
var oVal = iterateInverse(aFunc, fDF * 0.5, fDF);
var bConvError = oVal.bError;
var res = oVal.val;
if (bConvError){
return new cError(cErrorType.not_numeric);
}
return null !== res && !isNaN(res) ? new cNumber(res) : new cError(cErrorType.wrong_value_type);
};
return this.value = this._findArrayInNumberArguments(oArguments, calcTDist);
};
cTINV.prototype.getInfo = function () {
return {
name: this.name, args: "(probability, deg_freedom)"
};
};
cTINV.prototype = Object.create(cT_INV_2T.prototype);
cTINV.prototype.constructor = cTINV;
/**
* @constructor
......
......@@ -1019,6 +1019,9 @@
case AscDFH.historydescription_Document_AddInlineLevelContentControl:
sString = "Document_AddInlineLevelContentControl";
break;
case AscDFH.historydescription_Document_RemoveContentControl:
sString = "Document_RemoveContentControl";
break;
}
return sString;
}
......@@ -2907,6 +2910,7 @@
window['AscDFH'].historydescription_Document_InsertSignatureLine = 0x0140;
window['AscDFH'].historydescription_Document_AddBlockLevelContentControl = 0x0141;
window['AscDFH'].historydescription_Document_AddInlineLevelContentControl = 0x0142;
window['AscDFH'].historydescription_Document_RemoveContentControl = 0x0143;
......
......@@ -629,12 +629,17 @@ CBlockLevelSdt.prototype.Document_Is_SelectionLocked = function(CheckType, bChec
var nContentControlLock = this.GetContentControlLock();
if (AscCommon.changestype_ContentControl_Remove === CheckType
|| AscCommon.changestype_ContentControl_Properties === CheckType)
this.Lock.Check(this.GetId());
if (isCheckContentControlLock
&& (AscCommon.changestype_Paragraph_Content === CheckType
|| AscCommon.changestype_Remove === CheckType
|| AscCommon.changestype_Delete === CheckType
|| AscCommon.changestype_Document_Content === CheckType
|| AscCommon.changestype_Document_Content_Add === CheckType)
|| AscCommon.changestype_Document_Content_Add === CheckType
|| AscCommon.changestype_ContentControl_Remove === CheckType)
&& this.IsSelectionUse()
&& this.IsSelectedAll())
{
......
......@@ -1040,35 +1040,37 @@
var locktype_Other2 = 4; // данный объект залочен другим(не текущим) пользователем (обновления уже пришли)
var locktype_Other3 = 5; // данный объект был залочен (обновления пришли) и снова стал залочен
var changestype_None = 0; // Ничего не происходит с выделенным элементом (проверка идет через дополнительный параметр)
var changestype_Paragraph_Content = 1; // Добавление/удаление элементов в параграф
var changestype_Paragraph_Properties = 2; // Изменение свойств параграфа
var changestype_Document_Content = 10; // Добавление/удаление элементов в Document или в DocumentContent
var changestype_Document_Content_Add = 11; // Добавление элемента в класс Document или в класс DocumentContent
var changestype_Document_SectPr = 12; // Изменения свойств данной секции (размер страницы, поля и ориентация)
var changestype_Document_Styles = 13; // Изменяем стили документа (добавление/удаление/модифицирование)
var changestype_Table_Properties = 20; // Любые изменения в таблице
var changestype_Table_RemoveCells = 21; // Удаление ячеек (строк или столбцов)
var changestype_Image_Properties = 23; // Изменения настроек картинки
var changestype_HdrFtr = 30; // Изменения в колонтитуле (любые изменения)
var changestype_Remove = 40; // Удаление, через кнопку backspace (Удаление назад)
var changestype_Delete = 41; // Удаление, через кнопку delete (Удаление вперед)
var changestype_Drawing_Props = 51; // Изменение свойств фигуры
var changestype_ColorScheme = 60; // Изменение свойств фигуры
var changestype_Text_Props = 61; // Изменение свойств фигуры
var changestype_RemoveSlide = 62; // Изменение свойств фигуры
var changestype_PresentationProps = 63; // Изменение темы, цветовой схемы, размера слайда;
var changestype_Theme = 64; // Изменение темы;
var changestype_SlideSize = 65; // Изменение цветовой схемы;
var changestype_SlideBg = 66; // Изменение цветовой схемы;
var changestype_SlideTiming = 67; // Изменение цветовой схемы;
var changestype_MoveComment = 68;
var changestype_AddSp = 69;
var changestype_AddComment = 70;
var changestype_Layout = 71;
var changestype_AddShape = 72;
var changestype_AddShapes = 73;
var changestype_PresDefaultLang = 74;
var changestype_None = 0; // Ничего не происходит с выделенным элементом (проверка идет через дополнительный параметр)
var changestype_Paragraph_Content = 1; // Добавление/удаление элементов в параграф
var changestype_Paragraph_Properties = 2; // Изменение свойств параграфа
var changestype_Document_Content = 10; // Добавление/удаление элементов в Document или в DocumentContent
var changestype_Document_Content_Add = 11; // Добавление элемента в класс Document или в класс DocumentContent
var changestype_Document_SectPr = 12; // Изменения свойств данной секции (размер страницы, поля и ориентация)
var changestype_Document_Styles = 13; // Изменяем стили документа (добавление/удаление/модифицирование)
var changestype_Table_Properties = 20; // Любые изменения в таблице
var changestype_Table_RemoveCells = 21; // Удаление ячеек (строк или столбцов)
var changestype_Image_Properties = 23; // Изменения настроек картинки
var changestype_ContentControl_Remove = 24; // Удаление контейнера целиком
var changestype_ContentControl_Properties = 25; // Изменение свойств контейнера
var changestype_HdrFtr = 30; // Изменения в колонтитуле (любые изменения)
var changestype_Remove = 40; // Удаление, через кнопку backspace (Удаление назад)
var changestype_Delete = 41; // Удаление, через кнопку delete (Удаление вперед)
var changestype_Drawing_Props = 51; // Изменение свойств фигуры
var changestype_ColorScheme = 60; // Изменение свойств фигуры
var changestype_Text_Props = 61; // Изменение свойств фигуры
var changestype_RemoveSlide = 62; // Изменение свойств фигуры
var changestype_PresentationProps = 63; // Изменение темы, цветовой схемы, размера слайда;
var changestype_Theme = 64; // Изменение темы;
var changestype_SlideSize = 65; // Изменение цветовой схемы;
var changestype_SlideBg = 66; // Изменение цветовой схемы;
var changestype_SlideTiming = 67; // Изменение цветовой схемы;
var changestype_MoveComment = 68;
var changestype_AddSp = 69;
var changestype_AddComment = 70;
var changestype_Layout = 71;
var changestype_AddShape = 72;
var changestype_AddShapes = 73;
var changestype_PresDefaultLang = 74;
var changestype_2_InlineObjectMove = 1; // Передвигаем объект в заданную позцию (проверяем место, в которое пытаемся передвинуть)
var changestype_2_HdrFtr = 2; // Изменения с колонтитулом
......@@ -1737,41 +1739,43 @@
window["AscCommon"].locktype_Other2 = locktype_Other2;
window["AscCommon"].locktype_Other3 = locktype_Other3;
window["AscCommon"].changestype_None = changestype_None;
window["AscCommon"].changestype_Paragraph_Content = changestype_Paragraph_Content;
window["AscCommon"].changestype_Paragraph_Properties = changestype_Paragraph_Properties;
window["AscCommon"].changestype_Document_Content = changestype_Document_Content;
window["AscCommon"].changestype_Document_Content_Add = changestype_Document_Content_Add;
window["AscCommon"].changestype_Document_SectPr = changestype_Document_SectPr;
window["AscCommon"].changestype_Document_Styles = changestype_Document_Styles;
window["AscCommon"].changestype_Table_Properties = changestype_Table_Properties;
window["AscCommon"].changestype_Table_RemoveCells = changestype_Table_RemoveCells;
window["AscCommon"].changestype_Image_Properties = changestype_Image_Properties;
window["AscCommon"].changestype_HdrFtr = changestype_HdrFtr;
window["AscCommon"].changestype_Remove = changestype_Remove;
window["AscCommon"].changestype_Delete = changestype_Delete;
window["AscCommon"].changestype_Drawing_Props = changestype_Drawing_Props;
window["AscCommon"].changestype_ColorScheme = changestype_ColorScheme;
window["AscCommon"].changestype_Text_Props = changestype_Text_Props;
window["AscCommon"].changestype_RemoveSlide = changestype_RemoveSlide;
window["AscCommon"].changestype_Theme = changestype_Theme;
window["AscCommon"].changestype_SlideSize = changestype_SlideSize;
window["AscCommon"].changestype_SlideBg = changestype_SlideBg;
window["AscCommon"].changestype_SlideTiming = changestype_SlideTiming;
window["AscCommon"].changestype_MoveComment = changestype_MoveComment;
window["AscCommon"].changestype_AddComment = changestype_AddComment;
window["AscCommon"].changestype_Layout = changestype_Layout;
window["AscCommon"].changestype_AddShape = changestype_AddShape;
window["AscCommon"].changestype_AddShapes = changestype_AddShapes;
window["AscCommon"].changestype_PresDefaultLang = changestype_PresDefaultLang;
window["AscCommon"].changestype_2_InlineObjectMove = changestype_2_InlineObjectMove;
window["AscCommon"].changestype_2_HdrFtr = changestype_2_HdrFtr;
window["AscCommon"].changestype_2_Comment = changestype_2_Comment;
window["AscCommon"].changestype_2_Element_and_Type = changestype_2_Element_and_Type;
window["AscCommon"].changestype_2_ElementsArray_and_Type = changestype_2_ElementsArray_and_Type;
window["AscCommon"].changestype_2_AdditionalTypes = changestype_2_AdditionalTypes;
window["AscCommon"].contentchanges_Add = contentchanges_Add;
window["AscCommon"].contentchanges_Remove = contentchanges_Remove;
window["AscCommon"].changestype_None = changestype_None;
window["AscCommon"].changestype_Paragraph_Content = changestype_Paragraph_Content;
window["AscCommon"].changestype_Paragraph_Properties = changestype_Paragraph_Properties;
window["AscCommon"].changestype_Document_Content = changestype_Document_Content;
window["AscCommon"].changestype_Document_Content_Add = changestype_Document_Content_Add;
window["AscCommon"].changestype_Document_SectPr = changestype_Document_SectPr;
window["AscCommon"].changestype_Document_Styles = changestype_Document_Styles;
window["AscCommon"].changestype_Table_Properties = changestype_Table_Properties;
window["AscCommon"].changestype_Table_RemoveCells = changestype_Table_RemoveCells;
window["AscCommon"].changestype_Image_Properties = changestype_Image_Properties;
window["AscCommon"].changestype_ContentControl_Remove = changestype_ContentControl_Remove;
window["AscCommon"].changestype_ContentControl_Properties = changestype_ContentControl_Properties;
window["AscCommon"].changestype_HdrFtr = changestype_HdrFtr;
window["AscCommon"].changestype_Remove = changestype_Remove;
window["AscCommon"].changestype_Delete = changestype_Delete;
window["AscCommon"].changestype_Drawing_Props = changestype_Drawing_Props;
window["AscCommon"].changestype_ColorScheme = changestype_ColorScheme;
window["AscCommon"].changestype_Text_Props = changestype_Text_Props;
window["AscCommon"].changestype_RemoveSlide = changestype_RemoveSlide;
window["AscCommon"].changestype_Theme = changestype_Theme;
window["AscCommon"].changestype_SlideSize = changestype_SlideSize;
window["AscCommon"].changestype_SlideBg = changestype_SlideBg;
window["AscCommon"].changestype_SlideTiming = changestype_SlideTiming;
window["AscCommon"].changestype_MoveComment = changestype_MoveComment;
window["AscCommon"].changestype_AddComment = changestype_AddComment;
window["AscCommon"].changestype_Layout = changestype_Layout;
window["AscCommon"].changestype_AddShape = changestype_AddShape;
window["AscCommon"].changestype_AddShapes = changestype_AddShapes;
window["AscCommon"].changestype_PresDefaultLang = changestype_PresDefaultLang;
window["AscCommon"].changestype_2_InlineObjectMove = changestype_2_InlineObjectMove;
window["AscCommon"].changestype_2_HdrFtr = changestype_2_HdrFtr;
window["AscCommon"].changestype_2_Comment = changestype_2_Comment;
window["AscCommon"].changestype_2_Element_and_Type = changestype_2_Element_and_Type;
window["AscCommon"].changestype_2_ElementsArray_and_Type = changestype_2_ElementsArray_and_Type;
window["AscCommon"].changestype_2_AdditionalTypes = changestype_2_AdditionalTypes;
window["AscCommon"].contentchanges_Add = contentchanges_Add;
window["AscCommon"].contentchanges_Remove = contentchanges_Remove;
window["AscCommon"].offlineMode = offlineMode;
......
......@@ -52,6 +52,7 @@ function CBlockLevelSdt(oLogicDocument, oParent)
this.LogicDocument = oLogicDocument;
this.Content = new CDocumentContent(this, oLogicDocument ? oLogicDocument.Get_DrawingDocument() : null, 0, 0, 0, 0, true, false, false);
this.Pr = new CSdtPr();
this.Lock = new AscCommon.CLock();
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add(this, this.Id);
......@@ -142,6 +143,12 @@ CBlockLevelSdt.prototype.Read_FromBinary2 = function(Reader)
CBlockLevelSdt.prototype.Draw = function(CurPage, oGraphics)
{
this.Content.Draw(CurPage, oGraphics);
if (AscCommon.locktype_None !== this.Lock.Get_Type())
{
var oBounds = this.GetContentBounds(CurPage);
oGraphics.DrawLockObjectRect(this.Lock.Get_Type(), oBounds.Left, oBounds.Top, oBounds.Right - oBounds.Left, oBounds.Bottom - oBounds.Top);
}
};
CBlockLevelSdt.prototype.Get_CurrentPage_Absolute = function()
{
......@@ -165,6 +172,20 @@ CBlockLevelSdt.prototype.IsTableBorder = function(X, Y, CurPage)
};
CBlockLevelSdt.prototype.UpdateCursorType = function(X, Y, CurPage)
{
var oBounds = this.GetContentBounds(CurPage);
if (true === this.Lock.Is_Locked() && X < oBounds.Right && X > oBounds.Left && Y > oBounds.Top && Y < oBounds.Bottom)
{
var MMData = new AscCommon.CMouseMoveData();
var Coords = this.LogicDocument.DrawingDocument.ConvertCoordsToCursorWR(oBounds.Left, oBounds.Top, this.Get_AbsolutePage(CurPage), this.Get_ParentTextTransform());
MMData.X_abs = Coords.X - 5;
MMData.Y_abs = Coords.Y;
MMData.Type = AscCommon.c_oAscMouseMoveDataTypes.LockedObject;
MMData.UserId = this.Lock.Get_UserId();
MMData.HaveChanges = this.Lock.Have_Changes();
MMData.LockedObjectType = c_oAscMouseMoveLockedObjectType.Common;
this.LogicDocument.Api.sync_MouseMoveCallback(MMData);
}
this.DrawContentControlsTrack(true);
return this.Content.UpdateCursorType(X, Y, CurPage);
};
......
......@@ -7202,9 +7202,9 @@ background-repeat: no-repeat;\
var sDefaultText = this.textArtTranslate ? this.textArtTranslate.DefaultText : "Your text here";
if (AscCommonWord.sdttype_BlockLevel === nType)
{
if (false === oLogicDocument.Document_Is_SelectionLocked())
if (false === oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Document_Content))
{
History.Create_NewPoint(AscDFH.historydescription_Document_AddBlockLevelContentControl);
oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_AddBlockLevelContentControl);
var oContentControl = oLogicDocument.AddContentControl(AscCommonWord.sdttype_BlockLevel);
if (oContentControlPr)
......@@ -7223,9 +7223,9 @@ background-repeat: no-repeat;\
}
else if (AscCommonWord.sdttype_InlineLevel === nType)
{
if (false === oLogicDocument.Document_Is_SelectionLocked())
if (false === oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Paragraph_Content))
{
History.Create_NewPoint(AscDFH.historydescription_Document_AddInlineLevelContentControl);
oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_AddInlineLevelContentControl);
var oContentControl = oLogicDocument.AddContentControl(AscCommonWord.sdttype_InlineLevel);
......@@ -7244,7 +7244,65 @@ background-repeat: no-repeat;\
}
}
};
asc_docs_api.prototype.asc_RemoveContentControl = function(Id)
{
var oLogicDocument = this.WordControl.m_oLogicDocument;
if (!oLogicDocument)
return;
var isLocked = true;
var oContentControl = null;
if (undefined === Id)
{
var oInfo = oLogicDocument.GetSelectedElementsInfo();
var oInlineControl = oInfo.GetInlineLevelSdt();
var oBlockControl = oInfo.GetBlockLevelSdt();
if (oInlineControl)
oContentControl = oInlineControl;
else if (oBlockControl)
oContentControl = oBlockControl;
}
else
{
oContentControl = AscCommon.g_oTableId.Get_ById(Id);
}
if (oContentControl && oContentControl.GetContentControlType)
{
if (AscCommonWord.sdttype_BlockLevel === oContentControl.GetContentControlType())
{
isLocked = oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None, {
Type : AscCommon.changestype_2_ElementsArray_and_Type,
Elements : [oContentControl],
CheckType : AscCommon.changestype_ContentControl_Remove
});
}
else if (AscCommonWord.sdttype_InlineLevel === oContentControl.GetContentControlType())
{
var oParagraph = oContentControl.GetParagraph();
if (oParagraph)
{
isLocked = oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_None, {
Type : AscCommon.changestype_2_ElementsArray_and_Type,
Elements : [oParagraph],
CheckType : AscCommon.changestype_Paragraph_Content
});
}
}
Id = oContentControl.GetId();
}
if (false === isLocked)
{
oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_RemoveContentControl);
oLogicDocument.RemoveContentControl(Id);
oLogicDocument.Recalculate();
oLogicDocument.Document_UpdateInterfaceState();
oLogicDocument.Document_UpdateSelectionState();
}
};
// input
asc_docs_api.prototype.Begin_CompositeInput = function()
......
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