summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHubert Figuière <hub@collabora.com>2024-04-25 13:59:01 -0400
committerCaolán McNamara <caolanm@gmail.com>2024-04-29 14:42:18 +0100
commit978dc59ce1da92a62f5ce285fac06c412c674b70 (patch)
tree62c9bec184d9c6289d5d7ac3dcd9532b0c38f4c9
parentbrowser: preview: fix invalidate previews when resize (diff)
downloadonline-978dc59ce1da92a62f5ce285fac06c412c674b70.tar.gz
online-978dc59ce1da92a62f5ce285fac06c412c674b70.zip
calc: Implement hiding the grid lines
Fixes #8066 Requires https://gerrit.libreoffice.org/c/core/+/166647 Signed-off-by: Hubert Figuière <hub@collabora.com> Change-Id: I2196e1a8e654a8afd20519b18f00cefafa048f2c
-rw-r--r--browser/src/control/Control.JSDialogBuilder.js3
-rw-r--r--browser/src/control/Control.Menubar.js2
-rw-r--r--browser/src/control/Control.NotebookbarCalc.js7
-rw-r--r--browser/src/layer/tile/CalcTileLayer.js8
-rw-r--r--browser/src/layer/tile/CanvasTileLayer.js4
-rw-r--r--browser/src/unocommands.js1
6 files changed, 24 insertions, 1 deletions
diff --git a/browser/src/control/Control.JSDialogBuilder.js b/browser/src/control/Control.JSDialogBuilder.js
index a33a2aa991..7357a035a8 100644
--- a/browser/src/control/Control.JSDialogBuilder.js
+++ b/browser/src/control/Control.JSDialogBuilder.js
@@ -2217,7 +2217,8 @@ L.Control.JSDialogBuilder = L.Control.extend({
'downloadas-epub': 'exportepub',
'languagestatusmenu': 'languagemenu',
'cancelsearch': 'cancel',
- 'printoptions': 'print'
+ 'printoptions': 'print',
+ 'togglesheetgrid': 'show',
};
if (iconURLAliases[cleanName]) {
cleanName = iconURLAliases[cleanName];
diff --git a/browser/src/control/Control.Menubar.js b/browser/src/control/Control.Menubar.js
index 50682d8391..1ee4b31874 100644
--- a/browser/src/control/Control.Menubar.js
+++ b/browser/src/control/Control.Menubar.js
@@ -722,6 +722,8 @@ L.Control.Menubar = L.Control.extend({
{name: _('Dark Mode'), id: 'toggledarktheme', type: 'action'},
{uno: '.uno:SidebarDeck.PropertyDeck', name: _UNO('.uno:Sidebar')},
{uno: '.uno:Navigator', id: 'navigator'},
+ {type: 'separator'},
+ {name: _UNO('.uno:ToggleSheetGrid', 'spreadsheet', true), uno: '.uno:ToggleSheetGrid', id: 'sheetgrid'},
{name: _UNO('.uno:FreezePanes', 'spreadsheet', true), id: 'FreezePanes', type: 'action', uno: '.uno:FreezePanes'},
{name: _UNO('.uno:FreezeCellsMenu', 'spreadsheet', true), id: 'FreezeCellsMenu', type: 'menu', uno: '.uno:FreezeCellsMenu', menu: [
{name: _UNO('.uno:FreezePanesColumn', 'spreadsheet', true), id: 'FreezePanesColumn', type: 'action', uno: '.uno:FreezePanesColumn'},
diff --git a/browser/src/control/Control.NotebookbarCalc.js b/browser/src/control/Control.NotebookbarCalc.js
index 97f48e7cfb..042be1a335 100644
--- a/browser/src/control/Control.NotebookbarCalc.js
+++ b/browser/src/control/Control.NotebookbarCalc.js
@@ -1139,6 +1139,13 @@ L.Control.NotebookbarCalc = L.Control.NotebookbarWriter.extend({
],
'vertical': 'true'
},
+ {
+ 'id': 'view-togglegrid',
+ 'type': 'bigtoolitem',
+ 'text': _UNO('.uno:ToggleSheetGrid'),
+ 'command': '.uno:ToggleSheetGrid',
+ 'accessibility': { focusBack: true, combination: 'SG', de: null }
+ },
(window.mode.isTablet()) ?
{
'id': 'closemobile',
diff --git a/browser/src/layer/tile/CalcTileLayer.js b/browser/src/layer/tile/CalcTileLayer.js
index 6a91ecd56b..9443e6fd15 100644
--- a/browser/src/layer/tile/CalcTileLayer.js
+++ b/browser/src/layer/tile/CalcTileLayer.js
@@ -90,6 +90,7 @@ L.CalcTileLayer = L.CanvasTileLayer.extend({
this.insertMode = false;
this._resetInternalState();
this._sheetSwitch = new L.SheetSwitchViewRestore(map);
+ this._sheetGrid = true;
},
_resetInternalState: function() {
@@ -839,6 +840,13 @@ L.CalcTileLayer = L.CanvasTileLayer.extend({
*/
this.insertMode = e.state.trim() === '' ? false: true;
}
+ else if (e.commandName === '.uno:ToggleSheetGrid') {
+ let newState = e.state.trim() === 'true';
+ if (this._sheetGrid != newState) {
+ this._sheetGrid = newState;
+ this._painter._sectionContainer.requestReDraw();
+ }
+ }
},
_onSplitStateChanged: function (e, isSplitCol) {
diff --git a/browser/src/layer/tile/CanvasTileLayer.js b/browser/src/layer/tile/CanvasTileLayer.js
index ef78c52ca2..f4ae62945e 100644
--- a/browser/src/layer/tile/CanvasTileLayer.js
+++ b/browser/src/layer/tile/CanvasTileLayer.js
@@ -393,6 +393,10 @@ L.TileSectionManager = L.Class.extend({
if (this.containerObject.isInZoomAnimation() || this.sectionProperties.tsManager.waitForTiles())
return;
+ // We don't show the sheet grid, so we don't draw it.
+ if (!this.sectionProperties.docLayer._sheetGrid)
+ return;
+
// grid-section's onDrawArea is TileSectionManager's _drawGridSectionArea().
this.onDrawArea();
},
diff --git a/browser/src/unocommands.js b/browser/src/unocommands.js
index 535f531070..2159c2d12a 100644
--- a/browser/src/unocommands.js
+++ b/browser/src/unocommands.js
@@ -470,6 +470,7 @@ var unoCommandsArray = {
'ThesaurusDialog':{global:{menu:_('~Thesaurus...'),},text:{menu:_('~Thesaurus...'),},},
'TitlePageDialog':{text:{menu:_('Title Page...'),},},
'ToggleMergeCells':{spreadsheet:{context:_('Merge and center or unmerge cells depending on the current toggle state'),menu:_('M~erge and Center Cells'),},},
+ 'ToggleSheetGrid':{global:{menu:_('View ~Grid Lines'),},},
'ToolsMenu':{global:{menu:_('~Tools'),},},
'TrackChanges':{text:{context:_('Record Track Changes'),menu:_('~Record'),},},
'TransformDialog':{global:{menu:_('Position and Si~ze...'),},},