Skip to content

Commit

Permalink
[se] Add asc_GetPageBreaksDisableType
Browse files Browse the repository at this point in the history
  • Loading branch information
GoshaZotov committed Jul 18, 2023
1 parent ae3992e commit 00bf82f
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 8 deletions.
45 changes: 38 additions & 7 deletions cell/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -5813,9 +5813,22 @@ var editor;
return oWorksheet.getActiveCellCoord(useUpRightMerge);
}
}

};

// Получить координаты активной ячейки
spreadsheet_api.prototype.asc_getActiveCell = function() {
var oWorksheet = this.wb.getWorksheet();
if(oWorksheet){
if(oWorksheet.isSelectOnShape){
return null;
}
else{
return oWorksheet.getActiveCell();
}
}

};

// Получить координаты для каких-либо действий (для общей схемы)
spreadsheet_api.prototype.asc_getAnchorPosition = function() {
return this.asc_getActiveCellCoord();
Expand Down Expand Up @@ -8820,16 +8833,34 @@ var editor;
return ws.resetAllPageBreaks();
};

spreadsheet_api.prototype.asc_isContainsPageBreaks = function (index) {
spreadsheet_api.prototype.asc_GetPageBreaksDisableType = function (index) {
if (!this.wbModel) {
return;
}
let sheetIndex = (undefined !== index && null !== index) ? index : this.wbModel.getActive();
let ws = this.wbModel.getWorksheet(sheetIndex);
let res = Asc.c_oAscPageBreaksDisableType.none;
if (ws) {
let isPageBreaks = ws && ((ws.colBreaks && ws.colBreaks.getCount()) || (ws.rowBreaks && ws.rowBreaks.getCount()));
let activeCell = ws.selectionRange && ws.selectionRange.activeCell;
let isFirstActiveCell = activeCell && activeCell.col === 0 && activeCell.row === 0;

if (isFirstActiveCell && !isPageBreaks) {
//disable all
res = Asc.c_oAscPageBreaksDisableType.all;
} else if (isFirstActiveCell && isPageBreaks) {
//disable insert/remove
res = Asc.c_oAscPageBreaksDisableType.insertRemove;
} else if (!isFirstActiveCell && !isPageBreaks) {
//disable reset
res = Asc.c_oAscPageBreaksDisableType.reset;
}
}

return ws && ((ws.colBreaks && ws.colBreaks.getCount()) || (ws.rowBreaks && ws.rowBreaks.getCount()));
return res;
};


/*
* Export
* -----------------------------------------------------------------------------
Expand Down Expand Up @@ -9395,10 +9426,10 @@ var editor;

prot["asc_ChangeTextCase"] = prot.asc_ChangeTextCase;

prot["asc_InsertPageBreak"] = prot.asc_InsertPageBreak;
prot["asc_RemovePageBreak"] = prot.asc_RemovePageBreak;
prot["asc_ResetAllPageBreaks"] = prot.asc_ResetAllPageBreaks;
prot["asc_isContainsPageBreaks"] = prot.asc_isContainsPageBreaks;
prot["asc_InsertPageBreak"] = prot.asc_InsertPageBreak;
prot["asc_RemovePageBreak"] = prot.asc_RemovePageBreak;
prot["asc_ResetAllPageBreaks"] = prot.asc_ResetAllPageBreaks;
prot["asc_GetPageBreaksDisableType"]= prot.asc_GetPageBreaksDisableType;



Expand Down
17 changes: 16 additions & 1 deletion cell/apiDefines.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,15 @@ var c_oAscPopUpSelectorType = {
path: 2
};

//----------------------------------------------------------export----------------------------------------------------
var c_oAscPageBreaksDisableType = {
none: 0,
all: 1,
insertRemove: 3,
reset: 3
};


//----------------------------------------------------------export----------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
window['AscCommonExcel'].c_oAscDrawDepOptions = c_oAscDrawDepOptions;
window['AscCommonExcel'].c_oAscScrollType = c_oAscScrollType;
Expand Down Expand Up @@ -965,5 +973,12 @@ var c_oAscPopUpSelectorType = {
prot['link'] = prot.link;
prot['path'] = prot.path;

window['Asc']['c_oAscPageBreaksDisableType'] = window['Asc'].c_oAscPageBreaksDisableType = c_oAscPageBreaksDisableType;
prot = c_oAscPageBreaksDisableType;
prot['none'] = prot.none;
prot['all'] = prot.all;
prot['insertRemove'] = prot.insertRemove;
prot['reset'] = prot.reset;


})(window);

0 comments on commit 00bf82f

Please sign in to comment.