Commit 0b950397 authored by Dmitry.Vikulov's avatar Dmitry.Vikulov Committed by Alexander.Trofimov

- setRasterImage для CImage

- смена src картинки по URL и через файл
- api: asc_changeImageFromFile

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48227 954022d7-b5bf-4e40-9824-e11837661b57
parent 2c68cbe6
......@@ -3210,8 +3210,14 @@ function DrawingObjects() {
sheetId = data["input"]["sheetId"];
var url = data["url"];
if (sheetId == worksheet.model.getId())
_this.addImageDrawingObject(url, false, null);
if (sheetId == worksheet.model.getId()) {
if ( api.isImageChangeUrl ) {
_this.editImageDrawingObject(url);
api.isImageChangeUrl = false;
}
else
_this.addImageDrawingObject(url, false, null);
}
else
worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
}
......@@ -3726,6 +3732,39 @@ function DrawingObjects() {
}
}
_this.editImageDrawingObject = function(imageUrl) {
if ( imageUrl && (_this.controller.selectedObjects.length == 1) ) {
var drawingObject = _this.controller.selectedObjects[0].drawingBase;
if ( drawingObject.graphicObject.isImage() ) {
var _image = api.ImageLoader.LoadImage(imageUrl, 1);
if (null != _image) {
addImageObject(_image);
}
else {
_this.asyncImageEndLoaded = function(_image) {
addImageObject(_image);
}
}
function addImageObject(_image) {
if ( !_image.Image ) {
worksheet.model.workbook.handlers.trigger("asc_onError", c_oAscError.ID.UplImageUrl, c_oAscError.Level.NoCritical);
}
else {
drawingObject.graphicObject.setRasterImage(_image.src);
_this.showDrawingObjects(true);
_this.selectGraphicObject();
}
worksheet.model.workbook.handlers.trigger("asc_onEndAction", c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.LoadImage);
}
}
}
}
_this.addChartDrawingObject = function(chart, bWithoutHistory, options) {
if (isViewerMode())
......
......@@ -115,6 +115,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.ImageLoader = window.g_image_loader;
this.ImageLoader.put_Api(this);
this.shapeElementId = null;
this.isImageChangeUrl = false;
/**************************************/
......@@ -2146,6 +2147,11 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
this.shapeElementId = elementId;
},
asc_changeImageFromFile: function() {
this.isImageChangeUrl = true;
this.asc_showImageFileDialog();
},
asyncImageStartLoaded: function() {
},
......@@ -2951,6 +2957,7 @@ var ASC_DOCS_API_USE_EMBEDDED_FONTS = "@@ASC_DOCS_API_USE_EMBEDDED_FONTS";
prot["asc_getOriginalImageSize"] = prot.asc_getOriginalImageSize;
prot["asc_changeShapeType"] = prot.asc_changeShapeType;
prot["asc_setInterfaceDrawImagePlaceShape"] = prot.asc_setInterfaceDrawImagePlaceShape;
prot["asc_changeImageFromFile"] = prot.asc_changeImageFromFile;
// Cell interface
prot["asc_getCellInfo"] = prot.asc_getCellInfo;
......
......@@ -73,8 +73,6 @@ function CImage(drawingBase, drawingObjects)
CImage.prototype =
{
getObjectType: function()
{
return CLASS_TYPE_IMAGE;
......@@ -160,6 +158,18 @@ CImage.prototype =
};
},
setRasterImage: function(img, canvas)
{
this.blipFill = new CBlipFill();
this.blipFill.RasterImageId = img;
if(isRealObject(canvas))
this.blipFill.canvas = canvas;
this.spPr.Fill = new CUniFill();
this.spPr.Fill.fill = this.blipFill;
this.brush = this.spPr.Fill;
},
updateDrawingBaseCoordinates: function()
{
if(isRealObject(this.drawingBase))
......
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