Commit 420f9a0e 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@58564 954022d7-b5bf-4e40-9824-e11837661b57
parent b2611336
......@@ -1113,6 +1113,7 @@ CChartSpace.prototype =
copy.setUserShapes(this.userShapes);
copy.setThemeOverride(this.themeOverride);
copy.setBDeleted(this.bDeleted);
copy.cachedImage = this.getBase64Img();
return copy;
},
......@@ -1123,10 +1124,11 @@ CChartSpace.prototype =
convertToPPTX: function(drawingDocument, worksheet)
{
this.setBDeleted(false);
this.setWorksheet(worksheet);
this.setParent(null);
return this;
var copy = this.copy(drawingDocument)
copy.setBDeleted(false);
copy.setWorksheet(worksheet);
copy.setParent(null);
return copy;
},
rebuildSeriesFromAsc: function(asc_chart)
......@@ -1761,8 +1763,22 @@ CChartSpace.prototype =
this.group = group;
},
getBase64Img: function () {
return ShapeToImageConverter(this, this.pageIndex).ImageUrl;
getBase64Img: function ()
{
if(typeof this.cachedImage === "string")
{
return this.cachedImage;
}
var img_object = ShapeToImageConverter(this, this.pageIndex);
if(img_object)
{
return img_object.ImageUrl;
}
else
{
return "";
}
},
getRangeObjectStr: function()
......@@ -9747,9 +9763,6 @@ CChartSpace.prototype =
|| bounds.y + bounds.h < rect.y)
return;
}
var pix= 3*this.convertPixToMM(1);
var intGrid = graphics.GetIntegerGrid();
graphics.SaveGrState();
graphics.SetIntegerGrid(false);
graphics.transform3(this.transform, false);
......
......@@ -11106,48 +11106,8 @@ function CSld()
this.name = "";
this.Bg = null;
this.spTree = [];//new GroupShape();
this.merge = function(cSld)
{
};
this.createFullCopy = function(parent, elementsManipulator)
{
var _copy = new CSld();
_copy.name = this.name;
if(this.Bg != null)
{
_copy.Bg = this.Bg.createFullCopy();
}
var _glyph_index;
for(_glyph_index = 0; _glyph_index < this.spTree.length; ++_glyph_index)
{
if(typeof this.spTree[_glyph_index].createFullCopy === "function")
{
_copy.spTree[_glyph_index] = this.spTree[_glyph_index].createFullCopy(parent, elementsManipulator);
_copy.spTree[_glyph_index].Recalculate();
_copy.spTree[_glyph_index].updateCursorTypes();
}
}
return _copy;
};
}
CSld.prototype =
{
Get_Id: function()
{
return this.Id;
},
Refresh_RecalcData: function()
{}
};
// ----------------------------------
// MASTERSLIDE ----------------------
......
......@@ -234,6 +234,7 @@ CGroupShape.prototype =
copy.spTree[copy.spTree.length-1].setGroup(copy);
}
copy.setBDeleted(this.bDeleted);
copy.cachedImage = this.getBase64Img();
return copy;
},
......@@ -266,45 +267,27 @@ CGroupShape.prototype =
return commonSearchResults.length > 0 ? commonSearchResults : null;
},
getSelectedArraysByTypes: function()
{
var selected_objects = this.selectedObjects;
var tables = [], charts = [], shapes = [], images = [], groups = [];
for(var i = 0; i < selected_objects.length; ++i)
{
var selected_object = selected_objects[i];
if(typeof selected_object.isTable === "function" && selected_object.isTable())
{
tables.push(selected_object);
}
else if(typeof selected_object.isChart === "function" && selected_object.isChart())
{
charts.push(selected_object);
}
else if(selected_object.isShape())
{
shapes.push(selected_object);
}
else if(selected_object.isImage())
{
images.push(selected_object);
}
else if(typeof selected_object.isGroup())
{
groups.push(selected_object);
}
}
return {tables: tables, charts: charts, shapes: shapes, images: images, groups: groups};
},
getBoundsInGroup: function()
{
return getBoundsInGroup(this);
},
getBase64Img: function()
getBase64Img: function ()
{
return ShapeToImageConverter(this, this.pageIndex).ImageUrl;
if(typeof this.cachedImage === "string")
{
return this.cachedImage;
}
var img_object = ShapeToImageConverter(this, this.pageIndex);
if(img_object)
{
return img_object.ImageUrl;
}
else
{
return "";
}
},
convertToWord: function(document)
......@@ -325,13 +308,14 @@ CGroupShape.prototype =
convertToPPTX: function(drawingDocument, worksheet)
{
var sp_tree_copy = [].concat(this.spTree), i;
this.setWorksheet(worksheet);
this.setParent(null);
this.setBDeleted(false);
for(i = this.spTree.length-1; i > -1; --i)
{
this.removeFromSpTreeByPos(i);
}
this.setWorksheet(worksheet);
this.setParent(null);
this.setBDeleted(false);
for(i = 0; i < sp_tree_copy.length; ++i)
{
this.addToSpTree(this.spTree.length, sp_tree_copy[i].convertToPPTX(drawingDocument, worksheet));
......@@ -780,6 +764,7 @@ CGroupShape.prototype =
recalculateTransform: function()
{
this.cachedImage = null;
var xfrm;
if(this.spPr.xfrm.isNotNullForGroup())
xfrm = this.spPr.xfrm;
......@@ -1075,88 +1060,6 @@ CGroupShape.prototype =
return null;
},
getArraysByTypes: function()
{
var selected_objects = this.arrGraphicObjects;
var tables = [], charts = [], shapes = [], images = [];
for(var i = 0; i < selected_objects.length; ++i)
{
var selected_object = selected_objects[i];
if(typeof selected_object.isTable === "function" && selected_object.isTable())
{
tables.push(selected_object);
}
else if(typeof selected_object.isChart === "function" && selected_object.isChart())
{
charts.push(selected_object);
}
else if(selected_object.isShape())
{
shapes.push(selected_object);
}
else if(typeof selected_object.isImage())
{
images.push(selected_object);
}
}
return {tables: tables, charts: charts, shapes: shapes, images: images};
},
calculateCompiledVerticalAlign: function()
{
var _shapes = this.spTree;
var _shape_index;
var _result_align = null;
var _cur_align;
for(_shape_index = 0; _shape_index < _shapes.length; ++ _shape_index)
{
var _shape = _shapes[_shape_index];
if(_shape instanceof CShape)
{
if(_shape.txBody && _shape.txBody.compiledBodyPr && typeof (_shape.txBody.compiledBodyPr.anchor) == "number")
{
_cur_align = _shape.txBody.compiledBodyPr.anchor;
if(_result_align === null)
{
_result_align = _cur_align;
}
else
{
if(_result_align !== _cur_align)
{
return null;
}
}
}
else
{
return null;
}
}
if(_shape instanceof CGroupShape)
{
_cur_align = _shape.calculateCompiledVerticalAlign();
if(_cur_align === null)
{
return null;
}
if(_result_align === null)
{
_result_align = _cur_align;
}
else
{
if(_result_align !== _cur_align)
{
return null;
}
}
}
}
return _result_align;
},
setVerticalAlign : function(align)
{
for(var _shape_index = 0; _shape_index < this.spTree.length; ++_shape_index)
......@@ -1211,9 +1114,6 @@ CGroupShape.prototype =
return {kd1: 1, kd2: 1};
},
changePresetGeom: function(preset)
{
for(var _shape_index = 0; _shape_index < this.spTree.length; ++_shape_index)
......@@ -1236,7 +1136,6 @@ CGroupShape.prototype =
}
},
changeLine: function(line)
{
for(var _shape_index = 0; _shape_index < this.spTree.length; ++_shape_index)
......@@ -1414,7 +1313,6 @@ CGroupShape.prototype =
}
},
select: CShape.prototype.select,
deselect: function(drawingObjectsController)
......@@ -1442,7 +1340,6 @@ CGroupShape.prototype =
return parents;
},
getCardDirectionByNum: function(num)
{
var num_north = this.getNumByCardDirection(CARD_DIRECTION_N);
......@@ -1455,7 +1352,6 @@ CGroupShape.prototype =
return (CARD_DIRECTION_N - (num - num_north)+ 8)%8;
},
getNumByCardDirection: function(cardDirection)
{
var hc = this.extX*0.5;
......@@ -1507,7 +1403,6 @@ CGroupShape.prototype =
return num === 0 || num === 4 ? _tmp_x/_tmp_y : _tmp_y/_tmp_x;
},
getFullFlipH: function()
{
if(!isRealObject(this.group))
......
......@@ -35,7 +35,6 @@ function CImageShape()
g_oTableId.Add( this, this.Id );
}
CImageShape.prototype =
{
Get_Id: function()
......@@ -112,6 +111,7 @@ CImageShape.prototype =
copy.setBlipFill(this.blipFill.createDuplicate());
}
copy.setBDeleted(this.bDeleted);
copy.cachedImage = this.getBase64Img();
return copy;
},
......@@ -178,8 +178,6 @@ CImageShape.prototype =
return false;
},
isShape: function()
{
return false;
......@@ -190,7 +188,6 @@ CImageShape.prototype =
return true;
},
isChart: function()
{
return false;
......@@ -207,18 +204,12 @@ CImageShape.prototype =
return {hit: false, num: -1, polar: false};
},
getParentObjects: CShape.prototype.getParentObjects,
hitInPath: CShape.prototype.hitInPath,
hitInInnerArea: CShape.prototype.hitInInnerArea,
getRotateAngle: CShape.prototype.getRotateAngle,
changeSize: CShape.prototype.changeSize,
getFullFlipH: function()
{
if(!isRealObject(this.group))
......@@ -275,24 +266,6 @@ CImageShape.prototype =
return {minX: min_x, maxX: max_x, minY: min_y, maxY: max_y};
},
getImageProps: function()
{
var _result_image_props = {};
_result_image_props.Width = this.extX;
_result_image_props.Height = this.extY;
_result_image_props.Position = {X: this.x, Y: this.y};
_result_image_props.Paddings = {Left: this.x, Top: this.y, Right: this.x + this.extX, Bottom: this.y + this.extY};
if(this.blipFill && this.blipFill.fill && this.blipFill.fill.RasterImageId)
{
_result_image_props.ImageUrl = this.blipFill.fill.RasterImageId;
}
if(!isRealObject(this.group))
{
_result_image_props.IsLocked = !(this.Lock.Type === locktype_None || this.Lock.Type === locktype_Mine);
}
return _result_image_props;
},
canRotate: function()
{
......@@ -366,10 +339,22 @@ CImageShape.prototype =
return false;
},
getBase64Img: function()
getBase64Img: function ()
{
return ShapeToImageConverter(this, this.pageIndex).ImageUrl;
if(typeof this.cachedImage === "string")
{
return this.cachedImage;
}
var img_object = ShapeToImageConverter(this, this.pageIndex);
if(img_object)
{
return img_object.ImageUrl;
}
else
{
return "";
}
},
convertToWord: function(document)
......@@ -439,6 +424,7 @@ CImageShape.prototype =
},
recalculateTransform: function()
{
this.cachedImage = null;
if(!isRealObject(this.group))
{
if(this.spPr.xfrm.isNotNull())
......@@ -718,9 +704,6 @@ CImageShape.prototype =
{
},
hitToAdjustment: function()
{
return {hit:false};
......@@ -746,22 +729,12 @@ CImageShape.prototype =
return this.isPlaceholder() ? this.nvPicPr.nvPr.ph.idx : null;
},
setNvSpPr: function(pr)
{
History.Add(this, {Type: historyitem_ImageShapeSetNvPicPr, oldPr: this.nvPicPr, newPr: pr});
this.nvPicPr = pr;
},
setStyle: function(style)
{
History.Add(this, {Type:historyitem_SetSetStyle, oldPr: this.style, newPr:style});
this.style = style;
},
getAllImages: function(images)
{
if(this.blipFill && this.blipFill.fill instanceof CBlipFill && typeof this.blipFill.fill.RasterImageId === "string")
......@@ -1024,7 +997,6 @@ CImageShape.prototype =
}
},
Load_LinkData: function(linkData)
{
}
......
......@@ -161,6 +161,7 @@ function CShape()
this.localTransform = new CMatrix();
this.localTransformText = new CMatrix();
this.worksheet = null;
this.cachedImage = null;
this.setRecalculateInfo();
......@@ -638,7 +639,6 @@ CShape.prototype =
return false;
},
isShape: function () {
return true;
},
......@@ -784,7 +784,6 @@ CShape.prototype =
}
},
getSelectedTextInfo: function(info)
{
var content = this.getDocContent();
......@@ -867,8 +866,6 @@ CShape.prototype =
return isRealObject(this.nvSpPr) && isRealObject(this.nvSpPr.nvPr) && isRealObject(this.nvSpPr.nvPr.ph);
},
getPlaceholderType: function () {
return this.isPlaceholder() ? this.nvSpPr.nvPr.ph.type : null;
},
......@@ -1672,6 +1669,7 @@ CShape.prototype =
}
copy.setWordShape(this.bWordShape);
copy.setBDeleted(this.bDeleted);
copy.cachedImage = this.getBase64Img();
return copy;
},
......@@ -1987,6 +1985,7 @@ CShape.prototype =
recalculateTransform: function () {
this.cachedImage = null;
this.recalculateLocalTransform(this.transform);
this.invertTransform = global_MatrixTransformer.Invert(this.transform);
if(this.drawingBase && !this.group)
......@@ -2150,18 +2149,6 @@ CShape.prototype =
return { x: this.x, y: this.y, extX: this.extX, extY: this.extY, rot: this.rot, flipH: this.flipH, flipV: this.flipV };
},
getRotateTrackObject: function () {
return new RotateTrackShape(this);
},
getResizeTrackObject: function (cardDirection) {
return new CResizeShapeTrack(this, cardDirection);
},
getCardDirection: function (num) {
},
getAngle: function (x, y) {
var px = this.invertTransform.TransformPointX(x, y);
var py = this.invertTransform.TransformPointY(x, y);
......@@ -2304,7 +2291,6 @@ CShape.prototype =
return { kd1: 1, kd2: 1 };
},
select: function (drawingObjectsController, pageIndex)
{
this.selected = true;
......@@ -2550,8 +2536,6 @@ CShape.prototype =
}
},
normalize: function () {
var new_off_x, new_off_y, new_ext_x, new_ext_y;
var xfrm = this.spPr.xfrm;
......@@ -2591,22 +2575,29 @@ CShape.prototype =
},
getBase64Img: function () {
return ShapeToImageConverter(this, this.pageIndex).ImageUrl;
},
getBase64Img: function ()
{
if(typeof this.cachedImage === "string")
{
return this.cachedImage;
}
var img_object = ShapeToImageConverter(this, this.pageIndex);
if(img_object)
{
return img_object.ImageUrl;
}
else
{
onParagraphChanged: function () {
this.recalcInfo.recalculateContent = true;
this.recalcInfo.recalculateTransformText = true;
return "";
}
},
isSimpleObject: function () {
return true;
},
draw: function (graphics, transform, transformText, pageIndex) {
if(graphics.updatedRect && this.bounds)
......@@ -2922,7 +2913,6 @@ CShape.prototype =
return { minX: min_x, maxX: max_x, minY: min_y, maxY: max_y };
},
getInvertTransform: function ()
{
return this.invertTransform ? this.invertTransform : new CMatrix();
......@@ -3266,16 +3256,6 @@ CShape.prototype =
this.spPr.setLn(stroke);
},
setLine: function (line) {
var old_line = this.spPr.ln;
var new_line = line;
this.spPr.ln = line;
this.recalcInfo.recalculateLine = true;
this.recalcInfo.recalculatePen = true;
},
hitToAdjustment: function (x, y) {
var invert_transform = this.getInvertTransform();
var t_x, t_y;
......@@ -3321,7 +3301,6 @@ CShape.prototype =
return false;
},
hitInBoundingRect: function (x, y) {
var invert_transform = this.getInvertTransform();
var x_t = invert_transform.TransformPointX(x, y);
......@@ -3384,8 +3363,6 @@ CShape.prototype =
return new MoveShapeImageTrackInGroup(this);
},
remove: function (Count, bOnlyText, bRemoveOnlySelection) {
if (this.txBody) {
this.txBody.content.Remove(Count, bOnlyText, bRemoveOnlySelection);
......
......@@ -354,15 +354,12 @@ CTextBody.prototype =
}
},
Write_ToBinary2: function(w)
{
w.WriteLong(historyitem_type_TextBody);
w.WriteString2(this.Id);
},
Read_FromBinary2: function(r)
{
this.Id = r.GetString2();
......@@ -373,7 +370,6 @@ CTextBody.prototype =
},
recalculateBodyPr: function()
{
ExecuteNoHistory(function()
......@@ -413,8 +409,6 @@ CTextBody.prototype =
}
},
isEmpty: function()
{
return this.content.Is_Empty();
......@@ -423,7 +417,6 @@ CTextBody.prototype =
OnContentReDraw: function()
{},
Get_StartPage_Absolute: function()
{
return 0;//TODO;
......@@ -444,7 +437,6 @@ CTextBody.prototype =
return {X: 0, Y: 0, XLimit: this.contentWidth, YLimit: 20000};
},
Get_Numbering: function()
{
return new CNumbering();
......@@ -458,11 +450,11 @@ CTextBody.prototype =
}
},
checkDocContent: function()
{
this.parent && this.parent.checkDocContent && this.parent.checkDocContent();
},
getBodyPr: function()
{
if(this.recalcInfo.recalculateBodyPr)
......@@ -473,13 +465,11 @@ CTextBody.prototype =
return this.compiledBodyPr;
},
getSummaryHeight: function()
{
return this.content.Get_SummaryHeight();
},
getSummaryHeight2: function()
{
return this.content2 ? this.content2.Get_SummaryHeight() : 0;
......@@ -491,9 +481,6 @@ CTextBody.prototype =
return this.compiledBodyPr;
},
addPhContent: function(phType)
{},
Get_TableStyleForPara: function()
{
return null;
......@@ -545,11 +532,10 @@ CTextBody.prototype =
{
return false;
},
OnContentRecalculate: function()
{},
getMargins: function ()
{
var _parent_transform = this.parent.transform;
......@@ -592,7 +578,6 @@ CTextBody.prototype =
return {L : xc - hc , T: yc - vc , R : xc + hc , B : yc + vc, textMatrix : this.parent.transform};
},
Refresh_RecalcData2: function(pageIndex)
{
this.parent && this.parent.Refresh_RecalcData2 && this.parent.Refresh_RecalcData2(pageIndex, this);
......@@ -640,17 +625,6 @@ CTextBody.prototype =
return max_width + 2 + r_ins + l_ins;
},
getRectHeight: function(maxHeight, width)
{
this.content.RecalculateNumbering();
this.content.Reset(0, 0, width, 20000);
this.content.Recalculate_Page(0, true);
var content_height = this.getSummaryHeight();
var t_ins = isRealNumber(this.bodyPr.tIns) ? this.bodyPr.tIns : 1.27;
var b_ins = isRealNumber(this.bodyPr.bIns) ? this.bodyPr.bIns : 1.27;
return content_height + t_ins + b_ins;
},
getMaxContentWidth: function(maxWidth, bLeft)
{
this.content.Reset(0, 0, maxWidth - 0.01, 20000);
......
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