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

првака бага 19829 - Не вставляются некоторые автофигуры из раздела Lines

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@50637 954022d7-b5bf-4e40-9824-e11837661b57
parent 931df3d4
......@@ -22,10 +22,8 @@ DrawingObjectsController.prototype =
{
getAllFontNames: function()
{
},
setCellFontName: function (fontName) {
this.checkSelectedObjectsAndCallback(this.setCellFontNameCallBack, [fontName]);
......
......@@ -3122,6 +3122,52 @@ CLn.prototype =
this.w = w;
},
setTailEnd: function(end)
{
var old_value = null;
if(this.tailEnd)
{
var w = new CMemory();
this.tailEnd.Write_ToBinary2(w);
old_value = w.pos + ";" + w.GetBase64Memory();
}
var new_value = null;
if(end)
{
var w = new CMemory();
end.Write_ToBinary2(w);
new_value = w.pos + ";" + w.GetBase64Memory();
}
this.tailEnd = end;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetTailEnd, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(old_value, new_value)));
},
setHeadEnd: function(end)
{
var old_value = null;
if(this.tailEnd)
{
var w = new CMemory();
this.headEnd.Write_ToBinary2(w);
old_value = w.pos + ";" + w.GetBase64Memory();
}
var new_value = null;
if(end)
{
var w = new CMemory();
end.Write_ToBinary2(w);
new_value = w.pos + ";" + w.GetBase64Memory();
}
this.headEnd = end;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetTailEnd, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(old_value, new_value)));
},
getObjectType: function()
{
return CLASS_TYPE_LINE;
......@@ -3146,6 +3192,34 @@ CLn.prototype =
this.w = data.oldValue;
break;
}
case historyitem_AutoShapes_SetTailEnd:
{
if(typeof data.oldValue === "string")
{
this.tailEnd = new EndArrow();
var r = CreateBinaryReader(data.oldValue, 0, data.oldValue.length);
this.tailEnd.Read_FromBinary2(r);
}
else
{
this.tailEnd = null;
}
break;
}
case historyitem_AutoShapes_SetHeadEnd:
{
if(typeof data.oldValue === "string")
{
this.headEnd = new EndArrow();
var r = CreateBinaryReader(data.oldValue, 0, data.oldValue.length);
this.headEnd.Read_FromBinary2(r);
}
else
{
this.headEnd = null;
}
break;
}
}
},
......@@ -3163,6 +3237,34 @@ CLn.prototype =
this.w = data.newValue;
break;
}
case historyitem_AutoShapes_SetTailEnd:
{
if(typeof data.newValue === "string")
{
this.tailEnd = new EndArrow();
var r = CreateBinaryReader(data.newValue, 0, data.newValue.length);
this.tailEnd.Read_FromBinary2(r);
}
else
{
this.tailEnd = null;
}
break;
}
case historyitem_AutoShapes_SetHeadEnd:
{
if(typeof data.newValue === "string")
{
this.headEnd = new EndArrow();
var r = CreateBinaryReader(data.newValue, 0, data.newValue.length);
this.headEnd.Read_FromBinary2(r);
}
else
{
this.headEnd = null;
}
break;
}
}
},
Write_ToBinary2: function(Writer)
......
......@@ -13,22 +13,6 @@ var cToDeg = 1/cToRad;
function Path(extrusionOk, fill, stroke, w, h)
{
if(stroke!=undefined)
this.stroke = stroke;
else
this.stroke = true;
this.extrusionOk = extrusionOk||false;
this.fill = fill||'norm';
this.pathW = w;
this.pathH = h;
if(this.pathW!=undefined)
{
this.divPW = 1/w;
this.divPH = 1/h;
}
this.ArrPathCommandInfo = new Array();
this.ArrPathCommand = new Array();
......@@ -50,6 +34,19 @@ function Path(extrusionOk, fill, stroke, w, h)
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
var stroke2;
if(stroke!=undefined)
stroke2 = stroke;
else
stroke2 = true;
this.setStroke(stroke2);
this.extrusionOk = extrusionOk||false;
this.setFill(fill||'norm');
this.setWH(w, h);
}
Path.prototype = {
......@@ -59,6 +56,11 @@ Path.prototype = {
return CLASS_TYPE_PATH;
},
Get_Id: function()
{
return this.Id;
},
Write_ToBinary2: function(writer)
{
writer.WriteBool(this.stroke);
......@@ -235,6 +237,42 @@ Path.prototype = {
}
},
setStroke: function(stroke)
{
var oldValue = this.stroke;
var newValue = stroke;
this.stroke = stroke;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Set_PathStroke, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
},
setFill: function(fill)
{
var oldValue = this.fill;
var newValue = fill;
this.stroke = fill;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Set_PathFill, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
},
setWH: function(w, h)
{
var oldValue1 = this.pathW;
var oldValue2 = this.pathH;
var newValue1 = w;
var newValue2 = h;
this.pathW = w;
this.pathH = h;
if(this.pathW != undefined)
{
this.divPW = 1/w;
this.divPH = 1/h;
}
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Set_PathWH, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOPairProps(oldValue1, oldValue2, newValue1, newValue2)));
UndoRedoDataGOPairProps
},
moveTo: function(x, y)
{
if(!isNaN(parseInt(x,10)))
......@@ -1062,6 +1100,7 @@ Path.prototype = {
case historyitem_AutoShapes_Add_PathCubicBezTo:
{
this.ArrPathCommandInfo.splice(this.ArrPathCommandInfo.length - 1, 1);
break;
}
}
},
......@@ -1093,6 +1132,27 @@ Path.prototype = {
this.ArrPathCommandInfo.push({id: close});
break;
}
case historyitem_AutoShapes_Set_PathStroke:
{
this.stroke = data.newValue;
break;
}
case historyitem_AutoShapes_Set_PathFill:
{
this.fill = data.newValue;
break;
}
case historyitem_AutoShapes_Set_PathWH:
{
this.pathW = data.newValue1;
this.pathH = data.newValue2;
if(this.pathW != undefined)
{
this.divPW = 1/this.pathW;
this.divPH = 1/this.pathH;
}
break;
}
}
}
};
......
......@@ -740,13 +740,32 @@ CShape.prototype =
},
initDefault: function(x, y, extX, extY, flipH, flipV, presetGeom)
initDefault: function(x, y, extX, extY, flipH, flipV, presetGeom, tailEnd, headEnd)
{
this.setXfrmObject(new CXfrm());
this.setPosition(x, y);
this.setExtents(extX, extY);
this.setFlips(flipH, flipV);
this.setPresetGeometry(presetGeom);
if(tailEnd || headEnd)
{
var ln = new CLn();
if(tailEnd)
{
var tailEnd = new EndArrow();
tailEnd.type = LineEndType.Arrow;
tailEnd.len = LineEndSize.Mid;
ln.setTailEnd(tailEnd);
}
if(headEnd)
{
var headEnd = new EndArrow();
headEnd.type = LineEndType.Arrow;
headEnd.len = LineEndSize.Mid;
ln.setHeadEnd(headEnd);
}
this.setUniLine(ln);
}
this.setDefaultStyle();
this.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterInit, null, null,
......
......@@ -11,6 +11,8 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
this.presetGeom = presetGeom;
this.startX = startX;
this.startY = startY;
this.headEnd = false;
this.tailEnd = false;
this.x = null;
this.y = null;
......@@ -18,8 +20,7 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
this.extY = null;
this.transform = new CMatrix();
var geometry = CreateGeometry(presetGeom !== "textRect" ? presetGeom : "rect");
geometry.Init(5, 5);
var theme = drawingObjects.getWorkbook().theme;
var color_map = GenerateDefaultColorMap().color_map;
......@@ -41,38 +42,115 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
}
}
var pen = theme.getLnStyle(style.lnRef.idx);
style.lnRef.Color.Calculate(theme, color_map, {R: 0 , G: 0, B: 0, A: 255});
RGBA = style.lnRef.Color.RGBA;
var final_preset = presetGeom;
var sPreset = presetGeom;
switch(sPreset)
{
case "lineWithArrow":
{
final_preset = "line";
this.tailEnd = true;
break;
}
case "lineWithTwoArrows":
{
final_preset = "line";
this.tailEnd = true;
this.headEnd = true;
break;
}
case "bentConnector5WithArrow":
{
final_preset = "bentConnector5";
this.tailEnd = true;
break;
}
case "bentConnector5WithTwoArrows":
{
final_preset = "bentConnector5";
this.tailEnd = true;
this.headEnd = true;
break;
}
case "curvedConnector3WithArrow":
{
final_preset = "curvedConnector3";
this.tailEnd = true;
break;
}
case "curvedConnector3WithTwoArrows":
{
final_preset = "curvedConnector3";
this.tailEnd = true;
this.headEnd = true;
break;
}
case "textRect":
{
final_preset = "rect";
break;
}
default :
{
final_preset = sPreset;
break;
}
}
if(presetGeom === "textRect")
{
var ln, fill;
ln = new CLn();
ln.w = 6350;
ln.Fill = new CUniFill();
ln.Fill.fill = new CSolidFill();
ln.Fill.fill.color = new CUniColor();
ln.Fill.fill.color.color = new CPrstColor();
ln.Fill.fill.color.color.id = "black";
if(presetGeom === "textRect")
{
var ln, fill;
ln = new CLn();
ln.w = 6350;
ln.Fill = new CUniFill();
ln.Fill.fill = new CSolidFill();
ln.Fill.fill.color = new CUniColor();
ln.Fill.fill.color.color = new CPrstColor();
ln.Fill.fill.color.color.id = "black";
fill = new CUniFill();
fill.fill = new CSolidFill();
fill.fill.color = new CUniColor();
fill.fill.color.color = new CSchemeColor();
fill.fill.color.color.id = 12;
fill = new CUniFill();
fill.fill = new CSolidFill();
fill.fill.color = new CUniColor();
fill.fill.color.color = new CSchemeColor();
fill.fill.color.color.id = 12;
pen.merge(ln);
brush.merge(fill);
}
}
else if(this.tailEnd || this.headEnd)
{
var ln;
ln = new CLn();
if(this.tailEnd)
{
ln.tailEnd = new EndArrow();
ln.tailEnd.type = LineEndType.Arrow;
ln.tailEnd.len = LineEndSize.Mid;
}
if(this.headEnd)
{
ln.headEnd = new EndArrow();
ln.headEnd.type = LineEndType.Arrow;
ln.headEnd.len = LineEndSize.Mid;
}
pen.merge(ln);
brush.merge(fill);
}
pen.Fill.calculate(theme, color_map, RGBA) ;
brush.calculate(theme, color_map, RGBA) ;
this.finalPreset = final_preset;
var geometry = CreateGeometry(final_preset);
geometry.Init(5, 5);
this.overlayObject = new OverlayObject(geometry, 5, 5, brush, pen, this.transform);
this.lineFlag = CheckLinePreset(final_preset);
this.track = function(e, x, y)
{
var real_dist_x = x - this.startX;
......@@ -267,11 +345,16 @@ function NewShapeTrack(drawingObjects, presetGeom, startX, startY)
{
var shape = new CShape(null, this.drawingObjects);
if(this.presetGeom !== "textRect")
shape.initDefault(this.x, this.y, this.extX, this.extY, false, false, this.presetGeom);
shape.initDefault(this.x, this.y, this.extX, this.extY, false, false, this.finalPreset, this.tailEnd, this.headEnd);
else
shape.initDefaultTextRect(this.x, this.y, this.extX, this.extY, false, false);
shape.select(this.drawingObjects.controller);
shape.addToDrawingObjects();
this.drawingObjects.controller.curState.resultObject = shape;
};
}
function CheckLinePreset(preset)
{
return preset === "line";
}
\ No newline at end of file
......@@ -180,6 +180,14 @@ var historyitem_AutoShapes_BottomInset = 68;
var historyitem_AutoShapes_Set_AutoShapeStyle = 69;
var historyitem_AutoShapes_Set_ImageBlipFill = 70;
var historyitem_AutoShapes_Set_AscChart = 71;
var historyitem_AutoShapes_Set_PathStroke = 72;
var historyitem_AutoShapes_Set_PathFill = 73;
var historyitem_AutoShapes_Set_PathWH = 74;
var historyitem_AutoShapes_SetTailEnd = 75;
var historyitem_AutoShapes_SetHeadEnd = 76;
......
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