desktop/source/app/app.cxx                   |    1 
 desktop/source/app/cmdlineargs.cxx           |    4 ++-
 desktop/source/app/cmdlineargs.hxx           |    2 +
 desktop/source/app/cmdlinehelp.cxx           |    3 +-
 desktop/source/app/dispatchwatcher.cxx       |   10 ++++----
 desktop/source/app/dispatchwatcher.hxx       |    2 -
 desktop/source/app/officeipcthread.cxx       |    3 +-
 desktop/source/app/officeipcthread.hxx       |    1 
 include/sfx2/sfxsids.hrc                     |    2 -
 sd/inc/drawdoc.hxx                           |    8 +++---
 sd/qa/unit/tiledrendering/tiledrendering.cxx |    2 -
 sd/sdi/sdraw.sdi                             |    2 -
 sd/source/core/drawdoc.cxx                   |    6 ++--
 sd/source/ui/docshell/docshel4.cxx           |   33 ++++++++++++++-------------
 sd/source/ui/slideshow/slideshowimpl.cxx     |    7 +++--
 sd/source/ui/view/ViewShellBase.cxx          |   15 ++++++++----
 sd/source/ui/view/drviewse.cxx               |    7 ++++-
 sfx2/source/appl/appuno.cxx                  |    8 +++---
 sfx2/source/doc/objstor.cxx                  |    2 -
 19 files changed, 71 insertions(+), 47 deletions(-)

New commits:
commit 773fe1fe924110d36749a51645a4e44d27c939c8
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Fri May 3 08:32:27 2024 -0400
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue May 14 09:11:06 2024 +0200

    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 <jl...@mail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167609
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

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   
"
         "                       must be enclosed in quotation marks.           
         
"
         "   --view              Opens following files in viewer mode 
(read-only).       
"
-        "   --show              Opens and starts the following presentation 
documents   
"
+        "   --show{=slide#}     Opens and starts the following presentation 
documents   
"
         "                       of each immediately. Files are closed after 
the showing.
"
+        "                       If a slide # is provided, they start at that 
slide.     
"
         "                       Files other than Impress documents are opened 
in        
"
         "                       default mode , regardless of previous mode.    
         
"
         "   --convert-to OutputFileExtension[:OutputFilterName] \              
        
"
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
diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc
index c5479d836855..4aa9424e13bb 100644
--- a/include/sfx2/sfxsids.hrc
+++ b/include/sfx2/sfxsids.hrc
@@ -344,7 +344,7 @@ class SvxZoomItem;
 #define SID_MODIFIER                        
TypedWhichId<SfxUInt16Item>(SID_SFX_START + 669)
 #define SID_SETOPTIONS                      (SID_SFX_START + 670)
 #define SID_SOURCEVIEW                      (SID_SFX_START + 675)
-#define SID_DOC_STARTPRESENTATION           
TypedWhichId<SfxBoolItem>(SID_SFX_START + 695)
+#define SID_DOC_STARTPRESENTATION           
TypedWhichId<SfxUInt16Item>(SID_SFX_START + 695)
 #define SID_DDE_RECONNECT_ONLOAD            
TypedWhichId<SfxBoolItem>(SID_SFX_START + 696)
 
 #define SID_DOCTEMPLATE                     (SID_SFX_START + 538)
diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx
index dd6b81647ef7..d766ea35ce72 100644
--- a/sd/inc/drawdoc.hxx
+++ b/sd/inc/drawdoc.hxx
@@ -153,8 +153,8 @@ private:
 
     bool                mbOnlineSpell;
     bool                mbSummationOfParagraphs;
-    bool                mbStartWithPresentation;        ///< is set to true 
when starting with command line parameter -start
-    bool                mbExitAfterPresenting;         ///< true if 
mbStartWithPresentation AND Presentation was shown fully
+    sal_uInt16          mnStartWithPresentation; ///< 1-based starting slide# 
when presenting via command line parameter --show
+    bool                mbExitAfterPresenting; ///< true if 
GetStartWithPresentation AND Presentation was shown fully
     LanguageType        meLanguage;
     LanguageType        meLanguageCJK;
     LanguageType        meLanguageCTL;
@@ -283,8 +283,8 @@ public:
                             ::sd::DrawDocShell* pBookmarkDocSh,
                             Point const * pObjPos);
 
-    SAL_DLLPRIVATE bool IsStartWithPresentation() const { return 
mbStartWithPresentation;}
-    SAL_DLLPRIVATE void SetStartWithPresentation( bool bStartWithPresentation 
);
+    SAL_DLLPRIVATE sal_uInt16 GetStartWithPresentation() const { return 
mnStartWithPresentation; }
+    SAL_DLLPRIVATE void SetStartWithPresentation(sal_uInt16 nStartingSlide);
 
     SAL_DLLPRIVATE bool IsExitAfterPresenting() const { return 
mbExitAfterPresenting;}
     SAL_DLLPRIVATE void SetExitAfterPresenting( bool bExitAfterPresenting );
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index adc39d571b0a..11a49a15e51c 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -2971,7 +2971,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testStartPresentation)
 {
     SdXImpressDocument* pXImpressDocument = createDoc("test.ppsx");
     ViewCallback aView;
-    CPPUNIT_ASSERT(pXImpressDocument->GetDoc()->IsStartWithPresentation());
+    CPPUNIT_ASSERT(pXImpressDocument->GetDoc()->GetStartWithPresentation());
     Scheduler::ProcessEventsToIdle();
 
     const auto it = aView.m_aStateChanges.find(".uno:StartWithPresentation");
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 7bb752c687ac..06468a74dcda 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -3176,7 +3176,7 @@ SfxBoolItem PickThrough SID_PICK_THROUGH
 ]
 
 SfxVoidItem Presentation SID_PRESENTATION
-()
+(SfxUInt16Item StartingSlide FN_PARAM_1)
 [
     AutoUpdate = FALSE,
     FastCall = FALSE,
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 9f798689ba03..315a89533950 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -123,7 +123,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, 
SfxObjectShell* pDrDocSh)
 , mbInitialOnlineSpellingEnabled(true)
 , mbNewOrLoadCompleted(false)
 , mbOnlineSpell(false)
-, mbStartWithPresentation( false )
+, mnStartWithPresentation(0)
 , mbExitAfterPresenting( false )
 , meLanguage( LANGUAGE_SYSTEM )
 , meLanguageCJK( LANGUAGE_SYSTEM )
@@ -1055,9 +1055,9 @@ void SdDrawDocument::SetPrinterIndependentLayout 
(sal_Int32 nMode)
     }
 }
 
-void SdDrawDocument::SetStartWithPresentation( bool bStartWithPresentation )
+void SdDrawDocument::SetStartWithPresentation(sal_uInt16 nStartingSlide)
 {
-    mbStartWithPresentation = bStartWithPresentation;
+    mnStartWithPresentation = nStartingSlide;
 }
 
 void SdDrawDocument::SetExitAfterPresenting( bool bExitAfterPresenting )
diff --git a/sd/source/ui/docshell/docshel4.cxx 
b/sd/source/ui/docshell/docshel4.cxx
index 742614d101c1..514409ec755b 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -284,11 +284,11 @@ bool DrawDocShell::Load( SfxMedium& rMedium )
         mpDoc->SetStarDrawPreviewMode( true );
     }
 
-    if( SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)&&
-        rSet.Get( SID_DOC_STARTPRESENTATION ).GetValue() )
+    if (SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION))
     {
-        bStartPresentation = true;
-        mpDoc->SetStartWithPresentation( true );
+        const sal_uInt16 nStartingSlide = 
rSet.Get(SID_DOC_STARTPRESENTATION).GetValue();
+        bStartPresentation = nStartingSlide;
+        mpDoc->SetStartWithPresentation(nStartingSlide);
     }
 
     bRet = SfxObjectShell::Load( rMedium );
@@ -421,15 +421,18 @@ bool DrawDocShell::ImportFrom(SfxMedium &rMedium,
     const bool bRet = SfxObjectShell::ImportFrom(rMedium, xInsertPosition);
 
     SfxItemSet& rSet = rMedium.GetItemSet();
-    if( SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)&&
-        rSet.Get( SID_DOC_STARTPRESENTATION ).GetValue() )
+    if (SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION))
     {
-        mpDoc->SetStartWithPresentation( true );
-
-        // tell SFX to change viewshell when in preview mode
-        if( IsPreview() )
+        const sal_uInt16 nStartingSlide = 
rSet.Get(SID_DOC_STARTPRESENTATION).GetValue();
+        if (nStartingSlide)
         {
-            GetMedium()->GetItemSet().Put( SfxUInt16Item( SID_VIEW_ID, 1 ) );
+            mpDoc->SetStartWithPresentation(nStartingSlide);
+
+            // tell SFX to change viewshell when in preview mode
+            if (IsPreview())
+            {
+                GetMedium()->GetItemSet().Put(SfxUInt16Item(SID_VIEW_ID, 1));
+            }
         }
     }
 
@@ -453,11 +456,11 @@ bool DrawDocShell::ConvertFrom( SfxMedium& rMedium )
         mpDoc->SetStarDrawPreviewMode( true );
     }
 
-    if( SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)&&
-        rSet.Get( SID_DOC_STARTPRESENTATION ).GetValue() )
+    if (SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION))
     {
-        bStartPresentation = true;
-        mpDoc->SetStartWithPresentation( true );
+        const sal_uInt16 nStartingSlide = 
rSet.Get(SID_DOC_STARTPRESENTATION).GetValue();
+        bStartPresentation = nStartingSlide;
+        mpDoc->SetStartWithPresentation(nStartingSlide);
     }
 
     if( aFilterName == pFilterPowerPoint97
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx 
b/sd/source/ui/slideshow/slideshowimpl.cxx
index 4bf43fc3bda5..3c0039211aa2 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -867,7 +867,8 @@ bool SlideshowImpl::startShow( PresentationSettingsEx const 
* pPresSettings )
         return false;
 
     // Autoplay (pps/ppsx)
-    if (mpViewShell->GetDoc()->IsStartWithPresentation()){
+    if (mpViewShell->GetDoc()->GetStartWithPresentation())
+    {
         mpViewShell->GetDoc()->SetExitAfterPresenting(true);
     }
 
@@ -2056,7 +2057,7 @@ IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl, void*, 
void)
     const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
     xMenu->set_visible("next", mpSlideController->getNextSlideIndex() != -1);
     xMenu->set_visible("prev", (mpSlideController->getPreviousSlideIndex() != 
-1 ) || (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || 
(eMode == SHOWWINDOWMODE_BLANK));
-    xMenu->set_visible("edit", 
mpViewShell->GetDoc()->IsStartWithPresentation());
+    xMenu->set_visible("edit", 
mpViewShell->GetDoc()->GetStartWithPresentation() != 0);
 
     std::unique_ptr<weld::Menu> xPageMenu(xBuilder->weld_menu("gotomenu"));
     OUString sFirstImage(BMP_MENU_FIRST), sLastImage(BMP_MENU_LAST);
@@ -2926,7 +2927,7 @@ void SAL_CALL SlideshowImpl::gotoNextSlide(  )
                     if( mpShowWindow )
                     {
                         mpShowWindow->SetEndMode();
-                        if( !mpViewShell->GetDoc()->IsStartWithPresentation() )
+                        if (!mpViewShell->GetDoc()->GetStartWithPresentation())
                             pause();
                     }
                 }
diff --git a/sd/source/ui/view/ViewShellBase.cxx 
b/sd/source/ui/view/ViewShellBase.cxx
index 88f9c3e77e88..e73bdee1841f 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -63,6 +63,7 @@
 #include <sfx2/msg.hxx>
 #include <sfx2/objface.hxx>
 #include <sfx2/viewfrm.hxx>
+#include <svl/intitem.hxx>
 #include <svl/whiter.hxx>
 #include <svx/theme/ThemeColorChangerCommon.hxx>
 #include <vcl/commandinfoprovider.hxx>
@@ -412,13 +413,17 @@ void ViewShellBase::Notify(SfxBroadcaster& rBC, const 
SfxHint& rHint)
         switch (static_cast<const SfxEventHint&>(rHint).GetEventId())
         {
             case SfxEventHintId::OpenDoc:
-                if( GetDocument() && GetDocument()->IsStartWithPresentation() )
+            {
+                const sal_uInt16 nStartingSlide
+                    = GetDocument() ? 
GetDocument()->GetStartWithPresentation() : 0;
+                if (nStartingSlide)
                 {
-                    GetViewFrame().GetDispatcher()->Execute(
-                        SID_PRESENTATION, SfxCallMode::ASYNCHRON );
+                    SfxUInt16Item aItem(FN_PARAM_1, nStartingSlide);
+                    GetViewFrame().GetDispatcher()->ExecuteList(
+                        SID_PRESENTATION, SfxCallMode::ASYNCHRON, { &aItem });
                 }
                 break;
-
+            }
             default:
                 break;
         }
@@ -1026,7 +1031,7 @@ void ViewShellBase::afterCallbackRegistered()
         svx::theme::notifyLOK(pThemeColors, aDocumentColors);
     }
 
-    if (mpDocument && mpDocument->IsStartWithPresentation())
+    if (mpDocument && mpDocument->GetStartWithPresentation())
     {
         // Be consistent with SidebarController, emit JSON.
         boost::property_tree::ptree aTree;
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index af81827d40d5..9f72178c6387 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -1694,8 +1694,13 @@ namespace slideshowhelp
         {
             //Start at page 0, this would blow away any custom
             //show settings if any were set
+            const SfxUInt16Item* pStartingSlide = 
rReq.GetArg<SfxUInt16Item>(FN_PARAM_1);
+            const sal_uInt16 nStartingSlide = pStartingSlide ? 
pStartingSlide->GetValue() - 1 : 0;
+            SdPage* pSlide = rDoc.GetSdPage(nStartingSlide, 
PageKind::Standard);
+            const OUString& rStartingSlide = pSlide ? pSlide->GetName() : 
OUString();
+
             Sequence< PropertyValue > aArguments{ 
comphelper::makePropertyValue("FirstPage",
-                                                                               
 OUString("0")) };
+                                                                               
 rStartingSlide) };
             xPresentation->startWithArguments( aArguments );
         }
         sfx2::SfxNotebookBar::UnlockNotebookBar();
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 386cce711c7c..2985fe8ab98c 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -545,11 +545,11 @@ void TransformParameters( sal_uInt16 nSlotId, const 
uno::Sequence<beans::Propert
             }
             else if ( aName == sStartPresentation )
             {
-                bool bVal = false;
-                bool bOK = (rProp.Value >>= bVal);
+                sal_uInt16 nVal = 0;
+                bool bOK = (rProp.Value >>= nVal);
                 DBG_ASSERT( bOK, "invalid type for StartPresentation" );
                 if (bOK)
-                    rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) );
+                    rSet.Put(SfxUInt16Item(SID_DOC_STARTPRESENTATION, nVal));
             }
             else if ( aName == sSelectionOnly )
             {
@@ -1491,7 +1491,7 @@ void TransformItems( sal_uInt16 nSlotId, const 
SfxItemSet& rSet, uno::Sequence<b
             pValue[nActProp].Name = sDdeReconnect;
             pValue[nActProp++].Value <<= pItem->GetValue();
         }
-        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( 
SID_DOC_STARTPRESENTATION, false) )
+        if (const SfxUInt16Item* pItem = 
rSet.GetItemIfSet(SID_DOC_STARTPRESENTATION, false))
         {
             pValue[nActProp].Name = sStartPresentation;
             pValue[nActProp++].Value <<= pItem->GetValue();
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index b1f16c498625..f4826b93ad7d 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -650,7 +650,7 @@ bool SfxObjectShell::DoLoad( SfxMedium *pMed )
             SetError(nError);
 
         if (pMedium->GetFilter()->GetFilterFlags() & 
SfxFilterFlags::STARTPRESENTATION)
-            rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, true) );
+            rSet.Put(SfxUInt16Item(SID_DOC_STARTPRESENTATION, 1));
     }
 
     EnableSetModified( false );

Reply via email to