diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-05-16 13:18:06 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-05-23 08:37:32 +0000 |
commit | 83c3c4d46d7185856041be3d9da660aaceff8799 (patch) | |
tree | baba56b0eaa80cefa2f2ccdd78dd69b24f1bf6bd /sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx | |
parent | 4c05c610661096342c0f826936aa3307a7ca78b3 (diff) |
Resolves: tdf#99523 exit text edit and unmark objects before moving slide
otherwise correct undo isn't recorded for moving the slides
Change-Id: I08338a413f10242c4bdf92a73d504f125bc26631
(cherry picked from commit 4e41e784b97a5b6f5e0cc1f5b24b816ef887b310)
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.
Change-Id: I97d744c1c57b68dc312a17a5cd5290e1b6ccf083
(cherry picked from commit db00223e6d3132eac9603e5dabd20cd03f599cb3)
give this tremendously useful snippet a descriptive name and de-duplicate it
This is the magic smoke which sets the right selection on an undo of move
slides when the slidesorter has the focus. If the main shell has the focus
then the undo doesn't reselect the original slides like it does when this
artifact is in the mix.
Change-Id: I5ebe0195225136bfaf81e28ad4ba8e9ec431cc22
(cherry picked from commit e226c19e9136dda366c1485a9d53a0c5d433387c)
move the KeepSlideSorterInSyncWithPageChanges to a level lower
so that is a SlideSorter is present it is kept in sync on
undo/redo. regardless of whether focus is in the SlideSorter
or in the main shell.
Change-Id: I11b3333b4447a6020862092e89e9a89de1768f87
(cherry picked from commit a0de7474400ae0a84daf688de12c9344d028df93)
maDeletedPages member of slidesorter is only written to, never read
Change-Id: I5eb58462306f3d8cab54eb00f4ff492c80585dbb
(cherry picked from commit 9288886b01907545e22b98dca1dc666a11d71e55)
Related: tdf#99523 NotifyPageEvent ultimately comes from HINT_PAGEORDERCHG...
which is called for removepage, insertpage *and* change page number. e.g.
ctrl+shift+end and similar *move* the page, in those cases not removing before
adding results in duplicate pages/slides in the list, causing inconsistencies
on what gets selected on undo
Change-Id: I7e0a0231e90a77adea03619a0dd92ddbbcbba442
(cherry picked from commit bb3671180eb7327be9ac178e0d8341322f63d72a)
refactor this repeated code into a single method
no logic change
Change-Id: I362d888323bb22ded7812147811efbebce933564
(cherry picked from commit cc03133e1b719ad6ae3885f2eca519196843f2c4)
Reviewed-on: https://gerrit.libreoffice.org/25107
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx')
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx index c90b10458ea7..cf1ed111faaf 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx @@ -58,8 +58,7 @@ void SelectionObserver::Context::Abort() SelectionObserver::SelectionObserver (SlideSorter& rSlideSorter) : mrSlideSorter(rSlideSorter), mbIsOvservationActive(false), - maInsertedPages(), - maDeletedPages() + maInsertedPages() { } @@ -76,24 +75,22 @@ void SelectionObserver::NotifyPageEvent (const SdrPage* pSdrPage) if (pPage == nullptr) return; + //NotifyPageEvent is called for add, remove, *and* change position so for + //the change position case we must ensure we don't end up with the slide + //duplicated in our list + std::vector<const SdPage*>::iterator iPage( + std::find(maInsertedPages.begin(), maInsertedPages.end(), pPage)); + if (iPage != maInsertedPages.end()) + maInsertedPages.erase(iPage); + if (pPage->IsInserted()) maInsertedPages.push_back(pPage); - else - { - ::std::vector<const SdPage*>::iterator iPage( - ::std::find(maInsertedPages.begin(), maInsertedPages.end(), pPage)); - if (iPage != maInsertedPages.end()) - maInsertedPages.erase(iPage); - - maDeletedPages.push_back(pPage->GetPageNum()); - } } void SelectionObserver::StartObservation() { OSL_ASSERT(!mbIsOvservationActive); maInsertedPages.clear(); - maDeletedPages.clear(); mbIsOvservationActive = true; } @@ -102,7 +99,6 @@ void SelectionObserver::AbortObservation() OSL_ASSERT(mbIsOvservationActive); mbIsOvservationActive = false; maInsertedPages.clear(); - maDeletedPages.clear(); } void SelectionObserver::EndObservation() @@ -126,7 +122,6 @@ void SelectionObserver::EndObservation() } maInsertedPages.clear(); } - maDeletedPages.clear(); aUpdateLock.Release(); mrSlideSorter.GetController().GetFocusManager().SetFocusedPageToCurrentPage(); |