Commit 01afbbe9 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@49707 954022d7-b5bf-4e40-9824-e11837661b57
parent f44ccf9e
......@@ -2600,6 +2600,126 @@ function CXfrm()
this.flipV = null;
this.rot = null;
this.Write_ToBinary2 = function(Writer)
{
var flag;
flag = this.offX != null;
Writer.WriteBool(flag);
if(flag === true)
Writer.WriteDouble(this.offX);
flag = this.offY != null;
Writer.WriteBool(flag);
if(flag === true)
Writer.WriteDouble(this.offY);
flag = this.extX != null;
Writer.WriteBool(flag);
if(flag === true)
Writer.WriteDouble(this.extX);
flag = this.extY != null;
Writer.WriteBool(flag);
if(flag === true)
Writer.WriteDouble(this.extY);
flag = this.chOffX != null;
Writer.WriteBool(flag);
if(flag === true)
Writer.WriteDouble(this.chOffX);
flag = this.chOffY != null;
Writer.WriteBool(flag);
if(flag === true)
Writer.WriteDouble(this.chOffY);
flag = this.chExtX != null;
Writer.WriteBool(flag);
if(flag === true)
Writer.WriteDouble(this.chExtX);
flag = this.chExtY !== null;
Writer.WriteBool(flag);
if(flag === true)
Writer.WriteDouble(this.chExtY);
flag = this.flipH !== null;
Writer.WriteBool(flag);
if(flag)
Writer.WriteBool(this.flipH);
flag = this.flipV !== null;
Writer.WriteBool(flag);
if(flag)
Writer.WriteBool(this.flipV);
flag = this.rot !== null;
Writer.WriteBool(flag);
if(flag)
Writer.WriteDouble(this.rot);
};
this.Read_FromBinary2 = function(Reader)
{
var flag = Reader.GetBool();
if(flag)
this.offX = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
this.offY = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
this.extX = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
this.extY = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
this.chOffX = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
this.chOffY = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
this.chExtX = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
this.chExtY = Reader.GetDouble();
flag = Reader.GetBool();
if(flag)
this.flipH = Reader.GetBool();
flag = Reader.GetBool();
if(flag)
this.flipV = Reader.GetBool();
flag = Reader.GetBool();
if(flag)
this.rot = Reader.GetDouble();
};
this.isNotNull = function()
{
return isRealNumber(this.offX) && isRealNumber(this.offY) && isRealNumber(this.extX) && isRealNumber(this.extY);
......@@ -2730,7 +2850,7 @@ function CSpPr()
this.ln = new CLn();
this.ln.merge(spPr.ln);
} */
}
};
this.createDuplicate = function()
{
......@@ -2748,7 +2868,62 @@ function CSpPr()
duplicate.ln = this.ln.createDuplicate();
}
return duplicate;
}
};
this.Write_ToBinary2 = function(Writer)
{
var boolBWMode = this.bwMode == 1;
Writer.WriteBool(boolBWMode);
Writer.WriteBool(isRealObject(this.xfrm));
if(isRealObject(this.xfrm))
this.xfrm.Write_ToBinary2(Writer);
var flag = this.geometry != null;
Writer.WriteBool(flag);
if(flag)
this.geometry.Write_ToBinary2(Writer);
flag = this.Fill != null;
Writer.WriteBool(flag);
if(flag)
this.Fill.Write_ToBinary2(Writer);
flag = this.ln != null;
Writer.WriteBool(flag);
if(flag)
{
this.ln.Write_ToBinary2(Writer);
}
};
this.Read_FromBinary2 = function(Reader)
{
var boolBWMode = Reader.GetBool();
this.bwMode = boolBWMode ? 1 : 0;
if(Reader.GetBool())
this.xfrm.Read_FromBinary2(Reader);
var flag = Reader.GetBool();
if(flag)
{
this.geometry = new Geometry();
this.geometry.Read_FromBinary2(Reader);
}
flag = Reader.GetBool();
if(flag)
{
this.Fill = new CUniFill();
this.Fill.Read_FromBinary2(Reader);
}
flag = Reader.GetBool();
if(flag)
{
this.ln = new CLn();
this.ln.Read_FromBinary2(Reader);
}
};
}
function CGrSpPr()
......
......@@ -42,6 +42,9 @@ function CChartAsGroup(parent/*(WordGraphicObject)*/, document, drawingDocument,
[];
this.selected = false;
this.mainGroup = null;
this.recalcInfo =
{};
this.Lock = new CLock();
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
......@@ -57,6 +60,13 @@ CChartAsGroup.prototype =
return this.chart;
},
recalcAll: function()
{},
recalcAllColors: function()
{},
calculateAfterChangeTheme: function()
{
this.recalculate();
......@@ -81,6 +91,21 @@ CChartAsGroup.prototype =
{
return this.transform;
},
sendMouseData: function()
{
if ( true === this.Lock.Is_Locked() )
{
var MMData = new CMouseMoveData();
var Coords = editor.WordControl.m_oLogicDocument.DrawingDocument.ConvertCoordsToCursorWR(this.x, this.y, this.parent.num, null);
MMData.X_abs = Coords.X - 5;
MMData.Y_abs = Coords.Y;
MMData.Type = c_oAscMouseMoveDataTypes.LockedObject;
MMData.UserId = this.Lock.Get_UserId();
MMData.HaveChanges = this.Lock.Have_Changes();
MMData.LockedObjectType = 0;
editor.sync_MouseMoveCallback( MMData );
}
},
getObjectType: function()
......@@ -481,6 +506,115 @@ CChartAsGroup.prototype =
setXfrm: function(offX, offY, extX, extY, rot, flipH, flipV)
{
if(this.spPr.xfrm.isNotNull())
{
if(isRealNumber(offX) && isRealNumber(offY))
this.setOffset(offX, offY);
if(isRealNumber(extX) && isRealNumber(extY))
this.setExtents(extX, extY);
if(isRealNumber(rot))
this.setRotate(rot);
if(isRealBool(flipH) && isRealBool(flipV))
this.setFlips(flipH, flipV);
}
else
{
var transform = this.getTransform();
if(isRealNumber(offX) && isRealNumber(offY))
this.setOffset(offX, offY);
else
this.setOffset(transform.x, transform.y);
if(isRealNumber(extX) && isRealNumber(extY))
this.setExtents(extX, extY);
else
this.setExtents(transform.extX, transform.extY);
if(isRealNumber(rot))
this.setRotate(rot);
else
this.setRotate(transform.rot);
if(isRealBool(flipH) && isRealBool(flipV))
this.setFlips(flipH, flipV);
else
this.setFlips(transform.flipH, transform.flipV);
}
},
normalize: function()
{
var new_off_x, new_off_y, new_ext_x, new_ext_y;
var xfrm = this.spPr.xfrm;
if(!isRealObject(this.group))
{
new_off_x = xfrm.offX;
new_off_y = xfrm.offY;
new_ext_x = xfrm.extX;
new_ext_y = xfrm.extY;
}
else
{
var scale_scale_coefficients = this.group.getResultScaleCoefficients();
new_off_x = scale_scale_coefficients.cx*(xfrm.offX - this.group.spPr.xfrm.chOffX);
new_off_y = scale_scale_coefficients.cy*(xfrm.offY - this.group.spPr.xfrm.chOffY);
new_ext_x = scale_scale_coefficients.cx*xfrm.extX;
new_ext_y = scale_scale_coefficients.cy*xfrm.extY;
}
this.setOffset(new_off_x, new_off_y);
this.setExtents(new_ext_x, new_ext_y);
},
setRotate: function(rot)
{
var xfrm = this.spPr.xfrm;
History.Add(this, {Type: historyitem_SetShapeRot, oldRot: xfrm.rot, newRot: rot});
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
xfrm.rot = rot;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
},
setOffset: function(offX, offY)
{
History.Add(this, {Type: historyitem_SetShapeOffset, oldOffsetX: this.spPr.xfrm.offX, newOffsetX: offX, oldOffsetY: this.spPr.xfrm.offY, newOffsetY: offY});
this.spPr.xfrm.offX = offX;
this.spPr.xfrm.offY = offY;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
},
setExtents: function(extX, extY)
{
History.Add(this, {Type: historyitem_SetShapeExtents, oldExtentX: this.spPr.xfrm.extX, newExtentX: extX, oldExtentY: this.spPr.xfrm.extY, newExtentY: extY});
this.spPr.xfrm.extX = extX;
this.spPr.xfrm.extY = extY;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateGeometry = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
},
setFlips: function(flipH, flipV)
{
History.Add(this, {Type: historyitem_SetShapeFlips, oldFlipH: this.spPr.xfrm.flipH, newFlipH: flipH, oldFlipV: this.spPr.xfrm.flipV, newFlipV: flipV});
this.spPr.xfrm.flipH = flipH;
this.spPr.xfrm.flipV = flipV;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
},
recalculateMatrix: function()
{
......@@ -849,19 +983,39 @@ CChartAsGroup.prototype =
return [];
},
select: function(pageIndex)
select: function(drawingObjectsController)
{
this.selected = true;
if(typeof pageIndex === "number")
this.selectStartPage = pageIndex;
var selected_objects;
if(!isRealObject(this.group))
selected_objects = drawingObjectsController.selectedObjects;
else
selected_objects = this.group.getMainGroup().selectedObjects;
for(var i = 0; i < selected_objects.length; ++i)
{
if(selected_objects[i] === this)
break;
}
if(i === selected_objects.length)
selected_objects.push(this);
},
deselect: function()
deselect: function(drawingObjectsController)
{
this.selected = false;
this.selectStartPage = -1;
var selected_objects;
if(!isRealObject(this.group))
selected_objects = drawingObjectsController.selectedObjects;
else
selected_objects = this.group.getMainGroup().selectedObjects;
for(var i = 0; i < selected_objects.length; ++i)
{
if(selected_objects[i] === this)
{
selected_objects.splice(i, 1);
break;
}
}
if(isRealObject(this.chartTitle))
{
......@@ -910,7 +1064,7 @@ CChartAsGroup.prototype =
var t_x, t_y;
t_x = invert_transform.TransformPointX(x, y);
t_y = invert_transform.TransformPointY(x, y);
var radius = this.drawingObjects.convertMetric(TRACK_CIRCLE_RADIUS, 0, 3);
var radius = this.getParentObjects().presentation.DrawingDocument.GetMMPerDot(TRACK_CIRCLE_RADIUS);
var sqr_x = t_x*t_y, sqr_y = t_y*t_y;
if(Math.sqrt(sqr_x + sqr_y) < radius)
......@@ -953,16 +1107,7 @@ CChartAsGroup.prototype =
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 7;
var rotate_distance = this.drawingObjects.convertMetric(TRACK_DISTANCE_ROTATE, 0, 3);
dist_y = t_y + rotate_distance;
sqr_y = dist_y*dist_y;
dist_x = t_x - hc;
sqr_x = dist_x*dist_x;
if(Math.sqrt(sqr_x + sqr_y) < radius)
return 8;
return -1;
},
recalculate: function(updateImage)
......@@ -1176,14 +1321,6 @@ CChartAsGroup.prototype =
var is_on = History.Is_On();
if(is_on)
History.TurnOff();
if(isRealObject(this.parent))
{
var xfrm = this.spPr.xfrm;
xfrm.offX = 0;
xfrm.offY = 0;
xfrm.extX = this.parent.Extent.W;
xfrm.extY = this.parent.Extent.H;
}
if(isRealObject(this.chartTitle))
{
......@@ -1518,6 +1655,11 @@ CChartAsGroup.prototype =
return new MoveTrackChart(this, true);
},
createResizeTrack: function(cardDirection)
{
return new ResizeTrackChart(this, cardDirection);
},
createTrackObjectForResize: function(handleNum, pageIndex)
{
return new ResizeTrackShape(this, handleNum, pageIndex, true);
......@@ -1664,15 +1806,6 @@ CChartAsGroup.prototype =
return {minX: min_x, maxX: max_x, minY: min_y, maxY: max_y};
},
setPosition: function(x, y)
{
this.spPr.xfrm.setPosition(x, y);
},
setExtents: function(extX, extY)
{
this.spPr.xfrm.setExtents(extX, extY);
},
calculateTransformTextMatrix: function()
{},
......@@ -1838,11 +1971,6 @@ CChartAsGroup.prototype =
Save_Changes: function()
{},
Load_Changes: function()
{},
Refresh_RecalcData: function()
{},
......@@ -1850,70 +1978,6 @@ CChartAsGroup.prototype =
Refresh_RecalcData2: function()
{},
Undo: function(data)
{
switch(data.Type)
{
case historyitem_SetSizes:
{
this.spPr.xfrm.extX = data.oldW;
this.spPr.xfrm.extY = data.oldH;
this.spPr.xfrm.flipH = data.oldFlipH;
this.spPr.xfrm.flipV = data.oldFlipV;
this.extX = data.oldW;
this.extY = data.oldH;
this.absFlipH = data.oldFlipH;
this.absFlipV = data.oldFlipV;
this.x = data.oldPosX;
this.y = data.oldPosY;
if(this.parent)
{
this.parent.absOffsetX = data.oldPosX;
this.parent.absOffsetY = data.oldPosY;
this.parent.absExtX = data.oldW;
this.parent.absExtY = data.oldH;
this.parent.flipH = data.oldFlipH;
this.parent.flipV = data.oldFlipV;
}
this.calculateAfterResize();
break;
}
}
},
Redo: function(data)
{
switch(data.Type)
{
case historyitem_SetSizes:
{
this.spPr.xfrm.extX = data.oldW;
this.spPr.xfrm.extY = data.oldH;
this.spPr.xfrm.flipH = data.oldFlipH;
this.spPr.xfrm.flipV = data.oldFlipV;
this.extX = data.oldW;
this.extY = data.oldH;
this.absFlipH = data.oldFlipH;
this.absFlipV = data.oldFlipV;
this.x = data.oldPosX;
this.y = data.oldPosY;
if(this.parent)
{
this.parent.absOffsetX = data.oldPosX;
this.parent.absOffsetY = data.oldPosY;
this.parent.absExtX = data.oldW;
this.parent.absExtY = data.oldH;
this.parent.flipH = data.oldFlipH;
this.parent.flipV = data.oldFlipV;
}
this.calculateAfterResize();
break;
}
}
},
getChartBinary: function()
{
var w = new CMemory();
......@@ -2015,11 +2079,6 @@ CChartAsGroup.prototype =
}
this.chart.Read_FromBinary2(r);
this.spPr.Read_FromBinary2(r);
if(isRealObject(this.parent))
{
this.parent.Extent.W = this.spPr.xfrm.extX;
this.parent.Extent.H = this.spPr.xfrm.extY;
}
this.init();
this.recalculate();
},
......@@ -2057,12 +2116,371 @@ CChartAsGroup.prototype =
this.parent = paraDrawing;
},
Write_ToBinary2: function()
{},
Read_FromBinary2: function()
{}
Undo: function(data)
{
switch(data.Type)
{
case historyitem_SetShapeRot:
{
this.spPr.xfrm.rot = data.oldRot;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeOffset:
{
this.spPr.xfrm.offX = data.oldOffsetX;
this.spPr.xfrm.offY = data.oldOffsetY;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeExtents:
{
this.spPr.xfrm.extX = data.oldExtentX;
this.spPr.xfrm.extY = data.oldExtentY;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeFlips:
{
this.spPr.xfrm.flipH = data.oldFlipH;
this.spPr.xfrm.flipV = data.oldFlipV;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
break;
}
case historyitem_SetShapeSetFill:
{
if(isRealObject(data.oldFill))
{
this.spPr.Fill = data.oldFill.createDuplicate();
}
else
{
this.spPr.Fill = null;
}
this.recalcInfo.recalculateFill = true;
this.recalcInfo.recalculateBrush = true;
this.recalcInfo.recalculateTransparent = true;
break;
}
case historyitem_SetShapeSetLine:
{
if(isRealObject(data.oldLine))
{
this.spPr.ln = data.oldLine.createDuplicate();
}
else
{
this.spPr.ln = null;
}
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
break;
}
case historyitem_SetShapeSetGeometry:
{
if(isRealObject(data.oldGeometry))
{
this.spPr.geometry = data.oldGeometry.createDuplicate();
this.spPr.geometry.Init(5, 5);
}
else
{
this.spPr.geometry = null;
}
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeBodyPr:
{
this.txBody.bodyPr = data.oldBodyPr.createDuplicate();
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
},
Redo: function(data)
{
switch(data.Type)
{
case historyitem_SetShapeRot:
{
this.spPr.xfrm.rot = data.newRot;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeOffset:
{
this.spPr.xfrm.offX = data.newOffsetX;
this.spPr.xfrm.offY = data.newOffsetY;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeExtents:
{
this.spPr.xfrm.extX = data.newExtentX;
this.spPr.xfrm.extY = data.newExtentY;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeFlips:
{
this.spPr.xfrm.flipH = data.newFlipH;
this.spPr.xfrm.flipV = data.newFlipV;
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
break;
}
case historyitem_SetShapeSetFill:
{
if(isRealObject(data.newFill))
{
this.spPr.Fill = data.newFill.createDuplicate();
}
this.recalcInfo.recalculateFill = true;
this.recalcInfo.recalculateBrush = true;
this.recalcInfo.recalculateTransparent = true;
break;
}
case historyitem_SetShapeSetLine:
{
if(isRealObject(data.newLine))
{
this.spPr.ln = data.newLine.createDuplicate();
}
else
{
this.spPr.ln = null;
}
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
break;
}
case historyitem_SetShapeSetGeometry:
{
if(isRealObject(data.newGeometry))
{
this.spPr.geometry = data.newGeometry.createDuplicate();
this.spPr.geometry.Init(5, 5);
}
else
{
this.spPr.geometry = null;
}
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeBodyPr:
{
this.txBody.bodyPr = data.newBodyPr.createDuplicate();
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
},
Save_Changes: function(data, w)
{
w.WriteLong(historyitem_type_Shape);
w.WriteLong(data.Type);
var bool;
switch(data.Type)
{
case historyitem_SetShapeRot:
{
w.WriteDouble(data.newRot);
break;
}
case historyitem_SetShapeOffset:
{
w.WriteDouble(data.newOffsetX);
w.WriteDouble(data.newOffsetY);
break;
}
case historyitem_SetShapeExtents:
{
w.WriteDouble(data.newExtentX);
w.WriteDouble(data.newExtentY);
break;
}
case historyitem_SetShapeFlips:
{
w.WriteBool(data.newFlipH);
w.WriteBool(data.newFlipV);
break;
}
case historyitem_SetShapeSetFill:
{
w.WriteBool(isRealObject(data.newFill));
if(isRealObject(data.newFill))
{
data.newFill.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShapeSetLine:
{
w.WriteBool(isRealObject(data.newLine));
if(isRealObject(data.newLine))
{
data.newLine.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShapeSetGeometry:
{
w.WriteBool(isRealObject(data.newGeometry));
if(isRealObject(data.newGeometry))
{
data.newGeometry.Write_ToBinary2(w);
}
break;
}
case historyitem_SetShapeBodyPr:
{
data.newBodyPr.Write_ToBinary2(w);
break;
}
}
},
Load_Changes: function(r)
{
if(r.GetLong() === historyitem_type_Shape)
{
switch(r.GetLong())
{
case historyitem_SetShapeRot:
{
this.spPr.xfrm.rot = r.GetDouble();
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeOffset:
{
this.spPr.xfrm.offX = r.GetDouble();
this.spPr.xfrm.offY = r.GetDouble();
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
case historyitem_SetShapeExtents:
{
this.spPr.xfrm.extX = r.GetDouble();
this.spPr.xfrm.extY = r.GetDouble();
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeFlips:
{
this.spPr.xfrm.flipH = r.GetBool();
this.spPr.xfrm.flipV = r.GetBool();
this.recalcInfo.recalculateTransform = true;
this.recalcInfo.recalculateTransformText = true;
this.recalcInfo.recalculateContent = true;
break;
}
case historyitem_SetShapeSetFill:
{
if(r.GetBool())
{
this.spPr.Fill = new CUniFill();
this.spPr.Fill.Read_FromBinary2(r);
}
this.recalcInfo.recalculateFill = true;
this.recalcInfo.recalculateBrush = true;
this.recalcInfo.recalculateTransparent = true;
break;
}
case historyitem_SetShapeSetLine:
{
if(r.GetBool())
{
this.spPr.ln = new CLn();
this.spPr.ln.Read_FromBinary2(r);
}
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
break;
}
case historyitem_SetShapeSetGeometry:
{
if(r.GetBool())
{
this.spPr.geometry = new Geometry();
this.spPr.geometry.Read_FromBinary2(r);
this.spPr.geometry.Init(5, 5);
}
else
{
this.spPr.geometry = null;
}
this.recalcInfo.recalculateGeometry = true;
break;
}
case historyitem_SetShapeBodyPr:
{
this.txBody.bodyPr = new CBodyPr();
this.txBody.bodyPr.Read_FromBinary2(r);
this.txBody.recalcInfo.recalculateBodyPr = true;
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this;
}
},
Write_ToBinary2: function(w)
{
w.WriteLong(historyitem_type_Chart);
w.WriteString2(this.Id);
},
Read_FromBinary2: function(r)
{
this.Id = r.GetString2();
}
};
window["Asc"].CChartAsGroup = CChartAsGroup;
......
......@@ -20,96 +20,129 @@ function CChartLayout()
this.y = null;
this.w = null;
this.h = null;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id, null)
}
CChartLayout.prototype =
{
createDuplicate: function()
{
var ret = new CChartLayout();
this.isManual = false;
ret.layoutTarget = this.layoutTarget;
ret.xMode = this.xMode;
ret.yMode = this.yMode;
ret.wMode = this.wMode;
ret.hMode = this.hMode;
ret.x = this.x;
ret.y = this.y;
ret.w = this.w;
ret.h = this.h;
return ret;
},
Write_ToBinary2: function(w)
{
w.WriteBool(isRealNumber(this.layoutTarget));
if(isRealNumber(this.layoutTarget))
w.WriteLong(this.layoutTarget);
w.WriteBool(isRealNumber(this.xMode));
if(isRealNumber(this.xMode))
w.WriteLong(this.xMode);
w.WriteBool(isRealNumber(this.yMode));
if(isRealNumber(this.yMode))
w.WriteLong(this.yMode);
w.WriteBool(isRealNumber(this.wMode));
if(isRealNumber(this.wMode))
w.WriteLong(this.wMode);
w.WriteBool(isRealNumber(this.hMode));
if(isRealNumber(this.hMode))
w.WriteLong(this.hMode);
w.WriteBool(isRealNumber(this.x));
if(isRealNumber(this.x))
w.WriteLong(this.x);
w.WriteBool(isRealNumber(this.y));
if(isRealNumber(this.y))
w.WriteLong(this.y);
w.WriteBool(isRealNumber(this.w));
if(isRealNumber(this.w))
w.WriteLong(this.w);
w.WriteBool(isRealNumber(this.h));
if(isRealNumber(this.h))
w.WriteLong(this.h);
},
Read_FromBinary2: function(r)
{
if(r.GetBool())
(this.layoutTarget) = r.GetLong();
if(r.GetBool())
(this.xMode) = r.GetLong();
if(r.GetBool())
(this.yMode) = r.GetLong();
if(r.GetBool())
(this.wMode) = r.GetLong();
if(r.GetBool())
(this.hMode) = r.GetLong();
if(r.GetBool())
(this.x) = r.GetLong();
if(r.GetBool())
(this.y) = r.GetLong();
if(r.GetBool())
(this.w) = r.GetLong();
if(r.GetBool())
(this.h) = r.GetLong();
},
setXMode: function(mode)
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Layout_Set_X_Mode, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(this.xMode, mode)), null);
this.xMode = mode;
},
setYMode: function(mode)
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Layout_Set_Y_Mode, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(this.yMode, mode)), null);
this.yMode = mode;
},
setX: function(x)
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Layout_Set_X, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(this.x, x)), null);
this.x = x;
},
setY: function(y)
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_Layout_Set_Y, null, null, new UndoRedoDataGraphicObjects(this.Id, new UndoRedoDataGOSingleProp(this.y, y)), null);
this.y = y;
},
setIsManual: function(isManual)
{
this.isManual = isManual;
},
Undo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_Layout_Set_X_Mode:
{
this.xMode = data.oldValue;
break;
}
case historyitem_AutoShapes_Layout_Set_Y_Mode:
{
this.yMode = data.oldValue;
break;
}
case historyitem_AutoShapes_Layout_Set_X:
{
this.x = data.oldValue;
break;
}
case historyitem_AutoShapes_Layout_Set_Y:
{
this.y = data.oldValue;
break;
}
}
},
Redo: function(type, data)
{
switch(type)
{
case historyitem_AutoShapes_Layout_Set_X_Mode:
{
this.xMode = data.newValue;
break;
}
case historyitem_AutoShapes_Layout_Set_Y_Mode:
{
this.yMode = data.newValue;
break;
}
case historyitem_AutoShapes_Layout_Set_X:
{
this.x = data.newValue;
break;
}
case historyitem_AutoShapes_Layout_Set_Y:
{
this.y = data.newValue;
break;
}
}
}
};
\ No newline at end of file
......@@ -22,16 +22,6 @@ function CChartTitle(chartGroup, type)
this.extX = null;
this.extY = null;
/* this.pen = new CLn();
this.pen.w = 90000;
this.pen.Fill = new CUniFill();
this.pen.Fill.fill = new CSolidFill();
this.pen.Fill.fill.color.color = new CRGBColor();
this.brush = new CUniFill();
this.brush.fill = new CSolidFill();
this.brush.fill.color.color = new CRGBColor(); */
this.brush = null;
this.pen = null;
this.spPr.geometry = CreateGeometry("rect");
......@@ -148,14 +138,6 @@ CChartTitle.prototype =
this.textBody.initFromString(title);
},
//recalculate
/*recalculateTransform: function()
{
this.recalculateAfterTextAdd();
this.transform.Reset();
global_MatrixTransformer.TranslateAppend(this.transform, this.x, this.y);
},*/
setDefaultText: function(val)
......@@ -209,7 +191,8 @@ CChartTitle.prototype =
{
if(!isRealObject(this.txBody))
this.txBody = new CTextBody(this);
this.txBody.paragraphAdd(paraItem);
this.txBody.content.Paragraph_Add(paraItem, false);
this.txBody.content.RecalculateCurPos();
var old_cx = this.x + this.extX*0.5;
var old_cy = this.y + this.extY*0.5;
......@@ -390,15 +373,17 @@ CChartTitle.prototype =
} */
},
updateSelectionState: function(drawingDocument)
updateSelectionState: function()
{
this.txBody.updateSelectionState(drawingDocument);
this.txBody.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
},
recalculateCurPos: function()
{
if(this.txBody)
this.txBody.recalculateCurPos();
if(isRealObject(this.txBody))
{
this.txBody.content.RecalculateCurPos();
}
},
drawTextSelection: function()
......@@ -858,41 +843,48 @@ CChartTitle.prototype =
},
selectionSetStart: function(e, x, y)
selectionSetStart: function(e, x, y, slideIndex)
{
var t_x, t_y;
t_x = this.invertTransformText.TransformPointX(x, y);
t_y = this.invertTransformText.TransformPointY(x, y);
var event = new CMouseEventHandler();
event.fromJQueryEvent(e);
this.txBody.selectionSetStart(e, t_x, t_y);
if(isRealObject(this.txBody))
{
var tx, ty;
tx = this.invertTransformText.TransformPointX(x, y);
ty = this.invertTransformText.TransformPointY(x, y);
this.txBody.content.Selection_SetStart(tx, ty, 0, e);
}
},
selectionSetEnd: function(e, x, y)
selectionSetEnd: function(e, x, y, slideIndex)
{
var t_x, t_y;
t_x = this.invertTransformText.TransformPointX(x, y);
t_y = this.invertTransformText.TransformPointY(x, y);
var event = new CMouseEventHandler();
event.fromJQueryEvent(e);
this.txBody.selectionSetEnd(e, t_x, t_y);
if(isRealObject(this.txBody))
{
var tx, ty;
tx = this.invertTransformText.TransformPointX(x, y);
ty = this.invertTransformText.TransformPointY(x, y);
this.txBody.content.Selection_SetEnd(tx, ty, 0, e);
}
},
setPosition: function(x, y)
{
if(!isRealObject(this.layout))
this.setLayout(new CChartLayout());
this.layout.setIsManual(true);
this.layout.setXMode(LAYOUT_MODE_EDGE);
this.layout.setX(x/this.chartGroup.extX);
this.layout.setYMode(LAYOUT_MODE_EDGE);
this.layout.setY(y/this.chartGroup.extY);
var layout = new CChartLayout();
layout.setIsManual(true);
layout.setXMode(LAYOUT_MODE_EDGE);
layout.setX(x/this.chartGroup.extX);
layout.setYMode(LAYOUT_MODE_EDGE);
layout.setY(y/this.chartGroup.extY);
this.setLayout(layout);
},
setLayout: function(layout)
{
var oldLayout = this.layout ? this.layout.createDuplicate() : null;
var newLayout = layout ? layout.createDuplicate() : null;
History.Add(this, {Type: historyitem_SetCahrtLayout, oldLayout: oldLayout, newLayout: newLayout});
this.layout = layout;
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this.chartGroup;
},
......@@ -908,7 +900,7 @@ CChartTitle.prototype =
var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y);
if(isRealObject(this.spPr.geometry))
return this.spPr.geometry.hitInPath(this.drawingObjects.getCanvasContext(), x_t, y_t);
return this.spPr.geometry.hitInPath(editor.WordControl.m_oDrawingDocument.CanvasHitContext, x_t, y_t);
return false;
},
......@@ -918,7 +910,7 @@ CChartTitle.prototype =
var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y);
if(isRealObject(this.spPr.geometry))
return this.spPr.geometry.hitInInnerArea(this.drawingObjects.getCanvasContext(), x_t, y_t);
return this.spPr.geometry.hitInInnerArea(editor.WordControl.m_oDrawingDocument.CanvasHitContext, x_t, y_t);
return x_t > 0 && x_t < this.extX && y_t > 0 && y_t < this.extY;
},
......@@ -940,7 +932,7 @@ CChartTitle.prototype =
var x_t = invert_transform.TransformPointX(x, y);
var y_t = invert_transform.TransformPointY(x, y);
var _hit_context = this.drawingObjects.getCanvasContext();
var _hit_context = editor.WordControl.m_oDrawingDocument.CanvasHitContext;
return (HitInLine(_hit_context, x_t, y_t, 0, 0, this.extX, 0) ||
HitInLine(_hit_context, x_t, y_t, this.extX, 0, this.extX, this.extY)||
......@@ -952,5 +944,137 @@ CChartTitle.prototype =
getInvertTransform: function()
{
return this.invertTransform;
},
recalcAll: function()
{},
recalcAllColors: function()
{},
writeToBinary: function(w)
{
w.WriteBool(isRealObject(this.layout));
if(isRealObject(this.layout))
this.layout.writeToBinary(w);
w.WriteBool(this.overlay);
this.spPr.Write_ToBinary2(w);
w.WriteBool(isRealObject(this.txPr));
if(isRealObject(this.txPr))
this.txPr.writeToBinary(w);
w.WriteBool(isRealObject(this.txBody));
if(isRealObject(this.txBody))
this.txBody.writeToBinary(w);
},
readFromBinary: function(r)
{
if(r.GetBool())
{
this.layout = new CChartLayout();
this.layout.readFromBinary(r);
}
this.overlay = r.GetBool();
this.spPr.Read_FromBinary2(r);
if(r.GetBool())
{
this.txPr = new CTextBody(this);
this.txPr.readFromBinary(r);
}
if(r.GetBool())
{
this.txBody = new CTextBody(this);
this.txBody.readFromBinary(r);
}
},
Undo: function(data)
{
switch(data.Type)
{
case historyitem_SetCahrtLayout:
{
if(isRealObject(data.oldLayout))
{
this.layout = data.oldLayout.createDuplicate();
}
else
{
this.layout = null;
}
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this.chartGroup;
},
Redo: function(data)
{
switch(data.Type)
{
case historyitem_SetCahrtLayout:
{
if(isRealObject(data.newLayout))
{
this.layout = data.newLayout.createDuplicate();
}
else
{
this.layout = null;
}
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this.chartGroup;
},
Refresh_RecalcData: function()
{},
Save_Changes: function(data, w)
{
w.WriteLong(historyitem_type_ChartTitle);
w.WriteLong(data.Type);
switch(data.Type)
{
case historyitem_SetCahrtLayout:
{
w.WriteBool(isRealObject(data.newLayout));
if(isRealObject(data.newLayout))
{
data.newLayout.Write_ToBinary2(w);
}
break;
}
}
},
Load_Changes: function(r)
{
if(r.GetLong() === historyitem_type_Shape)
{
switch(r.GetLong())
{
case historyitem_SetCahrtLayout:
{
if(r.GetBool())
{
this.layout = new CChartLayout();
this.layout.Read_FromBinary2(r);
}
else
{
this.layout = null;
}
break;
}
}
editor.WordControl.m_oLogicDocument.recalcMap[this.Id] = this.chartGroup;
}
}
};
\ No newline at end of file
......@@ -405,7 +405,7 @@ CGraphicFrame.prototype =
drawingDocument.TargetEnd();
drawingDocument.SelectEnabled(true);
drawingDocument.SelectClear();
Doc.Selection_Draw();
Doc.Selection_Draw_Page(this.parent.num);
drawingDocument.SelectShow();
}
else /*if(this.parent.elementsManipulator.Document.CurPos.Type == docpostype_FlowObjects ) */
......
......@@ -570,11 +570,6 @@ CPresentation.prototype =
this.recalcMap = {};
if(this.updateSlideIndex)
{
}
this.RecalculateCurPos();
this.DrawingDocument.OnRecalculatePage( this.CurPage, this.Slides[this.CurPage] );
this.DrawingDocument.OnEndRecalculate();
......@@ -1011,6 +1006,12 @@ CPresentation.prototype =
this.Recalculate();
},
addChart: function(binary)
{
this.Slides[this.CurPage].graphicObjects.addChart(binary);
this.Recalculate();
},
Add_InlineImage : function(W, H, Img, Chart, bFlow)
{
if ( undefined === bFlow )
......@@ -1071,7 +1072,7 @@ CPresentation.prototype =
Get_ChartObject: function()
{
return this.DrawingObjects.getChartObject();
return this.Slides[this.CurPage].graphicObjects.getChartObject();
},
Add_FlowTable : function(Cols, Rows)
......@@ -1504,24 +1505,7 @@ CPresentation.prototype =
Set_ImageProps : function(Props)
{
// Работаем с колонтитулом
if ( docpostype_HdrFtr === this.CurPos.Type )
{
this.HdrFtr.Set_ImageProps(Props);
}
else if ( docpostype_DrawingObjects === this.CurPos.Type )
{
this.DrawingObjects.setProps( Props );
}
else if ( docpostype_Content == this.CurPos.Type && ( ( true === this.Selection.Use && this.Selection.StartPos == this.Selection.EndPos && type_Table == this.Content[this.Selection.StartPos].GetType() ) || ( false == this.Selection.Use && type_Table == this.Content[this.CurPos.ContentPos].GetType() ) ) )
{
this.Interface_Update_TablePr();
if ( true == this.Selection.Use )
this.Content[this.Selection.StartPos].Set_ImageProps(Props);
else
this.Content[this.CurPos.ContentPos].Set_ImageProps(Props);
}
this.Slides[this.CurPage].graphicObjects.setImageProps(Props);
this.Recalculate();
this.Document_UpdateInterfaceState();
},
......@@ -6398,6 +6382,7 @@ CPresentation.prototype =
return bResult;
},
Save_Changes : function(Data, Writer)
{
Writer.WriteLong( historyitem_type_Document );
......
......@@ -3347,4 +3347,98 @@ CShape.prototype =
{
this.parent = g_oTableId.Get_ById(linkData.parent);
}
};
\ No newline at end of file
};
function CreateBinaryReader(szSrc, offset, srcLen)
{
var nWritten = 0;
var index = -1 + offset;
var dst_len = "";
for( ; index < srcLen; )
{
index++;
var _c = szSrc.charCodeAt(index);
if (_c == ";".charCodeAt(0))
{
index++;
break;
}
dst_len += String.fromCharCode(_c);
}
var dstLen = parseInt(dst_len);
if(isNaN(dstLen))
return null;
var pointer = g_memory.Alloc(dstLen);
var stream = new FT_Stream2(pointer.data, dstLen);
stream.obj = pointer.obj;
var dstPx = stream.data;
if (window.chrome)
{
while (index < srcLen)
{
var dwCurr = 0;
var i;
var nBits = 0;
for (i=0; i<4; i++)
{
if (index >= srcLen)
break;
var nCh = DecodeBase64Char(szSrc.charCodeAt(index++));
if (nCh == -1)
{
i--;
continue;
}
dwCurr <<= 6;
dwCurr |= nCh;
nBits += 6;
}
dwCurr <<= 24-nBits;
for (i=0; i<nBits/8; i++)
{
dstPx[nWritten++] = ((dwCurr & 0x00ff0000) >>> 16);
dwCurr <<= 8;
}
}
}
else
{
var p = b64_decode;
while (index < srcLen)
{
var dwCurr = 0;
var i;
var nBits = 0;
for (i=0; i<4; i++)
{
if (index >= srcLen)
break;
var nCh = p[szSrc.charCodeAt(index++)];
if (nCh == undefined)
{
i--;
continue;
}
dwCurr <<= 6;
dwCurr |= nCh;
nBits += 6;
}
dwCurr <<= 24-nBits;
for (i=0; i<nBits/8; i++)
{
dstPx[nWritten++] = ((dwCurr & 0x00ff0000) >>> 16);
dwCurr <<= 8;
}
}
}
return stream;
}
\ No newline at end of file
......@@ -163,7 +163,7 @@ CTextBody.prototype =
drawingDocument.TargetEnd();
drawingDocument.SelectEnabled(true);
drawingDocument.SelectClear();
this.content.Selection_Draw_Page(this.shape.parent.num);
this.content.Selection_Draw_Page(this.shape.parent ? this.shape.parent.num : this.shape.chartGroup.parent.num);
drawingDocument.SelectShow();
}
else /*if(this.parent.elementsManipulator.Document.CurPos.Type == docpostype_FlowObjects ) */
......@@ -295,7 +295,7 @@ CTextBody.prototype =
Get_StartPage_Absolute: function()
{
return isRealObject(this.shape) && isRealObject(this.shape.parent) && isRealNumber(this.shape.parent.num) ? this.shape.parent.num : 0;
return isRealObject(this.shape) && isRealObject(this.shape.parent) && isRealNumber(this.shape.parent.num) ? this.shape.parent.num : (this.shape.chartGroup ? this.shape.chartGroup.parent.num : 0);
},
Is_HdrFtr: function()
......@@ -369,6 +369,18 @@ CTextBody.prototype =
OnContentRecalculate: function()
{},
writeToBinary: function(w)
{
this.bodyPr.Write_ToBinary2(w);
writeToBinaryDocContent(this.content, w);
},
readFromBinary: function(r, drawingDocument)
{
this.bodyPr.Read_FromBinary2(r);
readFromBinaryDocContent(this.content, r);
},
Undo: function()
{},
......
......@@ -37,6 +37,8 @@ CGraphicObjects.prototype = {
{
case STATES_ID_TEXT_ADD:
case STATES_ID_TEXT_ADD_IN_GROUP:
case STATES_ID_CHART_TEXT_ADD:
{
if(editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Drawing_Props) === false)
{
......@@ -81,6 +83,7 @@ CGraphicObjects.prototype = {
break;
}
}
editor.WordControl.m_oLogicDocument.Recalculate();
},
......@@ -489,6 +492,11 @@ CGraphicObjects.prototype = {
}
},
Set_ImageProps: function(Props)
{
},
getSelectedArraysByTypes: function()
{
var selected_objects = this.selectedObjects;
......@@ -1108,6 +1116,24 @@ CGraphicObjects.prototype = {
},
getChartObject: function()
{
var selected_arr = this.selectedObjects;
for(var i = 0; i < selected_arr.length; ++i)
{
if(selected_arr[i].chart != null)
return selected_arr[i];
}
var ret = new CChartAsGroup();
ret.chart.initDefault();
ret.spPr.xfrm.offX = 0;
ret.spPr.xfrm.offY = 0;
ret.spPr.xfrm.extX = this.slide.Width*2/3;//ditor.WordControl.m_oDrawingDocument.GetMMPerDot(c_oAscChartDefines.defaultChartWidth);
ret.spPr.xfrm.extY = 0.593*this.slide.Height;//ditor.WordControl.m_oDrawingDocument.GetMMPerDot(c_oAscChartDefines.defaultChartHeight);
return ret;
},
shapeApply: function(properties)
{
......@@ -1217,6 +1243,15 @@ CGraphicObjects.prototype = {
editor.WordControl.m_oLogicDocument.recalcMap[image.Id] = image;
},
addChart: function(binary)
{
var chart = new CChartAsGroup(this.slide);
chart.initFromBinary(binary);
this.slide.addSp(chart);
editor.WordControl.m_oLogicDocument.recalcMap[chart.Id] = chart;
},
addNewParagraph: function(bRecalc)
{
......
......@@ -273,6 +273,11 @@ var historyitem_SetShapeSetGeometry = 9;
var historyitem_SetShapeBodyPr = 10;
//Типы изменений в классе CChartAsGroup
var historyitem_SetCahrtLayout = 0;
......@@ -345,6 +350,7 @@ var historyitem_type_Chart = 24;
var historyitem_type_HdrFtrGrObjects = 25;
var historyitem_type_GrObjects = 26;
var historyitem_type_Hyperlink = 27;
var historyitem_type_ChartTitle = 28;
function CHistory(Document)
......
......@@ -157,7 +157,7 @@ function NullState(drawingObjectsController, drawingObjects)
cur_drawing.selectionSetStart(e, x, y);
this.drawingObjectsController.changeCurrentState(new TextAddState(this.drawingObjectsController, this.drawingObjects, cur_drawing));
if(e.ClickCount < 2)
this.drawingObjectsController.updateSelectionState(this.drawingObjects.drawingDocument);
this.drawingObjectsController.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
return;
}
}
......@@ -193,7 +193,7 @@ function NullState(drawingObjectsController, drawingObjects)
grouped_objects[j].selectionSetStart(e, x, y);
this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, cur_drawing, grouped_objects[j]));
if(e.ClickCount < 2)
grouped_objects[j].updateSelectionState(this.drawingObjects.drawingDocument);
grouped_objects[j].updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
return;
}
}
......@@ -705,7 +705,7 @@ function NullState(drawingObjectsController, drawingObjects)
if(typeof this.textObject.setCellBackgroundColor === "function")
{
this.textObject.setCellBackgroundColor(color);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
}; */
......@@ -753,7 +753,7 @@ function NullState(drawingObjectsController, drawingObjects)
if(typeof this.textObject.insertHyperlink === "function")
{
this.textObject.insertHyperlink(options);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
}
}
......@@ -832,9 +832,10 @@ function MoveInternalChartObjectState(drawingObjectsController, drawingObjects,
History.Create_NewPoint();
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
editor.WordControl.m_oLogicDocument.Recalculate();
this.drawingObjects.OnUpdateOverlay();
this.drawingObjectsController.changeCurrentState(new ChartState(this.drawingObjectsController, this.drawingObjects, this.chartElement.chartGroup));
};
this.onKeyDown = function(e)
......@@ -934,197 +935,203 @@ function ChartState(drawingObjectsController, drawingObjects, chart)
for(var i = drawing_bases.length - 1; i > -1; --i)
{
var cur_drawing_base = drawing_bases[i];
if(cur_drawing_base.isGraphicObject())
var cur_drawing = cur_drawing_base;
if(cur_drawing.isShape() || cur_drawing.isImage())
{
var cur_drawing = cur_drawing_base.graphicObject;
if(cur_drawing.isShape() || cur_drawing.isImage())
var hit_in_inner_area = cur_drawing.hitInInnerArea(x, y);
var hit_in_path = cur_drawing.hitInPath(x, y);
var hit_in_text_rect = cur_drawing.hitInTextRect(x, y);
if(hit_in_inner_area && !hit_in_text_rect || hit_in_path)
{
var hit_in_inner_area = cur_drawing.hitInInnerArea(x, y);
var hit_in_path = cur_drawing.hitInPath(x, y);
var hit_in_text_rect = cur_drawing.hitInTextRect(x, y);
this.chart.resetSelection(this.drawingObjectsController);
if(!(e.CtrlKey || e.ShiftKey))
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
for(var j = 0; j < selected_objects.length; ++j)
{
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createMoveTrack());
}
this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects,x, y, e.ShiftKey, e.ctrl, cur_drawing, false, true));
this.drawingObjects.OnUpdateOverlay();
return;
}
else if(hit_in_text_rect)
{
//TODO
}
}
if(cur_drawing.isGroup())
{
var grouped_objects = cur_drawing.getArrGraphicObjects();
for(var j = grouped_objects.length - 1; j > -1; --j)
{
var cur_grouped_object = grouped_objects[j];
var hit_in_inner_area = cur_grouped_object.hitInInnerArea(x, y);
var hit_in_path = cur_grouped_object.hitInPath(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)
{
this.chart.resetSelection(this.drawingObjectsController);
this.drawingObjectsController.clearPreTrackObjects();
var is_selected = cur_drawing.selected;
if(!(e.CtrlKey || e.ShiftKey))
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
this.drawingObjects.OnUpdateOverlay();
for(var j = 0; j < selected_objects.length; ++j)
{
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createMoveTrack());
}
this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects,x, y, e.ShiftKey, e.ctrl, cur_drawing, false, true));
this.drawingObjects.OnUpdateOverlay();
this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects,x, y, e.ShiftKey, e.ctrl, cur_drawing, is_selected, true));
return;
}
else if(hit_in_text_rect)
{
//TODO
this.drawingObjectsController.resetSelection();
cur_grouped_object.select(this.drawingObjectsController);
grouped_objects[j].select(cur_grouped_object);
grouped_objects[j].selectionSetStart(e, x, y);
this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, cur_drawing, grouped_objects[j]));
if(e.ClickCount < 2)
grouped_objects[j].updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
return;
}
}
else if(cur_drawing.isGroup())
}
else if(cur_drawing.isChart())
{
if(cur_drawing === this.chart)
{
var grouped_objects = cur_drawing.getArrGraphicObjects();
for(var j = grouped_objects.length - 1; j > -1; --j)
for(var j = 0; j < titles.length; ++j)
{
var cur_grouped_object = grouped_objects[j];
var hit_in_inner_area = cur_grouped_object.hitInInnerArea(x, y);
var hit_in_path = cur_grouped_object.hitInPath(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)
title = titles[j];
if(isRealObject(title))
{
this.chart.resetSelection(this.drawingObjectsController);
if(!(e.CtrlKey || e.ShiftKey))
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
this.drawingObjects.OnUpdateOverlay();
for(var j = 0; j < selected_objects.length; ++j)
if(!title.selected)
{
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createMoveTrack());
if(title.hit(x, y))
{
this.chart.resetSelection();
title.select();
this.drawingObjectsController.clearPreTrackObjects();
this.drawingObjectsController.addPreTrackObject(new MoveTitleInChart(title));
this.drawingObjectsController.changeCurrentState(new PreMoveInternalChartObjectState(this.drawingObjectsController, this.drawingObjects, x, y, title));
this.drawingObjects.OnUpdateOverlay();
return;
}
}
this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects,x, y, e.ShiftKey, e.ctrl, cur_drawing, false, true));
this.drawingObjectsController.OnUpdateOverlay();
return;
}
else if(hit_in_text_rect)
{
//TODO
}
}
}
else if(cur_drawing.isChart())
{
if(cur_drawing === this.chart)
{
for(var j = 0; j < titles.length; ++j)
{
title = titles[j];
if(isRealObject(title))
else
{
if(!title.selected)
if(title.hit(x, y))
{
if(title.hit(x, y))
if(title.hitInTextRect(x, y))
{
this.chart.resetSelection();
title.select();
this.drawingObjectsController.clearPreTrackObjects();
this.drawingObjectsController.addPreTrackObject(new MoveTitleInChart(title));
this.drawingObjectsController.changeCurrentState(new PreMoveInternalChartObjectState(this.drawingObjectsController, this.drawingObjects, x, y, title));
this.drawingObjects.OnUpdateOverlay();
title.selectionSetStart(e, x, y);
this.drawingObjectsController.changeCurrentState(new ChartTextAdd(this.drawingObjectsController, this.drawingObjects, this.chart, title));
if(e.ClickCount < 2)
title.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
return;
}
}
else
{
if(title.hit(x, y))
else
{
if(title.hitInTextRect(x, y))
{
title.selectionSetStart(e, x, y);
this.drawingObjectsController.changeCurrentState(new ChartTextAdd(this.drawingObjectsController, this.drawingObjects, this.chart, title));
if(e.ClickCount < 2)
title.updateSelectionState(this.drawingObjects.drawingDocument);
return;
}
else
{
this.drawingObjectsController.clearPreTrackObjects();
this.drawingObjectsController.addPreTrackObject(new MoveTitleInChart(title));
this.drawingObjectsController.changeCurrentState(new PreMoveInternalChartObjectState(this.drawingObjectsController, this.drawingObjects, x, y, title));
this.drawingObjects.OnUpdateOverlay();
}
return;
this.drawingObjectsController.clearPreTrackObjects();
this.drawingObjectsController.addPreTrackObject(new MoveTitleInChart(title));
this.drawingObjectsController.changeCurrentState(new PreMoveInternalChartObjectState(this.drawingObjectsController, this.drawingObjects, x, y, title));
this.drawingObjects.OnUpdateOverlay();
}
return;
}
}
}
if(cur_drawing.hitInWorkArea(x, y))
}
if(cur_drawing.hitInWorkArea(x, y))
{
this.drawingObjectsController.clearPreTrackObjects();
var is_selected = cur_drawing.selected;
this.chart.resetSelection();
if(!(e.CtrlKey || e.ShiftKey) && !is_selected)
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
this.drawingObjects.OnUpdateOverlay();
for(var j = 0; j < selected_objects.length; ++j)
{
this.drawingObjectsController.clearPreTrackObjects();
var is_selected = cur_drawing.selected;
this.chart.resetSelection();
if(!(e.CtrlKey || e.ShiftKey) && !is_selected)
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
this.drawingObjects.OnUpdateOverlay();
for(var j = 0; j < selected_objects.length; ++j)
{
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createMoveTrack());
}
this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects,x, y, e.ShiftKey, e.ctrl, cur_drawing, is_selected, true));
return;
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createMoveTrack());
}
this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects,x, y, e.ShiftKey, e.ctrl, cur_drawing, is_selected, true));
return;
}
else
}
else
{
if(cur_drawing.hitInWorkArea(x, y))
{
if(cur_drawing.hitInWorkArea(x, y))
if(!e.ShiftKey && !e.CtrlKey)
{
if(!e.ShiftKey && !e.CtrlKey)
if(isRealObject(cur_drawing.chartLegend))
{
//TODO
}
if(isRealObject(cur_drawing.chartLegend))
{
//TODO
}
var object_for_move_in_chart = null;
if(isRealObject(cur_drawing.chartTitle))
var object_for_move_in_chart = null;
if(isRealObject(cur_drawing.chartTitle))
{
if(cur_drawing.chartTitle.hit(x, y))
{
if(cur_drawing.chartTitle.hit(x, y))
{
object_for_move_in_chart = cur_drawing.chartTitle;
}
object_for_move_in_chart = cur_drawing.chartTitle;
}
}
if(isRealObject(cur_drawing.hAxisTitle) && !isRealObject(object_for_move_in_chart))
if(isRealObject(cur_drawing.hAxisTitle) && !isRealObject(object_for_move_in_chart))
{
if(cur_drawing.hAxisTitle.hit(x, y))
{
if(cur_drawing.hAxisTitle.hit(x, y))
{
object_for_move_in_chart = cur_drawing.hAxisTitle;
}
object_for_move_in_chart = cur_drawing.hAxisTitle;
}
}
if(isRealObject(cur_drawing.vAxisTitle) && !isRealObject(object_for_move_in_chart))
if(isRealObject(cur_drawing.vAxisTitle) && !isRealObject(object_for_move_in_chart))
{
if(cur_drawing.vAxisTitle.hit(x, y))
{
if(cur_drawing.vAxisTitle.hit(x, y))
{
object_for_move_in_chart = cur_drawing.vAxisTitle;
}
object_for_move_in_chart = cur_drawing.vAxisTitle;
}
if(isRealObject(object_for_move_in_chart))
{
this.chart.resetSelection();
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
object_for_move_in_chart.select();
this.drawingObjectsController.clearPreTrackObjects();
this.drawingObjectsController.addPreTrackObject(new MoveTitleInChart(object_for_move_in_chart));
this.drawingObjectsController.changeCurrentState(new PreMoveInternalChartObjectState(this.drawingObjectsController, this.drawingObjects, x, y, object_for_move_in_chart));
this.drawingObjects.OnUpdateOverlay();
return;
}
this.drawingObjectsController.clearPreTrackObjects();
var is_selected = cur_drawing.selected;
}
if(isRealObject(object_for_move_in_chart))
{
this.chart.resetSelection();
if(!(e.CtrlKey || e.ShiftKey) && !is_selected)
this.drawingObjectsController.resetSelection();
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
object_for_move_in_chart.select();
this.drawingObjectsController.clearPreTrackObjects();
this.drawingObjectsController.addPreTrackObject(new MoveTitleInChart(object_for_move_in_chart));
this.drawingObjectsController.changeCurrentState(new PreMoveInternalChartObjectState(this.drawingObjectsController, this.drawingObjects, x, y, object_for_move_in_chart));
this.drawingObjects.OnUpdateOverlay();
for(var j = 0; j < selected_objects.length; ++j)
{
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createMoveTrack());
}
this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects,x, y, e.ShiftKey, e.ctrl, cur_drawing, is_selected, true));
return;
}
this.drawingObjectsController.clearPreTrackObjects();
var is_selected = cur_drawing.selected;
this.chart.resetSelection();
if(!(e.CtrlKey || e.ShiftKey) && !is_selected)
this.drawingObjectsController.resetSelection();
cur_drawing.select(this.drawingObjectsController);
this.drawingObjects.OnUpdateOverlay();
for(var j = 0; j < selected_objects.length; ++j)
{
this.drawingObjectsController.addPreTrackObject(selected_objects[j].createMoveTrack());
}
this.drawingObjectsController.changeCurrentState(new PreMoveState(this.drawingObjectsController, this.drawingObjects,x, y, e.ShiftKey, e.ctrl, cur_drawing, is_selected, true));
return;
}
}
}
}
}
}
this.chart.resetSelection(this.drawingObjectsController);
this.drawingObjectsController.resetSelection();
......@@ -1341,17 +1348,17 @@ function ChartTextAdd(drawingObjectsController, drawingObjects, chart, textObjec
this.onMouseMove = function(e, x, y)
{
if(e.which > 0 && e.type === "mousemove")
if(e.IsLocked)
{
this.textObject.selectionSetEnd(e, x, y);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
this.onMouseUp = function(e, x, y)
{
this.textObject.selectionSetEnd(e, x, y);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
};
this.onKeyDown = function(e)
......@@ -1399,7 +1406,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
this.nullState.onMouseDown(e, x, y);
if(this.drawingObjectsController.State.id !== STATES_ID_TEXT_ADD || this.drawingObjectsController.State.id !== STATES_ID_TEXT_ADD_IN_GROUP)
{
this.drawingObjectsController.updateSelectionState(this.drawingObjects.drawingDocument);
this.drawingObjectsController.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1449,7 +1456,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
this.drawingObjects.objectLocker.checkObjects(callback);
// this.textObject.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
// this.drawingObjects.showDrawingObjects(true);
// this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
// this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
};
this.drawSelection = function(drawingDocument)
......@@ -1470,7 +1477,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellFontName(fontName);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1480,7 +1487,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellFontSize(fontSize);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1490,7 +1497,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellBold(isBold);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1500,7 +1507,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellItalic(isItalic);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1510,7 +1517,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellUnderline(isUnderline);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1520,7 +1527,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellStrikeout(isStrikeout);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1530,7 +1537,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellSubscript(isSubscript);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1540,7 +1547,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellSuperscript(isSuperscript);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1550,7 +1557,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellAlign(align);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1560,7 +1567,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellVertAlign(align);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1570,7 +1577,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellTextColor(color);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1590,7 +1597,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.setCellAngle(angle);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1601,7 +1608,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.increaseFontSize();
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1611,7 +1618,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
{
this.textObject.decreaseFontSize();
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -1620,7 +1627,7 @@ function TextAddState(drawingObjectsController, drawingObjects, textObject)
if(typeof this.textObject.insertHyperlink === "function")
{
this.textObject.insertHyperlink(options);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
}
......@@ -2018,20 +2025,27 @@ function TrackNewShapeState(drawingObjectsController, drawingObjects, presetGeom
this.drawingObjectsController.resetSelection();
History.Create_NewPoint();
this.drawingObjectsController.trackEnd();
this.drawingObjectsController.clearTrackObjects();
if(this.presetGeom != "textRect")
if(editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Drawing_Props) === false)
{
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
History.Create_NewPoint();
this.drawingObjectsController.trackEnd();
if(this.presetGeom != "textRect")
{
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
}
else if(isRealObject(this.resultObject))
{
this.drawingObjectsController.changeCurrentState(new TextAddState(this.drawingObjectsController, this.drawingObjects, this.resultObject));
}
this.drawingObjects.presentation.Recalculate();
this.drawingObjects.presentation.DrawingDocument.OnRecalculatePage(this.drawingObjects.num, this.drawingObjects);
}
else if(isRealObject(this.resultObject))
else
{
this.drawingObjectsController.changeCurrentState(new TextAddState(this.drawingObjectsController, this.drawingObjects, this.resultObject));
this.drawingObjectsController.changeCurrentState(new NullState(this.drawingObjectsController, this.drawingObjects));
}
this.drawingObjects.presentation.Recalculate();
this.drawingObjects.presentation.DrawingDocument.OnRecalculatePage(this.drawingObjects.num, this.drawingObjects);
editor.sync_EndAddShape();
this.drawingObjectsController.clearTrackObjects();
this.drawingObjects.OnUpdateOverlay();
};
......@@ -2106,22 +2120,20 @@ function PreMoveState(drawingObjectsController, drawingObjects, startX, startY,
if(!this.ctrl && !this.shift)
{
//if(e.ClickCount > 1)
if(e.ClickCount > 1)
{
var gr_obj = this.majorObject;
if(gr_obj.isChart())
if(gr_obj.chart)
{
this.drawingObjectsController.changeCurrentState(new ExtpectDoubleClickState(this.drawingObjectsController, this.drawingObjects));
return;
/* if(false === this.graphicObjects.document.Document_Is_SelectionLocked(changestype_Drawing_Props, {Type : changestype_2_Element_and_Type , Element : gr_obj.Parent, CheckType : changestype_Paragraph_Content} )) {
var chart = this.graphicObjects.majorGraphicObject.GraphicObj.chart.serializeChart();
chart["themeColors"] = [];
for (var i = 0; i < this.graphicObjects.drawingDocument.GuiControlColorsMap.length; i++) {
chart["themeColors"].push( this.graphicObjects.drawingDocument.GuiControlColorsMap[i].get_hex() );
}
editor.asc_fireCallback("asc_doubleClickOnChart", chart);
} */
if(false === editor.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Drawing_Props, undefined )) {
var graphicObject = gr_obj;
graphicObject.chart.themeColors = [];
for (var i = 0; i < editor.WordControl.m_oDrawingDocument.GuiControlColorsMap.length; i++) {
graphicObject.chart.themeColors.push( editor.WordControl.m_oDrawingDocument.GuiControlColorsMap[i].get_hex() );
}
editor.asc_fireCallback("asc_doubleClickOnChart", graphicObject);
}
}
}
}
......@@ -2548,7 +2560,7 @@ function GroupState(drawingObjectsController, drawingObjects, group)
cur_drawing.selectionSetStart(e, x, y);
this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, this.group, cur_drawing));
if(e.ClickCount < 2)
cur_drawing.updateSelectionState(this.drawingObjects.drawingDocument);
cur_drawing.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
return;
}
}
......@@ -2585,7 +2597,7 @@ function GroupState(drawingObjectsController, drawingObjects, group)
cur_grouped_object.selectionSetStart(e, x, y);
this.drawingObjectsController.changeCurrentState(new TextAddInGroup(this.drawingObjectsController, this.drawingObjects, this.group, cur_drawing));
if(e.ClickCount < 2)
cur_drawing.updateSelectionState(this.drawingObjects.drawingDocument);
cur_drawing.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
return;
}
}
......@@ -2780,7 +2792,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
this.groupState.onMouseDown(e, x, y);
if(this.drawingObjectsController.State.id !== STATES_ID_TEXT_ADD || this.drawingObjectsController.State.id !== STATES_ID_TEXT_ADD_IN_GROUP)
{
this.drawingObjectsController.updateSelectionState(this.drawingObjects.drawingDocument);
this.drawingObjectsController.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2790,14 +2802,14 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
if(e.IsLocked)
{
this.textObject.selectionSetEnd(e, x, y);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
this.onMouseUp = function(e, x, y)
{
this.textObject.selectionSetEnd(e, x, y);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
};
this.drawSelection = function(drawingDocument)
{
......@@ -2833,9 +2845,9 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
this.drawingObjects.objectLocker.checkObjects(callback);
// this.textObject.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
// this.drawingObjects.showDrawingObjects(true);
// this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
// this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
//this.textObject.paragraphAdd(new ParaText(String.fromCharCode(e.charCode)));
//this.drawingObjectsController.updateSelectionState(this.drawingObjects.drawingDocument);
//this.drawingObjectsController.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
//this.drawingObjects.showDrawingObjects(true);
//this.drawingObjects.OnUpdateOverlay();
};
......@@ -2850,7 +2862,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellFontName(fontName);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2860,7 +2872,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellFontSize(fontSize);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2870,7 +2882,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellBold(isBold);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2880,7 +2892,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellItalic(isItalic);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2890,7 +2902,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellUnderline(isUnderline);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2900,7 +2912,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellStrikeout(isStrikeout);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2910,7 +2922,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellSubscript(isSubscript);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2920,7 +2932,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellSuperscript(isSuperscript);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2930,7 +2942,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellAlign(align);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2940,7 +2952,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellVertAlign(align);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2950,7 +2962,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellTextColor(color);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2970,7 +2982,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.setCellAngle(angle);
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2981,7 +2993,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.increaseFontSize();
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -2991,7 +3003,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
{
this.textObject.decreaseFontSize();
this.drawingObjects.showDrawingObjects(true);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
......@@ -3000,7 +3012,7 @@ function TextAddInGroup(drawingObjectsController, drawingObjects, group, textObj
if(typeof this.textObject.insertHyperlink === "function")
{
this.textObject.insertHyperlink(options);
this.textObject.updateSelectionState(this.drawingObjects.drawingDocument);
this.textObject.updateSelectionState(editor.WordControl.m_oLogicDocument.DrawingDocument);
}
};
}
......
......@@ -227,10 +227,8 @@ function MoveTitleInChart(originalObject)
this.trackEnd = function()
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.chartGroup.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.setPosition(this.x, this.y);
this.originalObject.chartGroup.recalculate();
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.chartGroup.Id, new UndoRedoDataShapeRecalc()), null);
}
}
......@@ -283,15 +281,7 @@ function MoveTrackChart(originalObject)
this.trackEnd = function()
{
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformUndo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.x = this.x;
this.originalObject.y = this.y;
this.originalObject.updateDrawingBaseCoordinates();
this.originalObject.setPosition(this.x, this.y);
History.Add(g_oUndoRedoGraphicObjects, historyitem_AutoShapes_RecalculateTransformRedo, null, null, new UndoRedoDataGraphicObjects(this.originalObject.Id, new UndoRedoDataShapeRecalc()), null);
this.originalObject.recalculateTransform();
this.originalObject.calculateTransformTextMatrix();
this.originalObject.setXfrm(this.x, this.y, null, null, null, null, null);
};
}
......@@ -3718,7 +3718,7 @@ asc_docs_api.prototype.sync_slidePropCallback = function(slide)
{
var bg = slide.cSld.Bg;
var obj = new CAscSlideProps();
if (null == bg)
/* if (null == bg)
{
obj.Background = new CAscFill();
obj.Background.type = c_oAscFill.FILL_TYPE_NOFILL;
......@@ -3752,6 +3752,22 @@ asc_docs_api.prototype.sync_slidePropCallback = function(slide)
{
this.WordControl.m_oDrawingDocument.DrawImageTextureFillSlide(_back_fill.fill.RasterImageId);
}
} */
var bgFill = slide.backgroundFill;
if(!bgFill)
{
obj.Background = new CAscFill();
obj.Background.type = c_oAscFill.FILL_TYPE_NOFILL;
}
else
{
obj.Background = CreateAscFill(bgFill);
if (bgFill != null && bgFill.fill != null && bgFill.fill.type == FILL_TYPE_BLIP)
{
this.WordControl.m_oDrawingDocument.DrawImageTextureFillSlide(bgFill.fill.RasterImageId);
}
}
obj.Timing = slide.timing;
......@@ -4229,6 +4245,63 @@ asc_docs_api.prototype.sync_EndAddShape = function()
}
}
// Вставка диаграмм
asc_docs_api.prototype.asc_getChartObject = function()
{
this.isChartEditor = true; // Для совместного редактирования
var graphicObject = this.WordControl.m_oLogicDocument.Get_ChartObject();
for (var i = 0; i < this.WordControl.m_oDrawingDocument.GuiControlColorsMap.length; i++) {
graphicObject.chart.themeColors.push( this.WordControl.m_oDrawingDocument.GuiControlColorsMap[i].get_hex() );
}
return graphicObject;
}
asc_docs_api.prototype.asc_addChartDrawingObject = function(chartBinary)
{
/**/
// Приводим бинарик к объекту типа CChartAsGroup и добавляем объект
if ( isObject(chartBinary) )
{
var binary = chartBinary["binary"];
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Drawing_Props) )
{
History.Create_NewPoint();
this.WordControl.m_oLogicDocument.addChart(binary);
}
}
}
asc_docs_api.prototype.asc_editChartDrawingObject = function(chartBinary)
{
/**/
// Находим выделенную диаграмму и накатываем бинарник
if ( isObject(chartBinary) )
{
var binary = chartBinary["binary"];
if ( false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content) )
{
History.Create_NewPoint();
this.WordControl.m_oLogicDocument.Edit_Chart(binary);
}
}
}
asc_docs_api.prototype.asc_getChartPreviews = function(chartType, chartSubType)
{
if ( this.chartPreviewManager.isReady() ) {
return this.chartPreviewManager.getChartPreviews(chartType, chartSubType);
}
}
asc_docs_api.prototype.sync_closeChartEditor = function()
{
this.asc_fireCallback("asc_onCloseChartEditor");
}
//-----------------------------------------------------------------
// События контекстного меню
......
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