diff options
author | mst <mst@openoffice.org> | 2011-09-17 22:43:38 +0000 |
---|---|---|
committer | Thorsten Behrens <tbehrens@suse.com> | 2011-11-29 17:57:33 +0100 |
commit | 6e26550c8262b416dfd38df082f9fbf340c57516 (patch) | |
tree | 5946765254085879e0a49673531bdd98719ae96f /sd | |
parent | bdfbbb33a491f3ce34375de14ba33436b047e88b (diff) |
slidesorter1: #i116412# Temporarily turning off slide tracking to avoid unwanted repositioning of visible area.
* found as LGPLv3-only fix at svn rev 1172132 (http://svn.apache.org/viewvc?view=revision&revision=1172132)
Diffstat (limited to 'sd')
3 files changed, 46 insertions, 1 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx index 94caa8f6a64d..e07d77da3f97 100644 --- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx +++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx @@ -46,6 +46,7 @@ #include "controller/SlsSelectionManager.hxx" #include "controller/SlsTransferable.hxx" #include "controller/SlsSelectionObserver.hxx" +#include "controller/SlsVisibleAreaManager.hxx" #include "cache/SlsPageCache.hxx" #include "ViewShellBase.hxx" @@ -84,6 +85,37 @@ namespace sd { namespace slidesorter { namespace controller { +namespace { +/** Temporarily deactivate slide tracking of the VisibleAreaManager. + This is used as a workaround to avoid unwanted repositioning of + the visible area when the selection of slides is copied to the + clipboard (cloning of slides leads to model change notifications + for the original model.) +*/ +class TemporarySlideTrackingDeactivator +{ +public: + TemporarySlideTrackingDeactivator (SlideSorterController& rController) + : mrController(rController), + mbIsCurrentSlideTrackingActive ( + mrController.GetVisibleAreaManager().IsCurrentSlideTrackingActive()) + { + if (mbIsCurrentSlideTrackingActive) + mrController.GetVisibleAreaManager().DeactivateCurrentSlideTracking(); + } + ~TemporarySlideTrackingDeactivator (void) + { + if (mbIsCurrentSlideTrackingActive) + mrController.GetVisibleAreaManager().ActivateCurrentSlideTracking(); + } + +private: + SlideSorterController& mrController; + const bool mbIsCurrentSlideTrackingActive; +}; +} // end of anonymous namespace + + class Clipboard::UndoContext { public: @@ -466,7 +498,11 @@ void Clipboard::CreateSlideTransferable ( pTransferable->SetStartPos (pActionWindow->PixelToLogic( pActionWindow->GetPointerPosPixel())); pTransferable->SetObjectDescriptor (aObjDesc); - pTransferable->SetPageBookmarks (aBookmarkList, !bDrag); + + { + TemporarySlideTrackingDeactivator aDeactivator (mrController); + pTransferable->SetPageBookmarks (aBookmarkList, !bDrag); + } for (void* p=aBookmarkList.First(); p!=NULL; p=aBookmarkList.Next()) delete static_cast<String*>(p); diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx index 6f07413502e9..5861232f5a27 100644 --- a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx @@ -94,6 +94,14 @@ void VisibleAreaManager::DeactivateCurrentSlideTracking (void) +bool VisibleAreaManager::IsCurrentSlideTrackingActive (void) const +{ + return mbIsCurrentSlideTrackingActive; +} + + + + void VisibleAreaManager::RequestVisible ( const model::SharedPageDescriptor& rpDescriptor, const bool bForce) diff --git a/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx index 7108574dfdfd..11049fb2203e 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx @@ -48,6 +48,7 @@ public: void ActivateCurrentSlideTracking (void); void DeactivateCurrentSlideTracking (void); + bool IsCurrentSlideTrackingActive (void) const; /** Request the current slide to be moved into the visible area. This request is only obeyed when the current slide tracking is |