From f77dc3d45f932113f1ce334847c2f00ec26c1460 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 18 Jan 2018 17:26:31 +0300 Subject: [PATCH 1/7] [DE] Added table settings: change width/height, distribute rows/columns. --- .../main/app/controller/RightMenu.js | 1 + .../main/app/template/TableSettings.template | 36 +++-- .../main/app/view/TableSettings.js | 151 ++++++++---------- apps/documenteditor/main/locale/en.json | 11 +- 4 files changed, 106 insertions(+), 93 deletions(-) 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/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/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index babc878c2..4f0d26c39 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -79,14 +79,11 @@ define([ CheckFirst: false, CheckLast: false, CheckColBanded: false, - WrapStyle: -1, - CanBeFlow: true, - TableAlignment: -1, - TableIndent: 0, BackColor: '#000000', RepeatRow: false, DisabledControls: false }; + this.spinners = []; this.lockedControls = []; this._locked = false; this._originalLook = new Asc.CTablePropLook(); @@ -96,7 +93,6 @@ define([ this.CellColor = {Value: 1, Color: 'transparent'}; // value=1 - цвет определен - прозрачный или другой, value=0 - цвет не определен, рисуем прозрачным this.BorderSize = 1; this._noApply = false; - this._wrapHandled = false; this.render(); }, @@ -140,24 +136,6 @@ 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(); @@ -259,8 +237,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 +286,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 +367,50 @@ 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){ + // this._changedProps.put_Height(this.cmbUnit.getValue() ? -field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + }, 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){ + // this._changedProps.put_Width(this.cmbUnit.getValue() ? -field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + }, 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(field, newValue, oldValue, eOpts){ + }, this)); + + this.btnDistributeCols = new Common.UI.Button({ + el: $('#table-btn-distrub-cols') + }); + this.lockedControls.push(this.btnDistributeCols); + this.btnDistributeCols.on('click', _.bind(function(field, newValue, oldValue, eOpts){ + }, this)); + this.linkAdvanced = $('#table-advanced-link'); $(this.el).on('click', '#table-advanced-link', _.bind(this.openAdvancedSettings, this)); }, @@ -424,6 +418,7 @@ define([ createDelayedElements: function() { this.createDelayedControls(); this.UpdateThemeColors(); + this.updateMetricUnit(); this._initSettings = false; }, @@ -438,17 +433,16 @@ 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 = null;//props.get_Width(); + if ( Math.abs(this._state.Width-value)>0.001 || + (this._state.Width===null || value===null)&&(this._state.Width!==value)) { + this.numWidth.setValue((value !== null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + } + value = null;//props.get_Height(); + if ( Math.abs(this._state.Height-value)>0.001 || + (this._state.Height===null || value===null)&&(this._state.Height!==value)) { + this.numHeight.setValue((value !== null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); } - - // 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(); @@ -567,6 +561,16 @@ define([ } }, + updateMetricUnit: function() { + if (this.spinners) { + for (var i=0; i Date: Thu, 18 Jan 2018 17:44:03 +0300 Subject: [PATCH 2/7] [DE] Table context menu: remove table wrapping and align, add rows/columns distribution. --- .../main/app/view/DocumentHolder.js | 106 ++++-------------- apps/documenteditor/main/locale/en.json | 6 +- 2 files changed, 28 insertions(+), 84 deletions(-) diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index c0705edff..6a4eaaf56 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -1595,27 +1595,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){ @@ -2327,51 +2306,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) { @@ -2641,6 +2575,22 @@ define([ caption : '--' }); + var menuTableDistRows = new Common.UI.MenuItem({ + caption : me.textDistributeRows + }).on('click', _.bind(function(){ + // if (me.api) + // me.api.distributeCols(); + me.fireEvent('editcomplete', me); + }, me)); + + var menuTableDistCols = new Common.UI.MenuItem({ + caption : me.textDistributeCols + }).on('click', _.bind(function(){ + // if (me.api) + // me.api.distributeCols(); + me.fireEvent('editcomplete', me); + }, me)); + var tableDirection = function(item, e) { if (me.api) { var properties = new Asc.CTableProp(); @@ -2700,14 +2650,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 +2664,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 +2844,12 @@ define([ mnuTableMerge, mnuTableSplit, { caption: '--' }, + menuTableDistRows, + menuTableDistCols, + { caption: '--' }, menuTableCellAlign, menuTableDirection, { caption: '--' }, - menuTableWrapInline, - menuTableWrapFlow, - { caption: '--' }, menuTableAdvanced, { caption: '--' }, /** coauthoring begin **/ @@ -3476,8 +3418,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 +3577,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/locale/en.json b/apps/documenteditor/main/locale/en.json index 7c507dcae..375de78de 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -837,13 +837,13 @@ "DE.Views.DocumentHolder.editFooterText": "Edit Footer", "DE.Views.DocumentHolder.editHeaderText": "Edit Header", "DE.Views.DocumentHolder.editHyperlinkText": "Edit Hyperlink", - "DE.Views.DocumentHolder.flowoverText": "Wrapping Style - Flow", + "del_DE.Views.DocumentHolder.flowoverText": "Wrapping Style - Flow", "DE.Views.DocumentHolder.guestText": "Guest", "DE.Views.DocumentHolder.hyperlinkText": "Hyperlink", "DE.Views.DocumentHolder.ignoreAllSpellText": "Ignore All", "DE.Views.DocumentHolder.ignoreSpellText": "Ignore", "DE.Views.DocumentHolder.imageText": "Image Advanced Settings", - "DE.Views.DocumentHolder.inlineText": "Wrapping Style - Inline", + "del_DE.Views.DocumentHolder.inlineText": "Wrapping Style - Inline", "DE.Views.DocumentHolder.insertColumnLeftText": "Column Left", "DE.Views.DocumentHolder.insertColumnRightText": "Column Right", "DE.Views.DocumentHolder.insertColumnText": "Insert Column", @@ -990,6 +990,8 @@ "DE.Views.DocumentHolder.textNest": "Nest table", "DE.Views.DocumentHolder.updateStyleText": "Update %1 style", "DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment", + "DE.Views.DocumentHolder.textDistributeRows": "Distribute rows", + "DE.Views.DocumentHolder.textDistributeCols": "Distribute columns", "DE.Views.DropcapSettingsAdvanced.cancelButtonText": "Cancel", "DE.Views.DropcapSettingsAdvanced.okButtonText": "Ok", "DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill", From 5854f4ea43b2e82a3eeb40f999914babe7f84b2b Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Fri, 26 Jan 2018 11:02:37 +0300 Subject: [PATCH 3/7] [DE] Distribute table rows and columns. --- apps/documenteditor/main/app/view/DocumentHolder.js | 8 ++++---- apps/documenteditor/main/app/view/TableSettings.js | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js index 6a4eaaf56..d350081c0 100644 --- a/apps/documenteditor/main/app/view/DocumentHolder.js +++ b/apps/documenteditor/main/app/view/DocumentHolder.js @@ -2578,16 +2578,16 @@ define([ var menuTableDistRows = new Common.UI.MenuItem({ caption : me.textDistributeRows }).on('click', _.bind(function(){ - // if (me.api) - // me.api.distributeCols(); + 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.distributeCols(); + if (me.api) + me.api.asc_DistributeTableCells(true); me.fireEvent('editcomplete', me); }, me)); diff --git a/apps/documenteditor/main/app/view/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index 4f0d26c39..ad72179a5 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -401,14 +401,16 @@ define([ el: $('#table-btn-distrub-rows') }); this.lockedControls.push(this.btnDistributeRows); - this.btnDistributeRows.on('click', _.bind(function(field, newValue, oldValue, eOpts){ + 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(field, newValue, oldValue, eOpts){ + this.btnDistributeCols.on('click', _.bind(function(btn){ + this.api.asc_DistributeTableCells(true); }, this)); this.linkAdvanced = $('#table-advanced-link'); From ba6d82f74187ded78570c358bcec2da6b0f79aab Mon Sep 17 00:00:00 2001 From: Ilya Kirillov Date: Tue, 30 Jan 2018 14:42:19 +0300 Subject: [PATCH 4/7] Test variant for working with column width and row height. --- .../main/app/view/TableSettings.js | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/apps/documenteditor/main/app/view/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index ad72179a5..ae018fa01 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -376,8 +376,10 @@ define([ maxValue: 55.88, minValue: 0 }); - this.numHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){ - // this._changedProps.put_Height(this.cmbUnit.getValue() ? -field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + 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); @@ -392,7 +394,9 @@ define([ minValue: 0 }); this.numWidth.on('change', _.bind(function(field, newValue, oldValue, eOpts){ - // this._changedProps.put_Width(this.cmbUnit.getValue() ? -field.getNumberValue() : Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); + 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); @@ -435,14 +439,14 @@ define([ this._originalProps = new Asc.CTableProp(props); this._originalProps.put_CellSelect(true); - var value = null;//props.get_Width(); - if ( Math.abs(this._state.Width-value)>0.001 || - (this._state.Width===null || value===null)&&(this._state.Width!==value)) { + var value = props.get_ColumnWidth(); + if ((this._state.Width === null || this._state.Width === undefined) || + Math.abs(this._state.Width-value)>0.001) { this.numWidth.setValue((value !== null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); } - value = null;//props.get_Height(); - if ( Math.abs(this._state.Height-value)>0.001 || - (this._state.Height===null || value===null)&&(this._state.Height!==value)) { + value = props.get_RowHeight(); + if ((this._state.Height === null || this._state.Height === undefined) || + Math.abs(this._state.Height-value)>0.001) { this.numHeight.setValue((value !== null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); } From 4a760ce9992c34b518a01c6c22f5e1a5388b6847 Mon Sep 17 00:00:00 2001 From: Oleg Korshul Date: Tue, 30 Jan 2018 17:00:57 +0300 Subject: [PATCH 5/7] add new scripts --- apps/documenteditor/sdk_dev_scripts.js | 6 ++++-- apps/presentationeditor/sdk_dev_scripts.js | 5 ++++- apps/spreadsheeteditor/sdk_dev_scripts.js | 11 +++++++---- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/apps/documenteditor/sdk_dev_scripts.js b/apps/documenteditor/sdk_dev_scripts.js index 3ba4cf95a..26652e11d 100644 --- a/apps/documenteditor/sdk_dev_scripts.js +++ b/apps/documenteditor/sdk_dev_scripts.js @@ -18,9 +18,11 @@ var sdk_dev_scrpipts = [ "../../../../sdkjs/common/AdvancedOptions.js", "../../../../sdkjs/common/FontsFreeType/font_engine.js", "../../../../sdkjs/common/FontsFreeType/FontFile.js", - "../../../../sdkjs/common/FontsFreeType/font_map.js", + "../../../../sdkjs/common/FontsFreeType/font_map.js", + "../../../../sdkjs/common/FontsFreeType/RasterHeapManager.js", + "../../../../sdkjs/common/FontsFreeType/GlyphString.js", "../../../../sdkjs/common/FontsFreeType/FontManager.js", - "../../../../sdkjs/word/Editor/FontClassification.js", + "../../../../sdkjs/common/FontsFreeType/FontClassification.js", "../../../../sdkjs/common/FontsFreeType/character.js", "../../../../sdkjs/common/Drawings/Metafile.js", "../../../../sdkjs/common/FontsFreeType/TextMeasurer.js", diff --git a/apps/presentationeditor/sdk_dev_scripts.js b/apps/presentationeditor/sdk_dev_scripts.js index 6f6ddf6fe..c44352eac 100644 --- a/apps/presentationeditor/sdk_dev_scripts.js +++ b/apps/presentationeditor/sdk_dev_scripts.js @@ -19,8 +19,11 @@ var sdk_dev_scrpipts = [ "../../../../sdkjs/common/FontsFreeType/font_engine.js", "../../../../sdkjs/common/FontsFreeType/FontFile.js", "../../../../sdkjs/common/FontsFreeType/font_map.js", + "../../../../sdkjs/common/FontsFreeType/RasterHeapManager.js", + "../../../../sdkjs/common/FontsFreeType/GlyphString.js", "../../../../sdkjs/common/FontsFreeType/FontManager.js", - "../../../../sdkjs/word/Editor/FontClassification.js", + "../../../../sdkjs/common/FontsFreeType/FontClassification.js", + "../../../../sdkjs/common/FontsFreeType/character.js", "../../../../sdkjs/common/Drawings/Metafile.js", "../../../../sdkjs/common/FontsFreeType/TextMeasurer.js", "../../../../sdkjs/common/Drawings/WorkEvents.js", diff --git a/apps/spreadsheeteditor/sdk_dev_scripts.js b/apps/spreadsheeteditor/sdk_dev_scripts.js index 3ca931033..6cdc9650f 100644 --- a/apps/spreadsheeteditor/sdk_dev_scripts.js +++ b/apps/spreadsheeteditor/sdk_dev_scripts.js @@ -26,10 +26,13 @@ var sdk_dev_scrpipts = [ "../../../../sdkjs/common/NumFormat.js", "../../../../sdkjs/common/SerializeChart.js", "../../../../sdkjs/common/FontsFreeType/font_engine.js", - "../../../../sdkjs/common/FontsFreeType/FontFile.js", - "../../../../sdkjs/common/FontsFreeType/font_map.js", - "../../../../sdkjs/common/FontsFreeType/FontManager.js", - "../../../../sdkjs/word/Editor/FontClassification.js", + "../../../../sdkjs/common/FontsFreeType/FontFile.js", + "../../../../sdkjs/common/FontsFreeType/font_map.js", + "../../../../sdkjs/common/FontsFreeType/RasterHeapManager.js", + "../../../../sdkjs/common/FontsFreeType/GlyphString.js", + "../../../../sdkjs/common/FontsFreeType/FontManager.js", + "../../../../sdkjs/common/FontsFreeType/FontClassification.js", + "../../../../sdkjs/common/FontsFreeType/character.js", "../../../../sdkjs/common/Drawings/Metafile.js", "../../../../sdkjs/common/FontsFreeType/TextMeasurer.js", "../../../../sdkjs/common/Drawings/WorkEvents.js", From ba341f529e0442af567752aca271638fc71de677 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 6 Feb 2018 14:45:10 +0300 Subject: [PATCH 6/7] [DE] Refactoring table settings. --- apps/documenteditor/main/app/view/TableSettings.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/apps/documenteditor/main/app/view/TableSettings.js b/apps/documenteditor/main/app/view/TableSettings.js index ae018fa01..ee04179a0 100644 --- a/apps/documenteditor/main/app/view/TableSettings.js +++ b/apps/documenteditor/main/app/view/TableSettings.js @@ -81,7 +81,9 @@ define([ CheckColBanded: false, BackColor: '#000000', RepeatRow: false, - DisabledControls: false + DisabledControls: false, + Width: null, + Height: null }; this.spinners = []; this.lockedControls = []; @@ -440,14 +442,16 @@ define([ this._originalProps.put_CellSelect(true); var value = props.get_ColumnWidth(); - if ((this._state.Width === null || this._state.Width === undefined) || + if ((this._state.Width === undefined || value === undefined)&&(this._state.Width!==value) || Math.abs(this._state.Width-value)>0.001) { - this.numWidth.setValue((value !== null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + 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 === null || this._state.Height === undefined) || + if ((this._state.Height === undefined || value === undefined)&&(this._state.Height!==value) || Math.abs(this._state.Height-value)>0.001) { - this.numHeight.setValue((value !== null) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this.numHeight.setValue((value !== null && value !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(value) : '', true); + this._state.Height=value; } //for table-template From 81e72f269c5d280429cc97ad4ea9fda4ae16e67a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 6 Feb 2018 15:06:01 +0300 Subject: [PATCH 7/7] [PE] Added width, height for table settings in the right panel. Distribute rows and columns in table. --- .../main/app/controller/RightMenu.js | 1 + .../main/app/template/TableSettings.template | 32 +++++++ .../main/app/view/DocumentHolder.js | 27 +++++- .../main/app/view/TableSettings.js | 88 ++++++++++++++++++- apps/presentationeditor/main/locale/en.json | 7 ++ 5 files changed, 150 insertions(+), 5 deletions(-) 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/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..130364c25 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, @@ -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/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