sd/source/ui/docshell/docshel4.cxx | 37 +++++++++++++++++++++++++++++-------- sfx2/source/appl/appopen.cxx | 16 +++++++++++++++- 2 files changed, 44 insertions(+), 9 deletions(-)
New commits: commit a781e5ad356ad0fb86eb8210a2c570fdd276ceac Author: Tibor Nagy <[email protected]> AuthorDate: Tue Sep 10 12:04:13 2024 +0200 Commit: Nagy Tibor <[email protected]> CommitDate: Tue Sep 10 18:57:34 2024 +0200 tdf#76981 sd: opening linked presentation in slideshow mode (part2) If an MSO presentation(pptx,ppt) 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: Ia9df1e4daa55dc697285a3778102a850e2f6098c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173130 Tested-by: Jenkins Reviewed-by: Nagy Tibor <[email protected]> diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 3b60fd176367..202d69fc0aad 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -447,16 +447,25 @@ bool DrawDocShell::ImportFrom(SfxMedium &rMedium, SfxItemSet& rSet = rMedium.GetItemSet(); if (SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)) { - const sal_uInt16 nStartingSlide = rSet.Get(SID_DOC_STARTPRESENTATION).GetValue(); - if (nStartingSlide) + sal_uInt16 nStartingSlide = rSet.Get(SID_DOC_STARTPRESENTATION).GetValue(); + if (nStartingSlide == 0) { - mpDoc->SetStartWithPresentation(nStartingSlide); - - // tell SFX to change viewshell when in preview mode - if (IsPreview()) + OUString sStartPage = mpDoc->getPresentationSettings().maPresPage; + if (!sStartPage.isEmpty()) { - GetMedium()->GetItemSet().Put(SfxUInt16Item(SID_VIEW_ID, 1)); + bool bIsMasterPage = false; + sal_uInt16 nPageNumb = mpDoc->GetPageByName(sStartPage, bIsMasterPage); + nStartingSlide = (nPageNumb + 1) / 2; } + else + nStartingSlide = 1; + } + mpDoc->SetStartWithPresentation(nStartingSlide); + + // tell SFX to change viewshell when in preview mode + if (IsPreview()) + { + GetMedium()->GetItemSet().Put(SfxUInt16Item(SID_VIEW_ID, 1)); } } @@ -482,7 +491,19 @@ bool DrawDocShell::ConvertFrom( SfxMedium& rMedium ) if (SfxItemState::SET == rSet.GetItemState(SID_DOC_STARTPRESENTATION)) { - const sal_uInt16 nStartingSlide = rSet.Get(SID_DOC_STARTPRESENTATION).GetValue(); + 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); } diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index a271df27c472..0eb93a09571f 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -862,7 +862,21 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) pFilter = rMatcher.GetFilter4EA( aTypeName ); } - if (!pFilter || !lcl_isFilterNativelySupported(*pFilter)) + bool bStartPresentation = false; + if (pFilter) + { + const SfxUInt16Item* pSlide = rReq.GetArg<SfxUInt16Item>(SID_DOC_STARTPRESENTATION); + if (pSlide + && (pFilter->GetWildcard().Matches(u".pptx") + || pFilter->GetWildcard().Matches(u".ppt") + || pFilter->GetWildcard().Matches(u".ppsx") + || pFilter->GetWildcard().Matches(u".pps"))) + { + bStartPresentation = true; + } + } + + if (!pFilter || (!lcl_isFilterNativelySupported(*pFilter) && !bStartPresentation)) { // hyperlink does not link to own type => special handling (http, ftp) browser and (other external protocols) OS if ( aINetProtocol == INetProtocol::Mailto )
