Commit ed82c0d8 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@52977 954022d7-b5bf-4e40-9824-e11837661b57
parent d438cf22
......@@ -2356,65 +2356,98 @@ DrawingObjectsController.prototype =
setGraphicObjectLayerCallBack: function(layerType)
{
History.Create_NewPoint();
switch (layerType)
if(!(this.curState.group instanceof CGroupShape))
{
case 0:
{
this.bringToFront();
break;
}
case 1:
{
this.sendToBack();
break;
}
case 2:
History.Create_NewPoint();
switch (layerType)
{
this.bringForward();
break;
case 0:
{
this.bringToFront();
break;
}
case 1:
{
this.sendToBack();
break;
}
case 2:
{
this.bringForward();
break;
}
case 3:
{
this.bringBackward();
}
}
case 3:
}
else
{
var oThis = this;
var callback = function(layer)
{
this.bringBackward();
}
History.Create_NewPoint();
switch (layer)
{
case 0:
{
oThis.bringToFront();
break;
}
case 1:
{
oThis.sendToBack();
break;
}
case 2:
{
oThis.bringForward();
break;
}
case 3:
{
oThis.bringBackward();
}
}
};
this.checkSelectedObjectsAndCallback(callback, [layerType]);
}
},
bringToFront : function()
{
var state = this.curState;
var sp_tree = this.drawingObjects.getDrawingObjects();
switch(state.id)
if(!(state.group instanceof CGroupShape))
{
case STATES_ID_NULL:
var selected = [];
for(var i = 0; i < sp_tree.length; ++i)
{
var selected = [];
for(var i = 0; i < sp_tree.length; ++i)
if(sp_tree[i].graphicObject.selected)
{
if(sp_tree[i].graphicObject.selected)
{
selected.push(sp_tree[i].graphicObject);
}
selected.push(sp_tree[i].graphicObject);
}
for(var i = sp_tree.length-1; i > -1 ; --i)
{
if(sp_tree[i].graphicObject.selected)
{
sp_tree[i].graphicObject.deleteDrawingBase();
}
}
for(i = 0; i < selected.length; ++i)
}
for(var i = sp_tree.length-1; i > -1 ; --i)
{
if(sp_tree[i].graphicObject.selected)
{
selected[i].addToDrawingObjects(sp_tree.length);
sp_tree[i].graphicObject.deleteDrawingBase();
}
break;
}
case STATES_ID_GROUP:
for(i = 0; i < selected.length; ++i)
{
break;
selected[i].addToDrawingObjects(sp_tree.length);
}
}
else
{
state.group.bringToFront();
}
this.drawingObjects.showDrawingObjects(true);
},
......@@ -2423,26 +2456,22 @@ DrawingObjectsController.prototype =
{
var state = this.curState;
var sp_tree = this.drawingObjects.getDrawingObjects();
switch(state.id)
if(!(state.group instanceof CGroupShape))
{
case STATES_ID_NULL:
for(var i = sp_tree.length - 1;i > -1; --i)
{
for(var i = sp_tree.length - 1;i > -1; --i)
var sp = sp_tree[i].graphicObject;
if(sp.selected && i < sp_tree.length - 1 && !sp_tree[i+1].graphicObject.selected)
{
var sp = sp_tree[i].graphicObject;
if(sp.selected && i < sp_tree.length - 1 && !sp_tree[i+1].graphicObject.selected)
{
sp.deleteDrawingBase();
sp.addToDrawingObjects(i+1);
}
sp.deleteDrawingBase();
sp.addToDrawingObjects(i+1);
}
break;
}
case STATES_ID_GROUP:
{
break;
}
}
else
{
state.group.bringForward();
}
this.drawingObjects.showDrawingObjects(true);
},
......@@ -2450,28 +2479,25 @@ DrawingObjectsController.prototype =
{
var state = this.curState;
var sp_tree = this.drawingObjects.getDrawingObjects();
switch(state.id)
if(!(state.group instanceof CGroupShape))
{
case STATES_ID_NULL:
var j = 0;
for(var i = 0; i < sp_tree.length; ++i)
{
var j = 0;
for(var i = 0; i < sp_tree.length; ++i)
if(sp_tree[i].graphicObject.selected)
{
if(sp_tree[i].graphicObject.selected)
{
var object = sp_tree[i].graphicObject;
object.deleteDrawingBase();
object.addToDrawingObjects(j);
++j;
}
var object = sp_tree[i].graphicObject;
object.deleteDrawingBase();
object.addToDrawingObjects(j);
++j;
}
break;
}
case STATES_ID_GROUP:
{
break;
}
}
else
{
state.group.sendToBack();
}
this.drawingObjects.showDrawingObjects(true);
},
......@@ -2481,26 +2507,22 @@ DrawingObjectsController.prototype =
{
var state = this.curState;
var sp_tree = this.drawingObjects.getDrawingObjects();
switch(state.id)
if(!(state.group instanceof CGroupShape))
{
case STATES_ID_NULL:
for(var i = 0;i < sp_tree.length; ++i)
{
for(var i = 0;i < sp_tree.length; ++i)
var sp = sp_tree[i].graphicObject;
if(sp.selected && i > 0 && !sp_tree[i-1].graphicObject.selected)
{
var sp = sp_tree[i].graphicObject;
if(sp.selected && i > 0 && !sp_tree[i-1].graphicObject.selected)
{
sp.deleteDrawingBase();
sp.addToDrawingObjects(i-1);
}
sp.deleteDrawingBase();
sp.addToDrawingObjects(i-1);
}
break;
}
case STATES_ID_GROUP:
{
break;
}
}
else
{
state.group.bringBackward();
}
this.drawingObjects.showDrawingObjects(true);
}
......
......@@ -36,7 +36,6 @@ function CGroupShape(drawingBase, drawingObjects)
this.brush = null;
this.pen = null;
this.selected = false;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
......@@ -101,6 +100,8 @@ CGroupShape.prototype =
},
removeFromSpTree: function(id)
{
for(var i = 0; i < this.spTree.length; ++i)
......@@ -114,6 +115,149 @@ CGroupShape.prototype =
}
},
haveSelectedObjects: function()
{
for(var i = 0; i < this.spTree.length; ++i)
{
if(!(this.spTree[i] instanceof CGroupShape))
{
if(this.spTree[i].selected)
return true;
}
else
{
if(this.spTree[i].haveSelectedObjects())
{
return true;
}
}
}
return false;
},
bringToFront : function()
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsUndo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var sp_tree = this.spTree;
var selected = [];
for(var i = 0; i < sp_tree.length; ++i)
{
if(!(sp_tree[i] instanceof CGroupShape))
{
if(sp_tree[i].selected)
{
selected.push(sp_tree[i]);
}
}
else
{
sp_tree[i].bringToFront();
}
}
for(var i = sp_tree.length-1; i > -1 ; --i)
{
if(sp_tree[i].selected)
{
this.removeFromSpTree(sp_tree[i].Get_Id());
}
}
for(i = 0; i < selected.length; ++i)
{
this.addToSpTree(selected[i]);
}
this.recalcInfo.recalculateArrGraphicObjects = true;
this.recalculateArrGraphicObjects();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsRedo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
},
bringForward : function()
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsUndo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var sp_tree = this.spTree;
for(var i = sp_tree.length - 1;i > -1; --i)
{
var sp = sp_tree[i];
if(!(sp instanceof CGroupShape))
{
if( sp.selected && i < sp_tree.length - 1 && !sp_tree[i+1].selected)
{
this.removeFromSpTree(sp.Get_Id());
this.addToSpTreeToPos(sp, i+1);
}
}
else
{
sp.bringForward();
}
}
this.recalculateArrGraphicObjects();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsRedo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
},
sendToBack : function()
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsUndo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var sp_tree = this.spTree;
var j = 0;
for(var i = 0; i < sp_tree.length; ++i)
{
if(!(sp_tree[i] instanceof CGroupShape))
{
if(sp_tree[i].selected)
{
var object = sp_tree[i];
this.removeFromSpTree(object.Get_Id());
this.addToSpTreeToPos(object, j);
++j;
}
}
else
{
sp_tree[i].sendToBack();
}
}
this.recalculateArrGraphicObjects();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsRedo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
},
bringBackward : function()
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsUndo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var sp_tree = this.spTree;
for(var i = 0;i < sp_tree.length; ++i)
{
var sp = sp_tree[i];
if(!(sp instanceof CGroupShape))
{
if(sp.selected && i > 0 && !sp_tree[i-1].selected)
{
this.removeFromSpTree(sp.Get_Id());
this.addToSpTreeToPos(sp, i-1);
}
}
else
{
sp.bringForward();
}
}
this.recalculateArrGraphicObjects();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsRedo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
},
isShape: function()
{
return false;
......@@ -246,6 +390,13 @@ CGroupShape.prototype =
this.recalcInfo.recalculateArrGraphicObjects = true;
},
addToSpTreeToPos: function(grObj, pos)
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_AddToGroupSpTreeToPos, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(grObj.Get_Id(), pos)));
this.spTree.splice(pos, 0, grObj);
},
getMainGroup: function()
{
if(!isRealObject(this.group))
......@@ -1615,12 +1766,18 @@ CGroupShape.prototype =
{
switch(type)
{
case historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsUndo:
{
this.recalculateArrGraphicObjects();
break;
}
case historyitem_AutoShapes_SetGroup:
{
this.group = g_oTableId.Get_ById(data.oldValue);
break;
}
case historyitem_AutoShapes_AddToSpTree:
case historyitem_AutoShapes_AddToGroupSpTreeToPos:
{
for(var i = this.spTree.length -1; i > -1; --i)
{
......@@ -1632,6 +1789,7 @@ CGroupShape.prototype =
}
break;
}
case historyitem_AutoShapes_SetXfrm:
{
this.spPr.xfrm = g_oTableId.Get_ById(data.oldValue);
......@@ -1688,6 +1846,11 @@ CGroupShape.prototype =
{
switch(type)
{
case historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsRedo:
{
this.recalculateArrGraphicObjects();
break;
}
case historyitem_AutoShapes_SetGroup:
{
this.group = g_oTableId.Get_ById(data.newValue);
......@@ -1698,6 +1861,11 @@ CGroupShape.prototype =
this.spTree.push(g_oTableId.Get_ById(data.oldValue));
break;
}
case historyitem_AutoShapes_AddToGroupSpTreeToPos:
{
this.spTree.splice(data.newValue, 0, g_oTableId.Get_ById(data.oldValue));
break;
}
case historyitem_AutoShapes_GroupRecalculateRedo:
{
this.recalculate();
......@@ -1775,8 +1943,6 @@ CGroupShape.prototype =
}
},
getBase64Image: function()
{
return ShapeToImageConverter(this, this.pageIndex).ImageUrl;
......
......@@ -196,6 +196,9 @@ var historyitem_AutoShapes_SetChartTitleType = 84;
var historyitem_AutoShapes_OnContentRecalculateUndo = 85;
var historyitem_AutoShapes_OnContentRecalculateRedo = 86;
var historyitem_AutoShapes_GeometryAddPreset = 87;
var historyitem_AutoShapes_AddToGroupSpTreeToPos = 88;
var historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsUndo = 89;
var historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsRedo = 90;
......
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