Skip to content

Commit

Permalink
[de] Refactor move shape extends update to a proper place
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillovIlya committed Oct 19, 2023
1 parent b12da1d commit 04a1fe2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
17 changes: 16 additions & 1 deletion word/Editor/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -2779,7 +2779,9 @@ CDocument.prototype.FinalizeAction = function(isCheckEmptyAction)

if (this.Action.Additional.FormAutoFit)
this.private_FinalizeFormAutoFit(nRecalcResult & document_recalcresult_FastFlag);


if (this.Action.Additional.ShapeAutoFit)
this.private_FinalizeShapeAutoFit();
}
else if (undefined !== this.Action.Redraw.Start && undefined !== this.Action.Redraw.End)
{
Expand Down Expand Up @@ -3048,6 +3050,11 @@ CDocument.prototype.private_FinalizeFormAutoFit = function(isFastRecalc)
if (this.Action.Additional.FormAutoFit.length)
this.Action.Recalculate = true;
};
CDocument.prototype.private_FinalizeShapeAutoFit = function()
{
this.CheckCurrentTextObjectExtends();
this.Action.Recalculate = true
};
CDocument.prototype.private_FinalizeRadioRequired = function()
{
for (var sGroupKey in this.Action.Additional.RadioRequired)
Expand Down Expand Up @@ -24874,6 +24881,14 @@ CDocument.prototype.CheckFormAutoFit = function(oForm)

this.Action.Additional.FormAutoFit.push(oForm);
};
/**
* Сообщаем, что в конце действия нужно будет проверить размер текущей автофигуры
*/
CDocument.prototype.CheckShapeAutoFit = function(shape)
{
if (!this.Action.Additional.ShapeAutoFit)
this.Action.Additional.ShapeAutoFit = true;
};
/**
* Выставляем настройку выделять знак параграфа, когда выделено все его содержимое
* @param {boolean} isUse
Expand Down
8 changes: 8 additions & 0 deletions word/Editor/DocumentContentBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -2473,6 +2473,14 @@ CDocumentContentBase.prototype.OnContentChange = function()
{
if (this.Parent && this.Parent.OnContentChange)
this.Parent.OnContentChange();

let shape = this.Is_DrawingShape(true);
if (shape
&& this.GetLogicDocument()
&& this.GetLogicDocument().IsDocumentEditor())
{
this.GetLogicDocument().CheckShapeAutoFit(shape);
}
};

CDocumentContentBase.prototype.GetCalculatedTextPr = function()
Expand Down
16 changes: 1 addition & 15 deletions word/Editor/document-composite-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
document.StartAction(AscDFH.historydescription_Document_CompositeInput);

if (document.IsDrawingSelected())
document.GetDrawingObjects.CreateDocContent();
document.GetDrawingObjects().CreateDocContent();

document.RemoveBeforePaste();
let paragraph = document.GetCurrentParagraph();
Expand Down Expand Up @@ -102,18 +102,6 @@
this.validateInput();
this.compositeInput.end();

// Why is this here?
// var oController = this.DrawingObjects;
// if(oController)
// {
// var oTargetTextObject = AscFormat.getTargetTextObject(oController);
// if(oTargetTextObject && oTargetTextObject.txWarpStructNoTransform)
// {
// oTargetTextObject.recalcInfo.recalculateTxBoxContent = true;
// oTargetTextObject.recalculateText();
// }
// }

// UpdateInterface is necessary here since we need to fire the Api.CheckChangedDocument event
// This event was blocked util the end of the composite input
this.document.UpdateInterface();
Expand Down Expand Up @@ -206,8 +194,6 @@

actionFunc();

// Зачем это тут?
document.CheckCurrentTextObjectExtends();
document.Recalculate();
document.UpdateSelection();
document.UpdateUndoRedo();
Expand Down

0 comments on commit 04a1fe2

Please sign in to comment.