From 04a1fe268e2a1d631fdf3b884ac6910501c52d39 Mon Sep 17 00:00:00 2001 From: KirillovIlya Date: Thu, 19 Oct 2023 18:17:42 +0300 Subject: [PATCH] [de] Refactor move shape extends update to a proper place --- word/Editor/Document.js | 17 ++++++++++++++++- word/Editor/DocumentContentBase.js | 8 ++++++++ word/Editor/document-composite-input.js | 16 +--------------- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/word/Editor/Document.js b/word/Editor/Document.js index ab0ae36b2b..704277ad1b 100644 --- a/word/Editor/Document.js +++ b/word/Editor/Document.js @@ -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) { @@ -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) @@ -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 diff --git a/word/Editor/DocumentContentBase.js b/word/Editor/DocumentContentBase.js index af8c7414e8..10508a3883 100644 --- a/word/Editor/DocumentContentBase.js +++ b/word/Editor/DocumentContentBase.js @@ -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() diff --git a/word/Editor/document-composite-input.js b/word/Editor/document-composite-input.js index fddc56579f..289c61f6fe 100644 --- a/word/Editor/document-composite-input.js +++ b/word/Editor/document-composite-input.js @@ -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(); @@ -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(); @@ -206,8 +194,6 @@ actionFunc(); - // Зачем это тут? - document.CheckCurrentTextObjectExtends(); document.Recalculate(); document.UpdateSelection(); document.UpdateUndoRedo();