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
...@@ -2355,6 +2355,8 @@ DrawingObjectsController.prototype = ...@@ -2355,6 +2355,8 @@ DrawingObjectsController.prototype =
setGraphicObjectLayerCallBack: function(layerType) setGraphicObjectLayerCallBack: function(layerType)
{
if(!(this.curState.group instanceof CGroupShape))
{ {
History.Create_NewPoint(); History.Create_NewPoint();
switch (layerType) switch (layerType)
...@@ -2379,15 +2381,48 @@ DrawingObjectsController.prototype = ...@@ -2379,15 +2381,48 @@ DrawingObjectsController.prototype =
this.bringBackward(); this.bringBackward();
} }
} }
}
else
{
var oThis = this;
var callback = function(layer)
{
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() bringToFront : function()
{ {
var state = this.curState; var state = this.curState;
var sp_tree = this.drawingObjects.getDrawingObjects(); var sp_tree = this.drawingObjects.getDrawingObjects();
switch(state.id) if(!(state.group instanceof CGroupShape))
{
case STATES_ID_NULL:
{ {
var selected = []; var selected = [];
for(var i = 0; i < sp_tree.length; ++i) for(var i = 0; i < sp_tree.length; ++i)
...@@ -2408,12 +2443,10 @@ DrawingObjectsController.prototype = ...@@ -2408,12 +2443,10 @@ DrawingObjectsController.prototype =
{ {
selected[i].addToDrawingObjects(sp_tree.length); selected[i].addToDrawingObjects(sp_tree.length);
} }
break;
} }
case STATES_ID_GROUP: else
{ {
break; state.group.bringToFront();
}
} }
this.drawingObjects.showDrawingObjects(true); this.drawingObjects.showDrawingObjects(true);
...@@ -2423,9 +2456,7 @@ DrawingObjectsController.prototype = ...@@ -2423,9 +2456,7 @@ DrawingObjectsController.prototype =
{ {
var state = this.curState; var state = this.curState;
var sp_tree = this.drawingObjects.getDrawingObjects(); 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)
{ {
...@@ -2436,12 +2467,10 @@ DrawingObjectsController.prototype = ...@@ -2436,12 +2467,10 @@ DrawingObjectsController.prototype =
sp.addToDrawingObjects(i+1); sp.addToDrawingObjects(i+1);
} }
} }
break;
} }
case STATES_ID_GROUP: else
{ {
break; state.group.bringForward();
}
} }
this.drawingObjects.showDrawingObjects(true); this.drawingObjects.showDrawingObjects(true);
}, },
...@@ -2450,9 +2479,8 @@ DrawingObjectsController.prototype = ...@@ -2450,9 +2479,8 @@ DrawingObjectsController.prototype =
{ {
var state = this.curState; var state = this.curState;
var sp_tree = this.drawingObjects.getDrawingObjects(); var sp_tree = this.drawingObjects.getDrawingObjects();
switch(state.id)
{ if(!(state.group instanceof CGroupShape))
case STATES_ID_NULL:
{ {
var j = 0; var j = 0;
for(var i = 0; i < sp_tree.length; ++i) for(var i = 0; i < sp_tree.length; ++i)
...@@ -2465,12 +2493,10 @@ DrawingObjectsController.prototype = ...@@ -2465,12 +2493,10 @@ DrawingObjectsController.prototype =
++j; ++j;
} }
} }
break;
} }
case STATES_ID_GROUP: else
{ {
break; state.group.sendToBack();
}
} }
this.drawingObjects.showDrawingObjects(true); this.drawingObjects.showDrawingObjects(true);
...@@ -2481,9 +2507,7 @@ DrawingObjectsController.prototype = ...@@ -2481,9 +2507,7 @@ DrawingObjectsController.prototype =
{ {
var state = this.curState; var state = this.curState;
var sp_tree = this.drawingObjects.getDrawingObjects(); 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)
{ {
...@@ -2494,12 +2518,10 @@ DrawingObjectsController.prototype = ...@@ -2494,12 +2518,10 @@ DrawingObjectsController.prototype =
sp.addToDrawingObjects(i-1); sp.addToDrawingObjects(i-1);
} }
} }
break;
} }
case STATES_ID_GROUP: else
{ {
break; state.group.bringBackward();
}
} }
this.drawingObjects.showDrawingObjects(true); this.drawingObjects.showDrawingObjects(true);
......
...@@ -36,7 +36,6 @@ function CGroupShape(drawingBase, drawingObjects) ...@@ -36,7 +36,6 @@ function CGroupShape(drawingBase, drawingObjects)
this.brush = null; this.brush = null;
this.pen = null; this.pen = null;
this.selected = false; this.selected = false;
this.Id = g_oIdCounter.Get_NewId(); this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id); g_oTableId.Add(this, this.Id);
...@@ -101,6 +100,8 @@ CGroupShape.prototype = ...@@ -101,6 +100,8 @@ CGroupShape.prototype =
}, },
removeFromSpTree: function(id) removeFromSpTree: function(id)
{ {
for(var i = 0; i < this.spTree.length; ++i) for(var i = 0; i < this.spTree.length; ++i)
...@@ -114,6 +115,149 @@ CGroupShape.prototype = ...@@ -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() isShape: function()
{ {
return false; return false;
...@@ -246,6 +390,13 @@ CGroupShape.prototype = ...@@ -246,6 +390,13 @@ CGroupShape.prototype =
this.recalcInfo.recalculateArrGraphicObjects = true; 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() getMainGroup: function()
{ {
if(!isRealObject(this.group)) if(!isRealObject(this.group))
...@@ -1615,12 +1766,18 @@ CGroupShape.prototype = ...@@ -1615,12 +1766,18 @@ CGroupShape.prototype =
{ {
switch(type) switch(type)
{ {
case historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsUndo:
{
this.recalculateArrGraphicObjects();
break;
}
case historyitem_AutoShapes_SetGroup: case historyitem_AutoShapes_SetGroup:
{ {
this.group = g_oTableId.Get_ById(data.oldValue); this.group = g_oTableId.Get_ById(data.oldValue);
break; break;
} }
case historyitem_AutoShapes_AddToSpTree: case historyitem_AutoShapes_AddToSpTree:
case historyitem_AutoShapes_AddToGroupSpTreeToPos:
{ {
for(var i = this.spTree.length -1; i > -1; --i) for(var i = this.spTree.length -1; i > -1; --i)
{ {
...@@ -1632,6 +1789,7 @@ CGroupShape.prototype = ...@@ -1632,6 +1789,7 @@ CGroupShape.prototype =
} }
break; break;
} }
case historyitem_AutoShapes_SetXfrm: case historyitem_AutoShapes_SetXfrm:
{ {
this.spPr.xfrm = g_oTableId.Get_ById(data.oldValue); this.spPr.xfrm = g_oTableId.Get_ById(data.oldValue);
...@@ -1688,6 +1846,11 @@ CGroupShape.prototype = ...@@ -1688,6 +1846,11 @@ CGroupShape.prototype =
{ {
switch(type) switch(type)
{ {
case historyitem_AutoShapes_GroupRecalculateArrGraphicObjectsRedo:
{
this.recalculateArrGraphicObjects();
break;
}
case historyitem_AutoShapes_SetGroup: case historyitem_AutoShapes_SetGroup:
{ {
this.group = g_oTableId.Get_ById(data.newValue); this.group = g_oTableId.Get_ById(data.newValue);
...@@ -1698,6 +1861,11 @@ CGroupShape.prototype = ...@@ -1698,6 +1861,11 @@ CGroupShape.prototype =
this.spTree.push(g_oTableId.Get_ById(data.oldValue)); this.spTree.push(g_oTableId.Get_ById(data.oldValue));
break; break;
} }
case historyitem_AutoShapes_AddToGroupSpTreeToPos:
{
this.spTree.splice(data.newValue, 0, g_oTableId.Get_ById(data.oldValue));
break;
}
case historyitem_AutoShapes_GroupRecalculateRedo: case historyitem_AutoShapes_GroupRecalculateRedo:
{ {
this.recalculate(); this.recalculate();
...@@ -1775,8 +1943,6 @@ CGroupShape.prototype = ...@@ -1775,8 +1943,6 @@ CGroupShape.prototype =
} }
}, },
getBase64Image: function() getBase64Image: function()
{ {
return ShapeToImageConverter(this, this.pageIndex).ImageUrl; return ShapeToImageConverter(this, this.pageIndex).ImageUrl;
......
...@@ -196,6 +196,9 @@ var historyitem_AutoShapes_SetChartTitleType = 84; ...@@ -196,6 +196,9 @@ var historyitem_AutoShapes_SetChartTitleType = 84;
var historyitem_AutoShapes_OnContentRecalculateUndo = 85; var historyitem_AutoShapes_OnContentRecalculateUndo = 85;
var historyitem_AutoShapes_OnContentRecalculateRedo = 86; var historyitem_AutoShapes_OnContentRecalculateRedo = 86;
var historyitem_AutoShapes_GeometryAddPreset = 87; 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