renaissance1: #i107215# Improved selection handling.

This commit is contained in:
Andre Fischer
2010-02-18 15:20:15 +01:00
parent b237fdf1e2
commit f5d2c01dda
6 changed files with 34 additions and 10 deletions

View File

@@ -168,9 +168,7 @@ void FocusManager::MoveFocus (FocusMoveDirection eDirection)
if (mbPageIsFocused) if (mbPageIsFocused)
{ {
#ifndef UNIFY_FOCUS_AND_CURRENT_PAGE
ShowFocusIndicator(GetFocusedPageDescriptor(), true); ShowFocusIndicator(GetFocusedPageDescriptor(), true);
#endif
} }
} }
} }
@@ -295,7 +293,6 @@ void FocusManager::ShowFocusIndicator (
const model::SharedPageDescriptor& rpDescriptor, const model::SharedPageDescriptor& rpDescriptor,
const bool bScrollToFocus) const bool bScrollToFocus)
{ {
#ifndef UNIFY_FOCUS_AND_CURRENT_PAGE
if (rpDescriptor.get() != NULL) if (rpDescriptor.get() != NULL)
{ {
mrSlideSorter.GetView().SetState(rpDescriptor, model::PageDescriptor::ST_Focused, true); mrSlideSorter.GetView().SetState(rpDescriptor, model::PageDescriptor::ST_Focused, true);
@@ -308,10 +305,11 @@ void FocusManager::ShowFocusIndicator (
GetFocusedPageDescriptor()->GetBoundingBox()); GetFocusedPageDescriptor()->GetBoundingBox());
} }
#ifndef UNIFY_FOCUS_AND_CURRENT_PAGE
mrSlideSorter.GetView().RequestRepaint (rpDescriptor); mrSlideSorter.GetView().RequestRepaint (rpDescriptor);
#endif
NotifyFocusChangeListeners(); NotifyFocusChangeListeners();
} }
#endif
} }

View File

@@ -273,6 +273,14 @@ SharedPageDescriptor PageSelector::GetMostRecentlySelectedPage (void) const
void PageSelector::SetMostRecentlySelectedPage (const model::SharedPageDescriptor& rpDescriptor)
{
mpMostRecentlySelectedPage = rpDescriptor;
}
SharedPageDescriptor PageSelector::GetSelectionAnchor (void) const SharedPageDescriptor PageSelector::GetSelectionAnchor (void) const
{ {
return mpSelectionAnchor; return mpSelectionAnchor;
@@ -367,10 +375,16 @@ void PageSelector::UpdateCurrentPage (void)
// here we store and at the end of this scope restore the // here we store and at the end of this scope restore the
// current selection. // current selection.
::boost::shared_ptr<PageSelection> pSelection (GetPageSelection()); ::boost::shared_ptr<PageSelection> pSelection (GetPageSelection());
SharedPageDescriptor pRecentSelection (GetMostRecentlySelectedPage());
mrController.GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor); mrController.GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
// Restore the selection and prevent a recursive call to // Restore the selection and prevent a recursive call to
// UpdateCurrentPage(). // UpdateCurrentPage().
SetPageSelection(pSelection, false); SetPageSelection(pSelection, false);
// Restore the most recently selected page. Important for
// making the right part of the selection visible.
mpMostRecentlySelectedPage = pRecentSelection;
return; return;
} }
} }

View File

@@ -635,6 +635,10 @@ void SelectionFunction::MoveFocus (
rSelector.DeselectAllPages(); rSelector.DeselectAllPages();
mrController.GetPageSelector().SelectPage(pFocusedDescriptor); 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);
} }

View File

@@ -578,7 +578,9 @@ Rectangle SelectionManager::ResolveLargeSelection (
} }
OSL_ASSERT(pRepresentative.get() != NULL); OSL_ASSERT(pRepresentative.get() != NULL);
return pRepresentative->GetBoundingBox(); return mrSlideSorter.GetView().GetLayouter().GetPageObjectBox(
pRepresentative->GetPageIndex(),
true);
} }

View File

@@ -134,6 +134,11 @@ public:
*/ */
model::SharedPageDescriptor GetMostRecentlySelectedPage (void) const; 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 /** Return the anchor for a range selection. This usually is the first
selected page after all pages have been deselected. selected page after all pages have been deselected.
@return @return

View File

@@ -46,6 +46,9 @@
#include <tools/link.hxx> #include <tools/link.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
namespace sd { namespace sd {
@@ -301,7 +304,7 @@ void PreviewRenderer::PaintPage (const SdPage* pPage)
try try
{ {
mpView->CompleteRedraw (mpPreviewDevice.get(), aRegion); mpView->CompleteRedraw(mpPreviewDevice.get(), aRegion);
} }
catch (const ::com::sun::star::uno::Exception&) 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.reset (new DrawView (pDocShell, mpPreviewDevice.get(), NULL));
} }
mpView->SetPreviewRenderer( sal_True ); mpView->SetPreviewRenderer(true);
mpView->SetBordVisible(FALSE); mpView->SetPagePaintingAllowed(false);
mpView->SetPageBorderVisible(TRUE);
mpView->SetPageVisible(FALSE);
} }