Created attachment 176323 [details]
ODG file with screenshots
One common task in working with spreadsheets is duplicating the current sheet (quickly create a copy of a sheet).
To do so in Calc the user has to follow a lot of steps:
1) Right click the sheet tab that will be duplicated
2) A context menu will appear. Click "Move or copy sheet"
3) Under "Action" select "Copy" (notice that "Move" is the default)
4) In the "Insert before" area, choose where the copy will be placed (optional)
5) Define a new name (optional)
6) Click OK
In Excel online and Google sheets a very handy option has been added to ease the duplication of sheets. They simply added a "Duplicate" option when the user right-clicks the sheet tab (see attached ODG file).
I would like to suggest this feature be added to LO Calc as well.
I have added an ODG file with screenshots showing the "Duplicate" options in Google Sheets and Excel Online, as well as a suggestion of where the new "Duplicate" option could be placed in the current context menu.
Yep, would be nice
Click on the tab of the sheet, hold mouse button down and drag the tab while holding the Ctrl-key. That duplicates the sheet. Without Ctrl-key it moves the sheet.
For renaming a sheet click on the tab while holding down the Alt-key. That brings the tab into edit mode.
(In reply to Regina Henschel from comment #2)
> Click on the tab of the sheet, hold mouse button down and drag the tab while
> holding the Ctrl-key. That duplicates the sheet. Without Ctrl-key it moves
> the sheet.
> For renaming a sheet click on the tab while holding down the Alt-key. That
> brings the tab into edit mode.
Hi Regina. I did not know about these shortcuts. I tested them and indeed they work. However, I could not find any documentation in the online Help about them. I'll create some entries for these shortcuts in:
Despite that, I believe the new "Duplicate" option should be implemented in addition to the existing shortcuts because these shortcuts are not very discoverable by new (or even somewhat experienced) users. I myself had no idea about them =)
I always have scruples with adding similar functions. The new "Duplicate" command would be the same as the current "Move or Copy", with just less options. But I see benefit from removing or cleaning-up this dialog in favor of the "Duplicate". Do we need the Move anyway? Maybe if the target is within a different document. So either kill the dialog or keep but without Copy.
Alternatively we could advertise the shift+drag interaction per static label on the "copy" radio button.
(In reply to Heiko Tietze from comment #5)
> Do we need the Move anyway?
Yes. With a 200 sheets document you don't want to drag&drop over 150 sheet tabs to reach the target. And then miss.
We discussed the request in the design meeting and recommend to implement a command uno:DuplicateSheet that bypasses the dialog.
It's likely easyhackable given the existing shortcut as Regina pointed out. The challenge is to find the right code pointer.
Code pointer: the move/copy operation is done in ScViewFunc::MoveTable() after being initiated per FID_TAB_MOVE. It starts the dialog when called without parameter, so a new command would just need a parameter.
Hi Heiko, Houssein,
First of all, thanks for the code pointers.
I would like to try to fix this one. However, I find it a bit complex to understand how to create new UNO commands. The relationship between SDI files and the actual code is a bit complex.
Looking though Gerrit a found this patch which I believe is a good pointer to create a new UNO command in Calc:
Do you think this is a good "template" for this bug?
I agree with Heiko. Look for FID_TAB_MOVE, .uno:Move, and also take a look at ScViewFunc::MoveTable(), as this command is more similar.
You can see more Calc commands here:
Look for "FID_TAB_MOVE":
git grep FID_TAB_MOVE
You will see that it is defined and used in these files:
You can go on and start from copying some parts from the tab move, and then try to be specific on this command. As you may see, the ScViewFunc::MoveTable() is invoked in the switch case inside tabvwshf.cxx.
Look for ".uno:Move":
git grep -Fw .uno:Move |grep -v .py
Look into these files:
You should define FID_TAB_DUPLICATE and .uno:DuplicateSheet.
BASIC is also a useful for testing. For example, I test ".uno:SheetRightToLeft" with this BASIC code snippet. It reverses the the direction of an open Calc document.
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dim args(0) as new com.sun.star.beans.PropertyValue
args(0).Name = "RightToLeft"
args(0).Value = "true"
dispatcher.executeDispatch(document, ".uno:SheetRightToLeft", "", 0, args())
Proposed patch available in Gerrit for review.
* Create a "Duplicate sheet" option in LO Calc
+ (hidden) workflow per shift/ctrl+click (Regina)
+ solve by introducing a new function or via static label explaining
the functionality (Heiko)
+ Move is necessary for large databases (Eike)
+ would introduce uno:DuplicateSheet (Cor)
=> do it; easyhackable
Minutes from the UX/design meeting 2021-Nov-24
rafaelhlima committed a patch related to this issue.
It has been pushed to "master":
tdf#145745 Create uno:DuplicateSheet command
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:
Affected users are encouraged to test the fix and report feedback.
FIXED. Tested with:
Version: 18.104.22.168.alpha0+ / LibreOffice Community
Build ID: 60f786bde4524bbba462eccc6578715f39020076
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US