Bug 127341 - FORMATTING: Right-click on a cell with hyperlink should show 'Format Cells...' command
Summary: FORMATTING: Right-click on a cell with hyperlink should show 'Format Cells......
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.4.0.0.alpha1+
Hardware: All All
: medium enhancement
Assignee: Armin Le Grand
URL:
Whiteboard: target:7.4.0
Keywords:
Depends on:
Blocks: Context-Menu Hyperlink-Calc
  Show dependency treegraph
 
Reported: 2019-09-04 15:49 UTC by Thomas Lendo
Modified: 2022-02-03 16:18 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Lendo 2019-09-04 15:49:29 UTC
When you make a right-click on a cell, then a context menu appears with the command 'Format Cells...' at its end.

But if you do this right-click on a hyperlink, then this cell format command is missing and the hyperlink-related context menu is popping up.

This is no problem if only a part of the cell content contains a hyperlink. But if the whole content is a hyperlink, you can't open the 'Format Cells...' command with a right-click.

You can test it in attachment 153875 [details].

Possible solution could be to add the 'Format Cells...' to the hyperlink-related context menu. But I don't know where this context menu also is used and if this leads to a false behavior elsewhere.


Steps to reproduce:
1. Open a new Calc document.
2. Write text in a cell that is as long as the cell is wide.
3. Select the cell (not the string in it) and click the 'Insert Hyperlink' command. Insert a web address or something else.
4. Right-click on this cell with a hyperlink.

If you want to edit the whole cell and not the content/hyperlink, it's not possible anymore. Right-clicking on a hyperlink brings you the hyperlink context menu and not the cell context menu.
Comment 1 m.a.riosv 2019-09-05 07:57:25 UTC
If I'm not wrong Context Menus can be edit through Menu/Tools/Customize/Context Menus - (Target) Cell Edit
Comment 2 Thomas Lendo 2019-09-05 08:55:15 UTC
(In reply to m.a.riosv from comment #1)
> If I'm not wrong Context Menus can be edit through
> Menu/Tools/Customize/Context Menus - (Target) Cell Edit
Right. But I'm writing this report not for me but for all users from Benjamin to Eve. [1]

[1] https://wiki.documentfoundation.org/Design/HIG_foundations#Persona
Comment 3 Roman Kuznetsov 2019-09-05 19:37:47 UTC
confirm wrong behavior when we use right-click on hyperlink in the Calc cell. We see hyperlink context menu instead cell context menu. 
We can make cell wider and then right click on empty space in the cell and then we'll see normal cell context menu

Версия: 6.4.0.0.alpha0+
ID сборки: 2bed8af91fc2654b9ed2432f969d32d5741a529b
Потоков ЦП: 4; ОС:Linux 5.2; Отрисовка ИП: по умолчанию; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2019-08-21_09:30:10
Локаль: ru-RU (ru_RU.UTF-8); Язык интерфейса: ru-RU
Calc: threaded

Samuel, any opinion?
Comment 4 Samuel Mehrbrodt (allotropia) 2019-09-06 06:14:23 UTC
Ah the problem seems to be that when right clicking on a cell with a hyperlink beneath, the cell edit mode is activated and so the context menu for the hyperlink appears.

Instead, the behavior should be that when right clicking on a cell, always the cell context menu should appear, even when a hyperlink is below the cursor.
Comment 5 Thomas Lendo 2019-09-07 08:38:40 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #4)
> Ah the problem seems to be that when right clicking on a cell with a
> hyperlink beneath, the cell edit mode is activated and so the context menu
> for the hyperlink appears.
> 
> Instead, the behavior should be that when right clicking on a cell, always
> the cell context menu should appear, even when a hyperlink is below the
> cursor.
Yes, but I assume the current behavior is based on another enhancement request that resulted in what we see now. So the maximum demand won't be the best for UX maybe. Because of this I suggested to only add this one command. Maybe other cell format commands should be added too.
Comment 6 Heiko Tietze 2019-09-24 13:29:42 UTC
I agree with the summary, the cell formatting context is expected independently from the content. Probably because hyperlinks are handled by the edit engine a single click goes into the edit mode (in order to activate the link) so the edit context is active.

The simple solution is to not open links per right click, which is the fact right now, but also to not go into the edit mode, as we on cells without links.
Comment 7 Heiko Tietze 2021-05-18 09:59:14 UTC
Let's just replace Character... (.uno:FontDialog) by Format Cells... (.uno:FormatCellDialog) in sc/uiconfig/scalc/popupmenu/celledit.xml
Comment 8 Thorsten Behrens (allotropia) 2021-12-08 17:25:37 UTC
Looks like not as easy as just changing uno commands. RightMouseButton activates EditMode, which now need to be changed. Perhaps just a test missing which button was pressed? Needs some digging.
Comment 9 Heiko Tietze 2021-12-08 17:44:46 UTC
(In reply to Thorsten Behrens (allotropia) from comment #8)
> RightMouseButton activates EditMode...

Not for me.
Comment 10 Armin Le Grand 2021-12-08 18:01:50 UTC
It does activate TextEdit when here is
(1) either a link
(2) or a wrong-spelled word (which gets also selected, and the context menu shows SpellCheck & alternatives)
Where (2) is probably wanted (Heiko?) but (1) definitely not.
o see, just right-click, close popup-menu with ESC and use cursor keys o navigate in activated TextEdit :-)

Exactly because this is so special it will be hard to find - there must be some pretty crude code to do that :-(
Comment 11 Armin Le Grand 2021-12-09 08:54:46 UTC
taking a deeper look, debugging into UI actions (always tricky...) using SAL_NO_MOUSEGRABS...
Comment 12 Armin Le Grand 2021-12-09 09:43:58 UTC
There are different mechanisms if EditMode is already active or not, we need to check here for not-yet-active. Also extra-stuff when active - blocks when debugging, but not interested in. As expected, have to fight with debugging & interactive stuff, will add SAL_WARN and activate trace output...
Comment 13 Armin Le Grand 2021-12-09 10:36:51 UTC
Identified action/acivation in ScGridWindow::MouseButtonDown in sc/source/ui/view/gridwin.cxx, so can fix it now.
Question is now (for the last Time) - is this by purpose or not?
It *is* triggered on nCode == MouseSettings::GetContextMenuCode() in ImplHandleMouseEvent in vcl/source/window/winproc.cxx, so this is by purpose (outside calc) and thus on right-mouse-down. Checked git history, but it did not change for a long time, so found no hints hat this was added as an option by purpose.
Will thus change it now - if this was an option it can be re-added by reverting the fix.
Comment 14 Heiko Tietze 2021-12-09 11:45:39 UTC
(In reply to Armin Le Grand from comment #10)
> It does activate TextEdit when here is...

True, these are something special. And yes, we do want the interaction with hyperlinks and misspelled words. But now I'm totally confused what is expected and what is possible. Thomas, your ticket...
Comment 15 Armin Le Grand 2021-12-09 15:12:52 UTC
Have a fix now that prevents text edit activation on right-click on link, still behaves the same for the rest - especially spell check does still work as (i guess is) intended. Will propose this for now
Comment 16 Commit Notification 2021-12-10 10:32:16 UTC
Armin Le Grand (Allotropia) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/110d3504c1f738a1d7f740cc212064dafa4fb224

tdf#127341 Do not activate TextEdit at right-klick on URL in calc

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 17 Thomas Lendo 2022-02-03 16:18:07 UTC
Now it seems to work right (at least for me). Right-click on a cell shows the default cell options. After you double-clicked into a cell you can edit the content with spell checking or hyperlinks.

Verified with

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 52443996eff721e612ac4afc1eb1a53bb8a3e06f
CPU threads: 12; OS: Windows 10.0 Build 19043; UI render: Skia/Vulkan; VCL: win
Locale: de-AT (de_AT); UI: de-DE
Calc: threaded

Thank you very much, Armin!