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

Inserting OleObjects

parent e6a25da7
No related merge requests found
......@@ -2493,6 +2493,15 @@ var editor;
ws.objectRender.setDrawImagePlaceParagraph(element_id, props);
};
spreadsheet_api.prototype.asc_replaceLoadImageCallback = function(fCallback){
if(this.wb){
var ws = this.wb.getWorksheet();
if(ws.objectRender){
ws.objectRender.asyncImageEndLoaded = fCallback;
}
}
};
spreadsheet_api.prototype.asyncImageEndLoaded = function(_image) {
if (this.wb) {
var ws = this.wb.getWorksheet();
......
......@@ -71,6 +71,26 @@ var DISTANCE_TO_TEXT_LEFTRIGHT = 3.2;
CURSOR_TYPES_BY_CARD_DIRECTION[CARD_DIRECTION_W] = "w-resize";
CURSOR_TYPES_BY_CARD_DIRECTION[CARD_DIRECTION_NW] = "nw-resize";
function fillImage(image, rasterImageId, x, y, extX, extY)
{
image.setSpPr(new AscFormat.CSpPr());
image.spPr.setParent(image);
image.spPr.setGeometry(AscFormat.CreateGeometry("rect"));
image.spPr.setXfrm(new AscFormat.CXfrm());
image.spPr.xfrm.setParent(image.spPr);
image.spPr.xfrm.setOffX(x);
image.spPr.xfrm.setOffY(y);
image.spPr.xfrm.setExtX(extX);
image.spPr.xfrm.setExtY(extY);
var blip_fill = new AscFormat.CBlipFill();
blip_fill.setRasterImageId(rasterImageId);
blip_fill.setStretch(true);
image.setBlipFill(blip_fill);
image.setNvPicPr(new AscFormat.UniNvPr());
image.setBDeleted(false);
}
function removeDPtsFromSeries(series)
{
if(Array.isArray(series.dPt))
......@@ -480,6 +500,7 @@ function getObjectsByTypesFromArr(arr, bGrouped)
break;
}
case AscDFH.historyitem_type_ImageShape:
case AscDFH.historyitem_type_OleObject:
{
ret.images.push(drawing);
break;
......@@ -588,6 +609,10 @@ function CanStartEditText(oController)
DrawingObjectsController.prototype =
{
handleOleDblClick: function(drawing, e, x, y, pageIndex)
{
},
//for mobile spreadsheet editor
startEditTextCurrentShape: function()
......@@ -853,6 +878,9 @@ DrawingObjectsController.prototype =
if (object.getObjectType() === AscDFH.historyitem_type_ChartSpace && this.handleChartDoubleClick)
this.handleChartDoubleClick(drawing, object, e, x, y, pageIndex);
if (object.getObjectType() === AscDFH.historyitem_type_OleObject && this.handleChartDoubleClick){
this.handleOleObjectDoubleClick(drawing, object, e, x, y, pageIndex);
}
else if (2 == e.ClickCount && drawing instanceof ParaDrawing && drawing.Is_MathEquation())
this.handleMathDrawingDoubleClick(drawing, e, x, y, pageIndex);
}
......@@ -7047,28 +7075,23 @@ DrawingObjectsController.prototype =
ascSelectedObjects.push(new AscCommon.asc_CSelectedObject ( Asc.c_oAscTypeSelectElement.Paragraph, new Asc.asc_CParagraphProperty( ParaPr ) ));
},
createImage: function(rasterImageId, x, y, extX, extY)
{
var image = new AscFormat.CImageShape();
image.setSpPr(new AscFormat.CSpPr());
image.spPr.setParent(image);
image.spPr.setGeometry(AscFormat.CreateGeometry("rect"));
image.spPr.setXfrm(new AscFormat.CXfrm());
image.spPr.xfrm.setParent(image.spPr);
image.spPr.xfrm.setOffX(x);
image.spPr.xfrm.setOffY(y);
image.spPr.xfrm.setExtX(extX);
image.spPr.xfrm.setExtY(extY);
var blip_fill = new AscFormat.CBlipFill();
blip_fill.setRasterImageId(rasterImageId);
blip_fill.setStretch(true);
image.setBlipFill(blip_fill);
image.setNvPicPr(new AscFormat.UniNvPr());
image.setBDeleted(false);
AscFormat.fillImage(image, rasterImageId, x, y, extX, extY);
return image;
},
createOleObject: function(data, sApplicationId, rasterImageId, x, y, extX, extY)
{
var oleObject = new AscFormat.COleObject();
AscFormat.fillImage(oleObject, rasterImageId, x, y, extX, extY);
oleObject.setData(data);
oleObject.setApplicationId(sApplicationId);
return oleObject;
},
createTextArt: function(nStyle, bWord, wsModel)
{
var MainLogicDocument = (editor && editor.WordControl && editor.WordControl.m_oLogicDocument ? editor && editor.WordControl && editor.WordControl.m_oLogicDocument : null);
......@@ -8799,4 +8822,5 @@ function CalcLiterByLength(aAlphaBet, nLength)
window['AscFormat'].GetMinSnapDistanceXObjectByArrays = GetMinSnapDistanceXObjectByArrays;
window['AscFormat'].GetMinSnapDistanceYObjectByArrays = GetMinSnapDistanceYObjectByArrays;
window['AscFormat'].CalcLiterByLength = CalcLiterByLength;
window['AscFormat'].fillImage = fillImage;
})(window);
......@@ -96,6 +96,7 @@ function handleFloatObjects(drawingObjectsController, drawingArr, e, x, y, group
{
case AscDFH.historyitem_type_Shape:
case AscDFH.historyitem_type_ImageShape:
case AscDFH.historyitem_type_OleObject:
{
ret = handleShapeImage(drawing, drawingObjectsController, e, x, y, group, pageIndex, bWord);
if(ret)
......@@ -203,6 +204,7 @@ function handleGroup(drawing, drawingObjectsController, e, x, y, group, pageInde
{
case AscDFH.historyitem_type_Shape:
case AscDFH.historyitem_type_ImageShape:
case AscDFH.historyitem_type_OleObject:
{
ret = handleShapeImageInGroup(drawingObjectsController, drawing, cur_grouped_object, e, x, y, pageIndex, bWord);
if(ret)
......@@ -613,8 +615,12 @@ function handleInlineHitNoText(drawing, drawingObjects, e, x, y, pageIndex, bInS
{
if (drawing.getObjectType() === AscDFH.historyitem_type_ChartSpace && drawingObjects.handleChartDoubleClick)
drawingObjects.handleChartDoubleClick(drawing.parent, drawing, e, x, y, pageIndex);
else if (drawing.getObjectType() === AscDFH.historyitem_type_OleObject && drawingObjects.handleChartDoubleClick){
drawingObjects.handleOleObjectDoubleClick(drawing.parent, drawing, e, x, y, pageIndex);
}
else if (2 == e.ClickCount && drawing.parent instanceof ParaDrawing && drawing.parent.Is_MathEquation())
drawingObjects.handleMathDrawingDoubleClick(drawing.parent, e, x, y, pageIndex);
}
drawingObjects.updateOverlay();
return true;
......@@ -642,6 +648,7 @@ function handleInlineObjects(drawingObjectsController, drawingArr, e, x, y, page
{
case AscDFH.historyitem_type_Shape:
case AscDFH.historyitem_type_ImageShape:
case AscDFH.historyitem_type_OleObject:
{
ret = handleInlineShapeImage(drawing, drawingObjectsController, e, x, y, pageIndex);
if(ret)
......
......@@ -12498,6 +12498,7 @@ function checkBlipFillRasterImages(sp)
break;
}
case AscDFH.historyitem_type_ImageShape:
case AscDFH.historyitem_type_OleObject:
{
if(sp.blipFill)
{
......
......@@ -889,6 +889,8 @@ window['AscDFH'].historyitem_ImageShapeSetBlipFill = 2537;
window['AscDFH'].historyitem_ImageShapeSetParent = 2538;
window['AscDFH'].historyitem_ImageShapeSetGroup = 2539;
window['AscDFH'].historyitem_ImageShapeSetStyle = 2540;
window['AscDFH'].historyitem_ImageShapeSetData = 2541;
window['AscDFH'].historyitem_ImageShapeSetApplicationId = 2542;
window['AscDFH'].historyitem_GeometrySetParent = 2540;
window['AscDFH'].historyitem_GeometryAddAdj = 2541;
window['AscDFH'].historyitem_GeometryAddGuide = 2542;
......@@ -1192,6 +1194,7 @@ window['AscDFH'].historyitem_type_PropLocker = 1120;
window['AscDFH'].historyitem_type_Theme = 1121;
window['AscDFH'].historyitem_type_GraphicFrame = 1122;
window['AscDFH'].historyitem_type_GrpFill = 1123;
window['AscDFH'].historyitem_type_OleObject = 1124;
......@@ -2000,5 +2003,6 @@ window['AscDFH'].historydescription_Document_AddTabToMath
window['AscDFH'].historydescription_Document_SetMathProps = 0x0134;
window['AscDFH'].historydescription_Document_ApplyPrToMath = 0x0135;
window['AscDFH'].historydescription_Document_ApiBuilder = 0x0136;
window['AscDFH'].historydescription_Document_AddOleObject = 0x0137;
})(window);
......@@ -12,16 +12,9 @@ var History = AscCommon.History;
function CGraphicFrame()
{
CGraphicFrame.superclass.constructor.call(this);
this.parent = null;
this.graphicObject = null;
this.nvGraphicFramePr = null;
this.spPr = null;
this.group = null;
this.x = null;
this.y = null;
this.extX = null;
this.extY = null;
this.compiledHierarchy = [];
this.Pages = [];
this.Id = AscCommon.g_oIdCounter.Get_NewId();
......@@ -36,7 +29,6 @@ function CGraphicFrame()
recalculateTable: true
};
this.RecalcInfo = {};
this.bDeleted = true;
}
AscCommon.extendClass(CGraphicFrame, AscFormat.CGraphicObjectBase);
......
......@@ -75,6 +75,7 @@
this.snapArrayX = [];
this.snapArrayY = [];
this.selected = false;
this.Lock = new AscCommon.CLock();
this.setRecalculateInfo();
......
......@@ -25,7 +25,6 @@ function CGroupShape()
this.invertTransform = null;
this.scaleCoefficients = {cx: 1, cy: 1};
this.selected = false;
this.arrGraphicObjects = [];
this.selectedObjects = [];
......
......@@ -20,11 +20,8 @@ function CImageShape()
this.blipFill = null;
this.style = null;
this.cursorTypes = [];
this.selected = false;
this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add( this, this.Id );
}
......@@ -666,6 +663,16 @@ CImageShape.prototype.Undo = function(data)
{
switch(data.Type)
{
case AscDFH.historyitem_ImageShapeSetData:
{
this.m_sData = data.oldData;
break;
}
case AscDFH.historyitem_ImageShapeSetApplicationId:
{
this.m_sData = data.oldId;
break;
}
case AscDFH.historyitem_AutoShapes_SetBFromSerialize:
{
this.fromSerialize = data.oldPr;
......@@ -747,6 +754,17 @@ CImageShape.prototype.Redo = function(data)
{
switch(data.Type)
{
case AscDFH.historyitem_ImageShapeSetData:
{
this.m_sData = data.newData;
break;
}
case AscDFH.historyitem_ImageShapeSetApplicationId:
{
this.m_sData = data.newId;
break;
}
case AscDFH.historyitem_AutoShapes_SetBFromSerialize:
{
this.fromSerialize = data.newPr;
......@@ -829,6 +847,17 @@ CImageShape.prototype.Save_Changes = function(data, w)
w.WriteLong(data.Type);
switch(data.Type)
{
case AscDFH.historyitem_ImageShapeSetData:
{
AscFormat.writeString(w, data.newData);
break;
}
case AscDFH.historyitem_ImageShapeSetApplicationId:
{
AscFormat.writeString(w, data.newId);
break;
}
case AscDFH.historyitem_AutoShapes_SetBFromSerialize:
{
AscFormat.writeBool(w, data.newPr);
......@@ -903,6 +932,16 @@ CImageShape.prototype.Load_Changes = function(r)
var type = r.GetLong();
switch(type)
{
case AscDFH.historyitem_ImageShapeSetData:
{
this.m_sData = AscFormat.readString(r);
break;
}
case AscDFH.historyitem_ImageShapeSetApplicationId:
{
this.m_sApplicationId = AscFormat.readString(r);
break;
}
case AscDFH.historyitem_AutoShapes_SetBFromSerialize:
{
this.fromSerialize = AscFormat.readBool(r);
......
"use strict";
(
/**
* @param {Window} window
* @param {undefined} undefined
*/
function (window, undefined) {
function COleObject()
{
COleObject.superclass.constructor.call(this);
this.m_sData = null;
this.m_sApplicationId = null;
this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add( this, this.Id );
}
AscCommon.extendClass(COleObject, CImageShape);
COleObject.prototype.getObjectType = function()
{
return AscDFH.historyitem_type_OleObject;
};
COleObject.prototype.setData = function(sData)
{
AscCommon.History.Add(this, {Type:AscDFH.historyitem_ImageShapeSetData, oldData: this.m_sData, newData: sData});
this.m_sData = sData;
};
COleObject.prototype.setApplicationId = function(sApplicationId)
{
AscCommon.History.Add(this, {Type:AscDFH.historyitem_ImageShapeSetApplicationId, oldId: this.m_sApplicationId, newId: sApplicationId});
this.m_sApplicationId = sApplicationId;
};
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].COleObject = COleObject;
})(window);
\ No newline at end of file
......@@ -555,7 +555,6 @@ function CShape()
this.transformText = new CMatrix();
this.invertTransformText = null;
this.selected = false;
this.localTransformText = new CMatrix();
......
......@@ -583,6 +583,39 @@ baseEditorsApi.prototype._uploadCallback = function(error, files) {
});
}
};
//метод, который подменяет callback загрузки в каждом редакторе, TODO: переделать, сделать одинаково в о всех редакторах
baseEditorsApi.prototype.asc_replaceLoadImageCallback = function(fCallback){
};
baseEditorsApi.prototype.asc_loadLocalImageAndAction = function(sLocalImage, fCallback){
this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalImage), 1);
this.asc_replaceLoadImageCallback(fCallback);
};
baseEditorsApi.prototype.asc_checkImageUrlAndAction = function(sImageUrl, fCallback){
var sLocalImage = AscCommon.g_oDocumentUrls.getImageLocal(sImageUrl);
if(sLocalImage){
this.asc_loadLocalImageAndAction(sLocalImage, fCallback);
return;
}
var oThis = this;
AscCommon.sendImgUrls(oThis, [sImageUrl], function(data){
if(data[0] && data[0].path != null){
oThis.asc_loadLocalImageAndAction(AscCommon.g_oDocumentUrls.imagePath2Local(data[0].path), fCallback);
}
}, this.editorId === c_oEditorId.Spreadsheet);
};
baseEditorsApi.prototype.asc_addOleObject = function(sImageUrl, sData, sApplicationId){
var oThis = this;
this.asc_checkImageUrlAndAction(sImageUrl, function(oImage){oThis.asc_addOleObjectAction(AscCommon.g_oDocumentUrls.getImageLocal(oImage.src), sData, sApplicationId);});
};
baseEditorsApi.prototype.asc_addOleObjectAction = function(sLocalUrl, sData, sApplicationId)
{
};
// Version History
baseEditorsApi.prototype.asc_showRevision = function(newObj) {
};
......
......@@ -97,7 +97,8 @@ CCollaborativeEditing.prototype.Send_Changes = function(IsUserSave, AdditionalIn
|| Class.getObjectType() === AscDFH.historyitem_type_ImageShape
|| Class.getObjectType() === AscDFH.historyitem_type_GroupShape
|| Class.getObjectType() === AscDFH.historyitem_type_GraphicFrame
|| Class.getObjectType() === AscDFH.historyitem_type_ChartSpace) && AscCommon.isRealObject(Class.parent))
|| Class.getObjectType() === AscDFH.historyitem_type_ChartSpace
|| Class.getObjectType() === AscDFH.historyitem_type_OleObject) && AscCommon.isRealObject(Class.parent))
{
if(Class.parent && AscFormat.isRealNumber(Class.parent.num))
{
......
......@@ -825,6 +825,7 @@ Slide.prototype =
break;
}
case AscDFH.historyitem_type_ImageShape:
case AscDFH.historyitem_type_OleObject:
{
if(!drawing.nvPicPr)
{
......@@ -1262,7 +1263,7 @@ Slide.prototype =
for(var i = 0; i < sp_tree.length; ++i)
{
var sp = sp_tree[i];
if(sp.getObjectType() === AscDFH.historyitem_type_Shape || sp.getObjectType() === AscDFH.historyitem_type_ImageShape)
if(sp.getObjectType() === AscDFH.historyitem_type_Shape || sp.getObjectType() === AscDFH.historyitem_type_ImageShapee || sp.getObjectType() === AscDFH.historyitem_type_OleObject)
{
if(sp.isPlaceholder && sp.isPlaceholder())
{
......
......@@ -4721,6 +4721,10 @@ asc_docs_api.prototype.asyncFontEndLoaded = function(fontinfo)
}
};
asc_docs_api.prototype.asc_replaceLoadImageCallback = function(fCallback){
this.asyncImageEndLoaded2 = fCallback;
};
asc_docs_api.prototype.asyncImageEndLoaded = function(_image)
{
// отжать заморозку меню
......
......@@ -3960,6 +3960,39 @@ CDocument.prototype.Add_InlineImage = function(W, H, Img, Chart, bFlo
}
}
};
CDocument.prototype.Add_OleObject = function(W, H, Img, Data, sApplicationId)
{
if (docpostype_HdrFtr === this.CurPos.Type)
{
return this.HdrFtr.Add_OleObject(W, H, Img, Data, sApplicationId);
}
else if (docpostype_DrawingObjects === this.CurPos.Type)
{
return this.DrawingObjects.addOleObject(W, H, Img, Data, sApplicationId);
}
else //if ( docpostype_Content === this.CurPos.Type )
{
if (true == this.Selection.Use)
this.Remove(1, true);
var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType())
{
var Drawing = new ParaDrawing(W, H, null, this.DrawingDocument, this, null);
var Image = this.DrawingObjects.createOleObject(Data, sApplicationId, Img, 0, 0, W, H);
Image.setParent(Drawing);
Drawing.Set_GraphicObject(Image);
this.Paragraph_Add(Drawing);
this.Select_DrawingObject(Drawing.Get_Id());
}
else if (type_Table == Item.GetType())
{
Item.Add_OleObject(W, H, Img, Data, sApplicationId);
}
}
};
CDocument.prototype.Add_TextArt = function(nStyle)
{
// Работаем с колонтитулом
......
......@@ -2256,6 +2256,34 @@ CDocumentContent.prototype.Add_InlineImage = function(W, H, I
}
}
};
CDocumentContent.prototype.Add_OleObject = function(W, H, Img, Data, sApplicationId)
{
if (docpostype_DrawingObjects === this.CurPos.Type)
{
return this.DrawingObjects.addOleObject(W, H, Img, Data, sApplicationId);
}
else //if ( docpostype_Content === this.CurPos.Type )
{
if (true == this.Selection.Use)
this.Remove(1, true);
var Item = this.Content[this.CurPos.ContentPos];
if (type_Paragraph == Item.GetType())
{
var Drawing = new ParaDrawing(W, H, null, this.DrawingDocument, this, null);
var Image = this.DrawingObjects.createOleObject(Data, sApplicationId, Img, 0, 0, W, H);
Image.setParent(Drawing);
Drawing.Set_GraphicObject(Image);
this.Paragraph_Add(Drawing);
this.Select_DrawingObject(Drawing.Get_Id());
}
else if (type_Table == Item.GetType())
{
Item.Add_OleObject(W, H, Img, Data, sApplicationId);
}
}
};
CDocumentContent.prototype.Add_TextArt = function(nStyle)
{
if (docpostype_DrawingObjects !== this.CurPos.Type)
......
......@@ -256,6 +256,7 @@ CGraphicObjects.prototype =
},
createImage: DrawingObjectsController.prototype.createImage,
createOleObject: DrawingObjectsController.prototype.createOleObject,
createTextArt: DrawingObjectsController.prototype.createTextArt,
getChartObject: DrawingObjectsController.prototype.getChartObject,
getChartSpace2: DrawingObjectsController.prototype.getChartSpace2,
......@@ -1215,6 +1216,16 @@ CGraphicObjects.prototype =
this.document.OnMouseUp(e, x, y, pageIndex);
},
handleOleObjectDoubleClick: function(drawing, oleObject, e, x, y, pageIndex)
{
if(false === this.document.Document_Is_SelectionLocked(changestype_Drawing_Props))
{
editor.asc_pluginRun(oleObject.m_sApplicationId, oleObject.m_sData);
}
this.changeCurrentState(new AscFormat.NullState(this));
this.document.OnMouseUp(e, x, y, pageIndex);
},
handleMathDrawingDoubleClick : function(drawing, e, x, y, pageIndex)
{
drawing.Convert_ToMathObject();
......@@ -1257,6 +1268,41 @@ CGraphicObjects.prototype =
}
},
addOleObject: function(W, H, Img, Data, sApplicationId)
{
var content = this.getTargetDocContent();
if(content)
{
if(!content.bPresentation){
content.Add_OleObject(W, H, Img, Data, sApplicationId);
}
else{
if(this.selectedObjects.length > 0)
{
this.resetSelection2();
this.document.Add_OleObject(W, H, Img, Data, sApplicationId);
}
}
}
else
{
if(this.selectedObjects[0] && this.selectedObjects[0].parent && this.selectedObjects[0].parent.Is_Inline())
{
this.resetInternalSelection();
this.document.Remove(1, true);
this.document.Add_OleObject(W, H, Img, Data, sApplicationId);
}
else
{
if(this.selectedObjects.length > 0)
{
this.resetSelection2();
this.document.Add_OleObject(W, H, Img, Data, sApplicationId);
}
}
}
},
addInlineTable: function( Cols, Rows )
{
var content = this.getTargetDocContent();
......@@ -1936,7 +1982,7 @@ CGraphicObjects.prototype =
{
if(drawing && drawing.GraphicObj)
{
if(drawing.GraphicObj.getObjectType() !== AscDFH.historyitem_type_ImageShape && drawing.GraphicObj.getObjectType() !== AscDFH.historyitem_type_ChartSpace)
if(drawing.GraphicObj.getObjectType() !== AscDFH.historyitem_type_ImageShape && drawing.GraphicObj.getObjectType() !== AscDFH.historyitem_type_OleObject && drawing.GraphicObj.getObjectType() !== AscDFH.historyitem_type_ChartSpace)
return null;
}
this.handleEventMode = HANDLE_EVENT_MODE_CURSOR;
......@@ -1957,7 +2003,7 @@ CGraphicObjects.prototype =
}
else
{
if(object.getObjectType() === AscDFH.historyitem_type_ImageShape && object.parent)
if((object.getObjectType() === AscDFH.historyitem_type_ImageShape || object.getObjectType() === AscDFH.historyitem_type_OleObject) && object.parent)
{
var oShape = object.parent.isShapeChild(true);
if(oShape)
......
......@@ -630,6 +630,11 @@ CHeaderFooter.prototype =
this.Content.Add_InlineImage(W,H,Img, Chart, bFlow);
},
Add_OleObject : function(W, H, Img, Data, sApplicationId)
{
this.Content.Add_OleObject(W, H, Img, Data, sApplicationId);
},
Add_TextArt : function(nStyle)
{
this.Content.Add_TextArt(nStyle);
......
......@@ -15183,6 +15183,7 @@ CParagraphRevisionsChangesChecker.prototype.Add_Drawing = function(Drawing)
}
case AscDFH.historyitem_type_ImageShape:
case AscDFH.historyitem_type_Image:
case AscDFH.historyitem_type_OleObject:
{
this.AddRemove.Value.push(c_oAscRevisionsObjectType.Image);
break;
......
......@@ -6810,6 +6810,13 @@ CTable.prototype =
this.CurCell.Content.Add_InlineImage(W,H,Img, Chart, bFlow);
},
Add_OleObject : function(W, H, Img, Data)
{
this.Selection.Use = true;
this.Selection.Type = table_Selection_Text;
this.CurCell.Content.Add_OleObject(W, H, Img, Data);
},
Add_TextArt : function(nStyle)
{
this.Selection.Use = true;
......
......@@ -5545,6 +5545,28 @@ asc_docs_api.prototype.sync_ImgPropCallback = function(imgProp)
this.asc_fireCallback("asc_onImgWrapStyleChanged",style);
};
asc_docs_api.prototype.asc_addOleObjectAction = function(sLocalUrl, sData, sApplicationId)
{
var _image = this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalUrl), 1);
if (null != _image)//картинка уже должна быть загружена
{
if (false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
var _w = Math.max(1, AscCommon.Page_Width - (AscCommon.X_Left_Margin + AscCommon.X_Right_Margin));
var _h = Math.max(1, AscCommon.Page_Height - (AscCommon.Y_Top_Margin + AscCommon.Y_Bottom_Margin));
if (_image.Image != null)
{
var __w = Math.max(parseInt(_image.Image.width * AscCommon.g_dKoef_pix_to_mm), 1);
var __h = Math.max(parseInt(_image.Image.height * AscCommon.g_dKoef_pix_to_mm), 1);
_w = Math.max(5, Math.min(_w, __w));
_h = Math.max(5, Math.min(parseInt(_w * __h / __w)));
}
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_AddOleObject);
this.WordControl.m_oLogicDocument.Add_OleObject(_w, _h, sLocalUrl, sData, sApplicationId);
}
}
};
//-----------------------------------------------------------------
// События контекстного меню
//-----------------------------------------------------------------
......@@ -6768,6 +6790,10 @@ asc_docs_api.prototype.asyncFontEndLoaded = function(fontinfo)
// отжать заморозку меню
};
asc_docs_api.prototype.asc_replaceLoadImageCallback = function(fCallback){
this.asyncImageEndLoaded2 = fCallback;
};
asc_docs_api.prototype.asyncImageEndLoaded = function(_image)
{
// отжать заморозку меню
......
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