Commit a1d89bc5 authored by Alexey Golubev's avatar Alexey Golubev

v5.0.0

parents 5fcb16b7 205e4a53
......@@ -17,8 +17,10 @@ jobs:
- npm install -g grunt-cli
- npm install --prefix build
- grunt --level=WHITESPACE_ONLY --base build --gruntfile build/Gruntfile.js
- docker pull onlyofficetestingrobot/doc-builder-testing
- docker run -v $PWD/word:/opt/onlyoffice/documentbuilder/sdkjs/word -v $PWD/cell:/opt/onlyoffice/documentbuilder/sdkjs/cell -v $PWD/slide:/opt/onlyoffice/documentbuilder/sdkjs/slide onlyofficetestingrobot/doc-builder-testing
- docker run -v $PWD/word:/opt/onlyoffice/documentbuilder/sdkjs/word
-v $PWD/cell:/opt/onlyoffice/documentbuilder/sdkjs/cell
-v $PWD/slide:/opt/onlyoffice/documentbuilder/sdkjs/slide
onlyofficetestingrobot/doc-builder-testing:develop-latest
notifications:
email:
recipients:
......
......@@ -11,12 +11,17 @@ GRUNT_ENV += PRODUCT_VERSION=$(PRODUCT_VERSION)
GRUNT_ENV += BUILD_NUMBER=$(BUILD_NUMBER)
WEBAPPS_DIR = web-apps
ifeq ($(PRODUCT_NAME),documentserver-integration)
WEBAPPS_DIR = web-apps-pro
endif
WEBAPPS = $(OUTPUT)/$(WEBAPPS_DIR)
NODE_MODULES = build/node_modules ../web-apps/build/node_modules
WEBAPPS_FILES += ../web-apps/deploy/web-apps/apps/api/documents/api.js
WEBAPPS_FILES += ../web-apps/deploy/web-apps/apps/documenteditor/main/app.js
WEBAPPS_FILES += ../web-apps/deploy/web-apps/apps/presentationeditor/main/app.js
WEBAPPS_FILES += ../web-apps/deploy/web-apps/apps/spreadsheeteditor/main/app.js
NODE_MODULES = build/node_modules ../$(WEBAPPS_DIR)/build/node_modules
WEBAPPS_FILES += ../$(WEBAPPS_DIR)/deploy/web-apps/apps/api/documents/api.js
WEBAPPS_FILES += ../$(WEBAPPS_DIR)/deploy/web-apps/apps/documenteditor/main/app.js
WEBAPPS_FILES += ../$(WEBAPPS_DIR)/deploy/web-apps/apps/presentationeditor/main/app.js
WEBAPPS_FILES += ../$(WEBAPPS_DIR)/deploy/web-apps/apps/spreadsheeteditor/main/app.js
SDKJS_FILES += word/sdk-all.js
SDKJS_FILES += cell/sdk-all.js
SDKJS_FILES += slide/sdk-all.js
......
......@@ -13,14 +13,14 @@ copy ..\cell\sdk-all-min.js ..\..\core\build\jsdesktop\sdkjs\cell\sdk-all-min.js
copy ..\common\Native\native.js ..\..\core\build\jsdesktop\sdkjs\common\Native\native.js
copy ..\word\sdk-all.js ..\..\core-ext\desktop-sdk-wrapper\test\src\build\win_64\Debug\Local\editors\sdkjs\word\sdk-all.js
copy ..\slide\sdk-all.js ..\..\core-ext\desktop-sdk-wrapper\test\src\build\win_64\Debug\Local\editors\sdkjs\slide\sdk-all.js
copy ..\cell\sdk-all.js ..\..\core-ext\desktop-sdk-wrapper\test\src\build\win_64\Debug\Local\editors\sdkjs\cell\sdk-all.js
copy ..\word\sdk-all.js ..\..\core-ext\desktop-sdk-wrapper\test\build\win_64\Debug\Local\editors\sdkjs\word\sdk-all.js
copy ..\slide\sdk-all.js ..\..\core-ext\desktop-sdk-wrapper\test\build\win_64\Debug\Local\editors\sdkjs\slide\sdk-all.js
copy ..\cell\sdk-all.js ..\..\core-ext\desktop-sdk-wrapper\test\build\win_64\Debug\Local\editors\sdkjs\cell\sdk-all.js
copy ..\word\sdk-all-min.js ..\..\core-ext\desktop-sdk-wrapper\test\src\build\win_64\Debug\Local\editors\sdkjs\word\sdk-all-min.js
copy ..\slide\sdk-all-min.js ..\..\core-ext\desktop-sdk-wrapper\test\src\build\win_64\Debug\Local\editors\sdkjs\slide\sdk-all-min.js
copy ..\cell\sdk-all-min.js ..\..\core-ext\desktop-sdk-wrapper\test\src\build\win_64\Debug\Local\editors\sdkjs\cell\sdk-all-min.js
copy ..\word\sdk-all-min.js ..\..\core-ext\desktop-sdk-wrapper\test\build\win_64\Debug\Local\editors\sdkjs\word\sdk-all-min.js
copy ..\slide\sdk-all-min.js ..\..\core-ext\desktop-sdk-wrapper\test\build\win_64\Debug\Local\editors\sdkjs\slide\sdk-all-min.js
copy ..\cell\sdk-all-min.js ..\..\core-ext\desktop-sdk-wrapper\test\build\win_64\Debug\Local\editors\sdkjs\cell\sdk-all-min.js
copy ..\common\Native\native.js ..\..\core-ext\desktop-sdk-wrapper\test\src\build\win_64\Debug\Local\editors\sdkjs\common\Native\native.js
copy ..\common\Native\native.js ..\..\core-ext\desktop-sdk-wrapper\test\build\win_64\Debug\Local\editors\sdkjs\common\Native\native.js
pause
\ No newline at end of file
#!/bin/bash
PRODUCT_VERSION="4.4.2"
BUILD_NUMBER="219"
PRODUCT_VERSION="5.0.0"
BUILD_NUMBER="56"
echo "----------------------------------------"
echo "Building for mobile"
......
......@@ -91,6 +91,9 @@
"../common/Scrolls/mobileTouchManagerBase.js",
"../common/wordcopypaste.js",
"../common/easysax.js",
"../common/openxml.js",
"../cell/document/empty-workbook.js",
"../cell/model/UndoRedo.js",
......@@ -133,6 +136,7 @@
"../cell/model/DrawingObjects/Format/ImagePrototype.js",
"../cell/model/DrawingObjects/Format/GroupPrototype.js",
"../cell/model/DrawingObjects/Format/ChartSpacePrototype.js",
"../cell/model/PivotTables.js",
"../word/Editor/DocumentContentElementBase.js",
"../word/Editor/Comments.js",
......@@ -268,9 +272,9 @@
"../common/externs/global.js",
"../common/externs/jquery-3.2.js",
"../common/externs/xregexp-3.0.0.js",
"../../web-apps/vendor/sockjs/sockjs.min.js",
"../../web-apps/vendor/jszip/jszip.min.js",
"../../web-apps/vendor/jszip-utils/jszip-utils.min.js"
"../common/externs/sockjs.js",
"../common/externs/jszip.min.js",
"../common/externs/jszip-utils.js"
],
"map": "sdk-all.js.map",
"log": "../cell/Build/Log"
......
......@@ -256,9 +256,9 @@
"../common/externs/global.js",
"../common/externs/jquery-3.2.js",
"../common/externs/xregexp-3.0.0.js",
"../../web-apps/vendor/sockjs/sockjs.min.js",
"../../web-apps/vendor/jszip/jszip.min.js",
"../../web-apps/vendor/jszip-utils/jszip-utils.min.js"
"../common/externs/sockjs.js",
"../common/externs/jszip.min.js",
"../common/externs/jszip-utils.js"
],
"map": "sdk-all.js.map",
"log": "../slide/Build/Log"
......
......@@ -248,9 +248,9 @@
"../common/externs/global.js",
"../common/externs/jquery-3.2.js",
"../common/externs/xregexp-3.0.0.js",
"../../web-apps/vendor/sockjs/sockjs.min.js",
"../../web-apps/vendor/jszip/jszip.min.js",
"../../web-apps/vendor/jszip-utils/jszip-utils.min.js"
"../common/externs/sockjs.js",
"../common/externs/jszip.min.js",
"../common/externs/jszip-utils.js"
],
"map": "sdk-all.js.map",
"log": "../word/Build/Log"
......
......@@ -4,11 +4,11 @@
"homepage": "http://www.onlyoffice.com",
"private": true,
"dependencies": {
"google-closure-compiler": "20170423.0.0",
"google-closure-compiler": "20170626.0.0",
"grunt": "1.0.1",
"grunt-contrib-clean": "1.0.0",
"grunt-contrib-clean": "1.0.0",
"grunt-contrib-concat": "1.0.1",
"grunt-replace": "1.0.1",
"grunt-split-file": "1.0.1"
"grunt-split-file": "1.0.1"
}
}
This diff is collapsed.
......@@ -60,7 +60,7 @@ var c_oAscError = Asc.c_oAscError;
window["AscDesktopEditor"]["LocalStartOpen"]();
};
asc['spreadsheet_api'].prototype._OfflineAppDocumentEndLoad = function(_data)
asc['spreadsheet_api'].prototype._OfflineAppDocumentEndLoad = function(_data, _len)
{
AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "")
......@@ -69,7 +69,8 @@ var c_oAscError = Asc.c_oAscError;
return;
}
this.openDocument(_data);
var _binary = getBinaryArray(_data, _len);
this.openDocument(_binary);
AscCommon.History.UserSaveMode = true;
DesktopOfflineUpdateLocalName(this);
......@@ -137,7 +138,7 @@ window["Asc"]['spreadsheet_api'].prototype.asc_setAdvancedOptions = function(idO
};
window["Asc"]['spreadsheet_api'].prototype["asc_setAdvancedOptions"] = window["Asc"]['spreadsheet_api'].prototype.asc_setAdvancedOptions;
window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data)
window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data, _len)
{
AscCommon.g_oDocumentUrls.documentUrl = _url;
if (AscCommon.g_oDocumentUrls.documentUrl.indexOf("file:") != 0)
......@@ -147,7 +148,7 @@ window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data)
AscCommon.g_oDocumentUrls.documentUrl = "file://" + AscCommon.g_oDocumentUrls.documentUrl;
}
window["Asc"]["editor"]._OfflineAppDocumentEndLoad(_data);
window["Asc"]["editor"]._OfflineAppDocumentEndLoad(_data, _len);
};
/////////////////////////////////////////////////////////
......
This diff is collapsed.
......@@ -635,6 +635,14 @@
return this;
};
DrawingContext.prototype.AddClipRect = function (x, y, w, h) {
return this.save().beginPath().rect(x, y, w, h).clip();
};
DrawingContext.prototype.RemoveClipRect = function () {
return this.restore();
};
DrawingContext.prototype.save = function () {
this.ctx.save();
return this;
......@@ -757,6 +765,9 @@
};
DrawingContext.prototype.setLineDash = function (segments) {
if (!this.ctx.setLineDash) {
return;
}
this.ctx.setLineDash(segments);
return this;
};
......
......@@ -183,7 +183,8 @@ function asc_CCommentData(obj) {
bDocument: 11,
bSolved: 12,
aReplies: 13,
bHidden: 14
bHidden: 14,
sOOTime: 15
};
this.bHidden = false;
......@@ -197,6 +198,7 @@ function asc_CCommentData(obj) {
// Common
this.sText = "";
this.sTime = "";
this.sOOTime = "";
this.sUserId = "";
this.sUserName = "";
this.bDocument = true; // For compatibility with 'Word Comment Control'
......@@ -215,6 +217,7 @@ function asc_CCommentData(obj) {
// Common
this.sText = obj.sText;
this.sTime = obj.sTime;
this.sOOTime = obj.sOOTime;
this.sUserId = obj.sUserId;
this.sUserName = obj.sUserName;
this.bDocument = obj.bDocument;
......@@ -266,6 +269,9 @@ asc_CCommentData.prototype = {
asc_putTime: function(val) { this.sTime = val; },
asc_getTime: function() { return this.sTime; },
asc_putOnlyOfficeTime: function(val) { this.sOOTime = val; },
asc_getOnlyOfficeTime: function() { return this.sOOTime; },
asc_putUserId: function(val) { this.sUserId = val; },
asc_getUserId: function() { return this.sUserId; },
......@@ -321,6 +327,7 @@ asc_CCommentData.prototype = {
case this.Properties.nLevel: return this.nLevel; break;
case this.Properties.sText: return this.sText; break;
case this.Properties.sTime: return this.sTime; break;
case this.Properties.sOOTime: return this.sOOTime; break;
case this.Properties.sUserId: return this.sUserId; break;
case this.Properties.sUserName: return this.sUserName; break;
case this.Properties.bDocument: return this.bDocument; break;
......@@ -340,6 +347,7 @@ asc_CCommentData.prototype = {
case this.Properties.nLevel: this.nLevel = value; break;
case this.Properties.sText: this.sText = value; break;
case this.Properties.sTime: this.sTime = value; break;
case this.Properties.sOOTime: this.sOOTime = value; break;
case this.Properties.sUserId: this.sUserId = value; break;
case this.Properties.sUserName: this.sUserName = value; break;
case this.Properties.bDocument: this.bDocument = value; break;
......@@ -1479,6 +1487,8 @@ CCellCommentator.prototype.Redo = function(type, data) {
prot["asc_getQuoteText"] = prot.asc_getQuoteText;
prot["asc_putTime"] = prot.asc_putTime;
prot["asc_getTime"] = prot.asc_getTime;
prot["asc_putOnlyOfficeTime"] = prot.asc_putOnlyOfficeTime;
prot["asc_getOnlyOfficeTime"] = prot.asc_getOnlyOfficeTime;
prot["asc_putUserId"] = prot.asc_putUserId;
prot["asc_getUserId"] = prot.asc_getUserId;
prot["asc_putUserName"] = prot.asc_putUserName;
......
This diff is collapsed.
......@@ -94,10 +94,9 @@
if (AscCommon.c_oNotifyParentType.CanDo === type) {
return true;
} else if (AscCommon.c_oNotifyParentType.IsDefName === type) {
return true;
return {bbox: this.cf.getBBox(), ranges: this.cf.ranges};
} else if (AscCommon.c_oNotifyParentType.Change === type) {
//todo collect
this.ws._updateConditionalFormatting(new AscCommonExcel.MultiplyRange(this.cf.ranges));
this.ws.setDirtyConditionalFormatting(new AscCommonExcel.MultiplyRange(this.cf.ranges));
}
};
......@@ -146,60 +145,65 @@
CConditionalFormattingRule.prototype.getTimePeriod = function() {
var start, end;
var now = new Date();
now.setUTCHours(0, 0, 0, 0);
switch (this.timePeriod) {
case AscCommonExcel.ST_TimePeriod.last7Days:
now.setUTCDate(now.getUTCDate() + 1);
end = now.getExcelDate();
now.setDate(now.getDate() - 7);
now.setUTCDate(now.getUTCDate() - 7);
start = now.getExcelDate();
break;
case AscCommonExcel.ST_TimePeriod.lastMonth:
now.setUTCDate(1);
end = now.getExcelDate();
now.setMonth(now.getMonth() - 1);
now.setUTCMonth(now.getUTCMonth() - 1);
start = now.getExcelDate();
break;
case AscCommonExcel.ST_TimePeriod.thisMonth:
now.setUTCDate(1);
start = now.getExcelDate();
now.setMonth(now.getMonth() + 1);
now.setUTCMonth(now.getUTCMonth() + 1);
end = now.getExcelDate();
break;
case AscCommonExcel.ST_TimePeriod.nextMonth:
now.setMonth(now.getMonth() + 1);
now.setUTCDate(1);
now.setUTCMonth(now.getUTCMonth() + 1);
start = now.getExcelDate();
now.setMonth(now.getMonth() + 1);
now.setUTCMonth(now.getUTCMonth() + 1);
end = now.getExcelDate();
break;
case AscCommonExcel.ST_TimePeriod.lastWeek:
now.setDate(now.getDate() - now.getDay());
now.setUTCDate(now.getUTCDate() - now.getUTCDay());
end = now.getExcelDate();
now.setDate(now.getDate() - 7);
now.setUTCDate(now.getUTCDate() - 7);
start = now.getExcelDate();
break;
case AscCommonExcel.ST_TimePeriod.thisWeek:
now.setDate(now.getDate() - now.getDay());
now.setUTCDate(now.getUTCDate() - now.getUTCDay());
start = now.getExcelDate();
now.setDate(now.getDate() + 7);
now.setUTCDate(now.getUTCDate() + 7);
end = now.getExcelDate();
break;
case AscCommonExcel.ST_TimePeriod.nextWeek:
now.setDate(now.getDate() - now.getDay() + 7);
now.setUTCDate(now.getUTCDate() - now.getUTCDay() + 7);
start = now.getExcelDate();
now.setDate(now.getDate() + 7);
now.setUTCDate(now.getUTCDate() + 7);
end = now.getExcelDate();
break;
case AscCommonExcel.ST_TimePeriod.yesterday:
end = now.getExcelDate();
now.setDate(now.getDate() - 1);
now.setUTCDate(now.getUTCDate() - 1);
start = now.getExcelDate();
break;
case AscCommonExcel.ST_TimePeriod.today:
start = now.getExcelDate();
now.setDate(now.getDate() + 1);
now.setUTCDate(now.getUTCDate() + 1);
end = now.getExcelDate();
break;
case AscCommonExcel.ST_TimePeriod.tomorrow:
now.setDate(now.getDate() + 1);
now.setUTCDate(now.getUTCDate() + 1);
start = now.getExcelDate();
now.setDate(now.getDate() + 1);
now.setUTCDate(now.getUTCDate() + 1);
end = now.getExcelDate();
break;
}
......
......@@ -90,7 +90,6 @@ CChartSpace.prototype.setRecalculateInfo = function()
recalculateTransform: true,
recalculateBounds: true,
recalculateChart: true,
recalculateBaseColors: true,
recalculateSeriesColors: true,
recalculateMarkers: true,
recalculateGridLines: true,
......@@ -114,7 +113,6 @@ CChartSpace.prototype.setRecalculateInfo = function()
recalculateTextPr : true,
recalculateBBoxRange: true
};
this.baseColors = [];
this.chartObj = null;
this.rectGeometry = AscFormat.ExecuteNoHistory(function(){return AscFormat.CreateGeometry("rect");}, this, []);
this.lockType = AscCommon.c_oAscLockTypes.kLockTypeNone;
......@@ -131,10 +129,6 @@ CChartSpace.prototype.recalcChart = function()
{
this.recalcInfo.recalculateChart = true;
};
CChartSpace.prototype.recalcBaseColors = function()
{
this.recalcInfo.recalculateBaseColors = true;
};
CChartSpace.prototype.recalcSeriesColors = function()
{
this.recalcInfo.recalculateSeriesColors = true;
......@@ -301,11 +295,6 @@ CChartSpace.prototype.recalculate = function()
this.recalculateBBox();
this.recalcInfo.recalculateBBox = false;
}
if(this.recalcInfo.recalculateBaseColors)
{
this.recalculateBaseColors();
this.recalcInfo.recalculateBaseColors = false;
}
if(this.recalcInfo.recalculateMarkers)
{
this.recalculateMarkers();
......
......@@ -87,11 +87,6 @@ CShape.prototype.Is_UseInDocument = function(){
return false;
};
CShape.prototype.isEmptyPlaceholder = function()
{
return false;
};
CShape.prototype.getTextArtPreviewManager = function()
{
return Asc["editor"].textArtPreviewManager;
......@@ -462,7 +457,8 @@ CShape.prototype.handleUpdateGeometry = function()
CShape.prototype.convertPixToMM = function(pix)
{
var drawingObjects = getDrawingObjects_Sp(this);
return drawingObjects ? drawingObjects.convertMetric(pix, 0, 3) : 0;
var _ret = drawingObjects ? drawingObjects.convertMetric(AscCommon.AscBrowser.convertToRetinaValue(pix, true), 0, 3) : 0;
return _ret;
};
CShape.prototype.getCanvasContext = function()
{
......
......@@ -1788,8 +1788,17 @@ CGraphics.prototype =
},
drawHorLine2 : function(align, y, x, r, penW)
{
if (!this.m_bIntegerGrid)
var _check_transform = global_MatrixTransformer.IsIdentity2(this.m_oTransform);
if (!this.m_bIntegerGrid || !_check_transform)
{
if (_check_transform)
{
this.SetIntegerGrid(true);
this.drawHorLine2(align, y, x, r, penW);
this.SetIntegerGrid(false);
return;
}
var _y1 = y - penW / 2;
var _y2 = _y1 + 2 * penW;
......
This diff is collapsed.
......@@ -459,7 +459,7 @@
cCOUPDAYSNC, cCOUPNCD, cCOUPNUM, cCOUPPCD, cCUMIPMT, cCUMPRINC, cDB, cDDB, cDISC, cDOLLARDE, cDOLLARFR,
cDURATION, cEFFECT, cFV, cFVSCHEDULE, cINTRATE, cIPMT, cIRR, cISPMT, cMDURATION, cMIRR, cNOMINAL, cNPER, cNPV,
cODDFPRICE, cODDFYIELD, cODDLPRICE, cODDLYIELD, cPMT, cPPMT, cPRICE, cPRICEDISC, cPRICEMAT, cPV, cRATE,
cRECEIVED, cSLN, cSYD, cTBILLEQ, cTBILLPRICE, cTBILLYIELD, cVDB, cXIRR, cXNPV, cYIELD, cYIELDDISC, cYIELDMAT);
cRECEIVED, cRRI, cSLN, cSYD, cTBILLEQ, cTBILLPRICE, cTBILLYIELD, cVDB, cXIRR, cXNPV, cYIELD, cYIELDDISC, cYIELDMAT);
/**
* @constructor
......@@ -4681,6 +4681,49 @@
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cRRI() {
this.name = "RRI";
this.value = null;
this.argumentsCurrent = 0;
}
cRRI.prototype = Object.create(cBaseFunction.prototype);
cRRI.prototype.constructor = cRRI;
cRRI.prototype.argumentsMin = 3;
cRRI.prototype.argumentsMax = 3;
cRRI.prototype.isXLFN = true;
cRRI.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 calcrpi = function(argArray){
var arg0 = argArray[0];
var arg1 = argArray[1];
var arg2 = argArray[2];
if ( arg0 <= 0.0 || arg1 === 0.0 ){
return new cError(cErrorType.not_numeric);
}
return new cNumber(Math.pow(arg2 / arg1, 1.0 / arg0) - 1.0);
};
return this.value = this._findArrayInNumberArguments(oArguments, calcrpi);
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......
......@@ -49,10 +49,11 @@
var cArray = AscCommonExcel.cArray;
var cBaseFunction = AscCommonExcel.cBaseFunction;
var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup;
var cElementType = AscCommonExcel.cElementType;
cFormulaFunctionGroup['Information'] = cFormulaFunctionGroup['Information'] || [];
cFormulaFunctionGroup['Information'].push(cERROR_TYPE, cISBLANK, cISERR, cISERROR, cISEVEN, cISLOGICAL, cISNA,
cISNONTEXT, cISNUMBER, cISODD, cISREF, cISTEXT, cN, cNA, cTYPE);
cFormulaFunctionGroup['Information'].push(cERROR_TYPE, cISBLANK, cISERR, cISERROR, cISEVEN, cISFORMULA, cISLOGICAL,
cISNA, cISNONTEXT, cISNUMBER, cISODD, cISREF, cISTEXT, cN, cNA, cSHEET, cSHEETS, cTYPE);
/**
* @constructor
......@@ -240,6 +241,38 @@
}
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cISFORMULA() {
this.name = "ISFORMULA";
this.value = null;
this.argumentsCurrent = 0;
}
cISFORMULA.prototype = Object.create(cBaseFunction.prototype);
cISFORMULA.prototype.constructor = cISFORMULA;
cISFORMULA.prototype.argumentsMin = 1;
cISFORMULA.prototype.argumentsMax = 1;
cISFORMULA.prototype.isXLFN = true;
cISFORMULA.prototype.Calculate = function (arg) {
//есть различия в поведении этой формулы для ms и lo(для нескольких ячеек с данными)
var arg0 = arg[0];
var res = false;
if ((arg0 instanceof cArea || arg0 instanceof cArea3D) && arg0.range) {
res = arg0.range.isFormula();
}else if ((arg0 instanceof cRef || arg0 instanceof cRef3D) && arg0.range) {
res = arg0.range.isFormula();
}
if (arg0 instanceof cError) {
return this.value = arg0;
}
return this.value = new cBool(res);
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -515,6 +548,97 @@
return this.value = new cError(cErrorType.not_available);
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cSHEET() {
this.name = "SHEET";
this.value = null;
this.argumentsCurrent = 0;
}
cSHEET.prototype = Object.create(cBaseFunction.prototype);
cSHEET.prototype.constructor = cSHEET;
cSHEET.prototype.argumentsMin = 0;
cSHEET.prototype.argumentsMax = 1;
cSHEET.prototype.isXLFN = true;
cSHEET.prototype.Calculate = function (arg, opt_bbox, opt_defName, ws) {
var res = null;
if(0 === arg.length){
res = new cNumber(ws.nSheetId);
}else{
var arg0 = arg[0];
if(cElementType.error === arg0.type){
res = arg0;
}else{
if(arg0.ws){
res = new cNumber(arg0.ws.nSheetId);
}else if(arg0.wsFrom){
var sheet1 = arg0.wsFrom.nSheetId;
var sheet2 = arg0.wsTo.nSheetId;
res = new cNumber(Math.min(sheet1, sheet2));
}else if(cElementType.string === arg0.type){
var arg0Val = arg0.getValue();
var curWorksheet = ws.workbook.getWorksheetByName(arg0Val);
if(curWorksheet && undefined !== curWorksheet.nSheetId){
res = new cNumber(curWorksheet.nSheetId);
}
}
}
}
if(null === res){
res = new cError(cErrorType.wrong_value_type);
}
return this.value = res;
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cSHEETS() {
this.name = "SHEETS";
this.value = null;
this.argumentsCurrent = 0;
}
cSHEETS.prototype = Object.create(cBaseFunction.prototype);
cSHEETS.prototype.constructor = cSHEETS;
cSHEETS.prototype.argumentsMin = 0;
cSHEETS.prototype.argumentsMax = 1;
cSHEETS.prototype.isXLFN = true;
cSHEETS.prototype.Calculate = function (arg, opt_bbox, opt_defName, ws) {
var res;
if(0 === arg.length){
res = new cNumber(ws.workbook.aWorksheets.length);
}else{
var arg0 = arg[0];
if(cElementType.error === arg0.type){
res = arg0;
}else if(cElementType.cellsRange === arg0.type || cElementType.cell === arg0.type || cElementType.cell3D === arg0.type){
res = new cNumber(1);
}else if(cElementType.cellsRange3D === arg0.type){
var sheet1 = arg0.wsFrom.index;
var sheet2 = arg0.wsTo.index;
if(sheet1 === sheet2){
res = new cNumber(1);
}else{
res = new cNumber(Math.abs(sheet2 - sheet1) + 1);
}
}else{
res = new cError(cErrorType.not_available);
}
}
return this.value = res;
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......
......@@ -48,9 +48,10 @@
var cArray = AscCommonExcel.cArray;
var cBaseFunction = AscCommonExcel.cBaseFunction;
var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup;
var cElementType = AscCommonExcel.cElementType;
cFormulaFunctionGroup['Logical'] = cFormulaFunctionGroup['Logical'] || [];
cFormulaFunctionGroup['Logical'].push(cAND, cFALSE, cIF, cIFERROR, cIFNA, cNOT, cOR, cTRUE, cXOR);
cFormulaFunctionGroup['Logical'].push(cAND, cFALSE, cIF, cIFERROR, cIFNA, cNOT, cOR, cSWITCH, cTRUE, cXOR);
/**
* @constructor
......@@ -170,17 +171,15 @@
arg2 = arg2.getElement(0);
}
arg0 = arg0.tocBool();
if (arg0 instanceof cError) {
return this.value = arg0;
} else if (arg0 instanceof cString) {
return this.value = new cError(cErrorType.wrong_value_type);
} else if (arg0.value) {
return this.value = arg1 ? arg1 instanceof cEmpty ? new cNumber(0) : arg1 : new cBool(true);
} else {
arg0 = arg0.tocBool();
if (arg0 instanceof cString) {
return this.value = new cError(cErrorType.wrong_value_type);
} else if (arg0.value) {
return this.value = arg1 ? arg1 instanceof cEmpty ? new cNumber(0) : arg1 : new cBool(true);
} else {
return this.value = arg2 ? arg2 instanceof cEmpty ? new cNumber(0) : arg2 : new cBool(false);
}
return this.value = arg2 ? arg2 instanceof cEmpty ? new cNumber(0) : arg2 : new cBool(false);
}
};
......@@ -359,6 +358,59 @@
return this.value = argResult;
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cSWITCH() {
this.name = "SWITCH";
this.value = null;
this.argumentsCurrent = 0;
}
cSWITCH.prototype = Object.create(cBaseFunction.prototype);
cSWITCH.prototype.constructor = cSWITCH;
cSWITCH.prototype.argumentsMin = 3;
cSWITCH.prototype.argumentsMax = 126;
cSWITCH.prototype.isXLFN = true;
cSWITCH.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1], true);
var argClone = oArguments.args;
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var arg0 = argClone[0].getValue();
if(cElementType.cell === argClone[0].type || cElementType.cell3D === argClone[0].type){
arg0 = arg0.getValue()
}
var res = null;
for(var i = 1; i < this.argumentsCurrent; i++){
var argN = argClone[i].getValue();
if(arg0 === argN){
if(!argClone[i + 1]){
return this.value = cErrorType.not_available;
}else{
res = argClone[i + 1];
break;
}
}
if(i === this.argumentsCurrent - 1){
res = argClone[i];
}
i++;
}
if(null === res){
return this.value = new cError(cErrorType.not_available);
}
return this.value = res;
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......
......@@ -404,28 +404,24 @@
} else if (cElementType.cellsRange === arg0.type) {
var ws = arg0.getWS(), bbox = arg0.getBBox0();
if (bbox.r1 == bbox.r2) {/*одна строка*/
res = ws.getRange3(bbox.r1, bbox.c1 + arg1 - 1, bbox.r1, bbox.c1 + arg1 - 1).getCells()[0].getName();
res = new cRef(res, ws);
if (bbox.r1 === bbox.r2) {/*одна строка*/
res = new Asc.Range(bbox.c1 + arg1 - 1, bbox.r1, bbox.c1 + arg1 - 1, bbox.r1);
res = new cRef(res.getName(), ws);
} else {
if (arg1 == 0 && arg2 > 0) {
var _a1 = ws.getRange3(bbox.r1, bbox.c1 + arg2 - 1, bbox.r1, bbox.c2 + arg2 - 1)
.getCells()[0].getName(), _a2 = ws.getRange3(bbox.r2, bbox.c1 + arg2 - 1, bbox.r2,
bbox.c2 + arg2 - 1)
.getCells()[0].getName();
res = new cArea(_a1.toString() + ":" + _a2.toString(), ws);
if (0 === arg1 && arg2 > 0) {
res = new Asc.Range(bbox.c1 + arg2 - 1, bbox.r1, bbox.c1 + arg2 - 1, bbox.r2);
res = new cArea(res.getName(), ws);
} else {
if (arg1 > Math.abs(bbox.r1 - bbox.r2) + 1 || arg2 > Math.abs(bbox.c1 - bbox.c2) + 1) {
res = new cError(cErrorType.bad_reference);
} else {
res = new cRef(ws.getRange3(bbox.r1 + arg1 - 1, bbox.c1 + arg2 - 1, bbox.r1 + arg1 - 1,
bbox.c1 + arg2 - 1)
.getCells()[0].getName(), ws);
res = new Asc.Range(bbox.c1 + arg2 - 1, bbox.r1 + arg1 - 1, bbox.c1 + arg2 - 1, bbox.r1 + arg1 - 1)
res = new cRef(res.getName(), ws);
}
}
}
} else if (cElementType.cell === arg0.type || cElementType.cell3D === arg0.type) {
if ((arg1 == 0 || arg1 == 1) && (arg2 == 0 || arg2 == 1)) {
if ((0 === arg1 || 1 === arg1) && (0 === arg2 || 1 === arg2)) {
res = arg0.getValue();
}
} else {
......@@ -782,14 +778,9 @@
bbox.r2 <= gc_nMaxRow0 && 0 <= bbox.c2 && bbox.c2 <= gc_nMaxCol0;
}
var arg0 = arg[0], arg1 = arg[1].tocNumber(), arg2 = arg[2].tocNumber(), arg3 = new cNumber(-1), arg4 = new cNumber(-1);
if (this.argumentsCurrent >= 4) {
arg3 = arg[3].tocNumber();
}
if (this.argumentsCurrent == 5) {
arg4 = arg[4].tocNumber();
}
var arg0 = arg[0], arg1 = arg[1].tocNumber(), arg2 = arg[2].tocNumber();
var arg3 = 3 < this.argumentsCurrent ? arg[3].tocNumber() : new cNumber(-1);
var arg4 = 5 === this.argumentsCurrent ? arg[4].tocNumber() : new cNumber(-1);
if (cElementType.error === arg1.type || cElementType.error === arg2.type || cElementType.error === arg3.type ||
arg4.type) {
......@@ -809,53 +800,35 @@
arg4 = 1;
}
if (cElementType.cell === arg0.type || cElementType.cell3D === arg0.type) {
if (cElementType.cell === arg0.type || cElementType.cell3D === arg0.type ||
cElementType.cellsRange === arg0.type || cElementType.cellsRange3D === arg0.type) {
var box = arg0.getBBox0();
if (box) {
box = box.clone(true);
var range = arg0.getRange(), bbox = range.getBBox0(), box = {r1: 0, r2: 0, c1: 0, c2: 0}, ref;
box.r2 = box.r1 + arg1 + arg3 - 1;
box.c2 = box.c1 + arg2 + arg4 - 1;
box.r1 = box.r1 + arg1;
box.c1 = box.c1 + arg2;
box.r1 = bbox.r1 + arg1;
box.c1 = bbox.c1 + arg2;
box.r2 = bbox.r1 + arg1 + arg3 - 1;
box.c2 = bbox.c1 + arg2 + arg4 - 1;
if (!validBBOX(box)) {
return this.value = new cError(cErrorType.bad_reference);
}
if (!validBBOX(box)) {
return this.value = new cError(cErrorType.bad_reference);
}
if (box.r1 == box.r2 && box.c1 == box.c2) {
ref = g_oCellAddressUtils.colnumToColstrFromWsView(box.c1 + 1) + _getRowTitle(box.r1);
this.value = (cElementType.cell === arg0.type) ? new cRef(ref, arg0.ws) : new cRef3D(ref, arg0.ws);
} else {
ref = g_oCellAddressUtils.colnumToColstrFromWsView(box.c1 + 1) + _getRowTitle(box.r1) + ":" +
g_oCellAddressUtils.colnumToColstrFromWsView(box.c2 + 1) + _getRowTitle(box.r2);
this.value =
(cElementType.cell === arg0.type) ? new cArea(ref, arg0.ws) : new cArea3D(ref, arg0.ws, arg0.ws);
var name = box.getName();
var ws = arg0.getWS();
var wsCell = arguments[3];
if (box.isOneCell()) {
this.value = wsCell === ws ? new cRef(name, ws) : new cRef3D(name, ws);
} else {
this.value = wsCell === ws ? new cArea(name, ws) : new cArea3D(name, ws, ws);
}
}
}
} else if (cElementType.cellsRange === arg0.type) {
var bbox = arg0.getBBox0(), box = {r1: 0, r2: 0, c1: 0, c2: 0}, ref;
box.r1 = bbox.r1 + arg1;
box.c1 = bbox.c1 + arg2;
box.r2 = bbox.r1 + arg1 + arg3 - 1;
box.c2 = bbox.c1 + arg2 + arg4 - 1;
if (!validBBOX(box)) {
return this.value = new cError(cErrorType.bad_reference);
}
if (box.r1 == box.r2 && box.c1 == box.c2) {
ref = g_oCellAddressUtils.colnumToColstrFromWsView(box.c1 + 1) + _getRowTitle(box.r1);
this.value = new cRef(ref, arg0.ws);
} else {
ref = g_oCellAddressUtils.colnumToColstrFromWsView(box.c1 + 1) + _getRowTitle(box.r1) + ":" +
g_oCellAddressUtils.colnumToColstrFromWsView(box.c2 + 1) + _getRowTitle(box.r2);
this.value = new cArea(ref, arg0.ws);
}
} else {
if (!this.value) {
this.value = new cError(cErrorType.wrong_value_type);
}
return this.value;
};
......
This diff is collapsed.
......@@ -57,9 +57,10 @@
var cFormulaFunctionGroup = AscCommonExcel.cFormulaFunctionGroup;
cFormulaFunctionGroup['TextAndData'] = cFormulaFunctionGroup['TextAndData'] || [];
cFormulaFunctionGroup['TextAndData'].push(cASC, cBAHTTEXT, cCHAR, cCLEAN, cCODE, cCONCATENATE, cCONCAT, cDOLLAR, cEXACT,
cFIND, cFINDB, cFIXED, cJIS, cLEFT, cLEFTB, cLEN, cLENB, cLOWER, cMID, cMIDB, cNUMBERVALUE, cPHONETIC, cPROPER, cREPLACE,
cREPLACEB, cREPT, cRIGHT, cRIGHTB, cSEARCH, cSEARCHB, cSUBSTITUTE, cT, cTEXT, cTRIM, cUPPER, cVALUE);
cFormulaFunctionGroup['TextAndData'].push(cASC, cBAHTTEXT, cCHAR, cCLEAN, cCODE, cCONCATENATE, cCONCAT, cDOLLAR,
cEXACT, cFIND, cFINDB, cFIXED, cJIS, cLEFT, cLEFTB, cLEN, cLENB, cLOWER, cMID, cMIDB, cNUMBERVALUE, cPHONETIC,
cPROPER, cREPLACE, cREPLACEB, cREPT, cRIGHT, cRIGHTB, cSEARCH, cSEARCHB, cSUBSTITUTE, cT, cTEXT, cTEXTJOIN,
cTRIM, cUNICHAR, cUNICODE, cUPPER, cVALUE);
cFormulaFunctionGroup['NotRealised'] = cFormulaFunctionGroup['NotRealised'] || [];
cFormulaFunctionGroup['NotRealised'].push(cASC, cBAHTTEXT, cJIS, cPHONETIC);
......@@ -1789,6 +1790,93 @@
return this.value;
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cTEXTJOIN() {
this.name = "TEXTJOIN";
this.value = null;
this.argumentsCurrent = 0;
}
cTEXTJOIN.prototype = Object.create(cBaseFunction.prototype);
cTEXTJOIN.prototype.constructor = cTEXTJOIN;
cTEXTJOIN.prototype.argumentsMin = 3;
cTEXTJOIN.prototype.argumentsMax = 255;
cTEXTJOIN.prototype.numFormat = AscCommonExcel.cNumFormatNone;
cTEXTJOIN.prototype.isXLFN = true;
cTEXTJOIN.prototype.Calculate = function (arg) {
var argClone = [arg[0], arg[1]];
argClone[1] = arg[1].tocBool();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
var ignore_empty = argClone[1].toBool();
var delimiter = argClone[0];
var delimiterIter = 0;
//разделитель может быть в виде массива, где используются все его элементы
var delimiterArr = this._getOneDimensionalArray(delimiter);
//если хотя бы один элемент ошибка, то возвращаем ошибку
if(delimiterArr instanceof cError){
return this.value = delimiterArr;
}
var concatString = function(string1, string2){
var res = string1;
if("" === string2 && ignore_empty){
return res;
}
var isStartStr = string1 === "";
//выбираем разделитель из массива по порядку
var delimiterStr = isStartStr ? "" : delimiterArr[delimiterIter];
if(undefined === delimiterStr){
delimiterIter = 0;
delimiterStr = delimiterArr[delimiterIter];
}
if(!isStartStr){
delimiterIter++;
}
res += delimiterStr + string2;
return res;
};
var arg0 = new cString(""), argI;
for (var i = 2; i < this.argumentsCurrent; i++) {
argI = arg[i];
var type = argI.type;
if(cElementType.cellsRange === type || cElementType.cellsRange3D === type || cElementType.array === type){
//получаем одномерный массив
argI = this._getOneDimensionalArray(argI);
//если хотя бы один элемент с ошибкой, возвращаем ошибку
if (argI instanceof cError) {
return this.value = argI;
}
for (var n = 0; n < argI.length; n++) {
arg0 = new cString(concatString(arg0.toString(), argI[n].toString()));
}
}else{
argI = argI.tocString();
if (argI instanceof cError) {
return this.value = argI;
}
arg0 = new cString(concatString(arg0.toString(), argI.toString()));
}
}
return this.value = arg0;
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......@@ -1825,6 +1913,85 @@
}).replace(/^\s|\s$/g, ""))
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cUNICHAR() {
this.name = "UNICHAR";
this.value = null;
this.argumentsCurrent = 0;
}
cUNICHAR.prototype = Object.create(cBaseFunction.prototype);
cUNICHAR.prototype.constructor = cUNICHAR;
cUNICHAR.prototype.argumentsMin = 1;
cUNICHAR.prototype.argumentsMax = 1;
cUNICHAR.prototype.isXLFN = true;
cUNICHAR.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1]);
var argClone = oArguments.args;
argClone[0] = argClone[0].tocNumber();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
function _func(argArray) {
var num = parseInt(argArray[0]);
if(isNaN(num) || num <= 0 || num > 1114111){
return new cError(cErrorType.wrong_value_type);
}
var res = String.fromCharCode(num);
if("" === res){
return new cError(cErrorType.wrong_value_type);
}
return new cString(res);
}
return this.value = this._findArrayInNumberArguments(oArguments, _func, true);
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
*/
function cUNICODE() {
this.name = "UNICODE";
this.value = null;
this.argumentsCurrent = 0;
}
cUNICODE.prototype = Object.create(cBaseFunction.prototype);
cUNICODE.prototype.constructor = cUNICODE;
cUNICODE.prototype.argumentsMin = 1;
cUNICODE.prototype.argumentsMax = 1;
cUNICODE.prototype.isXLFN = true;
cUNICODE.prototype.Calculate = function (arg) {
var oArguments = this._prepareArguments(arg, arguments[1]);
var argClone = oArguments.args;
argClone[0] = argClone[0].tocString();
var argError;
if (argError = this._checkErrorArg(argClone)) {
return this.value = argError;
}
function _func(argArray) {
var str = argArray[0].toString();
var res = str.charCodeAt(0);
return new cNumber(res);
}
return this.value = this._findArrayInNumberArguments(oArguments, _func, true);
};
/**
* @constructor
* @extends {AscCommonExcel.cBaseFunction}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -1326,7 +1326,7 @@
}
if (opt.fragments.length > 0) {
t.textRender.render(t._getContentLeft(), dy || 0, t._getContentWidth(), opt.textColor);
t.textRender.render(undefined, t._getContentLeft(), dy || 0, t._getContentWidth(), opt.textColor);
}
};
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -67,3 +67,5 @@ function pointerup(){}
function MSPointerDown(){}
function MSPointerMove(){}
function MSPointerUp(){}
var editor;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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