diff --git a/apps/api/documents/api.js b/apps/api/documents/api.js index c592dd587..a0b649635 100644 --- a/apps/api/documents/api.js +++ b/apps/api/documents/api.js @@ -189,6 +189,7 @@ _config.editorConfig.canHistoryRestore = _config.events && !!_config.events.onRequestRestore; _config.editorConfig.canSendEmailAddresses = _config.events && !!_config.events.onRequestEmailAddresses; _config.editorConfig.canRequestEditRights = _config.events && !!_config.events.onRequestEditRights; + _config.editorConfig.canRequestClose = _config.events && !!_config.events.onRequestClose; _config.frameEditorId = placeholderId; _config.events && !!_config.events.onReady && console.log("Obsolete: The onReady event is deprecated. Please use onAppReady instead."); diff --git a/apps/common/Gateway.js b/apps/common/Gateway.js index 71d36ecc1..5e06dbdd8 100644 --- a/apps/common/Gateway.js +++ b/apps/common/Gateway.js @@ -250,6 +250,10 @@ if (Common === undefined) { _postMessage({ event: 'onDocumentReady' }); }, + requestClose: function() { + _postMessage({event: 'onRequestClose'}); + }, + on: function(event, handler){ var localHandler = function(event, data){ handler.call(me, data) diff --git a/apps/common/main/lib/component/Window.js b/apps/common/main/lib/component/Window.js index acfec692b..e4387beaa 100644 --- a/apps/common/main/lib/component/Window.js +++ b/apps/common/main/lib/component/Window.js @@ -191,7 +191,10 @@ define([ event.preventDefault(); event.stopPropagation(); if (this.initConfig.closable !== false) { - this.initConfig.toolclose=='hide' ? this.hide() : this.close(); + if (this.initConfig.toolcallback) + this.initConfig.toolcallback.call(this); + else + (this.initConfig.toolclose=='hide') ? this.hide() : this.close(); } return false; } diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index f19778d6f..083b94536 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -219,7 +219,8 @@ define([ appConfig = mode; var me = this; - me.btnGoBack.updateHint(me.textBack); + if ( !me.branding.goback ) + me.btnGoBack.updateHint(me.textBack); me.btnGoBack.on('click', function (e) { Common.NotificationCenter.trigger('goback', true); }); @@ -511,11 +512,17 @@ define([ this.branding = value; - if (value && value.logo && value.logo.image) { - element = $('#header-logo'); - if ( element ) { - element.html(''); - element.css({'background-image': 'none', width: 'auto'}); + if ( value ) { + if ( value.logo && value.logo.image ) { + element = $('#header-logo'); + if (element) { + element.html(''); + element.css({'background-image': 'none', width: 'auto'}); + } + } + + if ( !!value.goback ) { + this.btnGoBack.updateHint(value.goback.text); } } }, diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js index 43a8ddf7f..462f7f028 100644 --- a/apps/common/main/lib/view/OpenDialog.js +++ b/apps/common/main/lib/view/OpenDialog.js @@ -54,14 +54,15 @@ define([ _options = {}; _.extend(_options, { - closable: false, + closable : false, width : 250, height : (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 205 : 155, contentWidth : 390, header : true, cls : 'open-dlg', contentTemplate : '', - title : (options.type == Asc.c_oAscAdvancedOptionsID.DRM) ? t.txtTitleProtected : t.txtTitle.replace('%1', (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 'CSV' : 'TXT') + title : (options.type == Asc.c_oAscAdvancedOptionsID.DRM) ? t.txtTitleProtected : t.txtTitle.replace('%1', (options.type == Asc.c_oAscAdvancedOptionsID.CSV) ? 'CSV' : 'TXT'), + toolcallback : _.bind(t.onToolClose, t) }, options); @@ -84,18 +85,21 @@ define([ '<% } %>', '', '', - '
', '' ].join(''); - this.handler = options.handler; - this.type = options.type; - this.codepages = options.codepages; - this.settings = options.settings; - this.validatePwd = options.validatePwd || false; + this.handler = _options.handler; + this.type = _options.type; + this.closable = _options.closable; + this.codepages = _options.codepages; + this.settings = _options.settings; + this.validatePwd = _options.validatePwd || false; _options.tpl = _.template(this.template)(_options); @@ -106,7 +110,8 @@ define([ if (this.$window) { var me = this; - this.$window.find('.tool').hide(); + if (!this.closable) + this.$window.find('.tool').hide(); this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) { this.inputPwd = new Common.UI.InputField({ @@ -120,11 +125,11 @@ define([ this.$window.find('input').on('keypress', _.bind(this.onKeyPress, this)); } else { this.initCodePages(); - this.onPrimary = function() { - me.onBtnClick(); - return false; - }; } + this.onPrimary = function() { + me._handleInput('ok'); + return false; + }; } }, @@ -141,25 +146,36 @@ define([ } }, - onBtnClick: function (event) { + onKeyPress: function(event) { + if (event.keyCode == Common.UI.Keys.RETURN) { + this._handleInput('ok'); + } else if (this.closable && event.keyCode == Common.UI.Keys.ESC) + this._handleInput('cancel'); + }, + + onBtnClick: function(event) { + this._handleInput(event.currentTarget.attributes['result'].value); + }, + + onToolClose: function() { + this._handleInput('cancel'); + }, + + _handleInput: function(state) { if (this.handler) { if (this.cmbEncoding) { var delimiter = this.cmbDelimiter ? this.cmbDelimiter.getValue() : null, delimiterChar = (delimiter == -1) ? this.inputDelimiter.getValue() : null; (delimiter == -1) && (delimiter = null); this.handler.call(this, this.cmbEncoding.getValue(), delimiter, delimiterChar); - } else - this.handler.call(this, this.inputPwd.getValue()); + } else { + this.handler.call(this, state, this.inputPwd.getValue()); + } } this.close(); }, - onKeyPress: function(event) { - if (event.keyCode == Common.UI.Keys.RETURN) - this.onBtnClick(); - }, - initCodePages: function () { var i, c, codepage, encodedata = [], listItems = [], length = 0; @@ -381,7 +397,8 @@ define([ txtPassword : "Password", txtTitleProtected : "Protected File", txtOther: 'Other', - txtIncorrectPwd: 'Password is incorrect.' + txtIncorrectPwd: 'Password is incorrect.', + closeButtonText: 'Close File' }, Common.Views.OpenDialog || {})); }); \ No newline at end of file diff --git a/apps/common/main/resources/img/controls/toolbarbig.png b/apps/common/main/resources/img/controls/toolbarbig.png index b9f731ba9..f589fa1c3 100644 Binary files a/apps/common/main/resources/img/controls/toolbarbig.png and b/apps/common/main/resources/img/controls/toolbarbig.png differ diff --git a/apps/common/main/resources/img/controls/toolbarbig@2x.png b/apps/common/main/resources/img/controls/toolbarbig@2x.png index a5cc606ce..26977df1a 100644 Binary files a/apps/common/main/resources/img/controls/toolbarbig@2x.png and b/apps/common/main/resources/img/controls/toolbarbig@2x.png differ diff --git a/apps/common/main/resources/less/toolbar.less b/apps/common/main/resources/less/toolbar.less index 50d1f9741..548d4f2ca 100644 --- a/apps/common/main/resources/less/toolbar.less +++ b/apps/common/main/resources/less/toolbar.less @@ -316,3 +316,4 @@ .button-normal-icon(~'x-huge .btn-grand-totals', 52, @toolbar-big-icon-size); .button-normal-icon(~'x-huge .btn-contents', 53, @toolbar-big-icon-size); .button-normal-icon(btn-controls, 54, @toolbar-big-icon-size); +.button-normal-icon(~'x-huge .btn-select-pivot', 55, @toolbar-big-icon-size); diff --git a/apps/documenteditor/main/app/controller/LeftMenu.js b/apps/documenteditor/main/app/controller/LeftMenu.js index 51e78b6db..2180cc6f9 100644 --- a/apps/documenteditor/main/app/controller/LeftMenu.js +++ b/apps/documenteditor/main/app/controller/LeftMenu.js @@ -610,6 +610,8 @@ define([ }, onShortcut: function(s, e) { + if (!this.mode) return; + switch (s) { case 'replace': case 'search': diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index e167c20db..4f46209dd 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -761,6 +761,12 @@ define([ title = this.loadingDocumentTitleText; text = this.loadingDocumentTextText; break; + default: + if (typeof action.id == 'string'){ + title = action.id; + text = action.id; + } + break; } if (action.type == Asc.c_oAscAsyncActionType['BlockInteraction']) { @@ -1066,6 +1072,7 @@ 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 @@ -1862,14 +1869,18 @@ define([ }); } else if (type == Asc.c_oAscAdvancedOptionsID.DRM) { me._state.openDlg = new Common.Views.OpenDialog({ + closable: me.appOptions.canRequestClose, type: type, validatePwd: !!me._state.isDRM, - handler: function (value) { + handler: function (result, value) { me.isShowOpenDialog = false; - if (me && me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value)); - me.loadMask && me.loadMask.show(); - } + if (result == 'ok') { + if (me.api) { + me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value)); + me.loadMask && me.loadMask.show(); + } + } else + Common.Gateway.requestClose(); me._state.openDlg = null; } }); diff --git a/apps/documenteditor/main/app/controller/RightMenu.js b/apps/documenteditor/main/app/controller/RightMenu.js index e8f72db52..196e1a9e0 100644 --- a/apps/documenteditor/main/app/controller/RightMenu.js +++ b/apps/documenteditor/main/app/controller/RightMenu.js @@ -260,6 +260,7 @@ define([ this.rightmenu.paragraphSettings.updateMetricUnit(); this.rightmenu.chartSettings.updateMetricUnit(); this.rightmenu.imageSettings.updateMetricUnit(); + this.rightmenu.tableSettings.updateMetricUnit(); }, createDelayedElements: function() { diff --git a/apps/documenteditor/main/app/template/ShapeSettings.template b/apps/documenteditor/main/app/template/ShapeSettings.template index e0346dc1e..4a4ff30d1 100644 --- a/apps/documenteditor/main/app/template/ShapeSettings.template +++ b/apps/documenteditor/main/app/template/ShapeSettings.template @@ -134,18 +134,18 @@ - +
- +
- +
diff --git a/apps/documenteditor/main/app/template/TableSettings.template b/apps/documenteditor/main/app/template/TableSettings.template index 611f7d811..19e649186 100644 --- a/apps/documenteditor/main/app/template/TableSettings.template +++ b/apps/documenteditor/main/app/template/TableSettings.template @@ -95,14 +95,9 @@ - - - - - - -
-
+ + +
@@ -110,10 +105,31 @@
+ + + + + - -
+ +
+ + + + + +
+ + + + + + + + + + diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index c0705edff..4166d5a2b 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -137,6 +137,8 @@ define([ if (shapeprops) { if (shapeprops.get_FromChart()) menu_props.imgProps.isChart = true; + else if (shapeprops.get_FromImage()) + menu_props.imgProps.isOnlyImg = true; else menu_props.imgProps.isShape = true; } else if ( chartprops ) @@ -1519,6 +1521,7 @@ define([ this.api.asc_registerCallback('asc_onDialogAddHyperlink', onDialogAddHyperlink); this.api.asc_registerCallback('asc_doubleClickOnChart', onDoubleClickOnChart); this.api.asc_registerCallback('asc_onSpellCheckVariantsFound', _.bind(onSpellCheckVariantsFound, this)); + this.api.asc_registerCallback('asc_onRulerDblClick', _.bind(this.onRulerDblClick, this)); } this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(onCoAuthoringDisconnect, this)); @@ -1595,27 +1598,6 @@ define([ window.currentStyleName = name; }, - _applyTableWrap: function(wrap, align){ - var selectedElements = this.api.getSelectedElements(); - if (selectedElements && _.isArray(selectedElements)){ - for (var i = selectedElements.length - 1; i >= 0; i--) { - var elType, elValue; - elType = selectedElements[i].get_ObjectType(); - elValue = selectedElements[i].get_ObjectValue(); - if (Asc.c_oAscTypeSelectElement.Table == elType) { - var properties = new Asc.CTableProp(); - properties.put_TableWrap(wrap); - if (wrap == c_tableWrap.TABLE_WRAP_NONE) { - properties.put_TableAlignment(align); - properties.put_TableIndent(0); - } - this.api.tblApply(properties); - break; - } - } - } - }, - advancedParagraphClick: function(item, e, eOpt){ var win, me = this; if (me.api){ @@ -1652,6 +1634,7 @@ define([ if (win) { win.show(); + return win; } }, @@ -1694,6 +1677,93 @@ define([ } }, + advancedTableClick: function(item, e, eOpt){ + var win, me = this; + if (me.api){ + var selectedElements = me.api.getSelectedElements(); + + if (selectedElements && _.isArray(selectedElements)){ + for (var i = selectedElements.length - 1; i >= 0; i--) { + var elType, elValue; + + elType = selectedElements[i].get_ObjectType(); + elValue = selectedElements[i].get_ObjectValue(); + + if (Asc.c_oAscTypeSelectElement.Table == elType) { + win = new DE.Views.TableSettingsAdvanced({ + tableStylerRows : (elValue.get_CellBorders().get_InsideH()===null && elValue.get_CellSelect()==true) ? 1 : 2, + tableStylerColumns : (elValue.get_CellBorders().get_InsideV()===null && elValue.get_CellSelect()==true) ? 1 : 2, + tableProps : elValue, + borderProps : me.borderAdvancedProps, + sectionProps : me.api.asc_GetSectionProps(), + handler : function(result, value) { + if (result == 'ok') { + if (me.api) { + me.borderAdvancedProps = value.borderProps; + me.api.tblApply(value.tableProps); + } + } + me.fireEvent('editcomplete', me); + } + }); + break; + } + } + } + } + + if (win) { + win.show(); + return win; + } + }, + + onRulerDblClick: function(type) { + var win, me = this; + if (type == 'tables') { + win = this.advancedTableClick(); + if (win) + win.setActiveCategory(4); + } else if (type == 'indents' || type == 'tabs') { + win = this.advancedParagraphClick({isChart: false}); + if (win) + win.setActiveCategory(type == 'indents' ? 0 : 3); + } else if (type == 'margins') { + win = new DE.Views.PageMarginsDialog({ + handler: function(dlg, result) { + if (result == 'ok') { + var props = dlg.getSettings(); + var mnu = DE.getController('Toolbar').toolbar.btnPageMargins.menu.items[0]; + mnu.setVisible(true); + mnu.setChecked(true); + mnu.options.value = mnu.value = [props.get_TopMargin(), props.get_LeftMargin(), props.get_BottomMargin(), props.get_RightMargin()]; + $(mnu.el).html(mnu.template({id: Common.UI.getId(), caption : mnu.caption, options : mnu.options})); + Common.localStorage.setItem("de-pgmargins-top", props.get_TopMargin()); + Common.localStorage.setItem("de-pgmargins-left", props.get_LeftMargin()); + Common.localStorage.setItem("de-pgmargins-bottom", props.get_BottomMargin()); + Common.localStorage.setItem("de-pgmargins-right", props.get_RightMargin()); + + me.api.asc_SetSectionProps(props); + me.fireEvent('editcomplete', me); + } + } + }); + win.show(); + win.setSettings(me.api.asc_GetSectionProps()); + } else if (type == 'columns') { + win = new DE.Views.CustomColumnsDialog({ + handler: function(dlg, result) { + if (result == 'ok') { + me.api.asc_SetColumnsProps(dlg.getSettings()); + me.fireEvent('editcomplete', me); + } + } + }); + win.show(); + win.setSettings(me.api.asc_GetColumnsProps()); + } + }, + editHyperlink: function(item, e, eOpt){ var win, me = this; if (me.api){ @@ -1806,14 +1876,14 @@ define([ me.api.asc_SetContentControlProperties(value, props.get_InternalId()); } - Common.NotificationCenter.trigger('edit:complete', me.toolbar); + me.fireEvent('editcomplete', me); } })).show(); } else if (item.value == 'remove') { this.api.asc_RemoveContentControlWrapper(props.get_InternalId()); } } - Common.NotificationCenter.trigger('edit:complete', this.toolbar); + me.fireEvent('editcomplete', me); }, createDelayedElementsViewer: function() { @@ -2266,8 +2336,7 @@ define([ menuChartEdit.setVisible(!_.isNull(value.imgProps.value.get_ChartProperties()) && !onlyCommonProps); - me.menuOriginalSize.setVisible(_.isNull(value.imgProps.value.get_ChartProperties()) && _.isNull(value.imgProps.value.get_ShapeProperties()) && - !onlyCommonProps); + me.menuOriginalSize.setVisible(value.imgProps.isOnlyImg); me.pictureMenu.items[10].setVisible(menuChartEdit.isVisible() || me.menuOriginalSize.isVisible()); var islocked = value.imgProps.locked || (value.headerProps!==undefined && value.headerProps.locked); @@ -2327,51 +2396,6 @@ define([ /* table menu*/ - var tableAlign = function(item, e) { - me._applyTableWrap(c_tableWrap.TABLE_WRAP_NONE, item.options.align); - }; - - var menuTableWrapInline = new Common.UI.MenuItem({ - caption : me.inlineText, - toggleGroup : 'popuptablewrapping', - checkable : true, - menu : new Common.UI.Menu({ - menuAlign: 'tl-tr', - items : [ - me.menuTableAlignLeft = new Common.UI.MenuItem({ - caption : me.textShapeAlignLeft, - toggleGroup : 'popuptablealign', - checkable : true, - checked : false, - align : c_tableAlign.TABLE_ALIGN_LEFT - }).on('click', _.bind(tableAlign, me)), - me.menuTableAlignCenter = new Common.UI.MenuItem({ - caption : me.textShapeAlignCenter, - toggleGroup : 'popuptablealign', - checkable : true, - checked : false, - align : c_tableAlign.TABLE_ALIGN_CENTER - }).on('click', _.bind(tableAlign, me)), - me.menuTableAlignRight = new Common.UI.MenuItem({ - caption : me.textShapeAlignRight, - toggleGroup : 'popuptablealign', - checkable : true, - checked : false, - align : c_tableAlign.TABLE_ALIGN_RIGHT - }).on('click', _.bind(tableAlign, me)) - ] - }) - }); - - var menuTableWrapFlow = new Common.UI.MenuItem({ - caption : me.flowoverText, - toggleGroup : 'popuptablewrapping', - checkable : true, - checked : true - }).on('click', function(item) { - me._applyTableWrap(c_tableWrap.TABLE_WRAP_PARALLEL); - }); - var mnuTableMerge = new Common.UI.MenuItem({ caption : me.mergeCellsText }).on('click', function(item) { @@ -2438,45 +2462,7 @@ define([ var menuTableAdvanced = new Common.UI.MenuItem({ caption : me.advancedTableText - }).on('click', function(item, e, eOpt){ - var win; - if (me.api){ - var selectedElements = me.api.getSelectedElements(); - - if (selectedElements && _.isArray(selectedElements)){ - for (var i = selectedElements.length - 1; i >= 0; i--) { - var elType, elValue; - - elType = selectedElements[i].get_ObjectType(); - elValue = selectedElements[i].get_ObjectValue(); - - if (Asc.c_oAscTypeSelectElement.Table == elType) { - win = new DE.Views.TableSettingsAdvanced({ - tableStylerRows : (elValue.get_CellBorders().get_InsideH()===null && elValue.get_CellSelect()==true) ? 1 : 2, - tableStylerColumns : (elValue.get_CellBorders().get_InsideV()===null && elValue.get_CellSelect()==true) ? 1 : 2, - tableProps : elValue, - borderProps : me.borderAdvancedProps, - sectionProps : me.api.asc_GetSectionProps(), - handler : function(result, value) { - if (result == 'ok') { - if (me.api) { - me.borderAdvancedProps = value.borderProps; - me.api.tblApply(value.tableProps); - } - } - me.fireEvent('editcomplete', me); - } - }); - break; - } - } - } - } - - if (win) { - win.show(); - } - }); + }).on('click', _.bind(me.advancedTableClick, me)); var menuParagraphAdvancedInTable = new Common.UI.MenuItem({ caption : me.advancedParagraphText @@ -2641,6 +2627,22 @@ define([ caption : '--' }); + var menuTableDistRows = new Common.UI.MenuItem({ + caption : me.textDistributeRows + }).on('click', _.bind(function(){ + if (me.api) + me.api.asc_DistributeTableCells(false); + me.fireEvent('editcomplete', me); + }, me)); + + var menuTableDistCols = new Common.UI.MenuItem({ + caption : me.textDistributeCols + }).on('click', _.bind(function(){ + if (me.api) + me.api.asc_DistributeTableCells(true); + me.fireEvent('editcomplete', me); + }, me)); + var tableDirection = function(item, e) { if (me.api) { var properties = new Asc.CTableProp(); @@ -2700,14 +2702,6 @@ define([ me.menuTableCellCenter.setChecked(align == Asc.c_oAscVertAlignJc.Center); me.menuTableCellBottom.setChecked(align == Asc.c_oAscVertAlignJc.Bottom); - var flow = (value.tableProps.value.get_TableWrap() == c_tableWrap.TABLE_WRAP_PARALLEL); - (flow) ? menuTableWrapFlow.setChecked(true) : menuTableWrapInline.setChecked(true); - - align = value.tableProps.value.get_TableAlignment(); - me.menuTableAlignLeft.setChecked((flow) ? false : (align === c_tableAlign.TABLE_ALIGN_LEFT)); - me.menuTableAlignCenter.setChecked((flow) ? false : (align === c_tableAlign.TABLE_ALIGN_CENTER)); - me.menuTableAlignRight.setChecked((flow) ? false : (align === c_tableAlign.TABLE_ALIGN_RIGHT)); - var dir = value.tableProps.value.get_CellsTextDirection(); me.menuTableDirectH.setChecked(dir == Asc.c_oAscCellTextDirection.LRTB); me.menuTableDirect90.setChecked(dir == Asc.c_oAscCellTextDirection.TBRL); @@ -2722,11 +2716,11 @@ define([ mnuTableSplit.setDisabled(disabled || !me.api.CheckBeforeSplitCells()); } + menuTableDistRows.setDisabled(disabled); + menuTableDistCols.setDisabled(disabled); menuTableCellAlign.setDisabled(disabled); menuTableDirection.setDisabled(disabled); - menuTableWrapInline.setDisabled(disabled); - menuTableWrapFlow.setDisabled(disabled || !value.tableProps.value.get_CanBeFlow()); menuTableAdvanced.setDisabled(disabled); var cancopy = me.api && me.api.can_CopyCut(); @@ -2902,12 +2896,12 @@ define([ mnuTableMerge, mnuTableSplit, { caption: '--' }, + menuTableDistRows, + menuTableDistCols, + { caption: '--' }, menuTableCellAlign, menuTableDirection, { caption: '--' }, - menuTableWrapInline, - menuTableWrapFlow, - { caption: '--' }, menuTableAdvanced, { caption: '--' }, /** coauthoring begin **/ @@ -3476,8 +3470,6 @@ define([ mergeCellsText : 'Merge Cells', splitCellsText : 'Split Cell...', splitCellTitleText : 'Split Cell', - flowoverText : 'Wrapping Style - Flow', - inlineText : 'Wrapping Style - Inline', originalSizeText : 'Default Size', advancedText : 'Advanced Settings', breakBeforeText : 'Page break before', @@ -3637,7 +3629,9 @@ define([ textRemove: 'Remove', textSettings: 'Settings', textRemoveControl: 'Remove content control', - textEditControls: 'Content control settings' + textEditControls: 'Content control settings', + textDistributeRows: 'Distribute rows', + textDistributeCols: 'Distribute columns' }, DE.Views.DocumentHolder || {})); }); \ 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 f15050312..88d0518cd 100644 --- a/apps/documenteditor/main/app/view/FileMenu.js +++ b/apps/documenteditor/main/app/view/FileMenu.js @@ -221,7 +221,7 @@ define([ }, show: function(panel, opts) { - if (this.isVisible() && panel===undefined) return; + if (this.isVisible() && panel===undefined || !this.mode) return; var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info'; if (!panel) diff --git a/apps/documenteditor/main/app/view/ShapeSettings.js b/apps/documenteditor/main/app/view/ShapeSettings.js index 7828424e5..03dc30873 100644 --- a/apps/documenteditor/main/app/view/ShapeSettings.js +++ b/apps/documenteditor/main/app/view/ShapeSettings.js @@ -755,11 +755,17 @@ define([ this._noApply = true; this.disableControls(this._locked, !shapeprops.get_CanFill()); - this.hideShapeOnlySettings(shapeprops.get_FromChart()); - this.hideChangeTypeSettings(shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' - || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' - || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' - || shapetype=='straightConnector1'); + this.hideShapeOnlySettings(shapeprops.get_FromChart() || shapeprops.get_FromImage()); + + var hidechangetype = shapeprops.get_FromChart() || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' + || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' + || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' + || shapetype=='straightConnector1'; + this.hideChangeTypeSettings(hidechangetype); + if (!hidechangetype) { + this.btnChangeShape.menu.items[0].setVisible(shapeprops.get_FromImage()); + this.btnChangeShape.menu.items[1].setVisible(!shapeprops.get_FromImage()); + } var value = props.get_WrappingStyle(); if (this._state.WrappingStyle!==value) { @@ -1522,22 +1528,27 @@ define([ shapesStore = this.application.getCollection('ShapeGroups'); var count = shapesStore.length; - for (var i=0; i0; i++) { + var shapeGroup = shapesStore.at(i>-1 ? i : i+1); var menuItem = new Common.UI.MenuItem({ caption: shapeGroup.get('groupName'), menu: new Common.UI.Menu({ menuAlign: 'tr-tl', items: [ - { template: _.template('') } + { template: _.template('') } ] }) }); me.btnChangeShape.menu.addItem(menuItem); + var store = shapeGroup.get('groupStore'); + if (i<0) { + store = store.clone(); + store.shift(); + } var shapePicker = new Common.UI.DataView({ - el: $('#id-shape-menu-shapegroup' + i), - store: shapeGroup.get('groupStore'), + el: $('#id-shape-menu-shapegroup' + (i+1)), + store: store, parentMenu: menuItem.menu, showLast: false, itemTemplate: _.template('
') diff --git a/apps/documenteditor/main/app/view/TableOfContentsSettings.js b/apps/documenteditor/main/app/view/TableOfContentsSettings.js index ca0ab8aca..171311f72 100644 --- a/apps/documenteditor/main/app/view/TableOfContentsSettings.js +++ b/apps/documenteditor/main/app/view/TableOfContentsSettings.js @@ -358,6 +358,12 @@ define([ this.chLinks.setValue((value !== null && value !== undefined) ? value : 'indeterminate', true); value = props.get_StylesType(); this.cmbStyles.setValue((value!==null) ? value : Asc.c_oAscTOCStylesType.Current); + value = props.get_ShowPageNumbers(); + this.chPages.setValue((value !== null && value !== undefined) ? value : 'indeterminate'); + if (this.chPages.getValue() == 'checked') { + value = props.get_RightAlignTab(); + this.chAlign.setValue((value !== null && value !== undefined) ? value : 'indeterminate'); + } var start = props.get_OutlineStart(), end = props.get_OutlineEnd(), @@ -446,11 +452,11 @@ define([ if (!props) { this._originalProps.put_OutlineRange(this.startLevel, this.endLevel); this._originalProps.put_Hyperlink(this.chLinks.getValue() == 'checked'); - } - this._originalProps.put_ShowPageNumbers(this.chPages.getValue() == 'checked'); - if (this.chPages.getValue() == 'checked') { - this._originalProps.put_RightAlignTab(this.chAlign.getValue() == 'checked'); - this._originalProps.put_TabLeader(this.cmbLeader.getValue()); + this._originalProps.put_ShowPageNumbers(this.chPages.getValue() == 'checked'); + if (this.chPages.getValue() == 'checked') { + this._originalProps.put_RightAlignTab(this.chAlign.getValue() == 'checked'); + this._originalProps.put_TabLeader(this.cmbLeader.getValue()); + } } // this.api.SetDrawImagePlaceContents('tableofcontents-img', this._originalProps); diff --git a/apps/documenteditor/main/app/view/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index babc878c2..001ac34f0 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -79,14 +79,13 @@ define([ CheckFirst: false, CheckLast: false, CheckColBanded: false, - WrapStyle: -1, - CanBeFlow: true, - TableAlignment: -1, - TableIndent: 0, BackColor: '#000000', RepeatRow: false, - DisabledControls: false + DisabledControls: false, + Width: null, + Height: null }; + this.spinners = []; this.lockedControls = []; this._locked = false; this._originalLook = new Asc.CTablePropLook(); @@ -96,7 +95,6 @@ define([ this.CellColor = {Value: 1, Color: 'transparent'}; // value=1 - цвет определен - прозрачный или другой, value=0 - цвет не определен, рисуем прозрачным this.BorderSize = 1; this._noApply = false; - this._wrapHandled = false; this.render(); }, @@ -140,28 +138,10 @@ define([ this.fireEvent('editcomplete', this); }, - onBtnWrapClick: function(btn, e) { - if (this.api && btn.pressed && !this._noApply) { - var properties = new Asc.CTableProp(); - properties.put_TableWrap(btn.options.posId); - if (btn.options.posId == c_tableWrap.TABLE_WRAP_NONE) { - if (this._state.TableAlignment<0) - this._state.TableAlignment = c_tableAlign.TABLE_ALIGN_LEFT; - properties.put_TableAlignment(this._state.TableAlignment); - properties.put_TableIndent(this._state.TableIndent); - } - properties.put_CellSelect(true); - this.api.tblApply(properties); - } - if (this._wrapHandled) { this._wrapHandled = false; return; } - this._wrapHandled = true; - this.fireEvent('editcomplete', this); - }, - onCheckRepeatRowChange: function(field, newValue, oldValue, eOpts) { if (this.api) { var properties = new Asc.CTableProp(); - properties.put_RowsInHeader((field.getValue()=='checked') ? 1 : 0 ); + properties.put_RowsInHeader(field.getValue()=='checked'); this.api.tblApply(properties); } this.fireEvent('editcomplete', this); @@ -259,8 +239,6 @@ define([ setApi: function(o) { this.api = o; if (o) { - this.api.asc_registerCallback('asc_onTblWrapStyleChanged', _.bind(this._TblWrapStyleChanged, this)); - this.api.asc_registerCallback('asc_onTblAlignChanged', _.bind(this._TblAlignChanged, this)); this.api.asc_registerCallback('asc_onInitTableTemplates', _.bind(this._onInitTemplates, this)); } return this; @@ -310,32 +288,6 @@ define([ this.chLast.on('change', _.bind(this.onCheckTemplateChange, this, 4)); this.chColBanded.on('change', _.bind(this.onCheckTemplateChange, this, 5)); - this.btnWrapNone = new Common.UI.Button({ - cls: 'btn-options huge', - iconCls: 'icon-right-panel btn-wrap-none', - posId: c_tableWrap.TABLE_WRAP_NONE, - hint: this.textWrapNoneTooltip, - enableToggle: true, - allowDepress: false, - toggleGroup : 'tablewrapGroup' - }); - this.btnWrapNone.render( $('#table-button-wrap-none')) ; - this.btnWrapNone.on('click', _.bind(this.onBtnWrapClick, this)); - this.lockedControls.push(this.btnWrapNone); - - this.btnWrapParallel = new Common.UI.Button({ - cls: 'btn-options huge', - iconCls: 'icon-right-panel btn-wrap-parallel', - posId: c_tableWrap.TABLE_WRAP_PARALLEL, - hint: this.textWrapParallelTooltip, - enableToggle: true, - allowDepress: false, - toggleGroup : 'tablewrapGroup' - }); - this.btnWrapParallel.render( $('#table-button-wrap-parallel')) ; - this.btnWrapParallel.on('click', _.bind(this.onBtnWrapClick, this)); - this.lockedControls.push(this.btnWrapParallel); - 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], @@ -417,6 +369,56 @@ define([ this.chRepeatRow.on('change', _.bind(this.onCheckRepeatRowChange, this)); this.lockedControls.push(this.chRepeatRow); + this.numHeight = new Common.UI.MetricSpinner({ + el: $('#table-spin-cell-height'), + step: .1, + width: 115, + defaultUnit : "cm", + value: '1 cm', + maxValue: 55.88, + minValue: 0 + }); + this.numHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var _props = new Asc.CTableProp(); + _props.put_RowHeight(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.api.tblApply(_props); + }, this)); + this.lockedControls.push(this.numHeight); + this.spinners.push(this.numHeight); + + this.numWidth = new Common.UI.MetricSpinner({ + el: $('#table-spin-cell-width'), + step: .1, + width: 115, + defaultUnit : "cm", + value: '1 cm', + maxValue: 55.88, + minValue: 0 + }); + this.numWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var _props = new Asc.CTableProp(); + _props.put_ColumnWidth(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.api.tblApply(_props); + }, this)); + this.lockedControls.push(this.numWidth); + this.spinners.push(this.numWidth); + + this.btnDistributeRows = new Common.UI.Button({ + el: $('#table-btn-distrub-rows') + }); + this.lockedControls.push(this.btnDistributeRows); + this.btnDistributeRows.on('click', _.bind(function(btn){ + this.api.asc_DistributeTableCells(false); + }, this)); + + this.btnDistributeCols = new Common.UI.Button({ + el: $('#table-btn-distrub-cols') + }); + this.lockedControls.push(this.btnDistributeCols); + this.btnDistributeCols.on('click', _.bind(function(btn){ + this.api.asc_DistributeTableCells(true); + }, this)); + this.linkAdvanced = $('#table-advanced-link'); $(this.el).on('click', '#table-advanced-link', _.bind(this.openAdvancedSettings, this)); }, @@ -424,6 +426,7 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.UpdateThemeColors(); + this.updateMetricUnit(); this._initSettings = false; }, @@ -438,17 +441,18 @@ define([ this._originalProps = new Asc.CTableProp(props); this._originalProps.put_CellSelect(true); - this._TblWrapStyleChanged(props.get_TableWrap()); - - var value = props.get_CanBeFlow() && !this._locked; - if ( this._state.CanBeFlow!==value ) { - this.btnWrapParallel.setDisabled(!value); - this._state.CanBeFlow=value; + var value = props.get_ColumnWidth(); + if ((this._state.Width === undefined || value === undefined)&&(this._state.Width!==value) || + Math.abs(this._state.Width-value)>0.001) { + this.numWidth.setValue((value !== null && value !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Width=value; + } + value = props.get_RowHeight(); + if ((this._state.Height === undefined || value === undefined)&&(this._state.Height!==value) || + Math.abs(this._state.Height-value)>0.001) { + this.numHeight.setValue((value !== null && value !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Height=value; } - - // align props - this._TblAlignChanged(props.get_TableAlignment()); - this._state.TableIndent = (props.get_TableAlignment() !== c_tableAlign.TABLE_ALIGN_LEFT) ? 0 : props.get_TableIndent(); //for table-template value = props.get_TableStyle(); @@ -558,15 +562,23 @@ define([ value = props.get_RowsInHeader(); if ( this._state.RepeatRow!==value ) { - if ( value !== null ) - this.chRepeatRow.setValue((value>0) ? 1 : 0, true); - else - this.chRepeatRow.setValue('indeterminate', true); + this.chRepeatRow.setValue(!!value, true); + this.chRepeatRow.setDisabled(value === null); this._state.RepeatRow=value; } } }, + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i canRequestEditRights must be defined this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view'; @@ -1712,14 +1719,18 @@ define([ me = this; if (type == Asc.c_oAscAdvancedOptionsID.DRM) { me._state.openDlg = new Common.Views.OpenDialog({ + closable: me.appOptions.canRequestClose, type: type, validatePwd: !!me._state.isDRM, - handler: function (value) { + handler: function (result, value) { me.isShowOpenDialog = false; - if (me && me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value)); - me.loadMask && me.loadMask.show(); - } + if (result == 'ok') { + if (me.api) { + me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value)); + me.loadMask && me.loadMask.show(); + } + } else + Common.Gateway.requestClose(); me._state.openDlg = null; } }); diff --git a/apps/presentationeditor/main/app/controller/RightMenu.js b/apps/presentationeditor/main/app/controller/RightMenu.js index 6b7c8e5d2..6aedd397a 100644 --- a/apps/presentationeditor/main/app/controller/RightMenu.js +++ b/apps/presentationeditor/main/app/controller/RightMenu.js @@ -273,6 +273,7 @@ define([ this.rightmenu.paragraphSettings.updateMetricUnit(); this.rightmenu.chartSettings.updateMetricUnit(); this.rightmenu.imageSettings.updateMetricUnit(); + this.rightmenu.tableSettings.updateMetricUnit(); }, fillTextArt: function() { diff --git a/apps/presentationeditor/main/app/template/ShapeSettings.template b/apps/presentationeditor/main/app/template/ShapeSettings.template index 13fc671a5..f86e7770a 100644 --- a/apps/presentationeditor/main/app/template/ShapeSettings.template +++ b/apps/presentationeditor/main/app/template/ShapeSettings.template @@ -97,7 +97,7 @@ - +
@@ -116,21 +116,18 @@
- - - - +
- +
- +
diff --git a/apps/presentationeditor/main/app/template/TableSettings.template b/apps/presentationeditor/main/app/template/TableSettings.template index aab71eff9..6d3db0d7e 100644 --- a/apps/presentationeditor/main/app/template/TableSettings.template +++ b/apps/presentationeditor/main/app/template/TableSettings.template @@ -105,6 +105,38 @@
+ + + + + + + + +
+ + + + + +
+ + + + + + + + + + + + + + +
+ + diff --git a/apps/presentationeditor/main/app/view/DocumentHolder.js b/apps/presentationeditor/main/app/view/DocumentHolder.js index 8ce3c5fda..7e56c8200 100644 --- a/apps/presentationeditor/main/app/view/DocumentHolder.js +++ b/apps/presentationeditor/main/app/view/DocumentHolder.js @@ -2116,6 +2116,22 @@ define([ })() }); + var menuTableDistRows = new Common.UI.MenuItem({ + caption : me.textDistributeRows + }).on('click', _.bind(function(){ + if (me.api) + me.api.asc_DistributeTableCells(false); + me.fireEvent('editcomplete', me); + }, me)); + + var menuTableDistCols = new Common.UI.MenuItem({ + caption : me.textDistributeCols + }).on('click', _.bind(function(){ + if (me.api) + me.api.asc_DistributeTableCells(true); + me.fireEvent('editcomplete', me); + }, me)); + me.menuSpellTable = new Common.UI.MenuItem({ caption : me.loadSpellText, disabled : true @@ -2910,7 +2926,7 @@ define([ return; var isEquation= (value.mathProps && value.mathProps.value); - for (var i = 6; i < 16; i++) { + for (var i = 6; i < 19; i++) { me.tableMenu.items[i].setVisible(!isEquation); } @@ -2924,6 +2940,8 @@ define([ mnuTableMerge.setDisabled(value.tableProps.locked || disabled || !me.api.CheckBeforeMergeCells()); mnuTableSplit.setDisabled(value.tableProps.locked || disabled || !me.api.CheckBeforeSplitCells()); } + menuTableDistRows.setDisabled(value.tableProps.locked || disabled); + menuTableDistCols.setDisabled(value.tableProps.locked || disabled); me.tableMenu.items[7].setDisabled(value.tableProps.locked || disabled); me.tableMenu.items[8].setDisabled(value.tableProps.locked || disabled); @@ -3068,6 +3086,9 @@ define([ mnuTableMerge, mnuTableSplit, { caption: '--' }, + menuTableDistRows, + menuTableDistCols, + { caption: '--' }, menuTableCellAlign, { caption: '--' }, menuTableAdvanced, @@ -3101,12 +3122,12 @@ define([ disabled = imgdisabled || shapedisabled || chartdisabled || (value.slideProps!==undefined && value.slideProps.locked); // image properties - menuImgOriginalSize.setVisible(_.isUndefined(value.shapeProps) && _.isUndefined(value.chartProps)); + menuImgOriginalSize.setVisible((_.isUndefined(value.shapeProps) || value.shapeProps.value.get_FromImage()) && _.isUndefined(value.chartProps)); if (menuImgOriginalSize.isVisible()) menuImgOriginalSize.setDisabled(disabled || _.isNull(value.imgProps.value.get_ImageUrl()) || _.isUndefined(value.imgProps.value.get_ImageUrl())); - menuImageAdvanced.setVisible(_.isUndefined(value.shapeProps) && _.isUndefined(value.chartProps)); + menuImageAdvanced.setVisible((_.isUndefined(value.shapeProps) || value.shapeProps.value.get_FromImage()) && _.isUndefined(value.chartProps)); menuShapeAdvanced.setVisible(_.isUndefined(value.imgProps) && _.isUndefined(value.chartProps)); menuChartEdit.setVisible(_.isUndefined(value.imgProps) && !_.isUndefined(value.chartProps) && (_.isUndefined(value.shapeProps) || value.shapeProps.isChart)); menuImgShapeSeparator.setVisible(menuImageAdvanced.isVisible() || menuShapeAdvanced.isVisible() || menuChartEdit.isVisible()); @@ -3375,7 +3396,9 @@ define([ txtKeepTextOnly: 'Keep text only', txtPastePicture: 'Picture', txtPasteSourceFormat: 'Keep source formatting', - txtPasteDestFormat: 'Use destination theme' + txtPasteDestFormat: 'Use destination theme', + textDistributeRows: 'Distribute rows', + textDistributeCols: 'Distribute columns' }, 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 bc10f274a..91ca8a383 100644 --- a/apps/presentationeditor/main/app/view/FileMenu.js +++ b/apps/presentationeditor/main/app/view/FileMenu.js @@ -216,7 +216,7 @@ define([ }, show: function(panel) { - if (this.isVisible() && panel===undefined) return; + if (this.isVisible() && panel===undefined || !this.mode) return; var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info'; if (!panel) diff --git a/apps/presentationeditor/main/app/view/LeftMenu.js b/apps/presentationeditor/main/app/view/LeftMenu.js index 5bd9deb5c..d72f0912a 100644 --- a/apps/presentationeditor/main/app/view/LeftMenu.js +++ b/apps/presentationeditor/main/app/view/LeftMenu.js @@ -302,12 +302,10 @@ define([ }, disableMenu: function(menu, disable) { - this.btnSearch.setDisabled(disable); this.btnThumbs.setDisabled(disable); this.btnAbout.setDisabled(disable); this.btnSupport.setDisabled(disable); /** coauthoring begin **/ - this.btnComments.setDisabled(disable); this.btnChat.setDisabled(disable); /** coauthoring end **/ this.btnPlugins.setDisabled(disable); diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index 3d96ff791..3a20fbd5f 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -687,11 +687,17 @@ define([ var shapetype = props.asc_getType(); this.disableControls(this._locked==true, props.get_CanFill() !== true); - this.hideShapeOnlySettings(props.get_FromChart()); - this.hideChangeTypeSettings(shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' - || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' - || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' - || shapetype=='straightConnector1'); + this.hideShapeOnlySettings(props.get_FromChart() || props.get_FromImage()); + + var hidechangetype = props.get_FromChart() || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' + || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' + || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' + || shapetype=='straightConnector1'; + this.hideChangeTypeSettings(hidechangetype); + if (!hidechangetype) { + this.btnChangeShape.menu.items[0].setVisible(props.get_FromImage()); + this.btnChangeShape.menu.items[1].setVisible(!props.get_FromImage()); + } // background colors var rec = null; @@ -1395,22 +1401,27 @@ define([ shapesStore = this.application.getCollection('ShapeGroups'); var count = shapesStore.length; - for (var i=0; i0; i++) { + var shapeGroup = shapesStore.at(i>-1 ? i : i+1); var menuItem = new Common.UI.MenuItem({ caption: shapeGroup.get('groupName'), menu: new Common.UI.Menu({ menuAlign: 'tr-tl', items: [ - { template: _.template('') } + { template: _.template('') } ] }) }); me.btnChangeShape.menu.addItem(menuItem); + var store = shapeGroup.get('groupStore'); + if (i<0) { + store = store.clone(); + store.shift(); + } var shapePicker = new Common.UI.DataView({ - el: $('#id-shape-menu-shapegroup' + i), - store: shapeGroup.get('groupStore'), + el: $('#id-shape-menu-shapegroup' + (i+1)), + store: store, parentMenu: menuItem.menu, showLast: false, itemTemplate: _.template('
') diff --git a/apps/presentationeditor/main/app/view/TableSettings.js b/apps/presentationeditor/main/app/view/TableSettings.js index 815b66760..251b624cd 100644 --- a/apps/presentationeditor/main/app/view/TableSettings.js +++ b/apps/presentationeditor/main/app/view/TableSettings.js @@ -80,8 +80,11 @@ define([ CheckLast: false, CheckColBanded: false, BackColor: '#000000', - DisabledControls: false + DisabledControls: false, + Width: null, + Height: null }; + this.spinners = []; this.lockedControls = []; this._locked = false; this._originalLook = new Asc.CTablePropLook(); @@ -350,6 +353,56 @@ define([ this.btnEdit.menu.on('item:click', _.bind(this.onEditClick, this)); this.lockedControls.push(this.btnEdit); + this.numHeight = new Common.UI.MetricSpinner({ + el: $('#table-spin-cell-height'), + step: .1, + width: 115, + defaultUnit : "cm", + value: '1 cm', + maxValue: 55.88, + minValue: 0 + }); + this.numHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var _props = new Asc.CTableProp(); + _props.put_RowHeight(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.api.tblApply(_props); + }, this)); + this.lockedControls.push(this.numHeight); + this.spinners.push(this.numHeight); + + this.numWidth = new Common.UI.MetricSpinner({ + el: $('#table-spin-cell-width'), + step: .1, + width: 115, + defaultUnit : "cm", + value: '1 cm', + maxValue: 55.88, + minValue: 0 + }); + this.numWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ + var _props = new Asc.CTableProp(); + _props.put_ColumnWidth(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + this.api.tblApply(_props); + }, this)); + this.lockedControls.push(this.numWidth); + this.spinners.push(this.numWidth); + + this.btnDistributeRows = new Common.UI.Button({ + el: $('#table-btn-distrub-rows') + }); + this.lockedControls.push(this.btnDistributeRows); + this.btnDistributeRows.on('click', _.bind(function(btn){ + this.api.asc_DistributeTableCells(false); + }, this)); + + this.btnDistributeCols = new Common.UI.Button({ + el: $('#table-btn-distrub-cols') + }); + this.lockedControls.push(this.btnDistributeCols); + this.btnDistributeCols.on('click', _.bind(function(btn){ + this.api.asc_DistributeTableCells(true); + }, this)); + this.linkAdvanced = $('#table-advanced-link'); $(this.el).on('click', '#table-advanced-link', _.bind(this.openAdvancedSettings, this)); }, @@ -365,8 +418,21 @@ define([ this._originalProps = new Asc.CTableProp(props); this._originalProps.put_CellSelect(true); + var value = props.get_ColumnWidth(); + if ((this._state.Width === undefined || value === undefined)&&(this._state.Width!==value) || + Math.abs(this._state.Width-value)>0.001) { + this.numWidth.setValue((value !== null && value !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Width=value; + } + value = props.get_RowHeight(); + if ((this._state.Height === undefined || value === undefined)&&(this._state.Height!==value) || + Math.abs(this._state.Height-value)>0.001) { + this.numHeight.setValue((value !== null && value !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Height=value; + } + //for table-template - var value = props.get_TableStyle(); + value = props.get_TableStyle(); if (this._state.TemplateId!==value || this._isTemplatesChanged) { this.cmbTableTemplate.suspendEvents(); var rec = this.cmbTableTemplate.menuPicker.store.findWhere({ @@ -473,6 +539,16 @@ define([ } }, + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i canRequestEditRights must be defined this.appOptions.isEdit = (this.appOptions.canLicense || this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge) && this.permissions.edit !== false && this.editorConfig.mode !== 'view'; @@ -1534,14 +1540,18 @@ define([ }); } else if (type == Asc.c_oAscAdvancedOptionsID.DRM) { me._state.openDlg = new Common.Views.OpenDialog({ + closable: me.appOptions.canRequestClose, type: type, validatePwd: !!me._state.isDRM, - handler: function (value) { + handler: function (result, value) { me.isShowOpenDialog = false; - if (me && me.api) { - me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value)); - me.loadMask && me.loadMask.show(); - } + if (result == 'ok') { + if (me && me.api) { + me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(value)); + me.loadMask && me.loadMask.show(); + } + } else + Common.Gateway.requestClose(); me._state.openDlg = null; } }); diff --git a/apps/spreadsheeteditor/main/app/controller/PivotTable.js b/apps/spreadsheeteditor/main/app/controller/PivotTable.js index ee2b75727..5f336a592 100644 --- a/apps/spreadsheeteditor/main/app/controller/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/controller/PivotTable.js @@ -59,6 +59,7 @@ define([ 'pivottable:rowscolumns': _.bind(this.onCheckTemplateChange, this), 'pivottable:create': _.bind(this.onCreateClick, this), 'pivottable:refresh': _.bind(this.onRefreshClick, this), + 'pivottable:select': _.bind(this.onSelectClick, this), 'pivottable:style': _.bind(this.onPivotStyleSelect, this), 'pivottable:layout': _.bind(this.onPivotLayout, this), 'pivottable:blankrows': _.bind(this.onPivotBlankRows, this), @@ -143,6 +144,13 @@ define([ Common.NotificationCenter.trigger('edit:complete', this); }, + onSelectClick: function(btn, opts){ + if (this.api) { + this._originalProps.asc_select(this.api); + } + Common.NotificationCenter.trigger('edit:complete', this); + }, + onPivotStyleSelect: function(record){ if (this.api) { this._originalProps.asc_getStyleInfo().asc_setName(this.api, this._originalProps, record.get('name')); diff --git a/apps/spreadsheeteditor/main/app/template/ShapeSettings.template b/apps/spreadsheeteditor/main/app/template/ShapeSettings.template index 13fc671a5..f86e7770a 100644 --- a/apps/spreadsheeteditor/main/app/template/ShapeSettings.template +++ b/apps/spreadsheeteditor/main/app/template/ShapeSettings.template @@ -97,7 +97,7 @@ - +
@@ -116,21 +116,18 @@
- - - - +
- +
- +
diff --git a/apps/spreadsheeteditor/main/app/view/FileMenu.js b/apps/spreadsheeteditor/main/app/view/FileMenu.js index bd54b5d3e..c5da026fb 100644 --- a/apps/spreadsheeteditor/main/app/view/FileMenu.js +++ b/apps/spreadsheeteditor/main/app/view/FileMenu.js @@ -205,7 +205,7 @@ define([ }, show: function(panel) { - if (this.isVisible() && panel===undefined) return; + if (this.isVisible() && panel===undefined || !this.mode) return; var defPanel = (this.mode.canDownload && (!this.mode.isDesktopApp || !this.mode.isOffline)) ? 'saveas' : 'info'; if (!panel) @@ -220,7 +220,7 @@ define([ hide: function() { this.$el.hide(); - this.api.asc_enableKeyEvents(true); + this.api && this.api.asc_enableKeyEvents(true); this.fireEvent('menu:hide', [this]); }, diff --git a/apps/spreadsheeteditor/main/app/view/PivotTable.js b/apps/spreadsheeteditor/main/app/view/PivotTable.js index 79cd96480..36ed358d9 100644 --- a/apps/spreadsheeteditor/main/app/view/PivotTable.js +++ b/apps/spreadsheeteditor/main/app/view/PivotTable.js @@ -67,6 +67,10 @@ define([ '' + '
' + '
' + + '
' + + '' + + '
' + + '
' + '
' + '
' + '' + @@ -114,6 +118,10 @@ define([ me.fireEvent('pivottable:refresh'); }); + this.btnSelectPivot.on('click', function (e) { + me.fireEvent('pivottable:select'); + }); + this.chRowHeader.on('change', function (field, value) { me.fireEvent('pivottable:rowscolumns', [0, value]); }); @@ -243,6 +251,13 @@ define([ }); // this.lockedControls.push(this.btnRefreshPivot); + this.btnSelectPivot = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'btn-select-pivot', + caption: this.txtSelect + }); + this.lockedControls.push(this.btnSelectPivot); + this.pivotStyles = new Common.UI.ComboDataView({ cls : 'combo-pivot-template', enableKeyEvents : true, @@ -270,6 +285,7 @@ define([ })).then(function(){ me.btnAddPivot.updateHint(me.tipCreatePivot); me.btnRefreshPivot.updateHint(me.tipRefresh); + me.btnSelectPivot.updateHint(me.tipSelect); me.btnPivotLayout.updateHint(me.capLayout); me.btnPivotBlankRows.updateHint(me.capBlankRows); me.btnPivotSubtotals.updateHint(me.tipSubtotals); @@ -289,6 +305,7 @@ define([ this.btnAddPivot.render(this.$el.find('#slot-btn-add-pivot')); this.btnRefreshPivot.render(this.$el.find('#slot-btn-refresh-pivot')); + this.btnSelectPivot.render(this.$el.find('#slot-btn-select-pivot')); this.btnPivotLayout.render(this.$el.find('#slot-btn-pivot-report-layout')); this.btnPivotBlankRows.render(this.$el.find('#slot-btn-pivot-blank-rows')); this.btnPivotSubtotals.render(this.$el.find('#slot-btn-pivot-subtotals')); @@ -341,7 +358,9 @@ define([ txtRefresh: 'Refresh', tipRefresh: 'Update the information from data source', tipGrandTotals: 'Show or hide grand totals', - tipSubtotals: 'Show or hide subtotals' + tipSubtotals: 'Show or hide subtotals', + txtSelect: 'Select', + tipSelect: 'Select entire pivot table' } }()), SSE.Views.PivotTable || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index ed33ce59f..996ae431a 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -711,11 +711,17 @@ define([ this._noApply = true; this.disableControls(this._locked, !shapeprops.asc_getCanFill()); - this.hideShapeOnlySettings(shapeprops.asc_getFromChart()); - this.hideChangeTypeSettings(shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' - || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' - || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' - || shapetype=='straightConnector1'); + this.hideShapeOnlySettings(shapeprops.asc_getFromChart() || shapeprops.asc_getFromImage()); + + var hidechangetype = shapeprops.get_FromChart() || shapetype=='line' || shapetype=='bentConnector2' || shapetype=='bentConnector3' + || shapetype=='bentConnector4' || shapetype=='bentConnector5' || shapetype=='curvedConnector2' + || shapetype=='curvedConnector3' || shapetype=='curvedConnector4' || shapetype=='curvedConnector5' + || shapetype=='straightConnector1'; + this.hideChangeTypeSettings(hidechangetype); + if (!hidechangetype) { + this.btnChangeShape.menu.items[0].setVisible(shapeprops.get_FromImage()); + this.btnChangeShape.menu.items[1].setVisible(!shapeprops.get_FromImage()); + } // background colors var rec = null; @@ -1420,22 +1426,27 @@ define([ shapesStore = this.application.getCollection('ShapeGroups'); var count = shapesStore.length; - for (var i=0; i0; i++) { + var shapeGroup = shapesStore.at(i>-1 ? i : i+1); var menuItem = new Common.UI.MenuItem({ caption: shapeGroup.get('groupName'), menu: new Common.UI.Menu({ menuAlign: 'tr-tl', items: [ - { template: _.template('') } + { template: _.template('') } ] }) }); me.btnChangeShape.menu.addItem(menuItem); + var store = shapeGroup.get('groupStore'); + if (i<0) { + store = store.clone(); + store.shift(); + } var shapePicker = new Common.UI.DataView({ - el: $('#id-shape-menu-shapegroup' + i), - store: shapeGroup.get('groupStore'), + el: $('#id-shape-menu-shapegroup' + (i+1)), + store: store, parentMenu: menuItem.menu, showLast: false, itemTemplate: _.template('
') diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index bced17ee7..678417074 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -102,6 +102,7 @@ "Common.Views.OpenDialog.txtTab": "Tab", "Common.Views.OpenDialog.txtTitle": "Choose %1 options", "Common.Views.OpenDialog.txtTitleProtected": "Protected File", + "Common.Views.OpenDialog.closeButtonText": "Close File", "Common.Views.PasswordDialog.cancelButtonText": "Cancel", "Common.Views.PasswordDialog.okButtonText": "OK", "Common.Views.PasswordDialog.txtDescription": "A password is required to open this document", @@ -1499,6 +1500,8 @@ "SSE.Views.PivotTable.tipRefresh": "Update the information from data source", "SSE.Views.PivotTable.tipGrandTotals": "Show or hide grand totals", "SSE.Views.PivotTable.tipSubtotals": "Show or hide subtotals", + "SSE.Views.PivotTable.txtSelect": "Select", + "SSE.Views.PivotTable.tipSelect": "Select entire pivot table", "SSE.Views.PrintSettings.btnPrint": "Save & Print", "SSE.Views.PrintSettings.cancelButtonText": "Cancel", "SSE.Views.PrintSettings.strBottom": "Bottom", diff --git a/apps/spreadsheeteditor/mobile/app/controller/Main.js b/apps/spreadsheeteditor/mobile/app/controller/Main.js index 5c2bb4b17..98ce0a370 100644 --- a/apps/spreadsheeteditor/mobile/app/controller/Main.js +++ b/apps/spreadsheeteditor/mobile/app/controller/Main.js @@ -440,6 +440,12 @@ define([ title = me.loadingDocumentTitleText; text = me.loadingDocumentTextText; break; + default: + if (typeof action.id == 'string'){ + title = action.id; + text = action.id; + } + break; } if (action.type == Asc.c_oAscAsyncActionType.BlockInteraction) {