3.0 source code

This commit is contained in:
agolybev
2015-04-28 17:59:00 +03:00
parent c69fd34bdd
commit 7b3b2248e5
16311 changed files with 1445974 additions and 3108429 deletions

View File

@@ -1,42 +1,40 @@
/*
* (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.FileTemplate", {
extend: "Ext.data.Model",
fields: [{
type: "string",
name: "name"
},
{
type: "string",
name: "icon"
}]
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["backbone", "documenteditor/main/app/model/EquationGroup"], function (Backbone) {
if (Common === undefined) {
var Common = {};
}
Common.Collections = Common.Collections || {};
DE.Collections.EquationGroups = Backbone.Collection.extend({
model: DE.Models.EquationGroup
});
});

View File

@@ -1,35 +1,40 @@
/*
* (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.store.ShapeGroups", {
extend: "Ext.data.Store",
model: "DE.model.ShapeGroup"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["backbone", "documenteditor/main/app/model/ShapeGroup"], function (Backbone) {
if (Common === undefined) {
var Common = {};
}
Common.Collections = Common.Collections || {};
DE.Collections.ShapeGroups = Backbone.Collection.extend({
model: DE.Models.ShapeGroup
});
});

View File

@@ -1,236 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.component.CellStyler", {
extend: "Ext.container.Container",
requires: ["Common.component.util.RGBColor"],
alias: "widget.decellstyler",
clickOffset: 10,
overwriteStyle: true,
maxBorderSize: 6,
halfBorderSize: false,
defaultBorderSize: 1,
defaultBorderColor: "#ccc",
initComponent: function () {
var me = this,
cfg = Ext.apply({},
me.initialConfig),
divContent = undefined,
virtualBorderSize = me.defaultBorderSize,
virtualBorderColor = new Common.util.RGBColor(me.defaultBorderColor);
var borderSize = {
top: virtualBorderSize,
right: virtualBorderSize,
bottom: virtualBorderSize,
left: virtualBorderSize
};
var borderColor = {
top: virtualBorderColor,
right: virtualBorderColor,
bottom: virtualBorderColor,
left: virtualBorderColor
};
var applyStyle = function () {
if (Ext.isDefined(divContent)) {
var drawLeftSize = (me.halfBorderSize) ? ((borderSize.left % 2) ? borderSize.left - 1 : borderSize.left) * 0.5 : borderSize.left,
drawRightSize = (me.halfBorderSize) ? ((borderSize.right % 2) ? borderSize.right + 1 : borderSize.right) * 0.5 : borderSize.right,
drawTopSize = (me.halfBorderSize) ? ((borderSize.top % 2) ? borderSize.top - 1 : borderSize.top) * 0.5 : borderSize.top,
drawBottomSize = (me.halfBorderSize) ? ((borderSize.bottom % 2) ? borderSize.bottom + 1 : borderSize.bottom) * 0.5 : borderSize.bottom;
var value = "inset " + ((drawLeftSize > 0.1 && drawLeftSize < 1) ? 1 : drawLeftSize) + "px" + " 0" + " 0 " + borderColor.left.toRGBA((drawLeftSize < 1) ? 0.5 : 1) + ", " + "inset " + -1 * ((drawRightSize > 0.1 && drawRightSize < 1) ? 1 : drawRightSize) + "px " + " 0" + " 0 " + borderColor.right.toRGBA((drawRightSize < 1) ? 0.5 : 1) + ", " + "inset " + "0 " + ((drawTopSize > 0.1 && drawTopSize < 1) ? 1 : drawTopSize) + "px" + " 0 " + borderColor.top.toRGBA((drawTopSize < 1) ? 0.5 : 1) + ", " + "inset " + "0 " + -1 * ((drawBottomSize > 0.1 && drawBottomSize < 1) ? 1 : drawBottomSize) + "px" + " 0 " + borderColor.bottom.toRGBA((drawBottomSize < 1) ? 0.5 : 1);
divContent.setStyle("box-shadow", value);
}
};
me.setBordersSize = function (borders, size) {
size = (size > me.maxBorderSize) ? me.maxBorderSize : size;
if (borders.indexOf("t") > -1) {
borderSize.top = size;
}
if (borders.indexOf("r") > -1) {
borderSize.right = size;
}
if (borders.indexOf("b") > -1) {
borderSize.bottom = size;
}
if (borders.indexOf("l") > -1) {
borderSize.left = size;
}
applyStyle();
};
me.setBordersColor = function (borders, color) {
var newColor = new Common.util.RGBColor(color);
if (borders.indexOf("t") > -1) {
borderColor.top = newColor;
}
if (borders.indexOf("r") > -1) {
borderColor.right = newColor;
}
if (borders.indexOf("b") > -1) {
borderColor.bottom = newColor;
}
if (borders.indexOf("l") > -1) {
borderColor.left = newColor;
}
applyStyle();
};
me.getBorderSize = function (border) {
switch (border) {
case "t":
return borderSize.top;
case "r":
return borderSize.right;
case "b":
return borderSize.bottom;
case "l":
return borderSize.left;
}
return null;
};
me.getBorderColor = function (border) {
switch (border) {
case "t":
return borderColor.top.toHex();
case "r":
return borderColor.right.toHex();
case "b":
return borderColor.bottom.toHex();
case "l":
return borderColor.left.toHex();
}
return null;
};
me.setVirtualBorderSize = function (size) {
virtualBorderSize = (size > me.maxBorderSize) ? me.maxBorderSize : size;
};
me.setVirtualBorderColor = function (color) {
var newColor = new Common.util.RGBColor(color);
if (virtualBorderColor.isEqual(newColor)) {
return;
}
virtualBorderColor = newColor;
};
me.getVirtualBorderSize = function () {
return virtualBorderSize;
};
me.getVirtualBorderColor = function () {
return virtualBorderColor.toHex();
};
me.addListener("afterrender", function () {
var selfEl = me.getEl();
if (selfEl) {
divContent = selfEl.down(".cell-content");
applyStyle();
}
selfEl.on("click", function (event) {
var pos = {
x: event.browserEvent.offsetX || (Ext.isDefined(event.browserEvent.layerX) ? event.browserEvent.layerX : 0),
y: event.browserEvent.offsetY || (Ext.isDefined(event.browserEvent.layerY) ? event.browserEvent.layerY : 0)
};
var ptInPoly = function (npol, xp, yp, x, y) {
var i, j, c = 0;
for (i = 0, j = npol - 1; i < npol; j = i++) {
if ((((yp[i] <= y) && (y < yp[j])) || ((yp[j] <= y) && (y < yp[i]))) && (x < (xp[j] - xp[i]) * (y - yp[i]) / (yp[j] - yp[i]) + xp[i])) {
c = !c;
}
}
return c;
};
var meWidth = selfEl.getWidth();
var meHeight = selfEl.getHeight();
if (ptInPoly(4, [0, meWidth, meWidth - me.clickOffset, me.clickOffset], [0, 0, me.clickOffset, me.clickOffset], pos.x, pos.y)) {
if (me.overwriteStyle) {
if (borderSize.top != virtualBorderSize || !borderColor.top.isEqual(virtualBorderColor)) {
borderSize.top = virtualBorderSize;
borderColor.top = virtualBorderColor;
} else {
borderSize.top = 0;
}
} else {
borderSize.top = (borderSize.top > 0) ? 0 : virtualBorderSize;
borderColor.top = virtualBorderColor;
}
me.fireEvent("borderclick", me, "t", borderSize.top, borderColor.top.toHex());
} else {
if (ptInPoly(4, [meWidth, meWidth, meWidth - me.clickOffset, meWidth - me.clickOffset], [0, meHeight, meHeight - me.clickOffset, me.clickOffset], pos.x, pos.y)) {
if (me.overwriteStyle) {
if (borderSize.right != virtualBorderSize || !borderColor.right.isEqual(virtualBorderColor)) {
borderSize.right = virtualBorderSize;
borderColor.right = virtualBorderColor;
} else {
borderSize.right = 0;
}
} else {
borderSize.right = (borderSize.right > 0) ? 0 : virtualBorderSize;
borderColor.right = virtualBorderColor;
}
me.fireEvent("borderclick", me, "r", borderSize.right, borderColor.right.toHex());
} else {
if (ptInPoly(4, [0, me.clickOffset, meWidth - me.clickOffset, meWidth], [meHeight, meHeight - me.clickOffset, meHeight - me.clickOffset, meHeight], pos.x, pos.y)) {
if (me.overwriteStyle) {
if (borderSize.bottom != virtualBorderSize || !borderColor.bottom.isEqual(virtualBorderColor)) {
borderSize.bottom = virtualBorderSize;
borderColor.bottom = virtualBorderColor;
} else {
borderSize.bottom = 0;
}
} else {
borderSize.bottom = (borderSize.bottom > 0) ? 0 : virtualBorderSize;
borderColor.bottom = virtualBorderColor;
}
me.fireEvent("borderclick", me, "b", borderSize.bottom, borderColor.bottom.toHex());
} else {
if (ptInPoly(4, [0, me.clickOffset, me.clickOffset, 0], [0, me.clickOffset, meHeight - me.clickOffset, meHeight], pos.x, pos.y)) {
if (me.overwriteStyle) {
if (borderSize.left != virtualBorderSize || !borderColor.left.isEqual(virtualBorderColor)) {
borderSize.left = virtualBorderSize;
borderColor.left = virtualBorderColor;
} else {
borderSize.left = 0;
}
} else {
borderSize.left = (borderSize.left > 0) ? 0 : virtualBorderSize;
borderColor.left = virtualBorderColor;
}
me.fireEvent("borderclick", me, "l", borderSize.left, borderColor.left.toHex());
}
}
}
}
applyStyle();
});
});
Ext.apply(me, {
cls: "tablestyler-cell",
html: '<div class="cell-content" style="width: 100%; height: 100%;"><div class="content-text"></div></div>'
},
cfg);
me.callParent(arguments);
}
});

View File

@@ -1,163 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.component.ComboDropFonts", {
extend: "Ext.form.field.ComboBox",
alias: "widget.decombodropfonts",
queryMode: "local",
matchFieldWidth: false,
displayField: "name",
showlastused: false,
listeners: {
expand: function (picker) {
var combo = this;
var plugin = combo.getPlugin("scrollpane");
if (plugin) {
var doScroll = new Ext.util.DelayedTask(function () {
var node = combo.picker.getNode(combo.lastSelection[0]);
if (node) {
plugin.scrollToElement(node, false, false);
}
});
}
doScroll.delay(10);
}
},
constructor: function (config) {
var me = this;
me.iconHeight = FONT_THUMBNAIL_HEIGHT;
me.iconWidth = 302;
this.addEvents("createpicker");
var item_tpl = Ext.create("Ext.XTemplate", '<tpl for=".">', '<a class="font-item" style="display: block;">', '<img id="{[Ext.id()]}" src="{[this.getImageUri(values)]}" width="{[this.getImageWidth()]}" height="{[this.getImageHeight()]}" style="vertical-align: middle;margin: 0 0 0 -10px;">', "</a>", "</tpl>", {
getImageUri: function (opts) {
if (opts.cloneid) {
return me.picker.listEl.down("#" + opts.cloneid).dom.src;
}
var thumb = document.createElement("canvas");
thumb.width = me.spriteThumbs.width;
thumb.height = me.iconHeight;
var ctx = thumb.getContext("2d");
ctx.save();
ctx.translate(0, -FONT_THUMBNAIL_HEIGHT * opts.imgidx);
ctx.drawImage(me.spriteThumbs, 0, 0);
ctx.restore();
return thumb.toDataURL();
},
getImageWidth: function () {
return me.iconWidth;
},
getImageHeight: function () {
return me.iconHeight;
}
});
Ext.apply(config, {
listConfig: {
id: (Ext.isDefined(config.listId)) ? config.listId : "combo-fonts-list",
emptyText: "no fonts found",
mode: "local",
width: 326,
maxHeight: 468,
height: 468,
minHeight: 150,
itemTpl: item_tpl,
blockRefresh: true,
listeners: {
viewready: function (cmp) {
me.spriteThumbs = undefined;
}
}
}
});
this.initConfig(config);
this.callParent(arguments);
return this;
},
initComponent: function () {
this.addListener("beforequery", this._beforeQuery, this);
this.callParent(arguments);
},
onRender: function (cmp) {
this.callParent(arguments);
this.el.set({
"data-qtip": this.tooltip
});
this.validate();
},
createPicker: function () {
this.callParent(arguments);
if (this.showlastused) {
this.fireEvent("createpicker", this, this.picker);
}
return this.picker;
},
fillFonts: function (arr) {
this._loadSprite();
if (this.getStore().getCount()) {
var rec = this.getStore().findRecord("name", "Times New Roman");
if (rec) {
this.select(rec);
} else {
this.select(this.getStore().getAt(0));
}
}
},
_loadSprite: function () {
var me = this;
me.spriteThumbs = new Image();
me.spriteThumbs.src = window.g_standart_fonts_thumbnail;
},
_beforeQuery: function (qe) {
qe.forceAll = true;
qe.cancel = true;
if (qe.combo) {
qe.combo.expand();
var picker = qe.combo.getPicker();
var index = qe.combo.store.find("name", qe.query);
if (! (index < 0)) {
var node = picker.getNode(qe.combo.store.getAt(index));
if (node) {
picker.highlightItem(node);
var pos_h = picker.listEl.getHeight() / 2 - 30;
var list_t = picker.listEl.getTop();
var offset_y = Ext.get(node).getY() - list_t - pos_h;
if (Math.abs(offset_y) > pos_h) {
var jsp = $("#" + picker.listEl.id).data("jsp");
if (jsp) {
jsp.scrollByY(offset_y, true);
}
}
}
} else {
$("#" + picker.id + " ." + picker.overItemCls).removeClass(picker.overItemCls);
}
}
}
});

View File

@@ -1,124 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.component.DimensionPicker", {
extend: "Ext.Component",
requires: "Ext.XTemplate",
alias: "widget.dedimensionpicker",
baseCls: "x-dimension-picker",
itemSize: 18,
minRows: 5,
minColumns: 5,
maxRows: 20,
maxColumns: 20,
stalign: "bottom",
padding: 4,
clickEvent: "click",
value: null,
renderTpl: ['<div style="width: 100%; height: 100%;">', '<div class="{baseCls}-observecontainer">', '<div class="{baseCls}-mousecatcher"></div>', '<div class="{baseCls}-unhighlighted"></div>', '<div class="{baseCls}-highlighted"></div>', "</div>", '<div class="{baseCls}-status">0x0</div>', "</div>"],
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
initComponent: function () {
var me = this;
var rootEl = undefined;
var areaMouseCatcher = undefined;
var areaUnHighLighted = undefined;
var areaHighLighted = undefined;
var areaStatus = undefined;
var curColumns = 0;
var curRows = 0;
var onCatcherMouseMove = function (event, element, eOpts) {
var pos = [event.browserEvent.layerX || (Ext.isDefined(event.browserEvent.offsetX) ? event.browserEvent.offsetX : 0), event.browserEvent.layerY || (Ext.isDefined(event.browserEvent.offsetY) ? event.browserEvent.offsetY : 0)];
me.setTableSize(Math.floor(pos[0] / this.itemSize), Math.floor(pos[1] / this.itemSize));
};
var onHighLightedMouseMove = function (event, element, eOpts) {
var pos = [event.browserEvent.layerX || (Ext.isDefined(event.browserEvent.offsetX) ? event.browserEvent.offsetX : 0), event.browserEvent.layerY || (Ext.isDefined(event.browserEvent.offsetY) ? event.browserEvent.offsetY : 0)];
me.setTableSize(Math.ceil(pos[0] / this.itemSize), Math.ceil(pos[1] / this.itemSize));
};
var onUnHighLightedMouseMove = function (event, element, eOpts) {
var pos = [event.browserEvent.layerX || (Ext.isDefined(event.browserEvent.offsetX) ? event.browserEvent.offsetX : 0), event.browserEvent.layerY || (Ext.isDefined(event.browserEvent.offsetY) ? event.browserEvent.offsetY : 0)];
me.setTableSize(Math.ceil(pos[0] / this.itemSize), Math.ceil(pos[1] / this.itemSize));
};
var onHighLightedMouseClick = function (event) {
me.fireEvent("select", me, curColumns, curRows);
};
this.setTableSize = function (columns, rows) {
if (columns > this.maxColumns) {
columns = this.maxColumns;
}
if (rows > this.maxRows) {
rows = this.maxRows;
}
if (curColumns != columns || curRows != rows) {
curColumns = columns;
curRows = rows;
areaHighLighted.setSize(curColumns + "em", curRows + "em");
areaUnHighLighted.setSize(((curColumns < me.minColumns) ? me.minColumns : ((curColumns + 1 > me.maxColumns) ? me.maxColumns : curColumns + 1)) + "em", ((curRows < me.minRows) ? me.minRows : ((curRows + 1 > me.maxRows) ? me.maxRows : curRows + 1)) + "em");
rootEl.setWidth(areaUnHighLighted.getWidth());
areaStatus.update(Ext.String.format("{0} x {1}", curColumns, curRows));
areaStatus.setWidth(areaUnHighLighted.getWidth());
me.fireEvent("change", me, curColumns, curRows);
}
};
var onAfterRender = function (ct) {
rootEl = me.getEl();
if (rootEl) {
areaMouseCatcher = rootEl.down("." + me.baseCls + "-mousecatcher");
areaUnHighLighted = rootEl.down("." + me.baseCls + "-unhighlighted");
areaHighLighted = rootEl.down("." + me.baseCls + "-highlighted");
areaStatus = rootEl.down("." + me.baseCls + "-status");
rootEl.setStyle({
width: me.minColumns + "em"
});
areaMouseCatcher.setSize(me.maxColumns + "em", me.maxRows + "em");
areaUnHighLighted.setSize(me.minColumns + "em", me.minRows + "em");
areaStatus.update(Ext.String.format("{0} x {1}", curColumns, curRows));
areaStatus.setWidth(areaUnHighLighted.getWidth());
}
areaMouseCatcher.on("mousemove", onCatcherMouseMove, me);
areaHighLighted.on("mousemove", onHighLightedMouseMove, me);
areaUnHighLighted.on("mousemove", onUnHighLightedMouseMove, me);
areaHighLighted.on("click", onHighLightedMouseClick, me);
};
this.getColumnsCount = function () {
return curColumns;
};
this.getRowsCount = function () {
return curRows;
};
me.on("afterrender", onAfterRender, this);
me.callParent(arguments);
me.addEvents("change", "select");
}
});

View File

@@ -1,87 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.component.MenuDimensionPicker", {
extend: "Ext.menu.Menu",
alias: "widget.demenudimensionpicker",
requires: ["DE.component.DimensionPicker"],
hideOnClick: true,
minWidth: 10,
minHeight: 10,
maxWidth: 1000,
maxHeight: 1000,
minRows: 5,
minColumns: 5,
maxRows: 20,
maxColumns: 20,
baseCls: "dimension-picker-menu",
initComponent: function () {
var me = this,
cfg = Ext.apply({},
me.initialConfig);
delete cfg.listeners;
Ext.apply(me, {
plain: true,
showSeparator: false,
items: Ext.applyIf({
xtype: "dedimensionpicker",
minRows: this.minRows,
minColumns: this.minColumns,
maxRows: this.maxRows,
maxColumns: this.maxColumns
},
cfg)
});
me.callParent(arguments);
me.picker = me.down("dedimensionpicker");
me.relayEvents(me.picker, ["select"]);
if (me.hideOnClick) {
me.on("select", me.hidePickerOnSelect, me);
}
var onPickerChange = function (picker, columns, rows) {
var width = ((columns < me.picker.minColumns) ? me.picker.minColumns : ((columns + 1 > me.picker.maxColumns) ? me.picker.maxColumns : columns + 1));
var height = ((rows < me.picker.minRows) ? me.picker.minRows : ((rows + 1 > me.picker.maxRows) ? me.picker.maxRows : rows + 1));
width = width * me.picker.itemSize + 2 * me.picker.padding;
height = height * me.picker.itemSize + 2 * me.picker.padding + me.picker.itemSize;
me.setSize(width, height);
};
me.picker.addListener("change", onPickerChange, this);
},
show: function (animateTarget, callback, scope) {
var me = this;
me.callParent(arguments);
me.picker.setTableSize(0, 0);
this.setSize(me.picker.minColumns * me.picker.itemSize + 2 * me.picker.padding, me.picker.minRows * me.picker.itemSize + 2 * me.picker.padding + me.picker.itemSize);
},
hidePickerOnSelect: function (picker, columns, rows) {
Ext.menu.Manager.hideAll();
}
});

View File

@@ -1,493 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.component.TableStyler", {
extend: "Ext.container.Container",
requires: ["Ext.util.CSS", "Common.component.util.RGBColor"],
uses: ["DE.component.CellStyler"],
alias: "widget.detablestyler",
rows: 2,
columns: 2,
cellPadding: 10,
tablePadding: 10,
overwriteStyle: true,
maxBorderSize: 6,
spacingMode: false,
defaultBorderSize: 1,
defaultBorderColor: "#ccc",
constructor: function (config) {
this.initConfig(config);
this.callParent(arguments);
return this;
},
initComponent: function () {
var me = this,
cfg = Ext.apply({},
me.initialConfig),
virtualBorderSize = (me.defaultBorderSize > me.maxBorderSize) ? me.maxBorderSize : me.defaultBorderSize,
virtualBorderColor = new Common.component.util.RGBColor(me.defaultBorderColor),
topBorder,
rightBorder,
bottomBorder,
leftBorder,
topBorderSelector,
rightBorderSelector,
bottomBorderSelector,
leftBorderSelector;
var borderSize = {
top: virtualBorderSize,
right: virtualBorderSize,
bottom: virtualBorderSize,
left: virtualBorderSize
};
var borderColor = {
top: virtualBorderColor,
right: virtualBorderColor,
bottom: virtualBorderColor,
left: virtualBorderColor
};
var cfgItems = [];
for (var row = 0; row < this.rows; row++) {
if (row > 0) {
cfgItems.push({
xtype: "container",
height: (me.spacingMode) ? this.cellPadding : 0
});
}
var addRow = cfgItems.push({
xtype: "container",
layout: {
type: "hbox",
align: "stretch"
},
flex: 1,
items: []
});
for (var col = 0; col < this.columns; col++) {
if (col > 0) {
cfgItems[addRow - 1].items.push({
xtype: "container",
width: (me.spacingMode) ? this.cellPadding : 0
});
}
cfgItems[addRow - 1].items.push({
xtype: "decellstyler",
overwriteStyle: me.overwriteStyle,
halfBorderSize: !me.spacingMode,
defaultBorderSize: me.spacingMode ? virtualBorderSize : 0,
defaultBorderColor: virtualBorderColor.toHex(),
id: me.getId() + "-cell-" + col + "-" + row,
col: col,
row: row,
flex: 1,
listeners: {
borderclick: function (cell, type, size, color) {
var cellCol, cellRow, curCell;
if (type == "t") {
if (cell.row > 0) {
for (cellCol = 0; cellCol < me.columns; cellCol++) {
curCell = me.getCell(cellCol, cell.row - 1);
curCell.setBordersSize("b", size);
curCell.setBordersColor("b", color);
}
}
for (cellCol = 0; cellCol < me.columns; cellCol++) {
curCell = me.getCell(cellCol, cell.row);
if (cell.halfBorderSize && cell.row < 1) {
curCell.setBordersSize("t", 0);
} else {
curCell.setBordersSize("t", size);
}
curCell.setBordersColor("t", color);
}
} else {
if (type == "b") {
if (cell.row < me.rows - 1) {
for (cellCol = 0; cellCol < me.columns; cellCol++) {
curCell = me.getCell(cellCol, cell.row + 1);
curCell.setBordersSize("t", size);
curCell.setBordersColor("t", color);
}
}
for (cellCol = 0; cellCol < me.columns; cellCol++) {
curCell = me.getCell(cellCol, cell.row);
if (cell.halfBorderSize && cell.row >= me.rows - 1) {
curCell.setBordersSize("b", 0);
} else {
curCell.setBordersSize("b", size);
}
curCell.setBordersColor("b", color);
}
} else {
if (type == "l") {
if (cell.col > 0) {
for (cellRow = 0; cellRow < me.rows; cellRow++) {
curCell = me.getCell(cell.col - 1, cellRow);
curCell.setBordersSize("r", size);
curCell.setBordersColor("r", color);
}
}
for (cellRow = 0; cellRow < me.rows; cellRow++) {
curCell = me.getCell(cell.col, cellRow);
if (cell.halfBorderSize && cell.col < 1) {
curCell.setBordersSize("l", 0);
} else {
curCell.setBordersSize("l", size);
}
curCell.setBordersColor("l", color);
}
} else {
if (type == "r") {
if (cell.col < me.columns - 1) {
for (cellRow = 0; cellRow < me.rows; cellRow++) {
curCell = me.getCell(cell.col + 1, cellRow);
curCell.setBordersSize("l", size);
curCell.setBordersColor("l", color);
}
}
for (cellRow = 0; cellRow < me.rows; cellRow++) {
curCell = me.getCell(cell.col, cellRow);
if (cell.halfBorderSize && cell.col >= me.columns - 1) {
curCell.setBordersSize("r", 0);
} else {
curCell.setBordersSize("r", size);
}
curCell.setBordersColor("r", color);
}
}
}
}
}
}
}
});
}
}
var applyStyles = function () {
topBorder && topBorder.setStyle("border-bottom", ((borderSize.top > 0.1 && borderSize.top < 1) ? 1 : borderSize.top) + "pt solid " + borderColor.top.toRGBA((borderSize.top < 1) ? 0.2 : 1));
rightBorder && rightBorder.setStyle("border-right", ((borderSize.right > 0.1 && borderSize.right < 1) ? 1 : borderSize.right) + "pt solid " + borderColor.right.toRGBA((borderSize.right < 1) ? 0.2 : 1));
bottomBorder && bottomBorder.setStyle("border-bottom", ((borderSize.bottom > 0.1 && borderSize.bottom < 1) ? 1 : borderSize.bottom) + "pt solid " + borderColor.bottom.toRGBA((borderSize.bottom < 1) ? 0.2 : 1));
leftBorder && leftBorder.setStyle("border-right", ((borderSize.left > 0.1 && borderSize.left < 1) ? 1 : borderSize.left) + "pt solid " + borderColor.left.toRGBA((borderSize.left < 1) ? 0.2 : 1));
};
me.addListener("afterrender", function () {
var meId = me.getId();
topBorder = Ext.get(meId + "-table-top-border");
rightBorder = Ext.get(meId + "-table-right-border");
bottomBorder = Ext.get(meId + "-table-bottom-border");
leftBorder = Ext.get(meId + "-table-left-border");
topBorderSelector = Ext.get(meId + "-table-top-border-selector");
rightBorderSelector = Ext.get(meId + "-table-right-border-selector");
bottomBorderSelector = Ext.get(meId + "-table-bottom-border-selector");
leftBorderSelector = Ext.get(meId + "-table-left-border-selector");
topBorderSelector.on("click", function (e) {
if (me.overwriteStyle) {
if (borderSize.top != virtualBorderSize || !borderColor.top.isEqual(virtualBorderColor)) {
borderSize.top = virtualBorderSize;
borderColor.top = virtualBorderColor;
} else {
borderSize.top = 0;
}
} else {
borderSize.top = (borderSize.top > 0) ? 0 : virtualBorderSize;
borderColor.top = virtualBorderColor;
}
topBorder.setStyle("border-bottom", ((borderSize.top > 0.1 && borderSize.top < 1) ? 1 : borderSize.top) + "pt solid " + borderColor.top.toRGBA((borderSize.top < 1) ? 0.2 : 1));
me.fireEvent("borderclick", me, "t", borderSize.top, borderColor.top.toHex());
},
me);
rightBorderSelector.on("click", function (e) {
if (me.overwriteStyle) {
if (borderSize.right != virtualBorderSize || !borderColor.right.isEqual(virtualBorderColor)) {
borderSize.right = virtualBorderSize;
borderColor.right = virtualBorderColor;
} else {
borderSize.right = 0;
}
} else {
borderSize.right = (borderSize.right > 0) ? 0 : virtualBorderSize;
borderColor.right = virtualBorderColor;
}
rightBorder.setStyle("border-right", ((borderSize.right > 0.1 && borderSize.right < 1) ? 1 : borderSize.right) + "pt solid " + borderColor.right.toRGBA((borderSize.right < 1) ? 0.2 : 1));
me.fireEvent("borderclick", me, "r", borderSize.right, borderColor.right.toHex());
},
me);
bottomBorderSelector.on("click", function (e) {
if (me.overwriteStyle) {
if (borderSize.bottom != virtualBorderSize || !borderColor.bottom.isEqual(virtualBorderColor)) {
borderSize.bottom = virtualBorderSize;
borderColor.bottom = virtualBorderColor;
} else {
borderSize.bottom = 0;
}
} else {
borderSize.bottom = (borderSize.bottom > 0) ? 0 : virtualBorderSize;
borderColor.bottom = virtualBorderColor;
}
bottomBorder.setStyle("border-bottom", ((borderSize.bottom > 0.1 && borderSize.bottom < 1) ? 1 : borderSize.bottom) + "pt solid " + borderColor.bottom.toRGBA((borderSize.bottom < 1) ? 0.2 : 1));
me.fireEvent("borderclick", me, "b", borderSize.bottom, borderColor.bottom.toHex());
},
me);
leftBorderSelector.on("click", function (e) {
if (me.overwriteStyle) {
if (borderSize.left != virtualBorderSize || !borderColor.left.isEqual(virtualBorderColor)) {
borderSize.left = virtualBorderSize;
borderColor.left = virtualBorderColor;
} else {
borderSize.left = 0;
}
} else {
borderSize.left = (borderSize.left > 0) ? 0 : virtualBorderSize;
borderColor.left = virtualBorderColor;
}
leftBorder.setStyle("border-right", ((borderSize.left > 0.1 && borderSize.left < 1) ? 1 : borderSize.left) + "pt solid " + borderColor.left.toRGBA((borderSize.left < 1) ? 0.2 : 1));
me.fireEvent("borderclick", me, "l", borderSize.left, borderColor.left.toHex());
},
me);
});
me.getVirtualBorderSize = function () {
return virtualBorderSize;
};
me.getVirtualBorderColor = function () {
return virtualBorderColor.toHex();
};
me.setVirtualBorderSize = function (size) {
size = (size > me.maxBorderSize) ? me.maxBorderSize : size;
virtualBorderSize = size;
for (var row = 0; row < me.rows; row++) {
for (var col = 0; col < me.columns; col++) {
var cell = me.getCell(col, row);
cell.setVirtualBorderSize(size);
}
}
};
me.setVirtualBorderColor = function (color) {
var newColor = new Common.component.util.RGBColor(color);
if (virtualBorderColor.isEqual(newColor)) {
return;
}
virtualBorderColor = newColor;
for (var row = 0; row < me.rows; row++) {
for (var col = 0; col < me.columns; col++) {
var cell = me.getCell(col, row);
cell.setVirtualBorderColor(virtualBorderColor.toHex());
}
}
};
me.setBordersSize = function (borders, size) {
size = (size > me.maxBorderSize) ? me.maxBorderSize : size;
if (borders.indexOf("t") > -1) {
borderSize.top = size;
}
if (borders.indexOf("r") > -1) {
borderSize.right = size;
}
if (borders.indexOf("b") > -1) {
borderSize.bottom = size;
}
if (borders.indexOf("l") > -1) {
borderSize.left = size;
}
applyStyles();
};
me.setBordersColor = function (borders, color) {
var newColor = new Common.component.util.RGBColor(color);
if (borders.indexOf("t") > -1) {
borderColor.top = newColor;
}
if (borders.indexOf("r") > -1) {
borderColor.right = newColor;
}
if (borders.indexOf("b") > -1) {
borderColor.bottom = newColor;
}
if (borders.indexOf("l") > -1) {
borderColor.left = newColor;
}
applyStyles();
};
me.getBorderSize = function (border) {
switch (border) {
case "t":
return borderSize.top;
case "r":
return borderSize.right;
case "b":
return borderSize.bottom;
case "l":
return borderSize.left;
}
return null;
};
me.getBorderColor = function (border) {
switch (border) {
case "t":
return borderColor.top.toHex();
case "r":
return borderColor.right.toHex();
case "b":
return borderColor.bottom.toHex();
case "l":
return borderColor.left.toHex();
}
return null;
};
Ext.apply(me, {
layout: {
type: "vbox",
align: "stretch"
},
cls: "table-styler",
style: "background-color: #fff;",
items: [{
xtype: "container",
layout: {
type: "hbox",
align: "stretch"
},
height: this.tablePadding,
style: "overflow: visible;",
items: [{
xtype: "container",
style: "border-bottom: 1pt dotted gray; border-right: 1pt dotted gray;",
width: this.tablePadding
},
{
xtype: "container",
layout: "absolute",
flex: 1,
items: [{
xtype: "container",
style: "z-index: 1;",
id: me.getId() + "-table-top-border-selector",
x: 0,
y: me.tablePadding * 0.5,
height: me.tablePadding,
anchor: "100%",
html: '<table width="100%" height="100%">' + "<tr>" + '<td id="' + me.getId() + "-table-top-border" + '" style="height:50%; border-bottom: ' + borderSize.top + "px solid " + borderColor.top.toHex() + ';"></td>' + "</tr>" + "<tr>" + "<td></td>" + "</tr>" + "</table>"
}]
},
{
xtype: "container",
style: "border-bottom: 1pt dotted gray; border-left: 1pt dotted gray;",
width: this.tablePadding
}]
},
{
xtype: "container",
flex: 1,
layout: {
type: "hbox",
align: "stretch"
},
style: "overflow: visible;",
items: [{
xtype: "container",
layout: "absolute",
width: this.tablePadding,
items: [{
xtype: "container",
style: "z-index: 1;",
id: me.getId() + "-table-left-border-selector",
x: me.tablePadding * 0.5,
y: 0,
width: me.tablePadding,
anchor: "auto 100%",
html: '<table width="100%" height="100%">' + "<tr>" + '<td id="' + me.getId() + "-table-left-border" + '" style="border-right: ' + borderSize.left + "pt solid " + borderColor.left.toHex() + ';"></td>' + '<td width="50%"></td>' + "</tr>" + "</table>"
}]
},
{
xtype: "container",
layout: {
type: "vbox",
align: "stretch"
},
padding: (me.spacingMode) ? this.cellPadding : 0,
flex: 1,
items: cfgItems
},
{
xtype: "container",
layout: "absolute",
width: this.tablePadding,
items: [{
xtype: "container",
style: "z-index: 1;",
id: me.getId() + "-table-right-border-selector",
x: -1 * me.tablePadding * 0.5,
y: 0,
width: me.tablePadding,
anchor: "auto 100%",
html: '<table width="100%" height="100%">' + "<tr>" + '<td id="' + me.getId() + "-table-right-border" + '" style="border-right: ' + borderSize.right + "pt solid " + borderColor.right.toHex() + ';"></td>' + '<td width="50%"></td>' + "</tr>" + "</table>"
}]
}]
},
{
xtype: "container",
layout: {
type: "hbox",
align: "stretch"
},
style: "overflow: visible;",
height: this.tablePadding,
items: [{
xtype: "container",
style: "border-top: 1pt dotted gray; border-right: 1pt dotted gray;",
width: this.tablePadding
},
{
xtype: "container",
layout: "absolute",
flex: 1,
items: [{
xtype: "container",
style: "z-index: 1;",
id: me.getId() + "-table-bottom-border-selector",
x: 0,
y: -1 * me.tablePadding * 0.5,
height: me.tablePadding,
anchor: "100%",
html: '<table width="100%" height="100%">' + "<tr>" + '<td id="' + me.getId() + "-table-bottom-border" + '" style="height:50%; border-bottom: ' + borderSize.bottom + "px solid " + borderColor.bottom.toHex() + ';"></td>' + "</tr>" + "<tr>" + "<td></td>" + "</tr>" + "</table>"
}]
},
{
xtype: "container",
style: "border-top: 1pt dotted gray; border-left: 1pt dotted gray;",
width: this.tablePadding
}]
}]
},
cfg);
this.callParent(arguments);
},
getCell: function (col, row) {
return Ext.getCmp(this.getId() + "-cell-" + col + "-" + row);
}
});

View File

@@ -1,133 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.controller.CreateFile", {
extend: "Ext.app.Controller",
views: ["CreateFile"],
stores: ["FileTemplates"],
refs: [{
ref: "filePanel",
selector: "defile"
}],
init: function () {
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
this.control({
"decreatenew": {
afterrender: Ext.bind(this.onRenderView, this, {
single: true
})
},
"decreatenew dataview": {
itemclick: this.onTemplateClick
}
});
},
applyConfig: function (config) {
if (config) {
this.createUrl = config.createUrl;
this.nativeApp = config.nativeApp;
var templates = this.getFileTemplatesStore();
if (templates && config.templates) {
templates.removeAll();
templates.add(config.templates);
}
}
},
loadConfig: function (data) {
if (data && data.config) {
this.createUrl = data.config.createUrl;
this.nativeApp = data.config.nativeApp;
var templates = this.getFileTemplatesStore();
if (templates && data.config.templates) {
templates.removeAll();
templates.add(data.config.templates);
}
}
},
onRenderView: function () {
var btnBlankDocument = Ext.fly("id-create-blank-document");
if (btnBlankDocument) {
btnBlankDocument.addClsOnOver("over");
btnBlankDocument.on("click", this.onBlankDocClick, this);
}
},
setApi: function (o) {
this.api = o;
return this;
},
onBlankDocClick: function (event, el) {
var filePanel = this.getFilePanel();
if (filePanel) {
filePanel.closeMenu();
}
if (this.nativeApp === true) {
if (this.api) {
this.api.OpenNewDocument();
}
} else {
if (Ext.isEmpty(this.createUrl)) {
Ext.MessageBox.show({
title: this.textError,
msg: this.textCanNotCreateNewDoc,
buttons: Ext.Msg.OK,
icon: Ext.Msg.ERROR,
width: 300
});
} else {
var newDocumentPage = window.open(Ext.String.format("{0}?title={1}&action=create&doctype=text", this.createUrl, this.newDocumentTitle));
if (newDocumentPage) {
newDocumentPage.focus();
}
Common.component.Analytics.trackEvent("Create New", "Blank");
}
}
},
onTemplateClick: function (view, record, item, index, e) {
var filePanel = this.getFilePanel();
if (filePanel) {
filePanel.closeMenu();
}
if (this.nativeApp === true) {
if (this.api) {
this.api.OpenNewDocument(record.data.name);
}
} else {
var newDocumentPage = window.open(Ext.String.format("{0}?title={1}&template={2}&action=create&doctype=text", this.createUrl, this.newDocumentTitle, record.data.name));
if (newDocumentPage) {
newDocumentPage.focus();
}
}
Common.component.Analytics.trackEvent("Create New");
},
newDocumentTitle: "Unnamed document",
textError: "Error",
textCanNotCreateNewDoc: "Can not create a new document. Address to create a document is not configured."
});

View File

@@ -1,113 +1,103 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.controller.DocumentHolder", {
extend: "Ext.app.Controller",
views: ["DocumentHolder"],
refs: [{
ref: "splitterMainMenu",
selector: "#main-menu-splitter"
}],
init: function () {
this.control({
"menuitem[group=popupparagraphvalign]": {
click: this._onParagraphVAlign
},
"#view-main-menu": {
panelbeforeshow: function (fullscreen) {
this._isMenuHided = true;
if (fullscreen !== true) {
this.getSplitterMainMenu().show();
}
},
panelbeforehide: function () {
this._isMenuHided = true;
},
panelshow: function (panel, fulscreen) {
this._isMenuHided = false;
if (!fulscreen) {
if (!panel.isSizeInit) {
panel.isSizeInit = true;
var view = panel.down("dataview");
if (view) {
var nodes = view.getNodes(),
width_parent = panel.getWidth();
for (var item in nodes) {
nodes[item].style["width"] = width_parent + "px";
}
}
}
}
},
panelhide: function (panel, fulscreen) {
this._isMenuHided = false;
this.getSplitterMainMenu().hide();
}
},
"#main-menu-splitter": {
beforedragstart: function (obj, event) {
return !event.currentTarget.disabled;
},
move: this._onDocumentSplitterMove
}
});
},
setApi: function (o) {
this.api = o;
return this;
},
_onDocumentSplitterMove: function (obj, x, y) {
if (this._isMenuHided) {
return;
}
var jsp_container, width_parent = obj.up("container").down("demainmenu").getWidth();
if (width_parent > 40) {
width_parent -= 40;
Ext.ComponentQuery.query("dataview[group=scrollable]").forEach(function (list) {
var nodes = list.getNodes();
for (var item in nodes) {
nodes[item].style["width"] = width_parent + "px";
}
list.getEl().setWidth(width_parent);
jsp_container = list.getEl().down(".jspContainer");
if (jsp_container) {
jsp_container.setWidth(width_parent);
list.getEl().down(".jspPane").setWidth(width_parent);
}
});
}
},
_onParagraphVAlign: function (item, e) {
var properties = new CImgProperty();
properties.put_VerticalTextAlign(item.valign);
this.api.ImgApply(properties);
}
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var c_paragraphLinerule = {
LINERULE_LEAST: 0,
LINERULE_AUTO: 1,
LINERULE_EXACT: 2
};
var c_pageNumPosition = {
PAGE_NUM_POSITION_TOP: 1,
PAGE_NUM_POSITION_BOTTOM: 2,
PAGE_NUM_POSITION_RIGHT: 0,
PAGE_NUM_POSITION_LEFT: 1,
PAGE_NUM_POSITION_CENTER: 2
};
var c_tableWrap = {
TABLE_WRAP_NONE: 0,
TABLE_WRAP_PARALLEL: 1
};
var c_tableAlign = {
TABLE_ALIGN_LEFT: 0,
TABLE_ALIGN_CENTER: 1,
TABLE_ALIGN_RIGHT: 2
};
var c_tableBorder = {
BORDER_VERTICAL_LEFT: 0,
BORDER_HORIZONTAL_TOP: 1,
BORDER_VERTICAL_RIGHT: 2,
BORDER_HORIZONTAL_BOTTOM: 3,
BORDER_VERTICAL_CENTER: 4,
BORDER_HORIZONTAL_CENTER: 5,
BORDER_INNER: 6,
BORDER_OUTER: 7,
BORDER_ALL: 8,
BORDER_NONE: 9,
BORDER_ALL_TABLE: 10,
BORDER_NONE_TABLE: 11,
BORDER_INNER_TABLE: 12,
BORDER_OUTER_TABLE: 13
};
define(["core", "documenteditor/main/app/view/DocumentHolder"], function () {
DE.Controllers.DocumentHolder = Backbone.Controller.extend({
models: [],
collections: [],
views: ["DocumentHolder"],
initialize: function () {},
onLaunch: function () {
this.documentHolder = this.createView("DocumentHolder").render();
this.documentHolder.el.tabIndex = -1;
},
setApi: function (api) {
this.api = api;
},
createDelayedElements: function () {
var diagramEditor = this.getApplication().getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");
if (diagramEditor) {
diagramEditor.on("internalmessage", _.bind(function (cmp, message) {
var command = message.data.command;
var data = message.data.data;
if (this.api) {
(diagramEditor.isEditMode()) ? this.api.asc_editChartDrawingObject(data) : this.api.asc_addChartDrawingObject(data);
}
},
this));
diagramEditor.on("hide", _.bind(function (cmp, message) {
this.documentHolder.fireEvent("editcomplete", this.documentHolder);
if (this.api) {
this.api.asc_enableKeyEvents(true);
}
},
this));
}
}
});
});

View File

@@ -0,0 +1,429 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "common/main/lib/util/Shortcuts", "documenteditor/main/app/view/LeftMenu", "documenteditor/main/app/view/FileMenu"], function () {
DE.Controllers.LeftMenu = Backbone.Controller.extend(_.extend({
views: ["LeftMenu", "FileMenu"],
initialize: function () {
this.addListeners({
"Common.Views.Chat": {
"hide": _.bind(this.onHideChat, this)
},
"Statusbar": {
"click:users": _.bind(this.clickStatusbarUsers, this)
},
"LeftMenu": {
"comments:show": _.bind(this.commentsShowHide, this, "show"),
"comments:hide": _.bind(this.commentsShowHide, this, "hide")
},
"Common.Views.About": {
"show": _.bind(this.aboutShowHide, this, false),
"hide": _.bind(this.aboutShowHide, this, true)
},
"FileMenu": {
"filemenu:hide": _.bind(this.menuFilesHide, this),
"item:click": _.bind(this.clickMenuFileItem, this),
"saveas:format": _.bind(this.clickSaveAsFormat, this),
"settings:apply": _.bind(this.applySettings, this),
"create:new": _.bind(this.onCreateNew, this),
"recent:open": _.bind(this.onOpenRecent, this)
},
"Toolbar": {
"file:settings": _.bind(this.clickToolbarSettings, this)
},
"SearchDialog": {
"hide": _.bind(this.onSearchDlgHide, this),
"search:back": _.bind(this.onQuerySearch, this, "back"),
"search:next": _.bind(this.onQuerySearch, this, "next"),
"search:replace": _.bind(this.onQueryReplace, this),
"search:replaceall": _.bind(this.onQueryReplaceAll, this),
"search:highlight": _.bind(this.onSearchHighlight, this)
}
});
Common.NotificationCenter.on("leftmenu:change", _.bind(this.onMenuChange, this));
},
onLaunch: function () {
this.leftMenu = this.createView("LeftMenu").render();
this.leftMenu.btnSearch.on("toggle", _.bind(this.onMenuSearch, this));
Common.util.Shortcuts.delegateShortcuts({
shortcuts: {
"command+shift+s,ctrl+shift+s": _.bind(this.onShortcut, this, "save"),
"command+f,ctrl+f": _.bind(this.onShortcut, this, "search"),
"command+h,ctrl+h": _.bind(this.onShortcut, this, "replace"),
"alt+f": _.bind(this.onShortcut, this, "file"),
"esc": _.bind(this.onShortcut, this, "escape"),
"ctrl+alt+q": _.bind(this.onShortcut, this, "chat"),
"command+shift+h,ctrl+shift+h": _.bind(this.onShortcut, this, "comments"),
"f1": _.bind(this.onShortcut, this, "help")
}
});
Common.util.Shortcuts.suspendEvents();
},
setApi: function (api) {
this.api = api;
this.api.asc_registerCallback("asc_onReplaceAll", _.bind(this.onApiTextReplaced, this));
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", _.bind(this.onApiServerDisconnect, this));
Common.NotificationCenter.on("api:disconnect", _.bind(this.onApiServerDisconnect, this));
if (this.mode.canCoAuthoring) {
this.api.asc_registerCallback("asc_onCoAuthoringChatReceiveMessage", _.bind(this.onApiChatMessage, this));
}
this.leftMenu.getMenu("file").setApi(api);
return this;
},
setMode: function (mode) {
this.mode = mode;
this.leftMenu.setMode(mode);
this.leftMenu.getMenu("file").setMode(mode);
return this;
},
createDelayedElements: function () {
if (this.mode.canCoAuthoring) {
this.leftMenu.btnComments[this.mode.isEdit ? "show" : "hide"]();
this.leftMenu.btnChat.show();
this.leftMenu.setOptionsPanel("chat", this.getApplication().getController("Common.Controllers.Chat").getView("Common.Views.Chat"));
this.leftMenu.setOptionsPanel("comment", this.getApplication().getController("Common.Controllers.Comments").getView("Common.Views.Comments"));
} else {
this.leftMenu.btnChat.hide();
this.leftMenu.btnComments.hide();
}
Common.util.Shortcuts.resumeEvents();
return this;
},
clickMenuFileItem: function (menu, action, isopts) {
var close_menu = true;
switch (action) {
case "back":
break;
case "save":
this.api.asc_Save();
break;
case "print":
this.api.asc_Print();
break;
case "exit":
Common.Gateway.goBack();
break;
case "edit":
this.getApplication().getController("Statusbar").setStatusCaption(this.requestEditRightsText);
Common.Gateway.requestEditRights();
break;
case "new":
if (isopts) {
close_menu = false;
} else {
this.onCreateNew(undefined, "blank");
}
break;
default:
close_menu = false;
}
if (close_menu) {
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
}
},
clickSaveAsFormat: function (menu, format) {
this.api.asc_DownloadAs(format);
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
},
applySettings: function (menu) {
var value = window.localStorage.getItem("de-settings-inputmode");
this.api.SetTextBoxInputMode(parseInt(value) == 1);
switch (window.localStorage.getItem("de-settings-showchanges")) {
case "all":
value = c_oAscCollaborativeMarksShowType.All;
break;
case "none":
value = c_oAscCollaborativeMarksShowType.None;
break;
default:
value = c_oAscCollaborativeMarksShowType.LastChanges;
}
this.api.SetCollaborativeMarksShowType(value);
value = window.localStorage.getItem("de-settings-livecomment");
(!(value !== null && parseInt(value) == 0)) ? this.api.asc_showComments() : this.api.asc_hideComments();
value = window.localStorage.getItem("de-settings-fontrender");
switch (value) {
case "1":
this.api.SetFontRenderingMode(1);
break;
case "2":
this.api.SetFontRenderingMode(2);
break;
case "0":
this.api.SetFontRenderingMode(3);
break;
}
if (this.mode.canAutosave) {
value = window.localStorage.getItem("de-settings-autosave");
this.api.asc_setAutoSaveGap(parseInt(value));
}
value = window.localStorage.getItem("de-settings-spellcheck");
this.api.asc_setSpellCheck(value === null || parseInt(value) == 1);
value = window.localStorage.getItem("de-settings-showsnaplines");
this.api.put_ShowSnapLines(value === null || parseInt(value) == 1);
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
},
onCreateNew: function (menu, type) {
if (this.mode.nativeApp === true) {
this.api.OpenNewDocument(type == "blank" ? "" : type);
} else {
var newDocumentPage = window.open(_.template("<%= url %>?title=<%= title %>" + '<% if (doctype != "blank") { %>&template=<%= doctype %><% } %>' + "&action=create&doctype=text", {
url: this.mode.createUrl,
title: this.newDocumentTitle,
doctype: type
}));
if (newDocumentPage) {
newDocumentPage.focus();
}
}
if (menu) {
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
}
},
onOpenRecent: function (menu, url) {
if (menu) {
menu.hide();
this.leftMenu.btnFile.toggle(false, true);
}
var recentDocPage = window.open(url);
if (recentDocPage) {
recentDocPage.focus();
}
Common.component.Analytics.trackEvent("Open Recent");
},
clickToolbarSettings: function (obj) {
if (this.leftMenu.btnFile.pressed && this.leftMenu.btnFile.panel.active == "opts") {
this.leftMenu.close();
} else {
this.leftMenu.showMenu("file:opts");
}
},
clickStatusbarUsers: function () {
if (this.mode.canCoAuthoring) {
if (this.leftMenu.btnChat.pressed) {
this.leftMenu.close();
} else {
this.leftMenu.showMenu("chat");
}
}
},
onHideChat: function () {
$(this.leftMenu.btnChat.el).blur();
Common.NotificationCenter.trigger("layout:changed", "leftmenu");
},
onQuerySearch: function (d, w, opts) {
if (opts.textsearch && opts.textsearch.length) {
if (!this.api.asc_findText(opts.textsearch, d != "back", opts.matchcase, opts.matchword)) {
var me = this;
Common.UI.info({
msg: this.textNoTextFound,
callback: function () {
me.dlgSearch.focus();
}
});
}
}
},
onQueryReplace: function (w, opts) {
if (!_.isEmpty(opts.textsearch) && !_.isEmpty(opts.textreplace)) {
if (!this.api.asc_replaceText(opts.textsearch, opts.textreplace, false, opts.matchcase, opts.matchword)) {
var me = this;
Common.UI.info({
msg: this.textNoTextFound,
callback: function () {
me.dlgSearch.focus();
}
});
}
}
},
onQueryReplaceAll: function (w, opts) {
if (!_.isEmpty(opts.textsearch) && !_.isEmpty(opts.textreplace)) {
this.api.asc_replaceText(opts.textsearch, opts.textreplace, true, opts.matchcase, opts.matchword);
}
},
onSearchHighlight: function (w, highlight) {
this.api.asc_selectSearchingResults(highlight);
},
showSearchDlg: function (show, action) {
if (!this.dlgSearch) {
this.dlgSearch = (new Common.UI.SearchDialog({
matchcase: true,
markresult: {
applied: true
}
}));
}
if (show) {
var mode = this.mode.isEdit ? (action || undefined) : "no-replace";
if (this.dlgSearch.isVisible()) {
this.dlgSearch.setMode(mode);
this.dlgSearch.focus();
} else {
this.dlgSearch.show(mode);
}
} else {
this.dlgSearch["hide"]();
}
},
onMenuSearch: function (obj, show) {
this.showSearchDlg(show);
},
onSearchDlgHide: function () {
this.leftMenu.btnSearch.toggle(false, true);
this.api.asc_selectSearchingResults(false);
$(this.leftMenu.btnSearch.el).blur();
this.api.asc_enableKeyEvents(true);
},
onApiTextReplaced: function (found, replaced) {
var me = this;
if (found) { ! (found - replaced > 0) ? Common.UI.info({
msg: Common.Utils.String.format(this.textReplaceSuccess, replaced)
}) : Common.UI.warning({
msg: Common.Utils.String.format(this.textReplaceSkipped, found - replaced)
});
} else {
Common.UI.info({
msg: this.textNoTextFound
});
}
},
onApiServerDisconnect: function () {
this.mode.isEdit = false;
this.leftMenu.close();
this.leftMenu.btnComments.setDisabled(true);
this.leftMenu.btnChat.setDisabled(true);
this.leftMenu.getMenu("file").setMode({
isDisconnected: true
});
if (this.dlgSearch) {
this.leftMenu.btnSearch.toggle(false, true);
this.dlgSearch["hide"]();
}
},
onApiChatMessage: function () {
this.leftMenu.markCoauthOptions();
},
commentsShowHide: function (mode) {
var value = window.localStorage.getItem("de-settings-livecomment");
if (value !== null && 0 === parseInt(value)) {
(mode === "show") ? this.api.asc_showComments() : this.api.asc_hideComments();
}
if (mode === "show") {
this.getApplication().getController("Common.Controllers.Comments").focusOnInput();
} else {
$(this.leftMenu.btnComments.el).blur();
}
},
aboutShowHide: function (value) {
if (this.api) {
this.api.asc_enableKeyEvents(value);
}
if (value) {
$(this.leftMenu.btnAbout.el).blur();
}
},
menuFilesHide: function (obj) {
$(this.leftMenu.btnFile.el).blur();
},
onMenuChange: function (value) {
if ("hide" === value) {
if (this.leftMenu.btnComments.isActive() && this.api) {
this.leftMenu.btnComments.toggle(false);
this.leftMenu.onBtnMenuClick(this.leftMenu.btnComments);
this.api.asc_enableKeyEvents(true);
}
}
},
onShortcut: function (s, e) {
switch (s) {
case "replace":
case "search":
Common.UI.Menu.Manager.hideAll();
this.showSearchDlg(true, s);
this.leftMenu.btnSearch.toggle(true, true);
this.leftMenu.btnFile.toggle(false);
this.leftMenu.btnAbout.toggle(false);
return false;
case "save":
if (this.mode.canDownload) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("file:saveas");
}
return false;
case "help":
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("file:help");
return false;
case "file":
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("file");
return false;
case "escape":
var statusbar = DE.getController("Statusbar");
var menu_opened = statusbar.statusbar.$el.find('.open > [data-toggle="dropdown"]');
if (menu_opened.length) {
$.fn.dropdown.Constructor.prototype.keydown.call(menu_opened[0], e);
return false;
}
if (this.leftMenu.btnFile.pressed || this.leftMenu.btnAbout.pressed || $(e.target).parents("#left-menu").length) {
this.leftMenu.close();
Common.NotificationCenter.trigger("layout:changed", "leftmenu");
return false;
}
break;
case "chat":
if (this.mode.canCoAuthoring) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("chat");
}
return false;
case "comments":
if (this.mode.canCoAuthoring && this.mode.isEdit) {
Common.UI.Menu.Manager.hideAll();
this.leftMenu.showMenu("comments");
this.getApplication().getController("Common.Controllers.Comments").focusOnInput();
}
return false;
}
},
textNoTextFound: "Text not found",
newDocumentTitle: "Unnamed document",
requestEditRightsText: "Requesting editing rights...",
textReplaceSuccess: "Search has been done. {0} occurrences have been replaced",
textReplaceSkipped: "The replacement has been made. {0} occurrences were skipped."
},
DE.Controllers.LeftMenu || {}));
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,66 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.controller.RecentFiles", {
extend: "Ext.app.Controller",
views: ["RecentFiles"],
stores: ["RecentFiles"],
refs: [{
ref: "filePanel",
selector: "defile"
}],
init: function () {
Common.Gateway.on("init", Ext.bind(this.loadConfig, this));
this.control({
"derecentfiles dataview": {
itemclick: this.onRecentFileClick
}
});
},
loadConfig: function (data) {
var recent = this.getRecentFilesStore();
if (recent && data && data.config && data.config.recent) {
recent.removeAll();
recent.add(data.config.recent);
}
},
onRecentFileClick: function (view, record, item, index, e) {
var filePanel = this.getFilePanel();
if (filePanel) {
filePanel.closeMenu();
}
var recentDocPage = window.open(record.data.url);
if (recentDocPage) {
recentDocPage.focus();
}
Common.component.Analytics.trackEvent("Open Recent");
}
});

View File

@@ -0,0 +1,279 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "documenteditor/main/app/view/RightMenu"], function () {
DE.Controllers.RightMenu = Backbone.Controller.extend({
models: [],
collections: [],
views: ["RightMenu"],
initialize: function () {
this.editMode = true;
this.addListeners({
"RightMenu": {
"rightmenuclick": this.onRightMenuClick
}
});
},
onLaunch: function () {
this.rightmenu = this.createView("RightMenu");
this.rightmenu.on("render:after", _.bind(this.onRightMenuAfterRender, this));
},
onRightMenuAfterRender: function (rightMenu) {
rightMenu.shapeSettings.application = this.getApplication();
this._settings = [];
this._settings[c_oAscTypeSelectElement.Paragraph] = {
panelId: "id-paragraph-settings",
panel: rightMenu.paragraphSettings,
btn: rightMenu.btnText,
hidden: 1,
locked: false
};
this._settings[c_oAscTypeSelectElement.Table] = {
panelId: "id-table-settings",
panel: rightMenu.tableSettings,
btn: rightMenu.btnTable,
hidden: 1,
locked: false
};
this._settings[c_oAscTypeSelectElement.Image] = {
panelId: "id-image-settings",
panel: rightMenu.imageSettings,
btn: rightMenu.btnImage,
hidden: 1,
locked: false
};
this._settings[c_oAscTypeSelectElement.Header] = {
panelId: "id-header-settings",
panel: rightMenu.headerSettings,
btn: rightMenu.btnHeaderFooter,
hidden: 1,
locked: false,
needShow: true
};
this._settings[c_oAscTypeSelectElement.Shape] = {
panelId: "id-shape-settings",
panel: rightMenu.shapeSettings,
btn: rightMenu.btnShape,
hidden: 1,
locked: false
};
this._settings[c_oAscTypeSelectElement.Chart] = {
panelId: "id-chart-settings",
panel: rightMenu.chartSettings,
btn: rightMenu.btnChart,
hidden: 1,
locked: false
};
},
setApi: function (api) {
this.api = api;
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", _.bind(this.onCoAuthoringDisconnect, this));
Common.NotificationCenter.on("api:disconnect", _.bind(this.onCoAuthoringDisconnect, this));
},
setMode: function (mode) {
this.editMode = mode.isEdit;
},
onRightMenuClick: function (menu, type, minimized) {
if (!minimized && this.editMode) {
var panel = this._settings[type].panel;
var props = this._settings[type].props;
if (props && panel) {
panel.ChangeSettings.call(panel, props);
}
}
Common.NotificationCenter.trigger("layout:changed", "rightmenu");
this.rightmenu.fireEvent("editcomplete", this.rightmenu);
},
onFocusObject: function (SelectedObjects) {
if (!this.editMode) {
return;
}
var needhide = true;
for (var i = 0; i < this._settings.length; i++) {
if (this._settings[i]) {
this._settings[i].hidden = 1;
this._settings[i].locked = false;
}
}
var isChart = 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_ChartProperties() !== null) {
isChart = true;
type = c_oAscTypeSelectElement.Chart;
} else {
if (value.get_ShapeProperties() !== null) {
isChart = value.get_ShapeProperties().get_FromChart();
type = c_oAscTypeSelectElement.Shape;
}
}
} else {
if (type == c_oAscTypeSelectElement.Paragraph) {
this._settings[type].panel.isChart = isChart;
}
}
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++) {
var pnl = this._settings[i];
if (pnl === undefined) {
continue;
}
if (pnl.hidden) {
if (!pnl.btn.isDisabled()) {
pnl.btn.setDisabled(true);
}
if (this.rightmenu.GetActivePane() == pnl.panelId) {
currentactive = -1;
}
} else {
if (pnl.btn.isDisabled()) {
pnl.btn.setDisabled(false);
}
lastactive = i;
if (pnl.needShow) {
pnl.needShow = false;
priorityactive = i;
} else {
if (this.rightmenu.GetActivePane() == pnl.panelId) {
currentactive = i;
}
}
pnl.panel.setLocked(pnl.locked);
}
}
if (!this.rightmenu.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) {
this.rightmenu.SetActivePane(active);
this._settings[active].panel.ChangeSettings.call(this._settings[active].panel, this._settings[active].props);
}
}
this._settings[c_oAscTypeSelectElement.Image].needShow = false;
this._settings[c_oAscTypeSelectElement.Chart].needShow = false;
this._settings[c_oAscTypeSelectElement.Shape].needShow = false;
},
onCoAuthoringDisconnect: function () {
if (this.rightmenu) {
this.rightmenu.SetDisabled("", true, true);
}
this.setMode({
isEdit: false
});
},
onInsertTable: function () {
this._settings[c_oAscTypeSelectElement.Table].needShow = true;
},
onInsertImage: function () {
this._settings[c_oAscTypeSelectElement.Image].needShow = true;
},
onInsertChart: function () {
this._settings[c_oAscTypeSelectElement.Chart].needShow = true;
},
onInsertShape: function () {
this._settings[c_oAscTypeSelectElement.Shape].needShow = true;
},
UpdateThemeColors: function () {
this.rightmenu.paragraphSettings.UpdateThemeColors();
this.rightmenu.tableSettings.UpdateThemeColors();
this.rightmenu.shapeSettings.UpdateThemeColors();
},
updateMetricUnit: function () {
this.rightmenu.headerSettings.updateMetricUnit();
this.rightmenu.paragraphSettings.updateMetricUnit();
this.rightmenu.chartSettings.updateMetricUnit();
this.rightmenu.imageSettings.updateMetricUnit();
},
createDelayedElements: function () {
var me = this;
if (this.api) {
this.api.asc_registerCallback("asc_onFocusObject", _.bind(this.onFocusObject, this));
this.api.asc_registerCallback("asc_doubleClickOnObject", _.bind(this.onDoubleClickOnObject, this));
}
if (this.editMode && this.api) {
var selectedElements = this.api.getSelectedElements();
if (selectedElements.length > 0) {
this.onFocusObject(selectedElements);
}
}
},
onDoubleClickOnObject: function (obj) {
if (!this.editMode) {
return;
}
var type = obj.get_ObjectType();
if (type >= this._settings.length || this._settings[type] === undefined) {
return;
}
var value = obj.get_ObjectValue();
if (type == c_oAscTypeSelectElement.Image) {
if (value.get_ChartProperties() !== null) {
type = c_oAscTypeSelectElement.Chart;
} else {
if (value.get_ShapeProperties() !== null) {
type = c_oAscTypeSelectElement.Shape;
}
}
}
if (type !== c_oAscTypeSelectElement.Paragraph) {
this.rightmenu.SetActivePane(type, true);
this._settings[type].panel.ChangeSettings.call(this._settings[type].panel, this._settings[type].props);
}
}
});
});

View File

@@ -1,207 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.controller.Search", {
extend: "Ext.app.Controller",
refs: [{
ref: "searchDialog",
selector: "commonsearchdialog"
},
{
ref: "searchQuery",
selector: "#search-dialog-text-search"
},
{
ref: "replaceQuery",
selector: "#search-dialog-text-replace"
}],
init: function () {
this.control({
"demainmenu #id-menu-search": {
toggle: this._showSearchDialog
},
"commonsearchdialog": {
show: function (obj) {
this.setDefaultView();
this.api.asc_selectSearchingResults(obj.getSettings().highlight);
},
hide: function () {
this.api.asc_selectSearchingResults(false);
this.api.asc_searchEnabled(false);
}
},
"commonsearchdialog button[group=search-text]": {
click: function (btn) {
this._startSearch(btn.direction);
}
},
"commonsearchdialog button[group=replace-text]": {
click: this.btnReplaceText
},
"#search-dialog-text-search": {
searchstart: function (obj, text) {
this._startSearch("next");
obj.stopSearch(true);
}
},
"commonsearchdialog checkbox[action=highlight]": {
change: function (obj, newValue, oldValue) {
this.api.asc_selectSearchingResults(newValue);
}
}
});
},
setApi: function (o) {
this.api = o;
this.api.asc_registerCallback("asc_onReplaceAll", Ext.bind(this._onReplaceText, this));
this.api.asc_registerCallback("asc_onСoAuthoringDisconnect", Ext.bind(this.onCoAuthoringDisconnect, this));
},
setMode: function (mode) {
this.mode = mode;
if (this._frmSearch) {
this._frmSearch.setViewMode(!this.mode.isEdit);
}
},
setDefaultView: function () {
this.getSearchDialog().searchMode();
},
_showSearchDialog: function (btn, pressed) {
var mainmenu = Ext.getCmp("view-main-menu");
if (pressed) {
mainmenu.closeFullScaleMenu();
var me = this;
if (!me._frmSearch) {
me._frmSearch = Ext.create("Common.view.SearchDialog", {
animateTarget: "id-menu-search",
closeAction: "hide",
wholewords: false,
highlight: {
checked: true
},
isViewMode: !this.mode.isEdit
});
me._frmSearch.addListener("hide", function (cnt, eOpts) {
if (!btn.ownrise) {
btn.ownrise = true;
btn.toggle(false);
if (!Ext.isDefined(mainmenu.currentFullScaleMenuBtn)) {
mainmenu.fireEvent("editcomplete", mainmenu);
}
}
btn.ownrise = false;
});
}
me._frmSearch.show();
} else {
if (this._frmSearch && !btn.ownrise) {
btn.ownrise = true;
this._frmSearch.hide();
if (!Ext.isDefined(mainmenu.currentFullScaleMenuBtn)) {
mainmenu.fireEvent("editcomplete", mainmenu);
}
}
}
},
btnReplaceText: function (btn, event, opts) {
var me = this;
if (me.getSearchQuery().isValueValid()) {
var sett = this.getSearchDialog().getSettings();
if (btn.type == "all") {
this.api.asc_replaceText(sett.textsearch, sett.textreplace, true, sett.casesensitive, sett.wholewords);
} else {
if (!this.api.asc_replaceText(sett.textsearch, sett.textreplace, false, sett.casesensitive, sett.wholewords)) {
this.showWarning(this.textNoTextFound);
}
}
}
},
_startSearch: function (direction) {
if (this.getSearchQuery().isValueValid()) {
var sett = this.getSearchDialog().getSettings();
if (!this.api.asc_findText(sett.textsearch, direction == "next", sett.casesensitive, sett.wholewords)) {
this.showWarning(this.textNoTextFound);
}
}
},
showWarning: function (text) {
var me = this;
if (!this.msgbox) {
this.msgbox = Ext.create("Ext.window.MessageBox", {
listeners: {
beforehide: function () {
me.getSearchQuery().focus(true, 100);
}
}
});
}
var config = {
title: this.textSearch,
msg: text,
icon: Ext.Msg.INFO,
buttons: Ext.Msg.OK
};
if (Common.userAgent.isIE) {
var oldFn = {
enter: Ext.FocusManager.navigateIn,
esc: Ext.FocusManager.navigateOut
};
Ext.FocusManager.navigateIn = Ext.emptyFn;
Ext.FocusManager.navigateOut = function (event) {
me.msgbox.close();
};
config.fn = function (btn) {
Ext.FocusManager.navigateIn = oldFn.enter;
Ext.FocusManager.navigateOut = oldFn.esc;
};
}
this.msgbox.show(config);
},
_onReplaceText: function (found, replaced) {
var me = this;
if (found) {
if (! (found - replaced)) {
me.showWarning(Ext.String.format(this.textReplaceSuccess, replaced));
} else {
me.showWarning(Ext.String.format(this.textReplaceSkipped, found - replaced));
}
} else {
me.showWarning(me.textNoTextFound);
}
},
onCoAuthoringDisconnect: function () {
this.mode.isEdit = false;
this._frmSearch && this._frmSearch.setViewMode(true);
},
textSearch: "Search",
textNoTextFound: "Text not found",
textReplaceSuccess: "Search has been done. {0} occurrences have been replaced",
textReplaceSkipped: "The replacement has been made. {0} occurrences were skipped."
});

View File

@@ -0,0 +1,165 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "documenteditor/main/app/view/Statusbar", "common/main/lib/util/LanguageInfo"], function () {
DE.Controllers.Statusbar = Backbone.Controller.extend(_.extend({
models: [],
collections: [],
views: ["Statusbar"],
initialize: function () {
this.addListeners({
"FileMenu": {
"settings:apply": _.bind(this.applySettings, this)
},
"Statusbar": {
"langchanged": this.onLangMenu
}
});
},
events: function () {
return {
"click #btn-zoom-down": _.bind(this.zoomDocument, this, "down"),
"click #btn-zoom-up": _.bind(this.zoomDocument, this, "up"),
"click #btn-doc-lang": _.bind(this.onBtnLanguage, this)
};
},
onLaunch: function () {
this.statusbar = this.createView("Statusbar").render();
this.statusbar.$el.css("z-index", 1);
this.bindViewEvents(this.statusbar, this.events);
$("#status-label-zoom").css("min-width", 70);
this.statusbar.btnSetSpelling.on("click", _.bind(this.onBtnSpelling, this));
this.statusbar.btnZoomToPage.on("click", _.bind(this.onBtnZoomTo, this, "topage"));
this.statusbar.btnZoomToWidth.on("click", _.bind(this.onBtnZoomTo, this, "towidth"));
this.statusbar.zoomMenu.on("item:click", _.bind(this.menuZoomClick, this));
},
setApi: function (api) {
this.api = api;
this.api.asc_registerCallback("asc_onZoomChange", _.bind(this._onZoomChange, this));
this.api.asc_registerCallback("asc_onTextLanguage", _.bind(this._onTextLanguage, this));
this.statusbar.setApi(api);
},
onBtnZoomTo: function (d, b, e) {
if (!b.pressed) {
this.api.zoomCustomMode();
} else {
this.api[d == "topage" ? "zoomFitToPage" : "zoomFitToWidth"]();
}
},
zoomDocument: function (d, e) {
switch (d) {
case "up":
this.api.zoomIn();
break;
case "down":
this.api.zoomOut();
break;
}
},
menuZoomClick: function (menu, item) {
this.api.zoom(item.value);
},
_onZoomChange: function (percent, type) {
this.statusbar.btnZoomToPage.toggle(type == 2, true);
this.statusbar.btnZoomToWidth.toggle(type == 1, true);
$("#status-label-zoom").text(Common.Utils.String.format(this.zoomText, percent));
},
_onTextLanguage: function (langId) {
var info = Common.util.LanguageInfo.getLocalLanguageName(langId);
this.statusbar.setLanguage({
tip: info[0],
title: info[1],
code: langId
});
},
setLanguages: function (apiLangs) {
var langs = this.langs = [],
info;
_.each(apiLangs, function (lang, index, list) {
info = Common.util.LanguageInfo.getLocalLanguageName(lang.asc_getId());
langs.push({
title: info[1],
tip: info[0],
code: lang.asc_getId()
});
},
this);
this.statusbar.reloadLanguages(langs);
},
setStatusCaption: function (text) {
if (text.length) {
this.statusbar.showStatusMessage(text);
} else {
this.statusbar.clearStatusMessage();
}
},
createDelayedElements: function () {
this.statusbar.$el.css("z-index", "");
var value = window.localStorage.getItem("de-settings-spellcheck");
this.statusbar.btnSetSpelling.toggle(value === null || parseInt(value) == 1, true);
},
onBtnLanguage: function () {
var langs = _.map(this.langs, function (item) {
return {
displayValue: item.title,
value: item.tip,
code: item.code
};
});
var me = this;
(new DE.Views.Statusbar.LanguageDialog({
languages: langs,
current: me.api.asc_getDefaultLanguage(),
handler: function (result, tip) {
if (result == "ok") {
var record = _.findWhere(langs, {
"value": tip
});
record && me.api.asc_setDefaultLanguage(record.code);
}
}
})).show();
},
onLangMenu: function (obj, langid, title) {
this.api.put_TextPrLang(langid);
},
onBtnSpelling: function (d, b, e) {
window.localStorage.setItem("de-settings-spellcheck", d.pressed ? 1 : 0);
this.api.asc_setSpellCheck(d.pressed);
},
applySettings: function (menu) {
var value = window.localStorage.getItem("de-settings-spellcheck");
this.statusbar.btnSetSpelling.toggle(value === null || parseInt(value) == 1, true);
},
zoomText: "Zoom {0}%"
},
DE.Controllers.Statusbar || {}));
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,87 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["core", "common/main/lib/view/Header", "documenteditor/main/app/view/Viewport", "documenteditor/main/app/view/LeftMenu"], function (Viewport) {
DE.Controllers.Viewport = Backbone.Controller.extend({
models: [],
collections: [],
views: ["Viewport", "Common.Views.Header"],
initialize: function () {},
setApi: function (api) {
this.api = api;
},
onLaunch: function () {
this.viewport = this.createView("Viewport").render();
this.header = this.createView("Common.Views.Header", {
headerCaption: "Document Editor"
}).render();
Common.NotificationCenter.on("layout:changed", _.bind(this.onLayoutChanged, this));
$(window).on("resize", _.bind(this.onWindowResize, this));
this.viewport.hlayout.on("layout:resizedrag", function () {
this.api.Resize();
},
this);
this.boxSdk = $("#editor_sdk");
this.boxSdk.css("border-left", "none");
},
onLayoutChanged: function (area) {
switch (area) {
default:
this.viewport.vlayout.doLayout();
case "rightmenu":
this.viewport.hlayout.doLayout();
break;
case "leftmenu":
var panel = this.viewport.hlayout.items[0];
if (panel.resize.el) {
if (panel.el.width() > 40) {
this.boxSdk.css("border-left", "");
panel.resize.el.show();
} else {
panel.resize.el.hide();
this.boxSdk.css("border-left", "0 none");
}
}
this.viewport.hlayout.doLayout();
break;
case "header":
case "toolbar":
case "status":
this.viewport.vlayout.doLayout();
break;
}
this.api.Resize();
},
onWindowResize: function (e) {
this.onLayoutChanged("window");
}
});
});

View File

@@ -1,54 +1,56 @@
/*
* (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);
}
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["backbone"], function (Backbone) {
DE.Models = DE.Models || {};
DE.Models.EquationModel = Backbone.Model.extend({
defaults: function () {
return {
id: Common.UI.getId(),
data: null,
width: 0,
height: 0,
posX: 0,
posY: 0
};
}
});
DE.Models.EquationGroup = Backbone.Model.extend({
defaults: function () {
return {
id: Common.UI.getId(),
groupName: null,
groupId: null,
groupStore: null
};
}
});
});

View File

@@ -1,35 +1,40 @@
/*
* (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.store.RecentFiles", {
extend: "Ext.data.Store",
model: "DE.model.RecentFile"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["underscore", "backbone"], function (_, Backbone) {
DE.Models = DE.Models || {};
DE.Models.Pages = Backbone.Model.extend({
defaults: {
current: 0,
count: 0
}
});
});

View File

@@ -1,46 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.model.RecentFile", {
extend: "Ext.data.Model",
fields: [{
type: "string",
name: "title"
},
{
type: "string",
name: "url"
},
{
type: "string",
name: "folder"
}]
});

View File

@@ -1,52 +1,53 @@
/*
* (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.ShapeModel", {
extend: "Ext.data.Model",
fields: [{
name: "imageUrl"
},
{
name: "data"
}]
});
Ext.define("DE.model.ShapeGroup", {
extend: "Ext.data.Model",
fields: [{
name: "groupName"
},
{
name: "groupId"
},
{
name: "groupStore"
}]
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["backbone"], function (Backbone) {
DE.Models = DE.Models || {};
DE.Models.ShapeModel = Backbone.Model.extend({
defaults: function () {
return {
id: Common.UI.getId(),
imageUrl: null,
data: null
};
}
});
DE.Models.ShapeGroup = Backbone.Model.extend({
defaults: function () {
return {
id: Common.UI.getId(),
groupName: null,
groupId: null,
groupStore: null
};
}
});
});

View File

@@ -1,35 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("DE.store.FileTemplates", {
extend: "Ext.data.Store",
model: "DE.model.FileTemplate"
});

View File

@@ -0,0 +1,69 @@
<table cols="2">
<tr>
<td colspan=2>
<label class="header"><%= scope.textSize %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="50%">
<label id="chart-label-width" class="input-label"><%= scope.textWidth %></label>
</td>
<td class="padding-small" width="50%">
<label id="chart-label-height" class="input-label"><%= scope.textHeight %></label>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2>
<label class="header"><%= scope.textWrap %></label>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div id="chart-button-wrap" style=""></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2>
<label class="header"><%= scope.textChartType %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="chart-button-type" style=""></div>
</td>
<td class="padding-small">
<div id="chart-button-style" style=""></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<button type="button" class="btn btn-text-default" id="chart-button-edit-data" style="width:115px;"><%= scope.textEditData %></button>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td align="center" colspan=2>
<label class="link" id="chart-advanced-link"><%= scope.textAdvanced %></label>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View File

@@ -0,0 +1,203 @@
<div id="id-adv-dropcap-frame" class="settings-panel">
<div class="inner-content">
<table cols="3" style="width: 100%">
<tr>
<td colspan="3">
<label class="header padding-small"><%= scope.textPosition %></label>
</td>
</tr>
<tr>
<td colspan="3" class="settins-cell padding-large">
<span id="frame-advanced-button-none" style="margin-right:5px;"></span>
<span id="frame-advanced-button-inline" style="margin-right:5px;"></span>
<span id="frame-advanced-button-flow"></span>
</td>
</tr>
<tr>
<td class="padding-small" colspan="3">
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td class="settins-cell padding-small" width="80">
<label class="input-label"><%= scope.textWidth %></label>
</td>
<td class="settins-cell padding-small" width="130" style="padding-right: 10px;">
<div id="frame-advanced-input-widthtype"></div>
</td>
<td class="settins-cell padding-small" width="95">
<div id="frame-advanced-input-width"></div>
</td>
</tr>
<tr>
<td class="settins-cell padding-small" width="80">
<label class="input-label"><%= scope.textHeight %></label>
</td>
<td class="settins-cell padding-small" width="130" style="padding-right: 10px;">
<div id="frame-advanced-input-heighttype"></div>
</td>
<td class="settins-cell padding-small" width="95">
<div id="frame-advanced-input-height"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan="3">
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan="3">
<label class="header"><%= scope.textHorizontal %></label>
</td>
</tr>
<tr>
<td colspan="2"></td>
<td class="settins-cell">
<label class="input-label"><%= scope.textRelative %></label>
</td>
</tr>
<tr>
<td class="settins-cell padding-small" width="80">
<label class="input-label"><%= scope.textPosition %></label>
</td>
<td class="settins-cell padding-small" width="130" style="padding-right: 10px;">
<div id="frame-advanced-input-hposition"></div>
</td>
<td class="settins-cell padding-small" width="95">
<div id="frame-advanced-input-hrelative"></div>
</td>
</tr>
<tr>
<td class="settins-cell padding-small" colspan="2" style="padding-right: 10px;">
<label class="input-label" style="float: right;"><%= scope.textDistance %></label>
</td>
<td class="settins-cell padding-small">
<div id="frame-advanced-input-hdist"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan="3">
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan="3">
<label class="header"><%= scope.textVertical %></label>
</td>
</tr>
<tr>
<td colspan="2"></td>
<td class="settins-cell">
<label class="input-label"><%= scope.textRelative %></label>
</td>
</tr>
<tr>
<td class="settins-cell padding-small" width="80">
<label class="input-label"><%= scope.textPosition %></label>
</td>
<td class="settins-cell padding-small" width="130" style="padding-right: 10px;">
<div id="frame-advanced-input-vposition"></div>
</td>
<td class="settins-cell padding-small" width="95">
<div id="frame-advanced-input-vrelative"></div>
</td>
</tr>
<tr>
<td class="settins-cell padding-small" colspan="2" style="padding-right: 10px;">
<label class="input-label" style="float: right;"><%= scope.textDistance %></label>
</td>
<td class="settins-cell padding-small">
<div id="frame-advanced-input-vdist"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan="3">
<div id="frame-advanced-checkbox-move"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-dropcap-dropcap" class="settings-panel">
<div class="inner-content">
<label class="header padding-small" style="width: 100%;"><%= scope.textPosition %></label>
<div class="padding-small" style="width: 100%">
<span id="drop-advanced-button-none" style="margin-right:5px;"></span>
<span id="drop-advanced-button-intext" style="margin-right:5px;"></span>
<span id="drop-advanced-button-inmargin" style="margin-right:5px;"></span>
</div>
<label class="header padding-small" style="width: 100%;"><%= scope.textParameters %></label>
<label class="input-label"><%= scope.textFont %></label>
<div id="drop-advanced-input-fonts" class="padding-small" style="width: 100%;"></div>
</div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td width="50%">
<label class="input-label"><%= scope.textRowHeight %></label>
<div id="drop-advanced-input-rowheight"></div>
</td>
<td width="50%">
<label class="input-label"><%= scope.textDistance %></label>
<div id="drop-advanced-input-distance"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-dropcap-borders" class="settings-panel">
<div class="inner-content">
<div style="width: 100%;" class="padding-small">
<label class="input-label" style="margin-right: 5px;"><%= scope.textBorderWidth %></label>
<div id="drop-advanced-input-bordersize" style="display: inline-block; vertical-align: middle; width: 93px;"></div>
<div style="display: inline-block; float:right;vertical-align: middle;">
<label class="input-label" style="margin-right: 5px;"><%= scope.textBorderColor %></label>
<div id="drop-advanced-button-bordercolor" style="display: inline-block;"></div>
</div>
</div>
<label class="input-label padding-small" style="width: 100%;"><%= scope.textBorderDesc %></label>
<div style="width: 100%;" class="padding-large">
<div id="drop-advanced-borderstyler" style="display: inline-block; vertical-align: middle; width: 200px; height: 170px;outline: 1px solid #ccc;"></div>
<div style="display: inline-block; float:right;vertical-align: middle; width: 80px; height: 170px; padding-top: 10px; padding-left: 4px;">
<div id="drop-advanced-button-borderline-00" style="display: inline-block;"></div>
<div id="drop-advanced-button-borderline-01" style="display: inline-block;"></div>
<div id="drop-advanced-button-borderline-10" style="display: inline-block;"></div>
<div id="drop-advanced-button-borderline-11" style="display: inline-block;"></div>
<div id="drop-advanced-button-borderline-20" style="display: inline-block;"></div>
<div id="drop-advanced-button-borderline-21" style="display: inline-block;"></div>
<div id="drop-advanced-button-borderline-30" style="display: inline-block;"></div>
<div id="drop-advanced-button-borderline-31" style="display: inline-block;"></div>
</div>
</div>
<div style="width: 100%;" class="padding-small">
<label class="input-label" style="margin-right: 5px;"><%= scope.textBackColor %></label>
<div id="drop-advanced-button-color" style="display: inline-block;"></div>
</div>
</div>
</div>
<div id="id-adv-dropcap-margins" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textTop %></label>
<div id="drop-advanced-input-top"></div>
</td>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textLeft %></label>
<div id="drop-advanced-input-left"></div>
</td>
</tr>
<tr>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textBottom %></label>
<div id="drop-advanced-input-bottom"></div>
</td>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textRight %></label>
<div id="drop-advanced-input-right"></div>
</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,28 @@
<div class="panel-menu">
<li class="fm-first-item"/>
<li id="fm-btn-return" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-save" class="fm-btn" />
<li id="fm-btn-edit" class="fm-btn" />
<li id="fm-btn-download" class="fm-btn" />
<li id="fm-btn-print" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-recent" class="fm-btn" />
<li id="fm-btn-create" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-info" class="fm-btn" />
<li class="devider" class="fm-btn" />
<li id="fm-btn-settings" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-help" class="fm-btn" />
<li class="devider" />
<li id="fm-btn-back" class="fm-btn" />
</div>
<div class="panel-context">
<div id="panel-saveas" class="content-box" />
<div id="panel-recentfiles" class="content-box" />
<div id="panel-createnew" class="content-box" />
<div id="panel-info" class="content-box" />
<div id="panel-settings" class="content-box" />
<div id="panel-help" class="content-box" />
</div>

View File

@@ -0,0 +1,63 @@
<table cols="1">
<tr>
<td>
<label class="header"><%= scope.textPageNum %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="headerfooter-button-top-left" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-top-center" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-top-right" style="display: inline-block; margin-right:5px;"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="headerfooter-button-bottom-left" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-bottom-center" style="display: inline-block; margin-right:5px;"></div>
<div id="headerfooter-button-bottom-right" style="display: inline-block; margin-right:5px;"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td>
<label class="header"><%= scope.textPosition %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<label id="headerfooter-label-position" class="input-label"><%= scope.textHeaderFromTop %></label>
<div id="headerfooter-spin-position"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td>
<label class="header"><%= scope.textOptions %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="headerfooter-check-diff-first"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="headerfooter-check-diff-odd"></div>
</td>
</tr>
<tr>
<td>
<div id="headerfooter-check-same-as"></div>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View File

@@ -0,0 +1,64 @@
<table cols="2">
<tr>
<td colspan=2>
<label class="header"><%= scope.textSize %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="50%">
<label id="image-label-width" class="input-label"><%= scope.textWidth %></label>
</td>
<td class="padding-small" width="50%">
<label id="image-label-height" class="input-label"><%= scope.textHeight %></label>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<button type="button" class="btn btn-text-default" id="image-button-original-size" style="width:100px;"><%= scope.textOriginalSize %></button>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2>
<label class="header"><%= scope.textWrap %></label>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div id="image-button-wrap" style=""></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2>
<label class="header"><%= scope.textInsert %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="50%">
<button type="button" class="btn btn-text-default" id="image-button-from-file" style="width:85px;"><%= scope.textFromFile %></button>
</td>
<td class="padding-small" width="50%">
<button type="button" class="btn btn-text-default" id="image-button-from-url" style="width:85px;"><%= scope.textFromUrl %></button>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td align="center" colspan=2>
<label class="link" id="image-advanced-link"><%= scope.textAdvanced %></label>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View File

@@ -0,0 +1,231 @@
<div id="id-adv-image-width" class="settings-panel active">
<div class="inner-content">
<table cols="4" width="100%">
<tr>
<td width="88px">
<label class="input-label"><%= scope.textWidth %></label>
<div id="image-advanced-spin-width"></div>
</td>
<td width="28px" style="vertical-align: bottom;">
<div id="image-advanced-button-ratio"></div>
</td>
<td width="88px">
<label class="input-label"><%= scope.textHeight %></label>
<div id="image-advanced-spin-height"></div>
</td>
<td style="vertical-align: bottom;">
<button type="button" class="btn btn-text-default" id="image-advanced-button-original-size" style="width:100px;"><%= scope.textOriginalSize %></button>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-image-wrap" class="settings-panel">
<div class="inner-content padding-large">
<label class="header padding-small"><%= scope.textWrap %></label>
<div class="padding-small">
<div id="image-advanced-button-wrap-inline" style="display: inline-block; margin-right:7px;"></div>
<div id="image-advanced-button-wrap-square" style="display: inline-block; margin-right:7px;"></div>
<div id="image-advanced-button-wrap-tight" style="display: inline-block; margin-right:7px;"></div>
<div id="image-advanced-button-wrap-through" style="display: inline-block; margin-right:7px;"></div>
</div>
<div class="padding-small">
<div id="image-advanced-button-wrap-topbottom" style="display: inline-block; margin-right:7px;"></div>
<div id="image-advanced-button-wrap-infront" style="display: inline-block; margin-right:7px;"></div>
<div id="image-advanced-button-wrap-behind" style="display: inline-block;"></div>
</div>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textDistance %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="125px">
<label class="input-label"><%= scope.textTop %></label>
<div id="image-advanced-distance-top"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textLeft %></label>
<div id="image-advanced-distance-left"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textBottom %></label>
<div id="image-advanced-distance-bottom"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRight %></label>
<div id="image-advanced-distance-right"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-image-position" class="settings-panel">
<div class="inner-content">
<table cols="3" style="width: 100%;">
<tr>
<td colspan="3" class="padding-small">
<label class="header"><%= scope.textHorizontal %></label>
</td>
</tr>
<tr>
<td style="vertical-align: bottom; padding-bottom: 12px;">
<div id="image-radio-halign"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textAlignment %></label>
<div id="image-combo-halign" style="width: 115px;"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRelative %></label>
<div id="image-combo-hrelative" style="width: 115px;"></div>
</td>
</tr>
<tr>
<td style="vertical-align: bottom; padding-bottom: 12px;">
<div id="image-radio-hposition"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textPosition %></label>
<div id="image-spin-x"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRightOf %></label>
<div id="image-combo-hposition" style="width: 115px;"></div>
</td>
</tr>
<tr>
<td colspan="3" class="padding-small">
<label class="header"><%= scope.textVertical %></label>
</td>
</tr>
<tr>
<td style="vertical-align: bottom; padding-bottom: 12px;">
<div id="image-radio-valign"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textAlignment %></label>
<div id="image-combo-valign" style="width: 115px;"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRelative %></label>
<div id="image-combo-vrelative" style="width: 115px;"></div>
</td>
</tr>
<tr>
<td style="vertical-align: bottom; padding-bottom: 19px;">
<div id="image-radio-vposition"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.textPosition %></label>
<div id="image-spin-y"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.textBelow %></label>
<div id="image-combo-vposition" style="width: 115px;"></div>
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan="2" class="padding-small">
<label class="header"><%= scope.textOptions %></label>
</td>
</tr>
<tr>
<td>
<div id="image-checkbox-move"></div>
</td>
<td>
<div id="image-checkbox-overlap"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-image-shape" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textLineStyle %></label>
</td>
</tr>
<tr>
<td class="padding-large" width="125px">
<label class="input-label"><%= scope.textCapType %></label>
<div id="shape-advanced-cap-type" style="width: 100px;"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.textJoinType %></label>
<div id="shape-advanced-join-type" style="width: 100px;"></div>
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textArrows %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="125px">
<label class="input-label"><%= scope.textBeginStyle %></label>
<div id="shape-advanced-begin-style" style="width: 100px;"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textEndStyle %></label>
<div id="shape-advanced-end-style" style="width: 100px;"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textBeginSize %></label>
<div id="shape-advanced-begin-size" style="width: 100px;"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textEndSize %></label>
<div id="shape-advanced-end-size" style="width: 100px;"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-image-margins" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small" width="125px">
<label class="input-label"><%= scope.textTop %></label>
<div id="image-margin-top"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textLeft %></label>
<div id="image-margin-left"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textBottom %></label>
<div id="image-margin-bottom"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRight %></label>
<div id="image-margin-right"></div>
</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,18 @@
<div id="view-left-menu" class="tool-menu left">
<div class="tool-menu-btns">
<button id="left-btn-file" class="btn btn-category" content-target="left-panel-file"><span class="btn-icon btn-menu-file">&nbsp;</span></button>
<button id="left-btn-search" class="btn btn-category" content-target=""><span class="btn-icon btn-menu-search">&nbsp;</span></button>
<!-- /** coauthoring begin **/ -->
<button id="left-btn-comments" class="btn btn-category" content-target="left-panel-comments"><span class="btn-icon btn-menu-comments">&nbsp;</span></button>
<button id="left-btn-chat" class="btn btn-category" content-target="left-panel-chat"><span class="btn-icon btn-menu-chat">&nbsp;</span></button>
<!-- /** coauthoring end **/ -->
<button id="left-btn-support" class="btn btn-category" content-target=""><span class="btn-icon btn-menu-support">&nbsp;</span></button>
<button id="left-btn-about" class="btn btn-category" content-target=""><span class="btn-icon btn-menu-about">&nbsp;</span></button>
</div>
<div class="left-panel" style="">
<!-- /** coauthoring begin **/ -->
<div id="left-panel-comments" class="" style="display: none;" />
<div id="left-panel-chat" class="" style="display: none;" />
<!-- /** coauthoring end **/ -->
</div>
</div>

View File

@@ -0,0 +1,54 @@
<table cols="2">
<tr>
<td colspan=2>
<label class="header"><%= scope.strParagraphSpacing %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textAt %></label>
<div id="paragraph-combo-line-rule" style="width: 85px;"></div>
</td>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textAt %></label>
<div id="paragraph-spin-line-height"></div>
</td>
</tr>
<tr>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.strSpacingBefore %></label>
<div id="paragraph-spin-spacing-before"></div>
</td>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.strSpacingAfter %></label>
<div id="paragraph-spin-spacing-after"></div>
</td>
</tr>
<tr class="text-only">
<td class="padding-small" colspan=2>
<div id="paragraph-checkbox-add-interval"></div>
</td>
</tr>
<tr class="text-only">
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr class="text-only">
<td class="padding-small" colspan=2>
<div id="paragraph-color-btn" style="display: inline-block;"></div>
<label class="input-label" style="margin-left: 5px;"><%= scope.textBackColor %></label>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td align="center" colspan=2>
<label class="link" id="paragraph-advanced-link"><%= scope.textAdvanced %></label>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View File

@@ -0,0 +1,180 @@
<div id="id-adv-paragraph-indents" class="settings-panel active">
<div class="inner-content">
<table cols="3" style="width: 100%;">
<tr>
<td class="padding-large">
<label class="input-label"><%= scope.strIndentsFirstLine %></label>
<div id="paragraphadv-spin-first-line" style="width: 85px;"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.strIndentsLeftText %></label>
<div id="paragraphadv-spin-indent-left"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.strIndentsRightText %></label>
<div id="paragraphadv-spin-indent-right"></div>
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large text-only"></div>
<div class="inner-content text-only" style="padding-right: 0px;" >
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small">
<div id="paragraphadv-checkbox-break-before"></div>
</td>
<td class="padding-small">
<div id="paragraphadv-checkbox-keep-lines"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="paragraphadv-checkbox-orphan"></div>
</td>
<td class="padding-small">
<div id="paragraphadv-checkbox-keep-next"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-paragraph-borders" class="settings-panel">
<div class="inner-content">
<div style="width: 100%;" class="padding-small">
<label class="input-label"><%= scope.textBorderWidth %></label>
<div id="paragraphadv-combo-border-size" style="display: inline-block; vertical-align: middle; width: 93px;"></div>
<div style="display: inline-block; float:right;vertical-align: middle;">
<label class="input-label" ><%= scope.textBorderColor %></label>
<div id="paragraphadv-border-color-btn" style="display: inline-block;"></div>
</div>
</div>
<label class="input-label padding-small" style="width: 100%;"><%= scope.textBorderDesc %></label>
<div style="width: 100%;" class="padding-large">
<div id="id-deparagraphstyler" style="display: inline-block; vertical-align: middle; width: 200px; height: 170px;outline: 1px solid #ccc;"></div>
<div style="display: inline-block; float:right;vertical-align: middle; width: 76px; text-align: right; height: 170px; padding-top: 10px;">
<div id="paragraphadv-button-border-top" style="display: inline-block;"></div>
<div id="paragraphadv-button-border-inner-hor" style="display: inline-block;"></div>
<div id="paragraphadv-button-border-bottom" style="display: inline-block;"></div>
<div id="paragraphadv-button-border-outer" style="display: inline-block;"></div>
<div id="paragraphadv-button-border-left" style="display: inline-block;"></div>
<div id="paragraphadv-button-border-all" style="display: inline-block;"></div>
<div id="paragraphadv-button-border-right" style="display: inline-block;"></div>
<div id="paragraphadv-button-border-none" style="display: inline-block;"></div>
</div>
</div>
<div style="width: 100%;" class="padding-small">
<label class="input-label" style="margin-right: 5px;"><%= scope.textBackColor %></label>
<div id="paragraphadv-back-color-btn" style="display: inline-block;"></div>
</div>
</div>
</div>
<div id="id-adv-paragraph-font" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textEffects %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="paragraphadv-checkbox-strike"></div>
</td>
<td class="padding-small">
<div id="paragraphadv-checkbox-subscript"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="paragraphadv-checkbox-double-strike"></div>
</td>
<td class="padding-small">
<div id="paragraphadv-checkbox-small-caps"></div>
</td>
</tr>
<tr>
<td class="padding-large">
<div id="paragraphadv-checkbox-superscript"></div>
</td>
<td class="padding-large">
<div id="paragraphadv-checkbox-all-caps"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textCharacterSpacing %></label>
</td>
</tr>
<tr>
<td class="padding-large" width="50%">
<label class="input-label"><%= scope.textSpacing %></label>
<div id="paragraphadv-spin-spacing"></div>
</td>
<td class="padding-large text-only" width="50%">
<label class="input-label"><%= scope.textPosition %></label>
<div id="paragraphadv-spin-position"></div>
</td>
</tr>
<tr>
<td colspan=2>
<div style="border: 1px solid #cbcbcb;">
<div id="paragraphadv-font-img" style="width: 300px; height: 80px; position: relative;"></div>
</div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-paragraph-tabs" class="settings-panel">
<div class="inner-content">
<div class="padding-small" style="display: inline-block;">
<label class="input-label"><%= scope.textTabPosition %></label>
<div id="paraadv-spin-tab"></div>
</div>
<div class="padding-small" style="display: inline-block; float: right;">
<label class="input-label"><%= scope.textDefault %></label>
<div id="paraadv-spin-default-tab"></div>
</div>
<div class="padding-large">
<div id="paraadv-list-tabs" style="width:180px; height: 90px;"></div>
</div>
<div class="padding-large" >
<label class="input-label padding-small" style="display: block;"><%= scope.textAlign %></label>
<div id="paragraphadv-radio-left" class="padding-small" style="display: block;"></div>
<div id="paragraphadv-radio-center" class="padding-small" style="display: block;"></div>
<div id="paragraphadv-radio-right" style="display: block;"></div>
</div>
<div>
<button type="button" class="btn btn-text-default" id="paraadv-button-add-tab" style="width:90px;margin-right: 4px;"><%= scope.textSet %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-tab" style="width:90px;margin-right: 4px;"><%= scope.textRemove %></button>
<button type="button" class="btn btn-text-default" id="paraadv-button-remove-all" style="width:90px;margin-right: 4px;"><%= scope.textRemoveAll %></button>
</div>
</div>
</div>
<div id="id-adv-paragraph-margins" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textTop %></label>
<div id="paraadv-number-margin-top"></div>
</td>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textLeft %></label>
<div id="paraadv-number-margin-left"></div>
</td>
</tr>
<tr>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textBottom %></label>
<div id="paraadv-number-margin-bottom"></div>
</td>
<td class="padding-small" width="50%">
<label class="input-label"><%= scope.textRight %></label>
<div id="paraadv-number-margin-right"></div>
</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,29 @@
<div id="view-right-menu" class="tool-menu right">
<div class="right-panel">
<div id="id-paragraph-settings" class="settings-panel">
</div>
<div id="id-table-settings" class="settings-panel">
</div>
<div id="id-image-settings" class="settings-panel">
</div>
<div id="id-header-settings" class="settings-panel">
</div>
<div id="id-shape-settings" class="settings-panel">
</div>
<!-- /** proprietary begin **/ -->
<div id="id-chart-settings" class="settings-panel">
</div>
<!-- /** proprietary end **/ -->
</div>
<div class="tool-menu-btns">
<div class="ct-btn-category arrow-left" />
<button id="id-right-menu-text" class="btn btn-category arrow-left" content-target="id-paragraph-settings"><span class="btn-icon btn-menu-text">&nbsp;</span></button>
<button id="id-right-menu-table" class="btn btn-category arrow-left" content-target="id-table-settings"><span class="btn-icon btn-menu-table">&nbsp;</span></button>
<button id="id-right-menu-image" class="btn btn-category arrow-left" content-target="id-image-settings"><span class="btn-icon btn-menu-image">&nbsp;</span></button>
<button id="id-right-menu-header" class="btn btn-category arrow-left" content-target="id-header-settings"><span class="btn-icon btn-menu-header">&nbsp;</span></button>
<button id="id-right-menu-shape" class="btn btn-category arrow-left" content-target="id-shape-settings"><span class="btn-icon btn-menu-shape">&nbsp;</span></button>
<!-- /** proprietary begin **/ -->
<button id="id-right-menu-chart" class="btn btn-category arrow-left" content-target="id-chart-settings"><span class="btn-icon btn-menu-chart">&nbsp;</span></button>
<!-- /** proprietary end **/ -->
</div>
</div>

View File

@@ -0,0 +1,151 @@
<table cols="1">
<tr>
<td>
<label class="header"><%= scope.strFill %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="shape-combo-fill-src" style="width: 100%;"></div>
</td>
</tr>
<tr>
<td>
<div id="shape-panel-color-fill" class="padding-small" style="width: 100%;">
<div id="shape-back-color-btn" style=""></div>
</div>
<div id="shape-panel-image-fill" class="settings-hidden padding-small" style="width: 100%;">
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small" width="50%">
<button type="button" class="btn btn-text-default" id="shape-button-from-file" style="width:90px;"><%= scope.textFromFile %></button>
</td>
<td class="padding-small" width="50%">
<button type="button" class="btn btn-text-default" id="shape-button-from-url" style="width:90px;"><%= scope.textFromUrl %></button>
</td>
</tr>
<tr>
<td style="vertical-align: top">
<div id="shape-combo-fill-type" style="width: 90px;"></div>
</td>
<td rowspan="2">
<div style="width: 90px; height: 80px; padding: 14px 20px; border: 1px solid #AFAFAF; border-radius: 2px; background: #ffffff;">
<div id="shape-texture-img" style="width: 50px;height: 50px;"></div>
</div>
</td>
</tr>
<tr>
<td style="vertical-align: bottom">
<label class="input-label" style=""><%= scope.textTexture %></label>
<div id="shape-combo-fill-texture" style="width: 90px;"></div>
</td>
</tr>
</table>
</div>
<div id="shape-panel-pattern-fill" class="settings-hidden padding-small" style="width: 100%;">
<label class="input-label" style="margin-top: 3px;"><%= scope.strPattern %></label>
<div id="shape-combo-pattern" style="width: 100%; height: 42px; margin-bottom: 8px;"></div>
<div style="width: 100%; height: 25px; margin-bottom: 8px;">
<label class="input-label" style="margin-top: 3px;"><%= scope.strForeground %></label>
<div id="shape-foreground-color-btn" style="display: inline-block; float:right;"></div>
</div>
<div style="width: 100%; height: 25px;">
<label class="input-label" style="margin-top: 3px;"><%= scope.strBackground %></label>
<div id="shape-background-color-btn" style="display: inline-block; float:right;"></div>
</div>
</div>
<div id="shape-panel-gradient-fill" class="settings-hidden padding-small" style="width: 100%;">
<div style="height:80px;">
<div style="display: inline-block;">
<label class="input-label" style=""><%= scope.textStyle %></label>
<div id="shape-combo-grad-type" style="width: 90px;"></div>
</div>
<div style="display: inline-block;float: right;">
<label class="input-label" style=""><%= scope.textDirection %></label>
<div id="shape-button-direction" style=""></div>
</div>
</div>
<label class="header" style="display:block;margin-bottom: 5px;"><%= scope.textGradient %></label>
<div style="display: inline-block; margin-top: 3px;">
<div id="shape-slider-gradient" style="display: inline-block; vertical-align: middle;"></div>
</div>
<div id="shape-gradient-color-btn" style="display: inline-block;float: right;"></div>
</div>
</td>
</tr>
<tr>
<td>
<div class="padding-small" id="shape-panel-transparent-fill" style="width: 100%;">
<label class="header" style="display:block;"><%= scope.strTransparency %></label>
<div style="display: inline-block; margin-top: 3px;">
<label id="shape-lbl-transparency-start">0</label>
<div id="shape-slider-transparency" style="display: inline-block;margin: 0 4px; vertical-align: middle;"></div>
<label id="shape-lbl-transparency-end">100</label>
</div>
<div id="shape-spin-transparency" style="display: inline-block;float: right;"></div>
</div>
</td>
</tr>
<tr>
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td>
<label class="header"><%= scope.strStroke %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div style="display:inline-block;width:100px;vertical-align: middle;">
<label class="input-label" style=""><%= scope.strSize %></label>
<div id="shape-combo-border-size" style="width: 93px;"></div>
</div>
<div style="display:inline-block;vertical-align: middle;">
<label class="input-label" style=""><%= scope.strColor %></label>
<div id="shape-border-color-btn" style=""></div>
</div>
</td>
</tr>
<tr class="shape-only">
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr class="shape-only">
<td>
<label class="header"><%= scope.textWrap %></label>
</td>
</tr>
<tr class="shape-only">
<td>
<div id="shape-button-wrap" style=""></div>
</td>
</tr>
<tr class="shape-only">
<td class="padding-small"></td>
</tr>
<tr class="shape-only">
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr class="shape-only">
<td class="padding-small">
<label class="header" style="margin-top: 3px;"><%= scope.strChange %></label>
<div id="shape-btn-change" style="display: inline-block; float:right;"></div>
</td>
</tr>
<tr class="shape-only">
<td class="padding-small">
<div class="separator horizontal"></div>
</td>
</tr>
<tr class="shape-only">
<td align="center">
<label class="link" id="shape-advanced-link"><%= scope.textAdvanced %></label>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View File

@@ -0,0 +1,45 @@
<div class="statusbar" style="display:table;">
<div class="status-group dropup">
<label id="status-label-pages" class="status-label" style="margin-left: 40px;" data-toggle="dropdown"><%= Common.Utils.String.format(scope.pageIndexText, 1, 1) %></label>
<div id="status-goto-box" class="dropdown-menu">
<label style="float:left;line-height:22px;"><%= scope.goToPageText %></label>
<div id="status-goto-page" style="display:inline-block;"></div>
</div>
</div>
<!-- /** coauthoring begin **/ -->
<div id="status-users-ct" class="status-group" style="display:none;">
<div class="separator short" style="margin-right: 12px; margin-left: 40px;" />
<div id="status-users-block" style="display:inline-block; cursor:pointer;">
<span id="status-users-icon" />
<label id="status-users-count" class="status-label">3</label>
</div>
<div class="separator short" style="margin-left: 10px;" />
</div>
<!-- /** coauthoring end **/ -->
<div class="status-group" style="width:100%; text-align:center;">
<label id="status-label-action" class="status-label"></label>
</div>
<div class="status-group" style="">
<div class="separator short el-edit"></div>
<div class="cnt-lang el-edit">
<div class="dropdown-toggle" data-toggle="dropdown" style="margin-right: 6px;">
<span class="icon-lang-flag" data-vertical-offset="10" />
<label id="status-label-lang" class="status-label">English (United States)</label>
<div class="caret up" />
</div>
</div>
<button id="btn-doc-lang" type="button" class="btn small btn-toolbar btn-toolbar-default el-edit"><span class="btn-icon">&nbsp;</span></button>
<button id="btn-doc-spell" type="button" class="btn small btn-toolbar btn-toolbar-default el-edit"><span class="btn-icon">&nbsp;</span></button>
<div class="separator short el-edit"></div>
<button id="btn-zoom-topage" type="button" class="btn small btn-toolbar btn-toolbar-default"><span class="btn-icon">&nbsp;</span></button>
<button id="btn-zoom-towidth" type="button" class="btn small btn-toolbar btn-toolbar-default"><span class="btn-icon">&nbsp;</span></button>
<button id="btn-zoom-down" type="button" class="btn small btn-toolbar btn-toolbar-default"><span class="btn-icon">&nbsp;</span></button>
<div class="cnt-zoom">
<div class="dropdown-toggle" data-toggle="dropdown">
<label id="status-label-zoom" class="status-label">Zoom 100%</label>
</div>
</div>
<button id="btn-zoom-up" type="button" class="btn small btn-toolbar btn-toolbar-default" style="margin-right:40px;"><span class="btn-icon">&nbsp;</span></button>
</div>
</div>

View File

@@ -0,0 +1,140 @@
<table cols="2">
<tr>
<td width="50%">
<label class="header"><%= scope.textRows %></label>
</td>
<td width="50%">
<label class="header"><%= scope.textColumns %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="table-checkbox-header"></div>
</td>
<td class="padding-small">
<div id="table-checkbox-first"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="table-checkbox-total"></div>
</td>
<td class="padding-small">
<div id="table-checkbox-last"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="table-checkbox-banded"></div>
</td>
<td class="padding-small">
<div id="table-checkbox-col-banded"></div>
</td>
</tr>
<tr>
<td colspan=2>
<label class="header"><%= scope.textTemplate %></label>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<div class="" id="table-combo-template" style="width: 100%; height: 64px;"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textBorders %></label>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div id="table-combo-border-size" style="display: inline-block; vertical-align: middle; width: 93px;"></div>
<div style="display: inline-block; float:right;vertical-align: middle;">
<label class="input-label" style="margin-right: 5px;"><%= scope.textBorderColor %></label>
<div id="table-border-color-btn" style="display: inline-block;"></div>
</div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<label class="input-label"><%= scope.textSelectBorders %></label>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<div id="table-button-border-all" style="display: inline-block;"></div>
<div id="table-button-border-none" style="display: inline-block;"></div>
<div id="table-button-border-inner" style="display: inline-block;"></div>
<div id="table-button-border-outer" style="display: inline-block;"></div>
</td>
</tr>
<tr>
<td colspan=2 class="padding-small">
<div id="table-button-border-left" style="display: inline-block;"></div>
<div id="table-button-border-inner-vert" style="display: inline-block;"></div>
<div id="table-button-border-right" style="display: inline-block;"></div>
<div id="table-button-border-top" style="display: inline-block;"></div>
<div id="table-button-border-inner-hor" style="display: inline-block;"></div>
<div id="table-button-border-bottom" style="display: inline-block;"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2 align="right">
<label class="input-label" style="margin-right: 5px;"><%= scope.textBackColor %></label>
<div id="table-back-color-btn" style="display: inline-block;text-align:left;"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td colspan=2>
<label class="header"><%= scope.textWrap %></label>
</td>
</tr>
<tr>
<td class="padding-small">
<div id="table-button-wrap-none" style="display: inline-block; margin-right:5px;"></div>
<div id="table-button-wrap-parallel" style="display: inline-block; margin-right:5px;"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<label class="header" style="margin-top: 3px;"><%= scope.textEdit %></label>
<div id="table-btn-edit" style="display: inline-block; float:right;"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div id="table-checkbox-repeat-row"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr>
<td align="center" colspan=2>
<label class="link" id="table-advanced-link"><%= scope.textAdvanced %></label>
</td>
</tr>
<tr class="finish-cell"></tr>
</table>

View File

@@ -0,0 +1,276 @@
<div id="id-adv-table-width" class="settings-panel active">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td class="padding-small" width="125px">
<div id="tableadv-checkbox-width"></div>
</td>
<td class="padding-small">
<div id="tableadv-checkbox-spacing"></div>
</td>
</tr>
<tr>
<td class="padding-large">
<div id="tableadv-number-width"></div>
</td>
<td class="padding-large">
<div id="tableadv-number-spacing"></div>
</td>
</tr>
<tr>
<td colspan="2" class="padding-large">
<div id="tableadv-checkbox-autofit"></div>
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textDefaultMargins %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="125px">
<label class="input-label"><%= scope.textTop %></label>
<div id="tableadv-number-margin-table-top"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textLeft %></label>
<div id="tableadv-number-margin-table-left"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textBottom %></label>
<div id="tableadv-number-margin-table-bottom"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRight %></label>
<div id="tableadv-number-margin-table-right"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-table-cell-props" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textMargins %></label>
</td>
</tr>
<tr>
<td colspan="2" class="padding-small">
<div id="tableadv-checkbox-margins"></div>
</td>
</tr>
<tr>
<td class="padding-small" width="125px">
<label class="input-label"><%= scope.textTop %></label>
<div id="tableadv-number-margin-top"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textLeft %></label>
<div id="tableadv-number-margin-left"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textBottom %></label>
<div id="tableadv-number-margin-bottom"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRight %></label>
<div id="tableadv-number-margin-right"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-table-wrap" class="settings-panel">
<div class="inner-content padding-large">
<div id="tableadv-button-wrap-none" style="display: inline-block; margin-right:5px;"></div>
<div id="tableadv-button-wrap-parallel" style="display: inline-block; margin-right:5px;"></div>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<div id="tableadv-panel-align" style="width: 100%;">
<label class="header padding-small"><%= scope.textAlign %></label>
<div class="padding-large">
<div id="tableadv-button-align-left" style="display: inline-block; margin-right:5px;"></div>
<div id="tableadv-button-align-center" style="display: inline-block; margin-right:5px;"></div>
<div id="tableadv-button-align-right" style="display: inline-block; margin-right:5px;"></div>
</div>
<div>
<label class="input-label" style="margin-right:5px;"><%= scope.textIndLeft %></label>
<div id="tableadv-number-indent" style="display: inline-block;vertical-align: middle;"></div>
</div>
</div>
<div id="tableadv-panel-distance" class="settings-hidden" style="width: 100%;">
<table cols="2" style="width: 100%;">
<tr>
<td colspan=2 class="padding-small">
<label class="header"><%= scope.textDistance %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="125px">
<label class="input-label"><%= scope.textTop %></label>
<div id="tableadv-number-distance-top"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textLeft %></label>
<div id="tableadv-number-distance-left"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textBottom %></label>
<div id="tableadv-number-distance-bottom"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRight %></label>
<div id="tableadv-number-distance-right"></div>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="id-adv-table-borders" class="settings-panel">
<div class="inner-content padding-large">
<div style="width: 100%;">
<label class="input-label"><%= scope.textBorderWidth %></label>
<div id="tableadv-combo-border-size" style="display: inline-block; vertical-align: middle; width: 93px;"></div>
<div style="display: inline-block; float:right;vertical-align: middle;">
<label class="input-label" ><%= scope.textBorderColor %></label>
<div id="tableadv-border-color-btn" style="display: inline-block;"></div>
</div>
</div>
</div>
<div class="inner-content">
<label class="input-label padding-large" style="width: 100%;"><%= scope.textBorderDesc %></label>
<div id="tableadv-panel-borders" style="width: 100%;" class="padding-large">
<div id="id-detablestyler" style="display: inline-block; vertical-align: middle; width: 200px; height: 200px;outline: 1px solid #ccc;"></div>
<div style="display: inline-block; vertical-align: middle; width: 76px; height: 200px; padding-top: 10px; padding-left: 10px;">
<div id="tableadv-button-border-all"></div>
<div id="tableadv-button-border-none"></div>
<div id="tableadv-button-border-inner"></div>
<div id="tableadv-button-border-outer"></div>
</div>
</div>
<div id="tableadv-panel-borders-spacing" style="width: 100%;" class="padding-large settings-hidden">
<div id="id-detablestyler-spacing" style="display: inline-block; vertical-align: middle; width: 200px; height: 200px;outline: 1px solid #ccc;"></div>
<div style="display: inline-block; float:right;vertical-align: middle; width: 76px; height: 200px; padding-top: 10px;">
<div id="tableadv-button-border-all-none" style="display: inline-block;"></div>
<div id="tableadv-button-border-all-table" style="display: inline-block;"></div>
<div id="tableadv-button-border-none-none" style="display: inline-block;"></div>
<div id="tableadv-button-border-none-table" style="display: inline-block;"></div>
<div id="tableadv-button-border-inner-none" style="display: inline-block;"></div>
<div id="tableadv-button-border-inner-table" style="display: inline-block;"></div>
<div id="tableadv-button-border-outer-none" style="display: inline-block;"></div>
<div id="tableadv-button-border-outer-table" style="display: inline-block;"></div>
</div>
</div>
<div style="width: 100%;">
<div id="tableadv-panel-cell-back" style="display: inline-block;">
<label class="input-label" style="margin-right: 5px;"><%= scope.textBackColor %></label>
<div id="tableadv-button-back-color" style="display: inline-block;"></div>
</div>
<div id="tableadv-panel-table-back" style="display: inline-block;">
<label class="input-label" style="margin-right: 5px;"><%= scope.textTableBackColor %></label>
<div id="tableadv-button-table-back-color" style="display: inline-block;"></div>
</div>
</div>
</div>
</div>
<div id="id-adv-table-position" class="settings-panel">
<div class="inner-content">
<table cols="3" style="width: 100%;">
<tr>
<td colspan="3" class="padding-small">
<label class="header"><%= scope.textHorizontal %></label>
</td>
</tr>
<tr>
<td style="vertical-align: bottom; padding-bottom: 12px;">
<div id="tableadv-radio-halign"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textAlignment %></label>
<div id="tableadv-combo-halign" style="width: 115px;"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRelative %></label>
<div id="tableadv-combo-hrelative" style="width: 115px;"></div>
</td>
</tr>
<tr>
<td style="vertical-align: bottom; padding-bottom: 12px;">
<div id="tableadv-radio-hposition"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textPosition %></label>
<div id="tableadv-spin-x"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRightOf %></label>
<div id="tableadv-combo-hposition" style="width: 115px;"></div>
</td>
</tr>
<tr>
<td colspan="3" class="padding-small">
<label class="header"><%= scope.textVertical %></label>
</td>
</tr>
<tr>
<td style="vertical-align: bottom; padding-bottom: 12px;">
<div id="tableadv-radio-valign"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textAlignment %></label>
<div id="tableadv-combo-valign" style="width: 115px;"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textRelative %></label>
<div id="tableadv-combo-vrelative" style="width: 115px;"></div>
</td>
</tr>
<tr>
<td style="vertical-align: bottom; padding-bottom: 19px;">
<div id="tableadv-radio-vposition"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.textPosition %></label>
<div id="tableadv-spin-y"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.textBelow %></label>
<div id="tableadv-combo-vposition" style="width: 115px;"></div>
</td>
</tr>
</table>
</div>
<div class="separator horizontal padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan="2" class="padding-small">
<label class="header"><%= scope.textOptions %></label>
</td>
</tr>
<tr>
<td>
<div id="tableadv-checkbox-move"></div>
</td>
<td>
<div id="tableadv-checkbox-overlap"></div>
</td>
</tr>
</table>
</div>
</div>

View File

@@ -0,0 +1,202 @@
<div class="toolbar" style="<%= isCompactView ? 'height: 41px;' : 'height: 67px;' %>">
<!---------------------->
<!--Short view toolbar-->
<!---------------------->
<div id="id-toolbar-short" style="<%= isCompactView ? 'display: table;' : 'display: none;' %> width: 100%;" >
<div class="toolbar-group no-mask">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-print"></span>
<span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-save"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-undo"></span>
<span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-redo"></span>
</div>
</div>
<div class="separator short"></div>
<div class="toolbar-group">
<div class="toolbar-row" style="width: 140px; margin-top: -1px;">
<span class="btn-placeholder" style="float: left; width: 90px;" id="id-toolbar-short-placeholder-field-fontname"></span>
<span class="btn-placeholder" style="float: left; width: 45px; margin-left: 2px;" id="id-toolbar-short-placeholder-field-fontsize"></span>
</div>
</div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-bold"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-italic"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-underline"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-highlight"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-fontcolor"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-halign"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-markers"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-numbering"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-multilevels"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-decoffset"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-incoffset"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-linespace"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-hidenchars"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertimage"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-inserttable"></span>
<!-- /** proprietary begin **/ -->
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertchart"></span>
<!-- /** proprietary end **/ -->
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-inserthyperlink"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-insertshape"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-pagebreak"></span>
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-editheader"></span>
</div>
</div>
<div class="separator short" style="margin-left: 5px;"></div>
<div class="toolbar-group" style="padding-left: 10px;">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-short-placeholder-btn-copystyle"></span>
</div>
</div>
<div class="toolbar-group" style="width: 100%; padding-left: 6px;"></div>
<div class="toolbar-group no-mask" style="padding-left:0;">
<div class="toolbar-row">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-short-placeholder-btn-hidebars"></span>
</div>
</div>
</div>
</div>
<!---------------------->
<!--Fully view toolbar-->
<!---------------------->
<div id="id-toolbar-full" style="<%= isCompactView ? 'display: none;' : 'display: table;' %> width: 100%;" >
<div class="toolbar-group toolbar-group-native">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-newdocument"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-opendocument"></span>
</div>
</div>
<div class="toolbar-group no-mask">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-print"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-save"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-copy"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-paste"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-undo"></span>
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-redo"></span>
</div>
</div>
<div class="separator long"></div>
<div class="toolbar-group">
<div class="toolbar-row" style="width:265px;">
<span class="btn-placeholder" style="float: left; width: 165px;" id="id-toolbar-full-placeholder-field-fontname"></span>
<span class="btn-placeholder" style="float: left; width: 45px; margin-left: 2px;" id="id-toolbar-full-placeholder-field-fontsize"></span>
<span class="btn-placeholder border" id="id-toolbar-full-placeholder-btn-incfont" style="margin-left: 2px;"></span>
<span class="btn-placeholder border" id="id-toolbar-full-placeholder-btn-decfont" style="margin-left: 2px;"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-bold"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-italic"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-underline"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-strikeout"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-superscript"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-subscript"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-highlight"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-fontcolor"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-paracolor"></span>
</div>
</div>
<div class="separator long" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-markers"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-numbering"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-multilevels"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-decoffset"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-incoffset"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-linespace"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-left"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-center"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-right"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-align-just"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-hidenchars"></span>
</div>
</div>
<div class="separator long" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-pagebreak"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertimage"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertchart"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserttext"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-dropcap"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-editheader"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserttable"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-inserthyperlink"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertshape"></span>
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-insertequation"></span>
</div>
</div>
<div class="separator long" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-pageorient"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-pagesize"></span>
</div>
</div>
<div class="separator long" style="margin-left: 5px;"></div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-clearstyle"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-copystyle"></span>
</div>
</div>
<div class="toolbar-group">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-colorschemas"></span>
</div>
</div>
<div class="toolbar-group" id="id-toolbar-full-placeholder-field-styles" style="width: 100%; min-width: 100px;">
</div>
<div class="toolbar-group no-mask">
<div class="toolbar-row">
<span class="btn-placeholder split" id="id-toolbar-full-placeholder-btn-hidebars"></span>
</div>
<div class="toolbar-row">
<span class="btn-placeholder" id="id-toolbar-full-placeholder-btn-settings"></span>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,16 @@
<div class="layout-region">
<div id="viewport-vbox-layout" class="layout-ct vbox">
<div id="header" class="layout-item"></div>
<div id="toolbar" class="layout-item"></div>
<div class="layout-item">
<div id="viewport-hbox-layout" class="layout-ct hbox">
<div id="left-menu" class="layout-item" style="width: 40px;"></div>
<div id="file-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
<div id="about-menu-panel" class="left-menu-full-ct" style="display:none;"></div>
<div id="editor_sdk" class="layout-item"></div>
<div id="right-menu" class="layout-item"></div>
</div>
</div>
<div id="statusbar" class="layout-item"></div>
</div>
</div>

View File

@@ -0,0 +1,620 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!documenteditor/main/app/template/ChartSettings.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "documenteditor/main/app/view/ImageSettingsAdvanced"], function (menuTemplate, $, _, Backbone) {
DE.Views.ChartSettings = Backbone.View.extend(_.extend({
el: "#id-chart-settings",
template: _.template(menuTemplate),
events: {},
options: {
alias: "ChartSettings"
},
initialize: function () {
var me = this;
this._initSettings = true;
this._state = {
WrappingStyle: c_oAscWrapStyle2.Inline,
CanBeFlow: true,
Width: 0,
Height: 0,
FromGroup: false,
ChartStyle: 1,
ChartType: -1,
SeveralCharts: false,
DisabledControls: false
};
this.lockedControls = [];
this._locked = false;
this._noApply = false;
this._originalProps = null;
this.render();
var viewData = [{
offsetx: 0,
data: c_oAscWrapStyle2.Inline,
iconCls: "wrap-inline",
tip: this.txtInline,
selected: true
},
{
offsetx: 50,
data: c_oAscWrapStyle2.Square,
iconCls: "wrap-square",
tip: this.txtSquare
},
{
offsetx: 100,
data: c_oAscWrapStyle2.Tight,
iconCls: "wrap-tight",
tip: this.txtTight
},
{
offsetx: 150,
data: c_oAscWrapStyle2.Through,
iconCls: "wrap-through",
tip: this.txtThrough
},
{
offsetx: 200,
data: c_oAscWrapStyle2.TopAndBottom,
iconCls: "wrap-topAndBottom",
tip: this.txtTopAndBottom
},
{
offsetx: 250,
data: c_oAscWrapStyle2.InFront,
iconCls: "wrap-inFront",
tip: this.txtInFront
},
{
offsetx: 300,
data: c_oAscWrapStyle2.Behind,
iconCls: "wrap-behind",
tip: this.txtBehind
}];
this.btnWrapType = new Common.UI.Button({
cls: "btn-large-dataview",
iconCls: "item-wrap wrap-inline",
menu: new Common.UI.Menu({
items: [{
template: _.template('<div id="id-chart-menu-wrap" style="width: 235px; margin: 0 5px;"></div>')
}]
})
});
this.btnWrapType.on("render:after", function (btn) {
me.mnuWrapPicker = new Common.UI.DataView({
el: $("#id-chart-menu-wrap"),
parentMenu: btn.menu,
store: new Common.UI.DataViewStore(viewData),
itemTemplate: _.template('<div id="<%= id %>" class="item-wrap" style="background-position: -<%= offsetx %>px 0;"></div>')
});
});
this.btnWrapType.render($("#chart-button-wrap"));
this.mnuWrapPicker.on("item:click", _.bind(this.onSelectWrap, this, this.btnWrapType));
this.lockedControls.push(this.btnWrapType);
this.btnChartType = new Common.UI.Button({
cls: "btn-large-dataview",
iconCls: "item-chartlist bar-normal",
menu: new Common.UI.Menu({
style: "width: 330px;",
items: [{
template: _.template('<div id="id-chart-menu-type" class="menu-insertchart" style="margin: 5px 5px 5px 10px;"></div>')
}]
})
});
this.btnChartType.on("render:after", function (btn) {
me.mnuChartTypePicker = new Common.UI.DataView({
el: $("#id-chart-menu-type"),
parentMenu: btn.menu,
restoreHeight: 411,
groups: new Common.UI.DataViewGroupStore([{
id: "menu-chart-group-bar",
caption: me.textColumn
},
{
id: "menu-chart-group-line",
caption: me.textLine
},
{
id: "menu-chart-group-pie",
caption: me.textPie
},
{
id: "menu-chart-group-hbar",
caption: me.textBar
},
{
id: "menu-chart-group-area",
caption: me.textArea
},
{
id: "menu-chart-group-scatter",
caption: me.textPoint
},
{
id: "menu-chart-group-stock",
caption: me.textStock
}]),
store: new Common.UI.DataViewStore([{
group: "menu-chart-group-bar",
type: c_oAscChartTypeSettings.barNormal,
iconCls: "column-normal",
selected: true
},
{
group: "menu-chart-group-bar",
type: c_oAscChartTypeSettings.barStacked,
iconCls: "column-stack"
},
{
group: "menu-chart-group-bar",
type: c_oAscChartTypeSettings.barStackedPer,
iconCls: "column-pstack"
},
{
group: "menu-chart-group-line",
type: c_oAscChartTypeSettings.lineNormal,
iconCls: "line-normal"
},
{
group: "menu-chart-group-line",
type: c_oAscChartTypeSettings.lineStacked,
iconCls: "line-stack"
},
{
group: "menu-chart-group-line",
type: c_oAscChartTypeSettings.lineStackedPer,
iconCls: "line-pstack"
},
{
group: "menu-chart-group-pie",
type: c_oAscChartTypeSettings.pie,
iconCls: "pie-normal"
},
{
group: "menu-chart-group-pie",
type: c_oAscChartTypeSettings.doughnut,
iconCls: "pie-doughnut"
},
{
group: "menu-chart-group-hbar",
type: c_oAscChartTypeSettings.hBarNormal,
iconCls: "bar-normal"
},
{
group: "menu-chart-group-hbar",
type: c_oAscChartTypeSettings.hBarStacked,
iconCls: "bar-stack"
},
{
group: "menu-chart-group-hbar",
type: c_oAscChartTypeSettings.hBarStackedPer,
iconCls: "bar-pstack"
},
{
group: "menu-chart-group-area",
type: c_oAscChartTypeSettings.areaNormal,
iconCls: "area-normal"
},
{
group: "menu-chart-group-area",
type: c_oAscChartTypeSettings.areaStacked,
iconCls: "area-stack"
},
{
group: "menu-chart-group-area",
type: c_oAscChartTypeSettings.areaStackedPer,
iconCls: "area-pstack"
},
{
group: "menu-chart-group-scatter",
type: c_oAscChartTypeSettings.scatter,
iconCls: "point-normal"
},
{
group: "menu-chart-group-stock",
type: c_oAscChartTypeSettings.stock,
iconCls: "stock-normal"
}]),
itemTemplate: _.template('<div id="<%= id %>" class="item-chartlist <%= iconCls %>"></div>')
});
});
this.btnChartType.render($("#chart-button-type"));
this.mnuChartTypePicker.on("item:click", _.bind(this.onSelectType, this, this.btnChartType));
this.lockedControls.push(this.btnChartType);
this.btnChartStyle = new Common.UI.Button({
cls: "btn-large-dataview",
iconCls: "item-wrap",
menu: new Common.UI.Menu({
menuAlign: "tr-br",
items: [{
template: _.template('<div id="id-chart-menu-style" style="width: 245px; margin: 0 5px;"></div>')
}]
})
});
this.btnChartStyle.on("render:after", function (btn) {
me.mnuChartStylePicker = new Common.UI.DataView({
el: $("#id-chart-menu-style"),
style: "max-height: 411px;",
parentMenu: btn.menu,
store: new Common.UI.DataViewStore(),
itemTemplate: _.template('<div id="<%= id %>" class="item-wrap" style="background-image: url(<%= imageUrl %>); background-position: 0 0;"></div>')
});
if (me.btnChartStyle.menu) {
me.btnChartStyle.menu.on("show:after", function () {
me.mnuChartStylePicker.scroller.update({
alwaysVisibleY: true
});
});
}
});
this.btnChartStyle.render($("#chart-button-style"));
this.mnuChartStylePicker.on("item:click", _.bind(this.onSelectStyle, this, this.btnChartStyle));
this.lockedControls.push(this.btnChartStyle);
this.labelWidth = $(this.el).find("#chart-label-width");
this.labelHeight = $(this.el).find("#chart-label-height");
this.btnEditData = new Common.UI.Button({
el: $("#chart-button-edit-data")
});
this.lockedControls.push(this.btnEditData);
this.btnEditData.on("click", _.bind(this.setEditData, this));
$(this.el).on("click", "#chart-advanced-link", _.bind(this.openAdvancedSettings, this));
},
render: function () {
var el = $(this.el);
el.html(this.template({
scope: this
}));
this.linkAdvanced = $("#chart-advanced-link");
},
setApi: function (api) {
this.api = api;
if (this.api) {
this.api.asc_registerCallback("asc_onImgWrapStyleChanged", _.bind(this._ChartWrapStyleChanged, this));
this.api.asc_registerCallback("asc_onUpdateChartStyles", _.bind(this._onUpdateChartStyles, this));
}
return this;
},
ChangeSettings: function (props) {
if (this._initSettings) {
this.createDelayedElements();
this._initSettings = false;
}
this.disableControls(this._locked);
if (props && props.get_ChartProperties()) {
this._originalProps = new CImgProperty(props);
this._noApply = true;
var value = props.get_WrappingStyle();
if (this._state.WrappingStyle !== value) {
var record = this.mnuWrapPicker.store.findWhere({
data: value
});
this.mnuWrapPicker.selectRecord(record, true);
if (record) {
this.btnWrapType.setIconCls("item-wrap " + record.get("iconCls"));
} else {
this.btnWrapType.setIconCls("");
}
this._state.WrappingStyle = value;
}
this.chartProps = props.get_ChartProperties();
value = props.get_SeveralCharts() || this._locked;
if (this._state.SeveralCharts !== value) {
this.btnEditData.setDisabled(value);
this._state.SeveralCharts = value;
}
value = props.get_SeveralChartTypes();
if (this._state.SeveralCharts && value) {
this.btnChartType.setIconCls("");
this._state.ChartType = null;
} else {
var type = this.chartProps.getType();
if (this._state.ChartType !== type) {
var record = this.mnuChartTypePicker.store.findWhere({
type: type
});
this.mnuChartTypePicker.selectRecord(record, true);
if (record) {
this.btnChartType.setIconCls("item-chartlist " + record.get("iconCls"));
}
this.updateChartStyles(this.api.asc_getChartPreviews(type));
this._state.ChartType = type;
}
}
value = props.get_SeveralChartStyles();
if (this._state.SeveralCharts && value) {
var btnIconEl = this.btnChartStyle.cmpEl.find("span.btn-icon");
btnIconEl.css("background-image", "none");
this.mnuChartStylePicker.selectRecord(null, true);
this._state.ChartStyle = null;
} else {
value = this.chartProps.getStyle();
if (this._state.ChartStyle !== value) {
var record = this.mnuChartStylePicker.store.findWhere({
data: value
});
this.mnuChartStylePicker.selectRecord(record, true);
if (record) {
var btnIconEl = this.btnChartStyle.cmpEl.find("span.btn-icon");
btnIconEl.css("background-image", "url(" + record.get("imageUrl") + ")");
}
this._state.ChartStyle = value;
}
}
this._noApply = false;
value = props.get_CanBeFlow() && !this._locked;
var fromgroup = props.get_FromGroup() || this._locked;
if (this._state.CanBeFlow !== value || this._state.FromGroup !== fromgroup) {
this.btnWrapType.setDisabled(!value || fromgroup);
this._state.CanBeFlow = value;
this._state.FromGroup = fromgroup;
}
value = props.get_Width();
if (Math.abs(this._state.Width - value) > 0.001) {
this.labelWidth[0].innerHTML = this.textWidth + ": " + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + " " + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this._state.Width = value;
}
value = props.get_Height();
if (Math.abs(this._state.Height - value) > 0.001) {
this.labelHeight[0].innerHTML = this.textHeight + ": " + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + " " + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this._state.Height = value;
}
}
},
updateMetricUnit: function () {
var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width);
this.labelWidth[0].innerHTML = this.textWidth + ": " + value.toFixed(1) + " " + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height);
this.labelHeight[0].innerHTML = this.textHeight + ": " + value.toFixed(1) + " " + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
},
createDelayedElements: function () {
this.updateMetricUnit();
},
_ChartWrapStyleChanged: function (style) {
if (this._state.WrappingStyle !== style) {
this._noApply = true;
var record = this.mnuWrapPicker.store.findWhere({
data: style
});
this.mnuWrapPicker.selectRecord(record, true);
if (record) {
this.btnWrapType.setIconCls("item-wrap " + record.get("iconCls"));
}
this._state.WrappingStyle = style;
this._noApply = false;
}
},
onSelectWrap: function (btn, picker, itemView, record) {
if (this._noApply) {
return;
}
var rawData = {},
isPickerSelect = _.isFunction(record.toJSON);
if (isPickerSelect) {
if (record.get("selected")) {
rawData = record.toJSON();
} else {
return;
}
} else {
rawData = record;
}
this.btnWrapType.setIconCls("item-wrap " + rawData.iconCls);
if (this.api) {
var props = new CImgProperty();
props.put_WrappingStyle((rawData.data));
if (this._state.WrappingStyle === c_oAscWrapStyle2.Inline && rawData.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);
},
setEditData: function () {
var diagramEditor = DE.getController("Common.Controllers.ExternalDiagramEditor").getView("Common.Views.ExternalDiagramEditor");
if (diagramEditor) {
diagramEditor.setEditMode(true);
diagramEditor.show();
var chart = this.api.asc_getChartObject();
if (chart) {
diagramEditor.setChartData(new Asc.asc_CChartBinary(chart));
}
}
},
openAdvancedSettings: function (e) {
if (this.linkAdvanced.hasClass("disabled")) {
return;
}
var me = this;
var win;
if (me.api && !this._locked) {
var selectedElements = me.api.getSelectedElements();
if (selectedElements && selectedElements.length > 0) {
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) {
var imgsizeMax = this.api.GetSectionInfo();
imgsizeMax = {
width: imgsizeMax.get_PageWidth() - (imgsizeMax.get_MarginLeft() + imgsizeMax.get_MarginRight()),
height: imgsizeMax.get_PageHeight() - (imgsizeMax.get_MarginTop() + imgsizeMax.get_MarginBottom())
};
(new DE.Views.ImageSettingsAdvanced({
imageProps: elValue,
sizeMax: imgsizeMax,
handler: function (result, value) {
if (result == "ok") {
if (me.api) {
me.api.ImgApply(value.imageProps);
}
}
me.fireEvent("editcomplete", me);
}
})).show();
break;
}
}
}
}
},
onSelectType: function (btn, picker, itemView, record) {
if (this._noApply) {
return;
}
var rawData = {},
isPickerSelect = _.isFunction(record.toJSON);
if (isPickerSelect) {
if (record.get("selected")) {
rawData = record.toJSON();
} else {
return;
}
} else {
rawData = record;
}
this.btnChartType.setIconCls("item-chartlist " + rawData.iconCls);
this._state.ChartType = -1;
if (this.api && !this._noApply && this.chartProps) {
var props = new CImgProperty();
this.chartProps.changeType(rawData.type);
props.put_ChartProperties(this.chartProps);
this.api.ImgApply(props);
}
this.fireEvent("editcomplete", this);
},
onSelectStyle: function (btn, picker, itemView, record) {
if (this._noApply) {
return;
}
var rawData = {},
isPickerSelect = _.isFunction(record.toJSON);
if (isPickerSelect) {
if (record.get("selected")) {
rawData = record.toJSON();
} else {
return;
}
} else {
rawData = record;
}
var style = "url(" + rawData.imageUrl + ")";
var btnIconEl = this.btnChartStyle.cmpEl.find("span.btn-icon");
btnIconEl.css("background-image", style);
if (this.api && !this._noApply && this.chartProps) {
var props = new CImgProperty();
this.chartProps.putStyle(rawData.data);
props.put_ChartProperties(this.chartProps);
this.api.ImgApply(props);
}
this.fireEvent("editcomplete", this);
},
_onUpdateChartStyles: function () {
if (this.api && this._state.ChartType !== null && this._state.ChartType > -1) {
this.updateChartStyles(this.api.asc_getChartPreviews(this._state.ChartType));
}
},
updateChartStyles: function (styles) {
var me = this;
if (styles && styles.length > 0) {
var stylesStore = this.mnuChartStylePicker.store;
if (stylesStore) {
var stylearray = [],
selectedIdx = -1,
selectedUrl;
_.each(styles, function (item, index) {
stylearray.push({
imageUrl: item.asc_getImageUrl(),
data: item.asc_getStyle(),
tip: me.textStyle + " " + item.asc_getStyle()
});
if (me._state.ChartStyle == item.asc_getStyle()) {
selectedIdx = index;
selectedUrl = item.asc_getImageUrl();
}
});
stylesStore.reset(stylearray, {
silent: false
});
}
}
this.mnuChartStylePicker.selectByIndex(selectedIdx, true);
if (selectedIdx >= 0 && this.btnChartStyle.cmpEl) {
var style = "url(" + selectedUrl + ")";
var btnIconEl = this.btnChartStyle.cmpEl.find("span.btn-icon");
btnIconEl.css("background-image", style);
}
},
setLocked: function (locked) {
this._locked = locked;
},
disableControls: function (disable) {
if (this._state.DisabledControls !== disable) {
this._state.DisabledControls = disable;
_.each(this.lockedControls, function (item) {
item.setDisabled(disable);
});
this.linkAdvanced.toggleClass("disabled", disable);
}
},
textSize: "Size",
textWrap: "Wrapping Style",
textWidth: "Width",
textHeight: "Height",
textAdvanced: "Show advanced settings",
txtInline: "Inline",
txtSquare: "Square",
txtTight: "Tight",
txtThrough: "Through",
txtTopAndBottom: "Top and bottom",
txtBehind: "Behind",
txtInFront: "In front",
textEditData: "Edit Data",
textChartType: "Change Chart Type",
textLine: "Line Chart",
textColumn: "Column Chart",
textBar: "Bar Chart",
textArea: "Area Chart",
textPie: "Pie Chart",
textPoint: "Point Chart",
textStock: "Stock Chart",
textStyle: "Style"
},
DE.Views.ChartSettings || {}));
});

View File

@@ -1,106 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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."
});

View File

@@ -1,90 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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"
});

View File

@@ -1,227 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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"
});

View File

@@ -1,231 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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"
});

View File

@@ -1,294 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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 + "/";
}
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,395 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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"
});

View File

@@ -1,171 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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"
});

View File

@@ -1,423 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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"
});

View File

@@ -1,574 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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"
});

View File

@@ -1,428 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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..."
});

View File

@@ -0,0 +1,243 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!documenteditor/main/app/template/FileMenu.template", "underscore", "common/main/lib/component/BaseView"], function (tpl, _) {
DE.Views.FileMenu = Common.UI.BaseView.extend(_.extend({
el: "#file-menu-panel",
template: _.template(tpl),
events: function () {
return {
"click .fm-btn": _.bind(function (event) {
var $item = $(event.currentTarget);
if (!$item.hasClass("active")) {
$(".fm-btn", this.el).removeClass("active");
$item.addClass("active");
}
var item = _.findWhere(this.items, {
el: event.currentTarget
});
if (item) {
var panel = this.panels[item.options.action];
this.fireEvent("item:click", [this, item.options.action, !!panel]);
if (panel) {
this.$el.find(".content-box:visible").hide();
this.active = item.options.action;
panel.show();
}
}
},
this)
};
},
initialize: function () {},
render: function () {
this.$el = $(this.el);
this.$el.html(this.template());
this.items = [];
this.items.push(new Common.UI.MenuItem({
el: $("#fm-btn-return", this.el),
action: "back",
caption: this.btnReturnCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-save", this.el),
action: "save",
caption: this.btnSaveCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-edit", this.el),
action: "edit",
caption: this.btnToEditCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-download", this.el),
action: "saveas",
caption: this.btnDownloadCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-print", this.el),
action: "print",
caption: this.btnPrintCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-recent", this.el),
action: "recent",
caption: this.btnRecentFilesCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-create", this.el),
action: "new",
caption: this.btnCreateNewCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-info", this.el),
action: "info",
caption: this.btnInfoCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-settings", this.el),
action: "opts",
caption: this.btnSettingsCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-help", this.el),
action: "help",
caption: this.btnHelpCaption,
canFocused: false
}), new Common.UI.MenuItem({
el: $("#fm-btn-back", this.el),
action: "exit",
caption: this.btnBackCaption,
canFocused: false
}));
var me = this;
this.panels = {};
require(["documenteditor/main/app/view/FileMenuPanels"], function () {
me.panels = {
"saveas": (new DE.Views.FileMenuPanels.ViewSaveAs({
menu: me
})).render(),
"opts": (new DE.Views.FileMenuPanels.Settings({
menu: me
})).render(),
"info": (new DE.Views.FileMenuPanels.DocumentInfo({
menu: me
})).render(),
"help": (new DE.Views.FileMenuPanels.Help({
menu: me
})).render()
};
me.$el.find(".content-box").hide();
});
return this;
},
show: function (panel) {
if (this.isVisible() && panel === undefined) {
return;
}
if (!panel) {
panel = this.active || (this.mode.canDownload ? "saveas" : "info");
}
this.$el.show();
this.selectMenu(panel);
if (this.mode.isEdit) {
DE.getController("Toolbar").DisableToolbar(true);
}
this.api.asc_enableKeyEvents(false);
},
hide: function () {
this.$el.hide();
if (this.mode.isEdit) {
DE.getController("Toolbar").DisableToolbar(false);
}
this.fireEvent("filemenu:hide", [this]);
this.api.asc_enableKeyEvents(true);
},
applyMode: function () {
this.items[0][this.mode.canBack ? "show" : "hide"]();
this.items[0].$el.find("+.devider")[this.mode.canBack ? "show" : "hide"]();
this.items[5][this.mode.canOpenRecent ? "show" : "hide"]();
this.items[6][this.mode.canCreateNew ? "show" : "hide"]();
this.items[6].$el.find("+.devider")[this.mode.canCreateNew ? "show" : "hide"]();
this.items[3][this.mode.canDownload ? "show" : "hide"]();
this.items[1][this.mode.isEdit ? "show" : "hide"]();
this.items[2][!this.mode.isEdit && this.mode.canEdit ? "show" : "hide"]();
this.panels["opts"].setMode(this.mode);
this.panels["info"].setMode(this.mode).updateInfo(this.document);
if (this.mode.canCreateNew) {
if (this.mode.templates && this.mode.templates.length) {
$("a", this.items[6].$el).text(this.btnCreateNewCaption + "...");
this.panels["new"] = ((new DE.Views.FileMenuPanels.CreateNew({
menu: this,
docs: this.mode.templates
})).render());
}
}
if (this.mode.canOpenRecent) {
if (this.mode.recent) {
this.panels["recent"] = (new DE.Views.FileMenuPanels.RecentFiles({
menu: this,
recent: this.mode.recent
})).render();
}
}
this.panels["help"].setLangConfig(this.mode.lang);
},
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();
}
},
setApi: function (api) {
this.api = api;
this.panels["info"].setApi(api);
},
loadDocument: function (data) {
this.document = data.doc;
},
selectMenu: function (menu) {
if (menu) {
var item = this._getMenuItem(menu),
panel = this.panels[menu];
if (item && panel) {
$(".fm-btn", this.el).removeClass("active");
item.$el.addClass("active");
this.$el.find(".content-box:visible").hide();
panel.show();
this.active = menu;
}
}
},
_getMenuItem: function (action) {
return _.find(this.items, function (item) {
return item.options.action == action;
});
},
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",
btnSettingsCaption: "Advanced Settings..."
},
DE.Views.FileMenu || {}));
});

View File

@@ -0,0 +1,813 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["common/main/lib/view/DocumentAccessDialog"], function () { ! DE.Views.FileMenuPanels && (DE.Views.FileMenuPanels = {});
DE.Views.FileMenuPanels.ViewSaveAs = Common.UI.BaseView.extend({
el: "#panel-saveas",
menu: undefined,
formats: [[{
name: "PDF",
imgCls: "pdf",
type: c_oAscFileType.PDF
},
{
name: "TXT",
imgCls: "txt",
type: c_oAscFileType.TXT
},
{
name: "DOCX",
imgCls: "docx",
type: c_oAscFileType.DOCX
}], [{
name: "ODT",
imgCls: "odt",
type: c_oAscFileType.ODT
},
{
name: "HTML (Zipped)",
imgCls: "html",
type: c_oAscFileType.HTML_ZIP
}]],
template: _.template(["<table><tbody>", "<% _.each(rows, function(row) { %>", "<tr>", "<% _.each(row, function(item) { %>", '<td><span class="btn-doc-format <%= item.imgCls %>" /></td>', "<% }) %>", "</tr>", "<% }) %>", "</tbody></table>"].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
},
render: function () {
$(this.el).html(this.template({
rows: this.formats
}));
$(".btn-doc-format", this.el).on("click", _.bind(this.onFormatClick, this));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
this.flatFormats = _.flatten(this.formats);
return this;
},
onFormatClick: function (e) {
var format = /\s(\w+)/.exec(e.currentTarget.className);
if (format) {
format = format[1];
var item = _.findWhere(this.flatFormats, {
imgCls: format
});
if (item && this.menu) {
this.menu.fireEvent("saveas:format", [this.menu, item.type]);
}
}
}
});
DE.Views.FileMenuPanels.Settings = Common.UI.BaseView.extend(_.extend({
el: "#panel-settings",
menu: undefined,
template: _.template(["<table><tbody>", '<tr class="edit">', '<td class="left"><label><%= scope.txtInput %></label></td>', '<td class="right"><div id="fms-chb-input-mode"/></td>', "</tr>", '<tr class="divider edit"></tr>', '<tr class="coauth">', '<td class="left"><label><%= scope.txtLiveComment %></label></td>', '<td class="right"><div id="fms-chb-live-comment"/></td>', "</tr>", '<tr class="divider coauth"></tr>', '<tr class="edit">', '<td class="left"><label><%= scope.txtSpellCheck %></label></td>', '<td class="right"><div id="fms-chb-spell-check"/></td>', "</tr>", '<tr class="divider edit"></tr>', '<tr class="autosave">', '<td class="left"><label><%= scope.textAutoSave %></label></td>', '<td class="right"><span id="fms-chb-autosave" /></td>', "</tr>", '<tr class="divider autosave"></tr>', "<tr>", '<td class="left"><label><%= scope.textAlignGuides %></label></td>', '<td class="right"><span id="fms-chb-align-guides" /></td>', "</tr>", '<tr class="divider"></tr>', "<tr>", '<td class="left"><label><%= scope.strZoom %></label></td>', '<td class="right"><div id="fms-cmb-zoom" class="input-group-nr" /></td>', "</tr>", '<tr class="divider"></tr>', '<tr class="coauth">', '<td class="left"><label><%= scope.strShowChanges %></label></td>', '<td class="right"><span id="fms-cmb-show-changes" /></td>', "</tr>", '<tr class="divider coauth"></tr>', "<tr>", '<td class="left"><label><%= scope.strFontRender %></label></td>', '<td class="right"><span id="fms-cmb-font-render" /></td>', "</tr>", '<tr class="divider"></tr>', '<tr class="edit">', '<td class="left"><label><%= scope.strUnit %></label></td>', '<td class="right"><span id="fms-cmb-unit" /></td>', "</tr>", '<tr class="divider edit"></tr>', "<tr>", '<td class="left"></td>', '<td class="right"><button id="fms-btn-apply" class="btn normal dlg-btn primary"><%= scope.okButtonText %></button></td>', "</tr>", "</tbody></table>"].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
},
render: function () {
$(this.el).html(this.template({
scope: this
}));
this.chInputMode = new Common.UI.CheckBox({
el: $("#fms-chb-input-mode"),
labelText: this.strInputMode
});
this.chLiveComment = new Common.UI.CheckBox({
el: $("#fms-chb-live-comment"),
labelText: this.strLiveComment
});
this.chSpell = new Common.UI.CheckBox({
el: $("#fms-chb-spell-check"),
labelText: this.strSpellCheckMode
});
this.chAutosave = new Common.UI.CheckBox({
el: $("#fms-chb-autosave"),
labelText: this.strAutosave
});
this.chAlignGuides = new Common.UI.CheckBox({
el: $("#fms-chb-align-guides"),
labelText: this.strAlignGuides
});
this.cmbZoom = new Common.UI.ComboBox({
el: $("#fms-cmb-zoom"),
style: "width: 160px;",
editable: false,
cls: "input-group-nr",
data: [{
value: 50,
displayValue: "50%"
},
{
value: 60,
displayValue: "60%"
},
{
value: 70,
displayValue: "70%"
},
{
value: 80,
displayValue: "80%"
},
{
value: 90,
displayValue: "90%"
},
{
value: 100,
displayValue: "100%"
},
{
value: 110,
displayValue: "110%"
},
{
value: 120,
displayValue: "120%"
},
{
value: 150,
displayValue: "150%"
},
{
value: 175,
displayValue: "175%"
},
{
value: 200,
displayValue: "200%"
}]
});
this.cmbShowChanges = new Common.UI.ComboBox({
el: $("#fms-cmb-show-changes"),
style: "width: 160px;",
editable: false,
cls: "input-group-nr",
data: [{
value: "none",
displayValue: this.txtNone
},
{
value: "all",
displayValue: this.txtAll
},
{
value: "last",
displayValue: this.txtLast
}]
});
this.cmbFontRender = new Common.UI.ComboBox({
el: $("#fms-cmb-font-render"),
style: "width: 160px;",
editable: false,
cls: "input-group-nr",
data: [{
value: 0,
displayValue: this.txtWin
},
{
value: 1,
displayValue: this.txtMac
},
{
value: 2,
displayValue: this.txtNative
}]
});
this.cmbUnit = new Common.UI.ComboBox({
el: $("#fms-cmb-unit"),
style: "width: 160px;",
editable: false,
cls: "input-group-nr",
data: [{
value: Common.Utils.Metric.c_MetricUnits["cm"],
displayValue: this.txtCm
},
{
value: Common.Utils.Metric.c_MetricUnits["pt"],
displayValue: this.txtPt
}]
});
this.btnApply = new Common.UI.Button({
el: "#fms-btn-apply"
});
this.btnApply.on("click", _.bind(this.applySettings, this));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
return this;
},
show: function () {
Common.UI.BaseView.prototype.show.call(this, arguments);
this.updateSettings();
},
setMode: function (mode) {
$("tr.edit", this.el)[mode.isEdit ? "show" : "hide"]();
$("tr.autosave", this.el)[mode.isEdit && mode.canAutosave ? "show" : "hide"]();
$("tr.coauth", this.el)[mode.canCoAuthoring && mode.isEdit ? "show" : "hide"]();
},
updateSettings: function () {
var value = window.localStorage.getItem("de-settings-inputmode");
this.chInputMode.setValue(value !== null && parseInt(value) == 1);
value = window.localStorage.getItem("de-settings-zoom");
var item = this.cmbZoom.store.findWhere({
value: parseInt(value)
});
this.cmbZoom.setValue(item ? parseInt(item.get("value")) : 100);
value = window.localStorage.getItem("de-settings-livecomment");
this.chLiveComment.setValue(!(value !== null && parseInt(value) == 0));
value = window.localStorage.getItem("de-settings-showchanges");
item = this.cmbShowChanges.store.findWhere({
value: value
});
this.cmbShowChanges.setValue(item ? item.get("value") : "last");
value = window.localStorage.getItem("de-settings-fontrender");
item = this.cmbFontRender.store.findWhere({
value: parseInt(value)
});
this.cmbFontRender.setValue(item ? item.get("value") : (window.devicePixelRatio > 1 ? 1 : 0));
value = window.localStorage.getItem("de-settings-unit");
item = this.cmbUnit.store.findWhere({
value: parseInt(value)
});
this.cmbUnit.setValue(item ? parseInt(item.get("value")) : 0);
this._oldUnits = this.cmbUnit.getValue();
value = window.localStorage.getItem("de-settings-autosave");
this.chAutosave.setValue(value === null || parseInt(value) == 1);
value = window.localStorage.getItem("de-settings-spellcheck");
this.chSpell.setValue(value === null || parseInt(value) == 1);
value = window.localStorage.getItem("de-settings-showsnaplines");
this.chAlignGuides.setValue(value === null || parseInt(value) == 1);
},
applySettings: function () {
window.localStorage.setItem("de-settings-inputmode", this.chInputMode.isChecked() ? 1 : 0);
window.localStorage.setItem("de-settings-zoom", this.cmbZoom.getValue());
window.localStorage.setItem("de-settings-livecomment", this.chLiveComment.isChecked() ? 1 : 0);
window.localStorage.setItem("de-settings-showchanges", this.cmbShowChanges.getValue());
window.localStorage.setItem("de-settings-fontrender", this.cmbFontRender.getValue());
window.localStorage.setItem("de-settings-unit", this.cmbUnit.getValue());
window.localStorage.setItem("de-settings-autosave", this.chAutosave.isChecked() ? 1 : 0);
window.localStorage.setItem("de-settings-spellcheck", this.chSpell.isChecked() ? 1 : 0);
window.localStorage.setItem("de-settings-showsnaplines", this.chAlignGuides.isChecked() ? 1 : 0);
if (this.menu) {
this.menu.fireEvent("settings:apply", [this.menu]);
if (this._oldUnits !== this.cmbUnit.getValue()) {
Common.NotificationCenter.trigger("settings:unitschanged", this);
}
}
},
strLiveComment: "Turn on option",
strInputMode: "Turn on hieroglyphs",
strZoom: "Default Zoom Value",
strShowChanges: "Realtime Collaboration Changes",
txtAll: "View All",
txtNone: "View Nothing",
txtLast: "View Last",
txtLiveComment: "Live Commenting",
okButtonText: "Apply",
txtInput: "Alternate Input",
txtWin: "as Windows",
txtMac: "as OS X",
txtNative: "Native",
strFontRender: "Font Hinting",
strUnit: "Unit of Measurement",
txtCm: "Centimeter",
txtPt: "Point",
textAutoSave: "Autosave",
strAutosave: "Turn on autosave",
txtSpellCheck: "Spell Checking",
strSpellCheckMode: "Turn on spell checking option",
textAlignGuides: "Alignment Guides",
strAlignGuides: "Turn on alignment guides"
},
DE.Views.FileMenuPanels.Settings || {}));
DE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({
el: "#panel-recentfiles",
menu: undefined,
template: _.template(['<div id="id-recent-view" style="margin: 20px 0;"></div>'].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
this.recent = options.recent;
},
render: function () {
$(this.el).html(this.template());
this.viewRecentPicker = new Common.UI.DataView({
el: $("#id-recent-view"),
store: new Common.UI.DataViewStore(this.recent),
itemTemplate: _.template(['<div class="recent-wrap">', '<div class="recent-icon"></div>', '<div class="file-name"><%= Common.Utils.String.htmlEncode(title) %></div>', '<div class="file-info"><%= Common.Utils.String.htmlEncode(folder) %></div>', "</div>"].join(""))
});
this.viewRecentPicker.on("item:click", _.bind(this.onRecentFileClick, this));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
return this;
},
onRecentFileClick: function (view, itemview, record) {
if (this.menu) {
this.menu.fireEvent("recent:open", [this.menu, record.get("url")]);
}
}
});
DE.Views.FileMenuPanels.CreateNew = Common.UI.BaseView.extend(_.extend({
el: "#panel-createnew",
menu: undefined,
events: function () {
return {
"click .blank-document-btn": _.bind(this._onBlankDocument, this),
"click .thumb-list .thumb-wrap": _.bind(this._onDocumentTemplate, this)
};
},
template: _.template(['<h3 style="margin-top: 20px;"><%= scope.fromBlankText %></h3><hr noshade />', '<div class="blank-document">', '<div class="blank-document-btn"></div>', '<div class="blank-document-info">', "<h3><%= scope.newDocumentText %></h3>", "<%= scope.newDescriptionText %>", "</div>", "</div>", "<h3><%= scope.fromTemplateText %></h3><hr noshade />", '<div class="thumb-list">', "<% _.each(docs, function(item) { %>", '<div class="thumb-wrap" template="<%= item.name %>">', '<div class="thumb"<% if (!_.isEmpty(item.icon)) { %> style="background-image: url(<%= item.icon %>);" <% } %> />', '<div class="title"><%= item.name %></div>', "</div>", "<% }) %>", "</div>"].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
},
render: function () {
$(this.el).html(this.template({
scope: this,
docs: this.options[0].docs
}));
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
return this;
},
_onBlankDocument: function () {
if (this.menu) {
this.menu.fireEvent("create:new", [this.menu, "blank"]);
}
},
_onDocumentTemplate: function (e) {
if (this.menu) {
this.menu.fireEvent("create:new", [this.menu, e.currentTarget.attributes["template"].value]);
}
},
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"
},
DE.Views.FileMenuPanels.CreateNew || {}));
DE.Views.FileMenuPanels.DocumentInfo = Common.UI.BaseView.extend(_.extend({
el: "#panel-info",
menu: undefined,
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.rendered = false;
this.template = _.template(['<table class="main">', "<tr>", '<td class="left"><label>' + this.txtTitle + "</label></td>", '<td class="right"><label id="id-info-title">-</label></td>', "</tr>", '<tr class="author">', '<td class="left"><label>' + this.txtAuthor + "</label></td>", '<td class="right"><span class="userLink" id="id-info-author">-</span></td>', "</tr>", '<tr class="placement">', '<td class="left"><label>' + this.txtPlacement + "</label></td>", '<td class="right"><label id="id-info-placement">-</label></td>', "</tr>", '<tr class="date">', '<td class="left"><label>' + this.txtDate + "</label></td>", '<td class="right"><label id="id-info-date">-</label></td>', "</tr>", '<tr class="divider date"></tr>', '<tr class="rights">', '<td class="left" style="vertical-align: top;"><label>' + this.txtRights + "</label></td>", '<td class="right"><div id="id-info-rights"></div></td>', "</tr>", '<tr class="edit-rights">', '<td class="left"></td><td class="right"><button id="id-info-btn-edit" class="btn normal dlg-btn primary" style="margin-right: 10px;width: auto;">' + this.txtBtnAccessRights + "</button></td>", "</tr>", '<tr class="divider rights"></tr>', "<tr>", '<td class="left" style="vertical-align: top;"><label>' + this.txtStatistics + "</label></td>", '<td class="right" style="vertical-align: top;"><div id="id-info-statistic">', "<table>", "<tr>", "<td><label>" + this.txtPages + "</label></td>", '<td><label id="id-info-pages"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtParagraphs + "</label></td>", '<td><label id="id-info-paragraphs"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtWords + "</label></td>", '<td><label id="id-info-words"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtSymbols + "</label></td>", '<td><label id="id-info-symbols"></label></td>', "</tr>", "<tr>", "<td><label>" + this.txtSpaces + "</label></td>", '<td><label id="id-info-spaces"></label></td>', "</tr>", "</table>", "</div></td>", "</tr>", "</table>"].join(""));
this.templateRights = _.template(["<table>", "<% _.each(users, function(item) { %>", "<tr>", '<td><span class="userLink"><%= Common.Utils.String.htmlEncode(item.user) %></span></td>', "<td><%= Common.Utils.String.htmlEncode(item.permissions) %></td>", "</tr>", "<% }); %>", "</table>"].join(""));
this.infoObj = {
PageCount: 0,
WordsCount: 0,
ParagraphCount: 0,
SymbolsCount: 0,
SymbolsWSCount: 0
};
this.inProgress = false;
this.menu = options.menu;
},
render: function () {
$(this.el).html(this.template());
this.lblTitle = $("#id-info-title");
this.lblPlacement = $("#id-info-placement");
this.lblDate = $("#id-info-date");
this.lblAuthor = $("#id-info-author");
this.lblStatPages = $("#id-info-pages");
this.lblStatWords = $("#id-info-words");
this.lblStatParagraphs = $("#id-info-paragraphs");
this.lblStatSymbols = $("#id-info-symbols");
this.lblStatSpaces = $("#id-info-spaces");
this.cntRights = $("#id-info-rights");
this.btnEditRights = new Common.UI.Button({
el: "#id-info-btn-edit"
});
this.btnEditRights.on("click", _.bind(this.changeAccessRights, this));
this.rendered = true;
this.updateInfo(this.doc);
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el),
suppressScrollX: true
});
}
return this;
},
show: function () {
Common.UI.BaseView.prototype.show.call(this, arguments);
this.updateStatisticInfo();
},
hide: function () {
Common.UI.BaseView.prototype.hide.call(this, arguments);
this.stopUpdatingStatisticInfo();
},
updateInfo: function (doc) {
this.doc = doc;
if (!this.rendered) {
return;
}
doc = doc || {};
this.lblTitle.text((doc.title) ? doc.title : "-");
if (doc.info) {
if (doc.info.author) {
this.lblAuthor.text(doc.info.author);
}
this._ShowHideInfoItem("author", doc.info.author !== undefined && doc.info.author !== null);
if (doc.info.created) {
this.lblDate.text(doc.info.created);
}
this._ShowHideInfoItem("date", doc.info.created !== undefined && doc.info.created !== null);
if (doc.info.folder) {
this.lblPlacement.text(doc.info.folder);
}
this._ShowHideInfoItem("placement", doc.info.folder !== undefined && doc.info.folder !== null);
if (doc.info.sharingSettings) {
this.cntRights.html(this.templateRights({
users: doc.info.sharingSettings
}));
}
this._ShowHideInfoItem("rights", doc.info.sharingSettings !== undefined && doc.info.sharingSettings !== null && this._readonlyRights !== true);
this._ShowHideInfoItem("edit-rights", !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights !== true);
} else {
this._ShowHideDocInfo(false);
}
},
_ShowHideInfoItem: function (cls, visible) {
$("tr." + cls, this.el)[visible ? "show" : "hide"]();
},
_ShowHideDocInfo: function (visible) {
this._ShowHideInfoItem("date", visible);
this._ShowHideInfoItem("placement", visible);
this._ShowHideInfoItem("author", visible);
this._ShowHideInfoItem("rights", visible);
this._ShowHideInfoItem("edit-rights", 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", _.bind(this._onGetDocInfoStart, this));
this.api.asc_registerCallback("asc_onGetDocInfoStop", _.bind(this._onGetDocInfoEnd, this));
this.api.asc_registerCallback("asc_onDocInfo", _.bind(this._onDocInfo, this));
this.api.asc_registerCallback("asc_onGetDocInfoEnd", _.bind(this._onGetDocInfoEnd, this));
return this;
},
setMode: function (mode) {
this.sharingSettingsUrl = mode.sharingSettingsUrl;
return this;
},
_onGetDocInfoStart: function () {
var me = this;
this.inProgress = true;
this.infoObj = {
PageCount: 0,
WordsCount: 0,
ParagraphCount: 0,
SymbolsCount: 0,
SymbolsWSCount: 0
};
_.defer(function () {
if (!me.inProgress) {
return;
}
me.lblStatPages.text(me.txtLoading);
me.lblStatWords.text(me.txtLoading);
me.lblStatParagraphs.text(me.txtLoading);
me.lblStatSymbols.text(me.txtLoading);
me.lblStatSpaces.text(me.txtLoading);
},
2000);
},
_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.text(this.infoObj.PageCount);
this.lblStatWords.text(this.infoObj.WordsCount);
this.lblStatParagraphs.text(this.infoObj.ParagraphCount);
this.lblStatSymbols.text(this.infoObj.SymbolsCount);
this.lblStatSpaces.text(this.infoObj.SymbolsWSCount);
},
changeAccessRights: function (btn, event, opts) {
var me = this;
var win = new Common.Views.DocumentAccessDialog({
settingsurl: this.sharingSettingsUrl
});
win.on("accessrights", function (obj, rights) {
me.doc.info.sharingSettings = rights;
me.cntRights.html(me.templateRights({
users: me.doc.info.sharingSettings
}));
});
win.show();
},
onLostEditRights: function () {
this._readonlyRights = true;
if (!this.rendered) {
return;
}
this._ShowHideInfoItem("rights", false);
this._ShowHideInfoItem("edit-rights", 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"
},
DE.Views.FileMenuPanels.DocumentInfo || {}));
DE.Views.FileMenuPanels.Help = Common.UI.BaseView.extend({
el: "#panel-help",
menu: undefined,
template: _.template(['<div style="width:100%; height:100%; position: relative;">', '<div id="id-help-contents" style="position: absolute; width:200px; top: 0; bottom: 0;" class="no-padding"></div>', '<div id="id-help-frame" style="position: absolute; left: 200px; top: 0; right: 0; bottom: 0;" class="no-padding"></div>', "</div>"].join("")),
initialize: function (options) {
Common.UI.BaseView.prototype.initialize.call(this, arguments);
this.menu = options.menu;
this.urlPref = "resources/help/en/";
this.itemclicked = false;
this.en_data = [{
src: "UsageInstructions/SetPageParameters.htm",
name: "Set page parameters",
headername: "Usage Instructions",
selected: true
},
{
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"
}];
if (Common.Utils.isIE) {
window.onhelp = function () {
return false;
};
}
},
render: function () {
var me = this;
$(this.el).html(this.template());
this.viewHelpPicker = new Common.UI.DataView({
el: $("#id-help-contents"),
store: new Common.UI.DataViewStore([]),
keyMoveDirection: "vertical",
itemTemplate: _.template(['<div id="<%= id %>" class="help-item-wrap">', '<div class="caption"><%= name %></div>', "</div>"].join(""))
});
this.viewHelpPicker.on("item:add", function (dataview, itemview, record) {
if (record.has("headername")) {
$(itemview.el).before('<div class="header-name">' + record.get("headername") + "</div>");
}
});
this.viewHelpPicker.on("item:select", function (dataview, itemview, record) {
me.itemclicked = true;
me.iFrame.src = me.urlPref + record.get("src");
});
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 = _.bind(function () {
if (!this.itemclicked) {
var src = arguments[0].currentTarget.contentDocument.URL;
var rec = this.viewHelpPicker.store.find(function (record) {
return (src.indexOf(record.get("src")) > 0);
});
if (rec) {
this.viewHelpPicker.selectRecord(rec, true);
this.viewHelpPicker.scrollToRecord(rec);
}
}
this.itemclicked = false;
},
this);
Common.Gateway.on("internalcommand", function (data) {
if (data.type == "help:hyperlink") {
if (!me.itemclicked) {
var src = data.data;
var rec = me.viewHelpPicker.store.find(function (record) {
return (src.indexOf(record.get("src")) > 0);
});
if (rec) {
me.viewHelpPicker.selectRecord(rec, true);
me.viewHelpPicker.scrollToRecord(rec);
}
}
me.itemclicked = false;
}
});
$("#id-help-frame").append(this.iFrame);
return this;
},
setLangConfig: function (lang) {
var me = this;
var store = this.viewHelpPicker.store;
if (lang) {
lang = lang.split("-")[0];
var config = {
dataType: "json",
error: function () {
if (me.urlPref.indexOf("resources/help/en/") < 0) {
me.urlPref = "resources/help/en/";
store.url = "resources/help/en/Contents.json";
store.fetch(config);
} else {
me.urlPref = "resources/help/en/";
store.reset(me.en_data);
}
},
success: function () {
var rec = store.at(0);
me.viewHelpPicker.selectRecord(rec);
me.iFrame.src = me.urlPref + rec.get("src");
}
};
store.url = "resources/help/" + lang + "/Contents.json";
store.fetch(config);
this.urlPref = "resources/help/" + lang + "/";
}
},
show: function () {
Common.UI.BaseView.prototype.show.call(this);
if (!this._scrollerInited) {
this.viewHelpPicker.scroller.update();
this._scrollerInited = true;
}
}
});
});

View File

@@ -1,312 +1,221 @@
/*
* (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"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!documenteditor/main/app/template/HeaderFooterSettings.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "common/main/lib/component/MetricSpinner", "common/main/lib/component/CheckBox"], function (menuTemplate, $, _, Backbone) {
DE.Views.HeaderFooterSettings = Backbone.View.extend(_.extend({
el: "#id-header-settings",
template: _.template(menuTemplate),
events: {},
options: {
alias: "HeaderFooterSettings"
},
initialize: function () {
var me = this;
this._initSettings = true;
this._state = {
PositionType: c_pageNumPosition.PAGE_NUM_POSITION_TOP,
Position: 12.5,
DiffFirst: false,
DiffOdd: false,
SameAs: false,
DisabledControls: false
};
this.spinners = [];
this.lockedControls = [];
this._locked = false;
this.render();
var _arrPosition = [[c_pageNumPosition.PAGE_NUM_POSITION_TOP, c_pageNumPosition.PAGE_NUM_POSITION_LEFT, "icon-right-panel btn-colontitul-tl", "headerfooter-button-top-left", this.textTopLeft], [c_pageNumPosition.PAGE_NUM_POSITION_TOP, c_pageNumPosition.PAGE_NUM_POSITION_CENTER, "icon-right-panel btn-colontitul-tc", "headerfooter-button-top-center", this.textTopCenter], [c_pageNumPosition.PAGE_NUM_POSITION_TOP, c_pageNumPosition.PAGE_NUM_POSITION_RIGHT, "icon-right-panel btn-colontitul-tr", "headerfooter-button-top-right", this.textTopRight], [c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, c_pageNumPosition.PAGE_NUM_POSITION_LEFT, "icon-right-panel btn-colontitul-bl", "headerfooter-button-bottom-left", this.textBottomLeft], [c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, c_pageNumPosition.PAGE_NUM_POSITION_CENTER, "icon-right-panel btn-colontitul-bc", "headerfooter-button-bottom-center", this.textBottomCenter], [c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM, c_pageNumPosition.PAGE_NUM_POSITION_RIGHT, "icon-right-panel btn-colontitul-br", "headerfooter-button-bottom-right", this.textBottomRight]];
this._btnsPosition = [];
_.each(_arrPosition, function (item, index, list) {
var _btn = new Common.UI.Button({
cls: "btn-options huge",
iconCls: item[2],
posWhere: item[0],
posAlign: item[1],
hint: item[4]
});
_btn.render($("#" + item[3]));
_btn.on("click", _.bind(this.onBtnPositionClick, this));
this._btnsPosition.push(_btn);
this.lockedControls.push(_btn);
},
this);
this.numPosition = new Common.UI.MetricSpinner({
el: $("#headerfooter-spin-position"),
step: 0.1,
width: 85,
value: "1.25 cm",
defaultUnit: "cm",
maxValue: 55.88,
minValue: 0
});
this.spinners.push(this.numPosition);
this.lockedControls.push(this.numPosition);
this.lblPosition = $(this.el).find("#headerfooter-label-position");
this.chDiffFirst = new Common.UI.CheckBox({
el: $("#headerfooter-check-diff-first"),
labelText: this.textDiffFirst
});
this.lockedControls.push(this.chDiffFirst);
this.chDiffOdd = new Common.UI.CheckBox({
el: $("#headerfooter-check-diff-odd"),
labelText: this.textDiffOdd
});
this.lockedControls.push(this.chDiffOdd);
this.chSameAs = new Common.UI.CheckBox({
el: $("#headerfooter-check-same-as"),
labelText: this.textSameAs
});
this.lockedControls.push(this.chSameAs);
this.numPosition.on("change", _.bind(this.onNumPositionChange, this));
this.chDiffFirst.on("change", _.bind(this.onDiffFirstChange, this));
this.chDiffOdd.on("change", _.bind(this.onDiffOddChange, this));
this.chSameAs.on("change", _.bind(this.onSameAsChange, this));
},
render: function () {
var el = $(this.el);
el.html(this.template({
scope: this
}));
},
setApi: function (api) {
this.api = api;
return this;
},
ChangeSettings: function (prop) {
if (this._initSettings) {
this.createDelayedElements();
this._initSettings = false;
}
this.disableControls(this._locked);
if (prop) {
var value = prop.get_Type();
if (this._state.PositionType !== value) {
if (value == c_pageNumPosition.PAGE_NUM_POSITION_BOTTOM) {
this.lblPosition[0].innerHTML = this.textHeaderFromBottom;
} else {
this.lblPosition[0].innerHTML = this.textHeaderFromTop;
}
this._state.PositionType = value;
}
value = prop.get_Position();
if (Math.abs(this._state.Position - value) > 0.001) {
this.numPosition.setValue(Common.Utils.Metric.fnRecalcFromMM(value), true);
this._state.Position = value;
}
value = prop.get_DifferentFirst();
if (this._state.DiffFirst !== value) {
this.chDiffFirst.setValue(value, true);
this._state.DiffFirst = value;
}
value = prop.get_DifferentEvenOdd();
if (this._state.DiffOdd !== value) {
this.chDiffOdd.setValue(value, true);
this._state.DiffOdd = value;
}
value = prop.get_LinkToPrevious();
if (this._state.SameAs !== value) {
this.chSameAs.setDisabled(value === null);
this.chSameAs.setValue(value == true, true);
this._state.SameAs = value;
}
}
},
onBtnPositionClick: function (btn, eOpts) {
if (this.api) {
this.api.put_PageNum(btn.options.posWhere, btn.options.posAlign);
}
this.fireEvent("editcomplete", this);
},
onNumPositionChange: function (field, newValue, oldValue, eOpts) {
if (this.api) {
this.api.put_HeadersAndFootersDistance(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
}
this.fireEvent("editcomplete", this);
},
onDiffFirstChange: function (field, newValue, oldValue, eOpts) {
if (this.api) {
this.api.HeadersAndFooters_DifferentFirstPage(field.getValue() == "checked");
}
this.fireEvent("editcomplete", this);
},
onDiffOddChange: function (field, newValue, oldValue, eOpts) {
if (this.api) {
this.api.HeadersAndFooters_DifferentOddandEvenPage((field.getValue() == "checked"));
}
this.fireEvent("editcomplete", this);
},
onSameAsChange: function (field, newValue, oldValue, eOpts) {
if (this.api) {
this.api.HeadersAndFooters_LinkToPrevious((field.getValue() == "checked"));
}
this.fireEvent("editcomplete", this);
},
updateMetricUnit: function () {
if (this.spinners) {
for (var i = 0; i < this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()]);
spinner.setStep(Common.Utils.Metric.getCurrentMetric() == Common.Utils.Metric.c_MetricUnits.cm ? 0.01 : 1);
}
}
},
createDelayedElements: function () {
this.updateMetricUnit();
},
setLocked: function (locked) {
this._locked = locked;
},
disableControls: function (disable) {
if (this._state.DisabledControls !== disable) {
this._state.DisabledControls = disable;
_.each(this.lockedControls, function (item) {
item.setDisabled(disable);
});
}
},
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",
textSameAs: "Link to Previous"
},
DE.Views.HeaderFooterSettings || {}));
});

View File

@@ -1,396 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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"
});

View File

@@ -1,259 +1,170 @@
/*
* (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"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
if (Common === undefined) {
var Common = {};
}
define(["common/main/lib/util/utils", "common/main/lib/component/InputField", "common/main/lib/component/Window"], function () {
DE.Views.HyperlinkSettingsDialog = Common.UI.Window.extend(_.extend({
options: {
width: 350,
style: "min-width: 230px;",
cls: "modal-dlg"
},
initialize: function (options) {
_.extend(this.options, {
title: this.textTitle
},
options || {});
this.template = ['<div class="box">', '<div class="input-row">', "<label>" + this.textUrl + " *</label>", "</div>", '<div id="id-dlg-hyperlink-url" class="input-row" style="margin-bottom: 5px;"></div>', '<div class="input-row">', "<label>" + this.textDisplay + "</label>", "</div>", '<div id="id-dlg-hyperlink-display" class="input-row" style="margin-bottom: 5px;"></div>', '<div class="input-row">', "<label>" + this.textTooltip + "</label>", "</div>", '<div id="id-dlg-hyperlink-tip" class="input-row" style="margin-bottom: 5px;"></div>', "</div>", '<div class="footer right">', '<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;">' + this.okButtonText + "</button>", '<button class="btn normal dlg-btn" result="cancel">' + this.cancelButtonText + "</button>", "</div>"].join("");
this.options.tpl = _.template(this.template, this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function () {
Common.UI.Window.prototype.render.call(this);
var me = this,
$window = this.getChild();
me.inputUrl = new Common.UI.InputField({
el: $("#id-dlg-hyperlink-url"),
allowBlank: false,
blankError: me.txtEmpty,
style: "width: 100%;",
validateOnBlur: false,
validation: function (value) {
me.isEmail = false;
var isvalid = value.strongMatch(Common.Utils.hostnameRe); ! isvalid && (me.isEmail = isvalid = value.strongMatch(Common.Utils.emailRe)); ! isvalid && (isvalid = value.strongMatch(Common.Utils.ipRe)); ! isvalid && (isvalid = value.strongMatch(Common.Utils.localRe));
if (isvalid) {
return true;
} else {
return me.txtNotUrl;
}
}
});
me.inputDisplay = new Common.UI.InputField({
el: $("#id-dlg-hyperlink-display"),
allowBlank: true,
validateOnBlur: false,
style: "width: 100%;"
}).on("changed:after", function () {
me.isTextChanged = true;
});
me.inputTip = new Common.UI.InputField({
el: $("#id-dlg-hyperlink-tip"),
style: "width: 100%;"
});
$window.find(".dlg-btn").on("click", _.bind(this.onBtnClick, this));
$window.find("input").on("keypress", _.bind(this.onKeyPress, this));
},
show: function () {
Common.UI.Window.prototype.show.apply(this, arguments);
var me = this;
_.delay(function () {
me.inputUrl.cmpEl.find("input").focus();
},
500);
},
setSettings: function (props) {
if (props) {
var me = this;
if (props.get_Value()) {
me.inputUrl.setValue(props.get_Value());
} else {
me.inputUrl.setValue("");
}
if (props.get_Text() !== null) {
me.inputDisplay.setValue(props.get_Text());
me.inputDisplay.setDisabled(false);
} else {
me.inputDisplay.setValue(this.textDefault);
me.inputDisplay.setDisabled(true);
}
this.isTextChanged = false;
me.inputTip.setValue(props.get_ToolTip());
}
},
getSettings: function () {
var me = this,
props = new CHyperlinkProperty(),
url = $.trim(me.inputUrl.getValue());
if (!/(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url)) {
url = ((me.isEmail) ? "mailto:": "http://") + url;
}
props.put_Value(url);
if (!me.inputDisplay.isDisabled() && (this.isTextChanged || _.isEmpty(me.inputDisplay.getValue()))) {
if (_.isEmpty(me.inputDisplay.getValue())) {
me.inputDisplay.setValue(url);
}
props.put_Text(me.inputDisplay.getValue());
} else {
props.put_Text(null);
}
props.put_ToolTip(me.inputTip.getValue());
return props;
},
onBtnClick: function (event) {
this._handleInput(event.currentTarget.attributes["result"].value);
},
onKeyPress: function (event) {
if (event.keyCode == Common.UI.Keys.RETURN) {
this._handleInput("ok");
return false;
}
},
_handleInput: function (state) {
if (this.options.handler) {
if (state == "ok") {
var checkurl = this.inputUrl.checkValidate(),
checkdisp = this.inputDisplay.checkValidate();
if (checkurl !== true) {
this.inputUrl.cmpEl.find("input").focus();
return;
}
if (checkdisp !== true) {
this.inputDisplay.cmpEl.find("input").focus();
return;
}
}
this.options.handler.call(this, this, state);
}
this.close();
},
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",
textTitle: "Hyperlink Settings"
},
DE.Views.HyperlinkSettingsDialog || {}));
});

View File

@@ -1,526 +1,369 @@
/*
* (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"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!documenteditor/main/app/template/ImageSettings.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "common/main/lib/view/ImageFromUrlDialog", "documenteditor/main/app/view/ImageSettingsAdvanced"], function (menuTemplate, $, _, Backbone) {
DE.Views.ImageSettings = Backbone.View.extend(_.extend({
el: "#id-image-settings",
template: _.template(menuTemplate),
events: {},
options: {
alias: "ImageSettings"
},
initialize: function () {
var me = this;
this._initSettings = true;
this._state = {
WrappingStyle: c_oAscWrapStyle2.Inline,
CanBeFlow: true,
Width: 0,
Height: 0,
FromGroup: false,
DisabledControls: false
};
this.lockedControls = [];
this._locked = false;
this._noApply = false;
this._originalProps = null;
this.render();
var viewData = [{
offsetx: 0,
data: c_oAscWrapStyle2.Inline,
iconcls: "wrap-inline",
tip: this.txtInline,
selected: true
},
{
offsetx: 50,
data: c_oAscWrapStyle2.Square,
iconcls: "wrap-square",
tip: this.txtSquare
},
{
offsetx: 100,
data: c_oAscWrapStyle2.Tight,
iconcls: "wrap-tight",
tip: this.txtTight
},
{
offsetx: 150,
data: c_oAscWrapStyle2.Through,
iconcls: "wrap-through",
tip: this.txtThrough
},
{
offsetx: 200,
data: c_oAscWrapStyle2.TopAndBottom,
iconcls: "wrap-topAndBottom",
tip: this.txtTopAndBottom
},
{
offsetx: 250,
data: c_oAscWrapStyle2.InFront,
iconcls: "wrap-inFront",
tip: this.txtInFront
},
{
offsetx: 300,
data: c_oAscWrapStyle2.Behind,
iconcls: "wrap-behind",
tip: this.txtBehind
}];
this.btnWrapType = new Common.UI.Button({
cls: "btn-large-dataview",
iconCls: "item-wrap wrap-inline",
menu: new Common.UI.Menu({
items: [{
template: _.template('<div id="id-image-menu-wrap" style="width: 235px; margin: 0 5px;"></div>')
}]
})
});
this.btnWrapType.on("render:after", function (btn) {
me.mnuWrapPicker = new Common.UI.DataView({
el: $("#id-image-menu-wrap"),
parentMenu: btn.menu,
store: new Common.UI.DataViewStore(viewData),
itemTemplate: _.template('<div id="<%= id %>" class="item-wrap" style="background-position: -<%= offsetx %>px 0;"></div>')
});
});
this.btnWrapType.render($("#image-button-wrap"));
this.mnuWrapPicker.on("item:click", _.bind(this.onSelectWrap, this, this.btnWrapType));
this.lockedControls.push(this.btnWrapType);
this.labelWidth = $(this.el).find("#image-label-width");
this.labelHeight = $(this.el).find("#image-label-height");
this.btnOriginalSize = new Common.UI.Button({
el: $("#image-button-original-size")
});
this.lockedControls.push(this.btnOriginalSize);
this.btnInsertFromFile = new Common.UI.Button({
el: $("#image-button-from-file")
});
this.lockedControls.push(this.btnInsertFromFile);
this.btnInsertFromUrl = new Common.UI.Button({
el: $("#image-button-from-url")
});
this.lockedControls.push(this.btnInsertFromUrl);
this.btnOriginalSize.on("click", _.bind(this.setOriginalSize, this));
this.btnInsertFromFile.on("click", _.bind(function (btn) {
if (this.api) {
this.api.ChangeImageFromFile();
}
this.fireEvent("editcomplete", this);
},
this));
this.btnInsertFromUrl.on("click", _.bind(this.insertFromUrl, this));
$(this.el).on("click", "#image-advanced-link", _.bind(this.openAdvancedSettings, this));
},
render: function () {
var el = $(this.el);
el.html(this.template({
scope: this
}));
this.linkAdvanced = $("#image-advanced-link");
},
setApi: function (api) {
this.api = api;
if (this.api) {
this.api.asc_registerCallback("asc_onImgWrapStyleChanged", _.bind(this._ImgWrapStyleChanged, this));
}
return this;
},
updateMetricUnit: function () {
var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width);
this.labelWidth[0].innerHTML = this.textWidth + ": " + value.toFixed(1) + " " + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height);
this.labelHeight[0].innerHTML = this.textHeight + ": " + value.toFixed(1) + " " + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
},
createDelayedElements: function () {
this.updateMetricUnit();
},
ChangeSettings: function (props) {
if (this._initSettings) {
this.createDelayedElements();
this._initSettings = false;
}
this.disableControls(this._locked);
if (props) {
this._originalProps = new CImgProperty(props);
var value = props.get_WrappingStyle();
if (this._state.WrappingStyle !== value) {
this._noApply = true;
var record = this.mnuWrapPicker.store.findWhere({
data: value
});
this.mnuWrapPicker.selectRecord(record, true);
if (record) {
this.btnWrapType.setIconCls("item-wrap " + record.get("iconcls"));
} else {
this.btnWrapType.setIconCls("");
}
this._noApply = false;
this._state.WrappingStyle = value;
}
value = props.get_CanBeFlow() && !this._locked;
var fromgroup = props.get_FromGroup() || this._locked;
if (this._state.CanBeFlow !== value || this._state.FromGroup !== fromgroup) {
this.btnWrapType.setDisabled(!value || fromgroup);
this._state.CanBeFlow = value;
this._state.FromGroup = fromgroup;
}
value = props.get_Width();
if (Math.abs(this._state.Width - value) > 0.001) {
this.labelWidth[0].innerHTML = this.textWidth + ": " + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + " " + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this._state.Width = value;
}
value = props.get_Height();
if (Math.abs(this._state.Height - value) > 0.001) {
this.labelHeight[0].innerHTML = this.textHeight + ": " + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(1) + " " + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this._state.Height = value;
}
this.btnOriginalSize.setDisabled(props.get_ImageUrl() === null || props.get_ImageUrl() === undefined || this._locked);
}
},
_ImgWrapStyleChanged: function (style) {
if (this._state.WrappingStyle !== style) {
this._noApply = true;
var record = this.mnuWrapPicker.store.findWhere({
data: style
});
this.mnuWrapPicker.selectRecord(record, true);
if (record) {
this.btnWrapType.setIconCls("item-wrap " + record.get("iconcls"));
}
this._state.WrappingStyle = style;
this._noApply = false;
}
},
onSelectWrap: function (btn, picker, itemView, record) {
if (this._noApply) {
return;
}
var rawData = {},
isPickerSelect = _.isFunction(record.toJSON);
if (isPickerSelect) {
if (record.get("selected")) {
rawData = record.toJSON();
} else {
return;
}
} else {
rawData = record;
}
this.btnWrapType.setIconCls("item-wrap " + rawData.iconcls);
if (this.api) {
var props = new CImgProperty();
props.put_WrappingStyle((rawData.data));
if (this._state.WrappingStyle === c_oAscWrapStyle2.Inline && rawData.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);
},
setOriginalSize: function () {
if (this.api) {
var imgsize = this.api.get_OriginalSizeImage();
var w = imgsize.get_ImageWidth();
var h = imgsize.get_ImageHeight();
this.labelWidth[0].innerHTML = this.textWidth + ": " + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + " " + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
this.labelHeight[0].innerHTML = this.textHeight + ": " + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + " " + Common.Utils.Metric.metricName[Common.Utils.Metric.getCurrentMetric()];
var properties = new CImgProperty();
properties.put_Width(w);
properties.put_Height(h);
this.api.ImgApply(properties);
this.fireEvent("editcomplete", this);
}
},
insertFromUrl: function () {
var me = this;
(new Common.Views.ImageFromUrlDialog({
handler: function (result, value) {
if (result == "ok") {
if (me.api) {
var checkUrl = value.replace(/ /g, "");
if (!_.isEmpty(checkUrl)) {
var props = new CImgProperty();
props.put_ImageUrl(checkUrl);
me.api.ImgApply(props);
}
}
}
me.fireEvent("editcomplete", me);
}
})).show();
},
openAdvancedSettings: function (e) {
if (this.linkAdvanced.hasClass("disabled")) {
return;
}
var me = this;
var win;
if (me.api && !this._locked) {
var selectedElements = me.api.getSelectedElements();
if (selectedElements && selectedElements.length > 0) {
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) {
var imgsizeOriginal;
if (!me.btnOriginalSize.isDisabled()) {
imgsizeOriginal = me.api.get_OriginalSizeImage();
if (imgsizeOriginal) {
imgsizeOriginal = {
width: imgsizeOriginal.get_ImageWidth(),
height: imgsizeOriginal.get_ImageHeight()
};
}
}
var imgsizeMax = this.api.GetSectionInfo();
imgsizeMax = {
width: imgsizeMax.get_PageWidth() - (imgsizeMax.get_MarginLeft() + imgsizeMax.get_MarginRight()),
height: imgsizeMax.get_PageHeight() - (imgsizeMax.get_MarginTop() + imgsizeMax.get_MarginBottom())
};
(new DE.Views.ImageSettingsAdvanced({
imageProps: elValue,
sizeOriginal: imgsizeOriginal,
sizeMax: imgsizeMax,
handler: function (result, value) {
if (result == "ok") {
if (me.api) {
me.api.ImgApply(value.imageProps);
}
}
me.fireEvent("editcomplete", me);
}
})).show();
break;
}
}
}
}
},
setLocked: function (locked) {
this._locked = locked;
},
disableControls: function (disable) {
if (this._state.DisabledControls !== disable) {
this._state.DisabledControls = disable;
_.each(this.lockedControls, function (item) {
item.setDisabled(disable);
});
this.linkAdvanced.toggleClass("disabled", disable);
}
},
textSize: "Size",
textWrap: "Wraping Style",
textWidth: "Width",
textHeight: "Height",
textOriginalSize: "Default Size",
textInsert: "Insert Image",
textFromUrl: "From URL",
textFromFile: "From File",
textAdvanced: "Show advanced settings",
txtInline: "Inline",
txtSquare: "Square",
txtTight: "Tight",
txtThrough: "Through",
txtTopAndBottom: "Top and bottom",
txtBehind: "Behind",
txtInFront: "In front"
},
DE.Views.ImageSettings || {}));
});

View File

@@ -1,194 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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}"
});

View File

@@ -0,0 +1,256 @@
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!documenteditor/main/app/template/LeftMenu.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "common/main/lib/view/About", "common/main/lib/view/Comments", "common/main/lib/view/Chat", "common/main/lib/view/About", "common/main/lib/view/SearchDialog", "documenteditor/main/app/view/FileMenu"], function (menuTemplate, $, _, Backbone) {
var SCALE_MIN = 40;
var MENU_SCALE_PART = 300;
DE.Views.LeftMenu = Backbone.View.extend(_.extend({
el: "#left-menu",
template: _.template(menuTemplate),
events: function () {
return {
"click #left-btn-support": function () {
window.open("http://feedback.onlyoffice.com/");
},
"click #left-btn-comments": _.bind(this.onCoauthOptions, this),
"click #left-btn-chat": _.bind(this.onCoauthOptions, this)
};
},
initialize: function () {
this.minimizedMode = true;
},
render: function () {
var el = $(this.el);
el.html(this.template({}));
this.btnFile = new Common.UI.Button({
action: "file",
el: $("#left-btn-file"),
hint: this.tipFile + Common.Utils.String.platformKey("Alt+F"),
enableToggle: true,
disabled: true,
toggleGroup: "leftMenuGroup"
});
this.btnSearch = new Common.UI.Button({
action: "search",
el: $("#left-btn-search"),
hint: this.tipSearch + Common.Utils.String.platformKey("Ctrl+F"),
disabled: true,
enableToggle: true
});
this.btnAbout = new Common.UI.Button({
action: "about",
el: $("#left-btn-about"),
hint: this.tipAbout,
enableToggle: true,
disabled: true,
toggleGroup: "leftMenuGroup"
});
this.btnSupport = new Common.UI.Button({
action: "support",
el: $("#left-btn-support"),
hint: this.tipSupport,
disabled: true
});
this.btnComments = new Common.UI.Button({
el: $("#left-btn-comments"),
hint: this.tipComments + Common.Utils.String.platformKey("Ctrl+Shift+H"),
enableToggle: true,
disabled: true,
toggleGroup: "leftMenuGroup"
});
this.btnChat = new Common.UI.Button({
el: $("#left-btn-chat"),
hint: this.tipChat + Common.Utils.String.platformKey("Ctrl+Alt+Q", null, function (string) {
if (Common.Utils.isMac) {
string = string.replace(/Ctrl|ctrl/g, "⌃");
}
return string;
}),
enableToggle: true,
disabled: true,
toggleGroup: "leftMenuGroup"
});
this.btnComments.hide();
this.btnChat.hide();
this.btnComments.on("click", _.bind(this.onBtnMenuClick, this));
this.btnChat.on("click", _.bind(this.onBtnMenuClick, this));
this.btnSearch.on("click", _.bind(this.onBtnMenuClick, this));
this.btnAbout.on("toggle", _.bind(this.onBtnMenuToggle, this));
this.btnFile.on("toggle", _.bind(this.onBtnMenuToggle, this));
var menuFile = new DE.Views.FileMenu({});
menuFile.options = {
alias: "FileMenu"
};
this.btnFile.panel = menuFile.render();
this.btnAbout.panel = (new Common.Views.About({
el: $("#about-menu-panel"),
appName: "Document Editor"
})).render();
return this;
},
onBtnMenuToggle: function (btn, state) {
if (state) {
btn.panel["show"]();
this.$el.width(SCALE_MIN);
if (this.btnSearch.isActive()) {
this.btnSearch.toggle(false);
}
} else {
btn.panel["hide"]();
}
if (this.mode.isEdit) {
DE.getController("Toolbar").DisableToolbar(state == true);
}
if (!this.supressEvents) {
Common.NotificationCenter.trigger("layout:changed", "leftmenu");
}
},
onBtnMenuClick: function (btn, e) {
this.supressEvents = true;
this.btnFile.toggle(false);
this.btnAbout.toggle(false);
if (btn.options.action == "search") {} else {
if (btn.pressed) {
if (! (this.$el.width() > SCALE_MIN)) {
this.$el.width(localStorage.getItem("de-mainmenu-width") || MENU_SCALE_PART);
}
} else {
localStorage.setItem("de-mainmenu-width", this.$el.width());
this.$el.width(SCALE_MIN);
}
}
this.supressEvents = false;
Common.NotificationCenter.trigger("layout:changed", "leftmenu");
},
onCoauthOptions: function (e) {
if (this.mode.canCoAuthoring) {
this.panelComments[this.btnComments.pressed ? "show" : "hide"]();
this.fireEvent((this.btnComments.pressed) ? "comments:show": "comments:hide", this);
if (this.btnChat.pressed) {
if (this.btnChat.$el.hasClass("notify")) {
this.btnChat.$el.removeClass("notify");
}
this.panelChat.show();
this.panelChat.focus();
} else {
this.panelChat["hide"]();
}
}
},
setOptionsPanel: function (name, panel) {
if (name == "chat") {
this.panelChat = panel.render("#left-panel-chat");
} else {
if (name == "comment") {
this.panelComments = panel;
}
}
},
markCoauthOptions: function (opt) {
if (this.btnChat.isVisible() && !this.btnChat.isDisabled() && !this.btnChat.pressed) {
this.btnChat.$el.addClass("notify");
}
},
close: function (menu) {
this.btnFile.toggle(false);
this.btnAbout.toggle(false);
this.$el.width(SCALE_MIN);
if (this.mode.canCoAuthoring) {
this.panelComments["hide"]();
this.panelChat["hide"]();
if (this.btnComments.pressed) {
this.fireEvent("comments:hide", this);
}
this.btnComments.toggle(false, true);
this.btnChat.toggle(false, true);
}
},
isOpened: function () {
var isopened = this.btnFile.pressed || this.btnSearch.pressed; ! isopened && (isopened = this.btnComments.pressed || this.btnChat.pressed);
return isopened;
},
disableMenu: function (menu, disable) {
this.btnFile.setDisabled(false);
this.btnSearch.setDisabled(false);
this.btnAbout.setDisabled(false);
this.btnSupport.setDisabled(false);
this.btnComments.setDisabled(false);
this.btnChat.setDisabled(false);
},
showMenu: function (menu) {
var re = /^(\w+):?(\w*)$/.exec(menu);
if (re[1] == "file") {
if (!this.btnFile.pressed) {
this.btnFile.toggle(true);
}
this.btnFile.panel.show(re[2].length ? re[2] : undefined);
} else {
if (menu == "chat") {
if (this.btnChat.isVisible() && !this.btnChat.isDisabled() && !this.btnChat.pressed) {
this.btnChat.toggle(true);
this.onBtnMenuClick(this.btnChat);
this.onCoauthOptions();
this.panelChat.focus();
}
} else {
if (menu == "comments") {
if (this.btnComments.isVisible() && !this.btnComments.isDisabled() && !this.btnComments.pressed) {
this.btnComments.toggle(true);
this.onBtnMenuClick(this.btnComments);
this.onCoauthOptions();
}
}
}
}
},
getMenu: function (type) {
switch (type) {
default:
return null;
case "file":
return this.btnFile.panel;
case "about":
return this.btnAbout.panel;
}
},
setMode: function (mode) {
this.mode = mode;
return this;
},
tipComments: "Comments",
tipChat: "Chat",
tipAbout: "About",
tipSupport: "Feedback & Support",
tipFile: "File",
tipSearch: "Search"
},
DE.Views.LeftMenu || {}));
});

View File

@@ -1,345 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
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();
}
}
}
});

View File

@@ -1,74 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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();
}
});

View File

@@ -1,75 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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
}
}]
}]
});
}
});

View File

@@ -1,223 +1,236 @@
/*
* (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"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
var SCALE_MIN = 40;
var MENU_SCALE_PART = 260;
define(["text!documenteditor/main/app/template/RightMenu.template", "jquery", "underscore", "backbone", "common/main/lib/component/Button", "common/main/lib/component/MetricSpinner", "common/main/lib/component/CheckBox", "documenteditor/main/app/view/ParagraphSettings", "documenteditor/main/app/view/HeaderFooterSettings", "documenteditor/main/app/view/ImageSettings", "documenteditor/main/app/view/ChartSettings", "documenteditor/main/app/view/TableSettings", "documenteditor/main/app/view/ShapeSettings", "common/main/lib/component/Scroller"], function (menuTemplate, $, _, Backbone) {
DE.Views.RightMenu = Backbone.View.extend(_.extend({
el: "#right-menu",
template: _.template(menuTemplate),
events: {},
initialize: function () {
this.minimizedMode = true;
this.btnText = new Common.UI.Button({
hint: this.txtParagraphSettings,
asctype: c_oAscTypeSelectElement.Paragraph,
enableToggle: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this.btnTable = new Common.UI.Button({
hint: this.txtTableSettings,
asctype: c_oAscTypeSelectElement.Table,
enableToggle: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this.btnImage = new Common.UI.Button({
hint: this.txtImageSettings,
asctype: c_oAscTypeSelectElement.Image,
enableToggle: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this.btnHeaderFooter = new Common.UI.Button({
hint: this.txtHeaderFooterSettings,
asctype: c_oAscTypeSelectElement.Header,
enableToggle: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this.btnChart = new Common.UI.Button({
hint: this.txtChartSettings,
asctype: c_oAscTypeSelectElement.Chart,
enableToggle: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this.btnShape = new Common.UI.Button({
hint: this.txtShapeSettings,
asctype: c_oAscTypeSelectElement.Shape,
enableToggle: true,
disabled: true,
toggleGroup: "tabpanelbtnsGroup"
});
this._settings = [];
this._settings[c_oAscTypeSelectElement.Paragraph] = {
panel: "id-paragraph-settings",
btn: this.btnText
};
this._settings[c_oAscTypeSelectElement.Table] = {
panel: "id-table-settings",
btn: this.btnTable
};
this._settings[c_oAscTypeSelectElement.Image] = {
panel: "id-image-settings",
btn: this.btnImage
};
this._settings[c_oAscTypeSelectElement.Header] = {
panel: "id-header-settings",
btn: this.btnHeaderFooter
};
this._settings[c_oAscTypeSelectElement.Shape] = {
panel: "id-shape-settings",
btn: this.btnShape
};
this._settings[c_oAscTypeSelectElement.Chart] = {
panel: "id-chart-settings",
btn: this.btnChart
};
return this;
},
render: function () {
var el = $(this.el);
this.trigger("render:before", this);
el.css("width", "40px");
el.show();
el.html(this.template({}));
this.btnText.el = $("#id-right-menu-text");
this.btnText.render();
this.btnTable.el = $("#id-right-menu-table");
this.btnTable.render();
this.btnImage.el = $("#id-right-menu-image");
this.btnImage.render();
this.btnHeaderFooter.el = $("#id-right-menu-header");
this.btnHeaderFooter.render();
this.btnChart.el = $("#id-right-menu-chart");
this.btnChart.render();
this.btnShape.el = $("#id-right-menu-shape");
this.btnShape.render();
this.btnText.on("click", _.bind(this.onBtnMenuClick, this));
this.btnTable.on("click", _.bind(this.onBtnMenuClick, this));
this.btnImage.on("click", _.bind(this.onBtnMenuClick, this));
this.btnHeaderFooter.on("click", _.bind(this.onBtnMenuClick, this));
this.btnChart.on("click", _.bind(this.onBtnMenuClick, this));
this.btnShape.on("click", _.bind(this.onBtnMenuClick, this));
this.paragraphSettings = new DE.Views.ParagraphSettings();
this.headerSettings = new DE.Views.HeaderFooterSettings();
this.imageSettings = new DE.Views.ImageSettings();
this.chartSettings = new DE.Views.ChartSettings();
this.tableSettings = new DE.Views.TableSettings();
this.shapeSettings = new DE.Views.ShapeSettings();
if (_.isUndefined(this.scroller)) {
this.scroller = new Common.UI.Scroller({
el: $(this.el).find(".right-panel"),
suppressScrollX: true,
useKeyboard: false
});
}
this.trigger("render:after", this);
return this;
},
setApi: function (api) {
this.api = api;
var fire = function () {
this.fireEvent("editcomplete", this);
};
this.paragraphSettings.setApi(api).on("editcomplete", _.bind(fire, this));
this.headerSettings.setApi(api).on("editcomplete", _.bind(fire, this));
this.imageSettings.setApi(api).on("editcomplete", _.bind(fire, this));
this.chartSettings.setApi(api).on("editcomplete", _.bind(fire, this));
this.tableSettings.setApi(api).on("editcomplete", _.bind(fire, this));
this.shapeSettings.setApi(api).on("editcomplete", _.bind(fire, this));
},
setMode: function (mode) {},
onBtnMenuClick: function (btn, e) {
var target_pane = $("#" + this._settings[btn.options.asctype].panel);
var target_pane_parent = target_pane.parent();
if (btn.pressed) {
if (this.minimizedMode) {
$(this.el).width(MENU_SCALE_PART);
target_pane_parent.css("display", "inline-block");
this.minimizedMode = false;
window.localStorage.setItem("de-hidden-right-settings", 0);
}
target_pane_parent.find("> .active").removeClass("active");
target_pane.addClass("active");
if (this.scroller) {
this.scroller.scrollTop(0);
}
} else {
target_pane_parent.css("display", "none");
$(this.el).width(SCALE_MIN);
this.minimizedMode = true;
window.localStorage.setItem("de-hidden-right-settings", 1);
}
this.fireEvent("rightmenuclick", [this, btn.options.asctype, this.minimizedMode]);
},
SetActivePane: function (type, open) {
if (this.minimizedMode && open !== true || this._settings[type] === undefined) {
return;
}
if (this.minimizedMode) {
this._settings[type].btn.toggle(true, false);
this._settings[type].btn.trigger("click", this._settings[type].btn);
} else {
var target_pane = $("#" + this._settings[type].panel);
if (!target_pane.hasClass("active")) {
target_pane.parent().find("> .active").removeClass("active");
target_pane.addClass("active");
if (this.scroller) {
this.scroller.update();
}
}
if (!this._settings[type].btn.isActive()) {
this._settings[type].btn.toggle(true, false);
}
}
},
GetActivePane: function () {
return (this.minimizedMode) ? null : $(".settings-panel.active")[0].id;
},
SetDisabled: function (id, disabled, all) {
if (all) {
this.paragraphSettings.disableControls(disabled);
this.shapeSettings.disableControls(disabled);
this.headerSettings.disableControls(disabled);
this.tableSettings.disableControls(disabled);
this.imageSettings.disableControls(disabled);
this.chartSettings.disableControls(disabled);
} else {
var cmp = $("#" + id);
if (disabled !== cmp.hasClass("disabled")) {
cmp.toggleClass("disabled", disabled);
(disabled) ? cmp.attr({
disabled: disabled
}) : cmp.removeAttr("disabled");
}
}
},
txtParagraphSettings: "Paragraph Settings",
txtImageSettings: "Image Settings",
txtTableSettings: "Table Settings",
txtHeaderFooterSettings: "Header and Footer Settings",
txtShapeSettings: "Shape Settings",
txtChartSettings: "Chart Settings"
},
DE.Views.RightMenu || {}));
});

View File

@@ -1,300 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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);
}
}
});

File diff suppressed because it is too large Load Diff

View File

@@ -1,546 +0,0 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
Ext.define("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"
});

View File

@@ -0,0 +1,470 @@
/**
* StatusBar View
*
* Created by Maxim Kadushkin
* Copyright (c) 2014 Ascensio System SIA. All rights reserved.
*
*/
define([
'text!documenteditor/main/app/template/StatusBar.template',
'jquery',
'underscore',
'backbone',
'tip',
'common/main/lib/component/Menu',
'common/main/lib/component/Window',
'documenteditor/main/app/model/Pages'
],
function(template, $, _, Backbone){
'use strict';
function _onCountPages(count){
this.pages.set('count', count);
}
function _onCurrentPage(number){
this.pages.set('current', number+1);
}
var _tplPages = _.template('Page <%= current %> of <%= count %>');
function _updatePagesCaption(model,value,opts) {
$('#status-label-pages').text(
Common.Utils.String.format(this.pageIndexText, model.get('current'), model.get('count')) );
}
function _clickLanguage(menu, item, state) {
var $parent = $(menu.el.parentNode);
$parent.find('#status-label-lang').text(item.caption);
$parent.find('.icon-lang-flag')
.removeClass(this.langMenu.prevTip)
.addClass(item.value.tip);
this.langMenu.prevTip = item.value.tip;
this.fireEvent('langchanged', [this, item.value.code, item.caption]);
}
if ( DE.Views.Statusbar )
var LanguageDialog = DE.Views.Statusbar.LanguageDialog || {};
DE.Views.Statusbar = Backbone.View.extend(_.extend({
el: '#statusbar',
template: _.template(template),
events: {
},
api: undefined,
pages: undefined,
initialize: function () {
this.pages = new DE.Models.Pages({current:1, count:1});
this.pages.on('change', _.bind(_updatePagesCaption,this));
},
render: function () {
$(this.el).html(this.template({
scope: this
}));
this.btnZoomToPage = new Common.UI.Button({
el: $('#btn-zoom-topage',this.el),
hint: this.tipFitPage,
hintAnchor: 'top',
toggleGroup: 'status-zoom',
enableToggle: true
});
this.btnZoomToWidth = new Common.UI.Button({
el: $('#btn-zoom-towidth',this.el),
hint: this.tipFitWidth,
hintAnchor: 'top',
toggleGroup: 'status-zoom',
enableToggle: true
});
this.btnZoomDown = new Common.UI.Button({
el: $('#btn-zoom-down',this.el),
hint: this.tipZoomOut + Common.Utils.String.platformKey('Ctrl+-'),
hintAnchor: 'top'
});
this.btnZoomUp = new Common.UI.Button({
el: $('#btn-zoom-up',this.el),
hint: this.tipZoomIn + Common.Utils.String.platformKey('Ctrl++'),
hintAnchor: 'top-right'
});
this.btnDocLanguage = new Common.UI.Button({
el: $('#btn-doc-lang',this.el),
hint: this.tipSetDocLang,
hintAnchor: 'top'
});
this.btnSetSpelling = new Common.UI.Button({
el: $('#btn-doc-spell',this.el),
enableToggle: true,
hint: this.tipSetSpelling,
hintAnchor: 'top'
});
var panelLang = $('.cnt-lang',this.el);
this.langMenu = new Common.UI.Menu({
style: 'margin-top:-5px;',
maxHeight: 300,
menuAlign: 'bl-tl'
});
this.btnLanguage = new Common.UI.Button({
el: panelLang,
hint: this.tipSetLang,
hintAnchor: 'top-left'
});
this.btnLanguage.cmpEl.on('show.bs.dropdown', function () {
_.defer(function(){
me.api.asc_enableKeyEvents(false);
me.btnLanguage.cmpEl.find('ul').focus();
}, 100);
}
);
this.btnLanguage.cmpEl.on('hide.bs.dropdown', function () {
_.defer(function(){
me.api.asc_enableKeyEvents(true);
}, 100);
}
);
this.langMenu.render(panelLang);
this.langMenu.cmpEl.attr({tabindex: -1});
this.cntZoom = new Common.UI.Button({
el: $('.cnt-zoom',this.el),
hint: this.tipZoomFactor,
hintAnchor: 'top'
});
this.cntZoom.cmpEl.on('show.bs.dropdown', function () {
_.defer(function(){
me.api.asc_enableKeyEvents(false);
me.cntZoom.cmpEl.find('ul').focus();
}, 100);
}
);
this.cntZoom.cmpEl.on('hide.bs.dropdown', function () {
_.defer(function(){
me.api.asc_enableKeyEvents(true);
}, 100);
}
);
this.zoomMenu = new Common.UI.Menu({
style: 'margin-top:-5px;',
menuAlign: 'bl-tl',
items: [
{ caption: "50%", value: 50 },
{ caption: "75%", value: 75 },
{ caption: "100%", value: 100 },
{ caption: "125%", value: 125 },
{ caption: "150%", value: 150 },
{ caption: "175%", value: 175 },
{ caption: "200%", value: 200 }
]
});
this.zoomMenu.render($('.cnt-zoom',this.el));
this.zoomMenu.cmpEl.attr({tabindex: -1});
this.langMenu.prevTip = 'en';
this.langMenu.on('item:click', _.bind(_clickLanguage,this));
/** coauthoring begin **/
this.panelUsers = $('#status-users-ct', this.el);
this.panelUsers.find('#status-users-block').on('click', _.bind(this.onUsersClick, this));
/** coauthoring end **/
// Go To Page
var me = this;
this.txtGoToPage = new Common.UI.InputField({
el : $('#status-goto-page'),
allowBlank : true,
validateOnChange: true,
style : 'width: 60px;',
maskExp: /[0-9]/,
validation : function(value) {
if (/(^[0-9]+$)/.test(value)) {
value = parseInt(value);
if (undefined !== value && value > 0 && value <= me.pages.get('count'))
return true;
}
return me.txtPageNumInvalid;
}
}).on('keypress:after', function(input, e) {
var box = me.$el.find('#status-goto-box');
if (e.keyCode === Common.UI.Keys.RETURN) {
var edit = box.find('input[type=text]'), page = parseInt(edit.val());
if (!page || page-- > me.pages.get('count') || page < 0) {
edit.select();
return false;
}
box.focus(); // for IE
box.parent().removeClass('open');
me.api.goToPage(page);
me.api.asc_enableKeyEvents(true);
return false;
}
}
);
var goto = this.$el.find('#status-goto-box');
goto.on('click', function() {
return false;
});
goto.parent().on('show.bs.dropdown',
function () {
me.txtGoToPage.setValue(me.api.getCurrentPage() + 1);
me.txtGoToPage.checkValidate();
var edit = me.txtGoToPage.$el.find('input');
_.defer(function(){edit.focus(); edit.select();}, 100);
}
);
goto.parent().on('hide.bs.dropdown',
function () { var box = me.$el.find('#status-goto-box');
if (me.api && box) {
box.focus(); // for IE
box.parent().removeClass('open');
me.api.asc_enableKeyEvents(true);
}
}
);
return this;
},
setApi: function(api) {
this.api = api;
if (this.api) {
this.api.asc_registerCallback('asc_onCountPages', _.bind(_onCountPages, this));
this.api.asc_registerCallback('asc_onCurrentPage', _.bind(_onCurrentPage, this));
/** coauthoring begin **/
this.api.asc_registerCallback('asc_onAuthParticipantsChanged', _.bind(this.onApiUsersChanged, this));
this.api.asc_registerCallback('asc_onParticipantsChanged', _.bind(this.onApiUsersChanged, this));
/** coauthoring end **/
}
return this;
},
setMode: function(mode) {
this.$el.find('.el-edit')[mode.isEdit?'show':'hide']();
},
setVisible: function(visible) {
visible
? this.show()
: this.hide();
},
/** coauthoring begin **/
onUsersClick: function() {
this.fireEvent('click:users', this);
},
onApiUsersChanged: function(users) {
var editusers = [];
_.each(users, function(item){
if (!item.asc_getView())
editusers.push(item);
});
var length = _.size(editusers);
this.panelUsers[length > 1 ? 'show' : 'hide']();
var ttblock = this.panelUsers.find('#status-users-block');
if (ttblock.data('bs.tooltip')) ttblock.removeData('bs.tooltip');
if (length > 1) {
this.panelUsers.find('#status-users-count').text(length);
var tip = this.tipUsers + '<br/><br/>', i = 0;
for (var n in editusers) {
tip += '\n' + Common.Utils.String.htmlEncode(editusers[n].asc_getUserName());
if (++i > 3) break;
}
if (length > 4) {
tip += '<br/>' + this.tipMoreUsers.replace('%1', length-4);
tip += '<br/><br/>' + this.tipShowUsers;
}
ttblock.tooltip({
title: tip,
html: true,
placement: 'top-left'
});
}
},
/** coauthoring end **/
reloadLanguages: function(array) {
_.each(array, function(item) {
this.langMenu.addItem({
iconCls : item['tip'],
caption : item['title'],
value : {tip: item['tip'], code: item['code']},
checkable : true,
checked : this.langMenu.saved == item.title,
toggleGroup : 'language'
});
}, this);
this.langMenu.doLayout();
},
setLanguage: function(info) {
if (this.langMenu.prevTip != info.tip) {
var $parent = $(this.langMenu.el.parentNode);
$parent.find('.icon-lang-flag')
.removeClass(this.langMenu.prevTip)
.addClass(info.tip);
this.langMenu.prevTip = info.tip;
$parent.find('#status-label-lang').text(info.title);
var index = $parent.find('ul li a:contains("'+info.title+'")').parent().index();
index < 0 ? this.langMenu.saved = info.title :
this.langMenu.items[index-1].setChecked(true);
}
},
showStatusMessage: function(message) {
$('#status-label-action').text(message);
},
clearStatusMessage: function() {
$('#status-label-action').text('');
},
pageIndexText : 'Page {0} of {1}',
goToPageText : 'Go to Page',
tipUsers : 'Document is in the collaborative editing mode.',
tipMoreUsers : 'and %1 users.',
tipShowUsers : 'To see all users click the icon below.',
tipFitPage : 'Fit Page',
tipFitWidth : 'Fit Width',
tipZoomIn : 'Zoom In',
tipZoomOut : 'Zoom Out',
tipZoomFactor : 'Magnification',
tipSetLang : 'Set Text Language',
tipSetDocLang : 'Set Document Language',
tipSetSpelling : 'Turn on spell checking option',
txtPageNumInvalid : 'Page number invalid'
}, DE.Views.Statusbar || {}));
DE.Views.Statusbar.LanguageDialog = Common.UI.Window.extend(_.extend({
options: {
header: false,
width: 350,
cls: 'modal-dlg'
},
template: '<div class="box">' +
'<div class="input-row">' +
'<label><%= label %></label>' +
'</div>' +
'<div class="input-row" id="id-document-language">' +
'</div>' +
'</div>' +
'<div class="footer right">' +
'<button class="btn normal dlg-btn primary" result="ok" style="margin-right: 10px;"><%= btns.ok %></button>'+
'<button class="btn normal dlg-btn" result="cancel"><%= btns.cancel %></button>'+
'</div>',
initialize : function(options) {
_.extend(this.options, options || {}, {
label: this.labelSelect,
btns: {ok: this.btnOk, cancel: this.btnCancel}
});
this.options.tpl = _.template(this.template, this.options);
Common.UI.Window.prototype.initialize.call(this, this.options);
},
render: function() {
Common.UI.Window.prototype.render.call(this);
var $window = this.getChild();
$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
this.cmbLanguage = new Common.UI.ComboBox({
el: $window.find('#id-document-language'),
cls: 'input-group-nr',
menuStyle: 'min-width: 318px; max-height: 300px;',
editable: false,
template: _.template([
'<span class="input-group combobox <%= cls %> combo-langs" id="<%= id %>" style="<%= style %>">',
'<input type="text" class="form-control">',
'<span class="input-lang-icon" style="position: absolute;"></span>',
'<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button>',
'<ul class="dropdown-menu <%= menuCls %>" style="<%= menuStyle %>" role="menu">',
'<% _.each(items, function(item) { %>',
'<li id="<%= item.id %>" data-value="<%= item.value %>">',
'<a tabindex="-1" type="menuitem" style="padding-left: 26px !important;">',
'<span class="menu-item-icon <%= item.value %> " style="position: absolute;margin-left:-21px;"></span>',
'<%= scope.getDisplayValue(item) %>',
'</a>',
'</li>',
'<% }); %>',
'</ul>',
'</span>'
].join('')),
data: this.options.languages
});
this.cmbLanguage.scroller.update({alwaysVisibleY: true});
this.cmbLanguage.on('selected', _.bind(this.onLangSelect, this));
this.cmbLanguage.setValue(Common.util.LanguageInfo.getLocalLanguageName(this.options.current)[0]);
this.onLangSelect(this.cmbLanguage, this.cmbLanguage.getSelectedRecord());
},
close: function(suppressevent) {
var $window = this.getChild();
if (!$window.find('.combobox.open').length) {
Common.UI.Window.prototype.close.call(this, arguments);
}
},
onBtnClick: function(event) {
if (this.options.handler) {
this.options.handler.call(this, event.currentTarget.attributes['result'].value, this.cmbLanguage.getValue());
}
this.close();
},
onLangSelect: function(cmb, rec, e) {
var icon = cmb.$el.find('.input-lang-icon'),
plang = icon.attr('lang');
if (plang) icon.removeClass(plang);
icon.addClass(rec.value).attr('lang',rec.value);
},
labelSelect : 'Select document language',
btnCancel : 'Cancel',
btnOk : 'Ok'
}, LanguageDialog||{}));
}
);

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -1,314 +1,121 @@
/*
* (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"
/*
* (c) Copyright Ascensio System SIA 2010-2015
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
define(["text!documenteditor/main/app/template/Viewport.template", "jquery", "underscore", "backbone", "common/main/lib/component/Layout"], function (viewportTemplate, $, _, Backbone) {
DE.Views.Viewport = Backbone.View.extend({
el: "#viewport",
template: _.template(viewportTemplate),
events: {},
initialize: function () {},
render: function () {
var el = $(this.el);
el.html(this.template({}));
if (Common.Utils.isSafari) {
$("body").addClass("safari");
$("body").mousewheel(function (e) {
e.preventDefault();
e.stopPropagation();
});
} else {
if (Common.Utils.isChrome) {
$("body").addClass("chrome");
}
}
var $container = $("#viewport-vbox-layout", el);
var items = $container.find(" > .layout-item");
this.vlayout = new Common.UI.VBoxLayout({
box: $container,
items: [{
el: items[0],
rely: true
},
{
el: items[1],
rely: true
},
{
el: items[2],
stretch: true
},
{
el: items[3],
height: 25
}]
});
$container = $("#viewport-hbox-layout", el);
items = $container.find(" > .layout-item");
this.hlayout = new Common.UI.HBoxLayout({
box: $container,
items: [{
el: items[0],
rely: true,
resize: {
hidden: true,
autohide: false,
min: 300,
max: 600
}
},
{
el: items[1],
stretch: true
},
{
el: $(items[2]).hide(),
rely: true
}]
});
return this;
},
applyEditorMode: function () {
var me = this,
toolbarView = DE.getController("Toolbar").getView("Toolbar"),
rightMenuView = DE.getController("RightMenu").getView("RightMenu"),
statusBarView = DE.getController("Statusbar").getView("Statusbar");
me._toolbar = toolbarView.render();
me._rightMenu = rightMenuView.render();
var value = window.localStorage.getItem("de-hidden-status");
if (value !== null && parseInt(value) == 1) {
statusBarView.setVisible(false);
}
},
setMode: function (mode) {
if (mode.isDisconnected) {
if (_.isUndefined(this.mode)) {
this.mode = {};
}
this.mode.canCoAuthoring = false;
} else {
this.mode = mode;
}
}
});
});