summaryrefslogtreecommitdiff
path: root/sd/source/ui/slidesorter
diff options
context:
space:
mode:
authorAndre Fischer <af@openoffice.org>2010-03-11 16:21:09 +0100
committerAndre Fischer <af@openoffice.org>2010-03-11 16:21:09 +0100
commitb21a5ef9255b086a639c0d615f104062f92f4ab9 (patch)
tree075296a3d46856cd448e2a21470badf0e3232e4e /sd/source/ui/slidesorter
parentb11b474c8b478f5672b5b64d86ed76dde019d016 (diff)
renaissance1: #i107215# Fixed drag-and-drop when used with auto-scrolling. Improved hide/show handling.
Diffstat (limited to 'sd/source/ui/slidesorter')
-rw-r--r--sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx50
-rw-r--r--sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx4
-rw-r--r--sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx4
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx235
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx96
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx17
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx13
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx14
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx7
-rw-r--r--sd/source/ui/slidesorter/model/SlideSorterModel.cxx34
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx5
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx110
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx28
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx2
14 files changed, 333 insertions, 286 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
index 21b3f3f5b942..5f98f3dc95f0 100644
--- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
@@ -65,6 +65,14 @@ DragAndDropContext::DragAndDropContext (SlideSorter& rSlideSorter)
+DragAndDropContext::~DragAndDropContext (void)
+{
+ SetTargetSlideSorter (NULL, Point(0,0), InsertionIndicatorHandler::UnknownMode, false);
+}
+
+
+
+
void DragAndDropContext::GetPagesFromBookmarks (
::std::vector<const SdPage*>& rPages,
sal_Int32& rnSelectionCount,
@@ -116,22 +124,6 @@ void DragAndDropContext::GetPagesFromSelection (
-DragAndDropContext::~DragAndDropContext (void)
-{
- if (mpTargetSlideSorter != NULL)
- mpTargetSlideSorter->GetController().GetScrollBarManager().StopAutoScroll();
-
- Process();
-
- if (mpTargetSlideSorter != NULL)
- {
- mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler()->End();
- }
-}
-
-
-
-
void DragAndDropContext::Dispose (void)
{
mnInsertionIndex = -1;
@@ -177,31 +169,6 @@ void DragAndDropContext::UpdatePosition (
-void DragAndDropContext::Process (void)
-{
- if (mpTargetSlideSorter == NULL)
- return;
-
- if (mpTargetSlideSorter->GetProperties()->IsUIReadOnly())
- return;
-
- if (mnInsertionIndex >= 0)
- {
- // Tell the model to move the selected pages behind the one with the
- // index mnInsertionIndex which first has to transformed into an index
- // understandable by the document.
- USHORT nDocumentIndex = (USHORT)mnInsertionIndex-1;
- mpTargetSlideSorter->GetController().GetSelectionManager()->MoveSelectedPages(nDocumentIndex);
-
- ViewShell* pViewShell = mpTargetSlideSorter->GetViewShell();
- if (pViewShell != NULL)
- pViewShell->GetViewFrame()->GetBindings().Invalidate(SID_STATUS_PAGE);
- }
-}
-
-
-
-
void DragAndDropContext::Show (void)
{
}
@@ -224,6 +191,7 @@ void DragAndDropContext::SetTargetSlideSorter (
{
if (mpTargetSlideSorter != NULL)
{
+ mpTargetSlideSorter->GetController().GetScrollBarManager().StopAutoScroll();
mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler()->End();
}
diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx
index 26df6f2c04a1..3f0a4e3547d7 100644
--- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.hxx
@@ -93,10 +93,6 @@ private:
::std::vector<const SdPage*>& rPages,
sal_Int32& rnSelectionCount,
model::PageEnumeration& rSelection) const;
-
- /** Move the substitution display of the currently selected pages.
- */
- void Process (void);
};
diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
index 63179c4dbcf9..1537adec84b5 100644
--- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx
@@ -55,8 +55,8 @@ ScrollBarManager::ScrollBarManager (SlideSorter& rSlideSorter)
mnHorizontalPosition (0),
mnVerticalPosition (0),
maScrollBorder (20,20),
- mnHorizontalScrollFactor (0.1),
- mnVerticalScrollFactor (0.1),
+ mnHorizontalScrollFactor (0.15),
+ mnVerticalScrollFactor (0.25),
mpScrollBarFiller(mrSlideSorter.GetScrollBarFiller()),
maAutoScrollTimer(),
maAutoScrollOffset(0,0),
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
index 02d484e7223e..8880100a918a 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -46,6 +46,7 @@
#include "controller/SlsSelectionManager.hxx"
#include "controller/SlsProperties.hxx"
#include "controller/SlsProperties.hxx"
+#include "controller/SlsSlotManager.hxx"
#include "model/SlideSorterModel.hxx"
#include "model/SlsPageDescriptor.hxx"
#include "model/SlsPageEnumerationProvider.hxx"
@@ -116,6 +117,8 @@ namespace sd { namespace slidesorter { namespace controller {
class SelectionFunction::MouseMultiSelector
{
public:
+ /** Start a rectangle selection at the given position.
+ */
MouseMultiSelector (
SlideSorter& rSlideSorter,
const Point& rMouseModelPosition);
@@ -134,50 +137,23 @@ public:
void SetSelectionMode (const SelectionMode eSelectionMode);
void SetSelectionModeFromModifier (const sal_uInt32 nEventCode);
-protected:
+private:
SlideSorter& mrSlideSorter;
SelectionMode meSelectionMode;
- ::std::set<sal_Int32> maInitialSelection;
+ Point maSecondCorner;
+ Pointer maSavedPointer;
+ sal_Int32 mnAnchorIndex;
+ sal_Int32 mnSecondIndex;
- virtual void UpdateModelPosition (const Point& rMouseModelPosition) = 0;
- virtual void UpdateSelection (void) = 0;
+ virtual void UpdateModelPosition (const Point& rMouseModelPosition);
+ virtual void UpdateSelection (void);
void UpdateSelectionState (
const model::SharedPageDescriptor& rpDescriptor,
const bool bIsInSelection) const;
};
-namespace {
-
- class RangeSelector
- : public SelectionFunction::MouseMultiSelector
- {
- public:
- /** Start a rectangle selection at the given position.
- */
- RangeSelector (
- SlideSorter& rSlideSorter,
- const Point& rMouseModelPosition);
- virtual ~RangeSelector (void);
-
- protected:
- virtual void UpdateModelPosition (const Point& rMouseModelPosition);
-
- /** Select all pages that lie completly in the selection rectangle.
- */
- virtual void UpdateSelection (void);
-
- private:
- Point maAnchor;
- Point maSecondCorner;
- Pointer maSavedPointer;
- sal_Int32 mnAnchorIndex;
- sal_Int32 mnSecondIndex;
-
- Rectangle GetBoundingBox (void) const;
- };
-} // end of anonymous namespace
class SelectionFunction::EventDescriptor
@@ -273,7 +249,10 @@ BOOL SelectionFunction::MouseMove (const MouseEvent& rEvent)
{
Point aMousePosition (rEvent.GetPosPixel());
- UpdatePageUnderMouse(aMousePosition, (rEvent.GetButtons() & MOUSE_LEFT)!=0);
+ mrSlideSorter.GetView().UpdatePageUnderMouse(
+ aMousePosition,
+ (rEvent.GetButtons() & MOUSE_LEFT)!=0,
+ true);
// Detect the mouse leaving the window. When not button is pressed then
// we can call IsLeaveWindow at the event. Otherwise we have to make an
@@ -281,11 +260,7 @@ BOOL SelectionFunction::MouseMove (const MouseEvent& rEvent)
if (rEvent.IsLeaveWindow()
|| ! Rectangle(Point(0,0),mpWindow->GetOutputSizePixel()).IsInside(aMousePosition))
{
- if (mpDragAndDropContext)
- {
- mpDragAndDropContext->Hide();
- mpDragAndDropContext.reset();
- }
+ StopDragAndDrop();
mrSlideSorter.GetView().SetPageUnderMouse(model::SharedPageDescriptor());
}
else
@@ -328,13 +303,7 @@ void SelectionFunction::MouseDragged (
InsertionIndicatorHandler::GetModeFromDndAction(nDragAction));//rEvent.mnAction));
if (rEvent.mbLeaving)
{
- if (mpDragAndDropContext)
- {
- // Disconnect the substitution handler from this selection function.
- mpDragAndDropContext->Hide();
- mpDragAndDropContext->SetTargetSlideSorter();
- mpDragAndDropContext.reset();
- }
+ StopDragAndDrop();
}
else if ( ! mpDragAndDropContext)
{
@@ -345,6 +314,7 @@ void SelectionFunction::MouseDragged (
pDragTransferable != NULL
&& pDragTransferable->GetView()==&mrSlideSorter.GetView());
mpDragAndDropContext->UpdatePosition(rEvent.maPosPixel, eMode);
+ UpdateMouseOverIndicationPermission();
}
// 1. Compute some frequently used values relating to the event.
@@ -373,12 +343,7 @@ void SelectionFunction::MouseDragged (
void SelectionFunction::NotifyDragFinished (void)
{
- if (mpDragAndDropContext)
- {
- mpDragAndDropContext->Dispose();
- mpDragAndDropContext.reset();
- }
- mrController.GetInsertionIndicatorHandler()->End();
+ StopDragAndDrop();
}
@@ -430,15 +395,12 @@ BOOL SelectionFunction::KeyInput (const KeyEvent& rEvent)
if ( ! (mpDragAndDropContext || mpMouseMultiSelector))
rFocusManager.SetFocusToToolBox();
- if (mpDragAndDropContext)
- {
- mpDragAndDropContext->Dispose();
- mpDragAndDropContext.reset();
- }
+ StopDragAndDrop();
if (mpMouseMultiSelector)
{
- mpMouseMultiSelector->RestoreInitialSelection();
- mpMouseMultiSelector.reset();
+ mrSlideSorter.GetView().RequestRepaint(
+ mrSlideSorter.GetModel().RestoreSelection());
+ StopMouseMultiSelection();
}
bResult = TRUE;
break;
@@ -703,6 +665,7 @@ void SelectionFunction::StartDrag (
{
mpDragAndDropContext.reset(new DragAndDropContext(mrSlideSorter));
mrController.GetInsertionIndicatorHandler()->Start(true);
+ UpdateMouseOverIndicationPermission();
}
mpDragAndDropContext->UpdatePosition(rMousePosition, eMode);
mpWindow->ReleaseMouse();
@@ -721,16 +684,14 @@ bool SelectionFunction::cancel (void)
-void SelectionFunction::UpdatePageUnderMouse (
- const Point& rMousePosition,
- const bool bIsMouseButtonDown)
+void SelectionFunction::UpdateMouseOverIndicationPermission (void)
{
+
// In some modes (dragging, moving) the mouse over indicator is only
// annoying. Turn it off in these cases.
- if (mpDragAndDropContext || mpMouseMultiSelector)
- mrSlideSorter.GetView().SetPageUnderMouse(model::SharedPageDescriptor());
- else
- mrSlideSorter.GetView().UpdatePageUnderMouse(rMousePosition, bIsMouseButtonDown);
+ mrSlideSorter.GetView().SetIsMouseOverIndicationAllowed(
+ ! mpDragAndDropContext
+ && ! mpMouseMultiSelector);
}
@@ -1034,7 +995,7 @@ void SelectionFunction::ProcessEventWhileDragActive (EventDescriptor& rDescripto
// The following Process() call may lead to the desctruction
// of rDescriptor.mpHitDescriptor so release our reference to it.
rDescriptor.mpHitDescriptor.reset();
- mpDragAndDropContext.reset();
+ StopDragAndDrop();
}
}
@@ -1056,13 +1017,13 @@ void SelectionFunction::ProcessEventWhileMultiSelectorActive (EventDescriptor& r
}
else if (Match(rDescriptor.mnEventCode, BUTTON_UP | LEFT_BUTTON | SINGLE_CLICK))
{
- mpMouseMultiSelector.reset();
+ StopMouseMultiSelection();
}
// Anything else stops the rectangle selection and the event is
// processed again.
else
{
- mpMouseMultiSelector.reset();
+ StopMouseMultiSelection();
rDescriptor.mnEventCode &= ~MULTI_SELECTOR;
ProcessEvent(rDescriptor);
}
@@ -1130,6 +1091,9 @@ void SelectionFunction::ProcessButtonDownEvent (EventDescriptor& rDescriptor)
case BUTTON_DOWN | RIGHT_BUTTON | SINGLE_CLICK | NOT_OVER_PAGE:
// Fallthrough.
case ANY_MODIFIER(BUTTON_DOWN | LEFT_BUTTON | SINGLE_CLICK | NOT_OVER_PAGE):
+ // Remember the current selection so that when a multi selection
+ // is started, we can restore the previous selection.
+ mrSlideSorter.GetModel().SaveCurrentSelection();
DeselectAllPages();
break;
}
@@ -1194,8 +1158,9 @@ void SelectionFunction::ProcessMouseMotionEvent (const EventDescriptor& rDescrip
case ANY_MODIFIER(MOUSE_MOTION | LEFT_BUTTON | SINGLE_CLICK | NOT_OVER_PAGE):
OSL_ASSERT(!mpMouseMultiSelector);
mpMouseMultiSelector.reset(
- new RangeSelector(mrSlideSorter, rDescriptor.maMouseModelPosition));
+ new MouseMultiSelector(mrSlideSorter, rDescriptor.maMouseModelPosition));
mpMouseMultiSelector->SetSelectionModeFromModifier(rDescriptor.mnEventCode);
+ UpdateMouseOverIndicationPermission();
break;
}
}
@@ -1281,14 +1246,13 @@ void SelectionFunction::ProcessButtonClick (
case 1:
// Toggle exclusion state.
- rSelector.DeselectAllPages();
- rSelector.SelectPage(rpDescriptor);
- if (mrSlideSorter.GetViewShell() != NULL)
- mrSlideSorter.GetViewShell()->GetDispatcher()->Execute(
- rpDescriptor->HasState(model::PageDescriptor::ST_Excluded)
- ? SID_SHOW_SLIDE
- : SID_HIDE_SLIDE,
- SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD);
+ if ( ! rpDescriptor)
+ return;
+ mrSlideSorter.GetController().GetSlotManager()->ChangeSlideExclusionState(
+ (rpDescriptor->HasState(model::PageDescriptor::ST_Selected)
+ ? model::SharedPageDescriptor()
+ : rpDescriptor),
+ ! rpDescriptor->HasState(model::PageDescriptor::ST_Excluded));
break;
case 0:
@@ -1306,6 +1270,34 @@ void SelectionFunction::ProcessButtonClick (
+void SelectionFunction::StopDragAndDrop (void)
+{
+ if (mpDragAndDropContext)
+ {
+ // Disconnect the substitution handler from this selection function.
+ mpDragAndDropContext->Hide();
+ mpDragAndDropContext->SetTargetSlideSorter();
+ mpDragAndDropContext.reset();
+ UpdateMouseOverIndicationPermission();
+ }
+ mrController.GetInsertionIndicatorHandler()->End();
+}
+
+
+
+
+void SelectionFunction::StopMouseMultiSelection (void)
+{
+ if (mpMouseMultiSelector)
+ {
+ mpMouseMultiSelector.reset();
+ UpdateMouseOverIndicationPermission();
+ }
+}
+
+
+
+
//===== EventDescriptor =======================================================
SelectionFunction::EventDescriptor::EventDescriptor (
@@ -1391,20 +1383,13 @@ SelectionFunction::MouseMultiSelector::MouseMultiSelector (
const Point& rMouseModelPosition)
: mrSlideSorter(rSlideSorter),
meSelectionMode(SM_Normal),
- maInitialSelection()
+ maSecondCorner(rMouseModelPosition),
+ maSavedPointer(mrSlideSorter.GetContentWindow()->GetPointer()),
+ mnAnchorIndex(-1),
+ mnSecondIndex(-1)
{
- (void)rMouseModelPosition;
- // Remember the current selection.
- model::PageEnumeration aPages (
- model::PageEnumerationProvider::CreateAllPagesEnumeration(
- mrSlideSorter.GetModel()));
- while (aPages.HasMoreElements())
- {
- model::SharedPageDescriptor pDescriptor (aPages.GetNextElement());
- pDescriptor->SetState(
- model::PageDescriptor::ST_WasSelected,
- pDescriptor->HasState(model::PageDescriptor::ST_Selected));
- }
+ const Pointer aSelectionPointer (POINTER_TEXT);
+ mrSlideSorter.GetContentWindow()->SetPointer(aSelectionPointer);
}
@@ -1412,26 +1397,7 @@ SelectionFunction::MouseMultiSelector::MouseMultiSelector (
SelectionFunction::MouseMultiSelector::~MouseMultiSelector (void)
{
-}
-
-
-
-
-void SelectionFunction::MouseMultiSelector::RestoreInitialSelection (void)
-{
- // Remember the current selection.
- model::PageEnumeration aPages (
- model::PageEnumerationProvider::CreateAllPagesEnumeration(
- mrSlideSorter.GetModel()));
- view::SlideSorterView& rView (mrSlideSorter.GetView());
- while (aPages.HasMoreElements())
- {
- model::SharedPageDescriptor pDescriptor (aPages.GetNextElement());
- pDescriptor->SetState(
- model::PageDescriptor::ST_Selected,
- pDescriptor->HasState(model::PageDescriptor::ST_WasSelected));
- rView.RequestRepaint(pDescriptor);
- }
+ mrSlideSorter.GetContentWindow()->SetPointer(maSavedPointer);
}
@@ -1534,35 +1500,7 @@ void SelectionFunction::MouseMultiSelector::UpdateSelectionState (
-//===== RangeSelector =========================================================
-
-namespace {
-
-RangeSelector::RangeSelector (
- SlideSorter& rSlideSorter,
- const Point& rMouseModelPosition)
- : MouseMultiSelector(rSlideSorter,rMouseModelPosition),
- maAnchor(rMouseModelPosition),
- maSecondCorner(rMouseModelPosition),
- maSavedPointer(mrSlideSorter.GetContentWindow()->GetPointer()),
- mnAnchorIndex(-1)
-{
- const Pointer aSelectionPointer (POINTER_TEXT);
- mrSlideSorter.GetContentWindow()->SetPointer(aSelectionPointer);
-}
-
-
-
-
-RangeSelector::~RangeSelector (void)
-{
- mrSlideSorter.GetContentWindow()->SetPointer(maSavedPointer);
-}
-
-
-
-
-void RangeSelector::UpdateModelPosition (const Point& rMouseModelPosition)
+void SelectionFunction::MouseMultiSelector::UpdateModelPosition (const Point& rMouseModelPosition)
{
maSecondCorner = rMouseModelPosition;
UpdateSelection();
@@ -1571,7 +1509,7 @@ void RangeSelector::UpdateModelPosition (const Point& rMouseModelPosition)
-void RangeSelector::UpdateSelection (void)
+void SelectionFunction::MouseMultiSelector::UpdateSelection (void)
{
view::SlideSorterView::DrawLock aLock (mrSlideSorter);
@@ -1606,17 +1544,4 @@ void RangeSelector::UpdateSelection (void)
-Rectangle RangeSelector::GetBoundingBox (void) const
-{
- return Rectangle(
- ::std::min(maAnchor.X(), maSecondCorner.X()),
- ::std::min(maAnchor.Y(), maSecondCorner.Y()),
- ::std::max(maAnchor.X(), maSecondCorner.X()),
- ::std::max(maAnchor.Y(), maSecondCorner.Y()));
-}
-
-
-} // end of anonymous namespace
-
-
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 8f1d6722cec0..ee0b542eaf25 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -96,6 +96,8 @@
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <vcl/svapp.hxx>
+#include <boost/bind.hpp>
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::presentation;
@@ -109,8 +111,6 @@ namespace {
*/
enum SlideExclusionState {UNDEFINED, EXCLUDED, INCLUDED, MIXED};
-void ChangeSlideExclusionState (SlideSorter& rSlideSorter, SfxRequest& rRequest);
-
/** Return for the given set of slides whether they included are
excluded from the slide show.
*/
@@ -155,8 +155,11 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
break;
case SID_HIDE_SLIDE:
+ ChangeSlideExclusionState(model::SharedPageDescriptor(), true);
+ break;
+
case SID_SHOW_SLIDE:
- ChangeSlideExclusionState(mrSlideSorter, rRequest);
+ ChangeSlideExclusionState(model::SharedPageDescriptor(), false);
break;
case SID_PAGES_PER_ROW:
@@ -241,6 +244,11 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
rRequest.Done();
break;
+ case SID_DUPLICATE_PAGE:
+ DuplicateSelectedSlides(rRequest);
+ rRequest.Done();
+ break;
+
case SID_DELETE_PAGE:
case SID_DELETE_MASTER_PAGE:
case SID_DELETE: // we need SID_CUT to handle the delete key
@@ -1192,6 +1200,34 @@ void SlotManager::InsertSlide (SfxRequest& rRequest)
+void SlotManager::DuplicateSelectedSlides (SfxRequest& rRequest)
+{
+ // Create a list of the pages that are to be duplicated. The process of
+ // duplication alters the selection.
+ ::std::vector<SdPage*> aPagesToDuplicate;
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(mrSlideSorter.GetModel()));
+ while (aSelectedPages.HasMoreElements())
+ {
+ model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
+ if (pDescriptor && pDescriptor->GetPage())
+ aPagesToDuplicate.push_back(pDescriptor->GetPage());
+ }
+
+ for_each (
+ aPagesToDuplicate.begin(),
+ aPagesToDuplicate.end(),
+ ::boost::bind(
+ &ViewShell::CreateOrDuplicatePage,
+ mrSlideSorter.GetViewShell(),
+ ::boost::ref(rRequest),
+ PK_STANDARD,
+ _1));
+}
+
+
+
+
void SlotManager::AssignTransitionEffect (void)
{
model::SlideSorterModel& rModel (mrSlideSorter.GetModel());
@@ -1251,59 +1287,49 @@ IMPL_LINK(SlotManager, UserEventCallback, void*, EMPTYARG)
-//-----------------------------------------------------------------------------
-
-namespace {
-
-void ChangeSlideExclusionState (
- SlideSorter& rSlideSorter,
- SfxRequest& rRequest)
+void SlotManager::ChangeSlideExclusionState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bExcludeSlide)
{
- model::PageEnumeration aSelectedPages (
- model::PageEnumerationProvider::CreateSelectedPagesEnumeration(rSlideSorter.GetModel()));
-
- SlideExclusionState eState (UNDEFINED);
-
- switch (rRequest.GetSlot())
+ if (rpDescriptor)
{
- case SID_HIDE_SLIDE:
- eState = EXCLUDED;
- break;
-
- case SID_SHOW_SLIDE:
- eState = INCLUDED;
- break;
-
- default:
- eState = UNDEFINED;
- break;
+ mrSlideSorter.GetView().SetState(
+ rpDescriptor,
+ model::PageDescriptor::ST_Excluded,
+ bExcludeSlide);
}
-
- if (eState != UNDEFINED)
+ else
{
- // Set status at the selected pages.
- aSelectedPages.Rewind ();
+ model::PageEnumeration aSelectedPages (
+ model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
+ mrSlideSorter.GetModel()));
while (aSelectedPages.HasMoreElements())
{
model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
- rSlideSorter.GetView().SetState(
+ mrSlideSorter.GetView().SetState(
pDescriptor,
model::PageDescriptor::ST_Excluded,
- eState==EXCLUDED);
+ bExcludeSlide);
}
}
- SfxBindings& rBindings = rSlideSorter.GetViewShell()->GetViewFrame()->GetBindings();
+ SfxBindings& rBindings (mrSlideSorter.GetViewShell()->GetViewFrame()->GetBindings());
rBindings.Invalidate(SID_PRESENTATION);
rBindings.Invalidate(SID_REHEARSE_TIMINGS);
rBindings.Invalidate(SID_HIDE_SLIDE);
rBindings.Invalidate(SID_SHOW_SLIDE);
- rSlideSorter.GetModel().GetDocument()->SetChanged();
+ mrSlideSorter.GetModel().GetDocument()->SetChanged();
}
+//-----------------------------------------------------------------------------
+
+namespace {
+
+
+
SlideExclusionState GetSlideExclusionState (model::PageEnumeration& rPageSet)
{
SlideExclusionState eState (UNDEFINED);
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
index 71315adbbb1c..a6995f88bdcd 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
@@ -102,19 +102,13 @@ public:
*/
void NotifyDragFinished (void);
- /** This is the higher level version of the
- SlideSorterView::UpdatePageUnderMouse() method.
- It does not update the page under the mouse when an operation is
- active that (logically) captures the mouse.
+ /** Call when drag-and-drop or multi selection is started or stopped in
+ order to update permission of mouse over indication.
*/
- void UpdatePageUnderMouse (
- const Point& rMousePosition,
- const bool bIsMouseButtonDown);
+ void UpdateMouseOverIndicationPermission (void);
::boost::shared_ptr<DragAndDropContext> GetDragAndDropContext (void) const;
- class MouseMultiSelector;
-
protected:
SlideSorter& mrSlideSorter;
SlideSorterController& mrController;
@@ -144,6 +138,8 @@ private:
bool mbProcessingMouseButtonDown;
::boost::shared_ptr<DragAndDropContext> mpDragAndDropContext;
+
+ class MouseMultiSelector;
::boost::scoped_ptr<MouseMultiSelector> mpMouseMultiSelector;
/** Remember where the left mouse button was pressed.
@@ -231,6 +227,9 @@ private:
const FocusManager::FocusMoveDirection eDirection,
const bool bIsShiftDown,
const bool bIsControlDown);
+
+ void StopDragAndDrop (void);
+ void StopMouseMultiSelection (void);
};
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
index 06e16c604500..e84262c8b677 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
@@ -30,6 +30,7 @@
#ifndef SD_SLIDESORTER_SLOT_MANAGER_HXX
#define SD_SLIDESORTER_SLOT_MANAGER_HXX
+#include "model/SlsSharedPageDescriptor.hxx"
#include <tools/link.hxx>
#include <memory>
#include <queue>
@@ -75,6 +76,16 @@ public:
void ExecuteCommandAsynchronously (::std::auto_ptr<Command> pCommand);
+ /** Exclude or include one slide or all selected slides.
+ @param rpDescriptor
+ When the pointer is empty then apply the new state to all
+ selected pages. Otherwise apply the new state to just the
+ specified state.
+ */
+ void ChangeSlideExclusionState (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bExcludeSlide);
+
private:
/// The controller for which we manage the slot calls.
SlideSorter& mrSlideSorter;
@@ -97,6 +108,8 @@ private:
*/
void InsertSlide (SfxRequest& rRequest);
+ void DuplicateSelectedSlides (SfxRequest& rRequest);
+
void AssignTransitionEffect (void);
DECL_LINK(UserEventCallback, void*);
diff --git a/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx b/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
index e8fed3b423ce..84f0f11b8e2f 100644
--- a/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
+++ b/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
@@ -39,6 +39,7 @@ class SdDrawDocument;
#include "pres.hxx"
#include <com/sun/star/drawing/XDrawPage.hpp>
#include <osl/mutex.hxx>
+#include <vcl/region.hxx>
#include <memory>
#include <vector>
@@ -196,6 +197,19 @@ public:
bool IsReadOnly (void) const;
+ /** The current selection is saved by copying the ST_Selected state into
+ ST_WasSelected for slides.
+ */
+ void SaveCurrentSelection (void);
+
+ /** The current selection is restored from the ST_WasSelected state from
+ the slides.
+ @returns
+ The returned region has to be repainted to reflect the updated
+ selection states.
+ */
+ Region RestoreSelection (void);
+
private:
mutable ::osl::Mutex maMutex;
SlideSorter& mrSlideSorter;
diff --git a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
index 3f327edc471d..a9cad51af652 100644
--- a/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlideSorterView.hxx
@@ -95,6 +95,7 @@ public:
void RequestRepaint (void);
void RequestRepaint (const model::SharedPageDescriptor& rDescriptor);
void RequestRepaint (const Rectangle& rRepaintBox);
+ void RequestRepaint (const Region& rRepaintRegion);
Rectangle GetModelArea (void);
@@ -190,6 +191,11 @@ public:
*/
void AddSdrObject (SdrObject& rObject);
+ /** The page under the mouse is not highlighted in some contexts. Call
+ this method on context changes.
+ */
+ void SetIsMouseOverIndicationAllowed (const bool bIsAllowed);
+ void UpdatePageUnderMouse (bool bAnimate);
void UpdatePageUnderMouse (
const Point& rMousePosition,
const bool bIsMouseButtonDown,
@@ -241,6 +247,7 @@ private:
Orientation meOrientation;
::boost::shared_ptr<controller::Properties> mpProperties;
model::SharedPageDescriptor mpPageUnderMouse;
+ bool mbIsMouseOverIndicationAllowed;
sal_Int32 mnButtonUnderMouse;
::boost::shared_ptr<PageObjectPainter> mpPageObjectPainter;
::boost::shared_ptr<SelectionPainter> mpSelectionPainter;
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index f60b8494edfd..ee5c0dfd45e0 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -515,4 +515,38 @@ bool SlideSorterModel::IsReadOnly (void) const
+
+void SlideSorterModel::SaveCurrentSelection (void)
+{
+ PageEnumeration aPages (PageEnumerationProvider::CreateAllPagesEnumeration(*this));
+ while (aPages.HasMoreElements())
+ {
+ SharedPageDescriptor pDescriptor (aPages.GetNextElement());
+ pDescriptor->SetState(
+ PageDescriptor::ST_WasSelected,
+ pDescriptor->HasState(PageDescriptor::ST_Selected));
+ }
+}
+
+
+
+
+Region SlideSorterModel::RestoreSelection (void)
+{
+ Region aRepaintRegion;
+ PageEnumeration aPages (PageEnumerationProvider::CreateAllPagesEnumeration(*this));
+ while (aPages.HasMoreElements())
+ {
+ SharedPageDescriptor pDescriptor (aPages.GetNextElement());
+ if (pDescriptor->SetState(
+ PageDescriptor::ST_Selected,
+ pDescriptor->HasState(PageDescriptor::ST_WasSelected)))
+ {
+ aRepaintRegion.Union(pDescriptor->GetBoundingBox());
+ }
+ }
+ return aRepaintRegion;
+}
+
+
} } } // end of namespace ::sd::slidesorter::model
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 4ce1420157fd..f9e93f775784 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -578,10 +578,7 @@ bool SlideSorterViewShell::HandleScrollCommand (const CommandEvent& rEvent, ::sd
OSL_ASSERT(mpSlideSorter.get()!=NULL);
if (rEvent.GetCommand() == COMMAND_WHEEL)
{
- ::rtl::Reference<controller::SelectionFunction> pFunction (
- mpSlideSorter->GetController().GetCurrentSelectionFunction());
- if (pFunction.is())
- pFunction->UpdatePageUnderMouse(rEvent.GetMousePosPixel(), false);
+ mpSlideSorter->GetView().UpdatePageUnderMouse(rEvent.GetMousePosPixel(), false);
}
}
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index b5a13811eac3..16da8620fb9b 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -337,6 +337,7 @@ SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
meOrientation(VERTICAL),
mpProperties(rSlideSorter.GetProperties()),
mpPageUnderMouse(),
+ mbIsMouseOverIndicationAllowed(true),
mnButtonUnderMouse(-1),
mpPageObjectPainter(),
mpSelectionPainter()
@@ -636,11 +637,7 @@ void SlideSorterView::DeterminePageObjectVisibilities (void)
maVisiblePageRange = aRange;
// Restore the mouse over state.
- const Window::PointerState aPointerState (pWindow->GetPointerState());
- UpdatePageUnderMouse (
- aPointerState.maPos,
- (aPointerState.mnState & MOUSE_LEFT)!=0,
- false);
+ UpdatePageUnderMouse(false);
}
}
@@ -735,6 +732,18 @@ void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox)
+void SlideSorterView::RequestRepaint (const Region& rRepaintRegion)
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ pWindow->Invalidate(rRepaintRegion);
+ mpLayeredDevice->InvalidateAllLayers(rRepaintRegion);
+ }
+}
+
+
+
Rectangle SlideSorterView::GetModelArea (void)
{
@@ -893,31 +902,66 @@ void SlideSorterView::Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint
+void SlideSorterView::SetIsMouseOverIndicationAllowed (const bool bIsAllowed)
+{
+ mbIsMouseOverIndicationAllowed = bIsAllowed;
+ if ( ! mbIsMouseOverIndicationAllowed)
+ SetPageUnderMouse(model::SharedPageDescriptor());
+ else
+ UpdatePageUnderMouse(false);
+}
+
+
+
+
+void SlideSorterView::UpdatePageUnderMouse (bool bAnimate)
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if (pWindow)
+ {
+ const Window::PointerState aPointerState (pWindow->GetPointerState());
+ UpdatePageUnderMouse (
+ aPointerState.maPos,
+ (aPointerState.mnState & MOUSE_LEFT)!=0,
+ bAnimate);
+ }
+}
+
+
+
+
void SlideSorterView::UpdatePageUnderMouse (
const Point& rMousePosition,
const bool bIsMouseButtonDown,
const bool bAnimate)
{
- // Determine page under mouse and show the mouse over effect.
- model::SharedPageDescriptor pHitDescriptor (
- mrSlideSorter.GetController().GetPageAt(rMousePosition));
- SetPageUnderMouse(pHitDescriptor, bAnimate);
-
- // Handle the mouse being over any buttons.
- if (pHitDescriptor)
+ if ( ! mbIsMouseOverIndicationAllowed)
{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
- const sal_Int32 nButtonIndex (
- GetLayouter().GetPageObjectLayouter()->GetButtonIndexAt (
- pHitDescriptor,
- aMouseModelPosition));
- SetButtonUnderMouse(nButtonIndex);
- if (bIsMouseButtonDown)
+ SetPageUnderMouse(model::SharedPageDescriptor());
+ }
+ else
+ {
+ // Determine page under mouse and show the mouse over effect.
+ model::SharedPageDescriptor pHitDescriptor (
+ mrSlideSorter.GetController().GetPageAt(rMousePosition));
+ SetPageUnderMouse(pHitDescriptor, bAnimate);
+
+ // Handle the mouse being over any buttons.
+ if (pHitDescriptor)
{
- pHitDescriptor->GetVisualState().SetActiveButtonState(
- nButtonIndex,
- model::VisualState::BS_Pressed);
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ const Point aMouseModelPosition (pWindow->PixelToLogic(rMousePosition));
+ const sal_Int32 nButtonIndex (
+ GetLayouter().GetPageObjectLayouter()->GetButtonIndexAt (
+ pHitDescriptor,
+ aMouseModelPosition));
+ SetButtonUnderMouse(nButtonIndex);
+ if (bIsMouseButtonDown)
+ {
+ pHitDescriptor->GetVisualState().SetActiveButtonState(
+ nButtonIndex,
+ model::VisualState::BS_Pressed);
+ }
}
}
}
@@ -998,7 +1042,11 @@ bool SlideSorterView::SetState (
const bool bStateValue,
const bool bAnimate)
{
- const bool bModified (rpDescriptor->SetState(eState, bStateValue));
+ model::SharedPageDescriptor pDescriptor (rpDescriptor);
+ if ( ! pDescriptor)
+ return false;
+
+ const bool bModified (pDescriptor->SetState(eState, bStateValue));
if ( ! bModified)
return false;
@@ -1010,7 +1058,7 @@ bool SlideSorterView::SetState (
case PageDescriptor::ST_MouseOver:
case PageDescriptor::ST_Current:
case PageDescriptor::ST_Excluded:
- RequestRepaint(rpDescriptor);
+ RequestRepaint(pDescriptor);
break;
case PageDescriptor::ST_WasSelected:
@@ -1024,11 +1072,11 @@ bool SlideSorterView::SetState (
const double nEndAlpha (bStateValue ? 0.2 : 1.0);
if (bAnimate)
{
- const double nStartAlpha (rpDescriptor->GetVisualState().GetButtonAlpha());
+ const double nStartAlpha (pDescriptor->GetVisualState().GetButtonAlpha());
// Stop a running animation.
const Animator::AnimationId nId (
- rpDescriptor->GetVisualState().GetButtonAlphaAnimationId());
+ pDescriptor->GetVisualState().GetButtonAlphaAnimationId());
if (nId != Animator::NotAnAnimationId)
mrSlideSorter.GetController().GetAnimator()->RemoveAnimation(nId);
@@ -1038,24 +1086,24 @@ bool SlideSorterView::SetState (
nStartAlpha,
nEndAlpha,
::boost::bind(AnimationFunction::Linear, _1)));
- rpDescriptor->GetVisualState().SetButtonAlphaAnimationId(
+ pDescriptor->GetVisualState().SetButtonAlphaAnimationId(
mrSlideSorter.GetController().GetAnimator()->AddAnimation(
::boost::bind(
AnimationFunction::ApplyButtonAlphaChange,
- rpDescriptor,
+ pDescriptor,
::boost::ref(*this),
::boost::bind(aBlendFunctor, _1)),
bStateValue ? 500 : 0,
400,
::boost::bind(
&VisualState::SetButtonAlphaAnimationId,
- ::boost::ref(rpDescriptor->GetVisualState()),
+ ::boost::ref(pDescriptor->GetVisualState()),
controller::Animator::NotAnAnimationId)
));
}
else
{
- rpDescriptor->GetVisualState().SetButtonAlpha(nEndAlpha);
+ pDescriptor->GetVisualState().SetButtonAlpha(nEndAlpha);
}
}
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
index 05bb9791a200..b625e60865b6 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
@@ -110,7 +110,8 @@ public:
~Layer (void);
void Initialize (const SharedSdWindow& rpTargetWindow);
- void Invalidate (const Rectangle& rInvalidationBox);
+ void InvalidateRectangle (const Rectangle& rInvalidationBox);
+ void InvalidateRegion (const Region& rInvalidationRegion);
void Validate (const MapMode& rMapMode);
void Repaint (
OutputDevice& rTargetDevice,
@@ -177,7 +178,7 @@ void LayeredDevice::Invalidate (
return;
}
- (*mpLayers)[nLayer]->Invalidate(rInvalidationArea);
+ (*mpLayers)[nLayer]->InvalidateRectangle(rInvalidationArea);
}
@@ -186,7 +187,16 @@ void LayeredDevice::Invalidate (
void LayeredDevice::InvalidateAllLayers (const Rectangle& rInvalidationArea)
{
for (sal_uInt32 nLayer=0; nLayer<mpLayers->size(); ++nLayer)
- (*mpLayers)[nLayer]->Invalidate(rInvalidationArea);
+ (*mpLayers)[nLayer]->InvalidateRectangle(rInvalidationArea);
+}
+
+
+
+
+void LayeredDevice::InvalidateAllLayers (const Region& rInvalidationRegion)
+{
+ for (sal_uInt32 nLayer=0; nLayer<mpLayers->size(); ++nLayer)
+ (*mpLayers)[nLayer]->InvalidateRegion(rInvalidationRegion);
}
@@ -343,7 +353,7 @@ void LayeredDevice::HandleMapModeChange (void)
::std::for_each(
mpLayers->begin(),
mpLayers->end(),
- ::boost::bind(&Layer::Invalidate, _1, ::boost::cref(aLogicWindowBox)));
+ ::boost::bind(&Layer::InvalidateRectangle, _1, ::boost::cref(aLogicWindowBox)));
}
else if (maSavedMapMode.GetOrigin() != rMapMode.GetOrigin())
{
@@ -410,7 +420,7 @@ void Layer::Initialize (const SharedSdWindow& rpTargetWindow)
-void Layer::Invalidate (const Rectangle& rInvalidationBox)
+void Layer::InvalidateRectangle (const Rectangle& rInvalidationBox)
{
maInvalidationRegion.Union(rInvalidationBox);
}
@@ -418,6 +428,14 @@ void Layer::Invalidate (const Rectangle& rInvalidationBox)
+void Layer::InvalidateRegion (const Region& rInvalidationRegion)
+{
+ maInvalidationRegion.Union(rInvalidationRegion);
+}
+
+
+
+
void Layer::Validate (const MapMode& rMapMode)
{
if (mpLayerDevice && ! maInvalidationRegion.IsEmpty())
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
index 405da65cb8eb..b428ae7e427c 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
@@ -62,6 +62,8 @@ public:
const sal_Int32 nLayer);
void InvalidateAllLayers (
const Rectangle& rInvalidationBox);
+ void InvalidateAllLayers (
+ const Region& rInvalidationRegion);
void RegisterPainter (
const SharedILayerPainter& rPainter,