Skip to content

Commit

Permalink
calc: feat: expose name-range functionality from core using unocommands
Browse files Browse the repository at this point in the history
- https://help.libreoffice.org/6.2/en-US/text/scalc/01/04070000.html
- added new button in Data->Define Range

Signed-off-by: Rashesh <[email protected]>
Change-Id: I986141e344aa4ff08f7c1092fa61630ac268eddf
  • Loading branch information
Rash419 committed Aug 20, 2024
1 parent ff6a2c7 commit 0e2fea4
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 4 deletions.
1 change: 1 addition & 0 deletions browser/images/dark/lc_definedbname.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions browser/images/lc_definedbname.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion browser/src/control/Control.FormulaAutoCompletePopup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ class FormulaAutoCompletePopup extends L.Control.AutoCompletePopup {
var currentText = this.map._docLayer._lastFormula;
var chIndex = currentText.length - 1;
var functionName = this.functionList[index].name;
var namedRange = this.functionList[index].namedRange;
functionName = functionName.substring(chIndex);
this.map._textInput._sendText(functionName + '(');
if (namedRange) this.map._textInput._sendText(functionName);
else this.map._textInput._sendText(functionName + '(');
this.closePopup();
} else if (eventType === 'keydown') {
if (object.key !== 'Tab' && object.key !== 'Shift') {
Expand Down
7 changes: 7 additions & 0 deletions browser/src/control/Control.NotebookbarCalc.js
Original file line number Diff line number Diff line change
Expand Up @@ -1802,6 +1802,13 @@ L.Control.NotebookbarCalc = L.Control.NotebookbarWriter.extend({
'enabled': 'true',
'accessibility': { focusBack: true, combination: 'DS', de: null }
},
{
'id': 'data-define-range',
'type': 'bigtoolitem',
'text': _UNO('.uno:DefineDBName', 'spreadsheet'),
'command': '.uno:DefineDBName',
'accessibility': { focusBack: true, combination: 'DR', de: null }
},
];

return this.getTabPage('Data', content);
Expand Down
13 changes: 10 additions & 3 deletions browser/src/layer/tile/CanvasTileLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2067,9 +2067,16 @@ L.CanvasTileLayer = L.Layer.extend({
var suggestionArray = JSON.parse(textMsg);
for (var i = 0; i < suggestionArray.length; i++) {
var signature = suggestionArray[i].signature;
var name = signature.substring(0,signature.indexOf('('));
var description = suggestionArray[i].description;
resultList.push({'name': name, 'description': description});
var namedRange = suggestionArray[i].namedRange;
var name, description;
if (namedRange) {
name = signature;
description = _('Named Range');
} else {
name = signature.substring(0,signature.indexOf('('));
description = suggestionArray[i].description;
}
resultList.push({'name': name, 'description': description, 'namedRange': namedRange});
}
return resultList;
},
Expand Down
1 change: 1 addition & 0 deletions browser/src/unocommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ var unoCommandsArray = {
'DecrementSubLevels':{text:{menu:_('Demote Outline Level with Subpoints'),},},
'DefaultBullet':{global:{context:_('Toggle Unordered List'),menu:_('~Unordered List'),},},
'DefaultNumbering':{global:{context:_('Toggle Ordered List'),menu:_('~Ordered List'),},},
'DefineDBName':{spreadsheet:{menu:_('~Define Range...'),},},
'DefineName':{spreadsheet:{menu:_('~Manage...'),},},
'DefinePrintArea':{spreadsheet:{menu:_('~Define'),},},
'Delete':{global:{menu:_('Delete C~ontents...'),},spreadsheet:{context:_('Cl~ear Contents...'),menu:_('Cle~ar Cells...'),},},
Expand Down

0 comments on commit 0e2fea4

Please sign in to comment.