[PE] Added width, height for table settings in the right panel. Distribute rows and columns in table.

This commit is contained in:
Julia Radzhabova 2018-02-06 15:06:01 +03:00
parent ba341f529e
commit 81e72f269c
5 changed files with 150 additions and 5 deletions

View file

@ -273,6 +273,7 @@ define([
this.rightmenu.paragraphSettings.updateMetricUnit(); this.rightmenu.paragraphSettings.updateMetricUnit();
this.rightmenu.chartSettings.updateMetricUnit(); this.rightmenu.chartSettings.updateMetricUnit();
this.rightmenu.imageSettings.updateMetricUnit(); this.rightmenu.imageSettings.updateMetricUnit();
this.rightmenu.tableSettings.updateMetricUnit();
}, },
fillTextArt: function() { fillTextArt: function() {

View file

@ -105,6 +105,38 @@
<div class="separator horizontal"></div> <div class="separator horizontal"></div>
</td> </td>
</tr> </tr>
<tr>
<td colspan=2>
<label class="header"><%= scope.textCellSize %></label>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<label style="margin-top: 3px;"><%= scope.textHeight %></label>
<div id="table-spin-cell-height" style="display: inline-block; float:right;"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<label style="margin-top: 3px;"><%= scope.textWidth %></label>
<div id="table-spin-cell-width" style="display: inline-block; float:right;"></div>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<button type="button" class="btn btn-text-default" id="table-btn-distrub-rows" style="width:100%;"><%= scope.textDistributeRows %></button>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<button type="button" class="btn btn-text-default" id="table-btn-distrub-cols" style="width:100%;"><%= scope.textDistributeCols %></button>
</td>
</tr>
<tr>
<td class="padding-small" colspan=2>
<div class="separator horizontal"></div>
</td>
</tr>
<tr> <tr>
<td align="center" colspan=2> <td align="center" colspan=2>
<label class="link" id="table-advanced-link"><%= scope.textAdvanced %></label> <label class="link" id="table-advanced-link"><%= scope.textAdvanced %></label>

View file

@ -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({ me.menuSpellTable = new Common.UI.MenuItem({
caption : me.loadSpellText, caption : me.loadSpellText,
disabled : true disabled : true
@ -2910,7 +2926,7 @@ define([
return; return;
var isEquation= (value.mathProps && value.mathProps.value); 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); me.tableMenu.items[i].setVisible(!isEquation);
} }
@ -2924,6 +2940,8 @@ define([
mnuTableMerge.setDisabled(value.tableProps.locked || disabled || !me.api.CheckBeforeMergeCells()); mnuTableMerge.setDisabled(value.tableProps.locked || disabled || !me.api.CheckBeforeMergeCells());
mnuTableSplit.setDisabled(value.tableProps.locked || disabled || !me.api.CheckBeforeSplitCells()); 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[7].setDisabled(value.tableProps.locked || disabled);
me.tableMenu.items[8].setDisabled(value.tableProps.locked || disabled); me.tableMenu.items[8].setDisabled(value.tableProps.locked || disabled);
@ -3068,6 +3086,9 @@ define([
mnuTableMerge, mnuTableMerge,
mnuTableSplit, mnuTableSplit,
{ caption: '--' }, { caption: '--' },
menuTableDistRows,
menuTableDistCols,
{ caption: '--' },
menuTableCellAlign, menuTableCellAlign,
{ caption: '--' }, { caption: '--' },
menuTableAdvanced, menuTableAdvanced,
@ -3375,7 +3396,9 @@ define([
txtKeepTextOnly: 'Keep text only', txtKeepTextOnly: 'Keep text only',
txtPastePicture: 'Picture', txtPastePicture: 'Picture',
txtPasteSourceFormat: 'Keep source formatting', txtPasteSourceFormat: 'Keep source formatting',
txtPasteDestFormat: 'Use destination theme' txtPasteDestFormat: 'Use destination theme',
textDistributeRows: 'Distribute rows',
textDistributeCols: 'Distribute columns'
}, PE.Views.DocumentHolder || {})); }, PE.Views.DocumentHolder || {}));
}); });

View file

@ -80,8 +80,11 @@ define([
CheckLast: false, CheckLast: false,
CheckColBanded: false, CheckColBanded: false,
BackColor: '#000000', BackColor: '#000000',
DisabledControls: false DisabledControls: false,
Width: null,
Height: null
}; };
this.spinners = [];
this.lockedControls = []; this.lockedControls = [];
this._locked = false; this._locked = false;
this._originalLook = new Asc.CTablePropLook(); this._originalLook = new Asc.CTablePropLook();
@ -350,6 +353,56 @@ define([
this.btnEdit.menu.on('item:click', _.bind(this.onEditClick, this)); this.btnEdit.menu.on('item:click', _.bind(this.onEditClick, this));
this.lockedControls.push(this.btnEdit); 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.linkAdvanced = $('#table-advanced-link');
$(this.el).on('click', '#table-advanced-link', _.bind(this.openAdvancedSettings, this)); $(this.el).on('click', '#table-advanced-link', _.bind(this.openAdvancedSettings, this));
}, },
@ -365,8 +418,21 @@ define([
this._originalProps = new Asc.CTableProp(props); this._originalProps = new Asc.CTableProp(props);
this._originalProps.put_CellSelect(true); 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 //for table-template
var value = props.get_TableStyle(); value = props.get_TableStyle();
if (this._state.TemplateId!==value || this._isTemplatesChanged) { if (this._state.TemplateId!==value || this._isTemplatesChanged) {
this.cmbTableTemplate.suspendEvents(); this.cmbTableTemplate.suspendEvents();
var rec = this.cmbTableTemplate.menuPicker.store.findWhere({ var rec = this.cmbTableTemplate.menuPicker.store.findWhere({
@ -473,6 +539,16 @@ define([
} }
}, },
updateMetricUnit: function() {
if (this.spinners) {
for (var i=0; i<this.spinners.length; i++) {
var spinner = this.spinners[i];
spinner.setDefaultUnit(Common.Utils.Metric.getCurrentMetricName());
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
}
}
},
_UpdateBordersStyle: function(border) { _UpdateBordersStyle: function(border) {
this.CellBorders = new Asc.CBorders(); this.CellBorders = new Asc.CBorders();
var updateBorders = this.CellBorders; var updateBorders = this.CellBorders;
@ -530,6 +606,7 @@ define([
createDelayedElements: function() { createDelayedElements: function() {
this.createDelayedControls(); this.createDelayedControls();
this.UpdateThemeColors(); this.UpdateThemeColors();
this.updateMetricUnit();
this._initSettings = false; this._initSettings = false;
}, },
@ -707,7 +784,12 @@ define([
tipInner: 'Set Inner Lines Only', tipInner: 'Set Inner Lines Only',
tipInnerVert: 'Set Vertical Inner Lines Only', tipInnerVert: 'Set Vertical Inner Lines Only',
tipInnerHor: 'Set Horizontal Inner Lines Only', tipInnerHor: 'Set Horizontal Inner Lines Only',
tipOuter: 'Set Outer Border Only' tipOuter: 'Set Outer Border Only',
textCellSize: 'Cell Size',
textHeight: 'Height',
textWidth: 'Width',
textDistributeRows: 'Distribute rows',
textDistributeCols: 'Distribute columns'
}, PE.Views.TableSettings || {})); }, PE.Views.TableSettings || {}));
}); });

View file

@ -719,6 +719,8 @@
"PE.Views.ChartSettingsAdvanced.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.", "PE.Views.ChartSettingsAdvanced.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.",
"PE.Views.ChartSettingsAdvanced.textAltTitle": "Title", "PE.Views.ChartSettingsAdvanced.textAltTitle": "Title",
"PE.Views.ChartSettingsAdvanced.textTitle": "Chart - Advanced Settings", "PE.Views.ChartSettingsAdvanced.textTitle": "Chart - Advanced Settings",
"PE.Views.DocumentHolder.textDistributeRows": "Distribute rows",
"PE.Views.DocumentHolder.textDistributeCols": "Distribute columns",
"PE.Views.DocumentHolder.aboveText": "Above", "PE.Views.DocumentHolder.aboveText": "Above",
"PE.Views.DocumentHolder.addCommentText": "Add Comment", "PE.Views.DocumentHolder.addCommentText": "Add Comment",
"PE.Views.DocumentHolder.advancedImageText": "Image Advanced Settings", "PE.Views.DocumentHolder.advancedImageText": "Image Advanced Settings",
@ -1262,6 +1264,11 @@
"PE.Views.Statusbar.tipZoomIn": "Zoom in", "PE.Views.Statusbar.tipZoomIn": "Zoom in",
"PE.Views.Statusbar.tipZoomOut": "Zoom out", "PE.Views.Statusbar.tipZoomOut": "Zoom out",
"PE.Views.Statusbar.txtPageNumInvalid": "Invalid slide number", "PE.Views.Statusbar.txtPageNumInvalid": "Invalid slide number",
"PE.Views.TableSettings.textCellSize": "Cell Size",
"PE.Views.TableSettings.textHeight": "Height",
"PE.Views.TableSettings.textWidth": "Width",
"PE.Views.TableSettings.textDistributeRows": "Distribute rows",
"PE.Views.TableSettings.textDistributeCols": "Distribute columns",
"PE.Views.TableSettings.deleteColumnText": "Delete Column", "PE.Views.TableSettings.deleteColumnText": "Delete Column",
"PE.Views.TableSettings.deleteRowText": "Delete Row", "PE.Views.TableSettings.deleteRowText": "Delete Row",
"PE.Views.TableSettings.deleteTableText": "Delete Table", "PE.Views.TableSettings.deleteTableText": "Delete Table",