From a46a847d4298806d4e91e4665c3c1907c09a17c7 Mon Sep 17 00:00:00 2001 From: Tibor Nagy Date: Fri, 25 Jun 2021 11:52:03 +0200 Subject: [PATCH] tdf#142589 Impress UI: fix Start button of Custom Slide Shows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This button started the selected custom slide show only by changing the (already) selected custom slide show, and enabling the checkbox "Use custom slide show". Otherwise it started always the full show. Remove the redundant checkbox "Use custom slide show" of the dialog window "Custom Slide Shows" (Slide Show->Custom Slide Show...) to avoid inconsistent behavior of the Start button (which could start the full show instead of the selected custom slide show). Now Start button of the dialog starts the selected custom slide show only once, i.e. it doesn't modify the global slide show settings for all the next slide shows (that is already handled by Slide Show->Slide Show Settings->Range->"Custom slide show:" and Slide Show->Slide Show Settings->Range->"All slides"). Change-Id: I6e97a69c546870199d5a45d9a6ad102e30d820c2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117876 Tested-by: László Németh Reviewed-by: László Németh --- sd/inc/drawdoc.hxx | 1 + sd/qa/unit/uiimpress.cxx | 17 ++++++++++++++ sd/source/core/drawdoc.cxx | 3 ++- sd/source/ui/dlg/custsdlg.cxx | 21 +++++------------ sd/source/ui/func/fucushow.cxx | 25 +++++++++++++++------ sd/source/ui/func/fusldlg.cxx | 1 + sd/source/ui/inc/custsdlg.hxx | 2 -- sd/source/ui/inc/slideshow.hxx | 3 ++- sd/source/ui/view/drviewse.cxx | 4 ++++ sd/uiconfig/simpress/ui/customslideshows.ui | 20 ----------------- 10 files changed, 50 insertions(+), 47 deletions(-) diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index 7d4c3c92ce5c..80a79955537f 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -108,6 +108,7 @@ namespace sd bool mbAnimationAllowed; sal_Int32 mnPauseTimeout; bool mbShowPauseLogo; + bool mbStartCustomShow; PresentationSettings(); }; diff --git a/sd/qa/unit/uiimpress.cxx b/sd/qa/unit/uiimpress.cxx index 8fa1622d6197..444677fdda41 100644 --- a/sd/qa/unit/uiimpress.cxx +++ b/sd/qa/unit/uiimpress.cxx @@ -49,6 +49,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -717,6 +718,22 @@ CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testSearchAllInDocumentAndNotes) Scheduler::ProcessEventsToIdle(); } +CPPUNIT_TEST_FIXTURE(SdUiImpressTest, testTdf142589) +{ + mxComponent = loadFromDesktop("private:factory/simpress", + "com.sun.star.presentation.PresentationDocument"); + CPPUNIT_ASSERT(mxComponent.is()); + + auto pImpressDocument = dynamic_cast(mxComponent.get()); + sd::ViewShell* pViewShell = pImpressDocument->GetDocShell()->GetViewShell(); + + SfxRequest aRequest(pViewShell->GetViewFrame(), SID_PRESENTATION); + pImpressDocument->GetDoc()->getPresentationSettings().mbCustomShow = true; + pImpressDocument->GetDoc()->getPresentationSettings().mbStartCustomShow = true; + sd::slideshowhelp::ShowSlideShow(aRequest, *pImpressDocument->GetDoc()); + CPPUNIT_ASSERT_EQUAL(false, pImpressDocument->GetDoc()->getPresentationSettings().mbCustomShow); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 4e7c6c5dbd88..baf1d57fea18 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -109,7 +109,8 @@ PresentationSettings::PresentationSettings() mbFullScreen( true ), mbAnimationAllowed( true ), mnPauseTimeout( 0 ), - mbShowPauseLogo( false ) + mbShowPauseLogo( false ), + mbStartCustomShow( false ) { } diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx index afa9e0be21be..db2414a51fa2 100644 --- a/sd/source/ui/dlg/custsdlg.cxx +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -38,7 +38,6 @@ SdCustomShowDlg::SdCustomShowDlg(weld::Window* pWindow, SdDrawDocument& rDrawDoc , pCustomShowList(nullptr) , bModified(false) , m_xLbCustomShows(m_xBuilder->weld_tree_view("customshowlist")) - , m_xCbxUseCustomShow(m_xBuilder->weld_check_button("usecustomshows")) , m_xBtnNew(m_xBuilder->weld_button("new")) , m_xBtnEdit(m_xBuilder->weld_button("edit")) , m_xBtnRemove(m_xBuilder->weld_button("delete")) @@ -55,7 +54,6 @@ SdCustomShowDlg::SdCustomShowDlg(weld::Window* pWindow, SdDrawDocument& rDrawDoc m_xBtnEdit->connect_clicked( aLink ); m_xBtnRemove->connect_clicked( aLink ); m_xBtnCopy->connect_clicked( aLink ); - m_xCbxUseCustomShow->connect_toggled(LINK(this, SdCustomShowDlg, ToggleButtonHdl)); m_xLbCustomShows->connect_changed( LINK( this, SdCustomShowDlg, SelectListBoxHdl ) ); m_xBtnStartShow->connect_clicked( LINK( this, SdCustomShowDlg, StartShowHdl ) ); // for test @@ -76,8 +74,6 @@ SdCustomShowDlg::SdCustomShowDlg(weld::Window* pWindow, SdDrawDocument& rDrawDoc pCustomShowList->Seek( nPosToSelect ); } - m_xCbxUseCustomShow->set_active(pCustomShowList && rDoc.getPresentationSettings().mbCustomShow); - CheckState(); } @@ -93,18 +89,12 @@ void SdCustomShowDlg::CheckState() m_xBtnEdit->set_sensitive( bEnable ); m_xBtnRemove->set_sensitive( bEnable ); m_xBtnCopy->set_sensitive( bEnable ); - m_xCbxUseCustomShow->set_sensitive( bEnable ); - m_xBtnStartShow->set_sensitive(true); + m_xBtnStartShow->set_sensitive(bEnable); if (bEnable && pCustomShowList) pCustomShowList->Seek( nPos ); } -IMPL_LINK( SdCustomShowDlg, ToggleButtonHdl, weld::Toggleable&, r, void ) -{ - SelectHdl(&r); -} - IMPL_LINK( SdCustomShowDlg, ClickButtonHdl, weld::Button&, r, void ) { SelectHdl(&r); @@ -241,10 +231,6 @@ void SdCustomShowDlg::SelectHdl(void const *p) bModified = true; } - else if( p == m_xCbxUseCustomShow.get() ) - { - bModified = true; - } CheckState(); } @@ -258,7 +244,10 @@ IMPL_LINK_NOARG(SdCustomShowDlg, StartShowHdl, weld::Button&, void) // CheckState bool SdCustomShowDlg::IsCustomShow() const { - return (m_xCbxUseCustomShow->get_sensitive() && m_xCbxUseCustomShow->get_active()); + if (!pCustomShowList->empty()) + return true; + else + return false; } // SdDefineCustomShowDlg diff --git a/sd/source/ui/func/fucushow.cxx b/sd/source/ui/func/fucushow.cxx index a87076b8ed6f..8c63d0215776 100644 --- a/sd/source/ui/func/fucushow.cxx +++ b/sd/source/ui/func/fucushow.cxx @@ -55,21 +55,32 @@ void FuCustomShowDlg::DoExecute( SfxRequest& ) vcl::Window* pWin = mpViewShell->GetActiveWindow(); ScopedVclPtr pDlg( pFact->CreateSdCustomShowDlg(pWin ? pWin->GetFrameWeld() : nullptr, *mpDoc) ); sal_uInt16 nRet = pDlg->Execute(); - if( pDlg->IsModified() ) - { - mpDoc->SetChanged(); - sd::PresentationSettings& rSettings = mpDoc->getPresentationSettings(); - rSettings.mbCustomShow = pDlg->IsCustomShow(); - } - pDlg.disposeAndClear(); + mpDoc->SetChanged(); + sd::PresentationSettings& rSettings = mpDoc->getPresentationSettings(); if( nRet == RET_YES ) { + // If the custom show is not set by default + if (!rSettings.mbCustomShow) + { + rSettings.mbStartCustomShow = true; + rSettings.mbCustomShow = pDlg->IsCustomShow(); + } + mpViewShell->SetStartShowWithDialog(true); mpViewShell->GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD ); } + if (nRet == RET_OK) + { + if (!pDlg->IsCustomShow()) + { + rSettings.mbCustomShow = false; + rSettings.mbAll = true; + } + } + pDlg.disposeAndClear(); } } // end of namespace diff --git a/sd/source/ui/func/fusldlg.cxx b/sd/source/ui/func/fusldlg.cxx index 484aa5f1f9b7..4fcc5fd9f5ce 100644 --- a/sd/source/ui/func/fusldlg.cxx +++ b/sd/source/ui/func/fusldlg.cxx @@ -141,6 +141,7 @@ void FuSlideShowDlg::DoExecute( SfxRequest& ) { bValuesChanged = true; rPresentationSettings.mbCustomShow = bValue; + rPresentationSettings.mbStartCustomShow = false; } bValue = ITEMVALUE( aDlgSet, ATTR_PRESENT_ENDLESS, SfxBoolItem ); diff --git a/sd/source/ui/inc/custsdlg.hxx b/sd/source/ui/inc/custsdlg.hxx index 3ef3cfb1cd66..cd25983e9528 100644 --- a/sd/source/ui/inc/custsdlg.hxx +++ b/sd/source/ui/inc/custsdlg.hxx @@ -33,7 +33,6 @@ private: bool bModified; std::unique_ptr m_xLbCustomShows; - std::unique_ptr m_xCbxUseCustomShow; std::unique_ptr m_xBtnNew; std::unique_ptr m_xBtnEdit; std::unique_ptr m_xBtnRemove; @@ -45,7 +44,6 @@ private: void CheckState(); DECL_LINK( ClickButtonHdl, weld::Button&, void ); - DECL_LINK( ToggleButtonHdl, weld::Toggleable&, void ); DECL_LINK( SelectListBoxHdl, weld::TreeView&, void ); DECL_LINK( StartShowHdl, weld::Button&, void ); void SelectHdl(void const *); diff --git a/sd/source/ui/inc/slideshow.hxx b/sd/source/ui/inc/slideshow.hxx index a1eef4689da8..68fe77125647 100644 --- a/sd/source/ui/inc/slideshow.hxx +++ b/sd/source/ui/inc/slideshow.hxx @@ -32,6 +32,7 @@ #include #include +#include namespace com::sun::star { namespace drawing { @@ -208,7 +209,7 @@ private: namespace slideshowhelp { - void ShowSlideShow(SfxRequest const & rReq, SdDrawDocument &rDoc); + SD_DLLPUBLIC void ShowSlideShow(SfxRequest const& rReq, SdDrawDocument& rDoc); } } diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index 9fb69869a0da..5e5a3ff38514 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -1653,6 +1653,10 @@ namespace slideshowhelp //use it whether or not we've been asked to //start from the current or first slide xPresentation->start(); + + // if the custom show not set by default, only show it. + if (rDoc.getPresentationSettings().mbStartCustomShow) + rDoc.getPresentationSettings().mbCustomShow = false; } else if (SID_PRESENTATION_CURRENT_SLIDE == rReq.GetSlot()) { diff --git a/sd/uiconfig/simpress/ui/customslideshows.ui b/sd/uiconfig/simpress/ui/customslideshows.ui index 5e0ac35717b4..f2ca42650068 100644 --- a/sd/uiconfig/simpress/ui/customslideshows.ui +++ b/sd/uiconfig/simpress/ui/customslideshows.ui @@ -146,26 +146,6 @@ 0 - - - _Use custom slide show - True - True - False - True - True - - - Runs the custom slide show you selected when you click Start. Otherwise, the entire presentation is shown. - - - - - False - True - 1 - - True