Commit 64b8732b authored by Julia Radzhabova's avatar Julia Radzhabova

[DE] ImageSettingsAdvanced: добавлена настройка относительной позиции в процентах.

parent 312efd8e
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
<div class="inner-content"> <div class="inner-content">
<table cols="3" style="width: 100%;"> <table cols="3" style="width: 100%;">
<tr> <tr>
<td colspan="3" class="padding-small"> <td colspan="3">
<label class="header"><%= scope.textHorizontal %></label> <label class="header"><%= scope.textHorizontal %></label>
</td> </td>
</tr> </tr>
...@@ -101,7 +101,20 @@ ...@@ -101,7 +101,20 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="3" class="padding-small"> <td style="vertical-align: bottom; padding-bottom: 19px;">
<div id="image-radio-hpositionpc"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.textPositionPc %></label>
<div id="image-spin-xpc"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.textRelative %></label>
<div id="image-combo-hpositionpc" style="width: 115px;"></div>
</td>
</tr>
<tr>
<td colspan="3">
<label class="header"><%= scope.textVertical %></label> <label class="header"><%= scope.textVertical %></label>
</td> </td>
</tr> </tr>
...@@ -119,25 +132,38 @@ ...@@ -119,25 +132,38 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="vertical-align: bottom; padding-bottom: 19px;"> <td style="vertical-align: bottom; padding-bottom: 12px;">
<div id="image-radio-vposition"></div> <div id="image-radio-vposition"></div>
</td> </td>
<td class="padding-large"> <td class="padding-small">
<label class="input-label"><%= scope.textPosition %></label> <label class="input-label"><%= scope.textPosition %></label>
<div id="image-spin-y"></div> <div id="image-spin-y"></div>
</td> </td>
<td class="padding-large"> <td class="padding-small">
<label class="input-label"><%= scope.textBelow %></label> <label class="input-label"><%= scope.textBelow %></label>
<div id="image-combo-vposition" style="width: 115px;"></div> <div id="image-combo-vposition" style="width: 115px;"></div>
</td> </td>
</tr> </tr>
<tr>
<td style="vertical-align: bottom; padding-bottom: 19px;">
<div id="image-radio-vpositionpc"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.textPositionPc %></label>
<div id="image-spin-ypc"></div>
</td>
<td class="padding-large">
<label class="input-label"><%= scope.textRelative %></label>
<div id="image-combo-vpositionpc" style="width: 115px;"></div>
</td>
</tr>
</table> </table>
</div> </div>
<div class="separator horizontal padding-large"></div> <div class="separator horizontal padding-small"></div>
<div class="inner-content"> <div class="inner-content">
<table cols="2" style="width: 100%;"> <table cols="2" style="width: 100%;">
<tr> <tr>
<td colspan="2" class="padding-small"> <td colspan="2">
<label class="header"><%= scope.textOptions %></label> <label class="header"><%= scope.textOptions %></label>
</td> </td>
</tr> </tr>
......
...@@ -391,6 +391,7 @@ define([ ...@@ -391,6 +391,7 @@ define([
{ {
imageProps: elValue, imageProps: elValue,
sizeMax: imgsizeMax, sizeMax: imgsizeMax,
sectionProps: me.api.asc_GetSectionProps(),
handler: function(result, value) { handler: function(result, value) {
if (result == 'ok') { if (result == 'ok') {
if (me.api) { if (me.api) {
......
...@@ -1912,6 +1912,7 @@ define([ ...@@ -1912,6 +1912,7 @@ define([
imageProps : elValue, imageProps : elValue,
sizeOriginal: imgsizeOriginal, sizeOriginal: imgsizeOriginal,
sizeMax : imgsizeMax, sizeMax : imgsizeMax,
sectionProps: me.api.asc_GetSectionProps(),
handler : function(result, value) { handler : function(result, value) {
if (result == 'ok') { if (result == 'ok') {
if (me.api) { if (me.api) {
......
...@@ -304,6 +304,7 @@ define([ ...@@ -304,6 +304,7 @@ define([
imageProps: elValue, imageProps: elValue,
sizeOriginal: imgsizeOriginal, sizeOriginal: imgsizeOriginal,
sizeMax: imgsizeMax, sizeMax: imgsizeMax,
sectionProps: me.api.asc_GetSectionProps(),
handler: function(result, value) { handler: function(result, value) {
if (result == 'ok') { if (result == 'ok') {
if (me.api) { if (me.api) {
......
...@@ -18,7 +18,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -18,7 +18,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
DE.Views.ImageSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({ DE.Views.ImageSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: { options: {
contentWidth: 340, contentWidth: 340,
height: 422, height: 485,
toggleGroup: 'image-adv-settings-group', toggleGroup: 'image-adv-settings-group',
sizeOriginal: {width: 0, height: 0}, sizeOriginal: {width: 0, height: 0},
sizeMax: {width: 55.88, height: 55.88}, sizeMax: {width: 55.88, height: 55.88},
...@@ -47,17 +47,23 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -47,17 +47,23 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
HAlignType: c_oAscAlignH.Left, HAlignType: c_oAscAlignH.Left,
HAlignFrom: c_oAscRelativeFromH.Character, HAlignFrom: c_oAscRelativeFromH.Character,
HPositionFrom: c_oAscRelativeFromH.Character, HPositionFrom: c_oAscRelativeFromH.Character,
HPositionPcFrom: c_oAscRelativeFromH.Page,
VAlignType: c_oAscAlignV.Top, VAlignType: c_oAscAlignV.Top,
VAlignFrom: c_oAscRelativeFromV.Line, VAlignFrom: c_oAscRelativeFromV.Line,
VPositionFrom: c_oAscRelativeFromV.Line, VPositionFrom: c_oAscRelativeFromV.Line,
VPositionPcFrom: c_oAscRelativeFromV.Page,
spnXChanged: false, spnXChanged: false,
spnYChanged: false spnYChanged: false,
spnXPcChanged: false,
spnYPcChanged: false
}; };
this._objectType = c_oAscTypeSelectElement.Image; this._objectType = c_oAscTypeSelectElement.Image;
this.Margins = undefined; this.Margins = undefined;
this._nRatio = 1; this._nRatio = 1;
this._originalProps = this.options.imageProps; this._originalProps = this.options.imageProps;
this.pageWidth = this.options.sectionProps ? this.options.sectionProps.get_W() : 210;
this.pageHeight = this.options.sectionProps ? this.options.sectionProps.get_H() : 297;
this._changedProps = null; this._changedProps = null;
this._changedShapeProps = null; this._changedShapeProps = null;
}, },
...@@ -329,6 +335,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -329,6 +335,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._changedProps.put_PositionH(new CImagePositionH()); this._changedProps.put_PositionH(new CImagePositionH());
this._changedProps.get_PositionH().put_UseAlign(false); this._changedProps.get_PositionH().put_UseAlign(false);
this._changedProps.get_PositionH().put_Percent(false);
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom); this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom);
this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
this._state.spnXChanged = true; this._state.spnXChanged = true;
...@@ -353,6 +360,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -353,6 +360,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._changedProps.put_PositionV(new CImagePositionV()); this._changedProps.put_PositionV(new CImagePositionV());
this._changedProps.get_PositionV().put_UseAlign(false); this._changedProps.get_PositionV().put_UseAlign(false);
this._changedProps.get_PositionV().put_Percent(false);
this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom); this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom);
this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue())); this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
this._state.spnYChanged = true; this._state.spnYChanged = true;
...@@ -407,6 +415,48 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -407,6 +415,48 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this.cmbHPosition.setValue(this._state.HPositionFrom); this.cmbHPosition.setValue(this._state.HPositionFrom);
this.cmbHPosition.on('selected', _.bind(this.onHPositionSelect, this)); this.cmbHPosition.on('selected', _.bind(this.onHPositionSelect, this));
this.spnXPc = new Common.UI.MetricSpinner({
el: $('#image-spin-xpc'),
step: 1,
width: 115,
disabled: true,
defaultUnit : "%",
defaultValue : 0,
value: '0 %',
maxValue: 1000,
minValue: -1000
});
this.spnXPc.on('change', _.bind(function(field, newValue, oldValue, eOpts){
if (this._changedProps) {
if (this._changedProps.get_PositionH()===null || this._changedProps.get_PositionH()===undefined)
this._changedProps.put_PositionH(new CImagePositionH());
this._changedProps.get_PositionH().put_UseAlign(false);
this._changedProps.get_PositionH().put_Percent(true);
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionPcFrom);
this._changedProps.get_PositionH().put_Value(field.getNumberValue());
this._state.spnXPcChanged = true;
}
}, this));
this._arrHRelativePc = [
{displayValue: this.textLeftMargin, value: c_oAscRelativeFromH.LeftMargin},
{displayValue: this.textMargin, value: c_oAscRelativeFromH.Margin},
{displayValue: this.textPage, value: c_oAscRelativeFromH.Page},
{displayValue: this.textRightMargin, value: c_oAscRelativeFromH.RightMargin}
];
this.cmbHPositionPc = new Common.UI.ComboBox({
el: $('#image-combo-hpositionpc'),
cls: 'input-group-nr',
menuStyle: 'min-width: 115px;',
editable: false,
data: this._arrHRelativePc
});
this.cmbHPositionPc.setDisabled(true);
this.cmbHPositionPc.setValue(this._state.HPositionPcFrom);
this.cmbHPositionPc.on('selected', _.bind(this.onHPositionPcSelect, this));
// Vertical // Vertical
this._arrVAlign = [ this._arrVAlign = [
{displayValue: this.textTop, value: c_oAscAlignV.Top}, {displayValue: this.textTop, value: c_oAscAlignV.Top},
...@@ -454,6 +504,48 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -454,6 +504,48 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this.cmbVPosition.setValue(this._state.VPositionFrom); this.cmbVPosition.setValue(this._state.VPositionFrom);
this.cmbVPosition.on('selected', _.bind(this.onVPositionSelect, this)); this.cmbVPosition.on('selected', _.bind(this.onVPositionSelect, this));
this.spnYPc = new Common.UI.MetricSpinner({
el: $('#image-spin-ypc'),
step: 1,
width: 115,
disabled: true,
defaultUnit : "%",
defaultValue : 0,
value: '0 %',
maxValue: 1000,
minValue: -1000
});
this.spnYPc.on('change', _.bind(function(field, newValue, oldValue, eOpts){
if (this._changedProps) {
if (this._changedProps.get_PositionV()===null || this._changedProps.get_PositionV()===undefined)
this._changedProps.put_PositionV(new CImagePositionV());
this._changedProps.get_PositionV().put_UseAlign(false);
this._changedProps.get_PositionV().put_Percent(true);
this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionPcFrom);
this._changedProps.get_PositionV().put_Value(field.getNumberValue());
this._state.spnYPcChanged = true;
}
}, this));
this._arrVRelativePc = [
{displayValue: this.textMargin, value: c_oAscRelativeFromV.Margin},
{displayValue: this.textBottomMargin, value: c_oAscRelativeFromV.BottomMargin},
{displayValue: this.textPage, value: c_oAscRelativeFromV.Page},
{displayValue: this.textTopMargin, value: c_oAscRelativeFromV.TopMargin}
];
this.cmbVPositionPc = new Common.UI.ComboBox({
el: $('#image-combo-vpositionpc'),
cls: 'input-group-nr',
menuStyle: 'min-width: 115px;',
editable: false,
data: this._arrVRelativePc
});
this.cmbVPositionPc.setDisabled(true);
this.cmbVPositionPc.setValue(this._state.VPositionPcFrom);
this.cmbVPositionPc.on('selected', _.bind(this.onVPositionPcSelect, this));
this.radioHAlign = new Common.UI.RadioBox({ this.radioHAlign = new Common.UI.RadioBox({
el: $('#image-radio-halign'), el: $('#image-radio-halign'),
name: 'asc-radio-horizontal', name: 'asc-radio-horizontal',
...@@ -467,6 +559,12 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -467,6 +559,12 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
}); });
this.radioHPosition.on('change', _.bind(this.onRadioHPositionChange, this)); this.radioHPosition.on('change', _.bind(this.onRadioHPositionChange, this));
this.radioHPositionPc = new Common.UI.RadioBox({
el: $('#image-radio-hpositionpc'),
name: 'asc-radio-horizontal'
});
this.radioHPositionPc.on('change', _.bind(this.onRadioHPositionPcChange, this));
this.radioVAlign = new Common.UI.RadioBox({ this.radioVAlign = new Common.UI.RadioBox({
el: $('#image-radio-valign'), el: $('#image-radio-valign'),
name: 'asc-radio-vertical', name: 'asc-radio-vertical',
...@@ -480,6 +578,12 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -480,6 +578,12 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
}); });
this.radioVPosition.on('change', _.bind(this.onRadioVPositionChange, this)); this.radioVPosition.on('change', _.bind(this.onRadioVPositionChange, this));
this.radioVPositionPc = new Common.UI.RadioBox({
el: $('#image-radio-vpositionpc'),
name: 'asc-radio-vertical'
});
this.radioVPositionPc.on('change', _.bind(this.onRadioVPositionPcChange, this));
this.chMove = new Common.UI.CheckBox({ this.chMove = new Common.UI.CheckBox({
el: $('#image-checkbox-move'), el: $('#image-checkbox-move'),
labelText: this.textMove labelText: this.textMove
...@@ -862,6 +966,17 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -862,6 +966,17 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
break; break;
} }
} }
} else if (Position.get_Percent()) {
this.radioHPositionPc.setValue(true);
this.spnXPc.setValue(Position.get_Value());
value = Position.get_RelativeFrom();
for (i=0; i<this._arrHRelativePc.length; i++) {
if (value == this._arrHRelativePc[i].value) {
this.cmbHPositionPc.setValue(value);
this._state.HPositionPcFrom = value;
break;
}
}
} else { } else {
this.radioHPosition.setValue(true); this.radioHPosition.setValue(true);
value = Position.get_Value(); value = Position.get_Value();
...@@ -888,22 +1003,40 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -888,22 +1003,40 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
break; break;
} }
} }
value = Position.get_RelativeFrom();
for (i=0; i<this._arrVRelative.length; i++) {
if (value == this._arrVRelative[i].value) {
this.cmbVRelative.setValue(value);
this._state.VAlignFrom = value;
break;
}
}
} else if (Position.get_Percent()) {
this.radioVPositionPc.setValue(true);
this.spnYPc.setValue(Position.get_Value());
value = Position.get_RelativeFrom();
for (i=0; i<this._arrVRelativePc.length; i++) {
if (value == this._arrVRelativePc[i].value) {
this.cmbVPositionPc.setValue(value);
this._state.VPositionPcFrom = value;
break;
}
}
} else { } else {
this.radioVPosition.setValue(true); this.radioVPosition.setValue(true);
value = Position.get_Value(); value = Position.get_Value();
this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(value)); this.spnY.setValue(Common.Utils.Metric.fnRecalcFromMM(value));
}
value = Position.get_RelativeFrom(); value = Position.get_RelativeFrom();
for (i=0; i<this._arrVRelative.length; i++) { for (i=0; i<this._arrVRelative.length; i++) {
if (value == this._arrVRelative[i].value) { if (value == this._arrVRelative[i].value) {
this.cmbVRelative.setValue(value);
this.cmbVPosition.setValue(value); this.cmbVPosition.setValue(value);
this._state.VAlignFrom = value;
this._state.VPositionFrom = value; this._state.VPositionFrom = value;
break; break;
} }
} }
}
this.chMove.setValue((value==c_oAscRelativeFromV.Line || value==c_oAscRelativeFromV.Paragraph), true); this.chMove.setValue((value==c_oAscRelativeFromV.Line || value==c_oAscRelativeFromV.Paragraph), true);
this.chMove.setDisabled(!Position.get_UseAlign() && Position.get_Percent());
} }
this.chOverlap.setValue((props.get_AllowOverlap() !== null && props.get_AllowOverlap() !== undefined) ? props.get_AllowOverlap() : 'indeterminate', true); this.chOverlap.setValue((props.get_AllowOverlap() !== null && props.get_AllowOverlap() !== undefined) ? props.get_AllowOverlap() : 'indeterminate', true);
...@@ -986,6 +1119,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -986,6 +1119,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
if ( properties.get_PositionH()===null || properties.get_PositionH()===undefined ) { if ( properties.get_PositionH()===null || properties.get_PositionH()===undefined ) {
properties.put_PositionH(new CImagePositionH()); properties.put_PositionH(new CImagePositionH());
properties.get_PositionH().put_UseAlign(false); properties.get_PositionH().put_UseAlign(false);
properties.get_PositionH().put_Percent(false);
properties.get_PositionH().put_RelativeFrom(c_oAscRelativeFromH.Column); properties.get_PositionH().put_RelativeFrom(c_oAscRelativeFromH.Column);
var val = this._originalProps.get_Value_X(c_oAscRelativeFromH.Column); var val = this._originalProps.get_Value_X(c_oAscRelativeFromH.Column);
properties.get_PositionH().put_Value(val); properties.get_PositionH().put_Value(val);
...@@ -994,6 +1128,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -994,6 +1128,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
if ( properties.get_PositionV()===null || properties.get_PositionV()===undefined ) { if ( properties.get_PositionV()===null || properties.get_PositionV()===undefined ) {
properties.put_PositionV(new CImagePositionV()); properties.put_PositionV(new CImagePositionV());
properties.get_PositionV().put_UseAlign(false); properties.get_PositionV().put_UseAlign(false);
properties.get_PositionV().put_Percent(false);
properties.get_PositionV().put_RelativeFrom(c_oAscRelativeFromV.Paragraph); properties.get_PositionV().put_RelativeFrom(c_oAscRelativeFromV.Paragraph);
val = this._originalProps.get_Value_Y(c_oAscRelativeFromV.Paragraph); val = this._originalProps.get_Value_Y(c_oAscRelativeFromV.Paragraph);
properties.get_PositionV().put_Value(val); properties.get_PositionV().put_Value(val);
...@@ -1122,6 +1257,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1122,6 +1257,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._state.HAlignType = record.value; this._state.HAlignType = record.value;
this._changedProps.get_PositionH().put_UseAlign(true); this._changedProps.get_PositionH().put_UseAlign(true);
this._changedProps.get_PositionH().put_Percent(false);
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom); this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom);
this._changedProps.get_PositionH().put_Align(this._state.HAlignType); this._changedProps.get_PositionH().put_Align(this._state.HAlignType);
} }
...@@ -1134,6 +1270,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1134,6 +1270,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._state.HAlignFrom = record.value; this._state.HAlignFrom = record.value;
this._changedProps.get_PositionH().put_UseAlign(true); this._changedProps.get_PositionH().put_UseAlign(true);
this._changedProps.get_PositionH().put_Percent(false);
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom); this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom);
this._changedProps.get_PositionH().put_Align(this._state.HAlignType); this._changedProps.get_PositionH().put_Align(this._state.HAlignType);
} }
...@@ -1146,6 +1283,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1146,6 +1283,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._state.HPositionFrom = record.value; this._state.HPositionFrom = record.value;
this._changedProps.get_PositionH().put_UseAlign(false); this._changedProps.get_PositionH().put_UseAlign(false);
this._changedProps.get_PositionH().put_Percent(false);
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom); this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom);
if (!this._state.spnXChanged) { if (!this._state.spnXChanged) {
var val = this._originalProps.get_Value_X(this._state.HPositionFrom); var val = this._originalProps.get_Value_X(this._state.HPositionFrom);
...@@ -1155,6 +1293,23 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1155,6 +1293,23 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
} }
}, },
onHPositionPcSelect: function(combo, record){
if (this._changedProps) {
if (this._changedProps.get_PositionH()===null || this._changedProps.get_PositionH()===undefined)
this._changedProps.put_PositionH(new CImagePositionH());
this._state.HPositionPcFrom = record.value;
this._changedProps.get_PositionH().put_UseAlign(false);
this._changedProps.get_PositionH().put_Percent(true);
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionPcFrom);
if (!this._state.spnXPcChanged) {
var val = this._originalProps.get_Value_X(this._state.HPositionPcFrom);
this.spnXPc.setValue(parseFloat((100*val/this.pageWidth).toFixed(2)), true);
}
this._changedProps.get_PositionH().put_Value(this.spnXPc.getNumberValue());
}
},
onVAlignSelect: function(combo, record){ onVAlignSelect: function(combo, record){
if (this._changedProps) { if (this._changedProps) {
if (this._changedProps.get_PositionV()===null || this._changedProps.get_PositionV()===undefined) if (this._changedProps.get_PositionV()===null || this._changedProps.get_PositionV()===undefined)
...@@ -1162,6 +1317,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1162,6 +1317,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._state.VAlignType = record.value; this._state.VAlignType = record.value;
this._changedProps.get_PositionV().put_UseAlign(true); this._changedProps.get_PositionV().put_UseAlign(true);
this._changedProps.get_PositionV().put_Percent(false);
this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom); this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom);
this._changedProps.get_PositionV().put_Align(this._state.VAlignType); this._changedProps.get_PositionV().put_Align(this._state.VAlignType);
} }
...@@ -1174,6 +1330,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1174,6 +1330,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._state.VAlignFrom = record.value; this._state.VAlignFrom = record.value;
this._changedProps.get_PositionV().put_UseAlign(true); this._changedProps.get_PositionV().put_UseAlign(true);
this._changedProps.get_PositionV().put_Percent(false);
this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom); this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom);
this._changedProps.get_PositionV().put_Align(this._state.VAlignType); this._changedProps.get_PositionV().put_Align(this._state.VAlignType);
...@@ -1188,6 +1345,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1188,6 +1345,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._state.VPositionFrom = record.value; this._state.VPositionFrom = record.value;
this._changedProps.get_PositionV().put_UseAlign(false); this._changedProps.get_PositionV().put_UseAlign(false);
this._changedProps.get_PositionV().put_Percent(false);
this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom); this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom);
if (!this._state.spnYChanged) { if (!this._state.spnYChanged) {
var val = this._originalProps.get_Value_Y(this._state.VPositionFrom); var val = this._originalProps.get_Value_Y(this._state.VPositionFrom);
...@@ -1198,6 +1356,24 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1198,6 +1356,24 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
} }
}, },
onVPositionPcSelect: function(combo, record){
if (this._changedProps) {
if (this._changedProps.get_PositionV()===null || this._changedProps.get_PositionV()===undefined)
this._changedProps.put_PositionV(new CImagePositionV());
this._state.VPositionPcFrom = record.value;
this._changedProps.get_PositionV().put_UseAlign(false);
this._changedProps.get_PositionV().put_Percent(true);
this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionPcFrom);
if (!this._state.spnYPcChanged) {
var val = this._originalProps.get_Value_Y(this._state.VPositionPcFrom);
this.spnYPc.setValue(parseFloat((100*val/this.pageHeight).toFixed(2)), true);
}
this._changedProps.get_PositionV().put_Value(this.spnYPc.getNumberValue());
}
},
onRadioHAlignChange: function(field, newValue, eOpts) { onRadioHAlignChange: function(field, newValue, eOpts) {
if (this._changedProps) { if (this._changedProps) {
if (this._changedProps.get_PositionH()===null || this._changedProps.get_PositionH()===undefined) if (this._changedProps.get_PositionH()===null || this._changedProps.get_PositionH()===undefined)
...@@ -1205,6 +1381,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1205,6 +1381,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._changedProps.get_PositionH().put_UseAlign(newValue); this._changedProps.get_PositionH().put_UseAlign(newValue);
if (newValue) { if (newValue) {
this._changedProps.get_PositionH().put_Percent(false);
this._changedProps.get_PositionH().put_Align(this._state.HAlignType); this._changedProps.get_PositionH().put_Align(this._state.HAlignType);
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom); this._changedProps.get_PositionH().put_RelativeFrom(this._state.HAlignFrom);
} }
...@@ -1214,6 +1391,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1214,6 +1391,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this.cmbHRelative.setDisabled(false); this.cmbHRelative.setDisabled(false);
this.spnX.setDisabled(true); this.spnX.setDisabled(true);
this.cmbHPosition.setDisabled(true); this.cmbHPosition.setDisabled(true);
this.spnXPc.setDisabled(true);
this.cmbHPositionPc.setDisabled(true);
} }
}, },
...@@ -1222,8 +1401,9 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1222,8 +1401,9 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
if (this._changedProps.get_PositionH()===null || this._changedProps.get_PositionH()===undefined) if (this._changedProps.get_PositionH()===null || this._changedProps.get_PositionH()===undefined)
this._changedProps.put_PositionH(new CImagePositionH()); this._changedProps.put_PositionH(new CImagePositionH());
this._changedProps.get_PositionH().put_UseAlign(!newValue);
if (newValue) { if (newValue) {
this._changedProps.get_PositionH().put_UseAlign(false);
this._changedProps.get_PositionH().put_Percent(false);
this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue())); this._changedProps.get_PositionH().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnX.getNumberValue()));
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom); this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionFrom);
} }
...@@ -1233,6 +1413,30 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1233,6 +1413,30 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this.cmbHRelative.setDisabled(true); this.cmbHRelative.setDisabled(true);
this.spnX.setDisabled(false); this.spnX.setDisabled(false);
this.cmbHPosition.setDisabled(false); this.cmbHPosition.setDisabled(false);
this.spnXPc.setDisabled(true);
this.cmbHPositionPc.setDisabled(true);
}
},
onRadioHPositionPcChange: function(field, newValue, eOpts) {
if (this._changedProps) {
if (this._changedProps.get_PositionH()===null || this._changedProps.get_PositionH()===undefined)
this._changedProps.put_PositionH(new CImagePositionH());
this._changedProps.get_PositionH().put_Percent(newValue);
if (newValue) {
this._changedProps.get_PositionH().put_UseAlign(false);
this._changedProps.get_PositionH().put_Value(this.spnXPc.getNumberValue());
this._changedProps.get_PositionH().put_RelativeFrom(this._state.HPositionPcFrom);
}
}
if (newValue) {
this.cmbHAlign.setDisabled(true);
this.cmbHRelative.setDisabled(true);
this.spnX.setDisabled(true);
this.cmbHPosition.setDisabled(true);
this.spnXPc.setDisabled(false);
this.cmbHPositionPc.setDisabled(false);
} }
}, },
...@@ -1243,6 +1447,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1243,6 +1447,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._changedProps.get_PositionV().put_UseAlign(newValue); this._changedProps.get_PositionV().put_UseAlign(newValue);
if (newValue) { if (newValue) {
this._changedProps.get_PositionV().put_Percent(false);
this._changedProps.get_PositionV().put_Align(this._state.VAlignType); this._changedProps.get_PositionV().put_Align(this._state.VAlignType);
this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom); this._changedProps.get_PositionV().put_RelativeFrom(this._state.VAlignFrom);
} }
...@@ -1253,6 +1458,9 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1253,6 +1458,9 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this.spnY.setDisabled(true); this.spnY.setDisabled(true);
this.cmbVPosition.setDisabled(true); this.cmbVPosition.setDisabled(true);
this.chMove.setValue(this._state.VAlignFrom==c_oAscRelativeFromV.Line || this._state.VAlignFrom==c_oAscRelativeFromV.Paragraph, true); this.chMove.setValue(this._state.VAlignFrom==c_oAscRelativeFromV.Line || this._state.VAlignFrom==c_oAscRelativeFromV.Paragraph, true);
this.chMove.setDisabled(false);
this.spnYPc.setDisabled(true);
this.cmbVPositionPc.setDisabled(true);
} }
}, },
...@@ -1261,8 +1469,9 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1261,8 +1469,9 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
if (this._changedProps.get_PositionV()===null || this._changedProps.get_PositionV()===undefined) if (this._changedProps.get_PositionV()===null || this._changedProps.get_PositionV()===undefined)
this._changedProps.put_PositionV(new CImagePositionV()); this._changedProps.put_PositionV(new CImagePositionV());
this._changedProps.get_PositionV().put_UseAlign(!newValue);
if (newValue) { if (newValue) {
this._changedProps.get_PositionV().put_UseAlign(false);
this._changedProps.get_PositionV().put_Percent(false);
this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue())); this._changedProps.get_PositionV().put_Value(Common.Utils.Metric.fnRecalcToMM(this.spnY.getNumberValue()));
this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom); this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionFrom);
} }
...@@ -1273,6 +1482,33 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1273,6 +1482,33 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this.spnY.setDisabled(false); this.spnY.setDisabled(false);
this.cmbVPosition.setDisabled(false); this.cmbVPosition.setDisabled(false);
this.chMove.setValue(this._state.VPositionFrom==c_oAscRelativeFromV.Line || this._state.VPositionFrom==c_oAscRelativeFromV.Paragraph, true); this.chMove.setValue(this._state.VPositionFrom==c_oAscRelativeFromV.Line || this._state.VPositionFrom==c_oAscRelativeFromV.Paragraph, true);
this.chMove.setDisabled(false);
this.spnYPc.setDisabled(true);
this.cmbVPositionPc.setDisabled(true);
}
},
onRadioVPositionPcChange: function(field, newValue, eOpts) {
if (this._changedProps) {
if (this._changedProps.get_PositionV()===null || this._changedProps.get_PositionV()===undefined)
this._changedProps.put_PositionV(new CImagePositionV());
this._changedProps.get_PositionV().put_Percent(newValue);
if (newValue) {
this._changedProps.get_PositionV().put_UseAlign(false);
this._changedProps.get_PositionV().put_Value(this.spnYPc.getNumberValue());
this._changedProps.get_PositionV().put_RelativeFrom(this._state.VPositionPcFrom);
}
}
if (newValue) {
this.cmbVAlign.setDisabled(true);
this.cmbVRelative.setDisabled(true);
this.spnY.setDisabled(true);
this.cmbVPosition.setDisabled(true);
this.chMove.setValue(false, true);
this.chMove.setDisabled(true);
this.spnYPc.setDisabled(false);
this.cmbVPositionPc.setDisabled(false);
} }
}, },
...@@ -1405,7 +1641,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat ...@@ -1405,7 +1641,8 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
textBeginStyle: 'Begin Style', textBeginStyle: 'Begin Style',
textBeginSize: 'Begin Size', textBeginSize: 'Begin Size',
textEndStyle: 'End Style', textEndStyle: 'End Style',
textEndSize: 'End Size' textEndSize: 'End Size',
textPositionPc: 'Relative position'
}, DE.Views.ImageSettingsAdvanced || {})); }, DE.Views.ImageSettingsAdvanced || {}));
}); });
\ No newline at end of file
...@@ -1143,6 +1143,7 @@ define([ ...@@ -1143,6 +1143,7 @@ define([
(new DE.Views.ImageSettingsAdvanced( (new DE.Views.ImageSettingsAdvanced(
{ {
imageProps: elValue, imageProps: elValue,
sectionProps: me.api.asc_GetSectionProps(),
handler: function(result, value) { handler: function(result, value) {
if (result == 'ok') { if (result == 'ok') {
if (me.api) { if (me.api) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment