Bug 151607 - Suppress "Consolidate Text" context menu entry if selection doesn't include multiple textbox objects
Summary: Suppress "Consolidate Text" context menu entry if selection doesn't include m...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.5.0.0 alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyMedium, easyHack, skillCpp, topicUI
Depends on:
Blocks: Textbox
  Show dependency treegraph
 
Reported: 2022-10-17 15:40 UTC by Eyal Rozenberg
Modified: 2023-05-14 18:31 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
A document for easily observing the bug (10.84 KB, application/vnd.oasis.opendocument.graphics)
2022-10-17 15:43 UTC, Eyal Rozenberg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2022-10-17 15:40:40 UTC
Explanation by reproduction instructions:

1. Create new Draw document
2. Create a rectangle shape using the drawing toolbar
3. Enter some text into the rectangle shape, e.g. "hello"
4. Create another rectangle shape using the drawing toolbar, below or to the side of the first shape
5. Enter some text into the second rectangle shape, e.g. "world"
6. Select both shapes
7. Open the context menu with a right-click on the selection's edge
8. Choose "Consolidate Text"

Expected result: The text of both shapes gets consolidated into a single box - either the first rectangle's, the last (second) rectangle's, or a separate textbox.

Actual result: Nothing happens.


Now, I suppose the decision could be to simply not offer text consolidation for non-textbox objects, which I would like less, but would at least be consistent. This behavior makes no sense.
Comment 1 Eyal Rozenberg 2022-10-17 15:43:12 UTC
Created attachment 183098 [details]
A document for easily observing the bug

Instead of following the first 5 reproduction steps, you can just open this document, select the two textboxes and "Consolidate Text".
Comment 2 Eyal Rozenberg 2022-10-17 15:44:42 UTC
Oh, BTW, seeing this with;

Version: 7.4.1.2 / LibreOffice Community
Build ID: 40(Build:2)
CPU threads: 4; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: en-IL (en_IL); UI: en-US
Debian package version: 1:7.4.1-1

and also with with 

Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: a09c5c69e3b5fbf448cae1d6c476f39067e40023
CPU threads: 4; OS: Linux 5.19; UI render: default; VCL: gtk3
Locale: en-IL (en_IL); UI: en-US
Comment 3 V Stuart Foote 2022-10-17 18:33:28 UTC
During development the .uno:TextCombine hack was explicitly set to only collect OBJ_TEXT draw objects.  Text from other draw shapes is not parsed.

dev choice, and further effort appropriately deferred to bug 32249

=> NAB

=-ref-=

https://gerrit.libreoffice.org/c/core/+/75043/
Comment 4 Eyal Rozenberg 2022-10-17 20:01:04 UTC
I believe you missed the last paragraph of my opening comment.

If "Consolidate Text" is only supposed to apply to textboxes, then it should be off the context menu for selection of non-textboxes - or at the very least grayed out.
Comment 5 V Stuart Foote 2022-10-17 22:04:08 UTC
(In reply to Eyal Rozenberg from comment #0)
> Now, I suppose the decision could be to simply not offer text consolidation
> for non-textbox objects, which I would like less, but would at least be
> consistent. This behavior makes no sense.

Yet that was the decision, the dev chose not to anything more with it.

It is not a bug--read the commit!  Black and white...

If you are asking for an Enhancement, then that is open as bug 32249 and this is a clear duplicate.

Setting as such.

*** This bug has been marked as a duplicate of bug 32249 ***
Comment 6 Eyal Rozenberg 2022-10-17 22:41:08 UTC
(In reply to V Stuart Foote from comment #5)
> (In reply to Eyal Rozenberg from comment #0)
> Yet that was the decision,
>
> the dev chose not to anything more with it.
> 
> It is not a bug--read the commit!  Black and white...

The decision was to not consolidate the text in non-textboxes. That's fine, albeit not my personal preference. I said as much in my first comment already. But the committer _absolutely did not_ intentionally keep this on the context menu of non-textbox-only selections on purpose. 

Again, this bug is about the menu item doing nothing. Either it starts doing something, or needs to go away, or be grayed-out. Actionable UI which does nothing is not acceptable.

In fact, the committer explicitly asked Heiko for a UI review, and unfortunately they both missed the fact that this always shows up on the context menu even if you haven't only selected textboxes.


> If you are asking for an Enhancement, then that is open as bug 32249 and
> this is a clear duplicate.

I made it clear that it's either the text consolidation _or_ removal/disabling of the menu item. But even if it were just the enhancement - it certainly would not be a dupe of 32249, since this bug report is not about PDFs or importation of PDFs.
Comment 7 Heiko Tietze 2022-11-02 16:27:13 UTC
Justin, is it an easy hack  to disable/hide the command if one of the objects is not a text box?
Comment 8 Justin L 2022-11-02 17:42:27 UTC
(In reply to Heiko Tietze from comment #7)
> Justin, is it an easy hack  to disable/hide the command if one of the
> objects is not a text box?

I imagine that it is an easy hack - although I would phrase it as "disable the command if less than 2 selected objects are text boxes". The code pointer is the link in comment 3.

I would suggest adding a (bool bTestOnly) to
svx/source/svdraw/svdedtv2.cxx's CombineMarkedTextObjects

and return true if ( GetMarkedObjectCount() > 1 )

Depending on how easy you want to make the hack - someone could point out where to check the State for .uno:TextCombine (since my UI knowledge is minimal).