Commit e98f2f02 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@48570 954022d7-b5bf-4e40-9824-e11837661b57
parent 847afe29
...@@ -236,10 +236,22 @@ function CColorMod() ...@@ -236,10 +236,22 @@ function CColorMod()
{ {
this.name = ""; this.name = "";
this.val = 0; this.val = 0;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
} }
CColorMod.prototype = CColorMod.prototype =
{ {
getObjectType: function()
{
return CLASS_TYPE_COLOR_MOD;
},
Get_Id: function()
{
return this.Id;
},
createDuplicate : function() createDuplicate : function()
{ {
var duplicate = new CColorMod(); var duplicate = new CColorMod();
...@@ -250,12 +262,55 @@ CColorMod.prototype = ...@@ -250,12 +262,55 @@ CColorMod.prototype =
setName: function(name) setName: function(name)
{ {
var oldValue = this.name;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterParagraphAddRedo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, name)));
this.name = name; this.name = name;
}, },
setVal: function(val) setVal: function(val)
{ {
var oldValue = this.val;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterParagraphAddUndo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, val)));
this.val = val; this.val = val;
},
Undo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_RecalculateAfterParagraphAddRedo:
{
this.name = data.oldValue;
break;
}
case historyitem_AutoShapes_RecalculateAfterParagraphAddUndo:
{
this.val = data.oldValue;
break;
}
}
},
Redo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_RecalculateAfterParagraphAddRedo:
{
this.name = data.newValue;
break;
}
case historyitem_AutoShapes_RecalculateAfterParagraphAddUndo:
{
this.val = data.newValue;
break;
}
}
} }
}; };
...@@ -1028,6 +1083,14 @@ function CUniColor() ...@@ -1028,6 +1083,14 @@ function CUniColor()
CUniColor.prototype = CUniColor.prototype =
{ {
addMod: function(mod)
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_AddColorMod, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(mod.Get_Id(), null)));
this.Mods.Mods.push(mod);
},
Get_Id: function() Get_Id: function()
{ {
return this.Id; return this.Id;
...@@ -1064,6 +1127,18 @@ CUniColor.prototype = ...@@ -1064,6 +1127,18 @@ CUniColor.prototype =
this.color = g_oTableId.Get_ById(data.oldValue); this.color = g_oTableId.Get_ById(data.oldValue);
break; break;
} }
case historyitem_AutoShapes_AddColorMod:
{
for(var i = 0; i < this.Mods.Mods.length; ++i)
{
if(this.Mods.Mods[i].Get_Id() === data.oldValue)
{
this.Mods.Mods.splice(i, 1);
break;
}
}
break;
}
} }
}, },
...@@ -1076,6 +1151,11 @@ CUniColor.prototype = ...@@ -1076,6 +1151,11 @@ CUniColor.prototype =
this.color = g_oTableId.Get_ById(data.newValue); this.color = g_oTableId.Get_ById(data.newValue);
break; break;
} }
case historyitem_AutoShapes_AddColorMod:
{
this.Mods.Mods.push(g_oTableId.Get_ById(data.oldValue));
break;
}
} }
}, },
......
...@@ -398,8 +398,8 @@ CShape.prototype = ...@@ -398,8 +398,8 @@ CShape.prototype =
}, },
setCellBackgroundColor: function (color) { setCellBackgroundColor: function (color)
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateBrushUndo, null, null, History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateBrushUndo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null))); new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
var unifill = new CUniFill(); var unifill = new CUniFill();
...@@ -409,7 +409,6 @@ CShape.prototype = ...@@ -409,7 +409,6 @@ CShape.prototype =
this.recalculateBrush(); this.recalculateBrush();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateBrushRedo, null, null, History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateBrushRedo, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null))); new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}, },
...@@ -922,6 +921,8 @@ CShape.prototype = ...@@ -922,6 +921,8 @@ CShape.prototype =
updateSelectionState: function(drawingDocument) updateSelectionState: function(drawingDocument)
{ {
drawingDocument.UpdateTargetTransform(this.transformText);
this.txBody.content.RecalculateCurPos();
this.txBody.updateSelectionState(drawingDocument); this.txBody.updateSelectionState(drawingDocument);
}, },
...@@ -1511,6 +1512,7 @@ CShape.prototype = ...@@ -1511,6 +1512,7 @@ CShape.prototype =
var event = new CMouseEventHandler(); var event = new CMouseEventHandler();
event.fromJQueryEvent(e); event.fromJQueryEvent(e);
this.txBody.selectionSetStart(e, t_x, t_y); this.txBody.selectionSetStart(e, t_x, t_y);
this.txBody.content.RecalculateCurPos();
}, },
selectionSetEnd: function(e, x, y) selectionSetEnd: function(e, x, y)
...@@ -2923,7 +2925,7 @@ function CorrectUniColor(asc_color, unicolor) ...@@ -2923,7 +2925,7 @@ function CorrectUniColor(asc_color, unicolor)
var _pos = _index - _id * 6; var _pos = _index - _id * 6;
var array_colors_types = [6, 15, 7, 16, 0, 1, 2, 3, 4, 5]; 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) if (ret.Mods.Mods.length != 0)
ret.Mods.Mods.splice(0, ret.Mods.Mods.length); ret.Mods.Mods.splice(0, ret.Mods.Mods.length);
...@@ -2934,9 +2936,10 @@ function CorrectUniColor(asc_color, unicolor) ...@@ -2934,9 +2936,10 @@ function CorrectUniColor(asc_color, unicolor)
var _ind = 0; var _ind = 0;
for (var k in _mods) for (var k in _mods)
{ {
ret.Mods.Mods[_ind] = new CColorMod(); var mod = new CColorMod();
ret.Mods.Mods[_ind].name = k; mod.setName(k);
ret.Mods.Mods[_ind].val = _mods[k]; mod.setVal(_mods[k]);
ret.addMod(mod);
_ind++; _ind++;
} }
} }
......
...@@ -224,6 +224,11 @@ CTableId.prototype = ...@@ -224,6 +224,11 @@ CTableId.prototype =
Class = new CChartTitle(); Class = new CChartTitle();
break; break;
} }
case CLASS_TYPE_COLOR_MOD:
{
Class = new CColorMod();
break;
}
} }
Class.Id = Id; Class.Id = Id;
this.m_aPairs[Id] = Class; this.m_aPairs[Id] = Class;
......
//----------------------------------------------------------------------------------- // Global counters //----------------------------------------------------------------------------------- function CIdCounter() { this.m_sUserId = null; this.m_bLoad = true; this.m_nIdCounterLoad = 0; // Счетчик Id для загрузки this.m_nIdCounterEdit = 0; // Счетчик Id для работы this.Get_NewId = function() { if ( true === this.m_bLoad || null === this.m_sUserId ) { this.m_nIdCounterLoad++; return ("" + this.m_nIdCounterLoad); } else { this.m_nIdCounterEdit++; return ("" + this.m_sUserId + "_" + this.m_nIdCounterEdit); } }; this.Set_UserId = function(sUserId) { this.m_sUserId = sUserId; }; this.Set_Load = function(bValue) { this.m_bLoad = bValue; }; } var g_oIdCounter = null; var CLASS_TYPE_TABLE_ID = 0; var CLASS_TYPE_DOCUMENT_CONTENT = 1; var CLASS_TYPE_SHAPE = 2; var CLASS_TYPE_IMAGE = 3; var CLASS_TYPE_GROUP = 4; var CLASS_TYPE_XFRM = 5; var CLASS_TYPE_GEOMETRY = 6; var CLASS_TYPE_PATH = 7; var CLASS_TYPE_PARAGRAPH = 8; var CLASS_TYPE_TEXT_BODY = 9; var CLASS_TYPE_TEXT_PR = 10; var CLASS_TYPE_UNI_FILL = 11; var CLASS_TYPE_PATTERN_FILL = 12; var CLASS_TYPE_GRAD_FILL = 13; var CLASS_TYPE_SOLID_FILL = 14; var CLASS_TYPE_UNI_COLOR = 15; var CLASS_TYPE_SCHEME_COLOR = 16; var CLASS_TYPE_RGB_COLOR = 17; var CLASS_TYPE_PRST_COLOR = 18; var CLASS_TYPE_SYS_COLOR = 19; var CLASS_TYPE_LINE = 20; var CLASS_TYPE_CHART_AS_GROUP = 21; var CLASS_TYPE_CHART_LEGEND = 22; var CLASS_TYPE_CHART_TITLE = 23; var g_oTableId = null; //----------------------------------------------------------------------------------- // Global counters //----------------------------------------------------------------------------------- function CIdCounter() { this.m_sUserId = null; this.m_bLoad = true; this.m_nIdCounterLoad = 0; // Счетчик Id для загрузки this.m_nIdCounterEdit = 0; // Счетчик Id для работы this.Get_NewId = function() { if ( true === this.m_bLoad || null === this.m_sUserId ) { this.m_nIdCounterLoad++; return ("" + this.m_nIdCounterLoad); } else { this.m_nIdCounterEdit++; return ("" + this.m_sUserId + "_" + this.m_nIdCounterEdit); } }; this.Set_UserId = function(sUserId) { this.m_sUserId = sUserId; }; this.Set_Load = function(bValue) { this.m_bLoad = bValue; }; } var g_oIdCounter = null; var CLASS_TYPE_TABLE_ID = 0; var CLASS_TYPE_DOCUMENT_CONTENT = 1; var CLASS_TYPE_SHAPE = 2; var CLASS_TYPE_IMAGE = 3; var CLASS_TYPE_GROUP = 4; var CLASS_TYPE_XFRM = 5; var CLASS_TYPE_GEOMETRY = 6; var CLASS_TYPE_PATH = 7; var CLASS_TYPE_PARAGRAPH = 8; var CLASS_TYPE_TEXT_BODY = 9; var CLASS_TYPE_TEXT_PR = 10; var CLASS_TYPE_UNI_FILL = 11; var CLASS_TYPE_PATTERN_FILL = 12; var CLASS_TYPE_GRAD_FILL = 13; var CLASS_TYPE_SOLID_FILL = 14; var CLASS_TYPE_UNI_COLOR = 15; var CLASS_TYPE_SCHEME_COLOR = 16; var CLASS_TYPE_RGB_COLOR = 17; var CLASS_TYPE_PRST_COLOR = 18; var CLASS_TYPE_SYS_COLOR = 19; var CLASS_TYPE_LINE = 20; var CLASS_TYPE_CHART_AS_GROUP = 21; var CLASS_TYPE_CHART_LEGEND = 22; var CLASS_TYPE_CHART_TITLE = 23; var CLASS_TYPE_COLOR_MOD = 24; var g_oTableId = null;
\ No newline at end of file \ No newline at end of file
......
...@@ -191,11 +191,11 @@ function NullState(drawingObjectsController, drawingObjects) ...@@ -191,11 +191,11 @@ function NullState(drawingObjectsController, drawingObjects)
{ {
this.drawingObjectsController.resetSelection(); this.drawingObjectsController.resetSelection();
cur_grouped_object.select(this.drawingObjectsController); cur_grouped_object.select(this.drawingObjectsController);
grouped_objects[i].select(cur_grouped_object); grouped_objects[j].select(cur_grouped_object);
grouped_objects[i].selectionSetStart(e, x, y); grouped_objects[j].selectionSetStart(e, x, y);
this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, cur_drawing, grouped_objects[i])); this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, cur_drawing, grouped_objects[j]));
if(e.ClickCount < 2) if(e.ClickCount < 2)
grouped_objects[i].updateSelectionState(this.drawingObjects.drawingDocument); grouped_objects[j].updateSelectionState(this.drawingObjects.drawingDocument);
return; return;
} }
} }
...@@ -495,11 +495,11 @@ function NullState(drawingObjectsController, drawingObjects) ...@@ -495,11 +495,11 @@ function NullState(drawingObjectsController, drawingObjects)
var hit_in_text_rect = cur_grouped_object.hitInTextRect(x, y); var hit_in_text_rect = cur_grouped_object.hitInTextRect(x, y);
if(hit_in_inner_area && !hit_in_text_rect || hit_in_path) if(hit_in_inner_area && !hit_in_text_rect || hit_in_path)
{ {
return {objectId: cur_grouped_object.Id, cursorType: "move"}; return {objectId: cur_drawing.Id, cursorType: "move"};
} }
else if(hit_in_text_rect) else if(hit_in_text_rect)
{ {
//TODO return {objectId: cur_drawing.Id, cursorType: "text"};
} }
} }
} }
...@@ -1358,7 +1358,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject) ...@@ -1358,7 +1358,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
this.nullState.onMouseDown(e, x, y); this.nullState.onMouseDown(e, x, y);
if(this.drawingObjectsController.curState.id !== STATES_ID_TEXT_ADD || this.drawingObjectsController.curState.id !== STATES_ID_TEXT_ADD_IN_GROUP) if(this.drawingObjectsController.curState.id !== STATES_ID_TEXT_ADD || this.drawingObjectsController.curState.id !== STATES_ID_TEXT_ADD_IN_GROUP)
{ {
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument); this.drawingObjectsController.updateSelectionState(this.drawingObjects.drawingDocument);
} }
}; };
...@@ -2629,6 +2629,7 @@ function GroupState(drawingObjectsController, drawingObjects, group) ...@@ -2629,6 +2629,7 @@ function GroupState(drawingObjectsController, drawingObjects, group)
this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, this.group, cur_drawing)); this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, this.group, cur_drawing));
if(e.ClickCount < 2) if(e.ClickCount < 2)
cur_drawing.updateSelectionState(this.drawingObjects.drawingDocument); cur_drawing.updateSelectionState(this.drawingObjects.drawingDocument);
return;
} }
} }
} }
...@@ -2665,6 +2666,7 @@ function GroupState(drawingObjectsController, drawingObjects, group) ...@@ -2665,6 +2666,7 @@ function GroupState(drawingObjectsController, drawingObjects, group)
this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, this.group, cur_drawing)); this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, this.group, cur_drawing));
if(e.ClickCount < 2) if(e.ClickCount < 2)
cur_drawing.updateSelectionState(this.drawingObjects.drawingDocument); cur_drawing.updateSelectionState(this.drawingObjects.drawingDocument);
return;
} }
} }
} }
...@@ -2799,7 +2801,7 @@ function GroupState(drawingObjectsController, drawingObjects, group) ...@@ -2799,7 +2801,7 @@ function GroupState(drawingObjectsController, drawingObjects, group)
} }
else if(hit_in_text_rect) else if(hit_in_text_rect)
{ {
//TODO return {objectId: cur_drawing.Id, cursorType: "text"};
} }
} }
else else
...@@ -2819,7 +2821,7 @@ function GroupState(drawingObjectsController, drawingObjects, group) ...@@ -2819,7 +2821,7 @@ function GroupState(drawingObjectsController, drawingObjects, group)
} }
else if(hit_in_text_rect) else if(hit_in_text_rect)
{ {
//TODO return {objectId: this.group.Id, cursorType: "text"};
} }
} }
} }
...@@ -2838,7 +2840,7 @@ function GroupState(drawingObjectsController, drawingObjects, group) ...@@ -2838,7 +2840,7 @@ function GroupState(drawingObjectsController, drawingObjects, group)
} }
else if(hit_in_text_rect) else if(hit_in_text_rect)
{ {
//TODO return {objectId: cur_drawing.Id, cursorType: "text"};
} }
} }
} }
......
...@@ -137,6 +137,8 @@ var historyitem_AutoShapes_VerticalAlign = 59; ...@@ -137,6 +137,8 @@ var historyitem_AutoShapes_VerticalAlign = 59;
var historyitem_AutoShapes_Vert = 60; var historyitem_AutoShapes_Vert = 60;
var historyitem_AutoShapes_GroupRecalculateUndo = 61; var historyitem_AutoShapes_GroupRecalculateUndo = 61;
var historyitem_AutoShapes_GroupRecalculateRedo = 62; var historyitem_AutoShapes_GroupRecalculateRedo = 62;
var historyitem_AutoShapes_AddColorMod = 63;
......
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