Skip to content

Commit

Permalink
Merge pull request #3277 from ONLYOFFICE/fix/bug59888
Browse files Browse the repository at this point in the history
Fix/bug59888
  • Loading branch information
SergeyLuzyanin committed Jan 25, 2023
2 parents e252f64 + 18def1c commit 1d161bd
Show file tree
Hide file tree
Showing 17 changed files with 331 additions and 124 deletions.
2 changes: 2 additions & 0 deletions common/Charts/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,8 @@ ChartPreviewManager.prototype.getChartPreviews = function(chartType, arrId, bEmp
SmartArtPreviewDrawer.prototype.getSmartArt = function(nSmartArtType) {
return AscFormat.ExecuteNoHistory(function () {
const oSmartArt = new AscFormat.SmartArt();
oSmartArt.bNeedUpdatePosition = false;
oSmartArt.bFirstRecalculate = false;
const oApi = Asc.editor || editor;
oSmartArt.bForceSlideTransform = true;
oSmartArt.fillByPreset(nSmartArtType, true);
Expand Down
1 change: 1 addition & 0 deletions common/Drawings/Format/ChartSpace.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ var GLOBAL_PATH_COUNT = 0;
oClass.bDeleted = value;
};
drawingsChangesMap[AscDFH.historyitem_ChartSpace_SetParent] = function(oClass, value) {
oClass.oldParent = oClass.parent;
oClass.parent = value;
};
drawingsChangesMap[AscDFH.historyitem_ChartSpace_SetChart] = function(oClass, value) {
Expand Down
42 changes: 26 additions & 16 deletions common/Drawings/Format/Data.js
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ Because of this, the display is sometimes not correct.
}

Point.prototype.getShape = function () {
if (this.parent && this.parent.parent instanceof CShape) {
if (this.parent && this.parent.parent instanceof AscFormat.CShape) {
return this.parent.parent;
}
}
Expand Down Expand Up @@ -10062,6 +10062,7 @@ Because of this, the display is sometimes not correct.
CBaseFormatObject.call(this);
this.shapePoint = null;
this.contentPoint = [];
this.maxFontSize = null;
}
InitClass(ShapeSmartArtInfo, CBaseFormatObject, AscDFH.historyitem_type_ShapeSmartArtInfo);

Expand All @@ -10085,6 +10086,9 @@ Because of this, the display is sometimes not correct.
nIdx === this.contentPoint.length - 1 ? this.contentPoint.pop() : this.contentPoint.splice(nIdx, 1);
}
}
ShapeSmartArtInfo.prototype.setMaxFontSize = function (oPr) {
this.maxFontSize = oPr;
}

changesFactory[AscDFH.historyitem_SmartArtColorsDef] = CChangeObject;
changesFactory[AscDFH.historyitem_SmartArtDrawing] = CChangeObject;
Expand Down Expand Up @@ -10112,6 +10116,7 @@ Because of this, the display is sometimes not correct.
oClass.styleDef = value;
};
drawingsChangesMap[AscDFH.historyitem_SmartArtParent] = function (oClass, value) {
oClass.oldParent = oClass.parent;
oClass.parent = value;
};

Expand All @@ -10127,6 +10132,7 @@ Because of this, the display is sometimes not correct.
this.bNeedUpdatePosition = true;

this.calcGeometry = null;
this.bFirstRecalculate = true;
}

InitClass(SmartArt, CGroupShape, AscDFH.historyitem_type_SmartArt);
Expand Down Expand Up @@ -10187,19 +10193,22 @@ Because of this, the display is sometimes not correct.
}

SmartArt.prototype.recalculate = function () {
var oldParaMarks = editor && editor.ShowParaMarks;
if (oldParaMarks) {
editor.ShowParaMarks = false;
}
CGroupShape.prototype.recalculate.call(this);
if (this.group && this.bNeedUpdatePosition) {
this.bNeedUpdatePosition = false;
var group = this.getMainGroup();
group.updateCoordinatesAfterInternalResize();
}
if (oldParaMarks) {
editor.ShowParaMarks = oldParaMarks;
}
if(this.bDeleted)
return;
AscFormat.ExecuteNoHistory(function () {
var oldParaMarks = editor && editor.ShowParaMarks;
if (oldParaMarks) {
editor.ShowParaMarks = false;
}
CGroupShape.prototype.recalculate.call(this);
if (this.bFirstRecalculate) {
this.bFirstRecalculate = false;
this.fitFontSize();
}
if (oldParaMarks) {
editor.ShowParaMarks = oldParaMarks;
}
}, this, []);
}

SmartArt.prototype.decorateParaDrawing = function (drawingObjects) {
Expand Down Expand Up @@ -10268,8 +10277,9 @@ Because of this, the display is sometimes not correct.

SmartArt.prototype.fitFontSize = function () {
this.spTree[0] && this.spTree[0].spTree.forEach(function (oShape) {
oShape.recalculateContent2()
oShape.findFitFontSizeForSmartArt();
oShape.recalculateContentWitCompiledPr();
oShape.setTruthFontSizeInSmartArt();
oShape.recalculateContentWitCompiledPr();
});
};

Expand Down
22 changes: 12 additions & 10 deletions common/Drawings/Format/DrawingContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -788,17 +788,19 @@
}
}
};
CDrawingDocContent.prototype.Is_Empty = function()
CDrawingDocContent.prototype.Is_Empty = function(bDefault)
{
if (this.isDocumentContentInSmartArtShape()) {
var oShape = this.Parent.parent;
var contentPoints = oShape.getSmartArtPointContent();
if (contentPoints && contentPoints.length !== 0) {
var isPhldr = contentPoints.every(function (point) {
return point && point.prSet && point.prSet.phldr;
});
if (isPhldr) {
return true;
if (!bDefault) {
if (this.isDocumentContentInSmartArtShape()) {
var oShape = this.Parent.parent;
var contentPoints = oShape.getSmartArtPointContent();
if (contentPoints && contentPoints.length !== 0) {
var isPhldr = contentPoints.every(function (point) {
return point && point.prSet && point.prSet.phldr;
});
if (isPhldr) {
return true;
}
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion common/Drawings/Format/GraphicFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ var History = AscCommon.History;
}
};
window['AscDFH'].drawingsChangesMap[AscDFH.historyitem_GraphicFrameSetSetNvSpPr] = function(oClass, value){oClass.nvGraphicFramePr = value;};
window['AscDFH'].drawingsChangesMap[AscDFH.historyitem_GraphicFrameSetSetParent] = function(oClass, value){oClass.parent = value;};
window['AscDFH'].drawingsChangesMap[AscDFH.historyitem_GraphicFrameSetSetParent] = function(oClass, value){
oClass.oldParent = oClass.parent;
oClass.parent = value;
};
window['AscDFH'].drawingsChangesMap[AscDFH.historyitem_GraphicFrameSetSetGroup] = function(oClass, value){oClass.group = value;};

AscDFH.changesFactory[AscDFH.historyitem_GraphicFrameSetSpPr] = AscDFH.CChangesDrawingsObject;
Expand Down
5 changes: 4 additions & 1 deletion common/Drawings/Format/GroupShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ var CShape = AscFormat.CShape;

AscDFH.drawingsChangesMap[AscDFH.historyitem_GroupShapeSetNvGrpSpPr] = function(oClass, value){oClass.nvGrpSpPr = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_GroupShapeSetSpPr] = function(oClass, value){oClass.spPr = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_GroupShapeSetParent] = function(oClass, value){oClass.parent = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_GroupShapeSetParent] = function(oClass, value){
oClass.oldParent = oClass.parent;
oClass.parent = value;
};
AscDFH.drawingsChangesMap[AscDFH.historyitem_GroupShapeSetGroup] = function(oClass, value){oClass.group = value;};

AscDFH.drawingContentChanges[AscDFH.historyitem_GroupShapeAddToSpTree] = AscDFH.drawingContentChanges[AscDFH.historyitem_GroupShapeRemoveFromSpTree] = function(oClass){return oClass.spTree;};
Expand Down
5 changes: 4 additions & 1 deletion common/Drawings/Format/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ var isRealObject = AscCommon.isRealObject;
}
}
};
AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetParent] = function(oClass, value){oClass.parent = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetParent] = function(oClass, value){
oClass.oldParent = oClass.parent;
oClass.parent = value;
};
AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetGroup] = function(oClass, value){oClass.group = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetStyle] = function(oClass, value){oClass.style = value;};
AscDFH.drawingsChangesMap[AscDFH.historyitem_ImageShapeSetNvPicPr] = function(oClass, value){oClass.nvPicPr = value;};
Expand Down
Loading

0 comments on commit 1d161bd

Please sign in to comment.