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()
......
This diff is collapsed.
......@@ -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)
......
This diff is collapsed.
......@@ -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