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

git-svn-id:...

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48600 954022d7-b5bf-4e40-9824-e11837661b57
parent 01dc7c71
......@@ -649,20 +649,18 @@ DrawingObjectsController.prototype =
{
var shape_props, image_props, chart_props;
switch (this.curState.id)
{
/*case STATES_ID_GROUP:
case STATES_ID_TEXT_ADD_IN_GROUP:
if(isRealObject(this.curState.group))
{
var s_array = this.curState.group.selectionInfo.selectionArray;
for(var i = 0; i< s_array.length; ++i)
var selected_objects = this.curState.group.selectedObjects;
for(var i = 0; i< selected_objects.length; ++i)
{
var c_obj = s_array[i];
if(c_obj.isImage() && c_obj.chart == null)
var c_obj = selected_objects[i];
if(c_obj.isImage())
{
if(!isRealObject(image_props))
{
image_props = {fromGroup: true};
image_props = new asc_CImgProperty();
image_props.fromGroup = true;
image_props.ImageUrl = c_obj.getImageUrl();
}
else
......@@ -671,11 +669,13 @@ DrawingObjectsController.prototype =
image_props.ImageUrl = null;
}
}
if(c_obj.isImage() && isRealObject(c_obj.chart))
if(c_obj.isChart())
{
if(!isRealObject(chart_props))
{
chart_props = {fromGroup: true};
chart_props = new asc_CImgProperty();
chart_props.fromGroup = true;
chart_props.ChartProperties = c_obj.chart;
}
else
......@@ -698,15 +698,15 @@ DrawingObjectsController.prototype =
{
if(!isRealObject(shape_props))
{
shape_props = {fromGroup: true};
shape_props.ShapeProperties =
{
type: c_obj.getPresetGeom(),
fill: c_obj.getFill(),
stroke: c_obj.getStroke(),
canChangeArrows: c_obj.canChangeArrows()
};
shape_props.verticalTextAlign = c_obj.bodyPr.anchor;
shape_props = new asc_CImgProperty();
shape_props.fromGroup = true;
shape_props.ShapeProperties = new asc_CShapeProperty();
shape_props.ShapeProperties.type = c_obj.getPresetGeom();
shape_props.ShapeProperties.fill = c_obj.getFill();
shape_props.ShapeProperties.stroke = c_obj.getStroke();
shape_props.ShapeProperties.canChangeArrows = c_obj.canChangeArrows();
shape_props.verticalTextAlign = isRealObject(c_obj.txBody) ? c_obj.txBody.getBodyPr().anchor : null;
}
else
{
......@@ -722,9 +722,8 @@ DrawingObjectsController.prototype =
}
}
}
break;
}*/
default :
}
else
{
var s_arr = this.selectedObjects;
for(i = 0; i < s_arr.length; ++i)
......@@ -745,11 +744,10 @@ DrawingObjectsController.prototype =
shape_props.ShapeProperties.stroke = c_obj.getStroke();
shape_props.ShapeProperties.canChangeArrows = c_obj.canChangeArrows();
//shape_props.verticalTextAlign = c_obj.bodyPr.anchor;
shape_props.verticalTextAlign = isRealObject(c_obj.txBody) ? c_obj.txBody.getBodyPr().anchor : null;
}
else
{
/* TODO
ShapeProperties = new asc_CShapeProperty();
ShapeProperties.type = c_obj.getPresetGeom();
ShapeProperties.fill = c_obj.getFill();
......@@ -759,40 +757,56 @@ DrawingObjectsController.prototype =
shape_props = c_obj.Get_Props(shape_props);
shape_props.ShapeProperties = CompareShapeProperties(ShapeProperties, shape_props.ShapeProperties);
shape_props.verticalTextAlign = undefined;
*/
}
}
if (c_obj.isImage())
{
if (!isRealObject(image_props))
{
image_props = new asc_CImgProperty;
image_props = new asc_CImgProperty();
image_props.Width = c_obj.extX;
image_props.Height = c_obj.extY;
image_props.ImageUrl = c_obj.getImageUrl();
}
else
{
/* TODO
image_props = c_obj.Get_Props(image_props);
if (image_props.ImageUrl != null && c_obj.getImageUrl() !== image_props.ImageUrl)
image_props.ImageUrl = null;
*/
}
}
if (c_obj.isChart())
{
if (!isRealObject(chart_props))
{
chart_props = new asc_CImgProperty;
chart_props = new asc_CImgProperty();
chart_props.Width = c_obj.extX;
chart_props.Height = c_obj.extY;
chart_props.ChartProperties = c_obj.chart;
}
}
if (c_obj.isGroup())
{
var shape_props2 = c_obj.getShapeProps();
var image_props2 = c_obj.getImageProps2();
var chart_props2 = c_obj.getChartProps();
if(isRealObject(shape_props2))
{
if (!isRealObject(shape_props))
{
shape_props = {};
shape_props = s_arr[i].Get_Props(null);
shape_props.ShapeProperties = shape_props2.ShapeProperties;
}
else
{
shape_props = s_arr[i].Get_Props(shape_props);
shape_props.ShapeProperties = CompareShapeProperties(shape_props2.ShapeProperties, shape_props.ShapeProperties);
}
}
/*if (c_obj.isGroup())
if (c_obj.isGroup())
{
var shape_props2 = c_obj.getShapeProps();
var image_props2 = c_obj.getImageProps2();
......@@ -857,13 +871,11 @@ DrawingObjectsController.prototype =
}
}
}*/
}
}
break;
}
}
}
var ret = [];
if (isRealObject(shape_props))
{
......@@ -874,8 +886,8 @@ DrawingObjectsController.prototype =
{
this.drawingObjects.drawingDocument.DrawImageTextureFillShape(pr.fill.fill.RasterImageId);
}
shape_props.ShapeProperties.fill = CreateAscFillEx(c_obj.getFill());
shape_props.ShapeProperties.stroke = CreateAscStrokeEx(c_obj.getStroke());
shape_props.ShapeProperties.fill = CreateAscFillEx(shape_props.ShapeProperties.fill);
shape_props.ShapeProperties.stroke = CreateAscStrokeEx(shape_props.ShapeProperties.stroke);
}
ret.push(shape_props);
......@@ -901,6 +913,7 @@ DrawingObjectsController.prototype =
setGraphicObjectProps: function(props)
{
History.Create_NewPoint();
var properties;
if ( (props instanceof asc_CImgProperty) && props.ShapeProperties)
properties = props.ShapeProperties;
......@@ -981,19 +994,18 @@ DrawingObjectsController.prototype =
{
ArrGlyph[i].setTextVerticalAlign(props.verticalTextAlign);
}
if(ArrGlyph[i].isChart() && isRealObject(props.ChartProperties))
{
ArrGlyph[i].chart = props.ChartProperties;
ArrGlyph[i].recalculate();
}
}
}
else if (this.curState.id === STATES_ID_GROUP || this.curState.id === STATES_ID_TEXT_ADD_IN_GROUP)
{
if (false === this.document.Document_Is_SelectionLocked(changestype_Drawing_Props, {Type : changestype_2_Element_and_Type , Element : this.curState.group.parent.Parent, CheckType : changestype_Paragraph_Content} ))
//if (false === this.document.Document_Is_SelectionLocked(changestype_Drawing_Props, {Type : changestype_2_Element_and_Type , Element : this.curState.group.parent.Parent, CheckType : changestype_Paragraph_Content} ))
{
if ( undefined != props.PositionH )
this.curState.group.parent.Set_PositionH( props.PositionH.RelativeFrom, props.PositionH.UseAlign, ( true === props.PositionH.UseAlign ? props.PositionH.Align : props.PositionH.Value ) );
if ( undefined != props.PositionV )
this.curState.group.parent.Set_PositionV( props.PositionV.RelativeFrom, props.PositionV.UseAlign, ( true === props.PositionV.UseAlign ? props.PositionV.Align : props.PositionV.Value ) );
ArrGlyph = this.curState.group.selectionInfo.selectionArray;
var b_change_diagram = false;
for (i = 0; i< ArrGlyph.length; ++i)
......@@ -1020,18 +1032,18 @@ DrawingObjectsController.prototype =
if (typeof props.verticalTextAlign === "number" && !isNaN(props.verticalTextAlign) && typeof ArrGlyph[i].setTextVerticalAlign === "function")
{
ArrGlyph[i].setTextVerticalAlign(props.verticalTextAlign);
ArrGlyph[i].setCellAllVertAlign(props.verticalTextAlign);
}
}
if (b_change_diagram)
{
this.curState.group.updateSizes();
/*this.curState.group.updateSizes();
this.curState.group.recalculate();
var bounds = this.curState.group.parent.getBounds();
if (!this.curState.group.parent.Is_Inline())
this.curState.group.parent.OnEnd_ChangeFlow(this.curState.group.absOffsetX, this.curState.group.absOffsetY, this.curState.group.pageIndex, bounds.r - bounds.l, bounds.b - bounds.t, null, true, true);
else
this.curState.group.parent.OnEnd_ResizeInline(bounds.r - bounds.l, bounds.b - bounds.t);
this.curState.group.parent.OnEnd_ResizeInline(bounds.r - bounds.l, bounds.b - bounds.t); */
}
}
}
......@@ -1042,13 +1054,11 @@ DrawingObjectsController.prototype =
applyColorScheme: function()
{
var api = window["Asc"]["editor"];
var themeColors = api.GuiControlColorsMap;
var aObjects = this.drawingObjects.getDrawingObjects();
for (var i = 0; i < aObjects.length; i++) {
if ( aObjects[i].graphicObject.isChart() )
aObjects[i].graphicObject.recalculate();
for (var i = 0; i < aObjects.length; i++)
{
if(typeof aObjects[i].graphicObject.recalculateColors === "function")
aObjects[i].graphicObject.recalculateColors();
}
}
};
......@@ -1184,7 +1194,7 @@ function CorrectUniColorEx(asc_color, unicolor) {
{
if (ret.color == null || ret.color.type != COLOR_TYPE_PRST)
{
ret.color = new CPrstColor();
ret.setColor(new CPrstColor());
}
ret.color.id = asc_color.asc_getValue();
break;
......@@ -1193,7 +1203,7 @@ function CorrectUniColorEx(asc_color, unicolor) {
{
if (ret.color == null || ret.color.type != COLOR_TYPE_SCHEME)
{
ret.color = new CSchemeColor();
ret.setColor(new CSchemeColor());
}
// тут выставляется ТОЛЬКО из меню. поэтому:
......@@ -1202,7 +1212,7 @@ function CorrectUniColorEx(asc_color, unicolor) {
var _pos = _index - _id * 6;
var array_colors_types = [6, 15, 7, 16, 0, 1, 2, 3, 4, 5];
ret.color.id = array_colors_types[_id];
ret.color.setColorId(array_colors_types[_id]);
if (ret.Mods.Mods.length != 0)
ret.Mods.Mods.splice(0, ret.Mods.Mods.length);
......@@ -1213,9 +1223,10 @@ function CorrectUniColorEx(asc_color, unicolor) {
var _ind = 0;
for (var k in _mods)
{
ret.Mods.Mods[_ind] = new CColorMod();
ret.Mods.Mods[_ind].name = k;
ret.Mods.Mods[_ind].val = _mods[k];
var mod = new CColorMod();
mod.setName(k);
mod.setVal(_mods[k]);
ret.addMod(mod);
_ind++;
}
}
......@@ -1226,12 +1237,9 @@ function CorrectUniColorEx(asc_color, unicolor) {
{
if (ret.color == null || ret.color.type != COLOR_TYPE_SRGB)
{
ret.color = new CRGBColor();
ret.setColor(new CRGBColor());
}
ret.color.RGBA.R = asc_color.asc_getR();
ret.color.RGBA.G = asc_color.asc_getG();
ret.color.RGBA.B = asc_color.asc_getB();
ret.color.RGBA.A = asc_color.asc_getA();
ret.color.setColor(asc_color.asc_getR()*16*16 + asc_color.asc_getG()*16 + asc_color.asc_getB());
}
}
return ret;
......@@ -1381,14 +1389,14 @@ function CorrectUniFillEx(asc_fill, unifill) {
{
case c_oAscFill.FILL_TYPE_NOFILL:
{
ret.fill = new CNoFill();
ret.setFill( new CNoFill());
break;
}
case c_oAscFill.FILL_TYPE_BLIP:
{
if (ret.fill == null || ret.fill.type != FILL_TYPE_BLIP)
{
ret.fill = new CBlipFill();
ret.setFill(new CBlipFill());
}
var _url = _fill.asc_getUrl();
......@@ -1399,10 +1407,10 @@ function CorrectUniFillEx(asc_fill, unifill) {
}
if (_url != null && _url !== undefined && _url != "")
ret.fill.RasterImageId = _url;
ret.fill.setRasterImageId(_url);
if (ret.fill.RasterImageId == null)
ret.fill.RasterImageId = "";
ret.fill.setRasterImageId("");
var tile = _fill.asc_getType();
if (tile == c_oAscFillBlipType.STRETCH)
......@@ -1416,16 +1424,16 @@ function CorrectUniFillEx(asc_fill, unifill) {
{
if (ret.fill == null || ret.fill.type != FILL_TYPE_SOLID)
{
ret.fill = new CSolidFill();
ret.setFill(new CSolidFill());
}
ret.fill.color = CorrectUniColorEx(_fill.asc_getColor(), ret.fill.color);
ret.fill.setColor(CorrectUniColorEx(_fill.asc_getColor(), ret.fill.color));
}
}
}
var _alpha = asc_fill.asc_getTransparent();
if (null != _alpha)
ret.transparent = _alpha;
ret.setTransparent(_alpha);
return ret;
}
......@@ -1608,22 +1616,21 @@ function CorrectUniStrokeEx(asc_stroke, unistroke) {
var _w = asc_stroke.asc_getWidth();
if (_w != null && _w !== undefined)
ret.w = _w * 36000.0;
ret.setW(_w * 36000.0);
var _color = asc_stroke.asc_getColor();
if (_type == c_oAscStrokeType.STROKE_NONE)
{
ret.Fill = new CUniFill();
ret.Fill.fill = new CNoFill();
ret.setFill(new CUniFill());
ret.Fill.setFill(new CNoFill());
}
else if (_type != null)
{
if (null != _color && undefined !== _color)
{
ret.Fill = new CUniFill();
ret.Fill.type = FILL_TYPE_SOLID;
ret.Fill.fill = new CSolidFill();
ret.Fill.fill.color = CorrectUniColorEx(_color, ret.Fill.fill.color);
ret.setFill(new CUniFill());
ret.Fill.setFill(new CSolidFill());
ret.Fill.fill.setColor(CorrectUniColorEx(_color, ret.Fill.fill.color));
}
}
......
......@@ -65,6 +65,60 @@ CChartAsGroup.prototype =
},
getBoundsInGroup: function()
{
return {minX: this.x, minY: this.y, maxX: this.x + this.extX, maxY: this.y + this.extY};
var r = this.rot;
if((r >= 0 && r < Math.PI*0.25)
|| (r > 3*Math.PI*0.25 && r < 5*Math.PI*0.25)
|| (r > 7*Math.PI*0.25 && r < 2*Math.PI))
{
}
else
{
var hc = this.extX*0.5;
var vc = this.extY*0.5;
var xc = this.x + hc;
var yc = this.y + vc;
return {minX: xc - vc, minY: yc - hc, maxX: xc + vc, maxY: yc + hc};
}
},
hitInTextRect: function()
{
return false;
},
setGroup: function(group)
{
var oldId = isRealObject(this.group) ? this.group.Get_Id() : null;
var newId = isRealObject(group) ? group.Get_Id() : null;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetGroup, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldId, newId)));
this.group = group;
},
hitInInnerArea: function(x, y)
{
var invert_transform = this.getInvertTransform();
var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y);
if(isRealObject(this.spPr.geometry))
return this.spPr.geometry.hitInInnerArea(this.drawingObjects.getCanvasContext(), x_t, y_t);
return x_t > 0 && x_t < this.extX && y_t > 0 && y_t < this.extY;
},
hitInPath: function(x, y)
{
var invert_transform = this.getInvertTransform();
var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y);
if(isRealObject(this.spPr.geometry))
return this.spPr.geometry.hitInPath(this.drawingObjects.getCanvasContext(), x_t, y_t);
return false;
},
recalculateColors: function()
{
......@@ -91,6 +145,22 @@ CChartAsGroup.prototype =
return false;
},
Get_Props: function(OtherProps)
{
var Props = new Object();
Props.Width = this.extX;
Props.Height = this.extY;
if(!isRealObject(OtherProps))
return Props;
OtherProps.Width = OtherProps.Width === Props.Width ? Props.Width : undefined;
OtherProps.Height = OtherProps.Height === Props.Height ? Props.Height : undefined;
return OtherProps;
},
syncAscChart: function() {
if ( this.chartTitle && this.chartTitle.txBody && this.chartTitle.txBody.content ) {
......@@ -1976,6 +2046,11 @@ CChartAsGroup.prototype =
return tx > 0 && tx < this.extX && ty > 0 && ty < this.extY;
},
canGroup: function()
{
return true;
},
canRotate: function()
{
return false;
......
......@@ -2353,7 +2353,7 @@ function CompareUniFill(unifill_1, unifill_2)
function CompareShapeProperties(shapeProp1, shapeProp2)
{
var _result_shape_prop = {};
var _result_shape_prop = new asc_CShapeProperty();
if(shapeProp1.type === shapeProp2.type)
{
_result_shape_prop.type = shapeProp1.type;
......@@ -2382,7 +2382,7 @@ function CompareShapeProperties(shapeProp1, shapeProp2)
function CompareImageProperties(imgProps1, imgProps2)
{
var _result_image_properties = {};
var _result_image_properties = new asc_CImgProperty();
if(imgProps1.Width == null || imgProps2.Width == null)
{
_result_image_properties.Width = null;
......
......@@ -1028,6 +1028,337 @@ CGroupShape.prototype =
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Add_To_Drawing_Objects, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(position, null)), null);
},
changePresetGeometry: function(preset)
{
for(var i =0; i < this.arrGraphicObjects.length; ++i)
{
if(typeof this.arrGraphicObjects[i].changePresetGeometry === "function")
this.arrGraphicObjects[i].changePresetGeometry(preset);
}
},
Get_Props: function(OtherProps)
{
var Props = new Object();
Props.Width = this.extX;
Props.Height = this.extY;
if(!isRealObject(OtherProps))
return Props;
OtherProps.Width = OtherProps.Width === Props.Width ? Props.Width : undefined;
OtherProps.Height = OtherProps.Height === Props.Height ? Props.Height : undefined;
return OtherProps;
},
getFill: function()
{
var _ret = null;
var _shapes = this.arrGraphicObjects;
var _shape_index;
for(_shape_index = 0; _shape_index < _shapes.length; ++_shape_index)
{
if(_shapes[_shape_index].isShape())
{
_ret = _shapes[_shape_index].getFill();
if(_ret == null)
{
return null;
}
break;
}
}
if(_shape_index < _shapes.length)
{
++_shape_index;
var _cur_fill;
for(;_shape_index < _shapes.length; ++_shape_index)
{
if(_shapes[_shape_index].isShape())
{
_cur_fill = _shapes[_shape_index].getFill();
_ret = CompareUniFill(_ret, _cur_fill);
}
}
}
return _ret;
},
getStroke: function()
{
var _ret = null;
var _shapes = this.arrGraphicObjects;
var _shape_index;
for(_shape_index = 0; _shape_index < _shapes.length; ++_shape_index)
{
if(_shapes[_shape_index].isShape())
{
_ret = _shapes[_shape_index].getStroke();
if(_ret == null)
{
return null;
}
break;
}
}
if(_shape_index < _shapes.length)
{
++_shape_index;
var _cur_line;
for(;_shape_index < _shapes.length; ++_shape_index)
{
if(_shapes[_shape_index].isShape())
{
_cur_line = _shapes[_shape_index].getStroke();
if(_cur_line == null)
{
return null;
}
else
{
_ret = _ret.compare(_cur_line);
}
}
}
}
return _ret;
},
canChangeArrows: function()
{
var _ret = false;
var _shapes = this.spTree;
var _shape_index;
for(_shape_index = 0; _shape_index < _shapes.length; ++_shape_index)
{
if(_shapes[_shape_index].canChangeArrows)
{
_ret = _shapes[_shape_index].canChangeArrows();
if(_ret == false)
{
return false;
}
break;
}
}
if(_shape_index < _shapes.length)
{
++_shape_index;
var _cur_line;
for(;_shape_index < _shapes.length; ++_shape_index)
{
if(_shapes[_shape_index].canChangeArrows)
{
if(_shapes[_shape_index].canChangeArrows() == false)
{
return false;
}
}
}
}
return _ret;
},
haveShapes: function()
{
for(var i = 0; i < this.arrGraphicObjects.length; ++i)
{
if(this.arrGraphicObjects[i].isShape())
return true;
}
return false;
},
haveImages: function()
{
for(var i = 0; i < this.arrGraphicObjects.length; ++i)
{
if(this.arrGraphicObjects[i].isImage())
return true;
}
return false;
},
haveChart: function()
{
for(var i = 0; i < this.arrGraphicObjects.length; ++i)
{
if(this.arrGraphicObjects[i].isChart())
return true;
}
return false;
},
getImageUrl: function()
{
var ret = null;
for(var i = 0; i < this.arrGraphicObjects.length; ++i)
{
if(this.arrGraphicObjects[i].isImage())
{
if(ret === null)
{
ret = this.arrGraphicObjects[i].getImageUrl();
}
else
{
if(ret !== this.arrGraphicObjects[i].getImageUrl())
return undefined;
}
}
}
return ret;
},
getPresetGeom: function()
{
var _ret = null;
var _shapes = this.arrGraphicObjects;
var _shape_index;
for(_shape_index = 0; _shape_index < _shapes.length; ++_shape_index)
{
if(_shapes[_shape_index].isShape())
{
_ret = _shapes[_shape_index].getPresetGeom();
if(_ret == null)
{
return null;
}
break;
}
}
if(_shape_index < _shapes.length)
{
++_shape_index;
var _cur_preset;
for(;_shape_index < _shapes.length; ++_shape_index)
{
if(_shapes[_shape_index].isShape())
{
_cur_preset = _shapes[_shape_index].getPresetGeom();
if(_cur_preset == null || _cur_preset != _ret)
{
return null;
}
}
}
}
return _ret;
},
getImageProps: function()
{
var _objects = this.arrGraphicObjects;
var _cur_object;
var _object_index;
var _object_count = _objects.length;
var _cur_image_props;
var _result_image_props = null;
for(_object_index = 0; _object_index < _object_count; ++_object_index)
{
_cur_object = _objects[_object_index];
if(_cur_object.isImage())
{
_cur_image_props = _cur_object.getImageProps();
if(_cur_image_props !== null)
{
if(_result_image_props === null)
{
_result_image_props = _cur_image_props;
}
else
{
_result_image_props = CompareImageProperties(_result_image_props, _cur_image_props);
}
}
}
}
return _result_image_props;
},
changeFill: function(fill)
{
for(var i = 0; i < this.arrGraphicObjects.length; ++i)
{
if(typeof this.arrGraphicObjects[i].changeFill ==="function")
this.arrGraphicObjects[i].changeFill(fill);
}
},
changeLine: function(line)
{
for(var i = 0; i < this.arrGraphicObjects.length; ++i)
{
if(typeof this.arrGraphicObjects[i].changeLine ==="function")
this.arrGraphicObjects[i].changeLine(line);
}
},
getShapeProps: function()
{
if(this.haveShapes())
{
var shape_props = new asc_CShapeProperty();
shape_props.type = this.getPresetGeom();
shape_props.fill = this.getFill();
shape_props.stroke = this.getStroke();
shape_props.canChangeArrows = this.canChangeArrows();
return {ShapeProperties : shape_props}
}
return null;
},
getImageProps2: function()
{
if(this.haveImages())
{
var img_pr = new asc_CImgProperty();
img_pr.ImageUrl = this.getImageUrl();
}
return img_pr;
return null;
},
getChartProps: function()
{
var ret = null;
for(var i = 0; i < this.arrGraphicObjects.length; ++i)
{
if(this.arrGraphicObjects[i].isChart())
{
if(!isRealObject(ret))
{
ret = new asc_CImgProperty();
ret.ChartProperties = this.arrGraphicObjects[i].chart;
}
else
{
ret.severalCharts = true;
if(ret.severalChartTypes !== true)
{
if(!(ret.ChartProperties.type === this.arrGraphicObjects[i].chart.type && ret.ChartProperties.subType === this.arrGraphicObjects[i].chart.subType) )
ret.severalChartTypes = true;
}
if(ret.severalChartStyles !== true)
{
if(ret.ChartProperties.styleId !== this.arrGraphicObjects[i].chart.styleId )
ret.severalChartStyles = true;
}
}
}
}
return ret;
},
Undo: function(type, data)
{
switch(type)
......
......@@ -989,7 +989,19 @@ CImage.prototype =
Props.Width = this.extX;
Props.Height = this.extY;
if(!isRealObject(OtherProps))
return Props;
OtherProps.Width = OtherProps.Width === Props.Width ? Props.Width : undefined;
OtherProps.Height = OtherProps.Height === Props.Height ? Props.Height : undefined;
return OtherProps;
},
getImageProps: function()
{
return {ImageUrl: this.blipFill.RasterImageId, Width: this.extX, Height: this.extY};
},
......
......@@ -2077,240 +2077,36 @@ CShape.prototype =
changeFill : function(ascFill)
{
//var historyObj = {Type: historyitem_ChangeFill};
if(this.spPr.Fill == null)
{
//historyObj.old_Fill = null;
}
else
{
//historyObj.old_Fill = this.spPr.Fill.createDuplicate();
}
if(this.spPr.Fill == null )
{
this.spPr.Fill = new CUniFill();
}
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateBrushUndo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(null, null)), null);
this.setUniFill(CorrectUniFillEx(ascFill, this.spPr.Fill));
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateBrushRedo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(null, null)), null);
//this.spPr.Fill = CorrectUniFillEx(ascFill, this.spPr.Fill);
this.spPr.Fill = CorrectUniFillEx(ascFill, this.spPr.Fill);
if(this.spPr.Fill == null)
{
//historyObj.new_Fill = null;
}
else
{
//historyObj.new_Fill = this.spPr.Fill.createDuplicate();
}
/* if(isRealObject(this.spPr.Fill) && isRealObject(this.spPr.Fill.fill) && this.spPr.Fill.fill.type === FILL_TYPE_BLIP)
{
editor.WordControl.m_oLogicDocument.DrawingObjects.urlMap.push(this.spPr.Fill.fill.RasterImageId);
} */
//History.Add(this, historyObj);
this.calculateFill();
this.recalculateBrush();
},
changeLine : function(line)
{
//var historyObj = {Type: historyitem_ChangeLine};
if(this.spPr.ln != null)
{
//historyObj.old_Line = this.spPr.ln.createDuplicate();
}
else
{
//historyObj.old_Line = null;
}
//this.spPr.ln.merge(line);
this.spPr.ln = CorrectUniStrokeEx(line, this.spPr.ln);
//historyObj.new_Line = this.spPr.ln.createDuplicate();
//History.Add(this, historyObj);
this.calculateLine();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateBrushUndo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(null, null)), null);
this.setUniLine(CorrectUniStrokeEx(line, this.spPr.ln));
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateBrushRedo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(null, null)), null);
this.recalculatePen();
},
changePresetGeometry: function(sPreset)
{
var _final_preset;
var _old_line;
var _new_line;
if(this.spPr.ln == null)
{
_old_line = null;
}
else
{
_old_line = this.spPr.ln.createDuplicate();
}
var _arrow_flag = false;
switch(sPreset)
{
case "lineWithArrow":
{
_final_preset = "line";
_arrow_flag = true;
if(_old_line == null)
{
_new_line = new CLn();
}
else
{
_new_line = this.spPr.ln.createDuplicate();
}
_new_line.tailEnd = new EndArrow();
_new_line.tailEnd.type = LineEndType.Arrow;
_new_line.tailEnd.len = LineEndSize.Mid;
_new_line.tailEnd.w = LineEndSize.Mid;
break;
}
case "lineWithTwoArrows":
{
_final_preset = "line";
_arrow_flag = true;
if(_old_line == null)
{
_new_line = new CLn();
}
else
{
_new_line = this.spPr.ln.createDuplicate();
}
_new_line.tailEnd = new EndArrow();
_new_line.tailEnd.type = LineEndType.Arrow;
_new_line.tailEnd.len = LineEndSize.Mid;
_new_line.tailEnd.w = LineEndSize.Mid;
_new_line.headEnd = new EndArrow();
_new_line.headEnd.type = LineEndType.Arrow;
_new_line.headEnd.len = LineEndSize.Mid;
_new_line.headEnd.w = LineEndSize.Mid;
break;
}
case "bentConnector5WithArrow":
{
_final_preset = "bentConnector5";
_arrow_flag = true;
if(_old_line == null)
{
_new_line = new CLn();
}
else
{
_new_line = this.spPr.ln.createDuplicate();
}
_new_line.tailEnd = new EndArrow();
_new_line.tailEnd.type = LineEndType.Arrow;
_new_line.tailEnd.len = LineEndSize.Mid;
_new_line.tailEnd.w = LineEndSize.Mid;
break;
}
case "bentConnector5WithTwoArrows":
{
_final_preset = "bentConnector5";
_arrow_flag = true;
if(_old_line == null)
{
_new_line = new CLn();
}
else
{
_new_line = this.spPr.ln.createDuplicate();
}
_new_line.tailEnd = new EndArrow();
_new_line.tailEnd.type = LineEndType.Arrow;
_new_line.tailEnd.len = LineEndSize.Mid;
_new_line.tailEnd.w = LineEndSize.Mid;
_new_line.headEnd = new EndArrow();
_new_line.headEnd.type = LineEndType.Arrow;
_new_line.headEnd.len = LineEndSize.Mid;
_new_line.headEnd.w = LineEndSize.Mid;
break;
}
case "curvedConnector3WithArrow":
{
_final_preset = "curvedConnector3";
_arrow_flag = true;
if(_old_line == null)
{
_new_line = new CLn();
}
else
{
_new_line = this.spPr.ln.createDuplicate();
}
_new_line.tailEnd = new EndArrow();
_new_line.tailEnd.type = LineEndType.Arrow;
_new_line.tailEnd.len = LineEndSize.Mid;
_new_line.tailEnd.w = LineEndSize.Mid;
break;
}
case "curvedConnector3WithTwoArrows":
{
_final_preset = "curvedConnector3";
_arrow_flag = true;
if(_old_line == null)
{
_new_line = new CLn();
}
else
{
_new_line = this.spPr.ln.createDuplicate();
}
_new_line.tailEnd = new EndArrow();
_new_line.tailEnd.type = LineEndType.Arrow;
_new_line.tailEnd.len = LineEndSize.Mid;
_new_line.tailEnd.w = LineEndSize.Mid;
_new_line.headEnd = new EndArrow();
_new_line.headEnd.type = LineEndType.Arrow;
_new_line.headEnd.len = LineEndSize.Mid;
_new_line.headEnd.w = LineEndSize.Mid;
break;
}
default :
{
_final_preset = sPreset;
_arrow_flag = true;
if(_old_line == null)
{
_new_line = new CLn();
}
else
{
_new_line = this.spPr.ln.createDuplicate();
}
_new_line.tailEnd = null;
_new_line.headEnd = null;
break;
}
}
//var historyData = {Type: historyitem_ChangePresetGeom};
//historyData.arrowFlag = _arrow_flag;
if(_arrow_flag === true)
{
//historyData.oldLine = _old_line;
//historyData.newLine = _new_line;
this.spPr.ln = _new_line;
this.calculateLine();
}
//historyData.old_geometryPreset = isRealObject(this.spPr.geometry) ? this.spPr.geometry.preset : null;
//historyData.new_geometryPreset = _final_preset;
//History.Add(this, historyData);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(null, null)), null);
this.setPresetGeometry(sPreset);
this.spPr.geometry.Recalculate(this.extX, this.extY);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(null, null)), null);
this.spPr.geometry = CreateGeometry(_final_preset);
this.spPr.geometry.Init(100, 100);
this.calculateAfterResize();
},
canChangeArrows : function()
......@@ -2634,7 +2430,14 @@ CShape.prototype =
Props.Width = this.extX;
Props.Height = this.extY;
if(!isRealObject(OtherProps))
return Props;
OtherProps.Width = OtherProps.Width === Props.Width ? Props.Width : undefined;
OtherProps.Height = OtherProps.Height === Props.Height ? Props.Height : undefined;
return OtherProps;
},
......@@ -2736,7 +2539,9 @@ CShape.prototype =
case historyitem_AutoShapes_RecalculateBrushUndo:
{
this.recalculateBrush();
this.recalculatePen();
break;
}
}
......@@ -2749,6 +2554,7 @@ CShape.prototype =
case historyitem_AutoShapes_RecalculateBrushRedo:
{
this.recalculateBrush();
this.recalculatePen();
break;
}
case historyitem_AutoShapes_RecalculateAfterParagraphAddRedo:
......
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