Commit d36cdd22 authored by Sergey.Luzyanin's avatar Sergey.Luzyanin

Селект в DrawingObject при быстром совместном редактировании

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@65498 954022d7-b5bf-4e40-9824-e11837661b57
parent 4d5a5350
......@@ -23267,6 +23267,15 @@ CTitle.prototype =
return this.chart.extX*0.5;
},
Is_UseInDocument: function()
{
if(this.parent && this.parent.title === this &&
this.chart && this.chart.Is_UseInDocument)
{
return this.chart.Is_UseInDocument();
}
return false;
},
getBodyPr: CDLbl.prototype.getBodyPr,
getCompiledStyle: CDLbl.prototype.getCompiledStyle,
......
......@@ -423,6 +423,19 @@ CChartSpace.prototype =
}
},
loadDocumentStateAfterLoadChanges: function(state)
{
this.selection.title = null;
this.selection.legend = null;
this.selection.legendEntry = null;
this.selection.axisLbls = null;
this.selection.dataLbls = null;
this.selection.dataLbl = null;
this.selection.textSelection = null;
this.selection.plotArea = null;
return false;
},
resetInternalSelection: function(noResetContentSelect)
{
if(this.selection.textSelection)
......
......@@ -1509,6 +1509,7 @@ CGroupShape.prototype =
resetInternalSelection: DrawingObjectsController.prototype.resetInternalSelection,
recalculateCurPos: DrawingObjectsController.prototype.recalculateCurPos,
loadDocumentStateAfterLoadChanges: DrawingObjectsController.prototype.loadDocumentStateAfterLoadChanges,
checkHitToBounds: CShape.prototype.checkHitToBounds,
checkDrawingBaseCoords: CShape.prototype.checkDrawingBaseCoords,
setDrawingBaseCoords: CShape.prototype.setDrawingBaseCoords,
......
......@@ -766,7 +766,23 @@ CTextBody.prototype =
Get_PrevElementEndInfo : function(CurElement)
{
return null;
}
},
Is_UseInDocument: function(Id)
{
if(Id != undefined)
{
if(!this.content || this.content.Get_Id() !== Id)
{
return false;
}
}
if(this.parent && this.parent.Is_UseInDocument)
{
return this.parent.Is_UseInDocument();
}
return false;
},
};
function CreateParaContentFromString(str)
......
......@@ -549,6 +549,7 @@ CChartSpace.prototype.updateTransformMatrix = function()
};
CChartSpace.prototype.getArrayWrapIntervals = CShape.prototype.getArrayWrapIntervals;
CChartSpace.prototype.select = CShape.prototype.select;
CChartSpace.prototype.Is_UseInDocument = CShape.prototype.Is_UseInDocument;
//CChartSpace.prototype.Refresh_RecalcData = function(data)
//{
// this.addToRecalculate();
......
......@@ -36,6 +36,7 @@ CGroupShape.prototype.handleUpdateLn = function()
CGroupShape.prototype.getRecalcObject = CShape.prototype.getRecalcObject;
CGroupShape.prototype.setRecalcObject = CShape.prototype.setRecalcObject;
CGroupShape.prototype.Get_ColorMap = CShape.prototype.Get_ColorMap;
CGroupShape.prototype.Is_UseInDocument = CShape.prototype.Is_UseInDocument;
CGroupShape.prototype.getTargetDocContent = DrawingObjectsController.prototype.getTargetDocContent;
......
......@@ -15,6 +15,7 @@ CImageShape.prototype.hitToHandles = CShape.prototype.hitToHandles;
CImageShape.prototype.hitInBoundingRect = CShape.prototype.hitInBoundingRect;
CImageShape.prototype.getRotateAngle = CShape.prototype.getRotateAngle;
CImageShape.prototype.recalculateWrapPolygon = CShape.prototype.recalculateWrapPolygon;
CImageShape.prototype.Is_UseInDocument = CShape.prototype.Is_UseInDocument;
CImageShape.prototype.setRecalculateInfo = function()
{
......
......@@ -692,7 +692,23 @@ CShape.prototype.Is_ThisElementCurrent = function(CurElement)
};
CShape.prototype.Is_UseInDocument = function()
{
return !this.bDeleted;
if(this.group)
{
var aSpTree = this.group.spTree;
for(var i = 0; i < aSpTree.length; ++i)
{
if(aSpTree[i] === this)
{
return this.group.Is_UseInDocument();
}
return false;
}
}
if(this.parent && this.parent.Is_UseInDocument && this.parent.GraphicObj === this)
{
return this.parent.Is_UseInDocument();
}
return false;
};
CShape.prototype.Is_HdrFtr = function(bool)
{
......
......@@ -2752,6 +2752,86 @@ CGraphicObjects.prototype =
return false;
},
Save_DocumentStateBeforeLoadChanges: function(oState)
{
oState.DrawingsSelectionState = this.getSelectionState()[0];
var oPos = this.getLeftTopSelectedObject2();
oState.X = oPos.X;
oState.Y = oPos.Y;
},
Load_DocumentStateAfterLoadChanges: function(oState)
{
this.clearPreTrackObjects();
this.clearTrackObjects();
this.resetSelection();
this.changeCurrentState(new NullState(this));
return this.loadDocumentStateAfterLoadChanges(oState.DrawingsSelectionState);
},
loadDocumentStateAfterLoadChanges: function(oSelectionState)
{
if(oSelectionState)
{
if(oSelectionState.textObject)
{
if(oSelectionState.textObject.Is_UseInDocument())
{
this.selectObject(oSelectionState.textObject, oSelectionState.textObject.parent.PageNum);
}
}
else if(oSelectionState.groupObject)
{
if(oSelectionState.groupObject.Is_UseInDocument())
{
this.selectObject(oSelectionState.groupObject, oSelectionState.groupObject.parent.PageNum);
oSelectionState.groupSelection.resetSelection(oSelectionState.groupSelection);
if(oSelectionState.groupObject.loadDocumentStateAfterLoadChanges(oSelectionState.groupSelection))
{
this.selection.groupSelection = oSelectionState.groupObject;
}
}
}
else if(oSelectionState.chartObject)
{
if(oSelectionState.chartObject.Is_UseInDocument())
{
this.selectObject(oSelectionState.chartObject, oSelectionState.chartObject.parent.PageNum);
oSelectionState.chartObject.resetSelection();
if(oSelectionState.chartObject.loadDocumentStateAfterLoadChanges(oSelectionState.chartSelection))
{
this.selection.chartSelection = oSelectionState.chartObject;
}
}
}
else if(oSelectionState.wrapObject)
{
if(oSelectionState.wrapObject.parent && oSelectionState.wrapObject.parent.Is_UseInDocument && oSelectionState.wrapObject.parent.Is_UseInDocument())
{
this.selectObject(oSelectionState.wrapObject, oSelectionState.wrapObject.parent.PageNum);
if(oSelectionState.wrapObject.canChangeWrapPolygon && oSelectionState.wrapObject.canChangeWrapPolygon() && !oSelectionState.wrapObject.parent.Is_Inline())
{
this.selection.wrapPolygonSelection = oSelectionState.wrapObject;
}
}
}
else
{
for(var i = 0; i < oSelectionState.selection.length; ++i)
{
var oSp = oSelectionState.selection[i].object;
if(oSp.Is_UseInDocument())
{
this.selectObject(oSp, oSp.parent.PageNum);
}
}
}
}
return this.selectedObjects.length > 0;
},
canChangeWrapPolygon: function()
{
return !this.selection.groupSelection && !this.selection.textSelection && !this.selection.chartSelection
......@@ -2967,6 +3047,17 @@ CGraphicObjects.prototype =
return {X: 0, Y: 0, PageIndex: pageIndex};
},
getLeftTopSelectedObject2: function()
{
if(this.selectedObjects.length > 0)
{
var aSelectedObjectsCopy = [].concat(this.selectedObjects);
aSelectedObjectsCopy.sort(function(a, b){return a.selectStartPage - b.selectStartPage});
return this.getLeftTopSelectedObjectByPage(aSelectedObjectsCopy[0].selectStartPage);
}
return {X: 0, Y: 0, PageIndex: 0};
},
getLeftTopSelectedObjectByPage: function(pageIndex)
{
var oDrawingPage, oRes;
......
......@@ -142,7 +142,7 @@ CParagraphContentWithContentBase.prototype.Is_UseInDocument = function(Id)
{
for(var i = 0; i < this.Content.length; ++i)
{
if(this.Content[i].Get_Id() === Id)
if(this.Content[i].Get_Id && this.Content[i].Get_Id() === Id)
{
break;
}
......
......@@ -1012,6 +1012,9 @@ ParaRun.prototype.Get_CurrentParaPos = function()
ParaRun.prototype.Get_ParaPosByContentPos = function(ContentPos, Depth)
{
if (this.StartRange < 0 || this.StartLine < 0)
return new CParaPos(0, 0, 0, 0);
var Pos = ContentPos.Get(Depth);
var CurLine = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment