summaryrefslogtreecommitdiff
path: root/sd/source/ui/slidesorter/inc/controller
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui/slidesorter/inc/controller')
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx46
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx180
-rwxr-xr-x[-rw-r--r--]sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx61
-rwxr-xr-x[-rw-r--r--]sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx39
-rwxr-xr-x[-rw-r--r--]sd/source/ui/slidesorter/inc/controller/SlsCurrentSlideManager.hxx29
-rwxr-xr-x[-rw-r--r--]sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx18
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx153
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx122
-rwxr-xr-x[-rw-r--r--]sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx16
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx70
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx145
-rwxr-xr-x[-rw-r--r--]sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx88
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx85
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSlideFunction.hxx6
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx25
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx87
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx100
17 files changed, 1022 insertions, 248 deletions
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index be2f09b58f73..4e7628450ca3 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -38,7 +38,6 @@
#include <sfx2/viewfac.hxx>
#include <tools/link.hxx>
#include <tools/gen.hxx>
-#include <memory>
#include <comphelper/implementationreference.hxx>
namespace sd { namespace slidesorter {
@@ -62,12 +61,15 @@ class Animator;
class Clipboard;
class CurrentSlideManager;
class FocusManager;
+class InsertionIndicatorHandler;
class Listener;
class PageSelector;
-class Properties;
class ScrollBarManager;
+class SelectionFunction;
class SelectionManager;
+class SelectionObserver;
class SlotManager;
+class VisibleAreaManager;
class SlideSorterController
{
@@ -86,6 +88,8 @@ public:
virtual ~SlideSorterController (void);
+ void Dispose (void);
+
/** Place and size the scroll bars and the browser window so that the
given rectangle is filled.
@return
@@ -107,7 +111,8 @@ public:
Rectangle Rearrange (bool bForce = false);
/** Return the descriptor of the page that is rendered under the
- given position.
+ given position. This takes the IsOnlyPreviewTriggersMouseOver
+ property into account.
@return
Returns a pointer to a page descriptor instead of a
reference because when no page is found at the position
@@ -126,9 +131,7 @@ public:
::boost::shared_ptr<CurrentSlideManager> GetCurrentSlideManager (void) const;
::boost::shared_ptr<SlotManager> GetSlotManager (void) const;
::boost::shared_ptr<SelectionManager> GetSelectionManager (void) const;
-
- // forward VCLs PrePaint window event to DrawingLayer
- void PrePaint();
+ ::boost::shared_ptr<InsertionIndicatorHandler> GetInsertionIndicatorHandler (void) const;
/** This method forwards the call to the SlideSorterView and executes
pending operations like moving selected pages into the visible area.
@@ -184,6 +187,12 @@ public:
*/
virtual FunctionReference CreateSelectionFunction (SfxRequest& rRequest);
+ /** When the current function of the view shell is the slide sorter
+ selection function then return a reference to it. Otherwise return
+ an empty reference.
+ */
+ ::rtl::Reference<SelectionFunction> GetCurrentSelectionFunction (void);
+
/** Prepare for a change of the edit mode. Depending on the current
edit mode we may save the selection so that it can be restored when
later changing back to the current edit mode.
@@ -220,11 +229,6 @@ public:
*/
bool IsContextMenuOpen (void) const;
- /** Return a collection of properties that are used througout the slide
- sorter.
- */
- ::boost::shared_ptr<Properties> GetProperties (void) const;
-
/** Provide the set of pages to be displayed in the slide sorter. The
GetDocumentSlides() method can be found only in the SlideSorterModel.
*/
@@ -234,18 +238,24 @@ public:
*/
::boost::shared_ptr<Animator> GetAnimator (void) const;
+ VisibleAreaManager& GetVisibleAreaManager (void) const;
+
+ void CheckForMasterPageAssignment (void);
+
private:
SlideSorter& mrSlideSorter;
model::SlideSorterModel& mrModel;
view::SlideSorterView& mrView;
- ::std::auto_ptr<PageSelector> mpPageSelector;
- ::std::auto_ptr<FocusManager> mpFocusManager;
+ ::boost::scoped_ptr<PageSelector> mpPageSelector;
+ ::boost::scoped_ptr<FocusManager> mpFocusManager;
::boost::shared_ptr<SlotManager> mpSlotManager;
- ::std::auto_ptr<controller::Clipboard> mpClipboard;
- ::std::auto_ptr<ScrollBarManager> mpScrollBarManager;
+ ::boost::scoped_ptr<controller::Clipboard> mpClipboard;
+ ::boost::scoped_ptr<ScrollBarManager> mpScrollBarManager;
mutable ::boost::shared_ptr<CurrentSlideManager> mpCurrentSlideManager;
::boost::shared_ptr<SelectionManager> mpSelectionManager;
+ ::boost::shared_ptr<InsertionIndicatorHandler> mpInsertionIndicatorHandler;
::boost::shared_ptr<Animator> mpAnimator;
+ ::boost::scoped_ptr<VisibleAreaManager> mpVisibleAreaManager;
// The listener listens to UNO events and thus is a UNO object.
// For proper life time management and at the same time free access to
@@ -253,6 +263,7 @@ private:
::rtl::Reference<controller::Listener> mpListener;
int mnModelChangeLockCount;
+ bool mbIsForcedRearrangePending;
bool mbPreModelChangeDone;
bool mbPostModelChangePending;
@@ -287,11 +298,6 @@ private:
*/
bool mbIsContextMenuOpen;
- /** Some slide sorter wide properties that are used in different
- classes.
- */
- ::boost::shared_ptr<Properties> mpProperties;
-
/** Delete the given list of normal pages. This method is a helper
function for DeleteSelectedPages().
@param rSelectedNormalPages
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx b/sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx
new file mode 100644
index 000000000000..38d0b2b22749
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsAnimationFunction.hxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_CONTROLLER_ANIMATION_FUNCTION_HXX
+#define SD_SLIDESORTER_CONTROLLER_ANIMATION_FUNCTION_HXX
+
+#include "model/SlsSharedPageDescriptor.hxx"
+#include <basegfx/point/b2dpoint.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/function.hpp>
+#include <tools/gen.hxx>
+#include <vector>
+
+namespace sd { namespace slidesorter { namespace view {
+class SlideSorterView;
+} } }
+
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** A collection of functions that are usefull when creating animations.
+ They are collected here until a better place is found.
+*/
+class AnimationFunction
+ : private ::boost::noncopyable
+{
+public:
+ /** Acceleration function that maps [0,1] to [0,1] linearly, ie it
+ returns the given time value unaltered.
+ */
+ static double Linear (const double nTime);
+
+ /** Acceleration function that maps [0,1] to [0,1]. Speed starts fast
+ and ends slow following the sine function.
+ */
+ static double FastInSlowOut_Sine (const double nTime);
+
+ /** Acceleration function that maps [0,1] to [0,1]. Speed starts fast
+ and ends slow following the square root function.
+ */
+ static double FastInSlowOut_Root (const double nTime);
+
+ /** Acceleration function that maps [0,1] to [0,0]. Speed starts slow,
+ rises, drops and ends slow following the sine function.
+ */
+ static double SlowInSlowOut_0to0_Sine (const double nTime);
+
+ /** Acceleration function that maps [0,1] to [0,0]. Speed starts slow,
+ rises and drops several times and ends slow following multiple
+ cycles of the the sine function.
+ */
+ static double Vibrate_Sine (const double nTime);
+
+ /** Scale point linearly.
+ */
+ static Point ScalePoint (const Point& rPoint, const double nTime);
+
+ /** Blend two points together according to the given weight.
+ */
+ static double Blend (const double nStartValue, const double nEndValue, const double nWeight);
+
+ /** Apply a gradual visual state change. The kind of change, i.e. the
+ previous and the new states are expected to be already set. This
+ method only adjusts the blending of the visual representation from
+ one state to the other.
+ */
+ static void ApplyVisualStateChange (
+ const model::SharedPageDescriptor& rpDescriptor,
+ view::SlideSorterView& rView,
+ const double nTime);
+
+ /** Apply a gradual change of a previously set offset to the location of
+ a page object.
+ */
+ static void ApplyLocationOffsetChange (
+ const model::SharedPageDescriptor& rpDescriptor,
+ view::SlideSorterView& rView,
+ const Point aLocationOffset);
+
+ /** Apply a gradual change the alpha value from the old value to a
+ new value (set prior to this call.)
+ */
+ static void ApplyButtonAlphaChange(
+ const model::SharedPageDescriptor& rpDescriptor,
+ view::SlideSorterView& rView,
+ const double nButtonAlpha,
+ const double nButtonBarAlpha);
+};
+
+
+
+
+class AnimationBezierFunction
+{
+public:
+ /** Create a cubic bezier curve whose start and end points are given
+ implicitly as P0=(0,0) and P3=(1,1).
+ */
+ AnimationBezierFunction (
+ const double nX1,
+ const double nY1,
+ const double nX2,
+ const double nY2);
+
+ /** Create a cubic bezier curve whose start and end points are given
+ implicitly as P0=(0,0) and P3=(1,1). The second control point is
+ implicitly given as P2=(1-nY1,1-nX1).
+ */
+ AnimationBezierFunction (
+ const double nX1,
+ const double nY1);
+
+ ::basegfx::B2DPoint operator() (const double nT);
+
+private:
+ const double mnX1;
+ const double mnY1;
+ const double mnX2;
+ const double mnY2;
+
+ double EvaluateComponent (
+ const double nT,
+ const double nV1,
+ const double nV2);
+};
+
+
+
+
+/** Turn a parametric function into one whose y-Values depend on its
+ x-Values. Note a lot of interpolation takes place. The resulting
+ accuracy should be good enough for the purpose of acceleration
+ function for animations.
+*/
+class AnimationParametricFunction
+{
+public:
+ typedef ::boost::function<basegfx::B2DPoint(double)> ParametricFunction;
+ AnimationParametricFunction (const ParametricFunction& rFunction);
+
+ double operator() (const double nX);
+
+private:
+ /** y-Values of the parametric function given to the constructor
+ evaluated (and interpolated) for evenly spaced x-Values.
+ */
+ ::std::vector<double> maY;
+};
+
+
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx b/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
index 3fa16dee7f65..e06bc6ca6708 100644..100755
--- a/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
@@ -30,6 +30,8 @@
#define SD_SLIDESORTER_CONTROLLER_ANIMATOR_HXX
#include "SlideSorter.hxx"
+#include "view/SlideSorterView.hxx"
+#include <canvas/elapsedtime.hxx>
#include <vcl/timer.hxx>
#include <sal/types.h>
#include <vector>
@@ -47,51 +49,94 @@ class Animator
: private ::boost::noncopyable
{
public:
+ /** In some circumstances we have to avoid animation and jump to the
+ final animation state immediately. Use this enum instead of a bool
+ to be more expressive.
+ */
+ enum AnimationMode { AM_Animated, AM_Immediate };
+
Animator (SlideSorter& rSlideSorter);
~Animator (void);
+ /** When disposed the animator will stop its work immediately and not
+ process any timer events anymore.
+ */
+ void Dispose (void);
+
/** An animation object is called with values between 0 and 1 as single
argument to its operator() method.
*/
- typedef ::boost::function1<void, double> AnimationFunction;
+ typedef ::boost::function1<void, double> AnimationFunctor;
+ typedef ::boost::function0<void> FinishFunctor;
+
+ typedef sal_Int32 AnimationId;
+ static const AnimationId NotAnAnimationId = -1;
/** Schedule a new animation for execution. The () operator of that
animation will be called with increasing values between 0 and 1 for
the specified duration.
@param rAnimation
The animation operation.
+ @param nStartOffset
+ Time in milli seconds before the animation is started.
@param nDuration
The duration in milli seconds.
*/
- void AddAnimation (
- const AnimationFunction& rAnimation,
- const sal_Int32 nDuration);
+ AnimationId AddAnimation (
+ const AnimationFunctor& rAnimation,
+ const sal_Int32 nStartOffset,
+ const sal_Int32 nDuration,
+ const FinishFunctor& rFinishFunctor = FinishFunctor());
+
+ AnimationId AddInfiniteAnimation (
+ const AnimationFunctor& rAnimation,
+ const double nDelta);
+
+ /** Abort and remove an animation. In order to reduce the bookkeeping
+ on the caller side, it is OK to call this method with an animation
+ function that is not currently being animated. Such a call is
+ silently ignored.
+ */
+ void RemoveAnimation (const AnimationId nAnimationId);
+
+ /** A typical use case for this method is the temporary shutdown of the
+ slidesorter when the slide sorter bar is put into a cache due to a
+ change of the edit mode.
+ */
+ void RemoveAllAnimations (void);
private:
SlideSorter& mrSlideSorter;
Timer maTimer;
-
+ bool mbIsDisposed;
class Animation;
typedef ::std::vector<boost::shared_ptr<Animation> > AnimationList;
AnimationList maAnimations;
+ ::canvas::tools::ElapsedTime maElapsedTime;
- class DrawLock;
- ::boost::scoped_ptr<DrawLock> mpDrawLock;
+ ::boost::scoped_ptr<view::SlideSorterView::DrawLock> mpDrawLock;
+
+ AnimationId mnNextAnimationId;
DECL_LINK(TimeoutHandler, Timer*);
/** Execute one step of every active animation.
+ @param nTime
+ Time measured in milli seconds with some arbitrary reference point.
@return
When one or more animation has finished then <TRUE/> is
returned. Call CleanUpAnimationList() in this case.
*/
- bool ServeAnimations (void);
+ bool ProcessAnimations (const double nTime);
/** Remove animations that have expired.
*/
void CleanUpAnimationList (void);
+
+ void RequestNextFrame (const double nFrameStart = 0);
};
+
} } } // end of namespace ::sd::slidesorter::controller
#endif
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx b/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
index a475b7a7166b..fc97dd32829a 100644..100755
--- a/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
@@ -25,11 +25,12 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef SD_SLIDESORTER_CLIPBOARD
#define SD_SLIDESORTER_CLIPBOARD
#include "ViewClipboard.hxx"
-
+#include "controller/SlsSelectionObserver.hxx"
#include <sal/types.h>
#include <tools/solar.h>
#include <svx/svdpage.hxx>
@@ -87,23 +88,25 @@ public:
const AcceptDropEvent& rEvt,
DropTargetHelper& rTargetHelper,
::sd::Window* pTargetWindow = NULL,
- USHORT nPage = SDRPAGE_NOTFOUND,
- USHORT nLayer = SDRPAGE_NOTFOUND );
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND );
sal_Int8 ExecuteDrop (
const ExecuteDropEvent& rEvt,
DropTargetHelper& rTargetHelper,
::sd::Window* pTargetWindow = NULL,
- USHORT nPage = SDRPAGE_NOTFOUND,
- USHORT nLayer = SDRPAGE_NOTFOUND);
+ sal_uInt16 nPage = SDRPAGE_NOTFOUND,
+ sal_uInt16 nLayer = SDRPAGE_NOTFOUND);
+
+ void Abort (void);
protected:
- virtual USHORT DetermineInsertPosition (
+ virtual sal_uInt16 DetermineInsertPosition (
const SdTransferable& rTransferable);
- virtual USHORT InsertSlides (
+ virtual sal_uInt16 InsertSlides (
const SdTransferable& rTransferable,
- USHORT nInsertPosition);
+ sal_uInt16 nInsertPosition);
private:
SlideSorter& mrSlideSorter;
@@ -124,10 +127,19 @@ private:
/** When pages are moved or copied then the selection of the slide
sorter has to be updated. This flag is used to remember whether the
- selection has to be updated or can stay as it is (FALSE).
+ selection has to be updated or can stay as it is (sal_False).
*/
bool mbUpdateSelectionPending;
+ /** Used when a drop is executed to combine all undo actions into one.
+ Typically created in ExecuteDrop() and released in DragFinish().
+ */
+ class UndoContext;
+ ::boost::scoped_ptr<UndoContext> mpUndoContext;
+
+ ::boost::scoped_ptr<SelectionObserver::Context> mpSelectionObserverContext;
+ sal_uLong mnDragFinishedUserEventId;
+
void CreateSlideTransferable (
::Window* pWindow,
bool bDrag);
@@ -207,8 +219,13 @@ private:
const void* pDropEvent ,
DropTargetHelper& rTargetHelper,
::sd::Window* pTargetWindow,
- USHORT nPage,
- USHORT nLayer);
+ sal_uInt16 nPage,
+ sal_uInt16 nLayer);
+
+ /** Asynchronous part of DragFinished. The argument is the sal_Int8
+ nDropAction, disguised as void*.
+ */
+ DECL_LINK(ProcessDragFinished, void*);
};
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsCurrentSlideManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsCurrentSlideManager.hxx
index 6bc502be4768..8bc96827c02e 100644..100755
--- a/sd/source/ui/slidesorter/inc/controller/SlsCurrentSlideManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsCurrentSlideManager.hxx
@@ -30,6 +30,8 @@
#define SD_SLIDESORTER_CURRENT_SLIDE_MANAGER_HXX
#include "model/SlsSharedPageDescriptor.hxx"
+#include <vcl/timer.hxx>
+#include <tools/link.hxx>
#include <com/sun/star/drawing/XDrawPage.hpp>
class SdPage;
@@ -44,6 +46,10 @@ namespace sd { namespace slidesorter { namespace controller {
/** Manage the current slide. This includes setting the according flags at
the PageDescriptor objects and setting the current slide at the main
view shell.
+
+ Switching pages is triggered only after a little delay. This allows
+ fast travelling through a larger set of slides without having to wait
+ for the edit view to update its content after every slide change.
*/
class CurrentSlideManager
{
@@ -58,14 +64,24 @@ public:
/** Call this when the current page of the main view shell has been
switched. Use SwitchCurrentSlide() to initiate such a switch.
*/
- void CurrentSlideHasChanged (const sal_Int32 nSlideIndex);
+ void NotifyCurrentSlideChange (const sal_Int32 nSlideIndex);
+ void NotifyCurrentSlideChange (const SdPage* pPage);
/** Call this method to switch the current page of the main view shell
to the given slide. Use CurrentSlideHasChanged() when the current
slide change has been initiated by someone else.
+ @param nSlideIndex
+ Zero based index in the range [0,number-of-slides).
+ @param bUpdateSelection
+ When <TRUE/> then the page selection is cleared and only the new
+ current slide is selected.
*/
- void SwitchCurrentSlide (const sal_Int32 nSlideIndex);
- void SwitchCurrentSlide (const model::SharedPageDescriptor& rpSlide);
+ void SwitchCurrentSlide (
+ const sal_Int32 nSlideIndex,
+ const bool bUpdateSelection = false);
+ void SwitchCurrentSlide (
+ const model::SharedPageDescriptor& rpSlide,
+ const bool bUpdateSelection = false);
/** Return the page descriptor for the current slide. Note, that when
there is no current slide then the returned pointer is empty.
@@ -84,9 +100,14 @@ private:
SlideSorter& mrSlideSorter;
sal_Int32 mnCurrentSlideIndex;
model::SharedPageDescriptor mpCurrentSlide;
+ /** Timer to control the delay after which to ask
+ XController/ViewShellBase to switch to another slide.
+ */
+ Timer maSwitchPageDelayTimer;
bool IsCurrentSlideIsValid (void);
void SetCurrentSlideAtViewShellBase (const model::SharedPageDescriptor& rpSlide);
+ void SetCurrentSlideAtTabControl (const model::SharedPageDescriptor& rpSlide);
void SetCurrentSlideAtXController (const model::SharedPageDescriptor& rpSlide);
/** When switching from one slide to a new current slide then this
@@ -98,6 +119,8 @@ private:
method connects to the new current slide.
*/
void AcquireCurrentSlide (const sal_Int32 nSlideIndex);
+
+ DECL_LINK(SwitchPageCallback,void*);
};
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
index 9a3df93f5f96..d077e64d5fbb 100644..100755
--- a/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsFocusManager.hxx
@@ -121,16 +121,6 @@ public:
*/
sal_Int32 GetFocusedPageIndex (void) const;
- /** DEPRECATED. (Use equivalent SetFocusedPage(sal_Int32) instead.
-
- Set the focus to the page with the given index. This does not make
- the focus visible.
- @param nPageIndex
- Index of a page as it is accepted by the slide sorter model.
- The index is not checked for validity.
- */
- void FocusPage (sal_Int32 nPageIndex);
-
/** Set the focused page to the one described by the given page
descriptor. The visibility of the focus indicator is not modified.
@param rDescriptor
@@ -146,6 +136,8 @@ public:
*/
void SetFocusedPage (sal_Int32 nPageIndex);
+ void SetFocusedPageToCurrentPage (void);
+
/** Return <TRUE/> when the focus inidcator is currently shown. A
prerequisite is that the window managed by this focus manager has
the input focus as indicated by a <TRUE/> return value of
@@ -204,6 +196,12 @@ private:
::std::vector<Link> maFocusChangeListeners;
+ /** When vertical wrap is active then pressing UP in the top row moves
+ the focus to the bottom row, DOWN in the bottom row moves the focus
+ to the top row.
+ */
+ bool mbIsVerticalWrapActive;
+
/** Reset the focus state of the given descriptor and request a repaint
so that the focus indicator is hidden.
@param pDescriptor
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx b/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx
new file mode 100644
index 000000000000..e257c5729b10
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_INSERTION_INDICATOR_HANDLER_HXX
+#define SD_SLIDESORTER_INSERTION_INDICATOR_HANDLER_HXX
+
+#include "view/SlsInsertAnimator.hxx"
+
+#include "view/SlsLayouter.hxx"
+
+namespace sd { namespace slidesorter { class SlideSorter; } }
+namespace sd { namespace slidesorter { namespace model {
+class PageEnumeration;
+} } }
+namespace sd { namespace slidesorter { namespace view {
+class InsertAnimator;
+class InsertionIndicatorOverlay;
+} } }
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class Transferable;
+
+
+/** Manage the visibility and location of the insertion indicator. Its
+ actual display is controlled by the InsertionIndicatorOverlay.
+*/
+class InsertionIndicatorHandler
+{
+public:
+ InsertionIndicatorHandler (SlideSorter& rSlideSorter);
+ ~InsertionIndicatorHandler (void);
+
+ enum Mode { CopyMode, MoveMode, UnknownMode };
+ static Mode GetModeFromDndAction (const sal_Int8 nDndAction);
+
+ /** Activate the insertion marker at the given coordinates.
+ */
+ void Start (const bool bIsOverSourceView);
+
+ /** Deactivate the insertion marker.
+ */
+ void End (const controller::Animator::AnimationMode eMode);
+
+ /** This context make sure that the insertion indicator is shown
+ (provided that the clipboard is not empty) while the context is
+ alive. Typically used while a context menu is displayed.
+ */
+ class ForceShowContext
+ {
+ public:
+ ForceShowContext (const ::boost::shared_ptr<InsertionIndicatorHandler>& rpHandler);
+ ~ForceShowContext (void);
+ private:
+ const ::boost::shared_ptr<InsertionIndicatorHandler> mpHandler;
+ };
+
+ /** Update the indicator icon from the current transferable (from the
+ clipboard or an active drag and drop operation.)
+ */
+ void UpdateIndicatorIcon (const Transferable* pTransferable);
+
+ /** Set the position of the insertion marker to the given coordinates.
+ */
+ void UpdatePosition (
+ const Point& rMouseModelPosition,
+ const Mode eMode);
+ void UpdatePosition (
+ const Point& rMouseModelPosition,
+ const sal_Int8 nDndAction);
+
+ /** Return whether the insertion marker is active.
+ */
+ bool IsActive (void) const;
+
+ /** Return the insertion index that corresponds with the current
+ graphical location of the insertion indicator.
+ */
+ sal_Int32 GetInsertionPageIndex (void) const;
+
+ /** Determine whether moving the current selection to the current
+ position of the insertion marker would alter the document. This
+ would be the case when the selection is not consecutive or would be
+ moved to a position outside and not adjacent to the selection.
+ */
+ bool IsInsertionTrivial (
+ const sal_Int32 nInsertionIndex,
+ const Mode eMode) const;
+ /** This method is like the other variant. It operates implicitly
+ on the current insertion index as would be returned by
+ GetInsertionPageIndex().
+ */
+ bool IsInsertionTrivial (const sal_Int8 nDndAction);
+
+private:
+ SlideSorter& mrSlideSorter;
+ ::boost::shared_ptr<view::InsertAnimator> mpInsertAnimator;
+ ::boost::shared_ptr<view::InsertionIndicatorOverlay> mpInsertionIndicatorOverlay;
+ view::InsertPosition maInsertPosition;
+ Mode meMode;
+ bool mbIsInsertionTrivial;
+ bool mbIsActive;
+ bool mbIsReadOnly;
+ bool mbIsOverSourceView;
+ Size maIconSize;
+ bool mbIsForcedShow;
+
+ void SetPosition (
+ const Point& rPoint,
+ const Mode eMode);
+ ::boost::shared_ptr<view::InsertAnimator> GetInsertAnimator (void);
+
+ /** Make the insertion indicator visible (that is the show part) and
+ keep it visible, even when the mouse leaves the window (that is the
+ force part). We need this when a context menu is displayed (mouse
+ over the popup menu triggers a mouse leave event) while the
+ insertion indicator remains visible in the background.
+
+ In effect all calls to End() are ignored until ForceEnd() is called.
+ */
+ void ForceShow (void);
+ void ForceEnd (void);
+};
+
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
index 58c44698c7ec..2aa7ee13f873 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
@@ -70,16 +70,29 @@ public:
void SelectAllPages (void);
void DeselectAllPages (void);
+
/** Update the selection state of all page descriptors to be the same as
- that of the pages of the SdDrawDocument they describe and issue
+ that of the corresponding pages of the SdPage objects and issue
redraw requests where necessary.
*/
- void UpdateAllPages (void);
+ void GetCoreSelection (void);
+
+ /** Update the selection state of the SdPage objects to be the same as
+ that of the correspinding page descriptors.
+ */
+ void SetCoreSelection (void);
+ /** Select the specified descriptor. The selection state of the other
+ descriptors is not affected.
+ */
void SelectPage (int nPageIndex);
- /** Select the descriptor that is associated with the given page.
+ /** Select the descriptor that is associated with the given page. The
+ selection state of the other descriptors is not affected.
*/
void SelectPage (const SdPage* pPage);
+ /** Select the specified descriptor. The selection state of the other
+ descriptors is not affected.
+ */
void SelectPage (const model::SharedPageDescriptor& rpDescriptor);
/** Return whether the specified page is selected. This convenience
@@ -90,9 +103,19 @@ public:
bool IsPageSelected (int nPageIndex);
/** Deselect the descriptor that is associated with the given page.
+ @param bUpdateCurrentPage
+ When <TRUE/> then the current page is updated to the first slide
+ of the remaining selection.
*/
- void DeselectPage (int nPageIndex);
- void DeselectPage (const model::SharedPageDescriptor& rpDescriptor);
+ void DeselectPage (
+ int nPageIndex,
+ const bool bUpdateCurrentPage = true);
+ void DeselectPage (
+ const SdPage* pPage,
+ const bool bUpdateCurrentPage = true);
+ void DeselectPage (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bUpdateCurrentPage = true);
/** This convenience method returns the same number of pages that
SlideSorterModel.GetPageCount() returns. It is included here so
@@ -102,35 +125,6 @@ public:
int GetPageCount (void) const;
int GetSelectedPageCount (void) const;
- void PrepareModelChange (void);
- void HandleModelChange (void);
-
- /** Enable the broadcasting of selection change events. This calls the
- SlideSorterController::SelectionHasChanged() method to do the actual
- work. When EnableBroadcasting has been called as many times as
- DisableBroadcasting() was called before and the selection has been
- changed in the mean time, this change will be broadcasted.
- */
- void EnableBroadcasting (bool bMakeSelectionVisible = true);
-
- /** Disable the broadcasting o selectio change events. Subsequent
- changes of the selection will set a flag that triggers the sending
- of events when EnableBroadcasting() is called.
- */
- void DisableBroadcasting (void);
-
- /** Return the descriptor of the most recently selected page. This
- works only when the page has not been de-selected in the mean time.
- This method helps the view when it scrolls the selection into the
- visible area.
- @return
- When the selection is empty or when the most recently selected
- page has been deselected already (but other pages are still
- selected) then NULL is returned, even when a selection did exist
- but has been cleared.
- */
- model::SharedPageDescriptor GetMostRecentlySelectedPage (void) const;
-
/** Return the anchor for a range selection. This usually is the first
selected page after all pages have been deselected.
@return
@@ -157,10 +151,46 @@ public:
the last call to GetPageSelection() it is still valid to call
this method with the selection. When pages have been inserted
or removed the result may be unexpected.
+ @param bUpdateCurrentPage
+ When <TRUE/> (the default value) then after setting the
+ selection update the current page to the first page of the
+ selection.
+ When called from withing UpdateCurrentPage() then this flag is
+ used to prevent a recursion loop.
*/
- void SetPageSelection (const ::boost::shared_ptr<PageSelection>& rSelection);
+ void SetPageSelection (
+ const ::boost::shared_ptr<PageSelection>& rSelection,
+ const bool bUpdateCurrentPage = true);
- void UpdateCurrentPage (const model::SharedPageDescriptor& rCurrentPageDescriptor);
+ /** Call this method after the the model has changed to set the number
+ of selected pages.
+ */
+ void CountSelectedPages (void);
+
+ /** Use the UpdateLock whenever you do a complex selection, i.e. call
+ more than one method in a row. An active lock prevents intermediate
+ changes of the current slide.
+ */
+ class UpdateLock
+ {
+ public:
+ UpdateLock (SlideSorter& rSlideSorter);
+ UpdateLock (PageSelector& rPageSelector);
+ ~UpdateLock (void);
+ void Release (void);
+ private:
+ PageSelector* mpSelector;
+ };
+
+ class BroadcastLock
+ {
+ public:
+ BroadcastLock (SlideSorter& rSlideSorter);
+ BroadcastLock (PageSelector& rPageSelector);
+ ~BroadcastLock (void);
+ private:
+ PageSelector& mrSelector;
+ };
private:
model::SlideSorterModel& mrModel;
@@ -173,8 +203,26 @@ private:
/// Anchor for a range selection.
model::SharedPageDescriptor mpSelectionAnchor;
model::SharedPageDescriptor mpCurrentPage;
+ sal_Int32 mnUpdateLockCount;
+ bool mbIsUpdateCurrentPagePending;
- void CountSelectedPages (void);
+ /** Enable the broadcasting of selection change events. This calls the
+ SlideSorterController::SelectionHasChanged() method to do the actual
+ work. When EnableBroadcasting has been called as many times as
+ DisableBroadcasting() was called before and the selection has been
+ changed in the mean time, this change will be broadcasted.
+ */
+ void EnableBroadcasting (void);
+
+ /** Disable the broadcasting of selection change events. Subsequent
+ changes of the selection will set a flag that triggers the sending
+ of events when EnableBroadcasting() is called.
+ */
+ void DisableBroadcasting (void);
+
+ void UpdateCurrentPage (const bool bUpdateOnlyWhenPending = false);
+
+ void CheckConsistency (void) const;
};
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx b/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx
index 7a6eeac00eba..2e9a183c36d4 100644..100755
--- a/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsProperties.hxx
@@ -41,6 +41,11 @@ public:
Properties (void);
~Properties (void);
+ /** Call this method after receiving a VCLEVENT_APPLICATION_DATACHANGED
+ event.
+ */
+ void HandleDataChangeEvent (void);
+
/** When this method returns <TRUE/> then the current slide is
highlighted in the view. The default value is <FALSE/>.
*/
@@ -109,6 +114,15 @@ public:
bool IsUIReadOnly (void) const;
void SetUIReadOnly (const bool bIsUIReadOnly);
+ /** The mouse over effect (and whether a mouse motion starts a multi
+ selection or a drag-and-drop) can be triggered by just the preview
+ area or the whole page object area.
+ */
+ bool IsOnlyPreviewTriggersMouseOver (void) const;
+ void SetOnlyPreviewTriggersMouseOver (const bool bFlag);
+
+ bool IsHighContrastModeActive (void) const;
+
private:
bool mbIsHighlightCurrentSlide;
bool mbIsShowSelection;
@@ -121,6 +135,8 @@ private:
Color maSelectionColor;
Color maHighlightColor;
bool mbIsUIReadOnly;
+ bool mbIsOnlyPreviewTriggersMouseOver;
+ bool mbIsHighContrastModeActive;
};
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
index 1f9e0552f1fb..2894650da197 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx
@@ -29,10 +29,13 @@
#ifndef SD_SLIDESORTER_SLIDE_SORTER_SCROLL_BAR_MANAGER_HXX
#define SD_SLIDESORTER_SLIDE_SORTER_SCROLL_BAR_MANAGER_HXX
+#include "SlideSorter.hxx"
+
#include <tools/link.hxx>
#include <tools/gen.hxx>
#include <vcl/timer.hxx>
#include <boost/shared_ptr.hpp>
+#include <boost/function.hpp>
class Point;
class Rectangle;
@@ -111,30 +114,34 @@ public:
bool bScrollToCurrentPosition = true);
/** Place the scroll bars inside the given area. When the available
- area is not large enough for the content to display the resulting
- behaviour depends on the mbUseVerticalScrollBar flag. When it is
- set to true then a vertical scroll bar is shown. Otherwise the
- height of the returned area is enlarged so that the content fits
- into it.
+ area is not large enough for the content to display the horizontal
+ and/or vertical scroll bar is enabled.
@param rAvailableArea
The scroll bars will be placed inside this rectangle. It is
expected to be given in pixel relative to its parent.
+ @param bIsHorizontalScrollBarAllowed
+ Only when this flag is <TRUE/> the horizontal scroll may be
+ displayed.
+ @param bIsVerticalScrollBarAllowed
+ Only when this flag is <TRUE/> the horizontal scroll may be
+ displayed.
@return
Returns the space that remains after the scroll bars are
- placed. When the mbUseVerticalScrollBar flag is false then the
- returned rectangle may be larger than the given one.
+ placed.
*/
- Rectangle PlaceScrollBars (const Rectangle& rAvailableArea);
+ Rectangle PlaceScrollBars (
+ const Rectangle& rAvailableArea,
+ const bool bIsHorizontalScrollBarAllowed,
+ const bool bIsVerticalScrollBarAllowed);
- /** Update the vertical scroll bar so that the visible area has the
- given top value.
+ /** Update the vertical and horizontal scroll bars so that the visible
+ area has the given top and left values.
*/
- void SetTop (const sal_Int32 nTop);
+ void SetTopLeft (const Point aNewTopLeft);
- /** Update the horizontal scroll bar so that the visible area has the
- given left value.
- */
- void SetLeft (const sal_Int32 nLeft);
+ sal_Int32 GetTop (void) const;
+
+ sal_Int32 GetLeft (void) const;
/** Return the width of the vertical scroll bar, which--when
shown--should be fixed in contrast to its height.
@@ -155,14 +162,35 @@ public:
/** Call this method to scroll a window while the mouse is in dragging a
selection. If the mouse is near the window border or is outside the
window then scroll the window accordingly.
+ @param rMouseWindowPosition
+ The mouse position for which the scroll amount is calculated.
+ @param rAutoScrollFunctor
+ Every time when the window is scrolled then this functor is executed.
@return
When the window is scrolled then this method returns <TRUE/>.
When the window is not changed then <FALSE/> is returned.
*/
- bool AutoScroll (const Point& rMouseWindowPosition);
+ bool AutoScroll (
+ const Point& rMouseWindowPosition,
+ const ::boost::function<void(void)>& rAutoScrollFunctor);
void StopAutoScroll (void);
+ enum Orientation { Orientation_Horizontal, Orientation_Vertical };
+ enum Unit { Unit_Pixel, Unit_Slide };
+ /** Scroll the slide sorter by setting the thumbs of the scroll bars and
+ by moving the content of the content window.
+ @param eOrientation
+ Defines whether to scroll horizontally or vertically.
+ @param eUnit
+ Defines whether the distance is a pixel value or the number of
+ slides to scroll.
+ */
+ void Scroll(
+ const Orientation eOrientation,
+ const Unit eUnit,
+ const sal_Int32 nDistance);
+
private:
SlideSorter& mrSlideSorter;
@@ -198,11 +226,14 @@ private:
*/
Timer maAutoScrollTimer;
Size maAutoScrollOffset;
+ bool mbIsAutoScrollActive;
/** The content window is the one whose view port is controlled by the
scroll bars.
*/
- ::boost::shared_ptr<sd::Window> mpContentWindow;
+ SharedSdWindow mpContentWindow;
+
+ ::boost::function<void(void)> maAutoScrollFunctor;
void SetWindowOrigin (
double nHorizontalPosition,
@@ -218,7 +249,10 @@ private:
The area that is enclosed by the scroll bars is returned. It
will be filled with the SlideSorterView.
*/
- Rectangle DetermineScrollBarVisibilities (const Rectangle& rAvailableArea);
+ Rectangle DetermineScrollBarVisibilities(
+ const Rectangle& rAvailableArea,
+ const bool bIsHorizontalScrollBarAllowed,
+ const bool bIsVerticalScrollBarAllowed);
/** Typically called by DetermineScrollBarVisibilities() this method
tests a specific configuration of the two scroll bars being visible
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
index 557d4070574c..9e399d7262f8 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionFunction.hxx
@@ -29,9 +29,13 @@
#ifndef SD_SLIDESORTER_SELECTION_FUNCTION_HXX
#define SD_SLIDESORTER_SELECTION_FUNCTION_HXX
-#include "controller/SlsSlideFunction.hxx"
#include "model/SlsSharedPageDescriptor.hxx"
-#include <memory>
+#include "controller/SlsFocusManager.hxx"
+#include "controller/SlsInsertionIndicatorHandler.hxx"
+#include "fupoor.hxx"
+#include <svtools/transfer.hxx>
+#include <boost/noncopyable.hpp>
+#include <boost/scoped_ptr.hpp>
class SdSlideViewShell;
class SdWindow;
@@ -46,9 +50,12 @@ class SlideSorter;
namespace sd { namespace slidesorter { namespace controller {
class SlideSorterController;
+class DragAndDropContext;
+
class SelectionFunction
- : public SlideFunction
+ : public FuPoor,
+ private ::boost::noncopyable
{
public:
TYPEINFO();
@@ -56,14 +63,13 @@ public:
static FunctionReference Create( SlideSorter& rSlideSorter, SfxRequest& rRequest );
// Mouse- & Key-Events
- virtual BOOL KeyInput(const KeyEvent& rKEvt);
- virtual BOOL MouseMove(const MouseEvent& rMEvt);
- virtual BOOL MouseButtonUp(const MouseEvent& rMEvt);
- virtual BOOL MouseButtonDown(const MouseEvent& rMEvt);
- virtual void Paint(const Rectangle&, ::sd::Window* );
+ virtual sal_Bool KeyInput(const KeyEvent& rKEvt);
+ virtual sal_Bool MouseMove(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp(const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown(const MouseEvent& rMEvt);
- virtual void Activate(); // Function aktivieren
- virtual void Deactivate(); // Function deaktivieren
+ virtual void Activate();
+ virtual void Deactivate();
virtual void ScrollStart();
virtual void ScrollEnd();
@@ -86,6 +92,42 @@ public:
*/
virtual bool cancel();
+ void MouseDragged (
+ const AcceptDropEvent& rEvent,
+ const sal_Int8 nDragAction);
+
+ /** Turn of substitution display and insertion indicator.
+ */
+ void NotifyDragFinished (void);
+
+ /** Call when drag-and-drop or multi selection is started or stopped in
+ order to update permission of mouse over indication.
+ */
+ void UpdateMouseOverIndicationPermission (void);
+
+ class EventDescriptor;
+ class ModeHandler;
+ friend class ModeHandler;
+ enum Mode
+ {
+ NormalMode,
+ MultiSelectionMode,
+ DragAndDropMode,
+ ButtonMode
+ };
+ void SwitchToNormalMode (void);
+ void SwitchToDragAndDropMode(const Point aMousePosition);
+ void SwitchToMultiSelectionMode (const Point aMousePosition, const sal_uInt32 nEventCode);
+ bool SwitchToButtonMode (void);
+
+ void ResetShiftKeySelectionAnchor (void);
+ /** Special case handling for when the context menu is hidden. This
+ method will reinitialize the current mouse position to prevent the
+ mouse motion during the time the context menu is displayed from
+ being interpreted as drag-and-drop start.
+ */
+ void ResetMouseAnchor (void);
+
protected:
SlideSorter& mrSlideSorter;
SlideSorterController& mrController;
@@ -97,11 +139,6 @@ protected:
virtual ~SelectionFunction();
private:
- class SubstitutionHandler;
- class EventDescriptor;
-
- /// Set in MouseButtonDown this flag indicates that a page has been hit.
- bool mbPageHit;
/// The rectangle of the mouse drag selection.
Rectangle maDragSelectionRectangle;
@@ -118,20 +155,17 @@ private:
*/
bool mbProcessingMouseButtonDown;
- ::std::auto_ptr<SubstitutionHandler> mpSubstitutionHandler;
-
- DECL_LINK( DragSlideHdl, Timer* );
- void StartDrag (void);
+ bool mbIsDeselectionPending;
- /** Set the selection to exactly the specified page and also set it as
- the current page.
+ /** Remember the slide where the shift key was pressed and started a
+ multiselection via keyboard.
*/
- void SetCurrentPage (const model::SharedPageDescriptor& rpDescriptor);
+ sal_Int32 mnShiftKeySelectionAnchor;
- /** When the view on which this selection function is working is the
- main view then the view is switched to the regular editing view.
+ /** The selection function can be in one of several mutually
+ exclusive modes.
*/
- void SwitchView (const model::SharedPageDescriptor& rpDescriptor);
+ ::boost::shared_ptr<ModeHandler> mpModeHandler;
/** Make the slide nOffset slides away of the current one the new
current slide. When the new index is outside the range of valid
@@ -142,64 +176,33 @@ private:
*/
void GotoNextPage (int nOffset);
+ /** Make the slide with the given index the new current slide.
+ @param nIndex
+ Index of the new current slide. When the new index is outside
+ the range of valid page numbers it is clipped to that range.
+ */
+ void GotoPage (int nIndex);
+
void ProcessMouseEvent (sal_uInt32 nEventType, const MouseEvent& rEvent);
void ProcessKeyEvent (const KeyEvent& rEvent);
// What follows are a couple of helper methods that are used by
// ProcessMouseEvent().
- /// Select the specified page and set the selection anchor.
- void SelectHitPage (const model::SharedPageDescriptor& rpDescriptor);
- /// Deselect the specified page.
- void DeselectHitPage (const model::SharedPageDescriptor& rpDescriptor);
- /// Deselect all pages.
- void DeselectAllPages (void);
-
- /** for a possibly following mouse motion by starting the drag timer
- that after a short time of pressed but un-moved mouse starts a drag
- operation.
- */
- void PrepareMouseMotion (const Point& aMouseModelPosition);
+ void ProcessEvent (EventDescriptor& rEvent);
- /** Select all pages between and including the selection anchor and the
- specified page.
- */
- void RangeSelect (const model::SharedPageDescriptor& rpDescriptor);
+ void MoveFocus (
+ const FocusManager::FocusMoveDirection eDirection,
+ const bool bIsShiftDown,
+ const bool bIsControlDown);
- /** Start a rectangle selection at the given position.
- */
- void StartRectangleSelection (const Point& aMouseModelPosition);
-
- /** Update the rectangle selection so that the given position becomes
- the new second point of the selection rectangle.
- */
- void UpdateRectangleSelection (const Point& aMouseModelPosition);
-
- /** Select all pages that lie completly in the selection rectangle.
- */
- void ProcessRectangleSelection (bool bToggleSelection);
-
- /** Compute a numerical code that describes a mouse event and that can
- be used for fast look up of the appropriate reaction.
- */
- sal_uInt32 EncodeMouseEvent (
- const EventDescriptor& rDescriptor,
- const MouseEvent& rEvent) const;
-
- /** Compute a numerical code that describes a key event and that can
- be used for fast look up of the appropriate reaction.
- */
- sal_uInt32 EncodeKeyEvent (
- const EventDescriptor& rDescriptor,
- const KeyEvent& rEvent) const;
+ void StopDragAndDrop (void);
- void EventPreprocessing (const EventDescriptor& rEvent);
- bool EventProcessing (const EventDescriptor& rEvent);
- void EventPostprocessing (const EventDescriptor& rEvent);
+ void SwitchMode (const ::boost::shared_ptr<ModeHandler>& rpHandler);
};
} } } // end of namespace ::sd::slidesorter::controller
#endif
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ \ No newline at end of file
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
index 344adf3e8775..05bb8ef9a895 100644..100755
--- a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
@@ -30,8 +30,10 @@
#define SD_SLIDESORTER_CONTROLLER_SELECTION_MANAGER_HXX
#include "model/SlsSharedPageDescriptor.hxx"
+#include "controller/SlsAnimator.hxx"
#include <sal/types.h>
#include <tools/gen.hxx>
+#include <basegfx/range/b2irectangle.hxx>
#include <vector>
class Link;
@@ -44,6 +46,7 @@ class SlideSorter;
namespace sd { namespace slidesorter { namespace controller {
class SlideSorterController;
+class SelectionObserver;
/** This class is a part of the controller and handles the selection of
slides.
@@ -63,12 +66,13 @@ public:
/** Delete the currently selected slides. When this method returns the
selection is empty.
+ @param bSelectFollowingPage
+ When <TRUE/> then after deleting the selected pages make the
+ slide after the last selected page the new current page.
+ When <FALSE/> then make the first slide before the selected
+ pages the new current slide.
*/
- void DeleteSelectedPages (void);
-
- /** Move the maked pages to a position directly after the specified page.
- */
- bool MoveSelectedPages (const sal_Int32 nTargetPage);
+ void DeleteSelectedPages (const bool bSelectFollowingPage = true);
/** Call this method after the selection has changed (possible several
calls to the PageSelector) to invalidate the relevant slots and send
@@ -76,42 +80,6 @@ public:
*/
void SelectionHasChanged (const bool bMakeSelectionVisible = true);
- /** Return <TRUE/> when the selection has changed but has not yet been
- moved to the visible area of the slide sorter view.
- */
- bool IsMakeSelectionVisiblePending (void) const;
-
- enum SelectionHint { SH_FIRST, SH_LAST, SH_RECENT };
-
- /** Try to make all currently selected page objects visible, i.e. set
- the origin so that the page objects lie inside the visible area.
- When the selection is empty then the visible area is not modified.
-
- <p>This method, and the ones is calls, look into the Properties
- object of the SlideSorter in order to determine whether the current
- selection is to be displayed centered.</p>
- @param eSelectionHint
- This is an advice on which selected page object to handle with
- the highest priority when the whole selection does not fit into
- the visible area.
- @return
- Returns the vertical translation of the visible area. It is 0
- when no update of the visible area was done.
- */
- Size MakeSelectionVisible (
- const SelectionHint eSelectionHint = SH_RECENT);
-
- /** Modify the origin of the visible area so that the given rectangle
- comes into view. This is done with the smallest change: no
- scrolling takes place when the given rectangle already lies in the
- visible area. Otherwise either the top or the bottom of the given
- rectangle is aligned with the top or the bottom of the visible area.
- @return
- Returns the vertical translation of the visible area. It is 0
- when no update of the visible area was done.
- */
- Size MakeRectangleVisible (const Rectangle& rBox);
-
/** Add a listener that is called when the selection of the slide sorter
changes.
@param rListener
@@ -144,6 +112,8 @@ public:
*/
void SetInsertionPosition (const sal_Int32 nInsertionPosition);
+ ::boost::shared_ptr<SelectionObserver> GetSelectionObserver (void) const;
+
private:
SlideSorter& mrSlideSorter;
SlideSorterController& mrController;
@@ -167,6 +137,17 @@ private:
*/
sal_Int32 mnInsertionPosition;
+ /** Animation id for a scroll animation the will eventually set the top
+ and left of the visible area to maRequestedTopLeft.
+ */
+ Animator::AnimationId mnAnimationId;
+ Point maRequestedTopLeft;
+
+ class PageInsertionListener;
+ ::boost::scoped_ptr<PageInsertionListener> mpPageInsertionListener;
+
+ ::boost::shared_ptr<SelectionObserver> mpSelectionObserver;
+
/** Delete the given list of normal pages. This method is a helper
function for DeleteSelectedPages().
@param rSelectedNormalPages
@@ -180,31 +161,6 @@ private:
A list of master pages. Supplying normal pages is an error.
*/
void DeleteSelectedMasterPages (const ::std::vector<SdPage*>& rSelectedMasterPages);
-
- /** Return <TRUE/> when the given rectangle, that typically is the
- bounding box of all currently selected slides, does not fit entirely
- into the visible area of the slide sorter view.
- */
- bool DoesSelectionExceedVisibleArea (const Rectangle& rSelectionBox) const;
-
- /** When not all currently selected slides fit into the visible area of
- the slide sorter view, and thus DoesSelectionExceedVisibleArea()
- would return <TRUE/>, then it is the task of this method to
- determine which part of the selection to move into the visible area.
- @param rpFirst
- The first selected slide. Must not be an empty pointer.
- @param rpLast
- The last selected slide. Must not be an empty pointer.
- @param eSelectionHint
- This hint tells the method on which slide to concentrate,
- i.e. which slide has to be inside the returned visible area.
- @return
- Returns the new visible area.
- */
- Rectangle ResolveLargeSelection (
- const model::SharedPageDescriptor& rpFirst,
- const model::SharedPageDescriptor& rpLast,
- const SelectionHint eSelectionHint);
};
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx
new file mode 100644
index 000000000000..0fb45b403af1
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_CONTROLLER_SELECTION_OBSERVER_HXX
+#define SD_SLIDESORTER_CONTROLLER_SELECTION_OBSERVER_HXX
+
+#include <tools/gen.hxx>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+class SdDrawDocument;
+class SdrPage;
+
+namespace sd { namespace slidesorter { namespace controller {
+
+/** Observe insertions and deletions of pages between calls to
+ StartObservation() and EndObservation(). When the later is called
+ the selection is set to just the newly inserted pages.
+*/
+class SelectionObserver
+{
+public:
+ SelectionObserver (SlideSorter& rSlideSorter);
+ virtual ~SelectionObserver (void);
+
+ void NotifyPageEvent (const SdrPage* pPage);
+ void StartObservation (void);
+ void AbortObservation (void);
+ void EndObservation (void);
+
+ /** Use this little class instead of calling StartObservation and
+ EndObservation directly so that EndObservation is not forgotten or
+ omitted due to an exception or some break or return in the middle of
+ code.
+ */
+ class Context
+ {
+ public:
+ Context (SlideSorter& rSlideSorter);
+ ~Context(void);
+ void Abort (void);
+ private:
+ ::boost::shared_ptr<SelectionObserver> mpSelectionObserver;
+ };
+
+private:
+ SlideSorter& mrSlideSorter;
+ SdDrawDocument* mpDocument;
+ bool mbIsOvservationActive;
+
+ ::std::vector<const SdPage*> maInsertedPages;
+ ::std::vector<sal_Int32> maDeletedPages;
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSlideFunction.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSlideFunction.hxx
index ca7ee78c957d..774e4c09cc7c 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSlideFunction.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSlideFunction.hxx
@@ -51,9 +51,9 @@ class SlideFunction
public:
TYPEINFO();
- virtual BOOL MouseMove (const MouseEvent& rMEvt);
- virtual BOOL MouseButtonUp (const MouseEvent& rMEvt);
- virtual BOOL MouseButtonDown (const MouseEvent& rMEvt);
+ virtual sal_Bool MouseMove (const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonUp (const MouseEvent& rMEvt);
+ virtual sal_Bool MouseButtonDown (const MouseEvent& rMEvt);
/** Called from ForceScroll() before the actual scrolling.
*/
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
index 083267da5c07..c21df03ad6d4 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSlotManager.hxx
@@ -28,6 +28,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>
@@ -72,6 +73,21 @@ 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);
+
+ /** Call this after a change from normal mode to master mode or back.
+ The affected slots are invalidated.
+ */
+ void NotifyEditModeChange (void);
+
private:
/// The controller for which we manage the slot calls.
SlideSorter& mrSlideSorter;
@@ -88,12 +104,19 @@ private:
*/
void RenameSlide (void);
DECL_LINK(RenameSlideHdl, AbstractSvxNameDialog*);
- bool RenameSlideFromDrawViewShell( USHORT nPageId, const String& rName);
+ bool RenameSlideFromDrawViewShell( sal_uInt16 nPageId, const String& rName);
/** Handle SID_INSERTPAGE slot calls.
*/
void InsertSlide (SfxRequest& rRequest);
+ void DuplicateSelectedSlides (SfxRequest& rRequest);
+
+ /** Use one of several ways to determine where to insert a new page.
+ This can be the current selection or the insertion indicator.
+ */
+ sal_Int32 GetInsertionPosition (void);
+
DECL_LINK(UserEventCallback, void*);
};
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx b/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx
new file mode 100644
index 000000000000..c0a09e73bfe9
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsTransferable.hxx
@@ -0,0 +1,87 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_TRANSFERABLE_HXX
+#define SD_SLIDESORTER_TRANSFERABLE_HXX
+
+#include "sdxfer.hxx"
+
+class SdDrawDocument;
+namespace sd { namespace slidesorter {
+class SlideSorterViewShell;
+} }
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+/** This class exists to have DragFinished call the correct object: the
+ SlideSorterViewShell instead of the old SlideView.
+*/
+class Transferable
+ : public SdTransferable
+{
+public:
+ class Representative
+ {
+ public:
+ Representative (const Bitmap& rBitmap, const bool bIsExcluded)
+ : maBitmap(rBitmap), mbIsExcluded(bIsExcluded) {}
+ Representative (const Representative& rOther)
+ : maBitmap(rOther.maBitmap), mbIsExcluded(rOther.mbIsExcluded) {}
+ Representative operator= (Representative& rOther)
+ { if (&rOther != this) {maBitmap = rOther.maBitmap; mbIsExcluded = rOther.mbIsExcluded; }
+ return *this;
+ }
+
+ Bitmap maBitmap;
+ bool mbIsExcluded;
+ };
+
+
+ Transferable (
+ SdDrawDocument* pSrcDoc,
+ ::sd::View* pWorkView,
+ sal_Bool bInitOnGetData,
+ SlideSorterViewShell* pViewShell,
+ const ::std::vector<Representative>& rRepresentatives);
+
+ virtual ~Transferable (void);
+
+ virtual void DragFinished (sal_Int8 nDropAction);
+
+ const ::std::vector<Representative>& GetRepresentatives (void) const;
+
+private:
+ SlideSorterViewShell* mpViewShell;
+ const ::std::vector<Representative> maRepresentatives;
+
+ virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint);
+};
+
+} } } // end of namespace ::sd::slidesorter::controller
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx
new file mode 100644
index 000000000000..cdaf9b1588ea
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_SLIDESORTER_VISIBLE_AREA_MANAGER_HXX
+#define SD_SLIDESORTER_VISIBLE_AREA_MANAGER_HXX
+
+#include "controller/SlsAnimator.hxx"
+#include "model/SlsSharedPageDescriptor.hxx"
+#include <boost/noncopyable.hpp>
+#include <boost/optional.hpp>
+
+namespace sd { namespace slidesorter { namespace controller {
+
+
+/** Manage requests for scrolling page objects into view.
+*/
+class VisibleAreaManager
+ : public ::boost::noncopyable
+{
+public:
+ VisibleAreaManager (SlideSorter& rSlideSorter);
+ ~VisibleAreaManager (void);
+
+ void ActivateCurrentSlideTracking (void);
+ void DeactivateCurrentSlideTracking (void);
+
+ /** Request the current slide to be moved into the visible area.
+ This request is only obeyed when the current slide tracking is
+ active.
+ @see ActivateCurrentSlideTracking() and DeactivateCurrentSlideTracking()
+ */
+ void RequestCurrentSlideVisible (void);
+
+ /** Request to make the specified page object visible.
+ */
+ void RequestVisible (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const bool bForce = false);
+
+ /** Temporarily disable the update of the visible area.
+ */
+ class TemporaryDisabler
+ {
+ public:
+ TemporaryDisabler (SlideSorter& rSlideSorter);
+ ~TemporaryDisabler (void);
+ private:
+ VisibleAreaManager& mrVisibleAreaManager;
+ };
+
+private:
+ SlideSorter& mrSlideSorter;
+
+ /** List of rectangle that someone wants to be moved into the visible
+ area.
+ Cleared on every call to ForgetVisibleRequests() and MakeVisible().
+ */
+ ::std::vector<Rectangle> maVisibleRequests;
+
+ /** Animation id for a scroll animation that sets the top
+ and left of the visible area to maRequestedVisibleTopLeft.
+ */
+ Animator::AnimationId mnScrollAnimationId;
+ Point maRequestedVisibleTopLeft;
+ Animator::AnimationMode meRequestedAnimationMode;
+ bool mbIsCurrentSlideTrackingActive;
+ int mnDisableCount;
+
+ void MakeVisible (void);
+ ::boost::optional<Point> GetRequestedTopLeft (void) const;
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif