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

cell/model/CellComment to function-closure

parent b9509bbd
CD /D %~dp0
call npm install -g grunt-cli
call npm install
call grunt --level=WHITESPACE_ONLY --nomap=true --mobile=true --formatting=PRETTY_PRINT
call grunt --nomap=true
pause
\ No newline at end of file
......@@ -6,11 +6,10 @@
* Date: Apr 23, 2015
*/
(/**
* @param {jQuery} $
* @param {Window} window
* @param {undefined} undefined
*/
function($, window, undefined) {
function(window, undefined) {
var asc = window["Asc"];
var prot;
......@@ -22,9 +21,8 @@
prot = asc['spreadsheet_api'].prototype;
prot['asc_addComment'] = prot.asc_addComment;
})(jQuery, window);
CCellCommentator.prototype.addComment = function(comment, bIsNotUpdate) {
AscCommonExcel.CCellCommentator.prototype.addComment = function(comment, bIsNotUpdate) {
var t = this;
var oComment = comment;
var bChange = false;
......@@ -55,4 +53,5 @@ CCellCommentator.prototype.addComment = function(comment, bIsNotUpdate) {
t._addComment(oComment, bChange, bIsNotUpdate);
};
this.isLockedComment(oComment, onAddCommentCallback);
};
\ No newline at end of file
};
})(window);
......@@ -1205,7 +1205,7 @@ var editor;
} else if (lockType === AscCommonExcel.c_oAscLockTypeElem.Range || lockType === AscCommonExcel.c_oAscLockTypeElem.Sheet) {
ws.updateSelection();
}
} else if (-1 !== lockSheetId && 0 === lockSheetId.indexOf(CCellCommentator.sStartCommentId)) {
} else if (-1 !== lockSheetId && 0 === lockSheetId.indexOf(AscCommonExcel.CCellCommentator.sStartCommentId)) {
// Коммментарий
t.handlers.trigger("asc_onLockComment", lockElem.Element["rangeOrObjectId"], e["user"]);
}
......@@ -3016,7 +3016,7 @@ var editor;
spreadsheet_api.prototype._onCheckCommentRemoveLock = function(lockElem) {
var res = false;
var sheetId = lockElem["sheetId"];
if (-1 !== sheetId && 0 === sheetId.indexOf(CCellCommentator.sStartCommentId)) {
if (-1 !== sheetId && 0 === sheetId.indexOf(AscCommonExcel.CCellCommentator.sStartCommentId)) {
// Коммментарий
res = true;
this.handlers.trigger("asc_onUnLockComment", lockElem["rangeOrObjectId"]);
......
"use strict";
/* CellComment.js
*
* Author: Dmitry Vikulov
* Date: 06/02/2013
(
/**
* @param {Window} window
* @param {undefined} undefined
*/
//-----------------------------------------------------------------------------------
// CommentCoords
//-----------------------------------------------------------------------------------
//{ ASC Classes
function (window, undefined) {
/** @constructor */
function asc_CCommentCoords(obj) {
......@@ -68,8 +63,6 @@ function asc_CCommentCoords(obj) {
this.bSizeWithCells = obj.bSizeWithCells;
}
}
// Prototype
asc_CCommentCoords.prototype = {
asc_setRow: function(val) { this.nRow = val; },
......@@ -136,30 +129,24 @@ asc_CCommentCoords.prototype = {
asc_getSizeWithCells: function() { return this.bSizeWithCells; }
};
window["Asc"]["asc_CCommentCoords"] = window["Asc"].asc_CCommentCoords = asc_CCommentCoords;
//-----------------------------------------------------------------------------------
// CommentData
//-----------------------------------------------------------------------------------
var g_oCCommentDataProperties = {
wsId: 0,
nCol: 1,
nRow: 2,
nId: 3,
nLevel: 5,
sText: 6,
sQuoteText: 7,
sTime: 8,
sUserId: 9,
sUserName: 10,
bDocument: 11,
bSolved: 12,
aReplies: 13,
bHidden: 14
};
/** @constructor */
function asc_CCommentData(obj) {
this.Properties = g_oCCommentDataProperties;
this.Properties = {
wsId: 0,
nCol: 1,
nRow: 2,
nId: 3,
nLevel: 5,
sText: 6,
sQuoteText: 7,
sTime: 8,
sUserId: 9,
sUserName: 10,
bDocument: 11,
bSolved: 12,
aReplies: 13,
bHidden: 14
};
this.bHidden = false;
this.wsId = null;
......@@ -204,8 +191,6 @@ function asc_CCommentData(obj) {
}
}
}
// Prototype
asc_CCommentData.prototype = {
guid: function () {
function S4() {
......@@ -336,71 +321,15 @@ asc_CCommentData.prototype = {
}
};
window["Asc"]["asc_CCommentData"] = window["Asc"].asc_CCommentData = asc_CCommentData;
prot = asc_CCommentData.prototype;
prot["asc_putRow"] = prot.asc_putRow;
prot["asc_getRow"] = prot.asc_getRow;
prot["asc_putCol"] = prot.asc_putCol;
prot["asc_getCol"] = prot.asc_getCol;
prot["asc_putId"] = prot.asc_putId;
prot["asc_getId"] = prot.asc_getId;
prot["asc_putLevel"] = prot.asc_putLevel;
prot["asc_getLevel"] = prot.asc_getLevel;
prot["asc_putParent"] = prot.asc_putParent;
prot["asc_getParent"] = prot.asc_getParent;
prot["asc_putText"] = prot.asc_putText;
prot["asc_getText"] = prot.asc_getText;
prot["asc_putQuoteText"] = prot.asc_putQuoteText;
prot["asc_getQuoteText"] = prot.asc_getQuoteText;
prot["asc_putTime"] = prot.asc_putTime;
prot["asc_getTime"] = prot.asc_getTime;
prot["asc_putUserId"] = prot.asc_putUserId;
prot["asc_getUserId"] = prot.asc_getUserId;
prot["asc_putUserName"] = prot.asc_putUserName;
prot["asc_getUserName"] = prot.asc_getUserName;
prot["asc_putDocumentFlag"] = prot.asc_putDocumentFlag;
prot["asc_getDocumentFlag"] = prot.asc_getDocumentFlag;
prot["asc_putHiddenFlag"] = prot.asc_putHiddenFlag;
prot["asc_getHiddenFlag"] = prot.asc_getHiddenFlag;
prot["asc_putSolved"] = prot.asc_putSolved;
prot["asc_getSolved"] = prot.asc_getSolved;
prot["asc_getRepliesCount"] = prot.asc_getRepliesCount;
prot["asc_getReply"] = prot.asc_getReply;
prot["asc_addReply"] = prot.asc_addReply;
prot["asc_getMasterCommentId"] = prot.asc_getMasterCommentId;
//}
//-----------------------------------------------------------------------------------
// CompositeCommentData
//-----------------------------------------------------------------------------------
var g_oCompositeCommentDataProperties = {
commentBefore: 0,
commentAfter: 1
};
function CompositeCommentData() {
this.commentBefore = null;
this.commentAfter = null;
this.Properties = g_oCompositeCommentDataProperties;
this.Properties = {
commentBefore: 0,
commentAfter: 1
};
}
CompositeCommentData.prototype = {
// For collaborative editing
getType: function() {
......@@ -427,9 +356,6 @@ CompositeCommentData.prototype = {
}
};
//-----------------------------------------------------------------------------------
// CellCommentator
//-----------------------------------------------------------------------------------
/** @constructor */
function CCellCommentator(currentSheet) {
this.worksheet = currentSheet;
......@@ -1515,4 +1441,44 @@ CCellCommentator.prototype.Redo = function(type, data) {
}
break;
}
};
\ No newline at end of file
};
//----------------------------------------------------------export----------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
window["AscCommonExcel"].asc_CCommentCoords = asc_CCommentCoords;
window["AscCommonExcel"].CCellCommentator = CCellCommentator;
window['Asc'] = window['Asc'] || {};
window["Asc"]["asc_CCommentData"] = window["Asc"].asc_CCommentData = asc_CCommentData;
prot = asc_CCommentData.prototype;
prot["asc_putRow"] = prot.asc_putRow;
prot["asc_getRow"] = prot.asc_getRow;
prot["asc_putCol"] = prot.asc_putCol;
prot["asc_getCol"] = prot.asc_getCol;
prot["asc_putId"] = prot.asc_putId;
prot["asc_getId"] = prot.asc_getId;
prot["asc_putLevel"] = prot.asc_putLevel;
prot["asc_getLevel"] = prot.asc_getLevel;
prot["asc_putParent"] = prot.asc_putParent;
prot["asc_getParent"] = prot.asc_getParent;
prot["asc_putText"] = prot.asc_putText;
prot["asc_getText"] = prot.asc_getText;
prot["asc_putQuoteText"] = prot.asc_putQuoteText;
prot["asc_getQuoteText"] = prot.asc_getQuoteText;
prot["asc_putTime"] = prot.asc_putTime;
prot["asc_getTime"] = prot.asc_getTime;
prot["asc_putUserId"] = prot.asc_putUserId;
prot["asc_getUserId"] = prot.asc_getUserId;
prot["asc_putUserName"] = prot.asc_putUserName;
prot["asc_getUserName"] = prot.asc_getUserName;
prot["asc_putDocumentFlag"] = prot.asc_putDocumentFlag;
prot["asc_getDocumentFlag"] = prot.asc_getDocumentFlag;
prot["asc_putHiddenFlag"] = prot.asc_putHiddenFlag;
prot["asc_getHiddenFlag"] = prot.asc_getHiddenFlag;
prot["asc_putSolved"] = prot.asc_putSolved;
prot["asc_getSolved"] = prot.asc_getSolved;
prot["asc_getRepliesCount"] = prot.asc_getRepliesCount;
prot["asc_getReply"] = prot.asc_getReply;
prot["asc_addReply"] = prot.asc_addReply;
prot["asc_getMasterCommentId"] = prot.asc_getMasterCommentId;
})(window);
......@@ -6155,7 +6155,7 @@
var oThis = this;
if ( c_oSerWorksheetsTypes.Comment == type )
{
var oCommentCoords = new Asc.asc_CCommentCoords();
var oCommentCoords = new AscCommonExcel.asc_CCommentCoords();
var aCommentData = [];
res = this.bcr.Read2Spreadsheet(length, function(t,l){
return oThis.ReadComment(t,l, oCommentCoords, aCommentData);
......
......@@ -666,7 +666,7 @@
self.defNameAllowCreate = !(reason == Asc.c_oAscDefinedNameReason.LockDefNameManager);
});
this.cellCommentator = new CCellCommentator({
this.cellCommentator = new AscCommonExcel.CCellCommentator({
model: new WorkbookCommentsModel(this.handlers),
collaborativeEditing: this.collaborativeEditing,
draw: function() {
......
......@@ -347,7 +347,7 @@
this.collaborativeEditing = collaborativeEditing;
this.drawingArea = new DrawingArea( this );
this.cellCommentator = new CCellCommentator( this );
this.cellCommentator = new AscCommonExcel.CCellCommentator(this);
this.objectRender = null;
this._init();
......
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