Commit b7549732 authored by Sergey Luzyanin's avatar Sergey Luzyanin

Merge branch 'release/4.0.1' into develop

parents 3c0789c2 15810781
......@@ -3247,23 +3247,28 @@ function DrawingObjects() {
_this.getOriginalImageSize = function() {
var selectedObjects = _this.controller.selectedObjects;
if ( (selectedObjects.length == 1) && selectedObjects[0].isImage() ) {
if ( (selectedObjects.length == 1) ) {
var imageUrl = selectedObjects[0].getImageUrl();
if(AscFormat.isRealNumber(selectedObjects[0].m_fDefaultSizeX) && AscFormat.isRealNumber(selectedObjects[0].m_fDefaultSizeY)){
return new AscCommon.asc_CImageSize( selectedObjects[0].m_fDefaultSizeX, selectedObjects[0].m_fDefaultSizeY, true);
}
if(selectedObjects[0].isImage()){
var imageUrl = selectedObjects[0].getImageUrl();
var _image = api.ImageLoader.map_image_index[AscCommon.getFullImageSrc2(imageUrl)];
if (_image != undefined && _image.Image != null && _image.Status == AscFonts.ImageLoadStatus.Complete) {
var _image = api.ImageLoader.map_image_index[AscCommon.getFullImageSrc2(imageUrl)];
if (_image != undefined && _image.Image != null && _image.Status == AscFonts.ImageLoadStatus.Complete) {
var _w = 1, _h = 1;
var bIsCorrect = false;
if (_image.Image != null) {
var _w = 1, _h = 1;
var bIsCorrect = false;
if (_image.Image != null) {
bIsCorrect = true;
_w = Math.max( pxToMm(_image.Image.width), 1 );
_h = Math.max( pxToMm(_image.Image.height), 1 );
}
bIsCorrect = true;
_w = Math.max( pxToMm(_image.Image.width), 1 );
_h = Math.max( pxToMm(_image.Image.height), 1 );
}
return new AscCommon.asc_CImageSize( _w, _h, bIsCorrect);
return new AscCommon.asc_CImageSize( _w, _h, bIsCorrect);
}
}
}
return new AscCommon.asc_CImageSize( 50, 50, false );
......
......@@ -2451,6 +2451,18 @@ DrawingObjectsController.prototype =
{
checkObjectInArray(aGroups, objects_by_type.oleObjects[i].group.getMainGroup());
}
var api = window.editor || window.Asc.editor;
if(api)
{
var pluginData = new Asc.CPluginData();
pluginData.setAttribute("data", objects_by_type.oleObjects[i].m_sData);
pluginData.setAttribute("guid", objects_by_type.oleObjects[i].m_sApplicationId);
pluginData.setAttribute("width", objects_by_type.oleObjects[i].spPr.xfrm.extX);
pluginData.setAttribute("height", objects_by_type.oleObjects[i].spPr.xfrm.extY);
pluginData.setAttribute("objectId", objects_by_type.oleObjects[i].Get_Id());
api.asc_pluginResize(pluginData);
}
objects_by_type.oleObjects[i].checkDrawingBaseCoords();
}
}
......@@ -6642,7 +6654,7 @@ DrawingObjectsController.prototype =
pluginData.setAttribute("objectId", drawing.Id);
new_image_props =
{
ImageUrl: null,
ImageUrl: drawing.getImageUrl(),
w: drawing.extX,
h: drawing.extY,
locked: locked,
......@@ -6650,7 +6662,9 @@ DrawingObjectsController.prototype =
y: drawing.y,
lockAspect: lockAspect,
pluginGuid: drawing.m_sApplicationId,
pluginData: pluginData
pluginData: pluginData,
oleWidth: drawing.m_fDefaultSizeX,
oleHeight: drawing.m_fDefaultSizeY
};
if(!image_props)
image_props = new_image_props;
......@@ -6670,8 +6684,10 @@ DrawingObjectsController.prototype =
image_props.locked = true;
if(image_props.lockAspect || new_image_props.lockAspect)
image_props.lockAspect = false;
new_image_props.pluginGuid = null;
new_image_props.pluginData = undefined;
image_props.pluginGuid = null;
image_props.pluginData = undefined;
image_props.oleWidth = undefined;
image_props.oleHeight = undefined;
}
break;
}
......@@ -7095,6 +7111,14 @@ DrawingObjectsController.prototype =
image_props.ImageUrl = props.imageProps.ImageUrl;
image_props.Locked = props.imageProps.locked === true;
image_props.lockAspect = props.imageProps.lockAspect;
image_props.pluginGuid = props.imageProps.pluginGuid;
image_props.pluginData = props.imageProps.pluginData;
image_props.oleWidth = props.imageProps.oleWidth;
image_props.oleHeight = props.imageProps.oleHeight;
if(!bParaLocked)
{
bParaLocked = image_props.Locked;
......
......@@ -45,6 +45,8 @@ function (window, undefined) {
this.m_sApplicationId = null;
this.m_nPixWidth = null;
this.m_nPixHeight = null;
this.m_fDefaultSizeX = null;
this.m_fDefaultSizeY = null;
this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add( this, this.Id );
}
......@@ -104,6 +106,19 @@ function (window, undefined) {
copy.cachedPixW = this.cachedPixW;
return copy;
};
COleObject.prototype.handleUpdateExtents = function(){
if(!AscFormat.isRealNumber(this.m_fDefaultSizeX) || !AscFormat.isRealNumber(this.m_fDefaultSizeY)){
if(this.spPr && this.spPr.xfrm && AscFormat.isRealNumber(this.spPr.xfrm.extX) && AscFormat.isRealNumber(this.spPr.xfrm.extY)){
this.m_fDefaultSizeX = this.spPr.xfrm.extX;
this.m_fDefaultSizeY = this.spPr.xfrm.extY;
}
}
if(AscFormat.CImageShape.prototype.handleUpdateExtents){
AscFormat.CImageShape.prototype.handleUpdateExtents.call(this, []);
}
};
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].COleObject = COleObject;
})(window);
\ No newline at end of file
......@@ -1747,8 +1747,10 @@
this.vert = obj.vert != undefined ? obj.vert : undefined;
//oleObjects
this.pluginGuid = obj.pluginGuid != undefined ? obj.pluginGuid : undefined;
this.pluginData = obj.pluginData != undefined ? obj.pluginData : undefined;
this.pluginGuid = obj.pluginGuid !== undefined ? obj.pluginGuid : undefined;
this.pluginData = obj.pluginData !== undefined ? obj.pluginData : undefined;
this.oleWidth = obj.oleWidth != undefined ? obj.oleWidth : undefined;
this.oleHeight = obj.oleHeight != undefined ? obj.oleHeight : undefined;
}
else {
this.CanBeFlow = true;
......@@ -1783,6 +1785,9 @@
//oleObjects
this.pluginGuid = undefined;
this.pluginData = undefined;
this.oleWidth = undefined;
this.oleHeight = undefined;
}
}
......@@ -1873,6 +1878,9 @@
asc_getOriginSize: function(api)
{
if(AscFormat.isRealNumber(this.oleWidth) && AscFormat.isRealNumber(this.oleHeight)){
return new asc_CImageSize( this.oleWidth, this.oleHeight, true );
}
var _section_select = api.WordControl.m_oLogicDocument.Get_PageSizesByDrawingObjects();
var _page_width = AscCommon.Page_Width;
var _page_height = AscCommon.Page_Height;
......@@ -2823,6 +2831,10 @@
prot["get_ShapeProperties"] = prot["asc_getShapeProperties"] = prot.asc_getShapeProperties;
prot["put_ShapeProperties"] = prot["asc_putShapeProperties"] = prot.asc_putShapeProperties;
prot["get_OriginSize"] = prot["asc_getOriginSize"] = prot.asc_getOriginSize;
prot["get_PluginGuid"] = prot["asc_getPluginGuid"] = prot.asc_getPluginGuid;
prot["put_PluginGuid"] = prot["asc_putPluginGuid"] = prot.asc_putPluginGuid;
prot["get_PluginData"] = prot["asc_getPluginData"] = prot.asc_getPluginData;
prot["put_PluginData"] = prot["asc_putPluginData"] = prot.asc_putPluginData;
window["AscCommon"].asc_CSelectedObject = asc_CSelectedObject;
prot = asc_CSelectedObject.prototype;
......
......@@ -506,6 +506,12 @@ CGraphicObjects.prototype =
image_props.Width = props_by_types.imageProps.w;
image_props.Height = props_by_types.imageProps.h;
image_props.lockAspect = props_by_types.imageProps.lockAspect;
image_props.pluginGuid = props_by_types.imageProps.pluginGuid;
image_props.pluginData = props_by_types.imageProps.pluginData;
image_props.oleWidth = props_by_types.imageProps.oleWidth;
image_props.oleHeight = props_by_types.imageProps.oleHeight;
}
if(props_by_types.chartProps && !(props_by_types.chartProps.severalCharts === true))
{
......
......@@ -5596,12 +5596,14 @@ background-repeat: no-repeat;\
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_EditOleObject);
this.WordControl.m_oLogicDocument.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight);
this.WordControl.m_oLogicDocument.Recalculate();
this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
}
}
else
{
this.WordControl.m_oLogicDocument.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight);
this.WordControl.m_oLogicDocument.Recalculate();
this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
}
}
};
......
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