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

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48810 954022d7-b5bf-4e40-9824-e11837661b57
parent 2997c28b
......@@ -1467,10 +1467,38 @@ prot["asc_putShapeProperties"] = prot.asc_putShapeProperties;
// CShapeProperty
//-----------------------------------------------------------------------------------
function asc_CPaddings( obj )
{
if ( obj )
{
this.Left = (undefined == obj.Left) ? null : obj.Left;
this.Top = (undefined == obj.Top) ? null : obj.Top;
this.Bottom = (undefined == obj.Bottom) ? null : obj.Bottom;
this.Right = (undefined == obj.Right) ? null : obj.Right;
}
else
{
this.Left = null;
this.Top = null;
this.Bottom = null;
this.Right = null;
}
}
asc_CPaddings.prototype.asc_get_Left = function() { return this.Left; }
asc_CPaddings.prototype.asc_put_Left = function(v) { this.Left = v; }
asc_CPaddings.prototype.asc_get_Top = function() { return this.Top; }
asc_CPaddings.prototype.asc_put_Top = function(v) { this.Top = v; }
asc_CPaddings.prototype.asc_get_Bottom = function() { return this.Bottom; }
asc_CPaddings.prototype.asc_put_Bottom = function(v) { this.Bottom = v; }
asc_CPaddings.prototype.asc_get_Right = function() { return this.Right; }
asc_CPaddings.prototype.asc_put_Right = function(v) { this.Right = v; }
function asc_CShapeProperty() {
this.type = null; // custom
this.fill = null;
this.stroke = null;
this.paddings = null;
}
asc_CShapeProperty.prototype = {
......@@ -1480,7 +1508,9 @@ asc_CShapeProperty.prototype = {
asc_getFill: function() { return this.fill; },
asc_putFill: function(v) { this.fill = v; },
asc_getStroke: function() { return this.stroke; },
asc_putStroke: function(v) { this.stroke = v; }
asc_putStroke: function(v) { this.stroke = v; },
asc_getPaddings: function() { return this.paddings; },
asc_putPaddings: function(v) { this.paddings = v; }
}
//{ asc_CShapeProperty export
......
......@@ -808,6 +808,7 @@ DrawingObjectsController.prototype =
shape_props.ShapeProperties.fill = c_obj.getFill();
shape_props.ShapeProperties.stroke = c_obj.getStroke();
shape_props.ShapeProperties.canChangeArrows = c_obj.canChangeArrows();
shape_props.ShapeProperties.paddings = c_obj.getPaddings();
shape_props.verticalTextAlign = isRealObject(c_obj.txBody) ? c_obj.txBody.getBodyPr().anchor : null;
}
else
......@@ -817,7 +818,8 @@ DrawingObjectsController.prototype =
type: c_obj.getPresetGeom(),
fill: c_obj.getFill(),
stroke: c_obj.getStroke(),
canChangeArrows: c_obj.canChangeArrows()
canChangeArrows: c_obj.canChangeArrows(),
paddings: c_obj.getPaddings()
};
shape_props.ShapeProperties = CompareShapeProperties(ShapeProperties, shape_props.ShapeProperties);
shape_props.verticalTextAlign = undefined;
......@@ -845,6 +847,7 @@ DrawingObjectsController.prototype =
shape_props.ShapeProperties.fill = c_obj.getFill();
shape_props.ShapeProperties.stroke = c_obj.getStroke();
shape_props.ShapeProperties.canChangeArrows = c_obj.canChangeArrows();
shape_props.ShapeProperties.paddings = c_obj.getPaddings();
shape_props.verticalTextAlign = isRealObject(c_obj.txBody) ? c_obj.txBody.getBodyPr().anchor : null;
}
......@@ -855,6 +858,7 @@ DrawingObjectsController.prototype =
ShapeProperties.fill = c_obj.getFill();
ShapeProperties.stroke = c_obj.getStroke();
ShapeProperties.canChangeArrows = c_obj.canChangeArrows();
ShapeProperties.paddings = c_obj.getPaddings();
shape_props = c_obj.Get_Props(shape_props);
shape_props.ShapeProperties = CompareShapeProperties(ShapeProperties, shape_props.ShapeProperties);
......@@ -890,26 +894,6 @@ DrawingObjectsController.prototype =
}
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())
{
var shape_props2 = c_obj.getShapeProps();
var image_props2 = c_obj.getImageProps2();
var chart_props2 = c_obj.getChartProps();
......@@ -972,9 +956,7 @@ DrawingObjectsController.prototype =
}
}
}
}
}
}
}
}
}
......@@ -1181,6 +1163,10 @@ DrawingObjectsController.prototype =
{
ArrGlyph[i].changeLine(properties.stroke);
}
if(properties.paddings)
{
ArrGlyph[i].setPaddings(properties.paddings);
}
}
if (typeof props.verticalTextAlign === "number" && !isNaN(props.verticalTextAlign) && typeof ArrGlyph[i].setTextVerticalAlign === "function")
......@@ -1217,6 +1203,10 @@ DrawingObjectsController.prototype =
{
ArrGlyph[i].changeLine(properties.stroke);
}
if(properties.paddings)
{
ArrGlyph[i].setPaddings(properties.paddings);
}
}
else if (isRealObject(props) && typeof props.ImageUrl === "string" && ArrGlyph[i].isImage())
{
......
......@@ -2382,6 +2382,14 @@ function CompareShapeProperties(shapeProp1, shapeProp2)
_result_shape_prop.canChangeArrows = true;
_result_shape_prop.fill = CompareUniFill(shapeProp1.fill, shapeProp2.fill);
if(isRealObject(shapeProp1.paddings) && isRealObject(shapeProp2.paddings))
{
_result_shape_prop.paddings = new asc_CPaddings();
_result_shape_prop.paddings.Left = isRealNumber(shapeProp1.paddings.Left) ? (shapeProp1.paddings.Left === shapeProp2.paddings.Left ? shapeProp1.paddings.Left : undefined) : undefined;
_result_shape_prop.paddings.Top = isRealNumber(shapeProp1.paddings.Top) ? (shapeProp1.paddings.Top === shapeProp2.paddings.Top ? shapeProp1.paddings.Top : undefined) : undefined;
_result_shape_prop.paddings.Right = isRealNumber(shapeProp1.paddings.Right) ? (shapeProp1.paddings.Right === shapeProp2.paddings.Right ? shapeProp1.paddings.Right : undefined) : undefined;
_result_shape_prop.paddings.Bottom = isRealNumber(shapeProp1.paddings.Bottom) ? (shapeProp1.paddings.Bottom === shapeProp2.paddings.Bottom ? shapeProp1.paddings.Bottom : undefined) : undefined;
}
return _result_shape_prop;
}
......
......@@ -492,6 +492,17 @@ CGroupShape.prototype =
}
},
setPaddings: function(paddings)
{
for(var i =0; i < this.arrGraphicObjects.length; ++i)
{
if(typeof this.arrGraphicObjects[i].setPaddings === "function")
{
this.arrGraphicObjects[i].setPaddings(paddings);
}
}
},
normalize: function()
{
for(var i = 0; i < this.spTree.length; ++i)
......@@ -1387,11 +1398,42 @@ CGroupShape.prototype =
shape_props.fill = this.getFill();
shape_props.stroke = this.getStroke();
shape_props.canChangeArrows = this.canChangeArrows();
shape_props.paddings = this.getPaddings();
return {ShapeProperties : shape_props}
}
return null;
},
getPaddings: function()
{
var paddings = null;
var cur_paddings;
for(var i = 0; i < this.arrGraphicObjects.length; ++i)
{
cur_paddings = null;
if(typeof this.arrGraphicObjects[i].getPaddings === "function")
{
cur_paddings = this.arrGraphicObjects[i].getPaddings();
}
if(cur_paddings)
{
if(!paddings)
{
paddings = cur_paddings;
}
else
{
paddings.Left = isRealNumber(paddings.Left) ? (paddings.Left === cur_paddings.Left ? paddings.Left : undefined) : undefined;
paddings.Top = isRealNumber(paddings.Top) ? (paddings.Top === cur_paddings.Top ? paddings.Top : undefined) : undefined;
paddings.Right = isRealNumber(paddings.Right) ? (paddings.Right === cur_paddings.Right ? paddings.Right : undefined) : undefined;
paddings.Bottom = isRealNumber(paddings.Bottom) ? (paddings.Bottom === cur_paddings.Bottom ? paddings.Bottom : undefined) : undefined;
}
}
}
return paddings;
},
getImageProps2: function()
{
if(this.haveImages())
......
......@@ -362,6 +362,15 @@ CShape.prototype =
}
},
setPaddings: function (paddings) {
if(isRealObject(this.txBody))
{
this.txBody.setPaddings(paddings);
this.calculateContent();
this.calculateTransformTextMatrix();
}
},
setCellTextWrap: function (isWrapped) {
if(isRealObject(this.txBody))
{
......@@ -2102,6 +2111,21 @@ CShape.prototype =
return this.pen;
},
getPaddings: function()
{
if(isRealObject(this.txBody))
{
var body_pr = this.txBody.getBodyPr();
var paddings = new asc_CPaddings();
paddings.Top = body_pr.tIns;
paddings.Left = body_pr.lIns;
paddings.Right = body_pr.rIns;
paddings.Bottom = body_pr.bIns;
return paddings;
}
return null;
},
getParagraphParaPr: function()
{
if(this.txBody)
......
......@@ -748,6 +748,58 @@ CTextBody.prototype =
}
},
setTopInset: function(ins)
{
if(isRealNumber(ins))
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_TopInset, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(this.bodyPr.tIns, ins)));
this.bodyPr.tIns = ins;
}
},
setRightInset: function(ins)
{
if(isRealNumber(ins))
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RightInset, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(this.bodyPr.rIns, ins)));
this.bodyPr.rIns = ins;
}
},
setLeftInset: function(ins)
{
if(isRealNumber(ins))
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_LeftInset, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(this.bodyPr.lIns, ins)));
this.bodyPr.lIns = ins;
}
},
setBottomInset: function(ins)
{
if(isRealNumber(ins))
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_LeftInset, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(this.bodyPr.bIns, ins)));
this.bodyPr.bIns = ins;
}
},
setPaddings: function(paddings)
{
if(isRealObject(paddings))
{
this.setBottomInset(paddings.Bottom);
this.setTopInset(paddings.Top);
this.setLeftInset(paddings.Left);
this.setRightInset(paddings.Right);
}
},
recalculateCurPos: function()
{
this.content.RecalculateCurPos();
......
This diff is collapsed.
......@@ -140,6 +140,11 @@ var historyitem_AutoShapes_GroupRecalculateRedo = 62;
var historyitem_AutoShapes_AddColorMod = 63;
var historyitem_AutoShapes_RemoveFromSpTree = 64;
var historyitem_AutoShapes_SwapGraphicObjects = 65;
var historyitem_AutoShapes_TopInset = 66;
var historyitem_AutoShapes_RightInset = 67;
var historyitem_AutoShapes_LeftInset = 68;
var historyitem_AutoShapes_BottomInset = 68;
......
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