Commit fb02de37 authored by Alexander.Trofimov's avatar Alexander.Trofimov

add ShowSolved comments flag

parent 01d34798
......@@ -2377,11 +2377,11 @@ var editor;
return this.wb.cellCommentator.getDocumentComments();
};
spreadsheet_api.prototype.asc_showComments = function () {
this.wb.showComments(true);
spreadsheet_api.prototype.asc_showComments = function (isShowSolved) {
this.wb.showComments(true, isShowSolved);
};
spreadsheet_api.prototype.asc_hideComments = function () {
this.wb.showComments(false);
this.wb.showComments(false, false);
};
// Shapes
......
......@@ -522,7 +522,7 @@ CCellCommentator.prototype.getCommentsXY = function(x, y) {
CCellCommentator.prototype.drawCommentCells = function () {
if (this.isViewerMode() || this.model.workbook.handlers.trigger('hiddenComments')) {
if (this.isViewerMode() || this.hiddenComments()) {
return;
}
......@@ -531,7 +531,8 @@ CCellCommentator.prototype.getCommentsXY = function(x, y) {
var aComments = this.model.aComments;
for (var i = 0; i < aComments.length; ++i) {
commentCell = aComments[i];
if (commentCell.asc_getDocumentFlag() || commentCell.asc_getHiddenFlag() || commentCell.asc_getSolved()) {
if (commentCell.asc_getDocumentFlag() || commentCell.asc_getHiddenFlag() ||
(commentCell.asc_getSolved() && !this.showSolved())) {
continue;
}
......@@ -944,15 +945,16 @@ CCellCommentator.prototype.getCommentsCoords = function(comments) {
return coords;
};
CCellCommentator.prototype.cleanSelectedComment = function() {
var metrics;
if ( this.lastSelectedId ) {
var comment = this.findComment(this.lastSelectedId);
if (comment && !comment.asc_getDocumentFlag() && !comment.asc_getSolved() &&
(metrics = this.worksheet.getCellMetrics(comment.asc_getCol(), comment.asc_getRow())))
this.overlayCtx.clearRect(metrics.left, metrics.top, metrics.width, metrics.height);
}
};
CCellCommentator.prototype.cleanSelectedComment = function () {
var metrics;
if (this.lastSelectedId) {
var comment = this.findComment(this.lastSelectedId);
if (comment && !comment.asc_getDocumentFlag() && (this.showSolved() || !comment.asc_getSolved()) &&
(metrics = this.worksheet.getCellMetrics(comment.asc_getCol(), comment.asc_getRow()))) {
this.overlayCtx.clearRect(metrics.left, metrics.top, metrics.width, metrics.height);
}
}
};
//-----------------------------------------------------------------------------------
// Misc methods
......@@ -1010,7 +1012,7 @@ CCellCommentator.prototype.selectComment = function(id, bMove) {
this.cleanLastSelection();
this.lastSelectedId = null;
if (comment && !comment.asc_getDocumentFlag() && !comment.asc_getSolved()) {
if (comment && !comment.asc_getDocumentFlag() && (this.showSolved() || !comment.asc_getSolved())) {
this.lastSelectedId = id;
......@@ -1157,7 +1159,7 @@ CCellCommentator.prototype.removeComment = function(id, bNoEvent, bNoAscLock, bN
var aComments = this.model.aComments;
var length = aComments.length;
if (this.model.workbook.handlers.trigger('hiddenComments')) {
if (this.hiddenComments()) {
return comments;
}
......@@ -1192,7 +1194,7 @@ CCellCommentator.prototype.removeComment = function(id, bNoEvent, bNoAscLock, bN
CCellCommentator.prototype.getRangeComments = function (range) {
var oComments = {};
if (this.model.workbook.handlers.trigger('hiddenComments')) {
if (this.hiddenComments()) {
return null;
}
......@@ -1446,6 +1448,13 @@ CCellCommentator.prototype.Redo = function(type, data) {
}
};
CCellCommentator.prototype.hiddenComments = function () {
return this.model.workbook.handlers.trigger('hiddenComments');
};
CCellCommentator.prototype.showSolved = function () {
return this.model.workbook.handlers.trigger('showSolved');
};
//----------------------------------------------------------export----------------------------------------------------
var prot;
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
......
......@@ -176,7 +176,8 @@
this.isCellEditMode = false;
this.isShowComments = true;
this.isShowComments = true;
this.isShowSolved = true;
this.formulasList = []; // Список всех формул
this.lastFormulaPos = -1; // Последняя позиция формулы
......@@ -835,6 +836,9 @@
this.handlers.add('hiddenComments', function () {
return !self.isShowComments;
});
this.handlers.add('showSolved', function () {
return self.isShowSolved;
});
this.model.handlers.add("hideSpecialPasteOptions", function() {
if(window['AscCommon'].g_clipboardBase.showSpecialPasteButton)
{
......@@ -2572,12 +2576,13 @@
this.isDocumentPlaceChangedEnabled = val;
};
WorkbookView.prototype.showComments = function (val) {
if (this.isShowComments !== val) {
this.isShowComments = val;
this.drawWS();
}
};
WorkbookView.prototype.showComments = function (val, isShowSolved) {
if (this.isShowComments !== val || this.isShowSolved !== isShowSolved) {
this.isShowComments = val;
this.isShowSolved = isShowSolved;
this.drawWS();
}
};
/*
* @param {c_oAscRenderingModeType} mode Режим отрисовки
......
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