Bug 138842 - Calc: Counter-intuitive "Default" context menu for comments makes them blue and changes font
Summary: Calc: Counter-intuitive "Default" context menu for comments makes them blue a...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.3.0
Keywords: difficultyBeginner, easyHack, skillCpp, topicUI
Depends on:
Blocks: Calc-Comments
  Show dependency treegraph
 
Reported: 2020-12-12 07:13 UTC by Ming Hua
Modified: 2021-10-28 13:39 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ming Hua 2020-12-12 07:13:49 UTC
Description:
The Calc comment's context menu has an item labelled "Default" that performs very counter-intuitive action and is IMHO rather useless.

Steps to reproduce:
1. New empty spread sheet, Insert > Comment;
2. Type some text in the newly created comment.  On my system at least, the background color of the comment box is PostIt yellow, and the font of the text is Liberation Sans;
3. Use mouse to select all the text in the comment, right-click, see the "Default" item at the bottom of the context menu, choose it;
4. The backgroud of the comment changes to blue, the font of the text changes to Libreation Serif (and slightly large size, it seems), the shadow of the comment box and the arrow of the leader line also changes.

One would expect "Default" means the comment would look like how it's created without further formatting change.  However it seems Calc comments are text boxes in a rectangular shape with some special formatting, and this "Default" menu just revert everything back as if it's just a regular shape with a regular text box or something.  (Just guessing here, as the blue color is the same default color of a filled shape in Draw.)

Additional info:
This happens in 6.4.7 as well as in 7.1.0 Beta1:
Version: 6.4.7.2 (x64)
Build ID: 639b8ac485750d5696d7590a72ef1b496725cfb5
CPU threads: 2; OS: Windows 10.0 Build 18363; UI render: default; VCL: win; 
Locale: zh-CN (zh_CN); UI-Language: en-US
Calc: threaded

Version: 7.1.0.0.beta1 (x64)
Build ID: 828a45a14a0b954e0e539f5a9a10ca31c81d8f53
CPU threads: 2; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: zh-CN (zh_CN); UI: zh-CN
Calc: threaded

Also if one does not select all text in the comment, and click "Default" context menu, the background of comment doesn't change, but the text font still does.
Comment 1 Roman Kuznetsov 2021-08-02 21:57:41 UTC
OMG, it's terribly of course

I confirm the bug in

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 4677345e3695bac158bb04048b4d5c608ed764b4
CPU threads: 4; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: default; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: CL

I think that item just applies the Draw default style to the comment's shape

UX-team - we should change it (or just delete that "Default" Comment's context menu item) to something more useful
Comment 2 Heiko Tietze 2021-08-12 08:08:33 UTC
The command is also available at standard shapes, we cannot just remove it. Or can we? I mean it shrinks the shape size to zero margin ('resize shape to fit text' without any spacing) and sets Liberation Serif in black on skyblue background which is hard to read (the default for shapes), quite ugly.

For some reason, the command is not available in Writer and Draw.

So either we add code to hide this command when the menu starts from Calc comments (sounds like a tricky task) or remove the command (and the code).
Comment 3 Heiko Tietze 2021-08-19 13:56:56 UTC
The topic was on the agenda for the design meeting but hasn't got further input. So let's kill the "Default".
Comment 4 Roman Kuznetsov 2021-08-19 14:29:26 UTC Comment hidden (obsolete)
Comment 5 Heiko Tietze 2021-08-19 14:58:11 UTC
Maybe it's an easyhack but not sure and too lazy to dig for code pointer. Check the UNO command name, search the *.sdi files for this command name, take the SID_* command into the search to find the execute method. Removing the command from the menu is a piece of cake.
Comment 6 Heiko Tietze 2021-10-13 06:30:25 UTC
To remove "Default" from the context menu just remove this line
sc/uiconfig/scalc/popupmenu/drawtext.xml -> .uno:StandardTextAttributes

But to eradicate the function completely clear these too:
sc/sdi/scalc.sdi -> SfxVoidItem StandardTextAttributes SID_TEXT_STANDARD
sc/inc/sc.hrc -> #define SID_TEXT_STANDARD       (FORMAT_MENU_START + 18)
sc/sdi/drawsh.sdi -> SID_TEXT_STANDARD       [ ExecMethod = ExecDrawAttr; StateMethod = NoState; ]
sc/sdi/drtxtob.sdi -> SID_TEXT_STANDARD       [ ExecMethod = ExecDrawAttr; StateMethod = NoState; ]
sc/source/ui/drawfunc/drawsh.cxx -> case SID_TEXT_STANDARD: // delete hard text attributes
sc/source/ui/drawfunc/drtxtob.cxx -> case SID_TEXT_STANDARD: // delete hard text attributes


Search for SID_TEXT_STANDARD to double-check.
Comment 7 Roman Kuznetsov 2021-10-13 13:38:56 UTC
(In reply to Heiko Tietze from comment #6)
> To remove "Default" from the context menu just remove this line
> sc/uiconfig/scalc/popupmenu/drawtext.xml -> .uno:StandardTextAttributes
> 
> But to eradicate the function completely clear these too:
> sc/sdi/scalc.sdi -> SfxVoidItem StandardTextAttributes SID_TEXT_STANDARD
> sc/inc/sc.hrc -> #define SID_TEXT_STANDARD       (FORMAT_MENU_START + 18)
> sc/sdi/drawsh.sdi -> SID_TEXT_STANDARD       [ ExecMethod = ExecDrawAttr;
> StateMethod = NoState; ]
> sc/sdi/drtxtob.sdi -> SID_TEXT_STANDARD       [ ExecMethod = ExecDrawAttr;
> StateMethod = NoState; ]
> sc/source/ui/drawfunc/drawsh.cxx -> case SID_TEXT_STANDARD: // delete hard
> text attributes
> sc/source/ui/drawfunc/drtxtob.cxx -> case SID_TEXT_STANDARD: // delete hard
> text attributes
> 
> 
> Search for SID_TEXT_STANDARD to double-check.

I don't think we should kill it at all, let's just delete it from the Calc Comment's context menu
Comment 8 Commit Notification 2021-10-14 19:17:38 UTC
Roman Kuznetsov committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/43b0d4f709a3a1446a32e36abb5deaa3bb45ddd9

tdf#138842 Delete Default item from Calc Comment's context menu

It will be available in 7.3.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 9 Heiko Tietze 2021-10-16 09:31:37 UTC
Roman's patch has removed the entry from the context menu but keep the function (as well customizability).
Comment 10 BogdanB 2021-10-28 13:39:29 UTC
Confirm taht Default is gone now.

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 4a8184ce0cc59e4e223cf963141c16644b762440
CPU threads: 4; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: ro-RO (ro_RO); UI: en-US
Calc: threaded