diff --git a/apps/documenteditor/main/app/template/ImageSettingsAdvanced.template b/apps/documenteditor/main/app/template/ImageSettingsAdvanced.template
index 9d7bea2c7..97e3f3ab6 100644
--- a/apps/documenteditor/main/app/template/ImageSettingsAdvanced.template
+++ b/apps/documenteditor/main/app/template/ImageSettingsAdvanced.template
@@ -70,7 +70,7 @@
-
+ |
|
@@ -101,7 +101,20 @@
-
+ |
+
+ |
+
+
+
+ |
+
+
+
+ |
+
+
+
|
@@ -119,25 +132,38 @@
-
+ |
|
-
+ |
|
-
+ |
|
+
+
+
+ |
+
+
+
+ |
+
+
+
+ |
+
-
+
-
+ |
|
diff --git a/apps/documenteditor/main/app/view/ChartSettings.js b/apps/documenteditor/main/app/view/ChartSettings.js
index 0b1e7e987..41a76e7d1 100644
--- a/apps/documenteditor/main/app/view/ChartSettings.js
+++ b/apps/documenteditor/main/app/view/ChartSettings.js
@@ -391,6 +391,7 @@ define([
{
imageProps: elValue,
sizeMax: imgsizeMax,
+ sectionProps: me.api.asc_GetSectionProps(),
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
diff --git a/apps/documenteditor/main/app/view/DocumentHolder.js b/apps/documenteditor/main/app/view/DocumentHolder.js
index d5e5a0890..53cfc49b8 100644
--- a/apps/documenteditor/main/app/view/DocumentHolder.js
+++ b/apps/documenteditor/main/app/view/DocumentHolder.js
@@ -1912,6 +1912,7 @@ define([
imageProps : elValue,
sizeOriginal: imgsizeOriginal,
sizeMax : imgsizeMax,
+ sectionProps: me.api.asc_GetSectionProps(),
handler : function(result, value) {
if (result == 'ok') {
if (me.api) {
diff --git a/apps/documenteditor/main/app/view/ImageSettings.js b/apps/documenteditor/main/app/view/ImageSettings.js
index 5c9b9eb4f..4f734ab9d 100644
--- a/apps/documenteditor/main/app/view/ImageSettings.js
+++ b/apps/documenteditor/main/app/view/ImageSettings.js
@@ -304,6 +304,7 @@ define([
imageProps: elValue,
sizeOriginal: imgsizeOriginal,
sizeMax: imgsizeMax,
+ sectionProps: me.api.asc_GetSectionProps(),
handler: function(result, value) {
if (result == 'ok') {
if (me.api) {
diff --git a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js
index 6a9039ed2..afe663bb5 100644
--- a/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js
+++ b/apps/documenteditor/main/app/view/ImageSettingsAdvanced.js
@@ -18,7 +18,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
DE.Views.ImageSettingsAdvanced = Common.Views.AdvancedSettingsWindow.extend(_.extend({
options: {
contentWidth: 340,
- height: 422,
+ height: 485,
toggleGroup: 'image-adv-settings-group',
sizeOriginal: {width: 0, height: 0},
sizeMax: {width: 55.88, height: 55.88},
@@ -47,17 +47,23 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
HAlignType: c_oAscAlignH.Left,
HAlignFrom: c_oAscRelativeFromH.Character,
HPositionFrom: c_oAscRelativeFromH.Character,
+ HPositionPcFrom: c_oAscRelativeFromH.Page,
VAlignType: c_oAscAlignV.Top,
VAlignFrom: c_oAscRelativeFromV.Line,
VPositionFrom: c_oAscRelativeFromV.Line,
+ VPositionPcFrom: c_oAscRelativeFromV.Page,
spnXChanged: false,
- spnYChanged: false
+ spnYChanged: false,
+ spnXPcChanged: false,
+ spnYPcChanged: false
};
this._objectType = c_oAscTypeSelectElement.Image;
this.Margins = undefined;
this._nRatio = 1;
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._changedShapeProps = null;
},
@@ -329,6 +335,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._changedProps.put_PositionH(new CImagePositionH());
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_Value(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
this._state.spnXChanged = true;
@@ -353,6 +360,7 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this._changedProps.put_PositionV(new CImagePositionV());
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_Value(Common.Utils.Metric.fnRecalcToMM(field.getNumberValue()));
this._state.spnYChanged = true;
@@ -407,6 +415,48 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this.cmbHPosition.setValue(this._state.HPositionFrom);
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
this._arrVAlign = [
{displayValue: this.textTop, value: c_oAscAlignV.Top},
@@ -454,6 +504,48 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
this.cmbVPosition.setValue(this._state.VPositionFrom);
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({
el: $('#image-radio-halign'),
name: 'asc-radio-horizontal',
@@ -467,6 +559,12 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
});
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({
el: $('#image-radio-valign'),
name: 'asc-radio-vertical',
@@ -480,6 +578,12 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
});
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({
el: $('#image-checkbox-move'),
labelText: this.textMove
@@ -862,6 +966,17 @@ define([ 'text!documenteditor/main/app/template/ImageSettingsAdvanced.templat
break;
}
}
+ } else if (Position.get_Percent()) {
+ this.radioHPositionPc.setValue(true);
+ this.spnXPc.setValue(Position.get_Value());
+ value = Position.get_RelativeFrom();
+ for (i=0; i