Commit 15810781 authored by Sergey Luzyanin's avatar Sergey Luzyanin

properties for right panel ole-objects

parent 345dee37
...@@ -3247,23 +3247,28 @@ function DrawingObjects() { ...@@ -3247,23 +3247,28 @@ function DrawingObjects() {
_this.getOriginalImageSize = function() { _this.getOriginalImageSize = function() {
var selectedObjects = _this.controller.selectedObjects; 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)]; var _image = api.ImageLoader.map_image_index[AscCommon.getFullImageSrc2(imageUrl)];
if (_image != undefined && _image.Image != null && _image.Status == AscFonts.ImageLoadStatus.Complete) { if (_image != undefined && _image.Image != null && _image.Status == AscFonts.ImageLoadStatus.Complete) {
var _w = 1, _h = 1; var _w = 1, _h = 1;
var bIsCorrect = false; var bIsCorrect = false;
if (_image.Image != null) { if (_image.Image != null) {
bIsCorrect = true; bIsCorrect = true;
_w = Math.max( pxToMm(_image.Image.width), 1 ); _w = Math.max( pxToMm(_image.Image.width), 1 );
_h = Math.max( pxToMm(_image.Image.height), 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 ); return new AscCommon.asc_CImageSize( 50, 50, false );
......
...@@ -2384,6 +2384,18 @@ DrawingObjectsController.prototype = ...@@ -2384,6 +2384,18 @@ DrawingObjectsController.prototype =
{ {
checkObjectInArray(aGroups, objects_by_type.oleObjects[i].group.getMainGroup()); 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(); objects_by_type.oleObjects[i].checkDrawingBaseCoords();
} }
} }
...@@ -6570,7 +6582,7 @@ DrawingObjectsController.prototype = ...@@ -6570,7 +6582,7 @@ DrawingObjectsController.prototype =
pluginData.setAttribute("objectId", drawing.Id); pluginData.setAttribute("objectId", drawing.Id);
new_image_props = new_image_props =
{ {
ImageUrl: null, ImageUrl: drawing.getImageUrl(),
w: drawing.extX, w: drawing.extX,
h: drawing.extY, h: drawing.extY,
locked: locked, locked: locked,
...@@ -6578,7 +6590,9 @@ DrawingObjectsController.prototype = ...@@ -6578,7 +6590,9 @@ DrawingObjectsController.prototype =
y: drawing.y, y: drawing.y,
lockAspect: lockAspect, lockAspect: lockAspect,
pluginGuid: drawing.m_sApplicationId, pluginGuid: drawing.m_sApplicationId,
pluginData: pluginData pluginData: pluginData,
oleWidth: drawing.m_fDefaultSizeX,
oleHeight: drawing.m_fDefaultSizeY
}; };
if(!image_props) if(!image_props)
image_props = new_image_props; image_props = new_image_props;
...@@ -6598,8 +6612,10 @@ DrawingObjectsController.prototype = ...@@ -6598,8 +6612,10 @@ DrawingObjectsController.prototype =
image_props.locked = true; image_props.locked = true;
if(image_props.lockAspect || new_image_props.lockAspect) if(image_props.lockAspect || new_image_props.lockAspect)
image_props.lockAspect = false; image_props.lockAspect = false;
new_image_props.pluginGuid = null; image_props.pluginGuid = null;
new_image_props.pluginData = undefined; image_props.pluginData = undefined;
image_props.oleWidth = undefined;
image_props.oleHeight = undefined;
} }
break; break;
} }
...@@ -7023,6 +7039,14 @@ DrawingObjectsController.prototype = ...@@ -7023,6 +7039,14 @@ DrawingObjectsController.prototype =
image_props.ImageUrl = props.imageProps.ImageUrl; image_props.ImageUrl = props.imageProps.ImageUrl;
image_props.Locked = props.imageProps.locked === true; image_props.Locked = props.imageProps.locked === true;
image_props.lockAspect = props.imageProps.lockAspect; 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) if(!bParaLocked)
{ {
bParaLocked = image_props.Locked; bParaLocked = image_props.Locked;
......
...@@ -45,6 +45,8 @@ function (window, undefined) { ...@@ -45,6 +45,8 @@ function (window, undefined) {
this.m_sApplicationId = null; this.m_sApplicationId = null;
this.m_nPixWidth = null; this.m_nPixWidth = null;
this.m_nPixHeight = null; this.m_nPixHeight = null;
this.m_fDefaultSizeX = null;
this.m_fDefaultSizeY = null;
this.Id = AscCommon.g_oIdCounter.Get_NewId(); this.Id = AscCommon.g_oIdCounter.Get_NewId();
AscCommon.g_oTableId.Add( this, this.Id ); AscCommon.g_oTableId.Add( this, this.Id );
} }
...@@ -104,6 +106,19 @@ function (window, undefined) { ...@@ -104,6 +106,19 @@ function (window, undefined) {
copy.cachedPixW = this.cachedPixW; copy.cachedPixW = this.cachedPixW;
return copy; 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'] = window['AscFormat'] || {};
window['AscFormat'].COleObject = COleObject; window['AscFormat'].COleObject = COleObject;
})(window); })(window);
\ No newline at end of file
...@@ -1747,8 +1747,10 @@ ...@@ -1747,8 +1747,10 @@
this.vert = obj.vert != undefined ? obj.vert : undefined; this.vert = obj.vert != undefined ? obj.vert : undefined;
//oleObjects //oleObjects
this.pluginGuid = obj.pluginGuid != undefined ? obj.pluginGuid : undefined; this.pluginGuid = obj.pluginGuid !== undefined ? obj.pluginGuid : undefined;
this.pluginData = obj.pluginData != undefined ? obj.pluginData : 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 { else {
this.CanBeFlow = true; this.CanBeFlow = true;
...@@ -1783,6 +1785,9 @@ ...@@ -1783,6 +1785,9 @@
//oleObjects //oleObjects
this.pluginGuid = undefined; this.pluginGuid = undefined;
this.pluginData = undefined; this.pluginData = undefined;
this.oleWidth = undefined;
this.oleHeight = undefined;
} }
} }
...@@ -1873,6 +1878,9 @@ ...@@ -1873,6 +1878,9 @@
asc_getOriginSize: function(api) 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 _section_select = api.WordControl.m_oLogicDocument.Get_PageSizesByDrawingObjects();
var _page_width = AscCommon.Page_Width; var _page_width = AscCommon.Page_Width;
var _page_height = AscCommon.Page_Height; var _page_height = AscCommon.Page_Height;
...@@ -2819,6 +2827,10 @@ ...@@ -2819,6 +2827,10 @@
prot["get_ShapeProperties"] = prot["asc_getShapeProperties"] = prot.asc_getShapeProperties; prot["get_ShapeProperties"] = prot["asc_getShapeProperties"] = prot.asc_getShapeProperties;
prot["put_ShapeProperties"] = prot["asc_putShapeProperties"] = prot.asc_putShapeProperties; prot["put_ShapeProperties"] = prot["asc_putShapeProperties"] = prot.asc_putShapeProperties;
prot["get_OriginSize"] = prot["asc_getOriginSize"] = prot.asc_getOriginSize; 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; window["AscCommon"].asc_CSelectedObject = asc_CSelectedObject;
prot = asc_CSelectedObject.prototype; prot = asc_CSelectedObject.prototype;
......
...@@ -506,6 +506,12 @@ CGraphicObjects.prototype = ...@@ -506,6 +506,12 @@ CGraphicObjects.prototype =
image_props.Width = props_by_types.imageProps.w; image_props.Width = props_by_types.imageProps.w;
image_props.Height = props_by_types.imageProps.h; image_props.Height = props_by_types.imageProps.h;
image_props.lockAspect = props_by_types.imageProps.lockAspect; 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)) if(props_by_types.chartProps && !(props_by_types.chartProps.severalCharts === true))
{ {
......
...@@ -5604,12 +5604,14 @@ background-repeat: no-repeat;\ ...@@ -5604,12 +5604,14 @@ background-repeat: no-repeat;\
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_EditOleObject); 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.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight);
this.WordControl.m_oLogicDocument.Recalculate(); this.WordControl.m_oLogicDocument.Recalculate();
this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
} }
} }
else else
{ {
this.WordControl.m_oLogicDocument.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight); this.WordControl.m_oLogicDocument.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight);
this.WordControl.m_oLogicDocument.Recalculate(); 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