diff options
author | Justin Luth <justin.luth@collabora.com> | 2024-05-03 08:32:27 -0400 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-05-14 09:11:06 +0200 |
commit | 773fe1fe924110d36749a51645a4e44d27c939c8 (patch) | |
tree | a485d57a81d499bc9fe75579b650f19db1ec4cc7 /desktop | |
parent | b6f42a6006dd0b0e42348888ed5e0f536b7f4d8a (diff) |
tdf#69192: add StartingSlide to SID_PRESENTATION and cmdline show=
Allow the user to start the presentation at a specific slide
using command-line parameters.
This backport includes ddc4cd3d0cf9e8bde440df3e92e98a2a2017c797
NFC dispatchwatcher.hxx: rename aPrinterName to aParam
Change-Id: I87797cbccb463904e5d2fe9b078e3921be27c91a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167066
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167609
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/app.cxx | 1 | ||||
-rw-r--r-- | desktop/source/app/cmdlineargs.cxx | 4 | ||||
-rw-r--r-- | desktop/source/app/cmdlineargs.hxx | 2 | ||||
-rw-r--r-- | desktop/source/app/cmdlinehelp.cxx | 3 | ||||
-rw-r--r-- | desktop/source/app/dispatchwatcher.cxx | 10 | ||||
-rw-r--r-- | desktop/source/app/dispatchwatcher.hxx | 2 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 3 | ||||
-rw-r--r-- | desktop/source/app/officeipcthread.hxx | 1 |
8 files changed, 18 insertions, 8 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 0d66a48daac7..7c81b0a3bbc1 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2081,6 +2081,7 @@ void Desktop::OpenClients() aRequest.aConversionParams = rArgs.GetConversionParams(); aRequest.aConversionOut = rArgs.GetConversionOut(); aRequest.aImageConversionType = rArgs.GetImageConversionType(); + aRequest.aStartListParams = rArgs.GetStartListParams(); aRequest.aInFilter = rArgs.GetInFilter(); aRequest.bTextCat = rArgs.IsTextCat(); aRequest.bScriptCat = rArgs.IsScriptCat(); diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index e7f315204048..3a3f876f6e90 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -538,10 +538,12 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) // open in viewmode eCurrentEvent = CommandLineEvent::View; } - else if ( oArg == "show" ) + else if (oArg == "show" || oArg.startsWith("show=", &rest)) { // open in viewmode eCurrentEvent = CommandLineEvent::Start; + // start on the first slide unless a valid starting slide # was provided + m_startListParams = rest.toUInt32() > 0 ? rest : "1"; } else if ( oArg == "display" ) { diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx index 64a1bcfd0ccb..8e0c6e649584 100644 --- a/desktop/source/app/cmdlineargs.hxx +++ b/desktop/source/app/cmdlineargs.hxx @@ -113,6 +113,7 @@ class CommandLineArgs const OUString& GetConversionParams() const { return m_conversionparams;} OUString GetConversionOut() const; OUString const & GetImageConversionType() const { return m_convertimages; } + const OUString& GetStartListParams() const { return m_startListParams; } const OUString& GetPidfileName() const { return m_pidfile;} // Special analyzed states (does not match directly to a command line parameter!) @@ -176,6 +177,7 @@ class CommandLineArgs OUString m_conversionparams; OUString m_conversionout; // contains external URIs OUString m_convertimages; // The format in which images should be converted + OUString m_startListParams; std::vector< OUString > m_infilter; OUString m_language; OUString m_pidfile; diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx index 9c9fd940f233..10b3e5c48cbb 100644 --- a/desktop/source/app/cmdlinehelp.cxx +++ b/desktop/source/app/cmdlinehelp.cxx @@ -145,8 +145,9 @@ namespace desktop " not appear. If the file name contains spaces, then it \n" " must be enclosed in quotation marks. \n" " --view Opens following files in viewer mode (read-only). \n" - " --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" " Files other than Impress documents are opened in \n" " default mode , regardless of previous mode. \n" " --convert-to OutputFileExtension[:OutputFilterName] \\ \n" diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 863d246951e9..c76c5c1c1e2d 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -503,7 +503,9 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest // if we are called with --show set Start in mediadescriptor if(aDispatchRequest.aRequestType == REQUEST_START) { - aArgs.emplace_back("StartPresentation", 0, Any(true), PropertyState_DIRECT_VALUE); + const sal_Int32 nStartingSlide = aDispatchRequest.aParam.toInt32(); + const sal_uInt16 nSlide = nStartingSlide > 0 ? nStartingSlide : 1; + aArgs.emplace_back("StartPresentation", 0, Any(nSlide), PropertyState_DIRECT_VALUE); } // Force input filter, if possible @@ -566,7 +568,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest // FIXME: factor out into a method ... Reference< XStorable > xStorable( xDoc, UNO_QUERY ); if ( xStorable.is() ) { - OUString aParam = aDispatchRequest.aPrinterName; + const OUString& aParam = aDispatchRequest.aParam; sal_Int32 nPathIndex = aParam.lastIndexOf( ';' ); sal_Int32 nFilterIndex = aParam.indexOf( ':' ); sal_Int32 nImgFilterIndex = aParam.lastIndexOf( '|' ); @@ -746,7 +748,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest } else if ( aDispatchRequest.aRequestType == REQUEST_BATCHPRINT ) { - batchPrint( aDispatchRequest.aPrinterName, xDoc, aObj, aName ); + batchPrint(aDispatchRequest.aParam, xDoc, aObj, aName); } else { @@ -754,7 +756,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest { // create the printer Sequence < PropertyValue > aPrinterArgs{ comphelper::makePropertyValue( - "Name", aDispatchRequest.aPrinterName) }; + u"Name"_ustr, aDispatchRequest.aParam) }; xDoc->setPrinter( aPrinterArgs ); } diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx index 70a7fd42e679..9a970cf82dce 100644 --- a/desktop/source/app/dispatchwatcher.hxx +++ b/desktop/source/app/dispatchwatcher.hxx @@ -59,7 +59,7 @@ class DispatchWatcher : public ::cppu::WeakImplHelper< css::frame::XDispatchResu RequestType aRequestType; OUString aURL; std::optional< OUString > aCwdUrl; - OUString aPrinterName; // also conversion params + OUString aParam; OUString aPreselectedFactory; }; diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 9d342bf35a84..18ab214a3014 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -985,6 +985,7 @@ bool IpcThread::process(OString const & arguments, bool * waitProcessed) { pRequest->aConversionParams = aCmdLineArgs->GetConversionParams(); pRequest->aConversionOut = aCmdLineArgs->GetConversionOut(); pRequest->aImageConversionType = aCmdLineArgs->GetImageConversionType(); + pRequest->aStartListParams = aCmdLineArgs->GetStartListParams(); pRequest->aInFilter = aCmdLineArgs->GetInFilter(); pRequest->bTextCat = aCmdLineArgs->IsTextCat(); pRequest->bScriptCat = aCmdLineArgs->IsScriptCat(); @@ -1310,7 +1311,7 @@ bool RequestHandler::ExecuteCmdLineRequests( AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aInFilter, DispatchWatcher::REQUEST_INFILTER, "", aRequest.aModule ); AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aOpenList, DispatchWatcher::REQUEST_OPEN, "", aRequest.aModule ); AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aViewList, DispatchWatcher::REQUEST_VIEW, "", aRequest.aModule ); - AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aStartList, DispatchWatcher::REQUEST_START, "", aRequest.aModule ); + AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aStartList, DispatchWatcher::REQUEST_START, aRequest.aStartListParams, aRequest.aModule ); AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aPrintList, DispatchWatcher::REQUEST_PRINT, "", aRequest.aModule ); AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aPrintToList, DispatchWatcher::REQUEST_PRINTTO, aRequest.aPrinterName, aRequest.aModule ); AddToDispatchList( aDispatchList, aRequest.aCwdUrl, aRequest.aForceOpenList, DispatchWatcher::REQUEST_FORCEOPEN, "", aRequest.aModule ); diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx index a233c18e012b..fc95b42668bc 100644 --- a/desktop/source/app/officeipcthread.hxx +++ b/desktop/source/app/officeipcthread.hxx @@ -60,6 +60,7 @@ struct ProcessDocumentsRequest OUString aConversionParams; OUString aConversionOut; OUString aImageConversionType; + OUString aStartListParams; std::vector< OUString > aInFilter; ::osl::Condition *pcProcessed; // pointer condition to be set when the request has been processed bool* mpbSuccess = nullptr; // pointer to boolean receiving if the processing was successful |