diff --git a/.gitignore b/.gitignore index 9319f27ea..cb4a0c389 100644 --- a/.gitignore +++ b/.gitignore @@ -3,12 +3,17 @@ Thumbs.db .DS_Store /deploy build/node_modules +build/sprites/node_modules/ apps/documenteditor/embed/resources/less/node_modules apps/presentationeditor/embed/resources/less/node_modules apps/spreadsheeteditor/embed/resources/less/node_modules apps/documenteditor/mobile/resources/sass/.sass-cache apps/spreadsheeteditor/mobile/resources/sass/.sass-cache apps/presentationeditor/mobile/resources/sass/.sass-cache +apps/**/main/resources/**/iconssmall*.png +apps/**/main/resources/**/iconssmall*.less +apps/**/main/resources/**/iconsbig*.png +apps/**/main/resources/**/iconsbig*.less # test documents @@ -22,4 +27,4 @@ apps/spreadsheeteditor/mobile/offlinedocs # tests selenium-debug.log **/test/bin -**/test/reports \ No newline at end of file +**/test/reports diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..0e075b610 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "filewatcher.commands": [ + { + "match": "app-(ios|material)\\.less", + "isAsync": true, + "cmd": "lessc --js --no-color '${file}' '${fileDirname}/../css/${fileBasenameNoExt}.css'", + "event": "onFileChange" + } + ] +} \ No newline at end of file diff --git a/Readme.md b/Readme.md index 56395225d..747cb8437 100644 --- a/Readme.md +++ b/Readme.md @@ -1,25 +1,29 @@ -[![License](https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat)](https://www.gnu.org/licenses/agpl-3.0.en.html) - -## web-apps - -The frontend for [ONLYOFFICE Document Server][2]. Builds the program interface and allows the user create, edit, save and export text, spreadsheet and presentation documents using the common interface of a document editor. - -## Project Information - -Official website: [http://www.onlyoffice.org](http://onlyoffice.org "http://www.onlyoffice.org") - -Code repository: [https://github.com/ONLYOFFICE/web-apps](https://github.com/ONLYOFFICE/web-apps "https://github.com/ONLYOFFICE/web-apps") - -SaaS version: [http://www.onlyoffice.com](http://www.onlyoffice.com "http://www.onlyoffice.com") - -## User Feedback and Support - -If you have any problems with or questions about [ONLYOFFICE Document Server][2], please visit our official forum to find answers to your questions: [dev.onlyoffice.org][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][3]. - - [1]: http://dev.onlyoffice.org - [2]: https://github.com/ONLYOFFICE/DocumentServer - [3]: http://stackoverflow.com/questions/tagged/onlyoffice - -## License - -web-apps is released under an GNU AGPL v3.0 license. See the LICENSE file for more information. +[![License](https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat)](https://www.gnu.org/licenses/agpl-3.0.en.html) + +## web-apps + +The frontend for [ONLYOFFICE Document Server][2]. Builds the program interface and allows the user create, edit, save and export text, spreadsheet and presentation documents using the common interface of a document editor. + +## Previos versions + +Until 2019-10-23 the repository was called web-apps-pro + +## Project Information + +Official website: [http://www.onlyoffice.org](http://onlyoffice.org "http://www.onlyoffice.org") + +Code repository: [https://github.com/ONLYOFFICE/web-apps](https://github.com/ONLYOFFICE/web-apps "https://github.com/ONLYOFFICE/web-apps") + +SaaS version: [http://www.onlyoffice.com](http://www.onlyoffice.com "http://www.onlyoffice.com") + +## User Feedback and Support + +If you have any problems with or questions about [ONLYOFFICE Document Server][2], please visit our official forum to find answers to your questions: [dev.onlyoffice.org][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][3]. + + [1]: http://dev.onlyoffice.org + [2]: https://github.com/ONLYOFFICE/DocumentServer + [3]: http://stackoverflow.com/questions/tagged/onlyoffice + +## License + +web-apps is released under an GNU AGPL v3.0 license. See the LICENSE file for more information. diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index ed34a79cb..f3cc1fc2a 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -44,7 +44,7 @@ review: , // default = edit print: , // default = true rename: , // default = false - changeHistory: , // default = false + changeHistory: , // default = false // must be deprecated, check onRequestRestore event instead comment: // default = edit, modifyFilter: // default = true modifyContentControl: // default = true @@ -109,7 +109,8 @@ goback: { url: 'http://...', text: 'Go to London', - blank: true + blank: true, + requestClose: false // if true - goback send onRequestClose event instead opening url }, chat: true, comments: true, @@ -129,7 +130,8 @@ toolbarNoTabs: false, toolbarHideFileName: false, reviewDisplay: 'original', - spellcheck: true + spellcheck: true, + compatibleFeatures: false }, plugins: { autostart: ['asc.{FFE1F462-1EA2-4391-990D-4CC84940B754}'], @@ -206,6 +208,8 @@ _config.editorConfig.canRequestSaveAs = _config.events && !!_config.events.onRequestSaveAs; _config.editorConfig.canRequestInsertImage = _config.events && !!_config.events.onRequestInsertImage; _config.editorConfig.canRequestMailMergeRecipients = _config.events && !!_config.events.onRequestMailMergeRecipients; + _config.editorConfig.canRequestCompareFile = _config.events && !!_config.events.onRequestCompareFile; + _config.editorConfig.canRequestSharingSettings = _config.events && !!_config.events.onRequestSharingSettings; _config.frameEditorId = placeholderId; var onMouseUp = function (evt) { @@ -575,6 +579,13 @@ }); }; + var _setRevisedFile = function(data) { + _sendCommand({ + command: 'setRevisedFile', + data: data + }); + }; + var _processMouse = function(evt) { var r = iframe.getBoundingClientRect(); var data = { @@ -619,7 +630,8 @@ showSharingSettings : _showSharingSettings, setSharingSettings : _setSharingSettings, insertImage : _insertImage, - setMailMergeRecipients: _setMailMergeRecipients + setMailMergeRecipients: _setMailMergeRecipients, + setRevisedFile : _setRevisedFile } }; @@ -730,8 +742,14 @@ } } + var userAgent = navigator.userAgent.toLowerCase(), + check = function(regex){ return regex.test(userAgent); }, + isIE = !check(/opera/) && (check(/msie/) || check(/trident/) || check(/edge/)), + isChrome = !isIE && check(/\bchrome\b/), + isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0); + path += app + "/"; - path += config.type === "mobile" + path += (config.type === "mobile" || isSafari_mobile) ? "mobile" : config.type === "embedded" ? "embed" @@ -770,9 +788,19 @@ } } + if (config.editorConfig && (config.editorConfig.mode == 'editdiagram' || config.editorConfig.mode == 'editmerge')) + params += "&internal=true"; + if (config.frameEditorId) params += "&frameEditorId=" + config.frameEditorId; - + + if (config.editorConfig && config.editorConfig.mode == 'view' || + config.document && config.document.permissions && (config.document.permissions.edit === false && !config.document.permissions.review )) + params += "&mode=view"; + + if (config.editorConfig && config.editorConfig.customization && !!config.editorConfig.customization.compactHeader) + params += "&compact=true"; + return params; } @@ -788,7 +816,8 @@ iframe.allowFullscreen = true; iframe.setAttribute("allowfullscreen",""); // for IE11 iframe.setAttribute("onmousewheel",""); // for Safari on Mac - + iframe.setAttribute("allow", "autoplay"); + if (config.type == "mobile") { iframe.style.position = "fixed"; diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js index b8e90ebad..ec542cb31 100644 --- a/apps/common/Gateway.js +++ b/apps/common/Gateway.js @@ -118,6 +118,10 @@ if (Common === undefined) { 'setMailMergeRecipients': function(data) { $me.trigger('setmailmergerecipients', data); + }, + + 'setRevisedFile': function(data) { + $me.trigger('setrevisedfile', data); } }; @@ -289,23 +293,31 @@ if (Common === undefined) { }, requestMakeActionLink: function (config) { - _postMessage({event:'onMakeActionLink', data: config}) + _postMessage({event:'onMakeActionLink', data: config}); }, requestUsers: function () { - _postMessage({event:'onRequestUsers'}) + _postMessage({event:'onRequestUsers'}); }, requestSendNotify: function (emails) { - _postMessage({event:'onRequestSendNotify', data: emails}) + _postMessage({event:'onRequestSendNotify', data: emails}); }, requestInsertImage: function () { - _postMessage({event:'onRequestInsertImage'}) + _postMessage({event:'onRequestInsertImage'}); }, requestMailMergeRecipients: function () { - _postMessage({event:'onRequestMailMergeRecipients'}) + _postMessage({event:'onRequestMailMergeRecipients'}); + }, + + requestCompareFile: function () { + _postMessage({event:'onRequestCompareFile'}); + }, + + requestSharingSettings: function () { + _postMessage({event:'onRequestSharingSettings'}); }, on: function(event, handler){ diff --git a/apps/common/main/lib/component/Button.js b/apps/common/main/lib/component/Button.js index e097848f9..12eb656b7 100644 --- a/apps/common/main/lib/component/Button.js +++ b/apps/common/main/lib/component/Button.js @@ -187,8 +187,9 @@ define([ '' + '<% } else { %>' + '<% if (/svgicon/.test(iconCls)) {' + - 'print(\'\');' + - '} else ' + + 'print(\'' + + '\');' + + '} else ' + 'print(\' \'); %>' + '<% } %>'; @@ -253,7 +254,8 @@ define([ // '<% if (iconCls != "") { print(\' \'); }} %>', '<% if (iconCls != "") { ' + ' if (/svgicon/.test(iconCls)) {' + - 'print(\'\');' + + 'print(\'' + + '\');' + '} else ' + 'print(\' \'); ' + '}} %>', @@ -573,6 +575,13 @@ define([ this.trigger('toggle', this, state); }, + click: function(opts) { + if ( !this.disabled ) { + this.doToggle(); + this.trigger('click', this, opts); + } + }, + isActive: function() { if (this.enableToggle) return this.pressed; @@ -641,6 +650,24 @@ define([ btnIconEl.addClass(cls || ''); }, + changeIcon: function(opts) { + var me = this; + if ( opts && (opts.curr || opts.next)) { + !!opts.curr && (me.$icon.removeClass(opts.curr)); + !!opts.next && !me.$icon.hasClass(opts.next) && (me.$icon.addClass(opts.next)); + + if ( !!me.options.signals ) { + if ( !(me.options.signals.indexOf('icon:changed') < 0) ) { + me.trigger('icon:changed', me, opts); + } + } + } + }, + + hasIcon: function(iconcls) { + return this.$icon.hasClass(iconcls); + }, + setVisible: function(visible) { if (this.cmpEl) this.cmpEl.toggleClass('hidden', !visible); this.visible = visible; @@ -710,7 +737,7 @@ define([ this.caption = caption; if (this.rendered) { - var captionNode = this.cmpEl.find('button:first > .caption').addBack().filter('button > .caption'); + var captionNode = this.cmpEl.find('.caption'); if (captionNode.length > 0) { captionNode.text(caption); diff --git a/apps/common/main/lib/component/Calendar.js b/apps/common/main/lib/component/Calendar.js new file mode 100644 index 000000000..71b282a13 --- /dev/null +++ b/apps/common/main/lib/component/Calendar.js @@ -0,0 +1,491 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2019 + * + * 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 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * 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/component/BaseView', + 'common/main/lib/util/utils' +], function () { + 'use strict'; + + Common.UI.Calendar = Common.UI.BaseView.extend(_.extend({ + + template : + _.template([ + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
', + '
' + ].join('')), + + options: { + date: undefined, + firstday: 0 // 0 - sunday, 1 - monday + }, + + initialize : function(options) { + Common.UI.BaseView.prototype.initialize.call(this, options); + + var me = this; + + this.monthNames = [this.textJanuary, this.textFebruary, this.textMarch, this.textApril, this.textMay, this.textJune, this.textJuly, this.textAugust, this.textSeptember, this.textOctober, this.textNovember, this.textDecember]; + this.dayNamesShort = [this.textShortSunday, this.textShortMonday, this.textShortTuesday, this.textShortWednesday, this.textShortThursday, this.textShortFriday, this.textShortSaturday]; + this.monthShortNames = [this.textShortJanuary, this.textShortFebruary, this.textShortMarch, this.textShortApril, this.textShortMay, this.textShortJune, this.textShortJuly, this.textShortAugust, this.textShortSeptember, this.textShortOctober, this.textShortNovember, this.textShortDecember]; + + me.options.date = options.date; + if (!_.isUndefined(options.firstday) && (options.firstday === 0 || options.firstday === 1)) { + me.options.firstday = options.firstday; + } + + me.enableKeyEvents= me.options.enableKeyEvents; + + me._state = undefined; // 0 - month, 1 - months, 2 - years + + me.render(); + }, + + render: function () { + var me = this; + me.cmpEl = me.$el || $(this.el); + me.cmpEl.html(this.template()); + + me.currentDate = me.options.date || new Date(); + + me.btnPrev = new Common.UI.Button({ + cls: '', + iconCls: 'arrow-prev img-commonctrl' + }); + me.btnPrev.render(me.cmpEl.find('#prev-arrow')); + me.btnPrev.on('click', _.bind(me.onClickPrev, me)); + + me.btnNext = new Common.UI.Button({ + cls: '', + iconCls: 'arrow-next img-commonctrl' + }); + me.btnNext.render(me.cmpEl.find('#next-arrow')); + me.btnNext.on('click', _.bind(me.onClickNext, me)); + + me.cmpEl.on('keydown', function(e) { + me.trigger('calendar:keydown', me, e); + }); + + me.renderMonth(me.currentDate); + + this.trigger('render:after', this); + return this; + }, + + onClickPrev: function () { + var me = this; + if (me._state === 0) { + var d = new Date(me.currentDate); + d.setMonth(d.getMonth() - 1); + if (d.getFullYear() > 0) { + me.renderMonth(d); + } + } else if (me._state === 1) { + var d = new Date(me.currentDate); + d.setFullYear(d.getFullYear() - 1); + if (d.getFullYear() > 0) { + me.renderMonths(d); + } + } else if (me._state === 2) { + var year = me.currentDate.getFullYear(), + newYear; + if (year % 10 !== 0) { + newYear = String(year); + newYear = Number(newYear.slice(0, -1) + '0') - 1; + } else { + newYear = year - 1; + } + if (newYear > 0) { + me.currentDate.setFullYear(newYear); + me.renderYears(newYear); + } + } + }, + + onClickNext: function () { + var me = this; + if (me._state === 0) { + var d = new Date(me.currentDate); + d.setMonth(d.getMonth() + 1); + if (d.getFullYear() > 0) { + me.renderMonth(d); + } + } else if (me._state === 1) { + var d = new Date(me.currentDate); + d.setFullYear(d.getFullYear() + 1); + if (d.getFullYear() > 0) { + me.renderMonths(d); + } + } else if (me._state === 2) { + var year = me.currentDate.getFullYear(), + newYear; + if (year % 10 !== 9) { + newYear = String(year); + newYear = Number(newYear.slice(0, -1) + '9') + 1; + } else { + newYear = year + 1; + } + if (newYear > 0) { + me.currentDate.setFullYear(newYear); + me.renderYears(newYear); + } + } + }, + + renderYears: function (year) { + var me = this, + year = _.isNumber(year) ? year : (me.currentDate ? me.currentDate.getFullYear() : new Date().getFullYear()); + + me._state = 2; + + var firstYear = year, + lastYear = year; + if ((firstYear % 10) !== 0) { + var strYear = String(year); + firstYear = Number(strYear.slice(0, -1) + '0'); + } + if ((lastYear % 10) !== 9) { + var strYear = String(year); + lastYear = Number(strYear.slice(0, -1) + '9'); + } + + me.topTitle = _.template([ + '' + ].join('')); + me.cmpEl.find('.calendar-header .title').html(me.topTitle); + + me.bottomTitle = _.template([ + '' + ].join('')); + me.cmpEl.find('.calendar-header .bottom-row').html(me.bottomTitle); + + var arrYears = []; + var tmpYear = firstYear - 3; + + for (var i = 0; i < 16; i++) { + arrYears.push({ + year: (tmpYear > 0) ? tmpYear : '', + isCurrentDecade: ((tmpYear >= firstYear) && (tmpYear <= lastYear)) ? true : false, + disabled: (tmpYear > 0) ? false : true, + selected: (_.isDate(me.selectedDate)) ? + (tmpYear === me.selectedDate.getFullYear()) : + (tmpYear === new Date().getFullYear()) + }); + tmpYear++; + } + + if (!me.yearPicker) { + me.yearPicker = new Common.UI.DataView({ + el: me.cmpEl.find('.calendar-content'), + store: new Common.UI.DataViewStore(arrYears), + itemTemplate: _.template('
<%= year %>
') + }); + me.yearPicker.on('item:click', function (picker, item, record, e) { + var year = record.get('year'), + date = new Date(); + date.setFullYear(year); + me.renderMonths(date); + }); + me.enableKeyEvents && this.yearPicker.on('item:keydown', function(view, record, e) { + if (e.keyCode==Common.UI.Keys.ESC) { + Common.NotificationCenter.trigger('dataview:blur'); + } + }); + } else + me.yearPicker.store.reset(arrYears); + + me.enableKeyEvents && _.delay(function() { + me.monthPicker.cmpEl.find('.dataview').focus(); + }, 10); + }, + + renderMonths: function (date) { + var me = this, + curDate = (_.isDate(date)) ? date : (me.currentDate ? me.currentDate : new Date()), + year = curDate.getFullYear(); + + me._state = 1; + me.currentDate = curDate; + + // Number of year + me.topTitle = _.template([ + '
' + ].join('')); + me.cmpEl.find('.calendar-header .title').html(me.topTitle); + me.cmpEl.find('.calendar-header .title').off(); + me.cmpEl.find('.calendar-header .title').on('click', _.bind(me.renderYears, me)); + + me.bottomTitle = _.template([ + '' + ].join('')); + me.cmpEl.find('.calendar-header .bottom-row').html(me.bottomTitle); + + var arrMonths = []; + var today = new Date(); + + for (var ind = 0; ind < 12; ind++) { + arrMonths.push({ + indexMonth: ind, + nameMonth: me.monthShortNames[ind], + year: year, + curYear: true, + isCurrentMonth: (ind === curDate.getMonth()), + selected: (_.isDate(me.selectedDate)) ? + (ind === me.selectedDate.getMonth() && year === me.selectedDate.getFullYear()) : + (ind === today.getMonth() && year === today.getFullYear()) + }); + } + year = year + 1; + for (var ind = 0; ind < 4; ind++) { + arrMonths.push({ + indexMonth: ind, + nameMonth: me.monthShortNames[ind], + year: year, + curYear: false, + selected: (_.isDate(me.selectedDate)) ? + (ind === me.selectedDate.getMonth() && year === me.selectedDate.getFullYear()) : + (ind === today.getMonth() && year === today.getFullYear()) + }); + } + + if (!me.monthsPicker) { + me.monthsPicker = new Common.UI.DataView({ + el: me.cmpEl.find('.calendar-content'), + store: new Common.UI.DataViewStore(arrMonths), + itemTemplate: _.template('
<%= nameMonth %>
') + }); + me.monthsPicker.on('item:click', function (picker, item, record, e) { + var month = record.get('indexMonth'), + year = record.get('year'), + date = new Date(); + date.setFullYear(year, month); + me.renderMonth(date); + }); + me.enableKeyEvents && this.monthsPicker.on('item:keydown', function(view, record, e) { + if (e.keyCode==Common.UI.Keys.ESC) { + Common.NotificationCenter.trigger('dataview:blur'); + } + }); + } else + me.monthsPicker.store.reset(arrMonths); + + me.enableKeyEvents && _.delay(function() { + me.monthPicker.cmpEl.find('.dataview').focus(); + }, 10); + }, + + renderMonth: function (date) { + var me = this; + me._state = 0; + var firstDay = me.options.firstday; + + // Current date + var curDate = date || new Date(), + curMonth = curDate.getMonth(), + curIndexDayInWeek = curDate.getDay(), + curNumberDayInMonth = curDate.getDate(), + curYear = curDate.getFullYear(); + + me.currentDate = curDate; + + // Name month + me.topTitle = _.template([ + '
', + '', + '
' + ].join('')); + me.cmpEl.find('.calendar-header .title').html(me.topTitle); + me.cmpEl.find('.calendar-header .title').off(); + me.cmpEl.find('.calendar-header .title').on('click', _.bind(me.renderMonths, me)); + + // Name days of week + var dayNamesTemplate = ''; + for (var i = firstDay; i < 7; i++) { + dayNamesTemplate += ''; + } + if (firstDay > 0) { + dayNamesTemplate += ''; + } + me.cmpEl.find('.calendar-header .bottom-row').html(_.template(dayNamesTemplate)); + + // Month + var rows = 6, + cols = 7; + + var arrDays = []; + + var d = new Date(curDate); + d.setDate(1); + var firstDayOfMonthIndex = d.getDay(); + + var daysInPrevMonth = me.daysInMonth(d.getTime() - (10 * 24 * 60 * 60 * 1000)), + numberDay, + month, + year; + if (firstDay === 0) { + numberDay = (firstDayOfMonthIndex > 0) ? (daysInPrevMonth - (firstDayOfMonthIndex - 1)) : 1; + } else { + if (firstDayOfMonthIndex === 0) { + numberDay = daysInPrevMonth - 5; + } else { + numberDay = daysInPrevMonth - (firstDayOfMonthIndex - 2); + } + } + if ((firstDayOfMonthIndex > 0 && firstDay === 0) || firstDay === 1) { + if (curMonth - 1 >= 0) { + month = curMonth - 1; + year = curYear; + } else { + month = 11; + year = curYear - 1; + } + } else { + month = curMonth; + year = curYear; + } + + var tmp = new Date(); + tmp.setFullYear(year, month, numberDay); + var today = new Date(); + + for(var r = 0; r < rows; r++) { + for(var c = 0; c < cols; c++) { + var tmpDay = tmp.getDay(), + tmpNumber = tmp.getDate(), + tmpMonth = tmp.getMonth(), + tmpYear = tmp.getFullYear(); + arrDays.push({ + indexInWeek: tmpDay, + dayNumber: tmpNumber, + month: tmpMonth, + year: tmpYear, + isCurrentMonth: tmpMonth === curMonth, + selected: (_.isDate(me.selectedDate)) ? + (tmpNumber === me.selectedDate.getDate() && tmpMonth === me.selectedDate.getMonth() && tmpYear === me.selectedDate.getFullYear()) : + (tmpNumber === today.getDate() && tmpMonth === today.getMonth() && tmpYear === today.getFullYear()) + }); + tmp.setDate(tmpNumber + 1); + } + } + + if (!me.monthPicker) { + me.monthPicker = new Common.UI.DataView({ + el: me.cmpEl.find('.calendar-content'), + store: new Common.UI.DataViewStore(arrDays), + itemTemplate: _.template('
<%= dayNumber %>
') + }); + me.monthPicker.on('item:click', function(picker, item, record, e) { + var day = record.get('dayNumber'), + month = record.get('month'), + year = record.get('year'); + if (_.isUndefined(me.selectedDate)) { + me.selectedDate = new Date(); + } + me.selectedDate.setFullYear(year, month, day); + me.trigger('date:click', me, me.selectedDate); + }); + me.enableKeyEvents && this.monthPicker.on('item:keydown', function(view, record, e) { + if (e.keyCode==Common.UI.Keys.ESC) { + Common.NotificationCenter.trigger('dataview:blur'); + } + }); + } else + me.monthPicker.store.reset(arrDays); + + me.enableKeyEvents && _.delay(function() { + me.monthPicker.cmpEl.find('.dataview').focus(); + }, 10); + }, + + daysInMonth: function (date) { + var d; + d = date ? new Date(date) : new Date(); + var result = new Date(); + result.setFullYear(d.getFullYear(), d.getMonth() + 1, 0); + return result.getDate(); + }, + + setDate: function (date) { + if (_.isDate(date)) { + this.selectedDate = new Date(date); + this.renderMonth(this.selectedDate); + } + }, + + textJanuary: 'January', + textFebruary: 'February', + textMarch: 'March', + textApril: 'April', + textMay: 'May', + textJune: 'June', + textJuly: 'July', + textAugust: 'August', + textSeptember: 'September', + textOctober: 'October', + textNovember: 'November', + textDecember: 'December', + textShortJanuary: 'Jan', + textShortFebruary: 'Feb', + textShortMarch: 'Mar', + textShortApril: 'Apr', + textShortMay: 'May', + textShortJune: 'Jun', + textShortJuly: 'Jul', + textShortAugust: 'Aug', + textShortSeptember: 'Sep', + textShortOctober: 'Oct', + textShortNovember: 'Nov', + textShortDecember: 'Dec', + textShortSunday: 'Su', + textShortMonday: 'Mo', + textShortTuesday: 'Tu', + textShortWednesday: 'We', + textShortThursday: 'Th', + textShortFriday: 'Fr', + textShortSaturday: 'Sa', + textMonths: 'Months', + textYears: 'Years' + }, Common.UI.Calendar || {})); +}); \ No newline at end of file diff --git a/apps/common/main/lib/component/CheckBox.js b/apps/common/main/lib/component/CheckBox.js index 0d3d35c75..019c1013f 100644 --- a/apps/common/main/lib/component/CheckBox.js +++ b/apps/common/main/lib/component/CheckBox.js @@ -94,7 +94,7 @@ define([ checked : false, value : 'unchecked', - template : _.template(''), + template : _.template(''), initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); diff --git a/apps/common/main/lib/component/ComboBorderSize.js b/apps/common/main/lib/component/ComboBorderSize.js index a22123a92..8f01b7071 100644 --- a/apps/common/main/lib/component/ComboBorderSize.js +++ b/apps/common/main/lib/component/ComboBorderSize.js @@ -268,4 +268,108 @@ define([ formcontrol.css('background-position', '0 -' + record.get('offsety') + 'px'); } }, Common.UI.ComboBorderType || {})); + + Common.UI.ComboBoxColor = Common.UI.ComboBox.extend(_.extend({ + template: _.template([ + '
', + '
', + '
', + '
', + '', + '', + '
' + ].join('')), + + itemClicked: function (e) { + var el = $(e.currentTarget).parent(); + + this._selectedItem = this.store.findWhere({ + id: el.attr('id') + }); + if (this._selectedItem) { + $('.selected', $(this.el)).removeClass('selected'); + el.addClass('selected'); + this.updateFormControl(this._selectedItem); + + this.trigger('selected', this, _.extend({}, this._selectedItem.toJSON()), e); + e.preventDefault(); + } + }, + + updateFormControl: function(record) { + var formcontrol = $(this.el).find('.form-control > div'); + + if (record.get('value')!=-1) { + formcontrol[0].innerHTML = ''; + formcontrol.css({'background': '#' + record.get('value'), 'margin-top': '0'}); + } else { + formcontrol[0].innerHTML = record.get('displayValue'); + formcontrol.css({'background': '', 'margin-top': '1px'}); + } + }, + + setValue: function(value) { + var obj; + this._selectedItem = this.store.findWhere((obj={}, obj[this.valueField]=value, obj)); + + $('.selected', $(this.el)).removeClass('selected'); + + if (this._selectedItem) { + this.updateFormControl(this._selectedItem); + $('#' + this._selectedItem.get('id'), $(this.el)).addClass('selected'); + } else { + var formcontrol = $(this.el).find('.form-control > div'); + formcontrol[0].innerHTML = ''; + formcontrol.css('background', ''); + } + }, + + onResetItems: function() { + if (this.itemsTemplate) { + $(this.el).find('ul').html( $(this.itemsTemplate({ + items: this.store.toJSON(), + scope: this + }))); + } else { + $(this.el).find('ul').html(_.template([ + '<% _.each(items, function(item) { %>', + '<% if (item.value==-1) { %>', + '
  • <%= scope.getDisplayValue(item) %>
  • ', + '<% } else { %>', + '
  • ', + '
    ', + '
  • ', + '<% } %>', + '<% }); %>' + ].join(''))({ + items: this.store.toJSON(), + scope: this + })); + } + + if (!_.isUndefined(this.scroller)) { + this.scroller.destroy(); + delete this.scroller; + } + this.scroller = new Common.UI.Scroller(_.extend({ + el: $('.dropdown-menu', this.cmpEl), + minScrollbarLength : 40, + includePadding : true, + wheelSpeed: 10, + alwaysVisibleY: this.scrollAlwaysVisible + }, this.options.scroller)); + } + + }, Common.UI.ComboBoxColor || {})); + }); \ No newline at end of file diff --git a/apps/common/main/lib/component/ComboBox.js b/apps/common/main/lib/component/ComboBox.js index 5b7a7f4cc..bd4229d95 100644 --- a/apps/common/main/lib/component/ComboBox.js +++ b/apps/common/main/lib/component/ComboBox.js @@ -217,6 +217,11 @@ define([ }); } + var $list = el.find('.dropdown-menu'); + if ($list.hasClass('menu-absolute')) { + $list.css('min-width', el.outerWidth()); + } + el.on('show.bs.dropdown', _.bind(me.onBeforeShowMenu, me)); el.on('shown.bs.dropdown', _.bind(me.onAfterShowMenu, me)); el.on('hide.bs.dropdown', _.bind(me.onBeforeHideMenu, me)); @@ -292,6 +297,12 @@ define([ tip.hide(); } } + + var $list = this.cmpEl.find('ul'); + if ($list.hasClass('menu-absolute')) { + var offset = this.cmpEl.offset(); + $list.css({left: offset.left, top: offset.top + this.cmpEl.outerHeight() + 2}); + } }, onAfterShowMenu: function(e) { @@ -300,11 +311,13 @@ define([ if ($selected.length) { var itemTop = $selected.position().top, - itemHeight = $selected.height(), - listHeight = $list.height(); + itemHeight = $selected.outerHeight(), + listHeight = $list.outerHeight(); if (itemTop < 0 || itemTop + itemHeight > listHeight) { - $list.scrollTop($list.scrollTop() + itemTop + itemHeight - (listHeight/2)); + var height = $list.scrollTop() + itemTop + (itemHeight - listHeight)/2; + height = (Math.floor(height/itemHeight) * itemHeight); + $list.scrollTop(height); } setTimeout(function(){$selected.find('a').focus();}, 1); } @@ -346,6 +359,8 @@ define([ this.onAfterHideMenu(e); return false; } else if (this.search && e.keyCode > 64 && e.keyCode < 91 && e.key){ + if (typeof this._search !== 'object') return; + var me = this; clearTimeout(this._search.timer); this._search.timer = setTimeout(function () { me._search = {}; }, 1000); @@ -389,10 +404,12 @@ define([ this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); var $list = $(this.el).find('ul'); var itemTop = item.position().top, - itemHeight = item.height(), - listHeight = $list.height(); + itemHeight = item.outerHeight(), + listHeight = $list.outerHeight(); if (itemTop < 0 || itemTop + itemHeight > listHeight) { - $list.scrollTop($list.scrollTop() + itemTop + itemHeight - (listHeight/2)); + var height = $list.scrollTop() + itemTop; + height = (Math.floor(height/itemHeight) * itemHeight); + $list.scrollTop(height); } } item.focus(); diff --git a/apps/common/main/lib/component/ComboBoxFonts.js b/apps/common/main/lib/component/ComboBoxFonts.js index 6acff6762..8ef57414a 100644 --- a/apps/common/main/lib/component/ComboBoxFonts.js +++ b/apps/common/main/lib/component/ComboBoxFonts.js @@ -430,7 +430,7 @@ define([ }, addItemToRecent: function(record, silent) { - if (this.recent<1) return; + if (!record || this.recent<1) return; var font = this.store.findWhere({name: record.get('name'),type:FONT_TYPE_RECENT}); font && this.store.remove(font); diff --git a/apps/common/main/lib/component/DimensionPicker.js b/apps/common/main/lib/component/DimensionPicker.js index dab30a9d2..c508a90e9 100644 --- a/apps/common/main/lib/component/DimensionPicker.js +++ b/apps/common/main/lib/component/DimensionPicker.js @@ -47,31 +47,6 @@ define([ 'use strict'; Common.UI.DimensionPicker = Common.UI.BaseView.extend((function(){ - var me, - rootEl, - areaMouseCatcher, - areaUnHighLighted, - areaHighLighted, - areaStatus, - curColumns = 0, - curRows = 0; - - var onMouseMove = function(event){ - me.setTableSize( - Math.ceil((event.offsetX === undefined ? event.originalEvent.layerX : event.offsetX*Common.Utils.zoom()) / me.itemSize), - Math.ceil((event.offsetY === undefined ? event.originalEvent.layerY : event.offsetY*Common.Utils.zoom()) / me.itemSize), - event - ); - }; - - var onMouseLeave = function(event){ - me.setTableSize(0, 0, event); - }; - - var onHighLightedMouseClick = function(e){ - me.trigger('select', me, curColumns, curRows, e); - }; - return { options: { itemSize : 18, @@ -95,9 +70,13 @@ define([ initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); - me = this; + var me = this; - rootEl = me.$el || $(this.el); + this.render(); + + this.cmpEl = me.$el || $(this.el); + + var rootEl = this.cmpEl; me.itemSize = me.options.itemSize; me.minRows = me.options.minRows; @@ -105,31 +84,48 @@ define([ me.maxRows = me.options.maxRows; me.maxColumns = me.options.maxColumns; - this.render(); + me.curColumns = 0; + me.curRows = 0; + + var onMouseMove = function(event){ + me.setTableSize( + Math.ceil((event.offsetX === undefined ? event.originalEvent.layerX : event.offsetX*Common.Utils.zoom()) / me.itemSize), + Math.ceil((event.offsetY === undefined ? event.originalEvent.layerY : event.offsetY*Common.Utils.zoom()) / me.itemSize), + event + ); + }; + + var onMouseLeave = function(event){ + me.setTableSize(0, 0, event); + }; + + var onHighLightedMouseClick = function(e){ + me.trigger('select', me, me.curColumns, me.curRows, e); + }; if (rootEl){ - areaMouseCatcher = rootEl.find('.dimension-picker-mousecatcher'); - areaUnHighLighted = rootEl.find('.dimension-picker-unhighlighted'); - areaHighLighted = rootEl.find('.dimension-picker-highlighted'); - areaStatus = rootEl.find('.dimension-picker-status'); + var areaMouseCatcher = rootEl.find('.dimension-picker-mousecatcher'); + me.areaUnHighLighted = rootEl.find('.dimension-picker-unhighlighted'); + me.areaHighLighted = rootEl.find('.dimension-picker-highlighted'); + me.areaStatus = rootEl.find('.dimension-picker-status'); rootEl.css({width: me.minColumns + 'em'}); areaMouseCatcher.css('z-index', 1); areaMouseCatcher.width(me.maxColumns + 'em').height(me.maxRows + 'em'); - areaUnHighLighted.width(me.minColumns + 'em').height(me.minRows + 'em'); - areaStatus.html(curColumns + ' x ' + curRows); - areaStatus.width(areaUnHighLighted.width()); - } + me.areaUnHighLighted.width(me.minColumns + 'em').height(me.minRows + 'em'); + me.areaStatus.html(me.curColumns + ' x ' + me.curRows); + me.areaStatus.width(me.areaUnHighLighted.width()); - areaMouseCatcher.on('mousemove', onMouseMove); - areaHighLighted.on('mousemove', onMouseMove); - areaUnHighLighted.on('mousemove', onMouseMove); - areaMouseCatcher.on('mouseleave', onMouseLeave); - areaHighLighted.on('mouseleave', onMouseLeave); - areaUnHighLighted.on('mouseleave', onMouseLeave); - areaMouseCatcher.on('click', onHighLightedMouseClick); - areaHighLighted.on('click', onHighLightedMouseClick); - areaUnHighLighted.on('click', onHighLightedMouseClick); + areaMouseCatcher.on('mousemove', onMouseMove); + me.areaHighLighted.on('mousemove', onMouseMove); + me.areaUnHighLighted.on('mousemove', onMouseMove); + areaMouseCatcher.on('mouseleave', onMouseLeave); + me.areaHighLighted.on('mouseleave', onMouseLeave); + me.areaUnHighLighted.on('mouseleave', onMouseLeave); + areaMouseCatcher.on('click', onHighLightedMouseClick); + me.areaHighLighted.on('click', onHighLightedMouseClick); + me.areaUnHighLighted.on('click', onHighLightedMouseClick); + } }, render: function() { @@ -142,38 +138,38 @@ define([ if (columns > this.maxColumns) columns = this.maxColumns; if (rows > this.maxRows) rows = this.maxRows; - if (curColumns != columns || curRows != rows){ - curColumns = columns; - curRows = rows; + if (this.curColumns != columns || this.curRows != rows){ + this.curColumns = columns; + this.curRows = rows; - areaHighLighted.width(curColumns + 'em').height(curRows + 'em'); - areaUnHighLighted.width( - ((curColumns < me.minColumns) - ? me.minColumns - : ((curColumns + 1 > me.maxColumns) - ? me.maxColumns - : curColumns + 1)) + 'em' - ).height(((curRows < me.minRows) - ? me.minRows - : ((curRows + 1 > me.maxRows) - ? me.maxRows - : curRows + 1)) + 'em' + this.areaHighLighted.width(this.curColumns + 'em').height(this.curRows + 'em'); + this.areaUnHighLighted.width( + ((this.curColumns < this.minColumns) + ? this.minColumns + : ((this.curColumns + 1 > this.maxColumns) + ? this.maxColumns + : this.curColumns + 1)) + 'em' + ).height(((this.curRows < this.minRows) + ? this.minRows + : ((this.curRows + 1 > this.maxRows) + ? this.maxRows + : this.curRows + 1)) + 'em' ); - rootEl.width(areaUnHighLighted.width()); - areaStatus.html(curColumns + ' x ' + curRows); - areaStatus.width(areaUnHighLighted.width()); + this.cmpEl.width(this.areaUnHighLighted.width()); + this.areaStatus.html(this.curColumns + ' x ' + this.curRows); + this.areaStatus.width(this.areaUnHighLighted.width()); - me.trigger('change', me, curColumns, curRows, event); + this.trigger('change', this, this.curColumns, this.curRows, event); } }, getColumnsCount: function() { - return curColumns; + return this.curColumns; }, getRowsCount: function() { - return curRows; + return this.curRows; } } })()) diff --git a/apps/common/main/lib/component/ListView.js b/apps/common/main/lib/component/ListView.js index e1a565af6..080d6e15f 100644 --- a/apps/common/main/lib/component/ListView.js +++ b/apps/common/main/lib/component/ListView.js @@ -67,11 +67,15 @@ define([ this.trigger('items:reset', this); }, - onAddItem: function(record, store, opts) { - var view = new Common.UI.DataViewItem({ + createNewItem: function(record) { + return new Common.UI.DataViewItem({ template: this.itemTemplate, model: record }); + }, + + onAddItem: function(record, store, opts) { + var view = this.createNewItem(record); if (!this.innerEl) this.innerEl = $(this.el).find('.inner'); diff --git a/apps/common/main/lib/component/Menu.js b/apps/common/main/lib/component/Menu.js index a0664d062..6d0d0bd92 100644 --- a/apps/common/main/lib/component/Menu.js +++ b/apps/common/main/lib/component/Menu.js @@ -380,15 +380,23 @@ define([ onAfterShowMenu: function(e) { this.trigger('show:after', this, e); if (this.scroller) { - this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); - var menuRoot = this.menuRoot, - $selected = menuRoot.find('> li .checked'); + var menuRoot = this.menuRoot; + if (this.wheelSpeed===undefined) { + var item = menuRoot.find('> li:first'), + itemHeight = (item.length) ? item.outerHeight() : 1; + this.wheelSpeed = Math.min((Math.floor(menuRoot.height()/itemHeight) * itemHeight)/10, 20); + } + this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible, wheelSpeed: this.wheelSpeed}); + + var $selected = menuRoot.find('> li .checked'); if ($selected.length) { var itemTop = $selected.position().top, - itemHeight = $selected.height(), - listHeight = menuRoot.height(); + itemHeight = $selected.outerHeight(), + listHeight = menuRoot.outerHeight(); if (itemTop < 0 || itemTop + itemHeight > listHeight) { - menuRoot.scrollTop(menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2)); + var height = menuRoot.scrollTop() + itemTop + (itemHeight - listHeight)/2; + height = (Math.floor(height/itemHeight) * itemHeight); + menuRoot.scrollTop(height); } setTimeout(function(){$selected.focus();}, 1); } @@ -469,12 +477,14 @@ define([ this._search.index = idxCandidate; var item = itemCandidate.cmpEl.find('a'); if (this.scroller) { - this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); + this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible, wheelSpeed: this.wheelSpeed}); var itemTop = item.position().top, - itemHeight = item.height(), - listHeight = this.menuRoot.height(); + itemHeight = item.outerHeight(), + listHeight = this.menuRoot.outerHeight(); if (itemTop < 0 || itemTop + itemHeight > listHeight) { - this.menuRoot.scrollTop(this.menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2)); + var height = this.menuRoot.scrollTop() + itemTop; + height = (Math.floor(height/itemHeight) * itemHeight); + this.menuRoot.scrollTop(height); } } item.focus(); @@ -541,6 +551,8 @@ define([ } else { left = docW - menuW; } + if (left < 0) + left = 0; if (this.options.restoreHeight) { if (typeof (this.options.restoreHeight) == "number") { @@ -552,8 +564,10 @@ define([ suppressScrollX: true, alwaysVisibleY: this.scrollAlwaysVisible })); + this.wheelSpeed = undefined; } else if ( top + menuH < docH && menuRoot.height() < this.options.restoreHeight) { menuRoot.css('max-height', (Math.min(docH - top, this.options.restoreHeight)) + 'px'); + this.wheelSpeed = undefined; } } } else { @@ -568,7 +582,6 @@ define([ if (top < 0) top = 0; } - if (this.options.additionalAlign) this.options.additionalAlign.call(this, menuRoot, left, top); else @@ -848,10 +861,12 @@ define([ $selected = menuRoot.find('> li .checked'); if ($selected.length) { var itemTop = $selected.position().top, - itemHeight = $selected.height(), - listHeight = menuRoot.height(); + itemHeight = $selected.outerHeight(), + listHeight = menuRoot.outerHeight(); if (itemTop < 0 || itemTop + itemHeight > listHeight) { - menuRoot.scrollTop(menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2)); + var height = menuRoot.scrollTop() + itemTop + (itemHeight - listHeight)/2; + height = (Math.floor(height/itemHeight) * itemHeight); + menuRoot.scrollTop(height); } setTimeout(function(){$selected.focus();}, 1); } @@ -936,10 +951,12 @@ define([ if (this.scroller) { this.scroller.update({alwaysVisibleY: this.scrollAlwaysVisible}); var itemTop = item.position().top, - itemHeight = item.height(), - listHeight = this.menuRoot.height(); + itemHeight = item.outerHeight(), + listHeight = this.menuRoot.outerHeight(); if (itemTop < 0 || itemTop + itemHeight > listHeight) { - this.menuRoot.scrollTop(this.menuRoot.scrollTop() + itemTop + itemHeight - (listHeight/2)); + var height = this.menuRoot.scrollTop() + itemTop; + height = (Math.floor(height/itemHeight) * itemHeight); + this.menuRoot.scrollTop(height); } } item.focus(); diff --git a/apps/common/main/lib/component/MenuItem.js b/apps/common/main/lib/component/MenuItem.js index c54501185..6d710cbec 100644 --- a/apps/common/main/lib/component/MenuItem.js +++ b/apps/common/main/lib/component/MenuItem.js @@ -183,6 +183,7 @@ define([ if (this.checkable && firstChild) { firstChild.toggleClass('checkable', this.checkable); + firstChild.toggleClass('no-checkmark', this.options.checkmark===false); firstChild.toggleClass('checked', this.checked); if (!_.isEmpty(this.iconCls)) { firstChild.css('background-image', 'none'); diff --git a/apps/common/main/lib/component/MetricSpinner.js b/apps/common/main/lib/component/MetricSpinner.js index 584db251d..673847da4 100644 --- a/apps/common/main/lib/component/MetricSpinner.js +++ b/apps/common/main/lib/component/MetricSpinner.js @@ -144,6 +144,9 @@ define([ el.on('input', '.form-control', _.bind(this.onInput, this)); if (!this.options.allowDecimal) el.on('keypress', '.form-control', _.bind(this.onKeyPress, this)); + el.on('focus', 'input.form-control', function() { + me.$input && me.$input.select(); + }); this.switches = { count: 1, @@ -347,6 +350,7 @@ define([ var value = this.getRawValue(); if (this.value != value) { this.onEnterValue(); + this.trigger('inputleave', this); return (this.value == value); } } else { @@ -355,6 +359,8 @@ define([ } else { this._fromKeyDown = true; } + if (e.keyCode==Common.UI.Keys.RETURN || e.keyCode==Common.UI.Keys.ESC) + this.trigger('inputleave', this); }, onKeyUp: function (e) { @@ -477,6 +483,8 @@ define([ _step: function (type, suspend) { (type) ? this._increase(suspend) : this._decrease(suspend); + if (this.options.hold && this.switches.fromKeyDown) + this.$input && this.$input.select(); }, _add: function (a, b, precision) { diff --git a/apps/common/main/lib/component/Mixtbar.js b/apps/common/main/lib/component/Mixtbar.js index 96169d94e..6e48e4261 100644 --- a/apps/common/main/lib/component/Mixtbar.js +++ b/apps/common/main/lib/component/Mixtbar.js @@ -74,7 +74,7 @@ define([ if ( this.isFolded ) { if ( $(e.target).parents('.toolbar, #file-menu-panel').length ){ } else { - this.collapse(); + optsFold.$bar && optsFold.$bar.hasClass('expanded') && this.collapse(); } } } diff --git a/apps/common/main/lib/component/MultiSliderGradient.js b/apps/common/main/lib/component/MultiSliderGradient.js index 8ad11eaff..71a5bf3a6 100644 --- a/apps/common/main/lib/component/MultiSliderGradient.js +++ b/apps/common/main/lib/component/MultiSliderGradient.js @@ -159,11 +159,21 @@ define([ me.changeSliderStyle(); }, + addNewThumb: function(index, color) { + var me = this; + me.thumbs[index].thumbcolor = me.thumbs[index].thumb.find('> div'); + (index>0) && this.setColorValue(color, index); + me.sortThumbs(); + me.changeSliderStyle(); + me.changeGradientStyle(); + }, + removeThumb: function(index) { if (index===undefined) index = this.thumbs.length-1; - if (index>0) { + if (this.thumbs.length > 2) { this.thumbs[index].thumb.remove(); this.thumbs.splice(index, 1); + this.sortThumbs(); this.changeSliderStyle(); } }, diff --git a/apps/common/main/lib/component/RadioBox.js b/apps/common/main/lib/component/RadioBox.js index 9e8e2d159..39fdcb585 100644 --- a/apps/common/main/lib/component/RadioBox.js +++ b/apps/common/main/lib/component/RadioBox.js @@ -71,7 +71,7 @@ define([ disabled : false, rendered : false, - template : _.template(''), + template : _.template(''), initialize : function(options) { Common.UI.BaseView.prototype.initialize.call(this, options); @@ -111,6 +111,7 @@ define([ return; if (disabled !== this.disabled) { + this.$label.toggleClass('disabled', disabled); this.$radio.toggleClass('disabled', disabled); (disabled) ? this.$radio.attr({disabled: disabled}) : this.$radio.removeAttr('disabled'); } diff --git a/apps/common/main/lib/component/Slider.js b/apps/common/main/lib/component/Slider.js index 0ee059b7e..212b38bbb 100644 --- a/apps/common/main/lib/component/Slider.js +++ b/apps/common/main/lib/component/Slider.js @@ -347,17 +347,29 @@ define([ pos = Math.max(0, Math.min(100, position)), value = pos/me.delta + me.minValue; - me.setThumbPosition(index, pos); - me.thumbs[index].value = value; + if (me.isRemoveThumb) { + if (me.thumbs.length < 3) { + $(document).off('mouseup', me.binding.onMouseUp); + $(document).off('mousemove', me.binding.onMouseMove); + return; + } + me.trigger('removethumb', me, _.findIndex(me.thumbs, {index: index})); + me.trigger('change', me, value, lastValue); + me.trigger('changecomplete', me, value, lastValue); + } else { + me.setThumbPosition(index, pos); + me.thumbs[index].value = value; - if (need_sort) - me.sortThumbs(); + if (need_sort) + me.sortThumbs(); + } $(document).off('mouseup', me.binding.onMouseUp); $(document).off('mousemove', me.binding.onMouseMove); me._dragstart = undefined; - me.trigger('changecomplete', me, value, lastValue); + !me.isRemoveThumb && me.trigger('changecomplete', me, value, lastValue); + me.isRemoveThumb = undefined; }; var onMouseMove = function (e) { @@ -382,6 +394,10 @@ define([ if (need_sort) me.sortThumbs(); + var positionY = e.pageY*Common.Utils.zoom() - me.cmpEl.offset().top; + me.isRemoveThumb = positionY > me.cmpEl.height() || positionY < 0; + me.setRemoveThumb(index, me.isRemoveThumb); + if (Math.abs(value-lastValue)>0.001) me.trigger('change', me, value, lastValue); }; @@ -403,7 +419,25 @@ define([ $(document).on('mousemove', null, e.data, me.binding.onMouseMove); }; - var onTrackMouseDown = function (e) { + var onTrackMouseUp = function (e) { + if ( me.disabled || !_.isUndefined(me._dragstart) || me.thumbs.length > 9) return; + + var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))), + nearIndex = findThumb(pos), + thumbColor = me.thumbs[nearIndex].colorValue, + thumbValue = me.thumbs[nearIndex].value, + value = pos/me.delta + me.minValue; + me.addThumb(); + var index = me.thumbs.length - 1; + me.setThumbPosition(index, pos); + me.thumbs[index].value = value; + me.trigger('addthumb', me, index, nearIndex, thumbColor); + + me.trigger('change', me); + me.trigger('changecomplete', me); + }; + + /*var onTrackMouseDown = function (e) { if ( me.disabled ) return; var pos = Math.max(0, Math.min(100, (Math.round((e.pageX*Common.Utils.zoom() - me.cmpEl.offset().left) / me.width * 100)))), @@ -416,7 +450,7 @@ define([ me.trigger('change', me, value, lastValue); me.trigger('changecomplete', me, value, lastValue); - }; + };*/ var findThumb = function(pos) { var nearest = 100, @@ -462,7 +496,8 @@ define([ me.setActiveThumb(0, true); if (!me.rendered) { - el.on('mousedown', '.track', onTrackMouseDown); + /*el.on('mousedown', '.track', onTrackMouseDown);*/ + el.on('mouseup', '.track', onTrackMouseUp); } me.rendered = true; @@ -472,11 +507,23 @@ define([ setActiveThumb: function(index, suspend) { this.currentThumb = index; + this.$thumbs = this.cmpEl.find('.thumb'); this.$thumbs.removeClass('active'); this.thumbs[index].thumb.addClass('active'); if (suspend!==true) this.trigger('thumbclick', this, index); }, + setRemoveThumb: function(index, remove) { + var ind = _.findIndex(this.thumbs, {index: index}); + if (ind !== -1) { + if (remove && this.thumbs.length > 2) { + this.$el.find('.active').addClass('remove'); + } else { + this.$el.find('.remove').removeClass('remove'); + } + } + }, + setThumbPosition: function(index, x) { this.thumbs[index].position = x; this.thumbs[index].thumb.css({left: x + '%'}); diff --git a/apps/common/main/lib/component/Tab.js b/apps/common/main/lib/component/Tab.js index 29e93b32c..108672047 100644 --- a/apps/common/main/lib/component/Tab.js +++ b/apps/common/main/lib/component/Tab.js @@ -51,8 +51,8 @@ define([ this.active = false; this.label = 'Tab'; this.cls = ''; - this.template = _.template(['
  • ', - '<%- label %>', + this.template = _.template(['
  • ', + '<%- label %>', '
  • '].join('')); this.initialize.call(this, opts); @@ -82,6 +82,10 @@ define([ this.$el.addClass('active'); }, + isSelected: function() { + return this.$el.hasClass('selected'); + }, + deactivate: function(){ this.$el.removeClass('active'); }, @@ -110,6 +114,11 @@ define([ this.$el.removeClass(cls); }, + toggleClass: function(cls) { + if (cls.length) + this.$el.toggleClass(cls); + }, + hasClass: function(cls) { return this.$el.hasClass(cls); }, diff --git a/apps/common/main/lib/component/TabBar.js b/apps/common/main/lib/component/TabBar.js index 0c6868add..44e58de0b 100644 --- a/apps/common/main/lib/component/TabBar.js +++ b/apps/common/main/lib/component/TabBar.js @@ -69,12 +69,28 @@ define([ }; StateManager.prototype.attach = function (tab) { - tab.changeState = $.proxy(function () { - this.trigger('tab:change', tab); - this.bar.$el.find('ul > li.active').removeClass('active'); - tab.activate(); + tab.changeState = $.proxy(function (select) { + if (select) { + tab.toggleClass('selected'); + var selectTab = _.find(this.bar.selectTabs, function (item) {return item.sheetindex === tab.sheetindex;}); + if (selectTab) { + this.bar.selectTabs = _.without(this.bar.selectTabs, selectTab); + } else { + this.bar.selectTabs.push(tab); + } + } else { + if (!tab.isSelected()) { + this.bar.$el.find('ul > li.selected').removeClass('selected'); + tab.addClass('selected'); + this.bar.selectTabs.length = 0; + this.bar.selectTabs.push(tab); + } + this.trigger('tab:change', tab); + this.bar.$el.find('ul > li.active').removeClass('active'); + tab.activate(); - this.bar.trigger('tab:changed', this.bar, this.bar.tabs.indexOf(tab), tab); + this.bar.trigger('tab:changed', this.bar, this.bar.tabs.indexOf(tab), tab); + } }, this); var dragHelper = new (function() { @@ -87,6 +103,8 @@ define([ var me = this, length = me.bar.tabs.length, barBounds = me.bar.$bar.get(0).getBoundingClientRect(); + me.leftBorder = barBounds.left; + me.rightBorder = barBounds.right; if (barBounds) { me.bounds = []; @@ -97,6 +115,8 @@ define([ this.bounds.push(me.bar.tabs[i].$el.get(0).getBoundingClientRect()); } + me.lastTabRight = me.bounds[length - 1].right; + me.tabBarLeft = me.bounds[0].left; me.tabBarRight = me.bounds[length - 1].right; me.tabBarRight = Math.min(me.tabBarRight, barBounds.right - 1); @@ -278,17 +298,105 @@ define([ document.removeEventListener('dragstart',dragDropText); }); } + }, + + setHookTabs: function (e, bar, tabs) { + var me = this; + function dragComplete() { + if (!_.isUndefined(me.drag)) { + bar.dragging = false; + bar.$el.find('li.mousemove').removeClass('mousemove right'); + var arrSelectIndex = []; + tabs.forEach(function (item) { + arrSelectIndex.push(item.sheetindex); + }); + if (!_.isUndefined(me.drag.place)) { + me.bar.trigger('tab:move', arrSelectIndex, me.drag.place); + me.bar.$bar.scrollLeft(me.scrollLeft); + me.bar.scrollX = undefined; + } else { + me.bar.trigger('tab:move', arrSelectIndex); + me.bar.$bar.scrollLeft(me.scrollLeft); + me.bar.scrollX = undefined; + } + + me.drag = undefined; + } + } + function dragMove (event) { + if (!_.isUndefined(me.drag)) { + me.drag.moveX = event.clientX*Common.Utils.zoom(); + if (me.drag.moveX < me.leftBorder) { + me.scrollLeft -= 20; + me.bar.$bar.scrollLeft(me.scrollLeft); + me.calculateBounds(); + } else if (me.drag.moveX < me.tabBarRight && me.drag.moveX > me.tabBarLeft) { + var name = $(event.target).parent().data('label'), + currentTab = _.findIndex(bar.tabs, {label: name}); + if (currentTab === -1) { + bar.$el.find('li.mousemove').removeClass('mousemove right'); + me.drag.place = undefined; + } else if (me.bounds[currentTab].left - me.scrollLeft >= me.tabBarLeft) { + me.drag.place = currentTab; + $(event.target).parent().parent().find('li.mousemove').removeClass('mousemove right'); + $(event.target).parent().addClass('mousemove'); + } + } else if (me.drag.moveX > me.lastTabRight && Math.abs(me.tabBarRight - me.bounds[me.bar.tabs.length - 1].right) < 1) { //move to end of list, right border of the right tab is visible + bar.$el.find('li.mousemove').removeClass('mousemove right'); + bar.tabs[bar.tabs.length - 1].$el.addClass('mousemove right'); + me.drag.place = bar.tabs.length; + } else if (me.drag.moveX - me.rightBorder > 3) { + me.scrollLeft += 20; + me.bar.$bar.scrollLeft(me.scrollLeft); + me.calculateBounds(); + } + } + } + if (!_.isUndefined(bar) && !_.isUndefined(tabs) && bar.tabs.length > 1) { + me.bar = bar; + me.drag = {tabs: tabs}; + bar.dragging = true; + this.calculateBounds(); + + $(document).on('mousemove.tabbar', dragMove); + $(document).on('mouseup.tabbar', function (e) { + dragComplete(e); + $(document).off('mouseup.tabbar'); + $(document).off('mousemove.tabbar', dragMove); + }); + } } } }); tab.$el.on({ - click: $.proxy(function () { - if (!tab.disabled && !tab.$el.hasClass('active')) { - if (tab.control == 'manual') { - this.bar.trigger('tab:manual', this.bar, this.bar.tabs.indexOf(tab), tab); - } else { - tab.changeState(); + click: $.proxy(function (event) { + if (!tab.disabled) { + if (event.ctrlKey || event.metaKey) { + if (!tab.isActive()) { + tab.changeState(true); + } + } else if (event.shiftKey) { + this.bar.$el.find('ul > li.selected').removeClass('selected'); + this.bar.selectTabs.length = 0; + var $active = this.bar.$el.find('ul > li.active'), + indexAct = $active.index(), + indexCur = this.bar.tabs.indexOf(tab); + var startIndex = (indexCur > indexAct) ? indexAct : indexCur, + endIndex = (indexCur > indexAct) ? indexCur : indexAct; + for (var i = startIndex; i <= endIndex; i++) { + this.bar.tabs[i].changeState(true); + } + } else if (!tab.$el.hasClass('active')) { + if (this.bar.tabs.length === this.bar.selectTabs.length) { + this.bar.$el.find('ul > li.selected').removeClass('selected'); + this.bar.selectTabs.length = 0; + } + if (tab.control == 'manual') { + this.bar.trigger('tab:manual', this.bar, this.bar.tabs.indexOf(tab), tab); + } else { + tab.changeState(); + } } } !tab.disabled && Common.NotificationCenter.trigger('edit:complete', this.bar); @@ -297,12 +405,16 @@ define([ this.trigger('tab:dblclick', this, this.tabs.indexOf(tab), tab); }, this.bar), contextmenu: $.proxy(function () { - this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab); + this.trigger('tab:contextmenu', this, this.tabs.indexOf(tab), tab, this.selectTabs); }, this.bar), mousedown: $.proxy(function (e) { if (this.bar.options.draggable && !_.isUndefined(dragHelper) && (3 !== e.which)) { if (!tab.isLockTheDrag) { - dragHelper.setHook(e, this.bar, tab); + if (this.bar.selectTabs.length > 1) { + dragHelper.setHookTabs(e, this.bar, this.bar.selectTabs); + } else { + dragHelper.setHook(e, this.bar, tab); + } } } }, this) @@ -322,6 +434,7 @@ define([ tabs: [], template: _.template('', '' ].join('')), @@ -133,9 +148,15 @@ define([ themeColors[row].push(effect); }); + // custom color + this.dynamicColors = Common.localStorage.getItem('asc.'+Common.localStorage.getId()+'.colors.custom'); + this.dynamicColors = this.dynamicColors ? this.dynamicColors.toLowerCase().split(',') : []; + + $(me.el).append(me.template({ themeColors: themeColors, - standartColors: standartColors + standartColors: standartColors, + dynamicColors: me.dynamicColors })); return me; @@ -157,29 +178,26 @@ define([ el = $(me.el), $target = $(e.currentTarget); - el.find('.color-palette a').removeClass('active'); - $target.addClass('active'); - var color = $target.data('color').toString(), effectId = $target.data('effectid'); - me.currentColor = color; - - if (effectId) { - me.currentColor = {color: color, effectId: effectId}; + if (color !== 'empty') { + el.find('.color-palette a').removeClass('active'); + $target.addClass('active'); + me.currentColor = color; + if (effectId) { + me.currentColor = {color: color, effectId: effectId}; + } + me.trigger('select', me, me.currentColor); + } else { + me.fireEvent('customcolor', me); } - - me.trigger('select', me, me.currentColor); }, select: function(color) { var me = this, el = $(me.el); - if (color == me.currentColor) { - return; - } - me.currentColor = color; me.clearSelection(); @@ -195,11 +213,10 @@ define([ color = /#?([a-fA-F0-9]{6})/.exec(color)[1]; } - if (/^[a-fA-F0-9]{6}|transparent$/.test(color) || _.indexOf(Common.Utils.ThemeColor.getStandartColors(), color) > -1) { - el.find('.standart-colors a[data-color=' + color + ']').addClass('active'); - } else { - el.find('.custom-colors a[data-color=' + color + ']').addClass('active'); + if (/^[a-fA-F0-9]{6}|transparent$/.test(color) || _.indexOf(Common.Utils.ThemeColor.getStandartColors(), color) > -1 || _.indexOf(this.dynamicColors, color) > -1) { + el.find('.color-palette a[data-color=' + color + ']').first().addClass('active'); } + } }, @@ -208,7 +225,43 @@ define([ $(this.el).find('.color-palette a').removeClass('active'); }, + saveDynamicColor: function(color) { + var key_name = 'asc.'+Common.localStorage.getId()+'.colors.custom'; + var colors = Common.localStorage.getItem(key_name); + colors = colors ? colors.split(',') : []; + if (colors.push(color) > this.options.dynamiccolors) colors.shift(); + this.dynamicColors = colors; + Common.localStorage.setItem(key_name, colors.join().toUpperCase()); + }, + + updateDynamicColors: function() { + var me = this; + var dynamicColors = Common.localStorage.getItem('asc.'+Common.localStorage.getId()+'.colors.custom'); + dynamicColors = dynamicColors ? dynamicColors.toLowerCase().split(',') : []; + var templateColors = ''; + _.each(dynamicColors, function(color) { + templateColors += ''; + }); + if (dynamicColors.length < this.options.dynamiccolors) { + for (var i = dynamicColors.length; i < this.options.dynamiccolors; i++) { + templateColors += ''; + } + } + $(this.el).find('.dynamic-colors .item-inner').html(_.template(templateColors)); + $(this.el).find('.color-palette .dynamic-colors a').on('click', _.bind(this.onColorClick, this)); + }, + + addNewDynamicColor: function(colorPicker, color) { + if (color) { + this.saveDynamicColor(color); + this.updateDynamicColors(); + this.trigger('select', this, color); + this.select(color); + } + }, + textThemeColors: 'Theme Colors', - textStandartColors: 'Standard Colors' + textStandartColors: 'Standard Colors', + textCustomColors: 'Custom Colors' }, Common.UI.ThemeColorPalette || {})); }); \ No newline at end of file diff --git a/apps/common/mobile/resources/less/ios/_color-palette.less b/apps/common/mobile/resources/less/ios/_color-palette.less index 2fa543df4..f243b1ef6 100644 --- a/apps/common/mobile/resources/less/ios/_color-palette.less +++ b/apps/common/mobile/resources/less/ios/_color-palette.less @@ -35,9 +35,132 @@ } } - .standart-colors { + .standart-colors, .dynamic-colors { .item-inner { overflow: visible; } } -} \ No newline at end of file +} + +.custom-colors { + display: flex; + justify-content: space-around; + align-items: center; + margin: 15px; + &.phone { + max-width: 300px; + margin: 0 auto; + margin-top: 4px; + .button-round { + margin-top: 20px; + } + } + .right-block { + margin-left: 20px; + } + .button-round { + height: 72px; + width: 72px; + padding: 0; + display: flex; + justify-content: center; + align-items: center; + border-radius: 100px; + background-color: #ffffff; + box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); + border-color: transparent; + margin-top: 25px; + &.active-state { + background-color: rgba(0, 0, 0, 0.1); + } + } + .color-hsb-preview { + width: 72px; + height: 72px; + border-radius: 100px; + overflow: hidden; + border: 1px solid #c4c4c4; + } + .new-color-hsb-preview { + width: 100%; + height: 36px; + } + .current-color-hsb-preview { + width: 100%; + height: 36px; + } + .list-block ul:before, .list-block ul:after { + content: none; + } + .list-block ul li { + border: 1px solid rgba(0, 0, 0, 0.3); + } + .color-picker-wheel { + position: relative; + width: 290px; + max-width: 100%; + height: auto; + font-size: 0; + + svg { + width: 100%; + height: auto; + } + + .color-picker-wheel-handle { + width: calc(100% / 6); + height: calc(100% / 6); + position: absolute; + box-sizing: border-box; + border: 2px solid #fff; + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5); + background: red; + border-radius: 50%; + left: 0; + top: 0; + } + + .color-picker-sb-spectrum { + background-color: #000; + background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, #000 100%), linear-gradient(to left, rgba(255, 255, 255, 0) 0%, #fff 100%); + position: relative; + width: 45%; + height: 45%; + left: 50%; + top: 50%; + transform: translate3d(-50%, -50%, 0); + position: absolute; + } + + .color-picker-sb-spectrum-handle { + width: 4px; + height: 4px; + position: absolute; + left: -2px; + top: -2px; + z-index: 1; + + &:after { + background-color: inherit; + content: ''; + position: absolute; + width: 16px; + height: 16px; + border: 1px solid #fff; + border-radius: 50%; + box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5); + box-sizing: border-box; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + transition: 150ms; + transition-property: transform; + transform-origin: center; + } + + &.color-picker-sb-spectrum-handle-pressed:after { + transform: scale(1.5) translate(-33.333%, -33.333%); + } + } + } +} diff --git a/apps/common/mobile/resources/less/material/_color-palette.less b/apps/common/mobile/resources/less/material/_color-palette.less index 49fa72501..511765221 100644 --- a/apps/common/mobile/resources/less/material/_color-palette.less +++ b/apps/common/mobile/resources/less/material/_color-palette.less @@ -35,7 +35,7 @@ } } - .standart-colors { + .standart-colors, .dynamic-colors { .item-inner { overflow: visible; } @@ -44,4 +44,128 @@ &.list-block:last-child li:last-child a { border-radius: 0; } + +} + +.custom-colors { + display: flex; + justify-content: space-around; + align-items: center; + margin: 15px; + &.phone { + max-width: 300px; + margin: 0 auto; + margin-top: 4px; + .button-round { + margin-top: 20px; + } + } + .right-block { + margin-left: 20px; + } + .button-round { + height: 72px; + width: 72px; + padding: 0; + display: flex; + justify-content: center; + align-items: center; + border-radius: 100px; + background-color: @themeColor; + box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25); + border-color: transparent; + margin-top: 25px; + &.active-state { + background-color: rgba(0, 0, 0, 0.1); + } + } + .color-hsb-preview { + width: 72px; + height: 72px; + border-radius: 100px; + overflow: hidden; + border: 1px solid #ededed; + } + .new-color-hsb-preview { + width: 100%; + height: 36px; + } + .current-color-hsb-preview { + width: 100%; + height: 36px; + } + .list-block ul:before, .list-block ul:after { + content: none; + } + .list-block ul li { + border: 1px solid rgba(0, 0, 0, 0.3); + } + .color-picker-wheel { + position: relative; + width: 290px; + max-width: 100%; + height: auto; + font-size: 0; + + svg { + width: 100%; + height: auto; + } + + .color-picker-wheel-handle { + width: calc(100% / 6); + height: calc(100% / 6); + position: absolute; + box-sizing: border-box; + border: 2px solid #fff; + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5); + background: red; + border-radius: 50%; + left: 0; + top: 0; + } + + .color-picker-sb-spectrum { + background-color: #000; + background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0) 0%, #000 100%), linear-gradient(to left, rgba(255, 255, 255, 0) 0%, #fff 100%); + position: relative; + width: 45%; + height: 45%; + left: 50%; + top: 50%; + transform: translate3d(-50%, -50%, 0); + position: absolute; + } + + .color-picker-sb-spectrum-handle { + width: 4px; + height: 4px; + position: absolute; + left: -2px; + top: -2px; + z-index: 1; + + &:after { + background-color: inherit; + content: ''; + position: absolute; + width: 16px; + height: 16px; + border: 1px solid #fff; + border-radius: 50%; + box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.5); + box-sizing: border-box; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + transition: 150ms; + transition-property: transform; + transform-origin: center; + } + + &.color-picker-sb-spectrum-handle-pressed:after { + transform: scale(1.5) translate(-33.333%, -33.333%); + } + } + } } \ No newline at end of file diff --git a/apps/documenteditor/embed/index.html b/apps/documenteditor/embed/index.html index 71e53a6d1..619b74394 100644 --- a/apps/documenteditor/embed/index.html +++ b/apps/documenteditor/embed/index.html @@ -115,7 +115,7 @@ - + - + diff --git a/apps/documenteditor/embed/index_loader.html b/apps/documenteditor/embed/index_loader.html index 4042fb812..82e2fa3bf 100644 --- a/apps/documenteditor/embed/index_loader.html +++ b/apps/documenteditor/embed/index_loader.html @@ -190,7 +190,7 @@ - + - + diff --git a/apps/documenteditor/embed/js/ApplicationController.js b/apps/documenteditor/embed/js/ApplicationController.js index f8baf5891..2978100b0 100644 --- a/apps/documenteditor/embed/js/ApplicationController.js +++ b/apps/documenteditor/embed/js/ApplicationController.js @@ -75,7 +75,7 @@ DE.ApplicationController = new(function(){ $('#editor_sdk').addClass('top'); } - if (config.canBackToFolder === false || !(config.customization && config.customization.goback && config.customization.goback.url)) { + if (config.canBackToFolder === false || !(config.customization && config.customization.goback && (config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose))) { $('#id-btn-close').hide(); // Hide last separator @@ -115,8 +115,6 @@ DE.ApplicationController = new(function(){ } embedConfig.docTitle = docConfig.title; - if ( !embedConfig.saveUrl && permissions.print === false) - $('#idt-copy').hide(); } } @@ -221,6 +219,9 @@ DE.ApplicationController = new(function(){ var zf = (config.customization && config.customization.zoom ? parseInt(config.customization.zoom) : -2); (zf == -1) ? api.zoomFitToPage() : ((zf == -2) ? api.zoomFitToWidth() : api.zoom(zf>0 ? zf : 100)); + if ( !embedConfig.saveUrl && permissions.print === false) + $('#idt-download').hide(); + if ( !embedConfig.shareUrl ) $('#idt-share').hide(); @@ -230,6 +231,9 @@ DE.ApplicationController = new(function(){ if ( !embedConfig.fullscreenUrl ) $('#idt-fullscreen').hide(); + if ( !embedConfig.saveUrl && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl) + $('#box-tools').addClass('hidden'); + common.controller.modals.attach({ share: '#idt-share', embed: '#idt-embed' @@ -266,8 +270,12 @@ DE.ApplicationController = new(function(){ }); $('#id-btn-close').on('click', function(){ - if (config.customization && config.customization.goback && config.customization.goback.url) - window.parent.location.href = config.customization.goback.url; + if (config.customization && config.customization.goback) { + if (config.customization.goback.requestClose && config.canRequestClose) + Common.Gateway.requestClose(); + else if (config.customization.goback.url) + window.parent.location.href = config.customization.goback.url; + } }); $('#id-btn-zoom-in').on('click', api.zoomIn.bind(this)); @@ -402,6 +410,10 @@ DE.ApplicationController = new(function(){ message = me.errorFileSizeExceed; break; + case Asc.c_oAscError.ID.UpdateVersion: + message = me.errorUpdateVersionOnDisconnect; + break; + default: message = me.errorDefaultMessage.replace('%1', id); break; @@ -517,7 +529,8 @@ DE.ApplicationController = new(function(){ window["flat_desine"] = true; api = new Asc.asc_docs_api({ - 'id-view' : 'editor_sdk' + 'id-view' : 'editor_sdk', + 'embedded' : true }); if (api){ @@ -558,6 +571,7 @@ DE.ApplicationController = new(function(){ waitText: 'Please, wait...', textLoadingDocument: 'Loading document', txtClose: 'Close', - errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.' + errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.', + errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.' } })(); \ No newline at end of file diff --git a/apps/documenteditor/embed/locale/en.json b/apps/documenteditor/embed/locale/en.json index 91cd7c4b4..a36be77b1 100644 --- a/apps/documenteditor/embed/locale/en.json +++ b/apps/documenteditor/embed/locale/en.json @@ -22,6 +22,7 @@ "DE.ApplicationController.unknownErrorText": "Unknown error.", "DE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.", "DE.ApplicationController.waitText": "Please, wait...", + "DE.ApplicationController.errorUpdateVersionOnDisconnect": "Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.", "DE.ApplicationView.txtDownload": "Download", "DE.ApplicationView.txtEmbed": "Embed", "DE.ApplicationView.txtFullScreen": "Full Screen", diff --git a/apps/documenteditor/embed/locale/fr.json b/apps/documenteditor/embed/locale/fr.json index 1145973e3..f06efef7c 100644 --- a/apps/documenteditor/embed/locale/fr.json +++ b/apps/documenteditor/embed/locale/fr.json @@ -12,6 +12,7 @@ "DE.ApplicationController.errorAccessDeny": "Vous tentez d'exéсuter une action pour laquelle vous ne disposez pas des droits.
    Veuillez contacter l'administrateur de Document Server.", "DE.ApplicationController.errorDefaultMessage": "Code d'erreur: %1", "DE.ApplicationController.errorFilePassProtect": "Le fichier est protégé par le mot de passe et ne peut pas être ouvert.", + "DE.ApplicationController.errorFileSizeExceed": "La taille du fichier dépasse les limites établies sur votre serveur.
    Veuillez contacter votre administrateur de Document Server pour obtenir plus d'information. ", "DE.ApplicationController.errorUserDrop": "Impossible d'accéder au fichier.", "DE.ApplicationController.notcriticalErrorTitle": "Avertissement", "DE.ApplicationController.scriptLoadError": "La connexion est trop lente, certains éléments ne peuvent pas être chargés. Veuillez recharger la page.", diff --git a/apps/documenteditor/embed/locale/it.json b/apps/documenteditor/embed/locale/it.json index 327a968e2..f35b88f9b 100644 --- a/apps/documenteditor/embed/locale/it.json +++ b/apps/documenteditor/embed/locale/it.json @@ -12,6 +12,7 @@ "DE.ApplicationController.errorAccessDeny": "Stai tentando di eseguire un'azione per la quale non disponi di permessi sufficienti.
    Si prega di contattare l'amministratore del Server dei Documenti.", "DE.ApplicationController.errorDefaultMessage": "Codice errore: %1", "DE.ApplicationController.errorFilePassProtect": "Il file è protetto da una password. Impossibile aprirlo.", + "DE.ApplicationController.errorFileSizeExceed": "La dimensione del file supera la limitazione impostata per il tuo server.
    Per i dettagli, contatta l'amministratore del Document server.", "DE.ApplicationController.errorUserDrop": "Impossibile accedere al file subito.", "DE.ApplicationController.notcriticalErrorTitle": "Avviso", "DE.ApplicationController.scriptLoadError": "La connessione è troppo lenta, alcuni componenti non possono essere caricati. Si prega di ricaricare la pagina.", diff --git a/apps/documenteditor/embed/locale/ru.json b/apps/documenteditor/embed/locale/ru.json index ea575e0d1..6fc73f817 100644 --- a/apps/documenteditor/embed/locale/ru.json +++ b/apps/documenteditor/embed/locale/ru.json @@ -12,6 +12,7 @@ "DE.ApplicationController.errorAccessDeny": "Вы пытаетесь выполнить действие, на которое у вас нет прав.
    Пожалуйста, обратитесь к администратору Сервера документов.", "DE.ApplicationController.errorDefaultMessage": "Код ошибки: %1", "DE.ApplicationController.errorFilePassProtect": "Файл защищен паролем и не может быть открыт.", + "DE.ApplicationController.errorFileSizeExceed": "Размер файла превышает ограничение, установленное для вашего сервера.
    Обратитесь к администратору Сервера документов для получения дополнительной информации.", "DE.ApplicationController.errorUserDrop": "В настоящий момент файл недоступен.", "DE.ApplicationController.notcriticalErrorTitle": "Внимание", "DE.ApplicationController.scriptLoadError": "Слишком медленное подключение, некоторые компоненты не удалось загрузить. Пожалуйста, обновите страницу.", diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index fd86037ef..dd630cf48 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -62,7 +62,6 @@ define([ 'hide': _.bind(this.onHideChat, this) }, 'Common.Views.Header': { - 'click:users': _.bind(this.clickStatusbarUsers, this), 'file:settings': _.bind(this.clickToolbarSettings,this), 'history:show': function () { if ( !this.leftMenu.panelHistory.isVisible() ) @@ -468,6 +467,7 @@ define([ if (this.mode.canViewComments && this.leftMenu.panelComments.isVisible()) value = resolved = true; (value) ? this.api.asc_showComments(resolved) : this.api.asc_hideComments(); + this.getApplication().getController('Common.Controllers.ReviewChanges').commentsShowHide(value ? 'show' : 'hide'); /** coauthoring end **/ value = Common.localStorage.getItem("de-settings-fontrender"); @@ -532,10 +532,6 @@ define([ }, /** coauthoring begin **/ - clickStatusbarUsers: function() { - this.leftMenu.menuFile.panels['rights'].changeAccessRights(); - }, - onHideChat: function() { $(this.leftMenu.btnChat.el).blur(); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); @@ -875,7 +871,7 @@ define([ requestEditRightsText : 'Requesting editing rights...', textReplaceSuccess : 'Search has been done. {0} occurrences have been replaced', textReplaceSkipped : 'The replacement has been made. {0} occurrences were skipped.', - textLoadHistory : 'Loading versions history...', + textLoadHistory : 'Loading version history...', notcriticalErrorTitle: 'Warning', leavePageText: 'All unsaved changes in this document will be lost.
    Click \'Cancel\' then \'Save\' to save them. Click \'OK\' to discard all the unsaved changes.', warnDownloadAs : 'If you continue saving in this format all features except the text will be lost.
    Are you sure you want to continue?', diff --git a/apps/documenteditor/main/app/controller/Links.js b/apps/documenteditor/main/app/controller/Links.js index f6d37fd4c..1903c5307 100644 --- a/apps/documenteditor/main/app/controller/Links.js +++ b/apps/documenteditor/main/app/controller/Links.js @@ -95,7 +95,6 @@ define([ Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onShowContentControlsActions',_.bind(this.onShowContentControlsActions, this)); this.api.asc_registerCallback('asc_onHideContentControlsActions',_.bind(this.onHideContentControlsActions, this)); - } return this; }, @@ -129,7 +128,8 @@ define([ in_header = false, in_equation = false, in_image = false, - in_table = false; + in_table = false, + frame_pr = null; while (++i < selectedObjects.length) { type = selectedObjects[i].get_ObjectType(); @@ -137,6 +137,7 @@ define([ if (type === Asc.c_oAscTypeSelectElement.Paragraph) { paragraph_locked = pr.get_Locked(); + frame_pr = pr; } else if (type === Asc.c_oAscTypeSelectElement.Header) { header_locked = pr.get_Locked(); in_header = true; @@ -153,12 +154,19 @@ define([ var control_props = this.api.asc_IsContentControl() ? this.api.asc_GetContentControlProperties() : null, control_plain = (control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false; + var rich_del_lock = (frame_pr) ? !frame_pr.can_DeleteBlockContentControl() : true, + rich_edit_lock = (frame_pr) ? !frame_pr.can_EditBlockContentControl() : true, + plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : true, + plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : true; - var need_disable = paragraph_locked || in_equation || in_image || in_header || control_plain; + var need_disable = paragraph_locked || in_equation || in_image || in_header || control_plain || rich_edit_lock || plain_edit_lock; this.view.btnsNotes.setDisabled(need_disable); need_disable = paragraph_locked || header_locked || in_header || control_plain; this.view.btnBookmarks.setDisabled(need_disable); + + need_disable = in_header || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock; + this.view.btnsContents.setDisabled(need_disable); }, onApiCanAddHyperlink: function(value) { @@ -351,8 +359,9 @@ define([ })).show(); }, - onShowContentControlsActions: function(action, x, y) { - var menu = (action==1) ? this.view.contentsUpdateMenu : this.view.contentsMenu, + onShowTOCActions: function(obj, x, y) { + var action = obj.button, + menu = (action==AscCommon.CCButtonType.Toc) ? this.view.contentsUpdateMenu : this.view.contentsMenu, documentHolderView = this.getApplication().getController('DocumentHolder').documentHolder, menuContainer = documentHolderView.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)), me = this; @@ -391,6 +400,10 @@ define([ onHideContentControlsActions: function() { this.view.contentsMenu && this.view.contentsMenu.hide(); this.view.contentsUpdateMenu && this.view.contentsUpdateMenu.hide(); + }, + + onShowContentControlsActions: function(obj, x, y) { + (obj.type == Asc.c_oAscContentControlSpecificType.TOC) && this.onShowTOCActions(obj, x, y); } }, DE.Controllers.Links || {})); diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 6c9c5b4b7..994b9034e 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -341,9 +341,10 @@ define([ this.appOptions.mergeFolderUrl = this.editorConfig.mergeFolderUrl; this.appOptions.saveAsUrl = this.editorConfig.saveAsUrl; this.appOptions.canAnalytics = false; + this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.customization = this.editorConfig.customization; - this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') - && (typeof (this.editorConfig.customization.goback) == 'object') && !_.isEmpty(this.editorConfig.customization.goback.url); + this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') && (typeof (this.editorConfig.customization.goback) == 'object') + && (!_.isEmpty(this.editorConfig.customization.goback.url) || this.editorConfig.customization.goback.requestClose && this.appOptions.canRequestClose); this.appOptions.canBack = this.appOptions.canBackToFolder === true; this.appOptions.canPlugins = false; this.appOptions.canMakeActionLink = this.editorConfig.canMakeActionLink; @@ -351,7 +352,11 @@ define([ this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify; this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs; this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage; + this.appOptions.canRequestCompareFile = this.editorConfig.canRequestCompareFile; this.appOptions.canRequestMailMergeRecipients = this.editorConfig.canRequestMailMergeRecipients; + this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings; + this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures; + this.appOptions.canFeatureComparison = !!this.api.asc_isSupportFeature("comparison"); appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header'); appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '') @@ -365,7 +370,8 @@ define([ if (!( this.editorConfig.customization && ( this.editorConfig.customization.toolbarNoTabs || (this.editorConfig.targetApp!=='desktop') && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)))) { - $('#editor_sdk').append('
    ' + '
    '.repeat(20) + '
    '); + $('#editor-container').css('overflow', 'hidden'); + $('#editor-container').append('
    ' + '
    '.repeat(20) + '
    '); } Common.Controllers.Desktop.init(this.appOptions); @@ -490,6 +496,8 @@ define([ }, onRefreshHistory: function(opts) { + if (!this.appOptions.canUseHistory) return; + this.loadMask && this.loadMask.hide(); if (opts.data.error || !opts.data.history) { var historyStore = this.getApplication().getCollection('Common.Collections.HistoryVersions'); @@ -596,7 +604,7 @@ define([ docId: version.key, docIdPrev: docIdPrev, selected: false, - canRestore: this.appOptions.canHistoryRestore, + canRestore: this.appOptions.canHistoryRestore && this.appOptions.canDownload, isRevision: false, isVisible: true, serverVersion: version.serverVersion @@ -646,11 +654,16 @@ define([ goBack: function(current) { if ( !Common.Controllers.Desktop.process('goback') ) { - var href = this.appOptions.customization.goback.url; - if (!current && this.appOptions.customization.goback.blank!==false) { - window.open(href, "_blank"); + if (this.appOptions.customization.goback.requestClose && this.appOptions.canRequestClose) { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); } else { - parent.location.href = href; + var href = this.appOptions.customization.goback.url; + if (!current && this.appOptions.customization.goback.blank!==false) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } } }, @@ -679,7 +692,7 @@ define([ if (this.api && this.appOptions.isEdit && !toolbarView._state.previewmode) { var cansave = this.api.asc_isDocumentCanSave(), forcesave = this.appOptions.forcesave, - isSyncButton = (toolbarView.btnCollabChanges.rendered) ? toolbarView.btnCollabChanges.$icon.hasClass('btn-synch') : false, + isSyncButton = (toolbarView.btnCollabChanges.rendered) ? toolbarView.btnCollabChanges.cmpEl.hasClass('notify') : false, isDisabled = !cansave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave; toolbarView.btnSave.setDisabled(isDisabled); } @@ -1054,6 +1067,7 @@ define([ $(document).on('contextmenu', _.bind(me.onContextMenu, me)); Common.Gateway.documentReady(); + $('#editor-container').css('overflow', ''); $('.doc-placeholder').remove(); }, @@ -1152,7 +1166,6 @@ define([ this.appOptions.isOffline = this.api.asc_isOffline(); this.appOptions.isReviewOnly = this.permissions.review === true && this.permissions.edit === false; this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights; - this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.canEdit = (this.permissions.edit !== false || this.permissions.review === true) && // can edit or review (this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined (!this.appOptions.isReviewOnly || this.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true @@ -1161,7 +1174,7 @@ define([ this.appOptions.canViewReview = true; this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isOffline; this.appOptions.canHistoryClose = this.editorConfig.canHistoryClose; - this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory; + this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && (this.permissions.changeHistory !== false); this.appOptions.canUseMailMerge= this.appOptions.canLicense && this.appOptions.canEdit && !this.appOptions.isOffline; this.appOptions.canSendEmailAddresses = this.appOptions.canLicense && this.editorConfig.canSendEmailAddresses && this.appOptions.canEdit && this.appOptions.canCoAuthoring; this.appOptions.canComments = this.appOptions.canLicense && (this.permissions.comment===undefined ? this.appOptions.isEdit : this.permissions.comment) && (this.editorConfig.mode !== 'view'); @@ -1228,6 +1241,9 @@ define([ this.appOptions.isRestrictedEdit && this.appOptions.canComments && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyComments); this.appOptions.isRestrictedEdit && this.appOptions.canFillForms && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); this.api.asc_LoadDocument(); + + if (this.permissions.changeHistory !== undefined) + console.warn("Obsolete: The changeHistory parameter of the document permission section is deprecated. Please use onRequestRestore event instead."); }, applyModeCommonElements: function() { @@ -1260,13 +1276,13 @@ define([ var me = this, application = this.getApplication(), reviewController = application.getController('Common.Controllers.ReviewChanges'); - reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); + reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api).loadDocument({doc:me.document}); if (this.appOptions.isEdit || this.appOptions.isRestrictedEdit) { // set api events for toolbar in the Restricted Editing mode var toolbarController = application.getController('Toolbar'); toolbarController && toolbarController.setApi(me.api); - if (this.appOptions.isRestrictedEdit) return; + if (!this.appOptions.isEdit) return; var rightmenuController = application.getController('RightMenu'), fontsControllers = application.getController('Common.Controllers.Fonts'); @@ -1384,6 +1400,18 @@ define([ config.msg = this.uploadImageFileCountMessage; break; + case Asc.c_oAscError.ID.UplDocumentSize: + config.msg = this.uploadDocSizeMessage; + break; + + case Asc.c_oAscError.ID.UplDocumentExt: + config.msg = this.uploadDocExtMessage; + break; + + case Asc.c_oAscError.ID.UplDocumentFileCount: + config.msg = this.uploadDocFileCountMessage; + break; + case Asc.c_oAscError.ID.SplitCellMaxRows: config.msg = this.splitMaxRowsErrorText.replace('%1', errData.get_Value()); break; @@ -1447,7 +1475,7 @@ define([ break; case Asc.c_oAscError.ID.Warning: - config.msg = this.errorConnectToServer.replace('%1', '{{API_URL_EDITING_CALLBACK}}'); + config.msg = this.errorConnectToServer; config.closable = false; break; @@ -1496,6 +1524,11 @@ define([ config.msg = this.errorFileSizeExceed; break; + case Asc.c_oAscError.ID.UpdateVersion: + config.msg = this.errorUpdateVersionOnDisconnect; + config.maxwidth = 600; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); break; @@ -1639,7 +1672,7 @@ define([ var toolbarView = this.getApplication().getController('Toolbar').getView(); if (toolbarView && toolbarView.btnCollabChanges && !toolbarView._state.previewmode) { - var isSyncButton = toolbarView.btnCollabChanges.$icon.hasClass('btn-synch'), + var isSyncButton = toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), forcesave = this.appOptions.forcesave, isDisabled = !isModified && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave; toolbarView.btnSave.setDisabled(isDisabled); @@ -1656,7 +1689,7 @@ define([ var toolbarView = this.getApplication().getController('Toolbar').getView(); if (toolbarView && this.api && !toolbarView._state.previewmode) { - var isSyncButton = toolbarView.btnCollabChanges.$icon.hasClass('btn-synch'), + var isSyncButton = toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), forcesave = this.appOptions.forcesave, isDisabled = !isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave; toolbarView.btnSave.setDisabled(isDisabled); @@ -2073,7 +2106,8 @@ define([ var filemenu = this.getApplication().getController('LeftMenu').getView('LeftMenu').getMenu('file'); filemenu.loadDocument({doc:this.document}); - filemenu.panels['info'].updateInfo(this.document); + filemenu.panels && filemenu.panels['info'] && filemenu.panels['info'].updateInfo(this.document); + this.getApplication().getController('Common.Controllers.ReviewChanges').loadDocument({doc:this.document}); Common.Gateway.metaChange(meta); }, @@ -2156,7 +2190,7 @@ define([ uploadImageTextText: 'Uploading image...', savePreparingText: 'Preparing to save', savePreparingTitle: 'Preparing to save. Please wait...', - uploadImageSizeMessage: 'Maximium image size limit exceeded.', + uploadImageSizeMessage: 'Maximum image size limit exceeded.', uploadImageExtMessage: 'Unknown image format.', uploadImageFileCountMessage: 'No images uploaded.', reloadButtonText: 'Reload Page', @@ -2216,15 +2250,14 @@ define([ sendMergeTitle: 'Sending Merge', sendMergeText: 'Sending Merge...', txtArt: 'Your text here', - errorConnectToServer: 'The document could not be saved. Please check connection settings or contact your administrator.
    When you click the \'OK\' button, you will be prompted to download the document.

    ' + - 'Find more information about connecting Document Server here', + errorConnectToServer: 'The document could not be saved. Please check connection settings or contact your administrator.
    When you click the \'OK\' button, you will be prompted to download the document.', textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.
    Click the \'Strict mode\' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.', textStrict: 'Strict mode', txtErrorLoadHistory: 'Loading history failed', textBuyNow: 'Visit website', textNoLicenseTitle: '%1 connection limitation', textContactUs: 'Contact sales', - errorViewerDisconnect: 'Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored.', + errorViewerDisconnect: 'Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored and page is reloaded.', warnLicenseExp: 'Your license has expired.
    Please update your license and refresh the page.', titleLicenseExp: 'License expired', openErrorText: 'An error has occurred while opening the file', @@ -2472,7 +2505,11 @@ define([ errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.', txtMainDocOnly: 'Error! Main Document Only.', txtNotValidBookmark: 'Error! Not a valid bookmark self-reference.', - txtNoText: 'Error! No text of specified style in document.' + txtNoText: 'Error! No text of specified style in document.', + uploadDocSizeMessage: 'Maximum document size limit exceeded.', + uploadDocExtMessage: 'Unknown document format.', + uploadDocFileCountMessage: 'No documents uploaded.', + errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.' } })(), DE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Toolbar.js b/apps/documenteditor/main/app/controller/Toolbar.js index 704255430..eb5a1f826 100644 --- a/apps/documenteditor/main/app/controller/Toolbar.js +++ b/apps/documenteditor/main/app/controller/Toolbar.js @@ -47,6 +47,7 @@ define([ 'common/main/lib/view/ImageFromUrlDialog', 'common/main/lib/view/InsertTableDialog', 'common/main/lib/view/SelectFileDlg', + 'common/main/lib/view/SymbolTableDialog', 'common/main/lib/util/define', 'documenteditor/main/app/view/Toolbar', 'documenteditor/main/app/view/DropcapSettingsAdvanced', @@ -56,7 +57,8 @@ define([ 'documenteditor/main/app/controller/PageLayout', 'documenteditor/main/app/view/CustomColumnsDialog', 'documenteditor/main/app/view/ControlSettingsDialog', - 'documenteditor/main/app/view/WatermarkSettingsDialog' + 'documenteditor/main/app/view/WatermarkSettingsDialog', + 'documenteditor/main/app/view/CompareSettingsDialog' ], function () { 'use strict'; @@ -264,7 +266,6 @@ define([ toolbar.btnAlignCenter.on('click', _.bind(this.onHorizontalAlign, this, 2)); toolbar.btnAlignRight.on('click', _.bind(this.onHorizontalAlign, this, 0)); toolbar.btnAlignJust.on('click', _.bind(this.onHorizontalAlign, this, 3)); - toolbar.btnHorizontalAlign.menu.on('item:click', _.bind(this.onMenuHorizontalAlignSelect, this)); toolbar.btnDecLeftOffset.on('click', _.bind(this.onDecOffset, this)); toolbar.btnIncLeftOffset.on('click', _.bind(this.onIncOffset, this)); toolbar.btnMarkers.on('click', _.bind(this.onMarkers, this)); @@ -324,6 +325,7 @@ define([ toolbar.listStyles.on('contextmenu', _.bind(this.onListStyleContextMenu, this)); toolbar.styleMenu.on('hide:before', _.bind(this.onListStyleBeforeHide, this)); toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this)); + toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this)); toolbar.mnuNoControlsColor.on('click', _.bind(this.onNoControlsColor, this)); toolbar.mnuControlsColorPicker.on('select', _.bind(this.onSelectControlsColor, this)); Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); @@ -378,7 +380,10 @@ define([ this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); this.api.asc_registerCallback('asc_onShowParaMarks', _.bind(this.onShowParaMarks, this)); this.api.asc_registerCallback('asc_onChangeSdtGlobalSettings', _.bind(this.onChangeSdtGlobalSettings, this)); + this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this)); Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); + this.api.asc_registerCallback('asc_onTableDrawModeChanged', _.bind(this.onTableDraw, this)); + this.api.asc_registerCallback('asc_onTableEraseModeChanged', _.bind(this.onTableErase, this)); } else if (this.mode.isRestrictedEdit) { this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObjectRestrictedEdit, this)); this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); @@ -541,18 +546,6 @@ define([ case 3: index = 3; align = 'btn-align-just'; break; default: index = -255; align = 'btn-align-left'; break; } - if (!(index < 0)) { - this.toolbar.btnHorizontalAlign.menu.items[index].setChecked(true); - } else if (index == -255) { - this.toolbar.btnHorizontalAlign.menu.clearAll(); - } - - var btnHorizontalAlign = this.toolbar.btnHorizontalAlign; - - if ( btnHorizontalAlign.rendered && btnHorizontalAlign.$icon ) { - btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls).addClass(align); - btnHorizontalAlign.options.icls = align; - } if (v === null || v===undefined) { toolbar.btnAlignRight.toggle(false, true); @@ -653,7 +646,8 @@ define([ var i = -1, type, paragraph_locked = false, header_locked = false, - image_locked = false; + image_locked = false, + in_image = false; while (++i < selectedObjects.length) { type = selectedObjects[i].get_ObjectType(); @@ -663,11 +657,15 @@ define([ } else if (type === Asc.c_oAscTypeSelectElement.Header) { header_locked = selectedObjects[i].get_ObjectValue().get_Locked(); } else if (type === Asc.c_oAscTypeSelectElement.Image) { + in_image = true; image_locked = selectedObjects[i].get_ObjectValue().get_Locked(); } } var need_disable = !this.api.can_AddQuotedComment() || paragraph_locked || header_locked || image_locked; + if (this.mode.compatibleFeatures) { + need_disable = need_disable || in_image; + } if ( this.btnsComment && this.btnsComment.length > 0 ) this.btnsComment.setDisabled(need_disable); }, @@ -729,7 +727,11 @@ define([ if (sh) this.onParagraphColor(sh); - var need_disable = paragraph_locked || header_locked; + var rich_del_lock = (frame_pr) ? !frame_pr.can_DeleteBlockContentControl() : true, + rich_edit_lock = (frame_pr) ? !frame_pr.can_EditBlockContentControl() : true, + plain_del_lock = (frame_pr) ? !frame_pr.can_DeleteInlineContentControl() : true, + plain_edit_lock = (frame_pr) ? !frame_pr.can_EditInlineContentControl() : true; + var need_disable = paragraph_locked || header_locked || rich_edit_lock || plain_edit_lock; if (this._state.prcontrolsdisable != need_disable) { if (this._state.activated) this._state.prcontrolsdisable = need_disable; @@ -743,15 +745,18 @@ define([ lock_type = (in_control&&control_props) ? control_props.get_Lock() : Asc.c_oAscSdtLockType.Unlocked, control_plain = (in_control&&control_props) ? (control_props.get_ContentControlType()==Asc.c_oAscSdtLevelType.Inline) : false; (lock_type===undefined) && (lock_type = Asc.c_oAscSdtLockType.Unlocked); + var content_locked = lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked; - if (!paragraph_locked && !header_locked) { - toolbar.btnContentControls.menu.items[0].setDisabled(control_plain || lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked); - toolbar.btnContentControls.menu.items[1].setDisabled(control_plain || lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.ContentLocked); - toolbar.btnContentControls.menu.items[3].setDisabled(!in_control || lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked); - toolbar.btnContentControls.menu.items[5].setDisabled(!in_control); + toolbar.btnContentControls.setDisabled(paragraph_locked || header_locked); + if (!(paragraph_locked || header_locked)) { + var control_disable = control_plain || content_locked; + for (var i=0; i<7; i++) + toolbar.btnContentControls.menu.items[i].setDisabled(control_disable); + toolbar.btnContentControls.menu.items[8].setDisabled(!in_control || lock_type==Asc.c_oAscSdtLockType.SdtContentLocked || lock_type==Asc.c_oAscSdtLockType.SdtLocked); + toolbar.btnContentControls.menu.items[10].setDisabled(!in_control); } - var need_text_disable = paragraph_locked || header_locked || in_chart; + var need_text_disable = paragraph_locked || header_locked || in_chart || rich_edit_lock || plain_edit_lock; if (this._state.textonlycontrolsdisable != need_text_disable) { if (this._state.activated) this._state.textonlycontrolsdisable = need_text_disable; if (!need_disable) { @@ -759,7 +764,7 @@ define([ item.setDisabled(need_text_disable); }, this); } - toolbar.btnCopyStyle.setDisabled(need_text_disable); + // toolbar.btnCopyStyle.setDisabled(need_text_disable); toolbar.btnClearStyle.setDisabled(need_text_disable); } @@ -785,22 +790,22 @@ define([ if ( !toolbar.btnDropCap.isDisabled() ) toolbar.mnuDropCapAdvanced.setDisabled(disable_dropcapadv); - need_disable = !can_add_table || header_locked || in_equation || control_plain; + need_disable = !can_add_table || header_locked || in_equation || control_plain || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock; toolbar.btnInsertTable.setDisabled(need_disable); need_disable = toolbar.mnuPageNumCurrentPos.isDisabled() && toolbar.mnuPageNumberPosPicker.isDisabled() || control_plain; toolbar.mnuInsertPageNum.setDisabled(need_disable); var in_footnote = this.api.asc_IsCursorInFootnote(); - need_disable = paragraph_locked || header_locked || in_header || in_image || in_equation && !btn_eq_state || in_footnote || in_control; + need_disable = paragraph_locked || header_locked || in_header || in_image || in_equation && !btn_eq_state || in_footnote || in_control || rich_edit_lock || plain_edit_lock || rich_del_lock; toolbar.btnsPageBreak.setDisabled(need_disable); toolbar.btnBlankPage.setDisabled(need_disable); - need_disable = paragraph_locked || header_locked || in_equation || control_plain; + need_disable = paragraph_locked || header_locked || in_equation || control_plain || content_locked; toolbar.btnInsertShape.setDisabled(need_disable); toolbar.btnInsertText.setDisabled(need_disable); - need_disable = paragraph_locked || header_locked || in_para && !can_add_image || in_equation || control_plain; + need_disable = paragraph_locked || header_locked || in_para && !can_add_image || in_equation || control_plain || rich_del_lock || plain_del_lock || content_locked; toolbar.btnInsertImage.setDisabled(need_disable); toolbar.btnInsertTextArt.setDisabled(need_disable || in_footnote); @@ -809,26 +814,31 @@ define([ this._state.in_chart = in_chart; } - need_disable = in_chart && image_locked || !in_chart && need_disable || control_plain; + need_disable = in_chart && image_locked || !in_chart && need_disable || control_plain || rich_del_lock || plain_del_lock || content_locked; toolbar.btnInsertChart.setDisabled(need_disable); - need_disable = paragraph_locked || header_locked || in_chart || !can_add_image&&!in_equation || control_plain; + need_disable = paragraph_locked || header_locked || in_chart || !can_add_image&&!in_equation || control_plain || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock; toolbar.btnInsertEquation.setDisabled(need_disable); - need_disable = paragraph_locked || header_locked || in_equation; + toolbar.btnInsertSymbol.setDisabled(!in_para || paragraph_locked || header_locked || rich_edit_lock || plain_edit_lock || rich_del_lock || plain_del_lock); + + need_disable = paragraph_locked || header_locked || in_equation || rich_edit_lock || plain_edit_lock; toolbar.btnSuperscript.setDisabled(need_disable); toolbar.btnSubscript.setDisabled(need_disable); toolbar.btnEditHeader.setDisabled(in_equation); - need_disable = paragraph_locked || header_locked || in_image || control_plain; + need_disable = paragraph_locked || header_locked || in_image || control_plain || rich_edit_lock || plain_edit_lock; if (need_disable != toolbar.btnColumns.isDisabled()) toolbar.btnColumns.setDisabled(need_disable); if (toolbar.listStylesAdditionalMenuItem && (frame_pr===undefined) !== toolbar.listStylesAdditionalMenuItem.isDisabled()) toolbar.listStylesAdditionalMenuItem.setDisabled(frame_pr===undefined); - need_disable = !this.api.can_AddQuotedComment() || paragraph_locked || header_locked || image_locked; + need_disable = !this.api.can_AddQuotedComment() || paragraph_locked || header_locked || image_locked || rich_del_lock || rich_edit_lock || plain_del_lock || plain_edit_lock; + if (this.mode.compatibleFeatures) { + need_disable = need_disable || in_image; + } if ( this.btnsComment && this.btnsComment.length > 0 ) this.btnsComment.setDisabled(need_disable); @@ -842,6 +852,13 @@ define([ this.modeAlwaysSetStyle = false; }, + onTableDraw: function(v) { + this.toolbar.mnuInsertTable && this.toolbar.mnuInsertTable.items[2].setChecked(!!v, true); + }, + onTableErase: function(v) { + this.toolbar.mnuInsertTable && this.toolbar.mnuInsertTable.items[3].setChecked(!!v, true); + }, + onApiParagraphStyleChange: function(name) { if (this._state.prstyle != name) { var listStyle = this.toolbar.listStyles, @@ -985,7 +1002,7 @@ define([ var toolbar = this.toolbar; if (this.api) { var isModified = this.api.asc_isDocumentCanSave(); - var isSyncButton = toolbar.btnCollabChanges && toolbar.btnCollabChanges.$icon.hasClass('btn-synch'); + var isSyncButton = toolbar.btnCollabChanges && toolbar.btnCollabChanges.cmpEl.hasClass('notify'); if (!isModified && !isSyncButton && !toolbar.mode.forcesave) return; @@ -1143,20 +1160,6 @@ define([ Common.component.Analytics.trackEvent('ToolBar', 'Align'); }, - onMenuHorizontalAlignSelect: function(menu, item) { - this._state.pralign = undefined; - var btnHorizontalAlign = this.toolbar.btnHorizontalAlign; - - btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls); - btnHorizontalAlign.options.icls = !item.checked ? 'btn-align-left' : item.options.icls; - btnHorizontalAlign.$icon.addClass(btnHorizontalAlign.options.icls); - - if (this.api && item.checked) - this.api.put_PrAlign(item.value); - - Common.NotificationCenter.trigger('edit:complete', this.toolbar); - Common.component.Analytics.trackEvent('ToolBar', 'Horizontal Align'); - }, onMarkers: function(btn, e) { var record = { @@ -1398,6 +1401,12 @@ define([ Common.NotificationCenter.trigger('edit:complete', me.toolbar); } })).show(); + } else if (item.value == 'draw') { + item.isChecked() && menu.items[3].setChecked(false, true); + this.api.SetTableDrawMode(item.isChecked()); + } else if (item.value == 'erase') { + item.isChecked() && menu.items[2].setChecked(false, true); + this.api.SetTableEraseMode(item.isChecked()); } }, @@ -1721,6 +1730,8 @@ define([ (new DE.Views.ControlSettingsDialog({ props: props, api: me.api, + controlLang: me._state.lang, + interfaceLang: me.mode.lang, handler: function(result, value) { if (result == 'ok') { me.api.asc_SetContentControlProperties(value, id); @@ -1737,7 +1748,17 @@ define([ } } } else { - this.api.asc_AddContentControl(item.value); + if (item.value == 'plain' || item.value == 'rich') + this.api.asc_AddContentControl((item.value=='plain') ? Asc.c_oAscSdtLevelType.Inline : Asc.c_oAscSdtLevelType.Block); + else if (item.value == 'picture') + this.api.asc_AddContentControlPicture(); + else if (item.value == 'checkbox') + this.api.asc_AddContentControlCheckBox(); + else if (item.value == 'date') + this.api.asc_AddContentControlDatePicker(); + else if (item.value == 'combobox' || item.value == 'dropdown') + this.api.asc_AddContentControlList(item.value == 'combobox'); + Common.component.Analytics.trackEvent('ToolBar', 'Add Content Control'); } @@ -2462,6 +2483,31 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertEquation); }, + onInsertSymbolClick: function() { + if (this.dlgSymbolTable && this.dlgSymbolTable.isVisible()) return; + + if (this.api) { + var me = this; + me.dlgSymbolTable = new Common.Views.SymbolTableDialog({ + api: me.api, + lang: me.mode.lang, + modal: false, + type: 1, + buttons: [{value: 'ok', caption: this.textInsert}, 'close'], + handler: function(dlg, result, settings) { + if (result == 'ok') { + me.api.asc_insertSymbol(settings.font, settings.code); + } else + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + }); + me.dlgSymbolTable.show(); + me.dlgSymbolTable.on('symbol:dblclick', function(cmp, result, settings) { + me.api.asc_insertSymbol(settings.font, settings.code); + }); + } + }, + onApiMathTypes: function(equation) { this._equationTemp = equation; var me = this; @@ -2827,45 +2873,43 @@ define([ compactview = true; } - setTimeout(function () { - me.toolbar.render(_.extend({isCompactView: compactview}, config)); + me.toolbar.render(_.extend({isCompactView: compactview}, config)); - var tab = {action: 'review', caption: me.toolbar.textTabCollaboration}; - var $panel = me.application.getController('Common.Controllers.ReviewChanges').createToolbarPanel(); - if ( $panel ) - me.toolbar.addTab(tab, $panel, 4); + var tab = {action: 'review', caption: me.toolbar.textTabCollaboration}; + var $panel = me.application.getController('Common.Controllers.ReviewChanges').createToolbarPanel(); + if ( $panel ) + me.toolbar.addTab(tab, $panel, 4); - if ( config.isEdit ) { - me.toolbar.setMode(config); + if ( config.isEdit ) { + me.toolbar.setMode(config); - me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled')); + me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled')); - if (!(config.customization && config.customization.compactHeader)) { - // hide 'print' and 'save' buttons group and next separator - me.toolbar.btnPrint.$el.parents('.group').hide().next().hide(); + if (!(config.customization && config.customization.compactHeader)) { + // hide 'print' and 'save' buttons group and next separator + me.toolbar.btnPrint.$el.parents('.group').hide().next().hide(); - // hide 'undo' and 'redo' buttons and retrieve parent container - var $box = me.toolbar.btnUndo.$el.hide().next().hide().parent(); + // hide 'undo' and 'redo' buttons and retrieve parent container + var $box = me.toolbar.btnUndo.$el.hide().next().hide().parent(); - // move 'paste' button to the container instead of 'undo' and 'redo' - me.toolbar.btnPaste.$el.detach().appendTo($box); - me.toolbar.btnCopy.$el.removeClass('split'); - } - - if ( config.isDesktopApp ) { - if ( config.canProtect ) { - tab = {action: 'protect', caption: me.toolbar.textTabProtect}; - $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); - - if ($panel) me.toolbar.addTab(tab, $panel, 5); - } - } - - var links = me.getApplication().getController('Links'); - links.setApi(me.api).setConfig({toolbar: me}); - Array.prototype.push.apply(me.toolbar.toolbarControls, links.getView('Links').getButtons()); + // move 'paste' button to the container instead of 'undo' and 'redo' + me.toolbar.btnPaste.$el.detach().appendTo($box); + me.toolbar.btnCopy.$el.removeClass('split'); } - }, 0); + + if ( config.isDesktopApp ) { + if ( config.canProtect ) { + tab = {action: 'protect', caption: me.toolbar.textTabProtect}; + $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); + + if ($panel) me.toolbar.addTab(tab, $panel, 5); + } + } + + var links = me.getApplication().getController('Links'); + links.setApi(me.api).setConfig({toolbar: me}); + Array.prototype.push.apply(me.toolbar.toolbarControls, links.getView('Links').getButtons()); + } }, onAppReady: function (config) { @@ -2873,7 +2917,7 @@ define([ me.appOptions = config; if ( config.canCoAuthoring && config.canComments ) { - this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'btn-menu-comments', this.toolbar.capBtnComment); + this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment); if ( this.btnsComment.length ) { var _comments = DE.getController('Common.Controllers.Comments').getView(); this.btnsComment.forEach(function (btn) { @@ -2881,6 +2925,8 @@ define([ btn.on('click', function (btn, e) { Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); }); + if (btn.cmpEl.closest('#review-changes-panel').length>0) + btn.setCaption(me.toolbar.capBtnAddComment); }, this); } } @@ -2915,6 +2961,10 @@ define([ } }, + onTextLanguage: function(langId) { + this._state.lang = langId; + }, + textEmptyImgUrl : 'You need to specify image URL.', textWarning : 'Warning', textFontSizeErr : 'The entered value is incorrect.
    Please enter a numeric value between 1 and 100', @@ -3262,7 +3312,8 @@ define([ confirmAddFontName: 'The font you are going to save is not available on the current device.
    The text style will be displayed using one of the device fonts, the saved font will be used when it is available.
    Do you want to continue?', notcriticalErrorTitle: 'Warning', txtMarginsW: 'Left and right margins are too high for a given page wight', - txtMarginsH: 'Top and bottom margins are too high for a given page height' + txtMarginsH: 'Top and bottom margins are too high for a given page height', + textInsert: 'Insert' }, DE.Controllers.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Viewport.js b/apps/documenteditor/main/app/controller/Viewport.js index 54ad031fd..5780631da 100644 --- a/apps/documenteditor/main/app/controller/Viewport.js +++ b/apps/documenteditor/main/app/controller/Viewport.js @@ -269,9 +269,9 @@ define([ 'data-stopPropagation="true"', '<% } %>', '>', '', - '', + '', '', - '', + '', '' ].join('')), stopPropagation: true, diff --git a/apps/documenteditor/main/app/template/ControlSettingsDialog.template b/apps/documenteditor/main/app/template/ControlSettingsDialog.template new file mode 100644 index 000000000..23880858e --- /dev/null +++ b/apps/documenteditor/main/app/template/ControlSettingsDialog.template @@ -0,0 +1,145 @@ +
    +
    + + + + + + + + + + +
    + +
    +
    + +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + +
    +
    + + +
    +
    + +
    +
    +
    +
    +
    + + + + + + + +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + +
    + + +
    +
    +
    + + + + + +
    +
    +
    +
    +
    + + + + + + + + + + + + + + + + +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + + + + + + + + + +
    + + + +
    + + + +
    +
    +
    \ No newline at end of file diff --git a/apps/documenteditor/main/app/template/ImageSettings.template b/apps/documenteditor/main/app/template/ImageSettings.template index 8abc9eaf0..9fae4b54e 100644 --- a/apps/documenteditor/main/app/template/ImageSettings.template +++ b/apps/documenteditor/main/app/template/ImageSettings.template @@ -14,17 +14,17 @@ - + - + -
    +
    diff --git a/apps/documenteditor/main/app/template/LeftMenu.template b/apps/documenteditor/main/app/template/LeftMenu.template index 01f72350d..2466925d3 100644 --- a/apps/documenteditor/main/app/template/LeftMenu.template +++ b/apps/documenteditor/main/app/template/LeftMenu.template @@ -1,14 +1,14 @@
    - + - - + + - - - - + + + +
    diff --git a/apps/documenteditor/main/app/template/RightMenu.template b/apps/documenteditor/main/app/template/RightMenu.template index 6605f9949..306a80310 100644 --- a/apps/documenteditor/main/app/template/RightMenu.template +++ b/apps/documenteditor/main/app/template/RightMenu.template @@ -21,14 +21,14 @@
    - - - - - - - - - + + + + + + + + +
    \ No newline at end of file diff --git a/apps/documenteditor/main/app/template/StatusBar.template b/apps/documenteditor/main/app/template/StatusBar.template index e313b8191..8f10cfc6d 100644 --- a/apps/documenteditor/main/app/template/StatusBar.template +++ b/apps/documenteditor/main/app/template/StatusBar.template @@ -23,14 +23,14 @@
    - - - + + +
    - +
    diff --git a/apps/documenteditor/main/app/template/Toolbar.template b/apps/documenteditor/main/app/template/Toolbar.template index c50e0c0e7..ff945a3a9 100644 --- a/apps/documenteditor/main/app/template/Toolbar.template +++ b/apps/documenteditor/main/app/template/Toolbar.template @@ -33,8 +33,8 @@
    - - + +
    @@ -108,6 +108,7 @@
    +
    diff --git a/apps/documenteditor/main/app/template/Viewport.template b/apps/documenteditor/main/app/template/Viewport.template index 40c1ea100..8d56d214c 100644 --- a/apps/documenteditor/main/app/template/Viewport.template +++ b/apps/documenteditor/main/app/template/Viewport.template @@ -9,7 +9,7 @@
    -
    +
    diff --git a/apps/documenteditor/main/app/view/AddNewCaptionLabelDialog.js b/apps/documenteditor/main/app/view/AddNewCaptionLabelDialog.js index bd32f99ac..4ca86915e 100644 --- a/apps/documenteditor/main/app/view/AddNewCaptionLabelDialog.js +++ b/apps/documenteditor/main/app/view/AddNewCaptionLabelDialog.js @@ -48,8 +48,7 @@ define([ width: 330, header: false, cls: 'modal-dlg', - buttons: ['ok', 'cancel'], - footerCls: 'center' + buttons: ['ok', 'cancel'] }, initialize : function(options) { @@ -94,7 +93,7 @@ define([ var me = this; _.delay(function(){ me.getChild('input').focus(); - },500); + },50); }, onPrimary: function(event) { diff --git a/apps/documenteditor/main/app/view/BookmarksDialog.js b/apps/documenteditor/main/app/view/BookmarksDialog.js index 60dea4536..9210e9648 100644 --- a/apps/documenteditor/main/app/view/BookmarksDialog.js +++ b/apps/documenteditor/main/app/view/BookmarksDialog.js @@ -110,7 +110,7 @@ define([ '
    ', '
    ', '', - '' + ].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; + me.inputName = new Common.UI.InputField({ + el : $('#id-dlg-label-name'), + allowBlank : false, + blankError : me.textNameError, + style : 'width: 100%;', + validateOnBlur: false, + validation : function(value) { + return value ? true : ''; + } + }); + me.inputName._input.on('input', function (e) { + if (me.copyvalue==undefined && me.inputValue.getValue()==me.inputName.getValue()) { + me.copyvalue = 1; + } + if (me.copyvalue==1) + me.inputValue.setValue($(e.target).val()); + else if (me.copyvalue==2) + me.copyvalue = 0; + }); + + me.inputValue = new Common.UI.InputField({ + el : $('#id-dlg-label-value'), + style : 'width: 100%;', + validateOnBlur: false, + validation : function(value) { + if (value!=='' && me.options.store) { + var rec = me.options.store.findWhere({value: value}); + if (rec) + return me.textValueError + } + return true; + } + }); + me.inputValue._input.on('input', function (e) { + if (me.copyvalue==undefined && me.inputValue.getValue()==me.inputName.getValue()) { + me.copyvalue = 2; + } + if (me.copyvalue==2) + me.inputName.setValue($(e.target).val()); + else if (me.copyvalue==1) + me.copyvalue = 0; + }); + + var $window = this.getChild(); + $window.find('.btn').on('click', _.bind(this.onBtnClick, this)); + }, + + show: function() { + Common.UI.Window.prototype.show.apply(this, arguments); + + var me = this; + _.delay(function(){ + me.inputName.cmpEl.find('input').focus(); + },50); + }, + + onPrimary: function(event) { + this._handleInput('ok'); + return false; + }, + + onBtnClick: function(event) { + this._handleInput(event.currentTarget.attributes['result'].value); + }, + + _handleInput: function(state) { + if (this.options.handler) { + if (state == 'ok') { + if (this.inputName.checkValidate() !== true) { + this.inputName.cmpEl.find('input').focus(); + return; + } + if (this.inputValue.checkValidate() !== true) { + this.inputValue.cmpEl.find('input').focus(); + return; + } + } + + this.options.handler.call(this, state, this.inputName.getValue(), this.inputValue.getValue()); + } + + this.close(); + }, + + setSettings: function (props) { + if (props) { + this.inputName.setValue(props.name || ''); + this.inputValue.setValue(props.value || ''); + } + }, + + textDisplayName: 'Display name', + textValue: 'Value', + textNameError: 'Display name must not be empty.', + textValueError: 'An item with the same value already exists.' + }, DE.Views.EditListItemDialog || {})); +}); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/FileMenu.js b/apps/documenteditor/main/app/view/FileMenu.js index 5fcf1c1d4..646859833 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -281,7 +281,8 @@ define([ if (!this.mode) return; this.miDownload[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide'](); - this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) ?'show':'hide'](); + var isBCSupport = window["AscDesktopEditor"] ? window["AscDesktopEditor"]["isBlockchainSupport"]() : false; + this.miSaveCopyAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide'](); this.miSaveAs[((this.mode.canDownload || this.mode.canDownloadOrigin) && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide'](); this.miSave[this.mode.isEdit?'show':'hide'](); this.miEdit[!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide'](); @@ -297,7 +298,7 @@ define([ this.miAccess[(!this.mode.isOffline && !this.mode.isReviewOnly && this.document&&this.document.info && (this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 || - this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide'](); + (this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length || this.mode.canRequestSharingSettings)))?'show':'hide'](); this.miHelp[this.mode.canHelp ?'show':'hide'](); this.miHelp.$el.prev()[this.mode.canHelp ?'show':'hide'](); diff --git a/apps/documenteditor/main/app/view/FileMenuPanels.js b/apps/documenteditor/main/app/view/FileMenuPanels.js index 730665ee5..d982e9fad 100644 --- a/apps/documenteditor/main/app/view/FileMenuPanels.js +++ b/apps/documenteditor/main/app/view/FileMenuPanels.js @@ -881,7 +881,7 @@ define([ }).on('keydown:before', keyDownBefore); this.btnApply = new Common.UI.Button({ - el: '#fminfo-btn-apply' + el: $markup.findById('#fminfo-btn-apply') }); this.btnApply.on('click', _.bind(this.applySettings, this)); @@ -1003,6 +1003,7 @@ define([ me.authors.push(item); }); this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit); + !this.mode.isEdit && this._ShowHideInfoItem(this.tblAuthor, !!this.authors.length); } this.SetDisabled(); }, @@ -1047,6 +1048,12 @@ define([ this.inputAuthor.setVisible(mode.isEdit); this.btnApply.setVisible(mode.isEdit); this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit); + if (!mode.isEdit) { + this.inputTitle._input.attr('placeholder', ''); + this.inputSubject._input.attr('placeholder', ''); + this.inputComment._input.attr('placeholder', ''); + this.inputAuthor._input.attr('placeholder', ''); + } this.SetDisabled(); return this; }, @@ -1192,7 +1199,7 @@ define([ this.updateInfo(this.doc); - Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this)); + Common.NotificationCenter.on('collaboration:sharingupdate', this.updateSharingSettings.bind(this)); Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this)); this.$el = $(node).html($markup); @@ -1224,7 +1231,7 @@ define([ if (doc.info.sharingSettings) this.cntRights.html(this.templateRights({users: doc.info.sharingSettings})); this._ShowHideInfoItem('rights', doc.info.sharingSettings!==undefined && doc.info.sharingSettings!==null && doc.info.sharingSettings.length>0); - this._ShowHideInfoItem('edit-rights', !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights!==true); + this._ShowHideInfoItem('edit-rights', (!!this.sharingSettingsUrl && this.sharingSettingsUrl.length || this.mode.canRequestSharingSettings) && this._readonlyRights!==true); } else this._ShowHideDocInfo(false); }, @@ -1244,37 +1251,18 @@ define([ }, setMode: function(mode) { + this.mode = mode; this.sharingSettingsUrl = mode.sharingSettingsUrl; - !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this)); - !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this)); return this; }, changeAccessRights: function(btn,event,opts) { - if (this._docAccessDlg || this._readonlyRights) return; - - var me = this; - me._docAccessDlg = new Common.Views.DocumentAccessDialog({ - settingsurl: this.sharingSettingsUrl - }); - me._docAccessDlg.on('accessrights', function(obj, rights){ - me.updateSharingSettings(rights); - }).on('close', function(obj){ - me._docAccessDlg = undefined; - }); - - me._docAccessDlg.show(); - }, - - setSharingSettings: function(data) { - data && this.updateSharingSettings(data.sharingSettings); + Common.NotificationCenter.trigger('collaboration:sharing'); }, updateSharingSettings: function(rights) { - this.doc.info.sharingSettings = rights; this._ShowHideInfoItem('rights', this.doc.info.sharingSettings!==undefined && this.doc.info.sharingSettings!==null && this.doc.info.sharingSettings.length>0); this.cntRights.html(this.templateRights({users: this.doc.info.sharingSettings})); - Common.NotificationCenter.trigger('mentions:clearusers', this); }, onLostEditRights: function() { diff --git a/apps/documenteditor/main/app/view/HeaderFooterSettings.js b/apps/documenteditor/main/app/view/HeaderFooterSettings.js index ae792ce79..f61c6c93a 100644 --- a/apps/documenteditor/main/app/view/HeaderFooterSettings.js +++ b/apps/documenteditor/main/app/view/HeaderFooterSettings.js @@ -158,7 +158,6 @@ define([ 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){ @@ -206,7 +205,6 @@ define([ this.radioFrom.setValue(true, true); this.api.asc_SetSectionStartPage(field.getNumberValue()); } - this.fireEvent('editcomplete', this); }, updateMetricUnit: function() { @@ -220,6 +218,7 @@ define([ }, createDelayedControls: function() { + var me = this; 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], @@ -276,6 +275,7 @@ define([ }); this.numPosition.on('change', _.bind(this.onNumPositionChange, this)); + this.numPosition.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.chDiffFirst.on('change', _.bind(this.onDiffFirstChange, this)); this.chDiffOdd.on('change', _.bind(this.onDiffOddChange, this)); this.chSameAs.on('change', _.bind(this.onSameAsChange, this)); @@ -313,6 +313,7 @@ define([ }); this.lockedControls.push(this.numFrom); this.numFrom.on('change', _.bind(this.onNumFromChange, this)); + this.numFrom.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); }, createDelayedElements: function() { diff --git a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js index a51640df5..0d7f8c0c2 100644 --- a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js @@ -58,8 +58,7 @@ define([ width: 350, style: 'min-width: 230px;', cls: 'modal-dlg', - buttons: ['ok', 'cancel'], - footerCls: 'right' + buttons: ['ok', 'cancel'] }, initialize : function(options) { diff --git a/apps/documenteditor/main/app/view/ImageSettings.js b/apps/documenteditor/main/app/view/ImageSettings.js index 84b2e50fd..3be09ca9b 100644 --- a/apps/documenteditor/main/app/view/ImageSettings.js +++ b/apps/documenteditor/main/app/view/ImageSettings.js @@ -105,10 +105,10 @@ define([ updateMetricUnit: function() { var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width); - this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); }, createDelayedControls: function() { @@ -159,6 +159,10 @@ define([ }); this.lockedControls.push(this.btnFitMargins); + var w = Math.max(this.btnOriginalSize.cmpEl.width(), this.btnFitMargins.cmpEl.width()); + this.btnOriginalSize.cmpEl.width(w); + this.btnFitMargins.cmpEl.width(w); + this.btnInsertFromFile = new Common.UI.Button({ el: $('#image-button-from-file') }); @@ -191,7 +195,7 @@ define([ this.btnRotate270 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-270', + iconCls: 'toolbar__icon btn-rotate-270', value: 0, hint: this.textHint270 }); @@ -201,7 +205,7 @@ define([ this.btnRotate90 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-90', + iconCls: 'toolbar__icon btn-rotate-90', value: 1, hint: this.textHint90 }); @@ -211,7 +215,7 @@ define([ this.btnFlipV = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-vert', + iconCls: 'toolbar__icon btn-flip-vert', value: 0, hint: this.textHintFlipV }); @@ -221,7 +225,7 @@ define([ this.btnFlipH = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-hor', + iconCls: 'toolbar__icon btn-flip-hor', value: 1, hint: this.textHintFlipH }); @@ -229,6 +233,7 @@ define([ this.btnFlipH.on('click', _.bind(this.onBtnFlipClick, this)); this.lockedControls.push(this.btnFlipH); + var w = this.btnOriginalSize.cmpEl.outerWidth(); this.btnCrop = new Common.UI.Button({ cls: 'btn-text-split-default', caption: this.textCrop, @@ -236,9 +241,9 @@ define([ enableToggle: true, allowDepress: true, pressed: this._state.cropMode, - width: 100, + width: w, menu : new Common.UI.Menu({ - style : 'min-width: 100px;', + style : 'min-width:' + w + 'px;', items: [ { caption: this.textCrop, @@ -311,13 +316,13 @@ define([ 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.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); 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.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Height = value; } @@ -391,8 +396,8 @@ define([ 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.getCurrentMetricName(); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); var properties = new Asc.asc_CImgProperty(); properties.put_Width(w); @@ -423,8 +428,8 @@ define([ h = pageh; } - this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); var properties = new Asc.asc_CImgProperty(); properties.put_Width(w); @@ -572,7 +577,7 @@ define([ textWrap: 'Wraping Style', textWidth: 'Width', textHeight: 'Height', - textOriginalSize: 'Default Size', + textOriginalSize: 'Actual Size', textInsert: 'Replace Image', textFromUrl: 'From URL', textFromFile: 'From File', diff --git a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js index 1dc6a5a6f..fee87f477 100644 --- a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js @@ -185,7 +185,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat this.btnRatio = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'advanced-btn-ratio', + iconCls: 'toolbar__icon advanced-btn-ratio', style: 'margin-bottom: 1px;', enableToggle: true, hint: this.textKeepRatio @@ -2013,7 +2013,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat textLeft: 'Left', textBottom: 'Bottom', textRight: 'Right', - textOriginalSize: 'Default Size', + textOriginalSize: 'Actual Size', textPosition: 'Position', textDistance: 'Distance From Text', textSize: 'Size', diff --git a/apps/documenteditor/main/app/view/Links.js b/apps/documenteditor/main/app/view/Links.js index e2ec9b0c5..1d63305d2 100644 --- a/apps/documenteditor/main/app/view/Links.js +++ b/apps/documenteditor/main/app/view/Links.js @@ -126,14 +126,14 @@ define([ var me = this, $host = me.toolbar.$el; - this.btnsContents = Common.Utils.injectButtons($host.find('.btn-slot.btn-contents'), '', 'btn-contents', me.capBtnInsContents, undefined, true, true ); - this.btnsNotes = Common.Utils.injectButtons($host.find('.btn-slot.slot-notes'), '', 'btn-notes', me.capBtnInsFootnote, undefined, true, true); - this.btnsHyperlink = Common.Utils.injectButtons($host.find('.btn-slot.slot-inshyperlink'), '', 'btn-inserthyperlink', me.capBtnInsLink); + this.btnsContents = Common.Utils.injectButtons($host.find('.btn-slot.btn-contents'), '', 'toolbar__icon btn-contents', me.capBtnInsContents, undefined, true, true ); + this.btnsNotes = Common.Utils.injectButtons($host.find('.btn-slot.slot-notes'), '', 'toolbar__icon btn-notes', me.capBtnInsFootnote, undefined, true, true); + this.btnsHyperlink = Common.Utils.injectButtons($host.find('.btn-slot.slot-inshyperlink'), '', 'toolbar__icon btn-inserthyperlink', me.capBtnInsLink); Array.prototype.push.apply(this.paragraphControls, this.btnsContents.concat(this.btnsNotes, this.btnsHyperlink)); this.btnContentsUpdate = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-contents-update', + iconCls: 'toolbar__icon btn-contents-update', caption: this.capBtnContentsUpdate, split: true, menu: true, @@ -144,7 +144,7 @@ define([ this.btnBookmarks = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-bookmarks', + iconCls: 'toolbar__icon btn-bookmarks', caption: this.capBtnBookmarks, disabled: true }); @@ -153,7 +153,7 @@ define([ this.btnCaption = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-caption', + iconCls: 'toolbar__icon btn-caption', caption: this.capBtnCaption, disabled: true }); @@ -229,8 +229,8 @@ define([ 'data-stopPropagation="true"', '<% } %>', '>', '', - '', - '', + '', + '', '' ].join('')), stopPropagation: true diff --git a/apps/documenteditor/main/app/view/MailMergeSettings.js b/apps/documenteditor/main/app/view/MailMergeSettings.js index ad24da6ef..3d520ea6e 100644 --- a/apps/documenteditor/main/app/view/MailMergeSettings.js +++ b/apps/documenteditor/main/app/view/MailMergeSettings.js @@ -182,7 +182,7 @@ define([ this.btnFirst = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'mmerge-first', + iconCls: 'toolbar__icon btn-firstitem', disabled: true, value: 0, hint: this.txtFirst, @@ -194,7 +194,7 @@ define([ this.btnPrev = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'mmerge-prev', + iconCls: 'toolbar__icon btn-previtem', disabled: true, value: 1, hint: this.txtPrev, @@ -206,7 +206,7 @@ define([ this.btnNext = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'mmerge-next', + iconCls: 'toolbar__icon btn-nextitem', value: 2, hint: this.txtNext, lock: [_set.noRecipients, _set.lostConnect] @@ -217,7 +217,7 @@ define([ this.btnLast = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'mmerge-last', + iconCls: 'toolbar__icon btn-lastitem', value: 3, hint: this.txtLast, lock: [_set.noRecipients, _set.lostConnect] diff --git a/apps/documenteditor/main/app/view/PageMarginsDialog.js b/apps/documenteditor/main/app/view/PageMarginsDialog.js index b1c6f83cb..a195a093f 100644 --- a/apps/documenteditor/main/app/view/PageMarginsDialog.js +++ b/apps/documenteditor/main/app/view/PageMarginsDialog.js @@ -45,9 +45,9 @@ define([ DE.Views.PageMarginsDialog = Common.UI.Window.extend(_.extend({ options: { - width: 215, + width: 404, header: true, - style: 'min-width: 216px;', + style: 'min-width: 404px;', cls: 'modal-dlg', id: 'window-page-margins', buttons: ['ok', 'cancel'] @@ -59,31 +59,50 @@ define([ }, options || {}); this.template = [ - '
    ', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '
    ', + '
    ', + '
    ', + '', + '
    ', + '
    ', '', '
    ', - '
    ', + '', + '
    ', '', '
    ', - '
    ', - '', + '', + '', + '
    ', + '
    ', + '', '
    ', - '
    ', - '', + '', + '
    ', + '', '
    ', - '
    ', - '
    ', - '
    ' + '
    ', + '', + '
    ', + '', + '
    ', + '
    ', + '
    ', + '
    ', + '
    ', + '
    ', + '', + '
    ', + '
    ', + '
    ', + '', + '
    ', + '
    ', + '', + '
    ', + '', + '
    ', + '
    ', + '' ].join(''); this.options.tpl = _.template(this.template)(this.options); @@ -107,6 +126,13 @@ define([ maxValue: 55.88, minValue: -55.87 }); + this.spnTop.on('change', _.bind(function (field, newValue, oldValue) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_TopMargin(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.spinners.push(this.spnTop); this.spnBottom = new Common.UI.MetricSpinner({ @@ -118,6 +144,13 @@ define([ maxValue: 55.88, minValue: -55.87 }); + this.spnBottom.on('change', _.bind(function (field, newValue, oldValue) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.spinners.push(this.spnBottom); this.spnLeft = new Common.UI.MetricSpinner({ @@ -129,6 +162,13 @@ define([ maxValue: 55.88, minValue: 0 }); + this.spnLeft.on('change', _.bind(function (field, newValue, oldValue) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.spinners.push(this.spnLeft); this.spnRight = new Common.UI.MetricSpinner({ @@ -140,10 +180,102 @@ define([ maxValue: 55.88, minValue: 0 }); + this.spnRight.on('change', _.bind(function (field, newValue, oldValue) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); this.spinners.push(this.spnRight); - var $window = this.getChild(); - $window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); + this.spnGutter = new Common.UI.MetricSpinner({ + el: $('#page-margins-spin-gutter'), + step: .1, + width: 86, + defaultUnit : "cm", + value: '1 cm', + maxValue: 55.88, + minValue: 0 + }); + this.spnGutter.on('change', _.bind(function (field, newValue, oldValue) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_Gutter(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); + this.spinners.push(this.spnGutter); + + this.cmbGutterPosition = new Common.UI.ComboBox({ + el : $('#page-margins-spin-gutter-position'), + menuStyle : 'min-width: 86px;', + style : 'width: 86px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 0, displayValue: this.textLeft }, + { value: 1, displayValue: this.textTop } + ] + }); + this.cmbGutterPosition.on('selected', _.bind(function (combo, record) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_GutterAtTop(record.value); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); + + this.cmbOrientation = new Common.UI.ComboBox({ + el : $('#page-margins-cmb-orientation'), + menuStyle : 'min-width: 180px;', + style : 'width: 180px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 0, displayValue: this.textPortrait }, + { value: 1, displayValue: this.textLandscape } + ] + }); + this.cmbOrientation.on('selected', _.bind(function (combo, record) { + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_Orientation(record.value); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); + + this.cmbMultiplePages = new Common.UI.ComboBox({ + el : $('#page-margins-cmb-multiple-pages'), + menuStyle : 'min-width: 180px;', + style : 'width: 180px;', + editable : false, + cls : 'input-group-nr', + data : [ + { value: 0, displayValue: this.textNormal }, + { value: 1, displayValue: this.textMirrorMargins } + ] + }); + this.cmbMultiplePages.on('selected', _.bind(function(combo, record) { + if (record.value === 0) { + this.window.find('#margin-left-label').html(this.textLeft); + this.window.find('#margin-right-label').html(this.textRight); + this.cmbGutterPosition.setDisabled(false); + } else { + this.window.find('#margin-left-label').html(this.textInside); + this.window.find('#margin-right-label').html(this.textOutside); + this.cmbGutterPosition.setValue(0); + this.cmbGutterPosition.setDisabled(true); + } + if (this.api) { + this.properties = (this.properties) ? this.properties : new Asc.CDocumentSectionProps(); + this.properties.put_MirrorMargins(record.value); + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } + }, this)); + + this.window = this.getChild(); + this.window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); this.updateMetricUnit(); }, @@ -181,6 +313,7 @@ define([ setSettings: function (props) { if (props) { + this.properties = props; this.maxMarginsH = Common.Utils.Metric.fnRecalcFromMM(props.get_H() - 2.6); this.maxMarginsW = Common.Utils.Metric.fnRecalcFromMM(props.get_W() - 12.7); this.spnTop.setMaxValue(this.maxMarginsH); @@ -192,6 +325,23 @@ define([ this.spnBottom.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_BottomMargin()), true); this.spnLeft.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_LeftMargin()), true); this.spnRight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_RightMargin()), true); + this.cmbOrientation.setValue(props.get_Orientation()); + + this.spnGutter.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_Gutter()), true); + this.cmbGutterPosition.setValue(props.get_GutterAtTop() ? 1 : 0); + var mirrorMargins = props.get_MirrorMargins(); + this.cmbMultiplePages.setValue(mirrorMargins ? 1 : 0); + + if (mirrorMargins) { + this.window.find('#margin-left-label').html(this.textInside); + this.window.find('#margin-right-label').html(this.textOutside); + this.cmbGutterPosition.setValue(0); + } + this.cmbGutterPosition.setDisabled(mirrorMargins); + + if (this.api) { + //this.api.SetDrawImagePreviewMargins('page-margins-preview', this.properties); + } } }, @@ -201,6 +351,10 @@ define([ props.put_BottomMargin(Common.Utils.Metric.fnRecalcToMM(this.spnBottom.getNumberValue())); props.put_LeftMargin(Common.Utils.Metric.fnRecalcToMM(this.spnLeft.getNumberValue())); props.put_RightMargin(Common.Utils.Metric.fnRecalcToMM(this.spnRight.getNumberValue())); + props.put_Orientation(this.cmbOrientation.getValue()); + props.put_Gutter(Common.Utils.Metric.fnRecalcToMM(this.spnGutter.getNumberValue())); + props.put_GutterAtTop(this.cmbGutterPosition.getValue() ? true : false); + props.put_MirrorMargins(this.cmbMultiplePages.getValue() ? true : false); return props; }, @@ -221,6 +375,17 @@ define([ textRight: 'Right', notcriticalErrorTitle: 'Warning', txtMarginsW: 'Left and right margins are too high for a given page wight', - txtMarginsH: 'Top and bottom margins are too high for a given page height' + txtMarginsH: 'Top and bottom margins are too high for a given page height', + textMultiplePages: 'Multiple pages', + textGutter: 'Gutter', + textGutterPosition: 'Gutter position', + textOrientation: 'Orientation', + textPreview: 'Preview', + textPortrait: 'Portrait', + textLandscape: 'Landscape', + textMirrorMargins: 'Mirror margins', + textNormal: 'Normal', + textInside: 'Inside', + textOutside: 'Outside' }, DE.Views.PageMarginsDialog || {})) }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/view/ParagraphSettings.js b/apps/documenteditor/main/app/view/ParagraphSettings.js index 04bee00dd..c683aa42f 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettings.js +++ b/apps/documenteditor/main/app/view/ParagraphSettings.js @@ -84,13 +84,13 @@ define([ this._locked = true; this.isChart = false; - this.render(); - this._arrLineRule = [ {displayValue: this.textAtLeast,defaultValue: 5, value: c_paragraphLinerule.LINERULE_LEAST, minValue: 0.03, step: 0.01, defaultUnit: 'cm'}, {displayValue: this.textAuto, defaultValue: 1, value: c_paragraphLinerule.LINERULE_AUTO, minValue: 0.5, step: 0.01, defaultUnit: ''}, {displayValue: this.textExact, defaultValue: 5, value: c_paragraphLinerule.LINERULE_EXACT, minValue: 0.03, step: 0.01, defaultUnit: 'cm'} ]; + + this.render(); }, render: function () { @@ -98,6 +98,8 @@ define([ scope: this })); + var me = this; + // Short Size this.cmbLineRule = new Common.UI.ComboBox({ el: $markup.findById('#paragraph-combo-line-rule'), @@ -170,6 +172,9 @@ define([ this.numLineHeight.on('change', this.onNumLineHeightChange.bind(this)); this.numSpacingBefore.on('change', this.onNumSpacingBeforeChange.bind(this)); this.numSpacingAfter.on('change', this.onNumSpacingAfterChange.bind(this)); + this.numLineHeight.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.numSpacingBefore.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.numSpacingAfter.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.chAddInterval.on('change', this.onAddIntervalChange.bind(this)); this.cmbLineRule.on('selected', this.onLineRuleSelect.bind(this)); this.cmbLineRule.on('hide:after', this.onHideMenus.bind(this)); @@ -199,7 +204,6 @@ define([ var type = c_paragraphLinerule.LINERULE_AUTO; if (this.api) this.api.put_PrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); - this.fireEvent('editcomplete', this); }, onNumSpacingBeforeChange: function(field, newValue, oldValue, eOpts){ @@ -208,8 +212,6 @@ define([ this._state.LineSpacingBefore = (num<0) ? -1 : Common.Utils.Metric.fnRecalcToMM(num); this.api.put_LineSpacingBeforeAfter(0, this._state.LineSpacingBefore); } - - this.fireEvent('editcomplete', this); }, onNumSpacingAfterChange: function(field, newValue, oldValue, eOpts){ @@ -218,7 +220,6 @@ define([ this._state.LineSpacingAfter = (num<0) ? -1 : Common.Utils.Metric.fnRecalcToMM(num); this.api.put_LineSpacingBeforeAfter(1, this._state.LineSpacingAfter); } - this.fireEvent('editcomplete', this); }, onAddIntervalChange: function(field, newValue, oldValue, eOpts){ diff --git a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js index bfc4f6191..f7eb4b34e 100644 --- a/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/documenteditor/main/app/view/ParagraphSettingsAdvanced.js @@ -124,9 +124,9 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem } this._arrTabAlign = [ - { value: 1, displayValue: this.textTabLeft }, - { value: 3, displayValue: this.textTabCenter }, - { value: 2, displayValue: this.textTabRight } + { value: Asc.c_oAscTabType.Left, displayValue: this.textTabLeft }, + { value: Asc.c_oAscTabType.Center, displayValue: this.textTabCenter }, + { value: Asc.c_oAscTabType.Right, displayValue: this.textTabRight } ]; this._arrKeyTabAlign = []; this._arrTabAlign.forEach(function(item) { @@ -207,7 +207,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); this.Spacing = properties.get_Spacing(); } - this.Spacing.Before = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()); + this.Spacing.put_Before(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); }, this)); this.spinners.push(this.numSpacingBefore); @@ -227,7 +227,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); this.Spacing = properties.get_Spacing(); } - this.Spacing.After = Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()); + this.Spacing.put_After(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); }, this)); this.spinners.push(this.numSpacingAfter); @@ -577,7 +577,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem cls : 'input-group-nr', data : this._arrTabAlign }); - this.cmbAlign.setValue(1); + this.cmbAlign.setValue(Asc.c_oAscTabType.Left); this.cmbLeader = new Common.UI.ComboBox({ el : $('#paraadv-cmb-leader'), @@ -1362,13 +1362,13 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); this.Spacing = properties.get_Spacing(); } - this.Spacing.LineRule = record.value; - if ( this.CurLineRuleIdx !== this.Spacing.LineRule ) { + this.Spacing.put_LineRule(record.value); + if ( this.CurLineRuleIdx !== this.Spacing.get_LineRule() ) { this.numLineHeight.setDefaultUnit(this._arrLineRule[record.value].defaultUnit); this.numLineHeight.setMinValue(this._arrLineRule[record.value].minValue); this.numLineHeight.setStep(this._arrLineRule[record.value].step); var value = this.numLineHeight.getNumberValue(); - if (this.Spacing.LineRule === c_paragraphLinerule.LINERULE_AUTO) { + if (this.Spacing.get_LineRule() === c_paragraphLinerule.LINERULE_AUTO) { this.numLineHeight.setValue(this._arrLineRule[record.value].defaultValue); } else if (this.CurLineRuleIdx === c_paragraphLinerule.LINERULE_AUTO) { this.numLineHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(this._arrLineRule[record.value].defaultValue)); @@ -1386,7 +1386,7 @@ define([ 'text!documenteditor/main/app/template/ParagraphSettingsAdvanced.tem var properties = (this._originalProps) ? this._originalProps : new Asc.asc_CParagraphProperty(); this.Spacing = properties.get_Spacing(); } - this.Spacing.Line = (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()); + this.Spacing.put_Line((this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); }, onSpecialSelect: function(combo, record) { diff --git a/apps/documenteditor/main/app/view/RightMenu.js b/apps/documenteditor/main/app/view/RightMenu.js index f1b95cc70..69a451c3a 100644 --- a/apps/documenteditor/main/app/view/RightMenu.js +++ b/apps/documenteditor/main/app/view/RightMenu.js @@ -190,8 +190,7 @@ define([ allowMouseEventsOnDisabled: true }); this._settings[Common.Utils.documentSettingsType.MailMerge] = {panel: "id-mail-merge-settings", btn: this.btnMailMerge}; - - this.btnMailMerge.el = $markup.findById('#id-right-menu-mail-merge'); this.btnMailMerge.render().setVisible(true); + this.btnMailMerge.setElement($markup.findById('#id-right-menu-mail-merge'), false); this.btnMailMerge.render().setVisible(true); this.btnMailMerge.on('click', this.onBtnMenuClick.bind(this)); this.mergeSettings = new DE.Views.MailMergeSettings(); } @@ -206,8 +205,7 @@ define([ allowMouseEventsOnDisabled: true }); this._settings[Common.Utils.documentSettingsType.Signature] = {panel: "id-signature-settings", btn: this.btnSignature}; - - this.btnSignature.el = $markup.findById('#id-right-menu-signature'); this.btnSignature.render().setVisible(true); + this.btnSignature.setElement($markup.findById('#id-right-menu-signature'), false); this.btnSignature.render().setVisible(true); this.btnSignature.on('click', this.onBtnMenuClick.bind(this)); this.signatureSettings = new DE.Views.SignatureSettings(); } diff --git a/apps/documenteditor/main/app/view/ShapeSettings.js b/apps/documenteditor/main/app/view/ShapeSettings.js index 1d227611a..d6a64fa25 100644 --- a/apps/documenteditor/main/app/view/ShapeSettings.js +++ b/apps/documenteditor/main/app/view/ShapeSettings.js @@ -364,7 +364,6 @@ define([ this.imgprops.put_ShapeProperties(props); this.api.ImgApply(this.imgprops); } - this.fireEvent('editcomplete', this); }, onTransparencyChange: function(field, newValue, oldValue){ @@ -550,17 +549,16 @@ define([ }); fill.get_fill().put_positions(arr); - if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_GRAD) { - if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { - fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); - fill.get_fill().put_linear_scale(true); - } - arr = []; - this.GradColor.colors.forEach(function(item){ - arr.push(Common.Utils.ThemeColor.getRgbColor(item)); - }); - fill.get_fill().put_colors(arr); + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); + fill.get_fill().put_linear_scale(true); } + arr = []; + this.GradColor.colors.forEach(function(item){ + arr.push(Common.Utils.ThemeColor.getRgbColor(item)); + }); + fill.get_fill().put_colors(arr); + props.put_fill(fill); this.imgprops.put_ShapeProperties(props); this.api.ImgApply(this.imgprops); @@ -930,7 +928,7 @@ define([ var me = this; var colors = fill.get_colors(), positions = fill.get_positions(), - length = colors.length; + length = colors ? colors.length : this.GradColor.colors.length; this.sldrGradient.setThumbs(length); if (this.GradColor.colors.length>length) { this.GradColor.colors.splice(length, this.GradColor.colors.length - length); @@ -958,6 +956,10 @@ define([ me.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(me.GradColor.colors[index]) == 'object') ? me.GradColor.colors[index].color : me.GradColor.colors[index]), index); me.sldrGradient.setValue(index, me.GradColor.values[index]); } + if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; this.FGColor = {Value: 1, Color: this.GradColor.colors[0]}; this.BGColor = {Value: 1, Color: 'ffffff'}; @@ -1255,6 +1257,7 @@ define([ minValue: 0 }); this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.fillControls.push(this.numTransparency); this.sldrTransparency = new Common.UI.SingleSlider({ @@ -1357,6 +1360,16 @@ define([ me.GradColor.colors = colors; me.GradColor.currentIdx = currentIdx; }); + this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){ + me.GradColor.colors[index] = me.GradColor.colors[nearIndex]; + me.GradColor.currentIdx = index; + me.sldrGradient.addNewThumb(index, color); + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + }); this.fillControls.push(this.sldrGradient); this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ @@ -1384,7 +1397,7 @@ define([ this.btnRotate270 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-270', + iconCls: 'toolbar__icon btn-rotate-270', value: 0, hint: this.textHint270 }); @@ -1394,7 +1407,7 @@ define([ this.btnRotate90 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-90', + iconCls: 'toolbar__icon btn-rotate-90', value: 1, hint: this.textHint90 }); @@ -1404,7 +1417,7 @@ define([ this.btnFlipV = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-vert', + iconCls: 'toolbar__icon btn-flip-vert', value: 0, hint: this.textHintFlipV }); @@ -1414,7 +1427,7 @@ define([ this.btnFlipH = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-hor', + iconCls: 'toolbar__icon btn-flip-hor', value: 1, hint: this.textHintFlipH }); diff --git a/apps/documenteditor/main/app/view/StyleTitleDialog.js b/apps/documenteditor/main/app/view/StyleTitleDialog.js index 5855d3237..bbda408ea 100644 --- a/apps/documenteditor/main/app/view/StyleTitleDialog.js +++ b/apps/documenteditor/main/app/view/StyleTitleDialog.js @@ -45,11 +45,9 @@ define([ DE.Views.StyleTitleDialog = Common.UI.Window.extend(_.extend({ options: { width: 350, - height: 200, style: 'min-width: 230px;', cls: 'modal-dlg', - buttons: ['ok', 'cancel'], - footerCls: 'right' + buttons: ['ok', 'cancel'] }, initialize : function(options) { diff --git a/apps/documenteditor/main/app/view/TableFormulaDialog.js b/apps/documenteditor/main/app/view/TableFormulaDialog.js index ec6900ab3..d3410012e 100644 --- a/apps/documenteditor/main/app/view/TableFormulaDialog.js +++ b/apps/documenteditor/main/app/view/TableFormulaDialog.js @@ -48,8 +48,7 @@ define([ width: 300, style: 'min-width: 230px;', cls: 'modal-dlg', - buttons: ['ok', 'cancel'], - footerCls: 'right' + buttons: ['ok', 'cancel'] }, initialize : function(options) { diff --git a/apps/documenteditor/main/app/view/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index 6a26cf3f9..553f08134 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -246,6 +246,8 @@ define([ }, createDelayedControls: function() { + var me = this; + this.chHeader = new Common.UI.CheckBox({ el: $('#table-checkbox-header'), labelText: this.textHeader @@ -290,22 +292,22 @@ define([ this.chColBanded.on('change', _.bind(this.onCheckTemplateChange, this, 5)); var _arrBorderPosition = [ - ['l', 'btn-borders-small btn-position-left', 'table-button-border-left', this.tipLeft], - ['c','btn-borders-small btn-position-inner-vert', 'table-button-border-inner-vert', this.tipInnerVert], - ['r','btn-borders-small btn-position-right', 'table-button-border-right', this.tipRight], - ['t','btn-borders-small btn-position-top', 'table-button-border-top', this.tipTop], - ['m','btn-borders-small btn-position-inner-hor', 'table-button-border-inner-hor', this.tipInnerHor], - ['b', 'btn-borders-small btn-position-bottom', 'table-button-border-bottom', this.tipBottom], - ['cm', 'btn-borders-small btn-position-inner', 'table-button-border-inner', this.tipInner], - ['lrtb', 'btn-borders-small btn-position-outer', 'table-button-border-outer', this.tipOuter], - ['lrtbcm', 'btn-borders-small btn-position-all', 'table-button-border-all', this.tipAll], - ['', 'btn-borders-small btn-position-none', 'table-button-border-none', this.tipNone] + ['l', 'toolbar__icon btn-border-left', 'table-button-border-left', this.tipLeft], + ['c', 'toolbar__icon btn-border-insidevert', 'table-button-border-inner-vert', this.tipInnerVert], + ['r', 'toolbar__icon btn-border-right', 'table-button-border-right', this.tipRight], + ['t', 'toolbar__icon btn-border-top', 'table-button-border-top', this.tipTop], + ['m', 'toolbar__icon btn-border-insidehor', 'table-button-border-inner-hor', this.tipInnerHor], + ['b', 'toolbar__icon btn-border-bottom', 'table-button-border-bottom', this.tipBottom], + ['cm', 'toolbar__icon btn-border-inside', 'table-button-border-inner', this.tipInner], + ['lrtb', 'toolbar__icon btn-border-out', 'table-button-border-outer', this.tipOuter], + ['lrtbcm', 'toolbar__icon btn-border-all', 'table-button-border-all', this.tipAll], + ['', 'toolbar__icon btn-border-no', 'table-button-border-none', this.tipNone] ]; this._btnsBorderPosition = []; _.each(_arrBorderPosition, function(item, index, list){ var _btn = new Common.UI.Button({ - cls: 'btn-toolbar', + cls: 'btn-toolbar borders--small', iconCls: item[1], strId :item[0], hint: item[3] @@ -384,6 +386,7 @@ define([ _props.put_RowHeight(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this.api.tblApply(_props); }, this)); + this.numHeight.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.lockedControls.push(this.numHeight); this.spinners.push(this.numHeight); @@ -401,6 +404,7 @@ define([ _props.put_ColumnWidth(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this.api.tblApply(_props); }, this)); + this.numWidth.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.lockedControls.push(this.numWidth); this.spinners.push(this.numWidth); @@ -853,7 +857,7 @@ define([ tipInnerVert: 'Set Vertical Inner Lines Only', tipInnerHor: 'Set Horizontal Inner Lines Only', tipOuter: 'Set Outer Border Only', - textCellSize: 'Cell Size', + textCellSize: 'Rows & Columns Size', textHeight: 'Height', textWidth: 'Width', textDistributeRows: 'Distribute rows', diff --git a/apps/documenteditor/main/app/view/TextArtSettings.js b/apps/documenteditor/main/app/view/TextArtSettings.js index 4613bf022..603dfc809 100644 --- a/apps/documenteditor/main/app/view/TextArtSettings.js +++ b/apps/documenteditor/main/app/view/TextArtSettings.js @@ -232,7 +232,6 @@ define([ this.shapeprops.put_TextArtProperties(props); this.api.ImgApply(this.imgprops); } - this.fireEvent('editcomplete', this); }, onTransparencyChange: function(field, newValue, oldValue){ @@ -622,7 +621,7 @@ define([ var me = this; var colors = fill.get_colors(), positions = fill.get_positions(), - length = colors.length; + length = colors ? colors.length : this.GradColor.colors.length; this.sldrGradient.setThumbs(length); if (this.GradColor.colors.length>length) { this.GradColor.colors.splice(length, this.GradColor.colors.length - length); @@ -650,6 +649,10 @@ define([ me.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(me.GradColor.colors[index]) == 'object') ? me.GradColor.colors[index].color : me.GradColor.colors[index]), index); me.sldrGradient.setValue(index, me.GradColor.values[index]); } + if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; this.ShapeColor = {Value: 1, Color: this.GradColor.colors[0]}; } @@ -843,6 +846,7 @@ define([ minValue: 0 }); this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.lockedControls.push(this.numTransparency); this.sldrTransparency = new Common.UI.SingleSlider({ @@ -944,6 +948,16 @@ define([ me.GradColor.colors = colors; me.GradColor.currentIdx = currentIdx; }); + this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){ + me.GradColor.colors[index] = me.GradColor.colors[nearIndex]; + me.GradColor.currentIdx = index; + me.sldrGradient.addNewThumb(index, color); + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + }); this.lockedControls.push(this.sldrGradient); this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ diff --git a/apps/documenteditor/main/app/view/Toolbar.js b/apps/documenteditor/main/app/view/Toolbar.js index acdb1b86a..01efb6c28 100644 --- a/apps/documenteditor/main/app/view/Toolbar.js +++ b/apps/documenteditor/main/app/view/Toolbar.js @@ -124,7 +124,7 @@ define([ this.btnPrint = new Common.UI.Button({ id: 'id-toolbar-btn-print', cls: 'btn-toolbar', - iconCls: 'btn-print no-mask', + iconCls: 'toolbar__icon btn-print no-mask', signals: ['disabled'] }); this.toolbarControls.push(this.btnPrint); @@ -132,7 +132,7 @@ define([ this.btnSave = new Common.UI.Button({ id: 'id-toolbar-btn-save', cls: 'btn-toolbar', - iconCls: 'no-mask ' + this.btnSaveCls, + iconCls: 'toolbar__icon no-mask ' + this.btnSaveCls, signals: ['disabled'] }); this.toolbarControls.push(this.btnSave); @@ -141,7 +141,7 @@ define([ this.btnUndo = new Common.UI.Button({ id: 'id-toolbar-btn-undo', cls: 'btn-toolbar', - iconCls: 'btn-undo', + iconCls: 'toolbar__icon btn-undo', signals: ['disabled'] }); this.toolbarControls.push(this.btnUndo); @@ -149,7 +149,7 @@ define([ this.btnRedo = new Common.UI.Button({ id: 'id-toolbar-btn-redo', cls: 'btn-toolbar', - iconCls: 'btn-redo', + iconCls: 'toolbar__icon btn-redo', signals: ['disabled'] }); this.toolbarControls.push(this.btnRedo); @@ -157,35 +157,35 @@ define([ this.btnCopy = new Common.UI.Button({ id: 'id-toolbar-btn-copy', cls: 'btn-toolbar', - iconCls: 'btn-copy' + iconCls: 'toolbar__icon btn-copy' }); this.toolbarControls.push(this.btnCopy); this.btnPaste = new Common.UI.Button({ id: 'id-toolbar-btn-paste', cls: 'btn-toolbar', - iconCls: 'btn-paste' + iconCls: 'toolbar__icon btn-paste' }); this.paragraphControls.push(this.btnPaste); this.btnIncFontSize = new Common.UI.Button({ id: 'id-toolbar-btn-incfont', cls: 'btn-toolbar', - iconCls: 'btn-incfont' + iconCls: 'toolbar__icon btn-incfont' }); this.paragraphControls.push(this.btnIncFontSize); this.btnDecFontSize = new Common.UI.Button({ id: 'id-toolbar-btn-decfont', cls: 'btn-toolbar', - iconCls: 'btn-decfont' + iconCls: 'toolbar__icon btn-decfont' }); this.paragraphControls.push(this.btnDecFontSize); this.btnBold = new Common.UI.Button({ id: 'id-toolbar-btn-bold', cls: 'btn-toolbar', - iconCls: 'btn-bold', + iconCls: 'toolbar__icon btn-bold', enableToggle: true }); this.paragraphControls.push(this.btnBold); @@ -193,7 +193,7 @@ define([ this.btnItalic = new Common.UI.Button({ id: 'id-toolbar-btn-italic', cls: 'btn-toolbar', - iconCls: 'btn-italic', + iconCls: 'toolbar__icon btn-italic', enableToggle: true }); this.paragraphControls.push(this.btnItalic); @@ -201,7 +201,7 @@ define([ this.btnUnderline = new Common.UI.Button({ id: 'id-toolbar-btn-underline', cls: 'btn-toolbar', - iconCls: 'btn-underline', + iconCls: 'toolbar__icon btn-underline', enableToggle: true }); this.paragraphControls.push(this.btnUnderline); @@ -209,7 +209,7 @@ define([ this.btnStrikeout = new Common.UI.Button({ id: 'id-toolbar-btn-strikeout', cls: 'btn-toolbar', - iconCls: 'btn-strikeout', + iconCls: 'toolbar__icon btn-strikeout', enableToggle: true }); this.paragraphControls.push(this.btnStrikeout); @@ -217,7 +217,7 @@ define([ this.btnSuperscript = new Common.UI.Button({ id: 'id-toolbar-btn-superscript', cls: 'btn-toolbar', - iconCls: 'btn-superscript', + iconCls: 'toolbar__icon btn-superscript', enableToggle: true, toggleGroup: 'superscriptGroup' }); @@ -226,7 +226,7 @@ define([ this.btnSubscript = new Common.UI.Button({ id: 'id-toolbar-btn-subscript', cls: 'btn-toolbar', - iconCls: 'btn-subscript', + iconCls: 'toolbar__icon btn-subscript', enableToggle: true, toggleGroup: 'superscriptGroup' }); @@ -235,7 +235,7 @@ define([ this.btnHighlightColor = new Common.UI.Button({ id: 'id-toolbar-btn-highlight', cls: 'btn-toolbar', - iconCls: 'btn-highlight', + iconCls: 'toolbar__icon btn-highlight', enableToggle: true, allowDepress: true, split: true, @@ -257,7 +257,7 @@ define([ this.btnFontColor = new Common.UI.Button({ id: 'id-toolbar-btn-fontcolor', cls: 'btn-toolbar', - iconCls: 'btn-fontcolor', + iconCls: 'toolbar__icon btn-fontcolor', split: true, menu: new Common.UI.Menu({ items: [ @@ -277,7 +277,7 @@ define([ this.btnParagraphColor = new Common.UI.Button({ id: 'id-toolbar-btn-paracolor', cls: 'btn-toolbar', - iconCls: 'btn-paracolor', + iconCls: 'toolbar__icon btn-paracolor', split: true, menu: new Common.UI.Menu({ items: [ @@ -292,7 +292,7 @@ define([ this.btnAlignLeft = new Common.UI.Button({ id: 'id-toolbar-btn-align-left', cls: 'btn-toolbar', - iconCls: 'btn-align-left', + iconCls: 'toolbar__icon btn-align-left', enableToggle: true, allowDepress: false, toggleGroup: 'alignGroup' @@ -302,7 +302,7 @@ define([ this.btnAlignCenter = new Common.UI.Button({ id: 'id-toolbar-btn-align-center', cls: 'btn-toolbar', - iconCls: 'btn-align-center', + iconCls: 'toolbar__icon btn-align-center', enableToggle: true, allowDepress: false, toggleGroup: 'alignGroup' @@ -312,7 +312,7 @@ define([ this.btnAlignRight = new Common.UI.Button({ id: 'id-toolbar-btn-align-right', cls: 'btn-toolbar', - iconCls: 'btn-align-right', + iconCls: 'toolbar__icon btn-align-right', enableToggle: true, allowDepress: false, toggleGroup: 'alignGroup' @@ -322,77 +322,32 @@ define([ this.btnAlignJust = new Common.UI.Button({ id: 'id-toolbar-btn-align-just', cls: 'btn-toolbar', - iconCls: 'btn-align-just', + iconCls: 'toolbar__icon btn-align-just', enableToggle: true, allowDepress: false, toggleGroup: 'alignGroup' }); this.paragraphControls.push(this.btnAlignJust); - this.btnHorizontalAlign = new Common.UI.Button({ - id: 'id-toolbar-btn-halign', - cls: 'btn-toolbar', - iconCls: 'btn-align-left', - icls: 'btn-align-left', - menu: new Common.UI.Menu({ - cls: 'ppm-toolbar', - items: [ - { - caption: this.tipAlignLeft + Common.Utils.String.platformKey('Ctrl+L'), - iconCls: 'mnu-align-left', - icls: 'btn-align-left', - checkable: true, - toggleGroup: 'halignGroup', - checked: true, - value: 1 - }, - { - caption: this.tipAlignCenter + Common.Utils.String.platformKey('Ctrl+E'), - iconCls: 'mnu-align-center', - icls: 'btn-align-center', - checkable: true, - toggleGroup: 'halignGroup', - value: 2 - }, - { - caption: this.tipAlignRight + Common.Utils.String.platformKey('Ctrl+R'), - iconCls: 'mnu-align-right', - icls: 'btn-align-right', - checkable: true, - toggleGroup: 'halignGroup', - value: 0 - }, - { - caption: this.tipAlignJust + Common.Utils.String.platformKey('Ctrl+J'), - iconCls: 'mnu-align-just', - icls: 'btn-align-just', - checkable: true, - toggleGroup: 'halignGroup', - value: 3 - } - ] - }) - }); - this.paragraphControls.push(this.btnHorizontalAlign); this.btnDecLeftOffset = new Common.UI.Button({ id: 'id-toolbar-btn-decoffset', cls: 'btn-toolbar', - iconCls: 'btn-decoffset' + iconCls: 'toolbar__icon btn-decoffset' }); this.paragraphControls.push(this.btnDecLeftOffset); this.btnIncLeftOffset = new Common.UI.Button({ id: 'id-toolbar-btn-incoffset', cls: 'btn-toolbar', - iconCls: 'btn-incoffset' + iconCls: 'toolbar__icon btn-incoffset' }); this.paragraphControls.push(this.btnIncLeftOffset); this.btnLineSpace = new Common.UI.Button({ id: 'id-toolbar-btn-linespace', cls: 'btn-toolbar', - iconCls: 'btn-linespace', + iconCls: 'toolbar__icon btn-linespace', menu: new Common.UI.Menu({ style: 'min-width: 60px;', items: [ @@ -410,7 +365,7 @@ define([ this.btnShowHidenChars = new Common.UI.Button({ id: 'id-toolbar-btn-hidenchars', cls: 'btn-toolbar', - iconCls: 'btn-hidenchars', + iconCls: 'toolbar__icon btn-paragraph', enableToggle: true, split: true, menu: new Common.UI.Menu({ @@ -426,7 +381,7 @@ define([ this.btnMarkers = new Common.UI.Button({ id: 'id-toolbar-btn-markers', cls: 'btn-toolbar', - iconCls: 'btn-setmarkers', + iconCls: 'toolbar__icon btn-setmarkers', enableToggle: true, toggleGroup: 'markersGroup', split: true, @@ -438,7 +393,7 @@ define([ this.btnNumbers = new Common.UI.Button({ id: 'id-toolbar-btn-numbering', cls: 'btn-toolbar', - iconCls: 'btn-numbering', + iconCls: 'toolbar__icon btn-numbering', enableToggle: true, toggleGroup: 'markersGroup', split: true, @@ -450,7 +405,7 @@ define([ this.btnMultilevels = new Common.UI.Button({ id: 'id-toolbar-btn-multilevels', cls: 'btn-toolbar', - iconCls: 'btn-multilevels', + iconCls: 'toolbar__icon btn-multilevels', menu: true }); this.paragraphControls.push(this.btnMultilevels); @@ -475,12 +430,14 @@ define([ this.btnInsertTable = new Common.UI.Button({ id: 'tlbtn-inserttable', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-inserttable', + iconCls: 'toolbar__icon btn-inserttable', caption: me.capBtnInsTable, menu: new Common.UI.Menu({ items: [ {template: _.template('
    ')}, - {caption: this.mniCustomTable, value: 'custom'} + {caption: this.mniCustomTable, value: 'custom'}, + {caption: this.mniDrawTable, value: 'draw', checkable: true}, + {caption: this.mniEraseTable, value: 'erase', checkable: true} ] }) }); @@ -489,7 +446,7 @@ define([ this.btnInsertImage = new Common.UI.Button({ id: 'tlbtn-insertimage', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-insertimage', + iconCls: 'toolbar__icon btn-insertimage', caption: me.capBtnInsImage, menu: new Common.UI.Menu({ items: [ @@ -505,7 +462,7 @@ define([ id: 'tlbtn-insertchart', cls: 'btn-toolbar x-huge icon-top', caption: me.capBtnInsChart, - iconCls: 'btn-insertchart', + iconCls: 'toolbar__icon btn-insertchart', menu: true }); this.paragraphControls.push(this.btnInsertChart); @@ -513,7 +470,7 @@ define([ this.btnInsertText = new Common.UI.Button({ id: 'tlbtn-inserttext', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-text', + iconCls: 'toolbar__icon btn-text', caption: me.capBtnInsTextbox, enableToggle: true }); @@ -521,7 +478,7 @@ define([ this.btnInsertTextArt = new Common.UI.Button({ id: 'tlbtn-inserttextart', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-textart', + iconCls: 'toolbar__icon btn-textart', caption: me.capBtnInsTextart, menu: new Common.UI.Menu({ cls: 'menu-shapes', @@ -535,7 +492,7 @@ define([ this.btnEditHeader = new Common.UI.Button({ id: 'id-toolbar-btn-editheader', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-editheader', + iconCls: 'toolbar__icon btn-editheader', caption: me.capBtnInsHeader, menu: true }); @@ -558,7 +515,7 @@ define([ this.btnBlankPage = new Common.UI.Button({ id: 'id-toolbar-btn-blankpage', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-blankpage', + iconCls: 'toolbar__icon btn-blankpage', caption: me.capBtnBlankPage }); this.paragraphControls.push(this.btnBlankPage); @@ -566,7 +523,7 @@ define([ this.btnInsertShape = new Common.UI.Button({ id: 'tlbtn-insertshape', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-insertshape', + iconCls: 'toolbar__icon btn-insertshape', caption: me.capBtnInsShape, enableToggle: true, menu: new Common.UI.Menu({cls: 'menu-shapes'}) @@ -576,40 +533,51 @@ define([ this.btnInsertEquation = new Common.UI.Button({ id: 'tlbtn-insertequation', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-insertequation', + iconCls: 'toolbar__icon btn-insertequation', caption: me.capBtnInsEquation, split: true, menu: new Common.UI.Menu({cls: 'menu-shapes'}) }); this.paragraphControls.push(this.btnInsertEquation); + this.btnInsertSymbol = new Common.UI.Button({ + id: 'tlbtn-insertsymbol', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-symbol', + caption: me.capBtnInsSymbol + }); + this.paragraphControls.push(this.btnInsertSymbol); + this.btnDropCap = new Common.UI.Button({ id: 'tlbtn-dropcap', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-dropcap', + iconCls: 'toolbar__icon btn-dropcap', caption: me.capBtnInsDropcap, menu: new Common.UI.Menu({ cls: 'ppm-toolbar', items: [ { caption: this.textNone, - iconCls: 'mnu-dropcap-none', + iconCls: 'menu__icon columns-one', checkable: true, + checkmark: false, toggleGroup: 'menuDropCap', value: Asc.c_oAscDropCap.None, checked: true }, { caption: this.textInText, - iconCls: 'mnu-dropcap-intext', + iconCls: 'menu__icon dropcap-intext', checkable: true, + checkmark: false, toggleGroup: 'menuDropCap', value: Asc.c_oAscDropCap.Drop }, { caption: this.textInMargin, - iconCls: 'mnu-dropcap-inmargin', + iconCls: 'menu__icon dropcap-inmargin', checkable: true, + checkmark: false, toggleGroup: 'menuDropCap', value: Asc.c_oAscDropCap.Margin }, @@ -623,25 +591,50 @@ define([ this.btnContentControls = new Common.UI.Button({ id: 'tlbtn-controls', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-controls', + iconCls: 'toolbar__icon btn-controls', caption: me.capBtnInsControls, menu: new Common.UI.Menu({ cls: 'ppm-toolbar', items: [ { caption: this.textPlainControl, - iconCls: 'mnu-control-plain', - value: Asc.c_oAscSdtLevelType.Inline + // iconCls: 'menu__icon cc-plaintext', + value: 'plain' }, { caption: this.textRichControl, - iconCls: 'mnu-control-rich', - value: Asc.c_oAscSdtLevelType.Block + // iconCls: 'menu__icon cc-richtext', + value: 'rich' + }, + { + caption: this.textPictureControl, + // iconCls: 'mnu-control-rich', + value: 'picture' + }, + { + caption: this.textComboboxControl, + // iconCls: 'mnu-control-rich', + value: 'combobox' + }, + { + caption: this.textDropdownControl, + // iconCls: 'mnu-control-rich', + value: 'dropdown' + }, + { + caption: this.textDateControl, + // iconCls: 'mnu-control-rich', + value: 'date' + }, + { + caption: this.textCheckboxControl, + // iconCls: 'mnu-control-rich', + value: 'checkbox' }, {caption: '--'}, { caption: this.textRemoveControl, - iconCls: 'mnu-control-remove', + // iconCls: 'menu__icon cc-remove', value: 'remove' }, {caption: '--'}, @@ -669,47 +662,52 @@ define([ ] }) }); - this.paragraphControls.push(this.btnContentControls); + // this.paragraphControls.push(this.btnContentControls); this.btnColumns = new Common.UI.Button({ id: 'tlbtn-columns', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-columns', + iconCls: 'toolbar__icon btn-columns', caption: me.capBtnColumns, menu: new Common.UI.Menu({ cls: 'ppm-toolbar', items: [ { caption: this.textColumnsOne, - iconCls: 'mnu-columns-one', + iconCls: 'menu__icon columns-one', checkable: true, + checkmark: false, toggleGroup: 'menuColumns', value: 0 }, { caption: this.textColumnsTwo, - iconCls: 'mnu-columns-two', + iconCls: 'menu__icon columns-two', checkable: true, + checkmark: false, toggleGroup: 'menuColumns', value: 1 }, { caption: this.textColumnsThree, - iconCls: 'mnu-columns-three', + iconCls: 'menu__icon columns-three', checkable: true, + checkmark: false, toggleGroup: 'menuColumns', value: 2 }, { caption: this.textColumnsLeft, - iconCls: 'mnu-columns-left', + iconCls: 'menu__icon columns-left', + checkmark: false, checkable: true, toggleGroup: 'menuColumns', value: 3 }, { caption: this.textColumnsRight, - iconCls: 'mnu-columns-right', + iconCls: 'menu__icon columns-right', + checkmark: false, checkable: true, toggleGroup: 'menuColumns', value: 4 @@ -724,22 +722,24 @@ define([ this.btnPageOrient = new Common.UI.Button({ id: 'tlbtn-pageorient', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-pageorient', + iconCls: 'toolbar__icon btn-pageorient', caption: me.capBtnPageOrient, menu: new Common.UI.Menu({ cls: 'ppm-toolbar', items: [ { caption: this.textPortrait, - iconCls: 'mnu-orient-portrait', + iconCls: 'menu__icon page-portrait', checkable: true, + checkmark: false, toggleGroup: 'menuOrient', value: true }, { caption: this.textLandscape, - iconCls: 'mnu-orient-landscape', + iconCls: 'menu__icon page-landscape', checkable: true, + checkmark: false, toggleGroup: 'menuOrient', value: false } @@ -760,7 +760,7 @@ define([ this.btnPageMargins = new Common.UI.Button({ id: 'tlbtn-pagemargins', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-pagemargins', + iconCls: 'toolbar__icon btn-pagemargins', caption: me.capBtnMargins, menu: new Common.UI.Menu({ items: [ @@ -819,7 +819,7 @@ define([ this.btnPageSize = new Common.UI.Button({ id: 'tlbtn-pagesize', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-pagesize', + iconCls: 'toolbar__icon btn-pagesize', caption: me.capBtnPageSize, menu: new Common.UI.Menu({ restoreHeight: true, @@ -939,14 +939,14 @@ define([ this.btnClearStyle = new Common.UI.Button({ id: 'id-toolbar-btn-clearstyle', cls: 'btn-toolbar', - iconCls: 'btn-clearstyle' + iconCls: 'toolbar__icon btn-clearstyle' }); this.toolbarControls.push(this.btnClearStyle); this.btnCopyStyle = new Common.UI.Button({ id: 'id-toolbar-btn-copystyle', cls: 'btn-toolbar', - iconCls: 'btn-copystyle', + iconCls: 'toolbar__icon btn-copystyle', enableToggle: true }); this.toolbarControls.push(this.btnCopyStyle); @@ -954,7 +954,7 @@ define([ this.btnColorSchemas = new Common.UI.Button({ id: 'id-toolbar-btn-colorschemas', cls: 'btn-toolbar', - iconCls: 'btn-colorschemas', + iconCls: 'toolbar__icon btn-colorschemas', menu: new Common.UI.Menu({ items: [], restoreHeight: true @@ -965,46 +965,46 @@ define([ this.btnMailRecepients = new Common.UI.Button({ id: 'id-toolbar-btn-mailrecepients', cls: 'btn-toolbar', - iconCls: 'btn-mailrecepients' + iconCls: 'toolbar__icon btn-mailmerge' }); me.btnImgAlign = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-img-align', + iconCls: 'toolbar__icon btn-img-align', caption: me.capImgAlign, menu: true }); me.btnImgGroup = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-img-group', + iconCls: 'toolbar__icon btn-img-group', caption: me.capImgGroup, menu: true }); me.btnImgForward = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-img-frwd', + iconCls: 'toolbar__icon btn-img-frwd', caption: me.capImgForward, split: true, menu: true }); me.btnImgBackward = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-img-bkwd', + iconCls: 'toolbar__icon btn-img-bkwd', caption: me.capImgBackward, split: true, menu: true }); me.btnImgWrapping = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-img-wrap', + iconCls: 'toolbar__icon btn-img-wrap', caption: me.capImgWrapping, menu: true }); me.btnWatermark = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-watermark', + iconCls: 'toolbar__icon btn-watermark', caption: me.capBtnWatermark, menu: new Common.UI.Menu({ cls: 'ppm-toolbar', @@ -1309,6 +1309,7 @@ define([ _injectComponent('#slot-btn-blankpage', this.btnBlankPage); _injectComponent('#slot-btn-insshape', this.btnInsertShape); _injectComponent('#slot-btn-insequation', this.btnInsertEquation); + _injectComponent('#slot-btn-inssymbol', this.btnInsertSymbol); _injectComponent('#slot-btn-pageorient', this.btnPageOrient); _injectComponent('#slot-btn-pagemargins', this.btnPageMargins); _injectComponent('#slot-btn-pagesize', this.btnPageSize); @@ -1317,7 +1318,6 @@ define([ _injectComponent('#slot-btn-colorschemas', this.btnColorSchemas); _injectComponent('#slot-btn-paracolor', this.btnParagraphColor); _injectComponent('#slot-field-styles', this.listStyles); - _injectComponent('#slot-btn-halign', this.btnHorizontalAlign); _injectComponent('#slot-btn-mailrecepients', this.btnMailRecepients); _injectComponent('#slot-img-align', this.btnImgAlign); _injectComponent('#slot-img-group', this.btnImgGroup); @@ -1326,7 +1326,7 @@ define([ _injectComponent('#slot-img-wrapping', this.btnImgWrapping); _injectComponent('#slot-btn-watermark', this.btnWatermark); - this.btnsPageBreak = Common.Utils.injectButtons($host.find('.btn-slot.btn-pagebreak'), '', 'btn-pagebreak', this.capBtnInsPagebreak, undefined, true, true); + this.btnsPageBreak = Common.Utils.injectButtons($host.find('.btn-slot.btn-pagebreak'), '', 'toolbar__icon btn-pagebreak', this.capBtnInsPagebreak, undefined, true, true); Array.prototype.push.apply(this.paragraphControls, this.btnsPageBreak); return $host; @@ -1368,11 +1368,11 @@ define([ me.btnImgForward.setMenu(new Common.UI.Menu({ items: [{ caption : _holder_view.textArrangeFront, - iconCls : 'mnu-arrange-front', + iconCls : 'menu__icon arrange-front', valign : Asc.c_oAscChangeLevel.BringToFront }, { caption : _holder_view.textArrangeForward, - iconCls : 'mnu-arrange-forward', + iconCls : 'menu__icon arrange-forward', valign : Asc.c_oAscChangeLevel.BringForward } ]}) @@ -1382,11 +1382,11 @@ define([ me.btnImgBackward.setMenu(new Common.UI.Menu({ items: [{ caption : _holder_view.textArrangeBack, - iconCls : 'mnu-arrange-back', + iconCls : 'menu__icon arrange-back', valign : Asc.c_oAscChangeLevel.SendToBack }, { caption : _holder_view.textArrangeBackward, - iconCls : 'mnu-arrange-backward', + iconCls : 'menu__icon arrange-backward', valign : Asc.c_oAscChangeLevel.BringBackward }] })); @@ -1420,39 +1420,39 @@ define([ me.mniDistribHor = new Common.UI.MenuItem({ caption: me.txtDistribHor, - iconCls: 'mnu-distrib-hor', + iconCls: 'menu__icon shape-distribute-hor', value: 6 }); me.mniDistribVert = new Common.UI.MenuItem({ caption: me.txtDistribVert, - iconCls: 'mnu-distrib-vert', + iconCls: 'menu__icon shape-distribute-vert', value: 7 }); me.btnImgAlign.setMenu(new Common.UI.Menu({ items: [{ caption : _holder_view.textShapeAlignLeft, - iconCls : 'mnu-img-align-left', + iconCls : 'menu__icon shape-align-left', value: Asc.c_oAscAlignShapeType.ALIGN_LEFT }, { caption : _holder_view.textShapeAlignCenter, - iconCls : 'mnu-img-align-center', + iconCls : 'menu__icon shape-align-center', value: Asc.c_oAscAlignShapeType.ALIGN_CENTER }, { caption : _holder_view.textShapeAlignRight, - iconCls : 'mnu-img-align-right', + iconCls : 'menu__icon shape-align-right', value: Asc.c_oAscAlignShapeType.ALIGN_RIGHT }, { caption : _holder_view.textShapeAlignTop, - iconCls : 'mnu-img-align-top', + iconCls : 'menu__icon shape-align-top', value: Asc.c_oAscAlignShapeType.ALIGN_TOP }, { caption : _holder_view.textShapeAlignMiddle, - iconCls : 'mnu-img-align-middle', + iconCls : 'menu__icon shape-align-middle', value: Asc.c_oAscAlignShapeType.ALIGN_MIDDLE }, { caption : _holder_view.textShapeAlignBottom, - iconCls : 'mnu-img-align-bottom', + iconCls : 'menu__icon shape-align-bottom', value: Asc.c_oAscAlignShapeType.ALIGN_BOTTOM }, {caption: '--'}, @@ -1469,11 +1469,11 @@ define([ me.btnImgGroup.setMenu(new Common.UI.Menu({ items: [{ caption : _holder_view.txtGroup, - iconCls : 'mnu-arrange-group', + iconCls : 'menu__icon shape-group', groupval: 1 }, { caption : _holder_view.txtUngroup, - iconCls : 'mnu-arrange-ungroup', + iconCls : 'menu__icon shape-ungroup', groupval: -1 }] })); @@ -1483,45 +1483,52 @@ define([ cls: 'ppm-toolbar', items: [{ caption : _holder_view.txtInline, - iconCls : 'mnu-wrap-inline', + iconCls : 'menu__icon wrap-inline', toggleGroup : 'imgwrapping', wrapType : Asc.c_oAscWrapStyle2.Inline, + checkmark : false, checkable : true }, { caption : _holder_view.txtSquare, - iconCls : 'mnu-wrap-square', + iconCls : 'menu__icon wrap-square', toggleGroup : 'imgwrapping', wrapType : Asc.c_oAscWrapStyle2.Square, + checkmark : false, checkable : true }, { caption : _holder_view.txtTight, - iconCls : 'mnu-wrap-tight', + iconCls : 'menu__icon wrap-tight', toggleGroup : 'imgwrapping', wrapType : Asc.c_oAscWrapStyle2.Tight, + checkmark : false, checkable : true }, { caption : _holder_view.txtThrough, - iconCls : 'mnu-wrap-through', + iconCls : 'menu__icon wrap-through', toggleGroup : 'imgwrapping', wrapType : Asc.c_oAscWrapStyle2.Through, + checkmark : false, checkable : true }, { caption : _holder_view.txtTopAndBottom, - iconCls : 'mnu-wrap-topAndBottom', + iconCls : 'menu__icon wrap-topandbottom', toggleGroup : 'imgwrapping', wrapType : Asc.c_oAscWrapStyle2.TopAndBottom, + checkmark : false, checkable : true }, { caption : _holder_view.txtInFront, - iconCls : 'mnu-wrap-inFront', + iconCls : 'menu__icon wrap-infront', toggleGroup : 'imgwrapping', wrapType : Asc.c_oAscWrapStyle2.InFront, + checkmark : false, checkable : true }, { caption : _holder_view.txtBehind, - iconCls : 'mnu-wrap-behind', + iconCls : 'menu__icon wrap-behind', toggleGroup : 'imgwrapping', wrapType : Asc.c_oAscWrapStyle2.Behind, + checkmark : false, checkable : true } ] @@ -1562,7 +1569,6 @@ define([ this.btnAlignCenter.updateHint(this.tipAlignCenter + Common.Utils.String.platformKey('Ctrl+E')); this.btnAlignRight.updateHint(this.tipAlignRight + Common.Utils.String.platformKey('Ctrl+R')); this.btnAlignJust.updateHint(this.tipAlignJust + Common.Utils.String.platformKey('Ctrl+J')); - this.btnHorizontalAlign.updateHint(this.tipHAligh); this.btnDecLeftOffset.updateHint(this.tipDecPrLeft + Common.Utils.String.platformKey('Ctrl+Shift+M')); this.btnIncLeftOffset.updateHint(this.tipIncPrLeft + Common.Utils.String.platformKey('Ctrl+M')); this.btnLineSpace.updateHint(this.tipLineSpace); @@ -1579,6 +1585,7 @@ define([ this.btnBlankPage.updateHint(this.tipBlankPage); this.btnInsertShape.updateHint(this.tipInsertShape); this.btnInsertEquation.updateHint(this.tipInsertEquation); + this.btnInsertSymbol.updateHint(this.tipInsertSymbol); this.btnDropCap.updateHint(this.tipDropCap); this.btnContentControls.updateHint(this.tipControls); this.btnColumns.updateHint(this.tipColumns); @@ -1664,48 +1671,8 @@ define([ parentMenu: menu, showLast: false, restoreHeight: 421, - groups: new Common.UI.DataViewGroupStore([ - {id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts}, - {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, inline: true}, - {id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true}, - {id: 'menu-chart-group-stock', caption: me.textStock, inline: true} - // {id: 'menu-chart-group-surface', caption: me.textSurface} - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} - - ]), + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData(true)), + store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()), itemTemplate: _.template('
    ') }); picker.on('item:click', function (picker, item, record, e) { @@ -1958,8 +1925,7 @@ define([ this.btnMailRecepients.setVisible(mode.canCoAuthoring == true && mode.canUseMailMerge); this.listStylesAdditionalMenuItem.setVisible(mode.canEditStyles); - this.btnContentControls.menu.items[4].setVisible(mode.canEditContentControl); - this.btnContentControls.menu.items[5].setVisible(mode.canEditContentControl); + this.btnContentControls.menu.items[10].setVisible(mode.canEditContentControl); this.mnuInsertImage.items[2].setVisible(this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1); }, @@ -2025,7 +1991,7 @@ define([ } this._state.hasCollaborativeChanges = true; - this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass('btn-synch'); + this.btnCollabChanges.cmpEl.addClass('notify'); if (this.showSynchTip) { this.btnCollabChanges.updateHint(''); if (this.synchTooltip === undefined) @@ -2061,8 +2027,8 @@ define([ if ( !this._state.previewmode && this.btnCollabChanges.rendered ) { var me = this; - if ( me.btnCollabChanges.$icon.hasClass('btn-synch') ) { - me.btnCollabChanges.$icon.removeClass('btn-synch').addClass(me.btnSaveCls); + if ( me.btnCollabChanges.cmpEl.hasClass('notify') ) { + me.btnCollabChanges.cmpEl.removeClass('notify'); if (this.synchTooltip) this.synchTooltip.hide(); this.btnCollabChanges.updateHint(this.btnSaveTip); @@ -2085,12 +2051,8 @@ define([ var cls = (length > 1) ? 'btn-save-coauth' : 'btn-save'; if ( cls !== me.btnSaveCls && me.btnCollabChanges.rendered ) { me.btnSaveTip = ((length > 1) ? me.tipSaveCoauth : me.tipSave ) + Common.Utils.String.platformKey('Ctrl+S'); - - if ( !me.btnCollabChanges.$icon.hasClass('btn-synch') ) { - me.btnCollabChanges.$icon.removeClass(me.btnSaveCls).addClass(cls); - me.btnCollabChanges.updateHint(me.btnSaveTip); - - } + me.btnCollabChanges.updateHint(me.btnSaveTip); + me.btnCollabChanges.$icon.removeClass(me.btnSaveCls).addClass(cls); me.btnSaveCls = cls; } }, @@ -2179,8 +2141,8 @@ define([ tipBack: 'Back', tipInsertShape: 'Insert Autoshape', tipInsertEquation: 'Insert Equation', - mniImageFromFile: 'Image from file', - mniImageFromUrl: 'Image from url', + mniImageFromFile: 'Image from File', + mniImageFromUrl: 'Image from URL', mniCustomTable: 'Insert Custom Table', textTitleError: 'Error', textInsertPageNumber: 'Insert page number', @@ -2194,17 +2156,9 @@ define([ textNewColor: 'Add New Custom Color', textAutoColor: 'Automatic', tipInsertChart: 'Insert Chart', - textLine: 'Line', - textColumn: 'Column', - textBar: 'Bar', - textArea: 'Area', - textPie: 'Pie', - textPoint: 'XY (Scatter)', - textStock: 'Stock', tipColorSchemas: 'Change Color Scheme', tipInsertText: 'Insert Text', tipInsertTextArt: 'Insert Text Art', - tipHAligh: 'Horizontal Align', mniEditDropCap: 'Drop Cap Settings', textNone: 'None', textInText: 'In Text', @@ -2268,7 +2222,6 @@ define([ textPortrait: 'Portrait', textLandscape: 'Landscape', textInsertPageCount: 'Insert number of pages', - textCharts: 'Charts', tipChangeChart: 'Change Chart Type', capBtnInsPagebreak: 'Page Break', capBtnInsImage: 'Image', @@ -2301,7 +2254,6 @@ define([ capImgWrapping: 'Wrapping', capBtnComment: 'Comment', textColumnsCustom: 'Custom Columns', - textSurface: 'Surface', textTabCollaboration: 'Collaboration', textTabProtect: 'Protection', textTabLinks: 'References', @@ -2324,7 +2276,17 @@ define([ capBtnWatermark: 'Watermark', textEditWatermark: 'Custom Watermark', textRemWatermark: 'Remove Watermark', - tipWatermark: 'Edit watermark' + tipWatermark: 'Edit watermark', + textPictureControl: 'Picture', + textComboboxControl: 'Combo box', + textCheckboxControl: 'Check box', + textDropdownControl: 'Drop-down list', + textDateControl: 'Date', + capBtnAddComment: 'Add Comment', + capBtnInsSymbol: 'Symbol', + tipInsertSymbol: 'Insert symbol', + mniDrawTable: 'Draw Table', + mniEraseTable: 'Erase Table' } })(), DE.Views.Toolbar || {})); }); diff --git a/apps/documenteditor/main/app/view/WatermarkSettingsDialog.js b/apps/documenteditor/main/app/view/WatermarkSettingsDialog.js index 0ec62b179..c23826bb2 100644 --- a/apps/documenteditor/main/app/view/WatermarkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/WatermarkSettingsDialog.js @@ -266,7 +266,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template', this.btnBold = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-bold', + iconCls: 'toolbar__icon btn-bold', enableToggle: true, hint: this.textBold }); @@ -275,7 +275,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template', this.btnItalic = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-italic', + iconCls: 'toolbar__icon btn-italic', enableToggle: true, hint: this.textItalic }); @@ -293,7 +293,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template', this.btnStrikeout = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-strikeout', + iconCls: 'toolbar__icon btn-strikeout', enableToggle: true, hint: this.textStrikeout }); @@ -318,7 +318,7 @@ define(['text!documenteditor/main/app/template/WatermarkSettings.template', }; this.btnTextColor = new Common.UI.Button({ cls : 'btn-toolbar', - iconCls : 'btn-fontcolor', + iconCls : 'toolbar__icon btn-fontcolor', hint : this.textColor, menu : new Common.UI.Menu({ items: [ diff --git a/apps/documenteditor/main/index.html b/apps/documenteditor/main/index.html index 93e36bc17..b5d3c4ecb 100644 --- a/apps/documenteditor/main/index.html +++ b/apps/documenteditor/main/index.html @@ -18,19 +18,20 @@ width: 100%; overflow: hidden; border: none; - background-color: #f4f4f4; + background: #e2e2e2; z-index: 1001; } .loadmask > .brendpanel { width: 100%; - height: 56px; + min-height: 32px; background: #446995; } .loadmask > .brendpanel > div { display: flex; align-items: center; + height: 28px; } .loadmask > .brendpanel .spacer { @@ -50,15 +51,6 @@ opacity: 0; } - .loadmask > .brendpanel .circle { - vertical-align: middle; - width: 20px; - height: 20px; - border-radius: 12px; - margin: 4px 10px; - background: rgba(255, 255, 255, 0.2); - } - .loadmask > .brendpanel .rect { vertical-align: middle; width: 50px; @@ -69,8 +61,8 @@ } .loadmask > .sktoolbar { - background: #fafafa; - border-bottom: 1px solid #e2e2e2; + background: #f1f1f1; + border-bottom: 1px solid #cfcfcf; height: 46px; padding: 10px 12px; box-sizing: content-box; @@ -81,11 +73,6 @@ padding: 0; white-space: nowrap; position: relative; - - -webkit-animation: flickerAnimation 2s infinite ease-in-out; - -moz-animation: flickerAnimation 2s infinite ease-in-out; - -o-animation: flickerAnimation 2s infinite ease-in-out; - animation: flickerAnimation 2s infinite ease-in-out; } .loadmask > .sktoolbar li { @@ -114,10 +101,10 @@ .loadmask > .placeholder { background: #fbfbfb; - width: 796px; + width: 794px; margin: 46px auto; height: 100%; - border: 1px solid #dfdfdf; + border: 1px solid #bebebe; padding-top: 50px; } @@ -135,24 +122,24 @@ } @keyframes flickerAnimation { - 0% { opacity:0.1; } + 0% { opacity:0.5; } 50% { opacity:1; } - 100% { opacity:0.1; } + 100% { opacity:0.5; } } @-o-keyframes flickerAnimation{ - 0% { opacity:0.1; } + 0% { opacity:0.5; } 50% { opacity:1; } - 100% { opacity:0.1; } + 100% { opacity:0.5; } } @-moz-keyframes flickerAnimation{ - 0% { opacity:0.1; } + 0% { opacity:0.5; } 50% { opacity:1; } - 100% { opacity:0.1; } + 100% { opacity:0.5; } } @-webkit-keyframes flickerAnimation{ - 0% { opacity:0.1; } + 0% { opacity:0.5; } 50% { opacity:1; } - 100% { opacity:0.1; } + 100% { opacity:0.5; } } @@ -222,7 +209,7 @@
    -
    +
    @@ -235,6 +222,18 @@
    + @@ -266,15 +266,15 @@ - + - + -
    +
    - + - + - + - + - + - + diff --git a/apps/presentationeditor/embed/index_loader.html b/apps/presentationeditor/embed/index_loader.html index e82a7d950..53fb0a0bd 100644 --- a/apps/presentationeditor/embed/index_loader.html +++ b/apps/presentationeditor/embed/index_loader.html @@ -189,7 +189,7 @@ - + - + diff --git a/apps/presentationeditor/embed/js/ApplicationController.js b/apps/presentationeditor/embed/js/ApplicationController.js index a140f01a6..6baf1fc98 100644 --- a/apps/presentationeditor/embed/js/ApplicationController.js +++ b/apps/presentationeditor/embed/js/ApplicationController.js @@ -76,7 +76,7 @@ PE.ApplicationController = new(function(){ $('#editor_sdk').addClass('top'); } - if (config.canBackToFolder === false || !(config.customization && config.customization.goback && config.customization.goback.url)) { + if (config.canBackToFolder === false || !(config.customization && config.customization.goback && (config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose))) { $('#id-btn-close').hide(); // Hide last separator @@ -111,8 +111,6 @@ PE.ApplicationController = new(function(){ } embedConfig.docTitle = docConfig.title; - if (!embedConfig.saveUrl && permissions.print === false) - $('#idt-copy').hide(); } } @@ -225,6 +223,9 @@ PE.ApplicationController = new(function(){ var zf = (config.customization && config.customization.zoom ? parseInt(config.customization.zoom) : -1); (zf == -1) ? api.zoomFitToPage() : ((zf == -2) ? api.zoomFitToWidth() : api.zoom(zf>0 ? zf : 100)); + if (!embedConfig.saveUrl && permissions.print === false) + $('#idt-download').hide(); + if ( !embedConfig.shareUrl ) $('#idt-share').hide(); @@ -234,6 +235,9 @@ PE.ApplicationController = new(function(){ if ( !embedConfig.fullscreenUrl ) $('#idt-fullscreen').hide(); + if ( !embedConfig.saveUrl && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl) + $('#box-tools').addClass('hidden'); + common.controller.modals.attach({ share: '#idt-share', embed: '#idt-embed' @@ -310,8 +314,12 @@ PE.ApplicationController = new(function(){ }); $('#id-btn-close').on('click', function(){ - if (config.customization && config.customization.goback && config.customization.goback.url) - window.parent.location.href = config.customization.goback.url; + if (config.customization && config.customization.goback) { + if (config.customization.goback.requestClose && config.canRequestClose) + Common.Gateway.requestClose(); + else if (config.customization.goback.url) + window.parent.location.href = config.customization.goback.url; + } }); $('#btn-left').on('click', function(){ @@ -502,6 +510,10 @@ PE.ApplicationController = new(function(){ message = me.errorFileSizeExceed; break; + case Asc.c_oAscError.ID.UpdateVersion: + message = me.errorUpdateVersionOnDisconnect; + break; + default: message = me.errorDefaultMessage.replace('%1', id); break; @@ -629,6 +641,7 @@ PE.ApplicationController = new(function(){ waitText: 'Please, wait...', textLoadingDocument: 'Loading presentation', txtClose: 'Close', - errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.' + errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.', + errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.' } })(); diff --git a/apps/presentationeditor/embed/locale/en.json b/apps/presentationeditor/embed/locale/en.json index a12071d1d..62e07cbb0 100644 --- a/apps/presentationeditor/embed/locale/en.json +++ b/apps/presentationeditor/embed/locale/en.json @@ -22,6 +22,7 @@ "PE.ApplicationController.unknownErrorText": "Unknown error.", "PE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.", "PE.ApplicationController.waitText": "Please, wait...", + "PE.ApplicationController.errorUpdateVersionOnDisconnect": "Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.", "PE.ApplicationView.txtDownload": "Download", "PE.ApplicationView.txtEmbed": "Embed", "PE.ApplicationView.txtFullScreen": "Full Screen", diff --git a/apps/presentationeditor/embed/locale/fr.json b/apps/presentationeditor/embed/locale/fr.json index 59e98e217..9fb821b58 100644 --- a/apps/presentationeditor/embed/locale/fr.json +++ b/apps/presentationeditor/embed/locale/fr.json @@ -12,6 +12,7 @@ "PE.ApplicationController.errorAccessDeny": "Vous tentez d'exéсuter une action pour laquelle vous ne disposez pas des droits.
    Veuillez contacter l'administrateur de Document Server.", "PE.ApplicationController.errorDefaultMessage": "Code d'erreur: %1", "PE.ApplicationController.errorFilePassProtect": "Le fichier est protégé par le mot de passe et ne peut pas être ouvert.", + "PE.ApplicationController.errorFileSizeExceed": "La taille du fichier dépasse les limites établies sur votre serveur.
    Veuillez contacter votre administrateur de Document Server pour obtenir plus d'information. ", "PE.ApplicationController.errorUserDrop": "Impossible d'accéder au fichier.", "PE.ApplicationController.notcriticalErrorTitle": "Avertissement", "PE.ApplicationController.scriptLoadError": "La connexion est trop lente, certains éléments ne peuvent pas être chargés. Veuillez recharger la page.", diff --git a/apps/presentationeditor/embed/locale/it.json b/apps/presentationeditor/embed/locale/it.json index 1847821b7..b20d6a18a 100644 --- a/apps/presentationeditor/embed/locale/it.json +++ b/apps/presentationeditor/embed/locale/it.json @@ -12,6 +12,7 @@ "PE.ApplicationController.errorAccessDeny": "Stai tentando di eseguire un'azione per la quale non disponi di permessi sufficienti.
    Si prega di contattare l'amministratore del Server dei Documenti.", "PE.ApplicationController.errorDefaultMessage": "Codice errore: %1", "PE.ApplicationController.errorFilePassProtect": "Il file è protetto da una password. Impossibile aprirlo.", + "PE.ApplicationController.errorFileSizeExceed": "La dimensione del file supera la limitazione impostata per il tuo server.
    Per i dettagli, contatta l'amministratore del Document server.", "PE.ApplicationController.errorUserDrop": "Impossibile accedere al file subito.", "PE.ApplicationController.notcriticalErrorTitle": "Avviso", "PE.ApplicationController.scriptLoadError": "La connessione è troppo lenta, alcuni componenti non possono essere caricati. Si prega di ricaricare la pagina.", diff --git a/apps/presentationeditor/embed/locale/ru.json b/apps/presentationeditor/embed/locale/ru.json index e40b0b493..5fdeb0973 100644 --- a/apps/presentationeditor/embed/locale/ru.json +++ b/apps/presentationeditor/embed/locale/ru.json @@ -12,6 +12,7 @@ "PE.ApplicationController.errorAccessDeny": "Вы пытаетесь выполнить действие, на которое у вас нет прав.
    Пожалуйста, обратитесь к администратору Сервера документов.", "PE.ApplicationController.errorDefaultMessage": "Код ошибки: %1", "PE.ApplicationController.errorFilePassProtect": "Файл защищен паролем и не может быть открыт.", + "PE.ApplicationController.errorFileSizeExceed": "Размер файла превышает ограничение, установленное для вашего сервера.
    Обратитесь к администратору Сервера документов для получения дополнительной информации.", "PE.ApplicationController.errorUserDrop": "В настоящий момент файл недоступен.", "PE.ApplicationController.notcriticalErrorTitle": "Внимание", "PE.ApplicationController.scriptLoadError": "Слишком медленное подключение, некоторые компоненты не удалось загрузить. Пожалуйста, обновите страницу.", diff --git a/apps/presentationeditor/main/app/controller/DocumentHolder.js b/apps/presentationeditor/main/app/controller/DocumentHolder.js index e5bd95ede..b1cef7f39 100644 --- a/apps/presentationeditor/main/app/controller/DocumentHolder.js +++ b/apps/presentationeditor/main/app/controller/DocumentHolder.js @@ -112,7 +112,7 @@ define([ if (this.api) { ( diagramEditor.isEditMode() ) ? this.api.asc_editChartDrawingObject(data) - : this.api.asc_addChartDrawingObject(data); + : this.api.asc_addChartDrawingObject(data, diagramEditor.getPlaceholder()); } }, this)); diagramEditor.on('hide', _.bind(function(cmp, message) { diff --git a/apps/presentationeditor/main/app/controller/LeftMenu.js b/apps/presentationeditor/main/app/controller/LeftMenu.js index be73ae8fa..0efddeeb9 100644 --- a/apps/presentationeditor/main/app/controller/LeftMenu.js +++ b/apps/presentationeditor/main/app/controller/LeftMenu.js @@ -62,8 +62,7 @@ define([ 'hide': _.bind(this.onHideChat, this) }, 'Common.Views.Header': { - 'file:settings': _.bind(this.clickToolbarSettings,this), - 'click:users': _.bind(this.clickStatusbarUsers, this) + 'file:settings': _.bind(this.clickToolbarSettings,this) }, 'Common.Views.Plugins': { 'plugin:open': _.bind(this.onPluginOpen, this), @@ -368,10 +367,6 @@ define([ }, /** coauthoring begin **/ - clickStatusbarUsers: function() { - this.leftMenu.menuFile.panels['rights'].changeAccessRights(); - }, - onHideChat: function() { $(this.leftMenu.btnChat.el).blur(); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 8ac192e66..418aa44e0 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -310,15 +310,18 @@ define([ this.appOptions.saveAsUrl = this.editorConfig.saveAsUrl; this.appOptions.fileChoiceUrl = this.editorConfig.fileChoiceUrl; this.appOptions.canAnalytics = false; + this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.customization = this.editorConfig.customization; - this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') - && (typeof (this.editorConfig.customization.goback) == 'object') && !_.isEmpty(this.editorConfig.customization.goback.url); + this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') && (typeof (this.editorConfig.customization.goback) == 'object') + && (!_.isEmpty(this.editorConfig.customization.goback.url) || this.editorConfig.customization.goback.requestClose && this.appOptions.canRequestClose); this.appOptions.canBack = this.appOptions.canBackToFolder === true; this.appOptions.canPlugins = false; this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers; this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify; this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs; this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage; + this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures; + this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings; appHeader = this.getApplication().getController('Viewport').getView('Common.Views.Header'); appHeader.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '') @@ -332,7 +335,7 @@ define([ if (!( this.editorConfig.customization && ( this.editorConfig.customization.toolbarNoTabs || (this.editorConfig.targetApp!=='desktop') && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo)))) { - $('#editor_sdk').append('
    '); + $('#editor-container').append('
    '); } Common.Controllers.Desktop.init(this.appOptions); @@ -446,11 +449,16 @@ define([ goBack: function(current) { var me = this; if ( !Common.Controllers.Desktop.process('goback') ) { - var href = me.appOptions.customization.goback.url; - if (!current && me.appOptions.customization.goback.blank!==false) { - window.open(href, "_blank"); + if (me.appOptions.customization.goback.requestClose && me.appOptions.canRequestClose) { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); } else { - parent.location.href = href; + var href = me.appOptions.customization.goback.url; + if (!current && me.appOptions.customization.goback.blank!==false) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } } }, @@ -463,7 +471,7 @@ define([ if (this.api && this.appOptions.isEdit && this.api.asc_isDocumentCanSave) { var cansave = this.api.asc_isDocumentCanSave(), forcesave = this.appOptions.forcesave, - isSyncButton = (toolbarView.btnCollabChanges.rendered) ? toolbarView.btnCollabChanges.$icon.hasClass('btn-synch') : false, + isSyncButton = (toolbarView.btnCollabChanges.rendered) ? toolbarView.btnCollabChanges.cmpEl.hasClass('notify') : false, isDisabled = !cansave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave; toolbarView.btnSave.setDisabled(isDisabled); } @@ -898,7 +906,6 @@ define([ this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion; /** coauthoring end **/ this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights; - this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.canEdit = this.permissions.edit !== false && // can edit (this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view'); // if mode=="view" -> canRequestEditRights must be defined this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; @@ -970,22 +977,24 @@ define([ commentsController.setConfig({config: this.editorConfig, sdkviewname: '#id_main_parent'}, this.api); } /** coauthoring end **/ - if (this.appOptions.isEdit) { - var me = this, - application = this.getApplication(), - toolbarController = application.getController('Toolbar'), - rightmenuController = application.getController('RightMenu'), - fontsControllers = application.getController('Common.Controllers.Fonts'), - reviewController = application.getController('Common.Controllers.ReviewChanges'); + var me = this, + application = this.getApplication(), + reviewController = application.getController('Common.Controllers.ReviewChanges'); + reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api).loadDocument({doc:me.document}); + + if (this.appOptions.isEdit || this.appOptions.isRestrictedEdit) { // set api events for toolbar in the Restricted Editing mode) + var toolbarController = application.getController('Toolbar'); + toolbarController && toolbarController.setApi(me.api); + + if (!this.appOptions.isEdit) return; + + var rightmenuController = application.getController('RightMenu'), + fontsControllers = application.getController('Common.Controllers.Fonts'); // me.getStore('SlideLayouts'); fontsControllers && fontsControllers.setApi(me.api); - toolbarController && toolbarController.setApi(me.api); - rightmenuController && rightmenuController.setApi(me.api); - reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); - if (me.appOptions.canProtect) application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); @@ -1155,7 +1164,7 @@ define([ break; case Asc.c_oAscError.ID.Warning: - config.msg = this.errorConnectToServer.replace('%1', '{{API_URL_EDITING_CALLBACK}}'); + config.msg = this.errorConnectToServer; config.closable = false; break; @@ -1204,6 +1213,11 @@ define([ config.msg = this.errorFileSizeExceed; break; + case Asc.c_oAscError.ID.UpdateVersion: + config.msg = this.errorUpdateVersionOnDisconnect; + config.maxwidth = 600; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); break; @@ -1354,7 +1368,7 @@ define([ var toolbarView = this.getApplication().getController('Toolbar').getView('Toolbar'); if (toolbarView && toolbarView.btnCollabChanges) { - var isSyncButton = toolbarView.btnCollabChanges.$icon.hasClass('btn-synch'), + var isSyncButton = toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), forcesave = this.appOptions.forcesave, isDisabled = !isModified && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave; toolbarView.btnSave.setDisabled(isDisabled); @@ -1363,7 +1377,7 @@ define([ onDocumentCanSaveChanged: function (isCanSave) { var toolbarView = this.getApplication().getController('Toolbar').getView('Toolbar'); if ( toolbarView ) { - var isSyncButton = toolbarView.btnCollabChanges.$icon.hasClass('btn-synch'), + var isSyncButton = toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), forcesave = this.appOptions.forcesave, isDisabled = !isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave; toolbarView.btnSave.setDisabled(isDisabled); @@ -1765,7 +1779,8 @@ define([ var filemenu = this.getApplication().getController('LeftMenu').getView('LeftMenu').getMenu('file'); filemenu.loadDocument({doc:this.document}); - filemenu.panels['info'].updateInfo(this.document); + filemenu.panels && filemenu.panels['info'] && filemenu.panels['info'].updateInfo(this.document); + this.getApplication().getController('Common.Controllers.ReviewChanges').loadDocument({doc:this.document}); Common.Gateway.metaChange(meta); }, @@ -1954,14 +1969,13 @@ define([ txtYAxis: 'Y Axis', txtSeries: 'Seria', txtArt: 'Your text here', - errorConnectToServer: ' The document could not be saved. Please check connection settings or contact your administrator.
    When you click the \'OK\' button, you will be prompted to download the document.

    ' + - 'Find more information about connecting Document Server here', + errorConnectToServer: ' The document could not be saved. Please check connection settings or contact your administrator.
    When you click the \'OK\' button, you will be prompted to download the document.', textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.
    Click the \'Strict mode\' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.', textStrict: 'Strict mode', textBuyNow: 'Visit website', textNoLicenseTitle: '%1 open source version', textContactUs: 'Contact sales', - errorViewerDisconnect: 'Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored.', + errorViewerDisconnect: 'Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored and page is reloaded.', warnLicenseExp: 'Your license has expired.
    Please update your license and refresh the page.', titleLicenseExp: 'License expired', openErrorText: 'An error has occurred while opening the file', @@ -2189,7 +2203,8 @@ define([ errorEmailClient: 'No email client could be found', textCustomLoader: 'Please note that according to the terms of the license you are not entitled to change the loader.
    Please contact our Sales Department to get a quote.', waitText: 'Please, wait...', - errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.' + errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.', + errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.' } })(), PE.Controllers.Main || {})) }); diff --git a/apps/presentationeditor/main/app/controller/Toolbar.js b/apps/presentationeditor/main/app/controller/Toolbar.js index 830ceaa55..f1aa976ca 100644 --- a/apps/presentationeditor/main/app/controller/Toolbar.js +++ b/apps/presentationeditor/main/app/controller/Toolbar.js @@ -48,6 +48,8 @@ define([ 'common/main/lib/view/ImageFromUrlDialog', 'common/main/lib/view/InsertTableDialog', 'common/main/lib/view/SelectFileDlg', + 'common/main/lib/view/ListSettingsDialog', + 'common/main/lib/view/SymbolTableDialog', 'common/main/lib/util/define', 'presentationeditor/main/app/collection/SlideThemes', 'presentationeditor/main/app/view/Toolbar', @@ -276,6 +278,8 @@ define([ toolbar.btnIncLeftOffset.on('click', _.bind(this.onIncOffset, this)); toolbar.btnMarkers.on('click', _.bind(this.onMarkers, this)); toolbar.btnNumbers.on('click', _.bind(this.onNumbers, this)); + toolbar.mnuMarkerSettings.on('click', _.bind(this.onMarkerSettingsClick, this, 0)); + toolbar.mnuNumberSettings.on('click', _.bind(this.onMarkerSettingsClick, this, 1)); toolbar.cmbFontName.on('selected', _.bind(this.onFontNameSelect, this)); toolbar.cmbFontName.on('show:after', _.bind(this.onComboOpen, this, true)); toolbar.cmbFontName.on('hide:after', _.bind(this.onHideMenus, this)); @@ -307,6 +311,7 @@ define([ toolbar.btnSlideSize.menu.on('item:click', _.bind(this.onSlideSize, this)); toolbar.listTheme.on('click', _.bind(this.onListThemeSelect, this)); toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this)); + toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this)); toolbar.btnEditHeader.on('click', _.bind(this.onEditHeaderClick, this, 'header')); toolbar.btnInsDateTime.on('click', _.bind(this.onEditHeaderClick, this, 'datetime')); toolbar.btnInsSlideNum.on('click', _.bind(this.onEditHeaderClick, this, 'slidenum')); @@ -318,48 +323,52 @@ define([ setApi: function(api) { this.api = api; - this.toolbar.setApi(api); + if (this.mode.isEdit) { + this.toolbar.setApi(api); - this.api.asc_registerCallback('asc_onFontSize', _.bind(this.onApiFontSize, this)); - this.api.asc_registerCallback('asc_onBold', _.bind(this.onApiBold, this)); - this.api.asc_registerCallback('asc_onItalic', _.bind(this.onApiItalic, this)); - this.api.asc_registerCallback('asc_onUnderline', _.bind(this.onApiUnderline, this)); - this.api.asc_registerCallback('asc_onStrikeout', _.bind(this.onApiStrikeout, this)); - this.api.asc_registerCallback('asc_onVerticalAlign', _.bind(this.onApiVerticalAlign, this)); - Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); + this.api.asc_registerCallback('asc_onFontSize', _.bind(this.onApiFontSize, this)); + this.api.asc_registerCallback('asc_onBold', _.bind(this.onApiBold, this)); + this.api.asc_registerCallback('asc_onItalic', _.bind(this.onApiItalic, this)); + this.api.asc_registerCallback('asc_onUnderline', _.bind(this.onApiUnderline, this)); + this.api.asc_registerCallback('asc_onStrikeout', _.bind(this.onApiStrikeout, this)); + this.api.asc_registerCallback('asc_onVerticalAlign', _.bind(this.onApiVerticalAlign, this)); + Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); - this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); - this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); - this.api.asc_registerCallback('asc_onPaintFormatChanged', _.bind(this.onApiStyleChange, this)); - this.api.asc_registerCallback('asc_onListType', _.bind(this.onApiBullets, this)); - this.api.asc_registerCallback('asc_canIncreaseIndent', _.bind(this.onApiCanIncreaseIndent, this)); - this.api.asc_registerCallback('asc_canDecreaseIndent', _.bind(this.onApiCanDecreaseIndent, this)); - this.api.asc_registerCallback('asc_onLineSpacing', _.bind(this.onApiLineSpacing, this)); - this.api.asc_registerCallback('asc_onPrAlign', _.bind(this.onApiParagraphAlign, this)); - this.api.asc_registerCallback('asc_onVerticalTextAlign', _.bind(this.onApiVerticalTextAlign, this)); - this.api.asc_registerCallback('asc_onCanAddHyperlink', _.bind(this.onApiCanAddHyperlink, this)); - this.api.asc_registerCallback('asc_onTextColor', _.bind(this.onApiTextColor, this)); + this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); + this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); + this.api.asc_registerCallback('asc_onPaintFormatChanged', _.bind(this.onApiStyleChange, this)); + this.api.asc_registerCallback('asc_onListType', _.bind(this.onApiBullets, this)); + this.api.asc_registerCallback('asc_canIncreaseIndent', _.bind(this.onApiCanIncreaseIndent, this)); + this.api.asc_registerCallback('asc_canDecreaseIndent', _.bind(this.onApiCanDecreaseIndent, this)); + this.api.asc_registerCallback('asc_onLineSpacing', _.bind(this.onApiLineSpacing, this)); + this.api.asc_registerCallback('asc_onPrAlign', _.bind(this.onApiParagraphAlign, this)); + this.api.asc_registerCallback('asc_onVerticalTextAlign', _.bind(this.onApiVerticalTextAlign, this)); + this.api.asc_registerCallback('asc_onCanAddHyperlink', _.bind(this.onApiCanAddHyperlink, this)); + this.api.asc_registerCallback('asc_onTextColor', _.bind(this.onApiTextColor, this)); - this.api.asc_registerCallback('asc_onUpdateThemeIndex', _.bind(this.onApiUpdateThemeIndex, this)); - this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this)); - this.api.asc_registerCallback('asc_onCanGroup', _.bind(this.onApiCanGroup, this)); - this.api.asc_registerCallback('asc_onCanUnGroup', _.bind(this.onApiCanUnGroup, this)); - this.api.asc_registerCallback('asc_onPresentationSize', _.bind(this.onApiPageSize, this)); + this.api.asc_registerCallback('asc_onUpdateThemeIndex', _.bind(this.onApiUpdateThemeIndex, this)); + this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this)); + this.api.asc_registerCallback('asc_onCanGroup', _.bind(this.onApiCanGroup, this)); + this.api.asc_registerCallback('asc_onCanUnGroup', _.bind(this.onApiCanUnGroup, this)); + this.api.asc_registerCallback('asc_onPresentationSize', _.bind(this.onApiPageSize, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); - Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); - this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this)); - this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); - this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this)); - this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this)); - this.api.asc_registerCallback('asc_onLockDocumentTheme', _.bind(this.onApiLockDocumentTheme, this)); - this.api.asc_registerCallback('asc_onUnLockDocumentTheme', _.bind(this.onApiUnLockDocumentTheme, this)); - this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this)); + this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); + this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this)); + this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this)); + this.api.asc_registerCallback('asc_onLockDocumentTheme', _.bind(this.onApiLockDocumentTheme, this)); + this.api.asc_registerCallback('asc_onUnLockDocumentTheme', _.bind(this.onApiUnLockDocumentTheme, this)); + this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this)); - this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPages, this)); - this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this)); - this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); - this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this)); + this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPages, this)); + this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this)); + this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); + this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this)); + } else if (this.mode.isRestrictedEdit) { + this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPagesRestricted, this)); + } }, onChangeCompactView: function(view, compact) { @@ -470,6 +479,7 @@ define([ case 0: this.toolbar.btnMarkers.toggle(true, true); this.toolbar.mnuMarkersPicker.selectByIndex(this._state.bullets.subtype, true); + this.toolbar.mnuMarkerSettings && this.toolbar.mnuMarkerSettings.setDisabled(this._state.bullets.subtype<0); break; case 1: var idx = 0; @@ -498,6 +508,7 @@ define([ } this.toolbar.btnNumbers.toggle(true, true); this.toolbar.mnuNumbersPicker.selectByIndex(idx, true); + this.toolbar.mnuNumberSettings && this.toolbar.mnuNumberSettings.setDisabled(idx==0); break; } } @@ -631,6 +642,14 @@ define([ } }, + onApiCountPagesRestricted: function(count) { + if (this._state.no_slides !== (count<=0)) { + this._state.no_slides = (count<=0); + if (this.btnsComment) + this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment }); + } + }, + onApiFocusObject: function(selectedObjects) { if (!this.editMode) return; @@ -905,7 +924,7 @@ define([ var toolbar = this.toolbar; if (this.api && this.api.asc_isDocumentCanSave) { var isModified = this.api.asc_isDocumentCanSave(); - var isSyncButton = this.toolbar.btnCollabChanges && this.toolbar.btnCollabChanges.$icon.hasClass('btn-synch'); + var isSyncButton = toolbar.btnCollabChanges && toolbar.btnCollabChanges.cmpEl.hasClass('notify'); if (!isModified && !isSyncButton && !this.toolbar.mode.forcesave) return; @@ -1092,6 +1111,37 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar); }, + onMarkerSettingsClick: function(type) { + var me = this, + props; + + var selectedElements = me.api.getSelectedElements(); + if (selectedElements && _.isArray(selectedElements)) { + for (var i = 0; i< selectedElements.length; i++) { + if (Asc.c_oAscTypeSelectElement.Paragraph == selectedElements[i].get_ObjectType()) { + props = selectedElements[i].get_ObjectValue(); + break; + } + } + } + if (props) { + (new Common.Views.ListSettingsDialog({ + api: me.api, + props: props, + type: type, + interfaceLang: me.toolbar.mode.lang, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.paraApply(value); + } + } + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + })).show(); + } + }, + onComboBlur: function() { Common.NotificationCenter.trigger('edit:complete', this.toolbar); }, @@ -1634,6 +1684,8 @@ define([ this.toolbar.mnuMarkersPicker.selectByIndex(0, true); this.toolbar.mnuNumbersPicker.selectByIndex(0, true); + this.toolbar.mnuMarkerSettings && this.toolbar.mnuMarkerSettings.setDisabled(true); + this.toolbar.mnuNumberSettings && this.toolbar.mnuNumberSettings.setDisabled(true); }, _getApiTextSize: function () { @@ -1789,6 +1841,28 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertEquation); }, + onInsertSymbolClick: function() { + if (this.api) { + var me = this, + win = new Common.Views.SymbolTableDialog({ + api: me.api, + lang: me.toolbar.mode.lang, + type: 1, + buttons: [{value: 'ok', caption: this.textInsert}, 'close'], + handler: function(dlg, result, settings) { + if (result == 'ok') { + me.api.asc_insertSymbol(settings.font, settings.code); + } else + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + }); + win.show(); + win.on('symbol:dblclick', function(cmp, result, settings) { + me.api.asc_insertSymbol(settings.font, settings.code); + }); + } + }, + onApiMathTypes: function(equation) { this._equationTemp = equation; var me = this; @@ -2077,45 +2151,39 @@ define([ compactview = true; } - /** - * Rendering of toolbar makes rendering of header very slow - * Temporary wrapped up in setTimeout to process events - * */ - setTimeout(function () { - me.toolbar.render(_.extend({compactview: compactview}, config)); + me.toolbar.render(_.extend({compactview: compactview}, config)); - if ( config.isEdit ) { - me.toolbar.setMode(config); + var tab = {action: 'review', caption: me.toolbar.textTabCollaboration}; + var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel(); + if ( $panel ) + me.toolbar.addTab(tab, $panel, 3); - var tab = {action: 'review', caption: me.toolbar.textTabCollaboration}; - var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel(); - if ( $panel ) - me.toolbar.addTab(tab, $panel, 3); + if ( config.isEdit ) { + me.toolbar.setMode(config); - me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled')); + me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled')); - if (!(config.customization && config.customization.compactHeader)) { - // hide 'print' and 'save' buttons group and next separator - me.toolbar.btnPrint.$el.parents('.group').hide().next().hide(); + if (!(config.customization && config.customization.compactHeader)) { + // hide 'print' and 'save' buttons group and next separator + me.toolbar.btnPrint.$el.parents('.group').hide().next().hide(); - // hide 'undo' and 'redo' buttons and get container - var $box = me.toolbar.btnUndo.$el.hide().next().hide().parent(); + // hide 'undo' and 'redo' buttons and get container + var $box = me.toolbar.btnUndo.$el.hide().next().hide().parent(); - // move 'paste' button to the container instead of 'undo' and 'redo' - me.toolbar.btnPaste.$el.detach().appendTo($box); - me.toolbar.btnCopy.$el.removeClass('split'); - } + // move 'paste' button to the container instead of 'undo' and 'redo' + me.toolbar.btnPaste.$el.detach().appendTo($box); + me.toolbar.btnCopy.$el.removeClass('split'); + } - if ( config.isDesktopApp ) { - if ( config.canProtect ) { // don't add protect panel to toolbar - tab = {action: 'protect', caption: me.toolbar.textTabProtect}; - $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); - if ($panel) - me.toolbar.addTab(tab, $panel, 4); - } + if ( config.isDesktopApp ) { + if ( config.canProtect ) { // don't add protect panel to toolbar + tab = {action: 'protect', caption: me.toolbar.textTabProtect}; + $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); + if ($panel) + me.toolbar.addTab(tab, $panel, 4); } } - }, 0); + } }, onAppReady: function (config) { @@ -2125,7 +2193,7 @@ define([ this.btnsComment = []; if ( config.canCoAuthoring && config.canComments ) { var _set = PE.enumLock; - this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'btn-menu-comments', me.toolbar.capBtnComment, [_set.lostConnect, _set.noSlides]); + this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', me.toolbar.capBtnComment, [_set.lostConnect, _set.noSlides]); if ( this.btnsComment.length ) { var _comments = PE.getController('Common.Controllers.Comments').getView(); @@ -2135,6 +2203,8 @@ define([ btn.on('click', function (btn, e) { Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); }); + if (btn.cmpEl.closest('#review-changes-panel').length>0) + btn.setCaption(me.toolbar.capBtnAddComment); }, this); this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment }); } @@ -2499,7 +2569,8 @@ define([ txtMatrix_2_2_LineBracket : 'Empty Matrix with Brackets', txtMatrix_2_2_DLineBracket : 'Empty Matrix with Brackets', txtMatrix_Flat_Round : 'Sparse Matrix', - txtMatrix_Flat_Square : 'Sparse Matrix' + txtMatrix_Flat_Square : 'Sparse Matrix', + textInsert: 'Insert' }, PE.Controllers.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/controller/Viewport.js b/apps/presentationeditor/main/app/controller/Viewport.js index 50de61e27..b8e4dbe30 100644 --- a/apps/presentationeditor/main/app/controller/Viewport.js +++ b/apps/presentationeditor/main/app/controller/Viewport.js @@ -272,9 +272,9 @@ define([ 'data-stopPropagation="true"', '<% } %>', '>', '', - '', + '', '', - '', + '', '
    ' ].join('')), stopPropagation: true, diff --git a/apps/presentationeditor/main/app/template/ImageSettings.template b/apps/presentationeditor/main/app/template/ImageSettings.template index 558f0b94b..6b41d6507 100644 --- a/apps/presentationeditor/main/app/template/ImageSettings.template +++ b/apps/presentationeditor/main/app/template/ImageSettings.template @@ -14,12 +14,17 @@ - + -
    + + + + + +
    diff --git a/apps/presentationeditor/main/app/template/LeftMenu.template b/apps/presentationeditor/main/app/template/LeftMenu.template index 408883566..2e85b7171 100644 --- a/apps/presentationeditor/main/app/template/LeftMenu.template +++ b/apps/presentationeditor/main/app/template/LeftMenu.template @@ -1,14 +1,14 @@
    - - + + - - + + - - + +
    diff --git a/apps/presentationeditor/main/app/template/RightMenu.template b/apps/presentationeditor/main/app/template/RightMenu.template index f4cfb2d7b..83a4bdf86 100644 --- a/apps/presentationeditor/main/app/template/RightMenu.template +++ b/apps/presentationeditor/main/app/template/RightMenu.template @@ -19,13 +19,13 @@
    - - - - - - - - + + + + + + + +
    \ No newline at end of file diff --git a/apps/presentationeditor/main/app/template/SlideSettings.template b/apps/presentationeditor/main/app/template/SlideSettings.template index fbe24606d..ce824dadc 100644 --- a/apps/presentationeditor/main/app/template/SlideSettings.template +++ b/apps/presentationeditor/main/app/template/SlideSettings.template @@ -11,7 +11,7 @@ -
    +
    diff --git a/apps/presentationeditor/main/app/template/StatusBar.template b/apps/presentationeditor/main/app/template/StatusBar.template index 411948a61..f4d7afebb 100644 --- a/apps/presentationeditor/main/app/template/StatusBar.template +++ b/apps/presentationeditor/main/app/template/StatusBar.template @@ -36,14 +36,14 @@
    - - - + + +
    - +
    diff --git a/apps/presentationeditor/main/app/template/Toolbar.template b/apps/presentationeditor/main/app/template/Toolbar.template index 0b8287bc6..4d5e1c3d2 100644 --- a/apps/presentationeditor/main/app/template/Toolbar.template +++ b/apps/presentationeditor/main/app/template/Toolbar.template @@ -129,6 +129,7 @@
    +
    diff --git a/apps/presentationeditor/main/app/template/Viewport.template b/apps/presentationeditor/main/app/template/Viewport.template index 5307c1f08..361363532 100644 --- a/apps/presentationeditor/main/app/template/Viewport.template +++ b/apps/presentationeditor/main/app/template/Viewport.template @@ -10,7 +10,7 @@
    -
    +
    diff --git a/apps/presentationeditor/main/app/view/ChartSettings.js b/apps/presentationeditor/main/app/view/ChartSettings.js index f742fb087..8bedf958a 100644 --- a/apps/presentationeditor/main/app/view/ChartSettings.js +++ b/apps/presentationeditor/main/app/view/ChartSettings.js @@ -213,47 +213,8 @@ define([ el: $('#id-chart-menu-type'), parentMenu: btn.menu, restoreHeight: 421, - 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, inline: true }, - { id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true }, - { id: 'menu-chart-group-stock', caption: me.textStock, inline: true } - // { id: 'menu-chart-group-surface', caption: me.textSurface} - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal', selected: true}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} - ]), + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()), + store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()), itemTemplate: _.template('
    ') }); }); @@ -293,10 +254,12 @@ define([ this.spnWidth.on('change', _.bind(this.onWidthChange, this)); this.spnHeight.on('change', _.bind(this.onHeightChange, this)); + this.spnWidth.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.spnHeight.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.btnRatio = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'advanced-btn-ratio', + iconCls: 'toolbar__icon advanced-btn-ratio', style: 'margin-bottom: 1px;', enableToggle: true, hint: this.textKeepRatio @@ -455,8 +418,6 @@ define([ props.put_Height(Common.Utils.Metric.fnRecalcToMM(h)); this.api.ChartApply(props); } - - this.fireEvent('editcomplete', this); }, onHeightChange: function(field, newValue, oldValue, eOpts){ @@ -476,8 +437,6 @@ define([ props.put_Height(Common.Utils.Metric.fnRecalcToMM(h)); this.api.ChartApply(props); } - - this.fireEvent('editcomplete', this); }, openAdvancedSettings: function(e) { @@ -534,15 +493,7 @@ define([ textHeight: 'Height', textEditData: 'Edit Data', textChartType: 'Change Chart Type', - textLine: 'Line', - textColumn: 'Column', - textBar: 'Bar', - textArea: 'Area', - textPie: 'Pie', - textPoint: 'XY (Scatter)', - textStock: 'Stock', textStyle: 'Style', - textAdvanced: 'Show advanced settings', - textSurface: 'Surface' + textAdvanced: 'Show advanced settings' }, PE.Views.ChartSettings || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index 529e5359c..091c5dd41 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -325,7 +325,10 @@ define([ }); meEl.on('click', function(e){ if (e.target.localName == 'canvas') { - meEl.focus(); + if (me._preventClick) + me._preventClick = false; + else + meEl.focus(); } }); meEl.on('mousedown', function(e){ @@ -675,18 +678,6 @@ define([ me.mode.isEdit = false; }; - var onDoubleClickOnChart = function(chart) { - if (me.mode.isEdit && !me._isDisabled) { - var diagramEditor = PE.getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); - - if (diagramEditor && chart) { - diagramEditor.setEditMode(true); - diagramEditor.show(); - diagramEditor.setChartData(new Asc.asc_CChartBinary(chart)); - } - } - }; - var onTextLanguage = function(langid) { me._currLang.id = langid; }; @@ -1581,12 +1572,18 @@ define([ if (me.mode.isEdit===true) { me.api.asc_registerCallback('asc_onDialogAddHyperlink', _.bind(onDialogAddHyperlink, me)); - me.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart); + me.api.asc_registerCallback('asc_doubleClickOnChart', _.bind(me.editChartClick, me)); me.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(onSpellCheckVariantsFound, me)); me.api.asc_registerCallback('asc_onShowSpecialPasteOptions', _.bind(onShowSpecialPasteOptions, me)); me.api.asc_registerCallback('asc_onHideSpecialPasteOptions', _.bind(onHideSpecialPasteOptions, me)); me.api.asc_registerCallback('asc_ChangeCropState', _.bind(onChangeCropState, me)); - + me.api.asc_registerCallback('asc_onHidePlaceholderActions', _.bind(me.onHidePlaceholderActions, me)); + me.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Image, _.bind(me.onInsertImage, me, true)); + me.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.ImageUrl, _.bind(me.onInsertImageUrl, me, true)); + me.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Chart, _.bind(me.onClickPlaceholderChart, me)); + me.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Table, _.bind(me.onClickPlaceholderTable, me)); + me.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Video, _.bind(me.onClickPlaceholder, me, AscCommon.PlaceholderButtonType.Video)); + me.api.asc_registerPlaceholderCallback(AscCommon.PlaceholderButtonType.Audio, _.bind(me.onClickPlaceholder, me, AscCommon.PlaceholderButtonType.Audio)); } me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(onCoAuthoringDisconnect, me)); Common.NotificationCenter.on('api:disconnect', _.bind(onCoAuthoringDisconnect, me)); @@ -1701,15 +1698,17 @@ define([ } }, /** coauthoring end **/ - editChartClick: function(){ - var diagramEditor = PE.getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); - if (diagramEditor) { - diagramEditor.setEditMode(true); - diagramEditor.show(); + editChartClick: function(chart, placeholder){ + if (this.mode.isEdit && !this._isDisabled) { + var diagramEditor = PE.getController('Common.Controllers.ExternalDiagramEditor').getView('Common.Views.ExternalDiagramEditor'); - var chart = this.api.asc_getChartObject(); - if (chart) { + if (diagramEditor) { + diagramEditor.setEditMode(chart===undefined || typeof chart == 'object'); //edit from doubleclick or context menu + diagramEditor.show(); + if (typeof chart !== 'object') + chart = this.api.asc_getChartObject(chart, placeholder); diagramEditor.setChartData(new Asc.asc_CChartBinary(chart)); + diagramEditor.setPlaceholder(placeholder); } } }, @@ -1760,6 +1759,11 @@ define([ } }, + addToLayout: function() { + if (this.api) + this.api.asc_AddToLayout(); + }, + createDelayedElementsViewer: function() { var me = this; @@ -1833,6 +1837,17 @@ define([ }) }); + var mnuResetSlide = new Common.UI.MenuItem({ + caption : me.txtResetLayout + }).on('click', function(item) { + if (me.api){ + me.api.ResetSlide(); + + me.fireEvent('editcomplete', me); + Common.component.Analytics.trackEvent('DocumentHolder', 'Reset Slide'); + } + }); + var mnuChangeTheme = new Common.UI.MenuItem({ caption : me.txtChangeTheme, menu : new Common.UI.Menu({ @@ -1910,11 +1925,12 @@ define([ mnuSlideHide.setChecked(value.isSlideHidden===true); me.slideMenu.items[5].setVisible(value.isSlideSelect===true || value.fromThumbs!==true); mnuChangeSlide.setVisible(value.isSlideSelect===true || value.fromThumbs!==true); + mnuResetSlide.setVisible(value.isSlideSelect===true || value.fromThumbs!==true); mnuChangeTheme.setVisible(value.isSlideSelect===true || value.fromThumbs!==true); menuSlideSettings.setVisible(value.isSlideSelect===true || value.fromThumbs!==true); menuSlideSettings.options.value = null; - for (var i = 9; i < 14; i++) { + for (var i = 10; i < 15; i++) { me.slideMenu.items[i].setVisible(value.fromThumbs===true); } mnuPrintSelection.setVisible(me.mode.canPrint && value.fromThumbs===true); @@ -1943,6 +1959,7 @@ define([ mnuSelectAll.setDisabled(locked || me.slidesCount<2); mnuDeleteSlide.setDisabled(lockedDeleted || locked); mnuChangeSlide.setDisabled(lockedLayout || locked); + mnuResetSlide.setDisabled(lockedLayout || locked); mnuChangeTheme.setDisabled(me._state.themeLock || locked ); mnuSlideHide.setDisabled(lockedLayout || locked); mnuPrintSelection.setDisabled(me.slidesCount<1); @@ -1975,6 +1992,7 @@ define([ mnuSlideHide, {caption: '--'}, mnuChangeSlide, + mnuResetSlide, mnuChangeTheme, menuSlideSettings, {caption: '--'}, @@ -2643,7 +2661,7 @@ define([ var menuChartEdit = new Common.UI.MenuItem({ caption : me.editChartText - }).on('click', _.bind(me.editChartClick, me)); + }).on('click', _.bind(me.editChartClick, me, undefined)); var menuParagraphVAlign = new Common.UI.MenuItem({ caption : me.vertAlignText, @@ -2703,24 +2721,27 @@ define([ items : [ me.menuParagraphDirectH = new Common.UI.MenuItem({ caption : me.directHText, - iconCls : 'mnu-direct-horiz', + iconCls : 'menu__icon text-orient-hor', checkable : true, + checkmark : false, checked : false, toggleGroup : 'popupparagraphdirect', direction : Asc.c_oAscVertDrawingText.normal }).on('click', _.bind(paragraphDirection, me)), me.menuParagraphDirect90 = new Common.UI.MenuItem({ caption : me.direct90Text, - iconCls : 'mnu-direct-rdown', + iconCls : 'menu__icon text-orient-rdown', checkable : true, + checkmark : false, checked : false, toggleGroup : 'popupparagraphdirect', direction : Asc.c_oAscVertDrawingText.vert }).on('click', _.bind(paragraphDirection, me)), me.menuParagraphDirect270 = new Common.UI.MenuItem({ caption : me.direct270Text, - iconCls : 'mnu-direct-rup', + iconCls : 'menu__icon text-orient-rup', checkable : true, + checkmark : false, checked : false, toggleGroup : 'popupparagraphdirect', direction : Asc.c_oAscVertDrawingText.vert270 @@ -2762,29 +2783,12 @@ define([ caption : this.textFromFile }).on('click', function(item) { setTimeout(function(){ - if (me.api) me.api.ChangeImageFromFile(); - me.fireEvent('editcomplete', me); + me.onInsertImage(); }, 10); }), new Common.UI.MenuItem({ caption : this.textFromUrl - }).on('click', function(item) { - (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 Asc.asc_CImgProperty(); - props.put_ImageUrl(checkUrl); - me.api.ImgApply(props); - } - } - } - me.fireEvent('editcomplete', me); - } - })).show(); - }) + }).on('click', _.bind(me.onInsertImageUrl, me, false)) ] }) }); @@ -2888,6 +2892,10 @@ define([ menuAddCommentImg.hide(); /** coauthoring end **/ + var menuAddToLayoutImg = new Common.UI.MenuItem({ + caption : me.addToLayoutText + }).on('click', _.bind(me.addToLayout, me)); + var menuParaCopy = new Common.UI.MenuItem({ caption : me.textCopy, value : 'copy' @@ -2941,6 +2949,10 @@ define([ caption : '--' }); + var menuAddToLayoutTable = new Common.UI.MenuItem({ + caption : me.addToLayoutText + }).on('click', _.bind(me.addToLayout, me)); + me.textMenu = new Common.UI.Menu({ initMenu: function(value){ var isInShape = (value.shapeProps && !_.isNull(value.shapeProps.value)); @@ -3245,7 +3257,9 @@ define([ menuAddCommentTable, /** coauthoring end **/ menuAddHyperlinkTable, - menuHyperlinkTable + menuHyperlinkTable, + { caption: '--' }, + menuAddToLayoutTable ] }).on('hide:after', function(menu, e, isFromInputControl) { if (me.suppressEditComplete) { @@ -3329,8 +3343,10 @@ define([ ,menuChartEdit /** coauthoring begin **/ ,menuCommentSeparatorImg, - menuAddCommentImg + menuAddCommentImg, /** coauthoring end **/ + { caption: '--' }, + menuAddToLayoutImg ] }).on('hide:after', function(menu, e, isFromInputControl) { if (me.suppressEditComplete) { @@ -3401,6 +3417,164 @@ define([ this._isDisabled = state; }, + onInsertImage: function(placeholder, obj, x, y) { + if (this.api) + (placeholder) ? this.api.asc_addImage(obj) : this.api.ChangeImageFromFile(); + this.fireEvent('editcomplete', this); + }, + + onInsertImageUrl: function(placeholder, obj, x, y) { + 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)) { + if (placeholder) + me.api.AddImageUrl(checkUrl, undefined, undefined, obj); + else { + var props = new Asc.asc_CImgProperty(); + props.put_ImageUrl(checkUrl); + me.api.ImgApply(props, obj); + } + } + } + } + me.fireEvent('editcomplete', me); + } + })).show(); + }, + + onClickPlaceholderChart: function(obj, x, y) { + if (!this.api) return; + + this._state.placeholderObj = obj; + var menu = this.placeholderMenuChart, + menuContainer = menu ? this.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, + me = this; + this._fromShowPlaceholder = true; + Common.UI.Menu.Manager.hideAll(); + + if (!menu) { + this.placeholderMenuChart = menu = new Common.UI.Menu({ + style: 'width: 435px;', + items: [ + {template: _.template('')} + ] + }); + // Prepare menu container + menuContainer = $(Common.Utils.String.format('', menu.id)); + this.cmpEl.append(menuContainer); + menu.render(menuContainer); + menu.cmpEl.attr({tabindex: "-1"}); + menu.on('hide:after', function(){ + if (!me._fromShowPlaceholder) + me.api.asc_uncheckPlaceholders(); + }); + + var picker = new Common.UI.DataView({ + el: $('#id-placeholder-menu-chart'), + parentMenu: menu, + showLast: false, + // restoreHeight: 421, + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()), + store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()), + itemTemplate: _.template('
    ') + }); + picker.on('item:click', function (picker, item, record, e) { + me.editChartClick(record.get('type'), me._state.placeholderObj); + }); + } + menuContainer.css({left: x, top : y}); + menuContainer.attr('data-value', 'prevent-canvas-click'); + this._preventClick = true; + menu.show(); + + menu.alignPosition(); + _.delay(function() { + menu.cmpEl.find('.dataview').focus(); + }, 10); + this._fromShowPlaceholder = false; + }, + + onClickPlaceholderTable: function(obj, x, y) { + if (!this.api) return; + + this._state.placeholderObj = obj; + var menu = this.placeholderMenuTable, + menuContainer = menu ? this.cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, + me = this; + this._fromShowPlaceholder = true; + Common.UI.Menu.Manager.hideAll(); + + if (!menu) { + this.placeholderMenuTable = menu = new Common.UI.Menu({ + items: [ + {template: _.template('
    ')}, + {caption: me.mniCustomTable, value: 'custom'} + ] + }); + // Prepare menu container + menuContainer = $(Common.Utils.String.format('', menu.id)); + this.cmpEl.append(menuContainer); + menu.render(menuContainer); + menu.cmpEl.attr({tabindex: "-1"}); + menu.on('hide:after', function(){ + if (!me._fromShowPlaceholder) + me.api.asc_uncheckPlaceholders(); + }); + + var picker = new Common.UI.DimensionPicker({ + el: $('#id-placeholder-menu-tablepicker'), + minRows: 8, + minColumns: 10, + maxRows: 8, + maxColumns: 10 + }); + picker.on('select', function(picker, columns, rows){ + me.api.put_Table(columns, rows, me._state.placeholderObj); + me.fireEvent('editcomplete', me); + }); + menu.on('item:click', function(menu, item, e){ + if (item.value === 'custom') { + (new Common.Views.InsertTableDialog({ + handler: function(result, value) { + if (result == 'ok') + me.api.put_Table(value.columns, value.rows, me._state.placeholderObj); + me.fireEvent('editcomplete', me); + } + })).show(); + } + }); + } + menuContainer.css({left: x, top : y}); + menuContainer.attr('data-value', 'prevent-canvas-click'); + this._preventClick = true; + menu.show(); + + menu.alignPosition(); + _.delay(function() { + menu.cmpEl.focus(); + }, 10); + this._fromShowPlaceholder = false; + }, + + onHidePlaceholderActions: function() { + this.placeholderMenuChart && this.placeholderMenuChart.hide(); + this.placeholderMenuTable && this.placeholderMenuTable.hide(); + }, + + onClickPlaceholder: function(type, obj, x, y) { + if (!this.api) return; + if (type == AscCommon.PlaceholderButtonType.Video) { + // this.api.addVideo(obj); + } else if (type == AscCommon.PlaceholderButtonType.Audio) { + // this.api.addAudio(obj); + } + this.fireEvent('editcomplete', this); + }, + insertRowAboveText : 'Row Above', insertRowBelowText : 'Row Below', insertColumnLeftText : 'Column Left', @@ -3412,7 +3586,7 @@ define([ mergeCellsText : 'Merge Cells', splitCellsText : 'Split Cell...', splitCellTitleText : 'Split Cell', - originalSizeText : 'Default Size', + originalSizeText : 'Actual Size', advancedImageText : 'Image Advanced Settings', hyperlinkText : 'Hyperlink', editHyperlinkText : 'Edit Hyperlink', @@ -3574,7 +3748,10 @@ define([ textCropFill: 'Fill', textCropFit: 'Fit', toDictionaryText: 'Add to Dictionary', - txtPrintSelection: 'Print Selection' + txtPrintSelection: 'Print Selection', + addToLayoutText: 'Add to Layout', + txtResetLayout: 'Reset Slide', + mniCustomTable: 'Insert Custom Table' }, PE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/view/FileMenu.js b/apps/presentationeditor/main/app/view/FileMenu.js index 469555fd2..bdddd3855 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -265,7 +265,8 @@ define([ if (!this.mode) return; this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide'](); - this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) ?'show':'hide'](); + var isBCSupport = window["AscDesktopEditor"] ? window["AscDesktopEditor"]["isBlockchainSupport"]() : false; + this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide'](); this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide'](); this.miSave[this.mode.isEdit?'show':'hide'](); this.miEdit[!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide'](); @@ -280,7 +281,7 @@ define([ this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide'](); this.miAccess[(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 || - this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide'](); + (this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length || this.mode.canRequestSharingSettings)))?'show':'hide'](); this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() : this.$el.find('#fm-btn-back').hide().prev().hide(); diff --git a/apps/presentationeditor/main/app/view/FileMenuPanels.js b/apps/presentationeditor/main/app/view/FileMenuPanels.js index 5a779721f..ce3116090 100644 --- a/apps/presentationeditor/main/app/view/FileMenuPanels.js +++ b/apps/presentationeditor/main/app/view/FileMenuPanels.js @@ -758,7 +758,7 @@ define([ }).on('keydown:before', keyDownBefore); this.btnApply = new Common.UI.Button({ - el: '#fminfo-btn-apply' + el: $markup.findById('#fminfo-btn-apply') }); this.btnApply.on('click', _.bind(this.applySettings, this)); @@ -878,6 +878,7 @@ define([ me.authors.push(item); }); this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit); + !this.mode.isEdit && this._ShowHideInfoItem(this.tblAuthor, !!this.authors.length); } this.SetDisabled(); }, @@ -898,6 +899,12 @@ define([ this.inputAuthor.setVisible(mode.isEdit); this.btnApply.setVisible(mode.isEdit); this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit); + if (!mode.isEdit) { + this.inputTitle._input.attr('placeholder', ''); + this.inputSubject._input.attr('placeholder', ''); + this.inputComment._input.attr('placeholder', ''); + this.inputAuthor._input.attr('placeholder', ''); + } this.SetDisabled(); return this; }, @@ -1010,7 +1017,7 @@ define([ }); } - Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this)); + Common.NotificationCenter.on('collaboration:sharingupdate', this.updateSharingSettings.bind(this)); Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this)); return this; @@ -1035,7 +1042,7 @@ define([ if (doc.info.sharingSettings) this.cntRights.html(this.templateRights({users: doc.info.sharingSettings})); this._ShowHideInfoItem('rights', doc.info.sharingSettings!==undefined && doc.info.sharingSettings!==null && doc.info.sharingSettings.length>0); - this._ShowHideInfoItem('edit-rights', !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights!==true); + this._ShowHideInfoItem('edit-rights', (!!this.sharingSettingsUrl && this.sharingSettingsUrl.length || this.mode.canRequestSharingSettings) && this._readonlyRights!==true); } else this._ShowHideDocInfo(false); }, @@ -1050,37 +1057,18 @@ define([ }, setMode: function(mode) { + this.mode = mode; this.sharingSettingsUrl = mode.sharingSettingsUrl; - !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this)); - !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this)); return this; }, changeAccessRights: function(btn,event,opts) { - if (this._docAccessDlg || this._readonlyRights) return; - - var me = this; - me._docAccessDlg = new Common.Views.DocumentAccessDialog({ - settingsurl: this.sharingSettingsUrl - }); - me._docAccessDlg.on('accessrights', function(obj, rights){ - me.updateSharingSettings(rights); - }).on('close', function(obj){ - me._docAccessDlg = undefined; - }); - - me._docAccessDlg.show(); - }, - - setSharingSettings: function(data) { - data && this.updateSharingSettings(data.sharingSettings); + Common.NotificationCenter.trigger('collaboration:sharing'); }, updateSharingSettings: function(rights) { - this.doc.info.sharingSettings = rights; this._ShowHideInfoItem('rights', this.doc.info.sharingSettings!==undefined && this.doc.info.sharingSettings!==null && this.doc.info.sharingSettings.length>0); this.cntRights.html(this.templateRights({users: this.doc.info.sharingSettings})); - Common.NotificationCenter.trigger('mentions:clearusers', this); }, onLostEditRights: function() { diff --git a/apps/presentationeditor/main/app/view/HeaderFooterDialog.js b/apps/presentationeditor/main/app/view/HeaderFooterDialog.js index 779e270d5..d7a669ac1 100644 --- a/apps/presentationeditor/main/app/view/HeaderFooterDialog.js +++ b/apps/presentationeditor/main/app/view/HeaderFooterDialog.js @@ -346,7 +346,7 @@ define(['text!presentationeditor/main/app/template/HeaderFooterDialog.template', this.close(); }, - textTitle: 'Header/Footer Settings', + textTitle: 'Footer Settings', applyAllText: 'Apply to all', applyText: 'Apply', textLang: 'Language', diff --git a/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js b/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js index deba6cf74..47fe2fda7 100644 --- a/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js @@ -61,8 +61,7 @@ define([ style: 'min-width: 230px;', cls: 'modal-dlg', id: 'window-hyperlink-settings', - buttons: ['ok', 'cancel'], - footerCls: 'right' + buttons: ['ok', 'cancel'] }, initialize : function(options) { diff --git a/apps/presentationeditor/main/app/view/ImageSettings.js b/apps/presentationeditor/main/app/view/ImageSettings.js index 447502f11..a5a396fde 100644 --- a/apps/presentationeditor/main/app/view/ImageSettings.js +++ b/apps/presentationeditor/main/app/view/ImageSettings.js @@ -102,10 +102,10 @@ define([ updateMetricUnit: function() { var value = Common.Utils.Metric.fnRecalcFromMM(this._state.Width); - this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + value.toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); value = Common.Utils.Metric.fnRecalcFromMM(this._state.Height); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + value.toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); }, createDelayedControls: function() { @@ -143,6 +143,17 @@ define([ this.fireEvent('editcomplete', this); }, this)); + this.btnFitSlide = new Common.UI.Button({ + el: $('#image-button-fit-slide') + }); + this.lockedControls.push(this.btnFitSlide); + this.btnFitSlide.on('click', _.bind(this.setFitSlide, this)); + + var w = Math.max(this.btnOriginalSize.cmpEl.width(), this.btnFitSlide.cmpEl.width()); + this.btnOriginalSize.cmpEl.width(w); + this.btnFitSlide.cmpEl.width(w); + + w = this.btnOriginalSize.cmpEl.outerWidth(); this.btnCrop = new Common.UI.Button({ cls: 'btn-text-split-default', caption: this.textCrop, @@ -150,9 +161,9 @@ define([ enableToggle: true, allowDepress: true, pressed: this._state.cropMode, - width: 100, + width: w, menu : new Common.UI.Menu({ - style : 'min-width: 100px;', + style : 'min-width:' + w + 'px;', items: [ { caption: this.textCrop, @@ -178,7 +189,7 @@ define([ this.btnRotate270 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-270', + iconCls: 'toolbar__icon btn-rotate-270', value: 0, hint: this.textHint270 }); @@ -188,7 +199,7 @@ define([ this.btnRotate90 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-90', + iconCls: 'toolbar__icon btn-rotate-90', value: 1, hint: this.textHint90 }); @@ -198,7 +209,7 @@ define([ this.btnFlipV = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-vert', + iconCls: 'toolbar__icon btn-flip-vert', value: 0, hint: this.textHintFlipV }); @@ -208,7 +219,7 @@ define([ this.btnFlipH = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-hor', + iconCls: 'toolbar__icon btn-flip-hor', value: 1, hint: this.textHintFlipH }); @@ -238,13 +249,13 @@ define([ var 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.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); 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.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(value).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); this._state.Height = value; } @@ -280,8 +291,8 @@ define([ 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.getCurrentMetricName(); - this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(1) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelWidth[0].innerHTML = this.textWidth + ': ' + Common.Utils.Metric.fnRecalcFromMM(w).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); + this.labelHeight[0].innerHTML = this.textHeight + ': ' + Common.Utils.Metric.fnRecalcFromMM(h).toFixed(2) + ' ' + Common.Utils.Metric.getCurrentMetricName(); var properties = new Asc.asc_CImgProperty(); properties.put_Width(w); @@ -378,6 +389,11 @@ define([ this.fireEvent('editcomplete', this); }, + setFitSlide: function() { + this.api && this.api.asc_FitImagesToSlide(); + this.fireEvent('editcomplete', this); + }, + onBtnRotateClick: function(btn) { var properties = new Asc.asc_CImgProperty(); properties.asc_putRotAdd((btn.options.value==1 ? 90 : 270) * 3.14159265358979 / 180); @@ -415,7 +431,7 @@ define([ textSize: 'Size', textWidth: 'Width', textHeight: 'Height', - textOriginalSize: 'Default Size', + textOriginalSize: 'Actual Size', textInsert: 'Replace Image', textFromUrl: 'From URL', textFromFile: 'From File', @@ -431,7 +447,8 @@ define([ textHintFlipH: 'Flip Horizontally', textCrop: 'Crop', textCropFill: 'Fill', - textCropFit: 'Fit' + textCropFit: 'Fit', + textFitSlide: 'Fit to Slide' }, PE.Views.ImageSettings || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js index fa3a58662..eda93024c 100644 --- a/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ImageSettingsAdvanced.js @@ -141,7 +141,7 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem this.btnRatio = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'advanced-btn-ratio', + iconCls: 'toolbar__icon advanced-btn-ratio', style: 'margin-bottom: 1px;', enableToggle: true, hint: this.textKeepRatio @@ -316,7 +316,7 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem }; }, - textOriginalSize: 'Default Size', + textOriginalSize: 'Actual Size', textPosition: 'Position', textSize: 'Size', textWidth: 'Width', diff --git a/apps/presentationeditor/main/app/view/ParagraphSettings.js b/apps/presentationeditor/main/app/view/ParagraphSettings.js index c848e9748..7311f8923 100644 --- a/apps/presentationeditor/main/app/view/ParagraphSettings.js +++ b/apps/presentationeditor/main/app/view/ParagraphSettings.js @@ -101,7 +101,6 @@ define([ return; if (this.api) this.api.put_PrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); - this.fireEvent('editcomplete', this); }, onNumSpacingBeforeChange: function(field, newValue, oldValue, eOpts){ @@ -112,8 +111,6 @@ define([ else this.api.put_LineSpacingBeforeAfter(0, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } - - this.fireEvent('editcomplete', this); }, onNumSpacingAfterChange: function(field, newValue, oldValue, eOpts){ @@ -124,7 +121,6 @@ define([ else this.api.put_LineSpacingBeforeAfter(1, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } - this.fireEvent('editcomplete', this); }, onLineRuleSelect: function(combo, record) { @@ -310,6 +306,9 @@ define([ this.numLineHeight.on('change', _.bind(this.onNumLineHeightChange, this)); this.numSpacingBefore.on('change', _.bind(this.onNumSpacingBeforeChange, this)); this.numSpacingAfter.on('change', _.bind(this.onNumSpacingAfterChange, this)); + this.numLineHeight.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.numSpacingBefore.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); + this.numSpacingAfter.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.cmbLineRule.on('selected', _.bind(this.onLineRuleSelect, this)); this.cmbLineRule.on('hide:after', _.bind(this.onHideMenus, this)); $(this.el).on('click', '#paragraph-advanced-link', _.bind(this.openAdvancedSettings, this)); diff --git a/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js index 9f6924427..67a59a72a 100644 --- a/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ParagraphSettingsAdvanced.js @@ -104,9 +104,9 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced ]; this._arrTabAlign = [ - { value: 1, displayValue: this.textTabLeft }, - { value: 3, displayValue: this.textTabCenter }, - { value: 2, displayValue: this.textTabRight } + { value: Asc.c_oAscTabType.Left, displayValue: this.textTabLeft }, + { value: Asc.c_oAscTabType.Center, displayValue: this.textTabCenter }, + { value: Asc.c_oAscTabType.Right, displayValue: this.textTabRight } ]; this._arrKeyTabAlign = []; this._arrTabAlign.forEach(function(item) { @@ -378,7 +378,7 @@ define([ 'text!presentationeditor/main/app/template/ParagraphSettingsAdvanced cls : 'input-group-nr', data : this._arrTabAlign }); - this.cmbAlign.setValue(1); + this.cmbAlign.setValue(Asc.c_oAscTabType.Left); this.btnAddTab = new Common.UI.Button({ el: $('#paraadv-button-add-tab') diff --git a/apps/presentationeditor/main/app/view/RightMenu.js b/apps/presentationeditor/main/app/view/RightMenu.js index 58462c338..bfe50a2a5 100644 --- a/apps/presentationeditor/main/app/view/RightMenu.js +++ b/apps/presentationeditor/main/app/view/RightMenu.js @@ -191,7 +191,7 @@ define([ }); this._settings[Common.Utils.documentSettingsType.Signature] = {panel: "id-signature-settings", btn: this.btnSignature}; - this.btnSignature.el = $('#id-right-menu-signature'); this.btnSignature.render().setVisible(true); + this.btnSignature.setElement($('#id-right-menu-signature'), false); this.btnSignature.render().setVisible(true); this.btnSignature.on('click', _.bind(this.onBtnMenuClick, this)); this.signatureSettings = new PE.Views.SignatureSettings(); } diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index 0ab44f978..cda326877 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -349,7 +349,6 @@ define([ props.put_fill(fill); this.api.ShapeApply(props); } - this.fireEvent('editcomplete', this); }, onTransparencyChange: function(field, newValue, oldValue){ @@ -531,17 +530,16 @@ define([ }); fill.get_fill().put_positions(arr); - if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_GRAD) { - if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { - fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); - fill.get_fill().put_linear_scale(true); - } - arr = []; - this.GradColor.colors.forEach(function(item){ - arr.push(Common.Utils.ThemeColor.getRgbColor(item)); - }); - fill.get_fill().put_colors(arr); + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + fill.get_fill().put_linear_angle(this.GradLinearDirectionType * 60000); + fill.get_fill().put_linear_scale(true); } + arr = []; + this.GradColor.colors.forEach(function(item){ + arr.push(Common.Utils.ThemeColor.getRgbColor(item)); + }); + fill.get_fill().put_colors(arr); + props.put_fill(fill); this.api.ShapeApply(props); this._sliderChanged = false; @@ -843,7 +841,7 @@ define([ var me = this; var colors = fill.get_colors(), positions = fill.get_positions(), - length = colors.length; + length = colors ? colors.length : this.GradColor.colors.length; this.sldrGradient.setThumbs(length); if (this.GradColor.colors.length>length) { this.GradColor.colors.splice(length, this.GradColor.colors.length - length); @@ -871,6 +869,10 @@ define([ me.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(me.GradColor.colors[index]) == 'object') ? me.GradColor.colors[index].color : me.GradColor.colors[index]), index); me.sldrGradient.setValue(index, me.GradColor.values[index]); } + if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; this.FGColor = {Value: 1, Color: this.GradColor.colors[0]}; this.BGColor = {Value: 1, Color: 'ffffff'}; @@ -1168,6 +1170,7 @@ define([ minValue: 0 }); this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.fillControls.push(this.numTransparency); this.sldrTransparency = new Common.UI.SingleSlider({ @@ -1269,6 +1272,16 @@ define([ me.GradColor.colors = colors; me.GradColor.currentIdx = currentIdx; }); + this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){ + me.GradColor.colors[index] = me.GradColor.colors[nearIndex]; + me.GradColor.currentIdx = index; + me.sldrGradient.addNewThumb(index, color); + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + }); this.fillControls.push(this.sldrGradient); this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ @@ -1308,7 +1321,7 @@ define([ this.btnRotate270 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-270', + iconCls: 'toolbar__icon btn-rotate-270', value: 0, hint: this.textHint270 }); @@ -1318,7 +1331,7 @@ define([ this.btnRotate90 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-90', + iconCls: 'toolbar__icon btn-rotate-90', value: 1, hint: this.textHint90 }); @@ -1328,7 +1341,7 @@ define([ this.btnFlipV = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-vert', + iconCls: 'toolbar__icon btn-flip-vert', value: 0, hint: this.textHintFlipV }); @@ -1338,7 +1351,7 @@ define([ this.btnFlipH = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-hor', + iconCls: 'toolbar__icon btn-flip-hor', value: 1, hint: this.textHintFlipH }); diff --git a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js index 84937cb3b..0899cc590 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/presentationeditor/main/app/view/ShapeSettingsAdvanced.js @@ -144,7 +144,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem this.btnRatio = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'advanced-btn-ratio', + iconCls: 'toolbar__icon advanced-btn-ratio', style: 'margin-bottom: 1px;', enableToggle: true, hint: this.textKeepRatio diff --git a/apps/presentationeditor/main/app/view/SlideSettings.js b/apps/presentationeditor/main/app/view/SlideSettings.js index f71abc046..8ac00a7a3 100644 --- a/apps/presentationeditor/main/app/view/SlideSettings.js +++ b/apps/presentationeditor/main/app/view/SlideSettings.js @@ -112,6 +112,7 @@ define([ this.render(); + var me = this; this._arrFillSrc = [ {displayValue: this.textColor, value: Asc.c_oAscFill.FILL_TYPE_SOLID}, {displayValue: this.textGradientFill, value: Asc.c_oAscFill.FILL_TYPE_GRAD}, @@ -129,9 +130,23 @@ define([ data: this._arrFillSrc, disabled: true }); - this.cmbFillSrc.setValue(''); + this.cmbFillSrc.setValue(Asc.c_oAscFill.FILL_TYPE_SOLID); this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this)); + this.btnBackColor = new Common.UI.ColorButton({ + style: "width:45px;", + disabled: true, + menu : new Common.UI.Menu({ + items: [ + { template: _.template('
    ') }, + { template: _.template('' + this.textNewColor + '') } + ] + }) + }); + this.btnBackColor.render( $('#slide-back-color-btn')); + this.btnBackColor.setColor('ffffff'); + this.FillItems.push(this.btnBackColor); + this.FillColorContainer = $('#slide-panel-color-fill'); this.FillImageContainer = $('#slide-panel-image-fill'); this.FillPatternContainer = $('#slide-panel-pattern-fill'); @@ -207,6 +222,7 @@ define([ disabled: true }); this.numDuration.on('change', _.bind(this.onDurationChange, this)); + this.numDuration.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.numDelay = new Common.UI.MetricSpinner({ el: $('#slide-spin-delay'), @@ -219,6 +235,7 @@ define([ disabled: true }); this.numDelay.on('change', _.bind(this.onDelayChange, this)); + this.numDelay.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.chStartOnClick = new Common.UI.CheckBox({ el: $('#slide-checkbox-start-click'), @@ -804,6 +821,16 @@ define([ me.GradColor.colors = colors; me.GradColor.currentIdx = currentIdx; }); + this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){ + me.GradColor.colors[index] = me.GradColor.colors[nearIndex]; + me.GradColor.currentIdx = index; + me.sldrGradient.addNewThumb(index, color); + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + }); this.FillItems.push(this.sldrGradient); }, @@ -998,7 +1025,6 @@ define([ props.put_timing(timing); this.api.SetSlideProps(props); } - this.fireEvent('editcomplete', this); }, onDelayChange: function(field, newValue, oldValue, eOpts){ @@ -1009,7 +1035,6 @@ define([ props.put_timing(timing); this.api.SetSlideProps(props); } - this.fireEvent('editcomplete', this); }, onStartOnClickChange: function(field, newValue, oldValue, eOpts){ @@ -1046,20 +1071,7 @@ define([ UpdateThemeColors: function() { if (this._initSettings) return; - if (!this.btnBackColor) { - this.btnBackColor = new Common.UI.ColorButton({ - style: "width:45px;", - disabled: true, - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
    ') }, - { template: _.template('' + this.textNewColor + '') } - ] - }) - }); - this.btnBackColor.render( $('#slide-back-color-btn')); - this.btnBackColor.setColor('ffffff'); - this.FillItems.push(this.btnBackColor); + if (!this.colorsBack) { this.colorsBack = new Common.UI.ThemeColorPalette({ el: $('#slide-back-color-menu'), value: 'ffffff', @@ -1254,7 +1266,7 @@ define([ var me = this; var colors = fill.get_colors(), positions = fill.get_positions(), - length = colors.length; + length = colors ? colors.length : this.GradColor.colors.length; this.sldrGradient.setThumbs(length); if (this.GradColor.colors.length>length) { this.GradColor.colors.splice(length, this.GradColor.colors.length - length); @@ -1282,6 +1294,10 @@ define([ me.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(me.GradColor.colors[index]) == 'object') ? me.GradColor.colors[index].color : me.GradColor.colors[index]), index); me.sldrGradient.setValue(index, me.GradColor.values[index]); } + if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; this.FGColor = {Value: 1, Color: this.GradColor.colors[0]}; this.BGColor = {Value: 1, Color: 'ffffff'}; diff --git a/apps/presentationeditor/main/app/view/SlideSizeSettings.js b/apps/presentationeditor/main/app/view/SlideSizeSettings.js index 19ec636ca..2d82c2ea9 100644 --- a/apps/presentationeditor/main/app/view/SlideSizeSettings.js +++ b/apps/presentationeditor/main/app/view/SlideSizeSettings.js @@ -61,7 +61,7 @@ define([ this.template = [ '
    ', '
    ', - '', + '', '
    ', '
    ', '', @@ -77,7 +77,7 @@ define([ '', '
    ', '
    ', - '', + '', '
    ', '
    ', '
    ', diff --git a/apps/presentationeditor/main/app/view/Statusbar.js b/apps/presentationeditor/main/app/view/Statusbar.js index 07b70a2b6..bc1f27ab4 100644 --- a/apps/presentationeditor/main/app/view/Statusbar.js +++ b/apps/presentationeditor/main/app/view/Statusbar.js @@ -231,7 +231,7 @@ define([ this.btnPreview = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-preview', + iconCls: 'toolbar__icon btn-preview', hint: this.tipPreview, hintAnchor: 'top', split: true, diff --git a/apps/presentationeditor/main/app/view/TableSettings.js b/apps/presentationeditor/main/app/view/TableSettings.js index 4fc127f91..dae5bb44a 100644 --- a/apps/presentationeditor/main/app/view/TableSettings.js +++ b/apps/presentationeditor/main/app/view/TableSettings.js @@ -280,22 +280,22 @@ define([ this.chColBanded.on('change', _.bind(this.onCheckTemplateChange, this, 5)); var _arrBorderPosition = [ - ['l', 'btn-borders-small btn-position-left', 'table-button-border-left', this.tipLeft], - ['c','btn-borders-small btn-position-inner-vert', 'table-button-border-inner-vert', this.tipInnerVert], - ['r','btn-borders-small btn-position-right', 'table-button-border-right', this.tipRight], - ['t','btn-borders-small btn-position-top', 'table-button-border-top', this.tipTop], - ['m','btn-borders-small btn-position-inner-hor', 'table-button-border-inner-hor', this.tipInnerHor], - ['b', 'btn-borders-small btn-position-bottom', 'table-button-border-bottom', this.tipBottom], - ['cm', 'btn-borders-small btn-position-inner', 'table-button-border-inner', this.tipInner], - ['lrtb', 'btn-borders-small btn-position-outer', 'table-button-border-outer', this.tipOuter], - ['lrtbcm', 'btn-borders-small btn-position-all', 'table-button-border-all', this.tipAll], - ['', 'btn-borders-small btn-position-none', 'table-button-border-none', this.tipNone] + ['l', 'toolbar__icon btn-border-left', 'table-button-border-left', this.tipLeft], + ['c', 'toolbar__icon btn-border-insidevert', 'table-button-border-inner-vert', this.tipInnerVert], + ['r', 'toolbar__icon btn-border-right', 'table-button-border-right', this.tipRight], + ['t', 'toolbar__icon btn-border-top', 'table-button-border-top', this.tipTop], + ['m', 'toolbar__icon btn-border-insidehor', 'table-button-border-inner-hor', this.tipInnerHor], + ['b', 'toolbar__icon btn-border-bottom', 'table-button-border-bottom', this.tipBottom], + ['cm', 'toolbar__icon btn-border-inside', 'table-button-border-inner', this.tipInner], + ['lrtb', 'toolbar__icon btn-border-out', 'table-button-border-outer', this.tipOuter], + ['lrtbcm', 'toolbar__icon btn-border-all', 'table-button-border-all', this.tipAll], + ['', 'toolbar__icon btn-border-no', 'table-button-border-none', this.tipNone] ]; this._btnsBorderPosition = []; _.each(_arrBorderPosition, function(item, index, list){ var _btn = new Common.UI.Button({ - cls: 'btn-toolbar', + cls: 'btn-toolbar borders--small', iconCls: item[1], strId :item[0], hint: item[3] @@ -367,6 +367,7 @@ define([ _props.put_RowHeight(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this.api.tblApply(_props); }, this)); + this.numHeight.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.lockedControls.push(this.numHeight); this.spinners.push(this.numHeight); @@ -384,6 +385,7 @@ define([ _props.put_ColumnWidth(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this.api.tblApply(_props); }, this)); + this.numWidth.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.lockedControls.push(this.numWidth); this.spinners.push(this.numWidth); diff --git a/apps/presentationeditor/main/app/view/TextArtSettings.js b/apps/presentationeditor/main/app/view/TextArtSettings.js index 7d1690829..f49ff4feb 100644 --- a/apps/presentationeditor/main/app/view/TextArtSettings.js +++ b/apps/presentationeditor/main/app/view/TextArtSettings.js @@ -354,7 +354,6 @@ define([ this.shapeprops.put_TextArtProperties(props); this.api.ShapeApply(this.shapeprops); } - this.fireEvent('editcomplete', this); }, onTransparencyChange: function(field, newValue, oldValue){ @@ -818,7 +817,7 @@ define([ var me = this; var colors = fill.get_colors(), positions = fill.get_positions(), - length = colors.length; + length = colors ? colors.length : this.GradColor.colors.length; this.sldrGradient.setThumbs(length); if (this.GradColor.colors.length>length) { this.GradColor.colors.splice(length, this.GradColor.colors.length - length); @@ -846,6 +845,10 @@ define([ me.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(me.GradColor.colors[index]) == 'object') ? me.GradColor.colors[index].color : me.GradColor.colors[index]), index); me.sldrGradient.setValue(index, me.GradColor.values[index]); } + if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; this.FGColor = {Value: 1, Color: this.GradColor.colors[0]}; this.BGColor = {Value: 1, Color: 'ffffff'}; @@ -1152,6 +1155,7 @@ define([ minValue: 0 }); this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ me.fireEvent('editcomplete', me);}); this.lockedControls.push(this.numTransparency); this.sldrTransparency = new Common.UI.SingleSlider({ @@ -1253,6 +1257,16 @@ define([ me.GradColor.colors = colors; me.GradColor.currentIdx = currentIdx; }); + this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){ + me.GradColor.colors[index] = me.GradColor.colors[nearIndex]; + me.GradColor.currentIdx = index; + me.sldrGradient.addNewThumb(index, color); + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + }); this.lockedControls.push(this.sldrGradient); this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ diff --git a/apps/presentationeditor/main/app/view/Toolbar.js b/apps/presentationeditor/main/app/view/Toolbar.js index ee4c99e5c..ee7c56ce9 100644 --- a/apps/presentationeditor/main/app/view/Toolbar.js +++ b/apps/presentationeditor/main/app/view/Toolbar.js @@ -121,7 +121,7 @@ define([ applyLayout: function (config) { var me = this; - + me.lockControls = []; if ( config.isEdit ) { Common.UI.Mixtbar.prototype.initialize.call(this, { template: _.template(template), @@ -144,7 +144,7 @@ define([ me.btnChangeSlide = new Common.UI.Button({ id: 'id-toolbar-button-change-slide', cls: 'btn-toolbar', - iconCls: 'btn-changeslide', + iconCls: 'toolbar__icon btn-changeslide', lock: [_set.menuFileOpen, _set.slideDeleted, _set.slideLock, _set.lostConnect, _set.noSlides, _set.disableOnStart], menu: true }); @@ -153,7 +153,7 @@ define([ me.btnPreview = new Common.UI.Button({ id: 'id-toolbar-button-preview', cls: 'btn-toolbar', - iconCls: 'btn-preview', + iconCls: 'toolbar__icon btn-preview', lock: [_set.menuFileOpen, _set.slideDeleted, _set.noSlides, _set.disableOnStart], split: true, menu: new Common.UI.Menu({ @@ -175,7 +175,7 @@ define([ me.btnPrint = new Common.UI.Button({ id: 'id-toolbar-btn-print', cls: 'btn-toolbar', - iconCls: 'btn-print no-mask', + iconCls: 'toolbar__icon btn-print no-mask', lock: [_set.slideDeleted, _set.noSlides, _set.cantPrint, _set.disableOnStart], signals: ['disabled'] }); @@ -184,7 +184,7 @@ define([ me.btnSave = new Common.UI.Button({ id: 'id-toolbar-btn-save', cls: 'btn-toolbar', - iconCls: 'no-mask ' + me.btnSaveCls, + iconCls: 'toolbar__icon no-mask ' + me.btnSaveCls, lock: [_set.lostConnect], signals: ['disabled'] }); @@ -193,7 +193,7 @@ define([ me.btnUndo = new Common.UI.Button({ id: 'id-toolbar-btn-undo', cls: 'btn-toolbar', - iconCls: 'btn-undo', + iconCls: 'toolbar__icon btn-undo', lock: [_set.undoLock, _set.slideDeleted, _set.lostConnect, _set.disableOnStart], signals: ['disabled'] }); @@ -202,7 +202,7 @@ define([ me.btnRedo = new Common.UI.Button({ id: 'id-toolbar-btn-redo', cls: 'btn-toolbar', - iconCls: 'btn-redo', + iconCls: 'toolbar__icon btn-redo', lock: [_set.redoLock, _set.slideDeleted, _set.lostConnect, _set.disableOnStart], signals: ['disabled'] }); @@ -211,7 +211,7 @@ define([ me.btnCopy = new Common.UI.Button({ id: 'id-toolbar-btn-copy', cls: 'btn-toolbar', - iconCls: 'btn-copy', + iconCls: 'toolbar__icon btn-copy', lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart] }); me.slideOnlyControls.push(me.btnCopy); @@ -219,7 +219,7 @@ define([ me.btnPaste = new Common.UI.Button({ id: 'id-toolbar-btn-paste', cls: 'btn-toolbar', - iconCls: 'btn-paste', + iconCls: 'toolbar__icon btn-paste', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides] }); me.paragraphControls.push(me.btnPaste); @@ -264,7 +264,7 @@ define([ me.btnBold = new Common.UI.Button({ id: 'id-toolbar-btn-bold', cls: 'btn-toolbar', - iconCls: 'btn-bold', + iconCls: 'toolbar__icon btn-bold', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock], enableToggle: true }); @@ -273,7 +273,7 @@ define([ me.btnItalic = new Common.UI.Button({ id: 'id-toolbar-btn-italic', cls: 'btn-toolbar', - iconCls: 'btn-italic', + iconCls: 'toolbar__icon btn-italic', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock], enableToggle: true }); @@ -282,7 +282,7 @@ define([ me.btnUnderline = new Common.UI.Button({ id: 'id-toolbar-btn-underline', cls: 'btn-toolbar', - iconCls: 'btn-underline', + iconCls: 'toolbar__icon btn-underline', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock], enableToggle: true }); @@ -291,7 +291,7 @@ define([ me.btnStrikeout = new Common.UI.Button({ id: 'id-toolbar-btn-strikeout', cls: 'btn-toolbar', - iconCls: 'btn-strikeout', + iconCls: 'toolbar__icon btn-strikeout', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock], enableToggle: true }); @@ -300,7 +300,7 @@ define([ me.btnSuperscript = new Common.UI.Button({ id: 'id-toolbar-btn-superscript', cls: 'btn-toolbar', - iconCls: 'btn-superscript', + iconCls: 'toolbar__icon btn-superscript', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock, _set.inEquation], enableToggle: true, toggleGroup: 'superscriptGroup' @@ -310,7 +310,7 @@ define([ me.btnSubscript = new Common.UI.Button({ id: 'id-toolbar-btn-subscript', cls: 'btn-toolbar', - iconCls: 'btn-subscript', + iconCls: 'toolbar__icon btn-subscript', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock, _set.inEquation], enableToggle: true, toggleGroup: 'superscriptGroup' @@ -320,7 +320,7 @@ define([ me.btnFontColor = new Common.UI.Button({ id: 'id-toolbar-btn-fontcolor', cls: 'btn-toolbar', - iconCls: 'btn-fontcolor', + iconCls: 'toolbar__icon btn-fontcolor', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.shapeLock], split: true, menu: new Common.UI.Menu({ @@ -335,7 +335,7 @@ define([ me.btnClearStyle = new Common.UI.Button({ id: 'id-toolbar-btn-clearstyle', cls: 'btn-toolbar', - iconCls: 'btn-clearstyle', + iconCls: 'toolbar__icon btn-clearstyle', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noParagraphSelected] }); me.paragraphControls.push(me.btnClearStyle); @@ -343,7 +343,7 @@ define([ me.btnCopyStyle = new Common.UI.Button({ id: 'id-toolbar-btn-copystyle', cls: 'btn-toolbar', - iconCls: 'btn-copystyle', + iconCls: 'toolbar__icon btn-copystyle', lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.noParagraphSelected, _set.disableOnStart], enableToggle: true }); @@ -352,7 +352,7 @@ define([ me.btnMarkers = new Common.UI.Button({ id: 'id-toolbar-btn-markers', cls: 'btn-toolbar', - iconCls: 'btn-setmarkers', + iconCls: 'toolbar__icon btn-setmarkers', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected], enableToggle: true, toggleGroup: 'markersGroup', @@ -364,7 +364,7 @@ define([ me.btnNumbers = new Common.UI.Button({ id: 'id-toolbar-btn-numbering', cls: 'btn-toolbar', - iconCls: 'btn-numbering', + iconCls: 'toolbar__icon btn-numbering', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected], enableToggle: true, toggleGroup: 'markersGroup', @@ -391,41 +391,45 @@ define([ me.btnHorizontalAlign = new Common.UI.Button({ id: 'id-toolbar-btn-halign', cls: 'btn-toolbar', - iconCls: 'btn-align-left', + iconCls: 'toolbar__icon btn-align-left', icls: 'btn-align-left', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected], menu: new Common.UI.Menu({ items: [ { caption: me.textAlignLeft + Common.Utils.String.platformKey('Ctrl+L'), - iconCls: 'mnu-align-left', + iconCls: 'menu__icon btn-align-left', icls: 'btn-align-left', checkable: true, + checkmark: false, toggleGroup: 'halignGroup', checked: true, value: 1 }, { caption: me.textAlignCenter + Common.Utils.String.platformKey('Ctrl+E'), - iconCls: 'mnu-align-center', + iconCls: 'menu__icon btn-align-center', icls: 'btn-align-center', checkable: true, + checkmark: false, toggleGroup: 'halignGroup', value: 2 }, { caption: me.textAlignRight + Common.Utils.String.platformKey('Ctrl+R'), - iconCls: 'mnu-align-right', + iconCls: 'menu__icon btn-align-right', icls: 'btn-align-right', checkable: true, + checkmark: false, toggleGroup: 'halignGroup', value: 0 }, { caption: me.textAlignJust + Common.Utils.String.platformKey('Ctrl+J'), - iconCls: 'mnu-align-just', + iconCls: 'menu__icon btn-align-just', icls: 'btn-align-just', checkable: true, + checkmark: false, toggleGroup: 'halignGroup', value: 3 } @@ -438,32 +442,35 @@ define([ id: 'id-toolbar-btn-valign', cls: 'btn-toolbar', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected, _set.noObjectSelected], - iconCls: 'btn-align-middle', + iconCls: 'toolbar__icon btn-align-middle', icls: 'btn-align-middle', menu: new Common.UI.Menu({ items: [ { caption: me.textAlignTop, - iconCls: 'mnu-align-top', + iconCls: 'menu__icon btn-align-top', icls: 'btn-align-top', checkable: true, + checkmark: false, toggleGroup: 'valignGroup', value: Asc.c_oAscVAlign.Top }, { caption: me.textAlignMiddle, - iconCls: 'mnu-align-middle', + iconCls: 'menu__icon btn-align-middle', icls: 'btn-align-middle', checkable: true, + checkmark: false, toggleGroup: 'valignGroup', value: Asc.c_oAscVAlign.Center, checked: true }, { caption: me.textAlignBottom, - iconCls: 'mnu-align-bottom', + iconCls: 'menu__icon btn-align-bottom', icls: 'btn-align-bottom', checkable: true, + checkmark: false, toggleGroup: 'valignGroup', value: Asc.c_oAscVAlign.Bottom } @@ -475,7 +482,7 @@ define([ me.btnDecLeftOffset = new Common.UI.Button({ id: 'id-toolbar-btn-decoffset', cls: 'btn-toolbar', - iconCls: 'btn-decoffset', + iconCls: 'toolbar__icon btn-decoffset', lock: [_set.decIndentLock, _set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noParagraphSelected] }); me.paragraphControls.push(me.btnDecLeftOffset); @@ -483,7 +490,7 @@ define([ me.btnIncLeftOffset = new Common.UI.Button({ id: 'id-toolbar-btn-incoffset', cls: 'btn-toolbar', - iconCls: 'btn-incoffset', + iconCls: 'toolbar__icon btn-incoffset', lock: [_set.incIndentLock, _set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noParagraphSelected] }); me.paragraphControls.push(me.btnIncLeftOffset); @@ -491,7 +498,7 @@ define([ me.btnLineSpace = new Common.UI.Button({ id: 'id-toolbar-btn-linespace', cls: 'btn-toolbar', - iconCls: 'btn-linespace', + iconCls: 'toolbar__icon btn-linespace', lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noTextSelected], menu: new Common.UI.Menu({ style: 'min-width: 60px;', @@ -510,7 +517,7 @@ define([ me.btnInsertTable = new Common.UI.Button({ id: 'tlbtn-inserttable', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-inserttable', + iconCls: 'toolbar__icon btn-inserttable', caption: me.capInsertTable, lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart], menu: new Common.UI.Menu({ @@ -525,7 +532,7 @@ define([ me.btnInsertChart = new Common.UI.Button({ id: 'tlbtn-insertchart', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-insertchart', + iconCls: 'toolbar__icon btn-insertchart', caption: me.capInsertChart, lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart], menu: true @@ -535,7 +542,7 @@ define([ me.btnInsertEquation = new Common.UI.Button({ id: 'tlbtn-insertequation', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-insertequation', + iconCls: 'toolbar__icon btn-insertequation', caption: me.capInsertEquation, lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart], split: true, @@ -543,10 +550,19 @@ define([ }); me.slideOnlyControls.push(this.btnInsertEquation); + me.btnInsertSymbol = new Common.UI.Button({ + id: 'tlbtn-insertsymbol', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-symbol', + caption: me.capBtnInsSymbol, + lock: [_set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noParagraphSelected] + }); + me.paragraphControls.push(me.btnInsertSymbol); + me.btnInsertHyperlink = new Common.UI.Button({ id: 'tlbtn-insertlink', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-inserthyperlink', + iconCls: 'toolbar__icon btn-inserthyperlink', caption: me.capInsertHyperlink, lock: [_set.hyperlinkLock, _set.slideDeleted, _set.paragraphLock, _set.lostConnect, _set.noSlides, _set.noParagraphSelected] }); @@ -555,7 +571,7 @@ define([ me.btnInsertTextArt = new Common.UI.Button({ id: 'tlbtn-inserttextart', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-textart', + iconCls: 'toolbar__icon btn-textart', caption: me.capInsertTextArt, lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart], menu: new Common.UI.Menu({ @@ -570,7 +586,7 @@ define([ me.btnEditHeader = new Common.UI.Button({ id: 'id-toolbar-btn-editheader', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-editheader', + iconCls: 'toolbar__icon btn-editheader', caption: me.capBtnInsHeader, lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart] }); @@ -579,7 +595,7 @@ define([ me.btnInsDateTime = new Common.UI.Button({ id: 'id-toolbar-btn-datetime', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-datetime', + iconCls: 'toolbar__icon btn-datetime', caption: me.capBtnDateTime, lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.paragraphLock, _set.disableOnStart] }); @@ -588,7 +604,7 @@ define([ me.btnInsSlideNum = new Common.UI.Button({ id: 'id-toolbar-btn-slidenum', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-pagenum', + iconCls: 'toolbar__icon btn-pagenum', caption: me.capBtnSlideNum, lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.paragraphLock, _set.disableOnStart] }); @@ -597,7 +613,7 @@ define([ me.btnColorSchemas = new Common.UI.Button({ id: 'id-toolbar-btn-colorschemas', cls: 'btn-toolbar', - iconCls: 'btn-colorschemas', + iconCls: 'toolbar__icon btn-colorschemas', lock: [_set.themeLock, _set.slideDeleted, _set.lostConnect, _set.noSlides, _set.disableOnStart], menu: new Common.UI.Menu({ items: [], @@ -625,50 +641,50 @@ define([ me.mniDistribHor = new Common.UI.MenuItem({ caption: me.txtDistribHor, - iconCls: 'mnu-distrib-hor', + iconCls: 'menu__icon shape-distribute-hor', value: 6 }); me.mniDistribVert = new Common.UI.MenuItem({ caption: me.txtDistribVert, - iconCls: 'mnu-distrib-vert', + iconCls: 'menu__icon shape-distribute-vert', value: 7 }); me.btnShapeAlign = new Common.UI.Button({ id: 'id-toolbar-btn-shape-align', cls: 'btn-toolbar', - iconCls: 'btn-align-shape', + iconCls: 'toolbar__icon btn-shape-alignleft', lock: [_set.slideDeleted, _set.shapeLock, _set.lostConnect, _set.noSlides, _set.noObjectSelected, _set.disableOnStart], menu: new Common.UI.Menu({ items: [ { caption: me.textShapeAlignLeft, - iconCls: 'mnu-shape-align-left', + iconCls: 'menu__icon shape-align-left', value: Asc.c_oAscAlignShapeType.ALIGN_LEFT }, { caption: me.textShapeAlignCenter, - iconCls: 'mnu-shape-align-center', + iconCls: 'menu__icon shape-align-center', value: Asc.c_oAscAlignShapeType.ALIGN_CENTER }, { caption: me.textShapeAlignRight, - iconCls: 'mnu-shape-align-right', + iconCls: 'menu__icon shape-align-right', value: Asc.c_oAscAlignShapeType.ALIGN_RIGHT }, { caption: me.textShapeAlignTop, - iconCls: 'mnu-shape-align-top', + iconCls: 'menu__icon shape-align-top', value: Asc.c_oAscAlignShapeType.ALIGN_TOP }, { caption: me.textShapeAlignMiddle, - iconCls: 'mnu-shape-align-middle', + iconCls: 'menu__icon shape-align-middle', value: Asc.c_oAscAlignShapeType.ALIGN_MIDDLE }, { caption: me.textShapeAlignBottom, - iconCls: 'mnu-shape-align-bottom', + iconCls: 'menu__icon shape-align-bottom', value: Asc.c_oAscAlignShapeType.ALIGN_BOTTOM }, {caption: '--'}, @@ -686,39 +702,39 @@ define([ me.btnShapeArrange = new Common.UI.Button({ id: 'id-toolbar-btn-shape-arrange', cls: 'btn-toolbar', - iconCls: 'btn-arrange-shape', + iconCls: 'toolbar__icon arrange-front', lock: [_set.slideDeleted, _set.lostConnect, _set.noSlides, _set.noObjectSelected, _set.disableOnStart], menu: new Common.UI.Menu({ items: [ { caption: me.textArrangeFront, - iconCls: 'mnu-arrange-front', + iconCls: 'menu__icon arrange-front', value: 1 }, { caption: me.textArrangeBack, - iconCls: 'mnu-arrange-back', + iconCls: 'menu__icon arrange-back', value: 2 }, { caption: me.textArrangeForward, - iconCls: 'mnu-arrange-forward', + iconCls: 'menu__icon arrange-forward', value: 3 }, { caption: me.textArrangeBackward, - iconCls: 'mnu-arrange-backward', + iconCls: 'menu__icon arrange-backward', value: 4 }, {caption: '--'}, me.mnuGroupShapes = new Common.UI.MenuItem({ caption: me.txtGroup, - iconCls: 'mnu-group', + iconCls: 'menu__icon shape-group', value: 5 }), me.mnuUnGroupShapes = new Common.UI.MenuItem({ caption: me.txtUngroup, - iconCls: 'mnu-ungroup', + iconCls: 'menu__icon shape-ungroup', value: 6 }) ] @@ -729,7 +745,7 @@ define([ me.btnSlideSize = new Common.UI.Button({ id: 'id-toolbar-btn-slide-size', cls: 'btn-toolbar', - iconCls: 'btn-slidesize', + iconCls: 'toolbar__icon btn-slidesize', lock: [_set.docPropsLock, _set.slideDeleted, _set.lostConnect, _set.disableOnStart], menu: new Common.UI.Menu({ items: [ @@ -815,7 +831,7 @@ define([ this.btnSubscript, this.btnFontColor, this.btnClearStyle, this.btnCopyStyle, this.btnMarkers, this.btnNumbers, this.btnDecLeftOffset, this.btnIncLeftOffset, this.btnLineSpace, this.btnHorizontalAlign, this.btnVerticalAlign, this.btnShapeArrange, this.btnShapeAlign, this.btnInsertTable, this.btnInsertChart, - this.btnInsertEquation, this.btnInsertHyperlink, this.btnColorSchemas, this.btnSlideSize, this.listTheme, this.mnuShowSettings + this.btnInsertEquation, this.btnInsertSymbol, this.btnInsertHyperlink, this.btnColorSchemas, this.btnSlideSize, this.listTheme, this.mnuShowSettings ]; // Disable all components before load document @@ -933,6 +949,7 @@ define([ _injectComponent('#slot-btn-arrange-shape', this.btnShapeArrange); _injectComponent('#slot-btn-align-shape', this.btnShapeAlign); _injectComponent('#slot-btn-insertequation', this.btnInsertEquation); + _injectComponent('#slot-btn-inssymbol', this.btnInsertSymbol); _injectComponent('#slot-btn-insertlink', this.btnInsertHyperlink); _injectComponent('#slot-btn-inserttable', this.btnInsertTable); _injectComponent('#slot-btn-insertchart', this.btnInsertChart); @@ -944,13 +961,13 @@ define([ _injectComponent('#slot-btn-datetime', this.btnInsDateTime); _injectComponent('#slot-btn-slidenum', this.btnInsSlideNum); - this.btnsInsertImage = Common.Utils.injectButtons($host.find('.slot-insertimg'), 'tlbtn-insertimage-', 'btn-insertimage', this.capInsertImage, + this.btnsInsertImage = Common.Utils.injectButtons($host.find('.slot-insertimg'), 'tlbtn-insertimage-', 'toolbar__icon btn-insertimage', this.capInsertImage, [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, true); - this.btnsInsertText = Common.Utils.injectButtons($host.find('.slot-instext'), 'tlbtn-inserttext-', 'btn-text', this.capInsertText, + this.btnsInsertText = Common.Utils.injectButtons($host.find('.slot-instext'), 'tlbtn-inserttext-', 'toolbar__icon btn-text', this.capInsertText, [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, false, true); - this.btnsInsertShape = Common.Utils.injectButtons($host.find('.slot-insertshape'), 'tlbtn-insertshape-', 'btn-insertshape', this.capInsertShape, + this.btnsInsertShape = Common.Utils.injectButtons($host.find('.slot-insertshape'), 'tlbtn-insertshape-', 'toolbar__icon btn-insertshape', this.capInsertShape, [PE.enumLock.slideDeleted, PE.enumLock.lostConnect, PE.enumLock.noSlides, PE.enumLock.disableOnStart], false, true, true); - this.btnsAddSlide = Common.Utils.injectButtons($host.find('.slot-addslide'), 'tlbtn-addslide-', 'btn-addslide', this.capAddSlide, + this.btnsAddSlide = Common.Utils.injectButtons($host.find('.slot-addslide'), 'tlbtn-addslide-', 'toolbar__icon btn-addslide', this.capAddSlide, [PE.enumLock.menuFileOpen, PE.enumLock.lostConnect, PE.enumLock.disableOnStart], true, true); var created = this.btnsInsertImage.concat(this.btnsInsertText, this.btnsInsertShape, this.btnsAddSlide); @@ -1044,6 +1061,7 @@ define([ this.btnInsertTable.updateHint(this.tipInsertTable); this.btnInsertChart.updateHint(this.tipInsertChart); this.btnInsertEquation.updateHint(this.tipInsertEquation); + this.btnInsertSymbol.updateHint(this.tipInsertSymbol); this.btnInsertHyperlink.updateHint(this.tipInsertHyperlink + Common.Utils.String.platformKey('Ctrl+K')); this.btnInsertTextArt.updateHint(this.tipInsertTextArt); this.btnColorSchemas.updateHint(this.tipColorSchemas); @@ -1062,7 +1080,12 @@ define([ new Common.UI.Menu({ style: 'min-width: 139px', items: [ - {template: _.template('')} + {template: _.template('')}, + this.mnuMarkerSettings = new Common.UI.MenuItem({ + caption: this.textListSettings, + disabled: (this.mnuMarkersPicker.conf.index || 0)==0, + value: 'settings' + }) ] }) ); @@ -1070,7 +1093,12 @@ define([ this.btnNumbers.setMenu( new Common.UI.Menu({ items: [ - {template: _.template('')} + {template: _.template('')}, + this.mnuNumberSettings = new Common.UI.MenuItem({ + caption: this.textListSettings, + disabled: (this.mnuNumbersPicker.conf.index || 0)==0, + value: 'settings' + }) ] }) ); @@ -1096,48 +1124,8 @@ define([ parentMenu: menu, showLast: false, restoreHeight: 421, - groups: new Common.UI.DataViewGroupStore([ - {id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts}, - {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, inline: true}, - {id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true}, - {id: 'menu-chart-group-stock', caption: me.textStock, inline: true} - // {id: 'menu-chart-group-surface', caption: me.textSurface} - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} - - ]), + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData(true)), + store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()), itemTemplate: _.template('
    ') }); picker.on('item:click', function (picker, item, record, e) { @@ -1340,7 +1328,7 @@ define([ } this._state.hasCollaborativeChanges = true; - this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass('btn-synch'); + this.btnCollabChanges.cmpEl.addClass('notify'); if (this.showSynchTip) { this.btnCollabChanges.updateHint(''); if (this.synchTooltip === undefined) @@ -1376,8 +1364,8 @@ define([ if (this.btnCollabChanges.rendered) { var me = this; - if ( me.btnCollabChanges.$icon.hasClass('btn-synch') ) { - me.btnCollabChanges.$icon.removeClass('btn-synch').addClass(this.btnSaveCls); + if ( me.btnCollabChanges.cmpEl.hasClass('notify') ) { + me.btnCollabChanges.cmpEl.removeClass('notify'); if (this.synchTooltip) this.synchTooltip.hide(); this.btnCollabChanges.updateHint(this.btnSaveTip); @@ -1399,11 +1387,8 @@ define([ var cls = (length > 1) ? 'btn-save-coauth' : 'btn-save'; if (cls !== this.btnSaveCls && this.btnCollabChanges.rendered) { this.btnSaveTip = ((length > 1) ? this.tipSaveCoauth : this.tipSave ) + Common.Utils.String.platformKey('Ctrl+S'); - - if ( !this.btnCollabChanges.$icon.hasClass('btn-synch') ) { - this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(cls); - this.btnCollabChanges.updateHint(this.btnSaveTip); - } + this.btnCollabChanges.updateHint(this.btnSaveTip); + this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(cls); this.btnSaveCls = cls; } }, @@ -1520,6 +1505,7 @@ define([ if (change && this.mnuSlidePicker) picker.options.layout_index = this.mnuSlidePicker.options.layout_index; this.mnuSlidePicker = picker; + this.mnuSlidePicker._needRecalcSlideLayout = true; }; me.btnsAddSlide.concat(me.btnChangeSlide).forEach(function (btn, index) { btn.menu.on('show:before', me.binding.onShowBeforeAddSlide, btn); @@ -1599,13 +1585,6 @@ define([ mniSlideAdvanced: 'Advanced Settings', tipSlideSize: 'Select Slide Size', tipInsertChart: 'Insert Chart', - textLine: 'Line', - textColumn: 'Column', - textBar: 'Bar', - textArea: 'Area', - textPie: 'Pie', - textPoint: 'XY (Scatter)', - textStock: 'Stock', tipSynchronize: 'The document has been changed by another user. Please click to save your changes and reload the updates.', txtScheme1: 'Office', txtScheme2: 'Grayscale', @@ -1634,7 +1613,6 @@ define([ textShowCurrent: 'Show from Current slide', textShowSettings: 'Show Settings', tipInsertEquation: 'Insert Equation', - textCharts: 'Charts', tipChangeChart: 'Change Chart Type', capInsertText: 'Text', capInsertTextArt: 'Text Art', @@ -1652,19 +1630,22 @@ define([ textTabFile: 'File', textTabHome: 'Home', textTabInsert: 'Insert', - textSurface: 'Surface', textShowPresenterView: 'Show presenter view', textTabCollaboration: 'Collaboration', textTabProtect: 'Protection', mniImageFromStorage: 'Image from Storage', txtSlideAlign: 'Align to Slide', txtObjectsAlign: 'Align Selected Objects', - tipEditHeader: 'Edit header or footer', + tipEditHeader: 'Edit footer', tipSlideNum: 'Insert slide number', tipDateTime: 'Insert current date and time', - capBtnInsHeader: 'Header/Footer', + capBtnInsHeader: 'Footer', capBtnSlideNum: 'Slide Number', - capBtnDateTime: 'Date & Time' + capBtnDateTime: 'Date & Time', + textListSettings: 'List Settings', + capBtnAddComment: 'Add Comment', + capBtnInsSymbol: 'Symbol', + tipInsertSymbol: 'Insert symbol' } }()), PE.Views.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/presentationeditor/main/index.html b/apps/presentationeditor/main/index.html index 1cf255116..56f0d0641 100644 --- a/apps/presentationeditor/main/index.html +++ b/apps/presentationeditor/main/index.html @@ -17,19 +17,20 @@ width: 100%; overflow: hidden; border: none; - background-color: #f4f4f4; + background-color: #e2e2e2; z-index: 1001; } .loadmask > .brendpanel { width: 100%; - height: 56px; + min-height: 32px; background: #aa5252; } .loadmask > .brendpanel > div { display: flex; align-items: center; + height: 28px; } .loadmask > .brendpanel .loading-logo { @@ -49,15 +50,6 @@ margin-left: auto; } - .loadmask > .brendpanel .circle { - vertical-align: middle; - width: 20px; - height: 20px; - border-radius: 12px; - margin: 4px 10px; - background: rgba(255, 255, 255, 0.2); - } - .loadmask > .brendpanel .rect { vertical-align: middle; width: 50px; @@ -68,8 +60,8 @@ } .loadmask > .sktoolbar { - background: #fafafa; - border-bottom: 1px solid #e2e2e2; + background: #f1f1f1; + border-bottom: 1px solid #cbcbcb; height: 46px; padding: 10px 12px; box-sizing: content-box; @@ -80,11 +72,6 @@ padding: 0; white-space: nowrap; position: relative; - - -webkit-animation: flickerAnimation 2s infinite ease-in-out; - -moz-animation: flickerAnimation 2s infinite ease-in-out; - -o-animation: flickerAnimation 2s infinite ease-in-out; - animation: flickerAnimation 2s infinite ease-in-out; } .loadmask > .sktoolbar li { @@ -167,27 +154,27 @@ .loadmask > .placeholder .slide-container > .line:nth-child(1) { height: 30%; - margin: 120px 80px 0; + margin: 10% 80px 0; } @keyframes flickerAnimation { 0% { opacity:1; } - 50% { opacity:0.3; } + 50% { opacity:0.5; } 100% { opacity:1; } } @-o-keyframes flickerAnimation{ 0% { opacity:1; } - 50% { opacity:0.3; } + 50% { opacity:0.5; } 100% { opacity:1; } } @-moz-keyframes flickerAnimation{ 0% { opacity:1; } - 50% { opacity:0.3; } + 50% { opacity:0.5; } 100% { opacity:1; } } @-webkit-keyframes flickerAnimation{ 0% { opacity:1; } - 50% { opacity:0.3; } + 50% { opacity:0.5; } 100% { opacity:1; } } @@ -250,7 +237,7 @@
    -
    +
    @@ -264,6 +251,18 @@
    - + - + @@ -256,7 +250,7 @@
    -
    +
    @@ -270,6 +264,18 @@
    - + - + - + - + - + - + diff --git a/apps/spreadsheeteditor/embed/index_loader.html b/apps/spreadsheeteditor/embed/index_loader.html index 746b49971..b29cba7c5 100644 --- a/apps/spreadsheeteditor/embed/index_loader.html +++ b/apps/spreadsheeteditor/embed/index_loader.html @@ -337,9 +337,9 @@ - + diff --git a/apps/spreadsheeteditor/embed/js/ApplicationController.js b/apps/spreadsheeteditor/embed/js/ApplicationController.js index 1c8078945..7d689f967 100644 --- a/apps/spreadsheeteditor/embed/js/ApplicationController.js +++ b/apps/spreadsheeteditor/embed/js/ApplicationController.js @@ -68,7 +68,7 @@ SSE.ApplicationController = new(function(){ common.controller.modals.init(embedConfig); - if (config.canBackToFolder === false || !(config.customization && config.customization.goback && config.customization.goback.url)) + if (config.canBackToFolder === false || !(config.customization && config.customization.goback && (config.customization.goback.url || config.customization.goback.requestClose && config.canRequestClose))) $('#id-btn-close').hide(); // Docked toolbar @@ -109,8 +109,6 @@ SSE.ApplicationController = new(function(){ } embedConfig.docTitle = docConfig.title; - if ( !embedConfig.saveUrl && permissions.print === false) - $('#idt-copy').hide(); } } @@ -170,6 +168,9 @@ SSE.ApplicationController = new(function(){ function onDocumentContentReady() { hidePreloader(); + if ( !embedConfig.saveUrl && permissions.print === false) + $('#idt-download').hide(); + if ( !embedConfig.shareUrl ) $('#idt-share').hide(); @@ -179,6 +180,9 @@ SSE.ApplicationController = new(function(){ if ( !embedConfig.fullscreenUrl ) $('#idt-fullscreen').hide(); + if ( !embedConfig.saveUrl && permissions.print === false && !embedConfig.shareUrl && !embedConfig.embedUrl && !embedConfig.fullscreenUrl) + $('#box-tools').addClass('hidden'); + common.controller.modals.attach({ share: '#idt-share', embed: '#idt-embed' @@ -211,8 +215,12 @@ SSE.ApplicationController = new(function(){ }); $('#id-btn-close').on('click', function(){ - if (config.customization && config.customization.goback && config.customization.goback.url) - window.parent.location.href = config.customization.goback.url; + if (config.customization && config.customization.goback) { + if (config.customization.goback.requestClose && config.canRequestClose) + Common.Gateway.requestClose(); + else if (config.customization.goback.url) + window.parent.location.href = config.customization.goback.url; + } }); $('#id-btn-zoom-in').on('click', function () { @@ -410,6 +418,10 @@ SSE.ApplicationController = new(function(){ message = me.errorFileSizeExceed; break; + case Asc.c_oAscError.ID.UpdateVersion: + message = me.errorUpdateVersionOnDisconnect; + break; + default: message = me.errorDefaultMessage.replace('%1', id); break; @@ -536,7 +548,8 @@ SSE.ApplicationController = new(function(){ }); api = new Asc.spreadsheet_api({ - 'id-view': 'editor_sdk' + 'id-view': 'editor_sdk', + 'embedded' : true }); if (api){ @@ -576,6 +589,7 @@ SSE.ApplicationController = new(function(){ waitText: 'Please, wait...', textLoadingDocument: 'Loading spreadsheet', txtClose: 'Close', - errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.' + errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.', + errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.' } })(); \ No newline at end of file diff --git a/apps/spreadsheeteditor/embed/locale/en.json b/apps/spreadsheeteditor/embed/locale/en.json index 11ac34dc1..a05a7bb1d 100644 --- a/apps/spreadsheeteditor/embed/locale/en.json +++ b/apps/spreadsheeteditor/embed/locale/en.json @@ -22,6 +22,7 @@ "SSE.ApplicationController.unknownErrorText": "Unknown error.", "SSE.ApplicationController.unsupportedBrowserErrorText": "Your browser is not supported.", "SSE.ApplicationController.waitText": "Please, wait...", + "SSE.ApplicationController.errorUpdateVersionOnDisconnect": "Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.", "SSE.ApplicationView.txtDownload": "Download", "SSE.ApplicationView.txtEmbed": "Embed", "SSE.ApplicationView.txtFullScreen": "Full Screen", diff --git a/apps/spreadsheeteditor/embed/locale/fr.json b/apps/spreadsheeteditor/embed/locale/fr.json index c8cd03921..f3d3a9065 100644 --- a/apps/spreadsheeteditor/embed/locale/fr.json +++ b/apps/spreadsheeteditor/embed/locale/fr.json @@ -12,6 +12,7 @@ "SSE.ApplicationController.errorAccessDeny": "Vous tentez d'exéсuter une action pour laquelle vous ne disposez pas des droits.
    Veuillez contacter l'administrateur de Document Server.", "SSE.ApplicationController.errorDefaultMessage": "Code d'erreur: %1", "SSE.ApplicationController.errorFilePassProtect": "Le fichier est protégé par le mot de passe et ne peut pas être ouvert.", + "SSE.ApplicationController.errorFileSizeExceed": "La taille du fichier dépasse les limites établies sur votre serveur.
    Veuillez contacter votre administrateur de Document Server pour obtenir plus d'information. ", "SSE.ApplicationController.errorUserDrop": "Impossible d'accéder au fichier.", "SSE.ApplicationController.notcriticalErrorTitle": "Avertissement", "SSE.ApplicationController.scriptLoadError": "La connexion est trop lente, certains éléments ne peuvent pas être chargés. Veuillez recharger la page.", diff --git a/apps/spreadsheeteditor/embed/locale/it.json b/apps/spreadsheeteditor/embed/locale/it.json index 12c35d15d..eacee39c1 100644 --- a/apps/spreadsheeteditor/embed/locale/it.json +++ b/apps/spreadsheeteditor/embed/locale/it.json @@ -12,6 +12,7 @@ "SSE.ApplicationController.errorAccessDeny": "Stai tentando di eseguire un'azione per la quale non disponi di permessi sufficienti.
    Si prega di contattare l'amministratore del Server dei Documenti.", "SSE.ApplicationController.errorDefaultMessage": "Codice errore: %1", "SSE.ApplicationController.errorFilePassProtect": "Il file è protetto da una password. Impossibile aprirlo.", + "SSE.ApplicationController.errorFileSizeExceed": "La dimensione del file supera la limitazione impostata per il tuo server.
    Per i dettagli, contatta l'amministratore del Document server.", "SSE.ApplicationController.errorUserDrop": "Impossibile accedere al file subito.", "SSE.ApplicationController.notcriticalErrorTitle": "Avviso", "SSE.ApplicationController.scriptLoadError": "La connessione è troppo lenta, alcuni componenti non possono essere caricati. Si prega di ricaricare la pagina.", diff --git a/apps/spreadsheeteditor/embed/locale/ru.json b/apps/spreadsheeteditor/embed/locale/ru.json index 0b85d4938..024d75f17 100644 --- a/apps/spreadsheeteditor/embed/locale/ru.json +++ b/apps/spreadsheeteditor/embed/locale/ru.json @@ -12,6 +12,7 @@ "SSE.ApplicationController.errorAccessDeny": "Вы пытаетесь выполнить действие, на которое у вас нет прав.
    Пожалуйста, обратитесь к администратору Сервера документов.", "SSE.ApplicationController.errorDefaultMessage": "Код ошибки: %1", "SSE.ApplicationController.errorFilePassProtect": "Файл защищен паролем и не может быть открыт.", + "SSE.ApplicationController.errorFileSizeExceed": "Размер файла превышает ограничение, установленное для вашего сервера.
    Обратитесь к администратору Сервера документов для получения дополнительной информации.", "SSE.ApplicationController.errorUserDrop": "В настоящий момент файл недоступен.", "SSE.ApplicationController.notcriticalErrorTitle": "Внимание", "SSE.ApplicationController.scriptLoadError": "Слишком медленное подключение, некоторые компоненты не удалось загрузить. Пожалуйста, обновите страницу.", diff --git a/apps/spreadsheeteditor/main/app/controller/CellEditor.js b/apps/spreadsheeteditor/main/app/controller/CellEditor.js index be5c06d20..71b231a98 100644 --- a/apps/spreadsheeteditor/main/app/controller/CellEditor.js +++ b/apps/spreadsheeteditor/main/app/controller/CellEditor.js @@ -119,6 +119,14 @@ define([ this.bindViewEvents(this.editor, this.events); this.editor.$el.parent().find('.after').css({zIndex: '4'}); // for spreadsheets - bug 23127 + + var val = Common.localStorage.getItem('sse-celleditor-height'); + this.editor.keep_height = (val!==null && parseInt(val)>0) ? parseInt(val) : 74; + if (Common.localStorage.getBool('sse-celleditor-expand')) { + this.editor.$el.height(this.editor.keep_height); + this.onLayoutResize(undefined, 'cell:edit'); + } + this.editor.btnNamedRanges.menu.on('item:click', _.bind(this.onNamedRangesMenu, this)) .on('show:before', _.bind(this.onNameBeforeShow, this)); this.namedrange_locked = false; @@ -180,8 +188,11 @@ define([ if (this.editor.$el.height() > 19) { if (!this.editor.$btnexpand.hasClass('btn-collapse')) this.editor.$btnexpand['addClass']('btn-collapse'); + o && Common.localStorage.setItem('sse-celleditor-height', this.editor.$el.height()); + o && Common.localStorage.setBool('sse-celleditor-expand', true); } else { this.editor.$btnexpand['removeClass']('btn-collapse'); + o && Common.localStorage.setBool('sse-celleditor-expand', false); } } }, @@ -218,9 +229,11 @@ define([ this.editor.keep_height = this.editor.$el.height(); this.editor.$el.height(19); this.editor.$btnexpand['removeClass']('btn-collapse'); + Common.localStorage.setBool('sse-celleditor-expand', false); } else { - this.editor.$el.height(this.editor.keep_height||74); + this.editor.$el.height(this.editor.keep_height); this.editor.$btnexpand['addClass']('btn-collapse'); + Common.localStorage.setBool('sse-celleditor-expand', true); } Common.NotificationCenter.trigger('layout:changed', 'celleditor'); diff --git a/apps/spreadsheeteditor/main/app/controller/DataTab.js b/apps/spreadsheeteditor/main/app/controller/DataTab.js index fbf16ba4a..1c236b871 100644 --- a/apps/spreadsheeteditor/main/app/controller/DataTab.js +++ b/apps/spreadsheeteditor/main/app/controller/DataTab.js @@ -42,7 +42,8 @@ define([ 'core', 'spreadsheeteditor/main/app/view/DataTab', - 'spreadsheeteditor/main/app/view/GroupDialog' + 'spreadsheeteditor/main/app/view/GroupDialog', + 'spreadsheeteditor/main/app/view/SortDialog' ], function () { 'use strict'; @@ -86,7 +87,8 @@ define([ 'data:tocolumns': this.onTextToColumn, 'data:show': this.onShowClick, 'data:hide': this.onHideClick, - 'data:groupsettings': this.onGroupSettings + 'data:groupsettings': this.onGroupSettings, + 'data:sortcustom': this.onCustomSort }, 'Statusbar': { 'sheet:changed': this.onApiSheetChanged @@ -212,9 +214,55 @@ define([ this.api.asc_changeGroupDetails(false); }, + onCustomSort: function() { + var me = this; + if (this.api) { + var res = this.api.asc_sortCellsRangeExpand(); + if (res) { + var config = { + width: 500, + title: this.toolbar.txtSorting, + msg: this.toolbar.txtExpandSort, + + buttons: [ {caption: this.toolbar.txtExpand, primary: true, value: 'expand'}, + {caption: this.toolbar.txtSortSelected, primary: true, value: 'sort'}, + 'cancel'], + callback: function(btn){ + if (btn == 'expand' || btn == 'sort') { + setTimeout(function(){ + me.showCustomSort(btn == 'expand'); + },1); + } + } + }; + Common.UI.alert(config); + } else + me.showCustomSort(res !== null); + } + }, + + showCustomSort: function(expand) { + var me = this, + props = me.api.asc_getSortProps(expand); + // props = new Asc.CSortProperties(); + if (props) { + (new SSE.Views.SortDialog({ + props: props, + api: me.api, + handler: function (result, settings) { + if (result == 'ok') { + if (me && me.api) { + me.api.asc_setSortProps(settings); + } + } + } + })).show(); + } + }, + onWorksheetLocked: function(index,locked) { if (index == this.api.asc_getActiveWorksheetIndex()) { - Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: [this.view.btnGroup, this.view.btnUngroup]}); + Common.Utils.lockControls(SSE.enumLock.sheetLock, locked, {array: this.view.btnsSortDown.concat(this.view.btnsSortUp, this.view.btnCustomSort, this.view.btnGroup, this.view.btnUngroup)}); } }, diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js index bcb7a5225..e4b1b96e8 100644 --- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js @@ -64,6 +64,7 @@ define([ 'common/main/lib/util/Shortcuts', 'common/main/lib/view/CopyWarningDialog', 'common/main/lib/view/OpenDialog', + 'common/main/lib/view/ListSettingsDialog', 'spreadsheeteditor/main/app/view/DocumentHolder', 'spreadsheeteditor/main/app/view/HyperlinkSettingsDialog', 'spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced', @@ -213,7 +214,7 @@ define([ view.menuImageAlign.menu.on('item:click', _.bind(me.onImgMenuAlign, me)); view.menuParagraphVAlign.menu.on('item:click', _.bind(me.onParagraphVAlign, me)); view.menuParagraphDirection.menu.on('item:click', _.bind(me.onParagraphDirection, me)); - view.menuParagraphBullets.menu.on('item:click', _.bind(me.onSelectNoneBullet, me)); + view.menuParagraphBullets.menu.on('item:click', _.bind(me.onSelectBulletMenu, me)); view.menuAddHyperlinkShape.on('click', _.bind(me.onInsHyperlink, me)); view.menuEditHyperlinkShape.on('click', _.bind(me.onInsHyperlink, me)); view.menuRemoveHyperlinkShape.on('click', _.bind(me.onRemoveHyperlinkShape, me)); @@ -744,11 +745,39 @@ define([ } }, - onSelectNoneBullet: function(menu, item) { - if (this.api && item.options.value == -1) { - this.api.asc_setListType(item.options.value); - Common.NotificationCenter.trigger('edit:complete', this.documentHolder); - Common.component.Analytics.trackEvent('DocumentHolder', 'List Type'); + onSelectBulletMenu: function(menu, item) { + if (this.api) { + if (item.options.value == -1) { + this.api.asc_setListType(item.options.value); + Common.NotificationCenter.trigger('edit:complete', this.documentHolder); + Common.component.Analytics.trackEvent('DocumentHolder', 'List Type'); + } else if (item.options.value == 'settings') { + var me = this, + props; + var selectedObjects = me.api.asc_getGraphicObjectProps(); + for (var i = 0; i < selectedObjects.length; i++) { + if (selectedObjects[i].asc_getObjectType() == Asc.c_oAscTypeSelectElement.Paragraph) { + props = selectedObjects[i].asc_getObjectValue(); + break; + } + } + if (props) { + (new Common.Views.ListSettingsDialog({ + api: me.api, + props: props, + type: me.api.asc_getCurrentListType().get_ListType(), + interfaceLang: me.permissions.lang, + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + me.api.asc_setGraphicObjectProps(value); + } + } + Common.NotificationCenter.trigger('edit:complete', me.documentHolder); + } + })).show(); + } + } } }, @@ -1645,6 +1674,7 @@ define([ documentHolder.menuParagraphDirect270.setChecked(direct == Asc.c_oAscVertDrawingText.vert270); documentHolder.menuParagraphBulletNone.setChecked(listtype.get_ListType() == -1); + documentHolder.mnuListSettings.setDisabled(listtype.get_ListType() == -1); var rec = documentHolder.paraBulletsPicker.store.findWhere({ type: listtype.get_ListType(), subtype: listtype.get_ListSubType() }); documentHolder.paraBulletsPicker.selectRecord(rec, true); } else if (elType == Asc.c_oAscTypeSelectElement.Paragraph) { @@ -1659,10 +1689,12 @@ define([ var hyperinfo = cellinfo.asc_getHyperlink(), can_add_hyperlink = this.api.asc_canAddShapeHyperlink(); + documentHolder.menuParagraphBullets.setVisible(istextchartmenu!==true); documentHolder.menuHyperlinkShape.setVisible(istextshapemenu && can_add_hyperlink!==false && hyperinfo); documentHolder.menuAddHyperlinkShape.setVisible(istextshapemenu && can_add_hyperlink!==false && !hyperinfo); documentHolder.menuParagraphVAlign.setVisible(istextchartmenu!==true && !isEquation); // убрать после того, как заголовок можно будет растягивать по вертикали!! documentHolder.menuParagraphDirection.setVisible(istextchartmenu!==true && !isEquation); // убрать после того, как заголовок можно будет растягивать по вертикали!! + documentHolder.textInShapeMenu.items[3].setVisible(istextchartmenu!==true || istextshapemenu && can_add_hyperlink!==false); documentHolder.pmiTextAdvanced.setVisible(documentHolder.pmiTextAdvanced.textInfo!==undefined); _.each(documentHolder.textInShapeMenu.items, function(item) { @@ -1801,6 +1833,8 @@ define([ documentHolder.menuParagraphDirection.setVisible(false); // убрать после того, как заголовок можно будет растягивать по вертикали!! documentHolder.pmiTextAdvanced.setVisible(false); documentHolder.textInShapeMenu.items[9].setVisible(false); + documentHolder.menuParagraphBullets.setVisible(false); + documentHolder.textInShapeMenu.items[3].setVisible(false); documentHolder.pmiTextCopy.setDisabled(false); if (showMenu) this.showPopupMenu(documentHolder.textInShapeMenu, {}, event); } diff --git a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js index 340faedd8..5720d7559 100644 --- a/apps/spreadsheeteditor/main/app/controller/LeftMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/LeftMenu.js @@ -56,8 +56,7 @@ define([ 'hide': _.bind(this.onHidePlugins, this) }, 'Common.Views.Header': { - 'file:settings': _.bind(this.clickToolbarSettings,this), - 'click:users': _.bind(this.clickStatusbarUsers, this) + 'file:settings': _.bind(this.clickToolbarSettings,this) }, 'LeftMenu': { 'file:show': _.bind(this.fileShowHide, this, true), @@ -76,6 +75,7 @@ define([ 'saveas:format': _.bind(this.clickSaveAsFormat, this), 'savecopy:format': _.bind(this.clickSaveCopyAsFormat, this), 'settings:apply': _.bind(this.applySettings, this), + 'spellcheck:apply': _.bind(this.applySpellcheckSettings, this), 'create:new': _.bind(this.onCreateNew, this), 'recent:open': _.bind(this.onOpenRecent, this) }, @@ -368,6 +368,7 @@ define([ if (this.mode.canViewComments && this.leftMenu.panelComments.isVisible()) value = resolved = true; (value) ? this.api.asc_showComments(resolved) : this.api.asc_hideComments(); + this.getApplication().getController('Common.Controllers.ReviewChanges').commentsShowHide(value ? 'show' : 'hide'); value = Common.localStorage.getBool("sse-settings-r1c1"); Common.Utils.InternalSettings.set("sse-settings-r1c1", value); @@ -394,6 +395,23 @@ define([ this.leftMenu.fireEvent('settings:apply'); }, + applySpellcheckSettings: function(menu) { + if (this.mode.isEdit && this.api) { + var value = Common.localStorage.getBool("sse-spellcheck-ignore-uppercase-words"); + this.api.asc_ignoreUppercase(value); + value = Common.localStorage.getBool("sse-spellcheck-ignore-numbers-words"); + this.api.asc_ignoreNumbers(value); + value = Common.localStorage.getItem("sse-spellcheck-locale"); + if (value) { + this.api.asc_setDefaultLanguage(parseInt(value)); + } + } + + menu.hide(); + + this.leftMenu.fireEvent('spellcheck:update'); + }, + onCreateNew: function(menu, type) { if ( !Common.Controllers.Desktop.process('create:new') ) { var newDocumentPage = window.open(type == 'blank' ? this.mode.createUrl : type, "_blank"); @@ -432,10 +450,6 @@ define([ }, /** coauthoring begin **/ - clickStatusbarUsers: function() { - this.leftMenu.menuFile.panels['rights'].changeAccessRights(); - }, - onHideChat: function() { $(this.leftMenu.btnChat.el).blur(); Common.NotificationCenter.trigger('layout:changed', 'leftmenu'); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 9bf1e45a5..8ac7e05aa 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -119,7 +119,9 @@ define([ 'Date': this.txtDate, 'Time': this.txtTime, 'Tab': this.txtTab, - 'File': this.txtFile + 'File': this.txtFile, + 'Column': this.txtColumn, + 'Row': this.txtRow }; styleNames.forEach(function(item){ translate[item] = me['txtStyle_' + item.replace(/ /g, '_')] || item; @@ -326,15 +328,18 @@ define([ this.appOptions.fileChoiceUrl = this.editorConfig.fileChoiceUrl; this.appOptions.isEditDiagram = this.editorConfig.mode == 'editdiagram'; this.appOptions.isEditMailMerge = this.editorConfig.mode == 'editmerge'; + this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.customization = this.editorConfig.customization; - this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') - && (typeof (this.editorConfig.customization.goback) == 'object') && !_.isEmpty(this.editorConfig.customization.goback.url); + this.appOptions.canBackToFolder = (this.editorConfig.canBackToFolder!==false) && (typeof (this.editorConfig.customization) == 'object') && (typeof (this.editorConfig.customization.goback) == 'object') + && (!_.isEmpty(this.editorConfig.customization.goback.url) || this.editorConfig.customization.goback.requestClose && this.appOptions.canRequestClose); this.appOptions.canBack = this.appOptions.canBackToFolder === true; this.appOptions.canPlugins = false; this.appOptions.canRequestUsers = this.editorConfig.canRequestUsers; this.appOptions.canRequestSendNotify = this.editorConfig.canRequestSendNotify; this.appOptions.canRequestSaveAs = this.editorConfig.canRequestSaveAs; this.appOptions.canRequestInsertImage = this.editorConfig.canRequestInsertImage; + this.appOptions.compatibleFeatures = (typeof (this.appOptions.customization) == 'object') && !!this.appOptions.customization.compatibleFeatures; + this.appOptions.canRequestSharingSettings = this.editorConfig.canRequestSharingSettings; this.headerView = this.getApplication().getController('Viewport').getView('Common.Views.Header'); this.headerView.setCanBack(this.appOptions.canBackToFolder === true, (this.appOptions.canBackToFolder) ? this.editorConfig.customization.goback.text : '') @@ -476,11 +481,16 @@ define([ goBack: function(current) { var me = this; if ( !Common.Controllers.Desktop.process('goback') ) { - var href = me.appOptions.customization.goback.url; - if (!current && me.appOptions.customization.goback.blank!==false) { - window.open(href, "_blank"); + if (me.appOptions.customization.goback.requestClose && me.appOptions.canRequestClose) { + Common.Gateway.requestClose(); + // Common.Controllers.Desktop.requestClose(); } else { - parent.location.href = href; + var href = me.appOptions.customization.goback.url; + if (!current && me.appOptions.customization.goback.blank!==false) { + window.open(href, "_blank"); + } else { + parent.location.href = href; + } } } }, @@ -684,6 +694,15 @@ define([ Common.Utils.InternalSettings.set("sse-settings-coauthmode", me._state.fastCoauth); /** coauthoring end **/ + /** spellcheck settings begin **/ + var ignoreUppercase = Common.localStorage.getBool("sse-spellcheck-ignore-uppercase-words", true); + Common.Utils.InternalSettings.set("sse-spellcheck-ignore-uppercase-words", ignoreUppercase); + this.api.asc_ignoreUppercase(ignoreUppercase); + var ignoreNumbers = Common.localStorage.getBool("sse-spellcheck-ignore-numbers-words", true); + Common.Utils.InternalSettings.set("sse-spellcheck-ignore-numbers-words", ignoreNumbers); + this.api.asc_ignoreNumbers(ignoreNumbers); + /** spellcheck settings end **/ + me.api.asc_registerCallback('asc_onStartAction', _.bind(me.onLongActionBegin, me)); me.api.asc_registerCallback('asc_onConfirmAction', _.bind(me.onConfirmAction, me)); me.api.asc_registerCallback('asc_onActiveSheetChanged', _.bind(me.onActiveSheetChanged, me)); @@ -949,7 +968,6 @@ define([ this.appOptions.canModifyFilter = true; this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights; - this.appOptions.canRequestClose = this.editorConfig.canRequestClose; this.appOptions.canEdit = this.permissions.edit !== false && // can edit (this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view'); // if mode=="view" -> canRequestEditRights must be defined this.appOptions.isEdit = (this.appOptions.canLicense || this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.permissions.edit !== false && this.editorConfig.mode !== 'view'; @@ -1044,24 +1062,25 @@ define([ this.api); } /** coauthoring end **/ + var me = this, + application = this.getApplication(), + reviewController = application.getController('Common.Controllers.ReviewChanges'); + reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api).loadDocument({doc:me.appOptions.spreadsheet}); - if (this.appOptions.isEdit) { - var me = this, - application = this.getApplication(), - toolbarController = application.getController('Toolbar'), - statusbarController = application.getController('Statusbar'), + if (this.appOptions.isEdit || this.appOptions.isRestrictedEdit) { // set api events for toolbar in the Restricted Editing mode + var toolbarController = application.getController('Toolbar'); + toolbarController && toolbarController.setApi(me.api); + + if (!this.appOptions.isEdit) return; + + var statusbarController = application.getController('Statusbar'), rightmenuController = application.getController('RightMenu'), - fontsControllers = application.getController('Common.Controllers.Fonts'), - reviewController = application.getController('Common.Controllers.ReviewChanges'); + fontsControllers = application.getController('Common.Controllers.Fonts'); fontsControllers && fontsControllers.setApi(me.api); - toolbarController && toolbarController.setApi(me.api); // statusbarController && statusbarController.setApi(me.api); - rightmenuController && rightmenuController.setApi(me.api); - reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); - if (me.appOptions.canProtect) application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); @@ -1311,7 +1330,7 @@ define([ break; case Asc.c_oAscError.ID.Warning: - config.msg = this.errorConnectToServer.replace('%1', '{{API_URL_EDITING_CALLBACK}}'); + config.msg = this.errorConnectToServer; config.closable = false; break; @@ -1415,6 +1434,11 @@ define([ config.msg = this.errorFileSizeExceed; break; + case Asc.c_oAscError.ID.UpdateVersion: + config.msg = this.errorUpdateVersionOnDisconnect; + config.maxwidth = 600; + break; + default: config.msg = (typeof id == 'string') ? id : this.errorDefaultMessage.replace('%1', id); break; @@ -1461,7 +1485,7 @@ define([ }, this); } - if ($('.asc-window.modal.alert:visible').length < 1 && (id !== Asc.c_oAscError.ID.ForceSaveTimeout)) { + if (id == Asc.c_oAscError.ID.EditingError || $('.asc-window.modal.alert:visible').length < 1 && (id !== Asc.c_oAscError.ID.ForceSaveTimeout)) { Common.UI.alert(config); Common.component.Analytics.trackEvent('Internal Error', id.toString()); } @@ -1547,7 +1571,7 @@ define([ Common.Gateway.setDocumentModified(change); if (this.toolbarView && this.toolbarView.btnCollabChanges && this.api) { - var isSyncButton = this.toolbarView.btnCollabChanges.$icon.hasClass('btn-synch'), + var isSyncButton = this.toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), forcesave = this.appOptions.forcesave, cansave = this.api.asc_isDocumentCanSave(), isDisabled = !cansave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave; @@ -1557,7 +1581,7 @@ define([ onDocumentCanSaveChanged: function (isCanSave) { if (this.toolbarView && this.toolbarView.btnCollabChanges) { - var isSyncButton = this.toolbarView.btnCollabChanges.$icon.hasClass('btn-synch'), + var isSyncButton = this.toolbarView.btnCollabChanges.cmpEl.hasClass('notify'), forcesave = this.appOptions.forcesave, isDisabled = !isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave; this.toolbarView.btnSave.setDisabled(isDisabled); @@ -2053,7 +2077,8 @@ define([ this.updateWindowTitle(this.api.asc_isDocumentModified(), true); this.appOptions.spreadsheet.title = meta.title; filemenu.loadDocument({doc:this.appOptions.spreadsheet}); - filemenu.panels['info'].updateInfo(this.appOptions.spreadsheet); + filemenu.panels && filemenu.panels['info'] && filemenu.panels['info'].updateInfo(this.appOptions.spreadsheet); + app.getController('Common.Controllers.ReviewChanges').loadDocument({doc:this.appOptions.spreadsheet}); Common.Gateway.metaChange(meta); }, @@ -2192,8 +2217,7 @@ define([ errorInvalidRef: 'Enter a correct name for the selection or a valid reference to go to.', errorCreateDefName: 'The existing named ranges cannot be edited and the new ones cannot be created
    at the moment as some of them are being edited.', errorPasteMaxRange: 'The copy and paste area does not match. Please select an area with the same size or click the first cell in a row to paste the copied cells.', - errorConnectToServer: ' The document could not be saved. Please check connection settings or contact your administrator.
    When you click the \'OK\' button, you will be prompted to download the document.

    ' + - 'Find more information about connecting Document Server here', + errorConnectToServer: ' The document could not be saved. Please check connection settings or contact your administrator.
    When you click the \'OK\' button, you will be prompted to download the document.', errorLockedWorksheetRename: 'The sheet cannot be renamed at the moment as it is being renamed by another user', textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.
    Click the \'Strict mode\' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.', textStrict: 'Strict mode', @@ -2203,7 +2227,7 @@ define([ textNoLicenseTitle: '%1 open source version', textContactUs: 'Contact sales', confirmPutMergeRange: 'The source data contains merged cells.
    They will be unmerged before they are pasted into the table.', - errorViewerDisconnect: 'Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored.', + errorViewerDisconnect: 'Connection is lost. You can still view the document,
    but will not be able to download or print until the connection is restored and page is reloaded.', warnLicenseExp: 'Your license has expired.
    Please update your license and refresh the page.', titleLicenseExp: 'License expired', openErrorText: 'An error has occurred while opening the file', @@ -2446,7 +2470,10 @@ define([ txtFile: 'File', errorFileSizeExceed: 'The file size exceeds the limitation set for your server.
    Please contact your Document Server administrator for details.', errorLabledColumnsPivot: 'To create a pivot table report, you must use data that is organized as a list with labeled columns.', - errorPivotOverlap: 'A pivot table report cannot overlap a table.' + errorPivotOverlap: 'A pivot table report cannot overlap a table.', + txtColumn: 'Column', + txtRow: 'Row', + errorUpdateVersionOnDisconnect: 'Internet connection has been restored, and the file version has been changed.
    Before you can continue working, you need to download the file or copy its content to make sure nothing is lost, and then reload this page.' } })(), SSE.Controllers.Main || {})) }); diff --git a/apps/spreadsheeteditor/main/app/controller/Print.js b/apps/spreadsheeteditor/main/app/controller/Print.js index a36c3e98c..532047783 100644 --- a/apps/spreadsheeteditor/main/app/controller/Print.js +++ b/apps/spreadsheeteditor/main/app/controller/Print.js @@ -141,10 +141,10 @@ define([ panel.cmbPaperSize.setValue(this.txtCustom + ' (' + parseFloat(Common.Utils.Metric.fnRecalcFromMM(w).toFixed(2)) + Common.Utils.Metric.getCurrentMetricName() + ' x ' + parseFloat(Common.Utils.Metric.fnRecalcFromMM(h).toFixed(2)) + Common.Utils.Metric.getCurrentMetricName() + ')'); - var fitwidth = opt.asc_getFitToWidth(), - fitheight = opt.asc_getFitToHeight(), - fitscale = opt.asc_getScale(); - this.setScaling(panel, fitwidth, fitheight, fitscale); + this.fitWidth = opt.asc_getFitToWidth(); + this.fitHeight = opt.asc_getFitToHeight(); + this.fitScale = opt.asc_getScale(); + this.setScaling(panel, this.fitWidth, this.fitHeight, this.fitScale); item = panel.cmbPaperOrientation.store.findWhere({value: opt.asc_getOrientation()}); if (item) panel.cmbPaperOrientation.setValue(item.get('value')); @@ -198,6 +198,7 @@ define([ opt.asc_setFitToWidth(fitToWidth); opt.asc_setFitToHeight(fitToHeight); !fitToWidth && !fitToHeight && opt.asc_setScale(100); + this.setScaling(panel, fitToWidth, fitToHeight, 100); } else { opt.asc_setFitToWidth(this.fitWidth); opt.asc_setFitToHeight(this.fitHeight); @@ -355,7 +356,7 @@ define([ }, propertyChange: function(panel, scale, combo, record) { - if (scale === 'scale' && record.value === 4) { + if (scale === 'scale' && record.value === 'customoptions') { var me = this, props = (me._changedProps.length > 0 && me._changedProps[panel.cmbSheet.getValue()]) ? me._changedProps[panel.cmbSheet.getValue()] : me.api.asc_getPageOptions(panel.cmbSheet.getValue()); var win = new SSE.Views.ScaleDialog({ @@ -396,11 +397,14 @@ define([ }, setScaling: function (panel, width, height, scale) { - if (!width && !height && scale === 100) panel.cmbLayout.setValue(0, true); - else if (width === 1 && height === 1) panel.cmbLayout.setValue(1, true); - else if (width === 1 && !height) panel.cmbLayout.setValue(2, true); - else if (!width && height === 1) panel.cmbLayout.setValue(3, true); - else panel.cmbLayout.setValue(4, true); + var value; + if (!width && !height && scale === 100) value = 0; + else if (width === 1 && height === 1) value = 1; + else if (width === 1 && !height) value = 2; + else if (!width && height === 1) value = 3; + else value = 4; + panel.addCustomScale(value === 4); + panel.cmbLayout.setValue(value, true); }, warnCheckMargings: 'Margins are incorrect', diff --git a/apps/spreadsheeteditor/main/app/controller/Spellcheck.js b/apps/spreadsheeteditor/main/app/controller/Spellcheck.js index 6f058827d..3fa4ee599 100644 --- a/apps/spreadsheeteditor/main/app/controller/Spellcheck.js +++ b/apps/spreadsheeteditor/main/app/controller/Spellcheck.js @@ -55,9 +55,16 @@ define([ 'Spellcheck': { 'show': function() { me._initSettings && me.loadLanguages(); + me.updateLanguages(); me.onClickNext(); }, 'hide': function() { + me.api && me.api.asc_cancelSpellCheck(); + } + }, + 'LeftMenu': { + 'spellcheck:update': function () { + me.updateLanguages(); } } }); @@ -120,23 +127,24 @@ define([ setLanguages: function (array) { this.languages = array; this._initSettings = true; + if (this.panelSpellcheck.cmbDictionaryLanguage.store.length > 0) { + this.panelSpellcheck.cmbDictionaryLanguage.store.reset(); + } }, loadLanguages: function () { - var value = Common.localStorage.getItem("sse-spellcheck-locale"); - if (value) - value = parseInt(value); - else - value = this.mode.lang ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)) : 0x0409; + var me = this; + if (this._initSettings) { + Common.Utils.InternalSettings.set("sse-spellcheck-locale", Common.localStorage.getItem("sse-spellcheck-locale")); + } - var combo = this.panelSpellcheck.cmbDictionaryLanguage; if (this.languages && this.languages.length>0) { - var langs = [], info, - allLangs = Common.util.LanguageInfo.getLanguages(); + var langs = [], info; + this.allLangs = Common.util.LanguageInfo.getLanguages(); this.languages.forEach(function (code) { code = parseInt(code); - if (allLangs.hasOwnProperty(code)) { - info = allLangs[code]; + if (me.allLangs.hasOwnProperty(code)) { + info = me.allLangs[code]; langs.push({ displayValue: info[1], shortName: info[0], @@ -149,29 +157,60 @@ define([ if (a.shortName > b.shortName) return 1; return 0; }); - combo.setData(langs); - var item = combo.store.findWhere({value: value}); - if (!item && allLangs[value]) { - value = allLangs[value][0].split(/[\-\_]/)[0]; - item = combo.store.find(function(model){ - return model.get('shortName').indexOf(value)==0; - }); + this.langs = langs; + } else { + this.langs = undefined; + } + this._initSettings = false; + + var change = this.panelSpellcheck.cmbDictionaryLanguage.store.length === 0; + + return [this.allLangs, this.langs, change]; + }, + + updateLanguages: function() { + var sessionValue = Common.Utils.InternalSettings.get("sse-spellcheck-locale"), + value, + isApply = false; + if (sessionValue) + value = parseInt(sessionValue); + else + value = this.mode.lang ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)) : 0x0409; + var combo = this.panelSpellcheck.cmbDictionaryLanguage; + if (this.langs && this.langs.length>0) { + if (combo.store.length === 0) { + combo.setData(this.langs); + isApply = true; } - combo.setValue(item ? item.get('value') : langs[0].value); + var item = combo.store.findWhere({value: value}); + if (!item && this.allLangs[value]) { + value = this.allLangs[value][0].split(/[\-\_]/)[0]; + item = combo.store.find(function(model){ + return model.get('shortName').indexOf(value)==0; + }); + } + combo.setValue(item ? item.get('value') : this.langs[0].value); value = combo.getValue(); } else { combo.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]); combo.setDisabled(true); } - this.api.asc_setDefaultLanguage(value); - this._initSettings = false; + if (isApply && this.api) { + this.api.asc_setDefaultLanguage(value); + if (value !== parseInt(sessionValue)) { + Common.Utils.InternalSettings.set("sse-spellcheck-locale", value); + } + isApply = false; + } }, onSelectLanguage: function (combo, record) { var lang = record.value; if (this.api && lang) { this.api.asc_setDefaultLanguage(lang); - Common.localStorage.setItem("sse-spellcheck-locale", this.panelSpellcheck.cmbDictionaryLanguage.getValue()); + var value = this.panelSpellcheck.cmbDictionaryLanguage.getValue(); + Common.localStorage.setItem("sse-spellcheck-locale", value); + Common.Utils.InternalSettings.set("sse-spellcheck-locale", value); } Common.NotificationCenter.trigger('edit:complete', this, {restorefocus:true}); }, @@ -245,7 +284,7 @@ define([ onApiEditCell: function(state) { if (state == Asc.c_oAscCellEditorState.editEnd) { this.panelSpellcheck.buttonNext.setDisabled(!this.panelSpellcheck.lblComplete.hasClass('hidden')); - this.panelSpellcheck.cmbDictionaryLanguage.setDisabled(false); + this.panelSpellcheck.cmbDictionaryLanguage.setDisabled((this.languages && this.languages.length > 0) ? false : true); } else { this.panelSpellcheck.buttonNext.setDisabled(true); this.panelSpellcheck.currentWord.setDisabled(true); diff --git a/apps/spreadsheeteditor/main/app/controller/Statusbar.js b/apps/spreadsheeteditor/main/app/controller/Statusbar.js index c462c9b8b..cb2809a3c 100644 --- a/apps/spreadsheeteditor/main/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Statusbar.js @@ -149,8 +149,8 @@ define([ /** coauthoring begin **/ onWorkbookLocked: function(locked) { this.statusbar.tabbar[locked?'addClass':'removeClass']('coauth-locked'); - this.statusbar.btnAddWorksheet.setDisabled(locked || this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.Chart || - this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable); + this.statusbar.btnAddWorksheet.setDisabled(locked || this.api.isCellEdited || this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.Chart || + this.statusbar.rangeSelectionMode==Asc.c_oAscSelectionDialogType.FormatTable); var item, i = this.statusbar.tabbar.getCount(); while (i-- > 0) { item = this.statusbar.tabbar.getAt(i); @@ -206,6 +206,7 @@ define([ statusbar.btnZoomUp.setDisabled(disable); statusbar.btnZoomDown.setDisabled(disable); statusbar.labelZoom[disable?'addClass':'removeClass']('disabled'); + statusbar.btnAddWorksheet.setDisabled(disable || this.api.asc_isWorkbookLocked() || statusbar.rangeSelectionMode!=Asc.c_oAscSelectionDialogType.None); if (disableAdd && mask.length>0 || !disableAdd && mask.length==0) return; statusbar.$el.find('.statusbar').toggleClass('masked', disableAdd); @@ -232,7 +233,7 @@ define([ onRangeDialogMode: function (mode) { var islocked = this.statusbar.tabbar.hasClass('coauth-locked'), currentIdx = this.api.asc_getActiveWorksheetIndex(); - this.statusbar.btnAddWorksheet.setDisabled(islocked || mode!=Asc.c_oAscSelectionDialogType.None); + this.statusbar.btnAddWorksheet.setDisabled(islocked || this.api.isCellEdited || mode!=Asc.c_oAscSelectionDialogType.None); var item, i = this.statusbar.tabbar.getCount(); while (i-- > 0) { @@ -247,39 +248,69 @@ define([ onTabMenu: function(obj, item, e) { var me = this; - switch (item.value){ - case 'ins': - setTimeout(function(){ - me.api.asc_insertWorksheet(me.createSheetName()); - }, 1); - break; - case 'del': this.deleteWorksheet(); break; - case 'ren': this.renameWorksheet(); break; - case 'copy': this.moveWorksheet(false); break; - case 'move': this.moveWorksheet(true); break; - case 'hide': - setTimeout(function(){ - me.hideWorksheet(true);}, 1); - break; + var selectTabs = this.statusbar.tabbar.selectTabs, + arrIndex = []; + selectTabs.forEach(function (item) { + arrIndex.push(item.sheetindex); + }); + switch (item.value) { + case 'ins': + var arrNames = []; + for(var i = 0; i < arrIndex.length; i++) { + arrNames.push(me.createSheetName(arrNames)); + } + setTimeout(function () { + me.api.asc_insertWorksheet(arrNames); + }, 1); + break; + case 'del': + this.deleteWorksheet(arrIndex); + break; + case 'ren': + this.renameWorksheet(); + break; + case 'copy': + this.moveWorksheet(arrIndex, false); + break; + case 'move': + this.moveWorksheet(arrIndex, true); + break; + case 'hide': + setTimeout(function () { + me.hideWorksheet(true, arrIndex); + }, 1); + break; } }, - createSheetName: function() { + createSheetName: function(curArrNames) { var items = [], wc = this.api.asc_getWorksheetsCount(); while (wc--) { items.push(this.api.asc_getWorksheetName(wc).toLowerCase()); } var index = 0, name; - while(++index < 1000) { + while(true) { + index++; name = this.strSheet + index; if (items.indexOf(name.toLowerCase()) < 0) break; } + if (curArrNames && curArrNames.length > 0) { + var arr = []; + curArrNames.forEach(function (item) { + arr.push(item.toLowerCase()); + }); + while(arr.indexOf(name.toLowerCase()) !== -1 || items.indexOf(name.toLowerCase()) !== -1) { + index++; + name = this.strSheet + index; + } + } + return name; }, - createCopyName: function(orig) { + createCopyName: function(orig, curArrNames) { var wc = this.api.asc_getWorksheetsCount(), names = []; while (wc--) { names.push(this.api.asc_getWorksheetName(wc).toLowerCase()); @@ -289,25 +320,37 @@ define([ var first = re ? re[1] : orig + ' '; var index = 1, name; - while(++index < 1000) { + while(true) { + index++; name = first + '(' + index + ')'; if (names.indexOf(name.toLowerCase()) < 0) break; } + if (curArrNames && curArrNames.length > 0) { + var arr = []; + curArrNames.forEach(function (item) { + arr.push(item.toLowerCase()); + }); + while(arr.indexOf(name.toLowerCase()) !== -1) { + index++; + name = first + '(' + index + ')'; + } + } + return name; }, - deleteWorksheet: function() { + deleteWorksheet: function(selectTabs) { var me = this; - if (this.statusbar.tabbar.tabs.length == 1) { + if (this.statusbar.tabbar.tabs.length == 1 || selectTabs.length === this.statusbar.tabbar.tabs.length) { Common.UI.warning({msg: this.errorLastSheet}); } else { Common.UI.warning({ msg: this.warnDeleteSheet, buttons: ['ok','cancel'], callback: function(btn) { - if (btn == 'ok' && !me.api.asc_deleteWorksheet()) { + if (btn == 'ok' && !me.api.asc_deleteWorksheet(selectTabs)) { _.delay(function(){ Common.UI.error({msg: me.errorRemoveSheet}); },10); @@ -319,7 +362,7 @@ define([ hideWorksheet: function(hide, index) { if ( hide ) { - this.statusbar.tabbar.tabs.length == 1 ? + (this.statusbar.tabbar.tabs.length == 1 || index.length === this.statusbar.tabbar.tabs.length) ? Common.UI.warning({msg: this.errorLastSheet}) : this.api['asc_hideWorksheet'](index); } else { @@ -376,26 +419,38 @@ define([ } }, - moveWorksheet: function(cut, silent, index, destPos) { + moveWorksheet: function(selectArr, cut, silent, index, destPos) { var me = this; - var wc = me.api.asc_getWorksheetsCount(), items = [], i = -1; + var wc = me.api.asc_getWorksheetsCount(), items = [], arrIndex = [], i = -1; while (++i < wc) { if (!this.api.asc_isWorksheetHidden(i)) { items.push({ - value : me.api.asc_getWorksheetName(i), - inindex : i + value: me.api.asc_getWorksheetName(i), + inindex: i }); } } + if (!_.isUndefined(selectArr)) { + items.forEach(function (item) { + if (selectArr.indexOf(item.inindex) !== -1) { + arrIndex.push(item.inindex); + } + }); + } if (!_.isUndefined(silent)) { - me.api.asc_showWorksheet(items[index].inindex); + if (_.isUndefined(selectArr)) { + me.api.asc_showWorksheet(items[index].inindex); - Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()]); + Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()]); - if (!_.isUndefined(destPos)) { - me.api.asc_moveWorksheet(items.length === destPos ? wc : items[destPos].inindex); + if (!_.isUndefined(destPos)) { + me.api.asc_moveWorksheet(items.length === destPos ? wc : items[destPos].inindex); + } + } else { + if (!_.isUndefined(destPos)) { + me.api.asc_moveWorksheet(items.length === destPos ? wc : items[destPos].inindex, arrIndex); + } } - return; } @@ -406,10 +461,13 @@ define([ handler : function(btn, i) { if (btn == 'ok') { if (cut) { - me.api.asc_moveWorksheet(i == -255 ? wc : i); + me.api.asc_moveWorksheet(i == -255 ? wc : i, arrIndex); } else { - var new_text = me.createCopyName(me.api.asc_getWorksheetName(me.api.asc_getActiveWorksheetIndex())); - me.api.asc_copyWorksheet(i == -255 ? wc : i, new_text); + var arrNames = []; + arrIndex.forEach(function (item) { + arrNames.push(me.createCopyName(me.api.asc_getWorksheetName(item), arrNames)); + }); + me.api.asc_copyWorksheet(i == -255 ? wc : i, arrNames, arrIndex); } } me.api.asc_enableKeyEvents(true); @@ -481,18 +539,26 @@ define([ }, setWorksheetColor: function (color) { + var me = this; if (this.api) { - var sindex = this.api.asc_getActiveWorksheetIndex(); - var tab = _.findWhere(this.statusbar.tabbar.tabs, {sheetindex: sindex}); - if (tab) { + var selectTabs = this.statusbar.tabbar.selectTabs, + arrIndex = []; + selectTabs.forEach(function (item) { + arrIndex.push(item.sheetindex); + }); + if (arrIndex) { if ('transparent' === color) { - this.api.asc_setWorksheetTabColor(null, [sindex]); - tab.$el.find('a').css('box-shadow', ''); + this.api.asc_setWorksheetTabColor(null, arrIndex); + selectTabs.forEach(function (tab) { + tab.$el.find('a').css('box-shadow', ''); + }); } else { var asc_clr = Common.Utils.ThemeColor.getRgbColor(color); if (asc_clr) { - this.api.asc_setWorksheetTabColor(asc_clr, [sindex]); - this.setTabLineColor(tab, asc_clr); + this.api.asc_setWorksheetTabColor(asc_clr, arrIndex); + selectTabs.forEach(function (tab) { + me.setTabLineColor(tab, asc_clr); + }); } } } @@ -610,9 +676,9 @@ define([ if (color.length) { if (!tab.isActive()) { - color = '0px 3px 0 ' + Common.Utils.RGBColor(color).toRGBA(0.7) + ' inset'; + color = '0px 4px 0 ' + Common.Utils.RGBColor(color).toRGBA(1) + ' inset'; } else { - color = '0px 3px 0 ' + color + ' inset'; + color = '0px 4px 0 ' + color + ' inset'; } tab.$el.find('a').css('box-shadow', color); diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js index b4e760c07..08e327e61 100644 --- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js @@ -44,6 +44,7 @@ define([ 'common/main/lib/view/CopyWarningDialog', 'common/main/lib/view/ImageFromUrlDialog', 'common/main/lib/view/SelectFileDlg', + 'common/main/lib/view/SymbolTableDialog', 'common/main/lib/util/define', 'spreadsheeteditor/main/app/view/Toolbar', 'spreadsheeteditor/main/app/collection/TableTemplates', @@ -308,8 +309,6 @@ define([ toolbar.btnAlignCenter.on('click', _.bind(this.onHorizontalAlign, this, AscCommon.align_Center)); toolbar.btnAlignRight.on('click', _.bind(this.onHorizontalAlign, this, AscCommon.align_Right)); toolbar.btnAlignJust.on('click', _.bind(this.onHorizontalAlign, this, AscCommon.align_Justify)); - toolbar.btnHorizontalAlign.menu.on('item:click', _.bind(this.onHorizontalAlignMenu, this)); - toolbar.btnVerticalAlign.menu.on('item:click', _.bind(this.onVerticalAlignMenu, this)); toolbar.btnMerge.on('click', _.bind(this.onMergeCellsMenu, this, toolbar.btnMerge.menu, toolbar.btnMerge.menu.items[0])); toolbar.btnMerge.menu.on('item:click', _.bind(this.onMergeCellsMenu, this)); toolbar.btnAlignTop.on('click', _.bind(this.onVerticalAlign, this, Asc.c_oAscVAlign.Top)); @@ -323,6 +322,7 @@ define([ toolbar.btnInsertText.on('click', _.bind(this.onBtnInsertTextClick, this)); toolbar.btnInsertShape.menu.on('hide:after', _.bind(this.onInsertShapeHide, this)); toolbar.btnInsertEquation.on('click', _.bind(this.onInsertEquationClick, this)); + toolbar.btnInsertSymbol.on('click', _.bind(this.onInsertSymbolClick, this)); toolbar.btnTableTemplate.menu.on('show:after', _.bind(this.onTableTplMenuOpen, this)); toolbar.btnPercentStyle.on('click', _.bind(this.onNumberFormat, this)); toolbar.btnCurrencyStyle.on('click', _.bind(this.onNumberFormat, this)); @@ -362,7 +362,9 @@ define([ toolbar.btnPageOrient.menu.on('item:click', _.bind(this.onPageOrientSelect, this)); toolbar.btnPageMargins.menu.on('item:click', _.bind(this.onPageMarginsSelect, this)); toolbar.mnuPageSize.on('item:click', _.bind(this.onPageSizeClick, this)); - toolbar.mnuScale.on('item:click', _.bind(this.onScaleClick, this)); + toolbar.mnuScale.on('item:click', _.bind(this.onScaleClick, this, 'scale')); + toolbar.menuWidthScale.on('item:click', _.bind(this.onScaleClick, this, 'width')); + toolbar.menuHeightScale.on('item:click', _.bind(this.onScaleClick, this, 'height')); toolbar.btnPrintArea.menu.on('item:click', _.bind(this.onPrintAreaClick, this)); toolbar.btnPrintArea.menu.on('show:after', _.bind(this.onPrintAreaMenuOpen, this)); toolbar.btnImgGroup.menu.on('item:click', _.bind(this.onImgGroupSelect, this)); @@ -385,18 +387,21 @@ define([ this.api = api; var config = SSE.getController('Main').appOptions; - if ( !config.isEditDiagram && !config.isEditMailMerge ) { - this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); - this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this)); - this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); - } + if (config.isEdit) { + if ( !config.isEditDiagram && !config.isEditMailMerge ) { + this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this)); + this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this)); + this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); + } + this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); + Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this)); + this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this)); + Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); + } else if (config.isRestrictedEdit) + this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChangedRestricted, this)); - this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this)); - Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); - this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this)); - this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this)); - Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); }, // onNewDocument: function(btn, e) { @@ -428,7 +433,7 @@ define([ onSave: function(e) { if (this.api) { var isModified = this.api.asc_isDocumentCanSave(); - var isSyncButton = this.toolbar.btnCollabChanges && this.toolbar.btnCollabChanges.$icon.hasClass('btn-synch'); + var isSyncButton = this.toolbar.btnCollabChanges && this.toolbar.btnCollabChanges.cmpEl.hasClass('notify'); if (!isModified && !isSyncButton && !this.toolbar.mode.forcesave) return; @@ -715,38 +720,6 @@ define([ Common.component.Analytics.trackEvent('ToolBar', 'Horizontal align'); }, - onHorizontalAlignMenu: function(menu, item) { - var btnHorizontalAlign = this.toolbar.btnHorizontalAlign; - - btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls); - btnHorizontalAlign.options.icls = !item.checked ? 'btn-align-left' : item.options.icls; - btnHorizontalAlign.$icon.addClass(btnHorizontalAlign.options.icls); - - this._state.pralign = undefined; - if (this.api) - this.api.asc_setCellAlign(!item.checked ? null : item.value); - - this.toolbar.btnWrap.allowDepress = !(item.value == AscCommon.align_Justify); - - Common.NotificationCenter.trigger('edit:complete', this.toolbar); - Common.component.Analytics.trackEvent('ToolBar', 'Horizontal Align'); - }, - - onVerticalAlignMenu: function(menu, item) { - var btnVerticalAlign = this.toolbar.btnVerticalAlign; - - btnVerticalAlign.$icon.removeClass(btnVerticalAlign.options.icls); - btnVerticalAlign.options.icls = !item.checked ? 'btn-valign-bottom' : item.options.icls; - btnVerticalAlign.$icon.addClass(btnVerticalAlign.options.icls); - - this._state.valign = undefined; - if (this.api) - this.api.asc_setCellVertAlign(!item.checked ? Asc.c_oAscVAlign.Bottom : item.value); - - Common.NotificationCenter.trigger('edit:complete', this.toolbar); - Common.component.Analytics.trackEvent('ToolBar', 'Vertical Align'); - }, - onVerticalAlign: function(type, btn, e) { this._state.valign = undefined; if (this.api) { @@ -1845,33 +1818,54 @@ define([ }, onChangeScaleSettings: function(width, height, scale) { - var me = this; if (this.toolbar.btnScale.menu) { - this.toolbar.btnScale.menu.clearAll(); if (width !== undefined) { - if ((width === 0 || width === null) && (height === 0 || height === null) && scale === 100) { - this._state.scale = 0; - } else if (width === 1 && height === 1) { - this._state.scale = 1; - } else if (width === 1 && (height === 0 || height === null)) { - this._state.scale = 2; - } else if ((width === 0 || width === null) && height === 1) { - this._state.scale = 3; - } else if ((width === 0 || width === null) && (height === 0 || height === null)) { - this._state.scale = 4; + var isWidth = false, + isHeight = false; + var width = width || 0, + height = height || 0; + if (scale !== undefined) { + this.toolbar.setValueCustomScale(scale); } else { - this._state.scale = 5; + this.toolbar.setValueCustomScale(this.api.asc_getPageOptions().asc_getPageSetup().asc_getScale()); + } + this.toolbar.menuWidthScale.clearAll(); + this.toolbar.menuWidthScale.items.forEach(function (item) { + if (item.value === width) { + item.setChecked(true); + isWidth = true; + return false; + } + }); + if (!isWidth) { + this.toolbar.menuWidthScale.items[11].setChecked(true); + } + this.toolbar.menuHeightScale.clearAll(); + this.toolbar.menuHeightScale.items.forEach(function (item) { + if (item.value === height) { + item.setChecked(true); + isHeight = true; + return false; + } + }); + if (!isHeight) { + this.toolbar.menuHeightScale.items[11].setChecked(true); + } + if (this.toolbar.btnCustomScaleUp && this.toolbar.btnCustomScaleDown) { + this.toolbar.btnCustomScaleUp.setDisabled(!(!width && !height)); + this.toolbar.btnCustomScaleDown.setDisabled(!(!width && !height)); + this.toolbar.mnuCustomScale.setDisabled(!(!width && !height)); + } + this._state.scaleWidth = width; + this._state.scaleHeight = height; + this._state.scale = scale; + } else { + if (this.toolbar.btnCustomScaleUp && this.toolbar.btnCustomScaleDown) { + this.toolbar.btnCustomScaleUp.setDisabled(!(!this._state.scaleWidth && !this._state.scaleHeight)); + this.toolbar.btnCustomScaleDown.setDisabled(!(!this._state.scaleWidth && !this._state.scaleHeight)); + this.toolbar.mnuCustomScale.setDisabled(!(!this._state.scaleWidth && !this._state.scaleHeight)); } - this.toolbar.setValueCustomScale(scale); - } else if (scale === undefined) { - this.toolbar.setValueCustomScale(this.api.asc_getPageOptions().asc_getPageSetup().asc_getScale()); } - _.each(this.toolbar.btnScale.menu.items, function(item){ - if (item.value === me._state.scale) { - item.setChecked(true); - return false; - } - }, this); } }, @@ -2210,20 +2204,11 @@ define([ toolbar.btnAlignLeft.toggle(index===0, true); toolbar.btnAlignCenter.toggle(index===1, true); toolbar.btnAlignJust.toggle(index===3, true); - toolbar.btnHorizontalAlign.menu.items[index].setChecked(true, false); } else if (index == -255) { toolbar.btnAlignRight.toggle(false, true); toolbar.btnAlignLeft.toggle(false, true); toolbar.btnAlignCenter.toggle(false, true); toolbar.btnAlignJust.toggle(false, true); - - toolbar.btnHorizontalAlign.menu.clearAll(); - } - - var btnHorizontalAlign = this.toolbar.btnHorizontalAlign; - if ( btnHorizontalAlign.rendered ) { - btnHorizontalAlign.$icon.removeClass(btnHorizontalAlign.options.icls).addClass(align); - btnHorizontalAlign.options.icls = align; } } @@ -2248,13 +2233,6 @@ define([ toolbar.btnAlignTop.toggle(index===0, true); toolbar.btnAlignMiddle.toggle(index===1, true); toolbar.btnAlignBottom.toggle(index===2, true); - toolbar.btnVerticalAlign.menu.items[index].setChecked(true, false); - - var btnVerticalAlign = this.toolbar.btnVerticalAlign; - if ( btnVerticalAlign.rendered ) { - btnVerticalAlign.$icon.removeClass(btnVerticalAlign.options.icls).addClass(align); - btnVerticalAlign.options.icls = align; - } } } @@ -2285,7 +2263,7 @@ define([ } need_disable = this._state.controlsdisabled.filters || (val===null); toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable, - { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnTableTemplate, toolbar.btnInsertTable) }); + { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnTableTemplate, toolbar.btnInsertTable) }); val = (formatTableInfo) ? formatTableInfo.asc_getTableStyleName() : null; if (this._state.tablestylename !== val && this.toolbar.mnuTableTemplatePicker) { @@ -2315,10 +2293,10 @@ define([ toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink, toolbar.btnInsertTable]}); this._state.inpivot = !!info.asc_getPivotTableInfo(); - toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsClearAutofilter, toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable)}); + toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsClearAutofilter, toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable)}); need_disable = !this.appConfig.canModifyFilter; - toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2], + toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnCustomSort, toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2], toolbar.btnInsertTable)}); } @@ -2397,12 +2375,20 @@ define([ toolbar.btnDeleteCell.menu.items[1].setDisabled(this._state.controlsdisabled.cells_down); } - toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (info.asc_getComments().length>0 || info.asc_getLocked()), + toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (info.asc_getComments().length>0 || info.asc_getLocked()) || + this.toolbar.mode.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells), { array: this.btnsComment }); toolbar.lockToolbar(SSE.enumLock.headerLock, info.asc_getLockedHeaderFooter(), {array: this.toolbar.btnsEditHeader}); }, + onApiSelectionChangedRestricted: function(info) { + var selectionType = info.asc_getFlags().asc_getSelectionType(); + this.toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (info.asc_getComments().length>0 || info.asc_getLocked()) || + this.appConfig && this.appConfig.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells), + { array: this.btnsComment }); + }, + onApiSelectionChanged_DiagramEditor: function(info) { if ( !this.editMode || this.api.isCellEdited || this.api.isRangeSelection) return; @@ -2739,6 +2725,28 @@ define([ Common.NotificationCenter.trigger('edit:complete', this.toolbar, this.toolbar.btnInsertEquation); }, + onInsertSymbolClick: function() { + if (this.api) { + var me = this, + win = new Common.Views.SymbolTableDialog({ + api: me.api, + lang: me.toolbar.mode.lang, + type: 1, + buttons: [{value: 'ok', caption: this.textInsert}, 'close'], + handler: function(dlg, result, settings) { + if (result == 'ok') { + me.api.asc_insertSymbol(settings.font, settings.code); + } else + Common.NotificationCenter.trigger('edit:complete', me.toolbar); + } + }); + win.show(); + win.on('symbol:dblclick', function(cmp, result, settings) { + me.api.asc_insertSymbol(settings.font, settings.code); + }); + } + }, + onApiMathTypes: function(equation) { this._equationTemp = equation; var me = this; @@ -3127,73 +3135,75 @@ define([ compactview = true; } - setTimeout(function () { - me.toolbar.render(_.extend({isCompactView: compactview}, config)); - if ( config.isEdit ) { - me.toolbar.setMode(config); + me.toolbar.render(_.extend({isCompactView: compactview}, config)); - me.toolbar.btnSave && me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled')); - me.toolbar.btnUndo && me.toolbar.btnUndo.on('disabled', _.bind(me.onBtnChangeState, me, 'undo:disabled')); - me.toolbar.btnRedo && me.toolbar.btnRedo.on('disabled', _.bind(me.onBtnChangeState, me, 'redo:disabled')); - me.toolbar.btnPrint && me.toolbar.btnPrint.on('disabled', _.bind(me.onBtnChangeState, me, 'print:disabled')); - me.toolbar.setApi(me.api); + if ( !config.isEditDiagram && !config.isEditMailMerge ) { + var tab = {action: 'review', caption: me.toolbar.textTabCollaboration}; + var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel(); + if ($panel) + me.toolbar.addTab(tab, $panel, 6); + } - if ( !config.isEditDiagram && !config.isEditMailMerge ) { - var datatab = me.getApplication().getController('DataTab'); - datatab.setApi(me.api).setConfig({toolbar: me}); + if ( config.isEdit ) { + me.toolbar.setMode(config); - datatab = datatab.getView('DataTab'); - Array.prototype.push.apply(me.toolbar.lockControls, datatab.getButtons()); - me.toolbar.btnsSortDown = datatab.getButtons('sort-down'); - me.toolbar.btnsSortUp = datatab.getButtons('sort-up'); - me.toolbar.btnsSetAutofilter = datatab.getButtons('set-filter'); - me.toolbar.btnsClearAutofilter = datatab.getButtons('clear-filter'); + me.toolbar.btnSave && me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled')); + me.toolbar.btnUndo && me.toolbar.btnUndo.on('disabled', _.bind(me.onBtnChangeState, me, 'undo:disabled')); + me.toolbar.btnRedo && me.toolbar.btnRedo.on('disabled', _.bind(me.onBtnChangeState, me, 'redo:disabled')); + me.toolbar.btnPrint && me.toolbar.btnPrint.on('disabled', _.bind(me.onBtnChangeState, me, 'print:disabled')); + me.toolbar.setApi(me.api); - var formulatab = me.getApplication().getController('FormulaDialog'); - formulatab.setConfig({toolbar: me}); - formulatab = formulatab.getView('FormulaTab'); - me.toolbar.btnsFormula = formulatab.getButtons('formula'); - Array.prototype.push.apply(me.toolbar.lockControls, formulatab.getButtons()); + if ( !config.isEditDiagram && !config.isEditMailMerge ) { + var datatab = me.getApplication().getController('DataTab'); + datatab.setApi(me.api).setConfig({toolbar: me}); - if ( !config.isOffline ) { - tab = {action: 'pivot', caption: me.textPivot}; - var pivottab = me.getApplication().getController('PivotTable'); - $panel = pivottab.createToolbarPanel(); - if ($panel) { - me.toolbar.addTab(tab, $panel, 5); - me.toolbar.setVisible('pivot', true); - Array.prototype.push.apply(me.toolbar.lockControls, pivottab.getView('PivotTable').getButtons()); - } + datatab = datatab.getView('DataTab'); + Array.prototype.push.apply(me.toolbar.lockControls, datatab.getButtons()); + me.toolbar.btnsSortDown = datatab.getButtons('sort-down'); + me.toolbar.btnsSortUp = datatab.getButtons('sort-up'); + me.toolbar.btnsSetAutofilter = datatab.getButtons('set-filter'); + me.toolbar.btnsClearAutofilter = datatab.getButtons('clear-filter'); + me.toolbar.btnCustomSort = datatab.getButtons('sort-custom'); + + var formulatab = me.getApplication().getController('FormulaDialog'); + formulatab.setConfig({toolbar: me}); + formulatab = formulatab.getView('FormulaTab'); + me.toolbar.btnsFormula = formulatab.getButtons('formula'); + Array.prototype.push.apply(me.toolbar.lockControls, formulatab.getButtons()); + + if ( !config.isOffline ) { + tab = {action: 'pivot', caption: me.textPivot}; + var pivottab = me.getApplication().getController('PivotTable'); + $panel = pivottab.createToolbarPanel(); + if ($panel) { + me.toolbar.addTab(tab, $panel, 5); + me.toolbar.setVisible('pivot', true); + Array.prototype.push.apply(me.toolbar.lockControls, pivottab.getView('PivotTable').getButtons()); } + } - var tab = {action: 'review', caption: me.toolbar.textTabCollaboration}; - var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel(); - if ( $panel ) - me.toolbar.addTab(tab, $panel, 6); + if (!(config.customization && config.customization.compactHeader)) { + // hide 'print' and 'save' buttons group and next separator + me.toolbar.btnPrint.$el.parents('.group').hide().next().hide(); - if (!(config.customization && config.customization.compactHeader)) { - // hide 'print' and 'save' buttons group and next separator - me.toolbar.btnPrint.$el.parents('.group').hide().next().hide(); + // hide 'undo' and 'redo' buttons and get container + var $box = me.toolbar.btnUndo.$el.hide().next().hide().parent(); - // hide 'undo' and 'redo' buttons and get container - var $box = me.toolbar.btnUndo.$el.hide().next().hide().parent(); + // move 'paste' button to the container instead of 'undo' and 'redo' + me.toolbar.btnPaste.$el.detach().appendTo($box); + me.toolbar.btnCopy.$el.removeClass('split'); + } - // move 'paste' button to the container instead of 'undo' and 'redo' - me.toolbar.btnPaste.$el.detach().appendTo($box); - me.toolbar.btnCopy.$el.removeClass('split'); - } - - if ( config.isDesktopApp ) { - if ( config.canProtect ) { - tab = {action: 'protect', caption: me.toolbar.textTabProtect}; - $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); - if ($panel) - me.toolbar.addTab(tab, $panel, 7); - } + if ( config.isDesktopApp ) { + if ( config.canProtect ) { + var tab = {action: 'protect', caption: me.toolbar.textTabProtect}; + var $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel(); + if ($panel) + me.toolbar.addTab(tab, $panel, 7); } } } - }, 0); + } }, onAppReady: function (config) { @@ -3203,7 +3213,7 @@ define([ this.btnsComment = []; if ( config.canCoAuthoring && config.canComments ) { var _set = SSE.enumLock; - this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'btn-menu-comments', this.toolbar.capBtnComment, [_set.lostConnect, _set.commentLock, _set.editCell]); + this.btnsComment = Common.Utils.injectButtons(this.toolbar.$el.find('.slot-comment'), 'tlbtn-addcomment-', 'toolbar__icon btn-menu-comments', this.toolbar.capBtnComment, [_set.lostConnect, _set.commentLock, _set.editCell]); if ( this.btnsComment.length ) { var _comments = SSE.getController('Common.Controllers.Comments').getView(); @@ -3213,6 +3223,8 @@ define([ btn.on('click', function (btn, e) { Common.NotificationCenter.trigger('app:comment:add', 'toolbar', me.api.asc_getCellInfo().asc_getFlags().asc_getSelectionType() != Asc.c_oAscSelectionType.RangeCells); }); + if (btn.cmpEl.closest('#review-changes-panel').length>0) + btn.setCaption(me.toolbar.capBtnAddComment); }, this); } } @@ -3392,50 +3404,40 @@ define([ } }, - onScaleClick: function(menu, item, event, scale) { + onScaleClick: function(type, menu, item, event, scale) { var me = this; if (me.api) { - if (scale !== undefined) { - me.api.asc_SetPrintScale(0, 0, scale); - me._state.scale = 4; - } else { - switch (item.value) { - case 0: - me.api.asc_SetPrintScale(0, 0, 100); - me._state.scale = 0; - break; - case 1: - me.api.asc_SetPrintScale(1, 1, 100); - me._state.scale = 1; - break; - case 2: - me.api.asc_SetPrintScale(1, 0, 100); - me._state.scale = 2; - break; - case 3: - me.api.asc_SetPrintScale(0, 1, 100); - me._state.scale = 3; - break; - case 5: - var win = new SSE.Views.ScaleDialog({ - api: me.api, - props: null, - handler: function (dlg, result) { - if (dlg == 'ok') { - if (me.api && result) { - me.api.asc_SetPrintScale(result.width, result.height, result.scale); - me.onChangeScaleSettings(result.width, result.height, result.scale); - } - me._state.scale = 5; - } else { - me.onChangeScaleSettings(); - } - Common.NotificationCenter.trigger('edit:complete'); - } - }); - win.show(); - break; + if (type === 'width' && item.value !== 'more') { + if (me._state.scaleHeight === undefined || me._state.scaleHeight === null) { + me._state.scaleHeight = 0; } + me.api.asc_SetPrintScale(item.value, me._state.scaleHeight, 100); + me.onChangeScaleSettings(item.value, me._state.scaleHeight, 100); + } else if (type === 'height' && item.value !== 'more') { + if (me._state.scaleWidth === undefined || me._state.scaleWidth === null) { + me._state.scaleWidth = 0; + } + me.api.asc_SetPrintScale(me._state.scaleWidth, item.value, 100); + me.onChangeScaleSettings(me._state.scaleWidth, item.value, 100); + } else if (type === 'scale' && scale !== undefined) { + me.api.asc_SetPrintScale(0, 0, scale); + } else if (item.value === 'custom' || item.value === 'more') { + var win = new SSE.Views.ScaleDialog({ + api: me.api, + props: null, + handler: function (dlg, result) { + if (dlg == 'ok') { + if (me.api && result) { + me.api.asc_SetPrintScale(result.width, result.height, result.scale); + me.onChangeScaleSettings(result.width, result.height, result.scale); + } + } else { + me.onChangeScaleSettings(me._state.scaleWidth, me._state.scaleHeight, me._state.scale); + } + Common.NotificationCenter.trigger('edit:complete'); + } + }); + win.show(); } } @@ -3800,7 +3802,8 @@ define([ textPivot: 'Pivot Table', txtTable_TableStyleMedium: 'Table Style Medium', txtTable_TableStyleDark: 'Table Style Dark', - txtTable_TableStyleLight: 'Table Style Light' + txtTable_TableStyleLight: 'Table Style Light', + textInsert: 'Insert' }, SSE.Controllers.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/controller/Viewport.js b/apps/spreadsheeteditor/main/app/controller/Viewport.js index 9002db7a2..151f68b4c 100644 --- a/apps/spreadsheeteditor/main/app/controller/Viewport.js +++ b/apps/spreadsheeteditor/main/app/controller/Viewport.js @@ -242,9 +242,9 @@ define([ 'data-stopPropagation="true"', '<% } %>', '>', '', - '', + '', '', - '', + '', '
    ' ].join('')), stopPropagation: true, diff --git a/apps/spreadsheeteditor/main/app/template/CellEditor.template b/apps/spreadsheeteditor/main/app/template/CellEditor.template index 31ad75506..01bf97f19 100644 --- a/apps/spreadsheeteditor/main/app/template/CellEditor.template +++ b/apps/spreadsheeteditor/main/app/template/CellEditor.template @@ -1,7 +1,7 @@
    - +
    diff --git a/apps/spreadsheeteditor/main/app/template/CellSettings.template b/apps/spreadsheeteditor/main/app/template/CellSettings.template index bcafb045b..c9bbb14b0 100644 --- a/apps/spreadsheeteditor/main/app/template/CellSettings.template +++ b/apps/spreadsheeteditor/main/app/template/CellSettings.template @@ -11,7 +11,7 @@ -
    +
    @@ -29,30 +29,19 @@
    - -
    + +
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    + +
    +
    +
    diff --git a/apps/spreadsheeteditor/main/app/template/ImageSettings.template b/apps/spreadsheeteditor/main/app/template/ImageSettings.template index 8e90e9ace..ace66d110 100644 --- a/apps/spreadsheeteditor/main/app/template/ImageSettings.template +++ b/apps/spreadsheeteditor/main/app/template/ImageSettings.template @@ -21,12 +21,12 @@ diff --git a/apps/spreadsheeteditor/main/app/template/LeftMenu.template b/apps/spreadsheeteditor/main/app/template/LeftMenu.template index a5ff8e732..e01779e68 100644 --- a/apps/spreadsheeteditor/main/app/template/LeftMenu.template +++ b/apps/spreadsheeteditor/main/app/template/LeftMenu.template @@ -1,14 +1,14 @@
    - + - - + + - - - - + + + +
    diff --git a/apps/spreadsheeteditor/main/app/template/RightMenu.template b/apps/spreadsheeteditor/main/app/template/RightMenu.template index 6208aadf7..09960c52f 100644 --- a/apps/spreadsheeteditor/main/app/template/RightMenu.template +++ b/apps/spreadsheeteditor/main/app/template/RightMenu.template @@ -21,14 +21,14 @@
    - - - - - - - - - + + + + + + + + +
    \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/template/SortDialog.template b/apps/spreadsheeteditor/main/app/template/SortDialog.template new file mode 100644 index 000000000..d4f8168b9 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/template/SortDialog.template @@ -0,0 +1,28 @@ +
    +
    +
    - +
    -
    +
    + + + + + + + + + +
    + + + +
    +
    + +
    + + + +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/template/StatusBar.template b/apps/spreadsheeteditor/main/app/template/StatusBar.template index 4c979f33b..0d913dd6d 100644 --- a/apps/spreadsheeteditor/main/app/template/StatusBar.template +++ b/apps/spreadsheeteditor/main/app/template/StatusBar.template @@ -1,23 +1,23 @@
    - - - - + + + +
    - +
    - +
    - +
    diff --git a/apps/spreadsheeteditor/main/app/template/Toolbar.template b/apps/spreadsheeteditor/main/app/template/Toolbar.template index 9d812e6b3..052149916 100644 --- a/apps/spreadsheeteditor/main/app/template/Toolbar.template +++ b/apps/spreadsheeteditor/main/app/template/Toolbar.template @@ -33,8 +33,8 @@
    - - + +
    @@ -142,6 +142,7 @@
    +
    @@ -151,7 +152,7 @@ - +
    @@ -185,14 +186,17 @@
    - - + +
    - - + +
    +
    + +
    diff --git a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js index 2364b6e71..23bae9a5f 100644 --- a/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/AutoFilterDialog.js @@ -759,12 +759,13 @@ define([ '
    ', '', '
    ', '
    <%= Common.Utils.String.htmlEncode(value) %>
    ', @@ -1015,7 +1016,7 @@ define([ } } - if (type === 'button' || isLabel) { + if (type === 'button' || isLabel || event.target.className.match('checkmark')) { this.updateCellCheck(listView, record); _.delay(function () { diff --git a/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js b/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js index 196322ba3..19c89d13b 100644 --- a/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js @@ -52,8 +52,7 @@ define([ width : 350, cls : 'modal-dlg', modal : false, - buttons: ['ok', 'cancel'], - footerCls: 'right' + buttons: ['ok', 'cancel'] }, initialize : function(options) { @@ -156,7 +155,8 @@ define([ if (this.inputRange.checkValidate() !== true) return; } - this.options.handler.call(this, this, state); + if (this.options.handler.call(this, this, state)) + return; } this.close(); diff --git a/apps/spreadsheeteditor/main/app/view/CellSettings.js b/apps/spreadsheeteditor/main/app/view/CellSettings.js index 483d0f9ed..d77aafa17 100644 --- a/apps/spreadsheeteditor/main/app/view/CellSettings.js +++ b/apps/spreadsheeteditor/main/app/view/CellSettings.js @@ -75,11 +75,10 @@ define([ CellAngle: undefined, GradFillType: Asc.c_oAscFillGradType.GRAD_LINEAR, CellColor: 'transparent', - FillType: Asc.c_oAscFill.FILL_TYPE_SOLID, + FillType: Asc.c_oAscFill.FILL_TYPE_NOFILL, FGColor: '000000', BGColor: 'ffffff', - GradColor1: '000000', - GradColor2: 'ffffff' + GradColor: '000000' }; this.lockedControls = []; this._locked = true; @@ -88,7 +87,7 @@ define([ this.GradFillType = Asc.c_oAscFillGradType.GRAD_LINEAR; this.GradLinearDirectionType = 0; this.GradRadialDirectionIdx = 0; - this.GradColors = []; + this.GradColor = { values: [0, 100], colors: ['000000', 'ffffff'], currentIdx: 0}; this.fillControls = []; @@ -188,11 +187,26 @@ define([ editable: false, data: this._arrFillSrc }); - this.cmbFillSrc.setValue(this._arrFillSrc[0].value); + this.cmbFillSrc.setValue(Asc.c_oAscFill.FILL_TYPE_NOFILL); this.fillControls.push(this.cmbFillSrc); this.cmbFillSrc.on('selected', _.bind(this.onFillSrcSelect, this)); - this._arrGradType = [ + this.numGradientAngle = new Common.UI.MetricSpinner({ + el: $('#cell-spin-gradient-angle'), + step: 10, + width: 90, + defaultUnit : "°", + value: '0 °', + allowDecimal: true, + maxValue: 359.9, + minValue: 0, + disabled: this._locked + }); + this.lockedControls.push(this.numGradientAngle); + this.numGradientAngle.on('change', _.bind(this.onGradientAngleChange, this)); + this.numGradientAngle.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + + /*this._arrGradType = [ {displayValue: this.textLinear, value: Asc.c_oAscFillGradType.GRAD_LINEAR}, {displayValue: this.textRadial, value: Asc.c_oAscFillGradType.GRAD_PATH} ]; @@ -206,7 +220,7 @@ define([ }); this.cmbGradType.setValue(this._arrGradType[0].value); this.fillControls.push(this.cmbGradType); - this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this)); + this.cmbGradType.on('selected', _.bind(this.onGradTypeSelect, this));*/ this._viewDataLinear = [ { offsetx: 0, offsety: 0, type:45, subtype:-1, iconcls:'gradient-left-top' }, @@ -219,10 +233,6 @@ define([ { offsetx: 100, offsety: 100, type:225, subtype:7, iconcls:'gradient-right-bottom'} ]; - this._viewDataRadial = [ - { offsetx: 100, offsety: 150, type:2, subtype:5, iconcls:'gradient-radial-center'} - ]; - this.btnDirection = new Common.UI.Button({ cls : 'btn-large-dataview', iconCls : 'item-gradient gradient-left', @@ -247,6 +257,48 @@ define([ this.fillControls.push(this.btnDirection); this.mnuDirectionPicker.on('item:click', _.bind(this.onSelectGradient, this, this.btnDirection)); + this.sldrGradient = new Common.UI.MultiSliderGradient({ + el: $('#cell-slider-gradient'), + width: 125, + minValue: 0, + maxValue: 100, + values: [0, 100] + }); + this.sldrGradient.on('change', _.bind(this.onGradientChange, this)); + this.sldrGradient.on('changecomplete', _.bind(this.onGradientChangeComplete, this)); + this.sldrGradient.on('thumbclick', function(cmp, index){ + me.GradColor.currentIdx = index; + var color = me.GradColor.colors[me.GradColor.currentIdx]; + me.btnGradColor.setColor(color); + me.colorsGrad.select(color,false); + }); + this.sldrGradient.on('thumbdblclick', function(cmp){ + me.btnGradColor.cmpEl.find('button').dropdown('toggle'); + }); + this.sldrGradient.on('sortthumbs', function(cmp, recalc_indexes){ + var colors = [], + currentIdx; + _.each (recalc_indexes, function(recalc_index, index) { + colors.push(me.GradColor.colors[recalc_index]); + if (me.GradColor.currentIdx == recalc_index) + currentIdx = index; + }); + me.OriginalFillType = null; + me.GradColor.colors = colors; + me.GradColor.currentIdx = currentIdx; + }); + this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){ + me.GradColor.colors[index] = me.GradColor.colors[nearIndex]; + me.GradColor.currentIdx = index; + me.sldrGradient.addNewThumb(index, color); + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + }); + this.fillControls.push(this.sldrGradient); + this.cmbPattern = new Common.UI.ComboDataView({ itemWidth: 28, itemHeight: 28, @@ -305,23 +357,23 @@ define([ } var _arrBorderPosition = [ - [Asc.c_oAscBorderOptions.Left, 'btn-borders-small btn-position-left', 'cell-button-border-left', this.tipLeft], - [Asc.c_oAscBorderOptions.InnerV,'btn-borders-small btn-position-inner-vert','cell-button-border-inner-vert', this.tipInnerVert], - [Asc.c_oAscBorderOptions.Right, 'btn-borders-small btn-position-right', 'cell-button-border-right', this.tipRight], - [Asc.c_oAscBorderOptions.Top, 'btn-borders-small btn-position-top', 'cell-button-border-top', this.tipTop], - [Asc.c_oAscBorderOptions.InnerH,'btn-borders-small btn-position-inner-hor', 'cell-button-border-inner-hor', this.tipInnerHor], - [Asc.c_oAscBorderOptions.Bottom,'btn-borders-small btn-position-bottom', 'cell-button-border-bottom', this.tipBottom], - [Asc.c_oAscBorderOptions.DiagU, 'btn-borders-small btn-position-diagu', 'cell-button-border-diagu', this.tipDiagU], - [Asc.c_oAscBorderOptions.DiagD, 'btn-borders-small btn-position-diagd', 'cell-button-border-diagd', this.tipDiagD], - ['inner', 'btn-borders-small btn-position-inner', 'cell-button-border-inner', this.tipInner], - ['outer', 'btn-borders-small btn-position-outer', 'cell-button-border-outer', this.tipOuter], - ['all', 'btn-borders-small btn-position-all', 'cell-button-border-all', this.tipAll], - ['none', 'btn-borders-small btn-position-none', 'cell-button-border-none', this.tipNone] + [Asc.c_oAscBorderOptions.Left, 'toolbar__icon btn-border-left', 'cell-button-border-left', this.tipLeft], + [Asc.c_oAscBorderOptions.InnerV,'toolbar__icon btn-border-insidevert', 'cell-button-border-inner-vert',this.tipInnerVert], + [Asc.c_oAscBorderOptions.Right, 'toolbar__icon btn-border-right', 'cell-button-border-right', this.tipRight], + [Asc.c_oAscBorderOptions.Top, 'toolbar__icon btn-border-top', 'cell-button-border-top', this.tipTop], + [Asc.c_oAscBorderOptions.InnerH,'toolbar__icon btn-border-insidehor', 'cell-button-border-inner-hor', this.tipInnerHor], + [Asc.c_oAscBorderOptions.Bottom,'toolbar__icon btn-border-bottom', 'cell-button-border-bottom', this.tipBottom], + [Asc.c_oAscBorderOptions.DiagU, 'toolbar__icon btn-border-diagup', 'cell-button-border-diagu', this.tipDiagU], + [Asc.c_oAscBorderOptions.DiagD, 'toolbar__icon btn-border-diagdown', 'cell-button-border-diagd', this.tipDiagD], + ['inner', 'toolbar__icon btn-border-inside', 'cell-button-border-inner', this.tipInner], + ['outer', 'toolbar__icon btn-border-out', 'cell-button-border-outer', this.tipOuter], + ['all', 'toolbar__icon btn-border-all', 'cell-button-border-all', this.tipAll], + ['none', 'toolbar__icon btn-border-no', 'cell-button-border-none', this.tipNone] ]; _.each(_arrBorderPosition, function(item, index, list){ var _btn = new Common.UI.Button({ - cls: 'btn-toolbar', + cls: 'btn-toolbar borders--small', iconCls: item[1], borderId:item[0], hint: item[3], @@ -387,6 +439,7 @@ define([ }); this.lockedControls.push(this.spnAngle); this.spnAngle.on('change', _.bind(this.onAngleChange, this)); + this.spnAngle.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); }, createDelayedElements: function() { @@ -401,261 +454,296 @@ define([ this.disableControls(this._locked); - if (props ) - { + if (props ) { this._noApply = true; var value = props.asc_getAngle(); - if ( Math.abs(this._state.CellAngle-value)>0.1 || (this._state.CellAngle===undefined)&&(this._state.CellAngle!==value)) { + if (Math.abs(this._state.CellAngle - value) > 0.1 || (this._state.CellAngle === undefined) && (this._state.CellAngle !== value)) { this.spnAngle.setValue((value !== null) ? value : '', true); - this._state.CellAngle=value; + this._state.CellAngle = value; } this.fill = props.asc_getFill2(); - this.pattern = this.fill.asc_getPatternFill(); - this.gradient = this.fill.asc_getGradientFill(); - if (this.pattern === null && this.gradient === null) { - this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_NOFILL; - this.CellColor = {Value: 0, Color: 'transparent'}; - this.FGColor = {Value: 1, Color: {color: '4f81bd', effectId: 24}}; - this.BGColor = {Value: 1, Color: 'ffffff'}; - this.GradColors[0] = {Value: 1, Color: {color: '4f81bd', effectId: 24}, Position: 0}; - this.GradColors[1] = {Value: 1, Color: 'ffffff', Position: 1}; - } else if (this.pattern !== null) { - if(this.pattern.asc_getType() === -1) { - var color = this.pattern.asc_getFgColor(); - if (color.asc_getType() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { - this.CellColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB()), effectValue: color.asc_getValue() }}; - } else { - this.CellColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB())}; - } - this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_SOLID; - this.FGColor = {Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.CellColor.Color)}; + if (this.fill) { + this.pattern = this.fill.asc_getPatternFill(); + this.gradient = this.fill.asc_getGradientFill(); + if (this.pattern === null && this.gradient === null) { + this.CellColor = {Value: 0, Color: 'transparent'}; + this.FGColor = {Value: 1, Color: {color: '4f81bd', effectId: 24}}; this.BGColor = {Value: 1, Color: 'ffffff'}; - this.GradColors[0] = {Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.CellColor.Color), Position: 0}; - this.GradColors[1] = {Value: 1, Color: 'ffffff', Position: 1}; - } else { - this.PatternFillType = this.pattern.asc_getType(); - if (this._state.PatternFillType !== this.PatternFillType) { - this.cmbPattern.suspendEvents(); - var rec = this.cmbPattern.menuPicker.store.findWhere({ - type: this.PatternFillType - }); - this.cmbPattern.menuPicker.selectRecord(rec); - this.cmbPattern.resumeEvents(); - this._state.PatternFillType = this.PatternFillType; - } - var color = this.pattern.asc_getFgColor(); - if (color) { + this.sldrGradient.setThumbs(2); + this.GradColor.colors.length = 0; + this.GradColor.values.length = 0; + this.GradColor.colors[0] = {color: '4f81bd', effectId: 24}; + this.GradColor.colors[1] = 'ffffff'; + this.GradColor.values = [0, 100]; + this.GradColor.currentIdx = 0; + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_NOFILL; + } else if (this.pattern !== null) { + if (this.pattern.asc_getType() === -1) { + var color = this.pattern.asc_getFgColor(); if (color.asc_getType() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { - this.FGColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB()), effectValue: color.asc_getValue() }}; + this.CellColor = { + Value: 1, + Color: { + color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB()), + effectValue: color.asc_getValue() + } + }; } else { - this.FGColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB())}; + this.CellColor = { + Value: 1, + Color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB()) + }; } - } else - this.FGColor = {Value: 1, Color: {color: '4f81bd', effectId: 24}}; - - color = this.pattern.asc_getBgColor(); - if (color) { - if (color.asc_getType() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { - this.BGColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB()), effectValue: color.asc_getValue() }}; - } else { - this.BGColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB())}; - } - } else + this.FGColor = { + Value: 1, + Color: Common.Utils.ThemeColor.colorValue2EffectId(this.CellColor.Color) + }; this.BGColor = {Value: 1, Color: 'ffffff'}; - this.CellColor = {Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color)}; - this.GradColors[0] = {Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color), Position: 0}; - this.GradColors[1] = {Value: 1, Color: 'ffffff', Position: 1}; - this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_PATT; - } - } else if (this.gradient !== null) { - var gradFillType = this.gradient.asc_getType(); - if (this._state.GradFillType !== gradFillType || this.GradFillType !== gradFillType) { - this.GradFillType = gradFillType; - rec = undefined; - if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR || this.GradFillType == Asc.c_oAscFillGradType.GRAD_PATH) { - this.cmbGradType.setValue(this.GradFillType); - rec = this.cmbGradType.store.findWhere({value: this.GradFillType}); - this.onGradTypeSelect(this.cmbGradType, rec.attributes); + this.sldrGradient.setThumbs(2); + this.GradColor.colors.length = 0; + this.GradColor.values.length = 0; + this.GradColor.values = [0, 100]; + this.GradColor.colors[0] = Common.Utils.ThemeColor.colorValue2EffectId(this.CellColor.Color); + this.GradColor.colors[1] = 'ffffff'; + this.GradColor.currentIdx = 0; + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_SOLID; } else { - this.cmbGradType.setValue(''); - this.btnDirection.setIconCls(''); + this.PatternFillType = this.pattern.asc_getType(); + if (this._state.PatternFillType !== this.PatternFillType) { + this.cmbPattern.suspendEvents(); + var rec = this.cmbPattern.menuPicker.store.findWhere({ + type: this.PatternFillType + }); + this.cmbPattern.menuPicker.selectRecord(rec); + this.cmbPattern.resumeEvents(); + this._state.PatternFillType = this.PatternFillType; + } + var color = this.pattern.asc_getFgColor(); + if (color) { + if (color.asc_getType() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.FGColor = { + Value: 1, + Color: { + color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB()), + effectValue: color.asc_getValue() + } + }; + } else { + this.FGColor = { + Value: 1, + Color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB()) + }; + } + } else + this.FGColor = {Value: 1, Color: {color: '4f81bd', effectId: 24}}; + + color = this.pattern.asc_getBgColor(); + if (color) { + if (color.asc_getType() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { + this.BGColor = { + Value: 1, + Color: { + color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB()), + effectValue: color.asc_getValue() + } + }; + } else { + this.BGColor = { + Value: 1, + Color: Common.Utils.ThemeColor.getHexColor(color.asc_getR(), color.asc_getG(), color.asc_getB()) + }; + } + } else + this.BGColor = {Value: 1, Color: 'ffffff'}; + this.CellColor = { + Value: 1, + Color: Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color) + }; + this.sldrGradient.setThumbs(2); + this.GradColor.colors.length = 0; + this.GradColor.values.length = 0; + this.GradColor.values = [0, 100]; + this.GradColor.colors[0] = Common.Utils.ThemeColor.colorValue2EffectId(this.FGColor.Color); + this.GradColor.colors[1] = 'ffffff'; + this.GradColor.currentIdx = 0; + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_PATT; } - this._state.GradFillType = this.GradFillType; - } - if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { - var value = this.gradient.asc_getDegree(); - if (Math.abs(this.GradLinearDirectionType-value)>0.001) { - this.GradLinearDirectionType=value; - var record = this.mnuDirectionPicker.store.findWhere({type: value}); - this.mnuDirectionPicker.selectRecord(record, true); - if (record) - this.btnDirection.setIconCls('item-gradient ' + record.get('iconcls')); - else + } else if (this.gradient !== null) { + var gradFillType = this.gradient.asc_getType(); + if (this._state.GradFillType !== gradFillType || this.GradFillType !== gradFillType) { + this.GradFillType = gradFillType; + /*rec = undefined; + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR || this.GradFillType == Asc.c_oAscFillGradType.GRAD_PATH) { + this.cmbGradType.setValue(this.GradFillType); + rec = this.cmbGradType.store.findWhere({value: this.GradFillType}); + this.onGradTypeSelect(this.cmbGradType, rec.attributes); + } else { + this.cmbGradType.setValue(''); this.btnDirection.setIconCls(''); + }*/ + this._state.GradFillType = this.GradFillType; } + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + var value = this.gradient.asc_getDegree(); + if (Math.abs(this.GradLinearDirectionType - value) > 0.001) { + this.GradLinearDirectionType = value; + var record = this.mnuDirectionPicker.store.findWhere({type: value}); + this.mnuDirectionPicker.selectRecord(record, true); + if (record) + this.btnDirection.setIconCls('item-gradient ' + record.get('iconcls')); + else + this.btnDirection.setIconCls(''); + this.numGradientAngle.setValue(value); + } + } + + var me = this; + + + var gradientStops; + gradientStops = this.gradient.asc_getGradientStops(); + var length = gradientStops.length; + this.sldrGradient.setThumbs(length); + this.GradColor.colors.length = 0; + this.GradColor.values.length = 0; + gradientStops.forEach(function (color) { + var clr = color.asc_getColor(), + position = color.asc_getPosition(); + me.GradColor.colors.push( clr.asc_getType() == Asc.c_oAscColor.COLOR_TYPE_SCHEME ? + {color: Common.Utils.ThemeColor.getHexColor(clr.asc_getR(), clr.asc_getG(), clr.asc_getB()), effectValue: clr.asc_getValue()} : + Common.Utils.ThemeColor.getHexColor(clr.asc_getR(), clr.asc_getG(), clr.asc_getB())); + me.GradColor.values.push(position*100); + }); + for (var index=0; index= me.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); + + this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; + this.FGColor = { + Value: 1, + Color: Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0]) + }; + this.BGColor = {Value: 1, Color: 'ffffff'}; + this.CellColor = { + Value: 1, + Color: Common.Utils.ThemeColor.colorValue2EffectId(this.GradColor.colors[0]) + }; } - var gradientStops; - this.GradColors.length = 0; - gradientStops = this.gradient.asc_getGradientStops(); - gradientStops.forEach(function (color) { - var clr = color.asc_getColor(), - position = color.asc_getPosition(), - itemColor; - if (clr.asc_getType() == Asc.c_oAscColor.COLOR_TYPE_SCHEME) { - itemColor = {Value: 1, Color: {color: Common.Utils.ThemeColor.getHexColor(clr.asc_getR(), clr.asc_getG(), clr.asc_getB()), effectValue: clr.asc_getValue()}, Position: position}; + if (this._state.FillType !== this.OriginalFillType) { + this.cmbFillSrc.setValue((this.OriginalFillType === null) ? '' : this.OriginalFillType); + this._state.FillType = this.OriginalFillType; + this.ShowHideElem(this.OriginalFillType); + } + + // Color Back + + var type1 = typeof (this.CellColor.Color), + type2 = typeof (this._state.CellColor); + if ((type1 !== type2) || (type1 == 'object' && + (this.CellColor.Color.effectValue !== this._state.CellColor.effectValue || this._state.CellColor.color.indexOf(this.CellColor.Color) < 0)) || + (type1 != 'object' && this._state.CellColor !== undefined && this._state.CellColor.indexOf(this.CellColor.Color) < 0)) { + + this.btnBackColor.setColor(this.CellColor.Color); + if (_.isObject(this.CellColor.Color)) { + var isselected = false; + for (var i = 0; i < 10; i++) { + if (Common.Utils.ThemeColor.ThemeValues[i] == this.CellColor.Color.effectValue) { + this.colorsBack.select(this.CellColor.Color, true); + isselected = true; + break; + } + } + if (!isselected) this.colorsBack.clearSelection(); } else { - itemColor = {Value: 1, Color: Common.Utils.ThemeColor.getHexColor(clr.asc_getR(), clr.asc_getG(), clr.asc_getB()), Position: position}; + this.colorsBack.select(this.CellColor.Color, true); } - me.GradColors.push(itemColor); - }); - this.GradColors = _.sortBy(this.GradColors, 'Position'); - - this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; - this.FGColor = {Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.GradColors[0].Color)}; - this.BGColor = {Value: 1, Color: 'ffffff'}; - this.CellColor = {Value: 1, Color: Common.Utils.ThemeColor.colorValue2EffectId(this.GradColors[0].Color)}; - } - - if ( this._state.FillType !== this.OriginalFillType ) { - this.cmbFillSrc.setValue((this.OriginalFillType === null) ? '' : this.OriginalFillType); - this._state.FillType = this.OriginalFillType; - this.ShowHideElem(this.OriginalFillType); - } - - // Color Back - - var type1 = typeof(this.CellColor.Color), - type2 = typeof(this._state.CellColor); - if ( (type1 !== type2) || (type1=='object' && - (this.CellColor.Color.effectValue!==this._state.CellColor.effectValue || this._state.CellColor.color.indexOf(this.CellColor.Color)<0)) || - (type1!='object' && this._state.CellColor!==undefined && this._state.CellColor.indexOf(this.CellColor.Color)<0 )) { - - this.btnBackColor.setColor(this.CellColor.Color); - if (_.isObject(this.CellColor.Color)) { - var isselected = false; - for (var i = 0; i < 10; i++) { - if (Common.Utils.ThemeColor.ThemeValues[i] == this.CellColor.Color.effectValue) { - this.colorsBack.select(this.CellColor.Color,true); - isselected = true; - break; - } - } - if (!isselected) this.colorsBack.clearSelection(); - } else { - this.colorsBack.select(this.CellColor.Color, true); + this._state.CellColor = this.CellColor.Color; } - this._state.CellColor = this.CellColor.Color; - } - // Pattern colors - type1 = typeof(this.FGColor.Color); - type2 = typeof(this._state.FGColor); + // Pattern colors + type1 = typeof (this.FGColor.Color); + type2 = typeof (this._state.FGColor); - if ( (type1 !== type2) || (type1=='object' && - (this.FGColor.Color.effectValue!==this._state.FGColor.effectValue || this._state.FGColor.color.indexOf(this.FGColor.Color.color)<0)) || - (type1!='object' && this._state.FGColor.indexOf(this.FGColor.Color)<0 )) { + if ((type1 !== type2) || (type1 == 'object' && + (this.FGColor.Color.effectValue !== this._state.FGColor.effectValue || this._state.FGColor.color.indexOf(this.FGColor.Color.color) < 0)) || + (type1 != 'object' && this._state.FGColor.indexOf(this.FGColor.Color) < 0)) { - this.btnFGColor.setColor(this.FGColor.Color); - if ( typeof(this.FGColor.Color) == 'object' ) { - var isselected = false; - for (var i=0; i<10; i++) { - if ( Common.Utils.ThemeColor.ThemeValues[i] == this.FGColor.Color.effectValue ) { - this.colorsFG.select(this.FGColor.Color,true); - isselected = true; - break; + this.btnFGColor.setColor(this.FGColor.Color); + if (typeof (this.FGColor.Color) == 'object') { + var isselected = false; + for (var i = 0; i < 10; i++) { + if (Common.Utils.ThemeColor.ThemeValues[i] == this.FGColor.Color.effectValue) { + this.colorsFG.select(this.FGColor.Color, true); + isselected = true; + break; + } } - } - if (!isselected) this.colorsFG.clearSelection(); - } else - this.colorsFG.select(this.FGColor.Color,true); + if (!isselected) this.colorsFG.clearSelection(); + } else + this.colorsFG.select(this.FGColor.Color, true); - this._state.FGColor = this.FGColor.Color; - } + this._state.FGColor = this.FGColor.Color; + } - type1 = typeof(this.BGColor.Color); - type2 = typeof(this._state.BGColor); + type1 = typeof (this.BGColor.Color); + type2 = typeof (this._state.BGColor); - if ( (type1 !== type2) || (type1=='object' && - (this.BGColor.Color.effectValue!==this._state.BGColor.effectValue || this._state.BGColor.color.indexOf(this.BGColor.Color.color)<0)) || - (type1!='object' && this._state.BGColor.indexOf(this.BGColor.Color)<0 )) { + if ((type1 !== type2) || (type1 == 'object' && + (this.BGColor.Color.effectValue !== this._state.BGColor.effectValue || this._state.BGColor.color.indexOf(this.BGColor.Color.color) < 0)) || + (type1 != 'object' && this._state.BGColor.indexOf(this.BGColor.Color) < 0)) { - this.btnBGColor.setColor(this.BGColor.Color); - if ( typeof(this.BGColor.Color) == 'object' ) { - var isselected = false; - for (var i=0; i<10; i++) { - if ( Common.Utils.ThemeColor.ThemeValues[i] == this.BGColor.Color.effectValue ) { - this.colorsBG.select(this.BGColor.Color,true); - isselected = true; - break; + this.btnBGColor.setColor(this.BGColor.Color); + if (typeof (this.BGColor.Color) == 'object') { + var isselected = false; + for (var i = 0; i < 10; i++) { + if (Common.Utils.ThemeColor.ThemeValues[i] == this.BGColor.Color.effectValue) { + this.colorsBG.select(this.BGColor.Color, true); + isselected = true; + break; + } } - } - if (!isselected) this.colorsBG.clearSelection(); - } else - this.colorsBG.select(this.BGColor.Color,true); + if (!isselected) this.colorsBG.clearSelection(); + } else + this.colorsBG.select(this.BGColor.Color, true); - this._state.BGColor = this.BGColor.Color; - } + this._state.BGColor = this.BGColor.Color; + } - // Gradient colors - var gradColor1 = this.GradColors[0]; - if (!gradColor1) { - gradColor1 = {Value: 1, Color: {color: '4f81bd', effectId: 24}}; - } - type1 = typeof(gradColor1.Color); - type2 = typeof(this._state.GradColor1); + // Gradient colors + var gradColor = this.GradColor.colors[this.GradColor.currentIdx]; + type1 = typeof (gradColor); + type2 = typeof (this._state.GradColor); - if ( (type1 !== type2) || (type1=='object' && - (gradColor1.Color.effectValue!==this._state.GradColor1.effectValue || this._state.GradColor1.color.indexOf(gradColor1.Color.color)<0)) || - (type1!='object' && this._state.GradColor1.indexOf(gradColor1.Color)<0 )) { + if ((type1 !== type2) || (type1 == 'object' && + (gradColor.effectValue !== this._state.GradColor.effectValue || this._state.GradColor.color.indexOf(gradColor.color) < 0)) || + (type1 != 'object' && this._state.GradColor.indexOf(gradColor) < 0)) { - this.btnGradColor1.setColor(gradColor1.Color); - if ( typeof(gradColor1.Color) == 'object' ) { - var isselected = false; - for (var i=0; i<10; i++) { - if ( Common.Utils.ThemeColor.ThemeValues[i] == gradColor1.Color.effectValue ) { - this.colorsGrad1.select(gradColor1.Color,true); - isselected = true; - break; + this.btnGradColor.setColor(gradColor); + if (typeof (gradColor) == 'object') { + var isselected = false; + for (var i = 0; i < 10; i++) { + if (Common.Utils.ThemeColor.ThemeValues[i] == gradColor.effectValue) { + this.colorsGrad.select(gradColor, true); + isselected = true; + break; + } } - } - if (!isselected) this.colorsGrad1.clearSelection(); - } else - this.colorsGrad1.select(gradColor1.Color,true); + if (!isselected) this.colorsGrad.clearSelection(); + } else + this.colorsGrad.select(gradColor, true); - this._state.GradColor1 = gradColor1.Color; + this._state.GradColor = gradColor; + } + + this._noApply = false; } - - var gradColor2 = this.GradColors[1]; - if (!gradColor2) { - gradColor2 = {Value: 1, Color: 'ffffff'}; - } - type1 = typeof(gradColor2.Color); - type2 = typeof(this._state.GradColor2); - - if ( (type1 !== type2) || (type1=='object' && - (gradColor2.Color.effectValue!==this._state.GradColor2.effectValue || this._state.GradColor2.color.indexOf(gradColor2.Color.color)<0)) || - (type1!='object' && this._state.GradColor2.indexOf(gradColor2.Color)<0 )) { - - this.btnGradColor2.setColor(gradColor2.Color); - if ( typeof(gradColor2.Color) == 'object' ) { - var isselected = false; - for (var i=0; i<10; i++) { - if ( Common.Utils.ThemeColor.ThemeValues[i] == gradColor2.Color.effectValue ) { - this.colorsGrad2.select(gradColor2.Color,true); - isselected = true; - break; - } - } - if (!isselected) this.colorsGrad2.clearSelection(); - } else - this.colorsGrad2.select(gradColor2.Color,true); - - this._state.GradColor2 = gradColor2.Color; - } - - this._noApply = false; } }, @@ -688,43 +776,24 @@ define([ this.btnBackColor.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsBack, this.btnBackColor)); this.fillControls.push(this.btnBackColor); - this.btnGradColor1 = new Common.UI.ColorButton({ + this.btnGradColor = new Common.UI.ColorButton({ style: "width:45px;", menu : new Common.UI.Menu({ items: [ - { template: _.template('
    ') }, - { template: _.template('' + this.textNewColor + '') } + { template: _.template('
    ') }, + { template: _.template('' + this.textNewColor + '') } ] }) }); - this.btnGradColor1.render( $('#cell-grad-btn-color-1')); - this.btnGradColor1.setColor('000000'); - this.colorsGrad1 = new Common.UI.ThemeColorPalette({ - el: $('#cell-gradient-color1-menu'), + this.btnGradColor.render( $('#cell-gradient-color-btn')); + this.btnGradColor.setColor('000000'); + this.colorsGrad = new Common.UI.ThemeColorPalette({ + el: $('#cell-gradient-color'), value: '000000' }); - this.colorsGrad1.on('select', _.bind(this.onColorsGradientSelect, this)); - this.btnGradColor1.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsGrad1, this.btnGradColor1)); - this.fillControls.push(this.btnGradColor1); - - this.btnGradColor2 = new Common.UI.ColorButton({ - style: "width:45px;", - menu : new Common.UI.Menu({ - items: [ - { template: _.template('
    ') }, - { template: _.template('' + this.textNewColor + '') } - ] - }) - }); - this.btnGradColor2.render( $('#cell-grad-btn-color-2')); - this.btnGradColor2.setColor('ffffff'); - this.colorsGrad2 = new Common.UI.ThemeColorPalette({ - el: $('#cell-gradient-color2-menu'), - value: 'ffffff' - }); - this.colorsGrad2.on('select', _.bind(this.onColorsGradientSelect, this)); - this.btnGradColor2.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsGrad2, this.btnGradColor2)); - this.fillControls.push(this.btnGradColor2); + this.colorsGrad.on('select', _.bind(this.onColorsGradientSelect, this)); + this.btnGradColor.menu.items[1].on('click', _.bind(this.addNewColor, this, this.colorsGrad, this.btnGradColor)); + this.fillControls.push(this.btnGradColor); this.btnFGColor = new Common.UI.ColorButton({ style: "width:45px;", @@ -767,8 +836,7 @@ define([ this.colorsBack.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.borderColor.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.btnBorderColor.setColor(this.borderColor.getColor()); - this.colorsGrad1.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); - this.colorsGrad2.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); + this.colorsGrad.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsFG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); this.colorsBG.updateColors(Common.Utils.ThemeColor.getEffectColors(), Common.Utils.ThemeColor.getStandartColors()); }, @@ -830,21 +898,24 @@ define([ this.gradient.asc_setDegree(this.GradLinearDirectionType); } if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_GRAD) { - var HexColor0 = Common.Utils.ThemeColor.getRgbColor(this.GradColors[0].Color).get_color().get_hex(), - HexColor1 = Common.Utils.ThemeColor.getRgbColor(this.GradColors[1].Color).get_color().get_hex(); - - if (HexColor0 === 'ffffff' && HexColor1 === 'ffffff') { - this.GradColors[0].Color = {color: '4f81bd', effectId: 24}; // color accent1 + this.GradColor.currentIdx = 0; + if (this.GradColor.colors.length === 2) { + var HexColor0 = Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[0]).get_color().get_hex(), + HexColor1 = Common.Utils.ThemeColor.getRgbColor(this.GradColor.colors[1]).get_color().get_hex(); + if (HexColor0 === 'ffffff' && HexColor1 === 'ffffff') { + this.GradColors.colors[0] = {color: '4f81bd', effectId: 24}; // color accent1 + } } var arrGradStop = []; - this.GradColors.forEach(function (item) { + this.GradColor.colors.forEach(function (item, index) { var gradientStop = new Asc.asc_CGradientStop(); - gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(item.Color)); - gradientStop.asc_setPosition(item.Position); + gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(me.GradColor.colors[index])); + gradientStop.asc_setPosition(me.GradColor.values[index]/100); arrGradStop.push(gradientStop); }); this.gradient.asc_putGradientStops(arrGradStop); } + this.fill.asc_setGradientFill(this.gradient); this.api.asc_setCellFill(this.fill); } @@ -887,7 +958,7 @@ define([ this.FillGradientContainer.toggleClass('settings-hidden', value !== Asc.c_oAscFill.FILL_TYPE_GRAD); }, - onGradTypeSelect: function(combo, record) { + /*onGradTypeSelect: function(combo, record) { this.GradFillType = record.value; if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { @@ -935,7 +1006,7 @@ define([ } Common.NotificationCenter.trigger('edit:complete', this); - }, + },*/ onSelectGradient: function(btn, picker, itemView, record) { var me = this; @@ -956,7 +1027,8 @@ define([ } this.btnDirection.setIconCls('item-gradient ' + rawData.iconcls); - (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) ? this.GradLinearDirectionType = rawData.type : this.GradRadialDirectionIdx = 0; + this.GradLinearDirectionType = rawData.type; + this.numGradientAngle.setValue(rawData.type); if (this.api) { if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { @@ -964,10 +1036,10 @@ define([ this.gradient = new Asc.asc_CGradientFill(); this.gradient.asc_setType(this.GradFillType); var arrGradStop = []; - this.GradColors.forEach(function (item) { + this.GradColor.values.forEach(function (item, index) { var gradientStop = new Asc.asc_CGradientStop(); - gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(item.Color)); - gradientStop.asc_setPosition(item.Position); + gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(me.GradColor.colors[index])); + gradientStop.asc_setPosition(me.GradColor.values[index]/100); arrGradStop.push(gradientStop); }); this.gradient.asc_putGradientStops(arrGradStop); @@ -982,15 +1054,10 @@ define([ }, onColorsGradientSelect: function(picker, color) { - var me = this, - pickerId = picker.el.id; - if (pickerId === "cell-gradient-color1-menu") { - this.btnGradColor1.setColor(color); - this.GradColors[0].Color = color; - } else if (pickerId === "cell-gradient-color2-menu") { - this.btnGradColor2.setColor(color); - this.GradColors[1].Color = color; - } + var me = this; + this.btnGradColor.setColor(color); + this.GradColor.colors[this.GradColor.currentIdx] = color; + this.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(color) == 'object') ? color.color : color)); if (this.api && !this._noApply) { if (this.gradient == null) { @@ -1001,10 +1068,10 @@ define([ } } var arrGradStop = []; - this.GradColors.forEach(function (item) { + this.GradColor.values.forEach(function (item, index) { var gradientStop = new Asc.asc_CGradientStop(); - gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(item.Color)); - gradientStop.asc_setPosition(item.Position); + gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(me.GradColor.colors[index]))); + gradientStop.asc_setPosition(me.GradColor.values[index]/100); arrGradStop.push(gradientStop); }); this.gradient.asc_putGradientStops(arrGradStop); @@ -1015,6 +1082,63 @@ define([ Common.NotificationCenter.trigger('edit:complete', this); }, + onGradientAngleChange: function(field, newValue, oldValue, eOpts) { + if (this.api) { + if (this.gradient == null) { + this.gradient = new Asc.asc_CGradientFill(); + this.gradient.asc_setType(this.GradFillType); + } + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + this.gradient.asc_setDegree(field.getNumberValue()); + } + this.fill.asc_setGradientFill(this.gradient); + this.api.asc_setCellFill(this.fill); + } + }, + + onGradientChange: function(slider, newValue, oldValue) { + this.GradColor.values = slider.getValues(); + this._sliderChanged = true; + if (this.api && !this._noApply) { + if (this._sendUndoPoint) { + this.api.setStartPointHistory(); + this._sendUndoPoint = false; + this.updateslider = setInterval(_.bind(this._gradientApplyFunc, this), 100); + } + } + }, + + onGradientChangeComplete: function(slider, newValue, oldValue) { + clearInterval(this.updateslider); + this._sliderChanged = true; + if (!this._sendUndoPoint) { // start point was added + this.api.setEndPointHistory(); + this._gradientApplyFunc(); + } + this._sendUndoPoint = true; + }, + + _gradientApplyFunc: function() { + if (this._sliderChanged) { + var me = this; + if (this.gradient == null) + this.gradient = new Asc.asc_CGradientFill(); + var arrGradStop = []; + this.GradColor.colors.forEach(function (item, index) { + var gradientStop = new Asc.asc_CGradientStop(); + gradientStop.asc_setColor(Common.Utils.ThemeColor.getRgbColor(Common.Utils.ThemeColor.colorValue2EffectId(me.GradColor.colors[index]))); + gradientStop.asc_setPosition(me.GradColor.values[index]/100); + arrGradStop.push(gradientStop); + }); + this.gradient.asc_putGradientStops(arrGradStop); + + this.fill.asc_setGradientFill(this.gradient); + this.api.asc_setCellFill(this.fill); + + this._sliderChanged = false; + } + }, + onPatternSelect: function(combo, record) { if (this.api && !this._noApply) { this.PatternFillType = record.get('type'); @@ -1086,13 +1210,13 @@ define([ textGradientFill: 'Gradient Fill', textPatternFill: 'Pattern', textColor: 'Color Fill', - textStyle: 'Style', textDirection: 'Direction', textLinear: 'Linear', textRadial: 'Radial', textPattern: 'Pattern', textForeground: 'Foreground color', - textBackground: 'Background color' + textBackground: 'Background color', + textGradient: 'Gradient' }, SSE.Views.CellSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettings.js b/apps/spreadsheeteditor/main/app/view/ChartSettings.js index 95f009c4d..18ae392ad 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettings.js @@ -668,47 +668,8 @@ define([ el: $('#id-chart-menu-type'), parentMenu: btn.menu, restoreHeight: 421, - 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, inline: true }, - { id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true }, - { id: 'menu-chart-group-stock', caption: me.textStock, inline: true } - // { id: 'menu-chart-group-surface', caption: me.textSurface} - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal', selected: true}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} - ]), + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()), + store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()), itemTemplate: _.template('
    ') }); }); @@ -742,10 +703,12 @@ define([ this.spnWidth.on('change', _.bind(this.onWidthChange, this)); this.spnHeight.on('change', _.bind(this.onHeightChange, this)); + this.spnWidth.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.spnHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.btnRatio = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'advanced-btn-ratio', + iconCls: 'toolbar__icon advanced-btn-ratio', style: 'margin-bottom: 1px;', enableToggle: true, hint: this.textKeepRatio @@ -781,16 +744,8 @@ define([ parentMenu: btn.menu, restoreHeight: 120, allowScrollbar: false, - groups: new Common.UI.DataViewGroupStore([ - { id: 'menu-chart-group-sparkcolumn', inline: true }, - { id: 'menu-chart-group-sparkline', inline: true }, - { id: 'menu-chart-group-sparkwin', inline: true } - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-sparkcolumn', type: Asc.c_oAscSparklineType.Column, allowSelected: true, iconCls: 'spark-column', tip: me.textColumnSpark}, - { group: 'menu-chart-group-sparkline', type: Asc.c_oAscSparklineType.Line, allowSelected: true, iconCls: 'spark-line', tip: me.textLineSpark}, - { group: 'menu-chart-group-sparkwin', type: Asc.c_oAscSparklineType.Stacked, allowSelected: true, iconCls: 'spark-win', tip: me.textWinLossSpark} - ]), + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getSparkGroupData()), + store: new Common.UI.DataViewStore(Common.define.chartData.getSparkData()), itemTemplate: _.template('
    ') }); }); @@ -895,8 +850,6 @@ define([ props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h)); this.api.asc_setGraphicObjectProps(props); } - - Common.NotificationCenter.trigger('edit:complete', this); }, onHeightChange: function(field, newValue, oldValue, eOpts){ @@ -916,8 +869,6 @@ define([ props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h)); this.api.asc_setGraphicObjectProps(props); } - - Common.NotificationCenter.trigger('edit:complete', this); }, openAdvancedSettings: function() { @@ -1324,22 +1275,12 @@ define([ textHeight: 'Height', textEditData: 'Edit Data and Location', textChartType: 'Change Chart Type', - textLine: 'Line', - textColumn: 'Column', - textBar: 'Bar', - textArea: 'Area', - textPie: 'Pie', - textPoint: 'XY (Scatter)', - textStock: 'Stock', textStyle: 'Style', textAdvanced: 'Show advanced settings', strSparkColor: 'Color', strLineWeight: 'Line Weight', textMarkers: 'Markers', textNewColor: 'Add New Custom Color', - textLineSpark: 'Line', - textColumnSpark: 'Column', - textWinLossSpark: 'Win/Loss', textHighPoint: 'High Point', textLowPoint: 'Low Point', textNegativePoint: 'Negative Point', @@ -1350,8 +1291,7 @@ define([ textType: 'Type', textSelectData: 'Select Data', textRanges: 'Data Range', - textBorderSizeErr: 'The entered value is incorrect.
    Please enter a value between 0 pt and 1584 pt.', - textSurface: 'Surface' + textBorderSizeErr: 'The entered value is incorrect.
    Please enter a value between 0 pt and 1584 pt.' }, SSE.Views.ChartSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js index 859113c94..40c9eff96 100644 --- a/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js +++ b/apps/spreadsheeteditor/main/app/view/ChartSettingsDlg.js @@ -129,47 +129,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' el: $('#id-chart-dlg-menu-type'), parentMenu: btn.menu, restoreHeight: 421, - 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, inline: true }, - { id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true }, - { id: 'menu-chart-group-stock', caption: me.textStock, inline: true } - // { id: 'menu-chart-group-surface', caption: me.textSurface} - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal', selected: true}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} - ]), + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData()), + store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()), itemTemplate: _.template('
    ') }); }); @@ -790,16 +751,8 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' el: $('#id-spark-dlg-menu-type'), parentMenu: btn.menu, restoreHeight: 120, - groups: new Common.UI.DataViewGroupStore([ - { id: 'menu-chart-group-sparkcolumn', inline: true }, - { id: 'menu-chart-group-sparkline', inline: true }, - { id: 'menu-chart-group-sparkwin', inline: true } - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-sparkcolumn', type: Asc.c_oAscSparklineType.Column, allowSelected: true, iconCls: 'spark-column', tip: me.textColumnSpark}, - { group: 'menu-chart-group-sparkline', type: Asc.c_oAscSparklineType.Line, allowSelected: true, iconCls: 'spark-line', tip: me.textLineSpark}, - { group: 'menu-chart-group-sparkwin', type: Asc.c_oAscSparklineType.Stacked, allowSelected: true, iconCls: 'spark-win', tip: me.textWinLossSpark} - ]), + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getSparkGroupData()), + store: new Common.UI.DataViewStore(Common.define.chartData.getSparkData()), itemTemplate: _.template('
    ') }); }); @@ -1680,13 +1633,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' textTitle: 'Chart - Advanced Settings', textShowValues: 'Display chart values', textShowBorders: 'Display chart borders', - textLine: 'Line', - textColumn: 'Column', - textBar: 'Bar', - textArea: 'Area', - textPie: 'Pie', - textPoint: 'XY (Scatter)', - textStock: 'Stock', textDataRows: 'in rows', textDataColumns: 'in columns', textDisplayLegend: 'Display Legend', @@ -1797,9 +1743,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' textGaps: 'Gaps', textZero: 'Zero', textEmptyLine: 'Connect data points with line', - textLineSpark: 'Line', - textColumnSpark: 'Column', - textWinLossSpark: 'Win/Loss', textShowSparkAxis: 'Show Axis', textReverseOrder: 'Reverse order', textAutoEach: 'Auto for Each', @@ -1809,7 +1752,6 @@ define([ 'text!spreadsheeteditor/main/app/template/ChartSettingsDlg.template' textAltTitle: 'Title', textAltDescription: 'Description', textAltTip: 'The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table.', - textSurface: 'Surface', errorMaxPoints: 'ERROR! The maximum number of points in series per chart is 4096.', textSnap: 'Cell Snapping', textAbsolute: 'Don\'t move or size with cells', diff --git a/apps/spreadsheeteditor/main/app/view/DataTab.js b/apps/spreadsheeteditor/main/app/view/DataTab.js index 1c4fce192..5b2f59a8d 100644 --- a/apps/spreadsheeteditor/main/app/view/DataTab.js +++ b/apps/spreadsheeteditor/main/app/view/DataTab.js @@ -66,12 +66,13 @@ define([ me.btnTextToColumns.on('click', function (b, e) { me.fireEvent('data:tocolumns'); }); - me.btnShow.on('click', function (b, e) { - me.fireEvent('data:show'); - }); - me.btnHide.on('click', function (b, e) { - me.fireEvent('data:hide'); - }); + // isn't used for awhile + // me.btnShow.on('click', function (b, e) { + // me.fireEvent('data:show'); + // }); + // me.btnHide.on('click', function (b, e) { + // me.fireEvent('data:hide'); + // }); me.btnsSortDown.forEach(function(button) { button.on('click', function (b, e) { me.fireEvent('data:sort', [Asc.c_oAscSortOptions.Ascending]); @@ -92,6 +93,9 @@ define([ me.fireEvent('data:clearfilter', [Asc.c_oAscSortOptions.Descending]); }); }); + me.btnCustomSort.on('click', function (b, e) { + me.fireEvent('data:sortcustom'); + }); } return { @@ -109,7 +113,7 @@ define([ this.btnGroup = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-cell-group', + iconCls: 'toolbar__icon btn-cell-group', caption: this.capBtnGroup, split: true, menu: true, @@ -121,7 +125,7 @@ define([ this.btnUngroup = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-cell-ungroup', + iconCls: 'toolbar__icon btn-cell-ungroup', caption: this.capBtnUngroup, split: true, menu: true, @@ -133,7 +137,7 @@ define([ this.btnTextToColumns = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-to-columns', + iconCls: 'toolbar__icon btn-to-columns', caption: this.capBtnTextToCol, split: false, disabled: true, @@ -142,37 +146,47 @@ define([ Common.Utils.injectComponent($host.find('#slot-btn-text-column'), this.btnTextToColumns); this.lockedControls.push(this.btnTextToColumns); - this.btnShow = new Common.UI.Button({ - cls : 'btn-toolbar', - iconCls : 'btn-show-details', - style: 'padding-right: 2px;', - caption: this.capBtnTextShow, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth] + // this.btnShow = new Common.UI.Button({ + // cls : 'btn-toolbar', + // iconCls : 'btn-show-details', + // style: 'padding-right: 2px;', + // caption: this.capBtnTextShow, + // lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth] + // }); + // Common.Utils.injectComponent($host.find('#slot-btn-show-details'), this.btnShow); + // this.lockedControls.push(this.btnShow); + + // this.btnHide = new Common.UI.Button({ + // cls : 'btn-toolbar', + // iconCls : 'btn-hide-details', + // style: 'padding-right: 2px;', + // caption: this.capBtnTextHide, + // lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth] + // }); + // Common.Utils.injectComponent($host.find('#slot-btn-hide-details'), this.btnHide); + // this.lockedControls.push(this.btnHide); + + this.btnCustomSort = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-custom-sort', + caption: this.capBtnTextCustomSort, + disabled: true, + lock: [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter, _set.sheetLock] }); - Common.Utils.injectComponent($host.find('#slot-btn-show-details'), this.btnShow); - this.lockedControls.push(this.btnShow); + Common.Utils.injectComponent($host.find('#slot-btn-custom-sort'), this.btnCustomSort); + this.lockedControls.push(this.btnCustomSort); - this.btnHide = new Common.UI.Button({ - cls : 'btn-toolbar', - iconCls : 'btn-hide-details', - style: 'padding-right: 2px;', - caption: this.capBtnTextHide, - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth] - }); - Common.Utils.injectComponent($host.find('#slot-btn-hide-details'), this.btnHide); - this.lockedControls.push(this.btnHide); + this.btnsSortDown = Common.Utils.injectButtons($host.find('.slot-sortdesc'), '', 'toolbar__icon btn-sort-down', '', + [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter, _set.sheetLock]); - this.btnsSortDown = Common.Utils.injectButtons($host.find('.slot-sortdesc'), '', 'btn-sort-down', '', - [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter]); + this.btnsSortUp = Common.Utils.injectButtons($host.find('.slot-sortasc'), '', 'toolbar__icon btn-sort-up', '', + [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter, _set.sheetLock]); - this.btnsSortUp = Common.Utils.injectButtons($host.find('.slot-sortasc'), '', 'btn-sort-up', '', - [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter]); - - this.btnsSetAutofilter = Common.Utils.injectButtons($host.find('.slot-btn-setfilter'), '', 'btn-autofilter', '', + this.btnsSetAutofilter = Common.Utils.injectButtons($host.find('.slot-btn-setfilter'), '', 'toolbar__icon btn-autofilter', '', [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot, _set.cantModifyFilter], false, false, true); - this.btnsClearAutofilter = Common.Utils.injectButtons($host.find('.slot-btn-clear-filter'), '', 'btn-clear-filter', '', + this.btnsClearAutofilter = Common.Utils.injectButtons($host.find('.slot-btn-clear-filter'), '', 'toolbar__icon btn-clear-filter', '', [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot]); Array.prototype.push.apply(this.lockedControls, this.btnsSortDown.concat(this.btnsSortUp, this.btnsSetAutofilter,this.btnsClearAutofilter)); @@ -225,6 +239,7 @@ define([ me.btnsClearAutofilter.forEach( function(btn) { btn.updateHint(me.toolbar.txtClearFilter); }); + me.btnCustomSort.updateHint(me.tipCustomSort); setEvents.call(me); }); @@ -240,6 +255,8 @@ define([ return this.btnsSortDown; else if (type == 'sort-up') return this.btnsSortUp; + else if (type == 'sort-custom') + return this.btnCustomSort; else if (type == 'set-filter') return this.btnsSetAutofilter; else if (type == 'clear-filter') @@ -271,7 +288,9 @@ define([ capBtnTextShow: 'Show details', capBtnTextHide: 'Hide details', textBelow: 'Summary rows below detail', - textRightOf: 'Summary columns to right of detail' + textRightOf: 'Summary columns to right of detail', + capBtnTextCustomSort: 'Custom Sort', + tipCustomSort: 'Custom sort' } }()), SSE.Views.DataTab || {})); }); diff --git a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js index 5613d6d40..2e504244a 100644 --- a/apps/spreadsheeteditor/main/app/view/DocumentHolder.js +++ b/apps/spreadsheeteditor/main/app/view/DocumentHolder.js @@ -543,14 +543,14 @@ define([ me.mnuGroupImg = new Common.UI.MenuItem({ caption : this.txtGroup, - iconCls : 'mnu-group', + iconCls : 'menu__icon shape-group', type : 'group', value : 'grouping' }); me.mnuUnGroupImg = new Common.UI.MenuItem({ caption : this.txtUngroup, - iconCls : 'mnu-ungroup', + iconCls : 'menu__icon shape-ungroup', type : 'group', value : 'ungrouping' }); @@ -630,25 +630,25 @@ define([ me.mnuBringToFront = new Common.UI.MenuItem({ caption : this.textArrangeFront, - iconCls : 'mnu-arrange-front', + iconCls : 'menu__icon arrange-front', type : 'arrange', value : Asc.c_oAscDrawingLayerType.BringToFront }); me.mnuSendToBack = new Common.UI.MenuItem({ caption : this.textArrangeBack, - iconCls : 'mnu-arrange-back', + iconCls : 'menu__icon arrange-back', type : 'arrange', value : Asc.c_oAscDrawingLayerType.SendToBack }); me.mnuBringForward = new Common.UI.MenuItem({ caption : this.textArrangeForward, - iconCls : 'mnu-arrange-forward', + iconCls : 'menu__icon arrange-forward', type : 'arrange', value : Asc.c_oAscDrawingLayerType.BringForward }); me.mnuSendBackward = new Common.UI.MenuItem({ caption: this.textArrangeBackward, - iconCls : 'mnu-arrange-backward', + iconCls : 'menu__icon arrange-backward', type : 'arrange', value : Asc.c_oAscDrawingLayerType.SendBackward }); @@ -675,38 +675,38 @@ define([ menuAlign: 'tl-tr', items: [{ caption : me.textShapeAlignLeft, - iconCls : 'mnu-img-align-left', + iconCls : 'menu__icon shape-align-left', value : 0 }, { caption : me.textShapeAlignCenter, - iconCls : 'mnu-img-align-center', + iconCls : 'menu__icon shape-align-center', value : 4 }, { caption : me.textShapeAlignRight, - iconCls : 'mnu-img-align-right', + iconCls : 'menu__icon shape-align-right', value : 1 }, { caption : me.textShapeAlignTop, - iconCls : 'mnu-img-align-top', + iconCls : 'menu__icon shape-align-top', value : 3 }, { caption : me.textShapeAlignMiddle, - iconCls : 'mnu-img-align-middle', + iconCls : 'menu__icon shape-align-middle', value : 5 }, { caption : me.textShapeAlignBottom, - iconCls : 'mnu-img-align-bottom', + iconCls : 'menu__icon shape-align-bottom', value : 2 }, {caption: '--'}, { caption: me.txtDistribHor, - iconCls: 'mnu-distrib-hor', + iconCls: 'menu__icon shape-distribute-hor', value: 6 }, { caption: me.txtDistribVert, - iconCls: 'mnu-distrib-vert', + iconCls: 'menu__icon shape-distribute-vert', value: 7 }] }) @@ -798,24 +798,27 @@ define([ items : [ me.menuParagraphDirectH = new Common.UI.MenuItem({ caption : me.directHText, - iconCls : 'mnu-direct-horiz', + iconCls : 'menu__icon text-orient-hor', checkable : true, + checkmark : false, checked : false, toggleGroup : 'popupparagraphdirect', direction : Asc.c_oAscVertDrawingText.normal }), me.menuParagraphDirect90 = new Common.UI.MenuItem({ caption : me.direct90Text, - iconCls : 'mnu-direct-rdown', + iconCls : 'menu__icon text-orient-rdown', checkable : true, + checkmark : false, checked : false, toggleGroup : 'popupparagraphdirect', direction : Asc.c_oAscVertDrawingText.vert }), me.menuParagraphDirect270 = new Common.UI.MenuItem({ caption : me.direct270Text, - iconCls : 'mnu-direct-rup', + iconCls : 'menu__icon text-orient-rup', checkable : true, + checkmark : false, checked : false, toggleGroup : 'popupparagraphdirect', direction : Asc.c_oAscVertDrawingText.vert270 @@ -836,6 +839,10 @@ define([ checkable : true, checked : false, value : -1 + }), + me.mnuListSettings = new Common.UI.MenuItem({ + caption: me.textListSettings, + value: 'settings' }) ] }) @@ -1057,7 +1064,7 @@ define([ strDetails: 'Signature Details', strSetup: 'Signature Setup', strDelete: 'Remove Signature', - originalSizeText: 'Default Size', + originalSizeText: 'Actual Size', textReplace: 'Replace image', textFromUrl: 'From URL', textFromFile: 'From File', @@ -1090,7 +1097,8 @@ define([ textAlign: 'Align', textCrop: 'Crop', textCropFill: 'Fill', - textCropFit: 'Fit' + textCropFit: 'Fit', + textListSettings: 'List Settings' }, SSE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index a8ccbbf59..dad0f7a27 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -256,7 +256,8 @@ define([ if (!this.mode) return; this.miDownload[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline))?'show':'hide'](); - this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) ?'show':'hide'](); + var isBCSupport = window["AscDesktopEditor"] ? window["AscDesktopEditor"]["isBlockchainSupport"]() : false; + this.miSaveCopyAs[(this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) && (this.mode.canRequestSaveAs || this.mode.saveAsUrl) && !isBCSupport ?'show':'hide'](); this.miSaveAs[(this.mode.canDownload && this.mode.isDesktopApp && this.mode.isOffline)?'show':'hide'](); this.miSave[this.mode.isEdit?'show':'hide'](); this.miEdit[!this.mode.isEdit && this.mode.canEdit && this.mode.canRequestEditRights ?'show':'hide'](); @@ -271,7 +272,7 @@ define([ this.miNew.$el.find('+.devider')[this.mode.canCreateNew?'show':'hide'](); this.miAccess[(!this.mode.isOffline && this.document&&this.document.info&&(this.document.info.sharingSettings&&this.document.info.sharingSettings.length>0 || - this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length))?'show':'hide'](); + (this.mode.sharingSettingsUrl&&this.mode.sharingSettingsUrl.length || this.mode.canRequestSharingSettings)))?'show':'hide'](); this.mode.canBack ? this.$el.find('#fm-btn-back').show().prev().show() : this.$el.find('#fm-btn-back').hide().prev().hide(); diff --git a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js index 585efc5fd..07218e341 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenuPanels.js @@ -171,6 +171,7 @@ define([ '
    ', '
    ', '
    ', + '
    ', '
    ', '
    ' ].join('')), @@ -192,11 +193,15 @@ define([ this.printSettings.menu = this.menu; this.printSettings.render($markup.findById('#panel-settings-print')); + this.spellcheckSettings = new SSE.Views.FileMenuPanels.MainSpellCheckSettings({menu: this.menu}); + this.spellcheckSettings.render($markup.findById('#panel-settings-spellcheck')); + this.viewSettingsPicker = new Common.UI.DataView({ el: $markup.findById('#id-settings-menu'), store: new Common.UI.DataViewStore([ - {name: this.txtGeneral, panel: this.generalSettings, iconCls:'mnu-settings-general', selected: true}, - {name: this.txtPageSettings, panel: this.printSettings, iconCls:'mnu-print'} + {name: this.txtGeneral, panel: this.generalSettings, iconCls:'toolbar__icon btn-settings', selected: true}, + {name: this.txtPageSettings, panel: this.printSettings, iconCls:'toolbar__icon btn-print'}, + {name: this.txtSpellChecking, panel: this.spellcheckSettings, iconCls:'toolbar__icon btn-ic-docspell'} ]), itemTemplate: _.template([ '
    ', @@ -227,6 +232,10 @@ define([ if (!this.mode.canPrint) this.viewSettingsPicker.store.pop(); this.generalSettings && this.generalSettings.setMode(this.mode); + this.spellcheckSettings && this.spellcheckSettings.setMode(this.mode); + if (!this.mode.isEdit) { + $(this.viewSettingsPicker.dataViewItems[2].el).hide(); + } }, setApi: function(api) { @@ -234,7 +243,8 @@ define([ }, txtGeneral: 'General', - txtPageSettings: 'Page Settings' + txtPageSettings: 'Page Settings', + txtSpellChecking: 'Spell checking' }, SSE.Views.FileMenuPanels.Settings || {})); SSE.Views.MainSettingsPrint = Common.UI.BaseView.extend(_.extend({ @@ -350,6 +360,14 @@ define([ ] }); + var itemsTemplate = + _.template([ + '<% _.each(items, function(item) { %>', + '
  • style="border-top: 1px solid #e5e5e5;margin-top: 5px;" <% } %> >', + '<%= scope.getDisplayValue(item) %>', + '
  • ', + '<% }); %>' + ].join('')); this.cmbLayout = new Common.UI.ComboBox({ el : $markup.findById('#advsettings-print-combo-layout'), style : 'width: 242px;', @@ -361,8 +379,9 @@ define([ { value: 1, displayValue: this.textFitPage }, { value: 2, displayValue: this.textFitCols }, { value: 3, displayValue: this.textFitRows }, - { value: 4, displayValue: this.textCustomOptions} - ] + { value: 'customoptions', displayValue: this.textCustomOptions } + ], + itemsTemplate: itemsTemplate }); this.chPrintGrid = new Common.UI.CheckBox({ @@ -438,6 +457,27 @@ define([ return this; }, + addCustomScale: function (add) { + if (add) { + this.cmbLayout.setData([ + { value: 0, displayValue: this.textActualSize }, + { value: 1, displayValue: this.textFitPage }, + { value: 2, displayValue: this.textFitCols }, + { value: 3, displayValue: this.textFitRows }, + { value: 4, displayValue: this.textCustom }, + { value: 'customoptions', displayValue: this.textCustomOptions } + ]); + } else { + this.cmbLayout.setData([ + { value: 0, displayValue: this.textActualSize }, + { value: 1, displayValue: this.textFitPage }, + { value: 2, displayValue: this.textFitCols }, + { value: 3, displayValue: this.textFitRows }, + { value: 'customoptions', displayValue: this.textCustomOptions } + ]); + } + }, + updateMetricUnit: function() { if (this.spinners) { for (var i=0; i', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '','', + '', + '', + '', + '', + '' + ].join('')), + + initialize: function(options) { + Common.UI.BaseView.prototype.initialize.call(this,arguments); + + this.menu = options.menu; + }, + + render: function(node) { + var me = this; + var $markup = $(this.template({scope: this})); + + this.chIgnoreUppercase = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-ignore-uppercase-words'), + labelText: this.strIgnoreWordsInUPPERCASE + }); + + this.chIgnoreNumbers = new Common.UI.CheckBox({ + el: $markup.findById('#fms-chb-ignore-numbers-words'), + labelText: this.strIgnoreWordsWithNumbers + }); + + this.cmbDictionaryLanguage = new Common.UI.ComboBox({ + el: $markup.findById('#fms-cmb-dictionary-language'), + cls: 'input-group-nr', + style: 'width: 267px;', + editable: false, + menuStyle: 'min-width: 267px; max-height: 209px;' + }); + + this.btnApply = new Common.UI.Button({ + el: $markup.findById('#fms-spellcheck-btn-apply') + }); + + this.btnApply.on('click', _.bind(this.applySettings, this)); + + this.$el = $(node).html($markup); + + 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) { + this.mode = mode; + }, + + setApi: function(api) { + this.api = api; + }, + + updateSettings: function() { + var arrLang = SSE.getController('Spellcheck').loadLanguages(), + allLangs = arrLang[0], + langs = arrLang[1], + change = arrLang[2]; + var sessionValue = Common.Utils.InternalSettings.get("sse-spellcheck-locale"), + value; + if (sessionValue) + value = parseInt(sessionValue); + else + value = this.mode.lang ? parseInt(Common.util.LanguageInfo.getLocalLanguageCode(this.mode.lang)) : 0x0409; + if (langs && langs.length > 0) { + if (this.cmbDictionaryLanguage.store.length === 0 || change) { + this.cmbDictionaryLanguage.setData(langs); + } + var item = this.cmbDictionaryLanguage.store.findWhere({value: value}); + if (!item && allLangs[value]) { + value = allLangs[value][0].split(/[\-\_]/)[0]; + item = this.cmbDictionaryLanguage.store.find(function(model){ + return model.get('shortName').indexOf(value)==0; + }); + } + this.cmbDictionaryLanguage.setValue(item ? item.get('value') : langs[0].value); + value = this.cmbDictionaryLanguage.getValue(); + if (value !== parseInt(sessionValue)) { + Common.Utils.InternalSettings.set("sse-spellcheck-locale", value); + } + } else { + this.cmbDictionaryLanguage.setValue(Common.util.LanguageInfo.getLocalLanguageName(value)[1]); + this.cmbDictionaryLanguage.setDisabled(true); + } + + this.chIgnoreUppercase.setValue(Common.Utils.InternalSettings.get("sse-spellcheck-ignore-uppercase-words")); + this.chIgnoreNumbers.setValue(Common.Utils.InternalSettings.get("sse-spellcheck-ignore-numbers-words")); + }, + + applySettings: function() { + var value = this.chIgnoreUppercase.isChecked(); + Common.localStorage.setBool("sse-spellcheck-ignore-uppercase-words", value); + Common.Utils.InternalSettings.set("sse-spellcheck-ignore-uppercase-words", value); + value = this.chIgnoreNumbers.isChecked(); + Common.localStorage.setBool("sse-spellcheck-ignore-numbers-words", value); + Common.Utils.InternalSettings.set("sse-spellcheck-ignore-numbers-words", value); + + if (!this.cmbDictionaryLanguage.isDisabled()) { + value = this.cmbDictionaryLanguage.getValue(); + Common.localStorage.setItem("sse-spellcheck-locale", value); + Common.Utils.InternalSettings.set("sse-spellcheck-locale", value); + } + + Common.localStorage.save(); + if (this.menu) { + this.menu.fireEvent('spellcheck:apply', [this.menu]); + } + }, + + strIgnoreWordsInUPPERCASE: 'Ignore words in UPPERCASE', + strIgnoreWordsWithNumbers: 'Ignore words with numbers', + strDictionaryLanguage: 'Dictionary language', + okButtonText: 'Apply' + + }, SSE.Views.FileMenuPanels.MainSpellCheckSettings || {})); + SSE.Views.FileMenuPanels.RecentFiles = Common.UI.BaseView.extend({ el: '#panel-recentfiles', menu: undefined, @@ -1211,7 +1400,7 @@ define([ }).on('keydown:before', keyDownBefore); this.btnApply = new Common.UI.Button({ - el: '#fminfo-btn-apply' + el: $markup.findById('#fminfo-btn-apply') }); this.btnApply.on('click', _.bind(this.applySettings, this)); @@ -1331,6 +1520,7 @@ define([ me.authors.push(item); }); this.tblAuthor.find('.close').toggleClass('hidden', !this.mode.isEdit); + !this.mode.isEdit && this._ShowHideInfoItem(this.tblAuthor, !!this.authors.length); } this.SetDisabled(); }, @@ -1351,6 +1541,12 @@ define([ this.inputAuthor.setVisible(mode.isEdit); this.btnApply.setVisible(mode.isEdit); this.tblAuthor.find('.close').toggleClass('hidden', !mode.isEdit); + if (!mode.isEdit) { + this.inputTitle._input.attr('placeholder', ''); + this.inputSubject._input.attr('placeholder', ''); + this.inputComment._input.attr('placeholder', ''); + this.inputAuthor._input.attr('placeholder', ''); + } this.SetDisabled(); return this; }, @@ -1461,7 +1657,7 @@ define([ }); } - Common.NotificationCenter.on('collaboration:sharing', this.changeAccessRights.bind(this)); + Common.NotificationCenter.on('collaboration:sharingupdate', this.updateSharingSettings.bind(this)); Common.NotificationCenter.on('collaboration:sharingdeny', this.onLostEditRights.bind(this)); return this; @@ -1485,7 +1681,7 @@ define([ if (doc.info.sharingSettings) this.cntRights.html(this.templateRights({users: doc.info.sharingSettings})); this._ShowHideInfoItem('rights', doc.info.sharingSettings!==undefined && doc.info.sharingSettings!==null && doc.info.sharingSettings.length>0); - this._ShowHideInfoItem('edit-rights', !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && this._readonlyRights!==true); + this._ShowHideInfoItem('edit-rights', (!!this.sharingSettingsUrl && this.sharingSettingsUrl.length || this.mode.canRequestSharingSettings) && this._readonlyRights!==true); } else this._ShowHideDocInfo(false); }, @@ -1500,37 +1696,18 @@ define([ }, setMode: function(mode) { + this.mode = mode; this.sharingSettingsUrl = mode.sharingSettingsUrl; - !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('showsharingsettings', _.bind(this.changeAccessRights, this)); - !!this.sharingSettingsUrl && this.sharingSettingsUrl.length && Common.Gateway.on('setsharingsettings', _.bind(this.setSharingSettings, this)); return this; }, changeAccessRights: function(btn,event,opts) { - if (this._docAccessDlg || this._readonlyRights) return; - - var me = this; - me._docAccessDlg = new Common.Views.DocumentAccessDialog({ - settingsurl: this.sharingSettingsUrl - }); - me._docAccessDlg.on('accessrights', function(obj, rights){ - me.updateSharingSettings(rights); - }).on('close', function(obj){ - me._docAccessDlg = undefined; - }); - - me._docAccessDlg.show(); - }, - - setSharingSettings: function(data) { - data && this.updateSharingSettings(data.sharingSettings); + Common.NotificationCenter.trigger('collaboration:sharing'); }, updateSharingSettings: function(rights) { - this.doc.info.sharingSettings = rights; this._ShowHideInfoItem('rights', this.doc.info.sharingSettings!==undefined && this.doc.info.sharingSettings!==null && this.doc.info.sharingSettings.length>0); this.cntRights.html(this.templateRights({users: this.doc.info.sharingSettings})); - Common.NotificationCenter.trigger('mentions:clearusers', this); }, onLostEditRights: function() { diff --git a/apps/spreadsheeteditor/main/app/view/FormulaTab.js b/apps/spreadsheeteditor/main/app/view/FormulaTab.js index 158d3c125..97a14d3a1 100644 --- a/apps/spreadsheeteditor/main/app/view/FormulaTab.js +++ b/apps/spreadsheeteditor/main/app/view/FormulaTab.js @@ -82,7 +82,7 @@ define([ this.btnFinancial = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-finance', + iconCls: 'toolbar__icon btn-finance', caption: formulaDialog.sCategoryFinancial, hint: formulaDialog.sCategoryFinancial, menu: true, @@ -95,7 +95,7 @@ define([ this.btnLogical = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-logic', + iconCls: 'toolbar__icon btn-logic', caption: formulaDialog.sCategoryLogical, hint: formulaDialog.sCategoryLogical, menu: true, @@ -108,7 +108,7 @@ define([ this.btnTextData = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-func-text', + iconCls: 'toolbar__icon btn-func-text', caption: formulaDialog.sCategoryTextAndData, hint: formulaDialog.sCategoryTextAndData, menu: true, @@ -121,7 +121,7 @@ define([ this.btnDateTime = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-datetime', + iconCls: 'toolbar__icon btn-datetime', caption: formulaDialog.sCategoryDateAndTime, hint: formulaDialog.sCategoryDateAndTime, menu: true, @@ -134,7 +134,7 @@ define([ this.btnReference = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-lookup', + iconCls: 'toolbar__icon btn-lookup', caption: formulaDialog.sCategoryLookupAndReference, hint: formulaDialog.sCategoryLookupAndReference, menu: true, @@ -147,7 +147,7 @@ define([ this.btnMath = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-func-math', + iconCls: 'toolbar__icon btn-func-math', caption: formulaDialog.sCategoryMathematic, hint: formulaDialog.sCategoryMathematic, menu: true, @@ -160,7 +160,7 @@ define([ this.btnRecent = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-recent', + iconCls: 'toolbar__icon btn-recent', caption: this.txtRecent, hint: this.txtRecent, menu: true, @@ -173,7 +173,7 @@ define([ this.btnAutosum = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-autosum', + iconCls: 'toolbar__icon btn-autosum', caption: this.txtAutosum, hint: this.txtAutosumTip, split: true, @@ -198,7 +198,7 @@ define([ this.btnFormula = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-ins-formula', + iconCls: 'toolbar__icon btn-ins-formula', caption: this.txtFormula, hint: this.txtFormulaTip, disabled: true, @@ -209,7 +209,7 @@ define([ this.btnMore = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-more', + iconCls: 'toolbar__icon btn-more', caption: this.txtMore, hint: this.txtMore, menu: true, @@ -222,7 +222,7 @@ define([ this.btnCalculate = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-calculation', + iconCls: 'toolbar__icon btn-calculation', caption: this.txtCalculation, split: true, menu: true, diff --git a/apps/spreadsheeteditor/main/app/view/HeaderFooterDialog.js b/apps/spreadsheeteditor/main/app/view/HeaderFooterDialog.js index c67f149ac..f40160581 100644 --- a/apps/spreadsheeteditor/main/app/view/HeaderFooterDialog.js +++ b/apps/spreadsheeteditor/main/app/view/HeaderFooterDialog.js @@ -167,6 +167,22 @@ define([ render: function() { Common.UI.Window.prototype.render.call(this); + this.menuAddAlign = function(menuRoot, left, top) { + var self = this; + if (!$window.hasClass('notransform')) { + $window.addClass('notransform'); + menuRoot.addClass('hidden'); + setTimeout(function() { + menuRoot.removeClass('hidden'); + menuRoot.css({left: left, top: top}); + self.options.additionalAlign = null; + }, 300); + } else { + menuRoot.css({left: left, top: top}); + self.options.additionalAlign = null; + } + }; + var me = this, $window = this.getChild(); @@ -305,6 +321,7 @@ define([ menu: new Common.UI.Menu({ style: 'min-width: 110px;', maxHeight: 200, + additionalAlign: this.menuAddAlign, items: data }) }); @@ -319,6 +336,7 @@ define([ menu: new Common.UI.Menu({ style: 'min-width: 110px;', maxHeight: 200, + additionalAlign: this.menuAddAlign, items: data }) }); @@ -409,7 +427,7 @@ define([ this.btnBold = []; this.btnBold.push(new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-bold', + iconCls: 'toolbar__icon btn-bold', enableToggle: true, hint: this.textBold })); @@ -419,7 +437,7 @@ define([ this.btnBold.push(new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-bold', + iconCls: 'toolbar__icon btn-bold', enableToggle: true, hint: this.textBold })); @@ -430,7 +448,7 @@ define([ this.btnItalic = []; this.btnItalic.push(new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-italic', + iconCls: 'toolbar__icon btn-italic', enableToggle: true, hint: this.textItalic })); @@ -440,7 +458,7 @@ define([ this.btnItalic.push(new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-italic', + iconCls: 'toolbar__icon btn-italic', enableToggle: true, hint: this.textItalic })); @@ -451,7 +469,7 @@ define([ this.btnUnderline = []; this.btnUnderline.push(new Common.UI.Button({ cls : 'btn-toolbar', - iconCls : 'btn-underline', + iconCls : 'toolbar__icon btn-underline', enableToggle: true, hint: this.textUnderline })); @@ -461,7 +479,7 @@ define([ this.btnUnderline.push(new Common.UI.Button({ cls : 'btn-toolbar', - iconCls : 'btn-underline', + iconCls : 'toolbar__icon btn-underline', enableToggle: true, hint: this.textUnderline })); @@ -472,7 +490,7 @@ define([ this.btnStrikeout = []; this.btnStrikeout.push(new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-strikeout', + iconCls: 'toolbar__icon btn-strikeout', enableToggle: true, hint: this.textStrikeout })); @@ -482,7 +500,7 @@ define([ this.btnStrikeout.push(new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-strikeout', + iconCls: 'toolbar__icon btn-strikeout', enableToggle: true, hint: this.textStrikeout })); @@ -493,7 +511,7 @@ define([ this.btnSuperscript = []; this.btnSuperscript.push(new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-superscript', + iconCls: 'toolbar__icon btn-superscript', enableToggle: true, toggleGroup: 'superscriptHFGroup', hint: this.textSuperscript @@ -504,7 +522,7 @@ define([ this.btnSuperscript.push(new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-superscript', + iconCls: 'toolbar__icon btn-superscript', enableToggle: true, toggleGroup: 'superscriptHFGroup', hint: this.textSuperscript @@ -516,7 +534,7 @@ define([ this.btnSubscript = []; this.btnSubscript.push(new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-subscript', + iconCls: 'toolbar__icon btn-subscript', enableToggle: true, toggleGroup: 'superscriptHFGroup', hint: this.textSubscript @@ -527,7 +545,7 @@ define([ this.btnSubscript.push(new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'btn-subscript', + iconCls: 'toolbar__icon btn-subscript', enableToggle: true, toggleGroup: 'superscriptHFGroup', hint: this.textSubscript @@ -556,10 +574,11 @@ define([ this.btnTextColor = []; this.btnTextColor.push(new Common.UI.Button({ cls : 'btn-toolbar', - iconCls : 'btn-fontcolor', + iconCls : 'toolbar__icon btn-fontcolor', hint : this.textColor, split : true, menu : new Common.UI.Menu({ + additionalAlign: this.menuAddAlign, items: [ { template: _.template('
    ') }, { template: _.template('' + this.textNewColor + '') } @@ -574,10 +593,11 @@ define([ this.btnTextColor.push(new Common.UI.Button({ cls : 'btn-toolbar', - iconCls : 'btn-fontcolor', + iconCls : 'toolbar__icon btn-fontcolor', hint : this.textColor, split : true, menu : new Common.UI.Menu({ + additionalAlign: this.menuAddAlign, items: [ { template: _.template('
    ') }, { template: _.template('' + this.textNewColor + '') } @@ -666,12 +686,14 @@ define([ this.btnPresetsH.setMenu(new Common.UI.Menu({ style: 'min-width: 110px;', maxHeight: 200, + additionalAlign: this.menuAddAlign, items: presets })); this.btnPresetsH.menu.on('item:click', _.bind(this.onPresetSelect, this, false)); this.btnPresetsF.setMenu(new Common.UI.Menu({ style: 'min-width: 110px;', maxHeight: 200, + additionalAlign: this.menuAddAlign, items: presets })); this.btnPresetsF.menu.on('item:click', _.bind(this.onPresetSelect, this, true)); diff --git a/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js index bfe086a30..7e8b4b140 100644 --- a/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js @@ -54,8 +54,7 @@ define([ width : 350, style : 'min-width: 230px;', cls : 'modal-dlg', - buttons: ['ok', 'cancel'], - footerCls: 'right' + buttons: ['ok', 'cancel'] }, initialize : function(options) { @@ -152,6 +151,7 @@ define([ style : 'width: 100%;', validateOnChange: true, validateOnBlur: false, + value: Common.Utils.InternalSettings.get("sse-settings-r1c1") ? 'R1C1' : 'A1', validation : function(value) { var isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.FormatTable, value, false); if (isvalid == Asc.c_oAscError.ID.No) { diff --git a/apps/spreadsheeteditor/main/app/view/ImageSettings.js b/apps/spreadsheeteditor/main/app/view/ImageSettings.js index 8f251fb6d..e0d6d93fb 100644 --- a/apps/spreadsheeteditor/main/app/view/ImageSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ImageSettings.js @@ -142,7 +142,7 @@ define([ this.btnRatio = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'advanced-btn-ratio', + iconCls: 'toolbar__icon advanced-btn-ratio', style: 'margin-bottom: 1px;', enableToggle: true, hint: this.textKeepRatio @@ -183,6 +183,8 @@ define([ this.spnWidth.on('change', _.bind(this.onWidthChange, this)); this.spnHeight.on('change', _.bind(this.onHeightChange, this)); + this.spnWidth.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.spnHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.btnOriginalSize.on('click', _.bind(this.setOriginalSize, this)); this.btnInsertFromFile.on('click', _.bind(function(btn){ if (this._isFromFile) return; @@ -199,6 +201,7 @@ define([ this.lblReplace = $('#image-lbl-replace'); + var w = this.btnOriginalSize.cmpEl.outerWidth(); this.btnCrop = new Common.UI.Button({ cls: 'btn-text-split-default', caption: this.textCrop, @@ -206,9 +209,9 @@ define([ enableToggle: true, allowDepress: true, pressed: this._state.cropMode, - width: 100, + width: w, menu : new Common.UI.Menu({ - style : 'min-width: 100px;', + style : 'min-width:' + w + 'px;', items: [ { caption: this.textCrop, @@ -234,7 +237,7 @@ define([ this.btnRotate270 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-270', + iconCls: 'toolbar__icon btn-rotate-270', value: 0, hint: this.textHint270 }); @@ -244,7 +247,7 @@ define([ this.btnRotate90 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-90', + iconCls: 'toolbar__icon btn-rotate-90', value: 1, hint: this.textHint90 }); @@ -254,7 +257,7 @@ define([ this.btnFlipV = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-vert', + iconCls: 'toolbar__icon btn-flip-vert', value: 0, hint: this.textHintFlipV }); @@ -264,7 +267,7 @@ define([ this.btnFlipH = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-hor', + iconCls: 'toolbar__icon btn-flip-hor', value: 1, hint: this.textHintFlipH }); @@ -391,7 +394,6 @@ define([ props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h)); this.api.asc_setGraphicObjectProps(props); } - Common.NotificationCenter.trigger('edit:complete', this); }, onHeightChange: function(field, newValue, oldValue, eOpts){ @@ -411,7 +413,6 @@ define([ props.asc_putHeight(Common.Utils.Metric.fnRecalcToMM(h)); this.api.asc_setGraphicObjectProps(props); } - Common.NotificationCenter.trigger('edit:complete', this); }, setOriginalSize: function() { @@ -514,7 +515,7 @@ define([ textSize: 'Size', textWidth: 'Width', textHeight: 'Height', - textOriginalSize: 'Default Size', + textOriginalSize: 'Actual Size', textInsert: 'Replace Image', textFromUrl: 'From URL', textFromFile: 'From File', diff --git a/apps/spreadsheeteditor/main/app/view/NamedRangeEditDlg.js b/apps/spreadsheeteditor/main/app/view/NamedRangeEditDlg.js index 88adbf56d..075399812 100644 --- a/apps/spreadsheeteditor/main/app/view/NamedRangeEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/NamedRangeEditDlg.js @@ -142,6 +142,10 @@ define([ } } }); + this.inputName._input.on('input', function (input, value) { + me.isInputFirstChange && me.inputName.showError(); + me.isInputFirstChange = false; + }); this.cmbScope = new Common.UI.ComboBox({ el : $('#named-range-combo-scope'), @@ -272,6 +276,7 @@ define([ checkrange = this.txtDataRange.checkValidate(); if (checkname !== true) { this.inputName.cmpEl.find('input').focus(); + this.isInputFirstChange = true; return; } if (checkrange !== true) { diff --git a/apps/spreadsheeteditor/main/app/view/ParagraphSettings.js b/apps/spreadsheeteditor/main/app/view/ParagraphSettings.js index 8dd4adc6c..2faa1701f 100644 --- a/apps/spreadsheeteditor/main/app/view/ParagraphSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ParagraphSettings.js @@ -107,8 +107,6 @@ define([ return; if (this.api) this.api.asc_putPrLineSpacing(this.cmbLineRule.getValue(), (this.cmbLineRule.getValue()==c_paragraphLinerule.LINERULE_AUTO) ? field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); - - Common.NotificationCenter.trigger('edit:complete', this); }, onNumSpacingBeforeChange: function(field, newValue, oldValue, eOpts){ @@ -119,8 +117,6 @@ define([ else this.api.asc_putLineSpacingBeforeAfter(0, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } - - Common.NotificationCenter.trigger('edit:complete', this); }, onNumSpacingAfterChange: function(field, newValue, oldValue, eOpts){ @@ -131,8 +127,6 @@ define([ else this.api.asc_putLineSpacingBeforeAfter(1, Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); } - - Common.NotificationCenter.trigger('edit:complete', this); }, onLineRuleSelect: function(combo, record) { @@ -317,6 +311,9 @@ define([ this.numLineHeight.on('change', _.bind(this.onNumLineHeightChange, this)); this.numSpacingBefore.on('change', _.bind(this.onNumSpacingBeforeChange, this)); this.numSpacingAfter.on('change', _.bind(this.onNumSpacingAfterChange, this)); + this.numLineHeight.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.numSpacingBefore.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); + this.numSpacingAfter.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.cmbLineRule.on('selected', _.bind(this.onLineRuleSelect, this)); this.cmbLineRule.on('hide:after', _.bind(this.onHideMenus, this)); $(this.el).on('click', '#paragraph-advanced-link', _.bind(this.openAdvancedSettings, this)); diff --git a/apps/spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced.js index a422a6bad..ca324c36e 100644 --- a/apps/spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/ParagraphSettingsAdvanced.js @@ -104,9 +104,9 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced. ]; this._arrTabAlign = [ - { value: 1, displayValue: this.textTabLeft }, - { value: 3, displayValue: this.textTabCenter }, - { value: 2, displayValue: this.textTabRight } + { value: Asc.c_oAscTabType.Left, displayValue: this.textTabLeft }, + { value: Asc.c_oAscTabType.Center, displayValue: this.textTabCenter }, + { value: Asc.c_oAscTabType.Right, displayValue: this.textTabRight } ]; this._arrKeyTabAlign = []; this._arrTabAlign.forEach(function(item) { @@ -378,7 +378,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ParagraphSettingsAdvanced. cls : 'input-group-nr', data : this._arrTabAlign }); - this.cmbAlign.setValue(1); + this.cmbAlign.setValue(Asc.c_oAscTabType.Left); this.btnAddTab = new Common.UI.Button({ el: $('#paraadv-button-add-tab') diff --git a/apps/spreadsheeteditor/main/app/view/PivotSettings.js b/apps/spreadsheeteditor/main/app/view/PivotSettings.js index 3b6e7cb8e..a9f5d80b1 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotSettings.js +++ b/apps/spreadsheeteditor/main/app/view/PivotSettings.js @@ -108,10 +108,11 @@ define([ '
    ', '', '
    <%= Common.Utils.String.htmlEncode(value) %>
    ', '
    ', @@ -644,7 +645,7 @@ define([ } } - if (type === 'button' || isLabel) { + if (type === 'button' || isLabel || event.target.className.match('checkmark')) { this.updateFieldCheck(listView, record); _.delay(function () { diff --git a/apps/spreadsheeteditor/main/app/view/PivotTable.js b/apps/spreadsheeteditor/main/app/view/PivotTable.js index 43db393e4..efabd3db0 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/view/PivotTable.js @@ -180,7 +180,7 @@ define([ this.btnAddPivot = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-add-pivot', + iconCls: 'toolbar__icon btn-add-pivot', caption: this.txtCreate, disabled : false, lock : [_set.lostConnect, _set.coAuth, _set.editPivot] @@ -188,7 +188,7 @@ define([ this.btnPivotLayout = new Common.UI.Button({ cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-pivot-layout', + iconCls : 'toolbar__icon btn-pivot-layout', caption : this.capLayout, disabled : true, lock : [_set.lostConnect, _set.coAuth, _set.noPivot], @@ -198,7 +198,7 @@ define([ this.btnPivotBlankRows = new Common.UI.Button({ cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-blank-rows', + iconCls : 'toolbar__icon btn-blank-rows', caption : this.capBlankRows, disabled : true, lock : [_set.lostConnect, _set.coAuth, _set.noPivot], @@ -208,7 +208,7 @@ define([ this.btnPivotSubtotals = new Common.UI.Button({ cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-subtotals', + iconCls : 'toolbar__icon btn-subtotals', caption : this.capSubtotals, disabled : true, lock : [_set.lostConnect, _set.coAuth, _set.noPivot], @@ -218,7 +218,7 @@ define([ this.btnPivotGrandTotals = new Common.UI.Button({ cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-grand-totals', + iconCls : 'toolbar__icon btn-grand-totals', caption : this.capGrandTotals, disabled : true, lock : [_set.lostConnect, _set.coAuth, _set.noPivot], @@ -228,7 +228,7 @@ define([ this.btnRefreshPivot = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-update-pivot', + iconCls: 'toolbar__icon btn-update-pivot', caption: this.txtRefresh, disabled : true, lock : [_set.lostConnect, _set.coAuth, _set.noPivot] @@ -237,9 +237,9 @@ define([ this.btnSelectPivot = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-select-pivot', + iconCls: 'toolbar__icon btn-select-pivot', caption: this.txtSelect, - lock : [_set.lostConnect, _set.coAuth, _set.noPivot] + lock: [_set.lostConnect, _set.coAuth, _set.noPivot] }); this.lockedControls.push(this.btnSelectPivot); diff --git a/apps/spreadsheeteditor/main/app/view/PrintSettings.js b/apps/spreadsheeteditor/main/app/view/PrintSettings.js index 87c903f8e..cc635dece 100644 --- a/apps/spreadsheeteditor/main/app/view/PrintSettings.js +++ b/apps/spreadsheeteditor/main/app/view/PrintSettings.js @@ -204,6 +204,14 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', }); this.spinners.push(this.spnMarginRight); + var itemsTemplate = + _.template([ + '<% _.each(items, function(item) { %>', + '
  • style="border-top: 1px solid #e5e5e5;margin-top: 5px;" <% } %> >', + '<%= scope.getDisplayValue(item) %>', + '
  • ', + '<% }); %>' + ].join('')); this.cmbLayout = new Common.UI.ComboBox({ el : $('#printadv-dlg-combo-layout'), style : 'width: 242px;', @@ -215,8 +223,9 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', { value: 1, displayValue: this.textFitPage }, { value: 2, displayValue: this.textFitCols }, { value: 3, displayValue: this.textFitRows }, - { value: 4, displayValue: this.textCustomOptions} - ] + { value: 'customoptions', displayValue: this.textCustomOptions } + ], + itemsTemplate: itemsTemplate }); this.btnHide = new Common.UI.Button({ @@ -233,6 +242,27 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', this.handlerShowDetails(this.btnHide); }, + addCustomScale: function (add) { + if (add) { + this.cmbLayout.setData([ + { value: 0, displayValue: this.textActualSize }, + { value: 1, displayValue: this.textFitPage }, + { value: 2, displayValue: this.textFitCols }, + { value: 3, displayValue: this.textFitRows }, + { value: 4, displayValue: this.textCustom }, + { value: 'customoptions', displayValue: this.textCustomOptions } + ]); + } else { + this.cmbLayout.setData([ + { value: 0, displayValue: this.textActualSize }, + { value: 1, displayValue: this.textFitPage }, + { value: 2, displayValue: this.textFitCols }, + { value: 3, displayValue: this.textFitRows }, + { value: 'customoptions', displayValue: this.textCustomOptions } + ]); + } + }, + setRange: function(value) { this.cmbRange.setValue(value); }, @@ -324,7 +354,8 @@ define([ 'text!spreadsheeteditor/main/app/template/PrintSettings.template', btnDownload: 'Save & Download', textRange: 'Range', textIgnore: 'Ignore Print Area', - textCustomOptions: 'Custom Options' + textCustomOptions: 'Custom Options', + textCustom: 'Custom' }, SSE.Views.PrintSettings || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/RightMenu.js b/apps/spreadsheeteditor/main/app/view/RightMenu.js index 1706af412..f252e0fd9 100644 --- a/apps/spreadsheeteditor/main/app/view/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/view/RightMenu.js @@ -207,7 +207,7 @@ define([ }); this._settings[Common.Utils.documentSettingsType.Signature] = {panel: "id-signature-settings", btn: this.btnSignature}; - this.btnSignature.el = $('#id-right-menu-signature'); this.btnSignature.render().setVisible(true); + this.btnSignature.setElement($('#id-right-menu-signature'), false); this.btnSignature.render().setVisible(true); this.btnSignature.on('click', _.bind(this.onBtnMenuClick, this)); this.signatureSettings = new SSE.Views.SignatureSettings(); } diff --git a/apps/spreadsheeteditor/main/app/view/ScaleDialog.js b/apps/spreadsheeteditor/main/app/view/ScaleDialog.js index b070b4087..3b5f71c68 100644 --- a/apps/spreadsheeteditor/main/app/view/ScaleDialog.js +++ b/apps/spreadsheeteditor/main/app/view/ScaleDialog.js @@ -169,10 +169,10 @@ define([ }, _handleInput: function(state) { - if (this.options.handler) { - this.options.handler.call(this, state, (state == 'ok') ? this.getSettings() : undefined); + if (this.options.handler && state === 'ok') { + this.options.handler.call(this, 'ok', this.getSettings()); } - this.close(); + this.close(state); }, onBtnClick: function(event) { @@ -228,8 +228,8 @@ define([ this._state.width = (width !== null && width !== 0) ? width : null; this._state.height = (height !== null && height !== 0) ? height : null; - width = (width !== null) ? width : 0; - height = (height !== null) ? height : 0; + width = (width !== null && width !== undefined) ? width : 0; + height = (height !== null && height !== undefined) ? height : 0; if (width === 0 && height === 0) { this.radioScaleTo.setValue(true,true); @@ -248,7 +248,7 @@ define([ this.cmbScaleHeight.setRawValue(height.toString() + ' ' + this.getTextPages(height)); } - this.spnScale.setValue((scale !== null) ? scale : '', true); + this.spnScale.setValue((scale !== null && scale !== undefined) ? scale : '', true); } }, @@ -316,6 +316,13 @@ define([ } }, + close: function(state) { + if (this.options.handler && state !== 'ok') { + this.options.handler.call(this, 'cancel', undefined); + } + Common.UI.Window.prototype.close.call(this); + }, + textTitle: 'Scale Settings', textWidth: 'Width', textHeight: 'Height', diff --git a/apps/spreadsheeteditor/main/app/view/SetValueDialog.js b/apps/spreadsheeteditor/main/app/view/SetValueDialog.js index d9db131d4..bf05929e1 100644 --- a/apps/spreadsheeteditor/main/app/view/SetValueDialog.js +++ b/apps/spreadsheeteditor/main/app/view/SetValueDialog.js @@ -83,9 +83,9 @@ define([ step: this.step, defaultUnit : this.defaultUnit, minValue : 0, - maxValue : this.maxvalue, - value : (this.startvalue!==null) ? (this.startvalue + ' ' + this.defaultUnit) : '' + maxValue : this.maxvalue }); + this.spnSize.setValue((this.startvalue!==null) ? (this.startvalue + ' ' + this.defaultUnit) : ''); if (this.startvalue!==null) { var me = this; diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index 2a5281b4a..a08c020bb 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -360,7 +360,6 @@ define([ this.imgprops.asc_putShapeProperties(props); this.api.asc_setGraphicObjectProps(this.imgprops); } - Common.NotificationCenter.trigger('edit:complete', this); }, onTransparencyChange: function(field, newValue, oldValue){ @@ -546,17 +545,16 @@ define([ }); fill.asc_getFill().asc_putPositions(arr); - if (this.OriginalFillType !== Asc.c_oAscFill.FILL_TYPE_GRAD) { - if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { - fill.asc_getFill().asc_putLinearAngle(this.GradLinearDirectionType * 60000); - fill.asc_getFill().asc_putLinearScale(true); - } - arr = []; - this.GradColor.colors.forEach(function(item){ - arr.push(Common.Utils.ThemeColor.getRgbColor(item)); - }); - fill.asc_getFill().asc_putColors(arr); + if (this.GradFillType == Asc.c_oAscFillGradType.GRAD_LINEAR) { + fill.asc_getFill().asc_putLinearAngle(this.GradLinearDirectionType * 60000); + fill.asc_getFill().asc_putLinearScale(true); } + arr = []; + this.GradColor.colors.forEach(function(item){ + arr.push(Common.Utils.ThemeColor.getRgbColor(item)); + }); + fill.asc_getFill().asc_putColors(arr); + props.asc_putFill(fill); this.imgprops.asc_putShapeProperties(props); this.api.asc_setGraphicObjectProps(this.imgprops); @@ -867,7 +865,7 @@ define([ var me = this; var colors = fill.asc_getColors(), positions = fill.asc_getPositions(), - length = colors.length; + length = colors ? colors.length : this.GradColor.colors.length; this.sldrGradient.setThumbs(length); if (this.GradColor.colors.length>length) { this.GradColor.colors.splice(length, this.GradColor.colors.length - length); @@ -895,6 +893,10 @@ define([ me.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(me.GradColor.colors[index]) == 'object') ? me.GradColor.colors[index].color : me.GradColor.colors[index]), index); me.sldrGradient.setValue(index, me.GradColor.values[index]); } + if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; this.FGColor = {Value: 1, Color: this.GradColor.colors[0]}; this.BGColor = {Value: 1, Color: 'ffffff'}; @@ -1192,6 +1194,7 @@ define([ minValue: 0 }); this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.fillControls.push(this.numTransparency); this.sldrTransparency = new Common.UI.SingleSlider({ @@ -1293,6 +1296,16 @@ define([ me.GradColor.colors = colors; me.GradColor.currentIdx = currentIdx; }); + this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){ + me.GradColor.colors[index] = me.GradColor.colors[nearIndex]; + me.GradColor.currentIdx = index; + me.sldrGradient.addNewThumb(index, color); + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + }); this.fillControls.push(this.sldrGradient); this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ @@ -1332,7 +1345,7 @@ define([ this.btnRotate270 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-270', + iconCls: 'toolbar__icon btn-rotate-270', value: 0, hint: this.textHint270 }); @@ -1342,7 +1355,7 @@ define([ this.btnRotate90 = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'rotate-90', + iconCls: 'toolbar__icon btn-rotate-90', value: 1, hint: this.textHint90 }); @@ -1352,7 +1365,7 @@ define([ this.btnFlipV = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-vert', + iconCls: 'toolbar__icon btn-flip-vert', value: 0, hint: this.textHintFlipV }); @@ -1362,7 +1375,7 @@ define([ this.btnFlipH = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'flip-hor', + iconCls: 'toolbar__icon btn-flip-hor', value: 1, hint: this.textHintFlipH }); diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js b/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js index 1c19cf93a..0cbe4acd8 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettingsAdvanced.js @@ -145,7 +145,7 @@ define([ 'text!spreadsheeteditor/main/app/template/ShapeSettingsAdvanced.temp this.btnRatio = new Common.UI.Button({ cls: 'btn-toolbar', - iconCls: 'advanced-btn-ratio', + iconCls: 'toolbar__icon advanced-btn-ratio', style: 'margin-bottom: 1px;', enableToggle: true, hint: this.textKeepRatio diff --git a/apps/spreadsheeteditor/main/app/view/SortDialog.js b/apps/spreadsheeteditor/main/app/view/SortDialog.js new file mode 100644 index 000000000..f80251533 --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/SortDialog.js @@ -0,0 +1,680 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2019 + * + * 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 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * 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 + * +*/ +/** + * + * SortDialog.js + * + * Created by Julia.Radzhabova on 05.10.19 + * Copyright (c) 2019 Ascensio System SIA. All rights reserved. + * + */ + +define([ 'text!spreadsheeteditor/main/app/template/SortDialog.template', + 'common/main/lib/view/AdvancedSettingsWindow', + 'common/main/lib/component/ComboBox', + 'common/main/lib/component/ListView', + 'spreadsheeteditor/main/app/view/SortOptionsDialog' +], function (contentTemplate) { + 'use strict'; + + SSE.Views = SSE.Views || {}; + + var _CustomItem = Common.UI.DataViewItem.extend({ + initialize : function(options) { + Common.UI.BaseView.prototype.initialize.call(this, options); + + var me = this; + + me.template = me.options.template || me.template; + + me.listenTo(me.model, 'change:sort', function() { + me.render(); + me.trigger('change', me, me.model); + }); + me.listenTo(me.model, 'change:selected', function() { + var el = me.$el || $(me.el); + el.toggleClass('selected', me.model.get('selected') && me.model.get('allowSelected')); + me.onSelectChange(me.model, me.model.get('selected') && me.model.get('allowSelected')); + }); + me.listenTo(me.model, 'remove', me.remove); + } + }); + + SSE.Views.SortDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + + options: { + alias: 'SortDialog', + contentWidth: 500, + height: 294, + buttons: ['ok', 'cancel'] + }, + + initialize: function (options) { + var me = this; + _.extend(this.options, { + title: this.txtTitle, + template: [ + '
    ', + '
    ' + _.template(contentTemplate)({scope: this}) + '
    ', + '
    ' + ].join('') + }, options); + + this.api = options.api; + this.handler = options.handler; + this.props = options.props; + this.levels = []; + + this.sortOptions = {}; + + this.options.handler = function(result, value) { + if ( result != 'ok' || this.isListValid() ) { + if (options.handler) + options.handler.call(this, result, value); + return; + } + return true; + }; + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + }, + render: function () { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + var me = this; + + this.sortList = new Common.UI.ListView({ + el: $('#sort-dialog-list', this.$window), + store: new Common.UI.DataViewStore(), + emptyText: '', + enableKeyEvents: false, + template: _.template(['
    '].join('')), + itemTemplate: _.template([ + '
    ', + '
    ', + '
    ', + '<% if (sort==Asc.c_oAscSortOptions.ByColorFill || sort==Asc.c_oAscSortOptions.ByColorFont) { %>', + '
    ', + '
    ', + '<% } else { %>', + '
    ', + '<% } %>', + '
    ' + ].join('')) + }); + this.sortList.createNewItem = function(record) { + return new _CustomItem({ + template: this.itemTemplate, + model: record + }); + }; + this.sortList.on('item:select', _.bind(this.onSelectLevel, this)) + .on('item:keydown', _.bind(this.onKeyDown, this)); + + this.btnAdd = new Common.UI.Button({ + el: $('#sort-dialog-btn-add') + }); + this.btnAdd.on('click', _.bind(this.onAddLevel, this, false)); + + this.btnDelete = new Common.UI.Button({ + el: $('#sort-dialog-btn-delete') + }); + this.btnDelete.on('click', _.bind(this.onDeleteLevel, this)); + + this.btnCopy = new Common.UI.Button({ + el: $('#sort-dialog-btn-copy') + }); + this.btnCopy.on('click', _.bind(this.onCopyLevel, this, false)); + + this.btnOptions = new Common.UI.Button({ + el: $('#sort-dialog-btn-options') + }); + this.btnOptions.on('click', _.bind(this.onOptions, this, false)); + + this.btnUp = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'caret-up', + hint: this.textUp + }); + this.btnUp.render($('#sort-dialog-btn-up')) ; + this.btnUp.on('click', _.bind(this.onMoveClick, this, true)); + + this.btnDown = new Common.UI.Button({ + cls: 'btn-toolbar', + iconCls: 'caret-down', + hint: this.textDown + }); + this.btnDown.render($('#sort-dialog-btn-down')) ; + this.btnDown.on('click', _.bind(this.onMoveClick, this, false)); + + this.lblColumn = $('#sort-dialog-label-column'); + + this.afterRender(); + }, + + afterRender: function() { + this._setDefaults(this.props); + }, + + _setDefaults: function (props) { + if (props) { + this.sortOptions = { + headers: props.asc_getHasHeaders(), + // sensitive: props.asc_getCaseSensitive(), + sortcol: props.asc_getColumnSort(), + lockHeaders: !!props.asc_getLockChangeHeaders(), + lockOrientation: !!props.asc_getLockChangeOrientation() + }; + + this.lblColumn.text(props.asc_getColumnSort() ? this.textColumn : this.textRow); + + // get name from props + this.fillSortValues(); + + this.sort_data = [ + { value: Asc.c_oAscSortOptions.ByValue, displayValue: this.textValues }, + { value: Asc.c_oAscSortOptions.ByColorFill, displayValue: this.textCellColor }, + { value: Asc.c_oAscSortOptions.ByColorFont, displayValue: this.textFontColor } + ]; + this.order_data = [ + { value: Asc.c_oAscSortOptions.Ascending, displayValue: this.textAZ }, + { value: Asc.c_oAscSortOptions.Descending, displayValue: this.textZA } + ]; + + this.sortList.on('item:add', _.bind(this.addControls, this)); + this.sortList.on('item:change', _.bind(this.addControls, this)); + this.refreshList(props.asc_getLevels()); + } + }, + + refreshList: function(levels) { + this.levels = []; + + var arr = []; + if (levels) { + for (var i=0; i0) && this.sortList.selectByIndex(0); + + this.updateButtons(); + }, + + addControls: function(listView, itemView, item) { + if (!item) return; + + var me = this, + i = item.get('levelIndex'), + cmpEl = this.sortList.cmpEl.find('#sort-dialog-item-' + i); + if (!this.levels[i]) + this.levels[i] = { + order_data: this.order_data + }; + var level = this.levels[i]; + var combo = new Common.UI.ComboBox({ + el : cmpEl.find('#sort-dialog-cmb-col-' + i), + editable : false, + cls : 'input-group-nr', + menuCls : 'menu-absolute', + menuStyle : 'max-height: 135px;', + data : this.column_data + }).on('selected', function(combo, record) { + if (record.value==-1) { + var index = item.get('columnIndex'); + combo.setValue(index!==null ? index : ''); + me.onSelectOther(combo, item); + } else { + item.set('columnIndex', record.value); + level.levelProps = me.props.asc_getLevelProps(record.value); + me.updateOrderList(i, item); + } + }); + var val = item.get('columnIndex'); + (val!==null) && combo.setValue(item.get('columnIndex')); + level.cmbColumn = combo; + + combo = new Common.UI.ComboBox({ + el : cmpEl.find('#sort-dialog-cmb-sort-' + i), + editable : false, + cls : 'input-group-nr', + menuCls : 'menu-absolute', + data : this.sort_data + }).on('selected', function(combo, record) { + item.set('sort', record.value); + me.updateOrderList(i, item); + }); + val = item.get('sort'); + (val!==null) && combo.setValue(val); + level.cmbSort = combo; + + var sort = item.get('sort'); + if (sort==Asc.c_oAscSortOptions.ByColorFill || sort==Asc.c_oAscSortOptions.ByColorFont) { + combo = new Common.UI.ComboBoxColor({ + el : cmpEl.find('#sort-dialog-btn-color-' + i), + editable : false, + menuCls : 'menu-absolute', + menuStyle : 'max-height: 135px;', + data : level.color_data + }).on('selected', function(combo, record) { + item.set('color', record.color); + }); + val = item.get('color'); + combo.setValue(val ? Common.Utils.ThemeColor.getHexColor(val.get_r(), val.get_g(), val.get_b()).toLocaleUpperCase() : -1); + var rec = combo.getSelectedRecord(); + rec && item.set('color', rec.color); + level.cmbColor = combo; + } + + combo = new Common.UI.ComboBox({ + el : cmpEl.find('#sort-dialog-cmb-order-' + i), + editable : false, + cls : 'input-group-nr', + menuCls : 'menu-absolute', + data : level.order_data + }).on('selected', function(combo, record) { + item.set('order', record.value); + }); + val = item.get('order'); + (val!==null) && combo.setValue(val); + level.cmbOrder = combo; + + cmpEl.on('mousedown', '.combobox', function(){ + me.sortList.selectRecord(item); + }); + }, + + onOptions: function () { + var me = this; + + var win = new SSE.Views.SortOptionsDialog({ + props: me.sortOptions, + handler : function(result, settings) { + if (result == 'ok' && settings) { + me.lblColumn.text(settings.sortcol ? me.textColumn : me.textRow); + me.props.asc_setHasHeaders(settings.headers); + // me.props.asc_setCaseSensitive(settings.sensitive); + me.props.asc_setColumnSort(settings.sortcol); + me.props.asc_updateSortList(me.sortOptions.sortcol == settings.sortcol); + me.sortOptions = settings; + me.updateSortValues(); + } + } + }); + win.show(); + }, + + fillSortValues: function() { + var values = this.props.asc_getSortList(), + len = values.length; + this.column_data = []; + for (var i=0; i=500) + this.column_data.push({ value: -1, displayValue: this.sortOptions.sortcol ? this.textMoreCols : this.textMoreRows }); + }, + + updateSortValues: function() { + this.fillSortValues(); + var me = this; + this.sortList.store.each(function(item) { + var columnIndex = (item.get('sort')==Asc.c_oAscSortOptions.ByValue) ? null : 0, + levelIndex = item.get('levelIndex'); + item.set('columnIndex', columnIndex, {silent: true} ); + item.set('order', Asc.c_oAscSortOptions.Ascending, {silent: true} ); + item.set('color', null, {silent: true} ); + me.levels[levelIndex].levelProps = (columnIndex!==null) ? me.props.asc_getLevelProps(columnIndex) : undefined; + me.addControls(null, null, item); + me.updateOrderList(levelIndex, item); + }); + }, + + onAddLevel: function() { + var store = this.sortList.store, + rec = this.sortList.getSelectedRec(); + rec = store.add({ + columnIndex: null, + levelIndex: this.levels.length, + sort: Asc.c_oAscSortOptions.ByValue, + order: Asc.c_oAscSortOptions.Ascending + }, {at: rec ? store.indexOf(rec)+1 : store.length}); + if (rec) { + this.sortList.selectRecord(rec); + this.sortList.scrollToRecord(rec); + } + this.updateButtons(); + }, + + onCopyLevel: function() { + var store = this.sortList.store, + rec = this.sortList.getSelectedRec(), + levelIndex = this.levels.length, + copyLevel = this.levels[rec ? rec.get('levelIndex') : null]; + + this.levels[levelIndex] = { + levelProps: copyLevel ? copyLevel.levelProps : null, + order_data: copyLevel ? copyLevel.order_data : null, + color_data: copyLevel ? copyLevel.color_data : null + }; + rec = store.add({ + levelIndex: levelIndex, + columnIndex: rec ? rec.get('columnIndex') : null, + sort: rec ? rec.get('sort') : Asc.c_oAscSortOptions.ByValue, + order: rec ? rec.get('order') : Asc.c_oAscSortOptions.Ascending, + color: rec ? rec.get('color') : null + }, {at: rec ? store.indexOf(rec)+1 : store.length}); + if (rec) { + this.sortList.selectRecord(rec); + this.sortList.scrollToRecord(rec); + } + this.updateButtons(); + }, + + onDeleteLevel: function() { + var store = this.sortList.store, + rec = this.sortList.getSelectedRec(); + if (rec) { + var index = rec.get('levelIndex'); + this.levels[index] = undefined; + index = store.indexOf(rec); + store.remove(rec); + (store.length>0) && this.sortList.selectByIndex(index0) && level.cmbColor.setValue(level.color_data[0].value); + + storeItem && storeItem.set('color', null); + } + }, + + getSettings: function() { + var props = new Asc.CSortProperties(); + props.asc_setHasHeaders(this.sortOptions.headers); + // props.asc_setCaseSensitive(this.sortOptions.sensitive); + props.asc_setColumnSort(this.sortOptions.sortcol); + + var me = this, + arr = []; + this.sortList.store.each(function(item) { + var columnIndex = item.get('columnIndex'), + levelProp = me.levels[item.get('levelIndex')]; + if (columnIndex!==null && levelProp) { + var level = new Asc.CSortPropertiesLevel(); + level.asc_setIndex(columnIndex); + level.asc_setSortBy(levelProp.cmbSort.getValue()); + level.asc_setDescending(levelProp.cmbOrder.getValue()); + if (levelProp.cmbSort.getValue() == Asc.c_oAscSortOptions.ByColorFill || levelProp.cmbSort.getValue()==Asc.c_oAscSortOptions.ByColorFont) { + var rec = levelProp.cmbColor.getSelectedRecord(); + if (rec) { + level.asc_setColor(rec.color); + } + } + arr.push(level); + } + }); + props.asc_setLevels(arr); + return props; + }, + + isListValid: function() { + var rec = this.sortList.store.findWhere({columnIndex: null}); + if (rec) + Common.UI.warning({msg: this.errorEmpty}); + else { + var store = this.sortList.store, + len = store.length; + for (var index=0; index=0; i--) { + var itemcheck = store.at(i), + levelcheck = this.levels[itemcheck.get('levelIndex')]; + if (item.get('columnIndex') == itemcheck.get('columnIndex') && sort == levelcheck.cmbSort.getValue()) { + if (sort == Asc.c_oAscSortOptions.ByColorFill || sort==Asc.c_oAscSortOptions.ByColorFont) { + var colorcheck = levelcheck.cmbColor.getSelectedRecord(); + if (color && colorcheck && color.value == colorcheck.value) { + rec = levelProp.cmbColumn.getSelectedRecord().displayValue; + rec = this.errorSameColumnColor.replace('%1', rec); + break; + } + } else { + rec = levelProp.cmbColumn.getSelectedRecord().displayValue; + rec = this.errorSameColumnValue.replace('%1', rec); + break; + } + } + } + if (rec) + break; + } + rec && Common.UI.warning({msg: rec}); + } + return !rec; + }, + + close: function () { + Common.Views.AdvancedSettingsWindow.prototype.close.call(this); + }, + + onKeyDown: function (lisvView, record, e) { + if (e.keyCode==Common.UI.Keys.DELETE && !this.btnDelete.isDisabled()) + this.onDeleteLevel(); + }, + + updateButtons: function() { + this.btnAdd.setDisabled(this.sortList.store.length>63); + this.btnCopy.setDisabled(this.sortList.store.length<1); + this.btnDelete.setDisabled(this.sortList.store.length<1); + this.updateMoveButtons(); + this.sortList.scroller && this.sortList.scroller.update(); + }, + + updateMoveButtons: function() { + var rec = this.sortList.getSelectedRec(), + index = rec ? this.sortList.store.indexOf(rec) : -1; + this.btnUp.setDisabled(index<1); + this.btnDown.setDisabled(index<0 || index==this.sortList.store.length-1); + }, + + onSelectOther: function(combo, item) { + var me = this; + if (me.api) { + var handlerDlg = function(dlg, result) { + if (result == 'ok') { + var range = dlg.getSettings(); + var isvalid; + if (!_.isEmpty(range)) { + isvalid = me.api.asc_checkDataRange(Asc.c_oAscSelectionDialogType.CustomSort, range, true, !me.sortOptions.sortcol); + } + + if (isvalid == Asc.c_oAscError.ID.No) { + var index = me.props.asc_addBySortList(range); + me.fillSortValues(); + combo.setData(me.column_data); + combo.setValue(index); + item.set('columnIndex', index); + me.levels[item.get('levelIndex')].levelProps = me.props.asc_getLevelProps(index); + me.updateOrderList(item.get('levelIndex'), item); + return false; + } else if (isvalid == Asc.c_oAscError.ID.CustomSortMoreOneSelectedError) + Common.UI.warning({msg: me.sortOptions.sortcol ? me.errorMoreOneCol: me.errorMoreOneRow}); + else if (isvalid == Asc.c_oAscError.ID.CustomSortNotOriginalSelectError) + Common.UI.warning({msg: me.sortOptions.sortcol ? me.errorNotOriginalCol : me.errorNotOriginalRow}); + else + Common.UI.warning({msg: me.txtInvalidRange}); + return true; + } + }; + + var win = new SSE.Views.CellRangeDialog({ + handler: handlerDlg + }).on('close', function() { + me.show(); + }); + + var xy = me.$window.offset(); + me.hide(); + win.show(xy.left + 65, xy.top + 77); + win.setSettings({ + api : me.api, + range : me.props.asc_getRangeStr(), + type : Asc.c_oAscSelectionDialogType.CustomSort + }); + } + }, + + txtTitle: 'Sort', + textAdd: 'Add level', + textDelete: 'Delete level', + textCopy: 'Copy level', + textColumn: 'Column', + textRow: 'Row', + textSort: 'Sort on', + textOrder: 'Order', + textUp: 'Move level up', + textDown: 'Move level down', + textOptions: 'Options', + textValues: 'Values', + textCellColor: 'Cell color', + textFontColor: 'Font color', + textAZ: 'A to Z', + textZA: 'Z to A', + textDesc: 'Descending', + textAsc: 'Ascending', + textTop: 'Top', + textBelow: 'Below', + textLeft: 'Left', + textRight: 'Right', + errorEmpty: 'All sort criteria must have a column or row specified.', + textAuto: 'Automatic', + textNone: 'None', + errorNotOriginalCol: 'The column you selected is not in the original selected range.', + errorNotOriginalRow: 'The row you selected is not in the original selected range.', + errorMoreOneRow: 'More than one row is selected.', + errorMoreOneCol: 'More than one column is selected.', + txtInvalidRange: 'Invalid cells range.', + textMoreRows: '(More rows...)', + textMoreCols: '(More columns...)', + errorSameColumnValue: "%1 is being sorted by values more than once.
    Delete the duplicate sort criteria and try again.", + errorSameColumnColor: "%1 is being sorted by the same color more than once.
    Delete the duplicate sort criteria and try again." + + }, SSE.Views.SortDialog || {})); +}); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/SortOptionsDialog.js b/apps/spreadsheeteditor/main/app/view/SortOptionsDialog.js new file mode 100644 index 000000000..3dae5613c --- /dev/null +++ b/apps/spreadsheeteditor/main/app/view/SortOptionsDialog.js @@ -0,0 +1,158 @@ +/* + * + * (c) Copyright Ascensio System SIA 2010-2019 + * + * 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 20A-12 Ernesta Birznieka-Upisha + * street, Riga, Latvia, EU, LV-1050. + * + * 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 + * + */ + +/** + * SortOptionsDialog.js + * + * Created by Julia Radzhabova on 05.10.2019 + * Copyright (c) 2019 Ascensio System SIA. All rights reserved. + * + */ +define([ + 'common/main/lib/util/utils', + 'common/main/lib/component/CheckBox', + 'common/main/lib/component/RadioBox', + 'common/main/lib/view/AdvancedSettingsWindow' +], function () { 'use strict'; + + SSE.Views.SortOptionsDialog = Common.Views.AdvancedSettingsWindow.extend(_.extend({ + options: { + contentWidth: 230, + height: 200 + }, + + initialize : function(options) { + var me = this; + + _.extend(this.options, { + title: this.textTitle, + template: [ + '
    ', + '
    ', + '
    ', + '', + '', + '', + '', + // '', + // '', + // '', + '', + '', + '', + '', + '', + '', + '', + '', + '', + '
    ', + '
    ', + '
    ', + // '
    ', + // '
    ', + '', + '
    ', + '
    ', + '
    ', + '
    ', + '
    ', + '
    ', + '
    ', + '
    ' + ].join('') + }, options); + + this.props = options.props; + + Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options); + }, + + render: function() { + Common.Views.AdvancedSettingsWindow.prototype.render.call(this); + + this.chHeaders = new Common.UI.CheckBox({ + el: $('#sort-options-chk-headers'), + labelText: this.textHeaders + }); + + // this.chCase = new Common.UI.CheckBox({ + // el: $('#sort-options-chk-case'), + // labelText: this.textCase + // }); + + this.radioTop = new Common.UI.RadioBox({ + el: $('#sort-options-radio-row'), + labelText: this.textTopBottom, + name: 'asc-radio-sort-orient' + }).on('change', _.bind(function(field, newValue, eOpts) { + newValue && this.chHeaders.setDisabled(this.props.lockHeaders); + }, this)); + + this.radioLeft = new Common.UI.RadioBox({ + el: $('#sort-options-radio-col'), + labelText: this.textLeftRight, + name: 'asc-radio-sort-orient' + }).on('change', _.bind(function(field, newValue, eOpts) { + newValue && this.chHeaders.setDisabled(true); + }, this)); + + this.afterRender(); + }, + + afterRender: function() { + this._setDefaults(this.props); + }, + + _setDefaults: function (props) { + if (props) { + this.chHeaders.setValue(props.headers); + // this.chCase.setValue(props.sensitive); + (props.sortcol || props.lockOrientation) ? this.radioTop.setValue(true) : this.radioLeft.setValue(true); + this.radioLeft.setDisabled(props.lockOrientation); + } + }, + + getSettings: function () { + return {headers: this.radioTop.getValue() && (this.chHeaders.getValue()=='checked'), /*sensitive: this.chCase.getValue()=='checked',*/ sortcol: this.radioTop.getValue(), lockHeaders: this.props.lockHeaders, lockOrientation: this.props.lockOrientation}; + }, + + textTitle: 'Sort Options', + textHeaders: 'My data has headers', + textCase: 'Case sensitive', + textOrientation: 'Orientation', + textTopBottom: 'Sort top to bottom', + textLeftRight: 'Sort left to right' + + }, SSE.Views.SortOptionsDialog || {})) +}); diff --git a/apps/spreadsheeteditor/main/app/view/Spellcheck.js b/apps/spreadsheeteditor/main/app/view/Spellcheck.js index 1d6a3ad83..c9501c81c 100644 --- a/apps/spreadsheeteditor/main/app/view/Spellcheck.js +++ b/apps/spreadsheeteditor/main/app/view/Spellcheck.js @@ -82,7 +82,7 @@ define([ this.buttonNext = new Common.UI.Button({ style: 'margin-left: 5px; width: 22px; height: 22px; border: 1px solid #cfcfcf;', cls: 'btn-toolbar bg-white', - iconCls: 'btn-spellcheck-next', + iconCls: 'toolbar__icon btn-nextitem', hint: this.txtNextTip }); this.buttonNext.render($('#spellcheck-next')); diff --git a/apps/spreadsheeteditor/main/app/view/Statusbar.js b/apps/spreadsheeteditor/main/app/view/Statusbar.js index a3037896b..0d50e0bfc 100644 --- a/apps/spreadsheeteditor/main/app/view/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/view/Statusbar.js @@ -80,6 +80,7 @@ define([ })); this.editMode = false; + this.rangeSelectionMode = Asc.c_oAscSelectionDialogType.None; this.btnZoomDown = new Common.UI.Button({ el: $('#status-btn-zoomdown',this.el), @@ -182,19 +183,23 @@ define([ me.fireEvent('sheet:changename'); } }, this), - 'tab:move' : _.bind(function (tabIndex, index) { + 'tab:move' : _.bind(function (selectTabs, index) { me.tabBarScroll = {scrollLeft: me.tabbar.scrollX}; - - if (_.isUndefined(index) || tabIndex === index) { + if (_.isUndefined(selectTabs) || _.isUndefined(index) || selectTabs === index) { return; } + if (_.isArray(selectTabs)) { + me.fireEvent('sheet:move', [selectTabs, false, true, undefined, index]); + } else { + var tabIndex = selectTabs; - if (tabIndex < index) { - ++index; + if (tabIndex < index) { + ++index; + } + + me.fireEvent('sheet:move', [undefined, false, true, tabIndex, index]); } - me.fireEvent('sheet:move', [false, true, tabIndex, index]); - }, this) }); @@ -241,7 +246,10 @@ define([ { caption: this.itemTabColor, menu: menuColorItems - } + }, + { caption: '--' }, + {caption: this.selectAllSheets, value: 'selectall'}, + {caption: this.ungroupSheets, value: 'noselect'} ] }).on('render:after', function(btn) { var colorVal = $('
    '); @@ -348,7 +356,7 @@ define([ if (!this.tabbar.isTabVisible(sindex)) this.tabbar.setTabVisible(sindex); - this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked()); + this.btnAddWorksheet.setDisabled(me.mode.isDisconnected || me.api.asc_isWorkbookLocked() || me.api.isCellEdited); $('#status-label-zoom').text(Common.Utils.String.format(this.zoomText, Math.floor((this.api.asc_getZoom() +.005)*100))); me.fireEvent('sheet:changed', [me, sindex]); @@ -409,7 +417,8 @@ define([ // Common.NotificationCenter.trigger('comments:updatefilter', ['doc', 'sheet' + this.api.asc_getActiveWorksheetId()], false); // hide popover }, - onTabMenu: function (o, index, tab) { + onTabMenu: function (o, index, tab, select) { + var me = this; if (this.mode.isEdit && !this.isEditFormula && (this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.Chart) && (this.rangeSelectionMode !== Asc.c_oAscSelectionDialogType.FormatTable) && !this.mode.isDisconnected ) { @@ -420,8 +429,18 @@ define([ if (!tab.isActive()) this.tabbar.setActive(tab); - var issheetlocked = this.api.asc_isWorksheetLockedOrDeleted(tab.sheetindex), - isdoclocked = this.api.asc_isWorkbookLocked(); + if (!_.isUndefined(select)) { + var issheetlocked = false; + select.forEach(function (item) { + if (me.api.asc_isWorksheetLockedOrDeleted(item.sheetindex)) { + issheetlocked = true; + } + }); + } else { + var issheetlocked = me.api.asc_isWorksheetLockedOrDeleted(tab.sheetindex); + } + + var isdoclocked = this.api.asc_isWorkbookLocked(); this.tabMenu.items[0].setDisabled(isdoclocked); this.tabMenu.items[1].setDisabled(issheetlocked); @@ -432,6 +451,15 @@ define([ this.tabMenu.items[6].setDisabled(isdoclocked); this.tabMenu.items[7].setDisabled(issheetlocked); + if (select.length === 1) { + this.tabMenu.items[10].hide(); + } else { + this.tabMenu.items[10].show(); + } + + this.tabMenu.items[9].setDisabled(issheetlocked); + this.tabMenu.items[10].setDisabled(issheetlocked); + this.api.asc_closeCellEditor(); this.api.asc_enableKeyEvents(false); @@ -473,6 +501,11 @@ define([ onTabMenuClick: function (o, item) { if (item && this.api) { this.enableKeyEvents = (item.value === 'ins' || item.value === 'hide'); + if (item.value === 'selectall') { + this.tabbar.setSelectAll(true); + } else if (item.value === 'noselect') { + this.tabbar.setSelectAll(false); + } } }, @@ -538,13 +571,15 @@ define([ textNoColor : 'No Color', textNewColor : 'Add New Custom Color', zoomText : 'Zoom {0}%', - textSum : 'SUM', - textCount : 'COUNT', - textAverage : 'AVERAGE', - textMin : 'MIN', - textMax : 'MAX', + textSum : 'Sum', + textCount : 'Count', + textAverage : 'Average', + textMin : 'Min', + textMax : 'Max', filteredRecordsText : '{0} of {1} records filtered', - filteredText : 'Filter mode' + filteredText : 'Filter mode', + selectAllSheets : 'Select All Sheets', + ungroupSheets : 'Ungroup Sheets' }, SSE.Views.Statusbar || {})); SSE.Views.Statusbar.RenameDialog = Common.UI.Window.extend(_.extend({ @@ -552,8 +587,7 @@ define([ header: false, width: 280, cls: 'modal-dlg', - buttons: ['ok', 'cancel'], - footerCls: 'right' + buttons: ['ok', 'cancel'] }, template: '
    ' + @@ -659,10 +693,8 @@ define([ SSE.Views.Statusbar.CopyDialog = Common.UI.Window.extend(_.extend({ options: { width: 270, - height: 300, cls: 'modal-dlg', - buttons: ['ok', 'cancel'], - footerCls: 'right' + buttons: ['ok', 'cancel'] }, template: '
    ' + diff --git a/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js b/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js index d01cb33e3..065dbd94d 100644 --- a/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js @@ -54,8 +54,7 @@ define([ width : 350, cls : 'modal-dlg', modal : false, - buttons: ['ok', 'cancel'], - footerCls: 'right' + buttons: ['ok', 'cancel'] }, initialize : function(options) { diff --git a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js index d3d6291d7..0e420d1cd 100644 --- a/apps/spreadsheeteditor/main/app/view/TextArtSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TextArtSettings.js @@ -355,7 +355,6 @@ define([ this.shapeprops.put_TextArtProperties(props); this.api.asc_setGraphicObjectProps(this.imgprops); } - Common.NotificationCenter.trigger('edit:complete', this); }, onTransparencyChange: function(field, newValue, oldValue){ @@ -822,7 +821,7 @@ define([ var me = this; var colors = fill.asc_getColors(), positions = fill.asc_getPositions(), - length = colors.length; + length = colors ? colors.length : this.GradColor.colors.length; this.sldrGradient.setThumbs(length); if (this.GradColor.colors.length>length) { this.GradColor.colors.splice(length, this.GradColor.colors.length - length); @@ -850,6 +849,10 @@ define([ me.sldrGradient.setColorValue(Common.Utils.String.format('#{0}', (typeof(me.GradColor.colors[index]) == 'object') ? me.GradColor.colors[index].color : me.GradColor.colors[index]), index); me.sldrGradient.setValue(index, me.GradColor.values[index]); } + if (_.isUndefined(me.GradColor.currentIdx) || me.GradColor.currentIdx >= this.GradColor.colors.length) { + me.GradColor.currentIdx = 0; + } + me.sldrGradient.setActiveThumb(me.GradColor.currentIdx); this.OriginalFillType = Asc.c_oAscFill.FILL_TYPE_GRAD; this.FGColor = {Value: 1, Color: this.GradColor.colors[0]}; this.BGColor = {Value: 1, Color: 'ffffff'}; @@ -1156,6 +1159,7 @@ define([ minValue: 0 }); this.numTransparency.on('change', _.bind(this.onNumTransparencyChange, this)); + this.numTransparency.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me);}); this.lockedControls.push(this.numTransparency); this.sldrTransparency = new Common.UI.SingleSlider({ @@ -1257,6 +1261,16 @@ define([ me.GradColor.colors = colors; me.GradColor.currentIdx = currentIdx; }); + this.sldrGradient.on('addthumb', function(cmp, index, nearIndex, color){ + me.GradColor.colors[index] = me.GradColor.colors[nearIndex]; + me.GradColor.currentIdx = index; + me.sldrGradient.addNewThumb(index, color); + }); + this.sldrGradient.on('removethumb', function(cmp, index){ + me.sldrGradient.removeThumb(index); + me.GradColor.values.splice(index, 1); + me.sldrGradient.changeGradientStyle(); + }); this.lockedControls.push(this.sldrGradient); this.cmbBorderSize = new Common.UI.ComboBorderSizeEditable({ diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 32d187dfd..d2fe1a385 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -172,20 +172,20 @@ define([ me.btnCopy = new Common.UI.Button({ id : 'id-toolbar-btn-copy', cls : 'btn-toolbar', - iconCls : 'btn-copy' + iconCls : 'toolbar__icon btn-copy' }); me.btnPaste = new Common.UI.Button({ id : 'id-toolbar-btn-paste', cls : 'btn-toolbar', - iconCls : 'btn-paste', + iconCls : 'toolbar__icon btn-paste', lock : [/*_set.editCell,*/ _set.coAuth, _set.lostConnect] }); me.btnUndo = new Common.UI.Button({ id : 'id-toolbar-btn-undo', cls : 'btn-toolbar', - iconCls : 'btn-undo', + iconCls : 'toolbar__icon btn-undo', disabled : true, lock : [_set.lostConnect], signals : ['disabled'] @@ -194,7 +194,7 @@ define([ me.btnRedo = new Common.UI.Button({ id : 'id-toolbar-btn-redo', cls : 'btn-toolbar', - iconCls : 'btn-redo', + iconCls : 'toolbar__icon btn-redo', disabled : true, lock : [_set.lostConnect], signals : ['disabled'] @@ -206,7 +206,7 @@ define([ me.btnInsertFormula = new Common.UI.Button({ id : 'id-toolbar-btn-insertformula', cls : 'btn-toolbar', - iconCls : 'btn-formula', + iconCls : 'toolbar__icon btn-formula', split : true, lock : [_set.editText, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRangeEdit, _set.lostConnect, _set.coAuth], menu : new Common.UI.Menu({ @@ -228,14 +228,14 @@ define([ me.btnDecDecimal = new Common.UI.Button({ id : 'id-toolbar-btn-decdecimal', cls : 'btn-toolbar', - iconCls : 'btn-decdecimal', + iconCls : 'toolbar__icon btn-decdecimal', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth] }); me.btnIncDecimal = new Common.UI.Button({ id : 'id-toolbar-btn-incdecimal', cls : 'btn-toolbar', - iconCls : 'btn-incdecimal', + iconCls : 'toolbar__icon btn-incdecimal', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth] }); @@ -275,28 +275,28 @@ define([ me.btnSearch = new Common.UI.Button({ id : 'id-toolbar-btn-search', cls : 'btn-toolbar', - iconCls : 'btn-search', + iconCls : 'toolbar__icon btn-menu-search', lock : [_set.lostConnect] }); me.btnSortDown = new Common.UI.Button({ id : 'id-toolbar-btn-sort-down', cls : 'btn-toolbar', - iconCls : 'btn-sort-down', + iconCls : 'toolbar__icon btn-sort-down', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot] }); me.btnSortUp = new Common.UI.Button({ id : 'id-toolbar-btn-sort-up', cls : 'btn-toolbar', - iconCls : 'btn-sort-up', + iconCls : 'toolbar__icon btn-sort-up', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot] }); me.btnSetAutofilter = new Common.UI.Button({ id : 'id-toolbar-btn-setautofilter', cls : 'btn-toolbar', - iconCls : 'btn-autofilter', + iconCls : 'toolbar__icon btn-autofilter', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.editPivot], enableToggle: true }); @@ -304,7 +304,7 @@ define([ me.btnClearAutofilter = new Common.UI.Button({ id : 'id-toolbar-btn-clearfilter', cls : 'btn-toolbar', - iconCls : 'btn-clear-filter', + iconCls : 'toolbar__icon btn-clear-filter', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleDelFilter, _set.editPivot] }); } else @@ -359,7 +359,7 @@ define([ me.btnPrint = new Common.UI.Button({ id : 'id-toolbar-btn-print', cls : 'btn-toolbar', - iconCls : 'btn-print no-mask', + iconCls : 'toolbar__icon btn-print no-mask', lock : [_set.editCell, _set.cantPrint, _set.disableOnStart], signals: ['disabled'] }); @@ -367,7 +367,7 @@ define([ me.btnSave = new Common.UI.Button({ id : 'id-toolbar-btn-save', cls : 'btn-toolbar', - iconCls : 'no-mask ' + me.btnSaveCls, + iconCls : 'toolbar__icon no-mask ' + me.btnSaveCls, signals : ['disabled'] }); me.btnCollabChanges = me.btnSave; @@ -375,21 +375,21 @@ define([ me.btnIncFontSize = new Common.UI.Button({ id : 'id-toolbar-btn-incfont', cls : 'btn-toolbar', - iconCls : 'btn-incfont', + iconCls : 'toolbar__icon btn-incfont', lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect] }); me.btnDecFontSize = new Common.UI.Button({ id : 'id-toolbar-btn-decfont', cls : 'btn-toolbar', - iconCls : 'btn-decfont', + iconCls : 'toolbar__icon btn-decfont', lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect] }); me.btnBold = new Common.UI.Button({ id : 'id-toolbar-btn-bold', cls : 'btn-toolbar', - iconCls : 'btn-bold', + iconCls : 'toolbar__icon btn-bold', lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect], enableToggle: true }); @@ -397,7 +397,7 @@ define([ me.btnItalic = new Common.UI.Button({ id : 'id-toolbar-btn-italic', cls : 'btn-toolbar', - iconCls : 'btn-italic', + iconCls : 'toolbar__icon btn-italic', lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect], enableToggle: true }); @@ -405,7 +405,7 @@ define([ me.btnUnderline = new Common.UI.Button({ id : 'id-toolbar-btn-underline', cls : 'btn-toolbar', - iconCls : 'btn-underline', + iconCls : 'toolbar__icon btn-underline', lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect], enableToggle: true }); @@ -413,7 +413,7 @@ define([ me.btnStrikeout = new Common.UI.Button({ id: 'id-toolbar-btn-strikeout', cls: 'btn-toolbar', - iconCls: 'btn-strikeout', + iconCls: 'toolbar__icon btn-strikeout', lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect], enableToggle: true }); @@ -421,7 +421,7 @@ define([ me.btnSubscript = new Common.UI.Button({ id : 'id-toolbar-btn-subscript', cls : 'btn-toolbar', - iconCls : 'btn-subscript', + iconCls : 'toolbar__icon btn-subscript', icls : 'btn-subscript', split : true, enableToggle: true, @@ -430,18 +430,20 @@ define([ items: [ { caption : me.textSuperscript, - iconCls : 'mnu-text-superscript', + iconCls : 'menu__icon btn-superscript', icls : 'btn-superscript', checkable : true, + checkmark : false, allowDepress: true, toggleGroup : 'textsubscriptgroup', value : 'super' }, { caption : me.textSubscript, - iconCls : 'mnu-text-subscript', + iconCls : 'menu__icon btn-subscript', icls : 'btn-subscript', checkable : true, + checkmark : false, allowDepress: true, toggleGroup : 'textsubscriptgroup', value : 'sub' @@ -454,7 +456,7 @@ define([ me.btnTextColor = new Common.UI.Button({ id : 'id-toolbar-btn-fontcolor', cls : 'btn-toolbar', - iconCls : 'btn-fontcolor', + iconCls : 'toolbar__icon btn-fontcolor', split : true, lock : [_set.selImage, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect], menu : new Common.UI.Menu({ @@ -469,7 +471,7 @@ define([ me.btnBackColor = new Common.UI.Button({ id : 'id-toolbar-btn-fillparag', cls : 'btn-toolbar', - iconCls : 'btn-fillparag', + iconCls : 'toolbar__icon btn-paracolor', split : true, lock : [_set.selImage, _set.editCell, _set.coAuth, _set.coAuthText, _set.lostConnect], menu : new Common.UI.Menu({ @@ -483,7 +485,7 @@ define([ me.btnBorders = new Common.UI.Button({ id : 'id-toolbar-btn-borders', cls : 'btn-toolbar', - iconCls : 'btn-border-out', + iconCls : 'toolbar__icon btn-border-out', icls : 'btn-border-out', borderId : 'outer', borderswidth: Asc.c_oAscBorderStyles.Thin, @@ -495,7 +497,7 @@ define([ me.btnAlignLeft = new Common.UI.Button({ id : 'id-toolbar-btn-align-left', cls : 'btn-toolbar', - iconCls : 'btn-align-left', + iconCls : 'toolbar__icon btn-align-left', enableToggle: true, lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText], toggleGroup : 'alignGroup' @@ -504,7 +506,7 @@ define([ me.btnAlignCenter = new Common.UI.Button({ id : 'id-toolbar-btn-align-center', cls : 'btn-toolbar', - iconCls : 'btn-align-center', + iconCls : 'toolbar__icon btn-align-center', enableToggle: true, lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText], toggleGroup : 'alignGroup' @@ -513,7 +515,7 @@ define([ me.btnAlignRight = new Common.UI.Button({ id : 'id-toolbar-btn-align-right', cls : 'btn-toolbar', - iconCls : 'btn-align-right', + iconCls : 'toolbar__icon btn-align-right', enableToggle: true, lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText], toggleGroup : 'alignGroup' @@ -522,7 +524,7 @@ define([ me.btnAlignJust = new Common.UI.Button({ id : 'id-toolbar-btn-align-just', cls : 'btn-toolbar', - iconCls : 'btn-align-just', + iconCls : 'toolbar__icon btn-align-just', enableToggle: true, lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText], toggleGroup: 'alignGroup' @@ -531,7 +533,7 @@ define([ me.btnMerge = new Common.UI.Button({ id : 'id-toolbar-rtn-merge', cls : 'btn-toolbar', - iconCls : 'btn-merge', + iconCls : 'toolbar__icon btn-merge', enableToggle: true, allowDepress: true, split : true, @@ -561,7 +563,7 @@ define([ me.btnAlignTop = new Common.UI.Button({ id : 'id-toolbar-rtn-valign-top', cls : 'btn-toolbar', - iconCls : 'btn-valign-top', + iconCls : 'toolbar__icon btn-align-top', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText], enableToggle: true, toggleGroup : 'vAlignGroup' @@ -570,7 +572,7 @@ define([ me.btnAlignMiddle = new Common.UI.Button({ id : 'id-toolbar-rtn-valign-middle', cls : 'btn-toolbar', - iconCls : 'btn-valign-middle', + iconCls : 'toolbar__icon btn-align-middle', enableToggle: true, lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText], toggleGroup : 'vAlignGroup' @@ -579,7 +581,7 @@ define([ me.btnAlignBottom = new Common.UI.Button({ id : 'id-toolbar-rtn-valign-bottom', cls : 'btn-toolbar', - iconCls : 'btn-valign-bottom', + iconCls : 'toolbar__icon btn-align-bottom', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText], enableToggle: true, toggleGroup : 'vAlignGroup' @@ -588,7 +590,7 @@ define([ me.btnWrap = new Common.UI.Button({ id : 'id-toolbar-rtn-wrap', cls : 'btn-toolbar', - iconCls : 'btn-wrap', + iconCls : 'toolbar__icon btn-wrap', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth], enableToggle: true, allowDepress: true @@ -597,42 +599,47 @@ define([ me.btnTextOrient = new Common.UI.Button({ id : 'id-toolbar-rtn-textorient', cls : 'btn-toolbar', - iconCls : 'btn-text-orient', + iconCls : 'toolbar__icon text-orient-ccw', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText], menu : new Common.UI.Menu({ items: [ { caption : me.textHorizontal, - iconCls : 'mnu-direct-horiz', + iconCls : 'menu__icon text-orient-hor', checkable : true, + checkmark : false, toggleGroup : 'textorientgroup', value : 'horiz' }, { caption : me.textCounterCw, - iconCls : 'mnu-direct-ccw', + iconCls : 'menu__icon text-orient-ccw', checkable : true, + checkmark : false, toggleGroup : 'textorientgroup', value : 'countcw' }, { caption : me.textClockwise, - iconCls : 'mnu-direct-cw', + iconCls : 'menu__icon text-orient-cw', checkable : true, + checkmark : false, toggleGroup : 'textorientgroup', value : 'clockwise' }, { caption : me.textRotateUp, - iconCls : 'mnu-direct-rup', + iconCls : 'menu__icon text-orient-rup', checkable : true, + checkmark : false, toggleGroup : 'textorientgroup', value : 'rotateup' }, { caption : me.textRotateDown, - iconCls : 'mnu-direct-rdown', + iconCls : 'menu__icon text-orient-rdown', checkable : true, + checkmark : false, toggleGroup : 'textorientgroup', value : 'rotatedown' } @@ -643,7 +650,7 @@ define([ me.btnInsertImage = new Common.UI.Button({ id : 'tlbtn-insertimage', cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-insertimage', + iconCls : 'toolbar__icon btn-insertimage', caption : me.capInsertImage, lock : [_set.editCell, _set.lostConnect, _set.coAuth], menu : new Common.UI.Menu({ @@ -658,7 +665,7 @@ define([ me.btnInsertHyperlink = new Common.UI.Button({ id : 'tlbtn-insertlink', cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-inserthyperlink', + iconCls : 'toolbar__icon btn-inserthyperlink', caption : me.capInsertHyperlink, lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.selShape, _set.cantHyperlink, _set.multiselect, _set.lostConnect, _set.coAuth, _set.editPivot] }); @@ -666,7 +673,7 @@ define([ me.btnInsertChart = new Common.UI.Button({ id : 'tlbtn-insertchart', cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-insertchart', + iconCls : 'toolbar__icon btn-insertchart', lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set.coAuthText], caption : me.capInsertChart, menu : true @@ -675,7 +682,7 @@ define([ me.btnInsertShape = new Common.UI.Button({ id : 'tlbtn-insertshape', cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-insertshape', + iconCls : 'toolbar__icon btn-insertshape', enableToggle: true, caption : me.capInsertShape, lock : [_set.editCell, _set.lostConnect, _set.coAuth], @@ -685,7 +692,7 @@ define([ me.btnInsertText = new Common.UI.Button({ id : 'tlbtn-inserttext', cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-text', + iconCls : 'toolbar__icon btn-text', caption : me.capInsertText, lock : [_set.editCell, _set.lostConnect, _set.coAuth], enableToggle: true @@ -694,7 +701,7 @@ define([ me.btnInsertTextArt = new Common.UI.Button({ id : 'tlbtn-inserttextart', cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-textart', + iconCls : 'toolbar__icon btn-textart', caption : me.capInsertTextart, lock : [_set.editCell, _set.lostConnect, _set.coAuth], menu : new Common.UI.Menu({ @@ -708,17 +715,25 @@ define([ me.btnInsertEquation = new Common.UI.Button({ id : 'tlbtn-insertequation', cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-insertequation', + iconCls : 'toolbar__icon btn-insertequation', caption : me.capInsertEquation, split : true, lock : [_set.editCell, _set.lostConnect, _set.coAuth], menu : new Common.UI.Menu({cls: 'menu-shapes'}) }); + me.btnInsertSymbol = new Common.UI.Button({ + id: 'tlbtn-insertsymbol', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-symbol', + caption: me.capBtnInsSymbol, + lock: [_set.selImage, _set.selChart, _set.selShape, _set.editFormula, _set.selRangeEdit, _set.coAuth, _set.coAuthText, _set.lostConnect] + }); + me.btnTableTemplate = new Common.UI.Button({ id : 'id-toolbar-btn-ttempl', cls : 'btn-toolbar', - iconCls : 'btn-ttempl', + iconCls : 'toolbar__icon btn-menu-table', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter], menu : new Common.UI.Menu({ items: [ @@ -730,7 +745,7 @@ define([ me.btnInsertTable = new Common.UI.Button({ id : 'tlbtn-inserttable', cls : 'btn-toolbar x-huge icon-top', - iconCls : 'btn-inserttable', + iconCls : 'toolbar__icon btn-inserttable', caption : me.capInsertTable, lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set.ruleMerge, _set.editPivot] }); @@ -797,7 +812,7 @@ define([ me.btnPercentStyle = new Common.UI.Button({ id : 'id-toolbar-btn-percent-style', cls : 'btn-toolbar', - iconCls : 'btn-percent-style', + iconCls : 'toolbar__icon btn-percent-style', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth], styleName : 'Percent' }); @@ -805,7 +820,7 @@ define([ me.btnCurrencyStyle = new Common.UI.Button({ id : 'id-toolbar-btn-accounting-style', cls : 'btn-toolbar', - iconCls : 'btn-currency-style', + iconCls : 'toolbar__icon btn-currency-style', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth], styleName : 'Currency', split : true, @@ -843,21 +858,21 @@ define([ me.btnDecDecimal = new Common.UI.Button({ id : 'id-toolbar-btn-decdecimal', cls : 'btn-toolbar', - iconCls : 'btn-decdecimal', + iconCls : 'toolbar__icon btn-decdecimal', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth] }); me.btnIncDecimal = new Common.UI.Button({ id : 'id-toolbar-btn-incdecimal', cls : 'btn-toolbar', - iconCls : 'btn-incdecimal', + iconCls : 'toolbar__icon btn-incdecimal', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth] }); me.btnInsertFormula = new Common.UI.Button({ id : 'id-toolbar-btn-insertformula', cls : 'btn-toolbar', - iconCls : 'btn-formula', + iconCls : 'toolbar__icon btn-formula', split : true, lock : [_set.editText, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.selRangeEdit, _set.lostConnect, _set.coAuth], menu : new Common.UI.Menu({ @@ -879,7 +894,7 @@ define([ me.btnNamedRange = new Common.UI.Button({ id : 'id-toolbar-btn-insertrange', cls : 'btn-toolbar', - iconCls : 'btn-named-range', + iconCls : 'toolbar__icon btn-named-range', lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.selRangeEdit], menu : new Common.UI.Menu({ style : 'min-width: 110px', @@ -905,7 +920,7 @@ define([ me.btnClearStyle = new Common.UI.Button({ id : 'id-toolbar-btn-clear', cls : 'btn-toolbar', - iconCls : 'btn-clearstyle', + iconCls : 'toolbar__icon btn-clearstyle', lock : [_set.lostConnect, _set.coAuth, _set.selRangeEdit], menu : new Common.UI.Menu({ style : 'min-width: 110px', @@ -942,7 +957,7 @@ define([ me.btnCopyStyle = new Common.UI.Button({ id : 'id-toolbar-btn-copystyle', cls : 'btn-toolbar', - iconCls : 'btn-copystyle', + iconCls : 'toolbar__icon btn-copystyle', lock : [_set.editCell, _set.lostConnect, _set.coAuth, _set.selChart], enableToggle: true }); @@ -950,7 +965,7 @@ define([ me.btnAddCell = new Common.UI.Button({ id : 'id-toolbar-btn-addcell', cls : 'btn-toolbar', - iconCls : 'btn-addcell', + iconCls : 'toolbar__icon btn-addcell', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth], menu : new Common.UI.Menu({ items : [ @@ -977,7 +992,7 @@ define([ me.btnDeleteCell = new Common.UI.Button({ id : 'id-toolbar-btn-delcell', cls : 'btn-toolbar', - iconCls : 'btn-delcell', + iconCls : 'toolbar__icon btn-delcell', lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth], menu : new Common.UI.Menu({ items : [ @@ -1004,7 +1019,7 @@ define([ me.btnColorSchemas = new Common.UI.Button({ id : 'id-toolbar-btn-colorschemas', cls : 'btn-toolbar', - iconCls : 'btn-colorschemas', + iconCls : 'toolbar__icon toolbar__icon btn-colorschemas', lock : [_set.editCell, _set.lostConnect, _set.coAuth], menu : new Common.UI.Menu({ items: [], @@ -1012,97 +1027,6 @@ define([ }) }); - // Is unique for the short view - - me.btnHorizontalAlign = new Common.UI.Button({ - id : 'id-toolbar-btn-halign', - cls : 'btn-toolbar', - iconCls : 'btn-align-left', - icls : 'btn-align-left', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.lostConnect, _set.coAuth, _set.coAuthText], - menu : new Common.UI.Menu({ - items: [ - { - caption : me.tipAlignLeft, - iconCls : 'mnu-align-left', - icls : 'btn-align-left', - checkable : true, - allowDepress: true, - toggleGroup : 'halignGroup', - checked : true, - value : AscCommon.align_Left - }, - { - caption : me.tipAlignCenter, - iconCls : 'mnu-align-center', - icls : 'btn-align-center', - checkable : true, - allowDepress: true, - toggleGroup : 'halignGroup', - value : AscCommon.align_Center - }, - { - caption : me.tipAlignRight, - iconCls : 'mnu-align-right', - icls : 'btn-align-right', - checkable : true, - allowDepress: true, - toggleGroup : 'halignGroup', - value : AscCommon.align_Right - }, - { - caption : me.tipAlignJust, - iconCls : 'mnu-align-just', - icls : 'btn-align-just', - checkable : true, - allowDepress: true, - toggleGroup : 'halignGroup', - value : AscCommon.align_Justify - } - ] - }) - }); - - me.btnVerticalAlign = new Common.UI.Button({ - id : 'id-toolbar-btn-valign', - cls : 'btn-toolbar', - iconCls : 'btn-valign-bottom', - icls : 'btn-valign-bottom', - lock : [_set.editCell, _set.selChart, _set.selChartText, _set.lostConnect, _set.coAuth, _set.coAuthText], - menu : new Common.UI.Menu({ - items: [ - { - caption : me.tipAlignTop, - iconCls : 'mnu-valign-top', - icls : 'btn-valign-top', - checkable : true, - allowDepress: true, - toggleGroup : 'valignGroup', - value : Asc.c_oAscVAlign.Top - }, - { - caption : me.tipAlignMiddle, - iconCls : 'mnu-valign-middle', - icls : 'btn-valign-middle', - checkable : true, - allowDepress: true, - toggleGroup : 'valignGroup', - value : Asc.c_oAscVAlign.Center - }, - { - caption : me.tipAlignBottom, - iconCls : 'mnu-valign-bottom', - icls : 'btn-valign-bottom', - checkable : true, - allowDepress: true, - checked : true, - toggleGroup : 'valignGroup', - value : Asc.c_oAscVAlign.Bottom - } - ] - }) - }); - var hidetip = Common.localStorage.getItem("sse-hide-synch"); me.showSynchTip = !(hidetip && parseInt(hidetip) == 1); // me.needShowSynchTip = false; @@ -1110,7 +1034,7 @@ define([ me.btnPageOrient = new Common.UI.Button({ id: 'tlbtn-pageorient', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-pageorient', + iconCls: 'toolbar__icon btn-pageorient', caption: me.capBtnPageOrient, lock : [_set.docPropsLock, _set.lostConnect, _set.coAuth], menu: new Common.UI.Menu({ @@ -1118,15 +1042,17 @@ define([ items: [ { caption: me.textPortrait, - iconCls: 'mnu-orient-portrait', + iconCls: 'menu__icon page-portrait', checkable: true, + checkmark: false, toggleGroup: 'menuOrient', value: Asc.c_oAscPageOrientation.PagePortrait }, { caption: me.textLandscape, - iconCls: 'mnu-orient-landscape', + iconCls: 'menu__icon page-landscape', checkable: true, + checkmark: false, toggleGroup: 'menuOrient', value: Asc.c_oAscPageOrientation.PageLandscape } @@ -1145,7 +1071,7 @@ define([ me.btnPageMargins = new Common.UI.Button({ id: 'tlbtn-pagemargins', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-pagemargins', + iconCls: 'toolbar__icon btn-pagemargins', caption: me.capBtnMargins, lock : [_set.docPropsLock, _set.lostConnect, _set.coAuth], menu: new Common.UI.Menu({ @@ -1190,7 +1116,7 @@ define([ me.btnPageSize = new Common.UI.Button({ id: 'tlbtn-pagesize', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-pagesize', + iconCls: 'toolbar__icon btn-pagesize', caption: me.capBtnPageSize, lock : [_set.docPropsLock, _set.lostConnect, _set.coAuth], menu: new Common.UI.Menu({ @@ -1309,7 +1235,7 @@ define([ me.btnPrintArea = new Common.UI.Button({ id: 'tlbtn-printarea', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-print-area', + iconCls: 'toolbar__icon btn-print-area', caption: me.capBtnPrintArea, lock : [_set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.editCell, _set.selRangeEdit, _set.printAreaLock, _set.lostConnect, _set.coAuth], menu: new Common.UI.Menu({ @@ -1340,64 +1266,81 @@ define([ 'data-stopPropagation="true"', '<% } %>', '>', '', - '', + '', '', - '', + '', '
    ' ].join('')), stopPropagation: true, - toggleGroup: 'menuScale', - checkable: true, value: 4 }); me.btnScale = new Common.UI.Button({ id: 'tlbtn-scale', cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-scale', + iconCls: 'toolbar__icon btn-scale', caption: me.capBtnScale, lock: [_set.docPropsLock, _set.lostConnect, _set.coAuth], menu: new Common.UI.Menu({ - items: [ - { - caption: me.textActualSize, - checkable: true, - toggleGroup: 'menuScale', - value: 0 - }, - { - caption: me.textFitSheetOnOnePage, - checkable: true, - toggleGroup: 'menuScale', - value: 1 - }, - { - caption: me.textFitAllColumnsOnOnePage, - checkable: true, - toggleGroup: 'menuScale', - value: 2 - }, - { - caption: me.textFitAllRowsOnOnePage, - checkable: true, - toggleGroup: 'menuScale', - value: 3 - }, - me.mnuCustomScale, - {caption: '--'}, - { caption: me.textScaleCustom, - checkable: true, - toggleGroup: 'menuScale', - value: 5 - } - ]}) + items: [], + cls: 'scale-menu'}) }); + var menuWidthItem = new Common.UI.MenuItem({ + caption: me.textWidth, + menu: new Common.UI.Menu({ + menuAlign: 'tl-tr', + items: [ + {caption: this.textAuto, value: 0, checkable: true, toggleGroup : 'scaleWidth'}, + {caption: '1 ' + this.textOnePage, value: 1, checkable: true, toggleGroup : 'scaleWidth'}, + {caption: '2 ' + this.textFewPages, value: 2, checkable: true, toggleGroup : 'scaleWidth'}, + {caption: '3 ' + this.textFewPages, value: 3, checkable: true, toggleGroup : 'scaleWidth'}, + {caption: '4 ' + this.textFewPages, value: 4, checkable: true, toggleGroup : 'scaleWidth'}, + {caption: '5 ' + this.textManyPages, value: 5, checkable: true, toggleGroup : 'scaleWidth'}, + {caption: '6 ' + this.textManyPages, value: 6, checkable: true, toggleGroup : 'scaleWidth'}, + {caption: '7 ' + this.textManyPages, value: 7, checkable: true, toggleGroup : 'scaleWidth'}, + {caption: '8 ' + this.textManyPages, value: 8, checkable: true, toggleGroup : 'scaleWidth'}, + {caption: '9 ' + this.textManyPages, value: 9, checkable: true, toggleGroup : 'scaleWidth'}, + {caption: '--'}, + {caption: this.textMorePages, value: 'more', checkable: true, toggleGroup : 'scaleWidth'} + ] + }) + }); + var menuHeightItem = new Common.UI.MenuItem({ + caption: me.textHeight, + menu: new Common.UI.Menu({ + menuAlign: 'tl-tr', + items: [ + {caption: this.textAuto, value: 0, checkable: true, toggleGroup : 'scaleHeight'}, + {caption: '1 ' + this.textOnePage, value: 1, checkable: true, toggleGroup : 'scaleHeight'}, + {caption: '2 ' + this.textFewPages, value: 2, checkable: true, toggleGroup : 'scaleHeight'}, + {caption: '3 ' + this.textFewPages, value: 3, checkable: true, toggleGroup : 'scaleHeight'}, + {caption: '4 ' + this.textFewPages, value: 4, checkable: true, toggleGroup : 'scaleHeight'}, + {caption: '5 ' + this.textManyPages, value: 5, checkable: true, toggleGroup : 'scaleHeight'}, + {caption: '6 ' + this.textManyPages, value: 6, checkable: true, toggleGroup : 'scaleHeight'}, + {caption: '7 ' + this.textManyPages, value: 7, checkable: true, toggleGroup : 'scaleHeight'}, + {caption: '8 ' + this.textManyPages, value: 8, checkable: true, toggleGroup : 'scaleHeight'}, + {caption: '9 ' + this.textManyPages, value: 9, checkable: true, toggleGroup : 'scaleHeight'}, + {caption: '--'}, + {caption: this.textMorePages, value: 'more', checkable: true, toggleGroup : 'scaleHeight'} + ] + }) + }); + me.btnScale.menu.addItem(menuWidthItem); + me.btnScale.menu.addItem(menuHeightItem); + me.btnScale.menu.addItem(me.mnuCustomScale); + me.btnScale.menu.addItem({caption: '--'}); + me.btnScale.menu.addItem( + { caption: me.textScaleCustom, value: 'custom' + }); + me.menuWidthScale = me.btnScale.menu.items[0].menu; + me.menuHeightScale = me.btnScale.menu.items[1].menu; + me.mnuScale = me.btnScale.menu; me.mnuScale.on('show:after', _.bind(me.onAfterShowMenuScale, me)); me.btnImgAlign = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-img-align', + iconCls: 'toolbar__icon btn-img-align', caption: me.capImgAlign, lock : [_set.selRange, _set.selRangeEdit, _set.cantGroup, _set.lostConnect, _set.coAuth, _set.coAuthText], menu: true @@ -1405,14 +1348,14 @@ define([ me.btnImgGroup = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-img-group', + iconCls: 'toolbar__icon btn-img-group', caption: me.capImgGroup, lock : [_set.selRange, _set.selRangeEdit, _set.cantGroupUngroup, _set.lostConnect, _set.coAuth, _set.coAuthText], menu: true }); me.btnImgForward = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-img-frwd', + iconCls: 'toolbar__icon btn-img-frwd', caption: me.capImgForward, split: true, lock : [_set.selRange, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set.coAuthText], @@ -1420,7 +1363,7 @@ define([ }); me.btnImgBackward = new Common.UI.Button({ cls: 'btn-toolbar x-huge icon-top', - iconCls: 'btn-img-bkwd', + iconCls: 'toolbar__icon btn-img-bkwd', caption: me.capImgBackward, lock : [_set.selRange, _set.selRangeEdit, _set.lostConnect, _set.coAuth, _set.coAuthText], split: true, @@ -1436,14 +1379,14 @@ define([ } ); } - + me.lockControls = []; if (config.isEdit) { me.lockControls = [ me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold, - me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft, - me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnVerticalAlign, me.btnAlignTop, + me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, me.btnTextColor, me.btnAlignLeft, + me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnAlignTop, me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnInsertTable, - me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation, + me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation, me.btnInsertSymbol, me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell, me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink, @@ -1473,7 +1416,7 @@ define([ } if (!me.itemCustomScale) { me.itemCustomScale = $('.custom-scale', me.mnuCustomScale.$el).on('click', _.bind(function () { - me.fireEvent('click:customscale', [undefined, undefined, undefined, me.valueCustomScale], this); + me.fireEvent('click:customscale', ['scale', undefined, undefined, undefined, me.valueCustomScale], this); }, this)); } if (!me.btnCustomScaleUp) { @@ -1492,6 +1435,7 @@ define([ me.fireEvent('change:scalespn', ['down', me.valueCustomScale], this); }, this)); } + SSE.getController('Toolbar').onChangeScaleSettings(); }, setValueCustomScale: function(val) { @@ -1618,6 +1562,7 @@ define([ _injectComponent('#slot-btn-instext', this.btnInsertText); _injectComponent('#slot-btn-instextart', this.btnInsertTextArt); _injectComponent('#slot-btn-insequation', this.btnInsertEquation); + _injectComponent('#slot-btn-inssymbol', this.btnInsertSymbol); _injectComponent('#slot-btn-sortdesc', this.btnSortDown); _injectComponent('#slot-btn-sortasc', this.btnSortUp); _injectComponent('#slot-btn-setfilter', this.btnSetAutofilter); @@ -1648,13 +1593,10 @@ define([ _injectComponent('#slot-img-movefrwd', this.btnImgForward); _injectComponent('#slot-img-movebkwd', this.btnImgBackward); _injectComponent('#slot-btn-scale', this.btnScale); - this.btnsEditHeader = Common.Utils.injectButtons($host.find('.slot-editheader'), 'tlbtn-editheader-', 'btn-editheader', this.capBtnInsHeader, + this.btnsEditHeader = Common.Utils.injectButtons($host.find('.slot-editheader'), 'tlbtn-editheader-', 'toolbar__icon btn-editheader', this.capBtnInsHeader, [SSE.enumLock.editCell, SSE.enumLock.selRangeEdit, SSE.enumLock.headerLock, SSE.enumLock.lostConnect, SSE.enumLock.coAuth]); Array.prototype.push.apply(this.lockControls, this.btnsEditHeader); - // replacePlacholder('#id-toolbar-short-placeholder-btn-halign', this.btnHorizontalAlign); - // replacePlacholder('#id-toolbar-short-placeholder-btn-valign', this.btnVerticalAlign); - return $host; }, @@ -1700,6 +1642,7 @@ define([ _updateHint(this.btnInsertHyperlink, this.tipInsertHyperlink + Common.Utils.String.platformKey('Ctrl+K')); _updateHint(this.btnInsertShape, this.tipInsertShape); _updateHint(this.btnInsertEquation, this.tipInsertEquation); + _updateHint(this.btnInsertSymbol, this.tipInsertSymbol); _updateHint(this.btnSortDown, this.txtSortAZ); _updateHint(this.btnSortUp, this.txtSortZA); _updateHint(this.btnSetAutofilter, this.txtFilter + ' (Ctrl+Shift+L)'); @@ -1717,8 +1660,6 @@ define([ _updateHint(this.btnAddCell, this.tipInsertOpt); _updateHint(this.btnDeleteCell, this.tipDeleteOpt); _updateHint(this.btnColorSchemas, this.tipColorSchemas); - _updateHint(this.btnHorizontalAlign, this.tipHAligh); - _updateHint(this.btnVerticalAlign, this.tipVAligh); _updateHint(this.btnPageOrient, this.tipPageOrient); _updateHint(this.btnPageSize, this.tipPageSize); _updateHint(this.btnPageMargins, this.tipPageMargins); @@ -1734,74 +1675,74 @@ define([ items: [ { caption : this.textOutBorders, - iconCls : 'mnu-border-out', + iconCls : 'menu__icon btn-border-out', icls : 'btn-border-out', borderId : 'outer' }, { caption : this.textAllBorders, - iconCls : 'mnu-border-all', + iconCls : 'menu__icon btn-border-all', icls : 'btn-border-all', borderId : 'all' }, { caption : this.textTopBorders, - iconCls : 'mnu-border-top', + iconCls : 'menu__icon btn-border-top', icls : 'btn-border-top', borderId : Asc.c_oAscBorderOptions.Top }, { caption : this.textBottomBorders, - iconCls : 'mnu-border-bottom', + iconCls : 'menu__icon btn-border-bottom', icls : 'btn-border-bottom', borderId : Asc.c_oAscBorderOptions.Bottom }, { caption : this.textLeftBorders, - iconCls : 'mnu-border-left', + iconCls : 'menu__icon btn-border-left', icls : 'btn-border-left', borderId : Asc.c_oAscBorderOptions.Left }, { caption : this.textRightBorders, - iconCls : 'mnu-border-right', + iconCls : 'menu__icon btn-border-right', icls : 'btn-border-right', borderId : Asc.c_oAscBorderOptions.Right }, { caption : this.textNoBorders, - iconCls : 'mnu-border-no', + iconCls : 'menu__icon btn-border-no', icls : 'btn-border-no', borderId : 'none' }, {caption: '--'}, { caption : this.textInsideBorders, - iconCls : 'mnu-border-center', + iconCls : 'menu__icon btn-border-inside', icls : 'btn-border-center', borderId : 'inner' }, { caption : this.textCenterBorders, - iconCls : 'mnu-border-vmiddle', + iconCls : 'menu__icon btn-border-insidevert', icls : 'btn-border-vmiddle', borderId : Asc.c_oAscBorderOptions.InnerV }, { caption : this.textMiddleBorders, - iconCls : 'mnu-border-hmiddle', + iconCls : 'menu__icon btn-border-insidehor', icls : 'btn-border-hmiddle', borderId : Asc.c_oAscBorderOptions.InnerH }, { caption : this.textDiagUpBorder, - iconCls : 'mnu-border-diagup', + iconCls : 'menu__icon btn-border-diagup', icls : 'btn-border-diagup', borderId : Asc.c_oAscBorderOptions.DiagU }, { caption : this.textDiagDownBorder, - iconCls : 'mnu-border-diagdown', + iconCls : 'menu__icon btn-border-diagdown', icls : 'btn-border-diagdown', borderId : Asc.c_oAscBorderOptions.DiagD }, @@ -1809,8 +1750,8 @@ define([ { id : 'id-toolbar-mnu-item-border-width', caption : this.textBordersStyle, - iconCls : 'mnu-icon-item mnu-border-width', - template : _.template('<%= caption %>'), + iconCls : 'menu__icon btn-border-style', + // template : _.template('<%= caption %>'), menu : (function(){ var itemTemplate = _.template('
    '); @@ -1875,53 +1816,8 @@ define([ parentMenu: menu, showLast: false, restoreHeight: 421, - groups: new Common.UI.DataViewGroupStore([ - {id: 'menu-chart-group-bar', caption: me.textColumn, headername: me.textCharts}, - {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, inline: true}, - {id: 'menu-chart-group-scatter', caption: me.textPoint, inline: true}, - {id: 'menu-chart-group-stock', caption: me.textStock, inline: true} - // { id: 'menu-chart-group-surface', caption: me.textSurface} - // ,{ id: 'menu-chart-group-sparkcolumn', inline: true, headername: me.textSparks }, - // { id: 'menu-chart-group-sparkline', inline: true }, - // { id: 'menu-chart-group-sparkwin', inline: true } - ]), - store: new Common.UI.DataViewStore([ - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal, iconCls: 'column-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked, iconCls: 'column-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer, iconCls: 'column-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3d, iconCls: 'column-3d-normal'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStacked3d, iconCls: 'column-3d-stack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barStackedPer3d, iconCls: 'column-3d-pstack'}, - { group: 'menu-chart-group-bar', type: Asc.c_oAscChartTypeSettings.barNormal3dPerspective, iconCls: 'column-3d-normal-per'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineNormal, iconCls: 'line-normal'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStacked, iconCls: 'line-stack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.lineStackedPer, iconCls: 'line-pstack'}, - { group: 'menu-chart-group-line', type: Asc.c_oAscChartTypeSettings.line3d, iconCls: 'line-3d'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie, iconCls: 'pie-normal'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.doughnut, iconCls: 'pie-doughnut'}, - { group: 'menu-chart-group-pie', type: Asc.c_oAscChartTypeSettings.pie3d, iconCls: 'pie-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal, iconCls: 'bar-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked, iconCls: 'bar-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer, iconCls: 'bar-pstack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarNormal3d, iconCls: 'bar-3d-normal'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStacked3d, iconCls: 'bar-3d-stack'}, - { group: 'menu-chart-group-hbar', type: Asc.c_oAscChartTypeSettings.hBarStackedPer3d, iconCls: 'bar-3d-pstack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaNormal, iconCls: 'area-normal'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStacked, iconCls: 'area-stack'}, - { group: 'menu-chart-group-area', type: Asc.c_oAscChartTypeSettings.areaStackedPer, iconCls: 'area-pstack'}, - { group: 'menu-chart-group-scatter', type: Asc.c_oAscChartTypeSettings.scatter, iconCls: 'point-normal'}, - { group: 'menu-chart-group-stock', type: Asc.c_oAscChartTypeSettings.stock, iconCls: 'stock-normal'} - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceNormal, iconCls: 'surface-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.surfaceWireframe, iconCls: 'surface-wireframe'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourNormal, iconCls: 'contour-normal'}, - // { group: 'menu-chart-group-surface', type: Asc.c_oAscChartTypeSettings.contourWireframe, iconCls: 'contour-wireframe'} - // ,{ group: 'menu-chart-group-sparkcolumn', type: Asc.c_oAscSparklineType.Column, allowSelected: true, iconCls: 'spark-column', tip: me.textColumnSpark}, - // { group: 'menu-chart-group-sparkline', type: Asc.c_oAscSparklineType.Line, allowSelected: true, iconCls: 'spark-line', tip: me.textLineSpark}, - // { group: 'menu-chart-group-sparkwin', type: Asc.c_oAscSparklineType.Stacked, allowSelected: true, iconCls: 'spark-win', tip: me.textWinLossSpark} - ]), + groups: new Common.UI.DataViewGroupStore(Common.define.chartData.getChartGroupData(true)/*.concat(Common.define.chartData.getSparkGroupData(true))*/), + store: new Common.UI.DataViewStore(Common.define.chartData.getChartData()/*.concat(Common.define.chartData.getSparkData())*/), itemTemplate: _.template('
    ') }); picker.on('item:click', function (picker, item, record, e) { @@ -2104,7 +2000,7 @@ define([ } this._state.hasCollaborativeChanges = true; - this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass('btn-synch'); + this.btnCollabChanges.cmpEl.addClass('notify'); if (this.showSynchTip){ this.btnCollabChanges.updateHint(''); @@ -2141,8 +2037,8 @@ define([ if (this.btnCollabChanges.rendered) { var me = this; - if ( me.btnCollabChanges.$icon.hasClass('btn-synch') ) { - me.btnCollabChanges.$icon.removeClass('btn-synch').addClass(this.btnSaveCls); + if ( me.btnCollabChanges.cmpEl.hasClass('notify') ) { + me.btnCollabChanges.cmpEl.removeClass('notify'); if (this.synchTooltip) this.synchTooltip.hide(); this.btnCollabChanges.updateHint(this.btnSaveTip); @@ -2164,11 +2060,8 @@ define([ var cls = (length>1) ? 'btn-save-coauth' : 'btn-save'; if (cls !== this.btnSaveCls && this.btnCollabChanges.rendered) { this.btnSaveTip = ((length>1) ? this.tipSaveCoauth : this.tipSave )+ Common.Utils.String.platformKey('Ctrl+S'); - - if ( !this.btnCollabChanges.$icon.hasClass('btn-synch') ) { - this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(cls); - this.btnCollabChanges.updateHint(this.btnSaveTip); - } + this.btnCollabChanges.updateHint(this.btnSaveTip); + this.btnCollabChanges.$icon.removeClass(this.btnSaveCls).addClass(cls); this.btnSaveCls = cls; } }, @@ -2182,11 +2075,11 @@ define([ me.btnImgForward.setMenu(new Common.UI.Menu({ items: [{ caption : _holder_view.textArrangeFront, - iconCls : 'mnu-arrange-front', + iconCls : 'menu__icon arrange-front', value : Asc.c_oAscDrawingLayerType.BringToFront }, { caption : _holder_view.textArrangeForward, - iconCls : 'mnu-arrange-forward', + iconCls : 'menu__icon arrange-forward', value : Asc.c_oAscDrawingLayerType.BringForward } ]}) @@ -2196,11 +2089,11 @@ define([ me.btnImgBackward.setMenu(new Common.UI.Menu({ items: [{ caption : _holder_view.textArrangeBack, - iconCls : 'mnu-arrange-back', + iconCls : 'menu__icon arrange-back', value : Asc.c_oAscDrawingLayerType.SendToBack }, { caption : _holder_view.textArrangeBackward, - iconCls : 'mnu-arrange-backward', + iconCls : 'menu__icon arrange-backward', value : Asc.c_oAscDrawingLayerType.SendBackward }] })); @@ -2209,38 +2102,38 @@ define([ me.btnImgAlign.setMenu(new Common.UI.Menu({ items: [{ caption : _holder_view.textShapeAlignLeft, - iconCls : 'mnu-img-align-left', + iconCls : 'menu__icon shape-align-left', value : 0 }, { caption : _holder_view.textShapeAlignCenter, - iconCls : 'mnu-img-align-center', + iconCls : 'menu__icon shape-align-center', value : 4 }, { caption : _holder_view.textShapeAlignRight, - iconCls : 'mnu-img-align-right', + iconCls : 'menu__icon shape-align-right', value : 1 }, { caption : _holder_view.textShapeAlignTop, - iconCls : 'mnu-img-align-top', + iconCls : 'menu__icon shape-align-top', value : 3 }, { caption : _holder_view.textShapeAlignMiddle, - iconCls : 'mnu-img-align-middle', + iconCls : 'menu__icon shape-align-middle', value : 5 }, { caption : _holder_view.textShapeAlignBottom, - iconCls : 'mnu-img-align-bottom', + iconCls : 'menu__icon shape-align-bottom', value : 2 }, {caption: '--'}, { caption: _holder_view.txtDistribHor, - iconCls: 'mnu-distrib-hor', + iconCls: 'menu__icon shape-distribute-hor', value: 6 }, { caption: _holder_view.txtDistribVert, - iconCls: 'mnu-distrib-vert', + iconCls: 'menu__icon shape-distribute-vert', value: 7 }] })); @@ -2249,11 +2142,11 @@ define([ me.btnImgGroup.setMenu(new Common.UI.Menu({ items: [{ caption : _holder_view.txtGroup, - iconCls : 'mnu-group', + iconCls : 'menu__icon shape-group', value: 'grouping' }, { caption : _holder_view.txtUngroup, - iconCls : 'mnu-ungroup', + iconCls : 'menu__icon shape-ungroup', value: 'ungrouping' }] })); @@ -2281,8 +2174,6 @@ define([ tipClearStyle: 'Clear', tipCopyStyle: 'Copy Style', tipBack: 'Back', - tipHAligh: 'Horizontal Align', - tipVAligh: 'Vertical Align', tipAlignLeft: 'Align Left', tipAlignRight: 'Align Right', tipAlignCenter: 'Align Center', @@ -2421,19 +2312,7 @@ define([ txtManageRange: 'Name manager', txtPasteRange: 'Paste name', textInsCharts: 'Charts', - textLine: 'Line', - textColumn: 'Column', - textBar: 'Bar', - textArea: 'Area', - textPie: 'Pie', - textPoint: 'XY (Scatter)', - textStock: 'Stock', - textLineSpark: 'Line', - textColumnSpark: 'Column', - textWinLossSpark: 'Win/Loss', tipInsertEquation: 'Insert Equation', - textCharts: 'Charts', - textSparks: 'Sparklines', tipInsertChartSpark: 'Insert Chart', textMoreFormats: 'More formats', capInsertText: 'Text', @@ -2447,7 +2326,6 @@ define([ textTabFile: 'File', textTabHome: 'Home', textTabInsert: 'Insert', - textSurface: 'Surface', tipChangeChart: 'Change Chart Type', textTabCollaboration: 'Collaboration', textTabProtect: 'Protection', @@ -2482,7 +2360,7 @@ define([ textSetPrintArea: 'Set Print Area', textClearPrintArea: 'Clear Print Area', textAddPrintArea: 'Add to Print Area', - tipPrintArea: 'Print Area', + tipPrintArea: 'Print area', capBtnInsHeader: 'Header/Footer', tipEditHeader: 'Edit header or footer', textTabData: 'Data', @@ -2496,6 +2374,16 @@ define([ textFitAllColumnsOnOnePage: 'Fit All Columns on One Page', textFitAllRowsOnOnePage: 'Fit All Rows on One Page', textScaleCustom: 'Custom', - textScale: 'Scale' + textScale: 'Scale', + textAuto: 'Auto', + textOnePage: 'page', + textFewPages: 'pages', + textManyPages: 'pages', + textHeight: 'Height', + textWidth: 'Width', + textMorePages: 'More pages', + capBtnAddComment: 'Add Comment', + capBtnInsSymbol: 'Symbol', + tipInsertSymbol: 'Insert symbol' }, SSE.Views.Toolbar || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/index.html b/apps/spreadsheeteditor/main/index.html index 162407c61..b77340bb8 100644 --- a/apps/spreadsheeteditor/main/index.html +++ b/apps/spreadsheeteditor/main/index.html @@ -22,13 +22,14 @@ .loadmask > .brendpanel { width: 100%; - height: 56px; + min-height: 32px; background: #40865c; } .loadmask > .brendpanel > div { display: flex; align-items: center; + height: 28px; } .loadmask > .brendpanel .loading-logo { @@ -48,20 +49,6 @@ margin-left: auto; } - .loadmask > .brendpanel .circle { - vertical-align: middle; - width: 20px; - height: 20px; - border-radius: 12px; - margin: 4px 10px; - background: rgba(255, 255, 255, 0.2); - - -webkit-animation: flickerAnimation 2s infinite ease-in-out; - -moz-animation: flickerAnimation 2s infinite ease-in-out; - -o-animation: flickerAnimation 2s infinite ease-in-out; - animation: flickerAnimation 2s infinite ease-in-out; - } - .loadmask > .brendpanel .rect { vertical-align: middle; width: 50px; @@ -69,15 +56,10 @@ border-radius: 3px; margin: 0 10px; background: rgba(255, 255, 255, 0.2); - - -webkit-animation: flickerAnimation 2s infinite ease-in-out; - -moz-animation: flickerAnimation 2s infinite ease-in-out; - -o-animation: flickerAnimation 2s infinite ease-in-out; - animation: flickerAnimation 2s infinite ease-in-out; } .loadmask > .sktoolbar { - background: #fafafa; + background: #f1f1f1; height: 46px; padding: 10px 12px; box-sizing: content-box; @@ -88,11 +70,6 @@ padding: 0; white-space: nowrap; position: relative; - - -webkit-animation: flickerAnimation 2s infinite ease-in-out; - -moz-animation: flickerAnimation 2s infinite ease-in-out; - -o-animation: flickerAnimation 2s infinite ease-in-out; - animation: flickerAnimation 2s infinite ease-in-out; } .loadmask > .sktoolbar li { @@ -136,8 +113,8 @@ width: 100%; height: 100%; display: inline-block; - background: linear-gradient(90deg, #d5d5d5 0px, rgba(0,0,0,0) 1px) 0 0, - linear-gradient(rgba(0,255,0,0) 19px, #d5d5d5 20px) 0 0, + background: linear-gradient(90deg, #d5d5d5 0px, rgba(223,223,223,0) 1px) 0 0, + linear-gradient(rgba(223,223,223,0) 19px, #d5d5d5 20px) 0 0, linear-gradient( #f1f1f1 0px, #f1f1f1 20px) 0 0 repeat-x; background-size: 80px 20px; } @@ -150,22 +127,22 @@ @keyframes flickerAnimation { 0% { opacity:1; } - 50% { opacity:0.3; } + 50% { opacity:0.5; } 100% { opacity:1; } } @-o-keyframes flickerAnimation{ 0% { opacity:1; } - 50% { opacity:0.3; } + 50% { opacity:0.5; } 100% { opacity:1; } } @-moz-keyframes flickerAnimation{ 0% { opacity:1; } - 50% { opacity:0.3; } + 50% { opacity:0.5; } 100% { opacity:1; } } @-webkit-keyframes flickerAnimation{ 0% { opacity:1; } - 50% { opacity:0.3; } + 50% { opacity:0.5; } 100% { opacity:1; } } @@ -230,22 +207,39 @@
    - -
    + +
    -
    -
    +
    - + - + @@ -235,22 +219,39 @@
    - -
    + +
    -
    -
    +
    - + - + - + - +