Commit 8399a844 authored by GoshaZotov's avatar GoshaZotov

Merge branch 'release/v4.1.0' into develop

parents 326d50b3 40de021f
......@@ -2104,6 +2104,43 @@
return isUpdate ? range : null;
},
afterMoveAutoFilters: function(arnFrom, arnTo)
{
//если переносим часть ф/т, применяем стиль к ячейкам arnTo
//todo пересмотреть перенос ячеек из ф/т. скорее всего нужно будет внести правки со стилями внутри moveRange
var worksheet = this.worksheet;
var intersectionRangeWithTablePartsFrom = this._intersectionRangeWithTableParts(arnFrom);
var intersectionRangeWithTablePartsTo = this._intersectionRangeWithTableParts(arnTo);
if(intersectionRangeWithTablePartsFrom && intersectionRangeWithTablePartsFrom.length === 1 && intersectionRangeWithTablePartsTo === false)
{
var refTable = intersectionRangeWithTablePartsFrom[0] ? intersectionRangeWithTablePartsFrom[0].Ref : null;
if(refTable && !arnFrom.containsRange(refTable))
{
var intersection = refTable.intersection(arnFrom);
//проходимся по всем ячейкам
var cell, cellTo;
var diffRow = arnTo.r1 - arnFrom.r1;
var diffCol = arnTo.c1 - arnFrom.c1;
for(var i = intersection.r1; i <= intersection.r2; i++)
{
for(var j = intersection.c1; j <= intersection.c2; j++)
{
cell = worksheet._getCell(i, j);
cellTo = worksheet._getCell(i + diffRow, j + diffCol);
var xfsTo = cellTo.getCompiledStyle();
if(null === xfsTo)
{
var xfsFrom = cell.getCompiledStyle();
cellTo.setStyle(xfsFrom);
}
}
}
}
}
},
//if active range intersect even a part tablePart(for insert(delete) cells)
isActiveCellsCrossHalfFTable: function(activeCells, val, prop)
{
......@@ -4472,8 +4509,6 @@
var diffCol = arnTo.c1 - arnFrom.c1;
var diffRow = arnTo.r1 - arnFrom.r1;
var applyStyleByCells = true;
if(!copyRange)
{
var findFilters = this._searchFiltersInRange(arnFrom);
......@@ -4500,7 +4535,6 @@
this._openHiddenRows(findFilters[i]);
}
applyStyleByCells = false;
}
//TODO пока будем всегда чистить фильтры, которые будут в месте вставки. Позже сделать аналогично MS либо пересмотреть все возможные ситуации.
......@@ -4515,26 +4549,6 @@
if(!(arnTo.r1 === ref.r1 && arnTo.c1 === ref.c1) && !arnFrom.containsRange(ref))
this.isEmptyAutoFilters(ref, null, findFilters);
}
applyStyleByCells = false;
}
}
if(applyStyleByCells)
{
var intersectionRangeWithTablePartsFrom = this._intersectionRangeWithTableParts(arnFrom);
var intersectionRangeWithTablePartsTo = this._intersectionRangeWithTableParts(arnTo);
if(intersectionRangeWithTablePartsFrom && intersectionRangeWithTablePartsFrom.length === 1 && intersectionRangeWithTablePartsTo === false)
{
//проходимся по всем ячейкам
var cell;
for(var i = arnFrom.r1; i <= arnFrom.r2; i++)
{
for(var j = arnFrom.c1; j <= arnFrom.c2; j++)
{
cell = worksheet._getCell(i, j);
cell.setStyle(cell.compiledXfs);
}
}
}
}
},
......
......@@ -882,6 +882,7 @@
}
}
this.handlers.trigger("asc_onSelectionChanged", info);
this.handlers.trigger("asc_onSelectionEnd");
};
......
......@@ -8819,6 +8819,8 @@
t.model.autoFilters.renameTableColumn( arnFrom );
t.model.autoFilters.renameTableColumn( arnTo );
t.model.autoFilters.reDrawFilter( arnFrom );
t.model.autoFilters.afterMoveAutoFilters( arnFrom, arnTo );
History.EndTransaction();
......
......@@ -3689,7 +3689,7 @@ CShape.prototype.hitInTextRectWord = function(x, y)
{
var content = this.getDocContent && this.getDocContent();
if (content)
if (content && this.invertTransform)
{
var t_x, t_y;
t_x = this.invertTransform.TransformPointX(x, y);
......@@ -4806,7 +4806,7 @@ CShape.prototype.hitToAdjustment = function (x, y) {
return ret;
}
}
if(this.recalcInfo.warpGeometry)
if(this.recalcInfo.warpGeometry && this.invertTransformTextWordArt)
{
invert_transform = this.invertTransformTextWordArt;
t_x = invert_transform.TransformPointX(x, y);
......
......@@ -37,8 +37,8 @@ AscCommon.baseEditorsApi.prototype._onEndPermissions = function()
if (this.isOnFirstConnectEnd && this.isOnLoadLicense)
{
var oResult = new AscCommon.asc_CAscEditorPermissions();
oResult.asc_setCanLicense(true);
oResult.asc_setCanBranding(true);
oResult.setCanLicense(true);
oResult.setCanBranding(true);
this.sendEvent('asc_onGetEditorPermissions', oResult);
}
};
\ No newline at end of file
......@@ -32,96 +32,15 @@
"use strict";
var g_oLicenseResult = {
Error : 1,
Expired : 2,
Success : 3,
UnknownUser : 4,
Connections : 5
};
var g_sLicenseDefaultUrl = "/license";
var g_sPublicRSAKey = '-----BEGIN CERTIFICATE-----MIIBvTCCASYCCQD55fNzc0WF7TANBgkqhkiG9w0BAQUFADAjMQswCQYDVQQGEwJKUDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwHhcNMTAwNTI4MDIwODUxWhcNMjAwNTI1MDIwODUxWjAjMQswCQYDVQQGEwJKUDEUMBIGA1UEChMLMDAtVEVTVC1SU0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANGEYXtfgDRlWUSDn3haY4NVVQiKI9CzThoua9+DxJuiseyzmBBe7Roh1RPqdvmtOHmEPbJ+kXZYhbozzPRbFGHCJyBfCLzQfVos9/qUQ88u83b0SFA2MGmQWQAlRtLy66EkR4rDRwTj2DzR4EEXgEKpIvo8VBs/3+sHLF3ESgAhAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEAEZ6mXFFq3AzfaqWHmCy1ARjlauYAa8ZmUFnLm0emg9dkVBJ63aEqARhtok6bDQDzSJxiLpCEF6G4b/Nv/M/MLyhP+OoOTmETMegAVQMq71choVJyOFE5BtQa6M/lCHEOya5QUfoRF2HF9EjRF44K3OK+u3ivTSj3zwjtpudY5Xo=-----END CERTIFICATE-----';
function CheckLicense(licenseUrl, customerId, userId, userFirstName, userLastName, callback) {
callback(true, g_oLicenseResult.Success);
return;
licenseUrl = licenseUrl ? licenseUrl : g_sLicenseDefaultUrl;
g_fGetJSZipUtils().getBinaryContent(licenseUrl, function(err, data) {
if (err) {
callback(true, g_oLicenseResult.Error);
return;
}
try {
var tmpSize;
var maxSize = 0x4000;
var sTextData = '';
for (var i = 0; i < data.byteLength; i += maxSize) {
tmpSize = data.byteLength - i;
sTextData += String.fromCharCode.apply(null, new Uint8Array(data, i, (tmpSize < maxSize) ? tmpSize : maxSize));
}
var oLicense = JSON.parse(sTextData);
var hSig = oLicense['signature'];
delete oLicense['signature'];
var x509 = new X509();
x509.readCertPEM(g_sPublicRSAKey);
var isValid = x509.subjectPublicKeyRSA.verifyString(JSON.stringify(oLicense), hSig);
callback(false, isValid ? CheckUserInLicense(customerId, userId, userFirstName, userLastName, oLicense) : g_oLicenseResult.Error);
} catch (e) {
callback(true, g_oLicenseResult.Error);
}
});
}
/**
*
* @param customerId
* @param userId
* @param userFirstName
* @param userLastName
* @param oLicense
* @returns {boolean}
*/
function CheckUserInLicense(customerId, userId, userFirstName, userLastName, oLicense) {
var res = g_oLicenseResult.Error;
var superuser = 'onlyoffice';
try {
if (oLicense['users']) {
var userName = (null == userFirstName ? '' : userFirstName) + (null == userLastName ? '' : userLastName);
var sUserHash = CryptoJS.SHA256(userId + userName).toString(CryptoJS.enc.Hex).toLowerCase();
var checkUserHash = false;
if (customerId === oLicense['customer_id'] || oLicense['customer_id'] === (sUserHash = superuser)) {
// users для новой версии - массив
checkUserHash = (-1 !== oLicense['users'].indexOf(sUserHash));
res = g_oLicenseResult.UnknownUser;
}
if (checkUserHash) {
var endDate = new Date(oLicense['end_date']);
res = (endDate >= new Date()) ? g_oLicenseResult.Success : g_oLicenseResult.Expired;
}
}
} catch (e) {
res = g_oLicenseResult.Error;
}
return res;
}
AscCommon.baseEditorsApi.prototype._onCheckLicenseEnd = function(err, res) {
this.licenseResult = {err: err, res: res};
this._onEndPermissions();
};
AscCommon.baseEditorsApi.prototype._onEndPermissions = function () {
if (this.isOnFirstConnectEnd && this.isOnLoadLicense) {
var oResult = new AscCommon.asc_CAscEditorPermissions();
if (null !== this.licenseResult) {
var type = this.licenseResult['type'];
oResult.asc_setCanLicense(g_oLicenseResult.Success === type);
oResult.asc_setCanBranding(g_oLicenseResult.Error !== type); // Для тех, у кого есть лицензия, branding доступен
oResult.asc_setCanBranding(g_oLicenseResult.Error !== type); // Для тех, у кого есть лицензия, branding доступен
oResult.asc_setIsLight(this.licenseResult['light']);
oResult.setLicenseType(type);
oResult.setCanLicense(Asc.c_oLicenseResult.Success === type);
oResult.setCanBranding(Asc.c_oLicenseResult.Error !== type); // Для тех, у кого есть лицензия, branding доступен
oResult.setIsLight(this.licenseResult['light']);
}
this.sendEvent('asc_onGetEditorPermissions', oResult);
}
......
This diff is collapsed.
......@@ -3160,7 +3160,11 @@ CPresentation.prototype =
// Возвращаем выделенный текст, если в выделении не более 1 параграфа, и там нет картинок, нумерации страниц и т.д.
Get_SelectedText : function(bClearText)
{
return this.Slides[this.CurPage].graphicObjects.Get_SelectedText(bClearText);
if(this.Slides[this.CurPage]){
return this.Slides[this.CurPage].graphicObjects.Get_SelectedText(bClearText);
}
return "";
},
//-----------------------------------------------------------------------------------
......
......@@ -854,7 +854,7 @@ CShape.prototype.checkPosTransformText = function()
};
CShape.prototype.getNearestPos = function(x, y, pageIndex)
{
if(isRealObject(this.textBoxContent))
if(isRealObject(this.textBoxContent) && this.invertTransformText)
{
var t_x = this.invertTransformText.TransformPointX(x, y);
var t_y = this.invertTransformText.TransformPointY(x, y);
......@@ -883,7 +883,7 @@ CShape.prototype.cursorGetPos = function()
CShape.prototype.cursorMoveAt = function( X, Y, AddToSelect )
{
var content = this.getDocContent();
if(isRealObject(content))
if(isRealObject(content) && this.invertTransformText)
{
var t_x = this.invertTransformText.TransformPointX(X, Y);
var t_y = this.invertTransformText.TransformPointY(X, Y);
......
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