diff --git a/apps/documenteditor/main/app/view/ImageSettings.js b/apps/documenteditor/main/app/view/ImageSettings.js index 762d64fad..14a7f1ac8 100644 --- a/apps/documenteditor/main/app/view/ImageSettings.js +++ b/apps/documenteditor/main/app/view/ImageSettings.js @@ -467,11 +467,15 @@ define([ } }, + setImageUrl: function(url, token) { + var props = new Asc.asc_CImgProperty(); + props.put_ImageUrl(url, token); + this.api.ImgApply(props); + }, + insertImageFromStorage: function(data) { if (data && data.url && data.c=='change') { - var props = new Asc.asc_CImgProperty(); - props.put_ImageUrl(data.url, data.token); - this.api.ImgApply(props); + this.setImageUrl(data.url, data.token); } }, @@ -484,9 +488,7 @@ define([ if (me.api) { var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { - var props = new Asc.asc_CImgProperty(); - props.put_ImageUrl(checkUrl); - me.api.ImgApply(props); + me.setImageUrl(checkUrl); } } } diff --git a/apps/documenteditor/main/app/view/ShapeSettings.js b/apps/documenteditor/main/app/view/ShapeSettings.js index d8d406f28..8fd41e2e5 100644 --- a/apps/documenteditor/main/app/view/ShapeSettings.js +++ b/apps/documenteditor/main/app/view/ShapeSettings.js @@ -695,20 +695,24 @@ define([ this.fireEvent('editcomplete', this); }, + setImageUrl: function(url, token) { + if (this.BlipFillType !== null) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(this.BlipFillType); + fill.get_fill().put_url(url, token); + + props.put_fill(fill); + this.imgprops.put_ShapeProperties(props); + this.api.ImgApply(this.imgprops); + } + }, + insertImageFromStorage: function(data) { if (data && data.url && data.c=='fill') { - if (this.BlipFillType !== null) { - var props = new Asc.asc_CShapeProperty(); - var fill = new Asc.asc_CShapeFill(); - fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); - fill.put_fill( new Asc.asc_CFillBlip()); - fill.get_fill().put_type(this.BlipFillType); - fill.get_fill().put_url(data.url, data.token); - - props.put_fill(fill); - this.imgprops.put_ShapeProperties(props); - this.api.ImgApply(this.imgprops); - } + this.setImageUrl(data.url, data.token); } }, @@ -721,18 +725,7 @@ define([ if (me.api) { var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { - if (me.BlipFillType !== null) { - var props = new Asc.asc_CShapeProperty(); - var fill = new Asc.asc_CShapeFill(); - fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); - fill.put_fill( new Asc.asc_CFillBlip()); - fill.get_fill().put_type(me.BlipFillType); - fill.get_fill().put_url(checkUrl); - - props.put_fill(fill); - me.imgprops.put_ShapeProperties(props); - me.api.ImgApply(me.imgprops); - } + me.setImageUrl(checkUrl); } } } diff --git a/apps/presentationeditor/main/app/view/ImageSettings.js b/apps/presentationeditor/main/app/view/ImageSettings.js index 4833b52ba..343e8e852 100644 --- a/apps/presentationeditor/main/app/view/ImageSettings.js +++ b/apps/presentationeditor/main/app/view/ImageSettings.js @@ -305,11 +305,15 @@ define([ } }, + setImageUrl: function(url, token) { + var props = new Asc.asc_CImgProperty(); + props.put_ImageUrl(url, token); + this.api.ImgApply(props); + }, + insertImageFromStorage: function(data) { if (data && data.url && data.c=='change') { - var props = new Asc.asc_CImgProperty(); - props.put_ImageUrl(data.url, data.token); - this.api.ImgApply(props); + this.setImageUrl(data.url, data.token); } }, @@ -322,9 +326,7 @@ define([ if (me.api) { var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { - var props = new Asc.asc_CImgProperty(); - props.put_ImageUrl(checkUrl); - me.api.ImgApply(props); + me.setImageUrl(checkUrl); } } } diff --git a/apps/presentationeditor/main/app/view/ShapeSettings.js b/apps/presentationeditor/main/app/view/ShapeSettings.js index 52c287641..5b214f2e9 100644 --- a/apps/presentationeditor/main/app/view/ShapeSettings.js +++ b/apps/presentationeditor/main/app/view/ShapeSettings.js @@ -635,19 +635,23 @@ define([ this.fireEvent('editcomplete', this); }, + setImageUrl: function(url, token) { + if (this.BlipFillType !== null) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(this.BlipFillType); + fill.get_fill().put_url(url, token); + + props.put_fill(fill); + this.api.ShapeApply(props); + } + }, + insertImageFromStorage: function(data) { if (data && data.url && data.c=='fill') { - if (this.BlipFillType !== null) { - var props = new Asc.asc_CShapeProperty(); - var fill = new Asc.asc_CShapeFill(); - fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); - fill.put_fill( new Asc.asc_CFillBlip()); - fill.get_fill().put_type(this.BlipFillType); - fill.get_fill().put_url(data.url, data.token); - - props.put_fill(fill); - this.api.ShapeApply(props); - } + this.setImageUrl(data.url, data.token); } }, @@ -660,17 +664,7 @@ define([ if (me.api) { var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { - if (me.BlipFillType !== null) { - var props = new Asc.asc_CShapeProperty(); - var fill = new Asc.asc_CShapeFill(); - fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); - fill.put_fill( new Asc.asc_CFillBlip()); - fill.get_fill().put_type(me.BlipFillType); - fill.get_fill().put_url(checkUrl); - - props.put_fill(fill); - me.api.ShapeApply(props); - } + me.setImageUrl(checkUrl); } } } diff --git a/apps/presentationeditor/main/app/view/SlideSettings.js b/apps/presentationeditor/main/app/view/SlideSettings.js index 8d2fe99e1..3bbed8708 100644 --- a/apps/presentationeditor/main/app/view/SlideSettings.js +++ b/apps/presentationeditor/main/app/view/SlideSettings.js @@ -645,19 +645,23 @@ define([ } }, + setImageUrl: function(url, token) { + if (this.BlipFillType !== null) { + var props = new Asc.CAscSlideProps(); + var fill = new Asc.asc_CShapeFill(); + fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.put_fill( new Asc.asc_CFillBlip()); + fill.get_fill().put_type(this.BlipFillType); + fill.get_fill().put_url(url, token); + + props.put_background(fill); + this.api.SetSlideProps(props); + } + }, + insertImageFromStorage: function(data) { if (data && data.url && data.c=='slide') { - if (this.BlipFillType !== null) { - var props = new Asc.CAscSlideProps(); - var fill = new Asc.asc_CShapeFill(); - fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); - fill.put_fill( new Asc.asc_CFillBlip()); - fill.get_fill().put_type(this.BlipFillType); - fill.get_fill().put_url(data.url, data.token); - - props.put_background(fill); - this.api.SetSlideProps(props); - } + this.setImageUrl(data.url, data.token); } }, @@ -670,17 +674,7 @@ define([ if (me.api) { var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { - if (me.BlipFillType !== null) { - var props = new Asc.CAscSlideProps(); - var fill = new Asc.asc_CShapeFill(); - fill.put_type(Asc.c_oAscFill.FILL_TYPE_BLIP); - fill.put_fill( new Asc.asc_CFillBlip()); - fill.get_fill().put_type(me.BlipFillType); - fill.get_fill().put_url(checkUrl); - - props.put_background(fill); - me.api.SetSlideProps(props); - } + me.setImageUrl(checkUrl); } } } diff --git a/apps/spreadsheeteditor/main/app/view/ImageSettings.js b/apps/spreadsheeteditor/main/app/view/ImageSettings.js index bbfb88a63..68728369d 100644 --- a/apps/spreadsheeteditor/main/app/view/ImageSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ImageSettings.js @@ -431,11 +431,15 @@ define([ } }, + setImageUrl: function(url, token) { + var props = new Asc.asc_CImgProperty(); + props.asc_putImageUrl(url, token); + this.api.asc_setGraphicObjectProps(props); + }, + insertImageFromStorage: function(data) { if (data && data.url && data.c=='change') { - var props = new Asc.asc_CImgProperty(); - props.asc_putImageUrl(data.url, data.token); - this.api.asc_setGraphicObjectProps(props); + this.setImageUrl(data.url, data.token); } }, @@ -448,9 +452,7 @@ define([ if (me.api) { var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { - var props = new Asc.asc_CImgProperty(); - props.asc_putImageUrl(checkUrl); - me.api.asc_setGraphicObjectProps(props); + me.setImageUrl(checkUrl); } } } diff --git a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js index 7bfbfa3a4..10f66d9d8 100644 --- a/apps/spreadsheeteditor/main/app/view/ShapeSettings.js +++ b/apps/spreadsheeteditor/main/app/view/ShapeSettings.js @@ -654,20 +654,24 @@ define([ Common.NotificationCenter.trigger('edit:complete', this); }, + setImageUrl: function(url, token) { + if (this.BlipFillType !== null) { + var props = new Asc.asc_CShapeProperty(); + var fill = new Asc.asc_CShapeFill(); + fill.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP); + fill.asc_putFill( new Asc.asc_CFillBlip()); + fill.asc_getFill().asc_putType(this.BlipFillType); + fill.asc_getFill().asc_putUrl(url, token); + + props.asc_putFill(fill); + this.imgprops.asc_putShapeProperties(props); + this.api.asc_setGraphicObjectProps(this.imgprops); + } + }, + insertImageFromStorage: function(data) { if (data && data.url && data.c=='fill') { - if (this.BlipFillType !== null) { - var props = new Asc.asc_CShapeProperty(); - var fill = new Asc.asc_CShapeFill(); - fill.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP); - fill.asc_putFill( new Asc.asc_CFillBlip()); - fill.asc_getFill().asc_putType(this.BlipFillType); - fill.asc_getFill().asc_putUrl(data.url, data.token); - - props.asc_putFill(fill); - this.imgprops.asc_putShapeProperties(props); - this.api.asc_setGraphicObjectProps(this.imgprops); - } + this.setImageUrl(data.url, data.token); } }, @@ -680,18 +684,7 @@ define([ if (me.api) { var checkUrl = value.replace(/ /g, ''); if (!_.isEmpty(checkUrl)) { - if (me.BlipFillType !== null) { - var props = new Asc.asc_CShapeProperty(); - var fill = new Asc.asc_CShapeFill(); - fill.asc_putType(Asc.c_oAscFill.FILL_TYPE_BLIP); - fill.asc_putFill( new Asc.asc_CFillBlip()); - fill.asc_getFill().asc_putType(me.BlipFillType); - fill.asc_getFill().asc_putUrl(checkUrl); - - props.asc_putFill(fill); - me.imgprops.asc_putShapeProperties(props); - me.api.asc_setGraphicObjectProps(me.imgprops); - } + me.setImageUrl(checkUrl); } } }