Bug 69192 - SLIDESHOW: add command line switch to start at arbitrary slide number
Summary: SLIDESHOW: add command line switch to start at arbitrary slide number
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Justin L
URL: http://bugs.debian.org/cgi-bin/bugrep...
Whiteboard: BSA target:24.8.0 inReleaseNotes:24.8...
Keywords:
Depends on:
Blocks: Commandline
  Show dependency treegraph
 
Reported: 2013-09-10 18:06 UTC by jidanni
Modified: 2024-07-25 09:03 UTC (History)
5 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 jidanni 2013-09-10 18:06:06 UTC
Let's say we want to start at slide 54 right from the command line.
Well all there is is
$ loimpress -show #which starts at slide 1.
Therefore please add
$ loimpress -show 54 file.ppt
capability etc.
              
Operating System: Debian
Version: 4.1.1.2 rc
Comment 1 Rob Snelders 2013-10-05 11:19:53 UTC
would be a good idea to implement
Comment 2 Timur 2022-05-12 14:03:51 UTC
Would be really useful in QA.
Comment 3 Justin L 2024-05-02 19:17:05 UTC
It certainly will not be straightforward to do this.

The command line can fairly easily be parsed to get the result in desktop/source/app/cmdlineargs.cxx

Then in desktop/source/app/dispatchwatcher.cxx it will need to be turned into something like a SID_PAGE_NUMBER. (Unfortunately, the current implementation of SlideshowImpl::createSlideList is expecting an exact match on the slide name, like "Slide 3", and not just a number.)

At DrawDocShell::Load, the SID_DOC_STARTPRESENTATION causes mpDoc->SetStartWithPresentation( true ), so likely SdDrawDocument will need to be extended to also SetStartingPage().

This is the turning point, when we get to ViewShellBase::Notify which only has a SfxEventHintId::OpenDoc hint that only can check if IsStartWithPresentation and thus calls an option-less SID_PRESENTATION

ShowSlideShow sees the SID_PRESENTATION and does a xPresentation->startWithArguments with a hard-coded FirstPage = 0 (which doesn't actually work like you would think, but only works because "0" is never found and thus it falls back to the first slide).

So then, SID_PRESENTATION must be extended to accept a starting page, because otherwise every time ShowSlideShow is called it would start at the command-line-provided start page (if we made a GetDocument().GetStartingPage()).
Comment 4 Justin L 2024-05-03 15:09:08 UTC
proposed patch at https://gerrit.libreoffice.org/c/core/+/167066
Comment 5 Commit Notification 2024-05-08 07:39:15 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/90eb9ea881a7497bb2ec348b3e4cba5aa5d51fa8

tdf#69192: add StartingSlide to SID_PRESENTATION and cmdline show=

It will be available in 24.8.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 6 Timur 2024-05-09 14:57:24 UTC
Thanks, Justin.
can you please explain how this works? I tried with sofice show=5.
Also, could you change soffice --help to indicate that slide number can be used.
Comment 7 Justin L 2024-05-10 12:59:14 UTC
(In reply to Timur from comment #6)
> could you change soffice --help to indicate that slide number can be used.
I did.
-   "--show          Opens and starts the following presentation documents   \n"
+   "--show{=slide#} Opens and starts the following presentation documents   \n"
    "                of each immediately. Files are closed after the showing.\n"
+   "                If a slide # is provided, they start at that slide.     \n"

> can you please explain how this works? I tried with sofice show=5.
That isn't very helpful. I'll bet you didn't get a presentation started at all. First make sure that you can open a file in presentation mode, and after that works then try to start from a specific slide. If starting from that specified slide now fails, copy and paste exactly what you entered on the command line.

Using OP's example, it would be "loimpress --show=54 file.ppt"
Comment 8 Timur 2024-05-10 14:10:11 UTC Comment hidden (obsolete)
Comment 9 Timur 2024-05-10 14:45:37 UTC
My mistake, I was running local installation. 
Works OK, thanks Justin once more. 
This could be in Release Notes, I add stragu. 

Similar to running full presentation, first is loaded and seen edit mode, then presentation with selected slide. 
That is a separate issue.
Comment 10 Stéphane Guillou (stragu) 2024-05-14 01:08:32 UTC
Thanks Justin and Timur, great little feature to have.

Justin, little follow-up: shouldn't --help show the following syntax instead?

   --show[=slide#]

It would be more consistent with the rest of the arguments, which seem to follow [optional] vs {placeholder}.
(Also: "#" could be spelled out as "number", and there's an extra space in "default mode , regardless" - which dates from before your commit.)

Added to release notes: https://wiki.documentfoundation.org/index.php?title=ReleaseNotes%2F24.8&action=historysubmit&type=revision&diff=750464&oldid=750443
Comment 11 Stéphane Guillou (stragu) 2024-05-14 02:13:47 UTC
Suggested wording in help patch: https://gerrit.libreoffice.org/c/help/+/167614
Comment 12 Commit Notification 2024-05-20 13:43:20 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3d4a3b30aea603b98da447ec6587b5d3eb20da66

tdf#69192 fix cmdlinehelp: --show[=slide_number], etc.

It will be available in 24.8.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 13 Commit Notification 2024-05-20 13:45:23 UTC
Stéphane Guillou committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/975d11c1c7bc9f57a7bce5ab8901ea1ec9f29d5c

related tdf#69192 document --show=slide_number option
Comment 14 Commit Notification 2024-07-25 09:03:26 UTC
Ilmari Lauhakangas committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/e35fb29cb092771840ff876bbb4350e7570e1627

Related tdf#69192 better placeholder string for command line example