Highlight the current row and column in Calc – difficulty interesting EasyHack

In large computer displays, it is somehow hard to track the active cell, and the associated row and column. One of the solutions provided to fix this problem is to highlight the row and column. The feature request is visible in tdf#33201:

  • Update (December 2023): This task is complete, as visible in these commits.

The importance

This is requested for a long time, but until now no developer has put time to make it a reality. This feature request has is a difficutlyIntersting EasyHack, which means it is among the EasyHacks that need more work compared to the difficutlyBeginner and difficutlyMedium ones.

I will describe the details of the task, and if you find it interesting, you can start working on it. Solving difficutlyIntersting EasyHacks is among the criterias for selecting GSoC candidates, so it worth trying if you want to be among next year GSoC candidates.

Highlighting the row and column in Calc

Highlighting the row and column in Calc

One of the contributors have created the above mock-up to show that how the implementation should look like. As you can see, it is somehow similar to a combination of the situations where you select a row, and a column. This can provide an insight on the possible path to the actual implementation. The only difference is that the actual color of the selected cell should be different.

Code pointers to highlight row and column

Eike, an experienced LibreOffice developer, suggests that one should look intoScTabView::MarkRows() and ScTabView::MarkColumns(). These functions are called for .uno:SelectRow and .uno:SelectColumn. As described previously, the selected cell should have a different color.

To do the implementation, one should add HighlightOverlay to the OverlayManager. As a similar implementation, SelectionOverlay is updated from InitBlockMode() as ScGridWindow::UpdateSelectionOverlay(), for example like UpdateHighlightOverlay().

Rafael, another active community member, suggests looking into these files, and add a new sdr::overlay::OverlayObjectList to handle the new highlight overlay:

sc/source/ui/inc/gridwin.hxx
sc/source/ui/view/gridwin.cxx
sc/source/ui/view/gridwin4.cxx

Heiko, the UX mentor for LibreOffice, has mentioned that this feature should be optional. He suggested to use this path in options:

Tools > Options > Calc > View: “[x] Highlight col/row <Blue>

Final Notes

To implement this feature, first you have to build LibreOffice from the sources. If you have not done that yet, please refer to this guide first:

Getting Started (Video Tutorial)