Skip to content

Commit

Permalink
Merge pull request #3617 from ONLYOFFICE/feature/pe-transform-transition
Browse files Browse the repository at this point in the history
Feature/pe transform transition
  • Loading branch information
SergeyLuzyanin authored Jul 18, 2023
2 parents 49752e1 + 815f458 commit 5fba2ed
Show file tree
Hide file tree
Showing 32 changed files with 3,553 additions and 1,335 deletions.
29 changes: 16 additions & 13 deletions cell/view/DrawingObjectsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,17 @@ DrawingObjectsController.prototype.getDrawingArray = function()

DrawingObjectsController.prototype.setTableProps = function(props)
{
var by_type = this.getSelectedObjectsByTypes();
let by_type = this.getSelectedObjectsByTypes();
if(by_type.tables.length === 1)
{
var sCaption = props.TableCaption;
var sDescription = props.TableDescription;
var dRowHeight = props.RowHeight;
by_type.tables[0].setTitle(sCaption);
by_type.tables[0].setDescription(sDescription);
let sCaption = props.TableCaption;
let sDescription = props.TableDescription;
let sName = props.TableName;
let dRowHeight = props.RowHeight;
let oTable = by_type.tables[0];
oTable.setTitle(sCaption);
oTable.setDescription(sDescription);
oTable.setName(sName);
props.TableCaption = undefined;
props.TableDescription = undefined;
var bIgnoreHeight = false;
Expand All @@ -125,22 +128,22 @@ DrawingObjectsController.prototype.setTableProps = function(props)
bIgnoreHeight = false;
}
var target_text_object = AscFormat.getTargetTextObject(this);
if(target_text_object === by_type.tables[0])
if(target_text_object === oTable)
{
by_type.tables[0].graphicObject.Set_Props(props);
oTable.graphicObject.Set_Props(props);
}
else
{
by_type.tables[0].graphicObject.SelectAll();
by_type.tables[0].graphicObject.Set_Props(props);
by_type.tables[0].graphicObject.RemoveSelection();
oTable.graphicObject.SelectAll();
oTable.graphicObject.Set_Props(props);
oTable.graphicObject.RemoveSelection();
}
props.TableCaption = sCaption;
props.TableDescription = sDescription;
props.RowHeight = dRowHeight;
if(!by_type.tables[0].setFrameTransform(props))
if(!oTable.setFrameTransform(props))
{
editor.WordControl.m_oLogicDocument.Check_GraphicFrameRowHeight(by_type.tables[0], bIgnoreHeight);
editor.WordControl.m_oLogicDocument.Check_GraphicFrameRowHeight(oTable, bIgnoreHeight);
}

}
Expand Down
27 changes: 26 additions & 1 deletion common/Drawings/CommonController.js
Original file line number Diff line number Diff line change
Expand Up @@ -3718,7 +3718,23 @@
objects_by_type.smartArts[i].setDescription(props.description);
}
}

if (props.name !== null && props.name !== undefined && props.name !== "") {
for (i = 0; i < objects_by_type.shapes.length; ++i) {
objects_by_type.shapes[i].setName(props.name);
}
for (i = 0; i < objects_by_type.groups.length; ++i) {
objects_by_type.groups[i].setName(props.name);
}
for (i = 0; i < objects_by_type.charts.length; ++i) {
objects_by_type.charts[i].setName(props.name);
}
for (i = 0; i < objects_by_type.images.length; ++i) {
objects_by_type.images[i].setName(props.name);
}
for (i = 0; i < objects_by_type.smartArts.length; ++i) {
objects_by_type.smartArts[i].setName(props.name);
}
}
if (props.anchor !== null && props.anchor !== undefined) {
for (i = 0; i < this.selectedObjects.length; ++i) {
var oSelectedObject = this.selectedObjects[i];
Expand Down Expand Up @@ -7065,6 +7081,7 @@
}
var lockAspect = drawing.getNoChangeAspect();
var oMainGroup = drawing.getMainGroup();
let sOwnName = drawing.getObjectName();
switch (drawing.getObjectType()) {
case AscDFH.historyitem_type_Shape:
case AscDFH.historyitem_type_Cnx:
Expand Down Expand Up @@ -7093,6 +7110,7 @@
textArtProperties: drawing.getTextArtProperties(),
lockAspect: lockAspect,
title: drawing.getTitle(),
name: sOwnName,
description: drawing.getDescription(),
columnNumber: drawing.getColumnNumber(),
columnSpace: drawing.getColumnSpace(),
Expand Down Expand Up @@ -7128,6 +7146,7 @@
y: drawing.y,
lockAspect: lockAspect,
title: drawing.getTitle(),
name: sOwnName,
description: drawing.getDescription(),
anchor: drawing.getDrawingBaseType(),
protectionLockText: (bGroupSelection || !drawing.group) ? drawing.getProtectionLockText() : null,
Expand Down Expand Up @@ -7194,6 +7213,7 @@
textArtProperties: null,
lockAspect: lockAspect,
title: drawing.getTitle(),
name: sOwnName,
description: drawing.getDescription(),
columnNumber: null,
columnSpace: null,
Expand Down Expand Up @@ -7236,6 +7256,7 @@
pluginGuid: drawing.m_sApplicationId,
pluginData: pluginData,
title: drawing.getTitle(),
name: sOwnName,
description: drawing.getDescription(),
anchor: drawing.getDrawingBaseType(),
protectionLockText: (bGroupSelection || !drawing.group) ? drawing.getProtectionLockText() : null,
Expand Down Expand Up @@ -7283,6 +7304,7 @@
locked: locked,
lockAspect: lockAspect,
title: drawing.getTitle(),
name: sOwnName,
description: drawing.getDescription(),
anchor: drawing.getDrawingBaseType(),
protectionLockText: (bGroupSelection || !drawing.group) ? drawing.getProtectionLockText() : null,
Expand Down Expand Up @@ -7349,6 +7371,7 @@
textArtProperties: null,
lockAspect: lockAspect,
title: drawing.getTitle(),
name: sOwnName,
description: drawing.getDescription(),
signatureId: drawing.getSignatureLineGuid(),
anchor: drawing.getDrawingBaseType(),
Expand Down Expand Up @@ -7386,6 +7409,7 @@
locked: locked,
lockAspect: lockAspect,
title: drawing.getTitle(),
name: sOwnName,
description: drawing.getDescription(),
anchor: drawing.getDrawingBaseType(),
slicerProps: oSlicerCopy,
Expand Down Expand Up @@ -7471,6 +7495,7 @@
}
new_table_props.TableDescription = drawing.getDescription();
new_table_props.TableCaption = drawing.getTitle();
new_table_props.TableName = sOwnName;
new_table_props.FrameWidth = drawing.extX;
new_table_props.FrameHeight = drawing.extY;
new_table_props.FrameX = drawing.x;
Expand Down
12 changes: 10 additions & 2 deletions common/Drawings/Format/ChartFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2615,6 +2615,7 @@
};
CDLbl.prototype.hitInPath = CShape.prototype.hitInPath;
CDLbl.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea;
CDLbl.prototype.getGeometry = CShape.prototype.getGeometry;
CDLbl.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
CDLbl.prototype.hitInTextRect = function(x, y) {
var content = this.getDocContent && this.getDocContent();
Expand Down Expand Up @@ -5158,7 +5159,8 @@
CPlotArea.prototype.getFullFlipH = CShape.prototype.getFullFlipH;
CPlotArea.prototype.getFullFlipV = CShape.prototype.getFullFlipV;
CPlotArea.prototype.getAspect = CShape.prototype.getAspect;
CPlotArea.prototype.getGeom = CShape.prototype.getGeom;
CPlotArea.prototype.getGeometry = CShape.prototype.getGeometry;
CPlotArea.prototype.getTrackGeometry = CShape.prototype.getTrackGeometry;
CPlotArea.prototype.convertPixToMM = function(pix) {
var oChartSpace = this.getChartSpace();
if(oChartSpace) {
Expand All @@ -5168,6 +5170,7 @@
};
CPlotArea.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
CPlotArea.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea;
CPlotArea.prototype.getGeometry = CShape.prototype.getGeometry;
CPlotArea.prototype.hitInPath = CShape.prototype.hitInPath;
CPlotArea.prototype.checkHitToBounds = function(x, y) {
CDLbl.prototype.checkHitToBounds.call(this, x, y);
Expand Down Expand Up @@ -10104,9 +10107,11 @@
CLegend.prototype.getFullFlipH = CShape.prototype.getFullFlipH;
CLegend.prototype.getFullFlipV = CShape.prototype.getFullFlipV;
CLegend.prototype.getAspect = CShape.prototype.getAspect;
CLegend.prototype.getGeom = CShape.prototype.getGeom;
CLegend.prototype.getGeometry = CShape.prototype.getGeometry;
CLegend.prototype.getTrackGeometry = CShape.prototype.getTrackGeometry;
CLegend.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
CLegend.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea;
CLegend.prototype.getGeometry = CShape.prototype.getGeometry;
CLegend.prototype.hitInPath = CShape.prototype.hitInPath;
CLegend.prototype.Refresh_RecalcData = function() {
this.Refresh_RecalcData2();
Expand Down Expand Up @@ -13577,6 +13582,7 @@
InitClass(CTitle, CBaseChartObject, AscDFH.historyitem_type_Title);
CTitle.prototype.hitInPath = CShape.prototype.hitInPath;
CTitle.prototype.hitInInnerArea = CShape.prototype.hitInInnerArea;
CTitle.prototype.getGeometry = CShape.prototype.getGeometry;
CTitle.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
CTitle.prototype.hitInTextRect = CDLbl.prototype.hitInTextRect;
CTitle.prototype.recalculateGeometry = CShape.prototype.recalculateGeometry;
Expand Down Expand Up @@ -15677,6 +15683,7 @@
}

CalcLegendEntry.prototype.updatePosition = CShape.prototype.updatePosition;
CalcLegendEntry.prototype.getGeometry = CShape.prototype.getGeometry;
CalcLegendEntry.prototype.getChartSpace = function() {
return this.chart;
};
Expand Down Expand Up @@ -15766,6 +15773,7 @@
}

CompiledMarker.prototype.draw = CShape.prototype.draw;
CompiledMarker.prototype.getGeometry = CShape.prototype.getGeometry;
CompiledMarker.prototype.check_bounds = CShape.prototype.check_bounds;
CompiledMarker.prototype.isEmptyPlaceholder = function() {
return false;
Expand Down
2 changes: 1 addition & 1 deletion common/Drawings/Format/ChartSpace.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ function(window, undefined) {

function CPathMemory() {
this.size = 1000;
this.ArrPathCommand = new Float64Array(this.size);
this.ArrPathCommand = new Float64Array(1000);
this.curPos = -1;

this.path = new AscFormat.Path2(this);
Expand Down
8 changes: 4 additions & 4 deletions common/Drawings/Format/CnxShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@
if(AscFormat.isRealNumber(oPr.stCnxId)){
oStartSp = oObjectsMap[oPr.stCnxId];
if(AscCommon.isRealObject(oStartSp)){
aCnx = oStartSp.getGeom().cnxLstInfo;
aCnx = oStartSp.getTrackGeometry().cnxLstInfo;
if(aCnx) {
oCnx = aCnx[oPr.stCnxIdx];
}
Expand All @@ -585,7 +585,7 @@
if(AscFormat.isRealNumber(oPr.endCnxId)){
oEndSp = oObjectsMap[oPr.endCnxId];
if(AscCommon.isRealObject(oEndSp)){
aCnx = oEndSp.getGeom().cnxLstInfo;
aCnx = oEndSp.getTrackGeometry().cnxLstInfo;
if(aCnx) {
oCnx = aCnx[oPr.endCnxIdx];
}
Expand Down Expand Up @@ -683,7 +683,7 @@
var _oCnxInfo;
var _groupTransform;
if(oBeginDrawing){
_oCnxInfo = oBeginDrawing.getGeom().cnxLst[this.getStCxnIdx()];
_oCnxInfo = oBeginDrawing.getTrackGeometry().cnxLst[this.getStCxnIdx()];
if(_oCnxInfo){
_spX = oBeginDrawing.transform.TransformPointX(_oCnxInfo.x, _oCnxInfo.y);
_spY = oBeginDrawing.transform.TransformPointY(_oCnxInfo.x, _oCnxInfo.y);
Expand All @@ -693,7 +693,7 @@
}
}
else {
_oCnxInfo = oEndDrawing.getGeom().cnxLst[this.getEndCxnIdx()];
_oCnxInfo = oEndDrawing.getTrackGeometry().cnxLst[this.getEndCxnIdx()];
if(_oCnxInfo){
_spX = oEndDrawing.transform.TransformPointX(_oCnxInfo.x, _oCnxInfo.y);
_spY = oEndDrawing.transform.TransformPointY(_oCnxInfo.x, _oCnxInfo.y);
Expand Down
54 changes: 49 additions & 5 deletions common/Drawings/Format/Format.js
Original file line number Diff line number Diff line change
Expand Up @@ -2867,6 +2867,24 @@
}
return false;
};
CSrcRect.prototype.isEqual = function(r) {
if(!r) {
return false;
}
if(r.l !== this.l) {
return false;
}
if(r.t !== this.t) {
return false;
}
if(r.r !== this.r) {
return false;
}
if(r.b !== this.v) {
return false;
}
return true;
};

function CBlipFillTile() {
CBaseNoIdObject.call(this)
Expand Down Expand Up @@ -3100,6 +3118,14 @@
return false;
}
}
if(fill.srcRect && !this.srcRect || this.srcRect && !fill.srcRect) {
return false;
}
if(fill.srcRect) {
if(!fill.srcRect.isEqual(this.srcRect)) {
return false;
}
}
/*
if(fill.rotWithShape != this.rotWithShape)
{
Expand Down Expand Up @@ -5299,12 +5325,13 @@
return _ret.fill;
};
CUniFill.prototype.isSolidFillRGB = function () {
return (this.fill && this.fill.color && this.fill.color.color
&& this.fill.color.color.type === window['Asc'].c_oAscColor.COLOR_TYPE_SRGB)
return (this.isSolidFill() && this.fill.color.color.type === window['Asc'].c_oAscColor.COLOR_TYPE_SRGB)
};
CUniFill.prototype.isSolidFill = function () {
return !!(this.fill && this.fill.color && this.fill.color.color);
};
CUniFill.prototype.isSolidFillScheme = function () {
return (this.fill && this.fill.color && this.fill.color.color
&& this.fill.color.color.type === window['Asc'].c_oAscColor.COLOR_TYPE_SCHEME)
return (this.isSolidFill() && this.fill.color.color.type === window['Asc'].c_oAscColor.COLOR_TYPE_SCHEME)
};
CUniFill.prototype.isNoFill = function () {
return this.fill && this.fill.type === window['Asc'].c_oAscFill.FILL_TYPE_NOFILL;
Expand Down Expand Up @@ -5336,6 +5363,11 @@
return true;
}
};
CUniFill.prototype.isGradientFill = function() {
if(this.fill && this.fill.type === c_oAscFill.FILL_TYPE_GRAD) {
return true;
}
};
CUniFill.prototype.checkTransparent = function() {
let oFill = this.fill;
if(oFill) {
Expand Down Expand Up @@ -5747,6 +5779,9 @@
if (shapeProp1.description === shapeProp2.description) {
_result_shape_prop.description = shapeProp1.description;
}
if (shapeProp1.name === shapeProp2.name) {
_result_shape_prop.name = shapeProp1.name;
}
if (shapeProp1.columnNumber === shapeProp2.columnNumber) {
_result_shape_prop.columnNumber = shapeProp1.columnNumber;
}
Expand Down Expand Up @@ -6186,6 +6221,9 @@
&& (this.tailEnd == null ? ln.tailEnd == null : this.tailEnd.IsIdentical(ln.headEnd)) &&
this.algn == ln.algn && this.cap == ln.cap && this.cmpd == ln.cmpd && this.w == ln.w && this.prstDash === ln.prstDash;
};
CLn.prototype.isEqual = function (ln) {
return this.IsIdentical(ln);
};
CLn.prototype.setFill = function (fill) {
this.Fill = fill;
};
Expand Down Expand Up @@ -6456,7 +6494,10 @@
}
this.cmpd = 1;
};

CLn.prototype.getWidthMM = function () {
const nEmu = AscFormat.isRealNumber(this.w) ? this.w : 12700;
return nEmu * AscCommonWord.g_dKoef_emu_to_mm;
};
// -----------------------------

// SHAPE ----------------------------
Expand Down Expand Up @@ -14384,6 +14425,7 @@
}
obj.title = shapeProp.title;
obj.description = shapeProp.description;
obj.name = shapeProp.name;
obj.columnNumber = shapeProp.columnNumber;
obj.columnSpace = shapeProp.columnSpace;
obj.textFitType = shapeProp.textFitType;
Expand Down Expand Up @@ -15248,6 +15290,7 @@
builder_SetAxisMinorGridlines(oChartSpace.chart.plotArea.getHorizontalAxis(), oLn);
}

const OBJECT_MORPH_MARKER = "!!";
//----------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
window['AscFormat'].CreateFontRef = CreateFontRef;
Expand Down Expand Up @@ -15576,5 +15619,6 @@
window['AscFormat'].MAP_AUTONUM_TYPES = MAP_AUTONUM_TYPES;
window['AscFormat'].CLR_NAME_MAP = CLR_NAME_MAP;
window['AscFormat'].LINE_PRESETS_MAP = LINE_PRESETS_MAP;
window['AscFormat'].OBJECT_MORPH_MARKER = OBJECT_MORPH_MARKER;
})
(window);
6 changes: 0 additions & 6 deletions common/Drawings/Format/Geometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -1819,12 +1819,6 @@ function GetArrayPolygonsByPaths(dEpsilon, aPathLst)
return aByPaths;
}

function ComparisonEdgeByTopPoint(graphEdge1, graphEdge2)
{
return Math.min(graphEdge1.point1.y, graphEdge1.point2.y) - Math.min(graphEdge2.point1.y, graphEdge2.point2.y);
}



//--------------------------------------------------------export----------------------------------------------------
window['AscFormat'] = window['AscFormat'] || {};
Expand Down
Loading

0 comments on commit 5fba2ed

Please sign in to comment.