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

удалены лишние файлы

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55906 954022d7-b5bf-4e40-9824-e11837661b57
parent 1d0baa25
var cToRad = Math.PI/(60000*180);
var cToDeg = 1/cToRad;
function Cos(angle)
{
return Math.cos(cToRad*angle);
}
function Sin(angle)
{
return Math.sin(cToRad*angle);
}
function Tan(angle)
{
return Math.tan(cToRad*angle);
}
function ATan(x)
{
return cToDeg*Math.atan(x);
}
function ATan2(y, x)
{
return cToDeg*Math.atan2(y, x);
}
function CAt2(x, y, z)
{
return x*(Math.cos(Math.atan2(z, y)));
}
function SAt2(x, y, z)
{
return x*(Math.sin(Math.atan2(z, y)));
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
var LAYOUT_MODE_EDGE = 0x00;
var LAYOUT_MODE_FACTOR = 0x01;
var LAYOUT_TARGET_INNER = 0x00;
var LAYOUT_TARGET_OUTER = 0x01;
function CChartLayout()
{
this.isManual = false;
this.layoutTarget = null;
this.xMode = null;
this.yMode = null;
this.wMode = null;
this.hMode = null;
this.x = null;
this.y = null;
this.w = null;
this.h = null;
// this.Id = g_oIdCounter.Get_NewId();
// g_oTableId.Add(this, this.Id, null)
}
CChartLayout.prototype =
{
setXMode: function(mode)
{
this.xMode = mode;
},
setYMode: function(mode)
{
this.yMode = mode;
},
setX: function(x)
{
this.x = x;
},
setY: function(y)
{
this.y = y;
},
setIsManual: function(isManual)
{
this.isManual = isManual;
},
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.WriteDouble(this.x);
w.WriteBool(isRealNumber(this.y));
if(isRealNumber(this.y))
w.WriteDouble(this.y);
w.WriteBool(isRealNumber(this.w));
if(isRealNumber(this.w))
w.WriteDouble(this.w);
w.WriteBool(isRealNumber(this.h));
if(isRealNumber(this.h))
w.WriteDouble(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.GetDouble();
if(r.GetBool())
(this.y) = r.GetDouble();
if(r.GetBool())
(this.w) = r.GetDouble();
if(r.GetBool())
(this.h) = r.GetDouble();
},
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;
}
}
},
copy: function()
{},
writeToBinary: 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.WriteDouble(this.x);
w.WriteBool(isRealNumber(this.y));
if(isRealNumber(this.y))
w.WriteDouble(this.y);
w.WriteBool(isRealNumber(this.w));
if(isRealNumber(this.w))
w.WriteDouble(this.w);
w.WriteBool(isRealNumber(this.h));
if(isRealNumber(this.h))
w.WriteDouble(this.h);
},
readFromBinary: 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.GetDouble();
if(r.GetBool())
this.y = r.GetDouble();
if(r.GetBool())
this.w = r.GetDouble();
if(r.GetBool())
this.h = r.GetDouble();
}
};
\ No newline at end of file
var LEGEND_ELEMENT_TYPE_RECT = 0x00;
var LEGEND_ELEMENT_TYPE_LINE = 0x01;
function CLegendEntry()
{
this.bDelete = null;
this.idx = null;
this.txPr = null;
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
CLegendEntry.prototype =
{
Get_Id: function()
{
return this.Id;
},
getObjectType: function()
{
return CLASS_TYPE_LEGEND_ENTRY;
}
};
function CChartLegend()
{
this.chartGroup = null;
this.layout = null;
this.legendEntries = [];
this.legendPos = null;
this.overlay = false;
this.spPr = new CSpPr();
this.txPr = null;
this.x = null;
this.y = null;
this.extX = null;
this.extY = null;
this.calculatedEntry = [];
this.Id = g_oIdCounter.Get_NewId();
g_oTableId.Add(this, this.Id);
}
CChartLegend.prototype =
{
getObjectType: function()
{
return CLASS_TYPE_CHART_LEGEND;
},
Get_Id: function()
{
return this.Id;
},
getStyles: function(level)
{
var styles = new CStyles();
var default_legend_style = new CStyle("defaultLegendStyle", styles.Default, null, styletype_Paragraph);
default_legend_style.TextPr.FontSize = 10;
default_legend_style.TextPr.FontFamily.Name = "Calibri";
default_legend_style.TextPr.Bold = true;
// default_legend_style.TextPr.RFonts. = "Calibri";
//TODO:ParaPr: default_legend_style.ParaPr.Ind
var tx_pr;
if(isRealObject(this.txPr))
{
//TODO
}
styles.Style[styles.Id] = default_legend_style;
return styles;
},
init: function()
{
this.setStartValues();
return;
var chart = this.chartGroup.chart;
var chart_legend = chart.getLegendInfo();
if(chart_legend.length > 0)
{
var shape_type = chart_legend[0].marker === c_oAscLegendMarkerType.Line ? "line" : "rect";
for(var i = 0; i < chart_legend.length; ++i)
{
var legend_entry_obj = chart_legend[i];
var entry_string = legend_entry_obj.text;
var cur_legend_entry = new CLegendEntryGroup(this);
cur_legend_entry.marker = chart_legend[0].marker;
cur_legend_entry.drawingObjects = this.chartGroup.drawingObjects;
cur_legend_entry.textBody = new CTextBody(cur_legend_entry);
cur_legend_entry.idx = i;
for(var key in entry_string)
{
cur_legend_entry.textBody.paragraphAdd(new ParaText(entry_string[key]), false);
}
cur_legend_entry.textBody.content.Reset(0, 0, 30, 30);
cur_legend_entry.textBody.content.Recalculate_Page(0, true);
cur_legend_entry.geometry = CreateGeometry(shape_type);
cur_legend_entry.geometry.Init(5, 5);
cur_legend_entry.brush = new CUniFill();
cur_legend_entry.brush.fill = new CSolidFill();
cur_legend_entry.brush.fill.color.color = new CRGBColor();
cur_legend_entry.brush.fill.color.color.RGBA = {R:legend_entry_obj.color.R, G:legend_entry_obj.color.G, B:legend_entry_obj.color.B, A:255}
}
}
},
draw: function(graphics)
{
for(var i = 0; i < this.calculatedEntry.length; ++i)
{
this.calculatedEntry[i].draw(graphics);
}
},
setStartValues: function()
{
var is_on_history = History.Is_On();
var is_on_table_id = !g_oTableId.m_bTurnOff;
if(is_on_history)
History.TurnOff();
if(is_on_table_id)
g_oTableId.m_bTurnOff = true;
g_oTableId.m_bTurnOff = true;
var chart = this.chartGroup.chart;
var legend_info = chart.getLegendInfo();
this.calculatedEntry.length = 0;
if(legend_info.length > 0)
{
var bullet_type = legend_info[0].marker === c_oAscLegendMarkerType.Line ? "line" : "rect";
for(var i = 0; i < legend_info.length; ++i)
{
var cur_legend_info = legend_info[i];
var legend_entry = this.legendEntries[i];
if(isRealObject(legend_entry) && legend_entry.bDelete === true)
continue;
var entry = new CLegendEntryGroup(this);
entry.bullet = new CShape(null, this.chartGroup.drawingObjects, legend_entry);
var uni_fill = new CUniFill();
uni_fill.setFill(new CSolidFill());
uni_fill.fill.setColor(new CUniColor());
uni_fill.fill.color.setColor(new CRGBColor());
uni_fill.fill.color.setColor(cur_legend_info.color.R*16*16 + cur_legend_info.color.G*16 +cur_legend_info.color.B);
if(bullet_type === "line")
{
entry.bullet.setPresetGeometry("line");
entry.bullet.setUniFill(uni_fill);
}
else
{
entry.bullet.setPresetGeometry("rect");
var shape_fill = new CUniFill();
shape_fill.setFill(new CNoFill());
var shape_line = new CLn();
var line_fill = new CUniFill();
line_fill.setFill(new CNoFill());
shape_line.setFill(line_fill);
entry.bullet.setUniFill(shape_fill);
entry.bullet.setUniLine(shape_line);
entry.bullet.addTextBody(new CTextBody(entry.bullet));
entry.bullet.paragraphAdd(new ParaTextPr({unifill: uni_fill}));
entry.bullet.paragraphAdd(new ParaText(String.fromCharCode(0x00A7)));
}
entry.title = new CShape(null, this.chartGroup.drawingObjects);
entry.title.addTextBody(new CTextBody(entry.title));
for(var i in cur_legend_info.text)
{
entry.title.paragraphAdd(new ParaText(cur_legend_info.text[i]));
}
this.calculatedEntry.push(entry);
}
}
if(is_on_history)
History.TurnOn();
if(is_on_table_id)
g_oTableId.m_bTurnOff = false;
},
setChartGroup: function(chartGroup)
{
this.chartGroup = chartGroup;
},
recalculateInternalPositionsAndExtents: function()
{
this.extX = null;
this.extY = null;
if(isRealObject(this.layout) && isRealNumber(this.layout.w) && isRealNumber(this.layout.h))
{
this.extX = this.chartGroup.extX*this.layout.w;
this.extY = this.chartGroup.extY*this.layout.h;
}
else
{
switch (this.legendPos)
{
case c_oAscChartLegend.right:
case c_oAscChartLegend.left:
{
for(var i = 0; i < this.calculatedEntry.length; ++i)
{
var cur_legend_entry = this.calculatedEntry[i];
}
break;
}
}
}
},
recalculateWithoutLayout: function()
{}
};
function CLegendEntryGroup(legend)
{
this.legend = legend;
this.bullet = null;
this.title = null;
}
CLegendEntryGroup.prototype =
{
setLegendGroup: function(legendGroup)
{
},
getStyles: function()
{
var styles = new CStyles();
var default_style = new CStyle("defaultEntryStyle", null, null, styletype_Paragraph);
default_style.TextPr.themeFont = "Calibri";
default_style.TextPr.FontSize = 10;
//default_style.ParaPr TODO
styles.Style[styles.Id] = default_style;
var legend_style = new CStyle("legend_style", styles.Id-1, null, styletype_Paragraph);
/*TODO*/
styles.Style[styles.Id] = legend_style;
var entry_style = new CStyle("entry_style", styles.Id - 1, null, styletype_Paragraph);
if(isRealObject(this.legendGroup.legendEntries[this.idx]) && isRealObject(this.legendGroup.legendEntries[this.idx].txPr))
{
//TODO
}
styles.Style[styles.Id] = entry_style;
return styles;
},
getBulletStyles: function()
{
},
getTitleStyles: function()
{},
recalculateInternalPosition: function()
{
},
draw: function(graphics)
{
if(isRealObject(this.bullet) && isRealObject(this.title))
{
this.bullet.draw(graphics);
this.title.draw(graphics);
}
}
};
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
function PolyLine (document, pageIndex)
{
this.document = document;
this.pageIndex = pageIndex;
this.arrPoint = [];
this.Matrix = new CMatrixL();
this.TransformMatrix = new CMatrixL();
this.style = CreateDefaultShapeStyle();
this.calculateLine = function()
{
var _calculated_line;
var _theme = this.document.theme;
var colorMap = this.document.clrSchemeMap.color_map;
if(colorMap==null)
colorMap = GenerateDefaultColorMap().color_map;
var RGBA = {R: 0, G: 0, B: 0, A: 255};
if(_theme !== null && typeof _theme === "object" && typeof _theme.getLnStyle === "function"
&& this.style !== null && typeof this.style === "object"
&& this.style.lnRef !== null && typeof this.style.lnRef === "object" && typeof this.style.lnRef.idx === "number"
&& this.style.lnRef.Color !== null && typeof this.style.lnRef.Color.Calculate === "function")
{
_calculated_line = _theme.getLnStyle(this.style.lnRef.idx);
this.style.lnRef.Color.Calculate(_theme, colorMap, {R: 0 , G: 0, B: 0, A: 255});
RGBA = this.style.lnRef.Color.RGBA;
}
else
{
_calculated_line = new CLn();
}
if(_calculated_line.Fill!=null)
{
_calculated_line.Fill.calculate(_theme, colorMap, RGBA) ;
}
this.pen = _calculated_line;
};
this.calculateLine();
this.Draw = function(graphics)
{
graphics.SetIntegerGrid(false);
graphics.transform3(this.Matrix);
var shape_drawer = new CShapeDrawer();
shape_drawer.fromShape(this, graphics);
shape_drawer.draw(this);
};
this.draw = function(g)
{
if(this.arrPoint.length < 2)
{
return;
}
g._m(this.arrPoint[0].x, this.arrPoint[0].y);
for(var i = 1; i < this.arrPoint.length; ++i)
{
g._l(this.arrPoint[i].x, this.arrPoint[i].y);
}
g.ds();
};
this.getLeftTopPoint = function()
{
if(this.arrPoint.length < 1)
return {x: 0, y: 0};
var xMax = this.arrPoint[0].x, yMax = this.arrPoint[0].y, xMin = xMax, yMin = yMax;
var i;
for( i = 1; i<this.arrPoint.length; ++i)
{
if(this.arrPoint[i].x > xMax)
{
xMax = this.arrPoint[i].x;
}
if(this.arrPoint[i].y > yMax)
{
yMax = this.arrPoint[i].y;
}
if(this.arrPoint[i].x < xMin)
{
xMin = this.arrPoint[i].x;
}
if(this.arrPoint[i].y < yMin)
{
yMin = this.arrPoint[i].y;
}
}
return {x: xMin, y: yMin};
};
this.createShape = function(document)
{
var xMax = this.arrPoint[0].x, yMax = this.arrPoint[0].y, xMin = xMax, yMin = yMax;
var i;
var bClosed = false;
if(this.arrPoint.length > 2)
{
var dx = this.arrPoint[0].x - this.arrPoint[this.arrPoint.length-1].x;
var dy = this.arrPoint[0].y - this.arrPoint[this.arrPoint.length-1].y;
if(Math.sqrt(dx*dx +dy*dy) < this.document.DrawingDocument.GetMMPerDot(3))
{
bClosed = true;
}
}
var _n = bClosed ? this.arrPoint.length - 1 : this.arrPoint.length;
for( i = 1; i<_n; ++i)
{
if(this.arrPoint[i].x > xMax)
{
xMax = this.arrPoint[i].x;
}
if(this.arrPoint[i].y > yMax)
{
yMax = this.arrPoint[i].y;
}
if(this.arrPoint[i].x < xMin)
{
xMin = this.arrPoint[i].x;
}
if(this.arrPoint[i].y < yMin)
{
yMin = this.arrPoint[i].y;
}
}
var wordGraphicObject = new ParaDrawing(null, null, null, document.DrawingDocument, null, document);
var wordShape = new WordShape(wordGraphicObject, document, document.DrawingDocument, null);
/*W, H, GraphicObj, Drawing*/
wordGraphicObject.Set_GraphicObject(wordShape);
wordShape.pageIndex = this.pageIndex;
wordShape.setAbsoluteTransform(xMin, yMin, xMax-xMin, yMax-yMin, 0, false, false);
wordShape.setXfrm(0, 0, xMax-xMin, yMax-yMin, 0, false, false);
wordShape.style = CreateDefaultShapeStyle();
var geometry = new CGeometry();
geometry.AddPathCommand(0, undefined, bClosed ? "norm": "none", undefined, xMax - xMin, yMax-yMin);
geometry.AddRect("l", "t", "r", "b");
geometry.AddPathCommand(1, (this.arrPoint[0].x - xMin) + "", (this.arrPoint[0].y - yMin) + "");
for(i = 1; i< _n; ++i)
{
geometry.AddPathCommand(2, (this.arrPoint[i].x - xMin) + "", (this.arrPoint[i].y - yMin) + "");
}
if(bClosed)
{
geometry.AddPathCommand(6);
}
geometry.Init( xMax-xMin, yMax-yMin);
wordShape.spPr.geometry = geometry;
wordShape.calculate();
wordShape.calculateTransformMatrix();
wordGraphicObject.setZIndex();
wordGraphicObject.setPageIndex(this.pageIndex);
var data = {Type:historyitem_CreatePolyine};
data.xMax = xMax;
data.xMin = xMin;
data.yMax = yMax;
data.yMin = yMin;
data.bClosed = bClosed;
data.commands = [];
data.commands.push({id: 1, x: (this.arrPoint[0].x - xMin) + "", y:(this.arrPoint[0].y - yMin) + ""});
for(i = 1; i< _n; ++i)
{
data.commands.push({id: 2, x: (this.arrPoint[i].x - xMin) + "", y:(this.arrPoint[i].y - yMin) + ""});
}
History.Add(wordShape, data);
History.Add(wordGraphicObject, {Type: historyitem_CalculateAfterPaste});
return wordGraphicObject;
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
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