Bug 142447 - Cut, copy, paste and drag operations for folded outlines: include folded content
Summary: Cut, copy, paste and drag operations for folded outlines: include folded content
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.0
Keywords:
: 147530 (view as bug list)
Depends on:
Blocks: Writer-Outline-Folding 148240
  Show dependency treegraph
 
Reported: 2021-05-23 15:25 UTC by j.a.swami
Modified: 2023-01-05 14:12 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Navigator Outline Copy enhancement (3.00 MB, video/x-matroska)
2022-02-08 03:35 UTC, Jim Raykowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description j.a.swami 2021-05-23 15:25:17 UTC
Description:
Now, when a subhead includes content folded beneath it, cutting, copying, or pasting the subhead acts only on the subhead, not the folded content. Better for these operations to include the folded content as well. 

Steps to Reproduce:
1. Select a subhead that has content beneath it.
2. Fold (hide) that content (but not the subhead)
3. Cut or copy the subhead
4. Optionally, paste the subhead

Actual Results:
The operations affect only the subhead, not the folded content.

Expected Results:
When we cut, copy, or paste the subhead, the folded content should also be cut, copied, or pasted.


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: dbd4110cc36011042c98549d997daa79e8065aba
CPU threads: 4; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-05-13_01:08:22
Calc: threaded
Comment 1 j.a.swami 2021-05-23 16:18:35 UTC
I suggest this apply to "move" operations also.
Comment 2 Timur 2021-05-24 11:19:20 UTC Comment hidden (obsolete)
Comment 3 Jean-Baptiste Faure 2021-08-10 15:59:50 UTC
(In reply to Timur from comment #2)
> I cannot copy/cut any content with "Show outline-folding buttons" checked.
> I don't know how you can copy subhead/heading name.

Reported as bug #143813

Best regards. JBF
Comment 4 steve 2021-08-27 10:59:10 UTC Comment hidden (obsolete)
Comment 5 Jean-Baptiste Faure 2021-08-27 18:54:10 UTC
(In reply to steve from comment #4)
> @jbf should this bug here be set to duplicate of #143813?

No, cut/copy & paste are not the same in this enhancement request and in the bug report #143813.
This enhancement is related to the subheads while #143813 is related to cut/copy & paste of any selected portion of text.

Best regards. JBF
Comment 6 Dieter 2022-01-21 07:40:59 UTC
Tested with

Version: 7.3.0.2 (x64) / LibreOffice Community
Build ID: f1c9017ac60ecca268da7b1cf147b10e244b9b21
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: CL

and with

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 151c56ed547490a99d912524c0e56b5d6d4a1939
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Actual result: Copy and paste works, but if you try to cut content a window pops up with the following message "Write potected content cannot be changed".

I propose to close this bug (might be fixed with bug 143813 and open a new one with a request for a pop-up dialog like "Selection contains outline-folding. Cutting the selection will also cut outline folding. Are you sure? Yes / No" (or something like that in a better English)

Jean-Baptiste and Jim, what do you think?
Comment 7 Timur 2022-01-21 09:24:28 UTC
No need to close the bug, just to define it. 
I don't see that copy/paste works, working in main text area with folded outlines.
I think that bug can be confirmed as requested.
Comment 8 Jean-Baptiste Faure 2022-01-21 11:00:33 UTC
For me it works as expected if you are careful to select the folded subtitle until the beginning of the next title. When you paste what you copied, it is pasted as folded, and you have to unfold if to see the whole result.

In my opinion, the error message when you try to cut a folded subtitle is not a bug, it is a security because you do not see what you are cutting.

Tested with Version: 7.3.1.0.0+ / LibreOffice Community
Build ID: de15e8d4f2f2e5d10cb5d9203e51f3a28347db8d
CPU threads: 8; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: fr-FR (fr_FR.UTF-8); UI: fr-FR
Ubuntu_20.04_x86-64
Calc: threaded

Best regards. JBF
Comment 9 Timur 2022-01-21 11:25:48 UTC
I confirmed the bug because it feels natural to be able just to select folded outline to copy or move it,like in MSO. Selecting until the next heading is a workaround.
Comment 10 Jean-Baptiste Faure 2022-01-21 11:30:06 UTC
(In reply to Timur from comment #9)
> I confirmed the bug because it feels natural to be able just to select
> folded outline to copy or move it,like in MSO. Selecting until the next
> heading is a workaround.

And how do you copy & paste only the subtitle if that works as you expect?

Best regards. JBF
Comment 11 Dieter 2022-01-24 07:41:56 UTC
So I think, we have different opinions here:

Copy/Paste: Works as expected (Jean-Baptiste / Dieter); Doesn't work as expected (Timur)

Drag / Drop: Works as expected (Dieter)

Cut / Paste: Not possible at the moment (Message pops up). Warning is expected and useful, but question is, if there should be an option to ignore it.

cc: Design-Team for input and decisions about the three options. Perhaps it would also better to have three different reports
Comment 12 Timur 2022-01-24 08:38:32 UTC
(In reply to Jean-Baptiste Faure from comment #10)
> And how do you copy & paste only the subtitle if that works as you expect?

We can copy & paste only the subtitle if unfolded, like in MSO.
Even better would be that selecting from the left selects heading and folded content, and selecting from the right selects just heading text. 

(In reply to Dieter from comment #11)
> Perhaps it would also better to have three different reports
Definitely not.
Comment 13 Heiko Tietze 2022-01-24 08:49:18 UTC
Testing with the "formatted dummy text" extension [1] that has
<H1>First Chapter
    <H2>Hidden Text
    <H2>Fiels
<H1>Second Chapter
    <H2>Image
    <H2>Table
    <H2>Chart
    <H2>Formula

If I fold only "Second Chapter" and keep everything below expanded only this heading is copied. Adding another chapter allows to extend the selection and I get the warning dialog (with misleading text; guess it's just taken from another place). Cutting an unfolded heading with or without extending it to the next paragraph works only on this selection.
Promote/Demote works on items with the same status. If all subchapters are expanded everything moves up. If only "Image" is folded along with "Second" these two go up and the other become part of the other H1 chapter.

So we have three different topics, at least. First of all, the text is misleading. If cutting folded content is forbidden we should say it. The "hidden section" text belongs to hidden sections. Second, the OP obviously has treeviews in mind where operations on nodes are applied to children. The opposite view considers the selection of a heading only, without any content below. True but not easy to understand, however. What bothers me more is the inconsistency when moving content with or without folded children. Safest solution is probably to always keep the folded content together.

[1] https://extensions.libreoffice.org/en/extensions/show/132
Comment 14 Heiko Tietze 2022-01-28 10:59:00 UTC
Putting all together I'd say we improve the warning message first. The inconsistent Move operation bothers me a bit, should be a separate ticket. Everything else works by design - the mental picture of a tree is wrong for documents.

Jim, this might be an easy hack. Do you have a code pointer at hand?
Comment 15 j.a.swami 2022-01-28 16:05:21 UTC
I'm having a hard time following the comments closely, I suppose because I'm looking at LO 7.2.5.2.0, not more recent daily builds. My fault.

That said, a design where whatever content one wishes to cut, copy, paste, or move must be unfolded and explicitly selected doesn't work for me. Imagine, for example, that the folded content under "First Chapter" extends for three pages. What I want to be able to do is fold it, select it by selecting the headline, and then cut, copy, paste, or move it. 

I suppose this means I agree with Timur. 

I don't understand why the mental picture of a tree is wrong. The feature under development is a "folding outline," and whether we picture an outline as a "tree" or as something else, outlines are by nature hierarchical structures. And so we should be able to manipulate them accordingly.

(BTW: The useful extension "Formatted Dummy Text" would be friendlier if its download page were to include or reference the user documentation found at https://design.blog.documentfoundation.org/2019/05/04/formatted-dummy-text/.)
Comment 16 Heiko Tietze 2022-01-31 09:45:21 UTC
(In reply to j.a.swami from comment #15)
> I don't understand why the mental picture of a tree is wrong.

You can select parts of the folded heading, which includes also 100%. And this case needs to be distinguished from the selection of the whole chapter. In contrast, tree controls provide edit vs. interaction modes and clearly allow to change the label (if at all) or to operate on the structure (expand/collapse).
Comment 17 Jim Raykowski 2022-02-01 04:14:30 UTC
(In reply to Heiko Tietze from comment #14)
> Putting all together I'd say we improve the warning message first. The
> inconsistent Move operation bothers me a bit, should be a separate ticket.
> Everything else works by design - the mental picture of a tree is wrong for
> documents.
> 
> Jim, this might be an easy hack. Do you have a code pointer at hand?

I'm listening. Cut, copy, paste, and move when folded content is involved definitely needs improvement. Sorry, I don't have any code pointers at hand for this.
Comment 18 j.a.swami 2022-02-03 14:01:36 UTC
(In reply to Heiko Tietze from comment #16)
> (In reply to j.a.swami from comment #15)
> > I don't understand why the mental picture of a tree is wrong.
> 
> You can select parts of the folded heading, which includes also 100%. And
> this case needs to be distinguished from the selection of the whole chapter.
> In contrast, tree controls provide edit vs. interaction modes and clearly
> allow to change the label (if at all) or to operate on the structure
> (expand/collapse).

I don't think I understand what's said here. But that's okay. I look forward to seeing further development.
Comment 19 Jim Raykowski 2022-02-08 03:35:45 UTC
Created attachment 178132 [details]
Navigator Outline Copy enhancement

Here is an enhancement for consideration to the Navigator that adds 'Copy' to the Headings context menu:
https://gerrit.libreoffice.org/c/core/+/129542
Comment 20 Heiko Tietze 2022-03-07 08:54:08 UTC
*** Bug 147530 has been marked as a duplicate of this bug. ***
Comment 21 Timur 2022-03-07 20:44:47 UTC
Seems like reviewers missing.
Comment 22 Gerry 2022-03-25 20:34:38 UTC
Hi Jim and Heiko, in case you are not aware: the gerrit patch in comment 19 seems to got stuck and hasn't yet had any reviewers looking at it. The pootle bot started complaining "A polite ping, still working on this patch?"


Btw: Is there a chance that outline folding gets out of experimental mode for LibreOffice 7.4?
Comment 23 Jim Raykowski 2022-03-25 21:59:14 UTC
(In reply to Gerry from comment #22)
> Hi Jim and Heiko, in case you are not aware: the gerrit patch in comment 19
> seems to got stuck and hasn't yet had any reviewers looking at it. The
> pootle bot started complaining "A polite ping, still working on this patch?"
H Gerry, I've rebased that patch on top of master and will put it after getting the OK from Jenkins.
Comment 24 Commit Notification 2022-03-25 22:19:24 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b000d964fcc8849d10576bf3539bde7729db2eb1

tdf#142447 related: SwNavigator: Copy outlines

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 25 Dieter 2022-03-27 14:34:02 UTC
(In reply to Gerry from comment #22)
> Btw: Is there a chance that outline folding gets out of experimental mode
> for LibreOffice 7.4?

Please open a new bug report with this enhancement request ("Make Outline-Folding non-experimental"). Thank you.
Comment 26 Stéphane Guillou (stragu) 2023-01-05 14:12:05 UTC
Jim, are you able to mark this as fixed, or is there something missing?