3.0 source code
This commit is contained in:
@@ -1,133 +0,0 @@
|
||||
/*
|
||||
* (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("PE.controller.CreateFile", {
|
||||
extend: "Ext.app.Controller",
|
||||
views: ["CreateFile"],
|
||||
stores: ["FileTemplates"],
|
||||
refs: [{
|
||||
ref: "filePanel",
|
||||
selector: "pefile"
|
||||
}],
|
||||
init: function () {
|
||||
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
|
||||
this.control({
|
||||
"pecreatenew": {
|
||||
afterrender: Ext.bind(this.onRenderView, this, {
|
||||
single: true
|
||||
})
|
||||
},
|
||||
"pecreatenew dataview": {
|
||||
itemclick: this.onTemplateClick
|
||||
}
|
||||
});
|
||||
},
|
||||
applyConfig: function (config) {
|
||||
if (config) {
|
||||
this.createUrl = config.createUrl;
|
||||
this.nativeApp = config.nativeApp;
|
||||
var templates = this.getFileTemplatesStore();
|
||||
if (templates && config.templates) {
|
||||
templates.removeAll();
|
||||
templates.add(config.templates);
|
||||
}
|
||||
}
|
||||
},
|
||||
loadConfig: function (data) {
|
||||
if (data && data.config) {
|
||||
this.createUrl = data.config.createUrl;
|
||||
this.nativeApp = data.config.nativeApp;
|
||||
var templates = this.getFileTemplatesStore();
|
||||
if (templates && data.config.templates) {
|
||||
templates.removeAll();
|
||||
templates.add(data.config.templates);
|
||||
}
|
||||
}
|
||||
},
|
||||
onRenderView: function () {
|
||||
var btnBlankDocument = Ext.fly("id-create-blank-document");
|
||||
if (btnBlankDocument) {
|
||||
btnBlankDocument.addClsOnOver("over");
|
||||
btnBlankDocument.on("click", this.onBlankDocClick, this);
|
||||
}
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
return this;
|
||||
},
|
||||
onBlankDocClick: function (event, el) {
|
||||
var filePanel = this.getFilePanel();
|
||||
if (filePanel) {
|
||||
filePanel.closeMenu();
|
||||
}
|
||||
if (this.nativeApp === true) {
|
||||
if (this.api) {
|
||||
this.api.OpenNewDocument();
|
||||
}
|
||||
} else {
|
||||
if (Ext.isEmpty(this.createUrl)) {
|
||||
Ext.MessageBox.show({
|
||||
title: this.textError,
|
||||
msg: this.textCanNotCreateNewDoc,
|
||||
buttons: Ext.Msg.OK,
|
||||
icon: Ext.Msg.ERROR,
|
||||
width: 300
|
||||
});
|
||||
} else {
|
||||
var newDocumentPage = window.open(Ext.String.format("{0}?title={1}&action=create&doctype=presentation", this.createUrl, this.newDocumentTitle));
|
||||
if (newDocumentPage) {
|
||||
newDocumentPage.focus();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("Create New", "Blank");
|
||||
}
|
||||
}
|
||||
},
|
||||
onTemplateClick: function (view, record, item, index, e) {
|
||||
var filePanel = this.getFilePanel();
|
||||
if (filePanel) {
|
||||
filePanel.closeMenu();
|
||||
}
|
||||
if (this.nativeApp === true) {
|
||||
if (this.api) {
|
||||
this.api.OpenNewDocument(record.data.name);
|
||||
}
|
||||
} else {
|
||||
var newDocumentPage = window.open(Ext.String.format("{0}?title={1}&template={2}&action=create&doctype=presentation", this.createUrl, this.newDocumentTitle, record.data.name));
|
||||
if (newDocumentPage) {
|
||||
newDocumentPage.focus();
|
||||
}
|
||||
}
|
||||
Common.component.Analytics.trackEvent("Create New");
|
||||
},
|
||||
newDocumentTitle: "Unnamed presentation",
|
||||
textError: "Error",
|
||||
textCanNotCreateNewDoc: "Can not create a new presentation. Address to create a document is not configured."
|
||||
});
|
||||
@@ -1,105 +1,87 @@
|
||||
/*
|
||||
* (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("PE.controller.DocumentHolder", {
|
||||
extend: "Ext.app.Controller",
|
||||
views: ["DocumentHolder"],
|
||||
refs: [{
|
||||
ref: "splitterMainMenu",
|
||||
selector: "#main-menu-splitter"
|
||||
},
|
||||
{
|
||||
ref: "mainCanvas",
|
||||
selector: "#id-main"
|
||||
}],
|
||||
init: function () {
|
||||
this.control({
|
||||
"#view-main-menu": {
|
||||
panelbeforeshow: function (fullscreen) {
|
||||
this._isMenuHided = true;
|
||||
if (fullscreen !== true) {
|
||||
this.getSplitterMainMenu().show();
|
||||
}
|
||||
},
|
||||
panelbeforehide: function () {
|
||||
this._isMenuHided = true;
|
||||
},
|
||||
panelshow: function (panel, fulscreen) {
|
||||
this._isMenuHided = false;
|
||||
if (!fulscreen) {}
|
||||
},
|
||||
panelhide: function (panel, fullscreen) {
|
||||
this._isMenuHided = false;
|
||||
this.getSplitterMainMenu().hide();
|
||||
}
|
||||
},
|
||||
"#main-menu-splitter": {
|
||||
beforedragstart: function (obj, event) {
|
||||
return !event.currentTarget.disabled;
|
||||
},
|
||||
move: this._onDocumentSplitterMove
|
||||
},
|
||||
"menuitem[group=popupparagraphvalign]": {
|
||||
click: this._onParagraphVAlign
|
||||
}
|
||||
});
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
return this;
|
||||
},
|
||||
_onDocumentSplitterMove: function (obj, x, y) {
|
||||
if (this._isMenuHided) {
|
||||
return;
|
||||
}
|
||||
var jsp_container, width_parent = obj.up("container").down("pemainmenu").getWidth();
|
||||
if (width_parent > 40) {
|
||||
width_parent -= 40;
|
||||
Ext.ComponentQuery.query("dataview[group=scrollable]").forEach(function (list) {
|
||||
var nodes = list.getNodes();
|
||||
for (var item in nodes) {
|
||||
nodes[item].style["width"] = width_parent + "px";
|
||||
}
|
||||
list.getEl().setWidth(width_parent);
|
||||
jsp_container = list.getEl().down(".jspContainer");
|
||||
if (jsp_container) {
|
||||
jsp_container.setWidth(width_parent);
|
||||
list.getEl().down(".jspPane").setWidth(width_parent);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
_onParagraphVAlign: function (item, e) {
|
||||
var properties = new CAscShapeProp();
|
||||
properties.put_VerticalTextAlign(item.valign);
|
||||
this.api.ShapeApply(properties);
|
||||
}
|
||||
/*
|
||||
* (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
|
||||
*
|
||||
*/
|
||||
var c_paragraphLinerule = {
|
||||
LINERULE_LEAST: 0,
|
||||
LINERULE_AUTO: 1,
|
||||
LINERULE_EXACT: 2
|
||||
};
|
||||
var c_tableBorder = {
|
||||
BORDER_VERTICAL_LEFT: 0,
|
||||
BORDER_HORIZONTAL_TOP: 1,
|
||||
BORDER_VERTICAL_RIGHT: 2,
|
||||
BORDER_HORIZONTAL_BOTTOM: 3,
|
||||
BORDER_VERTICAL_CENTER: 4,
|
||||
BORDER_HORIZONTAL_CENTER: 5,
|
||||
BORDER_INNER: 6,
|
||||
BORDER_OUTER: 7,
|
||||
BORDER_ALL: 8,
|
||||
BORDER_NONE: 9,
|
||||
BORDER_ALL_TABLE: 10,
|
||||
BORDER_NONE_TABLE: 11,
|
||||
BORDER_INNER_TABLE: 12,
|
||||
BORDER_OUTER_TABLE: 13
|
||||
};
|
||||
define(["core", "presentationeditor/main/app/view/DocumentHolder"], function () {
|
||||
PE.Controllers.DocumentHolder = Backbone.Controller.extend({
|
||||
models: [],
|
||||
collections: [],
|
||||
views: ["DocumentHolder"],
|
||||
initialize: function () {},
|
||||
onLaunch: function () {
|
||||
this.documentHolder = this.createView("DocumentHolder").render();
|
||||
this.documentHolder.el.tabIndex = -1;
|
||||
},
|
||||
setApi: function (api) {
|
||||
this.api = api;
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
var diagramEditor = this.getApplication().getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");
|
||||
if (diagramEditor) {
|
||||
diagramEditor.on("internalmessage", _.bind(function (cmp, message) {
|
||||
var command = message.data.command;
|
||||
var data = message.data.data;
|
||||
if (this.api) {
|
||||
(diagramEditor.isEditMode()) ? this.api.asc_editChartDrawingObject(data) : this.api.asc_addChartDrawingObject(data);
|
||||
}
|
||||
},
|
||||
this));
|
||||
diagramEditor.on("hide", _.bind(function (cmp, message) {
|
||||
this.documentHolder.fireEvent("editcomplete", this.documentHolder);
|
||||
if (this.api) {
|
||||
this.api.asc_enableKeyEvents(true);
|
||||
}
|
||||
},
|
||||
this));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,388 @@
|
||||
/*
|
||||
* (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
|
||||
*
|
||||
*/
|
||||
define(["core", "common/main/lib/util/Shortcuts", "presentationeditor/main/app/view/LeftMenu", "presentationeditor/main/app/view/FileMenu"], function () {
|
||||
PE.Controllers.LeftMenu = Backbone.Controller.extend(_.extend({
|
||||
views: ["LeftMenu", "FileMenu"],
|
||||
initialize: function () {
|
||||
this._state = {
|
||||
no_slides: undefined
|
||||
};
|
||||
this.addListeners({
|
||||
"Common.Views.Chat": {
|
||||
"hide": _.bind(this.onHideChat, this)
|
||||
},
|
||||
"Statusbar": {
|
||||
"click:users": _.bind(this.clickStatusbarUsers, this)
|
||||
},
|
||||
"LeftMenu": {
|
||||
"panel:show": _.bind(this.menuExpand, this),
|
||||
"comments:show": _.bind(this.commentsShowHide, this, "show"),
|
||||
"comments:hide": _.bind(this.commentsShowHide, this, "hide")
|
||||
},
|
||||
"Common.Views.About": {
|
||||
"show": _.bind(this.aboutShowHide, this, false),
|
||||
"hide": _.bind(this.aboutShowHide, this, true)
|
||||
},
|
||||
"FileMenu": {
|
||||
"filemenu:hide": _.bind(this.menuFilesHide, this),
|
||||
"item:click": _.bind(this.clickMenuFileItem, this),
|
||||
"saveas:format": _.bind(this.clickSaveAsFormat, this),
|
||||
"settings:apply": _.bind(this.applySettings, this),
|
||||
"create:new": _.bind(this.onCreateNew, this),
|
||||
"recent:open": _.bind(this.onOpenRecent, this)
|
||||
},
|
||||
"Toolbar": {
|
||||
"file:saving": _.bind(this.onToolbarSaving, this),
|
||||
"file:settings": _.bind(this.clickToolbarSettings, this)
|
||||
},
|
||||
"SearchDialog": {
|
||||
"hide": _.bind(this.onSearchDlgHide, this),
|
||||
"search:back": _.bind(this.onQuerySearch, this, "back"),
|
||||
"search:next": _.bind(this.onQuerySearch, this, "next")
|
||||
}
|
||||
});
|
||||
},
|
||||
onLaunch: function () {
|
||||
this.leftMenu = this.createView("LeftMenu").render();
|
||||
this.leftMenu.btnSearch.on("toggle", _.bind(this.onMenuSearch, this));
|
||||
this.leftMenu.btnThumbs.on("toggle", _.bind(this.onShowTumbnails, this));
|
||||
this.isThumbsShown = true;
|
||||
Common.util.Shortcuts.delegateShortcuts({
|
||||
shortcuts: {
|
||||
"command+shift+s,ctrl+shift+s": _.bind(this.onShortcut, this, "save"),
|
||||
"command+f,ctrl+f": _.bind(this.onShortcut, this, "search"),
|
||||
"alt+f": _.bind(this.onShortcut, this, "file"),
|
||||
"esc": _.bind(this.onShortcut, this, "escape"),
|
||||
"ctrl+alt+q": _.bind(this.onShortcut, this, "chat"),
|
||||
"command+shift+h,ctrl+shift+h": _.bind(this.onShortcut, this, "comments"),
|
||||
"f1": _.bind(this.onShortcut, this, "help")
|
||||
}
|
||||
});
|
||||
Common.util.Shortcuts.suspendEvents();
|
||||
},
|
||||
setApi: function (api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback("asc_onThumbnailsShow", _.bind(this.onThumbnailsShow, this));
|
||||
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", _.bind(this.onApiServerDisconnect, this));
|
||||
Common.NotificationCenter.on("api:disconnect", _.bind(this.onApiServerDisconnect, this));
|
||||
if (this.mode.canCoAuthoring) {
|
||||
this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage", _.bind(this.onApiChatMessage, this));
|
||||
}
|
||||
this.api.asc_registerCallback("asc_onCountPages", _.bind(this.onApiCountPages, this));
|
||||
this.onApiCountPages(this.api.getCountPages());
|
||||
this.leftMenu.getMenu("file").setApi(api);
|
||||
return this;
|
||||
},
|
||||
setMode: function (mode) {
|
||||
this.mode = mode;
|
||||
this.leftMenu.setMode(mode);
|
||||
this.leftMenu.getMenu("file").setMode(mode);
|
||||
return this;
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
if (this.mode.canCoAuthoring) {
|
||||
this.leftMenu.btnComments[this.mode.isEdit ? "show" : "hide"]();
|
||||
this.leftMenu.btnChat.show();
|
||||
this.leftMenu.setOptionsPanel("chat", this.getApplication().getController("Common.Controllers.Chat").getView("Common.Views.Chat"));
|
||||
this.leftMenu.setOptionsPanel("comment", this.getApplication().getController("Common.Controllers.Comments").getView("Common.Views.Comments"));
|
||||
} else {
|
||||
this.leftMenu.btnChat.hide();
|
||||
this.leftMenu.btnComments.hide();
|
||||
}
|
||||
Common.util.Shortcuts.resumeEvents();
|
||||
this.leftMenu.btnThumbs.toggle(true);
|
||||
return this;
|
||||
},
|
||||
clickMenuFileItem: function (menu, action, isopts) {
|
||||
var close_menu = true;
|
||||
switch (action) {
|
||||
case "back":
|
||||
break;
|
||||
case "save":
|
||||
this.api.asc_Save();
|
||||
break;
|
||||
case "print":
|
||||
this.api.asc_Print();
|
||||
break;
|
||||
case "exit":
|
||||
Common.Gateway.goBack();
|
||||
break;
|
||||
case "edit":
|
||||
this.getApplication().getController("Statusbar").setStatusCaption(this.requestEditRightsText);
|
||||
Common.Gateway.requestEditRights();
|
||||
break;
|
||||
case "new":
|
||||
if (isopts) {
|
||||
close_menu = false;
|
||||
} else {
|
||||
this.onCreateNew(undefined, "blank");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
close_menu = false;
|
||||
}
|
||||
if (close_menu) {
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
}
|
||||
},
|
||||
clickSaveAsFormat: function (menu, format) {
|
||||
this.api.asc_DownloadAs(format);
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
},
|
||||
applySettings: function (menu) {
|
||||
var value = window.localStorage.getItem("pe-settings-inputmode");
|
||||
this.api.SetTextBoxInputMode(parseInt(value) == 1);
|
||||
value = window.localStorage.getItem("pe-settings-showchanges");
|
||||
this.api.SetCollaborativeMarksShowType(value != "last" ? c_oAscCollaborativeMarksShowType.All : c_oAscCollaborativeMarksShowType.LastChanges);
|
||||
if (this.mode.canAutosave) {
|
||||
value = window.localStorage.getItem("pe-settings-autosave");
|
||||
this.api.asc_setAutoSaveGap(parseInt(value));
|
||||
}
|
||||
value = window.localStorage.getItem("pe-settings-showsnaplines");
|
||||
this.api.put_ShowSnapLines(value === null || parseInt(value) == 1);
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
},
|
||||
onCreateNew: function (menu, type) {
|
||||
if (this.mode.nativeApp === true) {
|
||||
this.api.OpenNewDocument(type == "blank" ? "" : type);
|
||||
} else {
|
||||
var newDocumentPage = window.open(_.template("<%= url %>?title=<%= title %>" + '<% if (doctype != "blank") { %>&template=<%= doctype %><% } %>' + "&action=create&doctype=presentation", {
|
||||
url: this.mode.createUrl,
|
||||
title: this.newDocumentTitle,
|
||||
doctype: type
|
||||
}));
|
||||
if (newDocumentPage) {
|
||||
newDocumentPage.focus();
|
||||
}
|
||||
}
|
||||
if (menu) {
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
}
|
||||
},
|
||||
onOpenRecent: function (menu, url) {
|
||||
if (menu) {
|
||||
menu.hide();
|
||||
this.leftMenu.btnFile.toggle(false, true);
|
||||
}
|
||||
var recentDocPage = window.open(url);
|
||||
if (recentDocPage) {
|
||||
recentDocPage.focus();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("Open Recent");
|
||||
},
|
||||
clickToolbarSettings: function (obj) {
|
||||
if (this.leftMenu.btnFile.pressed && this.leftMenu.btnFile.panel.active == "opts") {
|
||||
this.leftMenu.close();
|
||||
} else {
|
||||
this.leftMenu.showMenu("file:opts");
|
||||
}
|
||||
},
|
||||
onToolbarSaving: function (obj, status) {
|
||||
this.leftMenu.getMenu("file").disableMenu("save", status);
|
||||
},
|
||||
clickStatusbarUsers: function () {
|
||||
if (this.mode.canCoAuthoring) {
|
||||
if (this.leftMenu.btnChat.pressed) {
|
||||
this.leftMenu.close();
|
||||
} else {
|
||||
this.leftMenu.showMenu("chat");
|
||||
}
|
||||
}
|
||||
},
|
||||
onHideChat: function () {
|
||||
$(this.leftMenu.btnChat.el).blur();
|
||||
Common.NotificationCenter.trigger("layout:changed", "leftmenu");
|
||||
},
|
||||
onQuerySearch: function (d, w, opts) {
|
||||
if (opts.textsearch && opts.textsearch.length) {
|
||||
if (!this.api.findText(opts.textsearch, d != "back")) {
|
||||
var me = this;
|
||||
Common.UI.info({
|
||||
msg: this.textNoTextFound,
|
||||
callback: function () {
|
||||
me.dlgSearch.focus();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
showSearchDlg: function (show) {
|
||||
if (!this.dlgSearch) {
|
||||
this.dlgSearch = (new Common.UI.SearchDialog({}));
|
||||
}
|
||||
if (show) {
|
||||
this.dlgSearch.isVisible() ? this.dlgSearch.focus() : this.dlgSearch.show("no-replace");
|
||||
} else {
|
||||
this.dlgSearch["hide"]();
|
||||
}
|
||||
},
|
||||
onMenuSearch: function (obj, show) {
|
||||
this.showSearchDlg(show);
|
||||
},
|
||||
onShowTumbnails: function (obj, show) {
|
||||
this.api.ShowThumbnails(show);
|
||||
},
|
||||
onThumbnailsShow: function (isShow) {
|
||||
if (isShow && !this.isThumbsShown) {
|
||||
this.leftMenu.btnThumbs.toggle(true, false);
|
||||
} else {
|
||||
if (!isShow && this.isThumbsShown) {
|
||||
this.leftMenu.btnThumbs.toggle(false, false);
|
||||
}
|
||||
}
|
||||
this.isThumbsShown = isShow;
|
||||
},
|
||||
onSearchDlgHide: function () {
|
||||
this.leftMenu.btnSearch.toggle(false, true);
|
||||
$(this.leftMenu.btnSearch.el).blur();
|
||||
this.api.asc_enableKeyEvents(true);
|
||||
},
|
||||
onApiServerDisconnect: function () {
|
||||
this.mode.isEdit = false;
|
||||
this.leftMenu.close();
|
||||
this.leftMenu.btnComments.setDisabled(true);
|
||||
this.leftMenu.btnChat.setDisabled(true);
|
||||
this.leftMenu.getMenu("file").setMode({
|
||||
isDisconnected: true
|
||||
});
|
||||
if (this.dlgSearch) {
|
||||
this.leftMenu.btnSearch.toggle(false, true);
|
||||
this.dlgSearch["hide"]();
|
||||
}
|
||||
},
|
||||
onApiCountPages: function (count) {
|
||||
if (this._state.no_slides !== (count <= 0) && this.mode.isEdit) {
|
||||
this._state.no_slides = (count <= 0);
|
||||
this.leftMenu.btnComments.setDisabled(this._state.no_slides);
|
||||
this.leftMenu.btnSearch.setDisabled(this._state.no_slides);
|
||||
}
|
||||
},
|
||||
menuExpand: function (obj, panel, show) {
|
||||
if (panel == "thumbs") {
|
||||
this.isThumbsShown = show;
|
||||
} else {
|
||||
if (!show && this.isThumbsShown) {
|
||||
this.leftMenu.btnThumbs.toggle(true, false);
|
||||
}
|
||||
}
|
||||
},
|
||||
menuFilesHide: function (obj) {
|
||||
$(this.leftMenu.btnFile.el).blur();
|
||||
},
|
||||
onApiChatMessage: function () {
|
||||
this.leftMenu.markCoauthOptions();
|
||||
},
|
||||
commentsShowHide: function (mode) {
|
||||
if (mode === "show") {
|
||||
this.getApplication().getController("Common.Controllers.Comments").focusOnInput();
|
||||
} else {
|
||||
$(this.leftMenu.btnComments.el).blur();
|
||||
}
|
||||
},
|
||||
aboutShowHide: function (value) {
|
||||
if (this.api) {
|
||||
this.api.asc_enableKeyEvents(value);
|
||||
}
|
||||
if (value) {
|
||||
$(this.leftMenu.btnAbout.el).blur();
|
||||
}
|
||||
},
|
||||
onShortcut: function (s, e) {
|
||||
var previewPanel = PE.getController("Viewport").getView("DocumentPreview");
|
||||
switch (s) {
|
||||
case "search":
|
||||
if ((!previewPanel || !previewPanel.isVisible()) && !this._state.no_slides) {
|
||||
Common.UI.Menu.Manager.hideAll();
|
||||
var full_menu_pressed = (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed);
|
||||
this.showSearchDlg(true);
|
||||
this.leftMenu.btnSearch.toggle(true, true);
|
||||
this.leftMenu.btnFile.toggle(false);
|
||||
this.leftMenu.btnAbout.toggle(false);
|
||||
full_menu_pressed && this.menuExpand(this.leftMenu.btnFile, "files", false);
|
||||
}
|
||||
return false;
|
||||
case "save":
|
||||
if (this.mode.canDownload && (!previewPanel || !previewPanel.isVisible())) {
|
||||
Common.UI.Menu.Manager.hideAll();
|
||||
this.leftMenu.showMenu("file:saveas");
|
||||
}
|
||||
return false;
|
||||
case "help":
|
||||
if (!previewPanel || !previewPanel.isVisible()) {
|
||||
Common.UI.Menu.Manager.hideAll();
|
||||
this.leftMenu.showMenu("file:help");
|
||||
}
|
||||
return false;
|
||||
case "file":
|
||||
if (!previewPanel || !previewPanel.isVisible()) {
|
||||
Common.UI.Menu.Manager.hideAll();
|
||||
this.leftMenu.showMenu("file");
|
||||
}
|
||||
return false;
|
||||
case "escape":
|
||||
var statusbar = PE.getController("Statusbar");
|
||||
var menu_opened = statusbar.statusbar.$el.find('.open > [data-toggle="dropdown"]');
|
||||
if (menu_opened.length) {
|
||||
$.fn.dropdown.Constructor.prototype.keydown.call(menu_opened[0], e);
|
||||
return false;
|
||||
}
|
||||
if (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed || $(e.target).parents("#left-menu").length) {
|
||||
this.leftMenu.close();
|
||||
Common.NotificationCenter.trigger("layout:changed", "leftmenu");
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "chat":
|
||||
if (this.mode.canCoAuthoring && (!previewPanel || !previewPanel.isVisible())) {
|
||||
Common.UI.Menu.Manager.hideAll();
|
||||
this.leftMenu.showMenu("chat");
|
||||
}
|
||||
return false;
|
||||
case "comments":
|
||||
if (this.mode.canCoAuthoring && this.mode.isEdit && (!previewPanel || !previewPanel.isVisible()) && !this._state.no_slides) {
|
||||
Common.UI.Menu.Manager.hideAll();
|
||||
this.leftMenu.showMenu("comments");
|
||||
this.getApplication().getController("Common.Controllers.Comments").focusOnInput();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
textNoTextFound: "Text not found",
|
||||
newDocumentTitle: "Unnamed document",
|
||||
requestEditRightsText: "Requesting editing rights..."
|
||||
},
|
||||
PE.Controllers.LeftMenu || {}));
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* (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("PE.controller.RecentFiles", {
|
||||
extend: "Ext.app.Controller",
|
||||
views: ["RecentFiles"],
|
||||
stores: ["RecentFiles"],
|
||||
refs: [{
|
||||
ref: "filePanel",
|
||||
selector: "pefile"
|
||||
}],
|
||||
init: function () {
|
||||
this.control({
|
||||
"perecentfiles dataview": {
|
||||
itemclick: this.onRecentFileClick
|
||||
}
|
||||
});
|
||||
},
|
||||
loadConfig: function (data) {
|
||||
var recent = this.getRecentFilesStore();
|
||||
if (recent && data && data.config && data.config.recent) {
|
||||
recent.removeAll();
|
||||
recent.add(data.config.recent);
|
||||
}
|
||||
},
|
||||
onRecentFileClick: function (view, record, item, index, e) {
|
||||
var filePanel = this.getFilePanel();
|
||||
if (filePanel) {
|
||||
filePanel.closeMenu();
|
||||
}
|
||||
var recentDocPage = window.open(record.data.url);
|
||||
if (recentDocPage) {
|
||||
recentDocPage.focus();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("Open Recent");
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* (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
|
||||
*
|
||||
*/
|
||||
define(["core", "presentationeditor/main/app/view/RightMenu"], function () {
|
||||
PE.Controllers.RightMenu = Backbone.Controller.extend({
|
||||
models: [],
|
||||
collections: [],
|
||||
views: ["RightMenu"],
|
||||
initialize: function () {
|
||||
this.editMode = true;
|
||||
this._state = {
|
||||
no_slides: undefined
|
||||
};
|
||||
this.addListeners({
|
||||
"RightMenu": {
|
||||
"rightmenuclick": this.onRightMenuClick
|
||||
}
|
||||
});
|
||||
},
|
||||
onLaunch: function () {
|
||||
this.rightmenu = this.createView("RightMenu");
|
||||
this.rightmenu.on("render:after", _.bind(this.onRightMenuAfterRender, this));
|
||||
},
|
||||
onRightMenuAfterRender: function (rightMenu) {
|
||||
rightMenu.shapeSettings.application = this.getApplication();
|
||||
this._settings = [];
|
||||
this._settings[c_oAscTypeSelectElement.Paragraph] = {
|
||||
panelId: "id-paragraph-settings",
|
||||
panel: rightMenu.paragraphSettings,
|
||||
btn: rightMenu.btnText,
|
||||
hidden: 1,
|
||||
locked: false
|
||||
};
|
||||
this._settings[c_oAscTypeSelectElement.Table] = {
|
||||
panelId: "id-table-settings",
|
||||
panel: rightMenu.tableSettings,
|
||||
btn: rightMenu.btnTable,
|
||||
hidden: 1,
|
||||
locked: false
|
||||
};
|
||||
this._settings[c_oAscTypeSelectElement.Image] = {
|
||||
panelId: "id-image-settings",
|
||||
panel: rightMenu.imageSettings,
|
||||
btn: rightMenu.btnImage,
|
||||
hidden: 1,
|
||||
locked: false
|
||||
};
|
||||
this._settings[c_oAscTypeSelectElement.Slide] = {
|
||||
panelId: "id-slide-settings",
|
||||
panel: rightMenu.slideSettings,
|
||||
btn: rightMenu.btnSlide,
|
||||
hidden: 1,
|
||||
locked: false
|
||||
};
|
||||
this._settings[c_oAscTypeSelectElement.Shape] = {
|
||||
panelId: "id-shape-settings",
|
||||
panel: rightMenu.shapeSettings,
|
||||
btn: rightMenu.btnShape,
|
||||
hidden: 1,
|
||||
locked: false
|
||||
};
|
||||
this._settings[c_oAscTypeSelectElement.Chart] = {
|
||||
panelId: "id-chart-settings",
|
||||
panel: rightMenu.chartSettings,
|
||||
btn: rightMenu.btnChart,
|
||||
hidden: 1,
|
||||
locked: false
|
||||
};
|
||||
},
|
||||
setApi: function (api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback("asc_onCountPages", _.bind(this.onApiCountPages, this));
|
||||
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", _.bind(this.onCoAuthoringDisconnect, this));
|
||||
Common.NotificationCenter.on("api:disconnect", _.bind(this.onCoAuthoringDisconnect, this));
|
||||
},
|
||||
setMode: function (mode) {
|
||||
this.editMode = mode.isEdit;
|
||||
},
|
||||
onRightMenuClick: function (menu, type, minimized) {
|
||||
if (!minimized && this.editMode) {
|
||||
var panel = this._settings[type].panel;
|
||||
var props = this._settings[type].props;
|
||||
if (props && panel) {
|
||||
panel.ChangeSettings.call(panel, props);
|
||||
}
|
||||
}
|
||||
Common.NotificationCenter.trigger("layout:changed", "rightmenu");
|
||||
this.rightmenu.fireEvent("editcomplete", this.rightmenu);
|
||||
},
|
||||
onFocusObject: function (SelectedObjects) {
|
||||
if (!this.editMode) {
|
||||
return;
|
||||
}
|
||||
var needhide = true;
|
||||
for (var i = 0; i < this._settings.length; i++) {
|
||||
if (this._settings[i]) {
|
||||
this._settings[i].hidden = 1;
|
||||
this._settings[i].locked = undefined;
|
||||
}
|
||||
}
|
||||
this._settings[c_oAscTypeSelectElement.Slide].hidden = 0;
|
||||
for (i = 0; i < SelectedObjects.length; i++) {
|
||||
var type = SelectedObjects[i].get_ObjectType();
|
||||
if (type >= this._settings.length || this._settings[type] === undefined) {
|
||||
continue;
|
||||
}
|
||||
var value = SelectedObjects[i].get_ObjectValue();
|
||||
this._settings[type].props = value;
|
||||
this._settings[type].hidden = 0;
|
||||
if (type == c_oAscTypeSelectElement.Slide) {
|
||||
this._settings[type].locked = value.get_LockDelete();
|
||||
this._settings[type].lockedBackground = value.get_LockBackground();
|
||||
this._settings[type].lockedEffects = value.get_LockTranzition();
|
||||
this._settings[type].lockedTiming = value.get_LockTiming();
|
||||
} else {
|
||||
this._settings[type].locked = value.get_Locked();
|
||||
}
|
||||
}
|
||||
if (this._settings[c_oAscTypeSelectElement.Slide].locked) {
|
||||
for (i = 0; i < this._settings.length; i++) {
|
||||
if (this._settings[i]) {
|
||||
this._settings[i].locked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
var lastactive = -1,
|
||||
currentactive, priorityactive = -1;
|
||||
for (i = 0; i < this._settings.length; i++) {
|
||||
var pnl = this._settings[i];
|
||||
if (pnl === undefined) {
|
||||
continue;
|
||||
}
|
||||
if (pnl.hidden) {
|
||||
if (!pnl.btn.isDisabled()) {
|
||||
pnl.btn.setDisabled(true);
|
||||
}
|
||||
if (this.rightmenu.GetActivePane() == pnl.panelId) {
|
||||
currentactive = -1;
|
||||
}
|
||||
} else {
|
||||
if (pnl.btn.isDisabled()) {
|
||||
pnl.btn.setDisabled(false);
|
||||
}
|
||||
if (i != c_oAscTypeSelectElement.Slide) {
|
||||
lastactive = i;
|
||||
}
|
||||
if (pnl.needShow) {
|
||||
pnl.needShow = false;
|
||||
priorityactive = i;
|
||||
} else {
|
||||
if (i != c_oAscTypeSelectElement.Slide || this.rightmenu._settings[i].isCurrent) {
|
||||
if (this.rightmenu.GetActivePane() == pnl.panelId) {
|
||||
currentactive = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i == c_oAscTypeSelectElement.Slide) {
|
||||
if (pnl.locked !== undefined) {
|
||||
this.rightmenu.slideSettings.SetSlideDisabled(this._state.no_slides || pnl.lockedBackground || pnl.locked, this._state.no_slides || pnl.lockedEffects || pnl.locked, this._state.no_slides || pnl.lockedTiming || pnl.locked);
|
||||
}
|
||||
} else {
|
||||
pnl.panel.setLocked(pnl.locked);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.rightmenu.minimizedMode) {
|
||||
var active;
|
||||
if (priorityactive > -1) {
|
||||
active = priorityactive;
|
||||
} else {
|
||||
if (currentactive >= 0) {
|
||||
active = currentactive;
|
||||
} else {
|
||||
if (lastactive >= 0) {
|
||||
active = lastactive;
|
||||
} else {
|
||||
active = c_oAscTypeSelectElement.Slide;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (active !== undefined) {
|
||||
this.rightmenu.SetActivePane(active);
|
||||
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props);
|
||||
}
|
||||
}
|
||||
this._settings[c_oAscTypeSelectElement.Image].needShow = false;
|
||||
this._settings[c_oAscTypeSelectElement.Chart].needShow = false;
|
||||
this._settings[c_oAscTypeSelectElement.Shape].needShow = false;
|
||||
},
|
||||
onCoAuthoringDisconnect: function () {
|
||||
if (this.rightmenu) {
|
||||
this.rightmenu.SetDisabled("", true, true);
|
||||
}
|
||||
this.setMode({
|
||||
isEdit: false
|
||||
});
|
||||
},
|
||||
onInsertTable: function () {
|
||||
this._settings[c_oAscTypeSelectElement.Table].needShow = true;
|
||||
},
|
||||
onInsertImage: function () {
|
||||
this._settings[c_oAscTypeSelectElement.Image].needShow = true;
|
||||
},
|
||||
onInsertChart: function () {
|
||||
this._settings[c_oAscTypeSelectElement.Chart].needShow = true;
|
||||
},
|
||||
onInsertShape: function () {
|
||||
this._settings[c_oAscTypeSelectElement.Shape].needShow = true;
|
||||
},
|
||||
UpdateThemeColors: function () {
|
||||
this.rightmenu.slideSettings.UpdateThemeColors();
|
||||
this.rightmenu.tableSettings.UpdateThemeColors();
|
||||
this.rightmenu.shapeSettings.UpdateThemeColors();
|
||||
},
|
||||
updateMetricUnit: function () {
|
||||
this.rightmenu.paragraphSettings.updateMetricUnit();
|
||||
this.rightmenu.chartSettings.updateMetricUnit();
|
||||
this.rightmenu.imageSettings.updateMetricUnit();
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
if (this.editMode && this.api) {
|
||||
this.api.asc_registerCallback("asc_doubleClickOnObject", _.bind(this.onDoubleClickOnObject, this));
|
||||
var selectedElements = this.api.getSelectedElements();
|
||||
if (selectedElements.length > 0) {
|
||||
this.onFocusObject(selectedElements);
|
||||
}
|
||||
}
|
||||
},
|
||||
onDoubleClickOnObject: function (obj) {
|
||||
if (!this.editMode) {
|
||||
return;
|
||||
}
|
||||
var type = obj.get_ObjectType();
|
||||
if (type >= this._settings.length || this._settings[type] === undefined) {
|
||||
return;
|
||||
}
|
||||
if (type !== c_oAscTypeSelectElement.Paragraph) {
|
||||
this.rightmenu.SetActivePane(type, true);
|
||||
this._settings[type].panel.ChangeSettings.call(this._settings[type].panel, this._settings[type].props);
|
||||
}
|
||||
},
|
||||
onApiCountPages: function (count) {
|
||||
if (this._state.no_slides !== (count <= 0) && this.editMode) {
|
||||
this._state.no_slides = (count <= 0);
|
||||
if (this._state.no_slides && !this.rightmenu.minimizedMode) {
|
||||
this.rightmenu.clearSelection();
|
||||
}
|
||||
this._settings[c_oAscTypeSelectElement.Slide].btn.setDisabled(this._state.no_slides);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* (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("PE.controller.Search", {
|
||||
extend: "Ext.app.Controller",
|
||||
refs: [{
|
||||
ref: "searchQuery",
|
||||
selector: "#search-dialog-text-search"
|
||||
},
|
||||
{
|
||||
ref: "searchDialog",
|
||||
selector: "commonsearchdialog"
|
||||
}],
|
||||
init: function () {
|
||||
var me = this;
|
||||
this.control({
|
||||
"pemainmenu #main-menu-search": {
|
||||
toggle: this._showSearchDialog
|
||||
},
|
||||
"commonsearchdialog button[group=search-text]": {
|
||||
click: function (btn) {
|
||||
this._startSearch(btn.direction);
|
||||
}
|
||||
},
|
||||
"#search-dialog-text-search": {
|
||||
searchstart: function (obj, text) {
|
||||
this._startSearch("next");
|
||||
obj.stopSearch(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
},
|
||||
setMode: function (mode) {
|
||||
this.mode = mode;
|
||||
if (this._frmSearch) {
|
||||
this._frmSearch.setViewMode(!this.mode.isEdit);
|
||||
}
|
||||
},
|
||||
_startSearch: function (direction) {
|
||||
if (this.api && this.getSearchQuery().isValueValid()) {
|
||||
var sett = this.getSearchDialog().getSettings();
|
||||
if (!this.api.findText(sett.textsearch, direction == "next")) {
|
||||
Ext.Msg.alert(this.textSearch, this.textNoTextFound);
|
||||
}
|
||||
}
|
||||
},
|
||||
_showSearchDialog: function (btn, pressed) {
|
||||
var mainmenu = Ext.getCmp("view-main-menu");
|
||||
if (pressed) {
|
||||
mainmenu.closeFullScaleMenu();
|
||||
var me = this;
|
||||
if (!me._frmSearch) {
|
||||
me._frmSearch = Ext.create("Common.view.SearchDialog", {
|
||||
animateTarget: "main-menu-search",
|
||||
closeAction: "hide",
|
||||
simplesearch: true,
|
||||
isViewMode: true
|
||||
});
|
||||
me._frmSearch.addListener("hide", function (cnt, eOpts) {
|
||||
if (!btn.ownrise) {
|
||||
btn.ownrise = true;
|
||||
btn.toggle(false);
|
||||
if (!Ext.isDefined(mainmenu.currentFullScaleMenuBtn)) {
|
||||
mainmenu.fireEvent("editcomplete", mainmenu);
|
||||
}
|
||||
}
|
||||
btn.ownrise = false;
|
||||
});
|
||||
}
|
||||
me._frmSearch.show();
|
||||
} else {
|
||||
if (this._frmSearch && !btn.ownrise) {
|
||||
btn.ownrise = true;
|
||||
this._frmSearch.hide();
|
||||
if (!Ext.isDefined(mainmenu.currentFullScaleMenuBtn)) {
|
||||
mainmenu.fireEvent("editcomplete", mainmenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
textSearch: "Search",
|
||||
textNoTextFound: "Text not found"
|
||||
});
|
||||
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* (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
|
||||
*
|
||||
*/
|
||||
define(["core", "presentationeditor/main/app/view/Statusbar"], function () {
|
||||
PE.Controllers.Statusbar = Backbone.Controller.extend(_.extend({
|
||||
models: [],
|
||||
collections: [],
|
||||
views: ["Statusbar"],
|
||||
initialize: function () {
|
||||
this.addListeners({
|
||||
"Statusbar": {}
|
||||
});
|
||||
this._state = {
|
||||
zoom_type: undefined,
|
||||
zoom_percent: undefined
|
||||
};
|
||||
},
|
||||
events: function () {
|
||||
return {
|
||||
"click #btn-zoom-down": _.bind(this.zoomDocument, this, "down"),
|
||||
"click #btn-zoom-up": _.bind(this.zoomDocument, this, "up")
|
||||
};
|
||||
},
|
||||
onLaunch: function () {
|
||||
this.statusbar = this.createView("Statusbar").render();
|
||||
this.statusbar.$el.css("z-index", 1);
|
||||
this.bindViewEvents(this.statusbar, this.events);
|
||||
$("#status-label-zoom").css("min-width", 70);
|
||||
this.statusbar.btnZoomToPage.on("click", _.bind(this.onBtnZoomTo, this, "topage"));
|
||||
this.statusbar.btnZoomToWidth.on("click", _.bind(this.onBtnZoomTo, this, "towidth"));
|
||||
this.statusbar.zoomMenu.on("item:click", _.bind(this.menuZoomClick, this));
|
||||
},
|
||||
setApi: function (api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback("asc_onZoomChange", _.bind(this._onZoomChange, this));
|
||||
this.statusbar.setApi(api);
|
||||
},
|
||||
onBtnZoomTo: function (d, b, e) {
|
||||
this._state.zoom_type = undefined;
|
||||
this._state.zoom_percent = undefined;
|
||||
if (!b.pressed) {
|
||||
this.api.zoomCustomMode();
|
||||
} else {
|
||||
this.api[d == "topage" ? "zoomFitToPage" : "zoomFitToWidth"]();
|
||||
}
|
||||
},
|
||||
zoomDocument: function (d, e) {
|
||||
this._state.zoom_type = undefined;
|
||||
this._state.zoom_percent = undefined;
|
||||
switch (d) {
|
||||
case "up":
|
||||
this.api.zoomIn();
|
||||
break;
|
||||
case "down":
|
||||
this.api.zoomOut();
|
||||
break;
|
||||
}
|
||||
},
|
||||
menuZoomClick: function (menu, item) {
|
||||
this._state.zoom_type = undefined;
|
||||
this._state.zoom_percent = undefined;
|
||||
this.api.zoom(item.value);
|
||||
},
|
||||
_onZoomChange: function (percent, type) {
|
||||
if (this._state.zoom_type !== type) {
|
||||
this.statusbar.btnZoomToPage.toggle(type == 2, true);
|
||||
this.statusbar.btnZoomToWidth.toggle(type == 1, true);
|
||||
this._state.zoom_type = type;
|
||||
}
|
||||
if (this._state.zoom_percent !== percent) {
|
||||
$("#status-label-zoom").text(Common.Utils.String.format(this.zoomText, percent));
|
||||
this._state.zoom_percent = percent;
|
||||
}
|
||||
},
|
||||
setStatusCaption: function (text) {
|
||||
if (text.length) {
|
||||
this.statusbar.showStatusMessage(text);
|
||||
} else {
|
||||
this.statusbar.clearStatusMessage();
|
||||
}
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
this.statusbar.$el.css("z-index", "");
|
||||
},
|
||||
zoomText: "Zoom {0}%"
|
||||
},
|
||||
PE.Controllers.Statusbar || {}));
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* (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
|
||||
*
|
||||
*/
|
||||
define(["core", "common/main/lib/view/Header", "presentationeditor/main/app/view/DocumentPreview", "presentationeditor/main/app/view/Viewport"], function (Viewport) {
|
||||
PE.Controllers.Viewport = Backbone.Controller.extend({
|
||||
models: [],
|
||||
collections: [],
|
||||
views: ["Viewport", "Common.Views.Header", "DocumentPreview"],
|
||||
initialize: function () {
|
||||
this.addListeners({
|
||||
"Viewport": {}
|
||||
});
|
||||
},
|
||||
setApi: function (api) {
|
||||
this.api = api;
|
||||
},
|
||||
onLaunch: function () {
|
||||
this.viewport = this.createView("Viewport").render();
|
||||
this.header = this.createView("Common.Views.Header", {
|
||||
headerCaption: "Presentation Editor"
|
||||
}).render();
|
||||
this.docPreview = this.createView("DocumentPreview", {}).render();
|
||||
Common.NotificationCenter.on("layout:changed", _.bind(this.onLayoutChanged, this));
|
||||
$(window).on("resize", _.bind(this.onWindowResize, this));
|
||||
this.viewport.hlayout.on("layout:resizedrag", function () {
|
||||
this.api.Resize();
|
||||
},
|
||||
this);
|
||||
},
|
||||
onLayoutChanged: function (area) {
|
||||
switch (area) {
|
||||
default:
|
||||
this.viewport.vlayout.doLayout();
|
||||
case "rightmenu":
|
||||
this.viewport.hlayout.doLayout();
|
||||
break;
|
||||
case "leftmenu":
|
||||
var panel = this.viewport.hlayout.items[0];
|
||||
if (panel.resize.el) {
|
||||
panel.el.width() > 40 ? panel.resize.el.show() : panel.resize.el.hide();
|
||||
}
|
||||
this.viewport.hlayout.doLayout();
|
||||
break;
|
||||
case "header":
|
||||
case "toolbar":
|
||||
case "status":
|
||||
this.viewport.vlayout.doLayout();
|
||||
break;
|
||||
}
|
||||
this.api.Resize();
|
||||
},
|
||||
onWindowResize: function (e) {
|
||||
this.onLayoutChanged("window");
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user