init repo
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* (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.view.ChromeRecommendation", {
|
||||
extend: "Ext.window.Window",
|
||||
alias: "widget.dechromerecommendation",
|
||||
requires: ["Ext.window.Window"],
|
||||
modal: true,
|
||||
closable: true,
|
||||
resizable: false,
|
||||
plain: true,
|
||||
width: 375,
|
||||
height: 185,
|
||||
layout: {
|
||||
type: "border"
|
||||
},
|
||||
onEsc: function () {
|
||||
this.close();
|
||||
},
|
||||
initComponent: function () {
|
||||
this.addEvents("onmodalresult");
|
||||
this.items = [{
|
||||
xtype: "container",
|
||||
region: "center",
|
||||
layout: {
|
||||
type: "vbox",
|
||||
align: "center"
|
||||
},
|
||||
items: [{
|
||||
xtype: "box",
|
||||
padding: "15px 0 0 0",
|
||||
html: '<p style="width: 320px; text-align: center; font-size: 8pt; font-family: Arial; color: #636363; padding-top: 10px;">' + this.useChromeMessage + "</p>"
|
||||
}]
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
region: "south",
|
||||
height: 58,
|
||||
style: "border-top: 1px solid #E5E5E5",
|
||||
padding: "16px 0 0 0",
|
||||
layout: {
|
||||
type: "hbox",
|
||||
align: "center",
|
||||
pack: "center"
|
||||
},
|
||||
items: [{
|
||||
xtype: "button",
|
||||
cls: "asc-blue-button",
|
||||
width: 85,
|
||||
text: Ext.Msg.buttonText["ok"],
|
||||
margin: "0 5px 0 0",
|
||||
listeners: {
|
||||
click: function (btn) {
|
||||
this.fireEvent("onmodalresult", this, 0);
|
||||
this.close();
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
},
|
||||
{
|
||||
xtype: "button",
|
||||
cls: "asc-darkgray-button",
|
||||
text: this.dontShowButtonText,
|
||||
autoSize: true,
|
||||
listeners: {
|
||||
click: function (btn) {
|
||||
this.fireEvent("onmodalresult", this, 1);
|
||||
this.close();
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
}]
|
||||
}];
|
||||
this.callParent(arguments);
|
||||
},
|
||||
dontShowButtonText: "Don't show again",
|
||||
useChromeMessage: "We recommend that you use one of the latest versions of the Google Chrome web browser to speed up your work at documents."
|
||||
});
|
||||
90
OfficeWeb/apps/documenteditor/main/app/view/CreateFile.js
Normal file
90
OfficeWeb/apps/documenteditor/main/app/view/CreateFile.js
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* (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.view.CreateFile", {
|
||||
extend: "Ext.panel.Panel",
|
||||
alias: "widget.decreatenew",
|
||||
cls: "de-file-createnew",
|
||||
layout: {
|
||||
type: "vbox",
|
||||
align: "stretch"
|
||||
},
|
||||
requires: ["Ext.container.Container", "Ext.data.Model", "Ext.data.Store", "Ext.view.View", "Ext.XTemplate", "Common.plugin.DataViewScrollPane"],
|
||||
constructor: function (config) {
|
||||
this.initConfig(config);
|
||||
this.callParent(arguments);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
this.callParent(arguments);
|
||||
var me = this;
|
||||
me.add({
|
||||
xtype: "container",
|
||||
html: "<h3>" + me.fromBlankText + "</h3>" + "<hr noshade>" + '<div class="blank-document">' + '<div id="id-create-blank-document" class="btn-blank-document"></div>' + '<div class="blank-document-info">' + "<h3>" + me.newDocumentText + "</h3>" + me.newDescriptionText + "</div>" + "</div>" + '<div style="clear: both;"></div>' + "<h3>" + me.fromTemplateText + "</h3>" + "<hr noshade>"
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
flex: 1,
|
||||
layout: "fit",
|
||||
cls: "container-template-list",
|
||||
items: [{
|
||||
xtype: "dataview",
|
||||
store: "FileTemplates",
|
||||
tpl: Ext.create("Ext.XTemplate", '<tpl for=".">', '<div class="thumb-wrap">', '<tpl if="this.isEmptyIcon(icon)">', '<div class="thumb"></div>', "</tpl>", '<tpl if="this.isEmptyIcon(icon) == false">', '<div class="thumb" style="background-image: url(' + "'{icon}'" + ');"></div>', "</tpl>", '<div class="title">{name:htmlEncode}</div>', "</div>", "</tpl>", {
|
||||
isEmptyIcon: function (icon) {
|
||||
return icon == "";
|
||||
}
|
||||
}),
|
||||
singleSelect: true,
|
||||
trackOver: true,
|
||||
autoScroll: true,
|
||||
overItemCls: "x-item-over",
|
||||
itemSelector: "div.thumb-wrap",
|
||||
cls: "x-view-context",
|
||||
emptyText: '<div class="empty-text">' + this.noTemplatesText + "</div>",
|
||||
deferEmptyText: false,
|
||||
plugins: [{
|
||||
ptype: "dataviewscrollpane",
|
||||
pluginId: "scrollpane",
|
||||
areaSelector: ".x-view-context",
|
||||
settings: {
|
||||
enableKeyboardNavigation: true
|
||||
}
|
||||
}]
|
||||
}]
|
||||
});
|
||||
},
|
||||
fromBlankText: "From Blank",
|
||||
newDocumentText: "New Text Document",
|
||||
newDescriptionText: "Create a new blank text document which you will be able to style and format after it is created during the editing. Or choose one of the templates to start a document of a certain type or purpose where some styles have already been pre-applied.",
|
||||
fromTemplateText: "From Template",
|
||||
noTemplatesText: "There are no templates"
|
||||
});
|
||||
227
OfficeWeb/apps/documenteditor/main/app/view/DockablePanel.js
Normal file
227
OfficeWeb/apps/documenteditor/main/app/view/DockablePanel.js
Normal file
@@ -0,0 +1,227 @@
|
||||
/*
|
||||
* (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.view.DockablePanel", {
|
||||
extend: "Ext.panel.Panel",
|
||||
alias: "widget.dedockablepanel",
|
||||
requires: ["DE.view.UndockedWindow"],
|
||||
draggable: true,
|
||||
tolerance: 5,
|
||||
bodyPadding: "0 0 0 15px",
|
||||
listeners: {
|
||||
show: function (cmp) {
|
||||
if (cmp.dockConfig && !cmp.dockConfig.isVisible) {
|
||||
var size = cmp.getSize();
|
||||
var header = cmp.ownerCt.getHeader().getSize();
|
||||
cmp.dockConfig.isVisible = true;
|
||||
cmp.dockConfig.size.height = size.height;
|
||||
cmp.setHeight(size.height - header.height);
|
||||
}
|
||||
}
|
||||
},
|
||||
constructor: function (config) {
|
||||
this.controls = [];
|
||||
this.callParent(arguments);
|
||||
this.initConfig(config);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
var me = this;
|
||||
me.tools = [{
|
||||
type: "pin",
|
||||
qtip: this.textUndock,
|
||||
handler: function () {
|
||||
var pos = me.ownerCt.ownerCt.getPosition();
|
||||
if (me.actionConfig) {
|
||||
me.undock.apply(me, [me.actionConfig.undockPos[0], me.actionConfig.undockPos[1]]);
|
||||
} else {
|
||||
me.undock.apply(me, [pos[0] - 20, pos[1] + 10]);
|
||||
}
|
||||
},
|
||||
scope: me
|
||||
}];
|
||||
me.addEvents("docked", "undocked");
|
||||
me.callParent(arguments);
|
||||
},
|
||||
initDraggable: function () {
|
||||
var me = this;
|
||||
me.draggable = {
|
||||
delegate: me.getHeader().getEl(),
|
||||
tolerance: 100,
|
||||
constrain: true,
|
||||
constrainTo: document.body,
|
||||
listeners: {
|
||||
dragstart: function () {
|
||||
me.startDragPos = me.getPosition(true);
|
||||
},
|
||||
dragend: function () {
|
||||
var owner_pos = me.ownerCt.getPosition(),
|
||||
pos = me.getPosition(true);
|
||||
if (pos[0] < owner_pos[0] - 20) {
|
||||
me.undock.apply(me, pos);
|
||||
} else {
|
||||
me.setPosition(me.startDragPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Ext.Component.prototype.initDraggable.call(me);
|
||||
},
|
||||
dock: function (suspend) {
|
||||
var me = this,
|
||||
ownerCt, size, win;
|
||||
if (me.dockConfig) {
|
||||
ownerCt = me.dockConfig.ownerCt;
|
||||
win = me.dockConfig.win;
|
||||
size = me.dockConfig.size;
|
||||
win.remove(me, false);
|
||||
me.getHeader().show();
|
||||
me.setSize(size);
|
||||
ownerCt.add(me);
|
||||
win.destroy();
|
||||
delete me.dockConfig;
|
||||
if (!suspend) {
|
||||
me.fireEvent("docked", me);
|
||||
}
|
||||
}
|
||||
},
|
||||
undock: function (x, y, suspend, ownerWidth) {
|
||||
var me = this,
|
||||
ownerCt = me.ownerCt,
|
||||
ownerPos = (ownerCt) ? ownerCt.ownerCt.getPosition() : [0, 0],
|
||||
size = me.getSize(),
|
||||
bodySize = me.body.getSize(),
|
||||
ctWidth = (ownerWidth > 0) ? ownerWidth : ownerCt.ownerCt.getWidth(),
|
||||
win,
|
||||
isVisible = me.isVisible();
|
||||
if (me.dockConfig) {
|
||||
return;
|
||||
}
|
||||
size.width = ctWidth;
|
||||
bodySize.width = ctWidth;
|
||||
ownerCt.remove(me, false);
|
||||
me.getHeader().hide();
|
||||
me.setPosition(0, 0);
|
||||
if (isVisible) {
|
||||
me.setSize(bodySize);
|
||||
} else {
|
||||
me.setWidth(ctWidth);
|
||||
}
|
||||
win = Ext.create("DE.view.UndockedWindow", {
|
||||
items: me,
|
||||
title: me.title,
|
||||
tools: [{
|
||||
type: "pin",
|
||||
qtip: me.textRedock,
|
||||
handler: function () {
|
||||
me.dock();
|
||||
}
|
||||
}],
|
||||
listeners: {
|
||||
move: function (cmp, x, y) {
|
||||
var xy = ownerCt.getPosition();
|
||||
if (ownerCt.isVisible(true)) {
|
||||
if ((xy[0] - x) <= me.tolerance) {
|
||||
Ext.defer(me.dock, 10, me);
|
||||
}
|
||||
}
|
||||
},
|
||||
afterrender: function () {
|
||||
win.dd.addListener("dragend", Ext.bind(function () {
|
||||
var xy = win.getPosition();
|
||||
me.actionConfig = {
|
||||
undockPos: [xy[0], xy[1]]
|
||||
};
|
||||
me.fireEvent("changeposition", me);
|
||||
},
|
||||
this), this);
|
||||
}
|
||||
}
|
||||
});
|
||||
me.dockConfig = {
|
||||
ownerCt: ownerCt,
|
||||
win: win,
|
||||
size: size,
|
||||
isVisible: isVisible
|
||||
};
|
||||
win.show();
|
||||
if (Ext.isNumber(x) && Ext.isNumber(y)) {
|
||||
var pos = this.checkWindowPosition({
|
||||
x: x,
|
||||
y: y
|
||||
},
|
||||
{
|
||||
width: win.getWidth(),
|
||||
height: win.getHeight()
|
||||
});
|
||||
win.setPagePosition(pos.x, pos.y);
|
||||
me.actionConfig = {
|
||||
undockPos: [pos.x, pos.y]
|
||||
};
|
||||
}
|
||||
ownerCt.doLayout();
|
||||
if (!suspend) {
|
||||
me.fireEvent("undocked", me, ownerPos, ctWidth);
|
||||
}
|
||||
},
|
||||
isUndocked: function () {
|
||||
return typeof this.dockConfig !== "undefined";
|
||||
},
|
||||
checkWindowPosition: function (position, size) {
|
||||
var bodypos = Ext.getBody().getSize();
|
||||
if (position.x > bodypos.width - 10) {
|
||||
position.x = Math.max(bodypos.width - 10 - size.width, 0);
|
||||
} else {
|
||||
if (position.x < 0) {
|
||||
position.x = 10;
|
||||
}
|
||||
}
|
||||
if (position.y > bodypos.height - 10) {
|
||||
position.y = Math.max(bodypos.height - 10 - size.height, 0);
|
||||
} else {
|
||||
if (position.y < 0) {
|
||||
position.y = 10;
|
||||
}
|
||||
}
|
||||
return position;
|
||||
},
|
||||
SuspendEvents: function () {
|
||||
for (var i = 0; i < this.controls.length; i++) {
|
||||
this.controls[i].suspendEvents(false);
|
||||
}
|
||||
},
|
||||
ResumeEvents: function () {
|
||||
for (var i = 0; i < this.controls.length; i++) {
|
||||
this.controls[i].resumeEvents();
|
||||
}
|
||||
},
|
||||
textRedock: "Redock to original panel"
|
||||
});
|
||||
231
OfficeWeb/apps/documenteditor/main/app/view/DockableTabPanel.js
Normal file
231
OfficeWeb/apps/documenteditor/main/app/view/DockableTabPanel.js
Normal file
@@ -0,0 +1,231 @@
|
||||
/*
|
||||
* (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.view.DockableTabPanel", {
|
||||
extend: "Ext.panel.Panel",
|
||||
alias: "widget.dedockabletabpanel",
|
||||
requires: ["DE.view.UndockedWindow"],
|
||||
draggable: true,
|
||||
tolerance: 5,
|
||||
layout: "card",
|
||||
constructor: function (config) {
|
||||
this.controls = [];
|
||||
this.callParent(arguments);
|
||||
this.initConfig(config);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
var me = this;
|
||||
me.tools = [{
|
||||
type: "pin",
|
||||
qtip: this.textUndock,
|
||||
handler: function () {
|
||||
var pos = me.ownerCt.ownerCt.getPosition();
|
||||
if (me.actionConfig) {
|
||||
me.undock.apply(me, [me.actionConfig.undockPos[0], me.actionConfig.undockPos[1]]);
|
||||
} else {
|
||||
me.undock.apply(me, [pos[0] - 20, pos[1] + 10]);
|
||||
}
|
||||
},
|
||||
scope: me
|
||||
}];
|
||||
me.addEvents("docked", "undocked");
|
||||
me.callParent(arguments);
|
||||
},
|
||||
initDraggable: function () {
|
||||
var me = this;
|
||||
me.draggable = {
|
||||
delegate: me.getHeader().getEl(),
|
||||
tolerance: 100,
|
||||
constrain: true,
|
||||
constrainTo: document.body,
|
||||
listeners: {
|
||||
dragstart: function () {
|
||||
me.startDragPos = me.getPosition(true);
|
||||
},
|
||||
dragend: function () {
|
||||
var owner_pos = me.ownerCt.getPosition(),
|
||||
pos = me.getPosition(true);
|
||||
if (pos[0] < owner_pos[0] - 20) {
|
||||
var calcSizeObj = me.getPanelSize.apply(me);
|
||||
me.hide();
|
||||
Ext.defer(me.undock, 5, me, [pos[0], pos[1], false, null, calcSizeObj]);
|
||||
} else {
|
||||
me.setPosition(me.startDragPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
if (me.tabButtons) {
|
||||
me.getHeader().insert(0, me.tabButtons);
|
||||
}
|
||||
Ext.Component.prototype.initDraggable.call(me);
|
||||
},
|
||||
dock: function (suspend) {
|
||||
var me = this,
|
||||
ownerCt, size, win;
|
||||
if (me.dockConfig) {
|
||||
ownerCt = me.dockConfig.ownerCt;
|
||||
win = me.dockConfig.win;
|
||||
size = me.dockConfig.size;
|
||||
win.remove(me, false);
|
||||
if (me.tabButtons) {
|
||||
me.getHeader().insert(0, me.tabButtons);
|
||||
}
|
||||
me.getHeader().show();
|
||||
me.setSize(size);
|
||||
ownerCt.add(me);
|
||||
win.hide();
|
||||
delete me.dockConfig;
|
||||
if (!suspend) {
|
||||
me.fireEvent("docked", me);
|
||||
}
|
||||
}
|
||||
},
|
||||
getPanelSize: function () {
|
||||
return {
|
||||
size: this.getSize(),
|
||||
bodySize: this.body.getSize(),
|
||||
header: this.getHeader().getHeight()
|
||||
};
|
||||
},
|
||||
undock: function (x, y, suspend, ownerWidth, calcSizeObj) {
|
||||
var me = this,
|
||||
ownerCt = me.ownerCt,
|
||||
ownerPos = (ownerCt) ? ownerCt.ownerCt.getPosition() : [0, 0],
|
||||
ctWidth = (ownerWidth > 0) ? ownerWidth : ownerCt.ownerCt.getWidth(),
|
||||
size = (calcSizeObj) ? calcSizeObj.size : me.getSize(),
|
||||
bodySize = (calcSizeObj) ? calcSizeObj.bodySize : me.body.getSize(),
|
||||
header = (calcSizeObj) ? calcSizeObj.header : me.getHeader().getHeight();
|
||||
if (me.dockConfig) {
|
||||
return;
|
||||
}
|
||||
size.width = ctWidth;
|
||||
bodySize.width = ctWidth;
|
||||
ownerCt.remove(me, false);
|
||||
me.show();
|
||||
me.getHeader().hide();
|
||||
me.setPosition(0, 0);
|
||||
if (me.isVisible()) {
|
||||
me.setSize(bodySize);
|
||||
me.body.setSize(bodySize);
|
||||
} else {
|
||||
me.setWidth(ctWidth);
|
||||
}
|
||||
if (me.win === undefined) {
|
||||
me.win = Ext.create("DE.view.UndockedWindow", {
|
||||
items: me,
|
||||
title: me.title,
|
||||
tools: [{
|
||||
type: "pin",
|
||||
qtip: me.textRedock,
|
||||
handler: function () {
|
||||
me.dock();
|
||||
}
|
||||
}],
|
||||
listeners: {
|
||||
move: function (cmp, x, y) {
|
||||
var xy = ownerCt.getPosition();
|
||||
if (ownerCt.isVisible(true)) {
|
||||
if ((xy[0] - x) <= me.tolerance) {
|
||||
Ext.defer(me.dock, 10, me);
|
||||
}
|
||||
}
|
||||
},
|
||||
afterrender: function () {
|
||||
me.win.dd.addListener("dragend", Ext.bind(function () {
|
||||
var xy = me.win.getPosition();
|
||||
me.actionConfig = {
|
||||
undockPos: [xy[0], xy[1]]
|
||||
};
|
||||
me.fireEvent("changeposition", me);
|
||||
},
|
||||
this), this);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
me.win.add(me);
|
||||
}
|
||||
if (me.tabButtons) {
|
||||
me.win.getHeader().insert(0, me.tabButtons);
|
||||
}
|
||||
me.dockConfig = {
|
||||
ownerCt: ownerCt,
|
||||
win: me.win,
|
||||
size: size,
|
||||
headerHeight: header
|
||||
};
|
||||
me.win.show();
|
||||
if (Ext.isNumber(x) && Ext.isNumber(y)) {
|
||||
var pos = this.checkWindowPosition({
|
||||
x: x,
|
||||
y: y
|
||||
},
|
||||
{
|
||||
width: me.win.getWidth(),
|
||||
height: me.win.getHeight()
|
||||
});
|
||||
me.win.setPagePosition(pos.x, (pos.y + me.win.getHeight() > Ext.getBody().getSize().height) ? 0 : pos.y);
|
||||
me.actionConfig = {
|
||||
undockPos: [pos.x, pos.y]
|
||||
};
|
||||
}
|
||||
ownerCt.doLayout();
|
||||
me.doLayout();
|
||||
if (!suspend) {
|
||||
me.fireEvent("undocked", me, ownerPos, ctWidth);
|
||||
}
|
||||
},
|
||||
isUndocked: function () {
|
||||
return typeof this.dockConfig !== "undefined";
|
||||
},
|
||||
checkWindowPosition: function (position, size) {
|
||||
var bodypos = Ext.getBody().getSize();
|
||||
if (position.x > bodypos.width - 10) {
|
||||
position.x = Math.max(bodypos.width - 10 - size.width, 0);
|
||||
} else {
|
||||
if (position.x < 0) {
|
||||
position.x = 10;
|
||||
}
|
||||
}
|
||||
if (position.y > bodypos.height - 10) {
|
||||
position.y = Math.max(bodypos.height - 10 - size.height, 0);
|
||||
} else {
|
||||
if (position.y < 0) {
|
||||
position.y = 10;
|
||||
}
|
||||
}
|
||||
return position;
|
||||
},
|
||||
textRedock: "Redock to original panel",
|
||||
textUndock: "Undock panel"
|
||||
});
|
||||
294
OfficeWeb/apps/documenteditor/main/app/view/DocumentHelp.js
Normal file
294
OfficeWeb/apps/documenteditor/main/app/view/DocumentHelp.js
Normal file
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* (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.model.ModelHelpMenu", {
|
||||
extend: "Ext.data.Model",
|
||||
fields: [{
|
||||
type: "string",
|
||||
name: "name"
|
||||
},
|
||||
{
|
||||
type: "string",
|
||||
name: "src"
|
||||
},
|
||||
{
|
||||
type: "string",
|
||||
name: "headername"
|
||||
}]
|
||||
});
|
||||
Ext.define("DE.view.DocumentHelp", {
|
||||
extend: "Ext.container.Container",
|
||||
alias: "widget.dedocumenthelp",
|
||||
cls: "de-documenthelp-body",
|
||||
autoScroll: true,
|
||||
requires: ["Ext.container.Container", "Ext.XTemplate", "Ext.view.View", "Ext.data.Model", "Ext.data.Store", "Common.plugin.DataViewScrollPane"],
|
||||
constructor: function (config) {
|
||||
this.initConfig(config);
|
||||
this.callParent(arguments);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
var me = this;
|
||||
this.urlPref = "resources/help/en/";
|
||||
var en_data = [{
|
||||
src: "UsageInstructions/SetPageParameters.htm",
|
||||
name: "Set page parameters",
|
||||
headername: "Usage Instructions"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/CopyPasteUndoRedo.htm",
|
||||
name: "Copy/paste text passages, undo/redo your actions"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/NonprintingCharacters.htm",
|
||||
name: "Show/hide nonprinting characters"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/AlignText.htm",
|
||||
name: "Align your text in a line or paragraph"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/FormattingPresets.htm",
|
||||
name: "Apply formatting presets"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/BackgroundColor.htm",
|
||||
name: "Select background color for a paragraph"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/ParagraphIndents.htm",
|
||||
name: "Change paragraph indents"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/LineSpacing.htm",
|
||||
name: "Set paragraph line spacing"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/PageBreaks.htm",
|
||||
name: "Insert page breaks"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/AddBorders.htm",
|
||||
name: "Add Borders"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/FontTypeSizeColor.htm",
|
||||
name: "Set font type, size, and color"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/DecorationStyles.htm",
|
||||
name: "Apply font decoration styles"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/CopyClearFormatting.htm",
|
||||
name: "Copy/clear text formatting"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/CreateLists.htm",
|
||||
name: "Create lists"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/InsertTables.htm",
|
||||
name: "Insert tables"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/InsertImages.htm",
|
||||
name: "Insert images"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/AddHyperlinks.htm",
|
||||
name: "Add hyperlinks"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/InsertHeadersFooters.htm",
|
||||
name: "Insert headers and footers"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/InsertPageNumbers.htm",
|
||||
name: "Insert page numbers"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/ViewDocInfo.htm",
|
||||
name: "View document information"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/SavePrintDownload.htm",
|
||||
name: "Save/print/download your document"
|
||||
},
|
||||
{
|
||||
src: "UsageInstructions/OpenCreateNew.htm",
|
||||
name: "Create a new document or open an existing one"
|
||||
},
|
||||
{
|
||||
src: "HelpfulHints/About.htm",
|
||||
name: "About ONLYOFFICE Document Editor",
|
||||
headername: "Helpful Hints"
|
||||
},
|
||||
{
|
||||
src: "HelpfulHints/SupportedFormats.htm",
|
||||
name: "Supported Formats of Electronic Documents"
|
||||
},
|
||||
{
|
||||
src: "HelpfulHints/Navigation.htm",
|
||||
name: "Navigation through Your Document"
|
||||
},
|
||||
{
|
||||
src: "HelpfulHints/Search.htm",
|
||||
name: "Search Function"
|
||||
},
|
||||
{
|
||||
src: "HelpfulHints/KeyboardShortcuts.htm",
|
||||
name: "Keyboard Shortcuts"
|
||||
}];
|
||||
this.menuStore = Ext.create("Ext.data.Store", {
|
||||
model: "DE.model.ModelHelpMenu",
|
||||
proxy: {
|
||||
type: "ajax",
|
||||
url: "help/Contents.json",
|
||||
noCache: false
|
||||
},
|
||||
listeners: {
|
||||
load: function (store, records, successful) {
|
||||
if (!successful) {
|
||||
if (me.urlPref.indexOf("resources/help/en/") < 0) {
|
||||
me.urlPref = "resources/help/en/";
|
||||
store.getProxy().url = "resources/help/en/Contents.json";
|
||||
store.load();
|
||||
} else {
|
||||
me.urlPref = "resources/help/en/";
|
||||
store.loadData(en_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
var menuTpl = new Ext.XTemplate('<tpl for=".">', '<tpl if="headername">', '<div class="header-wrap">', '<span class="header">{headername}</span>', "</div>", "</tpl>", '<div class="thumb-wrap">', '<span class="caption">{name}</span>', "</div>", "</tpl>", '<div class="x-clear"></div>');
|
||||
this.cntMenu = Ext.create("Ext.container.Container", {
|
||||
layout: "fit",
|
||||
cls: "help-menu-container",
|
||||
width: 200,
|
||||
items: [this.menuView = Ext.create("Ext.view.View", {
|
||||
store: this.menuStore,
|
||||
tpl: menuTpl,
|
||||
singleSelect: true,
|
||||
trackOver: true,
|
||||
width: "100%",
|
||||
overItemCls: "x-item-over",
|
||||
itemSelector: "div.thumb-wrap",
|
||||
cls: "help-menu-view",
|
||||
listeners: {
|
||||
afterrender: function (view) {
|
||||
view.getSelectionModel().deselectOnContainerClick = false;
|
||||
if (view.getStore().getCount()) {
|
||||
view.select(0);
|
||||
me.iFrame.src = me.urlPref + view.getStore().getAt(0).data.src;
|
||||
}
|
||||
},
|
||||
selectionchange: function (model, selections) {
|
||||
var record = model.getLastSelected();
|
||||
if (record) {
|
||||
me.iFrame.src = me.urlPref + record.data.src;
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: [{
|
||||
ptype: "dataviewscrollpane",
|
||||
areaSelector: ".help-menu-view",
|
||||
pluginId: "docHelpPluginId",
|
||||
settings: {
|
||||
enableKeyboardNavigation: true,
|
||||
keyboardSpeed: 0.001
|
||||
}
|
||||
}]
|
||||
})]
|
||||
});
|
||||
this.iFrame = document.createElement("iframe");
|
||||
this.iFrame.src = "";
|
||||
this.iFrame.align = "top";
|
||||
this.iFrame.frameBorder = "0";
|
||||
this.iFrame.width = "100%";
|
||||
this.iFrame.height = "100%";
|
||||
this.iFrame.onload = Ext.bind(function () {
|
||||
var src = arguments[0].currentTarget.contentDocument.URL;
|
||||
Ext.each(this.menuStore.data.items, function (item, index) {
|
||||
var res = src.indexOf(item.data.src);
|
||||
if (res > 0) {
|
||||
this.menuView.select(index);
|
||||
var node = this.menuView.getNode(index),
|
||||
plugin = this.menuView.getPlugin("docHelpPluginId");
|
||||
if (plugin) {
|
||||
plugin.scrollToElement(node);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
this);
|
||||
},
|
||||
this);
|
||||
this.items = [{
|
||||
xtype: "container",
|
||||
layout: {
|
||||
type: "hbox",
|
||||
align: "stretch"
|
||||
},
|
||||
height: "100%",
|
||||
items: [this.cntMenu, {
|
||||
xtype: "tbspacer",
|
||||
width: 2,
|
||||
style: "border-left: 1px solid #C7C7C7"
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
flex: 1,
|
||||
layout: "fit",
|
||||
listeners: {
|
||||
afterrender: function (cmp) {
|
||||
cmp.getEl().appendChild(me.iFrame);
|
||||
}
|
||||
}
|
||||
}]
|
||||
}];
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setApi: function (o) {
|
||||
if (o) {
|
||||
this.api = o;
|
||||
}
|
||||
},
|
||||
setLangConfig: function (lang) {
|
||||
if (lang) {
|
||||
lang = lang.split("-")[0];
|
||||
this.menuStore.getProxy().url = "resources/help/" + lang + "/Contents.json";
|
||||
this.menuStore.load();
|
||||
this.urlPref = "resources/help/" + lang + "/";
|
||||
}
|
||||
}
|
||||
});
|
||||
2276
OfficeWeb/apps/documenteditor/main/app/view/DocumentHolder.js
Normal file
2276
OfficeWeb/apps/documenteditor/main/app/view/DocumentHolder.js
Normal file
File diff suppressed because it is too large
Load Diff
395
OfficeWeb/apps/documenteditor/main/app/view/DocumentInfo.js
Normal file
395
OfficeWeb/apps/documenteditor/main/app/view/DocumentInfo.js
Normal file
@@ -0,0 +1,395 @@
|
||||
/*
|
||||
* (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.view.DocumentInfo", {
|
||||
extend: "Ext.container.Container",
|
||||
alias: "widget.dedocumentinfo",
|
||||
cls: "de-documentinfo-body",
|
||||
autoScroll: true,
|
||||
requires: ["Ext.button.Button", "Ext.container.Container", "Common.plugin.ScrollPane", "Ext.form.Label", "Ext.XTemplate", "Ext.Date"],
|
||||
uses: ["Common.view.DocumentAccessDialog"],
|
||||
listeners: {
|
||||
afterrender: function (cmp, eOpts) {
|
||||
cmp.updateInfo(cmp.doc);
|
||||
},
|
||||
hide: function (cmp, eOpts) {
|
||||
cmp.stopUpdatingStatisticInfo();
|
||||
},
|
||||
show: function (cmp, eOpts) {
|
||||
cmp.updateStatisticInfo();
|
||||
}
|
||||
},
|
||||
constructor: function (config) {
|
||||
this.initConfig(config);
|
||||
this.callParent(arguments);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
this.infoObj = {
|
||||
PageCount: 0,
|
||||
WordsCount: 0,
|
||||
ParagraphCount: 0,
|
||||
SymbolsCount: 0,
|
||||
SymbolsWSCount: 0
|
||||
};
|
||||
this.inProgress = false;
|
||||
this.lblTitle = Ext.create("Ext.form.Label", {
|
||||
text: "-",
|
||||
height: 14
|
||||
});
|
||||
this.lblPlacement = Ext.create("Ext.form.Label", {
|
||||
text: "-",
|
||||
width: 150,
|
||||
height: 14,
|
||||
style: "text-align:left",
|
||||
hideId: "element-to-hide"
|
||||
});
|
||||
this.lblDate = Ext.create("Ext.form.Label", {
|
||||
text: "-",
|
||||
width: 150,
|
||||
height: 14,
|
||||
style: "text-align:left",
|
||||
hideId: "element-to-hide"
|
||||
});
|
||||
this.lblStatPages = Ext.create("Ext.form.Label", {
|
||||
text: "",
|
||||
width: 150,
|
||||
height: 14,
|
||||
style: "text-align:left"
|
||||
});
|
||||
this.lblStatWords = Ext.create("Ext.form.Label", {
|
||||
text: "",
|
||||
width: 150,
|
||||
height: 14,
|
||||
style: "text-align:left"
|
||||
});
|
||||
this.lblStatParagraphs = Ext.create("Ext.form.Label", {
|
||||
text: "",
|
||||
width: 150,
|
||||
height: 14,
|
||||
style: "text-align:left"
|
||||
});
|
||||
this.lblStatSymbols = Ext.create("Ext.form.Label", {
|
||||
text: "",
|
||||
width: 150,
|
||||
height: 14,
|
||||
style: "text-align:left"
|
||||
});
|
||||
this.lblStatSpaces = Ext.create("Ext.form.Label", {
|
||||
text: "",
|
||||
width: 150,
|
||||
height: 14,
|
||||
style: "text-align:left"
|
||||
});
|
||||
var userTpl = Ext.create("Ext.XTemplate", '<span class="userLink">{text:htmlEncode}</span>');
|
||||
this.cntAuthor = Ext.create("Ext.container.Container", {
|
||||
tpl: userTpl,
|
||||
data: {
|
||||
text: "-"
|
||||
},
|
||||
hideId: "element-to-hide"
|
||||
});
|
||||
var rightsTpl = Ext.create("Ext.XTemplate", "<table>", '<tpl for=".">', "<tr>", '<td style="padding: 0 20px 5px 0;"><span class="userLink">{user:htmlEncode}</span></td>', '<td style="padding: 0 20px 5px 0;">{permissions:htmlEncode}</td>', "</tr>", "</tpl>", "</table>");
|
||||
this.cntRights = Ext.create("Ext.container.Container", {
|
||||
tpl: rightsTpl,
|
||||
hideId: "element-to-hide"
|
||||
});
|
||||
this.items = [{
|
||||
xtype: "tbspacer",
|
||||
height: 30
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 2,
|
||||
tableAttrs: {
|
||||
style: "width: 100%;"
|
||||
},
|
||||
tdAttrs: {
|
||||
style: "padding: 5px 10px;vertical-align: top;"
|
||||
}
|
||||
},
|
||||
items: [{
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.txtTitle,
|
||||
style: "display: block;text-align: right;",
|
||||
width: "100%"
|
||||
},
|
||||
this.lblTitle, {
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.txtAuthor,
|
||||
style: "display: block;text-align: right;",
|
||||
width: "100%"
|
||||
},
|
||||
this.cntAuthor, {
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.txtPlacement,
|
||||
style: "display: block;text-align: right;",
|
||||
width: "100%"
|
||||
},
|
||||
this.lblPlacement, {
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.txtDate,
|
||||
style: "display: block;text-align: right;",
|
||||
width: "100%"
|
||||
},
|
||||
this.lblDate, {
|
||||
xtype: "tbspacer",
|
||||
colspan: 2,
|
||||
height: 5
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.txtRights,
|
||||
style: "display: block;text-align: right;",
|
||||
width: "100%"
|
||||
},
|
||||
this.cntRights, {
|
||||
xtype: "box"
|
||||
},
|
||||
this.btnEditRights = Ext.widget("button", {
|
||||
id: "doc-info-set-rights",
|
||||
cls: "asc-blue-button",
|
||||
text: this.txtBtnAccessRights,
|
||||
hideId: "element-to-hide",
|
||||
listeners: {
|
||||
click: Ext.bind(this._changeAccessRights, this)
|
||||
}
|
||||
}), this.tbsRights = Ext.create("Ext.toolbar.Spacer", {
|
||||
colspan: 2,
|
||||
height: 5,
|
||||
hideId: "element-to-hide"
|
||||
}), {
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.txtStatistics,
|
||||
style: "display: block;text-align: right;",
|
||||
width: "100%"
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
width: "100%",
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 2,
|
||||
tdAttrs: {
|
||||
style: "padding: 0 20px 5px 0;vertical-align: top;"
|
||||
}
|
||||
},
|
||||
items: [{
|
||||
xtype: "label",
|
||||
text: this.txtPages
|
||||
},
|
||||
this.lblStatPages, {
|
||||
xtype: "label",
|
||||
text: this.txtParagraphs
|
||||
},
|
||||
this.lblStatParagraphs, {
|
||||
xtype: "label",
|
||||
text: this.txtWords
|
||||
},
|
||||
this.lblStatWords, {
|
||||
xtype: "label",
|
||||
text: this.txtSymbols
|
||||
},
|
||||
this.lblStatSymbols, {
|
||||
xtype: "label",
|
||||
text: this.txtSpaces
|
||||
},
|
||||
this.lblStatSpaces]
|
||||
}]
|
||||
}];
|
||||
Ext.apply(this, {
|
||||
plugins: [{
|
||||
ptype: "scrollpane",
|
||||
areaSelector: ".x-container",
|
||||
pluginId: "docInfoPluginId",
|
||||
settings: {
|
||||
enableKeyboardNavigation: true
|
||||
}
|
||||
}]
|
||||
});
|
||||
this.callParent(arguments);
|
||||
},
|
||||
updateInfo: function (doc) {
|
||||
this.doc = doc;
|
||||
if (!this.rendered) {
|
||||
return;
|
||||
}
|
||||
doc = doc || {};
|
||||
this.lblTitle.setText((doc.title) ? doc.title : "-");
|
||||
if (doc.info) {
|
||||
if (doc.info.author) {
|
||||
this.cntAuthor.update({
|
||||
text: doc.info.author
|
||||
});
|
||||
}
|
||||
this._ShowHideInfoItem(this.cntAuthor, doc.info.author !== undefined && doc.info.author !== null);
|
||||
if (doc.info.created) {
|
||||
this.lblDate.setText(doc.info.created);
|
||||
}
|
||||
this._ShowHideInfoItem(this.lblDate, doc.info.created !== undefined && doc.info.created !== null);
|
||||
if (doc.info.folder) {
|
||||
this.lblPlacement.setText(doc.info.folder);
|
||||
}
|
||||
this._ShowHideInfoItem(this.lblPlacement, doc.info.folder !== undefined && doc.info.folder !== null);
|
||||
if (doc.info.sharingSettings) {
|
||||
this.cntRights.update(doc.info.sharingSettings);
|
||||
}
|
||||
this._ShowHideInfoItem(this.cntRights, doc.info.sharingSettings !== undefined && doc.info.sharingSettings !== null && this._readonlyRights !== true);
|
||||
this._ShowHideInfoItem(this.tbsRights, doc.info.sharingSettings !== undefined && doc.info.sharingSettings !== null && this._readonlyRights !== true);
|
||||
this._ShowHideInfoItem(this.btnEditRights, !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights !== true);
|
||||
} else {
|
||||
this._ShowHideDocInfo(false);
|
||||
}
|
||||
},
|
||||
_ShowHideInfoItem: function (cmp, visible) {
|
||||
var tr = cmp.getEl().up("tr");
|
||||
if (tr) {
|
||||
tr.setDisplayed(visible);
|
||||
}
|
||||
},
|
||||
_ShowHideDocInfo: function (visible) {
|
||||
var components = Ext.ComponentQuery.query('[hideId="element-to-hide"]', this);
|
||||
for (var i = 0; i < components.length; i++) {
|
||||
this._ShowHideInfoItem(components[i], visible);
|
||||
}
|
||||
},
|
||||
updateStatisticInfo: function () {
|
||||
if (this.api && this.doc) {
|
||||
this.api.startGetDocInfo();
|
||||
}
|
||||
},
|
||||
stopUpdatingStatisticInfo: function () {
|
||||
if (this.api) {
|
||||
this.api.stopGetDocInfo();
|
||||
}
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
this.api.asc_registerCallback("asc_onGetDocInfoStart", Ext.bind(this._onGetDocInfoStart, this));
|
||||
this.api.asc_registerCallback("asc_onGetDocInfoStop", Ext.bind(this._onGetDocInfoEnd, this));
|
||||
this.api.asc_registerCallback("asc_onDocInfo", Ext.bind(this._onDocInfo, this));
|
||||
this.api.asc_registerCallback("asc_onGetDocInfoEnd", Ext.bind(this._onGetDocInfoEnd, this));
|
||||
return this;
|
||||
},
|
||||
loadConfig: function (data) {
|
||||
this.sharingSettingsUrl = data.config.sharingSettingsUrl;
|
||||
return this;
|
||||
},
|
||||
_onGetDocInfoStart: function () {
|
||||
this.inProgress = true;
|
||||
this.infoObj = {
|
||||
PageCount: 0,
|
||||
WordsCount: 0,
|
||||
ParagraphCount: 0,
|
||||
SymbolsCount: 0,
|
||||
SymbolsWSCount: 0
|
||||
};
|
||||
Ext.defer(function () {
|
||||
if (!this.inProgress) {
|
||||
return;
|
||||
}
|
||||
this.lblStatPages.setText(this.txtLoading);
|
||||
this.lblStatWords.setText(this.txtLoading);
|
||||
this.lblStatParagraphs.setText(this.txtLoading);
|
||||
this.lblStatSymbols.setText(this.txtLoading);
|
||||
this.lblStatSpaces.setText(this.txtLoading);
|
||||
},
|
||||
2000, this);
|
||||
},
|
||||
_onDocInfo: function (obj) {
|
||||
if (obj) {
|
||||
if (obj.get_PageCount() > -1) {
|
||||
this.infoObj.PageCount = obj.get_PageCount();
|
||||
}
|
||||
if (obj.get_WordsCount() > -1) {
|
||||
this.infoObj.WordsCount = obj.get_WordsCount();
|
||||
}
|
||||
if (obj.get_ParagraphCount() > -1) {
|
||||
this.infoObj.ParagraphCount = obj.get_ParagraphCount();
|
||||
}
|
||||
if (obj.get_SymbolsCount() > -1) {
|
||||
this.infoObj.SymbolsCount = obj.get_SymbolsCount();
|
||||
}
|
||||
if (obj.get_SymbolsWSCount() > -1) {
|
||||
this.infoObj.SymbolsWSCount = obj.get_SymbolsWSCount();
|
||||
}
|
||||
}
|
||||
},
|
||||
_onGetDocInfoEnd: function () {
|
||||
this.inProgress = false;
|
||||
this.lblStatPages.setText(this.infoObj.PageCount);
|
||||
this.lblStatWords.setText(this.infoObj.WordsCount);
|
||||
this.lblStatParagraphs.setText(this.infoObj.ParagraphCount);
|
||||
this.lblStatSymbols.setText(this.infoObj.SymbolsCount);
|
||||
this.lblStatSpaces.setText(this.infoObj.SymbolsWSCount);
|
||||
},
|
||||
_changeAccessRights: function (btn, event, opts) {
|
||||
var win = Ext.widget("commondocumentaccessdialog", {
|
||||
settingsurl: this.sharingSettingsUrl
|
||||
});
|
||||
var me = this;
|
||||
win.on("accessrights", function (obj, rights) {
|
||||
me.doc.info.sharingSettings = rights;
|
||||
me.cntRights.update(rights);
|
||||
});
|
||||
win.show();
|
||||
},
|
||||
onLostEditRights: function () {
|
||||
this._readonlyRights = true;
|
||||
if (!this.rendered) {
|
||||
return;
|
||||
}
|
||||
this._ShowHideInfoItem(this.cntRights, false);
|
||||
this._ShowHideInfoItem(this.tbsRights, false);
|
||||
this._ShowHideInfoItem(this.btnEditRights, false);
|
||||
},
|
||||
txtTitle: "Document Title",
|
||||
txtAuthor: "Author",
|
||||
txtPlacement: "Placement",
|
||||
txtDate: "Creation Date",
|
||||
txtRights: "Persons who have rights",
|
||||
txtStatistics: "Statistics",
|
||||
txtPages: "Pages",
|
||||
txtWords: "Words",
|
||||
txtParagraphs: "Paragraphs",
|
||||
txtSymbols: "Symbols",
|
||||
txtSpaces: "Symbols with spaces",
|
||||
txtLoading: "Loading...",
|
||||
txtBtnAccessRights: "Change access rights"
|
||||
});
|
||||
171
OfficeWeb/apps/documenteditor/main/app/view/DocumentLanguage.js
Normal file
171
OfficeWeb/apps/documenteditor/main/app/view/DocumentLanguage.js
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* (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.view.DocumentLanguage", {
|
||||
extend: "Ext.window.Window",
|
||||
alias: "widget.dedocumentlanguage",
|
||||
requires: ["Ext.window.Window", "Ext.form.field.ComboBox", "Common.plugin.ComboBoxScrollPane", "Common.component.util.LanguageName"],
|
||||
modal: true,
|
||||
closable: true,
|
||||
closeAction: "hide",
|
||||
resizable: false,
|
||||
preventHeader: true,
|
||||
plain: true,
|
||||
height: 114,
|
||||
width: 350,
|
||||
padding: "20px",
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
constructor: function (config) {
|
||||
this.callParent(arguments);
|
||||
this.initConfig(config);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
var _btnOk = Ext.create("Ext.Button", {
|
||||
id: "langdialog-button-ok",
|
||||
text: this.okButtonText,
|
||||
width: 80,
|
||||
cls: "asc-blue-button",
|
||||
listeners: {
|
||||
click: function () {
|
||||
this._modalresult = 1;
|
||||
this.fireEvent("onmodalresult", this._modalresult);
|
||||
this.close();
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
var _btnCancel = Ext.create("Ext.Button", {
|
||||
id: "langdialog-button-cancel",
|
||||
text: this.cancelButtonText,
|
||||
width: 80,
|
||||
cls: "asc-darkgray-button",
|
||||
listeners: {
|
||||
click: function () {
|
||||
this._modalresult = 0;
|
||||
this.fireEvent("onmodalresult", this._modalresult);
|
||||
this.close();
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
this.cmbLangs = Ext.create("Ext.form.field.ComboBox", {
|
||||
store: this.langs,
|
||||
mode: "local",
|
||||
triggerAction: "all",
|
||||
editable: false,
|
||||
enableKeyEvents: true,
|
||||
width: 310,
|
||||
listConfig: {
|
||||
maxHeight: 200
|
||||
},
|
||||
listeners: {
|
||||
select: Ext.bind(function (combo, records, eOpts) {
|
||||
this.langNum = records[0].index;
|
||||
},
|
||||
this),
|
||||
specialkey: function (field, e) {
|
||||
if (e.getKey() == e.ENTER) {
|
||||
_btnOk.fireEvent("click");
|
||||
} else {
|
||||
if (e.getKey() == e.ESC) {
|
||||
_btnCancel.fireEvent("click");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
plugins: [{
|
||||
ptype: "comboboxscrollpane",
|
||||
pluginId: "scrollpane",
|
||||
settings: {
|
||||
enableKeyboardNavigation: true
|
||||
}
|
||||
}]
|
||||
});
|
||||
this.addEvents("onmodalresult");
|
||||
this.items = [{
|
||||
xtype: "label",
|
||||
text: this.textLang,
|
||||
width: "100%",
|
||||
style: "text-align:left"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
this.cmbLangs, {
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
width: 310,
|
||||
layout: "hbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
items: [{
|
||||
xtype: "tbspacer",
|
||||
flex: 1
|
||||
},
|
||||
_btnOk, {
|
||||
xtype: "tbspacer",
|
||||
width: 5
|
||||
},
|
||||
_btnCancel]
|
||||
}];
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setSettings: function (currentLang) {
|
||||
this.langNum = undefined;
|
||||
if (currentLang) {
|
||||
var rec = this.cmbLangs.findRecord("field1", currentLang);
|
||||
if (rec) {
|
||||
this.cmbLangs.select(rec);
|
||||
} else {
|
||||
if (this.cmbLangs.picker && this.cmbLangs.picker.selModel) {
|
||||
this.cmbLangs.picker.selModel.deselectAll();
|
||||
this.cmbLangs.picker.selModel.lastSelected = null;
|
||||
}
|
||||
this.cmbLangs.setValue(Common.util.LanguageName.getLocalLanguageName(currentLang)[1]);
|
||||
}
|
||||
}
|
||||
},
|
||||
getSettings: function () {
|
||||
return (this.langNum !== undefined) ? this.langs[this.langNum][0] : undefined;
|
||||
},
|
||||
textLang: "Select document language",
|
||||
cancelButtonText: "Cancel",
|
||||
okButtonText: "Ok"
|
||||
});
|
||||
423
OfficeWeb/apps/documenteditor/main/app/view/DocumentSettings.js
Normal file
423
OfficeWeb/apps/documenteditor/main/app/view/DocumentSettings.js
Normal file
@@ -0,0 +1,423 @@
|
||||
/*
|
||||
* (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.view.DocumentSettings", {
|
||||
extend: "Ext.container.Container",
|
||||
alias: "widget.dedocumentsettings",
|
||||
cls: "de-documentsettings-body",
|
||||
requires: ["Ext.button.Button", "Ext.container.Container", "Ext.form.Label", "Ext.form.field.Checkbox"],
|
||||
listeners: {
|
||||
show: function (cmp, eOpts) {
|
||||
cmp.updateSettings();
|
||||
}
|
||||
},
|
||||
constructor: function (config) {
|
||||
this.initConfig(config);
|
||||
this.callParent(arguments);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
this._changedProps = {
|
||||
zoomIdx: 5,
|
||||
showchangesIdx: 1,
|
||||
unitIdx: 0,
|
||||
saveVal: 600
|
||||
};
|
||||
this._oldUnit = undefined;
|
||||
this.chInputMode = Ext.create("Ext.form.field.Checkbox", {
|
||||
id: "docsettings-input-mode",
|
||||
boxLabel: this.strInputMode,
|
||||
width: 500
|
||||
});
|
||||
this.chLiveComment = Ext.create("Ext.form.field.Checkbox", {
|
||||
id: "docsettings-live-comment",
|
||||
checked: true,
|
||||
boxLabel: this.strLiveComment,
|
||||
width: 500
|
||||
});
|
||||
this._arrZoom = [[50, "50%"], [60, "60%"], [70, "70%"], [80, "80%"], [90, "90%"], [100, "100%"], [110, "110%"], [120, "120%"], [150, "150%"], [175, "175%"], [200, "200%"]];
|
||||
this.cmbZoom = Ext.create("Ext.form.field.ComboBox", {
|
||||
id: "docsettings-combo-zoom",
|
||||
width: 150,
|
||||
editable: false,
|
||||
store: this._arrZoom,
|
||||
mode: "local",
|
||||
triggerAction: "all",
|
||||
value: this._arrZoom[5][1],
|
||||
listeners: {
|
||||
select: Ext.bind(function (combo, records, eOpts) {
|
||||
this._changedProps.zoomIdx = records[0].index;
|
||||
combo.blur();
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this._arrShowChanges = [this.txtAll, this.txtLast];
|
||||
this.cmbShowChanges = Ext.create("Ext.form.field.ComboBox", {
|
||||
id: "docsettings-show-changes",
|
||||
width: 150,
|
||||
editable: false,
|
||||
store: this._arrShowChanges,
|
||||
mode: "local",
|
||||
triggerAction: "all",
|
||||
value: this._arrShowChanges[1],
|
||||
listeners: {
|
||||
select: Ext.bind(function (combo, records, eOpts) {
|
||||
this._changedProps.showchangesIdx = records[0].index;
|
||||
combo.blur();
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this._arrFontRender = [this.txtWin, this.txtMac, this.txtNative];
|
||||
this.cmbFontRender = Ext.create("Ext.form.field.ComboBox", {
|
||||
id: "docsettings-font-render",
|
||||
width: 150,
|
||||
editable: false,
|
||||
store: this._arrFontRender,
|
||||
mode: "local",
|
||||
triggerAction: "all",
|
||||
value: this._arrFontRender[0],
|
||||
listeners: {
|
||||
select: Ext.bind(function (combo, records, eOpts) {
|
||||
this._changedProps.fontrenderIdx = records[0].index;
|
||||
combo.blur();
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this._arrUnit = [[Common.MetricSettings.c_MetricUnits.cm, this.txtCm], [Common.MetricSettings.c_MetricUnits.pt, this.txtPt]];
|
||||
this.cmbUnit = Ext.create("Ext.form.field.ComboBox", {
|
||||
id: "docsettings-combo-unit",
|
||||
width: 150,
|
||||
editable: false,
|
||||
store: this._arrUnit,
|
||||
mode: "local",
|
||||
triggerAction: "all",
|
||||
value: this._arrUnit[0][1],
|
||||
listeners: {
|
||||
select: Ext.bind(function (combo, records, eOpts) {
|
||||
this._changedProps.unitIdx = records[0].index;
|
||||
combo.blur();
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this._arrAutoSave = [[0, this.textDisabled], [60, this.textMinute], [300, this.text5Minutes], [600, this.text10Minutes], [1800, this.text30Minutes], [3600, this.text60Minutes]];
|
||||
this.cmbAutoSave = Ext.create("Ext.form.field.ComboBox", {
|
||||
id: "docsettings-combo-save",
|
||||
width: 150,
|
||||
editable: false,
|
||||
store: this._arrAutoSave,
|
||||
mode: "local",
|
||||
triggerAction: "all",
|
||||
value: this._arrAutoSave[3][1],
|
||||
listeners: {
|
||||
select: Ext.bind(function (combo, records, eOpts) {
|
||||
this._changedProps.saveVal = records[0].data.field1;
|
||||
combo.blur();
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.btnOk = Ext.widget("button", {
|
||||
cls: "asc-blue-button",
|
||||
width: 90,
|
||||
height: 22,
|
||||
text: this.okButtonText,
|
||||
listeners: {
|
||||
click: function (btn) {
|
||||
this.applySettings();
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
this.items = [{
|
||||
xtype: "container",
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 2,
|
||||
tableAttrs: {
|
||||
style: "width: 100%;"
|
||||
},
|
||||
tdAttrs: {
|
||||
style: "padding: 5px 10px;"
|
||||
}
|
||||
},
|
||||
items: [{
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.txtInput,
|
||||
style: "display: block;text-align: right; margin-bottom: 1px;",
|
||||
width: "100%",
|
||||
hideId: "element-edit-mode"
|
||||
},
|
||||
this.chInputMode, {
|
||||
xtype: "tbspacer",
|
||||
hideId: "element-edit-mode"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer"
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.txtLiveComment,
|
||||
style: "display: block;text-align: right; margin-bottom: 1px;",
|
||||
width: "100%",
|
||||
hideId: "element-coauthoring"
|
||||
},
|
||||
this.chLiveComment, {
|
||||
xtype: "tbspacer",
|
||||
hideId: "element-coauthoring"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer"
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.strZoom,
|
||||
style: "display: block;text-align: right; margin-bottom: 5px;",
|
||||
width: "100%"
|
||||
},
|
||||
this.cmbZoom, {
|
||||
xtype: "tbspacer"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer"
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.strShowChanges,
|
||||
style: "display: block;text-align: right; margin-bottom: 5px;",
|
||||
width: "100%",
|
||||
hideId: "element-coauthoring"
|
||||
},
|
||||
this.cmbShowChanges, {
|
||||
xtype: "tbspacer",
|
||||
hideId: "element-coauthoring"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer"
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.strFontRender,
|
||||
style: "display: block;text-align: right; margin-bottom: 5px;",
|
||||
width: "100%"
|
||||
},
|
||||
this.cmbFontRender, {
|
||||
xtype: "tbspacer",
|
||||
hideId: "element-edit-mode"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer"
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.textAutoSave,
|
||||
style: "display: block;text-align: right; margin-bottom: 5px;",
|
||||
width: "100%",
|
||||
hideId: "element-autosave"
|
||||
},
|
||||
this.cmbAutoSave, {
|
||||
xtype: "tbspacer",
|
||||
hideId: "element-autosave"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer"
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
cellCls: "doc-info-label-cell",
|
||||
text: this.strUnit,
|
||||
style: "display: block;text-align: right; margin-bottom: 5px;",
|
||||
width: "100%",
|
||||
hideId: "element-edit-mode"
|
||||
},
|
||||
this.cmbUnit, {
|
||||
xtype: "tbspacer",
|
||||
height: 10
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 10
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer"
|
||||
},
|
||||
this.btnOk]
|
||||
}];
|
||||
this.addEvents("savedocsettings");
|
||||
this.addEvents("changemeasureunit");
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
return this;
|
||||
},
|
||||
applySettings: function () {
|
||||
this.api.SetTextBoxInputMode(this.chInputMode.getValue());
|
||||
this.api.SetCollaborativeMarksShowType((this._changedProps.showchangesIdx == 0) ? c_oAscCollaborativeMarksShowType.All : c_oAscCollaborativeMarksShowType.LastChanges);
|
||||
switch (this._changedProps.fontrenderIdx) {
|
||||
case 0:
|
||||
this.api.SetFontRenderingMode(3);
|
||||
break;
|
||||
case 1:
|
||||
this.api.SetFontRenderingMode(1);
|
||||
break;
|
||||
case 2:
|
||||
this.api.SetFontRenderingMode(2);
|
||||
break;
|
||||
}
|
||||
if (this.mode.canAutosave > -1) {
|
||||
this.api.asc_setAutoSaveGap(this._changedProps.saveVal);
|
||||
}
|
||||
window.localStorage.setItem("de-settings-inputmode", this.chInputMode.getValue() ? 1 : 0);
|
||||
window.localStorage.setItem("de-settings-zoom", this._arrZoom[this._changedProps.zoomIdx][0]);
|
||||
window.localStorage.setItem("de-settings-livecomment", this.chLiveComment.getValue() ? 1 : 0);
|
||||
window.localStorage.setItem("de-settings-showchanges", this._changedProps.showchangesIdx);
|
||||
window.localStorage.setItem("de-settings-fontrender", this._changedProps.fontrenderIdx);
|
||||
window.localStorage.setItem("de-settings-unit", this._arrUnit[this._changedProps.unitIdx][0]);
|
||||
window.localStorage.setItem("de-settings-autosave", this._changedProps.saveVal);
|
||||
Common.component.Analytics.trackEvent("File Menu", "SaveSettings");
|
||||
this.fireEvent("savedocsettings", this);
|
||||
if (this._oldUnit !== this._arrUnit[this._changedProps.unitIdx][0]) {
|
||||
this.fireEvent("changemeasureunit", this);
|
||||
}
|
||||
},
|
||||
updateSettings: function () {
|
||||
var value = window.localStorage.getItem("de-settings-inputmode");
|
||||
this.chInputMode.setValue(value !== null && parseInt(value) == 1);
|
||||
value = window.localStorage.getItem("de-settings-livecomment");
|
||||
this.chLiveComment.setValue(!(value !== null && parseInt(value) == 0));
|
||||
value = window.localStorage.getItem("de-settings-zoom");
|
||||
this._changedProps.zoomIdx = 5;
|
||||
if (value !== null) {
|
||||
for (var i = 0; i < this._arrZoom.length; i++) {
|
||||
if (this._arrZoom[i][0] == parseInt(value)) {
|
||||
this._changedProps.zoomIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.cmbZoom.setValue(this._arrZoom[this._changedProps.zoomIdx][1]);
|
||||
value = window.localStorage.getItem("de-settings-showchanges");
|
||||
this._changedProps.showchangesIdx = (value !== null && parseInt(value) == 0) ? 0 : 1;
|
||||
this.cmbShowChanges.setValue(this._arrShowChanges[this._changedProps.showchangesIdx]);
|
||||
value = window.localStorage.getItem("de-settings-fontrender");
|
||||
this._changedProps.fontrenderIdx = (value !== null) ? parseInt(value) : (window.devicePixelRatio > 1 ? 1 : 0);
|
||||
this.cmbFontRender.setValue(this._arrFontRender[this._changedProps.fontrenderIdx]);
|
||||
value = window.localStorage.getItem("de-settings-unit");
|
||||
this._changedProps.unitIdx = 0;
|
||||
if (value !== null) {
|
||||
for (var i = 0; i < this._arrUnit.length; i++) {
|
||||
if (this._arrUnit[i][0] == parseInt(value)) {
|
||||
this._changedProps.unitIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.cmbUnit.setValue(this._arrUnit[this._changedProps.unitIdx][1]);
|
||||
this._oldUnit = this._arrUnit[this._changedProps.unitIdx][0];
|
||||
value = window.localStorage.getItem("de-settings-autosave");
|
||||
value = (value !== null) ? parseInt(value) : 600;
|
||||
this._changedProps.saveVal = 600;
|
||||
var idx = 3;
|
||||
for (var i = 0; i < this._arrAutoSave.length; i++) {
|
||||
if (this._arrAutoSave[i][0] == value) {
|
||||
this._changedProps.saveVal = value;
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.cmbAutoSave.setValue(this._arrAutoSave[idx][1]);
|
||||
this._ShowHideDocSettings("element-edit-mode", this.mode.isEdit);
|
||||
this._ShowHideDocSettings("element-coauthoring", this.mode.canCoAuthoring && this.mode.isEdit);
|
||||
this._ShowHideDocSettings("element-autosave", this.mode.isEdit && (this.mode.canAutosave > -1));
|
||||
},
|
||||
_ShowHideSettingsItem: function (cmp, visible) {
|
||||
var tr = cmp.getEl().up("tr");
|
||||
if (tr) {
|
||||
tr.setDisplayed(visible);
|
||||
}
|
||||
},
|
||||
_ShowHideDocSettings: function (id, visible) {
|
||||
var components = Ext.ComponentQuery.query('[hideId="' + id + '"]', this);
|
||||
for (var i = 0; i < components.length; i++) {
|
||||
this._ShowHideSettingsItem(components[i], visible);
|
||||
}
|
||||
},
|
||||
setMode: function (mode) {
|
||||
this.mode = mode;
|
||||
if (this.mode.canAutosave > -1) {
|
||||
var idx = 0;
|
||||
for (idx = 1; idx < this._arrAutoSave.length; idx++) {
|
||||
if (this.mode.canAutosave < this._arrAutoSave[idx][0]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
var arr = [];
|
||||
arr = this._arrAutoSave.slice(idx, this._arrAutoSave.length);
|
||||
arr.unshift(this._arrAutoSave[0]);
|
||||
if (arr.length > 0) {
|
||||
this.cmbAutoSave.getStore().loadData(arr);
|
||||
}
|
||||
},
|
||||
strLiveComment: "Turn on option",
|
||||
strInputMode: "Turn on hieroglyphs",
|
||||
strZoom: "Default Zoom Value",
|
||||
strShowChanges: "Realtime Collaboration Changes",
|
||||
txtAll: "View All",
|
||||
txtLast: "View Last",
|
||||
okButtonText: "Apply",
|
||||
txtInput: "Alternate Input",
|
||||
txtLiveComment: "Live Commenting",
|
||||
txtWin: "as Windows",
|
||||
txtMac: "as OS X",
|
||||
txtNative: "Native",
|
||||
strFontRender: "Font Hinting",
|
||||
strUnit: "Unit of Measurement",
|
||||
txtCm: "Centimeter",
|
||||
txtPt: "Point",
|
||||
textDisabled: "Disabled",
|
||||
textMinute: "Every Minute",
|
||||
text5Minutes: "Every 5 Minutes",
|
||||
text10Minutes: "Every 10 Minutes",
|
||||
text30Minutes: "Every 30 Minutes",
|
||||
text60Minutes: "Every Hour",
|
||||
textAutoSave: "Autosave"
|
||||
});
|
||||
@@ -0,0 +1,574 @@
|
||||
/*
|
||||
* (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.view.DocumentStatusInfo", {
|
||||
extend: "Ext.container.Container",
|
||||
alias: "widget.documentstatusinfo",
|
||||
requires: ["Ext.form.field.Number", "Ext.button.Button", "Ext.form.Label", "Ext.toolbar.Spacer", "Ext.util.Cookies", "Ext.Img", "Common.component.LoadMask", "Common.component.util.LanguageName"],
|
||||
uses: ["Ext.tip.ToolTip", "Ext.menu.Menu", "Common.view.Participants"],
|
||||
layout: {
|
||||
type: "hbox",
|
||||
align: "middle"
|
||||
},
|
||||
config: {
|
||||
caption: ""
|
||||
},
|
||||
cls: "de-documentstatusinfo",
|
||||
height: 27,
|
||||
disabled: true,
|
||||
initComponent: function () {
|
||||
var me = this,
|
||||
cfg = Ext.apply({},
|
||||
me.initialConfig);
|
||||
me._currLang = {
|
||||
cls: ""
|
||||
};
|
||||
this.addEvents("editcomplete");
|
||||
var txtPages = Ext.widget("label", {
|
||||
id: "status-label-pages",
|
||||
text: Ext.String.format(me.pageIndexText, 0, 0),
|
||||
cls: "statusinfo-pages",
|
||||
style: "cursor:pointer;margin:0 40px;",
|
||||
listeners: {
|
||||
afterrender: function (ct) {
|
||||
ct.getEl().on("mousedown", onShowPageMenu, me);
|
||||
}
|
||||
}
|
||||
});
|
||||
var txtCaption = Ext.widget("label", {
|
||||
id: "status-label-caption",
|
||||
text: this.getCaption(),
|
||||
cls: "statusinfo-caption",
|
||||
height: 14
|
||||
});
|
||||
var txtZoom = Ext.widget("label", {
|
||||
id: "status-label-zoom",
|
||||
text: Ext.String.format(me.zoomText, 0),
|
||||
cls: "statusinfo-pages",
|
||||
style: "cursor: pointer; white-space:nowrap; text-align: center; margin: 0 5px;",
|
||||
listeners: {
|
||||
afterrender: Ext.bind(function (ct) {
|
||||
ct.getEl().on("mousedown", onShowZoomMenu, this);
|
||||
ct.getEl().set({
|
||||
"data-qtip": me.tipZoomFactor,
|
||||
"data-qalign": "bl-tl?"
|
||||
});
|
||||
ct.setWidth(Ext.util.TextMetrics.measure(ct.getEl(), Ext.String.format(me.zoomText, 999)).width);
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
var btnFitToPage = Ext.widget("button", {
|
||||
id: "status-button-fit-page",
|
||||
cls: "asc-statusbar-icon-btn",
|
||||
iconCls: "asc-statusbar-btn btn-fittopage",
|
||||
enableToggle: true,
|
||||
listeners: {
|
||||
toggle: function (btn, pressed) {
|
||||
if (me.api) {
|
||||
if (pressed) {
|
||||
me.api.zoomFitToPage();
|
||||
} else {
|
||||
me.api.zoomCustomMode();
|
||||
}
|
||||
}
|
||||
btnFitToWidth.toggle(false, true);
|
||||
},
|
||||
render: function (obj) {
|
||||
obj.getEl().set({
|
||||
"data-qtip": me.tipFitPage,
|
||||
"data-qalign": "bl-tl?"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
var btnFitToWidth = Ext.widget("button", {
|
||||
id: "status-button-fit-width",
|
||||
cls: "asc-statusbar-icon-btn",
|
||||
iconCls: "asc-statusbar-btn btn-fittowidth",
|
||||
enableToggle: true,
|
||||
style: "margin: 0 20px 0 5px;",
|
||||
listeners: {
|
||||
toggle: function (btn, pressed) {
|
||||
if (me.api) {
|
||||
if (pressed) {
|
||||
me.api.zoomFitToWidth();
|
||||
} else {
|
||||
me.api.zoomCustomMode();
|
||||
}
|
||||
}
|
||||
btnFitToPage.toggle(false, true);
|
||||
},
|
||||
render: function (obj) {
|
||||
obj.getEl().set({
|
||||
"data-qtip": me.tipFitWidth,
|
||||
"data-qalign": "bl-tl?"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
var btnZoomIn = Ext.widget("button", {
|
||||
id: "status-button-zoom-in",
|
||||
cls: "asc-btn-zoom asc-statusbar-icon-btn",
|
||||
iconCls: "asc-statusbar-btn btn-zoomin",
|
||||
style: "margin-right:40px",
|
||||
listeners: {
|
||||
click: function () {
|
||||
if (me.api) {
|
||||
me.api.zoomIn();
|
||||
}
|
||||
me.fireEvent("editcomplete", me);
|
||||
},
|
||||
render: function (obj) {
|
||||
obj.getEl().set({
|
||||
"data-qtip": me.tipZoomIn + " (Ctrl++)",
|
||||
"data-qalign": "bl-tl?"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
var btnZoomOut = Ext.widget("button", {
|
||||
id: "status-button-zoom-out",
|
||||
cls: "asc-btn-zoom asc-statusbar-icon-btn",
|
||||
iconCls: "asc-statusbar-btn btn-zoomout",
|
||||
listeners: {
|
||||
click: function () {
|
||||
if (me.api) {
|
||||
me.api.zoomOut();
|
||||
}
|
||||
me.fireEvent("editcomplete", me);
|
||||
},
|
||||
render: function (obj) {
|
||||
obj.getEl().set({
|
||||
"data-qtip": me.tipZoomOut + " (Ctrl+-)",
|
||||
"data-qalign": "bl-tl?"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
this.fieldPageNumber = Ext.widget("numberfield", {
|
||||
id: "status-field-page",
|
||||
width: 40,
|
||||
minValue: 1,
|
||||
maxValue: 10000,
|
||||
value: 1,
|
||||
allowDecimals: false,
|
||||
hideTrigger: true,
|
||||
keyNavEnabled: false,
|
||||
mouseWheelEnabled: false,
|
||||
enableKeyEvents: true,
|
||||
selectOnFocus: true,
|
||||
listeners: {
|
||||
specialkey: function (field, event, eOpts) {
|
||||
if (event.getKey() == event.ENTER) {
|
||||
if (me.api) {
|
||||
var page = me.fieldPageNumber.getValue();
|
||||
if (Ext.isNumber(page)) {
|
||||
if (page > me.fieldPageNumber.maxValue) {
|
||||
page = me.fieldPageNumber.maxValue;
|
||||
}
|
||||
if (page < me.fieldPageNumber.minValue) {
|
||||
page = me.fieldPageNumber.minValue;
|
||||
}
|
||||
me.fieldPageNumber.setValue(page);
|
||||
me.fieldPageNumber.selectText();
|
||||
me.api.goToPage(page - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.userPanel = Ext.widget("statusinfoparticipants", {
|
||||
userIconCls: "de-icon-statusinfo-users"
|
||||
});
|
||||
this.btnChangeLang = Ext.widget("button", {
|
||||
id: "status-button-lang",
|
||||
cls: "asc-statusbar-text-btn en",
|
||||
iconCls: "asc-lang-flag",
|
||||
text: "English (United States)",
|
||||
menuAlign: "bl-tl?",
|
||||
hideId : "element-edit-mode",
|
||||
menu: {
|
||||
items: [],
|
||||
showSeparator: false,
|
||||
maxHeight: 300,
|
||||
listeners: {
|
||||
beforeshow: function () {
|
||||
if (me._currMenuLangId !== me._currLang.id) {
|
||||
me.changeLanguageMenu(this);
|
||||
me._currMenuLangId = me._currLang.id;
|
||||
}
|
||||
},
|
||||
afterrender: function () {
|
||||
this.showBy(this.el, me.btnChangeLang.menuAlign);
|
||||
}
|
||||
},
|
||||
onShow: function () {
|
||||
var self = this;
|
||||
self.el.show();
|
||||
self.callParent(arguments);
|
||||
if (self.floating && self.constrain) {
|
||||
var y = self.el.getY();
|
||||
self.doConstrain();
|
||||
var h = self.getHeight();
|
||||
var maxHeight = Ext.Element.getViewportHeight();
|
||||
if (y + h > maxHeight) {
|
||||
y = maxHeight - h;
|
||||
}
|
||||
self.el.setY(y);
|
||||
if (self.currentCheckedItem !== undefined) {
|
||||
self.currentCheckedItem.getEl().scrollIntoView(self.layout.getRenderTarget());
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
listeners: {
|
||||
render: function (obj) {
|
||||
obj.getEl().set({
|
||||
"data-qtip": me.tipSetLang,
|
||||
"data-qalign": "bl-tl?"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
var _OpenDocLangDlg = function () {
|
||||
if (me.langDlg === undefined) {
|
||||
me.langDlg = Ext.create("DE.view.DocumentLanguage", {
|
||||
langs: me._docLangArr
|
||||
});
|
||||
me.langDlg.addListener("onmodalresult", Ext.bind(_OnOpenDocLangDlg, [me, me.langDlg]), false);
|
||||
me.langDlg.addListener("close", Ext.bind(function (cnt, eOpts) {
|
||||
me.fireEvent("editcomplete", me);
|
||||
},
|
||||
this));
|
||||
}
|
||||
me.langDlg.setSettings(me.api.asc_getDefaultLanguage());
|
||||
me.langDlg.show();
|
||||
};
|
||||
var _OnOpenDocLangDlg = function (mr) {
|
||||
if (mr == 1 && me.api) {
|
||||
var lang = this[1].getSettings();
|
||||
if (lang !== undefined) {
|
||||
me.api.asc_setDefaultLanguage(lang);
|
||||
}
|
||||
}
|
||||
};
|
||||
var btnDocLang = Ext.widget("button", {
|
||||
id: "status-button-doc-lang",
|
||||
cls: "asc-statusbar-icon-btn",
|
||||
iconCls: "asc-statusbar-btn btn-doc-lang",
|
||||
style: "margin: 0 0 0 5px;",
|
||||
hideId: "element-edit-mode",
|
||||
listeners: {
|
||||
click: _OpenDocLangDlg,
|
||||
render: function (obj) {
|
||||
obj.getEl().set({
|
||||
"data-qtip": me.tipSetDocLang,
|
||||
"data-qalign": "bl-tl?"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
var onShowPageMenu = function () {
|
||||
this.menuGoToPage.show();
|
||||
this.menuGoToPage.showBy(txtPages, "bl-tl", [0, -10]);
|
||||
};
|
||||
var onShowZoomMenu = function () {
|
||||
me.menuZoomTo.show();
|
||||
me.menuZoomTo.showBy(txtZoom, "b-t", [0, -10]);
|
||||
};
|
||||
var onZoomChange = function (percent, type) {
|
||||
btnFitToPage.toggle(type == 2, true);
|
||||
btnFitToWidth.toggle(type == 1, true);
|
||||
txtZoom.setText(Ext.String.format(me.zoomText, percent));
|
||||
txtZoom.zf = percent;
|
||||
me.doLayout();
|
||||
};
|
||||
var onCountPages = function (count) {
|
||||
txtPages.setText(Ext.String.format(me.pageIndexText, me.api.getCurrentPage() + 1, count));
|
||||
me.fieldPageNumber.setMinValue((count > 0) ? 1 : 0);
|
||||
me.fieldPageNumber.setMaxValue(count);
|
||||
};
|
||||
var onCurrentPage = function (number) {
|
||||
txtPages.setText(Ext.String.format(me.pageIndexText, number + 1, me.api.getCountPages()));
|
||||
me.fieldPageNumber.setValue(number + 1);
|
||||
};
|
||||
var onTextLanguage = function (langid) {
|
||||
if (me._currLang.id !== langid && langid !== null && langid !== undefined) {
|
||||
var langnames = Common.util.LanguageName.getLocalLanguageName(langid);
|
||||
me.btnChangeLang.getEl().removeCls(me._currLang.cls);
|
||||
me._currLang.cls = langnames[0];
|
||||
if (me._currLang.cls.indexOf("-") > -1) {
|
||||
me._currLang.cls += " " + me._currLang.cls.split("-")[0];
|
||||
}
|
||||
me.btnChangeLang.getEl().addCls(me._currLang.cls);
|
||||
me.btnChangeLang.setText(langnames[1]);
|
||||
}
|
||||
me._currLang.id = langid;
|
||||
};
|
||||
this.setApi = function (o) {
|
||||
this.api = o;
|
||||
if (this.api) {
|
||||
this.api.asc_registerCallback("asc_onZoomChange", Ext.bind(onZoomChange, this));
|
||||
this.api.asc_registerCallback("asc_onCountPages", Ext.bind(onCountPages, this));
|
||||
this.api.asc_registerCallback("asc_onCurrentPage", Ext.bind(onCurrentPage, this));
|
||||
this.api.asc_registerCallback("asc_onTextLanguage", Ext.bind(onTextLanguage, this));
|
||||
this.userPanel.setApi(this.api);
|
||||
}
|
||||
return this;
|
||||
};
|
||||
this.items = [txtPages, me.userPanel, Ext.widget("label", {
|
||||
text: "Powered by ONLYOFFICE",
|
||||
cls: "statusinfo-pages",
|
||||
style: "cursor:pointer;",
|
||||
listeners: {
|
||||
afterrender: function (cmp) {
|
||||
cmp.el.addListener("click", function () {
|
||||
var newDocumentPage = window.open("http://www.onlyoffice.com");
|
||||
newDocumentPage && newDocumentPage.focus();
|
||||
});
|
||||
}
|
||||
}
|
||||
}), {
|
||||
xtype: "container",
|
||||
flex: 1,
|
||||
layout: {
|
||||
type: "hbox",
|
||||
pack: "center"
|
||||
},
|
||||
style: "min-height: 1.1em;",
|
||||
items: [txtCaption]
|
||||
},
|
||||
{
|
||||
xtype: "tbseparator",
|
||||
width: 2,
|
||||
height: 27,
|
||||
style: "padding-top:2px;margin-right:6px;",
|
||||
hideId: "element-edit-mode",
|
||||
html: '<div style="width: 100%; height: 100%; border-left: 1px solid rgba(0, 0, 0, 0.1); border-right: 1px solid rgba(255, 255, 255, 0.5);"></div>'
|
||||
},
|
||||
me.btnChangeLang, btnDocLang, {
|
||||
xtype: "tbseparator",
|
||||
width: 2,
|
||||
height: 27,
|
||||
style: "padding-top:2px;margin-left:6px;margin-right:20px;",
|
||||
hideId: "element-edit-mode",
|
||||
html: '<div style="width: 100%; height: 100%; border-left: 1px solid rgba(0, 0, 0, 0.1); border-right: 1px solid rgba(255, 255, 255, 0.5);"></div>'
|
||||
},
|
||||
btnFitToPage, btnFitToWidth, btnZoomOut, txtZoom, btnZoomIn];
|
||||
me.callParent(arguments);
|
||||
},
|
||||
applyCaption: function (value) {
|
||||
var c = Ext.get("status-label-caption");
|
||||
if (c) {
|
||||
Ext.DomHelper.overwrite(c, value);
|
||||
}
|
||||
this.doLayout();
|
||||
return value;
|
||||
},
|
||||
changeLanguageMenu: function (menu) {
|
||||
if (this._currLang.id === null || this._currLang.id === undefined) {
|
||||
for (var i = 0; i < menu.items.length; i++) {
|
||||
menu.items.items[i].setChecked(false);
|
||||
}
|
||||
menu.currentCheckedItem = undefined;
|
||||
} else {
|
||||
for (var i = 0; i < menu.items.length; i++) {
|
||||
if (menu.items.items[i].langid === this._currLang.id) {
|
||||
menu.currentCheckedItem = menu.items.items[i];
|
||||
if (!menu.items.items[i].checked) {
|
||||
menu.items.items[i].setChecked(true);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
if (menu.items.items[i].checked) {
|
||||
menu.items.items[i].setChecked(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
setLanguages: function (langs) {
|
||||
var me = this,
|
||||
arr = [];
|
||||
me._docLangArr = [];
|
||||
if (langs && langs.length > 0) {
|
||||
Ext.each(langs, function (lang, index) {
|
||||
var langnames = Common.util.LanguageName.getLocalLanguageName(lang.asc_getId());
|
||||
me._docLangArr.push([lang.asc_getId(), langnames[1]]);
|
||||
var mnu = Ext.widget("menucheckitem", {
|
||||
text: langnames[1],
|
||||
langid: lang.asc_getId(),
|
||||
langname: langnames[0],
|
||||
checked: false,
|
||||
group: "popupstatuslang",
|
||||
listeners: {
|
||||
click: function (item, e, eOpt) {
|
||||
if (me.api) {
|
||||
if (item.langid !== undefined) {
|
||||
me.api.put_TextPrLang(item.langid);
|
||||
me._currLang.id = item.langid;
|
||||
me._currMenuLangId = item.langid;
|
||||
me.btnChangeLang.menu.currentCheckedItem = item;
|
||||
me.btnChangeLang.setText(item.text);
|
||||
me.btnChangeLang.getEl().removeCls(me._currLang.cls);
|
||||
me._currLang.cls = item.langname;
|
||||
if (me._currLang.cls.indexOf("-") > -1) {
|
||||
me._currLang.cls += " " + me._currLang.cls.split("-")[0];
|
||||
}
|
||||
me.btnChangeLang.getEl().addCls(me._currLang.cls);
|
||||
}
|
||||
me.fireEvent("editcomplete", me);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
arr.push(mnu);
|
||||
});
|
||||
me.btnChangeLang.menu.insert(0, arr);
|
||||
if (me._currLang && (me._currLang.id !== undefined)) {
|
||||
var langname = Common.util.LanguageName.getLocalLanguageName(me._currLang.id);
|
||||
me.btnChangeLang.setText(langname[1]);
|
||||
me.btnChangeLang.getEl().removeCls(me._currLang.cls);
|
||||
me._currLang.cls = langname[0];
|
||||
if (me._currLang.cls.indexOf("-") > -1) {
|
||||
me._currLang.cls += " " + me._currLang.cls.split("-")[0];
|
||||
}
|
||||
me.btnChangeLang.getEl().addCls(me._currLang.cls);
|
||||
}
|
||||
}
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
var me = this;
|
||||
var txtGoToPage = Ext.widget("label", {
|
||||
id: "status-label-page",
|
||||
text: me.goToPageText
|
||||
});
|
||||
var defaultPadding = 20;
|
||||
var defaultContainerOffset = 7;
|
||||
this.menuGoToPage = Ext.widget("menu", {
|
||||
id: "status-menu-page",
|
||||
autoHeight: true,
|
||||
autoWidth: true,
|
||||
plain: true,
|
||||
items: [{
|
||||
xtype: "container",
|
||||
cls: "de-documentstatusinfo-menu-inner",
|
||||
layout: {
|
||||
type: "hbox",
|
||||
align: "middle",
|
||||
padding: defaultPadding / 2 + "px " + defaultPadding + "px"
|
||||
},
|
||||
items: [txtGoToPage, {
|
||||
xtype: "tbspacer",
|
||||
width: defaultContainerOffset
|
||||
},
|
||||
this.fieldPageNumber],
|
||||
listeners: {
|
||||
afterrender: function (ct) {
|
||||
var textWidth = txtGoToPage.getWidth();
|
||||
ct.getEl().setWidth(defaultContainerOffset + 2 * defaultPadding + textWidth + me.fieldPageNumber.getWidth());
|
||||
}
|
||||
}
|
||||
}],
|
||||
listeners: {
|
||||
show: function (ct) {
|
||||
me.fieldPageNumber.setValue(me.api.getCurrentPage() + 1);
|
||||
me.fieldPageNumber.focus(true, 300);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.menuZoomTo = Ext.widget("menu", {
|
||||
plain: true,
|
||||
bodyCls: "status-zoom-menu",
|
||||
minWidth: 100,
|
||||
listeners: {
|
||||
hide: function () {
|
||||
me.fireEvent("editcomplete", me);
|
||||
},
|
||||
click: function (menu, item) {
|
||||
me.api.zoom(item.zf);
|
||||
}
|
||||
},
|
||||
items: [{
|
||||
text: "50%",
|
||||
zf: 50
|
||||
},
|
||||
{
|
||||
text: "75%",
|
||||
zf: 75
|
||||
},
|
||||
{
|
||||
text: "100%",
|
||||
zf: 100
|
||||
},
|
||||
{
|
||||
text: "125%",
|
||||
zf: 125
|
||||
},
|
||||
{
|
||||
text: "150%",
|
||||
zf: 150
|
||||
},
|
||||
{
|
||||
text: "175%",
|
||||
zf: 175
|
||||
},
|
||||
{
|
||||
text: "200%",
|
||||
zf: 200
|
||||
}]
|
||||
});
|
||||
},
|
||||
_ShowHideStatusInfo: function (id, visible) {
|
||||
var components = Ext.ComponentQuery.query('[hideId="' + id + '"]', this);
|
||||
for (var i = 0; i < components.length; i++) {
|
||||
components[i].setVisible(visible);
|
||||
}
|
||||
},
|
||||
setMode: function (m) {
|
||||
this.userPanel.setMode(m);
|
||||
this._ShowHideStatusInfo("element-edit-mode", m.isEdit);
|
||||
},
|
||||
zoomText: "Zoom {0}%",
|
||||
goToPageText: "Go to Page",
|
||||
pageIndexText: "Page {0} of {1}",
|
||||
tipFitPage: "Fit Page",
|
||||
tipFitWidth: "Fit Width",
|
||||
tipZoomIn: "Zoom In",
|
||||
tipZoomOut: "Zoom Out",
|
||||
tipZoomFactor: "Magnification",
|
||||
tipHideLines: "Hide lines",
|
||||
tipShowLines: "Show lines",
|
||||
tipSetLang: "Set Text Language",
|
||||
tipSetDocLang: "Set Document Language"
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
428
OfficeWeb/apps/documenteditor/main/app/view/File.js
Normal file
428
OfficeWeb/apps/documenteditor/main/app/view/File.js
Normal file
@@ -0,0 +1,428 @@
|
||||
/*
|
||||
* (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.view.File", {
|
||||
extend: "Ext.panel.Panel",
|
||||
alias: "widget.defile",
|
||||
cls: "de-file-body",
|
||||
layout: "card",
|
||||
toolbarWidth: 260,
|
||||
activeBtn: undefined,
|
||||
requires: ["Ext.toolbar.Toolbar", "Ext.button.Button", "Ext.container.Container"],
|
||||
uses: ["DE.view.DocumentInfo", "DE.view.DocumentHelp", "DE.view.DocumentSettings", "Common.view.About"],
|
||||
listeners: {
|
||||
afterrender: function (Component, eOpts) {
|
||||
var cnt = this.ownerCt;
|
||||
if (Ext.isDefined(cnt)) {
|
||||
cnt.addListener("show", Ext.Function.bind(this._onShow, this));
|
||||
cnt.addListener("hide", Ext.Function.bind(this._onHide, this));
|
||||
}
|
||||
}
|
||||
},
|
||||
initComponent: function () {
|
||||
this.addEvents("editdocument");
|
||||
this.callParent(arguments);
|
||||
},
|
||||
loadConfig: function (data) {
|
||||
this.editorConfig = data.config;
|
||||
},
|
||||
loadDocument: function (data) {
|
||||
this.document = data.doc;
|
||||
},
|
||||
_onShow: function () {
|
||||
if (this.activeBtn === undefined) {
|
||||
var btn = this[this.btnDomnloadAs.isVisible() ? "btnDomnloadAs" : "btnDocumentInfo"];
|
||||
this.activeBtn = btn.toggle(true);
|
||||
} else {
|
||||
this.redrawButton(this.activeBtn);
|
||||
}
|
||||
if (this.activeBtn == this.btnDocumentInfo) {
|
||||
this.getLayout().setActiveItem(this.cardDocumentInfo);
|
||||
this.cardDocumentInfo.updateStatisticInfo();
|
||||
} else {
|
||||
if (this.activeBtn == this.btnDocumentSettings) {
|
||||
this.getLayout().setActiveItem(this.cardDocumentSettings);
|
||||
this.cardDocumentSettings.updateSettings();
|
||||
}
|
||||
}
|
||||
},
|
||||
_onHide: function () {
|
||||
if (this.activeBtn == this.btnDocumentInfo) {
|
||||
this.cardDocumentInfo.stopUpdatingStatisticInfo();
|
||||
}
|
||||
},
|
||||
buildItems: function () {
|
||||
var docInfo = [{
|
||||
name: "PDF",
|
||||
imgCls: "doc-format btn-pdf",
|
||||
type: c_oAscFileType.PDF
|
||||
},
|
||||
{
|
||||
name: "DOCX",
|
||||
imgCls: "doc-format btn-docx",
|
||||
type: c_oAscFileType.DOCX
|
||||
}];
|
||||
this.cardDownloadAs = Ext.widget("container", {
|
||||
cls: "de-file-table",
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 3
|
||||
}
|
||||
});
|
||||
var me = this;
|
||||
Ext.each(docInfo, function (item) {
|
||||
this.cardDownloadAs.add({
|
||||
xtype: "container",
|
||||
items: [{
|
||||
xtype: "button",
|
||||
id: "file-format-" + item.name,
|
||||
cls: item.imgCls + " download-button-style",
|
||||
docType: item.type,
|
||||
width: 102,
|
||||
height: 129,
|
||||
margin: "65px 25px 0 25px",
|
||||
listeners: {
|
||||
click: Ext.bind(function (btn) {
|
||||
var api = me.ownerCt.getApi();
|
||||
if (api) {
|
||||
api.asc_DownloadAs(btn.docType);
|
||||
me.closeMenu();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("Download As", item.name);
|
||||
},
|
||||
this)
|
||||
}
|
||||
}]
|
||||
});
|
||||
},
|
||||
this);
|
||||
this.cardDocumentInfo = Ext.widget("dedocumentinfo");
|
||||
this.cardCreateNew = Ext.widget("decreatenew");
|
||||
this.cardRecentFiles = Ext.widget("derecentfiles");
|
||||
this.cardHelp = Ext.widget("dedocumenthelp");
|
||||
this.cardDocumentSettings = Ext.widget("dedocumentsettings");
|
||||
this.cardDocumentSettings.addListener("savedocsettings", Ext.bind(this.closeMenu, this));
|
||||
return [this.cardDownloadAs, this.cardDocumentInfo, this.cardCreateNew, this.cardRecentFiles, this.cardHelp, this.cardDocumentSettings];
|
||||
},
|
||||
buildDockedItems: function () {
|
||||
this.btnSave = Ext.create("Ext.button.Button", {
|
||||
id: "file-button-save",
|
||||
text: this.btnSaveCaption,
|
||||
textAlign: "left",
|
||||
enableToggle: true,
|
||||
cls: "asc-filemenu-btn",
|
||||
padding: "0 27px",
|
||||
height: 27,
|
||||
listeners: {
|
||||
click: Ext.bind(function (btnCall) {
|
||||
if (btnCall.pressed) {
|
||||
this.api = this.ownerCt.getApi();
|
||||
if (this.api) {
|
||||
this.redrawButton(btnCall);
|
||||
this.api.asc_Save();
|
||||
this.closeMenu();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("Save");
|
||||
Common.component.Analytics.trackEvent("File Menu", "Save");
|
||||
}
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.btnPrint = this.btnSave.cloneConfig({
|
||||
id: "file-button-print",
|
||||
text: this.btnPrintCaption,
|
||||
listeners: {
|
||||
click: Ext.bind(function (btnCall) {
|
||||
if (btnCall.pressed) {
|
||||
this.api = this.ownerCt.getApi();
|
||||
if (this.api) {
|
||||
this.api.asc_Print();
|
||||
this.closeMenu();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("Print");
|
||||
Common.component.Analytics.trackEvent("File Menu", "Print");
|
||||
}
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.btnToEdit = this.btnSave.cloneConfig({
|
||||
id: "file-button-edit",
|
||||
text: this.btnToEditCaption,
|
||||
listeners: {
|
||||
click: Ext.bind(function (btnCall) {
|
||||
this.redrawButton(btnCall);
|
||||
if (btnCall.pressed) {
|
||||
this.closeMenu();
|
||||
this.fireEvent("editdocument");
|
||||
Common.component.Analytics.trackEvent("Edit");
|
||||
Common.component.Analytics.trackEvent("File Menu", "Edit");
|
||||
}
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.btnDomnloadAs = Ext.create("Ext.button.Button", Ext.applyIf(this.getFileMenuButton(this.btnDownloadCaption, this.cardDownloadAs), {
|
||||
id: "file-button-download"
|
||||
}));
|
||||
this.btnDocumentInfo = Ext.create("Ext.button.Button", Ext.applyIf(this.getFileMenuButton(this.btnInfoCaption, this.cardDocumentInfo), {
|
||||
id: "file-button-info"
|
||||
}));
|
||||
this.btnDocumentSettings = Ext.create("Ext.button.Button", Ext.applyIf(this.getFileMenuButton(this.btnSettingsCaption, this.cardDocumentSettings), {
|
||||
id: "file-button-settings"
|
||||
}));
|
||||
this.btnBack = this.btnSave.cloneConfig({
|
||||
id: "file-button-back",
|
||||
text: this.btnBackCaption,
|
||||
listeners: {
|
||||
click: Ext.bind(function (btnCall) {
|
||||
this.redrawButton(btnCall);
|
||||
if (btnCall.pressed) {
|
||||
Common.Gateway.goBack();
|
||||
this.closeMenu();
|
||||
}
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.btnHelp = Ext.create("Ext.button.Button", this.getFileMenuButton(this.btnHelpCaption, this.cardHelp));
|
||||
this.btnReturn = Ext.create("Ext.button.Button", {
|
||||
id: "file-button-return",
|
||||
text: this.btnReturnCaption,
|
||||
textAlign: "left",
|
||||
enableToggle: true,
|
||||
cls: "asc-filemenu-btn",
|
||||
padding: "0 27px",
|
||||
height: 27,
|
||||
listeners: {
|
||||
click: Ext.bind(function (btnCall) {
|
||||
if (btnCall.pressed) {
|
||||
this.closeMenu();
|
||||
Common.component.Analytics.trackEvent("File Menu", "Return");
|
||||
}
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.btnCreateNew = Ext.create("Ext.button.Button", {
|
||||
id: "file-button-createnew",
|
||||
text: this.btnCreateNewCaption,
|
||||
textAlign: "left",
|
||||
enableToggle: true,
|
||||
cls: "asc-filemenu-btn",
|
||||
padding: "0 27px",
|
||||
height: 27
|
||||
});
|
||||
this.btnOpenRecent = Ext.create("Ext.button.Button", Ext.applyIf(this.getFileMenuButton(this.btnRecentFilesCaption, this.cardRecentFiles), {
|
||||
id: "file-button-recentfiles",
|
||||
label: "Recent"
|
||||
}));
|
||||
this.tbFileMenu = Ext.create("Ext.toolbar.Toolbar", {
|
||||
dock: "left",
|
||||
layout: {
|
||||
type: "vbox",
|
||||
align: "stretch"
|
||||
},
|
||||
cls: "de-file-toolbar",
|
||||
vertical: true,
|
||||
width: this.toolbarWidth,
|
||||
defaults: {
|
||||
height: 22,
|
||||
width: "100%"
|
||||
},
|
||||
items: [{
|
||||
xtype: "container",
|
||||
height: 15
|
||||
},
|
||||
this.btnReturn, this.getSeparator(), this.btnSave, this.btnToEdit, this.btnDomnloadAs, this.btnPrint, this.getSeparator(), this.btnOpenRecent, this.btnCreateNew, this.getSeparator(), this.btnDocumentInfo, this.getSeparator(), this.btnDocumentSettings, this.getSeparator(), this.btnHelp, this.getSeparator(), this.btnBack]
|
||||
});
|
||||
return this.tbFileMenu;
|
||||
},
|
||||
getSeparator: function () {
|
||||
return {
|
||||
xtype: "container",
|
||||
html: '<hr class="de-file-separator" />'
|
||||
};
|
||||
},
|
||||
getFileMenuButton: function (caption, card) {
|
||||
return {
|
||||
text: caption,
|
||||
textAlign: "left",
|
||||
enableToggle: true,
|
||||
cls: "asc-filemenu-btn",
|
||||
padding: "0 27px",
|
||||
height: 27,
|
||||
listeners: {
|
||||
click: Ext.Function.bind(function (btnCall) {
|
||||
if (btnCall.pressed) {
|
||||
if (this.activeBtn != btnCall) {
|
||||
this.getLayout().setActiveItem(card);
|
||||
this.activeBtn = btnCall;
|
||||
}
|
||||
Common.component.Analytics.trackEvent("File Menu", btnCall.label);
|
||||
}
|
||||
},
|
||||
this),
|
||||
toggle: Ext.Function.bind(function (btnCall) {
|
||||
this.redrawButton(btnCall);
|
||||
},
|
||||
this)
|
||||
}
|
||||
};
|
||||
},
|
||||
redrawButton: function (btnCall) {
|
||||
var tb = this.tbFileMenu;
|
||||
for (var i = 0; i < tb.items.length; i++) {
|
||||
var btn = tb.items.items[i];
|
||||
if (btn.componentCls === "x-btn") {
|
||||
if (btn.id != btnCall.id && btn.pressed) {
|
||||
btn.toggle(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
btnCall.toggle(true, true);
|
||||
},
|
||||
closeMenu: function () {
|
||||
this.ownerCt.closeMenu();
|
||||
},
|
||||
applyMode: function () {
|
||||
this.cardDocumentInfo.updateInfo(this.document);
|
||||
this.btnBack.setVisible(this.mode.canBack);
|
||||
this.tbFileMenu.items.items[16].setVisible(this.mode.canBack);
|
||||
this.btnOpenRecent.setVisible(this.mode.canOpenRecent);
|
||||
this.btnCreateNew.setVisible(this.mode.canCreateNew);
|
||||
this.tbFileMenu.items.items[10].setVisible(this.mode.canCreateNew);
|
||||
this.btnDomnloadAs.setVisible(this.mode.canDownload);
|
||||
this.hkSaveAs[this.mode.canDownload ? "enable" : "disable"]();
|
||||
this.btnSave.setVisible(this.mode.isEdit);
|
||||
this.btnToEdit.setVisible(this.mode.canEdit && this.mode.isEdit === false);
|
||||
this.cardDocumentSettings.setMode(this.mode);
|
||||
},
|
||||
setMode: function (mode, delay) {
|
||||
if (mode.isDisconnected) {
|
||||
this.mode.canEdit = this.mode.isEdit = false;
|
||||
this.mode.canOpenRecent = this.mode.canCreateNew = false;
|
||||
} else {
|
||||
this.mode = mode;
|
||||
}
|
||||
if (!delay) {
|
||||
this.applyMode();
|
||||
}
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
this.hkSaveAs = new Ext.util.KeyMap(document, {
|
||||
key: "s",
|
||||
ctrl: true,
|
||||
shift: true,
|
||||
defaultEventAction: "stopEvent",
|
||||
scope: this,
|
||||
fn: function () {
|
||||
if (this.ownerCt && this.ownerCt.isVisible()) {
|
||||
this.btnDomnloadAs.toggle(true);
|
||||
this.btnDomnloadAs.fireEvent("click", this.btnDomnloadAs);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.hkHelp = new Ext.util.KeyMap(document, {
|
||||
key: Ext.EventObject.F1,
|
||||
ctrl: false,
|
||||
shift: false,
|
||||
defaultEventAction: "stopEvent",
|
||||
scope: this,
|
||||
fn: function () {
|
||||
if (this.ownerCt && this.ownerCt.isVisible()) {
|
||||
this.btnHelp.toggle(true);
|
||||
this.btnHelp.fireEvent("click", this.btnHelp);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.add(this.buildItems.call(this));
|
||||
this.addDocked(this.buildDockedItems());
|
||||
this.setConfig();
|
||||
this.applyMode();
|
||||
},
|
||||
setConfig: function () {
|
||||
var me = this;
|
||||
if (this.editorConfig.templates && this.editorConfig.templates.length > 0) {
|
||||
this.btnCreateNew.setText(this.btnCreateNew.getText() + "...");
|
||||
this.btnCreateNew.enableToggle = true;
|
||||
this.btnCreateNew.on("click", function (btnCall) {
|
||||
if (btnCall.pressed) {
|
||||
if (me.activeBtn != btnCall) {
|
||||
me.getLayout().setActiveItem(me.cardCreateNew);
|
||||
me.activeBtn = btnCall;
|
||||
}
|
||||
Common.component.Analytics.trackEvent("File Menu", "Create");
|
||||
}
|
||||
});
|
||||
this.btnCreateNew.on("toggle", function (btnCall) {
|
||||
me.redrawButton(btnCall);
|
||||
});
|
||||
} else {
|
||||
this.btnCreateNew.on("click", function (btnCall) {
|
||||
if (Ext.isEmpty(me.editorConfig.createUrl)) {
|
||||
Ext.MessageBox.show({
|
||||
title: me.textError,
|
||||
msg: me.textCanNotCreateNewDoc,
|
||||
buttons: Ext.Msg.OK,
|
||||
icon: Ext.Msg.ERROR,
|
||||
width: 300
|
||||
});
|
||||
} else {
|
||||
if (btnCall.pressed) {
|
||||
var newDocumentPage = window.open(Ext.String.format("{0}?title={1}&action=create&doctype=text", me.editorConfig.createUrl, me.newDocumentTitle));
|
||||
if (newDocumentPage) {
|
||||
newDocumentPage.focus();
|
||||
}
|
||||
Common.component.Analytics.trackEvent("Create New", "Blank");
|
||||
}
|
||||
}
|
||||
me.closeMenu();
|
||||
});
|
||||
}
|
||||
this.cardHelp.setLangConfig(this.editorConfig.lang);
|
||||
},
|
||||
btnSaveCaption: "Save",
|
||||
btnDownloadCaption: "Download as...",
|
||||
btnInfoCaption: "Document Info...",
|
||||
btnCreateNewCaption: "Create New",
|
||||
btnRecentFilesCaption: "Open Recent...",
|
||||
btnPrintCaption: "Print",
|
||||
btnHelpCaption: "Help...",
|
||||
btnReturnCaption: "Back to Document",
|
||||
btnToEditCaption: "Edit Document",
|
||||
btnBackCaption: "Go to Documents",
|
||||
newDocumentTitle: "Unnamed document",
|
||||
textError: "Error",
|
||||
textCanNotCreateNewDoc: "Can not create a new document. Address to create a document is not configured.",
|
||||
btnSettingsCaption: "Advanced Settings..."
|
||||
});
|
||||
@@ -0,0 +1,312 @@
|
||||
/*
|
||||
* (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.view.HeaderFooterSettings", {
|
||||
extend: "Common.view.AbstractSettingsPanel",
|
||||
alias: "widget.deheaderfootersettings",
|
||||
height: 298,
|
||||
requires: ["Ext.button.Button", "Ext.form.Label", "Ext.form.field.Checkbox", "Ext.container.Container", "Ext.toolbar.Spacer", "Common.component.MetricSpinner"],
|
||||
constructor: function (config) {
|
||||
this.callParent(arguments);
|
||||
this.initConfig(config);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
this.title = this.txtTitle;
|
||||
this._initSettings = true;
|
||||
this._state = {
|
||||
PositionType: c_pageNumPosition.PAGE_NUM_POSITION_TOP,
|
||||
Position: 12.5,
|
||||
DiffFirst: false,
|
||||
DiffOdd: false
|
||||
};
|
||||
var _arrPosition = [[c_pageNumPosition.PAGE_NUM_POSITION_TOP, c_pageNumPosition.PAGE_NUM_POSITION_LEFT, "asc-right-panel-btn btn-colontitul-tl", "headerfooter-button-top-left", this.textTopLeft], [c_pageNumPosition.PAGE_NUM_POSITION_TOP, c_pageNumPosition.PAGE_NUM_POSITION_CENTER, "asc-right-panel-btn btn-colontitul-tc", "headerfooter-button-top-center", this.textTopCenter], [c_pageNumPosition.PAGE_NUM_POSITION_TOP, c_pageNumPosition.PAGE_NUM_POSITION_RIGHT, "asc-right-panel-btn btn-colontitul-tr", "headerfooter-button-top-right", this.textTopRight], [c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, c_pageNumPosition.PAGE_NUM_POSITION_LEFT, "asc-right-panel-btn btn-colontitul-bl", "headerfooter-button-bottom-left", this.textBottomLeft], [c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, c_pageNumPosition.PAGE_NUM_POSITION_CENTER, "asc-right-panel-btn btn-colontitul-bc", "headerfooter-button-bottom-center", this.textBottomCenter], [c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, c_pageNumPosition.PAGE_NUM_POSITION_RIGHT, "asc-right-panel-btn btn-colontitul-br", "headerfooter-button-bottom-right", this.textBottomRight]];
|
||||
this._btnsPosition = [];
|
||||
Ext.Array.forEach(_arrPosition, function (item) {
|
||||
var _btn = Ext.create("Ext.Button", {
|
||||
id: item[3],
|
||||
cls: item[2],
|
||||
posWhere: item[0],
|
||||
posAlign: item[1],
|
||||
margin: "2px 12px 2px 0",
|
||||
text: "",
|
||||
tooltip: item[4],
|
||||
listeners: {
|
||||
click: Ext.bind(function (btn) {
|
||||
if (this.api) {
|
||||
this.api.put_PageNum(btn.posWhere, btn.posAlign);
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this._btnsPosition.push(_btn);
|
||||
},
|
||||
this);
|
||||
this._numPosition = Ext.create("Common.component.MetricSpinner", {
|
||||
id: "headerfooter-spin-position",
|
||||
readOnly: false,
|
||||
step: 0.1,
|
||||
width: 85,
|
||||
defaultUnit: "cm",
|
||||
value: "1.25 cm",
|
||||
maxValue: 55.88,
|
||||
minValue: 0,
|
||||
listeners: {
|
||||
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
|
||||
if (this.api) {
|
||||
this.api.put_HeadersAndFootersDistance(Common.MetricSettings.fnRecalcToMM(field.getNumberValue()));
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.controls.push(this._numPosition);
|
||||
this._lblPosition = Ext.create("Ext.form.Label", {
|
||||
text: this.textHeaderFromTop,
|
||||
width: 150,
|
||||
height: 14,
|
||||
style: "text-align:left"
|
||||
});
|
||||
this._chDiffFirst = Ext.create("Ext.form.field.Checkbox", {
|
||||
id: "headerfooter-check-diff-first",
|
||||
boxLabel: this.textDiffFirst,
|
||||
listeners: {
|
||||
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
|
||||
if (this.api) {
|
||||
this.api.HeadersAndFooters_DifferentFirstPage(field.getValue());
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.controls.push(this._chDiffFirst);
|
||||
this._chDiffOdd = Ext.create("Ext.form.field.Checkbox", {
|
||||
id: "headerfooter-check-diff-odd",
|
||||
boxLabel: this.textDiffOdd,
|
||||
listeners: {
|
||||
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
|
||||
if (this.api) {
|
||||
this.api.HeadersAndFooters_DifferentOddandEvenPage(field.getValue());
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.controls.push(this._chDiffOdd);
|
||||
this._PageNumPanel = Ext.create("Ext.container.Container", {
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
height: 103,
|
||||
width: "100%",
|
||||
items: [{
|
||||
xtype: "tbspacer",
|
||||
height: 9
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 3
|
||||
},
|
||||
items: [this._btnsPosition[0], this._btnsPosition[1], this._btnsPosition[2], {
|
||||
xtype: "tbspacer",
|
||||
height: 11
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 11
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 11
|
||||
},
|
||||
this._btnsPosition[3], this._btnsPosition[4], this._btnsPosition[5]]
|
||||
}]
|
||||
});
|
||||
this._PositionPanel = Ext.create("Ext.container.Container", {
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
height: 50,
|
||||
width: 195,
|
||||
items: [{
|
||||
xtype: "tbspacer",
|
||||
height: 8
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 40,
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
style: "float:left;",
|
||||
items: [this._lblPosition, {
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
this._numPosition]
|
||||
}]
|
||||
});
|
||||
this._OptionsPanel = Ext.create("Ext.container.Container", {
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
height: 53,
|
||||
width: "100%",
|
||||
items: [{
|
||||
xtype: "tbspacer",
|
||||
height: 6
|
||||
},
|
||||
this._chDiffFirst, this._chDiffOdd]
|
||||
});
|
||||
this.items = [{
|
||||
xtype: "tbspacer",
|
||||
height: 9
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
style: "font-weight: bold;margin-top: 1px;",
|
||||
text: this.textPageNum
|
||||
},
|
||||
this._PageNumPanel, {
|
||||
xtype: "tbspacer",
|
||||
height: 5
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
width: "100%",
|
||||
height: 10,
|
||||
style: "padding-right: 10px;",
|
||||
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
style: "font-weight: bold;margin-top: 1px;",
|
||||
text: this.textPosition
|
||||
},
|
||||
this._PositionPanel, {
|
||||
xtype: "tbspacer",
|
||||
height: 5
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
width: "100%",
|
||||
height: 10,
|
||||
style: "padding-right: 10px;",
|
||||
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
style: "font-weight: bold;margin-top: 1px;",
|
||||
text: this.textOptions
|
||||
},
|
||||
this._OptionsPanel, {
|
||||
xtype: "tbspacer",
|
||||
height: 7
|
||||
}];
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setApi: function (api) {
|
||||
this.api = api;
|
||||
},
|
||||
updateMetricUnit: function () {
|
||||
var spinners = this.query("commonmetricspinner");
|
||||
if (spinners) {
|
||||
for (var i = 0; i < spinners.length; i++) {
|
||||
var spinner = spinners[i];
|
||||
spinner.setDefaultUnit(Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
|
||||
spinner.setStep(Common.MetricSettings.getCurrentMetric() == Common.MetricSettings.c_MetricUnits.cm ? 0.01 : 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
ChangeSettings: function (prop) {
|
||||
if (this._initSettings) {
|
||||
this.createDelayedElements();
|
||||
this._initSettings = false;
|
||||
}
|
||||
if (prop) {
|
||||
this.SuspendEvents();
|
||||
var value = prop.get_Type();
|
||||
if (this._state.PositionType !== value) {
|
||||
if (value == c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM) {
|
||||
this._lblPosition.setText(this.textHeaderFromBottom);
|
||||
} else {
|
||||
this._lblPosition.setText(this.textHeaderFromTop);
|
||||
}
|
||||
this._state.PositionType = value;
|
||||
}
|
||||
value = prop.get_Position();
|
||||
if (Math.abs(this._state.Position - value) > 0.001) {
|
||||
this._numPosition.setValue(Common.MetricSettings.fnRecalcFromMM(value));
|
||||
this._state.Position = value;
|
||||
}
|
||||
value = prop.get_DifferentFirst();
|
||||
if (this._state.DiffFirst !== value) {
|
||||
this._chDiffFirst.setValue(value);
|
||||
this._state.DiffFirst = value;
|
||||
}
|
||||
value = prop.get_DifferentEvenOdd();
|
||||
if (this._state.DiffOdd !== value) {
|
||||
this._chDiffOdd.setValue(value);
|
||||
this._state.DiffOdd = value;
|
||||
}
|
||||
this.ResumeEvents();
|
||||
}
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
this.updateMetricUnit();
|
||||
},
|
||||
textHeaderFromTop: "Header from Top",
|
||||
textHeaderFromBottom: "Header from Bottom",
|
||||
textPosition: "Position",
|
||||
textOptions: "Options",
|
||||
textDiffFirst: "Different First Page",
|
||||
textDiffOdd: "Different Odd and even Pages",
|
||||
textPageNum: "Insert Page Number",
|
||||
textTopLeft: "Top Left",
|
||||
textTopRight: "Top Right",
|
||||
textTopCenter: "Top Center",
|
||||
textBottomLeft: "Bottom Left",
|
||||
textBottomRight: "Bottom Right",
|
||||
textBottomCenter: "Bottom Center",
|
||||
textUndock: "Undock from panel",
|
||||
txtTitle: "Header and Footer"
|
||||
});
|
||||
396
OfficeWeb/apps/documenteditor/main/app/view/HeadersList.js
Normal file
396
OfficeWeb/apps/documenteditor/main/app/view/HeadersList.js
Normal file
@@ -0,0 +1,396 @@
|
||||
/*
|
||||
* (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.view.TreeHeaderModel", {
|
||||
extend: "Ext.data.Model",
|
||||
fields: [{
|
||||
name: "text",
|
||||
type: "string"
|
||||
},
|
||||
{
|
||||
name: "url",
|
||||
type: "string"
|
||||
},
|
||||
{
|
||||
name: "expanded",
|
||||
type: "boolean",
|
||||
defaultValue: false
|
||||
},
|
||||
{
|
||||
name: "leaf",
|
||||
type: "boolean",
|
||||
defaultValue: false
|
||||
}],
|
||||
hasMany: {
|
||||
model: "DE.view.TreeHeaderModel",
|
||||
name: "headers"
|
||||
}
|
||||
});
|
||||
Ext.define("DE.view.TreeHeaderModel2", {
|
||||
extend: "Ext.data.Model",
|
||||
fields: [{
|
||||
name: "headerText",
|
||||
type: "string"
|
||||
},
|
||||
{
|
||||
name: "headerLevel",
|
||||
type: "int",
|
||||
defaultValue: 0
|
||||
},
|
||||
{
|
||||
name: "headerId",
|
||||
type: "int",
|
||||
defaultValue: 0
|
||||
},
|
||||
{
|
||||
name: "treeLevel",
|
||||
type: "int",
|
||||
defaultValue: 0
|
||||
},
|
||||
{
|
||||
name: "expanded",
|
||||
type: "boolean",
|
||||
defaultValue: false
|
||||
},
|
||||
{
|
||||
name: "leaf",
|
||||
type: "boolean",
|
||||
defaultValue: false
|
||||
}],
|
||||
hasMany: {
|
||||
model: "DE.view.TreeHeaderModel2",
|
||||
name: "headers"
|
||||
}
|
||||
});
|
||||
Ext.define("DE.view.HeadersList", {
|
||||
extend: "Ext.panel.Panel",
|
||||
alias: "widget.deheaderslist",
|
||||
cls: "de-headerslist",
|
||||
bodyCls: "de-headerslist-body",
|
||||
requires: ["Ext.tree.Panel", "Ext.data.TreeStore"],
|
||||
layoutConfig: {
|
||||
type: "vbox",
|
||||
align: "stretch"
|
||||
},
|
||||
constructor: function (config) {
|
||||
this.initConfig(config);
|
||||
this.callParent(arguments);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
var data = {
|
||||
text: "MainHeader",
|
||||
headers: [{
|
||||
text: "Header 1",
|
||||
url: "some url",
|
||||
expanded: false,
|
||||
headers: [{
|
||||
text: "Header 2",
|
||||
leaf: true
|
||||
},
|
||||
{
|
||||
text: "Header 3",
|
||||
expanded: false,
|
||||
headers: [{
|
||||
text: "Header 4",
|
||||
leaf: true
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
text: "Header 5",
|
||||
url: "some url",
|
||||
leaf: true
|
||||
},
|
||||
{
|
||||
text: "Header 6",
|
||||
url: "some url",
|
||||
expanded: false,
|
||||
headers: [{
|
||||
text: "Header 7",
|
||||
leaf: true
|
||||
},
|
||||
{
|
||||
text: "Header 8",
|
||||
expanded: false,
|
||||
headers: [{
|
||||
text: "Very Very Very Very Long Header 3",
|
||||
leaf: true
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
};
|
||||
var data2 = {
|
||||
headerText: "MainHeader",
|
||||
headerLevel: 0,
|
||||
headers: [{
|
||||
headerText: "Header 1",
|
||||
headerLevel: 0,
|
||||
expanded: false,
|
||||
headers: [{
|
||||
headerText: "Header 2",
|
||||
headerLevel: 0,
|
||||
leaf: true
|
||||
},
|
||||
{
|
||||
headerText: "Header 3",
|
||||
headerLevel: 0,
|
||||
expanded: false,
|
||||
headers: [{
|
||||
headerText: "Header 4",
|
||||
headerLevel: 0,
|
||||
leaf: true
|
||||
}]
|
||||
}]
|
||||
},
|
||||
{
|
||||
headerText: "Header 5",
|
||||
headerLevel: 0,
|
||||
leaf: true
|
||||
},
|
||||
{
|
||||
headerText: "Header 6",
|
||||
headerLevel: 0,
|
||||
expanded: false,
|
||||
headers: [{
|
||||
headerText: "Header 7",
|
||||
headerLevel: 0,
|
||||
leaf: true
|
||||
},
|
||||
{
|
||||
headerText: "Header 8",
|
||||
headerLevel: 0,
|
||||
expanded: false,
|
||||
headers: [{
|
||||
headerText: "Very Very Very Very Long Header 3",
|
||||
headerLevel: 0,
|
||||
leaf: true
|
||||
}]
|
||||
}]
|
||||
}]
|
||||
};
|
||||
this._treestore = Ext.create("Ext.data.TreeStore", {
|
||||
model: "DE.view.TreeHeaderModel2",
|
||||
proxy: {
|
||||
type: "memory",
|
||||
reader: {
|
||||
type: "json",
|
||||
root: "headers"
|
||||
}
|
||||
}
|
||||
});
|
||||
this.headerListPanel = Ext.create("Ext.tree.Panel", {
|
||||
preventHeader: true,
|
||||
store: this._treestore,
|
||||
rootVisible: false,
|
||||
frame: false,
|
||||
layout: "fit",
|
||||
flex: 1,
|
||||
emptyText: "",
|
||||
cls: "x-headerslist-panel-context",
|
||||
lines: false,
|
||||
columns: [{
|
||||
xtype: "treecolumn",
|
||||
flex: 1,
|
||||
dataIndex: "headerText",
|
||||
renderer: function (value, metaData, record, rowIdx, colIdx, store, view) {
|
||||
var _value = value || record.data.headerText;
|
||||
var str = Ext.String.format('<span class="caption-inner">{0}</span><span class="caption-right-border"></span><span class="caption-right-border-padding"></span>', _value);
|
||||
return str;
|
||||
}
|
||||
}],
|
||||
hideHeaders: true,
|
||||
viewConfig: {
|
||||
autoScroll: true,
|
||||
store: this._treestore,
|
||||
singleSelect: true,
|
||||
hideHeaders: true,
|
||||
rootVisible: false,
|
||||
listeners: {
|
||||
itemupdate: function (record, index, node, eOpts) {
|
||||
if (record.data.headerLevel - record.data.treeLevel > 0) {
|
||||
var btn = node.querySelector("div.x-grid-cell-inner");
|
||||
if (btn) {
|
||||
for (var i = 0; i < (record.data.headerLevel - record.data.treeLevel); i++) {
|
||||
Ext.DomHelper.insertFirst(btn, {
|
||||
tag: "span",
|
||||
cls: "caption-add-left-padding"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
itemadd: function (records, index, nodes, eOpts) {
|
||||
for (var j = 0; j < records.length; j++) {
|
||||
if (records[j].data.headerLevel - records[j].data.treeLevel > 0) {
|
||||
var btn = nodes[j].querySelector("div.x-grid-cell-inner");
|
||||
if (btn) {
|
||||
for (var i = 0; i < (records[j].data.headerLevel - records[j].data.treeLevel); i++) {
|
||||
Ext.DomHelper.insertFirst(btn, {
|
||||
tag: "span",
|
||||
cls: "caption-add-left-padding"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
refresh: function (view, eOpts) {
|
||||
var nodes = view.getNodes();
|
||||
var records = view.getRecords(nodes);
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var record = view.getRecord(nodes[i]);
|
||||
if (record.data.headerLevel - record.data.treeLevel > 0) {
|
||||
var btn = nodes[i].querySelector("div.x-grid-cell-inner");
|
||||
if (btn) {
|
||||
for (var k = 0; k < (record.data.headerLevel - record.data.treeLevel); k++) {
|
||||
Ext.DomHelper.insertFirst(btn, {
|
||||
tag: "span",
|
||||
cls: "caption-add-left-padding"
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
}
|
||||
});
|
||||
this.items = [{
|
||||
xtype: "label",
|
||||
cls: "de-headerslist-header",
|
||||
text: this.textHeaderList,
|
||||
margin: "0 0 0 20px"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 12
|
||||
},
|
||||
this.headerListPanel];
|
||||
this.addListener("resize", this._onResize, this);
|
||||
this.addListener("afterrender", this._onAfterRender, this);
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setApi: function (api) {
|
||||
if (api == undefined) {
|
||||
return;
|
||||
}
|
||||
if (api) {
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback("asc_onChangeHeaderList", Ext.bind(this._refreshHeaderList, this));
|
||||
this.api.asc_registerCallback("asc_onReturnHeaders", Ext.bind(this._refreshHeaderList, this));
|
||||
this.api.CollectHeaders();
|
||||
}
|
||||
},
|
||||
_refreshHeaderList: function (headers) {
|
||||
if (headers) {
|
||||
this._apiHeaders2Tree(headers);
|
||||
this._treestore.setRootNode(this._treeHeaders);
|
||||
}
|
||||
},
|
||||
moveToDocPosition: function (url) {
|
||||
if (this.api) {
|
||||
this.api.moveToDocPosition(url);
|
||||
}
|
||||
},
|
||||
_onResize: function (panel, adjWidth, adjHeight, eOpts) {
|
||||
var _height = this.getHeight() - 45;
|
||||
if (this.headerListPanel.getHeight() != _height && _height > 0) {
|
||||
this.headerListPanel.setHeight(_height);
|
||||
}
|
||||
},
|
||||
_onAfterRender: function (panel, eOpts) {},
|
||||
_apiHeaders2Tree: function (headers) {
|
||||
this._fakeHeaders = headers;
|
||||
this._treeHeaders = {
|
||||
headerText: "MainHeader",
|
||||
headerLevel: 0,
|
||||
headerId: -1,
|
||||
headers: []
|
||||
};
|
||||
this.index = 0;
|
||||
var level = 0;
|
||||
var parentNode = this._createNodeFromApiHeaders(this._fakeHeaders[this.index], this.index, level);
|
||||
this._treeHeaders.headers.push(parentNode);
|
||||
this.index++;
|
||||
while (this.index < this._fakeHeaders.length) {
|
||||
var nextNode = this._fakeHeaders[this.index];
|
||||
if (nextNode.get_Level() > parentNode.headerLevel) {
|
||||
this._fillChildHeaders(parentNode);
|
||||
} else {
|
||||
if (parentNode.headers == undefined) {
|
||||
parentNode.leaf = true;
|
||||
}
|
||||
parentNode = this._createNodeFromApiHeaders(this._fakeHeaders[this.index], this.index, level);
|
||||
this._treeHeaders.headers.push(parentNode);
|
||||
this.index++;
|
||||
}
|
||||
}
|
||||
if (parentNode.headers == undefined) {
|
||||
parentNode.leaf = true;
|
||||
}
|
||||
},
|
||||
_createNodeFromApiHeaders: function (apiNode, index, level) {
|
||||
var treeNode = {
|
||||
headerText: apiNode.get_headerText(),
|
||||
headerLevel: apiNode.get_Level(),
|
||||
headerId: index,
|
||||
treeLevel: level
|
||||
};
|
||||
return treeNode;
|
||||
},
|
||||
_fillChildHeaders: function (parentNode) {
|
||||
if (parentNode.headers == undefined) {
|
||||
parentNode.expanded = true;
|
||||
parentNode.headers = [];
|
||||
}
|
||||
var newNode = this._createNodeFromApiHeaders(this._fakeHeaders[this.index], this.index, parentNode.treeLevel + 1);
|
||||
parentNode.headers.push(newNode);
|
||||
parentNode = newNode;
|
||||
this.index++;
|
||||
while (this.index < this._fakeHeaders.length) {
|
||||
var nextNode = this._fakeHeaders[this.index];
|
||||
if (nextNode.get_Level() > parentNode.headerLevel) {
|
||||
this._fillChildHeaders(parentNode);
|
||||
} else {
|
||||
if (parentNode.headers == undefined) {
|
||||
parentNode.leaf = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (parentNode.headers == undefined) {
|
||||
parentNode.leaf = true;
|
||||
}
|
||||
},
|
||||
textHeaderList: "Document Titles Navigation"
|
||||
});
|
||||
@@ -0,0 +1,259 @@
|
||||
/*
|
||||
* (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.view.HyperlinkSettingsDialog", {
|
||||
extend: "Ext.window.Window",
|
||||
alias: "widget.dehyperlinksettingsdialog",
|
||||
requires: ["Ext.window.Window"],
|
||||
modal: true,
|
||||
closable: true,
|
||||
resizable: false,
|
||||
preventHeader: true,
|
||||
plain: true,
|
||||
height: 216,
|
||||
width: 350,
|
||||
padding: "20px 20px 18px 20px",
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
listeners: {
|
||||
show: function () {
|
||||
this.txtUrl.focus(false, 500);
|
||||
}
|
||||
},
|
||||
constructor: function (config) {
|
||||
this.callParent(arguments);
|
||||
this.initConfig(config);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
this.isTextChanged = false;
|
||||
var _btnOk = Ext.create("Ext.Button", {
|
||||
id: "addhyperlink-button-ok",
|
||||
text: this.okButtonText,
|
||||
width: 80,
|
||||
cls: "asc-blue-button",
|
||||
listeners: {
|
||||
click: function () {
|
||||
if (!this.txtUrl.isValid() || !this.txtDisplay.isValid()) {
|
||||
return;
|
||||
}
|
||||
this._modalresult = 1;
|
||||
this.fireEvent("onmodalresult", this._modalresult);
|
||||
this.close();
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
var _btnCancel = Ext.create("Ext.Button", {
|
||||
id: "addhyperlink-button-cancel",
|
||||
text: this.cancelButtonText,
|
||||
width: 80,
|
||||
cls: "asc-darkgray-button",
|
||||
listeners: {
|
||||
click: function () {
|
||||
this._modalresult = 0;
|
||||
this.fireEvent("onmodalresult", this._modalresult);
|
||||
this.close();
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
this.txtUrl = Ext.create("Ext.form.Text", {
|
||||
id: "addhyperlink-text-url",
|
||||
width: 310,
|
||||
msgTarget: "side",
|
||||
validateOnChange: false,
|
||||
allowBlank: false,
|
||||
value: "http://",
|
||||
blankText: this.txtEmpty,
|
||||
regex: /(([\-\wа-яё]+\.)+[\wа-яё]{2,3}(\/[%\-\wа-яё]+(\.[\wа-яё]{2,})?)*(([\wа-яё\-\.\?\\\/+@&#;`~=%!]*)(\.[\wа-яё]{2,})?)*\/?)/i,
|
||||
regexText: this.txtNotUrl,
|
||||
listeners: {
|
||||
specialkey: function (field, e) {
|
||||
if (e.getKey() == e.ENTER) {
|
||||
_btnOk.fireEvent("click");
|
||||
} else {
|
||||
if (e.getKey() == e.ESC) {
|
||||
_btnCancel.fireEvent("click");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.txtDisplay = Ext.create("Ext.form.Text", {
|
||||
id: "addhyperlink-text-display",
|
||||
width: 310,
|
||||
msgTarget: "side",
|
||||
validateOnBlur: false,
|
||||
allowBlank: false,
|
||||
blankText: this.txtEmpty,
|
||||
value: "",
|
||||
listeners: {
|
||||
specialkey: function (field, e) {
|
||||
if (e.getKey() == e.ENTER) {
|
||||
_btnOk.fireEvent("click");
|
||||
} else {
|
||||
if (e.getKey() == e.ESC) {
|
||||
_btnCancel.fireEvent("click");
|
||||
}
|
||||
}
|
||||
},
|
||||
change: function (field, newValue, oldValue) {
|
||||
this.isTextChanged = true;
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
this.txtTooltip = Ext.create("Ext.form.Text", {
|
||||
id: "addhyperlink-text-tooltip",
|
||||
width: 310,
|
||||
msgTarget: "side",
|
||||
validateOnBlur: false,
|
||||
allowBlank: true,
|
||||
value: "",
|
||||
listeners: {
|
||||
specialkey: function (field, e) {
|
||||
if (e.getKey() == e.ENTER) {
|
||||
_btnOk.fireEvent("click");
|
||||
} else {
|
||||
if (e.getKey() == e.ESC) {
|
||||
_btnCancel.fireEvent("click");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.addEvents("onmodalresult");
|
||||
this.items = [{
|
||||
xtype: "label",
|
||||
text: this.textUrl,
|
||||
width: "100%",
|
||||
style: "text-align:left"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
this.txtUrl, {
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
text: this.textDisplay,
|
||||
width: "100%",
|
||||
style: "text-align:left"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
this.txtDisplay, {
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
text: this.textTooltip,
|
||||
width: "100%",
|
||||
style: "text-align:left"
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
this.txtTooltip, {
|
||||
xtype: "tbspacer",
|
||||
height: 8
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
width: 310,
|
||||
layout: "hbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
items: [{
|
||||
xtype: "tbspacer",
|
||||
flex: 1
|
||||
},
|
||||
_btnOk, {
|
||||
xtype: "tbspacer",
|
||||
width: 5
|
||||
},
|
||||
_btnCancel]
|
||||
}];
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setSettings: function (props) {
|
||||
if (props) {
|
||||
if (props.get_Value()) {
|
||||
this.txtUrl.setValue(props.get_Value());
|
||||
} else {
|
||||
this.txtUrl.setValue("");
|
||||
}
|
||||
if (props.get_Text() !== null) {
|
||||
this.txtDisplay.setValue(props.get_Text());
|
||||
this.txtDisplay.setDisabled(false);
|
||||
} else {
|
||||
this.txtDisplay.setValue(this.textDefault);
|
||||
this.txtDisplay.setDisabled(true);
|
||||
}
|
||||
this.isTextChanged = false;
|
||||
this.txtTooltip.setValue(props.get_ToolTip());
|
||||
}
|
||||
},
|
||||
getSettings: function () {
|
||||
var props = new CHyperlinkProperty();
|
||||
var url = this.txtUrl.getValue().trim();
|
||||
if (!/(((^https?)|(^ftp)):\/\/)/i.test(url)) {
|
||||
url = "http://" + url;
|
||||
}
|
||||
props.put_Value(url);
|
||||
if (!this.txtDisplay.isDisabled() && this.isTextChanged) {
|
||||
props.put_Text(this.txtDisplay.getValue());
|
||||
} else {
|
||||
props.put_Text(null);
|
||||
}
|
||||
props.put_ToolTip(this.txtTooltip.getValue());
|
||||
return props;
|
||||
},
|
||||
textUrl: "Link to",
|
||||
textDisplay: "Display",
|
||||
cancelButtonText: "Cancel",
|
||||
okButtonText: "Ok",
|
||||
txtEmpty: "This field is required",
|
||||
txtNotUrl: 'This field should be a URL in the format "http://www.example.com"',
|
||||
textTooltip: "ScreenTip text",
|
||||
textDefault: "Selected text"
|
||||
});
|
||||
526
OfficeWeb/apps/documenteditor/main/app/view/ImageSettings.js
Normal file
526
OfficeWeb/apps/documenteditor/main/app/view/ImageSettings.js
Normal file
@@ -0,0 +1,526 @@
|
||||
/*
|
||||
* (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.view.ImageSettings", {
|
||||
extend: "Common.view.AbstractSettingsPanel",
|
||||
alias: "widget.deimagesettings",
|
||||
height: 298,
|
||||
requires: ["Ext.ComponentQuery", "Ext.container.Container", "Ext.button.Button", "Ext.form.Checkbox", "Ext.form.Text", "Ext.form.Label", "Ext.toolbar.Spacer", "Common.view.ImageFromUrlDialog", "DE.view.ImageSettingsAdvanced", "Common.component.MenuDataViewPicker"],
|
||||
constructor: function (config) {
|
||||
this.callParent(arguments);
|
||||
this.initConfig(config);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
this.title = this.txtTitle;
|
||||
this._initSettings = true;
|
||||
this._state = {
|
||||
WrappingStyle: c_oAscWrapStyle2.Inline,
|
||||
CanBeFlow: true,
|
||||
Width: 0,
|
||||
Height: 0,
|
||||
FromGroup: false
|
||||
};
|
||||
this._nRatio = 1;
|
||||
this._noApply = false;
|
||||
this._originalProps = null;
|
||||
var dataTpl = Ext.create("Ext.XTemplate", '<tpl for=".">', '<div class="thumb-wrap" data-qtip="{tip}">', '<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" style="{imgstyle}" class="item-wraplist"/>', '<tpl if="title">', '<span class="title">{title}</span>', "</tpl>", "</div>", "</tpl>");
|
||||
var viewData = [{
|
||||
offsetx: 0,
|
||||
data: c_oAscWrapStyle2.Inline,
|
||||
iconcls: "wrap-subtype wrap-inline",
|
||||
tip: this.txtInline
|
||||
},
|
||||
{
|
||||
offsetx: 50,
|
||||
data: c_oAscWrapStyle2.Square,
|
||||
iconcls: "wrap-subtype wrap-square",
|
||||
tip: this.txtSquare
|
||||
},
|
||||
{
|
||||
offsetx: 100,
|
||||
data: c_oAscWrapStyle2.Tight,
|
||||
iconcls: "wrap-subtype wrap-tight",
|
||||
tip: this.txtTight
|
||||
},
|
||||
{
|
||||
offsetx: 150,
|
||||
data: c_oAscWrapStyle2.Through,
|
||||
iconcls: "wrap-subtype wrap-through",
|
||||
tip: this.txtThrough
|
||||
},
|
||||
{
|
||||
offsetx: 200,
|
||||
data: c_oAscWrapStyle2.TopAndBottom,
|
||||
iconcls: "wrap-subtype wrap-topAndBottom",
|
||||
tip: this.txtTopAndBottom
|
||||
},
|
||||
{
|
||||
offsetx: 250,
|
||||
data: c_oAscWrapStyle2.InFront,
|
||||
iconcls: "wrap-subtype wrap-inFront",
|
||||
tip: this.txtInFront
|
||||
},
|
||||
{
|
||||
offsetx: 300,
|
||||
data: c_oAscWrapStyle2.Behind,
|
||||
iconcls: "wrap-subtype wrap-behind",
|
||||
tip: this.txtBehind
|
||||
}];
|
||||
for (var i = 0; i < viewData.length; i++) {
|
||||
viewData[i].imgstyle = Ext.String.format("background-position: {0}px 0;", -viewData[i].offsetx);
|
||||
}
|
||||
this.btnWrapType = Ext.widget("button", {
|
||||
id: "image-button-wrap",
|
||||
width: 72,
|
||||
height: 58,
|
||||
cls: "btn-wrap-types",
|
||||
iconCls: "wrap-subtype wrap-inline",
|
||||
pressedCls: "disablepressed",
|
||||
menuAlign: "tl-bl?",
|
||||
menu : Ext.create("Common.component.MenuDataViewPicker", {
|
||||
width: 257,
|
||||
height: 133,
|
||||
cls: "wrap-view",
|
||||
dataTpl: dataTpl,
|
||||
viewData: viewData,
|
||||
contentWidth: 237,
|
||||
listeners: {
|
||||
select: Ext.bind(function (picker, record) {
|
||||
this.btnWrapType.setIconCls(record.data.iconcls);
|
||||
if (this.api && !this._noApply) {
|
||||
var props = new CImgProperty();
|
||||
props.put_WrappingStyle((record.data.data));
|
||||
if (this._state.WrappingStyle === c_oAscWrapStyle2.Inline && record.data.data !== c_oAscWrapStyle2.Inline) {
|
||||
props.put_PositionH(new CImagePositionH());
|
||||
props.get_PositionH().put_UseAlign(false);
|
||||
props.get_PositionH().put_RelativeFrom(c_oAscRelativeFromH.Column);
|
||||
var val = this._originalProps.get_Value_X(c_oAscRelativeFromH.Column);
|
||||
props.get_PositionH().put_Value(val);
|
||||
props.put_PositionV(new CImagePositionV());
|
||||
props.get_PositionV().put_UseAlign(false);
|
||||
props.get_PositionV().put_RelativeFrom(c_oAscRelativeFromV.Paragraph);
|
||||
val = this._originalProps.get_Value_Y(c_oAscRelativeFromV.Paragraph);
|
||||
props.get_PositionV().put_Value(val);
|
||||
}
|
||||
this.api.ImgApply(props);
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this),
|
||||
hide: Ext.bind(function () {
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
})
|
||||
});
|
||||
this.btnWrapType.menu.picker.selectByIndex(0);
|
||||
this._btnOriginalSize = Ext.create("Ext.Button", {
|
||||
id: "image-button-original-size",
|
||||
text: this.textOriginalSize,
|
||||
width: 100,
|
||||
listeners: {
|
||||
click: this.setOriginalSize,
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
this._btnInsertFromFile = Ext.create("Ext.Button", {
|
||||
id: "image-button-from-file",
|
||||
text: this.textFromFile,
|
||||
width: 85,
|
||||
listeners: {
|
||||
click: function (btn) {
|
||||
if (this.api) {
|
||||
this.api.ChangeImageFromFile();
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
this._btnInsertFromUrl = Ext.create("Ext.Button", {
|
||||
id: "image-button-from-url",
|
||||
text: this.textFromUrl,
|
||||
width: 85,
|
||||
listeners: {
|
||||
click: function (btn) {
|
||||
var w = Ext.create("Common.view.ImageFromUrlDialog");
|
||||
w.addListener("onmodalresult", Ext.bind(this._onOpenImageFromURL, [this, w]), false);
|
||||
w.addListener("close", Ext.bind(function (cnt, eOpts) {
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this));
|
||||
w.show();
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
this._SizePanel = Ext.create("Ext.container.Container", {
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
height: 61,
|
||||
width: 200,
|
||||
items: [{
|
||||
xtype: "tbspacer",
|
||||
height: 8
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 2,
|
||||
tdAttrs: {
|
||||
style: "padding-right: 8px;"
|
||||
}
|
||||
},
|
||||
defaults: {
|
||||
xtype: "container",
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
height: 16,
|
||||
style: "float:left;"
|
||||
},
|
||||
items: [{
|
||||
items: [this.labelWidth = Ext.create("Ext.form.Label", {
|
||||
text: this.textWidth,
|
||||
width: 85
|
||||
})]
|
||||
},
|
||||
{
|
||||
items: [this.labelHeight = Ext.create("Ext.form.Label", {
|
||||
text: this.textHeight,
|
||||
width: 85
|
||||
})]
|
||||
}]
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 8
|
||||
},
|
||||
this._btnOriginalSize, {
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
}]
|
||||
});
|
||||
this._WrapPanel = Ext.create("Ext.container.Container", {
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
height: 70,
|
||||
width: 200,
|
||||
items: [{
|
||||
xtype: "tbspacer",
|
||||
height: 6
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 63,
|
||||
width: 200,
|
||||
layout: "hbox",
|
||||
items: [this.btnWrapType]
|
||||
}]
|
||||
});
|
||||
this._UrlPanel = Ext.create("Ext.container.Container", {
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
height: 36,
|
||||
width: 200,
|
||||
items: [{
|
||||
xtype: "tbspacer",
|
||||
height: 8
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 2,
|
||||
tdAttrs: {
|
||||
style: "padding-right: 8px;"
|
||||
}
|
||||
},
|
||||
items: [this._btnInsertFromFile, this._btnInsertFromUrl]
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 2
|
||||
}]
|
||||
});
|
||||
this.items = [{
|
||||
xtype: "tbspacer",
|
||||
height: 9
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
style: "font-weight: bold;margin-top: 1px;",
|
||||
text: this.textSize
|
||||
},
|
||||
this._SizePanel, {
|
||||
xtype: "tbspacer",
|
||||
height: 5
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
width: "100%",
|
||||
height: 10,
|
||||
style: "padding-right: 10px;",
|
||||
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
style: "font-weight: bold;margin-top: 1px;",
|
||||
text: this.textWrap
|
||||
},
|
||||
this._WrapPanel, {
|
||||
xtype: "tbspacer",
|
||||
height: 5
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
width: "100%",
|
||||
height: 10,
|
||||
style: "padding-right: 10px;",
|
||||
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
style: "font-weight: bold;margin-top: 1px;",
|
||||
text: this.textInsert
|
||||
},
|
||||
this._UrlPanel, {
|
||||
xtype: "tbspacer",
|
||||
height: 8
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
width: "100%",
|
||||
height: 10,
|
||||
style: "padding-right: 10px;",
|
||||
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 20,
|
||||
width: "100%",
|
||||
items: [{
|
||||
xtype: "box",
|
||||
html: '<div style="width:100%;text-align:center;padding-right:15px;"><label id="image-advanced-link" class="asc-advanced-link">' + this.textAdvanced + "</label></div>",
|
||||
listeners: {
|
||||
afterrender: function (cmp) {
|
||||
document.getElementById("image-advanced-link").onclick = Ext.bind(this._openAdvancedSettings, this);
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
}]
|
||||
}];
|
||||
this.addEvents("editcomplete");
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setOriginalSize: function () {
|
||||
if (this.api) {
|
||||
var imgsize = this.api.get_OriginalSizeImage();
|
||||
var w = imgsize.get_ImageWidth();
|
||||
var h = imgsize.get_ImageHeight();
|
||||
this.labelWidth.setText(this.textWidth + ": " + Ext.util.Format.round(Common.MetricSettings.fnRecalcFromMM(w), 1) + " " + Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
|
||||
this.labelHeight.setText(this.textHeight + ": " + Ext.util.Format.round(Common.MetricSettings.fnRecalcFromMM(h), 1) + " " + Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
|
||||
var properties = new CImgProperty();
|
||||
properties.put_Width(w);
|
||||
properties.put_Height(h);
|
||||
this.api.ImgApply(properties);
|
||||
this.fireEvent("editcomplete", this);
|
||||
}
|
||||
},
|
||||
setApi: function (api) {
|
||||
if (api == undefined) {
|
||||
return;
|
||||
}
|
||||
if (this.api) {
|
||||
this.api.asc_unregisterCallback("asc_onImgWrapStyleChanged", Ext.bind(this._ImgWrapStyleChanged, this));
|
||||
}
|
||||
this.api = api;
|
||||
this.api.asc_registerCallback("asc_onImgWrapStyleChanged", Ext.bind(this._ImgWrapStyleChanged, this));
|
||||
},
|
||||
ChangeSettings: function (props) {
|
||||
if (this._initSettings) {
|
||||
this.createDelayedElements();
|
||||
this._initSettings = false;
|
||||
}
|
||||
if (props) {
|
||||
this._originalProps = new CImgProperty(props);
|
||||
var value = props.get_WrappingStyle();
|
||||
if (this._state.WrappingStyle !== value) {
|
||||
this._noApply = true;
|
||||
var idx = this.btnWrapType.menu.picker.store.find("data", value);
|
||||
this.btnWrapType.menu.picker.selectByIndex(idx, false);
|
||||
if (idx >= 0) {
|
||||
this.btnWrapType.setIconCls(this.btnWrapType.menu.viewData[idx].iconcls);
|
||||
} else {
|
||||
this.btnWrapType.setIconCls("");
|
||||
}
|
||||
this._noApply = false;
|
||||
this._state.WrappingStyle = value;
|
||||
}
|
||||
value = props.get_CanBeFlow();
|
||||
var fromgroup = props.get_FromGroup();
|
||||
if (this._state.CanBeFlow !== value || this._state.FromGroup !== fromgroup) {
|
||||
this.btnWrapType.setDisabled(!value || fromgroup);
|
||||
this._state.CanBeFlow = value;
|
||||
this._state.FromGroup = fromgroup;
|
||||
}
|
||||
this.SuspendEvents();
|
||||
value = props.get_Width();
|
||||
if (Math.abs(this._state.Width - value) > 0.001) {
|
||||
this.labelWidth.setText(this.textWidth + ": " + Ext.util.Format.round(Common.MetricSettings.fnRecalcFromMM(value), 1) + " " + Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
|
||||
this._state.Width = value;
|
||||
}
|
||||
value = props.get_Height();
|
||||
if (Math.abs(this._state.Height - value) > 0.001) {
|
||||
this.labelHeight.setText(this.textHeight + ": " + Ext.util.Format.round(Common.MetricSettings.fnRecalcFromMM(value), 1) + " " + Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
|
||||
this._state.Height = value;
|
||||
}
|
||||
this._btnOriginalSize.setDisabled(props.get_ImageUrl() === null || props.get_ImageUrl() === undefined);
|
||||
this.ResumeEvents();
|
||||
}
|
||||
},
|
||||
_ImgWrapStyleChanged: function (style) {
|
||||
if (this._state.WrappingStyle !== style) {
|
||||
this._noApply = true;
|
||||
var idx = this.btnWrapType.menu.picker.store.find("data", style);
|
||||
this.btnWrapType.menu.picker.selectByIndex(idx, false);
|
||||
if (idx >= 0) {
|
||||
this.btnWrapType.setIconCls(this.btnWrapType.menu.viewData[idx].iconcls);
|
||||
}
|
||||
this._state.WrappingStyle = style;
|
||||
this._noApply = false;
|
||||
}
|
||||
},
|
||||
_onOpenImageFromURL: function (mr) {
|
||||
var self = this[0];
|
||||
var url = this[1].txtUrl;
|
||||
if (mr == 1 && self.api) {
|
||||
var checkurl = url.value.replace(/ /g, "");
|
||||
if (checkurl != "") {
|
||||
var props = new CImgProperty();
|
||||
props.put_ImageUrl(url.value);
|
||||
self.api.ImgApply(props);
|
||||
}
|
||||
}
|
||||
},
|
||||
_openAdvancedSettings: function (e) {
|
||||
var me = this;
|
||||
var win;
|
||||
if (me.api) {
|
||||
var selectedElements = me.api.getSelectedElements();
|
||||
if (selectedElements && Ext.isArray(selectedElements)) {
|
||||
var elType, elValue;
|
||||
for (var i = selectedElements.length - 1; i >= 0; i--) {
|
||||
elType = selectedElements[i].get_ObjectType();
|
||||
elValue = selectedElements[i].get_ObjectValue();
|
||||
if (c_oAscTypeSelectElement.Image == elType) {
|
||||
win = Ext.create("DE.view.ImageSettingsAdvanced", {});
|
||||
win.updateMetricUnit();
|
||||
win.setSettings(elValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (win) {
|
||||
var imgsize;
|
||||
if (!this._btnOriginalSize.isDisabled()) {
|
||||
imgsize = this.api.get_OriginalSizeImage();
|
||||
if (imgsize) {
|
||||
win.setSizeOriginal({
|
||||
width: imgsize.get_ImageWidth(),
|
||||
height: imgsize.get_ImageHeight()
|
||||
});
|
||||
}
|
||||
}
|
||||
imgsize = this.api.GetSectionInfo();
|
||||
win.setSizeMax({
|
||||
width: imgsize.get_PageWidth() - (imgsize.get_MarginLeft() + imgsize.get_MarginRight()),
|
||||
height: imgsize.get_PageHeight() - (imgsize.get_MarginTop() + imgsize.get_MarginBottom())
|
||||
});
|
||||
win.addListener("onmodalresult", Ext.bind(function (o, mr, s) {
|
||||
if (mr == 1 && s) {
|
||||
me.api.ImgApply(s);
|
||||
}
|
||||
},
|
||||
this), false);
|
||||
win.addListener("close", function () {
|
||||
me.fireEvent("editcomplete", me);
|
||||
},
|
||||
false);
|
||||
win.show();
|
||||
}
|
||||
},
|
||||
updateMetricUnit: function () {
|
||||
var value = Common.MetricSettings.fnRecalcFromMM(this._state.Width);
|
||||
this.labelWidth.setText(this.textWidth + ": " + Ext.util.Format.round(value, 1) + " " + Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
|
||||
value = Common.MetricSettings.fnRecalcFromMM(this._state.Height);
|
||||
this.labelHeight.setText(this.textHeight + ": " + Ext.util.Format.round(value, 1) + " " + Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
this.updateMetricUnit();
|
||||
},
|
||||
textSize: "Size",
|
||||
textWrap: "Wraping Style",
|
||||
textKeepRatio: "Constant Proportions",
|
||||
textWidth: "Width",
|
||||
textHeight: "Height",
|
||||
textOriginalSize: "Default Size",
|
||||
textApply: "Apply",
|
||||
textUrl: "Image URL",
|
||||
textInsert: "Insert Image",
|
||||
textUndock: "Undock from panel",
|
||||
textFromUrl: "From URL",
|
||||
textFromFile: "From File",
|
||||
textAdvanced: "Show advanced settings",
|
||||
txtTitle: "Picture",
|
||||
txtInline: "Inline",
|
||||
txtSquare: "Square",
|
||||
txtTight: "Tight",
|
||||
txtThrough: "Through",
|
||||
txtTopAndBottom: "Top and bottom",
|
||||
txtBehind: "Behind",
|
||||
txtInFront: "In front"
|
||||
});
|
||||
1902
OfficeWeb/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js
Normal file
1902
OfficeWeb/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js
Normal file
File diff suppressed because it is too large
Load Diff
194
OfficeWeb/apps/documenteditor/main/app/view/InsertTableDialog.js
Normal file
194
OfficeWeb/apps/documenteditor/main/app/view/InsertTableDialog.js
Normal file
@@ -0,0 +1,194 @@
|
||||
/*
|
||||
* (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.view.InsertTableDialog", {
|
||||
extend: "Ext.window.Window",
|
||||
alias: "widget.deinserttabledialog",
|
||||
requires: ["Ext.window.Window"],
|
||||
modal: true,
|
||||
closable: false,
|
||||
resizable: false,
|
||||
preventHeader: true,
|
||||
plain: true,
|
||||
height: 172,
|
||||
width: 236,
|
||||
padding: "20px",
|
||||
layout: {
|
||||
type: "vbox",
|
||||
align: "stretch"
|
||||
},
|
||||
listeners: {
|
||||
show: function () {
|
||||
this.udColumns.focus(false, 500);
|
||||
}
|
||||
},
|
||||
initComponent: function () {
|
||||
var me = this;
|
||||
this.addEvents("onmodalresult");
|
||||
this.items = [{
|
||||
xtype: "label",
|
||||
text: this.labelTitle || this.txtTitle,
|
||||
style: "margin: 0 0 15px 0; font-size: 15px;"
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 32,
|
||||
layout: {
|
||||
type: "hbox",
|
||||
align: "stretch"
|
||||
},
|
||||
items: [{
|
||||
xtype: "label",
|
||||
padding: "4px 0 0 0",
|
||||
width: 130,
|
||||
text: this.txtColumns
|
||||
},
|
||||
this.udColumns = Ext.widget("numberfield", {
|
||||
minValue: 1,
|
||||
maxValue: 63,
|
||||
value: 2,
|
||||
step: 1,
|
||||
width: 64,
|
||||
allowDecimals: false,
|
||||
validateOnBlur: false,
|
||||
msgTarget: "side",
|
||||
minText: this.txtMinText,
|
||||
maxText: this.txtMaxText,
|
||||
listeners: {
|
||||
specialkey: Ext.bind(function (field, e) {
|
||||
if (e.getKey() == e.ENTER) {
|
||||
this.btnOk.fireEvent("click");
|
||||
} else {
|
||||
if (e.getKey() == e.ESC) {
|
||||
this.btnCancel.fireEvent("click");
|
||||
}
|
||||
}
|
||||
},
|
||||
this)
|
||||
}
|
||||
})]
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 42,
|
||||
layout: {
|
||||
type: "hbox",
|
||||
align: "stretch"
|
||||
},
|
||||
items: [{
|
||||
xtype: "label",
|
||||
padding: "4px 0 0 0",
|
||||
width: 130,
|
||||
text: this.txtRows
|
||||
},
|
||||
this.udRows = Ext.widget("numberfield", {
|
||||
minValue: 1,
|
||||
maxValue: 100,
|
||||
value: 2,
|
||||
step: 1,
|
||||
width: 64,
|
||||
allowDecimals: false,
|
||||
validateOnBlur: false,
|
||||
msgTarget: "side",
|
||||
minText: this.txtMinText,
|
||||
maxText: this.txtMaxText,
|
||||
listeners: {
|
||||
specialkey: Ext.bind(function (field, e) {
|
||||
if (e.getKey() == e.ENTER) {
|
||||
this.btnOk.fireEvent("click");
|
||||
} else {
|
||||
if (e.getKey() == e.ESC) {
|
||||
this.btnCancel.fireEvent("click");
|
||||
}
|
||||
}
|
||||
},
|
||||
this)
|
||||
}
|
||||
})]
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 30,
|
||||
layout: {
|
||||
type: "vbox",
|
||||
align: "center"
|
||||
},
|
||||
items: [{
|
||||
xtype: "container",
|
||||
width: 182,
|
||||
layout: {
|
||||
type: "hbox",
|
||||
align: "middle"
|
||||
},
|
||||
items: [this.btnOk = Ext.widget("button", {
|
||||
cls: "asc-blue-button",
|
||||
width: 86,
|
||||
height: 22,
|
||||
margin: "0 5px 0 0",
|
||||
text: this.okButtonText,
|
||||
listeners: {
|
||||
click: function (btn) {
|
||||
var valid_cols = this.udColumns.isValid();
|
||||
var valid_rows = this.udRows.isValid();
|
||||
if (!valid_cols || !valid_rows) {
|
||||
return;
|
||||
}
|
||||
this.fireEvent("onmodalresult", this, 1, [this.udColumns.value, this.udRows.value]);
|
||||
this.close();
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
}), this.btnCancel = Ext.widget("button", {
|
||||
cls: "asc-darkgray-button",
|
||||
width: 86,
|
||||
height: 22,
|
||||
text: this.cancelButtonText,
|
||||
listeners: {
|
||||
click: function (btn) {
|
||||
this.fireEvent("onmodalresult", this, 0);
|
||||
this.close();
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
})]
|
||||
}]
|
||||
}];
|
||||
this.callParent(arguments);
|
||||
},
|
||||
txtTitle: "Table size",
|
||||
txtColumns: "Number of Columns",
|
||||
txtRows: "Number of Rows",
|
||||
textInvalidRowsCols: "You need to specify valid rows and columns count.",
|
||||
cancelButtonText: "Cancel",
|
||||
okButtonText: "Ok",
|
||||
txtMinText: "The minimum value for this field is {0}",
|
||||
txtMaxText: "The maximum value for this field is {0}"
|
||||
});
|
||||
345
OfficeWeb/apps/documenteditor/main/app/view/MainMenu.js
Normal file
345
OfficeWeb/apps/documenteditor/main/app/view/MainMenu.js
Normal file
@@ -0,0 +1,345 @@
|
||||
/*
|
||||
* (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
|
||||
*
|
||||
*/
|
||||
var SCALE_MIN = 40;
|
||||
var SCALE_FULL = "100%";
|
||||
var SCALE_PART = 300;
|
||||
var MAINMENU_TOOLBAR_ID = "mainmenu-toolbar-id";
|
||||
var MAINMENU_PANEL_ID = "mainmenu-panel-id";
|
||||
var MAINMENU_FULL_PANEL_ID = "mainmenu-full-panel-id";
|
||||
Ext.define("DE.view.MainMenu", {
|
||||
extend: "Ext.panel.Panel",
|
||||
alias: "widget.demainmenu",
|
||||
requires: ["Ext.toolbar.Toolbar", "Ext.button.Button", "Ext.container.Container", "Ext.toolbar.Spacer"],
|
||||
cls: "lm-style",
|
||||
id: MAINMENU_PANEL_ID,
|
||||
bodyCls: "lm-body",
|
||||
width: SCALE_MIN,
|
||||
layout: "card",
|
||||
hidden: true,
|
||||
currentFullScaleMenuBtn: undefined,
|
||||
fullScaledItemCnt: undefined,
|
||||
buttonCollection: [],
|
||||
listeners: {
|
||||
afterrender: function () {
|
||||
var owner = this.ownerCt;
|
||||
if (Ext.isDefined(owner)) {
|
||||
owner.addListener("resize", Ext.bind(this.resizeMenu, this));
|
||||
}
|
||||
}
|
||||
},
|
||||
initComponent: function () {
|
||||
this.items = [];
|
||||
this.dockedItems = this.buildDockedItems();
|
||||
this.addEvents("panelshow", "panelhide");
|
||||
this.callParent(arguments);
|
||||
},
|
||||
buildDockedItems: function () {
|
||||
var addedButtons = [],
|
||||
item,
|
||||
config;
|
||||
var me = this;
|
||||
for (var i = 0; i < this.buttonCollection.length; i++) {
|
||||
item = this.buttonCollection[i];
|
||||
config = {
|
||||
xtype: "button",
|
||||
id: item.id,
|
||||
itemScale: item.scale,
|
||||
tooltip: item.tooltip,
|
||||
disabled: item.disabled === true,
|
||||
cls: "asc-main-menu-buttons",
|
||||
iconCls: "asc-main-menu-btn " + item.cls,
|
||||
style: "margin-bottom: 8px;"
|
||||
};
|
||||
if (item.scale == "modal") {
|
||||
config.enableToggle = true;
|
||||
config.listeners = item.listeners;
|
||||
config.getApi = function () {
|
||||
return me.api;
|
||||
};
|
||||
} else {
|
||||
config.isFullScale = item.scale == "full";
|
||||
config.bodyItems = item.items;
|
||||
config.toggleGroup = "tbMainMenu";
|
||||
config.listeners = {
|
||||
click: function (btnCall) {
|
||||
if (btnCall.pressed) {
|
||||
me.openButtonMenu(btnCall);
|
||||
}
|
||||
},
|
||||
toggle: function (btnCall, pressed) {
|
||||
btnCall[pressed ? "addCls" : "removeCls"]("asc-main-menu-btn-selected");
|
||||
if (!pressed) {
|
||||
me.fireEvent("panelbeforehide");
|
||||
if (btnCall.isFullScale) {
|
||||
if (Ext.isDefined(me.fullScaledItemCnt) && me.fullScaledItemCnt.isVisible()) {
|
||||
me.fullScaledItemCnt.hide();
|
||||
me.currentFullScaleMenuBtn = undefined;
|
||||
}
|
||||
var panel = me.fullScaledItemCnt;
|
||||
} else {
|
||||
window.localStorage.setItem("de-mainmenu-width", me.getWidth());
|
||||
panel = Ext.getCmp(btnCall.bodyCardId);
|
||||
me.setWidth(SCALE_MIN);
|
||||
}
|
||||
me.fireEvent("panelhide", panel, btnCall.isFullScale);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
addedButtons.push(config);
|
||||
}
|
||||
this.mainToolbar = Ext.create("Ext.toolbar.Toolbar", {
|
||||
cls: "lm-default-toolbar",
|
||||
width: this.width || SCALE_MIN,
|
||||
vertical: true,
|
||||
dock: "left",
|
||||
defaultType: "button",
|
||||
items: addedButtons,
|
||||
style: "padding-top:15px;",
|
||||
listeners: {
|
||||
afterrender: function (cmp) {
|
||||
cmp.getEl().on("keydown", me._onContainerKeyDown, me, {
|
||||
button: undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
return this.mainToolbar;
|
||||
},
|
||||
closeFullScaleMenu: function () {
|
||||
if (Ext.isDefined(this.currentFullScaleMenuBtn)) {
|
||||
this.currentFullScaleMenuBtn.toggle(false);
|
||||
}
|
||||
},
|
||||
openButtonMenu: function (btn) {
|
||||
this.fireEvent("panelbeforeshow", btn.isFullScale);
|
||||
if (Ext.isNumber(btn.itemScale)) {
|
||||
var saved_width = window.localStorage.getItem("de-mainmenu-width");
|
||||
saved_width = saved_width ? parseInt(saved_width) : btn.itemScale;
|
||||
this.setSize({
|
||||
width: saved_width
|
||||
});
|
||||
} else {
|
||||
this.setWidth(btn.isFullScale ? SCALE_MIN : SCALE_PART);
|
||||
}
|
||||
if (btn.isFullScale) {
|
||||
var ownerEl = this.ownerCt.el;
|
||||
var startPos = ownerEl.getXY();
|
||||
var panel = this.fullScaledItemCnt;
|
||||
this.currentFullScaleMenuBtn = btn;
|
||||
this.fullScaledItemCnt.setSize(ownerEl.getWidth() - SCALE_MIN, ownerEl.getHeight());
|
||||
this.fullScaledItemCnt.setPosition(startPos[0] + this.width, startPos[1]);
|
||||
this.fullScaledItemCnt.show();
|
||||
this.fullScaledItemCnt.getLayout().setActiveItem(Ext.getCmp(btn.bodyCardId));
|
||||
} else {
|
||||
panel = Ext.getCmp(btn.bodyCardId);
|
||||
this.getLayout().setActiveItem(btn.bodyCardId);
|
||||
}
|
||||
btn.removeCls("notify");
|
||||
this.doComponentLayout();
|
||||
this.fireEvent("panelshow", panel, btn.isFullScale);
|
||||
Common.component.Analytics.trackEvent("Main Menu", btn.tooltip);
|
||||
},
|
||||
resizeMenu: function (Component, adjWidth, adjHeight, eOpts) {
|
||||
if (Ext.isDefined(this.fullScaledItemCnt) && this.fullScaledItemCnt.isVisible()) {
|
||||
var ownerEl = this.ownerCt.el;
|
||||
var startPos = ownerEl.getXY();
|
||||
this.fullScaledItemCnt.setSize(adjWidth - SCALE_MIN, adjHeight);
|
||||
this.fullScaledItemCnt.setPosition(startPos[0] + this.width, startPos[1]);
|
||||
} else {
|
||||
for (var i = 0; i < this.items.length; i++) {
|
||||
if (adjHeight != this.items.items[i].getHeight()) {
|
||||
this.items.items[i].setHeight(adjHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.doComponentLayout();
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage", Ext.bind(this.onCoAuthoringChatReceiveMessage, this));
|
||||
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
|
||||
this.api.asc_registerCallback("asc_onGetLicense", Ext.bind(this.onGetLicense, this));
|
||||
this.api.asc_getLicense();
|
||||
return this;
|
||||
},
|
||||
selectMenu: function (clsname) {
|
||||
var btnCall, btn, i, panel;
|
||||
var tbMain = this.mainToolbar;
|
||||
for (i = tbMain.items.length; i > 0; i--) {
|
||||
btnCall = tbMain.items.items[i - 1];
|
||||
if (btnCall.iconCls && !(btnCall.iconCls.search(clsname) < 0)) {
|
||||
break;
|
||||
} else {
|
||||
btnCall = undefined;
|
||||
}
|
||||
}
|
||||
if (btnCall && !btnCall.pressed) {
|
||||
if (Ext.isDefined(tbMain)) {
|
||||
for (i = 0; i < tbMain.items.length; i++) {
|
||||
btn = tbMain.items.items[i];
|
||||
if (Ext.isDefined(btn) && btn.componentCls === "x-btn") {
|
||||
if (btn.id != btnCall.id && btn.pressed) {
|
||||
btn.toggle(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
btnCall.toggle(true);
|
||||
if (btnCall.itemScale != "modal") {
|
||||
this.openButtonMenu(btnCall);
|
||||
}
|
||||
}
|
||||
},
|
||||
clearSelection: function (exclude) {
|
||||
var btn, i;
|
||||
var tbMain = this.mainToolbar;
|
||||
if (Ext.isDefined(tbMain)) {
|
||||
for (i = 0; i < tbMain.items.length; i++) {
|
||||
btn = tbMain.items.items[i];
|
||||
if (Ext.isDefined(btn) && btn.componentCls === "x-btn") {
|
||||
if (btn.pressed) {
|
||||
if (exclude && btn.iconCls && !(btn.iconCls.search(exclude) < 0)) {
|
||||
continue;
|
||||
}
|
||||
btn.toggle(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
disableMenu: function (btns, disabled) {
|
||||
var btn, i;
|
||||
var tbMain = this.mainToolbar;
|
||||
if (Ext.isDefined(tbMain)) {
|
||||
var apply_all = false;
|
||||
typeof btns == "string" && (btns == "all" ? apply_all = true : btns = [btns]);
|
||||
for (i = 0; i < tbMain.items.length; i++) {
|
||||
btn = tbMain.items.items[i];
|
||||
if (Ext.isDefined(btn) && btn.componentCls === "x-btn") {
|
||||
if (apply_all || !(btns.indexOf(btn.id) < 0)) {
|
||||
btn.pressed && btn.toggle(false);
|
||||
btn.setDisabled(disabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onCoAuthoringChatReceiveMessage: function (messages) {
|
||||
var mainMenu = Ext.getCmp("view-main-menu");
|
||||
if (mainMenu) {
|
||||
var activeStep = mainMenu.getLayout().getActiveItem().down("container");
|
||||
if (activeStep) {
|
||||
var btnChat = Ext.getCmp("id-menu-chat");
|
||||
if (btnChat) {
|
||||
if (!activeStep.isXType("commonchatpanel") || activeStep.getWidth() < 1) {
|
||||
btnChat.addCls("notify");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onCoAuthoringDisconnect: function () {
|
||||
this.disableMenu(["id-menu-comments", "id-menu-chat"], true);
|
||||
},
|
||||
onGetLicense: function (license) {
|
||||
var panel = Ext.getCmp("main-menu-about");
|
||||
if (panel) {
|
||||
panel.setLicInfo(license);
|
||||
}
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
var me = this;
|
||||
this.hkEsc = new Ext.util.KeyMap(document, [{
|
||||
key: Ext.EventObject.ESC,
|
||||
fn: function (key, e) {
|
||||
if (Ext.isDefined(me.currentFullScaleMenuBtn)) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
me.currentFullScaleMenuBtn.toggle(false);
|
||||
}
|
||||
}
|
||||
}]);
|
||||
var addedItems = [],
|
||||
addedButtons = this.mainToolbar.items.items;
|
||||
for (var i = 0; i < this.buttonCollection.length; i++) {
|
||||
var item = this.buttonCollection[i],
|
||||
cardId = -1;
|
||||
if (item.scale == "modal") {} else {
|
||||
if (item.scale != "full") {
|
||||
var cardPanel = Ext.create("Ext.container.Container", {
|
||||
items: item.items,
|
||||
menubutton: addedButtons[i],
|
||||
listeners: {
|
||||
afterrender: function (cmp) {
|
||||
cmp.getEl().on("keydown", me._onContainerKeyDown, me, {
|
||||
button: cmp.menubutton
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
addedButtons[i].bodyCardId = cardPanel.getId();
|
||||
addedItems.push(cardPanel);
|
||||
} else {
|
||||
if (this.fullScaledItemCnt === undefined) {
|
||||
this.fullScaledItemCnt = Ext.create("Ext.container.Container", {
|
||||
id: MAINMENU_FULL_PANEL_ID,
|
||||
layout: "card",
|
||||
shadow: false,
|
||||
floating: true,
|
||||
toFrontOnShow: true,
|
||||
hidden: true,
|
||||
closeMenu: function () {
|
||||
me.closeFullScaleMenu();
|
||||
},
|
||||
getApi: function () {
|
||||
return me.api;
|
||||
}
|
||||
});
|
||||
}
|
||||
addedButtons[i].bodyCardId = item.items[0].id;
|
||||
this.fullScaledItemCnt.add(item.items);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.add(addedItems);
|
||||
},
|
||||
_onContainerKeyDown: function (event, target, opt) {
|
||||
if (event.getKey() == event.ESC) {
|
||||
if (opt.button) {
|
||||
opt.button.toggle(false);
|
||||
} else {
|
||||
this.clearSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* (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.view.MenuColontitules", {
|
||||
extend: "Ext.menu.Menu",
|
||||
alias: "widget.demenucolontitules",
|
||||
requires: ["Common.component.DataViewPicker"],
|
||||
hideOnClick: true,
|
||||
constructor: function (config) {
|
||||
if (!config || !config.viewData) {
|
||||
throw Error("Common.component.MenuDataViewPicker creation failed: required parameters are missing.");
|
||||
}
|
||||
this.initConfig(config);
|
||||
this.callParent(arguments);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
var me = this,
|
||||
cfg = Ext.apply({},
|
||||
me.initialConfig);
|
||||
delete cfg.listeners;
|
||||
Ext.apply(me, {
|
||||
plain: true,
|
||||
showSeparator: false,
|
||||
items: [{
|
||||
xtype: "label",
|
||||
margin: "6px 0 0 10px",
|
||||
text: "Insert page number"
|
||||
},
|
||||
Ext.applyIf({
|
||||
xtype: "cmddataviewpicker",
|
||||
padding: "4px 4px 1px 10px"
|
||||
},
|
||||
cfg)]
|
||||
});
|
||||
me.callParent(arguments);
|
||||
me.picker = me.down("cmddataviewpicker");
|
||||
me.relayEvents(me.picker, ["select"]);
|
||||
if (me.hideOnClick) {
|
||||
me.on("select", me.hidePickerOnSelect, me);
|
||||
}
|
||||
},
|
||||
hidePickerOnSelect: function (picker, columns, rows) {
|
||||
Ext.menu.Manager.hideAll();
|
||||
}
|
||||
});
|
||||
944
OfficeWeb/apps/documenteditor/main/app/view/ParagraphSettings.js
Normal file
944
OfficeWeb/apps/documenteditor/main/app/view/ParagraphSettings.js
Normal file
@@ -0,0 +1,944 @@
|
||||
/*
|
||||
* (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.view.ParagraphSettings", {
|
||||
extend: "Common.view.AbstractSettingsPanel",
|
||||
alias: "widget.deparagraphsettings",
|
||||
height: 261,
|
||||
requires: ["Ext.DomHelper", "Ext.button.Button", "Ext.form.field.Number", "Ext.form.Label", "Ext.container.Container", "Ext.toolbar.Spacer", "Common.component.MetricSpinner", "Common.component.IndeterminateCheckBox", "Ext.form.field.ComboBox", "DE.view.ParagraphSettingsAdvanced", "Common.component.ThemeColorPalette"],
|
||||
constructor: function (config) {
|
||||
this.callParent(arguments);
|
||||
this.initConfig(config);
|
||||
return this;
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
if (o) {
|
||||
this.api.asc_registerCallback("asc_onParaSpacingLine", Ext.bind(this._onLineSpacing, this));
|
||||
}
|
||||
},
|
||||
initComponent: function () {
|
||||
this.title = this.txtTitle;
|
||||
this._initSettings = true;
|
||||
this._state = {
|
||||
LineRuleIdx: 1,
|
||||
LineHeight: 1.5,
|
||||
LineSpacingBefore: 0,
|
||||
LineSpacingAfter: 0.35,
|
||||
AddInterval: false,
|
||||
BackColor: "#000000"
|
||||
};
|
||||
this.ThemeValues = [6, 15, 7, 16, 0, 1, 2, 3, 4, 5];
|
||||
this._arrLineRule = [this.textAtLeast, this.textAuto, this.textExact];
|
||||
this._arrLineDefaults = [[5, "cm", 0.03, 0.01], [1, "", 0.5, 0.01], [5, "cm", 0.03, 0.01]];
|
||||
this.cmbLineRule = Ext.create("Ext.form.field.ComboBox", {
|
||||
id: "table-combo-line-rule",
|
||||
width: 85,
|
||||
editable: false,
|
||||
store: this._arrLineRule,
|
||||
mode: "local",
|
||||
triggerAction: "all",
|
||||
listeners: {
|
||||
select: Ext.bind(function (combo, records, eOpts) {
|
||||
if (this.api) {
|
||||
this.api.put_PrLineSpacing(records[0].index, this._arrLineDefaults[records[0].index][0]);
|
||||
}
|
||||
this.numLineHeight.setDefaultUnit(this._arrLineDefaults[records[0].index][1]);
|
||||
this.numLineHeight.setMinValue(this._arrLineDefaults[records[0].index][2]);
|
||||
this.numLineHeight.setStep(this._arrLineDefaults[records[0].index][3]);
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.cmbLineRule.setValue(this._arrLineRule[1]);
|
||||
this.controls.push(this.cmbLineRule);
|
||||
this.numLineHeight = Ext.widget("commonmetricspinner", {
|
||||
id: "paragraph-spin-line-height",
|
||||
readOnly: false,
|
||||
step: 0.01,
|
||||
width: 85,
|
||||
value: "1.5",
|
||||
defaultUnit: "",
|
||||
maxValue: 132,
|
||||
minValue: 0.5,
|
||||
listeners: {
|
||||
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
|
||||
if (this.cmbLineRule.getValue() == "") {
|
||||
return;
|
||||
}
|
||||
var type = c_paragraphLinerule.LINERULE_AUTO;
|
||||
for (var i = 0; i < this._arrLineRule.length; i++) {
|
||||
if (this.cmbLineRule.getValue() == this._arrLineRule[i]) {
|
||||
type = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (this.api) {
|
||||
this.api.put_PrLineSpacing(type, (type == c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.MetricSettings.fnRecalcToMM(field.getNumberValue()));
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.controls.push(this.numLineHeight);
|
||||
this.numSpacingBefore = Ext.create("Common.component.MetricSpinner", {
|
||||
id: "paragraph-spin-spacing-before",
|
||||
readOnly: false,
|
||||
step: 0.1,
|
||||
width: 85,
|
||||
defaultUnit: "cm",
|
||||
value: "0 cm",
|
||||
maxValue: 55.88,
|
||||
minValue: 0,
|
||||
allowAuto: true,
|
||||
autoText: this.txtAutoText,
|
||||
listeners: {
|
||||
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
|
||||
if (this.api) {
|
||||
var num = field.getNumberValue();
|
||||
if (num < 0) {
|
||||
this.api.put_LineSpacingBeforeAfter(0, -1);
|
||||
} else {
|
||||
this.api.put_LineSpacingBeforeAfter(0, Common.MetricSettings.fnRecalcToMM(field.getNumberValue()));
|
||||
}
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.controls.push(this.numSpacingBefore);
|
||||
this.numSpacingAfter = Ext.create("Common.component.MetricSpinner", {
|
||||
id: "paragraph-spin-spacing-after",
|
||||
readOnly: false,
|
||||
step: 0.1,
|
||||
width: 85,
|
||||
defaultUnit: "cm",
|
||||
value: "0.35 cm",
|
||||
maxValue: 55.88,
|
||||
minValue: 0,
|
||||
allowAuto: true,
|
||||
autoText: this.txtAutoText,
|
||||
listeners: {
|
||||
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
|
||||
if (this.api) {
|
||||
var num = field.getNumberValue();
|
||||
if (num < 0) {
|
||||
this.api.put_LineSpacingBeforeAfter(1, -1);
|
||||
} else {
|
||||
this.api.put_LineSpacingBeforeAfter(1, Common.MetricSettings.fnRecalcToMM(field.getNumberValue()));
|
||||
}
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.controls.push(this.numSpacingAfter);
|
||||
this.chAddInterval = Ext.create("Common.component.IndeterminateCheckBox", {
|
||||
id: "paragraph-checkbox-add-interval",
|
||||
listeners: {
|
||||
change: Ext.bind(function (field, newValue, oldValue, eOpts) {
|
||||
if (this.api) {
|
||||
this.api.put_AddSpaceBetweenPrg((field.getValue() == "checked"));
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.controls.push(this.chAddInterval);
|
||||
this._SpacingPanel = Ext.create("Ext.container.Container", {
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
height: 139,
|
||||
width: 190,
|
||||
items: [{
|
||||
xtype: "tbspacer",
|
||||
height: 8
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 41,
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 2,
|
||||
tdAttrs: {
|
||||
style: "padding-right: 8px;vertical-align: middle;"
|
||||
}
|
||||
},
|
||||
items: [{
|
||||
xtype: "label",
|
||||
text: this.strLineHeight,
|
||||
style: "display: block;",
|
||||
width: 85
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
text: this.textAt,
|
||||
style: "display: block;",
|
||||
width: 85
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 2
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 2
|
||||
},
|
||||
this.cmbLineRule, this.numLineHeight]
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 10
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 2,
|
||||
tdAttrs: {
|
||||
style: "padding-right: 8px;"
|
||||
}
|
||||
},
|
||||
defaults: {
|
||||
xtype: "container",
|
||||
layout: "vbox",
|
||||
layoutConfig: {
|
||||
align: "stretch"
|
||||
},
|
||||
height: 48,
|
||||
style: "float:left;"
|
||||
},
|
||||
items: [{
|
||||
items: [{
|
||||
xtype: "label",
|
||||
text: this.strSpacingBefore,
|
||||
width: 85
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
this.numSpacingBefore]
|
||||
},
|
||||
{
|
||||
items: [{
|
||||
xtype: "label",
|
||||
text: this.strSpacingAfter,
|
||||
width: 85
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
this.numSpacingAfter]
|
||||
}]
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 32,
|
||||
width: "100%",
|
||||
layout: "hbox",
|
||||
items: [this.chAddInterval, {
|
||||
xtype: "label",
|
||||
text: this.strSomeParagraphSpace,
|
||||
margin: "1px 0 0 4px",
|
||||
flex: 1,
|
||||
listeners: {
|
||||
afterrender: Ext.bind(function (ct) {
|
||||
ct.getEl().on("click", Ext.bind(function () {
|
||||
this.chAddInterval.setValue((this.chAddInterval.getValue() == "indeterminate") ? false : !(this.chAddInterval.getValue() == "checked"));
|
||||
},
|
||||
this), this);
|
||||
ct.getEl().on("dblclick", Ext.bind(function () {
|
||||
this.chAddInterval.setValue((this.chAddInterval.getValue() == "indeterminate") ? false : !(this.chAddInterval.getValue() == "checked"));
|
||||
},
|
||||
this), this);
|
||||
},
|
||||
this)
|
||||
}
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
width: 5
|
||||
}]
|
||||
}]
|
||||
});
|
||||
this._btnBackColor = Ext.create("Ext.button.Button", {
|
||||
id: "paragraph-button-back-color",
|
||||
arrowCls: "",
|
||||
width: 50,
|
||||
height: 22,
|
||||
color: "transparent",
|
||||
menu: {
|
||||
showSeparator: false,
|
||||
items: [this.colorsBack = Ext.create("Common.component.ThemeColorPalette", {
|
||||
value: "000000",
|
||||
width: 165,
|
||||
height: 214,
|
||||
dynamiccolors: true,
|
||||
dyncolorscount: 10,
|
||||
colors: [this.textThemeColors, "-", {
|
||||
color: "3366FF",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "0000FF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000090",
|
||||
effectId: 3
|
||||
},
|
||||
{
|
||||
color: "660066",
|
||||
effectId: 4
|
||||
},
|
||||
{
|
||||
color: "800000",
|
||||
effectId: 5
|
||||
},
|
||||
{
|
||||
color: "FF0000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FF6600",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFF00",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "CCFFCC",
|
||||
effectId: 3
|
||||
},
|
||||
{
|
||||
color: "008000",
|
||||
effectId: 4
|
||||
},
|
||||
"-", {
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 3
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 4
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 5
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
{
|
||||
color: "FFFFFF",
|
||||
effectId: 2
|
||||
},
|
||||
{
|
||||
color: "000000",
|
||||
effectId: 1
|
||||
},
|
||||
"-", "--", "-", this.textStandartColors, "-", "transparent", "5301B3", "980ABD", "B2275F", "F83D26", "F86A1D", "F7AC16", "F7CA12", "FAFF44", "D6EF39", "-", "--"],
|
||||
listeners: {
|
||||
select: {
|
||||
fn: function (picker, color, eOpts, id) {
|
||||
Ext.menu.Manager.hideAll();
|
||||
var clr, border;
|
||||
this._btnBackColor.color = color;
|
||||
if (color == "transparent") {
|
||||
clr = "transparent";
|
||||
border = "1px solid #BEBEBE";
|
||||
} else {
|
||||
clr = Ext.String.format("#{0}", (typeof(color) == "object") ? color.color : color);
|
||||
border = "none";
|
||||
}
|
||||
if (this._btnBackColor.btnEl) {
|
||||
Ext.DomHelper.applyStyles(this._btnBackColor.btnEl, {
|
||||
"background-color": clr,
|
||||
"border": border
|
||||
});
|
||||
}
|
||||
this.BackColor = this._btnBackColor.color;
|
||||
if (this.api) {
|
||||
if (color == "transparent") {
|
||||
this.api.put_ParagraphShade(false);
|
||||
} else {
|
||||
this.api.put_ParagraphShade(true, this.getRgbColor(color));
|
||||
}
|
||||
}
|
||||
this.fireEvent("editcomplete", this);
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
}
|
||||
}), {
|
||||
cls: "menu-item-noicon menu-item-color-palette-theme",
|
||||
text: this.textNewColor,
|
||||
listeners: {
|
||||
click: Ext.bind(function (item, event) {
|
||||
this.colorsBack.addNewColor();
|
||||
},
|
||||
this)
|
||||
}
|
||||
}]
|
||||
},
|
||||
listeners: {
|
||||
render: function (c) {
|
||||
var border, clr;
|
||||
if (c.color == "transparent") {
|
||||
border = "1px solid #BEBEBE";
|
||||
clr = c.color;
|
||||
} else {
|
||||
border = "none";
|
||||
clr = Ext.String.format("#{0}", (typeof(c.color) == "object") ? c.color.color : c.color);
|
||||
}
|
||||
Ext.DomHelper.applyStyles(c.btnEl, {
|
||||
"background-color": clr,
|
||||
"border": border
|
||||
});
|
||||
}
|
||||
},
|
||||
setColor: function (newcolor) {
|
||||
var border, clr;
|
||||
this.color = newcolor;
|
||||
if (newcolor == "transparent") {
|
||||
border = "1px solid #BEBEBE";
|
||||
clr = newcolor;
|
||||
} else {
|
||||
border = "none";
|
||||
clr = Ext.String.format("#{0}", (typeof(newcolor) == "object") ? newcolor.color : newcolor);
|
||||
}
|
||||
if (this.btnEl !== undefined) {
|
||||
Ext.DomHelper.applyStyles(this.btnEl, {
|
||||
"background-color": clr,
|
||||
"border": border
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
this.controls.push(this.colorsBack);
|
||||
this._ColorContainer = Ext.create("Ext.container.Container", {
|
||||
height: 25,
|
||||
width: 195,
|
||||
layout: "hbox",
|
||||
items: [this._btnBackColor, {
|
||||
xtype: "tbspacer",
|
||||
width: 5
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
text: this.textBackColor,
|
||||
margin: "2px 0 0 0",
|
||||
flex: 1
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
width: 5
|
||||
}]
|
||||
});
|
||||
this.items = [{
|
||||
xtype: "tbspacer",
|
||||
height: 9
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
style: "font-weight: bold;margin-top: 1px;",
|
||||
text: this.strParagraphSpacing
|
||||
},
|
||||
this._SpacingPanel, {
|
||||
xtype: "tbspacer",
|
||||
height: 7
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
width: "100%",
|
||||
height: 10,
|
||||
style: "padding-right: 10px;",
|
||||
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
this._ColorContainer, {
|
||||
xtype: "tbspacer",
|
||||
height: 10
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
width: "100%",
|
||||
height: 10,
|
||||
style: "padding-right: 10px;",
|
||||
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 3
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 20,
|
||||
width: "100%",
|
||||
items: [{
|
||||
xtype: "box",
|
||||
html: '<div style="width:100%;text-align:center;padding-right:15px;"><label id="paragraph-advanced-link" class="asc-advanced-link">' + this.textAdvanced + "</label></div>",
|
||||
listeners: {
|
||||
afterrender: function (cmp) {
|
||||
document.getElementById("paragraph-advanced-link").onclick = Ext.bind(this._openAdvancedSettings, this);
|
||||
},
|
||||
scope: this
|
||||
}
|
||||
}]
|
||||
}];
|
||||
this.addEvents("editcomplete");
|
||||
this.callParent(arguments);
|
||||
},
|
||||
getHexColor: function (r, g, b) {
|
||||
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;
|
||||
},
|
||||
getRgbColor: function (clr) {
|
||||
var color = (typeof(clr) == "object") ? clr.color : clr;
|
||||
color = color.replace(/#/, "");
|
||||
if (color.length == 3) {
|
||||
color = color.replace(/(.)/g, "$1$1");
|
||||
}
|
||||
color = parseInt(color, 16);
|
||||
var c = new CAscColor();
|
||||
c.put_type((typeof(clr) == "object") ? c_oAscColor.COLOR_TYPE_SCHEME : c_oAscColor.COLOR_TYPE_SRGB);
|
||||
c.put_r(color >> 16);
|
||||
c.put_g((color & 65280) >> 8);
|
||||
c.put_b(color & 255);
|
||||
c.put_a(255);
|
||||
if (clr.effectId !== undefined) {
|
||||
c.put_value(clr.effectId);
|
||||
}
|
||||
return c;
|
||||
},
|
||||
_onLineSpacing: function (value) {
|
||||
var linerule = value.get_LineRule();
|
||||
var line = value.get_Line();
|
||||
this.numLineHeight.suspendEvents(false);
|
||||
this.cmbLineRule.suspendEvents(false);
|
||||
if (this._state.LineRuleIdx !== linerule) {
|
||||
this.cmbLineRule.setValue((linerule !== null) ? this._arrLineRule[linerule] : "");
|
||||
this.numLineHeight.setMinValue(this._arrLineDefaults[(linerule !== null) ? linerule : 1][2]);
|
||||
this.numLineHeight.setDefaultUnit(this._arrLineDefaults[(linerule !== null) ? linerule : 1][1]);
|
||||
this.numLineHeight.setStep(this._arrLineDefaults[(linerule !== null) ? linerule : 1][3]);
|
||||
this._state.LineRuleIdx = linerule;
|
||||
}
|
||||
if (Math.abs(this._state.LineHeight - line) > 0.001 || (this._state.LineHeight === null || line === null) && (this._state.LineHeight !== line)) {
|
||||
var val = "";
|
||||
if (linerule == c_paragraphLinerule.LINERULE_AUTO) {
|
||||
val = line;
|
||||
} else {
|
||||
if (linerule !== null && line !== null) {
|
||||
val = Common.MetricSettings.fnRecalcFromMM(line);
|
||||
}
|
||||
}
|
||||
this.numLineHeight.setValue((val !== null) ? val : "");
|
||||
this._state.LineHeight = line;
|
||||
}
|
||||
this.numLineHeight.resumeEvents();
|
||||
this.cmbLineRule.resumeEvents();
|
||||
},
|
||||
ChangeSettings: function (prop) {
|
||||
if (this._initSettings) {
|
||||
this.createDelayedElements();
|
||||
this._initSettings = false;
|
||||
}
|
||||
if (prop) {
|
||||
this.SuspendEvents();
|
||||
var Spacing = {
|
||||
Line: prop.get_Spacing().get_Line(),
|
||||
Before: prop.get_Spacing().get_Before(),
|
||||
After: prop.get_Spacing().get_After(),
|
||||
LineRule: prop.get_Spacing().get_LineRule()
|
||||
};
|
||||
var other = {
|
||||
ContextualSpacing: prop.get_ContextualSpacing()
|
||||
};
|
||||
if (this._state.LineRuleIdx !== Spacing.LineRule) {
|
||||
this.cmbLineRule.setValue((Spacing.LineRule !== null) ? this._arrLineRule[Spacing.LineRule] : "");
|
||||
this.numLineHeight.setMinValue(this._arrLineDefaults[(Spacing.LineRule !== null) ? Spacing.LineRule : 1][2]);
|
||||
this.numLineHeight.setDefaultUnit(this._arrLineDefaults[(Spacing.LineRule !== null) ? Spacing.LineRule : 1][1]);
|
||||
this.numLineHeight.setStep(this._arrLineDefaults[(Spacing.LineRule !== null) ? Spacing.LineRule : 1][3]);
|
||||
this._state.LineRuleIdx = Spacing.LineRule;
|
||||
}
|
||||
if (Math.abs(this._state.LineHeight - Spacing.Line) > 0.001 || (this._state.LineHeight === null || Spacing.Line === null) && (this._state.LineHeight !== Spacing.Line)) {
|
||||
var val = "";
|
||||
if (Spacing.LineRule == c_paragraphLinerule.LINERULE_AUTO) {
|
||||
val = Spacing.Line;
|
||||
} else {
|
||||
if (Spacing.LineRule !== null && Spacing.Line !== null) {
|
||||
val = Common.MetricSettings.fnRecalcFromMM(Spacing.Line);
|
||||
}
|
||||
}
|
||||
this.numLineHeight.setValue((val !== null) ? val : "");
|
||||
this._state.LineHeight = Spacing.Line;
|
||||
}
|
||||
if (Math.abs(this._state.LineSpacingBefore - Spacing.Before) > 0.001 || (this._state.LineSpacingBefore === null || Spacing.Before === null) && (this._state.LineSpacingBefore !== Spacing.Before)) {
|
||||
this.numSpacingBefore.setValue((Spacing.Before !== null) ? ((Spacing.Before < 0) ? Spacing.Before : Common.MetricSettings.fnRecalcFromMM(Spacing.Before)) : "");
|
||||
this._state.LineSpacingBefore = Spacing.Before;
|
||||
}
|
||||
if (Math.abs(this._state.LineSpacingAfter - Spacing.After) > 0.001 || (this._state.LineSpacingAfter === null || Spacing.After === null) && (this._state.LineSpacingAfter !== Spacing.After)) {
|
||||
this.numSpacingAfter.setValue((Spacing.After !== null) ? ((Spacing.After < 0) ? Spacing.After : Common.MetricSettings.fnRecalcFromMM(Spacing.After)) : "");
|
||||
this._state.LineSpacingAfter = Spacing.After;
|
||||
}
|
||||
if (this._state.AddInterval !== other.ContextualSpacing) {
|
||||
this.chAddInterval.setValue((other.ContextualSpacing !== null && other.ContextualSpacing !== undefined) ? other.ContextualSpacing : "indeterminate");
|
||||
this._state.AddInterval = other.ContextualSpacing;
|
||||
}
|
||||
var shd = prop.get_Shade();
|
||||
if (shd !== null && shd !== undefined && shd.get_Value() === shd_Clear) {
|
||||
var color = shd.get_Color();
|
||||
if (color) {
|
||||
if (color.get_type() == c_oAscColor.COLOR_TYPE_SCHEME) {
|
||||
this.BackColor = {
|
||||
color: this.getHexColor(color.get_r(), color.get_g(), color.get_b()),
|
||||
effectValue: color.get_value()
|
||||
};
|
||||
} else {
|
||||
this.BackColor = this.getHexColor(color.get_r(), color.get_g(), color.get_b());
|
||||
}
|
||||
} else {
|
||||
this.BackColor = "transparent";
|
||||
}
|
||||
} else {
|
||||
this.BackColor = "transparent";
|
||||
}
|
||||
var type1 = typeof(this.BackColor),
|
||||
type2 = typeof(this._state.BackColor);
|
||||
if ((type1 !== type2) || (type1 == "object" && (this.BackColor.effectValue !== this._state.BackColor.effectValue || this._state.BackColor.color.indexOf(this.BackColor.color) < 0)) || (type1 != "object" && this._state.BackColor.indexOf(this.BackColor) < 0)) {
|
||||
this._btnBackColor.setColor(this.BackColor);
|
||||
if (typeof(this.BackColor) == "object") {
|
||||
for (var i = 0; i < 10; i++) {
|
||||
if (this.ThemeValues[i] == this.BackColor.effectValue) {
|
||||
this.colorsBack.select(this.BackColor, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.colorsBack.select(this.BackColor, false);
|
||||
}
|
||||
this._state.BackColor = this.BackColor;
|
||||
}
|
||||
this.ResumeEvents();
|
||||
}
|
||||
},
|
||||
_openAdvancedSettings: function (e) {
|
||||
var me = this;
|
||||
var win;
|
||||
if (me.api) {
|
||||
var selectedElements = me.api.getSelectedElements();
|
||||
if (selectedElements && Ext.isArray(selectedElements)) {
|
||||
var elType, elValue;
|
||||
for (var i = selectedElements.length - 1; i >= 0; i--) {
|
||||
elType = selectedElements[i].get_ObjectType();
|
||||
elValue = selectedElements[i].get_ObjectValue();
|
||||
if (c_oAscTypeSelectElement.Paragraph == elType) {
|
||||
var paragraph_config = {
|
||||
tableStylerRows: 2,
|
||||
tableStylerColumns: 1
|
||||
};
|
||||
win = Ext.create("DE.view.ParagraphSettingsAdvanced", paragraph_config);
|
||||
win.updateMetricUnit();
|
||||
win.setSettings({
|
||||
paragraphProps: elValue,
|
||||
borderProps: me.borderAdvancedProps,
|
||||
api: me.api,
|
||||
colorProps: [me.effectcolors, me.standartcolors]
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (win) {
|
||||
win.addListener("onmodalresult", Ext.bind(function (o, mr, s) {
|
||||
if (mr == 1 && s) {
|
||||
me.borderAdvancedProps = s.borderProps;
|
||||
me.api.paraApply(s.paragraphProps);
|
||||
}
|
||||
},
|
||||
this), false);
|
||||
win.addListener("close", function () {
|
||||
me.fireEvent("editcomplete", me);
|
||||
},
|
||||
false);
|
||||
win.show();
|
||||
}
|
||||
},
|
||||
SendThemeColors: function (effectcolors, standartcolors) {
|
||||
this.effectcolors = effectcolors;
|
||||
if (standartcolors && standartcolors.length > 0) {
|
||||
this.standartcolors = standartcolors;
|
||||
}
|
||||
this.colorsBack.updateColors(effectcolors, standartcolors);
|
||||
},
|
||||
updateMetricUnit: function () {
|
||||
var spinners = this.query("commonmetricspinner");
|
||||
if (spinners) {
|
||||
for (var i = 0; i < spinners.length; i++) {
|
||||
var spinner = spinners[i];
|
||||
if (spinner.id == "paragraph-spin-line-height") {
|
||||
continue;
|
||||
}
|
||||
spinner.setDefaultUnit(Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()]);
|
||||
spinner.setStep(Common.MetricSettings.getCurrentMetric() == Common.MetricSettings.c_MetricUnits.cm ? 0.01 : 1);
|
||||
}
|
||||
}
|
||||
this._arrLineDefaults[2][1] = this._arrLineDefaults[0][1] = Common.MetricSettings.metricName[Common.MetricSettings.getCurrentMetric()];
|
||||
this._arrLineDefaults[2][2] = this._arrLineDefaults[0][2] = parseFloat(Common.MetricSettings.fnRecalcFromMM(0.3).toFixed(2));
|
||||
this._arrLineDefaults[2][3] = this._arrLineDefaults[0][3] = (Common.MetricSettings.getCurrentMetric() == Common.MetricSettings.c_MetricUnits.cm) ? 0.01 : 1;
|
||||
if (this._state.LineRuleIdx !== null) {
|
||||
this.numLineHeight.setDefaultUnit(this._arrLineDefaults[this._state.LineRuleIdx][1]);
|
||||
this.numLineHeight.setStep(this._arrLineDefaults[this._state.LineRuleIdx][3]);
|
||||
}
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
this.updateMetricUnit();
|
||||
},
|
||||
strParagraphSpacing: "Spacing",
|
||||
strSomeParagraphSpace: "Don't add interval between paragraphs of the same style",
|
||||
strLineHeight: "Line Spacing",
|
||||
strSpacingBefore: "Before",
|
||||
strSpacingAfter: "After",
|
||||
textUndock: "Undock from panel",
|
||||
textAuto: "Multiple",
|
||||
textAtLeast: "At least",
|
||||
textExact: "Exactly",
|
||||
textAdvanced: "Show advanced settings",
|
||||
textAt: "At",
|
||||
txtTitle: "Paragraph",
|
||||
txtAutoText: "Auto",
|
||||
textThemeColors: "Theme Colors",
|
||||
textStandartColors: "Standart Colors",
|
||||
textBackColor: "Background color",
|
||||
textNewColor: "Add New Custom Color"
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
75
OfficeWeb/apps/documenteditor/main/app/view/RecentFiles.js
Normal file
75
OfficeWeb/apps/documenteditor/main/app/view/RecentFiles.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* (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.view.RecentFiles", {
|
||||
extend: "Ext.panel.Panel",
|
||||
alias: "widget.derecentfiles",
|
||||
cls: "de-recentfiles",
|
||||
layout: {
|
||||
type: "vbox",
|
||||
align: "stretch"
|
||||
},
|
||||
requires: ["Ext.container.Container", "Ext.data.Model", "Ext.data.Store", "Ext.view.View", "Ext.XTemplate", "Common.plugin.DataViewScrollPane"],
|
||||
constructor: function (config) {
|
||||
this.initConfig(config);
|
||||
this.callParent(arguments);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
this.callParent(arguments);
|
||||
var me = this;
|
||||
me.add({
|
||||
xtype: "container",
|
||||
flex: 1,
|
||||
layout: "fit",
|
||||
cls: "container-recent-file-list",
|
||||
items: [{
|
||||
xtype: "dataview",
|
||||
store: "RecentFiles",
|
||||
tpl: Ext.create("Ext.XTemplate", '<tpl for=".">', '<div class="thumb-wrap">', '<div class="thumb"></div>', '<div class="file-name">{title:htmlEncode}</div>', '<div class="file-info">{folder:htmlEncode}</div>', "</div>", "</tpl>"),
|
||||
singleSelect: true,
|
||||
trackOver: true,
|
||||
style: "overflow:auto",
|
||||
overItemCls: "x-item-over",
|
||||
itemSelector: "div.thumb-wrap",
|
||||
cls: "x-view-context",
|
||||
plugins: [{
|
||||
ptype: "dataviewscrollpane",
|
||||
pluginId: "scrollpane",
|
||||
areaSelector: ".x-view-context",
|
||||
settings: {
|
||||
enableKeyboardNavigation: true
|
||||
}
|
||||
}]
|
||||
}]
|
||||
});
|
||||
}
|
||||
});
|
||||
223
OfficeWeb/apps/documenteditor/main/app/view/RightMenu.js
Normal file
223
OfficeWeb/apps/documenteditor/main/app/view/RightMenu.js
Normal file
@@ -0,0 +1,223 @@
|
||||
/*
|
||||
* (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
|
||||
*
|
||||
*/
|
||||
var SCALE_MIN = 40;
|
||||
var MENU_SCALE_PART = 260;
|
||||
var RIGHTMENU_TOOLBAR_ID = "rightmenu-toolbar-id";
|
||||
var RIGHTMENU_PANEL_ID = "rightmenu-panel-id";
|
||||
Ext.define("DE.view.RightMenu", {
|
||||
extend: "Ext.panel.Panel",
|
||||
alias: "widget.derightmenu",
|
||||
requires: ["Ext.toolbar.Toolbar", "Ext.button.Button", "Ext.container.Container", "Ext.toolbar.Spacer", "DE.view.RightPanel", "Ext.util.Cookies"],
|
||||
cls: "rm-style",
|
||||
id: RIGHTMENU_PANEL_ID,
|
||||
bodyCls: "rm-body",
|
||||
width: SCALE_MIN,
|
||||
buttonCollection: [],
|
||||
listeners: {
|
||||
afterrender: function () {
|
||||
var owner = this.ownerCt;
|
||||
if (Ext.isDefined(owner)) {
|
||||
owner.addListener("resize", Ext.bind(this.resizeMenu, this));
|
||||
}
|
||||
}
|
||||
},
|
||||
initComponent: function () {
|
||||
this.dockedItems = this.buildDockedItems();
|
||||
this._rightSettings = Ext.widget("derightpanel", {
|
||||
id: "view-right-panel-settings",
|
||||
btnText: this.btnText,
|
||||
btnTable: this.btnTable,
|
||||
btnImage: this.btnImage,
|
||||
btnHeaderFooter: this.btnHeaderFooter,
|
||||
btnShape: this.btnShape
|
||||
});
|
||||
this.items = [this._rightSettings];
|
||||
this.addEvents("editcomplete");
|
||||
this.callParent(arguments);
|
||||
},
|
||||
buildDockedItems: function () {
|
||||
var me = this;
|
||||
me.btnText = Ext.create("Ext.Button", {
|
||||
id: "id-right-menu-text",
|
||||
cls: "asc-main-menu-buttons",
|
||||
iconCls: "asc-main-menu-btn menuText",
|
||||
asctype: c_oAscTypeSelectElement.Paragraph,
|
||||
enableToggle: true,
|
||||
allowDepress: true,
|
||||
style: "margin-bottom: 8px;",
|
||||
disabled: true,
|
||||
toggleGroup: "tabpanelbtnsGroup"
|
||||
});
|
||||
me.btnTable = Ext.create("Ext.Button", {
|
||||
id: "id-right-menu-table",
|
||||
cls: "asc-main-menu-buttons",
|
||||
iconCls: "asc-main-menu-btn menuTable",
|
||||
asctype: c_oAscTypeSelectElement.Table,
|
||||
enableToggle: true,
|
||||
allowDepress: true,
|
||||
style: "margin-bottom: 8px;",
|
||||
disabled: true,
|
||||
toggleGroup: "tabpanelbtnsGroup"
|
||||
});
|
||||
me.btnImage = Ext.create("Ext.Button", {
|
||||
id: "id-right-menu-image",
|
||||
cls: "asc-main-menu-buttons",
|
||||
iconCls: "asc-main-menu-btn menuImage",
|
||||
asctype: c_oAscTypeSelectElement.Image,
|
||||
enableToggle: true,
|
||||
allowDepress: true,
|
||||
style: "margin-bottom: 8px;",
|
||||
disabled: true,
|
||||
toggleGroup: "tabpanelbtnsGroup"
|
||||
});
|
||||
me.btnHeaderFooter = Ext.create("Ext.Button", {
|
||||
id: "id-right-menu-header",
|
||||
cls: "asc-main-menu-buttons",
|
||||
iconCls: "asc-main-menu-btn menuHeaderFooter",
|
||||
asctype: c_oAscTypeSelectElement.Header,
|
||||
enableToggle: true,
|
||||
allowDepress: true,
|
||||
style: "margin-bottom: 8px;",
|
||||
disabled: true,
|
||||
toggleGroup: "tabpanelbtnsGroup"
|
||||
});
|
||||
me.btnShape = Ext.create("Ext.button.Button", {
|
||||
id: "id-right-menu-shape",
|
||||
cls: "asc-main-menu-buttons",
|
||||
iconCls: "asc-main-menu-btn menuShape",
|
||||
asctype: c_oAscTypeSelectElement.Shape,
|
||||
enableToggle: true,
|
||||
allowDepress: true,
|
||||
style: "margin-bottom: 8px;",
|
||||
disabled: true,
|
||||
toggleGroup: "tabpanelbtnsGroup"
|
||||
});
|
||||
this.rightToolbar = Ext.create("Ext.toolbar.Toolbar", {
|
||||
cls: "rm-default-toolbar",
|
||||
width: this.width || SCALE_MIN,
|
||||
vertical: true,
|
||||
dock: "right",
|
||||
defaultType: "button",
|
||||
style: "padding-top: 15px;",
|
||||
items: [me.btnText, me.btnTable, me.btnImage, me.btnHeaderFooter, me.btnShape]
|
||||
});
|
||||
return this.rightToolbar;
|
||||
},
|
||||
resizeMenu: function (Component, adjWidth, adjHeight, eOpts) {
|
||||
for (var i = 0; i < this.items.length; i++) {
|
||||
if (this.items.items[i].el && adjHeight != this.items.items[i].getHeight()) {
|
||||
this.items.items[i].setHeight(adjHeight);
|
||||
}
|
||||
}
|
||||
this.doComponentLayout();
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
|
||||
return this;
|
||||
},
|
||||
disableMenu: function (disabled) {
|
||||
var btn, i;
|
||||
var tbMain = this.rightToolbar;
|
||||
if (Ext.isDefined(tbMain)) {
|
||||
for (i = 0; i < tbMain.items.length; i++) {
|
||||
btn = tbMain.items.items[i];
|
||||
if (Ext.isDefined(btn) && btn.componentCls === "x-btn") {
|
||||
btn.pressed && btn.toggle(false);
|
||||
btn.setDisabled(disabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onCoAuthoringDisconnect: function () {
|
||||
this.disableMenu(true);
|
||||
if (this._rightSettings) {
|
||||
this._rightSettings.setDisabled(true);
|
||||
this._rightSettings.setMode({
|
||||
isEdit: false
|
||||
});
|
||||
}
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
var me = this;
|
||||
me._rightSettings.setHeight(me.getHeight());
|
||||
var toggleHandler = function (btn, pressed) {
|
||||
if (pressed && !me._rightSettings.minimizedMode) {
|
||||
btn.addCls("asc-main-menu-btn-selected");
|
||||
var panel = me._rightSettings._settings[btn.asctype].panel;
|
||||
var props = me._rightSettings._settings[btn.asctype].props;
|
||||
me._rightSettings.TabPanel.getLayout().setActiveItem(panel);
|
||||
me._rightSettings.TabPanel.setHeight(panel.initialHeight);
|
||||
if (props) {
|
||||
panel.ChangeSettings.call(panel, props);
|
||||
}
|
||||
}
|
||||
};
|
||||
var clickHandler = function (btn) {
|
||||
if (btn.pressed) {
|
||||
if (me._rightSettings.minimizedMode) {
|
||||
if (me._rightSettings.TabPanel.hidden) {
|
||||
me._rightSettings.TabPanel.setVisible(true);
|
||||
}
|
||||
me.setWidth(MENU_SCALE_PART);
|
||||
me._rightSettings.minimizedMode = false;
|
||||
toggleHandler(btn, btn.pressed);
|
||||
window.localStorage.setItem("de-hidden-right-settings", 0);
|
||||
} else {
|
||||
btn.addCls("asc-main-menu-btn-selected");
|
||||
}
|
||||
} else {
|
||||
me.setWidth(SCALE_MIN);
|
||||
me._rightSettings.minimizedMode = true;
|
||||
btn.removeCls("asc-main-menu-btn-selected");
|
||||
window.localStorage.setItem("de-hidden-right-settings", 1);
|
||||
}
|
||||
me.fireEvent("editcomplete", me);
|
||||
};
|
||||
var button;
|
||||
var tips = [me.txtParagraphSettings, me.txtTableSettings, me.txtImageSettings, me.txtHeaderFooterSettings, me.txtShapeSettings];
|
||||
for (var i = this.rightToolbar.items.items.length; i--;) {
|
||||
button = this.rightToolbar.items.items[i];
|
||||
button.on({
|
||||
"click": clickHandler,
|
||||
"toggle": toggleHandler
|
||||
});
|
||||
button.setTooltip(tips[i]);
|
||||
}
|
||||
},
|
||||
txtParagraphSettings: "Paragraph Settings",
|
||||
txtImageSettings: "Image Settings",
|
||||
txtTableSettings: "Table Settings",
|
||||
txtHeaderFooterSettings: "Header and Footer Settings",
|
||||
txtShapeSettings: "Shape Settings",
|
||||
txtChartSettings: "Chart Settings"
|
||||
});
|
||||
300
OfficeWeb/apps/documenteditor/main/app/view/RightPanel.js
Normal file
300
OfficeWeb/apps/documenteditor/main/app/view/RightPanel.js
Normal file
@@ -0,0 +1,300 @@
|
||||
/*
|
||||
* (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.view.RightPanel", {
|
||||
extend: "Ext.container.Container",
|
||||
alias: "widget.derightpanel",
|
||||
width: 220,
|
||||
layout: {
|
||||
type: "auto"
|
||||
},
|
||||
autoScroll: true,
|
||||
cls: "asc-right-panel-container",
|
||||
preventHeader: true,
|
||||
requires: ["Ext.toolbar.Toolbar", "Ext.container.Container", "Common.plugin.ScrollPane", "DE.view.TableSettings", "DE.view.ParagraphSettings", "DE.view.ImageSettings", "DE.view.HeaderFooterSettings", "DE.view.ShapeSettings", "Ext.Button"],
|
||||
uses: ["Ext.DomHelper", "Ext.util.Cookies"],
|
||||
listeners: {
|
||||
afterrender: function () {
|
||||
var owner = this.ownerCt;
|
||||
if (Ext.isDefined(owner)) {
|
||||
owner.addListener("resize", Ext.bind(this.resizeRightPanels, this));
|
||||
}
|
||||
}
|
||||
},
|
||||
resizeRightPanels: function (cnt) {
|
||||
this.doComponentLayout();
|
||||
},
|
||||
constructor: function (config) {
|
||||
this.callParent(arguments);
|
||||
this.initConfig(config);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
var me = this;
|
||||
me.editMode = true;
|
||||
me.minimizedMode = true;
|
||||
me.plugins = [{
|
||||
ptype: "scrollpane",
|
||||
pluginId: "scrollpane",
|
||||
areaSelector: ".x-container",
|
||||
settings: {
|
||||
enableKeyboardNavigation: true,
|
||||
verticalGutter: 0
|
||||
}
|
||||
}];
|
||||
me.callParent(arguments);
|
||||
},
|
||||
updateScrollPane: function () {
|
||||
var me = this;
|
||||
me.getPlugin("scrollpane").updateScrollPane();
|
||||
},
|
||||
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 = false;
|
||||
}
|
||||
}
|
||||
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();
|
||||
if (type == c_oAscTypeSelectElement.Image) {
|
||||
if (value.get_ShapeProperties() !== null) {
|
||||
type = c_oAscTypeSelectElement.Shape;
|
||||
}
|
||||
}
|
||||
this._settings[type].props = value;
|
||||
this._settings[type].hidden = 0;
|
||||
this._settings[type].locked = value.get_Locked();
|
||||
}
|
||||
if (this._settings[c_oAscTypeSelectElement.Header].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++) {
|
||||
if (this._settings[i] === undefined) {
|
||||
continue;
|
||||
}
|
||||
if (this._settings[i].hidden) {
|
||||
if (!this._settings[i].btn.isDisabled()) {
|
||||
this._settings[i].btn.setDisabled(true);
|
||||
}
|
||||
if (this.TabPanel.getLayout().getActiveItem() == this._settings[i].panel) {
|
||||
currentactive = -1;
|
||||
}
|
||||
} else {
|
||||
if (this._settings[i].btn.isDisabled()) {
|
||||
this._settings[i].btn.setDisabled(false);
|
||||
}
|
||||
lastactive = i;
|
||||
if (this._settings[i].needShow) {
|
||||
this._settings[i].needShow = false;
|
||||
priorityactive = i;
|
||||
} else {
|
||||
if (this.TabPanel.getLayout().getActiveItem() == this._settings[i].panel) {
|
||||
currentactive = i;
|
||||
}
|
||||
}
|
||||
if (this._settings[i].panel.isDisabled() !== this._settings[i].locked) {
|
||||
this._settings[i].panel.setDisabled(this._settings[i].locked);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this.minimizedMode) {
|
||||
var active;
|
||||
if (priorityactive > -1) {
|
||||
active = priorityactive;
|
||||
} else {
|
||||
if (lastactive >= 0 && currentactive < 0) {
|
||||
active = lastactive;
|
||||
} else {
|
||||
if (currentactive >= 0) {
|
||||
active = currentactive;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (active !== undefined) {
|
||||
if (!this._settings[active].btn.pressed) {
|
||||
this._settings[active].btn.toggle();
|
||||
} else {
|
||||
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.Shape].needShow = false;
|
||||
},
|
||||
onInsertTable: function () {
|
||||
this._settings[c_oAscTypeSelectElement.Table].needShow = true;
|
||||
},
|
||||
onInsertImage: function () {
|
||||
this._settings[c_oAscTypeSelectElement.Image].needShow = true;
|
||||
},
|
||||
onInsertShape: function () {
|
||||
this._settings[c_oAscTypeSelectElement.Shape].needShow = true;
|
||||
},
|
||||
FillAutoShapes: function () {
|
||||
this.ShapePanel.FillAutoShapes();
|
||||
},
|
||||
SendThemeColors: function (effectcolors, standartcolors) {
|
||||
this.effectcolors = effectcolors;
|
||||
if (standartcolors && standartcolors.length > 0) {
|
||||
this.standartcolors = standartcolors;
|
||||
}
|
||||
if (this.ShapePanel && this.TablePanel && this.ParagraphPanel) {
|
||||
this.ShapePanel.SendThemeColors(effectcolors, standartcolors);
|
||||
this.TablePanel.SendThemeColors(effectcolors, standartcolors);
|
||||
this.ParagraphPanel.SendThemeColors(effectcolors, standartcolors);
|
||||
}
|
||||
},
|
||||
setApi: function (api) {
|
||||
this.api = api;
|
||||
return this;
|
||||
},
|
||||
setMode: function (mode) {
|
||||
this.editMode = mode.isEdit;
|
||||
},
|
||||
updateMetricUnit: function () {
|
||||
this.HeaderFooterPanel.updateMetricUnit();
|
||||
this.ParagraphPanel.updateMetricUnit();
|
||||
this.ImagePanel.updateMetricUnit();
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
var me = this;
|
||||
me.panelHolder = Ext.create("Ext.container.Container", {
|
||||
layout: {
|
||||
type: "anchor"
|
||||
},
|
||||
items: [me.TabPanel = Ext.create("Ext.panel.Panel", {
|
||||
hidden: true,
|
||||
id: "view-tab-panel",
|
||||
cls: "asc-right-tabpanel",
|
||||
preventHeader: true,
|
||||
layout: "card",
|
||||
items: [me.ParagraphPanel = Ext.create("DE.view.ParagraphSettings", {
|
||||
id: "view-paragraph-settings",
|
||||
cls: "asc-right-panel",
|
||||
type: c_oAscTypeSelectElement.Paragraph
|
||||
}), me.TablePanel = Ext.create("DE.view.TableSettings", {
|
||||
id: "view-table-settings",
|
||||
cls: "asc-right-panel",
|
||||
type: c_oAscTypeSelectElement.Table
|
||||
}), me.ImagePanel = Ext.create("DE.view.ImageSettings", {
|
||||
id: "view-image-settings",
|
||||
cls: "asc-right-panel",
|
||||
type: c_oAscTypeSelectElement.Image
|
||||
}), me.HeaderFooterPanel = Ext.create("DE.view.HeaderFooterSettings", {
|
||||
id: "view-headerfooter-settings",
|
||||
cls: "asc-right-panel",
|
||||
type: c_oAscTypeSelectElement.Header
|
||||
}), me.ShapePanel = Ext.create("DE.view.ShapeSettings", {
|
||||
id: "view-shape-settings",
|
||||
cls: "asc-right-panel",
|
||||
type: c_oAscTypeSelectElement.Shape
|
||||
})],
|
||||
listeners: {
|
||||
afterlayout: function () {
|
||||
me.updateScrollPane();
|
||||
}
|
||||
}
|
||||
})],
|
||||
listeners: {
|
||||
afterlayout: function () {
|
||||
me.updateScrollPane();
|
||||
}
|
||||
}
|
||||
});
|
||||
me.add(me.panelHolder);
|
||||
me._settings = [];
|
||||
me._settings[c_oAscTypeSelectElement.Paragraph] = {
|
||||
panel: me.ParagraphPanel,
|
||||
btn: me.btnText,
|
||||
hidden: 1,
|
||||
locked: false
|
||||
};
|
||||
me._settings[c_oAscTypeSelectElement.Table] = {
|
||||
panel: me.TablePanel,
|
||||
btn: me.btnTable,
|
||||
hidden: 1,
|
||||
locked: false
|
||||
};
|
||||
me._settings[c_oAscTypeSelectElement.Image] = {
|
||||
panel: me.ImagePanel,
|
||||
btn: me.btnImage,
|
||||
hidden: 1,
|
||||
locked: false
|
||||
};
|
||||
me._settings[c_oAscTypeSelectElement.Header] = {
|
||||
panel: me.HeaderFooterPanel,
|
||||
btn: me.btnHeaderFooter,
|
||||
hidden: 1,
|
||||
locked: false,
|
||||
needShow: true
|
||||
};
|
||||
me._settings[c_oAscTypeSelectElement.Shape] = {
|
||||
panel: me.ShapePanel,
|
||||
btn: me.btnShape,
|
||||
hidden: 1,
|
||||
locked: false
|
||||
};
|
||||
if (this.api) {
|
||||
this.HeaderFooterPanel.setApi(this.api);
|
||||
this.ImagePanel.setApi(this.api);
|
||||
this.ParagraphPanel.setApi(this.api);
|
||||
this.TablePanel.setApi(this.api);
|
||||
this.ShapePanel.setApi(this.api);
|
||||
this.api.asc_registerCallback("asc_onFocusObject", Ext.bind(this.onFocusObject, this));
|
||||
}
|
||||
if (this.editMode && this.api) {
|
||||
var selectedElements = this.api.getSelectedElements();
|
||||
if (selectedElements.length > 0) {
|
||||
this.onFocusObject(selectedElements);
|
||||
}
|
||||
}
|
||||
if (this.effectcolors && this.standartcolors) {
|
||||
this.ShapePanel.SendThemeColors(this.effectcolors, this.standartcolors);
|
||||
this.TablePanel.SendThemeColors(this.effectcolors, this.standartcolors);
|
||||
this.ParagraphPanel.SendThemeColors(this.effectcolors, this.standartcolors);
|
||||
}
|
||||
}
|
||||
});
|
||||
3916
OfficeWeb/apps/documenteditor/main/app/view/ShapeSettings.js
Normal file
3916
OfficeWeb/apps/documenteditor/main/app/view/ShapeSettings.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,546 @@
|
||||
/*
|
||||
* (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.view.ShapeSettingsAdvancedCnt", {
|
||||
extend: "Ext.container.Container",
|
||||
alias: "widget.peshapesettingsadvancedcnt",
|
||||
requires: ["Ext.form.field.ComboBox", "Ext.data.Model", "Ext.data.Store", "Ext.Array", "Ext.button.Button"],
|
||||
cls: "image-advanced-container",
|
||||
height: 330,
|
||||
width: 320,
|
||||
layout: {
|
||||
type: "vbox",
|
||||
align: "stretch"
|
||||
},
|
||||
initComponent: function () {
|
||||
var me = this;
|
||||
this._originalProps = null;
|
||||
this._changedProps = null;
|
||||
this._beginSizeIdx = 0;
|
||||
this._endSizeIdx = 0;
|
||||
this._arrCapType = [[c_oAscLineCapType.Flat, this.textFlat], [c_oAscLineCapType.Round, this.textRound], [c_oAscLineCapType.Square, this.textSquare]];
|
||||
this.cmbCapType = Ext.create("Ext.form.field.ComboBox", {
|
||||
id: "shape-advanced-cap-type",
|
||||
width: 100,
|
||||
editable: false,
|
||||
store: this._arrCapType,
|
||||
queryMode: "local",
|
||||
triggerAction: "all",
|
||||
listeners: {
|
||||
select: Ext.bind(function (combo, records, eOpts) {
|
||||
if (this._changedProps) {
|
||||
if (this._changedProps.get_stroke() === null) {
|
||||
this._changedProps.put_stroke(new CAscStroke());
|
||||
}
|
||||
this._changedProps.get_stroke().put_linecap(me._arrCapType[records[0].index][0]);
|
||||
}
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.cmbCapType.setValue(this._arrCapType[0][1]);
|
||||
this._arrJoinType = [[c_oAscLineJoinType.Round, this.textRound], [c_oAscLineJoinType.Bevel, this.textBevel], [c_oAscLineJoinType.Miter, this.textMiter]];
|
||||
this.cmbJoinType = Ext.create("Ext.form.field.ComboBox", {
|
||||
id: "shape-advanced-join-type",
|
||||
width: 100,
|
||||
editable: false,
|
||||
store: this._arrJoinType,
|
||||
queryMode: "local",
|
||||
triggerAction: "all",
|
||||
listeners: {
|
||||
select: Ext.bind(function (combo, records, eOpts) {
|
||||
if (this._changedProps) {
|
||||
if (this._changedProps.get_stroke() === null) {
|
||||
this._changedProps.put_stroke(new CAscStroke());
|
||||
}
|
||||
this._changedProps.get_stroke().put_linejoin(me._arrJoinType[records[0].index][0]);
|
||||
}
|
||||
},
|
||||
this)
|
||||
}
|
||||
});
|
||||
this.cmbJoinType.setValue(this._arrJoinType[0][1]);
|
||||
this.styleURL = "resources/img/right-panels/Begin-EndStyle.png";
|
||||
this.styleURL2x = "resources/img/right-panels/Begin-EndStyle@2x.png";
|
||||
var _arrStyles = [],
|
||||
_arrSize = [];
|
||||
var _styleTypes = [c_oAscLineBeginType.None, c_oAscLineBeginType.Triangle, c_oAscLineBeginType.Arrow, c_oAscLineBeginType.Stealth, c_oAscLineBeginType.Diamond, c_oAscLineBeginType.Oval];
|
||||
var _sizeTypes = [c_oAscLineBeginSize.small_small, c_oAscLineBeginSize.small_mid, c_oAscLineBeginSize.small_large, c_oAscLineBeginSize.mid_small, c_oAscLineBeginSize.mid_mid, c_oAscLineBeginSize.mid_large, c_oAscLineBeginSize.large_small, c_oAscLineBeginSize.large_mid, c_oAscLineBeginSize.large_large];
|
||||
for (var i = 0; i < 6; i++) {
|
||||
var item = {
|
||||
value: i,
|
||||
imagewidth: 44,
|
||||
imageheight: 20,
|
||||
offsetx: 80 * i + 10,
|
||||
offsety: 0
|
||||
};
|
||||
item.borderstyle = Ext.String.format("background:url({0}) {3}px {4}px; width:{1}px; height:{2}px; background-image: -webkit-image-set(url({0}) 1x, url({5}) 2x);", this.styleURL, item.imagewidth, item.imageheight, -item.offsetx, -item.offsety, this.styleURL2x);
|
||||
_arrStyles.push(item);
|
||||
}
|
||||
_arrStyles[0].type = c_oAscLineBeginType.None;
|
||||
_arrStyles[1].type = c_oAscLineBeginType.Triangle;
|
||||
_arrStyles[2].type = c_oAscLineBeginType.Arrow;
|
||||
_arrStyles[3].type = c_oAscLineBeginType.Stealth;
|
||||
_arrStyles[4].type = c_oAscLineBeginType.Diamond;
|
||||
_arrStyles[5].type = c_oAscLineBeginType.Oval;
|
||||
for (i = 0; i < 9; i++) {
|
||||
var item = {
|
||||
value: i,
|
||||
imagewidth: 44,
|
||||
imageheight: 20,
|
||||
offsetx: 80 + 10,
|
||||
offsety: 20 * (i + 1)
|
||||
};
|
||||
item.borderstyle = Ext.String.format("background:url({0}) {3}px {4}px; width:{1}px; height:{2}px; background-image: -webkit-image-set(url({0}) 1x, url({5}) 2x);", this.styleURL, item.imagewidth, item.imageheight, -item.offsetx, -item.offsety, this.styleURL2x);
|
||||
_arrSize.push(item);
|
||||
}
|
||||
_arrSize[0].type = c_oAscLineBeginSize.small_small;
|
||||
_arrSize[1].type = c_oAscLineBeginSize.small_mid;
|
||||
_arrSize[2].type = c_oAscLineBeginSize.small_large;
|
||||
_arrSize[3].type = c_oAscLineBeginSize.mid_small;
|
||||
_arrSize[4].type = c_oAscLineBeginSize.mid_mid;
|
||||
_arrSize[5].type = c_oAscLineBeginSize.mid_large;
|
||||
_arrSize[6].type = c_oAscLineBeginSize.large_small;
|
||||
_arrSize[7].type = c_oAscLineBeginSize.large_mid;
|
||||
_arrSize[8].type = c_oAscLineBeginSize.large_large;
|
||||
var beginStyleStore = Ext.create("Ext.data.Store", {
|
||||
model: "DE.model.ModelBorders",
|
||||
data: _arrStyles
|
||||
});
|
||||
var beginSizeStore = Ext.create("Ext.data.Store", {
|
||||
model: "DE.model.ModelBorders",
|
||||
data: _arrSize
|
||||
});
|
||||
for (i = 0; i < _arrStyles.length; i++) {
|
||||
var item = _arrStyles[i];
|
||||
item.borderstyle = Ext.String.format("background:url({0}) {3}px {4}px; width:{1}px; height:{2}px; background-image: -webkit-image-set(url({0}) 1x, url({5}) 2x);", this.styleURL, item.imagewidth, item.imageheight, -item.offsetx, -(item.offsety + 200), this.styleURL2x);
|
||||
}
|
||||
for (i = 0; i < _arrSize.length; i++) {
|
||||
var item = _arrSize[i];
|
||||
item.borderstyle = Ext.String.format("background:url({0}) {3}px {4}px; width:{1}px; height:{2}px; background-image: -webkit-image-set(url({0}) 1x, url({5}) 2x);", this.styleURL, item.imagewidth, item.imageheight, -item.offsetx, -(item.offsety + 200), this.styleURL2x);
|
||||
}
|
||||
var endStyleStore = Ext.create("Ext.data.Store", {
|
||||
model: "DE.model.ModelBorders",
|
||||
data: _arrStyles
|
||||
});
|
||||
var endSizeStore = Ext.create("Ext.data.Store", {
|
||||
model: "DE.model.ModelBorders",
|
||||
data: _arrSize
|
||||
});
|
||||
this._updateSizeArr = function (sizecombo, record, type, sizeidx) {
|
||||
var style = Ext.String.format("background:url({0}) repeat scroll 0 -1px", "resources/img/controls/text-bg.gif");
|
||||
if (record.data.value > 0) {
|
||||
for (var i = 0; i < _arrSize.length; i++) {
|
||||
_arrSize[i].offsetx = record.data.value * 80 + 10;
|
||||
_arrSize[i].borderstyle = Ext.String.format("background:url({0}) {3}px {4}px; width:{1}px; height:{2}px; background-image: -webkit-image-set(url({0}) 1x, url({5}) 2x);", me.styleURL, _arrSize[i].imagewidth, _arrSize[i].imageheight, -_arrSize[i].offsetx, -(_arrSize[i].offsety + 200 * type), this.styleURL2x);
|
||||
}
|
||||
sizecombo.menu.picker.store.loadData(_arrSize);
|
||||
sizecombo.setDisabled(false);
|
||||
if (sizeidx !== null) {
|
||||
sizecombo.menu.picker.selectByIndex(sizeidx, true);
|
||||
me._selectStyleItem(sizecombo, sizecombo.menu.picker.store.getAt(sizeidx), type);
|
||||
} else {
|
||||
Ext.DomHelper.applyStyles(sizecombo.btnEl, style);
|
||||
}
|
||||
} else {
|
||||
Ext.DomHelper.applyStyles(sizecombo.btnEl, style);
|
||||
sizecombo.setDisabled(true);
|
||||
}
|
||||
};
|
||||
this._selectStyleItem = function (stylecombo, record, type) {
|
||||
var style;
|
||||
if (stylecombo.btnEl) {
|
||||
style = Ext.String.format("background:url({0}) repeat scroll {1}px {2}px, url({3}) repeat scroll 0 -1px;", me.styleURL, -(record.data.offsetx - 20), -(record.data.offsety + 200 * type), "resources/img/controls/text-bg.gif");
|
||||
style += Ext.String.format("background-image: -webkit-image-set(url({0}) 1x, url({1}) 2x), -webkit-image-set(url({2}) 1x, url({3}) 2x);", me.styleURL, me.styleURL2x, "resources/img/controls/text-bg.gif", "resources/img/controls/text-bg@2x.gif");
|
||||
Ext.DomHelper.applyStyles(stylecombo.btnEl, style);
|
||||
}
|
||||
};
|
||||
var endStyleTpl = Ext.create("Ext.XTemplate", '<tpl for=".">', '<div class="thumb-wrap">', '<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" align="left" style="{borderstyle}"" />', "</div>", "</tpl>");
|
||||
this._btnBeginStyle = Ext.create("Ext.button.Button", {
|
||||
width: 100,
|
||||
cls: "btn-combo-style",
|
||||
pressedCls: "",
|
||||
menu: this.BeginStyleMenu = Ext.create("Common.component.MenuDataViewPicker", {
|
||||
width: 115,
|
||||
height: 92,
|
||||
cls: "arrow-view",
|
||||
dataTpl: endStyleTpl,
|
||||
viewData: [],
|
||||
store: beginStyleStore,
|
||||
contentWidth: 95,
|
||||
listeners: {
|
||||
select: Ext.bind(function (picker, record) {
|
||||
if (me._changedProps) {
|
||||
if (this._changedProps.get_stroke() === null) {
|
||||
this._changedProps.put_stroke(new CAscStroke());
|
||||
}
|
||||
this._changedProps.get_stroke().put_linebeginstyle(record.data.type);
|
||||
}
|
||||
if (this._beginSizeIdx === null || this._beginSizeIdx === undefined) {
|
||||
this._beginSizeIdx = 4;
|
||||
}
|
||||
me._updateSizeArr(me._btnBeginSize, record, 0, this._beginSizeIdx);
|
||||
me._selectStyleItem(me._btnBeginStyle, record, 0);
|
||||
},
|
||||
me),
|
||||
hide: function () {
|
||||
me.fireEvent("editcomplete", me);
|
||||
}
|
||||
}
|
||||
}),
|
||||
listeners: {
|
||||
afterRender: function () {
|
||||
me._selectStyleItem(this, this.menu.picker.store.getAt(1), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
this._btnEndStyle = Ext.create("Ext.button.Button", {
|
||||
width: 100,
|
||||
cls: "btn-combo-style",
|
||||
pressedCls: "",
|
||||
menu: this.EndStyleMenu = Ext.create("Common.component.MenuDataViewPicker", {
|
||||
width: 115,
|
||||
height: 92,
|
||||
cls: "arrow-view",
|
||||
dataTpl: endStyleTpl,
|
||||
viewData: [],
|
||||
store: endStyleStore,
|
||||
contentWidth: 95,
|
||||
listeners: {
|
||||
select: Ext.bind(function (picker, record) {
|
||||
if (me._changedProps) {
|
||||
if (this._changedProps.get_stroke() === null) {
|
||||
this._changedProps.put_stroke(new CAscStroke());
|
||||
}
|
||||
this._changedProps.get_stroke().put_lineendstyle(record.data.type);
|
||||
}
|
||||
if (this._endSizeIdx === null || this._endSizeIdx === undefined) {
|
||||
this._endSizeIdx = 4;
|
||||
}
|
||||
me._updateSizeArr(me._btnEndSize, record, 1, this._endSizeIdx);
|
||||
me._selectStyleItem(me._btnEndStyle, record, 1);
|
||||
},
|
||||
me),
|
||||
hide: function () {
|
||||
me.fireEvent("editcomplete", me);
|
||||
}
|
||||
}
|
||||
}),
|
||||
listeners: {
|
||||
afterRender: function () {
|
||||
me._selectStyleItem(this, this.menu.picker.store.getAt(1), 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
this._btnBeginSize = Ext.create("Ext.button.Button", {
|
||||
width: 100,
|
||||
cls: "btn-combo-style",
|
||||
pressedCls: "",
|
||||
menu: this.BeginSizeMenu = Ext.create("Common.component.MenuDataViewPicker", {
|
||||
width: 167,
|
||||
height: 92,
|
||||
cls: "arrow-view",
|
||||
dataTpl: endStyleTpl,
|
||||
viewData: [],
|
||||
store: beginSizeStore,
|
||||
contentWidth: 147,
|
||||
listeners: {
|
||||
select: Ext.bind(function (picker, record) {
|
||||
if (me._changedProps) {
|
||||
if (this._changedProps.get_stroke() === null) {
|
||||
this._changedProps.put_stroke(new CAscStroke());
|
||||
}
|
||||
this._changedProps.get_stroke().put_linebeginsize(record.data.type);
|
||||
}
|
||||
this._beginSizeIdx = record.data.value;
|
||||
me._selectStyleItem(me._btnBeginSize, record, 0);
|
||||
},
|
||||
me),
|
||||
hide: function () {
|
||||
me.fireEvent("editcomplete", me);
|
||||
}
|
||||
}
|
||||
}),
|
||||
listeners: {
|
||||
afterRender: function () {
|
||||
me._selectStyleItem(this, this.menu.picker.store.getAt(1), 0);
|
||||
}
|
||||
}
|
||||
});
|
||||
this._btnEndSize = Ext.create("Ext.button.Button", {
|
||||
width: 100,
|
||||
cls: "btn-combo-style",
|
||||
pressedCls: "",
|
||||
menu: this.BeginSizeMenu = Ext.create("Common.component.MenuDataViewPicker", {
|
||||
width: 167,
|
||||
height: 92,
|
||||
cls: "arrow-view",
|
||||
dataTpl: endStyleTpl,
|
||||
viewData: [],
|
||||
store: endSizeStore,
|
||||
contentWidth: 147,
|
||||
listeners: {
|
||||
select: Ext.bind(function (picker, record) {
|
||||
if (me._changedProps) {
|
||||
if (this._changedProps.get_stroke() === null) {
|
||||
this._changedProps.put_stroke(new CAscStroke());
|
||||
}
|
||||
this._changedProps.get_stroke().put_lineendsize(record.data.type);
|
||||
}
|
||||
this._endSizeIdx = record.data.value;
|
||||
me._selectStyleItem(me._btnEndSize, record, 1);
|
||||
},
|
||||
me),
|
||||
hide: function () {
|
||||
me.fireEvent("editcomplete", me);
|
||||
}
|
||||
}
|
||||
}),
|
||||
listeners: {
|
||||
afterRender: function () {
|
||||
me._selectStyleItem(this, this.menu.picker.store.getAt(1), 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
this._spacer = Ext.create("Ext.toolbar.Spacer", {
|
||||
width: "100%",
|
||||
height: 10,
|
||||
html: '<div style="width: 100%; height: 40%; border-bottom: 1px solid #C7C7C7"></div>'
|
||||
});
|
||||
this.items = [{
|
||||
xtype: "label",
|
||||
style: "font-weight: bold;margin-top: 1px; padding-left:10px;height:13px;",
|
||||
text: this.textLineStyle
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 8
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 40,
|
||||
padding: "0 10",
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 2,
|
||||
tdAttrs: {
|
||||
style: "padding-right: 40px;vertical-align: middle;"
|
||||
}
|
||||
},
|
||||
items: [{
|
||||
xtype: "label",
|
||||
text: this.textCapType,
|
||||
width: 85
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
text: this.textJoinType,
|
||||
width: 85
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 2
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 2
|
||||
},
|
||||
this.cmbCapType, this.cmbJoinType]
|
||||
},
|
||||
this._spacer.cloneConfig({
|
||||
style: "margin: 16px 0 11px 0;",
|
||||
height: 6
|
||||
}), {
|
||||
xtype: "label",
|
||||
style: "font-weight: bold;margin-top: 1px; padding-left:10px;height:13px;",
|
||||
text: this.textArrows
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 8
|
||||
},
|
||||
{
|
||||
xtype: "container",
|
||||
height: 86,
|
||||
padding: "0 10",
|
||||
layout: {
|
||||
type: "table",
|
||||
columns: 2,
|
||||
tdAttrs: {
|
||||
style: "padding-right: 40px;vertical-align: middle;"
|
||||
}
|
||||
},
|
||||
items: [{
|
||||
xtype: "label",
|
||||
text: this.textBeginStyle,
|
||||
width: 85
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
text: this.textEndStyle,
|
||||
width: 85
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 2
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 2
|
||||
},
|
||||
this._btnBeginStyle, this._btnEndStyle, {
|
||||
xtype: "tbspacer",
|
||||
height: 5
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 5
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
text: this.textBeginSize,
|
||||
width: 85
|
||||
},
|
||||
{
|
||||
xtype: "label",
|
||||
text: this.textEndSize,
|
||||
width: 85
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 2
|
||||
},
|
||||
{
|
||||
xtype: "tbspacer",
|
||||
height: 2
|
||||
},
|
||||
this._btnBeginSize, this._btnEndSize]
|
||||
}];
|
||||
this.callParent(arguments);
|
||||
},
|
||||
afterRender: function () {
|
||||
this.callParent(arguments);
|
||||
},
|
||||
setSettings: function (props) {
|
||||
this._originalProps = props;
|
||||
this._changedProps = null;
|
||||
},
|
||||
_setDefaults: function (props) {
|
||||
if (props) {
|
||||
var stroke = props.get_stroke();
|
||||
if (stroke) {
|
||||
var value = stroke.get_linejoin();
|
||||
for (var i = 0; i < this._arrJoinType.length; i++) {
|
||||
if (value == this._arrJoinType[i][0]) {
|
||||
this.cmbJoinType.setValue(this._arrJoinType[i][1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
value = stroke.get_linecap();
|
||||
for (i = 0; i < this._arrCapType.length; i++) {
|
||||
if (value == this._arrCapType[i][0]) {
|
||||
this.cmbCapType.setValue(this._arrCapType[i][1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var canchange = stroke.get_canChangeArrows();
|
||||
this._btnBeginStyle.setDisabled(!canchange);
|
||||
this._btnEndStyle.setDisabled(!canchange);
|
||||
this._btnBeginSize.setDisabled(!canchange);
|
||||
this._btnEndSize.setDisabled(!canchange);
|
||||
var style = Ext.String.format("background:url({0}) repeat scroll 0 -1px", "resources/img/controls/text-bg.gif");
|
||||
if (canchange) {
|
||||
value = stroke.get_linebeginsize();
|
||||
var rec = this._btnBeginSize.menu.picker.store.findRecord("type", value);
|
||||
if (rec !== null) {
|
||||
this._beginSizeIdx = rec.data.value;
|
||||
} else {
|
||||
this._beginSizeIdx = null;
|
||||
Ext.DomHelper.applyStyles(this._btnBeginSize.btnEl, style);
|
||||
}
|
||||
value = stroke.get_linebeginstyle();
|
||||
rec = this._btnBeginStyle.menu.picker.store.findRecord("type", value);
|
||||
if (rec !== null) {
|
||||
this._btnBeginStyle.menu.picker.selectByIndex(rec.data.value, false);
|
||||
this._updateSizeArr(this._btnBeginSize, rec, 0, this._beginSizeIdx);
|
||||
this._selectStyleItem(this._btnBeginStyle, rec, 0);
|
||||
} else {
|
||||
Ext.DomHelper.applyStyles(this._btnBeginStyle.btnEl, style);
|
||||
}
|
||||
value = stroke.get_lineendsize();
|
||||
rec = this._btnEndSize.menu.picker.store.findRecord("type", value);
|
||||
if (rec !== null) {
|
||||
this._endSizeIdx = rec.data.value;
|
||||
} else {
|
||||
this._endSizeIdx = null;
|
||||
Ext.DomHelper.applyStyles(this._btnEndSize.btnEl, style);
|
||||
}
|
||||
value = stroke.get_lineendstyle();
|
||||
rec = this._btnEndStyle.menu.picker.store.findRecord("type", value);
|
||||
if (rec !== null) {
|
||||
this._btnEndStyle.menu.picker.selectByIndex(rec.data.value, false);
|
||||
this._updateSizeArr(this._btnEndSize, rec, 1, this._endSizeIdx);
|
||||
this._selectStyleItem(this._btnEndStyle, rec, 1);
|
||||
} else {
|
||||
Ext.DomHelper.applyStyles(this._btnEndStyle.btnEl, style);
|
||||
}
|
||||
} else {
|
||||
Ext.DomHelper.applyStyles(this._btnBeginStyle.btnEl, style);
|
||||
Ext.DomHelper.applyStyles(this._btnEndStyle.btnEl, style);
|
||||
Ext.DomHelper.applyStyles(this._btnBeginSize.btnEl, style);
|
||||
Ext.DomHelper.applyStyles(this._btnEndSize.btnEl, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
this._changedProps = new CAscShapeProp();
|
||||
},
|
||||
getSettings: function () {
|
||||
return this._changedProps;
|
||||
},
|
||||
textRound: "Round",
|
||||
textMiter: "Miter",
|
||||
textSquare: "Square",
|
||||
textFlat: "Flat",
|
||||
textBevel: "Bevel",
|
||||
textTitle: "Shape - Advanced Settings",
|
||||
cancelButtonText: "Cancel",
|
||||
okButtonText: "Ok",
|
||||
txtNone: "None",
|
||||
textWeightArrows: "Weights & Arrows",
|
||||
textArrows: "Arrows",
|
||||
textLineStyle: "Line Style",
|
||||
textCapType: "Cap Type",
|
||||
textJoinType: "Join Type",
|
||||
textBeginStyle: "Begin Style",
|
||||
textBeginSize: "Begin Size",
|
||||
textEndStyle: "End Style",
|
||||
textEndSize: "End Size"
|
||||
});
|
||||
1987
OfficeWeb/apps/documenteditor/main/app/view/TableSettings.js
Normal file
1987
OfficeWeb/apps/documenteditor/main/app/view/TableSettings.js
Normal file
File diff suppressed because it is too large
Load Diff
4105
OfficeWeb/apps/documenteditor/main/app/view/TableSettingsAdvanced.js
Normal file
4105
OfficeWeb/apps/documenteditor/main/app/view/TableSettingsAdvanced.js
Normal file
File diff suppressed because it is too large
Load Diff
2227
OfficeWeb/apps/documenteditor/main/app/view/Toolbar.js
Normal file
2227
OfficeWeb/apps/documenteditor/main/app/view/Toolbar.js
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* (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.view.UndockedWindow", {
|
||||
extend: "Ext.window.Window",
|
||||
cls: "asc-right-panel-undocked",
|
||||
constrain: true,
|
||||
closable: false,
|
||||
resizable: false,
|
||||
shadow: false,
|
||||
ghost: function () {
|
||||
var instance = this.callParent(arguments);
|
||||
if (!instance.getEl().hasCls("asc-right-panel-undocked-ghost")) {
|
||||
instance.getEl().addCls("asc-right-panel-undocked-ghost");
|
||||
}
|
||||
return instance;
|
||||
},
|
||||
constructor: function (config) {
|
||||
this.callParent(arguments);
|
||||
this.initConfig(config);
|
||||
return this;
|
||||
},
|
||||
initComponent: function () {
|
||||
this.callParent(arguments);
|
||||
}
|
||||
});
|
||||
314
OfficeWeb/apps/documenteditor/main/app/view/Viewport.js
Normal file
314
OfficeWeb/apps/documenteditor/main/app/view/Viewport.js
Normal file
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
* (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.view.Viewport", {
|
||||
extend: "Ext.container.Viewport",
|
||||
alias: "widget.deviewport",
|
||||
layout: "fit",
|
||||
requires: ["Common.view.Header", "Common.view.About", "DE.view.DocumentHolder", "DE.view.MainMenu", "DE.view.File", "DE.view.DocumentStatusInfo", "Common.view.ChatPanel"],
|
||||
uses: ["DE.view.Toolbar", "DE.view.RightMenu", "DE.view.CreateFile", "DE.view.RecentFiles", "Common.view.CommentsPanel"],
|
||||
initComponent: function () {
|
||||
this.header = Ext.widget("commonheader", {
|
||||
config: {
|
||||
headerCaption: "Document Editor"
|
||||
}
|
||||
});
|
||||
this._documentHolder = Ext.widget("dedocumentholder", {
|
||||
id: "editor_sdk",
|
||||
flex: 1,
|
||||
maintainFlex: true,
|
||||
style: "background-color:#b0b0b0;"
|
||||
});
|
||||
this.applicationUI = Ext.widget("container", {
|
||||
layout: {
|
||||
type: "vbox",
|
||||
align: "stretch"
|
||||
},
|
||||
flex: 1,
|
||||
hidden: true,
|
||||
items: [{
|
||||
xtype: "container",
|
||||
flex: 1,
|
||||
layout: {
|
||||
type: "hbox",
|
||||
align: "stretch"
|
||||
},
|
||||
items: [{
|
||||
xtype: "demainmenu",
|
||||
id: "view-main-menu",
|
||||
maxWidth: 600,
|
||||
buttonCollection: [{
|
||||
cls: "menuFile",
|
||||
id: "id-menu-file",
|
||||
tooltip: this.tipFile + " (Alt+F)",
|
||||
scale: "full",
|
||||
disabled: true,
|
||||
items: [{
|
||||
xtype: "defile",
|
||||
id: "main-menu-file-options",
|
||||
width: "100%",
|
||||
height: "100%"
|
||||
}]
|
||||
},
|
||||
{
|
||||
cls: "menuSearch",
|
||||
id: "id-menu-search",
|
||||
scale: "modal",
|
||||
disabled: true,
|
||||
tooltip: this.tipSearch + " (Ctrl+F)"
|
||||
},
|
||||
{
|
||||
cls: "menuComments",
|
||||
id: "id-menu-comments",
|
||||
hideMode: "display",
|
||||
scale: 300,
|
||||
tooltip: this.tipComments + " (Ctrl+Shift+H)",
|
||||
disabled: true,
|
||||
items: [{
|
||||
xtype: "commoncommentspanel",
|
||||
height: "100%"
|
||||
}]
|
||||
},
|
||||
{
|
||||
cls: "menuChat",
|
||||
id: "id-menu-chat",
|
||||
scale: 300,
|
||||
tooltip: this.tipChat + " (Ctrl+Alt+Q)",
|
||||
disabled: true,
|
||||
items: [{
|
||||
xtype: "commonchatpanel",
|
||||
height: "100%"
|
||||
}]
|
||||
},
|
||||
{
|
||||
cls: "menuAbout",
|
||||
id: "id-menu-about",
|
||||
tooltip: "About",
|
||||
scale: "full",
|
||||
disabled: true,
|
||||
items: [{
|
||||
xtype: "commonabout",
|
||||
id: "main-menu-about",
|
||||
width: "100%",
|
||||
height: "100%"
|
||||
}]
|
||||
}],
|
||||
listeners: {
|
||||
panelshow: Ext.bind(function (panel, fullScale) {
|
||||
if (fullScale) {
|
||||
var btn = Ext.getCmp("id-menu-search");
|
||||
if (btn.pressed) {
|
||||
btn.toggle();
|
||||
}
|
||||
} else {
|
||||
this._documentHolder.changePosition();
|
||||
}
|
||||
},
|
||||
this),
|
||||
panelhide: Ext.bind(function (panel, fullScale) {
|
||||
if (!fullScale) {
|
||||
this._documentHolder.changePosition();
|
||||
}
|
||||
},
|
||||
this)
|
||||
}
|
||||
},
|
||||
{
|
||||
xtype: "splitter",
|
||||
id: "main-menu-splitter",
|
||||
cls: "splitter-document-area",
|
||||
defaultSplitMin: 300,
|
||||
hidden: true
|
||||
},
|
||||
this._documentHolder]
|
||||
},
|
||||
this._documentStatus = Ext.widget("documentstatusinfo", {
|
||||
id: "view-status"
|
||||
})]
|
||||
});
|
||||
this.items = {
|
||||
xtype: "container",
|
||||
layout: {
|
||||
type: "vbox",
|
||||
align: "stretch"
|
||||
},
|
||||
items: [this.header, this.applicationUI]
|
||||
};
|
||||
this.callParent(arguments);
|
||||
},
|
||||
checkCanHotKey: function () {
|
||||
var winElements = Ext.getDoc().query(".x-window");
|
||||
for (var i = 0; i < winElements.length; i++) {
|
||||
var cmp = Ext.getCmp(winElements[i].id);
|
||||
if (cmp && cmp.isVisible() && cmp.modal) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
applyMode: function () {
|
||||
this.hkSaveAs[this.mode.canDownload ? "enable" : "disable"]();
|
||||
this.hkChat[this.mode.canCoAuthoring ? "enable" : "disable"]();
|
||||
this.hkComments[(this.mode.canCoAuthoring && this.mode.isEdit) ? "enable" : "disable"]();
|
||||
},
|
||||
setMode: function (mode, delay) {
|
||||
if (mode.isDisconnected) {
|
||||
if (this.mode === undefined) {
|
||||
this.mode = {};
|
||||
}
|
||||
this.mode.canCoAuthoring = false;
|
||||
} else {
|
||||
this.mode = mode;
|
||||
}
|
||||
if (!delay) {
|
||||
this.applyMode();
|
||||
}
|
||||
},
|
||||
setApi: function (o) {
|
||||
this.api = o;
|
||||
return this;
|
||||
},
|
||||
applyEditorMode: function () {
|
||||
var me = this;
|
||||
me._toolbar = Ext.widget("detoolbar", {
|
||||
id: "view-toolbar"
|
||||
});
|
||||
me.applicationUI.insert(0, me._toolbar);
|
||||
me._rightMenu = Ext.widget("derightmenu", {
|
||||
id: "view-right-menu"
|
||||
});
|
||||
me.applicationUI.items.items[1].add(me._rightMenu);
|
||||
var value = window.localStorage.getItem("de-hidden-status");
|
||||
if (value !== null && parseInt(value) == 1) {
|
||||
this._documentStatus.setVisible(false);
|
||||
}
|
||||
},
|
||||
createDelayedElements: function () {
|
||||
var _self = this;
|
||||
this.hk = new Ext.util.KeyMap(document, [{
|
||||
key: "f",
|
||||
ctrl: true,
|
||||
shift: false,
|
||||
defaultEventAction: "stopEvent",
|
||||
fn: function () {
|
||||
if (_self.checkCanHotKey()) {
|
||||
var cmp = Ext.getCmp("view-main-menu");
|
||||
if (cmp) {
|
||||
cmp.selectMenu("menuSearch");
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "f",
|
||||
alt: true,
|
||||
shift: false,
|
||||
ctrl: false,
|
||||
defaultEventAction: "stopEvent",
|
||||
fn: function () {
|
||||
if (_self.checkCanHotKey()) {
|
||||
Ext.menu.Manager.hideAll();
|
||||
var cmp = Ext.getCmp("view-main-menu");
|
||||
if (cmp) {
|
||||
cmp.selectMenu("menuFile");
|
||||
}
|
||||
}
|
||||
}
|
||||
}]);
|
||||
this.hkSaveAs = new Ext.util.KeyMap(document, {
|
||||
key: "s",
|
||||
ctrl: true,
|
||||
shift: true,
|
||||
defaultEventAction: "stopEvent",
|
||||
fn: function () {
|
||||
if (_self.checkCanHotKey()) {
|
||||
Ext.menu.Manager.hideAll();
|
||||
var cmp = Ext.getCmp("view-main-menu");
|
||||
if (cmp) {
|
||||
cmp.selectMenu("menuFile");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.hkHelp = new Ext.util.KeyMap(document, {
|
||||
key: Ext.EventObject.F1,
|
||||
ctrl: false,
|
||||
shift: false,
|
||||
defaultEventAction: "stopEvent",
|
||||
scope: this,
|
||||
fn: function () {
|
||||
if (_self.checkCanHotKey()) {
|
||||
Ext.menu.Manager.hideAll();
|
||||
var cmp = Ext.getCmp("view-main-menu");
|
||||
if (cmp) {
|
||||
cmp.selectMenu("menuFile");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.hkChat = new Ext.util.KeyMap(document, {
|
||||
key: "q",
|
||||
ctrl: true,
|
||||
alt: true,
|
||||
shift: false,
|
||||
defaultEventAction: "stopEvent",
|
||||
fn: function () {
|
||||
if (_self.checkCanHotKey()) {
|
||||
var cmp = Ext.getCmp("view-main-menu");
|
||||
if (cmp) {
|
||||
cmp.selectMenu("menuChat");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
this.hkComments = new Ext.util.KeyMap(document, {
|
||||
key: "H",
|
||||
ctrl: true,
|
||||
shift: true,
|
||||
defaultEventAction: "stopEvent",
|
||||
fn: function () {
|
||||
if (_self.checkCanHotKey()) {
|
||||
var cmp = Ext.getCmp("view-main-menu");
|
||||
if (cmp) {
|
||||
cmp.selectMenu("menuComments");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Ext.tip.QuickTipManager.init();
|
||||
this.applyMode();
|
||||
},
|
||||
tipFile: "File",
|
||||
tipSearch: "Search",
|
||||
tipComments: "Comments",
|
||||
tipChat: "Chat",
|
||||
tipTitles: "Titles"
|
||||
});
|
||||
Reference in New Issue
Block a user