diff options
-rw-r--r-- | sd/source/ui/docshell/docshel4.cxx | 38 | ||||
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 16 |
2 files changed, 46 insertions, 8 deletions
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index 6e995937215d..63722ba11c68 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -433,10 +433,22 @@ 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 ); + 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; + } + mpDoc->SetStartWithPresentation(nStartingSlide); // tell SFX to change viewshell when in preview mode if( IsPreview() ) @@ -465,11 +477,23 @@ 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 ); + 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); } if( aFilterName == pFilterPowerPoint97 diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 37c67e1ef293..03b57763986f 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 ) |