Merge pull request #1528 from ONLYOFFICE/feature/Bug_49684

Feature/bug 49684
This commit is contained in:
JuliaSvinareva 2022-02-02 12:09:10 +03:00 committed by GitHub
commit 4a5ce7f6c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 727 additions and 31 deletions

View file

@ -1425,6 +1425,7 @@ define([
var win = new PE.Views.ShapeSettingsAdvanced(
{
shapeProps: elValue,
slideSize: PE.getController('Toolbar').currentPageSize,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {

View file

@ -1,4 +1,57 @@
<div id="id-adv-chart-alttext" class="settings-panel active">
<div id="id-adv-chart-placement" class="settings-panel active">
<div class="inner-content">
<table cols="3">
<tr>
<td colspan="4" width="88px" class="padding-small">
<label class="header"><%= scope.textSize %></label>
</td>
</tr>
<tr>
<td width="93px" class="padding-large">
<label class="input-label"><%= scope.textWidth %></label>
<div id="chart-advanced-spin-width"></div>
</td>
<td width="28px" style="vertical-align: bottom;" class="padding-large">
<div id="chart-advanced-button-ratio"></div>
</td>
<td width="93px" class="padding-large">
<label class="input-label"><%= scope.textHeight %></label>
<div id="chart-advanced-spin-height"></div>
</td>
</tr>
</table>
</div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan="4" width="88px" class="padding-small">
<label class="header"><%= scope.textPosition %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="121px">
<label class="input-label"><%= scope.textHorizontal %></label>
<div id="chart-advanced-spin-x"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textFrom %></label>
<div id="chart-advanced-combo-from-x"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textVertical %></label>
<div id="chart-advanced-spin-y"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textFrom %></label>
<div id="chart-advanced-combo-from-y"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-chart-alttext" class="settings-panel">
<div class="inner-content">
<table cols="1" width="100%">
<tr>

View file

@ -24,7 +24,6 @@
</tr>
</table>
</div>
<div class="padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
@ -33,14 +32,24 @@
</td>
</tr>
<tr>
<td class="padding-small" width="115px">
<label class="input-label">X</label>
<td class="padding-small" width="106px">
<label class="input-label"><%= scope.textHorizontal %></label>
<div id="image-advanced-spin-x"></div>
</td>
<td class="padding-small">
<label class="input-label">Y</label>
<label class="input-label"><%= scope.textFrom %></label>
<div id="image-advanced-combo-from-x"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textVertical %></label>
<div id="image-advanced-spin-y"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textFrom %></label>
<div id="image-advanced-combo-from-y"></div>
</td>
</tr>
</table>
</div>

View file

@ -2,20 +2,55 @@
<div class="inner-content">
<table cols="3">
<tr>
<td width="108px">
<td colspan="3" width="88px" class="padding-small">
<label class="header"><%= scope.textSize %></label>
</td>
</tr>
<tr>
<td width="93px">
<label class="input-label"><%= scope.textWidth %></label>
<div id="shape-advanced-spin-width"></div>
</td>
<td width="28px" style="vertical-align: bottom;">
<div id="shape-advanced-button-ratio"></div>
</td>
<td width="108px">
<td width="93px">
<label class="input-label"><%= scope.textHeight %></label>
<div id="shape-advanced-spin-height"></div>
</td>
</tr>
</table>
</div>
<div class="padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan="4" width="88px" class="padding-small">
<label class="header"><%= scope.textPosition %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="121px">
<label class="input-label"><%= scope.textHorizontal %></label>
<div id="shape-advanced-spin-x"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textFrom %></label>
<div id="shape-advanced-combo-from-x"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textVertical %></label>
<div id="shape-advanced-spin-y"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textFrom %></label>
<div id="shape-advanced-combo-from-y"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-shape-rotate" class="settings-panel active">
<div class="inner-content padding-large">

View file

@ -1,4 +1,58 @@
<div id="id-adv-table-cell-props" class="settings-panel active">
<div id="id-adv-table-placement" class="settings-panel active">
<div class="inner-content">
<table cols="3">
<tr>
<td colspan="3" width="88px" class="padding-small">
<label class="header"><%= scope.textSize %></label>
</td>
</tr>
<tr>
<td width="93px">
<label class="input-label"><%= scope.textWidth %></label>
<div id="tableadv-spin-width"></div>
</td>
<td width="28px" style="vertical-align: bottom;">
<div id="tableadv-button-ratio"></div>
</td>
<td width="93px">
<label class="input-label"><%= scope.textHeight %></label>
<div id="tableadv-spin-height"></div>
</td>
</tr>
</table>
</div>
<div class="padding-large"></div>
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>
<td colspan="4" width="88px" class="padding-small">
<label class="header"><%= scope.textPosition %></label>
</td>
</tr>
<tr>
<td class="padding-small" width="121px">
<label class="input-label"><%= scope.textHorizontal %></label>
<div id="tableadv-spin-x"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textFrom %></label>
<div id="tableadv-combo-from-x"></div>
</td>
</tr>
<tr>
<td class="padding-small">
<label class="input-label"><%= scope.textVertical %></label>
<div id="tableadv-spin-y"></div>
</td>
<td class="padding-small">
<label class="input-label"><%= scope.textFrom %></label>
<div id="tableadv-combo-from-y"></div>
</td>
</tr>
</table>
</div>
</div>
<div id="id-adv-table-cell-props" class="settings-panel">
<div class="inner-content">
<table cols="2" style="width: 100%;">
<tr>

View file

@ -486,6 +486,7 @@ define([
(new PE.Views.ChartSettingsAdvanced(
{
chartProps: elValue,
slideSize: PE.getController('Toolbar').currentPageSize,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {

View file

@ -50,13 +50,15 @@ define([ 'text!presentationeditor/main/app/template/ChartSettingsAdvanced.tem
height: 342,
toggleGroup: 'chart-adv-settings-group',
properties: null,
storageName: 'pe-chart-settings-adv-category'
storageName: 'pe-chart-settings-adv-category',
sizeMax: {width: 55.88, height: 55.88},
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle,
items: [
{panelId: 'id-adv-chart-placement', panelCaption: this.textPlacement},
{panelId: 'id-adv-chart-alttext', panelCaption: this.textAlt}
],
contentTemplate: _.template(contentTemplate)({
@ -65,7 +67,10 @@ define([ 'text!presentationeditor/main/app/template/ChartSettingsAdvanced.tem
}, options);
Common.Views.AdvancedSettingsWindow.prototype.initialize.call(this, this.options);
this.spinners = [];
this._originalProps = this.options.chartProps;
this.slideSize = this.options.slideSize;
this._changedProps = null;
},
@ -74,6 +79,129 @@ define([ 'text!presentationeditor/main/app/template/ChartSettingsAdvanced.tem
var me = this;
// Placement
this.spnWidth = new Common.UI.MetricSpinner({
el: $('#chart-advanced-spin-width'),
step: .1,
width: 85,
defaultUnit : "cm",
value: '3 cm',
maxValue: 55.88,
minValue: 0
});
this.spnWidth.on('change', _.bind(function(field){
if (this.btnRatio.pressed) {
var w = field.getNumberValue();
var h = w/this._nRatio;
if (h>this.sizeMax.height) {
h = this.sizeMax.height;
w = h * this._nRatio;
this.spnWidth.setValue(w, true);
}
this.spnHeight.setValue(h, true);
}
if (this._changedProps) {
this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue()));
}
}, this));
this.spinners.push(this.spnWidth);
this.spnHeight = new Common.UI.MetricSpinner({
el: $('#chart-advanced-spin-height'),
step: .1,
width: 85,
defaultUnit : "cm",
value: '3 cm',
maxValue: 55.88,
minValue: 0
});
this.spnHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){
var h = field.getNumberValue(), w = null;
if (this.btnRatio.pressed) {
w = h * this._nRatio;
if (w>this.sizeMax.width) {
w = this.sizeMax.width;
h = w/this._nRatio;
this.spnHeight.setValue(h, true);
}
this.spnWidth.setValue(w, true);
}
if (this._changedProps) {
this._changedProps.put_Height(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
this._changedProps.put_Width(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue()));
}
}, this));
this.spinners.push(this.spnHeight);
this.btnRatio = new Common.UI.Button({
parentEl: $('#chart-advanced-button-ratio'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon advanced-btn-ratio',
style: 'margin-bottom: 1px;',
enableToggle: true,
hint: this.textKeepRatio
});
this.btnRatio.on('click', _.bind(function(btn, e) {
if (btn.pressed && this.spnHeight.getNumberValue()>0) {
this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue();
}
if (this._changedProps) {
this._changedProps.asc_putLockAspect(btn.pressed);
}
}, this));
this.spnX = new Common.UI.MetricSpinner({
el: $('#chart-advanced-spin-x'),
step: .1,
width: 85,
defaultUnit : "cm",
defaultValue : 0,
value: '0 cm',
maxValue: 55.87,
minValue: -55.87
});
this.spinners.push(this.spnX);
this.spnY = new Common.UI.MetricSpinner({
el: $('#chart-advanced-spin-y'),
step: .1,
width: 85,
defaultUnit : "cm",
defaultValue : 0,
value: '0 cm',
maxValue: 55.87,
minValue: -55.87
});
this.spinners.push(this.spnY);
this.cmbFromX = new Common.UI.ComboBox({
el: $('#chart-advanced-combo-from-x'),
cls: 'input-group-nr',
style: "width: 115px;",
menuStyle: 'min-width: 115px;',
data: [
{ value: 'left', displayValue: this.textTopLeftCorner },
{ value: 'center', displayValue: this.textCenter }
],
editable: false,
takeFocusOnClose: true
});
this.cmbFromY = new Common.UI.ComboBox({
el: $('#chart-advanced-combo-from-y'),
cls: 'input-group-nr',
style: "width: 115px;",
menuStyle: 'min-width: 115px;',
data: [
{ value: 'left', displayValue: this.textTopLeftCorner },
{ value: 'center', displayValue: this.textCenter }
],
editable: false,
takeFocusOnClose: true
});
// Alt Text
this.inputAltTitle = new Common.UI.InputField({
@ -97,6 +225,7 @@ define([ 'text!presentationeditor/main/app/template/ChartSettingsAdvanced.tem
},
afterRender: function() {
this.updateMetricUnit();
this._setDefaults(this._originalProps);
if (this.storageName) {
var value = Common.localStorage.getItem(this.storageName);
@ -106,7 +235,8 @@ define([ 'text!presentationeditor/main/app/template/ChartSettingsAdvanced.tem
getFocusedComponents: function() {
return [
this.inputAltTitle, this.textareaAltDescription // 0 tab
this.spnWidth, this.spnHeight, this.spnX, this.cmbFromX, this.spnY, this.cmbFromY, // 0 tab
this.inputAltTitle, this.textareaAltDescription // 1 tab
];
},
@ -117,6 +247,9 @@ define([ 'text!presentationeditor/main/app/template/ChartSettingsAdvanced.tem
setTimeout(function(){
switch (index) {
case 0:
me.spnWidth.focus();
break;
case 1:
me.inputAltTitle.focus();
break;
}
@ -125,6 +258,30 @@ define([ 'text!presentationeditor/main/app/template/ChartSettingsAdvanced.tem
_setDefaults: function(props) {
if (props ){
this.spnWidth.setMaxValue(this.sizeMax.width);
this.spnHeight.setMaxValue(this.sizeMax.height);
this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(props.asc_getWidth()).toFixed(2), true);
this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.asc_getHeight()).toFixed(2), true);
if (props.asc_getHeight()>0)
this._nRatio = props.asc_getWidth()/props.asc_getHeight();
var value = props.asc_getLockAspect();
this.btnRatio.toggle(value);
this.cmbFromX.setValue('left');
this.cmbFromY.setValue('left');
if (props.asc_getPosition()) {
var Position = {X: props.asc_getPosition().get_X(), Y: props.asc_getPosition().get_Y()};
this.spnX.setValue((Position.X !== null && Position.X !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.X) : '', true);
this.spnY.setValue((Position.Y !== null && Position.Y !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.Y) : '', true);
} else {
this.spnX.setValue('', true);
this.spnY.setValue('', true);
}
var value = props.asc_getTitle();
this.inputAltTitle.setValue(value ? value : '');
@ -136,6 +293,23 @@ define([ 'text!presentationeditor/main/app/template/ChartSettingsAdvanced.tem
},
getSettings: function() {
var Position = new Asc.CPosition();
if (this.spnX.getValue() !== '') {
var x = Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue());
if (this.cmbFromX.getValue() === 'center') {
x = (this.slideSize.width/36000)/2 + x;
}
Position.put_X(x);
}
if (this.spnY.getValue() !== '') {
var y = Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue());
if (this.cmbFromY.getValue() === 'center') {
y = (this.slideSize.height/36000)/2 + y;
}
Position.put_Y(y);
}
this._changedProps.asc_putPosition(Position);
if (this.isAltTitleChanged)
this._changedProps.asc_putTitle(this.inputAltTitle.getValue());
@ -145,11 +319,36 @@ define([ 'text!presentationeditor/main/app/template/ChartSettingsAdvanced.tem
return { chartProps: this._changedProps} ;
},
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);
}
}
this.sizeMax = {
width: Common.Utils.Metric.fnRecalcFromMM(this.options.sizeMax.width*10),
height: Common.Utils.Metric.fnRecalcFromMM(this.options.sizeMax.height*10)
};
},
textTitle: 'Chart - Advanced Settings',
textAlt: 'Alternative Text',
textAltTitle: 'Title',
textAltDescription: 'Description',
textAltTip: 'The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table.'
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.',
textPlacement: 'Placement',
textSize: 'Size',
textWidth: 'Width',
textHeight: 'Height',
textPosition: 'Position',
textHorizontal: 'Horizontal',
textVertical: 'Vertical',
textFrom: 'From',
textTopLeftCorner: 'Top Left Corner',
textCenter: 'Center',
textKeepRatio: 'Constant Proportions',
}, PE.Views.ChartSettingsAdvanced || {}));
});

View file

@ -2484,6 +2484,7 @@ define([
(new PE.Views.TableSettingsAdvanced(
{
tableProps: elValue,
slideSize: PE.getController('Toolbar').currentPageSize,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
@ -2527,6 +2528,7 @@ define([
{
imageProps: elValue,
sizeOriginal: imgsizeOriginal,
slideSize: PE.getController('Toolbar').currentPageSize,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
@ -2559,6 +2561,7 @@ define([
(new PE.Views.ShapeSettingsAdvanced(
{
shapeProps: elValue,
slideSize: PE.getController('Toolbar').currentPageSize,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {

View file

@ -436,6 +436,7 @@ define([
{
imageProps: elValue,
sizeOriginal: imgsizeOriginal,
slideSize: PE.getController('Toolbar').currentPageSize,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {

View file

@ -74,6 +74,7 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem
this._nRatio = 1;
this._isDefaultSize = false;
this._originalProps = this.options.imageProps;
this.slideSize = this.options.slideSize;
},
render: function() {
@ -178,6 +179,32 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem
});
this.spinners.push(this.spnY);
this.cmbFromX = new Common.UI.ComboBox({
el: $('#image-advanced-combo-from-x'),
cls: 'input-group-nr',
style: "width: 115px;",
menuStyle: 'min-width: 115px;',
data: [
{ value: 'left', displayValue: this.textTopLeftCorner },
{ value: 'center', displayValue: this.textCenter }
],
editable: false,
takeFocusOnClose: true
});
this.cmbFromY = new Common.UI.ComboBox({
el: $('#image-advanced-combo-from-y'),
cls: 'input-group-nr',
style: "width: 115px;",
menuStyle: 'min-width: 115px;',
data: [
{ value: 'left', displayValue: this.textTopLeftCorner },
{ value: 'center', displayValue: this.textCenter }
],
editable: false,
takeFocusOnClose: true
});
// Rotation
this.spnAngle = new Common.UI.MetricSpinner({
el: $('#image-advanced-spin-angle'),
@ -223,7 +250,7 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem
getFocusedComponents: function() {
return [
this.spnWidth, this.spnHeight, this.btnOriginalSize, this.spnX, this.spnY,// 0 tab
this.spnWidth, this.spnHeight, this.btnOriginalSize, this.spnX, this.cmbFromX, this.spnY, this.cmbFromY,// 0 tab
this.spnAngle, this.chFlipHor, this.chFlipVert, // 1 tab
this.inputAltTitle, this.textareaAltDescription // 2 tab
];
@ -271,6 +298,9 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem
if (props.get_Height()>0)
this._nRatio = props.get_Width()/props.get_Height();
this.cmbFromX.setValue('left');
this.cmbFromY.setValue('left');
if (props.get_Position()) {
var Position = {X: props.get_Position().get_X(), Y: props.get_Position().get_Y()};
this.spnX.setValue((Position.X !== null && Position.X !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.X) : '', true);
@ -306,10 +336,20 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem
properties.put_ResetCrop(this._isDefaultSize);
var Position = new Asc.CPosition();
if (this.spnX.getValue() !== '')
Position.put_X(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue()));
if (this.spnY.getValue() !== '')
Position.put_Y(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue()));
if (this.spnX.getValue() !== '') {
var x = Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue());
if (this.cmbFromX.getValue() === 'center') {
x = (this.slideSize.width/36000)/2 + x;
}
Position.put_X(x);
}
if (this.spnY.getValue() !== '') {
var y = Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue());
if (this.cmbFromY.getValue() === 'center') {
y = (this.slideSize.height/36000)/2 + y;
}
Position.put_Y(y);
}
properties.put_Position(Position);
if (this.isAltTitleChanged)
@ -360,7 +400,12 @@ define([ 'text!presentationeditor/main/app/template/ImageSettingsAdvanced.tem
textAngle: 'Angle',
textFlipped: 'Flipped',
textHorizontally: 'Horizontally',
textVertically: 'Vertically'
textVertically: 'Vertically',
textHorizontal: 'Horizontal',
textVertical: 'Vertical',
textFrom: 'From',
textTopLeftCorner: 'Top Left Corner',
textCenter: 'Center'
}, PE.Views.ImageSettingsAdvanced || {}));
});

View file

@ -737,6 +737,7 @@ define([
(new PE.Views.ShapeSettingsAdvanced(
{
shapeProps: elValue,
slideSize: PE.getController('Toolbar').currentPageSize,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {

View file

@ -61,7 +61,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
_.extend(this.options, {
title: this.textTitle,
items: [
{panelId: 'id-adv-shape-width', panelCaption: this.textSize},
{panelId: 'id-adv-shape-width', panelCaption: this.textPlacement},
{panelId: 'id-adv-shape-rotate', panelCaption: this.textRotation},
{panelId: 'id-adv-shape-shape', panelCaption: this.textWeightArrows},
{panelId: 'id-adv-shape-margins', panelCaption: this.textTextBox},
@ -80,6 +80,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
this._nRatio = 1;
this._originalProps = this.options.shapeProps;
this.slideSize = this.options.slideSize;
this._changedProps = null;
},
@ -91,7 +92,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
this.spnWidth = new Common.UI.MetricSpinner({
el: $('#shape-advanced-spin-width'),
step: .1,
width: 100,
width: 85,
defaultUnit : "cm",
value: '3 cm',
maxValue: 55.88,
@ -118,7 +119,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
this.spnHeight = new Common.UI.MetricSpinner({
el: $('#shape-advanced-spin-height'),
step: .1,
width: 100,
width: 85,
defaultUnit : "cm",
value: '3 cm',
maxValue: 55.88,
@ -159,6 +160,56 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
}
}, this));
this.spnX = new Common.UI.MetricSpinner({
el: $('#shape-advanced-spin-x'),
step: .1,
width: 85,
defaultUnit : "cm",
defaultValue : 0,
value: '0 cm',
maxValue: 55.87,
minValue: -55.87
});
this.spinners.push(this.spnX);
this.spnY = new Common.UI.MetricSpinner({
el: $('#shape-advanced-spin-y'),
step: .1,
width: 85,
defaultUnit : "cm",
defaultValue : 0,
value: '0 cm',
maxValue: 55.87,
minValue: -55.87
});
this.spinners.push(this.spnY);
this.cmbFromX = new Common.UI.ComboBox({
el: $('#shape-advanced-combo-from-x'),
cls: 'input-group-nr',
style: "width: 115px;",
menuStyle: 'min-width: 115px;',
data: [
{ value: 'left', displayValue: this.textTopLeftCorner },
{ value: 'center', displayValue: this.textCenter }
],
editable: false,
takeFocusOnClose: true
});
this.cmbFromY = new Common.UI.ComboBox({
el: $('#shape-advanced-combo-from-y'),
cls: 'input-group-nr',
style: "width: 115px;",
menuStyle: 'min-width: 115px;',
data: [
{ value: 'left', displayValue: this.textTopLeftCorner },
{ value: 'center', displayValue: this.textCenter }
],
editable: false,
takeFocusOnClose: true
});
// Margins
this.spnMarginTop = new Common.UI.MetricSpinner({
el: $('#shape-margin-top'),
@ -521,7 +572,7 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
getFocusedComponents: function() {
return [
this.spnWidth, this.spnHeight, // 0 tab
this.spnWidth, this.spnHeight, this.spnX, this.cmbFromX, this.spnY, this.cmbFromY, // 0 tab
this.spnAngle, this.chFlipHor, this.chFlipVert, // 1 tab
this.cmbCapType, this.cmbJoinType, // 2 tab
this.radioNofit, this.radioShrink, this.radioFit, this.spnMarginTop, this.spnMarginLeft, this.spnMarginBottom, this.spnMarginRight, // 3 tab
@ -578,15 +629,27 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
this.radioFit.setDisabled(true);
}
this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_Width()).toFixed(2), true);
this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_Height()).toFixed(2), true);
this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(props.asc_getWidth()).toFixed(2), true);
this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.asc_getHeight()).toFixed(2), true);
if (props.get_Height()>0)
this._nRatio = props.get_Width()/props.get_Height();
if (props.asc_getHeight()>0)
this._nRatio = props.asc_getWidth()/props.asc_getHeight();
var value = props.asc_getLockAspect();
this.btnRatio.toggle(value);
this.cmbFromX.setValue('left');
this.cmbFromY.setValue('left');
if (props.asc_getPosition()) {
var Position = {X: props.asc_getPosition().get_X(), Y: props.asc_getPosition().get_Y()};
this.spnX.setValue((Position.X !== null && Position.X !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.X) : '', true);
this.spnY.setValue((Position.Y !== null && Position.Y !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(Position.Y) : '', true);
} else {
this.spnX.setValue('', true);
this.spnY.setValue('', true);
}
this._setShapeDefaults(props);
var margins = props.get_paddings();
@ -643,6 +706,23 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
},
getSettings: function() {
var Position = new Asc.CPosition();
if (this.spnX.getValue() !== '') {
var x = Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue());
if (this.cmbFromX.getValue() === 'center') {
x = (this.slideSize.width/36000)/2 + x;
}
Position.put_X(x);
}
if (this.spnY.getValue() !== '') {
var y = Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue());
if (this.cmbFromY.getValue() === 'center') {
y = (this.slideSize.height/36000)/2 + y;
}
Position.put_Y(y);
}
this._changedProps.asc_putPosition(Position);
if (this.isAltTitleChanged)
this._changedProps.asc_putTitle(this.inputAltTitle.getValue());
@ -868,7 +948,14 @@ define([ 'text!presentationeditor/main/app/template/ShapeSettingsAdvanced.tem
textAutofit: 'AutoFit',
textNofit: 'Do not Autofit',
textShrink: 'Shrink text on overflow',
textResizeFit: 'Resize shape to fit text'
textResizeFit: 'Resize shape to fit text',
textPlacement: 'Placement',
textPosition: 'Position',
textHorizontal: 'Horizontal',
textFrom: 'From',
textVertical: 'Vertical',
textTopLeftCorner: 'Top Left Corner',
textCenter: 'Center'
}, PE.Views.ShapeSettingsAdvanced || {}));
});

View file

@ -763,6 +763,7 @@ define([
(new PE.Views.TableSettingsAdvanced(
{
tableProps: elValue,
slideSize: PE.getController('Toolbar').currentPageSize,
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {

View file

@ -49,13 +49,15 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
alias: 'TableSettingsAdvanced',
contentWidth: 280,
height: 385,
storageName: 'pe-table-settings-adv-category'
storageName: 'pe-table-settings-adv-category',
sizeMax: {width: 55.88, height: 55.88},
},
initialize : function(options) {
_.extend(this.options, {
title: this.textTitle,
items: [
{panelId: 'id-adv-table-placement', panelCaption: this.textPlacement},
{panelId: 'id-adv-table-cell-props', panelCaption: this.textWidthSpaces},
{panelId: 'id-adv-table-alttext', panelCaption: this.textAlt}
],
@ -86,6 +88,7 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
this._initialMarginsDefault = false; // если для всех выделенных ячеек пришло одинаковое значение Flag=0 (Use Default Margins)
this._originalProps = new Asc.CTableProp(this.options.tableProps);
this.slideSize = this.options.slideSize;
},
render: function() {
@ -93,6 +96,117 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
var me = this;
// Placement
this.spnWidth = new Common.UI.MetricSpinner({
el: $('#tableadv-spin-width'),
step: .1,
width: 85,
defaultUnit : "cm",
value: '3 cm',
maxValue: 55.88,
minValue: 0
});
this.spnWidth.on('change', _.bind(function(field){
if (this.btnRatio.pressed) {
var w = field.getNumberValue();
var h = w/this._nRatio;
if (h>this.sizeMax.height) {
h = this.sizeMax.height;
w = h * this._nRatio;
this.spnWidth.setValue(w, true);
}
this.spnHeight.setValue(h, true);
}
}, this));
this.spinners.push(this.spnWidth);
this.spnHeight = new Common.UI.MetricSpinner({
el: $('#tableadv-spin-height'),
step: .1,
width: 85,
defaultUnit : "cm",
value: '3 cm',
maxValue: 55.88,
minValue: 0
});
this.spnHeight.on('change', _.bind(function(field, newValue, oldValue, eOpts){
var h = field.getNumberValue(), w = null;
if (this.btnRatio.pressed) {
w = h * this._nRatio;
if (w>this.sizeMax.width) {
w = this.sizeMax.width;
h = w/this._nRatio;
this.spnHeight.setValue(h, true);
}
this.spnWidth.setValue(w, true);
}
}, this));
this.spinners.push(this.spnHeight);
this.btnRatio = new Common.UI.Button({
parentEl: $('#tableadv-button-ratio'),
cls: 'btn-toolbar',
iconCls: 'toolbar__icon advanced-btn-ratio',
style: 'margin-bottom: 1px;',
enableToggle: true,
hint: this.textKeepRatio
});
this.btnRatio.on('click', _.bind(function(btn, e) {
if (btn.pressed && this.spnHeight.getNumberValue()>0) {
this._nRatio = this.spnWidth.getNumberValue()/this.spnHeight.getNumberValue();
}
}, this));
this.spnX = new Common.UI.MetricSpinner({
el: $('#tableadv-spin-x'),
step: .1,
width: 85,
defaultUnit : "cm",
defaultValue : 0,
value: '0 cm',
maxValue: 55.87,
minValue: -55.87
});
this.spinners.push(this.spnX);
this.spnY = new Common.UI.MetricSpinner({
el: $('#tableadv-spin-y'),
step: .1,
width: 85,
defaultUnit : "cm",
defaultValue : 0,
value: '0 cm',
maxValue: 55.87,
minValue: -55.87
});
this.spinners.push(this.spnY);
this.cmbFromX = new Common.UI.ComboBox({
el: $('#tableadv-combo-from-x'),
cls: 'input-group-nr',
style: "width: 115px;",
menuStyle: 'min-width: 115px;',
data: [
{ value: 'left', displayValue: this.textTopLeftCorner },
{ value: 'center', displayValue: this.textCenter }
],
editable: false,
takeFocusOnClose: true
});
this.cmbFromY = new Common.UI.ComboBox({
el: $('#tableadv-combo-from-y'),
cls: 'input-group-nr',
style: "width: 115px;",
menuStyle: 'min-width: 115px;',
data: [
{ value: 'left', displayValue: this.textTopLeftCorner },
{ value: 'center', displayValue: this.textCenter }
],
editable: false,
takeFocusOnClose: true
});
this._marginsChange = function(field, newValue, oldValue, eOpts, source, property){
if (source=='table')
this.TableMargins[property] = field.getNumberValue();
@ -317,9 +431,10 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
getFocusedComponents: function() {
return [
this.spnWidth, this.spnHeight, this.spnX, this.cmbFromX, this.spnY, this.cmbFromY, // 0 tab
this.chCellMargins, this.spnMarginTop, this.spnMarginLeft, this.spnMarginBottom, this.spnMarginRight,
this.spnTableMarginTop, this.spnTableMarginLeft, this.spnTableMarginBottom, this.spnTableMarginRight, // 0 tab
this.inputAltTitle, this.textareaAltDescription // 1 tab
this.spnTableMarginTop, this.spnTableMarginLeft, this.spnTableMarginBottom, this.spnTableMarginRight, // 1 tab
this.inputAltTitle, this.textareaAltDescription // 2 tab
];
},
@ -330,12 +445,15 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
setTimeout(function(){
switch (index) {
case 0:
me.spnWidth.focus();
break;
case 1:
if (!me.spnMarginTop.isDisabled())
me.spnMarginTop.focus();
else
me.spnTableMarginTop.focus();
break;
case 1:
case 2:
me.inputAltTitle.focus();
break;
}
@ -352,6 +470,27 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
},
getSettings: function() {
if (this.spnHeight.getValue()!=='')
this._changedProps.put_FrameHeight(Common.Utils.Metric.fnRecalcToMM(this.spnHeight.getNumberValue()));
if (this.spnWidth.getValue()!=='')
this._changedProps.put_FrameWidth(Common.Utils.Metric.fnRecalcToMM(this.spnWidth.getNumberValue()));
this._changedProps.put_FrameLockAspect(this.btnRatio.pressed);
if (this.spnX.getValue() !== '') {
var x = Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue());
if (this.cmbFromX.getValue() === 'center') {
x = (this.slideSize.width/36000)/2 + x;
}
this._changedProps.put_FrameX(x);
}
if (this.spnY.getValue() !== '') {
var y = Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue());
if (this.cmbFromY.getValue() === 'center') {
y = (this.slideSize.height/36000)/2 + y;
}
this._changedProps.put_FrameY(y);
}
if (this.isAltTitleChanged)
this._changedProps.put_TableCaption(this.inputAltTitle.getValue());
@ -365,6 +504,24 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
if (props ){
this._allTable = !props.get_CellSelect();
// placement
this.spnWidth.setMaxValue(this.sizeMax.width);
this.spnHeight.setMaxValue(this.sizeMax.height);
this.spnWidth.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_FrameWidth()).toFixed(2), true);
this.spnHeight.setValue(Common.Utils.Metric.fnRecalcFromMM(props.get_FrameHeight()).toFixed(2), true);
var value = props.get_FrameLockAspect();
this.btnRatio.toggle(value);
if (props.get_FrameHeight()>0)
this._nRatio = props.get_FrameWidth()/props.get_FrameHeight();
this.cmbFromX.setValue('left');
this.cmbFromY.setValue('left');
var position = {x: props.get_FrameX(), y: props.get_FrameY()};
this.spnX.setValue((position.x !== null && position.x !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(position.x) : '', true);
this.spnY.setValue((position.y !== null && position.y !== undefined) ? Common.Utils.Metric.fnRecalcFromMM(position.y) : '', true);
// margins
var margins = props.get_DefaultMargins();
if (margins) {
@ -442,6 +599,10 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
spinner.setStep(Common.Utils.Metric.getCurrentMetric()==Common.Utils.Metric.c_MetricUnits.pt ? 1 : 0.1);
}
}
this.sizeMax = {
width: Common.Utils.Metric.fnRecalcFromMM(this.options.sizeMax.width*10),
height: Common.Utils.Metric.fnRecalcFromMM(this.options.sizeMax.height*10)
};
},
textWidthSpaces: 'Margins',
@ -456,7 +617,18 @@ define([ 'text!presentationeditor/main/app/template/TableSettingsAdvanced.tem
textAlt: 'Alternative Text',
textAltTitle: 'Title',
textAltDescription: 'Description',
textAltTip: 'The alternative text-based representation of the visual object information, which will be read to the people with vision or cognitive impairments to help them better understand what information there is in the image, autoshape, chart or table.'
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.',
textPlacement: 'Placement',
textSize: 'Size',
textPosition: 'Position',
textHorizontal: 'Horizontal',
textVertical: 'Vertical',
textFrom: 'From',
textTopLeftCorner: 'Top Left Corner',
textCenter: 'Center',
textWidth: 'Width',
textHeight: 'Height',
textKeepRatio: 'Constant Proportions'
}, PE.Views.TableSettingsAdvanced || {}));
});

View file

@ -1321,6 +1321,17 @@
"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.textTitle": "Chart - Advanced Settings",
"PE.Views.ChartSettingsAdvanced.textPlacement": "Placement",
"PE.Views.ChartSettingsAdvanced.textSize": "Size",
"PE.Views.ChartSettingsAdvanced.textWidth": "Width",
"PE.Views.ChartSettingsAdvanced.textHeight": "Height",
"PE.Views.ChartSettingsAdvanced.textPosition": "Position",
"PE.Views.ChartSettingsAdvanced.textHorizontal": "Horizontal",
"PE.Views.ChartSettingsAdvanced.textVertical": "Vertical",
"PE.Views.ChartSettingsAdvanced.textFrom": "From",
"PE.Views.ChartSettingsAdvanced.textTopLeftCorner": "Top Left Corner",
"PE.Views.ChartSettingsAdvanced.textCenter": "Center",
"PE.Views.ChartSettingsAdvanced.textKeepRatio": "Constant Proportions",
"PE.Views.DateTimeDialog.confirmDefault": "Set default format for {0}: \"{1}\"",
"PE.Views.DateTimeDialog.textDefault": "Set as default",
"PE.Views.DateTimeDialog.textFormat": "Formats",
@ -1696,6 +1707,11 @@
"PE.Views.ImageSettingsAdvanced.textTitle": "Image - Advanced Settings",
"PE.Views.ImageSettingsAdvanced.textVertically": "Vertically",
"PE.Views.ImageSettingsAdvanced.textWidth": "Width",
"PE.Views.ImageSettingsAdvanced.textHorizontal": "Horizontal",
"PE.Views.ImageSettingsAdvanced.textVertical": "Vertical",
"PE.Views.ImageSettingsAdvanced.textFrom": "From",
"PE.Views.ImageSettingsAdvanced.textTopLeftCorner": "Top Left Corner",
"PE.Views.ImageSettingsAdvanced.textCenter": "Center",
"PE.Views.LeftMenu.tipAbout": "About",
"PE.Views.LeftMenu.tipChat": "Chat",
"PE.Views.LeftMenu.tipComments": "Comments",
@ -1861,6 +1877,13 @@
"PE.Views.ShapeSettingsAdvanced.textWeightArrows": "Weights & Arrows",
"PE.Views.ShapeSettingsAdvanced.textWidth": "Width",
"PE.Views.ShapeSettingsAdvanced.txtNone": "None",
"PE.Views.ShapeSettingsAdvanced.textPlacement": "Placement",
"PE.Views.ShapeSettingsAdvanced.textPosition": "Position",
"PE.Views.ShapeSettingsAdvanced.textHorizontal": "Horizontal",
"PE.Views.ShapeSettingsAdvanced.textFrom": "From",
"PE.Views.ShapeSettingsAdvanced.textVertical": "Vertical",
"PE.Views.ShapeSettingsAdvanced.textTopLeftCorner": "Top Left Corner",
"PE.Views.ShapeSettingsAdvanced.textCenter": "Center",
"PE.Views.SignatureSettings.notcriticalErrorTitle": "Warning",
"PE.Views.SignatureSettings.strDelete": "Remove Signature",
"PE.Views.SignatureSettings.strDetails": "Signature Details",
@ -2018,6 +2041,17 @@
"PE.Views.TableSettingsAdvanced.textTitle": "Table - Advanced Settings",
"PE.Views.TableSettingsAdvanced.textTop": "Top",
"PE.Views.TableSettingsAdvanced.textWidthSpaces": "Margins",
"PE.Views.TableSettingsAdvanced.textPlacement": "Placement",
"PE.Views.TableSettingsAdvanced.textSize": "Size",
"PE.Views.TableSettingsAdvanced.textWidth": "Width",
"PE.Views.TableSettingsAdvanced.textHeight": "Height",
"PE.Views.TableSettingsAdvanced.textPosition": "Position",
"PE.Views.TableSettingsAdvanced.textHorizontal": "Horizontal",
"PE.Views.TableSettingsAdvanced.textVertical": "Vertical",
"PE.Views.TableSettingsAdvanced.textFrom": "From",
"PE.Views.TableSettingsAdvanced.textTopLeftCorner": "Top Left Corner",
"PE.Views.TableSettingsAdvanced.textCenter": "Center",
"PE.Views.TableSettingsAdvanced.textKeepRatio": "Constant Proportions",
"PE.Views.TextArtSettings.strBackground": "Background color",
"PE.Views.TextArtSettings.strColor": "Color",
"PE.Views.TextArtSettings.strFill": "Fill",