graphite/graphite-2.3.1.patch | 25 ++++++ sd/source/ui/slidesorter/controller/SlideSorterController.cxx | 12 +-- sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx | 5 + sd/source/ui/slidesorter/controller/SlsPageSelector.cxx | 40 ++++++---- sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx | 2 sd/source/ui/slidesorter/model/SlideSorterModel.cxx | 31 ++++++- sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx | 4 - 7 files changed, 89 insertions(+), 30 deletions(-)
New commits: commit 163d414311b0c8bcb1b0ad7c7cbf364e0ad4e4c4 Author: Andre Fischer <a...@apache.org> Date: Fri Feb 21 11:55:33 2014 +0000 123197: Fixed selection problems when switching between normal and master mode. diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index 83650d7..5b59595 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -946,6 +946,8 @@ void SlideSorterController::FinishEditModeChange (void) { if (mrModel.GetEditMode() == EM_MASTERPAGE) { + mpPageSelector->DeselectAllPages(); + // Search for the master page that was determined in // PrepareEditModeChange() and make it the current page. PageEnumeration aAllPages (PageEnumerationProvider::CreateAllPagesEnumeration(mrModel)); @@ -955,16 +957,20 @@ void SlideSorterController::FinishEditModeChange (void) if (pDescriptor->GetPage() == mpEditModeChangeMasterPage) { GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor); + mpPageSelector->SelectPage(pDescriptor); break; } } } else { + PageSelector::BroadcastLock aBroadcastLock (*mpPageSelector); + SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(mnCurrentPageBeforeSwitch)); GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor); // Restore the selection. + mpPageSelector->DeselectAllPages(); ::std::vector<SdPage*>::iterator iPage; for (iPage=maSelectionBeforeSwitch.begin(); iPage!=maSelectionBeforeSwitch.end(); @@ -1049,12 +1055,6 @@ void SlideSorterController::SetDocumentSlides (const Reference<container::XIndex PreModelChange(); mrModel.SetDocumentSlides(rxSlides); - mrView.Layout(); - - // Select just the current slide. - PageSelector::BroadcastLock aBroadcastLock (*mpPageSelector); - mpPageSelector->DeselectAllPages(); - mpPageSelector->SelectPage(mpCurrentSlideManager->GetCurrentSlide()); } } diff --git a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx index 0aa9f08..9676c5e 100644 --- a/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsCurrentSlideManager.cxx @@ -86,11 +86,14 @@ void CurrentSlideManager::NotifyCurrentSlideChange (const sal_Int32 nSlideIndex) { if (mnCurrentSlideIndex != nSlideIndex) { + PageSelector::BroadcastLock aBroadcastLock (mrSlideSorter.GetController().GetPageSelector()); + + mrSlideSorter.GetController().GetPageSelector().DeselectAllPages(); + ReleaseCurrentSlide(); AcquireCurrentSlide(nSlideIndex); // Update the selection. - mrSlideSorter.GetController().GetPageSelector().DeselectAllPages(); if (mpCurrentSlide) { mrSlideSorter.GetController().GetPageSelector().SelectPage(mpCurrentSlide); diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx index e03e202..8a17124 100644 --- a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx +++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx @@ -65,7 +65,7 @@ PageSelector::PageSelector (SlideSorter& rSlideSorter) mpSelectionAnchor(), mpCurrentPage(), mnUpdateLockCount(0), - mbIsUpdateCurrentPagePending(false) + mbIsUpdateCurrentPagePending(true) { CountSelectedPages (); } @@ -393,27 +393,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); + } } diff --git a/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx b/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx index d195f28..6e2d009 100644 --- a/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx +++ b/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx @@ -56,7 +56,7 @@ namespace sd { namespace slidesorter { namespace model { class DocumentPageContainer; inline sal_Int32 FromCoreIndex (const sal_uInt16 nCoreIndex) { return (nCoreIndex-1)/2; } -inline sal_uInt16 ToCoreIndex (const sal_Int32 nIndex) { return nIndex*2+1; } +inline sal_uInt16 ToCoreIndex (const sal_Int32 nIndex) { return static_cast<sal_uInt16>(nIndex*2+1); } /** The model of the slide sorter gives access to the slides that are to be displayed in the slide sorter view. Via the SetDocumentSlides() method diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx index 63b58b2..3512217 100644 --- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx +++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx @@ -173,7 +173,6 @@ bool SlideSorterModel::SetEditMode (EditMode eEditMode) { meEditMode = eEditMode; UpdatePageList(); - ClearDescriptorList(); bEditModeChanged = true; } return bEditModeChanged; @@ -424,7 +423,8 @@ void SlideSorterModel::SynchronizeDocumentSelection (void) while (aAllPages.HasMoreElements()) { SharedPageDescriptor pDescriptor (aAllPages.GetNextElement()); - pDescriptor->GetPage()->SetSelected(pDescriptor->HasState(PageDescriptor::ST_Selected)); + const bool bIsSelected (pDescriptor->HasState(PageDescriptor::ST_Selected)); + pDescriptor->GetPage()->SetSelected(bIsSelected); } } @@ -439,7 +439,8 @@ void SlideSorterModel::SynchronizeModelSelection (void) while (aAllPages.HasMoreElements()) { SharedPageDescriptor pDescriptor (aAllPages.GetNextElement()); - pDescriptor->SetState(PageDescriptor::ST_Selected, pDescriptor->GetPage()->IsSelected()); + const bool bIsSelected (pDescriptor->GetPage()->IsSelected()); + pDescriptor->SetState(PageDescriptor::ST_Selected, bIsSelected); } } @@ -459,11 +460,29 @@ void SlideSorterModel::SetDocumentSlides ( { ::osl::MutexGuard aGuard (maMutex); - // Reset the current page so to cause everbody to release references to it. + // Make the current selection persistent and then release the + // current set of pages. + SynchronizeDocumentSelection(); + mxSlides = NULL; + ClearDescriptorList (); + + // Reset the current page to cause everbody to release references to it. mrSlideSorter.GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange(-1); + // Set the new set of pages. mxSlides = rxSlides; - Resync(); + AdaptSize(); + SynchronizeModelSelection(); + mrSlideSorter.GetController().GetPageSelector().CountSelectedPages(); + + model::PageEnumeration aSelectedPages ( + model::PageEnumerationProvider::CreateSelectedPagesEnumeration(*this)); + if (aSelectedPages.HasMoreElements()) + { + SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement()); + mrSlideSorter.GetController().GetCurrentSlideManager()->NotifyCurrentSlideChange( + pDescriptor->GetPage()); + } ViewShell* pViewShell = mrSlideSorter.GetViewShell(); if (pViewShell != NULL) @@ -667,7 +686,6 @@ void SlideSorterModel::InsertSlide (SdPage* pPage) // Update page indices. UpdateIndices(nIndex+1); - OSL_TRACE("page inserted"); } @@ -705,7 +723,6 @@ void SlideSorterModel::DeleteSlide (const SdPage* pPage) maPageDescriptors.erase(maPageDescriptors.begin()+nIndex); UpdateIndices(nIndex); } - OSL_TRACE("page removed"); } diff --git a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx index f08cb6c..4966c9f 100644 --- a/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx +++ b/sd/source/ui/slidesorter/view/SlsViewCacheContext.cxx @@ -70,7 +70,9 @@ void ViewCacheContext::NotifyPreviewCreation ( } else { - OSL_ASSERT(pDescriptor); + // It is OK when a preview was created for a page that is not + // currently displayed because both normal and master pages are + // kept in the same cache. } } commit c2c3bd1ceed76e34a690bf458a8ad94cd6211fb0 Author: Herbert Dürr <h...@apache.org> Date: Fri Feb 21 10:26:51 2014 +0000 #i123501# fix invalid iterators in graphite diff --git a/graphite/graphite-2.3.1.patch b/graphite/graphite-2.3.1.patch index aca7337..85a8aa3 100644 --- a/graphite/graphite-2.3.1.patch +++ b/graphite/graphite-2.3.1.patch @@ -2427,3 +2427,28 @@ #include "GrAppData.h" namespace gr +--- misc/silgraphite-2.3.1/engine/include/graphite/SegmentAux.h Thu Jan 22 00:36:40 2009 ++++ misc/build/silgraphite-2.3.1/engine/include/graphite/SegmentAux.h Sat Aug 22 19:36:32 2009 +@@ -232,8 +232,12 @@ + protected: + // Constructor that includes output-slot mapping list, used for non-contiguous lists: + GlyphSetIterator(Segment & seg, size_t islout, RcVector * qvislout) +- : m_pseg(&seg), m_vit(qvislout->Vector().begin() + islout) ++ : m_pseg(&seg), m_vit(qvislout->Vector().begin()) + { ++ if( islout < qvislout->Vector().size()) ++ m_vit += islout; ++ else ++ m_vit = qvislout->Vector().end(); + m_qvislout = qvislout; + m_qvislout->IncRefCount(); + } +@@ -289,7 +293,7 @@ + + // Relational operators. + // Forward iterator requirements +- bool operator==(const GlyphSetIterator & rhs) const throw() { return m_vit == rhs.m_vit; } ++ bool operator==(const GlyphSetIterator & rhs) const throw() { return (m_qvislout == NULL) || (m_vit == rhs.m_vit); } + bool operator!=(const GlyphSetIterator & rhs) const throw() { return !(*this == rhs); } + + // Random access iterator requirements
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits