sd/source/ui/docshell/docshel4.cxx | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
New commits: commit 9c0cd7c60b138fa5265969dae3847a5e8e1ca923 Author: Tibor Nagy <tibor.nagy.ext...@allotropia.de> AuthorDate: Fri Sep 6 23:15:21 2024 +0200 Commit: Nagy Tibor <tibor.nagy.ext...@allotropia.de> CommitDate: Mon Sep 9 23:07:00 2024 +0200 tdf#76981 sd: opening linked presentation in slideshow mode If an Impress presentation(odp) is opened via a document link while in slideshow mode, the linked presentation should open in slideshow mode and close when finished. If it is opened while in editing mode, the linked presentation should open in editing mode. Change-Id: I3fd410872472ed6391b2150151810b5da32fa29b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172984 Tested-by: Jenkins Reviewed-by: Nagy Tibor <tibor.nagy.ext...@allotropia.de> diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 76562ed093ca..3b60fd176367 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -285,13 +285,6 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) mpDoc->SetStarDrawPreviewMode( true ); } - if (SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)) - { - const sal_uInt16 nStartingSlide = rSet.Get(SID_DOC_STARTPRESENTATION).GetValue(); - bStartPresentation = nStartingSlide; - mpDoc->SetStartWithPresentation(nStartingSlide); - } - bRet = SfxObjectShell::Load( rMedium ); if (bRet) { @@ -335,6 +328,25 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) SetError(ERRCODE_ABORT); } + if (SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)) + { + sal_uInt16 nStartingSlide = rSet.Get(SID_DOC_STARTPRESENTATION).GetValue(); + if (nStartingSlide == 0) + { + OUString sStartPage = mpDoc->getPresentationSettings().maPresPage; + if (!sStartPage.isEmpty()) + { + bool bIsMasterPage = false; + sal_uInt16 nPageNumb = mpDoc->GetPageByName(sStartPage, bIsMasterPage); + nStartingSlide = (nPageNumb + 1) / 2; + } + else + nStartingSlide = 1; + } + bStartPresentation = nStartingSlide; + mpDoc->SetStartWithPresentation(nStartingSlide); + } + // tell SFX to change viewshell when in preview mode if( IsPreview() || bStartPresentation ) { @@ -972,7 +984,9 @@ void DrawDocShell::OpenBookmark( const OUString& rBookmarkURL ) { SfxStringItem aStrItem( SID_FILE_NAME, rBookmarkURL ); SfxStringItem aReferer( SID_REFERER, GetMedium()->GetName() ); - const SfxPoolItem* ppArgs[] = { &aStrItem, &aReferer, nullptr }; + SfxUInt16Item aPresentation( SID_DOC_STARTPRESENTATION ); + const SfxPoolItem* ppArgs[] = { &aStrItem, &aReferer, &aPresentation, nullptr }; + if (SfxViewFrame* pFrame = mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current()) pFrame->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs ); }