From f5d2c01dda56f7544a88e5b85156bae2c71e2a89 Mon Sep 17 00:00:00 2001 From: Andre Fischer Date: Thu, 18 Feb 2010 15:20:15 +0100 Subject: [PATCH] renaissance1: #i107215# Improved selection handling. --- .../ui/slidesorter/controller/SlsFocusManager.cxx | 6 ++---- .../ui/slidesorter/controller/SlsPageSelector.cxx | 14 ++++++++++++++ .../controller/SlsSelectionFunction.cxx | 4 ++++ .../slidesorter/controller/SlsSelectionManager.cxx | 4 +++- .../slidesorter/inc/controller/SlsPageSelector.hxx | 5 +++++ sd/source/ui/tools/PreviewRenderer.cxx | 11 ++++++----- 6 files changed, 34 insertions(+), 10 deletions(-) diff --git a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx index 900658c4bcad..f633060e4dc7 100644 --- a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx @@ -168,9 +168,7 @@ void FocusManager::MoveFocus (FocusMoveDirection eDirection) if (mbPageIsFocused) { -#ifndef UNIFY_FOCUS_AND_CURRENT_PAGE ShowFocusIndicator(GetFocusedPageDescriptor(), true); -#endif } } } @@ -295,7 +293,6 @@ void FocusManager::ShowFocusIndicator ( const model::SharedPageDescriptor& rpDescriptor, const bool bScrollToFocus) { -#ifndef UNIFY_FOCUS_AND_CURRENT_PAGE if (rpDescriptor.get() != NULL) { mrSlideSorter.GetView().SetState(rpDescriptor, model::PageDescriptor::ST_Focused, true); @@ -308,10 +305,11 @@ void FocusManager::ShowFocusIndicator ( GetFocusedPageDescriptor()->GetBoundingBox()); } +#ifndef UNIFY_FOCUS_AND_CURRENT_PAGE mrSlideSorter.GetView().RequestRepaint (rpDescriptor); +#endif NotifyFocusChangeListeners(); } -#endif } diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx index 1a57ff03cc8d..73b5048b1615 100644 --- a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx +++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx @@ -273,6 +273,14 @@ SharedPageDescriptor PageSelector::GetMostRecentlySelectedPage (void) const +void PageSelector::SetMostRecentlySelectedPage (const model::SharedPageDescriptor& rpDescriptor) +{ + mpMostRecentlySelectedPage = rpDescriptor; +} + + + + SharedPageDescriptor PageSelector::GetSelectionAnchor (void) const { return mpSelectionAnchor; @@ -367,10 +375,16 @@ void PageSelector::UpdateCurrentPage (void) // here we store and at the end of this scope restore the // current selection. ::boost::shared_ptr pSelection (GetPageSelection()); + SharedPageDescriptor pRecentSelection (GetMostRecentlySelectedPage()); + mrController.GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor); + // Restore the selection and prevent a recursive call to // UpdateCurrentPage(). SetPageSelection(pSelection, false); + // Restore the most recently selected page. Important for + // making the right part of the selection visible. + mpMostRecentlySelectedPage = pRecentSelection; return; } } diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index 2d6c5a37b234..620c8efca908 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -635,6 +635,10 @@ void SelectionFunction::MoveFocus ( rSelector.DeselectAllPages(); mrController.GetPageSelector().SelectPage(pFocusedDescriptor); } + + // Mark the currently focused page as last selected so that it is made + // visible on the next paint. + mrController.GetPageSelector().SetMostRecentlySelectedPage(pFocusedDescriptor); } diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx index 432d370234f1..3a22668a76e3 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx @@ -578,7 +578,9 @@ Rectangle SelectionManager::ResolveLargeSelection ( } OSL_ASSERT(pRepresentative.get() != NULL); - return pRepresentative->GetBoundingBox(); + return mrSlideSorter.GetView().GetLayouter().GetPageObjectBox( + pRepresentative->GetPageIndex(), + true); } diff --git a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx index e83cf76511a2..d618b1feeb50 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx @@ -134,6 +134,11 @@ public: */ model::SharedPageDescriptor GetMostRecentlySelectedPage (void) const; + /** Mark the given page as the most recently selected. Use this method + when the selection does not really change but the focus does. + */ + void SetMostRecentlySelectedPage (const model::SharedPageDescriptor& rpDescriptor); + /** Return the anchor for a range selection. This usually is the first selected page after all pages have been deselected. @return diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx index 4a166b74e1a1..6b9e41f45371 100644 --- a/sd/source/ui/tools/PreviewRenderer.cxx +++ b/sd/source/ui/tools/PreviewRenderer.cxx @@ -46,6 +46,9 @@ #include #include +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + namespace sd { @@ -301,7 +304,7 @@ void PreviewRenderer::PaintPage (const SdPage* pPage) try { - mpView->CompleteRedraw (mpPreviewDevice.get(), aRegion); + mpView->CompleteRedraw(mpPreviewDevice.get(), aRegion); } catch (const ::com::sun::star::uno::Exception&) { @@ -416,10 +419,8 @@ void PreviewRenderer::ProvideView (DrawDocShell* pDocShell) { mpView.reset (new DrawView (pDocShell, mpPreviewDevice.get(), NULL)); } - mpView->SetPreviewRenderer( sal_True ); - mpView->SetBordVisible(FALSE); - mpView->SetPageBorderVisible(TRUE); - mpView->SetPageVisible(FALSE); + mpView->SetPreviewRenderer(true); + mpView->SetPagePaintingAllowed(false); }