Commit cd327af2 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin Committed by Alexander.Trofimov

отрисовка текстуры в настройках текстарта

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64131 954022d7-b5bf-4e40-9824-e11837661b57
parent 27733afd
...@@ -5834,10 +5834,10 @@ DrawingObjectsController.prototype = ...@@ -5834,10 +5834,10 @@ DrawingObjectsController.prototype =
{ {
oTextArtProperties.Fill = oTextPr.Unifill; oTextArtProperties.Fill = oTextPr.Unifill;
} }
// else if(oTextPr.Color) else if(oTextPr.Color)
// { {
// oTextArtProperties.Fill = CreateUnfilFromRGB(oTextPr.Color.r, oTextPr.Color.g, oTextPr.Color.b); oTextArtProperties.Fill = CreateUnfilFromRGB(oTextPr.Color.r, oTextPr.Color.g, oTextPr.Color.b);
// } }
oTextArtProperties.Line = oTextPr.TextOutline; oTextArtProperties.Line = oTextPr.TextOutline;
if(oTextArtProperties.Fill) if(oTextArtProperties.Fill)
{ {
...@@ -5903,6 +5903,7 @@ DrawingObjectsController.prototype = ...@@ -5903,6 +5903,7 @@ DrawingObjectsController.prototype =
shape_props.Width = props.shapeChartProps.w; shape_props.Width = props.shapeChartProps.w;
shape_props.Height = props.shapeChartProps.h; shape_props.Height = props.shapeChartProps.h;
var pr = shape_props.ShapeProperties; var pr = shape_props.ShapeProperties;
var oTextArtProperties;
if (!isRealObject(props.shapeProps)) if (!isRealObject(props.shapeProps))
{ {
if (pr.fill != null && pr.fill.fill != null && pr.fill.fill.type == FILL_TYPE_BLIP) if (pr.fill != null && pr.fill.fill != null && pr.fill.fill.type == FILL_TYPE_BLIP)
...@@ -5918,6 +5919,24 @@ DrawingObjectsController.prototype = ...@@ -5918,6 +5919,24 @@ DrawingObjectsController.prototype =
this.drawingObjects.drawingDocument.InitGuiCanvasShape(api.shapeElementId); this.drawingObjects.drawingDocument.InitGuiCanvasShape(api.shapeElementId);
this.drawingObjects.drawingDocument.DrawImageTextureFillShape(null); this.drawingObjects.drawingDocument.DrawImageTextureFillShape(null);
} }
if(pr.textArtProperties)
{
oTextArtProperties = pr.textArtProperties;
if(oTextArtProperties && oTextArtProperties.Fill && oTextArtProperties.Fill.fill && oTextArtProperties.Fill.fill.type == FILL_TYPE_BLIP)
{
if(api)
this.drawingObjects.drawingDocument.InitGuiCanvasTextArt(api.textArtElementId);
this.drawingObjects.drawingDocument.LastDrawingUrlTextArt = null;
this.WordControl.m_oDrawingDocument.DrawImageTextureFillTextArt(oTextArtProperties.Fill.fill.RasterImageId);
}
else
{
this.WordControl.m_oDrawingDocument.DrawImageTextureFillTextArt(null);
}
}
} }
shape_props.ShapeProperties.fill = CreateAscFill(shape_props.ShapeProperties.fill); shape_props.ShapeProperties.fill = CreateAscFill(shape_props.ShapeProperties.fill);
shape_props.ShapeProperties.stroke = CreateAscStroke(shape_props.ShapeProperties.stroke, shape_props.ShapeProperties.canChangeArrows === true); shape_props.ShapeProperties.stroke = CreateAscStroke(shape_props.ShapeProperties.stroke, shape_props.ShapeProperties.canChangeArrows === true);
...@@ -5938,6 +5957,22 @@ DrawingObjectsController.prototype = ...@@ -5938,6 +5957,22 @@ DrawingObjectsController.prototype =
shape_props.ShapeProperties.bFromChart = props.shapeProps.bFromChart; shape_props.ShapeProperties.bFromChart = props.shapeProps.bFromChart;
shape_props.ShapeProperties.textArtProperties = CreateAscTextArtProps(props.shapeProps.textArtProperties); shape_props.ShapeProperties.textArtProperties = CreateAscTextArtProps(props.shapeProps.textArtProperties);
if(props.shapeProps.textArtProperties)
{
oTextArtProperties = props.shapeProps.textArtProperties;
if(oTextArtProperties && oTextArtProperties.Fill && oTextArtProperties.Fill.fill && oTextArtProperties.Fill.fill.type == FILL_TYPE_BLIP)
{
if(api)
this.drawingObjects.drawingDocument.InitGuiCanvasTextArt(api.textArtElementId);
this.drawingObjects.drawingDocument.LastDrawingUrlTextArt = null;
this.drawingObjects.drawingDocument.DrawImageTextureFillTextArt(oTextArtProperties.Fill.fill.RasterImageId);
}
else
{
this.drawingObjects.drawingDocument.DrawImageTextureFillTextArt(null);
}
}
if(props.shapeProps.paddings) if(props.shapeProps.paddings)
{ {
shape_props.ShapeProperties.paddings = new asc_CPaddings(props.shapeProps.paddings); shape_props.ShapeProperties.paddings = new asc_CPaddings(props.shapeProps.paddings);
......
...@@ -133,6 +133,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -133,6 +133,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.ImageLoader = window.g_image_loader; this.ImageLoader = window.g_image_loader;
this.ImageLoader.put_Api(this); this.ImageLoader.put_Api(this);
this.shapeElementId = null; this.shapeElementId = null;
this.textArtElementId = null;
this.isImageChangeUrl = false; this.isImageChangeUrl = false;
this.isShapeImageChangeUrl = false; this.isShapeImageChangeUrl = false;
...@@ -2782,6 +2783,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -2782,6 +2783,10 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.shapeElementId = elementId; this.shapeElementId = elementId;
}; };
spreadsheet_api.prototype.asc_setInterfaceDrawImagePlaceTextArt = function(elementId) {
this.textArtElementId = elementId;
};
spreadsheet_api.prototype.asc_changeImageFromFile = function() { spreadsheet_api.prototype.asc_changeImageFromFile = function() {
this.isImageChangeUrl = true; this.isImageChangeUrl = true;
this.asc_showImageFileDialog(); this.asc_showImageFileDialog();
...@@ -3872,6 +3877,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS"; ...@@ -3872,6 +3877,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_getOriginalImageSize"] = prot.asc_getOriginalImageSize; prot["asc_getOriginalImageSize"] = prot.asc_getOriginalImageSize;
prot["asc_changeShapeType"] = prot.asc_changeShapeType; prot["asc_changeShapeType"] = prot.asc_changeShapeType;
prot["asc_setInterfaceDrawImagePlaceShape"] = prot.asc_setInterfaceDrawImagePlaceShape; prot["asc_setInterfaceDrawImagePlaceShape"] = prot.asc_setInterfaceDrawImagePlaceShape;
prot["asc_setInterfaceDrawImagePlaceTextArt"] = prot.asc_setInterfaceDrawImagePlaceTextArt;
prot["asc_changeImageFromFile"] = prot.asc_changeImageFromFile; prot["asc_changeImageFromFile"] = prot.asc_changeImageFromFile;
prot["asc_putPrLineSpacing"] = prot.asc_putPrLineSpacing; prot["asc_putPrLineSpacing"] = prot.asc_putPrLineSpacing;
prot["asc_addTextArt"] = prot.asc_addTextArt; prot["asc_addTextArt"] = prot.asc_addTextArt;
......
...@@ -1797,6 +1797,13 @@ function CDrawingDocument(drawingObjects) ...@@ -1797,6 +1797,13 @@ function CDrawingDocument(drawingObjects)
this.GuiCanvasFillTextureCtx = null; this.GuiCanvasFillTextureCtx = null;
this.LastDrawingUrl = ""; this.LastDrawingUrl = "";
this.GuiCanvasFillTextureParentIdTextArt = "";
this.GuiCanvasFillTextureTextArt = null;
this.GuiCanvasFillTextureCtxTextArt = null;
this.LastDrawingUrlTextArt = "";
this.GuiCanvasTextProps = null; this.GuiCanvasTextProps = null;
this.GuiCanvasTextPropsId = "gui_textprops_canvas_id"; this.GuiCanvasTextPropsId = "gui_textprops_canvas_id";
this.GuiLastTextProps = null; this.GuiLastTextProps = null;
...@@ -4368,6 +4375,79 @@ function CDrawingDocument(drawingObjects) ...@@ -4368,6 +4375,79 @@ function CDrawingDocument(drawingObjects)
} }
} }
this.DrawImageTextureFillTextArt = function(url)
{
if (this.GuiCanvasFillTextureTextArt == null)
{
this.InitGuiCanvasTextArt(this.GuiCanvasFillTextureParentIdTextArt);
}
if (this.GuiCanvasFillTextureTextArt == null || this.GuiCanvasFillTextureCtxTextArt == null || url == this.LastDrawingUrlTextArt)
return;
this.LastDrawingUrlTextArt = url;
var _width = this.GuiCanvasFillTextureTextArt.width;
var _height = this.GuiCanvasFillTextureTextArt.height;
this.GuiCanvasFillTextureCtxTextArt.clearRect(0, 0, _width, _height);
if (null == this.LastDrawingUrlTextArt)
return;
var _img = this.m_oWordControl.m_oApi.ImageLoader.map_image_index[getFullImageSrc2(this.LastDrawingUrlTextArt)];
if (_img != undefined && _img.Image != null && _img.Status != ImageLoadStatus.Loading)
{
var _x = 0;
var _y = 0;
var _w = Math.max(_img.Image.width, 1);
var _h = Math.max(_img.Image.height, 1);
var dAspect1 = _width / _height;
var dAspect2 = _w / _h;
_w = _width;
_h = _height;
if (dAspect1 >= dAspect2)
{
_w = dAspect2 * _height;
_x = (_width - _w) / 2;
}
else
{
_h = _w / dAspect2;
_y = (_height - _h) / 2;
}
this.GuiCanvasFillTextureCtxTextArt.drawImage(_img.Image, _x, _y, _w, _h);
}
else
{
this.GuiCanvasFillTextureCtxTextArt.lineWidth = 1;
this.GuiCanvasFillTextureCtxTextArt.beginPath();
this.GuiCanvasFillTextureCtxTextArt.moveTo(0, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, _height);
this.GuiCanvasFillTextureCtxTextArt.moveTo(_width, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(0, _height);
this.GuiCanvasFillTextureCtxTextArt.strokeStyle = "#FF0000";
this.GuiCanvasFillTextureCtxTextArt.stroke();
this.GuiCanvasFillTextureCtxTextArt.beginPath();
this.GuiCanvasFillTextureCtxTextArt.moveTo(0, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, _height);
this.GuiCanvasFillTextureCtxTextArt.lineTo(0, _height);
this.GuiCanvasFillTextureCtxTextArt.closePath();
this.GuiCanvasFillTextureCtxTextArt.strokeStyle = "#000000";
this.GuiCanvasFillTextureCtxTextArt.stroke();
this.GuiCanvasFillTextureCtxTextArt.beginPath();
}
}
this.InitGuiCanvasShape = function(div_id) this.InitGuiCanvasShape = function(div_id)
{ {
if (this.GuiCanvasFillTextureParentId == div_id && null != this.GuiCanvasFillTexture) if (this.GuiCanvasFillTextureParentId == div_id && null != this.GuiCanvasFillTexture)
...@@ -4457,6 +4537,33 @@ function CDrawingDocument(drawingObjects) ...@@ -4457,6 +4537,33 @@ function CDrawingDocument(drawingObjects)
} }
} }
this.InitGuiCanvasTextArt = function(div_id)
{
if (null != this.GuiCanvasFillTextureTextArt)
{
var _div_elem = document.getElementById(this.GuiCanvasFillTextureParentIdTextArt);
if (!_div_elem)
_div_elem.removeChild(this.GuiCanvasFillTextureTextArt);
this.GuiCanvasFillTextureTextArt = null;
this.GuiCanvasFillTextureCtxTextArt = null;
}
this.GuiCanvasFillTextureParentIdTextArt = div_id;
var _div_elem = document.getElementById(this.GuiCanvasFillTextureParentIdTextArt);
if (!_div_elem)
return;
this.GuiCanvasFillTextureTextArt = document.createElement('canvas');
this.GuiCanvasFillTextureTextArt.width = parseInt(_div_elem.style.width);
this.GuiCanvasFillTextureTextArt.height = parseInt(_div_elem.style.height);
this.LastDrawingUrlTextArt = "";
this.GuiCanvasFillTextureCtxTextArt = this.GuiCanvasFillTextureTextArt.getContext('2d');
_div_elem.appendChild(this.GuiCanvasFillTextureTextArt);
}
this.DrawGuiCanvasTextProps = function(props) this.DrawGuiCanvasTextProps = function(props)
{ {
var bIsChange = false; var bIsChange = false;
......
...@@ -1040,6 +1040,11 @@ function CDrawingDocument() ...@@ -1040,6 +1040,11 @@ function CDrawingDocument()
this.GuiCanvasFillTextureCtxSlide = null; this.GuiCanvasFillTextureCtxSlide = null;
this.LastDrawingUrlSlide = ""; this.LastDrawingUrlSlide = "";
this.GuiCanvasFillTextureParentIdTextArt = "";
this.GuiCanvasFillTextureTextArt = null;
this.GuiCanvasFillTextureCtxTextArt = null;
this.LastDrawingUrlTextArt = "";
this.AutoShapesTrack = null; this.AutoShapesTrack = null;
this.TransitionSlide = new CTransitionAnimation(null); this.TransitionSlide = new CTransitionAnimation(null);
...@@ -2980,6 +2985,78 @@ function CDrawingDocument() ...@@ -2980,6 +2985,78 @@ function CDrawingDocument()
} }
} }
this.DrawImageTextureFillTextArt = function(url)
{
if (this.GuiCanvasFillTextureTextArt == null)
{
this.InitGuiCanvasTextArt(this.GuiCanvasFillTextureParentIdTextArt);
}
if (this.GuiCanvasFillTextureTextArt == null || this.GuiCanvasFillTextureCtxTextArt == null || url == this.LastDrawingUrlTextArt)
return;
this.LastDrawingUrlTextArt = url;
var _width = this.GuiCanvasFillTextureTextArt.width;
var _height = this.GuiCanvasFillTextureTextArt.height;
this.GuiCanvasFillTextureCtxTextArt.clearRect(0, 0, _width, _height);
if (null == this.LastDrawingUrlTextArt)
return;
var _img = this.m_oWordControl.m_oApi.ImageLoader.map_image_index[getFullImageSrc2(this.LastDrawingUrlTextArt)];
if (_img != undefined && _img.Image != null && _img.Status != ImageLoadStatus.Loading)
{
var _x = 0;
var _y = 0;
var _w = Math.max(_img.Image.width, 1);
var _h = Math.max(_img.Image.height, 1);
var dAspect1 = _width / _height;
var dAspect2 = _w / _h;
_w = _width;
_h = _height;
if (dAspect1 >= dAspect2)
{
_w = dAspect2 * _height;
_x = (_width - _w) / 2;
}
else
{
_h = _w / dAspect2;
_y = (_height - _h) / 2;
}
this.GuiCanvasFillTextureCtxTextArt.drawImage(_img.Image, _x, _y, _w, _h);
}
else
{
this.GuiCanvasFillTextureCtxTextArt.lineWidth = 1;
this.GuiCanvasFillTextureCtxTextArt.beginPath();
this.GuiCanvasFillTextureCtxTextArt.moveTo(0, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, _height);
this.GuiCanvasFillTextureCtxTextArt.moveTo(_width, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(0, _height);
this.GuiCanvasFillTextureCtxTextArt.strokeStyle = "#FF0000";
this.GuiCanvasFillTextureCtxTextArt.stroke();
this.GuiCanvasFillTextureCtxTextArt.beginPath();
this.GuiCanvasFillTextureCtxTextArt.moveTo(0, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, 0);
this.GuiCanvasFillTextureCtxTextArt.lineTo(_width, _height);
this.GuiCanvasFillTextureCtxTextArt.lineTo(0, _height);
this.GuiCanvasFillTextureCtxTextArt.closePath();
this.GuiCanvasFillTextureCtxTextArt.strokeStyle = "#000000";
this.GuiCanvasFillTextureCtxTextArt.stroke();
this.GuiCanvasFillTextureCtxTextArt.beginPath();
}
}
this.InitGuiCanvasShape = function(div_id) this.InitGuiCanvasShape = function(div_id)
{ {
if (null != this.GuiCanvasFillTexture) if (null != this.GuiCanvasFillTexture)
...@@ -3034,6 +3111,33 @@ function CDrawingDocument() ...@@ -3034,6 +3111,33 @@ function CDrawingDocument()
_div_elem.appendChild(this.GuiCanvasFillTextureSlide); _div_elem.appendChild(this.GuiCanvasFillTextureSlide);
} }
this.InitGuiCanvasTextArt = function(div_id)
{
if (null != this.GuiCanvasFillTextureTextArt)
{
var _div_elem = document.getElementById(this.GuiCanvasFillTextureParentIdTextArt);
if (!_div_elem)
_div_elem.removeChild(this.GuiCanvasFillTextureTextArt);
this.GuiCanvasFillTextureTextArt = null;
this.GuiCanvasFillTextureCtxTextArt = null;
}
this.GuiCanvasFillTextureParentIdTextArt = div_id;
var _div_elem = document.getElementById(this.GuiCanvasFillTextureParentIdTextArt);
if (!_div_elem)
return;
this.GuiCanvasFillTextureTextArt = document.createElement('canvas');
this.GuiCanvasFillTextureTextArt.width = parseInt(_div_elem.style.width);
this.GuiCanvasFillTextureTextArt.height = parseInt(_div_elem.style.height);
this.LastDrawingUrlTextArt = "";
this.GuiCanvasFillTextureCtxTextArt = this.GuiCanvasFillTextureTextArt.getContext('2d');
_div_elem.appendChild(this.GuiCanvasFillTextureTextArt);
}
this.CheckTableStyles = function() this.CheckTableStyles = function()
{ {
// сначала проверим, подписан ли кто на этот евент // сначала проверим, подписан ли кто на этот евент
......
...@@ -1027,6 +1027,12 @@ asc_docs_api.prototype.SetInterfaceDrawImagePlaceSlide = function(div_id) ...@@ -1027,6 +1027,12 @@ asc_docs_api.prototype.SetInterfaceDrawImagePlaceSlide = function(div_id)
{ {
this.WordControl.m_oDrawingDocument.InitGuiCanvasSlide(div_id); this.WordControl.m_oDrawingDocument.InitGuiCanvasSlide(div_id);
}; };
asc_docs_api.prototype.SetInterfaceDrawImagePlaceTextArt = function(div_id)
{
this.WordControl.m_oDrawingDocument.InitGuiCanvasTextArt(div_id);
};
asc_docs_api.prototype.SetInterfaceDrawImagePlace = function() asc_docs_api.prototype.SetInterfaceDrawImagePlace = function()
{}; {};
...@@ -2189,6 +2195,8 @@ asc_docs_api.prototype.ShapeApply = function(prop) ...@@ -2189,6 +2195,8 @@ asc_docs_api.prototype.ShapeApply = function(prop)
var image_url = ""; var image_url = "";
prop.Width = prop.w; prop.Width = prop.w;
prop.Height = prop.h; prop.Height = prop.h;
var bShapeTexture = true;
if (prop.fill != null) if (prop.fill != null)
{ {
if (prop.fill.fill != null && prop.fill.type == c_oAscFill.FILL_TYPE_BLIP) if (prop.fill.fill != null && prop.fill.type == c_oAscFill.FILL_TYPE_BLIP)
...@@ -2202,6 +2210,22 @@ asc_docs_api.prototype.ShapeApply = function(prop) ...@@ -2202,6 +2210,22 @@ asc_docs_api.prototype.ShapeApply = function(prop)
} }
} }
} }
var oFill;
if(prop.textArtProperties)
{
oFill = prop.textArtProperties.asc_getFill();
if (oFill.fill != null && oFill.type == c_oAscFill.FILL_TYPE_BLIP)
{
image_url = oFill.fill.asc_getUrl();
var _tx_id = oFill.fill.asc_getTextureId();
if (null != _tx_id && 0 <= _tx_id && _tx_id < g_oUserTexturePresets.length)
{
image_url = g_oUserTexturePresets[_tx_id];
}
bShapeTexture = false;
}
}
if (image_url != "") if (image_url != "")
{ {
var _image = this.ImageLoader.LoadImage(image_url, 1); var _image = this.ImageLoader.LoadImage(image_url, 1);
...@@ -2210,15 +2234,28 @@ asc_docs_api.prototype.ShapeApply = function(prop) ...@@ -2210,15 +2234,28 @@ asc_docs_api.prototype.ShapeApply = function(prop)
if(0 == image_url.indexOf(sFindString)) if(0 == image_url.indexOf(sFindString))
{ {
image_url = image_url.substring(sFindString.length); image_url = image_url.substring(sFindString.length);
}
if(bShapeTexture)
{
prop.fill.fill.asc_putUrl(image_url); // erase documentUrl prop.fill.fill.asc_putUrl(image_url); // erase documentUrl
} }
else
{
oFill.fill.asc_putUrl(image_url);
}
if (null != _image) if (null != _image)
{ {
this.WordControl.m_oLogicDocument.ShapeApply(prop); this.WordControl.m_oLogicDocument.ShapeApply(prop);
if(bShapeTexture)
{
this.WordControl.m_oDrawingDocument.DrawImageTextureFillShape(image_url); this.WordControl.m_oDrawingDocument.DrawImageTextureFillShape(image_url);
} }
else else
{
this.WordControl.m_oDrawingDocument.DrawImageTextureFillTextArt(image_url);
}
}
else
{ {
this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage);
var oProp = prop; var oProp = prop;
...@@ -3029,6 +3066,11 @@ asc_docs_api.prototype.ChangeSlideImageFromFile = function() ...@@ -3029,6 +3066,11 @@ asc_docs_api.prototype.ChangeSlideImageFromFile = function()
this.isSlideImageChangeUrl = true; this.isSlideImageChangeUrl = true;
this.AddImage(); this.AddImage();
}; };
asc_docs_api.prototype.ChangeArtImageFromFile = function()
{
this.isTextArtChangeUrl = true;
this.AddImage();
};
asc_docs_api.prototype.AddImage = function(){ asc_docs_api.prototype.AddImage = function(){
var oImageUploader = document.getElementById("apiImageUpload"); var oImageUploader = document.getElementById("apiImageUpload");
...@@ -3126,10 +3168,9 @@ asc_docs_api.prototype.AddImageUrl = function(url){ ...@@ -3126,10 +3168,9 @@ asc_docs_api.prototype.AddImageUrl = function(url){
}, _sendCommandCallback, rData); }, _sendCommandCallback, rData);
} }
}; };
asc_docs_api.prototype.AddImageUrlAction = function(url){
var _image = this.ImageLoader.LoadImage(url, 1); asc_docs_api.prototype.AddImageUrlActionCallback = function(_image)
if (null != _image) {
{
var _w = Page_Width - (X_Left_Margin + X_Right_Margin); var _w = Page_Width - (X_Left_Margin + X_Right_Margin);
var _h = Page_Height - (Y_Top_Margin + Y_Bottom_Margin); var _h = Page_Height - (Y_Top_Margin + Y_Bottom_Margin);
if (_image.Image != null) if (_image.Image != null)
...@@ -3168,6 +3209,18 @@ asc_docs_api.prototype.AddImageUrlAction = function(url){ ...@@ -3168,6 +3209,18 @@ asc_docs_api.prototype.AddImageUrlAction = function(url){
this.ImgApply(AscImageProp); this.ImgApply(AscImageProp);
this.isImageChangeUrl = false; this.isImageChangeUrl = false;
} }
else if (this.isTextArtChangeUrl)
{
var AscShapeProp = new asc_CShapeProperty();
var oFill = new asc_CShapeFill();
oFill.type = c_oAscFill.FILL_TYPE_BLIP;
oFill.fill = new asc_CFillBlip();
oFill.fill.asc_putUrl(src);
AscShapeProp.textArtProperties = new asc_TextArtProperties();
AscShapeProp.textArtProperties.asc_putFill(oFill);
this.ShapeApply(AscShapeProp);
this.isTextArtChangeUrl = false;
}
else else
{ {
var sFindString = editor.DocumentUrl + "media/"; var sFindString = editor.DocumentUrl + "media/";
...@@ -3176,61 +3229,20 @@ asc_docs_api.prototype.AddImageUrlAction = function(url){ ...@@ -3176,61 +3229,20 @@ asc_docs_api.prototype.AddImageUrlAction = function(url){
this.WordControl.m_oLogicDocument.Add_FlowImage(_w, _h, src); this.WordControl.m_oLogicDocument.Add_FlowImage(_w, _h, src);
} }
}
asc_docs_api.prototype.AddImageUrlAction = function(url){
var _image = this.ImageLoader.LoadImage(url, 1);
if (null != _image)
{
this.AddImageUrlActionCallback(_image);
} }
else else
{ {
this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); this.sync_StartAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage);
this.asyncImageEndLoaded2 = function(_image) this.asyncImageEndLoaded2 = function(_image)
{ {
var _w = Page_Width - (X_Left_Margin + X_Right_Margin); this.AddImageUrlActionCallback(_image);
var _h = Page_Height - (Y_Top_Margin + Y_Bottom_Margin);
if (_image.Image != null)
{
var __w = Math.max((_image.Image.width * g_dKoef_pix_to_mm) >> 0, 1);
var __h = Math.max((_image.Image.height * g_dKoef_pix_to_mm) >> 0, 1);
_w = Math.max(5, Math.min(_w, __w));
_h = Math.max(5, Math.min((_w * __h / __w) >> 0));
}
// this.WordControl.m_oLogicDocument.Create_NewHistoryPoint();
var src = _image.src;
//this.WordControl.m_oLogicDocument.Add_FlowImage(_w, _h, src);
if (this.isShapeImageChangeUrl)
{
var AscShapeProp = new asc_CShapeProperty();
AscShapeProp.fill = new asc_CShapeFill();
AscShapeProp.fill.type = c_oAscFill.FILL_TYPE_BLIP;
AscShapeProp.fill.fill = new asc_CFillBlip();
AscShapeProp.fill.fill.asc_putUrl(src);
this.ShapeApply(AscShapeProp);
this.isShapeImageChangeUrl = false;
}
else if (this.isSlideImageChangeUrl)
{
var AscSlideProp = new CAscSlideProps();
AscSlideProp.Background = new asc_CShapeFill();
AscSlideProp.Background.type = c_oAscFill.FILL_TYPE_BLIP;
AscSlideProp.Background.fill = new asc_CFillBlip();
AscSlideProp.Background.fill.asc_putUrl(src);
this.SetSlideProps(AscSlideProp);
this.isSlideImageChangeUrl = false;
}
else if (this.isImageChangeUrl)
{
var AscImageProp = new asc_CImgProperty();
AscImageProp.ImageUrl = src;
this.ImgApply(AscImageProp);
this.isImageChangeUrl = false;
}
else
{
var sFindString = editor.DocumentUrl + "media/";
if(0 == src.indexOf(sFindString))
src = src.substring(sFindString.length);
this.WordControl.m_oLogicDocument.Add_FlowImage(_w, _h, src);
}
this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage); this.sync_EndAction(c_oAscAsyncActionType.Information, c_oAscAsyncAction.LoadImage);
this.asyncImageEndLoaded2 = null; this.asyncImageEndLoaded2 = null;
...@@ -4485,6 +4497,17 @@ asc_docs_api.prototype.sync_shapePropCallback = function(pr) ...@@ -4485,6 +4497,17 @@ asc_docs_api.prototype.sync_shapePropCallback = function(pr)
this.WordControl.m_oDrawingDocument.DrawImageTextureFillShape(null); this.WordControl.m_oDrawingDocument.DrawImageTextureFillShape(null);
} }
var oTextArtProperties = pr.textArtProperties;
if(oTextArtProperties && oTextArtProperties.Fill && oTextArtProperties.Fill.fill && oTextArtProperties.Fill.fill.type == FILL_TYPE_BLIP)
{
this.WordControl.m_oDrawingDocument.DrawImageTextureFillTextArt(oTextArtProperties.Fill.fill.RasterImageId);
}
else
{
this.WordControl.m_oDrawingDocument.DrawImageTextureFillTextArt(null);
}
var _len = this.SelectedObjectsStack.length; var _len = this.SelectedObjectsStack.length;
if (_len > 0) if (_len > 0)
{ {
......
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