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

add ShowSolved comments flag

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