Commit a5cdc08e 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@49448 954022d7-b5bf-4e40-9824-e11837661b57
parent d5bfb7ca
......@@ -1670,14 +1670,14 @@ function CorrectUniFillEx(asc_fill, unifill) {
{
case c_oAscFill.FILL_TYPE_NOFILL:
{
ret.fill = new CNoFill();
ret.setFill(new CNoFill());
break;
}
case c_oAscFill.FILL_TYPE_BLIP:
{
if (ret.fill == null || ret.fill.type != FILL_TYPE_BLIP)
{
ret.fill = new CBlipFill();
ret.setFill(new CBlipFill());
}
var _url = _fill.asc_getUrl();
......@@ -1688,10 +1688,10 @@ function CorrectUniFillEx(asc_fill, unifill) {
}
if (_url != null && _url !== undefined && _url != "")
ret.fill.RasterImageId = _url;
ret.fill.setRasterImageId(_url);
if (ret.fill.RasterImageId == null)
ret.fill.RasterImageId = "";
ret.fill.setRasterImageId("");
var tile = _fill.asc_getType();
if (tile == c_oAscFillBlipType.STRETCH)
......@@ -1705,20 +1705,20 @@ function CorrectUniFillEx(asc_fill, unifill) {
{
if (ret.fill == null || ret.fill.type != FILL_TYPE_PATT)
{
ret.fill = new CPattFill();
ret.setFill(new CPattFill());
}
if (undefined != _fill.PatternType)
{
ret.fill.ftype = _fill.PatternType;
ret.fill.setFType(_fill.PatternType);
}
if (undefined != _fill.fgClr)
{
ret.fill.fgClr = CorrectUniColorEx(_fill.asc_getColorFg(), ret.fill.fgClr);
ret.fill.setFgColor(CorrectUniColorEx(_fill.asc_getColorFg(), ret.fill.fgClr));
}
if (undefined != _fill.bgClr)
{
ret.fill.bgClr = CorrectUniColorEx(_fill.asc_getColorBg(), ret.fill.bgClr);
ret.fill.setBgColor(CorrectUniColorEx(_fill.asc_getColorBg(), ret.fill.bgClr));
}
break;
......@@ -1727,7 +1727,7 @@ function CorrectUniFillEx(asc_fill, unifill) {
{
if (ret.fill == null || ret.fill.type != FILL_TYPE_GRAD)
{
ret.fill = new CGradFill();
ret.setFill(new CGradFill());
}
var _colors = _fill.asc_getColors();
......@@ -1741,10 +1741,10 @@ function CorrectUniFillEx(asc_fill, unifill) {
for (var i = 0; i < _colors.length; i++)
{
var _gs = new CGs();
_gs.color = CorrectUniColorEx(_colors[i], _gs.color);
_gs.pos = _positions[i];
_gs.setColor(CorrectUniColorEx(_colors[i], _gs.color));
_gs.setPos(_positions[i]);
ret.fill.colors.push(_gs);
ret.fill.addGS(_gs);
}
}
}
......@@ -1754,7 +1754,7 @@ function CorrectUniFillEx(asc_fill, unifill) {
{
for (var i = 0; i < _colors.length; i++)
{
ret.fill.colors[i].color = CorrectUniColorEx(_colors[i], ret.fill.colors[i].color);
ret.fill.colors[i].setColor(CorrectUniColorEx(_colors[i], ret.fill.colors[i].color));
}
}
}
......@@ -1764,7 +1764,7 @@ function CorrectUniFillEx(asc_fill, unifill) {
{
for (var i = 0; i < _positions.length; i++)
{
ret.fill.colors[i].pos = _positions[i];
ret.fill.colors[i].setPos(_positions[i]);
}
}
}
......@@ -1777,17 +1777,17 @@ function CorrectUniFillEx(asc_fill, unifill) {
var _scale = _fill.asc_getLinearScale();
if (!ret.fill.lin)
ret.fill.lin = new GradLin();
ret.fill.setLin(new GradLin());
if (undefined != _angle)
ret.fill.lin.angle = _angle;
ret.fill.lin.setAngle(_angle);
if (undefined != _scale)
ret.fill.lin.scale = _scale;
ret.fill.lin.setScale(_scale);
}
else if (c_oAscFillGradType.GRAD_PATH == _grad_type)
{
ret.fill.lin = null;
ret.fill.path = new GradPath();
ret.fill.setLin(null);
ret.fill.setPath(new GradPath());
}
break;
}
......@@ -1795,16 +1795,16 @@ function CorrectUniFillEx(asc_fill, unifill) {
{
if (ret.fill == null || ret.fill.type != FILL_TYPE_SOLID)
{
ret.fill = new CSolidFill();
ret.setFill(new CSolidFill());
}
ret.fill.color = CorrectUniColorEx(_fill.asc_getColor(), ret.fill.color);
ret.fill.setColor(CorrectUniColorEx(_fill.asc_getColor(), ret.fill.color));
}
}
}
var _alpha = asc_fill.asc_getTransparent();
if (null != _alpha)
ret.transparent = _alpha;
ret.setTransparent(_alpha);
return ret;
}
......
......@@ -1721,12 +1721,18 @@ CSolidFill.prototype =
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
Writer.WriteBool(typeof this.color === "object" && this.color !== null)
if(typeof this.color === "object" && this.color !== null)
this.color.Write_ToBinary2(Writer);
},
Read_FromBinary2 : function(Reader)
{
if(Reader.GetBool())
{
this.color = new CUniColor();
this.color.Read_FromBinary2(Reader);
}
},
IsIdentical : function(fill)
......@@ -1766,10 +1772,77 @@ function CGs()
{
this.color = new CUniColor();
this.pos = 0;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
CGs.prototype =
{
Get_Id: function()
{
return this.Id;
},
getObjectType: function()
{
return CLASS_TYPE_GS;
},
setColor: function(unicolor)
{
var oldValue = isRealObject(this.color) ? this.color.Get_Id() : null;
var newValue = isRealObject(unicolor) ? unicolor.Get_Id() : null;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetFType, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.color = unicolor;
},
setPos: function(pos)
{
var oldValue = this.pos;
var newValue = pos;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetXfrm, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.pos = pos;
},
Undo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_SetFType:
{
this.color = g_oTableId.Get_ById(data.oldValue);
break;
}
case historyitem_AutoShapes_SetXfrm:
{
this.pos = data.oldValue;
break;
}
}
},
Redo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_SetFType:
{
this.color = g_oTableId.Get_ById(data.newValue);
break;
}
case historyitem_AutoShapes_SetXfrm:
{
this.pos = data.newValue;
break;
}
}
},
Write_ToBinary2 : function(Writer)
{
this.color.Write_ToBinary2(Writer);
......@@ -1794,7 +1867,7 @@ CGs.prototype =
duplicate.color = this.color.createDuplicate();
return duplicate;
}
};
}
/*function CGradFill()
{
......@@ -1892,9 +1965,76 @@ function GradLin()
{
this.angle = 5400000;
this.scale = true;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
GradLin.prototype =
{
Get_Id: function()
{
return this.Id;
},
getObjectType: function()
{
return CLASS_TYPE_GRAD_LIN;
},
setAngle: function(angle)
{
var oldValue = this.angle;
var newValue = angle;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetFType, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.angle = angle;
},
setScale: function(scale)
{
var oldValue = this.scale;
var newValue = scale;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetXfrm, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.scale = scale;
},
Undo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_SetFType:
{
this.angle =data.oldValue;
break;
}
case historyitem_AutoShapes_SetXfrm:
{
this.scale = data.oldValue;
break;
}
}
},
Redo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_SetFType:
{
this.angle =data.newValue;
break;
}
case historyitem_AutoShapes_SetXfrm:
{
this.scale = data.newValue;
break;
}
}
},
IsIdentical : function(lin)
{
if (this.angle != lin.angle)
......@@ -1954,10 +2094,99 @@ function CGradFill()
this.lin = null;
this.path = null;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
CGradFill.prototype =
{
Get_Id: function()
{
return this.Id;
},
getObjectType: function()
{
return CLASS_TYPE_GRAD_FILL;
},
addGS: function(gs)
{
var oldValue = isRealObject(gs) ? gs.Get_Id() : null;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetFType, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, null)));
this.colors.push(gs);
},
setLin: function(lin)
{
var oldValue = isRealObject(this.lin) ? this.lin.Get_Id() : null;
var newValue = isRealObject(lin) ? lin.Get_Id() : null;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetXfrm, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(oldValue, newValue)));
this.lin = lin;
},
setPath: function(path)
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_SetGroup, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(isRealObject(this.path), isRealObject(path))));
this.path = path;
},
Undo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_SetFType:
{
this.colors.length = this.colors.length - 1;
break;
}
case historyitem_AutoShapes_SetXfrm:
{
this.lin = g_oTableId.Get_ById(data.oldValue);
break;
}
case historyitem_AutoShapes_SetGroup:
{
if(data.oldValue)
this.path = new GradPath();
else
this.path = null;
break;
}
}
},
Redo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_SetFType:
{
this.colors.push(g_oTableId.Get_ById(data.oldValue));
break;
}
case historyitem_AutoShapes_SetXfrm:
{
this.lin = g_oTableId.Get_ById(data.newValue);
break;
}
case historyitem_AutoShapes_SetGroup:
{
if(data.newValue)
this.path = new GradPath();
else
this.path = null;
break;
}
}
},
IsIdentical : function(fill)
{
if(fill == null)
......@@ -2186,6 +2415,16 @@ function CNoFill()
CNoFill.prototype =
{
Get_Id: function()
{
return this.Id;
},
getObjectType: function()
{
return CLASS_TYPE_NO_FILL;
},
Write_ToBinary2 : function(Writer)
{
Writer.WriteLong(this.type);
......@@ -4029,6 +4268,11 @@ function CSpPr()
}
};
this.readFromBinaryForCopyPaste = function(r)
{
};
this.copyFromOther = function(spPr)
{
this.setBwMode(spPr.bwMode);
......
......@@ -2703,6 +2703,22 @@ CShape.prototype =
this.recalculatePen();
break;
}
case historyitem_AutoShapes_Set_AutoShapeStyle:
{
if(typeof data.oldValue === "string")
{
this.style = new CShapeStyle();
var r = CreateBinaryReader(data.oldValue, 0, data.oldValue.length);
this.style.Read_FromBinary2(r);
}
else
{
this.style = null;
}
/*this.recalculateBrush();
this.recalculatePen(); */
break;
}
}
},
......@@ -2812,6 +2828,22 @@ CShape.prototype =
this.txBody = g_oTableId.Get_ById(data.newValue);
break;
}
case historyitem_AutoShapes_Set_AutoShapeStyle:
{
if(typeof data.newValue === "string")
{
this.style = new CShapeStyle();
var r = CreateBinaryReader(data.newValue, 0, data.newValue.length);
this.style.Read_FromBinary2(r);
}
else
{
this.style = null;
}
/* this.recalculateBrush();
this.recalculatePen(); */
break;
}
}
},
......@@ -2841,21 +2873,107 @@ CShape.prototype =
readFromBinaryForCopyPaste: function(r, group, drawingObjects, x, y)
{
this.group = group;
this.drawingObjects = drawingObjects;
this.spPr.Read_FromBinary2(r);
this.setDrawingObjects(drawingObjects);
this.spPr.bwMode = r.GetBool();
this.setXfrmObject(new CXfrm());
var Reader = r;
var offX, offY, extX, extY, flipH, flipV, rot;
var flag = Reader.GetBool();
if(flag)
offX = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
offY = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
extX = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
extY = Reader.GetDouble();
flag = Reader.GetBool();
flag = Reader.GetBool();
flag = Reader.GetBool();
flag = Reader.GetBool();
flag = Reader.GetBool();
if(flag)
flipH = Reader.GetBool();
flag = Reader.GetBool();
if(flag)
flipV = Reader.GetBool();
flag = Reader.GetBool();
if(flag)
rot = Reader.GetDouble();
if(isRealNumber(offX) && isRealNumber(offY))
this.setPosition(offX, offY);
if(isRealNumber(extX) && isRealNumber(extY))
this.setExtents(extX, extY);
this.setFlips(flipH, flipV);
if(isRealNumber(rot))
this.setRotate(rot);
var flag = Reader.GetBool();
if(flag)
{
var geometry = new CGeometry();
geometry.Read_FromBinary2(Reader);
this.setPresetGeometry(geometry.preset);
}
flag = Reader.GetBool();
if(flag)
{
var Fill = new CUniFill();
Fill.Read_FromBinary2(Reader);
this.setUniFill(Fill);
}
flag = Reader.GetBool();
if(flag)
{
var ln = new CLn();
ln.Read_FromBinary2(Reader);
this.setUniLine(ln);
}
if(isRealNumber(x) && isRealNumber(y))
{
this.setPosition(x, y);
}
if(r.GetBool())
{
this.style = new CShapeStyle();
this.style.Read_FromBinary2(r);
var style = new CShapeStyle();
style.Read_FromBinary2(r);
this.setStyleBinary(style);
}
if(r.GetBool())
{
this.txBody = new CTextBody(this);
this.txBody.Read_FromBinary2(r);
this.txBody.readFromBinaryForCopyPaste(r, drawingObjects.drawingDocument);
}
if(!isRealObject(group))
{
......@@ -2863,7 +2981,35 @@ CShape.prototype =
this.recalculateTransform();
this.calculateContent();
this.calculateTransformTextMatrix();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateAfterInit, null, null,
new UndoRedoDataGraphicObjects(this.Get_Id(), new UndoRedoDataGOSingleProp(null, null)));
}
},
setStyleBinary: function(style)
{
var old_style_binary = null;
var new_style_binary = null;
if(isRealObject(this.style))
{
var w = new CMemory();
this.style.Write_ToBinary2(w);
old_style_binary = w.pos + ";" + w.GetBase64Memory();
}
if(isRealObject(style))
{
var w = new CMemory();
style.Write_ToBinary2(w);
new_style_binary = w.pos + ";" + w.GetBase64Memory();
}
if(isRealObject(style))
this.style = style.createDuplicate();
else
this.style = null;
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Set_AutoShapeStyle, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(old_style_binary, new_style_binary)), null);
}
};
......
......@@ -234,9 +234,23 @@ CTableId.prototype =
Class = new CLegendEntry();
break;
}
case CLASS_TYPE_NO_FILL:
{
Class = new CNoFill();
break;
}
case CLASS_TYPE_GS:
{
Class = new CGs();
break;
}
}
if(isRealObject(Class))
{
Class.Id = Id;
this.m_aPairs[Id] = Class;
}
this.m_bTurnOff = false;
break;
......@@ -908,12 +922,14 @@ CTextBody.prototype =
writeToBinaryForCopyPaste: function(w)
{
this.bodyPr.Write_ToBinary2(w);
writeToBinaryDocContent(this.content, w);
},
readFromBinaryForCopyPaste: function(r, drawingDocument)
{
this.bodyPr.Read_FromBinary2(r);
this.content = new CDocumentContent(this, drawingDocument, 0, 0, 0, 20000, false, false);
readFromBinaryDocContent(this.content, r);
},
......
//----------------------------------------------------------------------------------- // 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 CLASS_TYPE_LEGEND_ENTRY = 22; var CLASS_TYPE_CHART_DATA = 23; var g_oTableId = null;
\ No newline at end of file
//----------------------------------------------------------------------------------- // 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 CLASS_TYPE_LEGEND_ENTRY = 25; var CLASS_TYPE_CHART_DATA = 26; var CLASS_TYPE_NO_FILL = 27; var CLASS_TYPE_GS = 28; var CLASS_TYPE_GRAD_LIN = 29; var CLASS_TYPE_GRAD_PAT = 30; var g_oTableId = null;
\ No newline at end of file
......
......@@ -1423,7 +1423,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
this.drawSelection = function(drawingDocument)
{
drawingDocument.DrawTrack(TYPE_TRACK_TEXT, this.textObject.getTransform(), 0, 0, this.textObject.extX, this.textObject.extY, false/*, selected_objects[i].canRotate()TODO*/);
drawingDocument.DrawTrack(TYPE_TRACK_TEXT, this.textObject.getTransform(), 0, 0, this.textObject.extX, this.textObject.extY, false, this.textObject.canRotate ? this.textObject.canRotate() : false);
this.textObject.drawAdjustments(drawingDocument);
//this.textObject.updateSelectionState(drawingDocument);
};
......@@ -5538,7 +5538,7 @@ function DefaultKeyDownHandle(drawingObjectsController, e)
{
if(state.id === STATES_ID_GROUP)
state.group.resetSelection();
state.resetSelectionState();
drawingObjectsController.resetSelectionState();
var drawing_bases = drawingObjectsController.drawingObjects.getDrawingObjects();
for(var i = 0; i < drawing_bases.length; ++i)
{
......
......@@ -174,6 +174,8 @@ var historyitem_AutoShapes_TopInset = 66;
var historyitem_AutoShapes_RightInset = 67;
var historyitem_AutoShapes_LeftInset = 68;
var historyitem_AutoShapes_BottomInset = 68;
var historyitem_AutoShapes_Set_AutoShapeStyle = 69;
......
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