Skip to content

Commit

Permalink
[bug] fix bug 66398
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyLuzyanin committed Feb 7, 2024
1 parent 821baeb commit aca0923
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 41 deletions.
22 changes: 13 additions & 9 deletions common/Drawings/CommonController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2331,13 +2331,17 @@
}
}
}
this.lastSelectedObject = null;
},

deselectObject: function (object) {
for (let i = 0; i < this.selectedObjects.length; ++i) {
if (this.selectedObjects[i] === object) {
object.selected = false;
this.selectedObjects.splice(i, 1);
if(this.selectedObjects.length === 0) {
this.lastSelectedObject = object;
}
return;
}
}
Expand Down Expand Up @@ -2877,14 +2881,14 @@
this.selectedObjects[0].applyTextFunction(docContentFunction, tableFunction, args);
this.selection.textSelection.select(this, this.selection.textSelection.selectStartPage);
}
} else if (this.parent && this.parent.GoTo_Text) {
this.parent.GoTo_Text();
} else if (this.parent && this.parent.GoToText) {
this.parent.GoToText();
this.resetSelection();
if (this.document && (docpostype_DrawingObjects !== this.document.GetDocPosType() || isRealObject(getTargetTextObject(this.document.DrawingObjects))) && CDocumentContent.prototype.AddNewParagraph === docContentFunction) {
this.document.AddNewParagraph(args[0]);
}
} else if (this.selectedObjects.length > 0 && this.selectedObjects[0].parent && this.selectedObjects[0].parent.GoTo_Text) {
this.selectedObjects[0].parent.GoTo_Text();
} else if (this.selectedObjects.length > 0 && this.selectedObjects[0].parent && this.selectedObjects[0].parent.GoToText) {
this.selectedObjects[0].parent.GoToText();
this.resetSelection();
if (this.document && (docpostype_DrawingObjects !== this.document.GetDocPosType() || isRealObject(getTargetTextObject(this))) && CDocumentContent.prototype.AddNewParagraph === docContentFunction) {
this.document.AddNewParagraph(args[0]);
Expand Down Expand Up @@ -6314,19 +6318,19 @@
this.checkChartTextSelection();
}
this.resetInternalSelection(noResetContentSelect, bDoNotRedraw);
for (var i = 0; i < this.selectedObjects.length; ++i) {
this.selectedObjects[i].selected = false;
let aSelected = [].concat(this.selectedObjects);
for (let nDrawing = 0; nDrawing < aSelected.length; ++nDrawing) {
this.deselectObject(aSelected[nDrawing]);
}
this.selectedObjects.length = 0;
this.selection =
{
this.selection = {
selectedObjects: [],
groupSelection: null,
chartSelection: null,
textSelection: null,
cropSelection: null,
geometrySelection: null
};
};
if (bNoCheckAnim !== true) {
this.onChangeDrawingsSelection();
}
Expand Down
2 changes: 1 addition & 1 deletion common/Drawings/Format/GroupShape.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@
this.selection.textSelection.select(this, this.selection.textSelection.selectStartPage);
} else if (this.selectedObjects.length > 0) {
if (this.parent) {
this.parent.GoTo_Text();
this.parent.GoToText();
this.resetSelection();
}
}
Expand Down
6 changes: 3 additions & 3 deletions word/Editor/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -21990,7 +21990,7 @@ CDocument.prototype.MoveToFillingForm = function(isNext)
if (!oRes)
{
this.DrawingObjects.resetSelection();
oParaDrawing.GoTo_Text(true !== isNext, false);
oParaDrawing.GoToText(true !== isNext, false);

// В случаях, когда у нас автофигура внутри другой автофигуры
var arrPassedParagraphs = [];
Expand Down Expand Up @@ -22025,7 +22025,7 @@ CDocument.prototype.MoveToFillingForm = function(isNext)
}
else
{
oParaDrawing.GoTo_Text(true !== isNext, false);
oParaDrawing.GoToText(true !== isNext, false);
oParagraph = this.GetCurrentParagraph();
oShape = oParagraph.GetParent() ? oParagraph.GetParent().Is_DrawingShape(true) : null;
}
Expand Down Expand Up @@ -26715,7 +26715,7 @@ CDocument.prototype.GetSearchElementId = function(bNext)
return Id;

this.DrawingObjects.resetSelection();
ParaDrawing.GoTo_Text(true !== bNext, false);
ParaDrawing.GoToText(true !== bNext, false);
}

if (docpostype_Content === this.CurPos.Type)
Expand Down
4 changes: 2 additions & 2 deletions word/Editor/DocumentContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -6127,7 +6127,7 @@ CDocumentContent.prototype.RemoveSelection = function(bNoCheckDrawing)
{
var oParaDrawing = this.LogicDocument.DrawingObjects.getMajorParaDrawing();
if (oParaDrawing)
oParaDrawing.GoTo_Text(undefined, false);
oParaDrawing.GoToText(undefined, false);

return this.LogicDocument.DrawingObjects.resetSelection(undefined, bNoCheckDrawing);
}
Expand Down Expand Up @@ -8931,7 +8931,7 @@ CDocumentContent.prototype.GetSearchElementId = function(bNext, bCurrent)
if ( null != Id )
return Id;

ParaDrawing.GoTo_Text( true !== bNext, false );
ParaDrawing.GoToText( true !== bNext, false );
}

var Pos = this.CurPos.ContentPos;
Expand Down
4 changes: 2 additions & 2 deletions word/Editor/DrawingsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ CDrawingsController.prototype.AddTextArt = function(nStyle)
var ParaDrawing = this.DrawingObjects.getMajorParaDrawing();
if (ParaDrawing)
{
ParaDrawing.GoTo_Text(undefined, false);
ParaDrawing.GoToText(undefined, false);
this.LogicDocument.AddTextArt(nStyle);
}
};
Expand Down Expand Up @@ -380,7 +380,7 @@ CDrawingsController.prototype.RemoveSelection = function(bNoCheckDrawing)
oParaDrawing = arrDrawings[0];
}

oParaDrawing.GoTo_Text(undefined, false);
oParaDrawing.GoToText(undefined, false);
}
};
CDrawingsController.prototype.IsSelectionEmpty = function(bCheckHidden)
Expand Down
62 changes: 40 additions & 22 deletions word/Editor/GraphicObjects/GraphicObjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,14 @@ CGraphicObjects.prototype =
{
return this.selectedObjects[0].parent;
}
if(this.lastSelectedObject)
{
let oParaDrawing = this.lastSelectedObject.parent;
if(oParaDrawing && oParaDrawing.IsUseInDocument())
{
return oParaDrawing;
}
}
return null;
},

Expand Down Expand Up @@ -2238,19 +2246,19 @@ CGraphicObjects.prototype =

updateParentParagraphParaPr : function()
{
var majorParaDrawing = this.getMajorParaDrawing();
if(majorParaDrawing)
let oDrawing = this.getMajorParaDrawing();
if(oDrawing)
{
var parent_para = this.selectedObjects[0].parent.Get_ParentParagraph(), ParaPr;
if(parent_para)
let oParagraph = oDrawing.Get_ParentParagraph(), ParaPr;
if(oParagraph)
{
ParaPr = parent_para.Get_CompiledPr2(true).ParaPr;
if (ParaPr)
let oParaPr = oParagraph.Get_CompiledPr2(true).ParaPr;
if (oParaPr)
{
editor.sync_ParaSpacingLine( ParaPr.Spacing );
editor.Update_ParaInd(ParaPr.Ind);
editor.sync_PrAlignCallBack(ParaPr.Jc);
editor.sync_ParaStyleName(ParaPr.StyleName);
editor.sync_ParaSpacingLine( oParaPr.Spacing );
editor.Update_ParaInd(oParaPr.Ind);
editor.sync_PrAlignCallBack(oParaPr.Jc);
editor.sync_ParaStyleName(oParaPr.StyleName);
}
}
}
Expand Down Expand Up @@ -3212,25 +3220,35 @@ CGraphicObjects.prototype =

resetSelection2: function()
{
var sel_arr = this.selectedObjects;
if(sel_arr.length > 0)
if(this.selectedObjects.length > 0)
{
var top_obj = sel_arr[0];
for(var i = 1; i < sel_arr.length; ++i)
let oTopDrawing = this.selectedObjects[0];
for(let nDrawing = 1; nDrawing < this.selectedObjects.length; ++nDrawing)
{
var cur_obj = sel_arr[i];
if(cur_obj.selectStartPage < top_obj.selectStartPage)
let oCurDrawing = this.selectedObjects[nDrawing];
if(oCurDrawing.selectStartPage < oTopDrawing.selectStartPage)
{
top_obj = cur_obj;
oTopDrawing = oCurDrawing;
}
else if(cur_obj.selectStartPage === top_obj.selectStartPage)
else if(oCurDrawing.selectStartPage === oTopDrawing.selectStartPage)
{
if(cur_obj.parent.Get_ParentParagraph().Y < top_obj.parent.Get_ParentParagraph().Y)
top_obj = cur_obj;
if(oCurDrawing.parent.Get_ParentParagraph().Y < oTopDrawing.parent.Get_ParentParagraph().Y)
oTopDrawing = oCurDrawing;
}
}
this.resetSelection();
top_obj.parent.GoTo_Text();
oTopDrawing.parent.GoToText();
}
else
{
if(this.lastSelectedObject)
{
let oParaDrawing = this.lastSelectedObject.parent;
if(oParaDrawing && oParaDrawing.IsUseInDocument())
{
oParaDrawing.GoToText();
}
}
}
},

Expand Down Expand Up @@ -3465,7 +3483,7 @@ CGraphicObjects.prototype =
this.resetSelection();
if(oFirstParaDrawing)
{
oFirstParaDrawing.GoTo_Text();
oFirstParaDrawing.GoToText();
}
for(let nDrawing = 0; nDrawing < aSelectedObjects.length; ++nDrawing)
{
Expand Down
2 changes: 1 addition & 1 deletion word/Editor/Paragraph/ParaDrawing.js
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,7 @@ ParaDrawing.prototype.Get_ParentTextTransform = function()
}
return null;
};
ParaDrawing.prototype.GoTo_Text = function(bBefore, bUpdateStates)
ParaDrawing.prototype.GoToText = function(bBefore, bUpdateStates)
{
var Paragraph = this.Get_ParentParagraph();
if (Paragraph)
Expand Down
2 changes: 1 addition & 1 deletion word/Editor/StructuredDocumentTags/InlineLevel.js
Original file line number Diff line number Diff line change
Expand Up @@ -3611,7 +3611,7 @@ CInlineLevelSdt.prototype.MoveCursorOutsideForm = function(isBefore)
{
let oParaDrawing = oShape.GetParaDrawing();
if (oParaDrawing)
oParaDrawing.GoTo_Text(isBefore);
oParaDrawing.GoToText(isBefore);
}
else
{
Expand Down

0 comments on commit aca0923

Please sign in to comment.