diff options
author | Andre Fischer <af@apache.org> | 2014-02-21 11:55:33 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-21 15:30:24 +0000 |
commit | ad0c4bf5790546242884da0c2ec281f2db9e14a0 (patch) | |
tree | 80c666f07276cb844b8da23c140cb2652f0b5f46 /sd/source/ui/slidesorter/controller/SlsPageSelector.cxx | |
parent | 0f82480261a177cbb4f83548c8ce578056bb625a (diff) |
Related: #i123197# Fixed selection problems when switching...
between normal and master mode.
(cherry picked from commit 163d414311b0c8bcb1b0ad7c7cbf364e0ad4e4c4)
Change-Id: Ibabee4c67367c367a9ce1c5afffa76efa3f66bd7
Diffstat (limited to 'sd/source/ui/slidesorter/controller/SlsPageSelector.cxx')
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsPageSelector.cxx | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx index 4121add0b584..1484159df697 100644 --- a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx +++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx @@ -60,7 +60,7 @@ PageSelector::PageSelector (SlideSorter& rSlideSorter) mpSelectionAnchor(), mpCurrentPage(), mnUpdateLockCount(0), - mbIsUpdateCurrentPagePending(false) + mbIsUpdateCurrentPagePending(true) { CountSelectedPages (); } @@ -375,27 +375,39 @@ void PageSelector::UpdateCurrentPage (const bool bUpdateOnlyWhenPending) mbIsUpdateCurrentPagePending = false; // Make the first selected page the current page. + SharedPageDescriptor pCurrentPageDescriptor; const sal_Int32 nPageCount (GetPageCount()); for (sal_Int32 nIndex=0; nIndex<nPageCount; ++nIndex) { SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nIndex)); - if (pDescriptor && pDescriptor->HasState(PageDescriptor::ST_Selected)) + if ( ! pDescriptor) + continue; + if (pDescriptor->HasState(PageDescriptor::ST_Selected)) { - // Switching the current slide normally sets also the selection - // to just the new current slide. To prevent that, we store - // (and at the end of this scope restore) the current selection. - ::boost::shared_ptr<PageSelection> pSelection (GetPageSelection()); - - mrController.GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor); - - // Restore the selection and prevent a recursive call to - // UpdateCurrentPage(). - SetPageSelection(pSelection, false); - return; + pCurrentPageDescriptor = pDescriptor; + break; } } + if ( ! pCurrentPageDescriptor && nPageCount>0) + { + // No page is selected. Make the first slide the current page. + pCurrentPageDescriptor = mrModel.GetPageDescriptor(0); + } - // No page is selected. Do not change the current slide. + if (pCurrentPageDescriptor) + { + // Switching the current slide normally sets also the + // selection to just the new current slide. To prevent that, + // we store (and at the end of this scope restore) the current + // selection. + ::boost::shared_ptr<PageSelection> pSelection (GetPageSelection()); + + mrController.GetCurrentSlideManager()->SwitchCurrentSlide(pCurrentPageDescriptor); + + // Restore the selection and prevent a recursive call to + // UpdateCurrentPage(). + SetPageSelection(pSelection, false); + } } |