Commit 735cdfef authored by Dmitry.Shahtanov's avatar Dmitry.Shahtanov Committed by Alexander.Trofimov

для локализации

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62366 954022d7-b5bf-4e40-9824-e11837661b57
parent 7fb016ec
......@@ -367,8 +367,8 @@ var str_namedRanges = "A-Za-z\u005F\u0080-\u0081\u0083\u0085-\u0087\u0089-\u008A
rx_Gt = /^ *> */,
rx_Ge = /^ *>= */,
rx_Ne = /^ *<> */,
// rg = new XRegExp( "^([\\p{L}\\d.]+ *)[-+*/^&%<=>:;\\(\\)]" ),
rg = /^([\w\d.]+ *)[-+*\/^&%<=>:;\(\)]/,
rg = new XRegExp( "^([\\p{L}\\d.]+ *)[-+*/^&%<=>:;\\(\\)]" ),
// rg = /^([\w\d.]+ *)[-+*\/^&%<=>:;\(\)]/,
rgRange = /^\$?[A-Za-z]+\$?\d+:\$?[A-Za-z]+\$?\d+/,
rgCols = /^\$?[A-Za-z]+:\$?[A-Za-z]+/,
rgRows = /^\$?\d+:\$?\d+/,
......@@ -401,7 +401,8 @@ var str_namedRanges = "A-Za-z\u005F\u0080-\u0081\u0083\u0085-\u0087\u0089-\u008A
rg_validHEXNumber = /^[0-9A-F]{1,10}$/i,
rg_validOCTNumber = /^[0-7]{1,10}$/,
rg_complex_number = new XRegExp( "^(?<real>[-+]?(?:\\d*(?:\\.\\d+)?(?:[Ee][+-]?\\d+)?))?(?<img>([-+]?(\\d*(?:\\.\\d+)?(?:[Ee][+-]?\\d+)?)?[ij])?)", "g" ),
rx_name = new XRegExp( "^(?<name>" + "[" + str_namedRanges + "]" + "[" + str_namedRanges + "\\d.]*)([-+*\\/^&%<=>: ;),]|$)" );
rx_name = new XRegExp( "^(?<name>" + "[" + str_namedRanges + "]" + "[" + str_namedRanges + "\\d.]*)([-+*\\/^&%<=>: ;),]|$)" ),
rx_defName = new RegExp("(^(["+str_namedRanges+"_\\])(["+str_namedRanges+"_0-9]*)$)","i");
/**
......
......@@ -1029,7 +1029,7 @@ function cBESSELY() {
cBESSELY.prototype = Object.create( cBaseFunction.prototype );
function cBIN2DEC() {
cBaseFunction.call( this, "BIN2DEC", 1, 1 );
cBaseFunction.call( this, "BIN2DEC", null, 1, 1 );
}
cBIN2DEC.prototype = Object.create( cBaseFunction.prototype );
......@@ -1077,7 +1077,7 @@ cBIN2DEC.prototype.getInfo = function () {
}
function cBIN2HEX() {
cBaseFunction.call( this, "BIN2HEX", 1, 2 );
cBaseFunction.call( this, "BIN2HEX", null, 1, 2 );
}
cBIN2HEX.prototype = Object.create( cBaseFunction.prototype );
......@@ -1139,7 +1139,7 @@ cBIN2HEX.prototype.getInfo = function () {
}
function cBIN2OCT() {
cBaseFunction.call( this, "BIN2OCT" );
cBaseFunction.call( this, "BIN2OCT", null, 1, 2 );
}
cBIN2OCT.prototype = Object.create( cBaseFunction.prototype );
......@@ -1201,7 +1201,7 @@ cBIN2OCT.prototype.getInfo = function () {
}
function cCOMPLEX() {
cBaseFunction.call( this, "COMPLEX", 2, 3 );
cBaseFunction.call( this, "COMPLEX", null, 2, 3 );
}
cCOMPLEX.prototype = Object.create( cBaseFunction.prototype );
......@@ -1325,7 +1325,7 @@ cDEC2BIN.prototype.getInfo = function () {
}
function cDEC2HEX() {
cBaseFunction.call( this, "DEC2HEX", 1, 2 );
cBaseFunction.call( this, "DEC2HEX", null, 1, 2 );
}
cDEC2HEX.prototype = Object.create( cBaseFunction.prototype );
......@@ -1382,7 +1382,7 @@ cDEC2HEX.prototype.getInfo = function () {
}
function cDEC2OCT() {
cBaseFunction.call( this, "DEC2OCT", 1, 2 );
cBaseFunction.call( this, "DEC2OCT", null, 1, 2 );
}
cDEC2OCT.prototype = Object.create( cBaseFunction.prototype );
......@@ -1439,7 +1439,7 @@ cDEC2OCT.prototype.getInfo = function () {
}
function cDELTA() {
cBaseFunction.call( this, "DELTA", 1, 2 );
cBaseFunction.call( this, "DELTA", null, 1, 2 );
}
cDELTA.prototype = Object.create( cBaseFunction.prototype );
......@@ -1483,7 +1483,7 @@ cDELTA.prototype.getInfo = function () {
}
function cERF() {
cBaseFunction.call( this, "ERF", 1, 2 );
cBaseFunction.call( this, "ERF", null, 1, 2 );
}
cERF.prototype = Object.create( cBaseFunction.prototype );
......@@ -1537,7 +1537,7 @@ cERF.prototype.getInfo = function () {
}
function cERFC() {
cBaseFunction.call( this, "ERFC", 1, 1 );
cBaseFunction.call( this, "ERFC", null, 1, 1 );
}
cERFC.prototype = Object.create( cBaseFunction.prototype );
......@@ -1571,7 +1571,7 @@ cERFC.prototype.getInfo = function () {
}
function cGESTEP() {
cBaseFunction.call( this, "GESTEP", 1, 2 );
cBaseFunction.call( this, "GESTEP", null, 1, 2 );
}
cGESTEP.prototype = Object.create( cBaseFunction.prototype );
......@@ -1615,7 +1615,7 @@ cGESTEP.prototype.getInfo = function () {
}
function cHEX2BIN() {
cBaseFunction.call( this, "HEX2BIN", 1, 2 );
cBaseFunction.call( this, "HEX2BIN", null, 1, 2 );
}
cHEX2BIN.prototype = Object.create( cBaseFunction.prototype );
......@@ -1687,7 +1687,7 @@ cHEX2BIN.prototype.getInfo = function () {
}
function cHEX2DEC() {
cBaseFunction.call( this, "HEX2DEC", 1, 1 );
cBaseFunction.call( this, "HEX2DEC", null, 1, 1 );
}
cHEX2DEC.prototype = Object.create( cBaseFunction.prototype );
......@@ -1733,7 +1733,7 @@ cHEX2DEC.prototype.getInfo = function () {
}
function cHEX2OCT() {
cBaseFunction.call( this, "HEX2OCT", 1, 2 );
cBaseFunction.call( this, "HEX2OCT", null, 1, 2 );
}
cHEX2OCT.prototype = Object.create( cBaseFunction.prototype );
......@@ -1804,7 +1804,7 @@ cHEX2OCT.prototype.getInfo = function () {
}
function cIMABS() {
cBaseFunction.call( this, "IMABS", 1, 1 );
cBaseFunction.call( this, "IMABS", null, 1, 1 );
}
cIMABS.prototype = Object.create( cBaseFunction.prototype );
......@@ -1842,7 +1842,7 @@ cIMABS.prototype.getInfo = function () {
}
function cIMAGINARY() {
cBaseFunction.call( this, "IMAGINARY", 1, 1 );
cBaseFunction.call( this, "IMAGINARY", null, 1, 1 );
}
cIMAGINARY.prototype = Object.create( cBaseFunction.prototype );
......@@ -1880,7 +1880,7 @@ cIMAGINARY.prototype.getInfo = function () {
}
function cIMARGUMENT() {
cBaseFunction.call( this, "IMARGUMENT", 1, 1 );
cBaseFunction.call( this, "IMARGUMENT", null, 1, 1 );
}
cIMARGUMENT.prototype = Object.create( cBaseFunction.prototype );
......@@ -1918,7 +1918,7 @@ cIMARGUMENT.prototype.getInfo = function () {
}
function cIMCONJUGATE() {
cBaseFunction.call( this, "IMCONJUGATE", 1, 1 );
cBaseFunction.call( this, "IMCONJUGATE", null, 1, 1 );
}
cIMCONJUGATE.prototype = Object.create( cBaseFunction.prototype );
......@@ -1956,7 +1956,7 @@ cIMCONJUGATE.prototype.getInfo = function () {
}
function cIMCOS() {
cBaseFunction.call( this, "IMCOS", 1, 1 );
cBaseFunction.call( this, "IMCOS", null, 1, 1 );
}
cIMCOS.prototype = Object.create( cBaseFunction.prototype );
......@@ -1996,7 +1996,7 @@ cIMCOS.prototype.getInfo = function () {
}
function cIMDIV() {
cBaseFunction.call( this, "IMDIV", 2, 2 );
cBaseFunction.call( this, "IMDIV", null, 2, 2);
}
cIMDIV.prototype = Object.create( cBaseFunction.prototype );
......@@ -2047,7 +2047,7 @@ cIMDIV.prototype.getInfo = function () {
}
function cIMEXP() {
cBaseFunction.call( this, "IMEXP", 1, 1 );
cBaseFunction.call( this, "IMEXP", null, 1, 1 );
}
cIMEXP.prototype = Object.create( cBaseFunction.prototype );
......@@ -2087,7 +2087,7 @@ cIMEXP.prototype.getInfo = function () {
}
function cIMLN() {
cBaseFunction.call( this, "IMLN", 1, 1 );
cBaseFunction.call( this, "IMLN", null, 1, 1 );
}
cIMLN.prototype = Object.create( cBaseFunction.prototype );
......@@ -2131,7 +2131,7 @@ cIMLN.prototype.getInfo = function () {
}
function cIMLOG10() {
cBaseFunction.call( this, "IMLOG10", 1, 1 );
cBaseFunction.call( this, "IMLOG10", null, 1, 1 );
}
cIMLOG10.prototype = Object.create( cBaseFunction.prototype );
......@@ -2175,7 +2175,7 @@ cIMLOG10.prototype.getInfo = function () {
}
function cIMLOG2() {
cBaseFunction.call( this, "IMLOG2", 1, 1 );
cBaseFunction.call( this, "IMLOG2", null, 1, 1 );
}
cIMLOG2.prototype = Object.create( cBaseFunction.prototype );
......@@ -2219,7 +2219,7 @@ cIMLOG2.prototype.getInfo = function () {
}
function cIMPOWER() {
cBaseFunction.call( this, "IMPOWER", 2, 2 );
cBaseFunction.call( this, "IMPOWER", null, 2, 2 );
}
cIMPOWER.prototype = Object.create( cBaseFunction.prototype );
......@@ -2273,7 +2273,7 @@ cIMPOWER.prototype.getInfo = function () {
}
function cIMPRODUCT() {
cBaseFunction.call( this, "IMPRODUCT", 1 );
cBaseFunction.call( this, "IMPRODUCT", null, 1, 1 );
}
cIMPRODUCT.prototype = Object.create( cBaseFunction.prototype );
......@@ -2359,7 +2359,7 @@ cIMPRODUCT.prototype.getInfo = function () {
}
function cIMREAL() {
cBaseFunction.call( this, "IMREAL", 1, 1 );
cBaseFunction.call( this, "IMREAL", null, 1, 1 );
}
cIMREAL.prototype = Object.create( cBaseFunction.prototype );
......@@ -2397,7 +2397,7 @@ cIMREAL.prototype.getInfo = function () {
}
function cIMSIN() {
cBaseFunction.call( this, "IMSIN", 1, 1 );
cBaseFunction.call( this, "IMSIN", null, 1, 1 );
}
cIMSIN.prototype = Object.create( cBaseFunction.prototype );
......@@ -2437,7 +2437,7 @@ cIMSIN.prototype.getInfo = function () {
}
function cIMSQRT() {
cBaseFunction.call( this, "IMSQRT", 1, 1 );
cBaseFunction.call( this, "IMSQRT", null, 1, 1 );
}
cIMSQRT.prototype = Object.create( cBaseFunction.prototype );
......@@ -2477,7 +2477,7 @@ cIMSQRT.prototype.getInfo = function () {
}
function cIMSUB() {
cBaseFunction.call( this, "IMSUB", 2, 2 );
cBaseFunction.call( this, "IMSUB", null, 2, 2 );
}
cIMSUB.prototype = Object.create( cBaseFunction.prototype );
......@@ -2528,7 +2528,7 @@ cIMSUB.prototype.getInfo = function () {
}
function cIMSUM() {
cBaseFunction.call( this, "IMSUM", 1 );
cBaseFunction.call( this, "IMSUM", null, 1, 1 );
}
cIMSUM.prototype = Object.create( cBaseFunction.prototype );
......@@ -2615,7 +2615,7 @@ cIMSUM.prototype.getInfo = function () {
}
function cOCT2BIN() {
cBaseFunction.call( this, "OCT2BIN", 1, 2 );
cBaseFunction.call( this, "OCT2BIN", null, 1, 2 );
}
cOCT2BIN.prototype = Object.create( cBaseFunction.prototype );
......@@ -2687,7 +2687,7 @@ cOCT2BIN.prototype.getInfo = function () {
}
function cOCT2DEC() {
cBaseFunction.call( this, "OCT2DEC", 1, 1 );
cBaseFunction.call( this, "OCT2DEC", null, 1, 1 );
}
cOCT2DEC.prototype = Object.create( cBaseFunction.prototype );
......@@ -2733,7 +2733,7 @@ cOCT2DEC.prototype.getInfo = function () {
}
function cOCT2HEX() {
cBaseFunction.call( this, "OCT2HEX", 1, 2 );
cBaseFunction.call( this, "OCT2HEX", null, 1, 2 );
}
cOCT2HEX.prototype = Object.create( cBaseFunction.prototype );
......
......@@ -1545,8 +1545,9 @@ cBaseOperator.prototype = {
};
/** @constructor */
function cBaseFunction( name, argMin, argMax ) {
function cBaseFunction( name, nameLocale, argMin, argMax ) {
this.name = name;
this.nameLocale = nameLocale || this.name;
this.type = cElementType.func;
this.value = null;
this.argumentsMin = argMin ? argMin : 0;
......@@ -1613,6 +1614,26 @@ cBaseFunction.prototype = {
}
return new cString( this.name + "(" + str + ")" );
/* var str = "";
if ( this.argumentsCurrent === 2 ){
str += arg[start + count - 1] + this.name + arg[start + count - 2];
}
else{
str += this.name + arg[start];
}
return new cString( str );*/
},
Assemble2Locale:function ( arg, start, count ) {
var str = "", c = start+count-1
for ( var i = start; i <= c; i++ ) {
str += arg[i].toString();
if ( i !== c ) {
str += ",";
}
}
return new cString( this.nameLocale + "(" + str + ")" );
/* var str = "";
if ( this.argumentsCurrent === 2 ){
str += arg[start + count - 1] + this.name + arg[start + count - 2];
......@@ -3002,6 +3023,7 @@ function parserFormula( formula, _cellId, _ws ) {
this.outStack = [];
this.error = [];
this.Formula = formula;
this.FormulaLocale = null;
this.isParsed = false;
//для функции parse и parseDiagramRef
this.pCurrPos = 0;
......@@ -3061,7 +3083,7 @@ parserFormula.prototype = {
this.cellAddress = g_oCellAddressUtils.getCellAddress( cellId );
},
parse:function () {
parse:function ( local ) {
if ( this.isParsed )
return this.isParsed;
......@@ -3768,6 +3790,44 @@ parserFormula.prototype = {
}
},
/* Сборка функции в инфиксную форму */
assembleLocale:function ( rFormula ) {
/*if ( !rFormula && this.outStack.length == 1 && this.outStack[this.outStack.length - 1] instanceof cError ) {
return this.Formula;
}*/
var currentElement = null,
_count = this.outStack.length,
elemArr = new Array( _count ),
res = undefined, _count_arg;
for ( var i = 0, j = 0; i < _count; i++,j++ ) {
currentElement = this.outStack[i];
if ( currentElement.type == cElementType.operator || currentElement.type == cElementType.func ) {
_count_arg = currentElement.getArguments();
if( currentElement.type == cElementType.func ){
res = currentElement.Assemble2Locale( elemArr, j - _count_arg, _count_arg );
}
else{
res = currentElement.Assemble2( elemArr, j - _count_arg, _count_arg );
}
j -= _count_arg;
elemArr[j] = res;
}
else {
if ( currentElement instanceof cString ) {
currentElement = new cString( "\"" + currentElement.toString() + "\"" );
}
res = currentElement;
elemArr[j] = res;
}
}
if ( res != undefined && res != null ){
return res.toString();
}
else{
return this.Formula;
}
},
_changeOffsetHelper:function ( ref, offset ) {
var m = ref._cells.match( /\$/g );
if ( m.length == 1 ) {//для cRef, cRef3D, cArea. $A2, A$2, Sheet1!$A2, Sheet1!A$2, $A2:C4, A$2:C4, A2:$C4, A2:C$4.
......
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