3.0 source code
This commit is contained in:
@@ -1,65 +1,65 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.Document", {
|
||||
extend: "Ext.app.Controller",
|
||||
init: function () {},
|
||||
launch: function () {
|
||||
Ext.getCmp("id-conteiner-document").on("resize", this.onEditorResize, this);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onShowPopMenu", Ext.bind(this.onApiShowPopMenu, this));
|
||||
this.api.asc_registerCallback("asc_onHidePopMenu", Ext.bind(this.onApiHidePopMenu, this));
|
||||
}
|
||||
},
|
||||
onEditorResize: function (cmp) {
|
||||
if (this.api) {
|
||||
this.api.Resize();
|
||||
this.onApiHidePopMenu();
|
||||
}
|
||||
},
|
||||
onApiShowPopMenu: function (posX, posY) {
|
||||
var popClipCmp = Ext.ComponentQuery.query("popclip");
|
||||
if (popClipCmp.length > 0) {
|
||||
popClipCmp[0].setLeft(posX);
|
||||
popClipCmp[0].setTop(posY);
|
||||
popClipCmp[0].show();
|
||||
}
|
||||
},
|
||||
onApiHidePopMenu: function () {
|
||||
var popClipCmp = Ext.ComponentQuery.query("popclip");
|
||||
if (popClipCmp.length > 0) {
|
||||
popClipCmp[0].hide();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.Document", {
|
||||
extend: "Ext.app.Controller",
|
||||
init: function () {},
|
||||
launch: function () {
|
||||
Ext.getCmp("id-conteiner-document").on("resize", this.onEditorResize, this);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onShowPopMenu", Ext.bind(this.onApiShowPopMenu, this));
|
||||
this.api.asc_registerCallback("asc_onHidePopMenu", Ext.bind(this.onApiHidePopMenu, this));
|
||||
}
|
||||
},
|
||||
onEditorResize: function (cmp) {
|
||||
if (this.api) {
|
||||
this.api.Resize();
|
||||
this.onApiHidePopMenu();
|
||||
}
|
||||
},
|
||||
onApiShowPopMenu: function (posX, posY) {
|
||||
var popClipCmp = Ext.ComponentQuery.query("popclip");
|
||||
if (popClipCmp.length > 0) {
|
||||
popClipCmp[0].setLeft(posX);
|
||||
popClipCmp[0].setTop(posY);
|
||||
popClipCmp[0].show();
|
||||
}
|
||||
},
|
||||
onApiHidePopMenu: function () {
|
||||
var popClipCmp = Ext.ComponentQuery.query("popclip");
|
||||
if (popClipCmp.length > 0) {
|
||||
popClipCmp[0].hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,320 +1,320 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.Main", {
|
||||
extend: "Ext.app.Controller",
|
||||
editMode: false,
|
||||
requires: ["Ext.Anim", "Ext.LoadMask", "Ext.MessageBox"],
|
||||
launch: function () {
|
||||
if (!this._isSupport()) {
|
||||
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
|
||||
return;
|
||||
}
|
||||
this.initControl();
|
||||
var api = this.api,
|
||||
app = this.getApplication();
|
||||
api = new asc_docs_api("id-sdkeditor");
|
||||
api.SetMobileVersion(true);
|
||||
api.CreateComponents();
|
||||
api.SetFontsPath("../../../sdk/Fonts/");
|
||||
api.Init();
|
||||
api.initEvents2MobileAdvances();
|
||||
api.asc_registerCallback("asc_onStartAction", Ext.bind(this.onLongActionBegin, this));
|
||||
api.asc_registerCallback("asc_onError", Ext.bind(this.onError, this));
|
||||
api.asc_registerCallback("asc_onEndAction", Ext.bind(this.onLongActionEnd, this));
|
||||
api.asc_registerCallback("asc_onDocumentContentReady", Ext.bind(this.onDocumentContentReady, this));
|
||||
api.asc_registerCallback("asc_onOpenDocumentProgress2", Ext.bind(this.onOpenDocument, this));
|
||||
api.asc_registerCallback("asc_onSaveUrl", Ext.bind(this.onSaveUrl, this));
|
||||
api.asc_registerCallback("asc_onGetEditorPermissions", Ext.bind(this.onEditorPermissions, this));
|
||||
Ext.each(app.getControllers(), function (controllerName) {
|
||||
var controller = this.getApplication().getController(controllerName);
|
||||
controller && Ext.isFunction(controller.setApi) && controller.setApi(api);
|
||||
},
|
||||
this);
|
||||
this.initApi();
|
||||
this.editorConfig = {};
|
||||
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
|
||||
Common.Gateway.on("opendocument", Ext.bind(this.loadDocument, this));
|
||||
Common.Gateway.on("showmessage", Ext.bind(this.onExternalMessage, this));
|
||||
Common.Gateway.on("resetfocus", Ext.bind(this.onResetFocus, this));
|
||||
Common.Gateway.on("processsaveresult", Ext.bind(this.onProcessSaveResult, this));
|
||||
Common.Gateway.on("processrightschange", Ext.bind(this.onProcessRightsChange, this));
|
||||
Common.Gateway.ready();
|
||||
},
|
||||
initControl: function () {},
|
||||
initApi: function () {},
|
||||
loadConfig: function (data) {
|
||||
this.editorConfig = Ext.merge(this.editorConfig, data.config);
|
||||
if ((this.editorConfig.user === undefined || this.editorConfig.user === null)) {
|
||||
this.editorConfig.user = {};
|
||||
if (this.editorConfig.users) {
|
||||
this.editorConfig.userId = this.editorConfig.userId || 0;
|
||||
for (var i = 0; i < this.editorConfig.users.length; i++) {
|
||||
if (this.editorConfig.users[i].id === this.editorConfig.userId) {
|
||||
this.editorConfig.user = {
|
||||
id: this.editorConfig.users[i].id,
|
||||
name: this.editorConfig.users[i].username
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.editorConfig.user.id = this.editorConfig.user.id || ("uid-" + Ext.Date.now());
|
||||
this.editorConfig.user.name = this.editorConfig.user.name || this.textAnonymous;
|
||||
},
|
||||
loadDocument: function (data) {
|
||||
if (data.doc) {
|
||||
this.permissions = data.doc.permissions;
|
||||
var docInfo = new CDocInfo();
|
||||
docInfo.put_Id(data.doc.key);
|
||||
docInfo.put_Url(data.doc.url);
|
||||
docInfo.put_Title(data.doc.title);
|
||||
docInfo.put_Format(data.doc.fileType);
|
||||
docInfo.put_VKey(data.doc.vkey);
|
||||
docInfo.put_Options(data.doc.options);
|
||||
docInfo.put_UserId(this.editorConfig.user.id);
|
||||
docInfo.put_UserName(this.editorConfig.user.name);
|
||||
this.api.asc_setDocInfo(docInfo);
|
||||
this.api.asc_getEditorPermissions();
|
||||
Common.component.Analytics.trackEvent("Load", "Start");
|
||||
}
|
||||
},
|
||||
onEditorPermissions: function (params) {
|
||||
this.permissions.edit !== false && (this.permissions.edit = params.asc_getCanEdit());
|
||||
this.permissions.reader !== false && (this.permissions.reader = params.asc_getCanReaderMode());
|
||||
var profile = this.getApplication().getCurrentProfile(),
|
||||
deviceController = this.getApplication().getController("Main", profile ? profile.getNamespace() : null),
|
||||
editMode = (this.permissions.edit === true && this.editorConfig.mode !== "view"),
|
||||
readerMode = this.permissions.reader === true;
|
||||
if (deviceController) {
|
||||
if (Ext.os.is.Phone) {
|
||||
if (readerMode) {
|
||||
this.api.SetReaderModeOnly();
|
||||
editMode = false;
|
||||
}
|
||||
}
|
||||
if (Ext.isFunction(deviceController.setMode)) {
|
||||
deviceController.setMode(editMode ? "edit" : "view");
|
||||
}
|
||||
if (Ext.isFunction(deviceController.setReadableMode)) {
|
||||
deviceController.setReadableMode(readerMode);
|
||||
}
|
||||
}
|
||||
this.api.SetViewMode(!editMode);
|
||||
this.api.LoadDocument();
|
||||
this.api.Resize();
|
||||
},
|
||||
goBack: function () {
|
||||
Common.Gateway.goBack();
|
||||
},
|
||||
onDocumentContentReady: function () {
|
||||
if (this.api) {
|
||||
this.api.Resize();
|
||||
this.api.zoomFitToWidth();
|
||||
}
|
||||
this._hideLoadSplash();
|
||||
Common.component.Analytics.trackEvent("Load", "Complete");
|
||||
},
|
||||
onOpenDocument: function (progress) {
|
||||
var elem = document.getElementById("loadmask-text");
|
||||
if (elem) {
|
||||
elem.innerHTML = this.loadingDocText + ": " + Math.round(progress) + "%";
|
||||
}
|
||||
},
|
||||
onSaveUrl: function (url) {
|
||||
Common.Gateway.save(url);
|
||||
},
|
||||
onLongActionBegin: function (type, id) {
|
||||
var text = "";
|
||||
switch (id) {
|
||||
case c_oAscAsyncAction["Save"]:
|
||||
text = this.saveText;
|
||||
break;
|
||||
case c_oAscAsyncAction["Print"]:
|
||||
text = this.printText;
|
||||
}
|
||||
if (type == c_oAscAsyncActionType["BlockInteraction"]) {
|
||||
Ext.Viewport.setMasked({
|
||||
xtype: "loadmask",
|
||||
message: text
|
||||
});
|
||||
}
|
||||
},
|
||||
onLongActionEnd: function (type) {
|
||||
Ext.Viewport.unmask();
|
||||
},
|
||||
onError: function (id, level, errData) {
|
||||
this._hideLoadSplash();
|
||||
var config = {
|
||||
closable: false
|
||||
};
|
||||
switch (id) {
|
||||
case c_oAscError.ID.Unknown:
|
||||
config.message = this.unknownErrorText;
|
||||
break;
|
||||
case c_oAscError.ID.ConvertationTimeout:
|
||||
config.message = this.convertationTimeoutText;
|
||||
break;
|
||||
case c_oAscError.ID.ConvertationError:
|
||||
config.message = this.convertationErrorText;
|
||||
break;
|
||||
case c_oAscError.ID.DownloadError:
|
||||
config.message = this.downloadErrorText;
|
||||
break;
|
||||
case c_oAscError.ID.UplImageSize:
|
||||
config.message = this.uploadImageSizeMessage;
|
||||
break;
|
||||
case c_oAscError.ID.UplImageExt:
|
||||
config.message = this.uploadImageExtMessage;
|
||||
break;
|
||||
case c_oAscError.ID.UplImageFileCount:
|
||||
config.message = this.uploadImageFileCountMessage;
|
||||
break;
|
||||
case c_oAscError.ID.SplitCellMaxRows:
|
||||
config.message = this.splitMaxRowsErrorText.replace("%1", errData.get_Value());
|
||||
break;
|
||||
case c_oAscError.ID.SplitCellMaxCols:
|
||||
config.message = this.splitMaxColsErrorText.replace("%1", errData.get_Value());
|
||||
break;
|
||||
case c_oAscError.ID.SplitCellRowsDivider:
|
||||
config.message = this.splitDividerErrorText.replace("%1", errData.get_Value());
|
||||
break;
|
||||
case c_oAscError.ID.VKeyEncrypt:
|
||||
config.message = this.errorKeyEncrypt;
|
||||
break;
|
||||
case c_oAscError.ID.KeyExpire:
|
||||
config.message = this.errorKeyExpire;
|
||||
break;
|
||||
case c_oAscError.ID.UserCountExceed:
|
||||
config.message = this.errorUsersExceed;
|
||||
break;
|
||||
case c_oAscError.ID.CoAuthoringDisconnect:
|
||||
config.message = this.errorCoAuthoringDisconnect;
|
||||
break;
|
||||
case c_oAscError.ID.MobileUnexpectedCharCount:
|
||||
config.message = this.errorDocTooBig;
|
||||
config.out = true;
|
||||
break;
|
||||
default:
|
||||
config.message = this.errorDefaultMessage.replace("%1", id);
|
||||
break;
|
||||
}
|
||||
if (level == c_oAscError.Level.Critical) {
|
||||
Common.Gateway.reportError(id, config.message);
|
||||
config.title = this.criticalErrorTitle;
|
||||
config.message += "<br/>" + this.criticalErrorExtText;
|
||||
config.buttons = Ext.Msg.OK;
|
||||
config.fn = function (btn) {
|
||||
if (btn == "ok") {
|
||||
if (config.out === true) {
|
||||
Common.Gateway.goBack();
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
config.title = this.notcriticalErrorTitle;
|
||||
config.buttons = Ext.Msg.OK;
|
||||
config.fn = Ext.emptyFn;
|
||||
}
|
||||
Ext.Msg.show(config);
|
||||
Common.component.Analytics.trackEvent("Internal Error", id.toString());
|
||||
},
|
||||
onExternalMessage: function (msg) {
|
||||
if (msg) {
|
||||
this._hideLoadSplash();
|
||||
Ext.Msg.show({
|
||||
title: msg.title,
|
||||
msg: "<br/>" + msg.msg,
|
||||
icon: Ext.Msg[msg.severity.toUpperCase()],
|
||||
buttons: Ext.Msg.OK
|
||||
});
|
||||
Common.component.Analytics.trackEvent("External Error", msg.title);
|
||||
}
|
||||
},
|
||||
onResetFocus: function (data) {
|
||||
var activeElement = document.activeElement;
|
||||
activeElement.focus();
|
||||
},
|
||||
onProcessSaveResult: function (data) {
|
||||
this.api && this.api.asc_OnSaveEnd(data.result);
|
||||
},
|
||||
onProcessRightsChange: function (data) {
|
||||
if (this.api && data && data.enabled === false) {
|
||||
this.api.asc_coAuthoringDisconnect();
|
||||
}
|
||||
},
|
||||
_hideLoadSplash: function () {
|
||||
var preloader = Ext.get("loading-mask");
|
||||
if (preloader) {
|
||||
Ext.Anim.run(preloader, "fade", {
|
||||
out: true,
|
||||
duration: 250,
|
||||
after: function () {
|
||||
preloader.destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
_isSupport: function () {
|
||||
return (Ext.browser.is.WebKit && (Ext.os.is.iOS || Ext.os.is.Android || Ext.os.is.Desktop));
|
||||
},
|
||||
loadingDocText: "LOADING DOCUMENT",
|
||||
saveText: "Saving...",
|
||||
printText: "Printing...",
|
||||
criticalErrorTitle: "Error",
|
||||
notcriticalErrorTitle: "Warning",
|
||||
errorDefaultMessage: "Error code: %1",
|
||||
criticalErrorExtText: 'Press "Ok" to reload view page.',
|
||||
uploadImageSizeMessage: "Maximium image size limit exceeded.",
|
||||
uploadImageExtMessage: "Unknown image format.",
|
||||
uploadImageFileCountMessage: "No images uploaded.",
|
||||
reloadButtonText: "Reload Page",
|
||||
unknownErrorText: "Unknown error.",
|
||||
convertationTimeoutText: "Convertation timeout exceeded.",
|
||||
convertationErrorText: "Convertation failed.",
|
||||
downloadErrorText: "Download failed.",
|
||||
unsupportedBrowserErrorText: "Your browser is not supported.",
|
||||
splitMaxRowsErrorText: "The number of rows must be less than %1",
|
||||
splitMaxColsErrorText: "The number of columns must be less than %1",
|
||||
splitDividerErrorText: "The number of rows must be a divisor of %1",
|
||||
requestEditRightsText: "Requesting editing rights...",
|
||||
requestEditFailedTitleText: "Access denied",
|
||||
requestEditFailedMessageText: "Someone is editing this document right now. Please try again later.",
|
||||
errorKeyEncrypt: "Unknown key descriptor",
|
||||
errorKeyExpire: "Key descriptor expired",
|
||||
errorUsersExceed: "Count of users was exceed",
|
||||
errorCoAuthoringDisconnect: "Server connection lost. You can't edit anymore.",
|
||||
errorDocTooBig: "The document you are trying to open has more than 30000 characters or 1000 paragraphs in it and cannot by opened on your mobile device. Please try open it using a desktop PC.",
|
||||
textAnonymous: "Anonymous"
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.Main", {
|
||||
extend: "Ext.app.Controller",
|
||||
editMode: false,
|
||||
requires: ["Ext.Anim", "Ext.LoadMask", "Ext.MessageBox"],
|
||||
launch: function () {
|
||||
if (!this._isSupport()) {
|
||||
Common.Gateway.reportError(undefined, this.unsupportedBrowserErrorText);
|
||||
return;
|
||||
}
|
||||
this.initControl();
|
||||
var api = this.api,
|
||||
app = this.getApplication();
|
||||
api = new asc_docs_api("id-sdkeditor");
|
||||
api.SetMobileVersion(true);
|
||||
api.CreateComponents();
|
||||
api.SetFontsPath("../../../sdk/Fonts/");
|
||||
api.Init();
|
||||
api.initEvents2MobileAdvances();
|
||||
api.asc_registerCallback("asc_onStartAction", Ext.bind(this.onLongActionBegin, this));
|
||||
api.asc_registerCallback("asc_onError", Ext.bind(this.onError, this));
|
||||
api.asc_registerCallback("asc_onEndAction", Ext.bind(this.onLongActionEnd, this));
|
||||
api.asc_registerCallback("asc_onDocumentContentReady", Ext.bind(this.onDocumentContentReady, this));
|
||||
api.asc_registerCallback("asc_onOpenDocumentProgress2", Ext.bind(this.onOpenDocument, this));
|
||||
api.asc_registerCallback("asc_onSaveUrl", Ext.bind(this.onSaveUrl, this));
|
||||
api.asc_registerCallback("asc_onGetEditorPermissions", Ext.bind(this.onEditorPermissions, this));
|
||||
Ext.each(app.getControllers(), function (controllerName) {
|
||||
var controller = this.getApplication().getController(controllerName);
|
||||
controller && Ext.isFunction(controller.setApi) && controller.setApi(api);
|
||||
},
|
||||
this);
|
||||
this.initApi();
|
||||
this.editorConfig = {};
|
||||
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
|
||||
Common.Gateway.on("opendocument", Ext.bind(this.loadDocument, this));
|
||||
Common.Gateway.on("showmessage", Ext.bind(this.onExternalMessage, this));
|
||||
Common.Gateway.on("resetfocus", Ext.bind(this.onResetFocus, this));
|
||||
Common.Gateway.on("processsaveresult", Ext.bind(this.onProcessSaveResult, this));
|
||||
Common.Gateway.on("processrightschange", Ext.bind(this.onProcessRightsChange, this));
|
||||
Common.Gateway.ready();
|
||||
},
|
||||
initControl: function () {},
|
||||
initApi: function () {},
|
||||
loadConfig: function (data) {
|
||||
this.editorConfig = Ext.merge(this.editorConfig, data.config);
|
||||
if ((this.editorConfig.user === undefined || this.editorConfig.user === null)) {
|
||||
this.editorConfig.user = {};
|
||||
if (this.editorConfig.users) {
|
||||
this.editorConfig.userId = this.editorConfig.userId || 0;
|
||||
for (var i = 0; i < this.editorConfig.users.length; i++) {
|
||||
if (this.editorConfig.users[i].id === this.editorConfig.userId) {
|
||||
this.editorConfig.user = {
|
||||
id: this.editorConfig.users[i].id,
|
||||
name: this.editorConfig.users[i].username
|
||||
};
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.editorConfig.user.id = this.editorConfig.user.id || ("uid-" + Ext.Date.now());
|
||||
this.editorConfig.user.name = this.editorConfig.user.name || this.textAnonymous;
|
||||
},
|
||||
loadDocument: function (data) {
|
||||
if (data.doc) {
|
||||
this.permissions = data.doc.permissions;
|
||||
var docInfo = new CDocInfo();
|
||||
docInfo.put_Id(data.doc.key);
|
||||
docInfo.put_Url(data.doc.url);
|
||||
docInfo.put_Title(data.doc.title);
|
||||
docInfo.put_Format(data.doc.fileType);
|
||||
docInfo.put_VKey(data.doc.vkey);
|
||||
docInfo.put_Options(data.doc.options);
|
||||
docInfo.put_UserId(this.editorConfig.user.id);
|
||||
docInfo.put_UserName(this.editorConfig.user.name);
|
||||
this.api.asc_setDocInfo(docInfo);
|
||||
this.api.asc_getEditorPermissions();
|
||||
Common.component.Analytics.trackEvent("Load", "Start");
|
||||
}
|
||||
},
|
||||
onEditorPermissions: function (params) {
|
||||
this.permissions.edit !== false && (this.permissions.edit = params.asc_getCanEdit());
|
||||
this.permissions.reader !== false && (this.permissions.reader = params.asc_getCanReaderMode());
|
||||
var profile = this.getApplication().getCurrentProfile(),
|
||||
deviceController = this.getApplication().getController("Main", profile ? profile.getNamespace() : null),
|
||||
editMode = (this.permissions.edit === true && this.editorConfig.mode !== "view"),
|
||||
readerMode = this.permissions.reader === true;
|
||||
if (deviceController) {
|
||||
if (Ext.os.is.Phone) {
|
||||
if (readerMode) {
|
||||
this.api.SetReaderModeOnly();
|
||||
editMode = false;
|
||||
}
|
||||
}
|
||||
if (Ext.isFunction(deviceController.setMode)) {
|
||||
deviceController.setMode(editMode ? "edit" : "view");
|
||||
}
|
||||
if (Ext.isFunction(deviceController.setReadableMode)) {
|
||||
deviceController.setReadableMode(readerMode);
|
||||
}
|
||||
}
|
||||
this.api.SetViewMode(!editMode);
|
||||
this.api.LoadDocument();
|
||||
this.api.Resize();
|
||||
},
|
||||
goBack: function () {
|
||||
Common.Gateway.goBack();
|
||||
},
|
||||
onDocumentContentReady: function () {
|
||||
if (this.api) {
|
||||
this.api.Resize();
|
||||
this.api.zoomFitToWidth();
|
||||
}
|
||||
this._hideLoadSplash();
|
||||
Common.component.Analytics.trackEvent("Load", "Complete");
|
||||
},
|
||||
onOpenDocument: function (progress) {
|
||||
var elem = document.getElementById("loadmask-text");
|
||||
if (elem) {
|
||||
elem.innerHTML = this.loadingDocText + ": " + Math.round(progress) + "%";
|
||||
}
|
||||
},
|
||||
onSaveUrl: function (url) {
|
||||
Common.Gateway.save(url);
|
||||
},
|
||||
onLongActionBegin: function (type, id) {
|
||||
var text = "";
|
||||
switch (id) {
|
||||
case c_oAscAsyncAction["Save"]:
|
||||
text = this.saveText;
|
||||
break;
|
||||
case c_oAscAsyncAction["Print"]:
|
||||
text = this.printText;
|
||||
}
|
||||
if (type == c_oAscAsyncActionType["BlockInteraction"]) {
|
||||
Ext.Viewport.setMasked({
|
||||
xtype: "loadmask",
|
||||
message: text
|
||||
});
|
||||
}
|
||||
},
|
||||
onLongActionEnd: function (type) {
|
||||
Ext.Viewport.unmask();
|
||||
},
|
||||
onError: function (id, level, errData) {
|
||||
this._hideLoadSplash();
|
||||
var config = {
|
||||
closable: false
|
||||
};
|
||||
switch (id) {
|
||||
case c_oAscError.ID.Unknown:
|
||||
config.message = this.unknownErrorText;
|
||||
break;
|
||||
case c_oAscError.ID.ConvertationTimeout:
|
||||
config.message = this.convertationTimeoutText;
|
||||
break;
|
||||
case c_oAscError.ID.ConvertationError:
|
||||
config.message = this.convertationErrorText;
|
||||
break;
|
||||
case c_oAscError.ID.DownloadError:
|
||||
config.message = this.downloadErrorText;
|
||||
break;
|
||||
case c_oAscError.ID.UplImageSize:
|
||||
config.message = this.uploadImageSizeMessage;
|
||||
break;
|
||||
case c_oAscError.ID.UplImageExt:
|
||||
config.message = this.uploadImageExtMessage;
|
||||
break;
|
||||
case c_oAscError.ID.UplImageFileCount:
|
||||
config.message = this.uploadImageFileCountMessage;
|
||||
break;
|
||||
case c_oAscError.ID.SplitCellMaxRows:
|
||||
config.message = this.splitMaxRowsErrorText.replace("%1", errData.get_Value());
|
||||
break;
|
||||
case c_oAscError.ID.SplitCellMaxCols:
|
||||
config.message = this.splitMaxColsErrorText.replace("%1", errData.get_Value());
|
||||
break;
|
||||
case c_oAscError.ID.SplitCellRowsDivider:
|
||||
config.message = this.splitDividerErrorText.replace("%1", errData.get_Value());
|
||||
break;
|
||||
case c_oAscError.ID.VKeyEncrypt:
|
||||
config.message = this.errorKeyEncrypt;
|
||||
break;
|
||||
case c_oAscError.ID.KeyExpire:
|
||||
config.message = this.errorKeyExpire;
|
||||
break;
|
||||
case c_oAscError.ID.UserCountExceed:
|
||||
config.message = this.errorUsersExceed;
|
||||
break;
|
||||
case c_oAscError.ID.CoAuthoringDisconnect:
|
||||
config.message = this.errorCoAuthoringDisconnect;
|
||||
break;
|
||||
case c_oAscError.ID.MobileUnexpectedCharCount:
|
||||
config.message = this.errorDocTooBig;
|
||||
config.out = true;
|
||||
break;
|
||||
default:
|
||||
config.message = this.errorDefaultMessage.replace("%1", id);
|
||||
break;
|
||||
}
|
||||
if (level == c_oAscError.Level.Critical) {
|
||||
Common.Gateway.reportError(id, config.message);
|
||||
config.title = this.criticalErrorTitle;
|
||||
config.message += "<br/>" + this.criticalErrorExtText;
|
||||
config.buttons = Ext.Msg.OK;
|
||||
config.fn = function (btn) {
|
||||
if (btn == "ok") {
|
||||
if (config.out === true) {
|
||||
Common.Gateway.goBack();
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
config.title = this.notcriticalErrorTitle;
|
||||
config.buttons = Ext.Msg.OK;
|
||||
config.fn = Ext.emptyFn;
|
||||
}
|
||||
Ext.Msg.show(config);
|
||||
Common.component.Analytics.trackEvent("Internal Error", id.toString());
|
||||
},
|
||||
onExternalMessage: function (msg) {
|
||||
if (msg) {
|
||||
this._hideLoadSplash();
|
||||
Ext.Msg.show({
|
||||
title: msg.title,
|
||||
msg: "<br/>" + msg.msg,
|
||||
icon: Ext.Msg[msg.severity.toUpperCase()],
|
||||
buttons: Ext.Msg.OK
|
||||
});
|
||||
Common.component.Analytics.trackEvent("External Error", msg.title);
|
||||
}
|
||||
},
|
||||
onResetFocus: function (data) {
|
||||
var activeElement = document.activeElement;
|
||||
activeElement.focus();
|
||||
},
|
||||
onProcessSaveResult: function (data) {
|
||||
this.api && this.api.asc_OnSaveEnd(data.result);
|
||||
},
|
||||
onProcessRightsChange: function (data) {
|
||||
if (this.api && data && data.enabled === false) {
|
||||
this.api.asc_coAuthoringDisconnect();
|
||||
}
|
||||
},
|
||||
_hideLoadSplash: function () {
|
||||
var preloader = Ext.get("loading-mask");
|
||||
if (preloader) {
|
||||
Ext.Anim.run(preloader, "fade", {
|
||||
out: true,
|
||||
duration: 250,
|
||||
after: function () {
|
||||
preloader.destroy();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
_isSupport: function () {
|
||||
return (Ext.browser.is.WebKit && (Ext.os.is.iOS || Ext.os.is.Android || Ext.os.is.Desktop));
|
||||
},
|
||||
loadingDocText: "LOADING DOCUMENT",
|
||||
saveText: "Saving...",
|
||||
printText: "Printing...",
|
||||
criticalErrorTitle: "Error",
|
||||
notcriticalErrorTitle: "Warning",
|
||||
errorDefaultMessage: "Error code: %1",
|
||||
criticalErrorExtText: 'Press "Ok" to reload view page.',
|
||||
uploadImageSizeMessage: "Maximium image size limit exceeded.",
|
||||
uploadImageExtMessage: "Unknown image format.",
|
||||
uploadImageFileCountMessage: "No images uploaded.",
|
||||
reloadButtonText: "Reload Page",
|
||||
unknownErrorText: "Unknown error.",
|
||||
convertationTimeoutText: "Convertation timeout exceeded.",
|
||||
convertationErrorText: "Convertation failed.",
|
||||
downloadErrorText: "Download failed.",
|
||||
unsupportedBrowserErrorText: "Your browser is not supported.",
|
||||
splitMaxRowsErrorText: "The number of rows must be less than %1",
|
||||
splitMaxColsErrorText: "The number of columns must be less than %1",
|
||||
splitDividerErrorText: "The number of rows must be a divisor of %1",
|
||||
requestEditRightsText: "Requesting editing rights...",
|
||||
requestEditFailedTitleText: "Access denied",
|
||||
requestEditFailedMessageText: "Someone is editing this document right now. Please try again later.",
|
||||
errorKeyEncrypt: "Unknown key descriptor",
|
||||
errorKeyExpire: "Key descriptor expired",
|
||||
errorUsersExceed: "Count of users was exceed",
|
||||
errorCoAuthoringDisconnect: "Server connection lost. You can't edit anymore.",
|
||||
errorDocTooBig: "The document you are trying to open has more than 30000 characters or 1000 paragraphs in it and cannot by opened on your mobile device. Please try open it using a desktop PC.",
|
||||
textAnonymous: "Anonymous"
|
||||
});
|
||||
@@ -1,98 +1,98 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.Search", (function () {
|
||||
return {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
searchToolbar: "searchtoolbar",
|
||||
nextResultButton: "#id-btn-search-down",
|
||||
previousResultButton: "#id-btn-search-up",
|
||||
searchField: "#id-field-search"
|
||||
},
|
||||
control: {
|
||||
searchToolbar: {
|
||||
hide: "onSearchToolbarHide"
|
||||
},
|
||||
previousResultButton: {
|
||||
tap: "onPreviousResultButtonTap"
|
||||
},
|
||||
nextResultButton: {
|
||||
tap: "onNextResultButtonTap"
|
||||
},
|
||||
searchField: {
|
||||
keyup: "onSearchKeyUp",
|
||||
change: "onSearchChange",
|
||||
clearicontap: "onClearSearch"
|
||||
}
|
||||
}
|
||||
},
|
||||
init: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
updateNavigation: function () {
|
||||
var text = this.getSearchField().getValue();
|
||||
this.getNextResultButton().setDisabled(!(text.length > 0));
|
||||
this.getPreviousResultButton().setDisabled(!(text.length > 0));
|
||||
},
|
||||
clearSearchResults: function () {
|
||||
if (this.getSearchField()) {
|
||||
this.getSearchField().setValue("");
|
||||
this.updateNavigation();
|
||||
}
|
||||
window.focus();
|
||||
document.activeElement.blur();
|
||||
},
|
||||
onSearchToolbarHide: function () {
|
||||
this.clearSearchResults();
|
||||
},
|
||||
onNextResultButtonTap: function () {
|
||||
this.api.asc_findText(this.getSearchField().getValue(), true);
|
||||
},
|
||||
onPreviousResultButtonTap: function () {
|
||||
this.api.asc_findText(this.getSearchField().getValue(), false);
|
||||
},
|
||||
onSearchKeyUp: function (field, e) {
|
||||
if (e.event.keyCode == 13 && field.getValue().length > 0) {
|
||||
this.api.asc_findText(field.getValue(), true);
|
||||
}
|
||||
this.updateNavigation();
|
||||
},
|
||||
onSearchChange: function (field, newValue, oldValue) {
|
||||
this.updateNavigation();
|
||||
},
|
||||
onClearSearch: function (field, e) {
|
||||
this.clearSearchResults();
|
||||
}
|
||||
};
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.Search", (function () {
|
||||
return {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
searchToolbar: "searchtoolbar",
|
||||
nextResultButton: "#id-btn-search-down",
|
||||
previousResultButton: "#id-btn-search-up",
|
||||
searchField: "#id-field-search"
|
||||
},
|
||||
control: {
|
||||
searchToolbar: {
|
||||
hide: "onSearchToolbarHide"
|
||||
},
|
||||
previousResultButton: {
|
||||
tap: "onPreviousResultButtonTap"
|
||||
},
|
||||
nextResultButton: {
|
||||
tap: "onNextResultButtonTap"
|
||||
},
|
||||
searchField: {
|
||||
keyup: "onSearchKeyUp",
|
||||
change: "onSearchChange",
|
||||
clearicontap: "onClearSearch"
|
||||
}
|
||||
}
|
||||
},
|
||||
init: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
updateNavigation: function () {
|
||||
var text = this.getSearchField().getValue();
|
||||
this.getNextResultButton().setDisabled(!(text.length > 0));
|
||||
this.getPreviousResultButton().setDisabled(!(text.length > 0));
|
||||
},
|
||||
clearSearchResults: function () {
|
||||
if (this.getSearchField()) {
|
||||
this.getSearchField().setValue("");
|
||||
this.updateNavigation();
|
||||
}
|
||||
window.focus();
|
||||
document.activeElement.blur();
|
||||
},
|
||||
onSearchToolbarHide: function () {
|
||||
this.clearSearchResults();
|
||||
},
|
||||
onNextResultButtonTap: function () {
|
||||
this.api.asc_findText(this.getSearchField().getValue(), true);
|
||||
},
|
||||
onPreviousResultButtonTap: function () {
|
||||
this.api.asc_findText(this.getSearchField().getValue(), false);
|
||||
},
|
||||
onSearchKeyUp: function (field, e) {
|
||||
if (e.event.keyCode == 13 && field.getValue().length > 0) {
|
||||
this.api.asc_findText(field.getValue(), true);
|
||||
}
|
||||
this.updateNavigation();
|
||||
},
|
||||
onSearchChange: function (field, newValue, oldValue) {
|
||||
this.updateNavigation();
|
||||
},
|
||||
onClearSearch: function (field, e) {
|
||||
this.clearSearchResults();
|
||||
}
|
||||
};
|
||||
})());
|
||||
@@ -1,81 +1,81 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.phone.Main", {
|
||||
extend: "DE.controller.Main",
|
||||
requires: ["Ext.Anim"],
|
||||
config: {
|
||||
refs: {
|
||||
viewToolbar: "viewtoolbar",
|
||||
searchToolbar: "searchtoolbar",
|
||||
readableBtn: "#id-tb-btn-readable",
|
||||
searchButton: "#id-tb-btn-search",
|
||||
incFontSizeButton: "#id-tb-btn-incfontsize",
|
||||
decFontSizeButton: "#id-tb-btn-decfontsize",
|
||||
shareButton: "#id-tb-btn-view-share"
|
||||
}
|
||||
},
|
||||
launch: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initControl: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initApi: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
var viewToolbar = this.getViewToolbar();
|
||||
viewToolbar && viewToolbar.show();
|
||||
this.api && this.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
setReadableMode: function (readable) {
|
||||
var readableBtn = this.getReadableBtn(),
|
||||
searchButton = this.getSearchButton(),
|
||||
incFontSizeButton = this.getIncFontSizeButton(),
|
||||
decFontSizeButton = this.getDecFontSizeButton(),
|
||||
shareButton = this.getShareButton();
|
||||
if (readable) {
|
||||
readableBtn && readableBtn.show();
|
||||
searchButton && searchButton.hide();
|
||||
incFontSizeButton && incFontSizeButton.show();
|
||||
decFontSizeButton && decFontSizeButton.show();
|
||||
shareButton && shareButton.hide();
|
||||
} else {
|
||||
readableBtn && readableBtn.hide();
|
||||
searchButton && searchButton.show();
|
||||
incFontSizeButton && incFontSizeButton.hide();
|
||||
decFontSizeButton && decFontSizeButton.hide();
|
||||
shareButton && shareButton.show();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.phone.Main", {
|
||||
extend: "DE.controller.Main",
|
||||
requires: ["Ext.Anim"],
|
||||
config: {
|
||||
refs: {
|
||||
viewToolbar: "viewtoolbar",
|
||||
searchToolbar: "searchtoolbar",
|
||||
readableBtn: "#id-tb-btn-readable",
|
||||
searchButton: "#id-tb-btn-search",
|
||||
incFontSizeButton: "#id-tb-btn-incfontsize",
|
||||
decFontSizeButton: "#id-tb-btn-decfontsize",
|
||||
shareButton: "#id-tb-btn-view-share"
|
||||
}
|
||||
},
|
||||
launch: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initControl: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initApi: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
var viewToolbar = this.getViewToolbar();
|
||||
viewToolbar && viewToolbar.show();
|
||||
this.api && this.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
setReadableMode: function (readable) {
|
||||
var readableBtn = this.getReadableBtn(),
|
||||
searchButton = this.getSearchButton(),
|
||||
incFontSizeButton = this.getIncFontSizeButton(),
|
||||
decFontSizeButton = this.getDecFontSizeButton(),
|
||||
shareButton = this.getShareButton();
|
||||
if (readable) {
|
||||
readableBtn && readableBtn.show();
|
||||
searchButton && searchButton.hide();
|
||||
incFontSizeButton && incFontSizeButton.show();
|
||||
decFontSizeButton && decFontSizeButton.show();
|
||||
shareButton && shareButton.hide();
|
||||
} else {
|
||||
readableBtn && readableBtn.hide();
|
||||
searchButton && searchButton.show();
|
||||
incFontSizeButton && incFontSizeButton.hide();
|
||||
decFontSizeButton && decFontSizeButton.hide();
|
||||
shareButton && shareButton.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,83 +1,83 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.Main", {
|
||||
extend: "DE.controller.Main",
|
||||
requires: ["Ext.Anim"],
|
||||
config: {
|
||||
refs: {
|
||||
editToolbar: "edittoolbar",
|
||||
viewToolbar: "viewtoolbar",
|
||||
searchToolbar: "searchtoolbar",
|
||||
readableBtn: "#id-tb-btn-readable"
|
||||
},
|
||||
control: {}
|
||||
},
|
||||
launch: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initControl: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initApi: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
setMode: function (mode) {
|
||||
var editToolbar = this.getEditToolbar(),
|
||||
viewToolbar = this.getViewToolbar(),
|
||||
searchToolbar = this.getSearchToolbar(),
|
||||
popClipController = this.getApplication().getController("Common.controller.PopClip");
|
||||
if (mode == "edit") {
|
||||
viewToolbar && viewToolbar.hide();
|
||||
searchToolbar && searchToolbar.hide();
|
||||
editToolbar && editToolbar.show();
|
||||
this.api && this.api.asc_enableKeyEvents(true);
|
||||
this.api && this.api.SetViewMode(false);
|
||||
} else {
|
||||
editToolbar && editToolbar.hide();
|
||||
viewToolbar && viewToolbar.show();
|
||||
this.api && this.api.asc_enableKeyEvents(false);
|
||||
this.api && this.api.SetViewMode(true);
|
||||
}
|
||||
if (popClipController) {
|
||||
popClipController.setMode(mode);
|
||||
}
|
||||
},
|
||||
setReadableMode: function (readable) {
|
||||
var readableBtn = this.getReadableBtn();
|
||||
if (readableBtn) {
|
||||
readable ? readableBtn.show() : readableBtn.hide();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.Main", {
|
||||
extend: "DE.controller.Main",
|
||||
requires: ["Ext.Anim"],
|
||||
config: {
|
||||
refs: {
|
||||
editToolbar: "edittoolbar",
|
||||
viewToolbar: "viewtoolbar",
|
||||
searchToolbar: "searchtoolbar",
|
||||
readableBtn: "#id-tb-btn-readable"
|
||||
},
|
||||
control: {}
|
||||
},
|
||||
launch: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initControl: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initApi: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
setMode: function (mode) {
|
||||
var editToolbar = this.getEditToolbar(),
|
||||
viewToolbar = this.getViewToolbar(),
|
||||
searchToolbar = this.getSearchToolbar(),
|
||||
popClipController = this.getApplication().getController("Common.controller.PopClip");
|
||||
if (mode == "edit") {
|
||||
viewToolbar && viewToolbar.hide();
|
||||
searchToolbar && searchToolbar.hide();
|
||||
editToolbar && editToolbar.show();
|
||||
this.api && this.api.asc_enableKeyEvents(true);
|
||||
this.api && this.api.SetViewMode(false);
|
||||
} else {
|
||||
editToolbar && editToolbar.hide();
|
||||
viewToolbar && viewToolbar.show();
|
||||
this.api && this.api.asc_enableKeyEvents(false);
|
||||
this.api && this.api.SetViewMode(true);
|
||||
}
|
||||
if (popClipController) {
|
||||
popClipController.setMode(mode);
|
||||
}
|
||||
},
|
||||
setReadableMode: function (readable) {
|
||||
var readableBtn = this.getReadableBtn();
|
||||
if (readableBtn) {
|
||||
readable ? readableBtn.show() : readableBtn.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,298 +1,298 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Font", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
fontPanel: "fontpanel",
|
||||
navigateView: "#id-font-navigate",
|
||||
fontSizeSpinner: "fontpanel planarspinnerfield",
|
||||
fontView: "#id-font-root",
|
||||
fontNameView: "#id-font-name",
|
||||
fontNameButton: "#id-btn-fontname",
|
||||
fontButton: "#id-tb-btn-font",
|
||||
fontBaseToggle: "#id-toggle-baseline",
|
||||
fontBaseUp: "#id-btn-baseline-up",
|
||||
fontBaseDown: "#id-btn-baseline-down"
|
||||
},
|
||||
control: {
|
||||
fontPanel: {
|
||||
show: "onFontPanelShow",
|
||||
hide: "onFontPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
fontNameButton: {
|
||||
tap: "onFontNameButtonTap"
|
||||
},
|
||||
fontSizeSpinner: {
|
||||
blur: "onFontSizeSpinnerBlur",
|
||||
focus: "onFontSizeSpinnerFocus",
|
||||
keyup: "onFontSizeSpinnerKeyUp",
|
||||
spin: "onFontSizeSpinnerSpin"
|
||||
},
|
||||
fontNameView: {
|
||||
select: "onFontNameSelect",
|
||||
itemtap: "onFontNameItemTap"
|
||||
},
|
||||
fontBaseUp: {
|
||||
tap: "onFontBaseUpTap"
|
||||
},
|
||||
fontBaseDown: {
|
||||
tap: "onFontBaseDownTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onFontFamily", Ext.bind(this.onApiFontChange, this));
|
||||
this.api.asc_registerCallback("asc_onInitEditorFonts", Ext.bind(this.onApiLoadFonts, this));
|
||||
this.api.asc_registerCallback("asc_onFontSize", Ext.bind(this.onApiFontSize, this));
|
||||
this.api.asc_registerCallback("asc_onVerticalAlign", Ext.bind(this.onApiVerticalAlign, this));
|
||||
this.api.asc_registerCallback("asc_onDocumentContentReady", Ext.bind(this.onDocumentContentReady, this));
|
||||
}
|
||||
},
|
||||
onFontPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onFontPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView(),
|
||||
fontSizeSpinner = this.getFontSizeSpinner();
|
||||
if (fontSizeSpinner) {
|
||||
Ext.defer(function () {
|
||||
fontSizeSpinner.blur();
|
||||
},
|
||||
200);
|
||||
}
|
||||
if (navigateView) {
|
||||
navigateView.reset();
|
||||
navigateView.addCls("plain");
|
||||
navigateView.getNavigationBar().hide();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelSize = this.getSizeById(activeItem && activeItem.id);
|
||||
cmp.setSize(panelSize.width, panelSize.height);
|
||||
}
|
||||
},
|
||||
onFontNameButtonTap: function () {
|
||||
var navigateView = this.getNavigateView(),
|
||||
fontNameView = this.getFontNameView();
|
||||
if (navigateView) {
|
||||
var navigationBar = navigateView.getNavigationBar();
|
||||
if (navigationBar) {
|
||||
navigationBar.show();
|
||||
}
|
||||
navigateView.push(fontNameView);
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerFocus: function () {
|
||||
this.api && this.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
onFontSizeSpinnerBlur: function (field) {
|
||||
this.api && this.api.asc_enableKeyEvents(true);
|
||||
this.getFontSizeSpinner().setValue(field.getValue());
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(field.getValue());
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerKeyUp: function (field, event) {
|
||||
if (event.browserEvent.keyCode == 13 || event.browserEvent.keyCode == 10) {
|
||||
event.stopEvent();
|
||||
field.element.dom.blur();
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(field.getValue());
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerSpin: function (spin, value) {
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(value);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
},
|
||||
getSizeById: function (id) {
|
||||
switch (id) {
|
||||
case "id-font-name":
|
||||
return {
|
||||
width: 350,
|
||||
height: 300
|
||||
};
|
||||
default:
|
||||
case "id-font-root":
|
||||
return {
|
||||
width: 440,
|
||||
height: 46
|
||||
};
|
||||
}
|
||||
},
|
||||
toggleSegmentedButton: function (btn) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
var pressedButtonsNew = [];
|
||||
if (btn) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
toggler.setPressedButtons(pressedButtonsNew);
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
panelSize = this.getSizeById(view && view.id);
|
||||
if (parentCmp) {
|
||||
parentCmp.setSize(panelSize.width, panelSize.height);
|
||||
var navigationView = this.getNavigateView();
|
||||
if (navigationView) {
|
||||
navigationView.removeCls("plain");
|
||||
navigationView.getNavigationBar().show();
|
||||
}
|
||||
var fontButton = this.getFontButton();
|
||||
if (fontButton) {
|
||||
parentCmp.alignTo(fontButton);
|
||||
}
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem(),
|
||||
panelSize = this.getSizeById(activeItem && activeItem.id);
|
||||
if (activeItem && activeItem.id == "id-font-root") {
|
||||
var navigationView = this.getNavigateView();
|
||||
if (navigationView) {
|
||||
navigationView.addCls("plain");
|
||||
navigationView.getNavigationBar().hide();
|
||||
}
|
||||
}
|
||||
if (parentCmp) {
|
||||
parentCmp.setSize(panelSize.width, panelSize.height);
|
||||
var fontButton = this.getFontButton();
|
||||
if (fontButton) {
|
||||
parentCmp.alignTo(fontButton);
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontNameSelect: function (cmp, rec) {
|
||||
var fontNameButton = this.getFontNameButton();
|
||||
if (fontNameButton) {
|
||||
fontNameButton.setText(rec.get("setting"));
|
||||
}
|
||||
},
|
||||
onFontNameItemTap: function (cmp, index, item, rec) {
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontName(rec.get("setting"));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Name");
|
||||
}
|
||||
},
|
||||
onFontBaseUpTap: function (btn) {
|
||||
if (this.api) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
this.api.put_TextPrBaseline(toggler.isPressed(btn) ? 1 : 0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Superscript");
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontBaseDownTap: function (btn) {
|
||||
if (this.api) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
this.api.put_TextPrBaseline(toggler.isPressed(btn) ? 2 : 0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Subscript");
|
||||
}
|
||||
}
|
||||
},
|
||||
onDocumentContentReady: function () {
|
||||
if (this.api) {
|
||||
var fl = this.api.get_PropertyEditorFonts();
|
||||
if (fl) {
|
||||
this.onApiLoadFonts(fl);
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiFontChange: function (font) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
var fontNameView = this.getFontNameView();
|
||||
if (fontNameView) {
|
||||
var fontName = font.get_Name(),
|
||||
fontRec = fontNameView.getStore().findRecord("setting", fontName);
|
||||
if (fontRec) {
|
||||
fontNameView.select(fontRec);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiLoadFonts: function (fl) {
|
||||
var fontNameView = this.getFontNameView();
|
||||
if (fontNameView) {
|
||||
var rawFontsArray = [];
|
||||
Ext.each(fl, function (font) {
|
||||
rawFontsArray.push({
|
||||
setting: font.asc_getFontName(),
|
||||
group: "font"
|
||||
});
|
||||
});
|
||||
fontNameView.getStore().setData(rawFontsArray);
|
||||
}
|
||||
},
|
||||
onApiFontSize: function (size) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
var fontSizeSpinner = this.getFontSizeSpinner();
|
||||
if (fontSizeSpinner) {
|
||||
fontSizeSpinner.setValue(size);
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiVerticalAlign: function (type) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.toggleSegmentedButton(this.getFontBaseUp());
|
||||
break;
|
||||
case 2:
|
||||
this.toggleSegmentedButton(this.getFontBaseDown());
|
||||
break;
|
||||
default:
|
||||
this.toggleSegmentedButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Font", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
fontPanel: "fontpanel",
|
||||
navigateView: "#id-font-navigate",
|
||||
fontSizeSpinner: "fontpanel planarspinnerfield",
|
||||
fontView: "#id-font-root",
|
||||
fontNameView: "#id-font-name",
|
||||
fontNameButton: "#id-btn-fontname",
|
||||
fontButton: "#id-tb-btn-font",
|
||||
fontBaseToggle: "#id-toggle-baseline",
|
||||
fontBaseUp: "#id-btn-baseline-up",
|
||||
fontBaseDown: "#id-btn-baseline-down"
|
||||
},
|
||||
control: {
|
||||
fontPanel: {
|
||||
show: "onFontPanelShow",
|
||||
hide: "onFontPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
fontNameButton: {
|
||||
tap: "onFontNameButtonTap"
|
||||
},
|
||||
fontSizeSpinner: {
|
||||
blur: "onFontSizeSpinnerBlur",
|
||||
focus: "onFontSizeSpinnerFocus",
|
||||
keyup: "onFontSizeSpinnerKeyUp",
|
||||
spin: "onFontSizeSpinnerSpin"
|
||||
},
|
||||
fontNameView: {
|
||||
select: "onFontNameSelect",
|
||||
itemtap: "onFontNameItemTap"
|
||||
},
|
||||
fontBaseUp: {
|
||||
tap: "onFontBaseUpTap"
|
||||
},
|
||||
fontBaseDown: {
|
||||
tap: "onFontBaseDownTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onFontFamily", Ext.bind(this.onApiFontChange, this));
|
||||
this.api.asc_registerCallback("asc_onInitEditorFonts", Ext.bind(this.onApiLoadFonts, this));
|
||||
this.api.asc_registerCallback("asc_onFontSize", Ext.bind(this.onApiFontSize, this));
|
||||
this.api.asc_registerCallback("asc_onVerticalAlign", Ext.bind(this.onApiVerticalAlign, this));
|
||||
this.api.asc_registerCallback("asc_onDocumentContentReady", Ext.bind(this.onDocumentContentReady, this));
|
||||
}
|
||||
},
|
||||
onFontPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onFontPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView(),
|
||||
fontSizeSpinner = this.getFontSizeSpinner();
|
||||
if (fontSizeSpinner) {
|
||||
Ext.defer(function () {
|
||||
fontSizeSpinner.blur();
|
||||
},
|
||||
200);
|
||||
}
|
||||
if (navigateView) {
|
||||
navigateView.reset();
|
||||
navigateView.addCls("plain");
|
||||
navigateView.getNavigationBar().hide();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelSize = this.getSizeById(activeItem && activeItem.id);
|
||||
cmp.setSize(panelSize.width, panelSize.height);
|
||||
}
|
||||
},
|
||||
onFontNameButtonTap: function () {
|
||||
var navigateView = this.getNavigateView(),
|
||||
fontNameView = this.getFontNameView();
|
||||
if (navigateView) {
|
||||
var navigationBar = navigateView.getNavigationBar();
|
||||
if (navigationBar) {
|
||||
navigationBar.show();
|
||||
}
|
||||
navigateView.push(fontNameView);
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerFocus: function () {
|
||||
this.api && this.api.asc_enableKeyEvents(false);
|
||||
},
|
||||
onFontSizeSpinnerBlur: function (field) {
|
||||
this.api && this.api.asc_enableKeyEvents(true);
|
||||
this.getFontSizeSpinner().setValue(field.getValue());
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(field.getValue());
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerKeyUp: function (field, event) {
|
||||
if (event.browserEvent.keyCode == 13 || event.browserEvent.keyCode == 10) {
|
||||
event.stopEvent();
|
||||
field.element.dom.blur();
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(field.getValue());
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontSizeSpinnerSpin: function (spin, value) {
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontSize(value);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Size");
|
||||
}
|
||||
},
|
||||
getSizeById: function (id) {
|
||||
switch (id) {
|
||||
case "id-font-name":
|
||||
return {
|
||||
width: 350,
|
||||
height: 300
|
||||
};
|
||||
default:
|
||||
case "id-font-root":
|
||||
return {
|
||||
width: 440,
|
||||
height: 46
|
||||
};
|
||||
}
|
||||
},
|
||||
toggleSegmentedButton: function (btn) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
var pressedButtonsNew = [];
|
||||
if (btn) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
toggler.setPressedButtons(pressedButtonsNew);
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
panelSize = this.getSizeById(view && view.id);
|
||||
if (parentCmp) {
|
||||
parentCmp.setSize(panelSize.width, panelSize.height);
|
||||
var navigationView = this.getNavigateView();
|
||||
if (navigationView) {
|
||||
navigationView.removeCls("plain");
|
||||
navigationView.getNavigationBar().show();
|
||||
}
|
||||
var fontButton = this.getFontButton();
|
||||
if (fontButton) {
|
||||
parentCmp.alignTo(fontButton);
|
||||
}
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem(),
|
||||
panelSize = this.getSizeById(activeItem && activeItem.id);
|
||||
if (activeItem && activeItem.id == "id-font-root") {
|
||||
var navigationView = this.getNavigateView();
|
||||
if (navigationView) {
|
||||
navigationView.addCls("plain");
|
||||
navigationView.getNavigationBar().hide();
|
||||
}
|
||||
}
|
||||
if (parentCmp) {
|
||||
parentCmp.setSize(panelSize.width, panelSize.height);
|
||||
var fontButton = this.getFontButton();
|
||||
if (fontButton) {
|
||||
parentCmp.alignTo(fontButton);
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontNameSelect: function (cmp, rec) {
|
||||
var fontNameButton = this.getFontNameButton();
|
||||
if (fontNameButton) {
|
||||
fontNameButton.setText(rec.get("setting"));
|
||||
}
|
||||
},
|
||||
onFontNameItemTap: function (cmp, index, item, rec) {
|
||||
if (this.api) {
|
||||
this.api.put_TextPrFontName(rec.get("setting"));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Font Name");
|
||||
}
|
||||
},
|
||||
onFontBaseUpTap: function (btn) {
|
||||
if (this.api) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
this.api.put_TextPrBaseline(toggler.isPressed(btn) ? 1 : 0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Superscript");
|
||||
}
|
||||
}
|
||||
},
|
||||
onFontBaseDownTap: function (btn) {
|
||||
if (this.api) {
|
||||
var toggler = this.getFontBaseToggle();
|
||||
if (toggler) {
|
||||
this.api.put_TextPrBaseline(toggler.isPressed(btn) ? 2 : 0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Subscript");
|
||||
}
|
||||
}
|
||||
},
|
||||
onDocumentContentReady: function () {
|
||||
if (this.api) {
|
||||
var fl = this.api.get_PropertyEditorFonts();
|
||||
if (fl) {
|
||||
this.onApiLoadFonts(fl);
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiFontChange: function (font) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
var fontNameView = this.getFontNameView();
|
||||
if (fontNameView) {
|
||||
var fontName = font.get_Name(),
|
||||
fontRec = fontNameView.getStore().findRecord("setting", fontName);
|
||||
if (fontRec) {
|
||||
fontNameView.select(fontRec);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiLoadFonts: function (fl) {
|
||||
var fontNameView = this.getFontNameView();
|
||||
if (fontNameView) {
|
||||
var rawFontsArray = [];
|
||||
Ext.each(fl, function (font) {
|
||||
rawFontsArray.push({
|
||||
setting: font.asc_getFontName(),
|
||||
group: "font"
|
||||
});
|
||||
});
|
||||
fontNameView.getStore().setData(rawFontsArray);
|
||||
}
|
||||
},
|
||||
onApiFontSize: function (size) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
var fontSizeSpinner = this.getFontSizeSpinner();
|
||||
if (fontSizeSpinner) {
|
||||
fontSizeSpinner.setValue(size);
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiVerticalAlign: function (type) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
switch (type) {
|
||||
case 1:
|
||||
this.toggleSegmentedButton(this.getFontBaseUp());
|
||||
break;
|
||||
case 2:
|
||||
this.toggleSegmentedButton(this.getFontBaseDown());
|
||||
break;
|
||||
default:
|
||||
this.toggleSegmentedButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,130 +1,130 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.FontStyle", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
fontStylePanel: "fontstylepanel",
|
||||
fontStylesToggle: "#id-toggle-fontstyles",
|
||||
fontStyleBold: "#id-btn-fontstyle-bold",
|
||||
fontStyleItalic: "#id-btn-fontstyle-italic",
|
||||
fontStyleUnderline: "#id-btn-fontstyle-underline"
|
||||
},
|
||||
control: {
|
||||
fontStylePanel: {
|
||||
show: "onFontStyleShow",
|
||||
hide: "onFontStyleHide"
|
||||
},
|
||||
fontStyleBold: {
|
||||
tap: "onBoldButtonTap"
|
||||
},
|
||||
fontStyleItalic: {
|
||||
tap: "onItalicButtonTap"
|
||||
},
|
||||
fontStyleUnderline: {
|
||||
tap: "onUnderlineButtonTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onBold", Ext.bind(this.onApiBold, this));
|
||||
this.api.asc_registerCallback("asc_onItalic", Ext.bind(this.onApiItalic, this));
|
||||
this.api.asc_registerCallback("asc_onUnderline", Ext.bind(this.onApiUnderline, this));
|
||||
}
|
||||
},
|
||||
onFontStyleShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onFontStyleHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
},
|
||||
_toggleSegmentedButton: function (btn, toggle) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && btn) {
|
||||
var pressedButtonsOld = toggler.getPressedButtons().slice(),
|
||||
pressedButtonsNew = toggler.getPressedButtons(),
|
||||
pressedIndex = pressedButtonsNew.indexOf(btn);
|
||||
if (toggle) {
|
||||
if (pressedIndex < 0) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
} else {
|
||||
if (pressedIndex > -1) {
|
||||
pressedButtonsNew.splice(pressedIndex, 1);
|
||||
}
|
||||
}
|
||||
toggler.updatePressedButtons(pressedButtonsNew, pressedButtonsOld);
|
||||
}
|
||||
},
|
||||
onApiBold: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleBold(), on);
|
||||
}
|
||||
},
|
||||
onApiItalic: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleItalic(), on);
|
||||
}
|
||||
},
|
||||
onApiUnderline: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleUnderline(), on);
|
||||
}
|
||||
},
|
||||
onBoldButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrBold(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Bold");
|
||||
}
|
||||
},
|
||||
onItalicButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrItalic(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Italic");
|
||||
}
|
||||
},
|
||||
onUnderlineButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrUnderline(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Underline");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.FontStyle", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
fontStylePanel: "fontstylepanel",
|
||||
fontStylesToggle: "#id-toggle-fontstyles",
|
||||
fontStyleBold: "#id-btn-fontstyle-bold",
|
||||
fontStyleItalic: "#id-btn-fontstyle-italic",
|
||||
fontStyleUnderline: "#id-btn-fontstyle-underline"
|
||||
},
|
||||
control: {
|
||||
fontStylePanel: {
|
||||
show: "onFontStyleShow",
|
||||
hide: "onFontStyleHide"
|
||||
},
|
||||
fontStyleBold: {
|
||||
tap: "onBoldButtonTap"
|
||||
},
|
||||
fontStyleItalic: {
|
||||
tap: "onItalicButtonTap"
|
||||
},
|
||||
fontStyleUnderline: {
|
||||
tap: "onUnderlineButtonTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onBold", Ext.bind(this.onApiBold, this));
|
||||
this.api.asc_registerCallback("asc_onItalic", Ext.bind(this.onApiItalic, this));
|
||||
this.api.asc_registerCallback("asc_onUnderline", Ext.bind(this.onApiUnderline, this));
|
||||
}
|
||||
},
|
||||
onFontStyleShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onFontStyleHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
},
|
||||
_toggleSegmentedButton: function (btn, toggle) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && btn) {
|
||||
var pressedButtonsOld = toggler.getPressedButtons().slice(),
|
||||
pressedButtonsNew = toggler.getPressedButtons(),
|
||||
pressedIndex = pressedButtonsNew.indexOf(btn);
|
||||
if (toggle) {
|
||||
if (pressedIndex < 0) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
} else {
|
||||
if (pressedIndex > -1) {
|
||||
pressedButtonsNew.splice(pressedIndex, 1);
|
||||
}
|
||||
}
|
||||
toggler.updatePressedButtons(pressedButtonsNew, pressedButtonsOld);
|
||||
}
|
||||
},
|
||||
onApiBold: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleBold(), on);
|
||||
}
|
||||
},
|
||||
onApiItalic: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleItalic(), on);
|
||||
}
|
||||
},
|
||||
onApiUnderline: function (on) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
this._toggleSegmentedButton(this.getFontStyleUnderline(), on);
|
||||
}
|
||||
},
|
||||
onBoldButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrBold(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Bold");
|
||||
}
|
||||
},
|
||||
onItalicButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrItalic(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Italic");
|
||||
}
|
||||
},
|
||||
onUnderlineButtonTap: function (btn) {
|
||||
var toggler = this.getFontStylesToggle();
|
||||
if (toggler && this.api) {
|
||||
this.api.put_TextPrUnderline(toggler.isPressed(btn));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Underline");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,218 +1,218 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Insert", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
insertPanel: "insertpanel",
|
||||
navigateView: "#id-insert-navigate",
|
||||
insertListView: "#id-insert-root",
|
||||
insertTableView: "#id-insert-table-container",
|
||||
insertPictureView: "#id-insert-picture-container",
|
||||
insertTableButton: "#id-btn-insert-table",
|
||||
tableColumnsSpinner: "#id-spinner-table-columns",
|
||||
tableRowsSpinner: "#id-spinner-table-rows",
|
||||
insertImageList: "#id-insert-picture-container"
|
||||
},
|
||||
control: {
|
||||
insertPanel: {
|
||||
hide: "onInsertPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
insertListView: {
|
||||
itemsingletap: "onInsertListItemTap"
|
||||
},
|
||||
insertTableButton: {
|
||||
tap: "onInsertTableButtonTap"
|
||||
},
|
||||
insertImageList: {
|
||||
itemtap: "onInsertImageItemTap"
|
||||
}
|
||||
}
|
||||
},
|
||||
init: function () {},
|
||||
onInsertImageListShow: function (list) {
|
||||
var me = this,
|
||||
inputInlineMedia = document.querySelector("#id-insert-picture-inline input[type=file]"),
|
||||
inputFloatMedia = document.querySelector("#id-insert-picture-float input[type=file]");
|
||||
var onChangeInput = function (input) {
|
||||
if (Ext.isDefined(input)) {
|
||||
var file = input.files[0];
|
||||
if (Ext.isDefined(file)) {
|
||||
var panel = me.getInsertPanel(),
|
||||
mpImg = new MegaPixImage(file);
|
||||
mpImg.imageLoadListeners.push(function () {
|
||||
var canvas = document.createElement("canvas"),
|
||||
imgProperty = new CImgProperty();
|
||||
mpImg.render(canvas, {
|
||||
maxWidth: 1024,
|
||||
maxHeight: 1024
|
||||
});
|
||||
imgProperty.put_WrappingStyle((input == inputInlineMedia) ? c_oAscWrapStyle2.Inline : c_oAscWrapStyle2.Square);
|
||||
me.api.AddImageUrl(canvas.toDataURL(), imgProperty);
|
||||
Ext.Viewport.unmask();
|
||||
});
|
||||
input.value = "";
|
||||
panel && panel.hide();
|
||||
Ext.Viewport.setMasked({
|
||||
xtype: "loadmask",
|
||||
message: me.uploadingText + "..."
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
inputInlineMedia && (inputInlineMedia.onchange = Ext.bind(onChangeInput, me, [inputInlineMedia]));
|
||||
inputFloatMedia && (inputFloatMedia.onchange = Ext.bind(onChangeInput, me, [inputFloatMedia]));
|
||||
},
|
||||
launch: function () {
|
||||
var insertImageList = this.getInsertImageList();
|
||||
insertImageList && insertImageList.on("show", Ext.bind(this.onInsertImageListShow, this), this, {
|
||||
delay: 1000,
|
||||
single: true
|
||||
});
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
onInsertPanelHide: function (cmp) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
tableColumnsSpinner = this.getTableColumnsSpinner(),
|
||||
tableRowsSpinner = this.getTableRowsSpinner();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
tableColumnsSpinner && tableColumnsSpinner.setValue(tableColumnsSpinner.getMinValue());
|
||||
tableRowsSpinner && tableRowsSpinner.setValue(tableRowsSpinner.getMinValue());
|
||||
},
|
||||
onInsertListItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-insert-table-row") {
|
||||
this.insertTableObject("row");
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Insert Row");
|
||||
} else {
|
||||
if (cmdId == "id-insert-table-column") {
|
||||
this.insertTableObject("column");
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Insert Column");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-insert-table-container":
|
||||
return 225;
|
||||
case "id-insert-picture-container":
|
||||
return 174;
|
||||
default:
|
||||
case "id-insert-root":
|
||||
return 283;
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view && view.id));
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onInsertTableButtonTap: function (btn) {
|
||||
var insertPanel = this.getInsertPanel(),
|
||||
tableColumnsSpinner = this.getTableColumnsSpinner(),
|
||||
tableRowsSpinner = this.getTableRowsSpinner();
|
||||
if (this.api && tableColumnsSpinner && tableRowsSpinner) {
|
||||
this.api.put_Table(tableColumnsSpinner.getValue(), tableRowsSpinner.getValue());
|
||||
}
|
||||
if (insertPanel) {
|
||||
insertPanel.hide();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Table");
|
||||
},
|
||||
onInsertImageItemTap: function (list) {
|
||||
if ((Ext.os.is.iOS && Ext.os.version.lt("6.0")) || (Ext.os.is.Android && Ext.os.version.lt("3.0"))) {
|
||||
Ext.Msg.show({
|
||||
message: this.unsupportUploadText,
|
||||
promptConfig: false,
|
||||
buttons: [{
|
||||
text: "OK",
|
||||
itemId: "ok",
|
||||
ui: "base"
|
||||
}]
|
||||
});
|
||||
}
|
||||
},
|
||||
insertTableObject: function (type) {
|
||||
if (this.api) {
|
||||
var selectedElements = this.api.getSelectedElements();
|
||||
if (selectedElements && selectedElements.length > 0) {
|
||||
var elementType = selectedElements[0].get_ObjectType();
|
||||
if (c_oAscTypeSelectElement.Table == elementType) {
|
||||
type === "row" ? this.api.addRowBelow() : type === "column" ? this.api.addColumnRight() : this.api.put_Table(1, 1);
|
||||
} else {
|
||||
this.api.put_Table(1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
uploadingText: "Uploading",
|
||||
unsupportUploadText: "Feature is not supported on this device."
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Insert", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
insertPanel: "insertpanel",
|
||||
navigateView: "#id-insert-navigate",
|
||||
insertListView: "#id-insert-root",
|
||||
insertTableView: "#id-insert-table-container",
|
||||
insertPictureView: "#id-insert-picture-container",
|
||||
insertTableButton: "#id-btn-insert-table",
|
||||
tableColumnsSpinner: "#id-spinner-table-columns",
|
||||
tableRowsSpinner: "#id-spinner-table-rows",
|
||||
insertImageList: "#id-insert-picture-container"
|
||||
},
|
||||
control: {
|
||||
insertPanel: {
|
||||
hide: "onInsertPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
insertListView: {
|
||||
itemsingletap: "onInsertListItemTap"
|
||||
},
|
||||
insertTableButton: {
|
||||
tap: "onInsertTableButtonTap"
|
||||
},
|
||||
insertImageList: {
|
||||
itemtap: "onInsertImageItemTap"
|
||||
}
|
||||
}
|
||||
},
|
||||
init: function () {},
|
||||
onInsertImageListShow: function (list) {
|
||||
var me = this,
|
||||
inputInlineMedia = document.querySelector("#id-insert-picture-inline input[type=file]"),
|
||||
inputFloatMedia = document.querySelector("#id-insert-picture-float input[type=file]");
|
||||
var onChangeInput = function (input) {
|
||||
if (Ext.isDefined(input)) {
|
||||
var file = input.files[0];
|
||||
if (Ext.isDefined(file)) {
|
||||
var panel = me.getInsertPanel(),
|
||||
mpImg = new MegaPixImage(file);
|
||||
mpImg.imageLoadListeners.push(function () {
|
||||
var canvas = document.createElement("canvas"),
|
||||
imgProperty = new CImgProperty();
|
||||
mpImg.render(canvas, {
|
||||
maxWidth: 1024,
|
||||
maxHeight: 1024
|
||||
});
|
||||
imgProperty.put_WrappingStyle((input == inputInlineMedia) ? c_oAscWrapStyle2.Inline : c_oAscWrapStyle2.Square);
|
||||
me.api.AddImageUrl(canvas.toDataURL(), imgProperty);
|
||||
Ext.Viewport.unmask();
|
||||
});
|
||||
input.value = "";
|
||||
panel && panel.hide();
|
||||
Ext.Viewport.setMasked({
|
||||
xtype: "loadmask",
|
||||
message: me.uploadingText + "..."
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
inputInlineMedia && (inputInlineMedia.onchange = Ext.bind(onChangeInput, me, [inputInlineMedia]));
|
||||
inputFloatMedia && (inputFloatMedia.onchange = Ext.bind(onChangeInput, me, [inputFloatMedia]));
|
||||
},
|
||||
launch: function () {
|
||||
var insertImageList = this.getInsertImageList();
|
||||
insertImageList && insertImageList.on("show", Ext.bind(this.onInsertImageListShow, this), this, {
|
||||
delay: 1000,
|
||||
single: true
|
||||
});
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
onInsertPanelHide: function (cmp) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
tableColumnsSpinner = this.getTableColumnsSpinner(),
|
||||
tableRowsSpinner = this.getTableRowsSpinner();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
tableColumnsSpinner && tableColumnsSpinner.setValue(tableColumnsSpinner.getMinValue());
|
||||
tableRowsSpinner && tableRowsSpinner.setValue(tableRowsSpinner.getMinValue());
|
||||
},
|
||||
onInsertListItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-insert-table-row") {
|
||||
this.insertTableObject("row");
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Insert Row");
|
||||
} else {
|
||||
if (cmdId == "id-insert-table-column") {
|
||||
this.insertTableObject("column");
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Insert Column");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-insert-table-container":
|
||||
return 225;
|
||||
case "id-insert-picture-container":
|
||||
return 174;
|
||||
default:
|
||||
case "id-insert-root":
|
||||
return 283;
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view && view.id));
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onInsertTableButtonTap: function (btn) {
|
||||
var insertPanel = this.getInsertPanel(),
|
||||
tableColumnsSpinner = this.getTableColumnsSpinner(),
|
||||
tableRowsSpinner = this.getTableRowsSpinner();
|
||||
if (this.api && tableColumnsSpinner && tableRowsSpinner) {
|
||||
this.api.put_Table(tableColumnsSpinner.getValue(), tableRowsSpinner.getValue());
|
||||
}
|
||||
if (insertPanel) {
|
||||
insertPanel.hide();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Table");
|
||||
},
|
||||
onInsertImageItemTap: function (list) {
|
||||
if ((Ext.os.is.iOS && Ext.os.version.lt("6.0")) || (Ext.os.is.Android && Ext.os.version.lt("3.0"))) {
|
||||
Ext.Msg.show({
|
||||
message: this.unsupportUploadText,
|
||||
promptConfig: false,
|
||||
buttons: [{
|
||||
text: "OK",
|
||||
itemId: "ok",
|
||||
ui: "base"
|
||||
}]
|
||||
});
|
||||
}
|
||||
},
|
||||
insertTableObject: function (type) {
|
||||
if (this.api) {
|
||||
var selectedElements = this.api.getSelectedElements();
|
||||
if (selectedElements && selectedElements.length > 0) {
|
||||
var elementType = selectedElements[0].get_ObjectType();
|
||||
if (c_oAscTypeSelectElement.Table == elementType) {
|
||||
type === "row" ? this.api.addRowBelow() : type === "column" ? this.api.addColumnRight() : this.api.put_Table(1, 1);
|
||||
} else {
|
||||
this.api.put_Table(1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
uploadingText: "Uploading",
|
||||
unsupportUploadText: "Feature is not supported on this device."
|
||||
});
|
||||
@@ -1,152 +1,152 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.ParagraphAlignment", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
paraAlignPanel: "paragraphalignmentpanel",
|
||||
paraAlignsToggle: "#id-toggle-paragraphalignment",
|
||||
paragraphAlignmentButton: "#id-tb-btn-align",
|
||||
paraAlignLeft: "#id-btn-paragraphalignment-left",
|
||||
paraAlignCenter: "#id-btn-paragraphalignment-center",
|
||||
paraAlignRight: "#id-btn-paragraphalignment-right",
|
||||
paraAlignFill: "#id-btn-paragraphalignment-fill"
|
||||
},
|
||||
control: {
|
||||
paraAlignPanel: {
|
||||
show: "onParaAlignPanelShow",
|
||||
hide: "onParaAlignPanelHide"
|
||||
},
|
||||
paraAlignLeft: {
|
||||
tap: "onParaAlignLeftTap"
|
||||
},
|
||||
paraAlignCenter: {
|
||||
tap: "onParaAlignCenterTap"
|
||||
},
|
||||
paraAlignRight: {
|
||||
tap: "onParaAlignRightTap"
|
||||
},
|
||||
paraAlignFill: {
|
||||
tap: "onParaAlignFillTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
onParaAlignPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onParaAlignPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onPrAlign", Ext.bind(this.onApiParagraphAlign, this));
|
||||
}
|
||||
},
|
||||
onParaAlignLeftTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(1);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignCenterTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(2);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignRightTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignFillTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(3);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
toggleSegmentedButton: function (btn) {
|
||||
var toggler = this.getParaAlignsToggle();
|
||||
if (toggler) {
|
||||
var pressedButtonsNew = [];
|
||||
if (btn) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
toggler.setPressedButtons(pressedButtonsNew);
|
||||
}
|
||||
},
|
||||
onApiParagraphAlign: function (v) {
|
||||
var paragraphAlignmentButton = this.getParagraphAlignmentButton();
|
||||
if (paragraphAlignmentButton && Ext.isDefined(v)) {
|
||||
switch (v) {
|
||||
case 0:
|
||||
paragraphAlignmentButton.setIconCls("align-right");
|
||||
break;
|
||||
case 1:
|
||||
paragraphAlignmentButton.setIconCls("align-left");
|
||||
break;
|
||||
case 2:
|
||||
paragraphAlignmentButton.setIconCls("align-center");
|
||||
break;
|
||||
default:
|
||||
case 3:
|
||||
paragraphAlignmentButton.setIconCls("align-fill");
|
||||
}
|
||||
}
|
||||
if (this.getHandleApiEvent()) {
|
||||
if (!Ext.isDefined(v)) {
|
||||
this.toggleSegmentedButton();
|
||||
return;
|
||||
}
|
||||
switch (v) {
|
||||
case 0:
|
||||
this.toggleSegmentedButton(this.getParaAlignRight());
|
||||
break;
|
||||
case 1:
|
||||
this.toggleSegmentedButton(this.getParaAlignLeft());
|
||||
break;
|
||||
case 2:
|
||||
this.toggleSegmentedButton(this.getParaAlignCenter());
|
||||
break;
|
||||
default:
|
||||
case 3:
|
||||
this.toggleSegmentedButton(this.getParaAlignFill());
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.ParagraphAlignment", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
paraAlignPanel: "paragraphalignmentpanel",
|
||||
paraAlignsToggle: "#id-toggle-paragraphalignment",
|
||||
paragraphAlignmentButton: "#id-tb-btn-align",
|
||||
paraAlignLeft: "#id-btn-paragraphalignment-left",
|
||||
paraAlignCenter: "#id-btn-paragraphalignment-center",
|
||||
paraAlignRight: "#id-btn-paragraphalignment-right",
|
||||
paraAlignFill: "#id-btn-paragraphalignment-fill"
|
||||
},
|
||||
control: {
|
||||
paraAlignPanel: {
|
||||
show: "onParaAlignPanelShow",
|
||||
hide: "onParaAlignPanelHide"
|
||||
},
|
||||
paraAlignLeft: {
|
||||
tap: "onParaAlignLeftTap"
|
||||
},
|
||||
paraAlignCenter: {
|
||||
tap: "onParaAlignCenterTap"
|
||||
},
|
||||
paraAlignRight: {
|
||||
tap: "onParaAlignRightTap"
|
||||
},
|
||||
paraAlignFill: {
|
||||
tap: "onParaAlignFillTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
onParaAlignPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onParaAlignPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onPrAlign", Ext.bind(this.onApiParagraphAlign, this));
|
||||
}
|
||||
},
|
||||
onParaAlignLeftTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(1);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignCenterTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(2);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignRightTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(0);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
onParaAlignFillTap: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PrAlign(3);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Align");
|
||||
}
|
||||
},
|
||||
toggleSegmentedButton: function (btn) {
|
||||
var toggler = this.getParaAlignsToggle();
|
||||
if (toggler) {
|
||||
var pressedButtonsNew = [];
|
||||
if (btn) {
|
||||
pressedButtonsNew.push(btn);
|
||||
}
|
||||
toggler.setPressedButtons(pressedButtonsNew);
|
||||
}
|
||||
},
|
||||
onApiParagraphAlign: function (v) {
|
||||
var paragraphAlignmentButton = this.getParagraphAlignmentButton();
|
||||
if (paragraphAlignmentButton && Ext.isDefined(v)) {
|
||||
switch (v) {
|
||||
case 0:
|
||||
paragraphAlignmentButton.setIconCls("align-right");
|
||||
break;
|
||||
case 1:
|
||||
paragraphAlignmentButton.setIconCls("align-left");
|
||||
break;
|
||||
case 2:
|
||||
paragraphAlignmentButton.setIconCls("align-center");
|
||||
break;
|
||||
default:
|
||||
case 3:
|
||||
paragraphAlignmentButton.setIconCls("align-fill");
|
||||
}
|
||||
}
|
||||
if (this.getHandleApiEvent()) {
|
||||
if (!Ext.isDefined(v)) {
|
||||
this.toggleSegmentedButton();
|
||||
return;
|
||||
}
|
||||
switch (v) {
|
||||
case 0:
|
||||
this.toggleSegmentedButton(this.getParaAlignRight());
|
||||
break;
|
||||
case 1:
|
||||
this.toggleSegmentedButton(this.getParaAlignLeft());
|
||||
break;
|
||||
case 2:
|
||||
this.toggleSegmentedButton(this.getParaAlignCenter());
|
||||
break;
|
||||
default:
|
||||
case 3:
|
||||
this.toggleSegmentedButton(this.getParaAlignFill());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,180 +1,180 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Spacing", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
spacingPanel: "spacingpanel",
|
||||
navigateView: "#id-spacing-navigate",
|
||||
spacingListView: "#id-spacing-root",
|
||||
spacingValueListView: "#id-spacing-linespacing"
|
||||
},
|
||||
control: {
|
||||
spacingPanel: {
|
||||
show: "onSpacingPanelShow",
|
||||
hide: "onSpacingPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onSpacingListViewPush",
|
||||
pop: "onSpacingListViewPop",
|
||||
back: "onSpacingListViewBack"
|
||||
},
|
||||
spacingListView: {
|
||||
itemsingletap: "onSpacingListItemTap"
|
||||
},
|
||||
spacingValueListView: {
|
||||
itemsingletap: "onSpacingValueListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onParaSpacingLine", Ext.bind(this.onApiLineSpacing, this));
|
||||
}
|
||||
},
|
||||
onSpacingPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onSpacingPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onSpacingListItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-linespacing-increaseindent") {
|
||||
this.api && this.api.IncreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
} else {
|
||||
if (cmdId == "id-linespacing-decrementindent") {
|
||||
this.api && this.api.DecreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onSpacingValueListItemTap: function (cmp, index, target, record) {
|
||||
var spacingVal = parseFloat(record.get("setting")),
|
||||
LINERULE_AUTO = 1;
|
||||
this.api && this.api.put_PrLineSpacing(LINERULE_AUTO, spacingVal);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Line Spacing");
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-spacing-linespacing":
|
||||
return 360;
|
||||
default:
|
||||
case "id-spacing-root":
|
||||
return 235;
|
||||
}
|
||||
},
|
||||
onSpacingListViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view.id));
|
||||
}
|
||||
},
|
||||
onSpacingListViewPop: function (cmp, view) {},
|
||||
onSpacingListViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onApiLineSpacing: function (info) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
if (Ext.isDefined(info)) {
|
||||
var spacingValueListView = this.getSpacingValueListView();
|
||||
if (spacingValueListView) {
|
||||
if (info.get_Line() === null || info.get_LineRule() === null || info.get_LineRule() != 1) {
|
||||
spacingValueListView.deselectAll();
|
||||
return;
|
||||
}
|
||||
var line = info.get_Line();
|
||||
if (Math.abs(line - 1) < 0.0001) {
|
||||
spacingValueListView.select(0);
|
||||
} else {
|
||||
if (Math.abs(line - 1.15) < 0.0001) {
|
||||
spacingValueListView.select(1);
|
||||
} else {
|
||||
if (Math.abs(line - 1.5) < 0.0001) {
|
||||
spacingValueListView.select(2);
|
||||
} else {
|
||||
if (Math.abs(line - 2) < 0.0001) {
|
||||
spacingValueListView.select(3);
|
||||
} else {
|
||||
if (Math.abs(line - 2.5) < 0.0001) {
|
||||
spacingValueListView.select(4);
|
||||
} else {
|
||||
if (Math.abs(line - 3) < 0.0001) {
|
||||
spacingValueListView.select(5);
|
||||
} else {
|
||||
spacingValueListView.deselectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Spacing", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
spacingPanel: "spacingpanel",
|
||||
navigateView: "#id-spacing-navigate",
|
||||
spacingListView: "#id-spacing-root",
|
||||
spacingValueListView: "#id-spacing-linespacing"
|
||||
},
|
||||
control: {
|
||||
spacingPanel: {
|
||||
show: "onSpacingPanelShow",
|
||||
hide: "onSpacingPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onSpacingListViewPush",
|
||||
pop: "onSpacingListViewPop",
|
||||
back: "onSpacingListViewBack"
|
||||
},
|
||||
spacingListView: {
|
||||
itemsingletap: "onSpacingListItemTap"
|
||||
},
|
||||
spacingValueListView: {
|
||||
itemsingletap: "onSpacingValueListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onParaSpacingLine", Ext.bind(this.onApiLineSpacing, this));
|
||||
}
|
||||
},
|
||||
onSpacingPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onSpacingPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onSpacingListItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-linespacing-increaseindent") {
|
||||
this.api && this.api.IncreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
} else {
|
||||
if (cmdId == "id-linespacing-decrementindent") {
|
||||
this.api && this.api.DecreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onSpacingValueListItemTap: function (cmp, index, target, record) {
|
||||
var spacingVal = parseFloat(record.get("setting")),
|
||||
LINERULE_AUTO = 1;
|
||||
this.api && this.api.put_PrLineSpacing(LINERULE_AUTO, spacingVal);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Line Spacing");
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-spacing-linespacing":
|
||||
return 360;
|
||||
default:
|
||||
case "id-spacing-root":
|
||||
return 235;
|
||||
}
|
||||
},
|
||||
onSpacingListViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view.id));
|
||||
}
|
||||
},
|
||||
onSpacingListViewPop: function (cmp, view) {},
|
||||
onSpacingListViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onApiLineSpacing: function (info) {
|
||||
if (this.getHandleApiEvent()) {
|
||||
if (Ext.isDefined(info)) {
|
||||
var spacingValueListView = this.getSpacingValueListView();
|
||||
if (spacingValueListView) {
|
||||
if (info.get_Line() === null || info.get_LineRule() === null || info.get_LineRule() != 1) {
|
||||
spacingValueListView.deselectAll();
|
||||
return;
|
||||
}
|
||||
var line = info.get_Line();
|
||||
if (Math.abs(line - 1) < 0.0001) {
|
||||
spacingValueListView.select(0);
|
||||
} else {
|
||||
if (Math.abs(line - 1.15) < 0.0001) {
|
||||
spacingValueListView.select(1);
|
||||
} else {
|
||||
if (Math.abs(line - 1.5) < 0.0001) {
|
||||
spacingValueListView.select(2);
|
||||
} else {
|
||||
if (Math.abs(line - 2) < 0.0001) {
|
||||
spacingValueListView.select(3);
|
||||
} else {
|
||||
if (Math.abs(line - 2.5) < 0.0001) {
|
||||
spacingValueListView.select(4);
|
||||
} else {
|
||||
if (Math.abs(line - 3) < 0.0001) {
|
||||
spacingValueListView.select(5);
|
||||
} else {
|
||||
spacingValueListView.deselectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,156 +1,156 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Style", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
listStylePanel: "liststylepanel",
|
||||
navigateView: "#id-liststyle-navigate",
|
||||
listStyleView: "#id-liststyle-root",
|
||||
bulletsListView: "#id-liststyle-bullets",
|
||||
numberingListView: "#id-liststyle-numbering",
|
||||
outlineListView: "#id-liststyle-outline",
|
||||
bulletsList: "#id-liststyle-bullets dataview",
|
||||
numberingList: "#id-liststyle-numbering dataview",
|
||||
outlineList: "#id-liststyle-outline dataview"
|
||||
},
|
||||
control: {
|
||||
listStylePanel: {
|
||||
show: "onListStylePanelShow",
|
||||
hide: "onListStylePanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onListStyleViewPush",
|
||||
pop: "onListStyleViewPop",
|
||||
back: "onListStyleViewBack"
|
||||
},
|
||||
listStyleView: {
|
||||
itemsingletap: "onListStyleItemTap"
|
||||
},
|
||||
bulletsList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
},
|
||||
numberingList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
},
|
||||
outlineList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
onListStylePanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onListStylePanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onListStyleItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-list-indent-increment") {
|
||||
this.onIncrementIndentButton();
|
||||
} else {
|
||||
if (cmdId == "id-list-indent-decrement") {
|
||||
this.onDecrementIndentButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var childId = record.get("child");
|
||||
if (!Ext.isEmpty(childId)) {
|
||||
var childCmp = Ext.getCmp(childId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-liststyle-bullets":
|
||||
case "id-liststyle-numbering":
|
||||
return 225;
|
||||
case "id-liststyle-outline":
|
||||
return 150;
|
||||
default:
|
||||
case "id-liststyle-root":
|
||||
return 328;
|
||||
}
|
||||
},
|
||||
onListStyleViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view.id));
|
||||
}
|
||||
},
|
||||
onListStyleViewPop: function (cmp, view) {},
|
||||
onListStyleViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onCommonListItemTap: function (view, index, target, record) {
|
||||
this.api && this.api.put_ListType(parseInt(record.get("type")), parseInt(record.get("subtype")));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "List Type");
|
||||
},
|
||||
onIncrementIndentButton: function () {
|
||||
this.api && this.api.IncreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
},
|
||||
onDecrementIndentButton: function () {
|
||||
this.api && this.api.DecreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.Style", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
listStylePanel: "liststylepanel",
|
||||
navigateView: "#id-liststyle-navigate",
|
||||
listStyleView: "#id-liststyle-root",
|
||||
bulletsListView: "#id-liststyle-bullets",
|
||||
numberingListView: "#id-liststyle-numbering",
|
||||
outlineListView: "#id-liststyle-outline",
|
||||
bulletsList: "#id-liststyle-bullets dataview",
|
||||
numberingList: "#id-liststyle-numbering dataview",
|
||||
outlineList: "#id-liststyle-outline dataview"
|
||||
},
|
||||
control: {
|
||||
listStylePanel: {
|
||||
show: "onListStylePanelShow",
|
||||
hide: "onListStylePanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onListStyleViewPush",
|
||||
pop: "onListStyleViewPop",
|
||||
back: "onListStyleViewBack"
|
||||
},
|
||||
listStyleView: {
|
||||
itemsingletap: "onListStyleItemTap"
|
||||
},
|
||||
bulletsList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
},
|
||||
numberingList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
},
|
||||
outlineList: {
|
||||
itemsingletap: "onCommonListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
onListStylePanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onListStylePanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onListStyleItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView(),
|
||||
cmdId = record.get("id");
|
||||
if (!Ext.isEmpty(cmdId)) {
|
||||
if (cmdId == "id-list-indent-increment") {
|
||||
this.onIncrementIndentButton();
|
||||
} else {
|
||||
if (cmdId == "id-list-indent-decrement") {
|
||||
this.onDecrementIndentButton();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (navigateView) {
|
||||
var childId = record.get("child");
|
||||
if (!Ext.isEmpty(childId)) {
|
||||
var childCmp = Ext.getCmp(childId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-liststyle-bullets":
|
||||
case "id-liststyle-numbering":
|
||||
return 225;
|
||||
case "id-liststyle-outline":
|
||||
return 150;
|
||||
default:
|
||||
case "id-liststyle-root":
|
||||
return 328;
|
||||
}
|
||||
},
|
||||
onListStyleViewPush: function (cmp, view) {
|
||||
var parentCmp = cmp.getParent();
|
||||
if (parentCmp) {
|
||||
parentCmp.setHeight(this.getHeightById(view.id));
|
||||
}
|
||||
},
|
||||
onListStyleViewPop: function (cmp, view) {},
|
||||
onListStyleViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
parentCmp.setHeight(this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onCommonListItemTap: function (view, index, target, record) {
|
||||
this.api && this.api.put_ListType(parseInt(record.get("type")), parseInt(record.get("subtype")));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "List Type");
|
||||
},
|
||||
onIncrementIndentButton: function () {
|
||||
this.api && this.api.IncreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
},
|
||||
onDecrementIndentButton: function () {
|
||||
this.api && this.api.DecreaseIndent();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Indent");
|
||||
}
|
||||
});
|
||||
@@ -1,258 +1,258 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.TextColor", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
textColorPanel: "textcolorsettingspanel",
|
||||
navigateView: "#id-textcolor-navigate",
|
||||
textColorView: "#id-textcolor-root",
|
||||
highlightColorList: "#id-textcolor-highlight dataview",
|
||||
textColorList: "#id-textcolor-text dataview",
|
||||
noFillColorButton: "#id-btn-highlight-none"
|
||||
},
|
||||
control: {
|
||||
textColorPanel: {
|
||||
show: "onTextColorPanelShow",
|
||||
hide: "onTextColorPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
textColorView: {
|
||||
itemsingletap: "onTextColorItemTap"
|
||||
},
|
||||
highlightColorList: {
|
||||
itemsingletap: "onHighlightListItemTap"
|
||||
},
|
||||
noFillColorButton: {
|
||||
tap: "onNoFillColorTap"
|
||||
},
|
||||
textColorList: {
|
||||
itemsingletap: "onTextColorListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onTextColor", Ext.bind(this.onApiTextColor, this));
|
||||
this.api.asc_registerCallback("asc_onTextHighLight", Ext.bind(this.onApiHighlightColor, this));
|
||||
}
|
||||
},
|
||||
onTextColorPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onTextColorPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onTextColorItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onHighlightListItemTap: function (cmp, index, target, record) {
|
||||
var noFillColorButton = this.getNoFillColorButton(),
|
||||
highlightColorList = this.getHighlightColorList();
|
||||
if (noFillColorButton && highlightColorList) {
|
||||
noFillColorButton.removeCls("x-button-pressing pressed");
|
||||
highlightColorList.select(record);
|
||||
var color = record.get("color"),
|
||||
r = color[0] + color[1],
|
||||
g = color[2] + color[3],
|
||||
b = color[4] + color[5];
|
||||
this.api && this.api.SetMarkerFormat(true, true, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Highlight Color");
|
||||
}
|
||||
},
|
||||
onNoFillColorTap: function (btn) {
|
||||
var noFillColorButton = this.getNoFillColorButton(),
|
||||
highlightColorList = this.getHighlightColorList();
|
||||
if (noFillColorButton && highlightColorList) {
|
||||
if (!btn.element.hasCls("x-button-pressing pressed")) {
|
||||
highlightColorList.deselectAll();
|
||||
noFillColorButton.addCls("x-button-pressing pressed");
|
||||
this.api && this.api.SetMarkerFormat(true, false);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Highlight Color");
|
||||
}
|
||||
}
|
||||
},
|
||||
onTextColorListItemTap: function (cmp, index, target, record) {
|
||||
var textColorList = this.getTextColorList();
|
||||
if (textColorList) {
|
||||
textColorList.select(record);
|
||||
var color = record.get("color"),
|
||||
ascColor = new CAscColor();
|
||||
ascColor.put_r(parseInt((color[0] + color[1]), 16));
|
||||
ascColor.put_g(parseInt((color[2] + color[3]), 16));
|
||||
ascColor.put_b(parseInt((color[4] + color[5]), 16));
|
||||
this.api && this.api.put_TextColor(ascColor);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Text Color");
|
||||
}
|
||||
},
|
||||
scrollToSelected: function (view) {
|
||||
if (view && view.isXType("dataview")) {
|
||||
var el = view.element,
|
||||
cls = view.getSelectedCls(),
|
||||
selected = el.down("." + cls),
|
||||
y;
|
||||
if (selected) {
|
||||
y = selected.dom.offsetTop;
|
||||
Ext.defer(function () {
|
||||
var scroller = view.getScrollable().getScroller().getTranslatable()._element;
|
||||
if (scroller && y > scroller.getHeight() - view.element.getHeight()) {
|
||||
y = scroller.getHeight() - view.element.getHeight();
|
||||
}
|
||||
view.getScrollable().getScroller().scrollTo(0, y, true);
|
||||
},
|
||||
500);
|
||||
}
|
||||
}
|
||||
},
|
||||
animateSetHeight: function (cmp, height) {
|
||||
if (Ext.isDefined(cmp)) {
|
||||
cmp.setHeight(height);
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-textcolor-root":
|
||||
return 172;
|
||||
case "id-textcolor-highlight":
|
||||
return 326;
|
||||
default:
|
||||
case "id-textcolor-text":
|
||||
return 336;
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
this.animateSetHeight(cmp.getParent(), this.getHeightById(view.id));
|
||||
if (view.id == "id-textcolor-highlight") {
|
||||
this.scrollToSelected(this.getHighlightColorList());
|
||||
} else {
|
||||
if (view.id == "id-textcolor-text") {
|
||||
this.scrollToSelected(this.getTextColorList());
|
||||
}
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
this.animateSetHeight(parentCmp, this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onApiTextColor: function (color) {
|
||||
if (this.getHandleApiEvent() && Ext.isDefined(color)) {
|
||||
var textColorList = this.getTextColorList();
|
||||
if (textColorList) {
|
||||
var colorToHex = function (r, g, b) {
|
||||
var r = r.toString(16),
|
||||
g = g.toString(16),
|
||||
b = b.toString(16);
|
||||
if (r.length == 1) {
|
||||
r = "0" + r;
|
||||
}
|
||||
if (g.length == 1) {
|
||||
g = "0" + g;
|
||||
}
|
||||
if (b.length == 1) {
|
||||
b = "0" + b;
|
||||
}
|
||||
return (r + g + b).toUpperCase();
|
||||
};
|
||||
var hexColor = colorToHex(color.get_r(), color.get_g(), color.get_b()),
|
||||
recColor = textColorList.getStore().findRecord("color", hexColor);
|
||||
if (recColor) {
|
||||
textColorList.select(recColor);
|
||||
} else {
|
||||
textColorList.deselectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiHighlightColor: function (color) {
|
||||
if (this.getHandleApiEvent() && Ext.isDefined(color)) {
|
||||
var textPara = this.api.get_TextProps().get_TextPr(),
|
||||
highlightColorList = this.getHighlightColorList(),
|
||||
noFillColorButton = this.getNoFillColorButton();
|
||||
var pressNoColor = function () {
|
||||
highlightColorList.deselectAll();
|
||||
noFillColorButton.addCls("x-button-pressing pressed");
|
||||
};
|
||||
if (textPara) {
|
||||
color = textPara.get_HighLight();
|
||||
if (color == -1) {
|
||||
pressNoColor();
|
||||
} else {
|
||||
var hexColor = color.get_hex().toUpperCase();
|
||||
if (highlightColorList) {
|
||||
var recColor = highlightColorList.getStore().findRecord("color", hexColor);
|
||||
if (recColor) {
|
||||
noFillColorButton.removeCls("x-button-pressing pressed");
|
||||
highlightColorList.select(recColor);
|
||||
} else {
|
||||
pressNoColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.tablet.panel.TextColor", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
textColorPanel: "textcolorsettingspanel",
|
||||
navigateView: "#id-textcolor-navigate",
|
||||
textColorView: "#id-textcolor-root",
|
||||
highlightColorList: "#id-textcolor-highlight dataview",
|
||||
textColorList: "#id-textcolor-text dataview",
|
||||
noFillColorButton: "#id-btn-highlight-none"
|
||||
},
|
||||
control: {
|
||||
textColorPanel: {
|
||||
show: "onTextColorPanelShow",
|
||||
hide: "onTextColorPanelHide"
|
||||
},
|
||||
navigateView: {
|
||||
push: "onNavigateViewPush",
|
||||
pop: "onNavigateViewPop",
|
||||
back: "onNavigateViewBack"
|
||||
},
|
||||
textColorView: {
|
||||
itemsingletap: "onTextColorItemTap"
|
||||
},
|
||||
highlightColorList: {
|
||||
itemsingletap: "onHighlightListItemTap"
|
||||
},
|
||||
noFillColorButton: {
|
||||
tap: "onNoFillColorTap"
|
||||
},
|
||||
textColorList: {
|
||||
itemsingletap: "onTextColorListItemTap"
|
||||
}
|
||||
},
|
||||
handleApiEvent: false
|
||||
},
|
||||
init: function () {},
|
||||
launch: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onTextColor", Ext.bind(this.onApiTextColor, this));
|
||||
this.api.asc_registerCallback("asc_onTextHighLight", Ext.bind(this.onApiHighlightColor, this));
|
||||
}
|
||||
},
|
||||
onTextColorPanelShow: function (cmp) {
|
||||
this.setHandleApiEvent(true);
|
||||
this.api && this.api.UpdateInterfaceState();
|
||||
},
|
||||
onTextColorPanelHide: function (cmp) {
|
||||
this.setHandleApiEvent(false);
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getInAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getInAnimation().stop();
|
||||
}
|
||||
if (Ext.isDefined(navigateView.getLayout().getAnimation().getOutAnimation)) {
|
||||
navigateView.getLayout().getAnimation().getOutAnimation().stop();
|
||||
}
|
||||
navigateView.reset();
|
||||
var activeItem = navigateView.getActiveItem(),
|
||||
panelHeight = this.getHeightById(activeItem && activeItem.id);
|
||||
cmp.setHeight(panelHeight);
|
||||
}
|
||||
},
|
||||
onTextColorItemTap: function (cmp, index, target, record) {
|
||||
var navigateView = this.getNavigateView();
|
||||
if (navigateView) {
|
||||
var cmpId = record.get("child");
|
||||
if (!Ext.isEmpty(cmpId)) {
|
||||
var childCmp = Ext.getCmp(cmpId);
|
||||
if (childCmp) {
|
||||
navigateView.push(childCmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onHighlightListItemTap: function (cmp, index, target, record) {
|
||||
var noFillColorButton = this.getNoFillColorButton(),
|
||||
highlightColorList = this.getHighlightColorList();
|
||||
if (noFillColorButton && highlightColorList) {
|
||||
noFillColorButton.removeCls("x-button-pressing pressed");
|
||||
highlightColorList.select(record);
|
||||
var color = record.get("color"),
|
||||
r = color[0] + color[1],
|
||||
g = color[2] + color[3],
|
||||
b = color[4] + color[5];
|
||||
this.api && this.api.SetMarkerFormat(true, true, parseInt(r, 16), parseInt(g, 16), parseInt(b, 16));
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Highlight Color");
|
||||
}
|
||||
},
|
||||
onNoFillColorTap: function (btn) {
|
||||
var noFillColorButton = this.getNoFillColorButton(),
|
||||
highlightColorList = this.getHighlightColorList();
|
||||
if (noFillColorButton && highlightColorList) {
|
||||
if (!btn.element.hasCls("x-button-pressing pressed")) {
|
||||
highlightColorList.deselectAll();
|
||||
noFillColorButton.addCls("x-button-pressing pressed");
|
||||
this.api && this.api.SetMarkerFormat(true, false);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Highlight Color");
|
||||
}
|
||||
}
|
||||
},
|
||||
onTextColorListItemTap: function (cmp, index, target, record) {
|
||||
var textColorList = this.getTextColorList();
|
||||
if (textColorList) {
|
||||
textColorList.select(record);
|
||||
var color = record.get("color"),
|
||||
ascColor = new CAscColor();
|
||||
ascColor.put_r(parseInt((color[0] + color[1]), 16));
|
||||
ascColor.put_g(parseInt((color[2] + color[3]), 16));
|
||||
ascColor.put_b(parseInt((color[4] + color[5]), 16));
|
||||
this.api && this.api.put_TextColor(ascColor);
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Text Color");
|
||||
}
|
||||
},
|
||||
scrollToSelected: function (view) {
|
||||
if (view && view.isXType("dataview")) {
|
||||
var el = view.element,
|
||||
cls = view.getSelectedCls(),
|
||||
selected = el.down("." + cls),
|
||||
y;
|
||||
if (selected) {
|
||||
y = selected.dom.offsetTop;
|
||||
Ext.defer(function () {
|
||||
var scroller = view.getScrollable().getScroller().getTranslatable()._element;
|
||||
if (scroller && y > scroller.getHeight() - view.element.getHeight()) {
|
||||
y = scroller.getHeight() - view.element.getHeight();
|
||||
}
|
||||
view.getScrollable().getScroller().scrollTo(0, y, true);
|
||||
},
|
||||
500);
|
||||
}
|
||||
}
|
||||
},
|
||||
animateSetHeight: function (cmp, height) {
|
||||
if (Ext.isDefined(cmp)) {
|
||||
cmp.setHeight(height);
|
||||
}
|
||||
},
|
||||
getHeightById: function (id) {
|
||||
switch (id) {
|
||||
case "id-textcolor-root":
|
||||
return 172;
|
||||
case "id-textcolor-highlight":
|
||||
return 326;
|
||||
default:
|
||||
case "id-textcolor-text":
|
||||
return 336;
|
||||
}
|
||||
},
|
||||
onNavigateViewPush: function (cmp, view) {
|
||||
this.animateSetHeight(cmp.getParent(), this.getHeightById(view.id));
|
||||
if (view.id == "id-textcolor-highlight") {
|
||||
this.scrollToSelected(this.getHighlightColorList());
|
||||
} else {
|
||||
if (view.id == "id-textcolor-text") {
|
||||
this.scrollToSelected(this.getTextColorList());
|
||||
}
|
||||
}
|
||||
},
|
||||
onNavigateViewPop: function (cmp, view) {},
|
||||
onNavigateViewBack: function (cmp) {
|
||||
var parentCmp = cmp.getParent(),
|
||||
activeItem = cmp.getActiveItem();
|
||||
if (parentCmp && activeItem) {
|
||||
this.animateSetHeight(parentCmp, this.getHeightById(activeItem && activeItem.id));
|
||||
}
|
||||
},
|
||||
onApiTextColor: function (color) {
|
||||
if (this.getHandleApiEvent() && Ext.isDefined(color)) {
|
||||
var textColorList = this.getTextColorList();
|
||||
if (textColorList) {
|
||||
var colorToHex = function (r, g, b) {
|
||||
var r = r.toString(16),
|
||||
g = g.toString(16),
|
||||
b = b.toString(16);
|
||||
if (r.length == 1) {
|
||||
r = "0" + r;
|
||||
}
|
||||
if (g.length == 1) {
|
||||
g = "0" + g;
|
||||
}
|
||||
if (b.length == 1) {
|
||||
b = "0" + b;
|
||||
}
|
||||
return (r + g + b).toUpperCase();
|
||||
};
|
||||
var hexColor = colorToHex(color.get_r(), color.get_g(), color.get_b()),
|
||||
recColor = textColorList.getStore().findRecord("color", hexColor);
|
||||
if (recColor) {
|
||||
textColorList.select(recColor);
|
||||
} else {
|
||||
textColorList.deselectAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onApiHighlightColor: function (color) {
|
||||
if (this.getHandleApiEvent() && Ext.isDefined(color)) {
|
||||
var textPara = this.api.get_TextProps().get_TextPr(),
|
||||
highlightColorList = this.getHighlightColorList(),
|
||||
noFillColorButton = this.getNoFillColorButton();
|
||||
var pressNoColor = function () {
|
||||
highlightColorList.deselectAll();
|
||||
noFillColorButton.addCls("x-button-pressing pressed");
|
||||
};
|
||||
if (textPara) {
|
||||
color = textPara.get_HighLight();
|
||||
if (color == -1) {
|
||||
pressNoColor();
|
||||
} else {
|
||||
var hexColor = color.get_hex().toUpperCase();
|
||||
if (highlightColorList) {
|
||||
var recColor = highlightColorList.getStore().findRecord("color", hexColor);
|
||||
if (recColor) {
|
||||
noFillColorButton.removeCls("x-button-pressing pressed");
|
||||
highlightColorList.select(recColor);
|
||||
} else {
|
||||
pressNoColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,238 +1,249 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.toolbar.Edit", {
|
||||
extend: "Ext.app.Controller",
|
||||
requires: (["Ext.MessageBox", "Ext.util.Point", "Ext.util.Region", "DE.view.tablet.panel.Font", "DE.view.tablet.panel.FontStyle", "DE.view.tablet.panel.Insert", "DE.view.tablet.panel.ListStyle", "DE.view.tablet.panel.ParagraphAlignment", "DE.view.tablet.panel.Spacing", "DE.view.tablet.panel.TextColor"]),
|
||||
config: {
|
||||
refs: {
|
||||
doneButton: "#id-tb-btn-done",
|
||||
saveButton: "#id-tb-btn-save",
|
||||
undoButton: "#id-tb-btn-undo",
|
||||
fontButton: "#id-tb-btn-font",
|
||||
fontStyleButton: "#id-tb-btn-style",
|
||||
textColorButton: "#id-tb-btn-color",
|
||||
paragraphAlignmentButton: "#id-tb-btn-align",
|
||||
listStyleButton: "#id-tb-btn-liststyle",
|
||||
paragraphButton: "#id-tb-btn-paragraph",
|
||||
tableButton: "#id-tb-btn-table",
|
||||
shareButton: "#id-tb-btn-share",
|
||||
textColorPanel: "#id-panel-text-color",
|
||||
paragraphPanel: "#id-panel-spacing",
|
||||
paragraphAlignmentPanel: "#id-panel-paragraph-alignment",
|
||||
fontStylePanel: "#id-panel-font-style",
|
||||
listStylePanel: "#id-panel-liststyle",
|
||||
insertPanel: "#id-panel-insert",
|
||||
fontPanel: "#id-panel-font"
|
||||
},
|
||||
control: {
|
||||
doneButton: {
|
||||
tap: "onTapDone"
|
||||
},
|
||||
saveButton: {
|
||||
tap: "onTapSave"
|
||||
},
|
||||
undoButton: {
|
||||
tap: "onTapUndo"
|
||||
},
|
||||
fontButton: {
|
||||
tap: "onTapFont"
|
||||
},
|
||||
fontStyleButton: {
|
||||
tap: "onTapFontStyle"
|
||||
},
|
||||
textColorButton: {
|
||||
tap: "onTapTextColor"
|
||||
},
|
||||
paragraphAlignmentButton: {
|
||||
tap: "onTabParagraphAlignment"
|
||||
},
|
||||
listStyleButton: {
|
||||
tap: "onTapListStyle"
|
||||
},
|
||||
paragraphButton: {
|
||||
tap: "onTapParagraphButton"
|
||||
},
|
||||
tableButton: {
|
||||
tap: "onTapTable"
|
||||
},
|
||||
shareButton: {
|
||||
tap: "onTapShare"
|
||||
}
|
||||
}
|
||||
},
|
||||
launch: function () {
|
||||
this.callParent(arguments);
|
||||
Ext.getCmp("id-conteiner-document").on("resize", this.onEditorResize, this);
|
||||
var toolbarButtons = Ext.ComponentQuery.query("edittoolbar > button, edittoolbar > toolbar > button");
|
||||
Ext.each(Ext.ComponentQuery.query("commonpopoverpanel"), function (panel) {
|
||||
var modal = panel.getModal();
|
||||
if (modal) {
|
||||
modal.on("tap", function (mask, event) {
|
||||
Ext.each(toolbarButtons, function (button) {
|
||||
if (button !== panel.alignByCmp) {
|
||||
var mousePoint = Ext.util.Point.fromEvent(event),
|
||||
buttonRect = Ext.util.Region.from(button.element.getPageBox());
|
||||
if (!buttonRect.isOutOfBound(mousePoint)) {
|
||||
button.fireEvent("tap", button, event);
|
||||
}
|
||||
}
|
||||
},
|
||||
this);
|
||||
},
|
||||
this);
|
||||
}
|
||||
},
|
||||
this);
|
||||
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
|
||||
},
|
||||
initControl: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initApi: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onCanUndo", Ext.bind(this.onApiCanUndo, this));
|
||||
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
|
||||
}
|
||||
},
|
||||
loadConfig: function (data) {
|
||||
var doneButton = this.getDoneButton();
|
||||
if (doneButton && data && data.config && data.config.canBackToFolder === true) {
|
||||
doneButton.show();
|
||||
}
|
||||
},
|
||||
onApiCanUndo: function (can) {
|
||||
var undoButton = this.getUndoButton();
|
||||
undoButton && undoButton.setDisabled(!can);
|
||||
},
|
||||
onCoAuthoringDisconnect: function () {
|
||||
Ext.each(Ext.ComponentQuery.query("commonpopoverpanel"), function (panel) {
|
||||
panel.hide();
|
||||
});
|
||||
Ext.each(Ext.ComponentQuery.query("edittoolbar > button, edittoolbar > toolbar > button"), function (btn) {
|
||||
btn.removeCls("x-button-pressing");
|
||||
btn.disable();
|
||||
});
|
||||
var shareButton = this.getShareButton();
|
||||
shareButton && shareButton.enable();
|
||||
},
|
||||
showToolbarPanel: function (panel, button) {
|
||||
if (panel && button) {
|
||||
panel.on("hide", Ext.bind(function () {
|
||||
button.removeCls("x-button-pressing");
|
||||
},
|
||||
this), this, {
|
||||
single: true
|
||||
});
|
||||
button.addCls("x-button-pressing");
|
||||
Ext.each(Ext.ComponentQuery.query("popclip"), function (cmp) {
|
||||
cmp.hide(true);
|
||||
},
|
||||
this);
|
||||
panel.alignByCmp = button;
|
||||
panel.setLeft(0);
|
||||
panel.setTop(0);
|
||||
panel.showBy(button);
|
||||
}
|
||||
},
|
||||
onTapDone: function () {
|
||||
if (this.api.isDocumentModified()) {
|
||||
Ext.Msg.show({
|
||||
title: this.dlgLeaveTitleText,
|
||||
message: this.dlgLeaveMsgText,
|
||||
buttons: [{
|
||||
text: this.leaveButtonText,
|
||||
itemId: "cancel",
|
||||
ui: "base"
|
||||
},
|
||||
{
|
||||
text: this.stayButtonText,
|
||||
itemId: "ok",
|
||||
ui: "base-blue"
|
||||
}],
|
||||
promptConfig: false,
|
||||
scope: this,
|
||||
fn: function (button) {
|
||||
if (button == "cancel") {
|
||||
Common.Gateway.goBack();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Common.Gateway.goBack();
|
||||
}
|
||||
},
|
||||
onTapSave: function () {
|
||||
this.api && this.api.asc_Save();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Save");
|
||||
},
|
||||
onTapUndo: function () {
|
||||
this.api && this.api.Undo();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Undo");
|
||||
},
|
||||
onTapShare: function () {
|
||||
this.api && this.api.asc_Print();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Share");
|
||||
},
|
||||
onTapFont: function () {
|
||||
this.showToolbarPanel(this.getFontPanel(), this.getFontButton());
|
||||
},
|
||||
onTapFontStyle: function () {
|
||||
this.showToolbarPanel(this.getFontStylePanel(), this.getFontStyleButton());
|
||||
},
|
||||
onTapTextColor: function () {
|
||||
this.showToolbarPanel(this.getTextColorPanel(), this.getTextColorButton());
|
||||
},
|
||||
onTabParagraphAlignment: function () {
|
||||
this.showToolbarPanel(this.getParagraphAlignmentPanel(), this.getParagraphAlignmentButton());
|
||||
},
|
||||
onTapListStyle: function () {
|
||||
this.showToolbarPanel(this.getListStylePanel(), this.getListStyleButton());
|
||||
},
|
||||
onTapParagraphButton: function () {
|
||||
this.showToolbarPanel(this.getParagraphPanel(), this.getParagraphButton());
|
||||
},
|
||||
onTapTable: function () {
|
||||
this.showToolbarPanel(this.getInsertPanel(), this.getTableButton());
|
||||
},
|
||||
onEditorResize: function (cmp) {
|
||||
var overlayPanels = Ext.ComponentQuery.query("commonpopoverpanel");
|
||||
Ext.each(overlayPanels, function (panel) {
|
||||
panel.hide();
|
||||
});
|
||||
},
|
||||
dlgLeaveTitleText: "You leave the application",
|
||||
dlgLeaveMsgText: "You have unsaved changes in this document. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.",
|
||||
leaveButtonText: "Leave this Page",
|
||||
stayButtonText: "Stay on this Page"
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.toolbar.Edit", {
|
||||
extend: "Ext.app.Controller",
|
||||
requires: (["Ext.MessageBox", "Ext.util.Point", "Ext.util.Region", "DE.view.tablet.panel.Font", "DE.view.tablet.panel.FontStyle", "DE.view.tablet.panel.Insert", "DE.view.tablet.panel.ListStyle", "DE.view.tablet.panel.ParagraphAlignment", "DE.view.tablet.panel.Spacing", "DE.view.tablet.panel.TextColor"]),
|
||||
config: {
|
||||
refs: {
|
||||
doneButton: "#id-tb-btn-done",
|
||||
saveButton: "#id-tb-btn-save",
|
||||
undoButton: "#id-tb-btn-undo",
|
||||
fontButton: "#id-tb-btn-font",
|
||||
fontStyleButton: "#id-tb-btn-style",
|
||||
textColorButton: "#id-tb-btn-color",
|
||||
paragraphAlignmentButton: "#id-tb-btn-align",
|
||||
listStyleButton: "#id-tb-btn-liststyle",
|
||||
paragraphButton: "#id-tb-btn-paragraph",
|
||||
tableButton: "#id-tb-btn-table",
|
||||
shareButton: "#id-tb-btn-share",
|
||||
textColorPanel: "#id-panel-text-color",
|
||||
paragraphPanel: "#id-panel-spacing",
|
||||
paragraphAlignmentPanel: "#id-panel-paragraph-alignment",
|
||||
fontStylePanel: "#id-panel-font-style",
|
||||
listStylePanel: "#id-panel-liststyle",
|
||||
insertPanel: "#id-panel-insert",
|
||||
fontPanel: "#id-panel-font"
|
||||
},
|
||||
control: {
|
||||
doneButton: {
|
||||
tap: "onTapDone"
|
||||
},
|
||||
saveButton: {
|
||||
tap: "onTapSave"
|
||||
},
|
||||
undoButton: {
|
||||
tap: "onTapUndo"
|
||||
},
|
||||
fontButton: {
|
||||
tap: "onTapFont"
|
||||
},
|
||||
fontStyleButton: {
|
||||
tap: "onTapFontStyle"
|
||||
},
|
||||
textColorButton: {
|
||||
tap: "onTapTextColor"
|
||||
},
|
||||
paragraphAlignmentButton: {
|
||||
tap: "onTabParagraphAlignment"
|
||||
},
|
||||
listStyleButton: {
|
||||
tap: "onTapListStyle"
|
||||
},
|
||||
paragraphButton: {
|
||||
tap: "onTapParagraphButton"
|
||||
},
|
||||
tableButton: {
|
||||
tap: "onTapTable"
|
||||
},
|
||||
shareButton: {
|
||||
tap: "onTapShare"
|
||||
}
|
||||
}
|
||||
},
|
||||
launch: function () {
|
||||
this.callParent(arguments);
|
||||
Ext.getCmp("id-conteiner-document").on("resize", this.onEditorResize, this);
|
||||
var toolbarButtons = Ext.ComponentQuery.query("edittoolbar > button, edittoolbar > toolbar > button");
|
||||
Ext.each(Ext.ComponentQuery.query("commonpopoverpanel"), function (panel) {
|
||||
var modal = panel.getModal();
|
||||
if (modal) {
|
||||
modal.on("tap", function (mask, event) {
|
||||
Ext.each(toolbarButtons, function (button) {
|
||||
if (button !== panel.alignByCmp) {
|
||||
var mousePoint = Ext.util.Point.fromEvent(event),
|
||||
buttonRect = Ext.util.Region.from(button.element.getPageBox());
|
||||
if (!buttonRect.isOutOfBound(mousePoint)) {
|
||||
button.fireEvent("tap", button, event);
|
||||
}
|
||||
}
|
||||
},
|
||||
this);
|
||||
},
|
||||
this);
|
||||
}
|
||||
},
|
||||
this);
|
||||
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
|
||||
},
|
||||
initControl: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initApi: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onCanUndo", Ext.bind(this.onApiCanUndo, this));
|
||||
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
|
||||
this.api.asc_registerCallback("asc_onDocumentModifiedChanged", Ext.bind(this.onApiDocumentModified, this));
|
||||
}
|
||||
},
|
||||
loadConfig: function (data) {
|
||||
var doneButton = this.getDoneButton();
|
||||
if (doneButton && data && data.config && data.config.canBackToFolder === true) {
|
||||
doneButton.show();
|
||||
}
|
||||
},
|
||||
onApiCanUndo: function (can) {
|
||||
var undoButton = this.getUndoButton();
|
||||
undoButton && undoButton.setDisabled(!can);
|
||||
},
|
||||
onCoAuthoringDisconnect: function () {
|
||||
Ext.each(Ext.ComponentQuery.query("commonpopoverpanel"), function (panel) {
|
||||
panel.hide();
|
||||
});
|
||||
Ext.each(Ext.ComponentQuery.query("edittoolbar > button, edittoolbar > toolbar > button"), function (btn) {
|
||||
btn.removeCls("x-button-pressing");
|
||||
btn.disable();
|
||||
});
|
||||
var shareButton = this.getShareButton();
|
||||
shareButton && shareButton.enable();
|
||||
},
|
||||
onApiDocumentModified: function () {
|
||||
var isModified = this.api.isDocumentModified();
|
||||
if (this.isDocModified !== isModified) {
|
||||
if (this.getSaveButton()) {
|
||||
this.getSaveButton().setDisabled(!isModified);
|
||||
}
|
||||
Common.Gateway.setDocumentModified(isModified);
|
||||
this.isDocModified = isModified;
|
||||
}
|
||||
},
|
||||
showToolbarPanel: function (panel, button) {
|
||||
if (panel && button) {
|
||||
panel.on("hide", Ext.bind(function () {
|
||||
button.removeCls("x-button-pressing");
|
||||
},
|
||||
this), this, {
|
||||
single: true
|
||||
});
|
||||
button.addCls("x-button-pressing");
|
||||
Ext.each(Ext.ComponentQuery.query("popclip"), function (cmp) {
|
||||
cmp.hide(true);
|
||||
},
|
||||
this);
|
||||
panel.alignByCmp = button;
|
||||
panel.setLeft(0);
|
||||
panel.setTop(0);
|
||||
panel.showBy(button);
|
||||
}
|
||||
},
|
||||
onTapDone: function () {
|
||||
if (this.api.isDocumentModified()) {
|
||||
Ext.Msg.show({
|
||||
title: this.dlgLeaveTitleText,
|
||||
message: this.dlgLeaveMsgText,
|
||||
buttons: [{
|
||||
text: this.leaveButtonText,
|
||||
itemId: "cancel",
|
||||
ui: "base"
|
||||
},
|
||||
{
|
||||
text: this.stayButtonText,
|
||||
itemId: "ok",
|
||||
ui: "base-blue"
|
||||
}],
|
||||
promptConfig: false,
|
||||
scope: this,
|
||||
fn: function (button) {
|
||||
if (button == "cancel") {
|
||||
Common.Gateway.goBack();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Common.Gateway.goBack();
|
||||
}
|
||||
},
|
||||
onTapSave: function () {
|
||||
this.api && this.api.asc_Save();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Save");
|
||||
},
|
||||
onTapUndo: function () {
|
||||
this.api && this.api.Undo();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Undo");
|
||||
},
|
||||
onTapShare: function () {
|
||||
this.api && this.api.asc_Print();
|
||||
Common.component.Analytics.trackEvent("ToolBar", "Share");
|
||||
},
|
||||
onTapFont: function () {
|
||||
this.showToolbarPanel(this.getFontPanel(), this.getFontButton());
|
||||
},
|
||||
onTapFontStyle: function () {
|
||||
this.showToolbarPanel(this.getFontStylePanel(), this.getFontStyleButton());
|
||||
},
|
||||
onTapTextColor: function () {
|
||||
this.showToolbarPanel(this.getTextColorPanel(), this.getTextColorButton());
|
||||
},
|
||||
onTabParagraphAlignment: function () {
|
||||
this.showToolbarPanel(this.getParagraphAlignmentPanel(), this.getParagraphAlignmentButton());
|
||||
},
|
||||
onTapListStyle: function () {
|
||||
this.showToolbarPanel(this.getListStylePanel(), this.getListStyleButton());
|
||||
},
|
||||
onTapParagraphButton: function () {
|
||||
this.showToolbarPanel(this.getParagraphPanel(), this.getParagraphButton());
|
||||
},
|
||||
onTapTable: function () {
|
||||
this.showToolbarPanel(this.getInsertPanel(), this.getTableButton());
|
||||
},
|
||||
onEditorResize: function (cmp) {
|
||||
var overlayPanels = Ext.ComponentQuery.query("commonpopoverpanel");
|
||||
Ext.each(overlayPanels, function (panel) {
|
||||
panel.hide();
|
||||
});
|
||||
},
|
||||
dlgLeaveTitleText: "You leave the application",
|
||||
dlgLeaveMsgText: "You have unsaved changes in this document. Click 'Stay on this Page' then 'Save' to save them. Click 'Leave this Page' to discard all the unsaved changes.",
|
||||
leaveButtonText: "Leave this Page",
|
||||
stayButtonText: "Stay on this Page"
|
||||
});
|
||||
@@ -1,342 +1,342 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.toolbar.View", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
viewToolbar: "viewtoolbar",
|
||||
searchToolbar: "searchtoolbar",
|
||||
doneButton: "#id-tb-btn-view-done",
|
||||
editModeButton: "#id-tb-btn-editmode",
|
||||
readModeButton: "#id-tb-btn-readable",
|
||||
searchButton: "#id-tb-btn-search",
|
||||
fullscreenButton: "#id-tb-btn-fullscreen",
|
||||
shareButton: "#id-tb-btn-view-share",
|
||||
incFontSizeButton: "#id-tb-btn-incfontsize",
|
||||
decFontSizeButton: "#id-tb-btn-decfontsize"
|
||||
},
|
||||
control: {
|
||||
doneButton: {
|
||||
tap: "onTapDoneButton"
|
||||
},
|
||||
editModeButton: {
|
||||
tap: "onTapEditModeButton"
|
||||
},
|
||||
searchButton: {
|
||||
tap: "onTapSearchButton"
|
||||
},
|
||||
readModeButton: {
|
||||
tap: "onTapReaderButton"
|
||||
},
|
||||
shareButton: {
|
||||
tap: "onTapShareButton"
|
||||
},
|
||||
incFontSizeButton: {
|
||||
tap: "onTapIncFontSizeButton"
|
||||
},
|
||||
decFontSizeButton: {
|
||||
tap: "onTapDecFontSizeButton"
|
||||
}
|
||||
},
|
||||
searchMode: false,
|
||||
fullscreenMode: false,
|
||||
readableMode: false
|
||||
},
|
||||
init: function () {
|
||||
this.control({
|
||||
fullscreenButton: {
|
||||
tap: Ext.Function.createBuffered(this.onTapFullscreenButton, 500, this)
|
||||
}
|
||||
});
|
||||
},
|
||||
launch: function () {
|
||||
this.callParent(arguments);
|
||||
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
|
||||
Common.Gateway.on("opendocument", Ext.bind(this.loadDocument, this));
|
||||
Common.Gateway.on("applyeditrights", Ext.bind(this.onApplyEditRights, this));
|
||||
},
|
||||
initControl: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initApi: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onTapEvent", Ext.bind(this.onSingleTapDocument, this));
|
||||
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
|
||||
}
|
||||
},
|
||||
loadConfig: function (data) {
|
||||
var doneButton = this.getDoneButton();
|
||||
if (doneButton && data && data.config && data.config.canBackToFolder === true) {
|
||||
doneButton.show();
|
||||
}
|
||||
},
|
||||
loadDocument: function (data) {
|
||||
var permissions = {};
|
||||
if (data.doc) {
|
||||
permissions = Ext.merge(permissions, data.doc.permissions);
|
||||
var editModeButton = this.getEditModeButton();
|
||||
if (editModeButton) {
|
||||
editModeButton.setHidden(permissions.edit !== true);
|
||||
}
|
||||
}
|
||||
},
|
||||
onApplyEditRights: function (data) {
|
||||
Ext.Viewport.unmask();
|
||||
if (data && data.allowed) {
|
||||
var mainController = this.getApplication().getController("tablet.Main");
|
||||
if (this.getReadableMode()) {
|
||||
this.setReadableMode(false);
|
||||
}
|
||||
if (this.getFullscreenMode()) {
|
||||
this.setFullscreenMode(false);
|
||||
}
|
||||
if (mainController) {
|
||||
mainController.setMode("edit");
|
||||
}
|
||||
} else {
|
||||
var editModeButton = this.getEditModeButton();
|
||||
editModeButton && editModeButton.hide();
|
||||
Ext.Msg.show({
|
||||
title: this.requestEditFailedTitleText,
|
||||
message: (data && data.message) || this.requestEditFailedMessageText,
|
||||
icon: Ext.Msg.INFO,
|
||||
buttons: Ext.Msg.OK
|
||||
});
|
||||
}
|
||||
},
|
||||
applySearchMode: function (search) {
|
||||
if (!Ext.isBoolean(search)) {
|
||||
Ext.Logger.error("Invalid parameters.");
|
||||
} else {
|
||||
var me = this,
|
||||
searchToolbar = me.getSearchToolbar(),
|
||||
searchButton = me.getSearchButton();
|
||||
if (searchToolbar) {
|
||||
if (search) {
|
||||
searchButton && searchButton.addCls("x-button-pressing");
|
||||
if (me.getFullscreenMode()) {
|
||||
searchToolbar.show({
|
||||
easing: "ease-out",
|
||||
preserveEndState: true,
|
||||
autoClear: false,
|
||||
from: {
|
||||
opacity: 0.3
|
||||
},
|
||||
to: {
|
||||
opacity: 0.9
|
||||
}
|
||||
});
|
||||
} else {
|
||||
searchToolbar.show();
|
||||
}
|
||||
} else {
|
||||
searchButton && searchButton.removeCls("x-button-pressing");
|
||||
if (me.getFullscreenMode()) {
|
||||
searchToolbar.hide({
|
||||
easing: "ease-in",
|
||||
to: {
|
||||
opacity: 0.3
|
||||
}
|
||||
});
|
||||
} else {
|
||||
searchToolbar.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
return search;
|
||||
}
|
||||
},
|
||||
applyFullscreenMode: function (fullscreen) {
|
||||
if (!Ext.isBoolean(fullscreen)) {
|
||||
Ext.Logger.error("Invalid parameters.");
|
||||
} else {
|
||||
var viewToolbar = this.getViewToolbar(),
|
||||
searchToolbar = this.getSearchToolbar(),
|
||||
fullscreenButton = this.getFullscreenButton(),
|
||||
popClipCmp = Ext.ComponentQuery.query("popclip");
|
||||
if (popClipCmp.length > 0) {
|
||||
popClipCmp[0].hide();
|
||||
}
|
||||
if (viewToolbar && searchToolbar) {
|
||||
if (fullscreen) {
|
||||
fullscreenButton && fullscreenButton.addCls("x-button-pressing");
|
||||
viewToolbar.setStyle({
|
||||
position: "absolute",
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: 0,
|
||||
opacity: 0.9,
|
||||
"z-index": 17
|
||||
});
|
||||
searchToolbar.setStyle({
|
||||
position: "absolute",
|
||||
left: 0,
|
||||
top: "44px",
|
||||
right: 0,
|
||||
opacity: 0.9,
|
||||
"z-index": 16
|
||||
});
|
||||
this.setHiddenToolbars(true);
|
||||
} else {
|
||||
viewToolbar.setStyle({
|
||||
position: "initial",
|
||||
opacity: 1
|
||||
});
|
||||
searchToolbar.setStyle({
|
||||
position: "initial",
|
||||
opacity: 1
|
||||
});
|
||||
viewToolbar.setDocked("top");
|
||||
searchToolbar.setDocked("top");
|
||||
}
|
||||
}
|
||||
return fullscreen;
|
||||
}
|
||||
},
|
||||
applyReadableMode: function (readable) {
|
||||
if (!Ext.isBoolean(readable)) {
|
||||
Ext.Logger.error("Invalid parameters.");
|
||||
} else {
|
||||
var searchButton = this.getSearchButton(),
|
||||
incFontSizeButton = this.getIncFontSizeButton(),
|
||||
decFontSizeButton = this.getDecFontSizeButton(),
|
||||
readModeButton = this.getReadModeButton(),
|
||||
popClipCmp = Ext.ComponentQuery.query("popclip"),
|
||||
shareButton = this.getShareButton();
|
||||
if (popClipCmp.length > 0) {
|
||||
popClipCmp[0].hide();
|
||||
}
|
||||
if (readable) {
|
||||
this.getSearchMode() && this.setSearchMode(false);
|
||||
readable && readModeButton && readModeButton.addCls("x-button-pressing");
|
||||
searchButton && searchButton.hide();
|
||||
incFontSizeButton && incFontSizeButton.show();
|
||||
decFontSizeButton && decFontSizeButton.show();
|
||||
shareButton && shareButton.setDisabled(true);
|
||||
} else {
|
||||
incFontSizeButton && incFontSizeButton.hide();
|
||||
decFontSizeButton && decFontSizeButton.hide();
|
||||
searchButton && searchButton.show();
|
||||
shareButton && shareButton.setDisabled(false);
|
||||
}
|
||||
this.api && this.api.ChangeReaderMode();
|
||||
return readable;
|
||||
}
|
||||
},
|
||||
setHiddenToolbars: function (hide) {
|
||||
var viewToolbar = this.getViewToolbar(),
|
||||
searchToolbar = this.getSearchToolbar();
|
||||
if (viewToolbar && searchToolbar) {
|
||||
if (hide) {
|
||||
viewToolbar.hide({
|
||||
easing: "ease-out",
|
||||
from: {
|
||||
opacity: 0.9
|
||||
},
|
||||
to: {
|
||||
opacity: 0
|
||||
}
|
||||
});
|
||||
searchToolbar.hide({
|
||||
easing: "ease-out",
|
||||
from: {
|
||||
opacity: 0.9
|
||||
},
|
||||
to: {
|
||||
opacity: 0
|
||||
}
|
||||
});
|
||||
} else {
|
||||
viewToolbar.show({
|
||||
preserveEndState: true,
|
||||
easing: "ease-in",
|
||||
from: {
|
||||
opacity: 0
|
||||
},
|
||||
to: {
|
||||
opacity: 0.9
|
||||
}
|
||||
});
|
||||
this.getSearchMode() && searchToolbar.show({
|
||||
preserveEndState: true,
|
||||
easing: "ease-in",
|
||||
from: {
|
||||
opacity: 0
|
||||
},
|
||||
to: {
|
||||
opacity: 0.9
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onTapDoneButton: function () {
|
||||
Common.Gateway.goBack();
|
||||
},
|
||||
onTapEditModeButton: function () {
|
||||
Ext.Viewport.mask();
|
||||
Common.Gateway.requestEditRights();
|
||||
},
|
||||
onTapReaderButton: function () {
|
||||
this.setReadableMode(!this.getReadableMode());
|
||||
},
|
||||
onTapSearchButton: function (btn) {
|
||||
this.setSearchMode(!this.getSearchMode());
|
||||
},
|
||||
onTapFullscreenButton: function (btn) {
|
||||
this.setFullscreenMode(!this.getFullscreenMode());
|
||||
},
|
||||
onTapShareButton: function () {
|
||||
this.api && this.api.asc_Print();
|
||||
Common.component.Analytics.trackEvent("ToolBar View", "Share");
|
||||
},
|
||||
onSingleTapDocument: function () {
|
||||
var viewToolbar = this.getViewToolbar();
|
||||
if (viewToolbar && this.getFullscreenMode()) {
|
||||
this.setHiddenToolbars(!viewToolbar.isHidden());
|
||||
}
|
||||
},
|
||||
onCoAuthoringDisconnect: function () {
|
||||
var editModeButton = this.getEditModeButton();
|
||||
editModeButton && editModeButton.setHidden(true);
|
||||
},
|
||||
onTapIncFontSizeButton: function () {
|
||||
this.api && this.api.IncreaseReaderFontSize();
|
||||
},
|
||||
onTapDecFontSizeButton: function () {
|
||||
this.api && this.api.DecreaseReaderFontSize();
|
||||
},
|
||||
requestEditFailedTitleText: "Access denied",
|
||||
requestEditFailedMessageText: "You can't edit the document right now. Please try again later."
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2015
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
Ext.define("DE.controller.toolbar.View", {
|
||||
extend: "Ext.app.Controller",
|
||||
config: {
|
||||
refs: {
|
||||
viewToolbar: "viewtoolbar",
|
||||
searchToolbar: "searchtoolbar",
|
||||
doneButton: "#id-tb-btn-view-done",
|
||||
editModeButton: "#id-tb-btn-editmode",
|
||||
readModeButton: "#id-tb-btn-readable",
|
||||
searchButton: "#id-tb-btn-search",
|
||||
fullscreenButton: "#id-tb-btn-fullscreen",
|
||||
shareButton: "#id-tb-btn-view-share",
|
||||
incFontSizeButton: "#id-tb-btn-incfontsize",
|
||||
decFontSizeButton: "#id-tb-btn-decfontsize"
|
||||
},
|
||||
control: {
|
||||
doneButton: {
|
||||
tap: "onTapDoneButton"
|
||||
},
|
||||
editModeButton: {
|
||||
tap: "onTapEditModeButton"
|
||||
},
|
||||
searchButton: {
|
||||
tap: "onTapSearchButton"
|
||||
},
|
||||
readModeButton: {
|
||||
tap: "onTapReaderButton"
|
||||
},
|
||||
shareButton: {
|
||||
tap: "onTapShareButton"
|
||||
},
|
||||
incFontSizeButton: {
|
||||
tap: "onTapIncFontSizeButton"
|
||||
},
|
||||
decFontSizeButton: {
|
||||
tap: "onTapDecFontSizeButton"
|
||||
}
|
||||
},
|
||||
searchMode: false,
|
||||
fullscreenMode: false,
|
||||
readableMode: false
|
||||
},
|
||||
init: function () {
|
||||
this.control({
|
||||
fullscreenButton: {
|
||||
tap: Ext.Function.createBuffered(this.onTapFullscreenButton, 500, this)
|
||||
}
|
||||
});
|
||||
},
|
||||
launch: function () {
|
||||
this.callParent(arguments);
|
||||
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
|
||||
Common.Gateway.on("opendocument", Ext.bind(this.loadDocument, this));
|
||||
Common.Gateway.on("applyeditrights", Ext.bind(this.onApplyEditRights, this));
|
||||
},
|
||||
initControl: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
initApi: function () {},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onTapEvent", Ext.bind(this.onSingleTapDocument, this));
|
||||
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
|
||||
}
|
||||
},
|
||||
loadConfig: function (data) {
|
||||
var doneButton = this.getDoneButton();
|
||||
if (doneButton && data && data.config && data.config.canBackToFolder === true) {
|
||||
doneButton.show();
|
||||
}
|
||||
},
|
||||
loadDocument: function (data) {
|
||||
var permissions = {};
|
||||
if (data.doc) {
|
||||
permissions = Ext.merge(permissions, data.doc.permissions);
|
||||
var editModeButton = this.getEditModeButton();
|
||||
if (editModeButton) {
|
||||
editModeButton.setHidden(permissions.edit !== true);
|
||||
}
|
||||
}
|
||||
},
|
||||
onApplyEditRights: function (data) {
|
||||
Ext.Viewport.unmask();
|
||||
if (data && data.allowed) {
|
||||
var mainController = this.getApplication().getController("tablet.Main");
|
||||
if (this.getReadableMode()) {
|
||||
this.setReadableMode(false);
|
||||
}
|
||||
if (this.getFullscreenMode()) {
|
||||
this.setFullscreenMode(false);
|
||||
}
|
||||
if (mainController) {
|
||||
mainController.setMode("edit");
|
||||
}
|
||||
} else {
|
||||
var editModeButton = this.getEditModeButton();
|
||||
editModeButton && editModeButton.hide();
|
||||
Ext.Msg.show({
|
||||
title: this.requestEditFailedTitleText,
|
||||
message: (data && data.message) || this.requestEditFailedMessageText,
|
||||
icon: Ext.Msg.INFO,
|
||||
buttons: Ext.Msg.OK
|
||||
});
|
||||
}
|
||||
},
|
||||
applySearchMode: function (search) {
|
||||
if (!Ext.isBoolean(search)) {
|
||||
Ext.Logger.error("Invalid parameters.");
|
||||
} else {
|
||||
var me = this,
|
||||
searchToolbar = me.getSearchToolbar(),
|
||||
searchButton = me.getSearchButton();
|
||||
if (searchToolbar) {
|
||||
if (search) {
|
||||
searchButton && searchButton.addCls("x-button-pressing");
|
||||
if (me.getFullscreenMode()) {
|
||||
searchToolbar.show({
|
||||
easing: "ease-out",
|
||||
preserveEndState: true,
|
||||
autoClear: false,
|
||||
from: {
|
||||
opacity: 0.3
|
||||
},
|
||||
to: {
|
||||
opacity: 0.9
|
||||
}
|
||||
});
|
||||
} else {
|
||||
searchToolbar.show();
|
||||
}
|
||||
} else {
|
||||
searchButton && searchButton.removeCls("x-button-pressing");
|
||||
if (me.getFullscreenMode()) {
|
||||
searchToolbar.hide({
|
||||
easing: "ease-in",
|
||||
to: {
|
||||
opacity: 0.3
|
||||
}
|
||||
});
|
||||
} else {
|
||||
searchToolbar.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
return search;
|
||||
}
|
||||
},
|
||||
applyFullscreenMode: function (fullscreen) {
|
||||
if (!Ext.isBoolean(fullscreen)) {
|
||||
Ext.Logger.error("Invalid parameters.");
|
||||
} else {
|
||||
var viewToolbar = this.getViewToolbar(),
|
||||
searchToolbar = this.getSearchToolbar(),
|
||||
fullscreenButton = this.getFullscreenButton(),
|
||||
popClipCmp = Ext.ComponentQuery.query("popclip");
|
||||
if (popClipCmp.length > 0) {
|
||||
popClipCmp[0].hide();
|
||||
}
|
||||
if (viewToolbar && searchToolbar) {
|
||||
if (fullscreen) {
|
||||
fullscreenButton && fullscreenButton.addCls("x-button-pressing");
|
||||
viewToolbar.setStyle({
|
||||
position: "absolute",
|
||||
left: 0,
|
||||
top: 0,
|
||||
right: 0,
|
||||
opacity: 0.9,
|
||||
"z-index": 17
|
||||
});
|
||||
searchToolbar.setStyle({
|
||||
position: "absolute",
|
||||
left: 0,
|
||||
top: "44px",
|
||||
right: 0,
|
||||
opacity: 0.9,
|
||||
"z-index": 16
|
||||
});
|
||||
this.setHiddenToolbars(true);
|
||||
} else {
|
||||
viewToolbar.setStyle({
|
||||
position: "initial",
|
||||
opacity: 1
|
||||
});
|
||||
searchToolbar.setStyle({
|
||||
position: "initial",
|
||||
opacity: 1
|
||||
});
|
||||
viewToolbar.setDocked("top");
|
||||
searchToolbar.setDocked("top");
|
||||
}
|
||||
}
|
||||
return fullscreen;
|
||||
}
|
||||
},
|
||||
applyReadableMode: function (readable) {
|
||||
if (!Ext.isBoolean(readable)) {
|
||||
Ext.Logger.error("Invalid parameters.");
|
||||
} else {
|
||||
var searchButton = this.getSearchButton(),
|
||||
incFontSizeButton = this.getIncFontSizeButton(),
|
||||
decFontSizeButton = this.getDecFontSizeButton(),
|
||||
readModeButton = this.getReadModeButton(),
|
||||
popClipCmp = Ext.ComponentQuery.query("popclip"),
|
||||
shareButton = this.getShareButton();
|
||||
if (popClipCmp.length > 0) {
|
||||
popClipCmp[0].hide();
|
||||
}
|
||||
if (readable) {
|
||||
this.getSearchMode() && this.setSearchMode(false);
|
||||
readable && readModeButton && readModeButton.addCls("x-button-pressing");
|
||||
searchButton && searchButton.hide();
|
||||
incFontSizeButton && incFontSizeButton.show();
|
||||
decFontSizeButton && decFontSizeButton.show();
|
||||
shareButton && shareButton.setDisabled(true);
|
||||
} else {
|
||||
incFontSizeButton && incFontSizeButton.hide();
|
||||
decFontSizeButton && decFontSizeButton.hide();
|
||||
searchButton && searchButton.show();
|
||||
shareButton && shareButton.setDisabled(false);
|
||||
}
|
||||
this.api && this.api.ChangeReaderMode();
|
||||
return readable;
|
||||
}
|
||||
},
|
||||
setHiddenToolbars: function (hide) {
|
||||
var viewToolbar = this.getViewToolbar(),
|
||||
searchToolbar = this.getSearchToolbar();
|
||||
if (viewToolbar && searchToolbar) {
|
||||
if (hide) {
|
||||
viewToolbar.hide({
|
||||
easing: "ease-out",
|
||||
from: {
|
||||
opacity: 0.9
|
||||
},
|
||||
to: {
|
||||
opacity: 0
|
||||
}
|
||||
});
|
||||
searchToolbar.hide({
|
||||
easing: "ease-out",
|
||||
from: {
|
||||
opacity: 0.9
|
||||
},
|
||||
to: {
|
||||
opacity: 0
|
||||
}
|
||||
});
|
||||
} else {
|
||||
viewToolbar.show({
|
||||
preserveEndState: true,
|
||||
easing: "ease-in",
|
||||
from: {
|
||||
opacity: 0
|
||||
},
|
||||
to: {
|
||||
opacity: 0.9
|
||||
}
|
||||
});
|
||||
this.getSearchMode() && searchToolbar.show({
|
||||
preserveEndState: true,
|
||||
easing: "ease-in",
|
||||
from: {
|
||||
opacity: 0
|
||||
},
|
||||
to: {
|
||||
opacity: 0.9
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onTapDoneButton: function () {
|
||||
Common.Gateway.goBack();
|
||||
},
|
||||
onTapEditModeButton: function () {
|
||||
Ext.Viewport.mask();
|
||||
Common.Gateway.requestEditRights();
|
||||
},
|
||||
onTapReaderButton: function () {
|
||||
this.setReadableMode(!this.getReadableMode());
|
||||
},
|
||||
onTapSearchButton: function (btn) {
|
||||
this.setSearchMode(!this.getSearchMode());
|
||||
},
|
||||
onTapFullscreenButton: function (btn) {
|
||||
this.setFullscreenMode(!this.getFullscreenMode());
|
||||
},
|
||||
onTapShareButton: function () {
|
||||
this.api && this.api.asc_Print();
|
||||
Common.component.Analytics.trackEvent("ToolBar View", "Share");
|
||||
},
|
||||
onSingleTapDocument: function () {
|
||||
var viewToolbar = this.getViewToolbar();
|
||||
if (viewToolbar && this.getFullscreenMode()) {
|
||||
this.setHiddenToolbars(!viewToolbar.isHidden());
|
||||
}
|
||||
},
|
||||
onCoAuthoringDisconnect: function () {
|
||||
var editModeButton = this.getEditModeButton();
|
||||
editModeButton && editModeButton.setHidden(true);
|
||||
},
|
||||
onTapIncFontSizeButton: function () {
|
||||
this.api && this.api.IncreaseReaderFontSize();
|
||||
},
|
||||
onTapDecFontSizeButton: function () {
|
||||
this.api && this.api.DecreaseReaderFontSize();
|
||||
},
|
||||
requestEditFailedTitleText: "Access denied",
|
||||
requestEditFailedMessageText: "You can't edit the document right now. Please try again later."
|
||||
});
|
||||
Reference in New Issue
Block a user