showLockContainer: function() { if (cache.protectState) { Backbone.trigger('event:showMsgBar:show', '保护状态,不能进行该操作'); return; } Backbone.trigger('event:sidebarContainer:show', 'lock'); },
var setFontFamily = function(sheetId, fontFamily, label) { var clip, region, operRegion, sendRegion, headItemRowList = headItemRows.models, headItemColList = headItemCols.models, changeModelList = []; clip = selectRegions.getModelByType('clip'); if (clip !== undefined) { cache.clipState = 'null'; clip.destroy(); } if (cache.protectState) { Backbone.trigger('event:showMsgBar:show','保护状态,不能进行该操作'); return; } region = getOperRegion(label); operRegion = region.operRegion; sendRegion = region.sendRegion; if (operRegion.startColIndex === -1 || operRegion.startRowIndex === -1) { sendData(); return; } if (operRegion.endColIndex === 'MAX') { //整行操作 rowOperate.rowPropOper(operRegion.startRowIndex, operRegion.endRowIndex, 'content.family', fontFamily); } else if (operRegion.endRowIndex === 'MAX') { colOperate.colPropOper(operRegion.startColIndex, operRegion.endColIndex, 'content.family', fontFamily); } else { cells.oprCellsByRegion(operRegion, function(cell, colSort, rowSort) { if (cell.get('content').family !== fontFamily) { changeModelList.push({ colSort: colSort, rowSort: rowSort, value: cell.get('content').family }); cell.set('content.family', fontFamily); } }); history.addAction(history.getCellPropUpdateAction('content.family', fontFamily, { startColSort: headItemColList[operRegion.startColIndex].get('sort'), startRowSort: headItemRowList[operRegion.startRowIndex].get('sort'), endColSort: headItemColList[operRegion.endColIndex].get('sort'), endRowSort: headItemRowList[operRegion.endRowIndex].get('sort') }, changeModelList)); } sendData(); function sendData() { send.PackAjax({ url: config.url.cell.fontFamily, data: JSON.stringify({ coordinate: sendRegion, family: fontFamily }) }); } };
editState: function() { var modelJSON = this.model.toJSON(), startRowIndex, startColIndex, endRowIndex, endColIndex, isAble; if (cache.mouseOperateState !== config.mouseOperateState.select) { return; } startRowIndex = headItemRows.getIndexByAlias(modelJSON.wholePosi.startY); startColIndex = headItemCols.getIndexByAlias(modelJSON.wholePosi.startX); endRowIndex = headItemRows.getIndexByAlias(modelJSON.wholePosi.endY); endColIndex = headItemCols.getIndexByAlias(modelJSON.wholePosi.endX); isAble = protect.interceptor({ startRowIndex: startRowIndex, startColIndex: startColIndex, endColIndex: endColIndex, endRowIndex: endRowIndex }); if (isAble) { return; } Backbone.trigger('event:InputContainer:show', true); },
var setCellHeight = function(sheetId, rowLabel, height) { var index; if (cache.TempProp.isFrozen === true) { return; } index = headItemRows.getIndexByDisplayname(rowLabel); if (index > -1) { // adjustHeight = height - headItemRows.models[index].get('height'); Backbone.trigger('event:rowHeightAdjust', index, height); } };
close: function(e) { e.preventDefault(); Backbone.trigger('event:sidebarContainer:remove'); },
setDataSourceState: function() { Backbone.trigger('event:cellsContainer:setMouseState', 'locatedState' , 'dataSourceLocatedState'); Backbone.trigger('event:colsHeadContainer:setMouseState', 'locatedState' , 'dataSourceLocatedState'); Backbone.trigger('event:rowsHeadContainer:setMouseState', 'locatedState' , 'dataSourceLocatedState'); },
setSelectState: function() { Backbone.trigger('event:cellsContainer:setMouseState', 'locatedState' , 'selectLocatedState'); Backbone.trigger('event:colsHeadContainer:setMouseState', 'locatedState' , 'selectLocatedState'); Backbone.trigger('event:rowsHeadContainer:setMouseState', 'locatedState' , 'selectLocatedState'); },
var setFontStyle = function(sheetId, italic, label) { var clip, region, operRegion, sendRegion, tempCellList, headItemRowList = headItemRows.models, headItemColList = headItemCols.models, changeModelList = []; clip = selectRegions.getModelByType('clip'); if (clip !== undefined) { cache.clipState = 'null'; clip.destroy(); } if (cache.protectState) { Backbone.trigger('event:showMsgBar:show', '保护状态,不能进行该操作'); return; } region = getOperRegion(label); operRegion = region.operRegion; sendRegion = region.sendRegion; if (operRegion.startColIndex === -1 || operRegion.startRowIndex === -1) { sendData(); return; } if (italic === 'italic') { italic = true; } else if (italic === 'normal') { italic = false; } else { tempCellList = cells.getCellByVertical(operRegion.startColIndex, operRegion.startRowIndex, operRegion.endColIndex, operRegion.endRowIndex); if (tempCellList === null || tempCellList === undefined || tempCellList.length === 0) { italic = true; } else { italic = !tempCellList[0].get('content').italic; } } if (operRegion.endColIndex === 'MAX') { //整行操作 rowOperate.rowPropOper(operRegion.startRowIndex, operRegion.endRowIndex, 'content.italic', italic); } else if (operRegion.endRowIndex === 'MAX') { colOperate.colPropOper(operRegion.startColIndex, operRegion.endColIndex, 'content.italic', italic); } else { cells.oprCellsByRegion(operRegion, function(cell, colSort, rowSort) { if (cell.get('content').italic !== italic) { changeModelList.push({ colSort: colSort, rowSort: rowSort, value: cell.get('content').italic }); cell.set('content.italic', italic); } }); history.addAction(history.getCellPropUpdateAction('content.italic', italic, { startColSort: headItemColList[operRegion.startColIndex].get('sort'), startRowSort: headItemRowList[operRegion.startRowIndex].get('sort'), endColSort: headItemColList[operRegion.endColIndex].get('sort'), endRowSort: headItemRowList[operRegion.endRowIndex].get('sort') }, changeModelList)); } sendData(); function sendData() { send.PackAjax({ url: config.url.cell.fontItalic, data: JSON.stringify({ coordinate: sendRegion, italic: italic }) }); } };
adaptScreen = function() { Backbone.trigger('call:screenContainer:adaptScreen'); };
_toggle: function(lock, arrOper) { var clip, region, operRegion, sendRegion, cellList = [], i, len1, j, len2, tempCell, tempArr = [], tempLock; if (cache.protectState) { Backbone.trigger('event:showMsgBar:show', '保护状态,不能进行该操作'); return; } if (clip = selects.getModelByType('clip')) { cache.clipState = 'null'; clip.destroy(); } region = getOperRegion(arrOper); operRegion = region.operRegion; sendRegion = region.sendRegion; //整行操作或多行操作 if (operRegion.endColIndex === 'MAX') { //筛选出已经进行设置过的锁定列 for (i = 0, len1 = colList.length; i < len1; i++) { if (typeof(tempLock = colList[i].get('operProp').locked) === 'boolean' && tempLock !== lock) { tempArr.push(i); } } for (i = operRegion.startRowIndex, len1 = operRegion.endRowIndex + 1; i < len1; i++) { rowList[i].set('operProp.locked', lock); //交叉位置创建单元格 for (j = 0, len2 = tempArr.length; j < len2; j++) { tempCell = cells.createCellModel(tempArr[j], i); tempCell.set('locked', lock); } } cellList = cells.getCellByVertical(operRegion); for (i = 0, len1 = cellList.length; i < len1; i++) { cellList[i].set('locked', lock); } //整列或多列操作 } else if (operRegion.endRowIndex === 'MAX') { for (i = 0, len2 = rowList.length; i < len2; i++) { if (typeof(tempLock = rowList[i].get('operProp').locked) === 'boolean' && tempLock !== lock) { tempArr.push(i); } } for (i = operRegion.startColIndex, len1 = operRegion.endColIndex + 1; i < len1; i++) { colList[i].set('operProp.locked', lock); //交叉位置创建单元格 for (j = 0, len2 = tempArr.length; j < len2; j++) { tempCell = cells.createCellModel(i, tempArr[j]); tempCell.set('locked', lock); } } cellList = cells.getCellByVertical(operRegion); for (i = 0, len1 = cellList.length; i < len1; i++) { cellList[i].set('locked', lock); } } else { cells.oprCellsByRegion(operRegion, function(cell) { cell.set('locked', lock); }); } send.PackAjax({ url: config.url.cell.lock, data: JSON.stringify({ coordinate: [sendRegion], lock: lock }) }); },
showProtectContainer: function() { Backbone.trigger('event:sidebarContainer:show', 'protect'); }
destroy: function() { Backbone.trigger('event:rowsHeadContainer:destroy'); Backbone.off('call:rowsAllHeadContainer'); this.siderLineRowContainer.destroy(); this.remove(); }