sd/source/ui/docshell/docshel4.cxx | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
New commits: commit 93f71fca39df1b60c25b5e8b608b8c5997e986eb Author: Tibor Nagy <tibor.nagy.ext...@allotropia.de> AuthorDate: Fri Sep 6 23:15:21 2024 +0200 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Tue Sep 10 00:55:47 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> (cherry picked from commit 9c0cd7c60b138fa5265969dae3847a5e8e1ca923) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173092 Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Tested-by: allotropia jenkins <jenk...@allotropia.de> diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 742614d101c1..6e995937215d 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -284,13 +284,6 @@ bool DrawDocShell::Load( SfxMedium& rMedium ) mpDoc->SetStarDrawPreviewMode( true ); } - if( SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)&& - rSet.Get( SID_DOC_STARTPRESENTATION ).GetValue() ) - { - bStartPresentation = true; - mpDoc->SetStartWithPresentation( true ); - } - bRet = SfxObjectShell::Load( rMedium ); if (bRet) { @@ -334,6 +327,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 ) { @@ -957,7 +969,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 ); }