Commit 7b71afd2 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix bug 33377

add copy comments with move range
parent 23e9cd4f
......@@ -357,40 +357,45 @@ asc_CCommentData.prototype = {
}
};
function CompositeCommentData() {
function CompositeCommentData() {
this.commentBefore = null;
this.commentAfter = null;
this.Properties = {
commentBefore: 0,
commentAfter: 1
commentBefore: 0, commentAfter: 1
};
}
CompositeCommentData.prototype = {
// For collaborative editing
getType: function() {
}
CompositeCommentData.prototype.getType = function () {
return AscCommonExcel.UndoRedoDataTypes.CompositeCommentData;
},
};
getProperties: function() {
CompositeCommentData.prototype.getProperties = function () {
return this.Properties;
},
};
getProperty: function(nType) {
CompositeCommentData.prototype.getProperty = function (nType) {
switch (nType) {
case this.Properties.commentBefore: return this.commentBefore; break;
case this.Properties.commentAfter: return this.commentAfter; break;
case this.Properties.commentBefore:
return this.commentBefore;
break;
case this.Properties.commentAfter:
return this.commentAfter;
break;
}
return null;
},
};
setProperty: function(nType, value) {
CompositeCommentData.prototype.setProperty = function (nType, value) {
switch (nType) {
case this.Properties.commentBefore: this.commentBefore = value; break;
case this.Properties.commentAfter: this.commentAfter = value; break;
}
case this.Properties.commentBefore:
this.commentBefore = value;
break;
case this.Properties.commentAfter:
this.commentAfter = value;
break;
}
};
};
/** @constructor */
function CCellCommentator(currentSheet) {
......@@ -419,7 +424,6 @@ CCellCommentator.sStartCommentId = 'comment_';
CCellCommentator.prototype.isViewerMode = function () {
return this.worksheet.handlers.trigger("getViewerMode");
};
CCellCommentator.prototype.isLockedComment = function(oComment, callbackFunc) {
var objectGuid = oComment.asc_getId();
if (objectGuid) {
......@@ -454,8 +458,8 @@ CCellCommentator.prototype.isLockedComment = function(oComment, callbackFunc) {
}
};
CCellCommentator.prototype.moveRangeComments = function(rangeFrom, rangeTo) {
if ( rangeFrom && rangeTo ) {
CCellCommentator.prototype.moveRangeComments = function (rangeFrom, rangeTo, copy) {
if (rangeFrom && rangeTo) {
var colOffset = rangeTo.c1 - rangeFrom.c1;
var rowOffset = rangeTo.r1 - rangeFrom.r1;
......@@ -464,11 +468,15 @@ CCellCommentator.prototype.moveRangeComments = function(rangeFrom, rangeTo) {
for (var i = 0; i < aComments.length; i++) {
var comment = aComments[i];
if (rangeFrom.contains(comment.nCol, comment.nRow)) {
if (copy) {
var newComment = new asc_CCommentData(comment);
newComment.nCol += colOffset;
newComment.nRow += rowOffset;
newComment.setId();
this.addComment(newComment, true);
} else {
var commentBefore = new asc_CCommentData(comment);
comment.nCol += colOffset;
comment.nRow += rowOffset;
this.model.workbook.handlers.trigger("asc_onChangeCommentData", comment.asc_getId(), comment);
......@@ -480,11 +488,13 @@ CCellCommentator.prototype.moveRangeComments = function(rangeFrom, rangeTo) {
compositeComment.commentAfter = commentAfter;
History.Create_NewPoint();
History.Add(AscCommonExcel.g_oUndoRedoComment, AscCH.historyitem_Comment_Change, this.model.getId(), null, compositeComment);
History.Add(AscCommonExcel.g_oUndoRedoComment, AscCH.historyitem_Comment_Change, this.model.getId(),
null, compositeComment);
}
}
}
};
}
};
CCellCommentator.prototype.deleteCommentsRange = function(range) {
if ( range ) {
......
......@@ -8331,9 +8331,9 @@
}
};
WorksheetView.prototype.applyMoveResizeRangeHandle = function ( target ) {
if ( -1 == target.targetArr && !this.startCellMoveResizeRange.isEqual( this.moveRangeDrawingObjectTo ) ) {
this.objectRender.moveRangeDrawingObject( this.startCellMoveResizeRange, this.moveRangeDrawingObjectTo );
WorksheetView.prototype.applyMoveResizeRangeHandle = function (target) {
if (-1 == target.targetArr && !this.startCellMoveResizeRange.isEqual(this.moveRangeDrawingObjectTo)) {
this.objectRender.moveRangeDrawingObject(this.startCellMoveResizeRange, this.moveRangeDrawingObjectTo);
}
this.startCellMoveResizeRange = null;
......@@ -8367,7 +8367,7 @@
t.model.autoFilters._preMoveAutoFilters(arnFrom, arnTo, copyRange);
t.model._moveRange(arnFrom, arnTo, copyRange);
t.cellCommentator.moveRangeComments(arnFrom, arnTo);
t.cellCommentator.moveRangeComments(arnFrom, arnTo, copyRange);
t.objectRender.moveRangeDrawingObject(arnFrom, arnTo);
// Вызываем функцию пересчета для заголовков форматированной таблицы
......
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