From db00223e6d3132eac9603e5dabd20cd03f599cb3 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 18 May 2016 12:10:26 +0100 Subject: Related: tdf#99523 select only the desired slides when selecting the same slides in the document as are selected in the slide pane, don't forget to unselect any slides already selected in the document. impress is nuts in carrying around two selection mechanisms. Change-Id: I97d744c1c57b68dc312a17a5cd5290e1b6ccf083 --- sd/inc/drawdoc.hxx | 1 + sd/source/core/drawdoc2.cxx | 10 ++++++++++ sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index bf5e0db7429f..476be4de258e 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -363,6 +363,7 @@ public: sal_uInt16 GetSdPageCount(PageKind ePgKind) const; SAL_DLLPRIVATE void SetSelected(SdPage* pPage, bool bSelect); + SAL_DLLPRIVATE void UnselectAllPages(); SAL_DLLPRIVATE bool MovePages(sal_uInt16 nTargetPage); SdPage*GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind); diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx index 68f3b91feb4d..200f613f4972 100644 --- a/sd/source/core/drawdoc2.cxx +++ b/sd/source/core/drawdoc2.cxx @@ -696,6 +696,16 @@ bool SdDrawDocument::CreateMissingNotesAndHandoutPages() return bOK; } +void SdDrawDocument::UnselectAllPages() +{ + sal_uInt16 nNoOfPages = GetSdPageCount(PK_STANDARD); + for (sal_uInt16 nPage = 0; nPage < nNoOfPages; ++nPage) + { + SdPage* pPage = GetSdPage(nPage, PK_STANDARD); + pPage->SetSelected(false); + } +} + // + Move selected pages after said page // (nTargetPage = (sal_uInt16)-1 --> move before first page) // + Returns sal_True when the page has been moved diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx index dbc53f2bc260..24fab760d082 100644 --- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx +++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx @@ -718,6 +718,7 @@ void SlideSorterViewShell::ExecMovePageFirst (SfxRequest& /*rReq*/) // SdDrawDocument MovePages is based on SdPage IsSelected, so // transfer the SlideSorter selection to SdPages (*it) + GetDoc()->UnselectAllPages(); std::shared_ptr pSelection ( GetPageSelection() ); for (auto it = pSelection->begin(); it != pSelection->end() ; ++it ) { GetDoc()->SetSelected(*it, true); @@ -769,6 +770,7 @@ void SlideSorterViewShell::ExecMovePageUp (SfxRequest& /*rReq*/) sal_uInt16 pageNo; // SdDrawDocument MovePages is based on SdPage IsSelected, so // transfer the SlideSorter selection to SdPages (*it) + GetDoc()->UnselectAllPages(); std::shared_ptr pSelection ( GetPageSelection() ); for (auto it = pSelection->begin(); it != pSelection->end() ; ++it ) { // Check page number @@ -803,6 +805,7 @@ void SlideSorterViewShell::ExecMovePageDown (SfxRequest& /*rReq*/) sal_uInt16 pageNo; // SdDrawDocument MovePages is based on SdPage IsSelected, so // transfer the SlideSorter selection to SdPages (*it) + GetDoc()->UnselectAllPages(); std::shared_ptr pSelection ( GetPageSelection() ); for (auto it = pSelection->begin(); it != pSelection->end() ; ++it ) { @@ -837,6 +840,7 @@ void SlideSorterViewShell::ExecMovePageLast (SfxRequest& /*rReq*/) // SdDrawDocument MovePages is based on SdPage IsSelected, so // transfer the SlideSorter selection to SdPages (*it) + GetDoc()->UnselectAllPages(); std::shared_ptr pSelection ( GetPageSelection() ); for (auto it = pSelection->begin(); it != pSelection->end() ; ++it ) { GetDoc()->SetSelected(*it, true); @@ -866,6 +870,7 @@ void SlideSorterViewShell::GetStateMovePageLast (SfxItemSet& rSet) sal_uInt16 pageNo; // SdDrawDocument MovePages is based on SdPage IsSelected, so // transfer the SlideSorter selection to SdPages (*it) + GetDoc()->UnselectAllPages(); std::shared_ptr pSelection ( GetPageSelection() ); for (auto it = pSelection->begin(); it != pSelection->end() ; ++it ) { -- cgit v1.2.3