summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorAndre Fischer <af@openoffice.org>2010-04-08 14:47:08 +0200
committerAndre Fischer <af@openoffice.org>2010-04-08 14:47:08 +0200
commit8c6409990af3f38230a465801c7aba39e127e338 (patch)
tree31e18a8a3ffed3682481875132357f7202ff2aa9 /sd
parent93a68953ef974f1a9f0b0aac5ef78a6d3be503c5 (diff)
renaissance1: #i107215# Many fixes around drag-and-drop and selection.
Diffstat (limited to 'sd')
-rw-r--r--sd/source/core/drawdoc3.cxx36
-rw-r--r--sd/source/ui/slidesorter/controller/SlideSorterController.cxx28
-rw-r--r--sd/source/ui/slidesorter/controller/SlsClipboard.cxx141
-rw-r--r--sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx3
-rw-r--r--sd/source/ui/slidesorter/controller/SlsFocusManager.cxx7
-rw-r--r--sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx10
-rw-r--r--sd/source/ui/slidesorter/controller/SlsListener.cxx22
-rw-r--r--sd/source/ui/slidesorter/controller/SlsPageSelector.cxx97
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx15
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx304
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx152
-rw-r--r--sd/source/ui/slidesorter/controller/SlsSlotManager.cxx8
-rw-r--r--sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx254
-rw-r--r--sd/source/ui/slidesorter/controller/makefile.mk4
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx14
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx6
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx7
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx2
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx34
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx62
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx78
-rw-r--r--sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx81
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx23
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlsPageDescriptor.hxx9
-rw-r--r--sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx2
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx9
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsResource.hrc (renamed from sd/source/ui/slidesorter/view/SlsIcons.hrc)2
-rw-r--r--sd/source/ui/slidesorter/inc/view/SlsTheme.hxx23
-rw-r--r--sd/source/ui/slidesorter/model/SlideSorterModel.cxx228
-rw-r--r--sd/source/ui/slidesorter/model/SlsPageDescriptor.cxx17
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx7
-rw-r--r--sd/source/ui/slidesorter/view/SlideSorterView.cxx80
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx40
-rw-r--r--sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx25
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx88
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx2
-rw-r--r--sd/source/ui/slidesorter/view/SlsLayouter.cxx76
-rw-r--r--sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx21
-rw-r--r--sd/source/ui/slidesorter/view/SlsResource.hxx (renamed from sd/source/ui/slidesorter/view/SlsIcons.hxx)6
-rw-r--r--sd/source/ui/slidesorter/view/SlsResource.src (renamed from sd/source/ui/slidesorter/view/SlsIcons.src)12
-rw-r--r--sd/source/ui/slidesorter/view/SlsTheme.cxx47
-rw-r--r--sd/source/ui/slidesorter/view/makefile.mk2
-rw-r--r--sd/source/ui/unoidl/SdUnoSlideView.cxx2
43 files changed, 1365 insertions, 721 deletions
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 103a197d5a1f..025700a790fc 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -57,6 +57,7 @@
#include <sot/formats.hxx>
#include <set>
+#include <boost/bind.hpp>
#include "glob.hrc"
#include "drawdoc.hxx"
@@ -410,6 +411,20 @@ void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc
delete pLayout;
}
+/** Just add one page to the container given to the constructor.
+*/
+class InsertBookmarkAsPage_AddBookmarkedPages
+ : public SdDrawDocument::InsertBookmarkAsPage_PageFunctorBase
+{
+public:
+ InsertBookmarkAsPage_AddBookmarkedPages(::std::vector<SdPage*>& rContainer)
+ : mrContainer(rContainer) {}
+ ~InsertBookmarkAsPage_AddBookmarkedPages(void) {}
+ void operator() (SdDrawDocument&, SdPage* pPage) { mrContainer.push_back(pPage); }
+private:
+ ::std::vector<SdPage*>& mrContainer;
+};
+
BOOL SdDrawDocument::InsertBookmarkAsPage(
List* pBookmarkList,
@@ -668,23 +683,24 @@ BOOL SdDrawDocument::InsertBookmarkAsPage(
USHORT nActualInsertPos = nInsertPos;
+ // Collect the bookmarked pages.
+ ::std::vector<SdPage*> aBookmarkedPages (pBookmarkList->Count(), NULL);
for (USHORT nPos = 0; nPos < pBookmarkList->Count(); nPos++)
{
- /**************************************************************
- * Namen der Bookmark-Seiten aus Liste holen
- **************************************************************/
String aPgName(*(String*) pBookmarkList->GetObject(nPos));
BOOL bIsMasterPage;
USHORT nBMPage = pBookmarkDoc->GetPageByName( aPgName, bIsMasterPage );
if (nBMPage != SDRPAGE_NOTFOUND)
{
- pBMPage = (SdPage*) pBookmarkDoc->GetPage(nBMPage);
- }
- else
- {
- pBMPage = NULL;
+ aBookmarkedPages[nPos] = dynamic_cast<SdPage*>(pBookmarkDoc->GetPage(nBMPage));
}
+ }
+
+ for (USHORT nPos = 0; nPos < pBookmarkList->Count(); nPos++)
+ {
+ pBMPage = aBookmarkedPages[nPos];
+ USHORT nBMPage = pBMPage!=NULL ? pBMPage->GetPageNum() : SDRPAGE_NOTFOUND;
if (pBMPage && pBMPage->GetPageKind()==PK_STANDARD && !pBMPage->IsMasterPage())
{
@@ -696,6 +712,8 @@ BOOL SdDrawDocument::InsertBookmarkAsPage(
// #95991# delay renaming *after* pages are copied (might destroy source otherwise)
// #67905# don't change name if source and dest model are the same!
// #96029# avoid renaming if replacing the same page
+ String aPgName(*(String*) pBookmarkList->GetObject(nPos));
+ BOOL bIsMasterPage;
USHORT nPageSameName = GetPageByName(aPgName, bIsMasterPage);
if( pBookmarkDoc != this &&
nPageSameName != SDRPAGE_NOTFOUND &&
@@ -705,7 +723,7 @@ BOOL SdDrawDocument::InsertBookmarkAsPage(
bMustRename = sal_True;
}
- SdPage* pBookmarkPage = dynamic_cast< SdPage* >( pBookmarkDoc->GetPage(nBMPage) );
+ SdPage* pBookmarkPage = pBMPage;
if (bReplace )
{
ReplacePageInCustomShows( dynamic_cast< SdPage* >( GetPage( nActualInsertPos ) ), pBookmarkPage );
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index d35849819c05..6eae261ec1d2 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -44,6 +44,7 @@
#include "controller/SlsSelectionManager.hxx"
#include "controller/SlsSlotManager.hxx"
#include "controller/SlsTransferable.hxx"
+#include "controller/SlsVisibleAreaManager.hxx"
#include "model/SlideSorterModel.hxx"
#include "model/SlsPageEnumerationProvider.hxx"
#include "model/SlsPageDescriptor.hxx"
@@ -119,6 +120,7 @@ SlideSorterController::SlideSorterController (SlideSorter& rSlideSorter)
mpSelectionManager(),
mpInsertionIndicatorHandler(new InsertionIndicatorHandler(rSlideSorter)),
mpAnimator(new Animator(rSlideSorter)),
+ mpVisibleAreaManager(new VisibleAreaManager(rSlideSorter)),
mpListener(),
mnModelChangeLockCount(0),
mbPreModelChangeDone(false),
@@ -205,7 +207,7 @@ SlideSorterController::~SlideSorterController (void)
void SlideSorterController::Dispose (void)
{
- mpInsertionIndicatorHandler->End();
+ mpInsertionIndicatorHandler->End(Animator::AM_Immediate);
mpSelectionManager.reset();
mpAnimator->Dispose();
}
@@ -345,9 +347,6 @@ void SlideSorterController::Paint (
try
{
- if (GetSelectionManager()->IsMakeSelectionVisiblePending())
- GetSelectionManager()->MakeSelectionVisible();
-
mrView.CompleteRedraw(pWindow, Region(rBBox), 0);
}
catch (const Exception&)
@@ -546,7 +545,6 @@ void SlideSorterController::PreModelChange (void)
mrSlideSorter.GetViewShell()->Broadcast(
ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_START));
- mpPageSelector->PrepareModelChange();
GetCurrentSlideManager()->PrepareModelChange();
if (mrSlideSorter.GetContentWindow())
@@ -579,8 +577,6 @@ void SlideSorterController::PostModelChange (void)
Rearrange();
}
- mpPageSelector->HandleModelChange ();
-
if (mrSlideSorter.GetViewShell() != NULL)
mrSlideSorter.GetViewShell()->Broadcast(
ViewShellHint(ViewShellHint::HINT_COMPLEX_MODEL_CHANGE_END));
@@ -825,8 +821,8 @@ Rectangle SlideSorterController::Rearrange (bool bForce)
// window and the arrangement of the page objects.
GetScrollBarManager().UpdateScrollBars(false, !bForce);
- // When there is a selection then keep it in the visible area.
- GetSelectionManager()->MakeSelectionVisible();
+ // Keep the current slide in the visible area.
+ GetVisibleAreaManager().RequestVisible(GetCurrentSlideManager()->GetCurrentSlide());
}
return aNewContentArea;
@@ -1052,6 +1048,11 @@ void SlideSorterController::SetDocumentSlides (const Reference<container::XIndex
mrModel.SetDocumentSlides(rxSlides);
mrView.Layout();
+
+ // Select just the current slide.
+ PageSelector::BroadcastLock aBroadcastLock (*mpPageSelector);
+ mpPageSelector->DeselectAllPages();
+ mpPageSelector->SelectPage(mpCurrentSlideManager->GetCurrentSlide());
}
}
@@ -1066,6 +1067,15 @@ void SlideSorterController::SetDocumentSlides (const Reference<container::XIndex
+VisibleAreaManager& SlideSorterController::GetVisibleAreaManager (void) const
+{
+ OSL_ASSERT(mpVisibleAreaManager);
+ return *mpVisibleAreaManager;
+}
+
+
+
+
void SlideSorterController::CheckForMasterPageAssignment (void)
{
if (mrModel.GetPageCount()%2==0)
diff --git a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
index 327d6ee24398..32a0a6dafbb6 100644
--- a/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsClipboard.cxx
@@ -35,6 +35,7 @@
#include "model/SlsPageDescriptor.hxx"
#include "model/SlsPageEnumerationProvider.hxx"
#include "view/SlideSorterView.hxx"
+#include "view/SlsTheme.hxx"
#include "controller/SlideSorterController.hxx"
#include "controller/SlsInsertionIndicatorHandler.hxx"
#include "controller/SlsPageSelector.hxx"
@@ -44,6 +45,7 @@
#include "controller/SlsFocusManager.hxx"
#include "controller/SlsSelectionManager.hxx"
#include "controller/SlsTransferable.hxx"
+#include "controller/SlsSelectionObserver.hxx"
#include "cache/SlsPageCache.hxx"
#include "ViewShellBase.hxx"
@@ -74,6 +76,7 @@
#include <sfx2/bindings.hxx>
#include <sfx2/docfile.hxx>
#include <svx/svxids.hrc>
+#include <svx/svdstr.hrc>
#include <vcl/msgbox.hxx>
#include <tools/urlobj.hxx>
#include <rtl/ustring.hxx>
@@ -82,6 +85,43 @@
namespace sd { namespace slidesorter { namespace controller {
+class Clipboard::UndoContext
+{
+public:
+ UndoContext (
+ SdDrawDocument* pDocument,
+ const ::boost::shared_ptr<ViewShell>& rpMainViewShell,
+ const ::boost::shared_ptr<view::Theme>& rpTheme)
+ : mpDocument(pDocument),
+ mpMainViewShell(rpMainViewShell)
+ {
+ if (mpDocument!=NULL && mpDocument->IsUndoEnabled())
+ {
+ if (mpMainViewShell && mpMainViewShell->GetShellType() == ViewShell::ST_DRAW)
+ mpDocument->BegUndo(rpTheme->GetString(view::Theme::String_DragAndDropPages));
+ else
+ mpDocument->BegUndo(rpTheme->GetString(view::Theme::String_DragAndDropSlides));
+ }
+ }
+
+ ~UndoContext (void)
+ {
+ if (mpDocument!=NULL && mpDocument->IsUndoEnabled())
+ mpDocument->EndUndo();
+ if (mpMainViewShell && mpMainViewShell->GetViewFrame()!=NULL)
+ {
+ SfxBindings& rBindings = mpMainViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate(SID_UNDO);
+ rBindings.Invalidate(SID_REDO);
+ }
+ }
+private:
+ SdDrawDocument* mpDocument;
+ ::boost::shared_ptr<ViewShell> mpMainViewShell;
+};
+
+
+
Clipboard::Clipboard (SlideSorter& rSlideSorter)
: ViewClipboard(rSlideSorter.GetView()),
@@ -89,7 +129,8 @@ Clipboard::Clipboard (SlideSorter& rSlideSorter)
mrController(mrSlideSorter.GetController()),
maPagesToRemove(),
maPagesToSelect(),
- mbUpdateSelectionPending(false)
+ mbUpdateSelectionPending(false),
+ mpUndoContext()
{
}
@@ -144,11 +185,11 @@ void Clipboard::HandleSlotCall (SfxRequest& rRequest)
if (mrSlideSorter.GetModel().GetEditMode() != EM_MASTERPAGE)
{
view::SlideSorterView::DrawLock aLock (mrSlideSorter);
+ SelectionObserver::Context aContext (mrSlideSorter);
if(xFunc.is())
xFunc->DoPaste();
else
DoPaste();
- mrController.GetSelectionManager()->MakeSelectionVisible();
}
rRequest.Done();
break;
@@ -263,9 +304,9 @@ sal_Int32 Clipboard::GetInsertionPosition (::Window* pWindow)
sal_Int32 Clipboard::PasteTransferable (sal_Int32 nInsertPosition)
{
SdTransferable* pClipTransferable = SD_MOD()->pTransferClip;
- bool bMergeMasterPages = !pClipTransferable->HasSourceDoc (
- mrSlideSorter.GetModel().GetDocument());
- USHORT nInsertIndex ((USHORT)(nInsertPosition * 2 + 1));
+ model::SlideSorterModel& rModel (mrSlideSorter.GetModel());
+ bool bMergeMasterPages = !pClipTransferable->HasSourceDoc (rModel.GetDocument());
+ USHORT nInsertIndex (rModel.GetCoreIndex(nInsertPosition));
sal_Int32 nInsertPageCount (0);
if (pClipTransferable->HasPageBookmarks())
{
@@ -273,7 +314,7 @@ sal_Int32 Clipboard::PasteTransferable (sal_Int32 nInsertPosition)
const ::vos::OGuard aGuard (Application::GetSolarMutex());
nInsertPageCount = (USHORT) rBookmarkList.Count();
- mrSlideSorter.GetModel().GetDocument()->InsertBookmarkAsPage(
+ rModel.GetDocument()->InsertBookmarkAsPage(
const_cast<List*>(&rBookmarkList),
NULL,
FALSE,
@@ -296,9 +337,9 @@ sal_Int32 Clipboard::PasteTransferable (sal_Int32 nInsertPosition)
{
const ::vos::OGuard aGuard (Application::GetSolarMutex());
- bMergeMasterPages = (pDataDoc != mrSlideSorter.GetModel().GetDocument());
+ bMergeMasterPages = (pDataDoc != rModel.GetDocument());
nInsertPageCount = pDataDoc->GetSdPageCount( PK_STANDARD );
- mrSlideSorter.GetModel().GetDocument()->InsertBookmarkAsPage(
+ rModel.GetDocument()->InsertBookmarkAsPage(
NULL,
NULL,
FALSE,
@@ -496,9 +537,11 @@ void Clipboard::DragFinished (sal_Int8 nDropAction)
}
mrController.GetSelectionManager()->DeleteSelectedPages ();
}
+ mpUndoContext.reset();
+ mrSlideSorter.GetController().GetSelectionManager()->GetSelectionObserver()->EndObservation();
- if (nDropAction != DND_ACTION_NONE)
- SelectPages();
+ // if (nDropAction != DND_ACTION_NONE)
+ // SelectPages();
}
@@ -592,6 +635,7 @@ sal_Int8 Clipboard::ExecuteDrop (
USHORT nLayer)
{
sal_Int8 nResult = DND_ACTION_NONE;
+ mpUndoContext.reset();
switch (IsDropAccepted())
{
@@ -614,38 +658,34 @@ sal_Int8 Clipboard::ExecuteDrop (
rEvent.mnAction);
USHORT nIndex = DetermineInsertPosition(*pDragTransferable);
+ // Tell the insertion indicator handler to hide before the model
+ // is modified. Doing it later may result in page objects whose
+ // animation state is not properly reset because they are then
+ // in another run then before the model change.
+ mrController.GetInsertionIndicatorHandler()->End(Animator::AM_Immediate);
+
if (bContinue)
{
SlideSorterController::ModelChangeLock aModelChangeLock (mrController);
- if (pDragTransferable->GetView() == &mrSlideSorter.GetView()
- && rEvent.mnAction == DND_ACTION_MOVE)
- {
- // We are asked to move pages inside one view. For this we
- // call MoveSelectedPages() which is faster than going the
- // generic way.
-
- // Remember to select the moved pages afterwards.
- maPagesToRemove.swap(maPagesToSelect);
- maPagesToRemove.clear();
-
- USHORT nSdrModelIndex;
- if (nIndex != SDRPAGE_NOTFOUND)
- nSdrModelIndex = nIndex / 2 - 1;
- else
- nSdrModelIndex = SDRPAGE_NOTFOUND;
- mrController.GetSelectionManager()->MoveSelectedPages(nSdrModelIndex);
- mbUpdateSelectionPending = true;
- nResult = DND_ACTION_NONE;
- }
- else
- {
- // Handle a general drop operation.
- HandlePageDrop(*pDragTransferable);
- nResult = rEvent.mnAction;
- }
+ // Handle a general drop operation.
+ mpUndoContext.reset(new UndoContext (
+ mrSlideSorter.GetModel().GetDocument(),
+ mrSlideSorter.GetViewShell()->GetViewShellBase().GetMainViewShell(),
+ mrSlideSorter.GetTheme()));
+ mrSlideSorter.GetController().GetSelectionManager()
+ ->GetSelectionObserver()->StartObservation();
+
+ HandlePageDrop(*pDragTransferable);
+ nResult = rEvent.mnAction;
+
+ // When moving or copying inside one view then leave the
+ // undo context active a little longer until
+ // NotifyDragFinished is called and possibly some slides are
+ // deleted. Otherwise all actions in the target view are
+ // complete and
+ // ( pDragTransferable->GetView() != &mrSlideSorter.GetView() )
}
- mrController.GetInsertionIndicatorHandler()->End();
// Notify the receiving selection function that drag-and-drop is
// finished and the substitution handler can be released.
@@ -686,12 +726,11 @@ USHORT Clipboard::DetermineInsertPosition (const SdTransferable& )
sal_Int32 nInsertionIndex (
mrController.GetInsertionIndicatorHandler()->GetInsertionPageIndex());
- // The index returned by the overlay starts with 1 for the first slide.
- // This is now converted that to an SdModel index that also starts with 1.
+ // Convert to insertion index to that of an SdModel.
if (nInsertionIndex >= 0)
- nInsertPosition = (USHORT)nInsertionIndex * 2 + 1;
-
- return nInsertPosition;
+ return mrSlideSorter.GetModel().GetCoreIndex(nInsertionIndex);
+ else
+ return 0;
}
@@ -707,14 +746,12 @@ USHORT Clipboard::InsertSlides (
// Remember the inserted pages so that they can be selected when the
// operation is finished.
- int nDocumentIndex = nInsertPosition / 2 - 1;
- for (USHORT i=1; i<=nInsertedPageCount; i++)
- {
- model::SharedPageDescriptor pDescriptor (
- mrSlideSorter.GetModel().GetPageDescriptor(nDocumentIndex + i));
- if (pDescriptor.get() != NULL)
- maPagesToSelect.push_back (pDescriptor->GetPage());
- }
+ maPagesToSelect.clear();
+ SdDrawDocument* pDocument = mrSlideSorter.GetModel().GetDocument();
+ if (pDocument != NULL)
+ for (sal_Int32 i=0; i<=nInsertedPageCount; i+=2)
+ maPagesToSelect.push_back(
+ dynamic_cast<SdPage*>(pDocument->GetPage(nInsertPosition+i)));
mbUpdateSelectionPending |= (nInsertedPageCount>0);
@@ -780,8 +817,8 @@ sal_Int8 Clipboard::ExecuteOrAcceptShapeDrop (
model::SharedPageDescriptor pDescriptor (
mrSlideSorter.GetModel().GetPageDescriptor(
mrSlideSorter.GetView().GetPageIndexAtPoint(rPosition)));
- if (pDescriptor.get() != NULL && pDescriptor->GetPage()!=NULL)
- nPage = (pDescriptor->GetPage()->GetPageNum() - 1) / 2;
+ if (pDescriptor)
+ nPage = pDescriptor->GetPageIndex();
}
// Now comes the code that is different for the Execute and Accept:
diff --git a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
index 4c8bd0158461..97d2a5e08881 100644
--- a/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsDragAndDropContext.cxx
@@ -192,7 +192,8 @@ void DragAndDropContext::SetTargetSlideSorter (
if (mpTargetSlideSorter != NULL)
{
mpTargetSlideSorter->GetController().GetScrollBarManager().StopAutoScroll();
- mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler()->End();
+ mpTargetSlideSorter->GetController().GetInsertionIndicatorHandler()->End(
+ Animator::AM_Animated);
}
mpTargetSlideSorter = pSlideSorter;
diff --git a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
index e923edff47ec..8f3d5d05008a 100644
--- a/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
@@ -31,8 +31,8 @@
#include "SlideSorter.hxx"
#include "PaneDockingWindow.hxx"
#include "controller/SlideSorterController.hxx"
-#include "controller/SlsSelectionManager.hxx"
#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsVisibleAreaManager.hxx"
#include "model/SlideSorterModel.hxx"
#include "model/SlsPageDescriptor.hxx"
#include "view/SlideSorterView.hxx"
@@ -298,11 +298,8 @@ void FocusManager::ShowFocusIndicator (
{
// Scroll the focused page object into the visible area and repaint
// it, so that the focus indicator becomes visible.
- mrSlideSorter.GetController().GetSelectionManager()->MakeRectangleVisible (
- mrSlideSorter.GetView().GetLayouter().GetPageObjectBox(
- rpDescriptor->GetPageIndex(), true));
+ mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(rpDescriptor);
}
-
mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
NotifyFocusChangeListeners();
diff --git a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
index 68f4f1d6b0e3..d7e3f52a9b18 100644
--- a/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsInsertionIndicatorHandler.cxx
@@ -88,15 +88,15 @@ void InsertionIndicatorHandler::Start (const bool bIsOverSourceView)
-void InsertionIndicatorHandler::End (void)
+void InsertionIndicatorHandler::End (const controller::Animator::AnimationMode eMode)
{
if (mbIsForcedShow || ! mbIsActive || mbIsReadOnly)
return;
- GetInsertAnimator()->Reset();
+ GetInsertAnimator()->Reset(eMode);
mbIsActive = false;
- maInsertPosition = view::InsertPosition();
+ // maInsertPosition = view::InsertPosition();
meMode = UnknownMode;
mpInsertionIndicatorOverlay->Hide();
@@ -116,7 +116,7 @@ void InsertionIndicatorHandler::ForceShow (void)
void InsertionIndicatorHandler::ForceEnd (void)
{
mbIsForcedShow = false;
- End();
+ End(Animator::AM_Immediate);
}
@@ -219,7 +219,7 @@ void InsertionIndicatorHandler::SetPosition (
}
else
{
- GetInsertAnimator()->Reset();
+ GetInsertAnimator()->Reset(Animator::AM_Animated);
mpInsertionIndicatorOverlay->Hide();
}
}
diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx
index 3e303cde4f47..93bdb9aa43ce 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -35,6 +35,8 @@
#include "controller/SlideSorterController.hxx"
#include "controller/SlsPageSelector.hxx"
#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsSelectionObserver.hxx"
#include "model/SlideSorterModel.hxx"
#include "model/SlsPageEnumerationProvider.hxx"
#include "view/SlideSorterView.hxx"
@@ -315,13 +317,23 @@ void Listener::Notify (
switch (rSdrHint.GetKind())
{
case HINT_PAGEORDERCHG:
- if (rBroadcaster.ISA(SdDrawDocument))
+ if (&rBroadcaster == mrSlideSorter.GetModel().GetDocument())
{
- SdDrawDocument& rDocument (static_cast<SdDrawDocument&>(rBroadcaster));
- if (rDocument.GetMasterSdPageCount(PK_STANDARD)
- == rDocument.GetMasterSdPageCount(PK_NOTES))
+ // Notify model and selection observer about the page.
+ // The return value of the model call acts as filter as
+ // to which events to pass to the selection observer.
+ if (mrSlideSorter.GetModel().NotifyPageEvent(rSdrHint.GetPage()))
+ mrController.GetSelectionManager()
+ ->GetSelectionObserver()->NotifyPageEvent(rSdrHint.GetPage());
+
+ if (rBroadcaster.ISA(SdDrawDocument))
{
- mrController.HandleModelChange();
+ SdDrawDocument& rDocument (static_cast<SdDrawDocument&>(rBroadcaster));
+ if (rDocument.GetMasterSdPageCount(PK_STANDARD)
+ == rDocument.GetMasterSdPageCount(PK_NOTES))
+ {
+ mrController.HandleModelChange();
+ }
}
}
break;
diff --git a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
index 2509c3d02fa8..ec76256b5e97 100644
--- a/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsPageSelector.cxx
@@ -35,6 +35,7 @@
#include "controller/SlsSelectionManager.hxx"
#include "controller/SlsAnimator.hxx"
#include "controller/SlsCurrentSlideManager.hxx"
+#include "controller/SlsVisibleAreaManager.hxx"
#include "model/SlsPageDescriptor.hxx"
#include "model/SlsPageEnumerationProvider.hxx"
#include "model/SlideSorterModel.hxx"
@@ -54,6 +55,23 @@ using namespace ::com::sun::star::uno;
using namespace ::sd::slidesorter::model;
using namespace ::sd::slidesorter::view;
+namespace
+{
+class BoolContext
+{
+public:
+ BoolContext (bool& rValue, bool bContextValue) : mrValue(rValue),mbSavedValue(mrValue)
+ { mrValue = bContextValue; }
+ ~BoolContext (void)
+ { mrValue = mbSavedValue; }
+private:
+ bool& mrValue;
+ const bool mbSavedValue;
+};
+
+} // end of anonymous namespace
+
+
namespace sd { namespace slidesorter { namespace controller {
@@ -68,7 +86,8 @@ PageSelector::PageSelector (SlideSorter& rSlideSorter)
mpSelectionAnchor(),
mpCurrentPage(),
mnUpdateLockCount(0),
- mbIsUpdateCurrentPagePending(false)
+ mbIsUpdateCurrentPagePending(false),
+ mbIsMakeVisibleDisabled(false)
{
CountSelectedPages ();
}
@@ -79,10 +98,11 @@ PageSelector::PageSelector (SlideSorter& rSlideSorter)
void PageSelector::SelectAllPages (void)
{
PageSelector::UpdateLock aLock (*this);
+ BoolContext aContext (mbIsMakeVisibleDisabled, true);
int nPageCount = mrModel.GetPageCount();
for (int nPageIndex=0; nPageIndex<nPageCount; nPageIndex++)
- SelectPage (nPageIndex);
+ SelectPage(nPageIndex);
}
@@ -91,14 +111,15 @@ void PageSelector::SelectAllPages (void)
void PageSelector::DeselectAllPages (void)
{
PageSelector::UpdateLock aLock (*this);
+ BoolContext aContext (mbIsMakeVisibleDisabled, true);
int nPageCount = mrModel.GetPageCount();
for (int nPageIndex=0; nPageIndex<nPageCount; nPageIndex++)
- DeselectPage (nPageIndex);
+ DeselectPage(nPageIndex);
+
DBG_ASSERT (mnSelectedPageCount==0,
"PageSelector::DeselectAllPages: the selected pages counter is not 0");
mnSelectedPageCount = 0;
- mpMostRecentlySelectedPage.reset();
mpSelectionAnchor.reset();
}
@@ -118,6 +139,7 @@ void PageSelector::GetCoreSelection (void)
model::SharedPageDescriptor pDescriptor (aAllPages.GetNextElement());
if (pDescriptor->GetCoreSelection())
{
+ mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(pDescriptor);
mrSlideSorter.GetView().RequestRepaint(pDescriptor);
bSelectionHasChanged = true;
}
@@ -164,7 +186,7 @@ void PageSelector::SelectPage (int nPageIndex)
void PageSelector::SelectPage (const SdPage* pPage)
{
- int nPageIndex = (pPage->GetPageNum()-1) / 2;
+ const sal_Int32 nPageIndex (mrModel.GetIndex(pPage));
SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
if (pDescriptor.get()!=NULL && pDescriptor->GetPage()==pPage)
SelectPage(pDescriptor);
@@ -179,6 +201,8 @@ void PageSelector::SelectPage (const SharedPageDescriptor& rpDescriptor)
&& mrSlideSorter.GetView().SetState(rpDescriptor, PageDescriptor::ST_Selected, true))
{
mnSelectedPageCount ++;
+ if ( ! mbIsMakeVisibleDisabled)
+ mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(rpDescriptor);
mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
mpMostRecentlySelectedPage = rpDescriptor;
@@ -208,7 +232,7 @@ void PageSelector::DeselectPage (int nPageIndex)
void PageSelector::DeselectPage (const SdPage* pPage)
{
- int nPageIndex = (pPage->GetPageNum()-1) / 2;
+ const sal_Int32 nPageIndex (mrModel.GetIndex(pPage));
SharedPageDescriptor pDescriptor (mrModel.GetPageDescriptor(nPageIndex));
if (pDescriptor.get()!=NULL && pDescriptor->GetPage()==pPage)
DeselectPage(pDescriptor);
@@ -223,6 +247,8 @@ void PageSelector::DeselectPage (const SharedPageDescriptor& rpDescriptor)
&& mrSlideSorter.GetView().SetState(rpDescriptor, PageDescriptor::ST_Selected, false))
{
mnSelectedPageCount --;
+ if ( ! mbIsMakeVisibleDisabled)
+ mrSlideSorter.GetController().GetVisibleAreaManager().RequestVisible(rpDescriptor);
mrSlideSorter.GetView().RequestRepaint(rpDescriptor);
if (mpMostRecentlySelectedPage == rpDescriptor)
mpMostRecentlySelectedPage.reset();
@@ -265,38 +291,6 @@ int PageSelector::GetSelectedPageCount (void) const
-void PageSelector::PrepareModelChange (void)
-{
- DeselectAllPages ();
-}
-
-
-
-
-void PageSelector::HandleModelChange (void)
-{
- GetCoreSelection();
-}
-
-
-
-
-SharedPageDescriptor PageSelector::GetMostRecentlySelectedPage (void) const
-{
- return mpMostRecentlySelectedPage;
-}
-
-
-
-
-void PageSelector::SetMostRecentlySelectedPage (const model::SharedPageDescriptor& rpDescriptor)
-{
- mpMostRecentlySelectedPage = rpDescriptor;
-}
-
-
-
-
SharedPageDescriptor PageSelector::GetSelectionAnchor (void) const
{
return mpSelectionAnchor;
@@ -320,13 +314,13 @@ void PageSelector::CountSelectedPages (void)
-void PageSelector::EnableBroadcasting (bool bMakeSelectionVisible)
+void PageSelector::EnableBroadcasting (void)
{
if (mnBroadcastDisableLevel > 0)
mnBroadcastDisableLevel --;
if (mnBroadcastDisableLevel==0 && mbSelectionChangeBroadcastPending)
{
- mrController.GetSelectionManager()->SelectionHasChanged(bMakeSelectionVisible);
+ mrController.GetSelectionManager()->SelectionHasChanged();
mbSelectionChangeBroadcastPending = false;
}
}
@@ -396,19 +390,15 @@ void PageSelector::UpdateCurrentPage (const bool bUpdateOnlyWhenPending)
if (pDescriptor && pDescriptor->HasState(PageDescriptor::ST_Selected))
{
// Switching the current slide normally sets also the selection
- // to just the new current slide. To prevent that here we store
- // and at the end of this scope restore the current selection.
+ // to just the new current slide. To prevent that, we store
+ // (and at the end of this scope restore) the current selection.
::boost::shared_ptr<PageSelection> pSelection (GetPageSelection());
- SharedPageDescriptor pRecentSelection (GetMostRecentlySelectedPage());
mrController.GetCurrentSlideManager()->SwitchCurrentSlide(pDescriptor);
// Restore the selection and prevent a recursive call to
// UpdateCurrentPage().
SetPageSelection(pSelection, false);
- // Restore the most recently selected page. Important for
- // making the right part of the selection visible.
- mpMostRecentlySelectedPage = pRecentSelection;
return;
}
}
@@ -453,8 +443,7 @@ PageSelector::UpdateLock::~UpdateLock (void)
//===== PageSelector::BroadcastLock ==============================================
PageSelector::BroadcastLock::BroadcastLock (SlideSorter& rSlideSorter)
- : mrSelector(rSlideSorter.GetController().GetPageSelector()),
- mbIsMakeSelectionVisiblePending(false)
+ : mrSelector(rSlideSorter.GetController().GetPageSelector())
{
mrSelector.DisableBroadcasting();
}
@@ -473,17 +462,7 @@ PageSelector::BroadcastLock::BroadcastLock (PageSelector& rSelector)
PageSelector::BroadcastLock::~BroadcastLock (void)
{
- mrSelector.EnableBroadcasting(mbIsMakeSelectionVisiblePending);
+ mrSelector.EnableBroadcasting();
}
-
-
-
-void PageSelector::BroadcastLock::RequestMakeSelectionVisible (void)
-{
- mbIsMakeSelectionVisiblePending = true;
-}
-
-
-
} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
index 85d10a7407fb..416f06a82616 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx
@@ -356,6 +356,7 @@ void SelectionFunction::NotifyDragFinished (void)
BOOL SelectionFunction::KeyInput (const KeyEvent& rEvent)
{
+ view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
PageSelector::UpdateLock aLock (mrSlideSorter);
FocusManager& rFocusManager (mrController.GetFocusManager());
BOOL bResult = FALSE;
@@ -559,10 +560,6 @@ void SelectionFunction::MoveFocus (
rSelector.DeselectAllPages();
mrController.GetPageSelector().SelectPage(pFocusedDescriptor);
}
-
- // Mark the currently focused page as last selected so that it is made
- // visible on the next paint.
- mrController.GetPageSelector().SetMostRecentlySelectedPage(pFocusedDescriptor);
}
@@ -961,9 +958,6 @@ bool SelectionFunction::ProcessEvent (EventDescriptor& rDescriptor)
}
}
- if (rDescriptor.mbMakeSelectionVisible)
- aBroadcastLock.RequestMakeSelectionVisible();
-
return bResult;
}
@@ -1181,7 +1175,7 @@ void SelectionFunction::PostProcessEvent (const EventDescriptor& rDescriptor)
// Now turn them off.
if ( ! mrController.IsContextMenuOpen())
- mrController.GetInsertionIndicatorHandler()->End();
+ mrController.GetInsertionIndicatorHandler()->End(Animator::AM_Animated);
mnButtonDownPageIndex = -1;
mnButtonDownButtonIndex = -1;
@@ -1293,7 +1287,7 @@ void SelectionFunction::StopDragAndDrop (void)
mpDragAndDropContext.reset();
UpdateMouseOverIndicationPermission();
}
- mrController.GetInsertionIndicatorHandler()->End();
+ mrController.GetInsertionIndicatorHandler()->End(Animator::AM_Animated);
}
@@ -1561,9 +1555,6 @@ void SelectionFunction::MouseMultiSelector::UpdateSelection (void)
UpdateSelectionState(pDescriptor, aRange.IsInside(nIndex));
}
-
- // Rely on auto scrolling to make page objects visible.
- mrSlideSorter.GetController().GetSelectionManager()->ResetMakeSelectionVisiblePending();
}
}
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
index 5ff0e034d816..8e8a97713666 100644
--- a/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionManager.cxx
@@ -30,15 +30,17 @@
#include "controller/SlsSelectionManager.hxx"
#include "SlideSorter.hxx"
-#include "SlsSelectionCommand.hxx"
+#include "SlsCommand.hxx"
#include "controller/SlideSorterController.hxx"
#include "controller/SlsAnimator.hxx"
#include "controller/SlsAnimationFunction.hxx"
#include "controller/SlsCurrentSlideManager.hxx"
#include "controller/SlsFocusManager.hxx"
+#include "controller/SlsPageSelector.hxx"
#include "controller/SlsProperties.hxx"
#include "controller/SlsScrollBarManager.hxx"
#include "controller/SlsSlotManager.hxx"
+#include "controller/SlsSelectionObserver.hxx"
#include "model/SlideSorterModel.hxx"
#include "model/SlsPageEnumerationProvider.hxx"
#include "model/SlsPageDescriptor.hxx"
@@ -67,24 +69,12 @@ using namespace ::sd::slidesorter::controller;
namespace sd { namespace slidesorter { namespace controller {
-namespace {
- class VisibleAreaScroller
- {
- public:
- VisibleAreaScroller (
- SlideSorter& rSlideSorter,
- const Point aStart,
- const Point aEnd);
- void operator() (const double nValue);
- private:
- SlideSorter& mrSlideSorter;
- Point maStart;
- const Point maEnd;
- const ::boost::function<double(double)> maAccelerationFunction;
- };
-}
-
+class SelectionManager::PageInsertionListener
+ : public SfxListener
+{
+public:
+};
SelectionManager::SelectionManager (SlideSorter& rSlideSorter)
@@ -94,7 +84,9 @@ SelectionManager::SelectionManager (SlideSorter& rSlideSorter)
mbIsMakeSelectionVisiblePending(true),
mnInsertionPosition(-1),
mnAnimationId(Animator::NotAnAnimationId),
- maRequestedTopLeft()
+ maRequestedTopLeft(),
+ mpPageInsertionListener(),
+ mpSelectionObserver(new SelectionObserver(rSlideSorter))
{
}
@@ -196,7 +188,7 @@ void SelectionManager::DeleteSelectedNormalPages (const ::std::vector<SdPage*>&
if (xPages->getCount() <= 1)
break;
- USHORT nPage = ((*aI)->GetPageNum()-1) / 2;
+ const USHORT nPage (model::FromCoreIndex((*aI)->GetPageNum()));
Reference< XDrawPage > xPage( xPages->getByIndex( nPage ), UNO_QUERY_THROW );
xPages->remove(xPage);
@@ -232,7 +224,7 @@ void SelectionManager::DeleteSelectedMasterPages (const ::std::vector<SdPage*>&
if (xPages->getCount() <= 1)
break;
- USHORT nPage = ((*aI)->GetPageNum()-1) / 2;
+ const USHORT nPage (model::FromCoreIndex((*aI)->GetPageNum()));
Reference< XDrawPage > xPage( xPages->getByIndex( nPage ), UNO_QUERY_THROW );
xPages->remove(xPage);
@@ -247,58 +239,6 @@ void SelectionManager::DeleteSelectedMasterPages (const ::std::vector<SdPage*>&
-bool SelectionManager::MoveSelectedPages (const sal_Int32 nTargetPageIndex)
-{
- bool bMoved (false);
- PageSelector& rSelector (mrController.GetPageSelector());
-
- view::SlideSorterView::DrawLock aDrawLock (mrSlideSorter);
- SlideSorterController::ModelChangeLock aLock (mrController);
-
- // Transfer selection of the slide sorter to the document.
- mrSlideSorter.GetModel().SynchronizeDocumentSelection ();
-
- // Detect how many pages lie between document start and insertion
- // position.
- sal_Int32 nPageCountBeforeTarget (0);
- ::boost::shared_ptr<PageSelector::PageSelection> pSelection (rSelector.GetPageSelection());
- PageSelector::PageSelection::const_iterator iSelectedPage (pSelection->begin());
- PageSelector::PageSelection::const_iterator iSelectionEnd (pSelection->end());
- for ( ; iSelectedPage!=iSelectionEnd; ++iSelectedPage)
- {
- if (*iSelectedPage==NULL)
- continue;
- if (((*iSelectedPage)->GetPageNum()-1)/2 <= nTargetPageIndex)
- ++nPageCountBeforeTarget;
- else
- break;
- }
-
- // Prepare to select the moved pages.
- SelectionCommand* pCommand = new SelectionCommand(
- rSelector,mrController.GetCurrentSlideManager(),mrSlideSorter.GetModel());
- sal_Int32 nSelectedPageCount (rSelector.GetSelectedPageCount());
- for (sal_Int32 nOffset=0; nOffset<nSelectedPageCount; ++nOffset)
- pCommand->AddSlide(sal::static_int_cast<USHORT>(
- nTargetPageIndex + nOffset - nPageCountBeforeTarget + 1));
-
- // At the moment we can not move master pages.
- if (nTargetPageIndex>=0)
- {
- if (mrSlideSorter.GetModel().GetEditMode() == EM_PAGE)
- bMoved = mrSlideSorter.GetModel().GetDocument()->MovePages(
- sal::static_int_cast<sal_uInt16>(nTargetPageIndex));
- }
- if (bMoved)
- mrController.GetSlotManager()->ExecuteCommandAsynchronously(
- ::std::auto_ptr<controller::Command>(pCommand));
-
- return bMoved;
-}
-
-
-
-
void SelectionManager::SelectionHasChanged (const bool bMakeSelectionVisible)
{
if (bMakeSelectionVisible)
@@ -340,173 +280,6 @@ void SelectionManager::SelectionHasChanged (const bool bMakeSelectionVisible)
-bool SelectionManager::IsMakeSelectionVisiblePending (void) const
-{
- return mbIsMakeSelectionVisiblePending;
-}
-
-
-
-
-void SelectionManager::ResetMakeSelectionVisiblePending (void)
-{
- mbIsMakeSelectionVisiblePending = false;
-}
-
-
-
-
-/** We have to distinguish three cases: 1) the selection is empty, 2) the
- selection fits completely into the visible area, 3) it does not.
- 1) The visible area is not modified.
- 2) When the selection fits completely into the visible area we have to
- decide how to align it. It is done by scrolling it there and thus when
- we scoll up the (towards the end of the document) the bottom of the
- selection is aligned with the bottom of the window. When we scroll
- down (towards the beginning of the document) the top of the selection is
- aligned with the top of the window.
- 3) We have to decide what part of the selection to make visible. Here
- we use the eSelectionHint and concentrate on either the first, the last,
- or the most recently selected page. We then again apply the algorithm
- of a).
-
-*/
-Size SelectionManager::MakeSelectionVisible (const SelectionHint eSelectionHint)
-{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow == NULL)
- return Size(0,0);
-
- mbIsMakeSelectionVisiblePending = false;
-
- // Determine the descriptors of the first and last selected page and the
- // bounding box that encloses their page objects.
- model::SharedPageDescriptor pFirst;
- model::SharedPageDescriptor pLast;
- Rectangle aSelectionBox;
- const view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter());
- model::PageEnumeration aSelectedPages (
- PageEnumerationProvider::CreateSelectedPagesEnumeration(mrSlideSorter.GetModel()));
- while (aSelectedPages.HasMoreElements())
- {
- model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
-
- if (pFirst.get() == NULL)
- pFirst = pDescriptor;
- pLast = pDescriptor;
-
- aSelectionBox.Union(rLayouter.GetPageObjectBox(pDescriptor->GetPageIndex(), true));
- }
-
- if (pFirst != NULL)
- {
- // Determine scroll direction and the position in model coordinates
- // that will be aligned with the top/left or bottom/right window
- // border.
- if (DoesSelectionExceedVisibleArea(aSelectionBox))
- {
- // We can show only a part of the selection.
- aSelectionBox = ResolveLargeSelection(pFirst,pLast, eSelectionHint);
- }
-
- return MakeRectangleVisible(aSelectionBox);
- }
-
- return Size(0,0);
-}
-
-
-
-
-Size SelectionManager::MakeRectangleVisible (const Rectangle& rBox)
-{
- SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
- if (pWindow == NULL)
- return Size(0,0);
-
- Rectangle aVisibleArea (pWindow->PixelToLogic(
- Rectangle(
- Point(0,0),
- pWindow->GetOutputSizePixel())));
-
- sal_Int32 nNewTop (aVisibleArea.Top());
- sal_Int32 nNewLeft (aVisibleArea.Left());
-
- if (mrSlideSorter.GetView().GetOrientation() != Layouter::HORIZONTAL)
- {
- // Scroll the visible area to make aSelectionBox visible.
- if (mrSlideSorter.GetProperties()->IsCenterSelection())
- {
- nNewTop = rBox.Top() - (aVisibleArea.GetHeight() - rBox.GetHeight()) / 2;
- }
- else
- {
- if (rBox.Top() < aVisibleArea.Top())
- nNewTop = rBox.Top();
- else if (rBox.Bottom() > aVisibleArea.Bottom())
- nNewTop = rBox.Bottom() - aVisibleArea.GetHeight();
- // otherwise we do not modify the visible area.
- }
-
- // Make some corrections of the new visible area.
- Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea());
- if (nNewTop + aVisibleArea.GetHeight() > aModelArea.Bottom())
- nNewTop = aModelArea.GetHeight() - aVisibleArea.GetHeight();
- if (nNewTop < aModelArea.Top())
- nNewTop = aModelArea.Top();
-
- }
-
- if (mrSlideSorter.GetView().GetOrientation() != Layouter::VERTICAL)
- {
- // Scroll the visible area to make aSelectionBox visible.
- if (mrSlideSorter.GetProperties()->IsCenterSelection())
- {
- nNewLeft = rBox.Left() - (aVisibleArea.GetWidth() - rBox.GetWidth()) / 2;
- }
- else
- {
- if (rBox.Left() < aVisibleArea.Left())
- nNewLeft = rBox.Left();
- else if (rBox.Right() > aVisibleArea.Right())
- nNewLeft = rBox.Right() - aVisibleArea.GetWidth();
- // otherwise we do not modify the visible area.
- }
-
- // Make some corrections of the new visible area.
- Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea());
- if (nNewLeft + aVisibleArea.GetWidth() > aModelArea.Right())
- nNewLeft = aModelArea.GetWidth() - aVisibleArea.GetWidth();
- if (nNewLeft < aModelArea.Left())
- nNewLeft = aModelArea.Left();
- }
-
- // Scroll when the visible area is not already at the requested location
- // and there is no active animation to scroll to it.
- if ((nNewTop != aVisibleArea.Top() || nNewLeft != aVisibleArea.Left())
- && (mnAnimationId==Animator::NotAnAnimationId
- || maRequestedTopLeft != Point(nNewLeft,nNewTop)))
- {
- if (mnAnimationId != Animator::NotAnAnimationId)
- mrController.GetAnimator()->RemoveAnimation(mnAnimationId);
-
- maRequestedTopLeft = Point(nNewLeft, nNewTop);
- VisibleAreaScroller aAnimation(
- mrSlideSorter,
- aVisibleArea.TopLeft(),
- maRequestedTopLeft);
- if (mrSlideSorter.GetProperties()->IsSmoothSelectionScrolling())
- mnAnimationId = mrController.GetAnimator()->AddAnimation(aAnimation, 0, 300);
- else
- aAnimation(1.0);
- }
-
- return Size(aVisibleArea.Left() - nNewLeft, aVisibleArea.Top() - nNewTop);
-}
-
-
-
-
void SelectionManager::AddSelectionChangeListener (const Link& rListener)
{
if (::std::find (
@@ -531,7 +304,7 @@ void SelectionManager::RemoveSelectionChangeListener(const Link&rListener)
}
-
+/*
bool SelectionManager::DoesSelectionExceedVisibleArea (const Rectangle& rSelectionBox) const
{
@@ -593,7 +366,7 @@ Rectangle SelectionManager::ResolveLargeSelection (
true);
}
-
+*/
sal_Int32 SelectionManager::GetInsertionPosition (void) const
@@ -612,7 +385,7 @@ sal_Int32 SelectionManager::GetInsertionPosition (void) const
const sal_Int32 nPosition (aSelectedPages.GetNextElement()->GetPage()->GetPageNum());
// Convert *2+1 index to straight index (n-1)/2 after the page
// (+1).
- nInsertionPosition = (nPosition-1)/2 + 1;
+ nInsertionPosition = model::FromCoreIndex(nPosition) + 1;
}
}
@@ -639,50 +412,9 @@ void SelectionManager::SetInsertionPosition (const sal_Int32 nInsertionPosition)
-//===== VerticalVisibleAreaScroller ===========================================
-
-namespace {
-
-const static sal_Int32 gnMaxScrollDistance = 300;
-
-VisibleAreaScroller::VisibleAreaScroller (
- SlideSorter& rSlideSorter,
- const Point aStart,
- const Point aEnd)
- : mrSlideSorter(rSlideSorter),
- maStart(aStart),
- maEnd(aEnd),
- maAccelerationFunction(
- controller::AnimationParametricFunction(
- controller::AnimationBezierFunction (0.1,0.6)))
+::boost::shared_ptr<SelectionObserver> SelectionManager::GetSelectionObserver (void) const
{
- // When the distance to scroll is larger than a threshold then first
- // jump to within this distance of the final value and start the
- // animation from there.
- if (abs(aStart.X()-aEnd.X()) > gnMaxScrollDistance)
- if (aStart.X() < aEnd.X())
- maStart.X() = aEnd.X()-gnMaxScrollDistance;
- else
- maStart.X() = aEnd.X()+gnMaxScrollDistance;
- if (abs(aStart.Y()-aEnd.Y()) > gnMaxScrollDistance)
- if (aStart.Y() < aEnd.Y())
- maStart.Y() = aEnd.Y()-gnMaxScrollDistance;
- else
- maStart.Y() = aEnd.Y()+gnMaxScrollDistance;
+ return mpSelectionObserver;
}
-
-
-
-void VisibleAreaScroller::operator() (const double nTime)
-{
- const double nLocalTime (maAccelerationFunction(nTime));
- mrSlideSorter.GetController().GetScrollBarManager().SetTopLeft(
- Point(
- sal_Int32(0.5 + maStart.X() * (1.0 - nLocalTime) + maEnd.X() * nLocalTime),
- sal_Int32 (0.5 + maStart.Y() * (1.0 - nLocalTime) + maEnd.Y() * nLocalTime)));
-}
-
-} // end of anonymous namespace
-
} } } // end of namespace ::sd::slidesorter
diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
new file mode 100644
index 000000000000..91edc092016f
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsSelectionObserver.cxx
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "SlideSorter.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsSelectionObserver.hxx"
+#include "controller/SlsPageSelector.hxx"
+#include "model/SlideSorterModel.hxx"
+#include "model/SlsPageDescriptor.hxx"
+#include <svx/svdmodel.hxx>
+#include "drawdoc.hxx"
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+SelectionObserver::Context::Context (SlideSorter& rSlideSorter)
+ : mpSelectionObserver(
+ rSlideSorter.GetController().GetSelectionManager()->GetSelectionObserver())
+{
+ if (mpSelectionObserver)
+ mpSelectionObserver->StartObservation();
+}
+
+
+
+
+SelectionObserver::Context::~Context(void)
+{
+ if (mpSelectionObserver)
+ mpSelectionObserver->EndObservation();
+}
+
+
+
+
+//===== SelectionObserver =====================================================
+
+SelectionObserver::SelectionObserver (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ mpDocument(mrSlideSorter.GetModel().GetDocument()),
+ mbIsOvservationActive(false),
+ maInsertedPages(),
+ maDeletedPages()
+{
+}
+
+
+
+
+SelectionObserver::~SelectionObserver (void)
+{
+}
+
+
+
+
+void SelectionObserver::NotifyPageEvent (const SdrPage* pSdrPage)
+{
+ if ( ! mbIsOvservationActive)
+ return;
+
+ const SdPage* pPage = dynamic_cast<const SdPage*>(pSdrPage);
+ if (pPage == NULL)
+ return;
+
+ if (pPage->IsInserted())
+ maInsertedPages.push_back(pPage);
+ else
+ {
+ ::std::vector<const SdPage*>::iterator iPage(
+ ::std::find(maInsertedPages.begin(), maInsertedPages.end(), pPage));
+ if (iPage != maInsertedPages.end())
+ maInsertedPages.erase(iPage);
+
+ maDeletedPages.push_back(pPage->GetPageNum());
+ }
+}
+
+
+
+void SelectionObserver::StartObservation (void)
+{
+ OSL_ASSERT(!mbIsOvservationActive);
+ maInsertedPages.clear();
+ maDeletedPages.clear();
+ mbIsOvservationActive = true;
+}
+
+
+
+
+void SelectionObserver::EndObservation (void)
+{
+ OSL_ASSERT(mbIsOvservationActive);
+ mbIsOvservationActive = false;
+
+ model::SlideSorterModel& rModel (mrSlideSorter.GetModel());
+ PageSelector& rSelector (mrSlideSorter.GetController().GetPageSelector());
+ rSelector.DeselectAllPages();
+ if ( ! maInsertedPages.empty())
+ {
+ // Select the inserted pages.
+ for (::std::vector<const SdPage*>::const_iterator
+ iPage(maInsertedPages.begin()),
+ iEnd(maInsertedPages.end());
+ iPage!=iEnd;
+ ++iPage)
+ {
+ rSelector.SelectPage(*iPage);
+ /*
+ const sal_Int32 nIndex (rModel.GetIndex (*iPage));
+ model::SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
+ if (pDescriptor)
+ pDescriptor->SetState(model::PageDescriptor::ST_Selected,
+ true);
+ */
+ }
+ maInsertedPages.clear();
+ }
+ maDeletedPages.clear();
+}
+
+
+
+} } } // 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 36c0e2494491..1a2410f1eb64 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -40,6 +40,7 @@
#include "controller/SlsPageSelector.hxx"
#include "controller/SlsSelectionFunction.hxx"
#include "controller/SlsSelectionManager.hxx"
+#include "controller/SlsSelectionObserver.hxx"
#include "SlsCommand.hxx"
#include "model/SlideSorterModel.hxx"
#include "model/SlsPageEnumerationProvider.hxx"
@@ -184,7 +185,6 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
case SID_SELECTALL:
mrSlideSorter.GetController().GetPageSelector().SelectAllPages();
- mrSlideSorter.GetController().GetSelectionManager()->ResetMakeSelectionVisiblePending();
rRequest.Done();
break;
@@ -399,7 +399,10 @@ void SlotManager::FuSupport (SfxRequest& rRequest)
SlideSorterViewShell* pViewShell
= dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
if (pViewShell != NULL)
+ {
+ SelectionObserver::Context aContext (mrSlideSorter);
pViewShell->ImpSidUndo (FALSE, rRequest);
+ }
break;
}
@@ -408,7 +411,10 @@ void SlotManager::FuSupport (SfxRequest& rRequest)
SlideSorterViewShell* pViewShell
= dynamic_cast<SlideSorterViewShell*>(mrSlideSorter.GetViewShell());
if (pViewShell != NULL)
+ {
+ SelectionObserver::Context aContext (mrSlideSorter);
pViewShell->ImpSidRedo (FALSE, rRequest);
+ }
break;
}
diff --git a/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
new file mode 100644
index 000000000000..c683c5e0a2c4
--- /dev/null
+++ b/sd/source/ui/slidesorter/controller/SlsVisibleAreaManager.cxx
@@ -0,0 +1,254 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "controller/SlsVisibleAreaManager.hxx"
+#include "controller/SlideSorterController.hxx"
+#include "controller/SlsProperties.hxx"
+#include "controller/SlsAnimationFunction.hxx"
+#include "controller/SlsScrollBarManager.hxx"
+
+
+namespace sd { namespace slidesorter { namespace controller {
+
+namespace {
+ class VisibleAreaScroller
+ {
+ public:
+ VisibleAreaScroller (
+ SlideSorter& rSlideSorter,
+ const Point aStart,
+ const Point aEnd);
+ void operator() (const double nValue);
+ private:
+ SlideSorter& mrSlideSorter;
+ Point maStart;
+ const Point maEnd;
+ const ::boost::function<double(double)> maAccelerationFunction;
+ };
+
+} // end of anonymous namespace
+
+
+
+VisibleAreaManager::VisibleAreaManager (SlideSorter& rSlideSorter)
+ : mrSlideSorter(rSlideSorter),
+ maVisibleRequests(),
+ mnScrollAnimationId(Animator::NotAnAnimationId),
+ maRequestedVisibleTopLeft(),
+ meRequestedAnimationMode(Animator::AM_Immediate)
+{
+}
+
+
+
+
+VisibleAreaManager::~VisibleAreaManager (void)
+{
+}
+
+
+
+
+void VisibleAreaManager::RequestVisible (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Animator::AnimationMode eRequestedAnimationMode)
+{
+ if (rpDescriptor)
+ {
+ maVisibleRequests.push_back(
+ mrSlideSorter.GetView().GetLayouter().GetPageObjectBox(
+ rpDescriptor->GetPageIndex(),
+ true));
+ if (eRequestedAnimationMode == Animator::AM_Animated)
+ meRequestedAnimationMode = Animator::AM_Animated;
+ MakeVisible();
+ }
+}
+
+
+
+
+void VisibleAreaManager::MakeVisible (void)
+{
+ if (maVisibleRequests.empty())
+ return;
+
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if ( ! pWindow)
+ return;
+ const Point aCurrentTopLeft (pWindow->PixelToLogic(Point(0,0)));
+
+ const ::boost::optional<Point> aNewVisibleTopLeft (GetRequestedTopLeft());
+ maVisibleRequests.clear();
+ if ( ! aNewVisibleTopLeft)
+ return;
+
+ // We now know what the visible area shall be. Scroll accordingly
+ // unless that is not already the visible area or a running scroll
+ // animation has it as its target area.
+ if (mnScrollAnimationId!=Animator::NotAnAnimationId
+ && maRequestedVisibleTopLeft==aNewVisibleTopLeft)
+ return;
+
+ // Stop a running animation.
+ if (mnScrollAnimationId != Animator::NotAnAnimationId)
+ mrSlideSorter.GetController().GetAnimator()->RemoveAnimation(mnScrollAnimationId);
+
+ maRequestedVisibleTopLeft = aNewVisibleTopLeft.get();
+ VisibleAreaScroller aAnimation(
+ mrSlideSorter,
+ aCurrentTopLeft,
+ maRequestedVisibleTopLeft);
+ if (meRequestedAnimationMode==Animator::AM_Animated
+ && mrSlideSorter.GetProperties()->IsSmoothSelectionScrolling())
+ {
+ mnScrollAnimationId = mrSlideSorter.GetController().GetAnimator()->AddAnimation(
+ aAnimation,
+ 0,
+ 300);
+ }
+ else
+ {
+ // Execute the animation at its final value.
+ aAnimation(1.0);
+ }
+ meRequestedAnimationMode = Animator::AM_Immediate;
+}
+
+
+
+
+::boost::optional<Point> VisibleAreaManager::GetRequestedTopLeft (void) const
+{
+ SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
+ if ( ! pWindow)
+ return ::boost::optional<Point>();
+
+ // Get the currently visible area and the model area.
+ const Rectangle aVisibleArea (pWindow->PixelToLogic(
+ Rectangle(
+ Point(0,0),
+ pWindow->GetOutputSizePixel())));
+ const Rectangle aModelArea (mrSlideSorter.GetView().GetModelArea());
+
+ sal_Int32 nVisibleTop (aVisibleArea.Top());
+ const sal_Int32 nVisibleWidth (aVisibleArea.GetWidth());
+ sal_Int32 nVisibleLeft (aVisibleArea.Left());
+ const sal_Int32 nVisibleHeight (aVisibleArea.GetHeight());
+
+ // Find the longest run of boxes whose union fits into the visible area.
+ Rectangle aBoundingBox;
+ for (::std::vector<Rectangle>::const_iterator
+ iBox(maVisibleRequests.begin()),
+ iEnd(maVisibleRequests.end());
+ iBox!=iEnd;
+ ++iBox)
+ {
+ if (nVisibleTop+nVisibleHeight <= iBox->Bottom())
+ nVisibleTop = iBox->Bottom()-nVisibleHeight;
+ if (nVisibleTop > iBox->Top())
+ nVisibleTop = iBox->Top();
+
+ if (nVisibleLeft+nVisibleWidth <= iBox->Right())
+ nVisibleLeft = iBox->Right()-nVisibleWidth;
+ if (nVisibleLeft > iBox->Left())
+ nVisibleLeft = iBox->Left();
+
+ // Make sure the visible area does not move outside the model area.
+ if (nVisibleTop + nVisibleHeight > aModelArea.Bottom())
+ nVisibleTop = aModelArea.Bottom() - nVisibleHeight;
+ if (nVisibleTop < aModelArea.Top())
+ nVisibleTop = aModelArea.Top();
+
+ if (nVisibleLeft + nVisibleWidth > aModelArea.Right())
+ nVisibleLeft = aModelArea.Right() - nVisibleWidth;
+ if (nVisibleLeft < aModelArea.Left())
+ nVisibleLeft = aModelArea.Left();
+ }
+
+ const Point aRequestedTopLeft (nVisibleLeft, nVisibleTop);
+ if (aRequestedTopLeft == aVisibleArea.TopLeft())
+ return ::boost::optional<Point>();
+ else
+ return ::boost::optional<Point>(aRequestedTopLeft);
+}
+
+
+
+
+
+
+
+//===== VerticalVisibleAreaScroller ===========================================
+
+namespace {
+
+const static sal_Int32 gnMaxScrollDistance = 300;
+
+VisibleAreaScroller::VisibleAreaScroller (
+ SlideSorter& rSlideSorter,
+ const Point aStart,
+ const Point aEnd)
+ : mrSlideSorter(rSlideSorter),
+ maStart(aStart),
+ maEnd(aEnd),
+ maAccelerationFunction(
+ controller::AnimationParametricFunction(
+ controller::AnimationBezierFunction (0.1,0.6)))
+{
+ // When the distance to scroll is larger than a threshold then first
+ // jump to within this distance of the final value and start the
+ // animation from there.
+ if (abs(aStart.X()-aEnd.X()) > gnMaxScrollDistance)
+ if (aStart.X() < aEnd.X())
+ maStart.X() = aEnd.X()-gnMaxScrollDistance;
+ else
+ maStart.X() = aEnd.X()+gnMaxScrollDistance;
+ if (abs(aStart.Y()-aEnd.Y()) > gnMaxScrollDistance)
+ if (aStart.Y() < aEnd.Y())
+ maStart.Y() = aEnd.Y()-gnMaxScrollDistance;
+ else
+ maStart.Y() = aEnd.Y()+gnMaxScrollDistance;
+}
+
+
+
+
+void VisibleAreaScroller::operator() (const double nTime)
+{
+ const double nLocalTime (maAccelerationFunction(nTime));
+ mrSlideSorter.GetController().GetScrollBarManager().SetTopLeft(
+ Point(
+ sal_Int32(0.5 + maStart.X() * (1.0 - nLocalTime) + maEnd.X() * nLocalTime),
+ sal_Int32 (0.5 + maStart.Y() * (1.0 - nLocalTime) + maEnd.Y() * nLocalTime)));
+}
+
+} // end of anonymous namespace
+
+} } } // end of namespace ::sd::slidesorter::controller
diff --git a/sd/source/ui/slidesorter/controller/makefile.mk b/sd/source/ui/slidesorter/controller/makefile.mk
index 89646e38ef5d..460ef16ed3f1 100644
--- a/sd/source/ui/slidesorter/controller/makefile.mk
+++ b/sd/source/ui/slidesorter/controller/makefile.mk
@@ -58,8 +58,10 @@ SLOFILES = \
$(SLO)$/SlsSelectionCommand.obj \
$(SLO)$/SlsSelectionFunction.obj \
$(SLO)$/SlsSelectionManager.obj \
+ $(SLO)$/SlsSelectionObserver.obj \
$(SLO)$/SlsSlotManager.obj \
- $(SLO)$/SlsTransferable.obj
+ $(SLO)$/SlsTransferable.obj \
+ $(SLO)$/SlsVisibleAreaManager.obj
# --- Tagets -------------------------------------------------------
diff --git a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
index 71b2073011aa..b72120e9fcb9 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlideSorterController.hxx
@@ -37,7 +37,6 @@
#include <sfx2/viewfac.hxx>
#include <tools/link.hxx>
#include <tools/gen.hxx>
-#include <memory>
#include <comphelper/implementationreference.hxx>
namespace sd { namespace slidesorter {
@@ -67,7 +66,9 @@ class PageSelector;
class ScrollBarManager;
class SelectionFunction;
class SelectionManager;
+class SelectionObserver;
class SlotManager;
+class VisibleAreaManager;
class SlideSorterController
{
@@ -249,21 +250,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
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx b/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
index a82e4b1d1773..2d8418e49631 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsAnimator.hxx
@@ -48,6 +48,12 @@ 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);
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx b/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
index 0bdbd7cb569f..536684be5dc3 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsClipboard.hxx
@@ -24,6 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef SD_SLIDESORTER_CLIPBOARD
#define SD_SLIDESORTER_CLIPBOARD
@@ -127,6 +128,12 @@ private:
*/
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;
+
void CreateSlideTransferable (
::Window* pWindow,
bool bDrag);
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx b/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx
index 73f11e3e0e32..3945225baf8b 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsInsertionIndicatorHandler.hxx
@@ -68,7 +68,7 @@ public:
/** Deactivate the insertion marker.
*/
- void End (void);
+ void End (const controller::Animator::AnimationMode eMode);
class ForceShowContext
{
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
index 1d5b17eb5bca..c2d221c62bd5 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsPageSelector.hxx
@@ -81,10 +81,17 @@ public:
*/
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
@@ -108,26 +115,6 @@ public:
int GetPageCount (void) const;
int GetSelectedPageCount (void) const;
- void PrepareModelChange (void);
- void HandleModelChange (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;
-
- /** Mark the given page as the most recently selected. Use this method
- when the selection does not really change but the focus does.
- */
- void SetMostRecentlySelectedPage (const model::SharedPageDescriptor& rpDescriptor);
-
/** Return the anchor for a range selection. This usually is the first
selected page after all pages have been deselected.
@return
@@ -185,10 +172,8 @@ public:
BroadcastLock (SlideSorter& rSlideSorter);
BroadcastLock (PageSelector& rPageSelector);
~BroadcastLock (void);
- void RequestMakeSelectionVisible (void);
private:
PageSelector& mrSelector;
- bool mbIsMakeSelectionVisiblePending;
};
private:
@@ -204,6 +189,7 @@ private:
model::SharedPageDescriptor mpCurrentPage;
sal_Int32 mnUpdateLockCount;
bool mbIsUpdateCurrentPagePending;
+ bool mbIsMakeVisibleDisabled;
/** Enable the broadcasting of selection change events. This calls the
SlideSorterController::SelectionHasChanged() method to do the actual
@@ -211,7 +197,7 @@ private:
DisableBroadcasting() was called before and the selection has been
changed in the mean time, this change will be broadcasted.
*/
- void EnableBroadcasting (bool bMakeSelectionVisible = true);
+ void EnableBroadcasting (void);
/** Disable the broadcasting o selectio change events. Subsequent
changes of the selection will set a flag that triggers the sending
diff --git a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
index 8810107f28db..74f5b4dece95 100644
--- a/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionManager.hxx
@@ -45,6 +45,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.
@@ -72,56 +73,12 @@ public:
*/
void DeleteSelectedPages (const bool bSelectFollowingPage = true);
- /** Move the maked pages to a position directly after the specified page.
- */
- bool MoveSelectedPages (const sal_Int32 nTargetPage);
-
/** Call this method after the selection has changed (possible several
calls to the PageSelector) to invalidate the relevant slots and send
appropriate events.
*/
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;
-
- /** Reset any request to make the set of selected pages visible.
- */
- void ResetMakeSelectionVisiblePending (void);
-
- 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
@@ -154,6 +111,8 @@ public:
*/
void SetInsertionPosition (const sal_Int32 nInsertionPosition);
+ ::boost::shared_ptr<SelectionObserver> GetSelectionObserver (void) const;
+
private:
SlideSorter& mrSlideSorter;
SlideSorterController& mrController;
@@ -183,6 +142,11 @@ private:
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
@@ -201,7 +165,7 @@ private:
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;
+ // 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()
@@ -217,10 +181,10 @@ private:
@return
Returns the new visible area.
*/
- Rectangle ResolveLargeSelection (
- const model::SharedPageDescriptor& rpFirst,
- const model::SharedPageDescriptor& rpLast,
- const SelectionHint eSelectionHint);
+ // 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..7718b9b7af01
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsSelectionObserver.hxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * 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>
+
+namespace sd { namespace slidesorter {
+class SlideSorter;
+} }
+
+class SdDrawDocument;
+class SdrPage;
+
+namespace sd { namespace slidesorter { namespace controller {
+
+class SelectionObserver
+{
+public:
+ SelectionObserver (SlideSorter& rSlideSorter);
+ virtual ~SelectionObserver (void);
+
+ void NotifyPageEvent (const SdrPage* pPage);
+ void StartObservation (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);
+ 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/SlsVisibleAreaManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx
new file mode 100644
index 000000000000..7edf45b22b16
--- /dev/null
+++ b/sd/source/ui/slidesorter/inc/controller/SlsVisibleAreaManager.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * 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);
+
+ /** Request to make the specified page object visible.
+ @param eRequestedAnimationMode
+ This flag specifies wether to smoothly scroll the page object into
+ view (AM_Animated) or do this in one step (AM_Immediate).
+ */
+ void RequestVisible (
+ const model::SharedPageDescriptor& rpDescriptor,
+ const Animator::AnimationMode eRequestedAnimationMode = Animator::AM_Immediate);
+
+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;
+
+ void MakeVisible (void);
+ ::boost::optional<Point> GetRequestedTopLeft (void) const;
+};
+
+
+} } } // end of namespace ::sd::slidesorter::view
+
+#endif
diff --git a/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx b/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
index 767ec630f6fc..9dfd861fd5cf 100644
--- a/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
+++ b/sd/source/ui/slidesorter/inc/model/SlideSorterModel.hxx
@@ -45,6 +45,7 @@ class SdDrawDocument;
namespace css = ::com::sun::star;
class SdrPage;
+class SdPage;
namespace sd { namespace slidesorter {
class SlideSorter;
@@ -58,6 +59,9 @@ namespace sd { namespace slidesorter { namespace model {
class DocumentPageContainer;
+inline sal_Int32 FromCoreIndex (const USHORT nCoreIndex) { return (nCoreIndex-1)/2; }
+inline USHORT ToCoreIndex (const sal_Int32 nIndex) { return nIndex*2+1; }
+
/** The model of the slide sorter gives access to the slides that are to be
displayed in the slide sorter view. Via the SetDocumentSlides() method
this set of slides can be modified (but do not call it directly, use
@@ -146,6 +150,13 @@ public:
*/
sal_Int32 GetIndex (const SdrPage* pPage) const;
+ /** Return an index for accessing an SdrModel that corresponds to the
+ given SlideSorterModel index. In many cases we just have to apply
+ the n*2+1 magic. Only when a special model is set, like a custom
+ slide show, then the returned value is different.
+ */
+ USHORT GetCoreIndex (const sal_Int32 nIndex) const;
+
/** Call this method after the document has changed its structure. This
will get the model in sync with the SdDrawDocument. This method
tries not to throw away to much information already gathered. This
@@ -207,6 +218,14 @@ public:
*/
Region RestoreSelection (void);
+ /** Typically called from controller::Listener this method handles the
+ insertion and deletion of single pages.
+ @return
+ Returns <TRUE/> when the given page is relevant for the current
+ page kind and edit mode.
+ */
+ bool NotifyPageEvent (const SdrPage* pPage);
+
private:
mutable ::osl::Mutex maMutex;
SlideSorter& mrSlideSorter;
@@ -221,6 +240,10 @@ private:
*/
void AdaptSize (void);
+ SdPage* GetPage (const sal_Int32 nCoreIndex) const;
+ void InsertSlide (SdPage* pPage);
+ void DeleteSlide (const SdPage* pPage);
+ void UpdateIndices (const sal_Int32 nFirstIndex);
};
} } } // end of namespace ::sd::slidesorter::model
diff --git a/sd/source/ui/slidesorter/inc/model/SlsPageDescriptor.hxx b/sd/source/ui/slidesorter/inc/model/SlsPageDescriptor.hxx
index 308bb5a49a15..276f1a7c10a7 100644
--- a/sd/source/ui/slidesorter/inc/model/SlsPageDescriptor.hxx
+++ b/sd/source/ui/slidesorter/inc/model/SlsPageDescriptor.hxx
@@ -96,6 +96,7 @@ public:
access the model filters them out.
*/
sal_Int32 GetPageIndex (void) const;
+ void SetPageIndex (const sal_Int32 nIndex);
bool UpdateMasterPage (void);
@@ -136,7 +137,10 @@ private:
/** This index is displayed as page number in the view. It may or may
not be the actual page index.
*/
- const sal_Int32 mnIndex;
+ sal_Int32 mnIndex;
+
+ Rectangle maBoundingBox;
+ VisualState maVisualState;
bool mbIsSelected : 1;
bool mbWasSelected : 1;
@@ -145,9 +149,6 @@ private:
bool mbIsCurrent : 1;
bool mbIsMouseOver : 1;
- Rectangle maBoundingBox;
-
- VisualState maVisualState;
// Do not use the copy constructor operator. It is not implemented.
PageDescriptor (const PageDescriptor& rDescriptor);
diff --git a/sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx b/sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx
index b8df8a6688f8..2a09fc047b80 100644
--- a/sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx
+++ b/sd/source/ui/slidesorter/inc/model/SlsVisualState.hxx
@@ -84,7 +84,7 @@ public:
void SetActiveButtonState (const sal_Int32 nIndex, const ButtonState eState);
ButtonState GetButtonState (const sal_Int32 nIndex);
- const sal_Int32 mnPageId; // For debugging
+ sal_Int32 mnPageId; // For debugging
private:
State meCurrentVisualState;
diff --git a/sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx b/sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx
index affe0824bd8c..b932134cf9a6 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsInsertAnimator.hxx
@@ -55,7 +55,14 @@ public:
*/
void SetInsertPosition (const InsertPosition& rInsertPosition);
- void Reset (void);
+ enum ResetMode { RM_Normal, RM_AbortAnimations };
+ /** Restore the normal position of all page objects.
+ @param eMode
+ This flag controls wether to start an animation that ends in the
+ normal positions of all slides (AM_Animated) or to restore the
+ normal positions immediately (AM_Immediate).
+ */
+ void Reset (const controller::Animator::AnimationMode eMode);
private:
class Implementation;
diff --git a/sd/source/ui/slidesorter/view/SlsIcons.hrc b/sd/source/ui/slidesorter/inc/view/SlsResource.hrc
index 22b4b398955c..e23c4e8a9a36 100644
--- a/sd/source/ui/slidesorter/view/SlsIcons.hrc
+++ b/sd/source/ui/slidesorter/inc/view/SlsResource.hrc
@@ -44,5 +44,7 @@
#define IMAGE_HIDE_SLIDE_OVERLAY 12
#define STRING_UNHIDE 13
+#define STRING_DRAG_AND_DROP_PAGES 14
+#define STRING_DRAG_AND_DROP_SLIDES 15
#endif
diff --git a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
index 1991babb0208..eefeda7c14d4 100644
--- a/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
+++ b/sd/source/ui/slidesorter/inc/view/SlsTheme.hxx
@@ -117,9 +117,12 @@ public:
enum IconType
{
- RawShadow,
- RawInsertShadow,
- HideSlideOverlay
+ Icon_RawShadow,
+ Icon_RawInsertShadow,
+ Icon_HideSlideOverlay,
+ Icon_StartPresentation,
+ Icon_ShowSlide,
+ Icon_DuplicateSlide
};
BitmapEx GetIcon (const IconType eType);
@@ -132,6 +135,14 @@ public:
sal_Int32 GetIntegerValue (const IntegerValueType eType) const;
void SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValue);
+ enum StringType
+ {
+ String_Unhide,
+ String_DragAndDropPages,
+ String_DragAndDropSlides
+ };
+ ::rtl::OUString GetString (const StringType eType) const;
+
private:
class GradientDescriptor
{
@@ -157,10 +168,16 @@ private:
BitmapEx maRawShadow;
BitmapEx maRawInsertShadow;
BitmapEx maHideSlideOverlay;
+ BitmapEx maStartPresentationIcon;
+ BitmapEx maShowSlideIcon;
+ BitmapEx maDuplicateSlideIcon;
::std::vector<ColorData> maColor;
sal_Int32 mnButtonCornerRadius;
sal_Int32 mnButtonMaxAlpha;
sal_Int32 mnButtonPaintType;
+ ::rtl::OUString msUnhide;
+ ::rtl::OUString msDragAndDropPages;
+ ::rtl::OUString msDragAndDropSlides;
GradientDescriptor& GetGradient (const GradientColorType eType);
};
diff --git a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
index e111d44d3a08..61befe64f80d 100644
--- a/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
+++ b/sd/source/ui/slidesorter/model/SlideSorterModel.cxx
@@ -65,6 +65,39 @@ namespace {
private:
Reference<drawing::XDrawPage> mxSlide;
};
+
+ bool CheckModel (const SlideSorterModel& rModel)
+ {
+ for (sal_Int32 nIndex=0,nCount=rModel.GetPageCount(); nIndex<nCount; ++nIndex)
+ {
+ SharedPageDescriptor pDescriptor (rModel.GetPageDescriptor(nIndex));
+ OSL_TRACE("%d %d %d %d %x",
+ nIndex,
+ pDescriptor->GetPageIndex(),
+ pDescriptor->GetVisualState().mnPageId,
+ FromCoreIndex(pDescriptor->GetPage()->GetPageNum()),
+ pDescriptor->GetPage());
+ if (nIndex != pDescriptor->GetPageIndex())
+ {
+ OSL_ASSERT(nIndex == pDescriptor->GetPageIndex());
+ return false;
+ }
+ if (nIndex != pDescriptor->GetVisualState().mnPageId)
+ {
+ OSL_ASSERT(nIndex == pDescriptor->GetVisualState().mnPageId);
+ return false;
+ }
+ /*
+ if (nIndex != FromCoreIndex(pDescriptor->GetPage()->GetPageNum()))
+ {
+ OSL_ASSERT(nIndex != FromCoreIndex(pDescriptor->GetPage()->GetPageNum()));
+ return false;
+ }
+ */
+ }
+
+ return true;
+ }
}
@@ -194,15 +227,7 @@ SharedPageDescriptor SlideSorterModel::GetPageDescriptor (
pDescriptor = maPageDescriptors[nPageIndex];
if (pDescriptor == NULL && bCreate && mxSlides.is())
{
- SdDrawDocument* pModel = const_cast<SlideSorterModel*>(this)->GetDocument();
- SdPage* pPage = NULL;
- if (pModel != NULL)
- {
- if (meEditMode == EM_PAGE)
- pPage = pModel->GetSdPage ((USHORT)nPageIndex, mePageKind);
- else
- pPage = pModel->GetMasterSdPage ((USHORT)nPageIndex, mePageKind);
- }
+ SdPage* pPage = GetPage(nPageIndex);
pDescriptor.reset(new PageDescriptor (
Reference<drawing::XDrawPage>(mxSlides->getByIndex(nPageIndex),UNO_QUERY),
pPage,
@@ -314,6 +339,18 @@ sal_Int32 SlideSorterModel::GetIndex (const SdrPage* pPage) const
+USHORT SlideSorterModel::GetCoreIndex (const sal_Int32 nIndex) const
+{
+ SharedPageDescriptor pDescriptor (GetPageDescriptor(nIndex));
+ if (pDescriptor)
+ return pDescriptor->GetPage()->GetPageNum();
+ else
+ return mxSlides->getCount()*2+1;
+}
+
+
+
+
/** For now this method uses a trivial algorithm: throw away all descriptors
and create them anew (on demand). The main problem that we are facing
when designing a better algorithm is that we can not compare pointers to
@@ -324,8 +361,37 @@ sal_Int32 SlideSorterModel::GetIndex (const SdrPage* pPage) const
void SlideSorterModel::Resync (void)
{
::osl::MutexGuard aGuard (maMutex);
- ClearDescriptorList ();
- AdaptSize();
+
+ // Check if document and this model really differ.
+ bool bIsUpToDate (true);
+ SdDrawDocument* pDocument = GetDocument();
+ if (pDocument!=NULL && maPageDescriptors.size()==pDocument->GetSdPageCount(mePageKind))
+ {
+ for (sal_Int32 nIndex=0,nCount=maPageDescriptors.size(); nIndex<nCount; ++nIndex)
+ {
+ if (maPageDescriptors[nIndex]
+ && maPageDescriptors[nIndex]->GetPage()
+ != GetPage(nIndex))
+ {
+ OSL_TRACE("page %d differs\n", nIndex);
+ bIsUpToDate = false;
+ break;
+ }
+ }
+ }
+ else
+ {
+ bIsUpToDate = false;
+ OSL_TRACE("models differ");
+ }
+
+ if ( ! bIsUpToDate)
+ {
+ SynchronizeDocumentSelection(); // Try to make the current selection persistent.
+ ClearDescriptorList ();
+ AdaptSize();
+ }
+ CheckModel(*this);
}
@@ -333,21 +399,26 @@ void SlideSorterModel::Resync (void)
void SlideSorterModel::ClearDescriptorList (void)
{
- ::osl::MutexGuard aGuard (maMutex);
+ DescriptorContainer aDescriptors;
+
+ {
+ ::osl::MutexGuard aGuard (maMutex);
+ aDescriptors.swap(maPageDescriptors);
+ }
- // Clear the cache of page descriptors.
- DescriptorContainer::iterator I;
- for (I=maPageDescriptors.begin(); I!=maPageDescriptors.end(); I++)
+ for (DescriptorContainer::iterator iDescriptor=aDescriptors.begin(), iEnd=aDescriptors.end();
+ iDescriptor!=iEnd;
+ ++iDescriptor)
{
- if (I->get() != NULL)
+ if (iDescriptor->get() != NULL)
{
- if ( ! I->unique())
+ if ( ! iDescriptor->unique())
{
- OSL_TRACE("SlideSorterModel::ClearDescriptorList: trying to delete page descriptor that is still used with count %d", I->use_count());
+ OSL_TRACE("SlideSorterModel::ClearDescriptorList: trying to delete page descriptor that is still used with count %d", iDescriptor->use_count());
// No assertion here because that can hang the office when
// opening a dialog from here.
}
- I->reset();
+ iDescriptor->reset();
}
}
}
@@ -547,4 +618,123 @@ Region SlideSorterModel::RestoreSelection (void)
}
+
+
+bool SlideSorterModel::NotifyPageEvent (const SdrPage* pSdrPage)
+{
+ ::osl::MutexGuard aGuard (maMutex);
+
+ SdPage* pPage = const_cast<SdPage*>(dynamic_cast<const SdPage*>(pSdrPage));
+ OSL_ASSERT(pPage!=NULL);
+ if (pPage == NULL)
+ return false;
+
+ // We are only interested in pages that are currently served by this
+ // model.
+ if (pPage->GetPageKind() != mePageKind)
+ return false;
+ if (pPage->IsMasterPage() != (meEditMode==EM_MASTERPAGE))
+ return false;
+
+ if (pPage->IsInserted())
+ InsertSlide(pPage);
+ else
+ DeleteSlide(pPage);
+ CheckModel(*this);
+
+ return true;
+}
+
+
+
+
+void SlideSorterModel::InsertSlide (SdPage* pPage)
+{
+ // Find the index at which to insert the given page.
+ USHORT nCoreIndex (pPage->GetPageNum());
+ sal_Int32 nIndex (FromCoreIndex(nCoreIndex));
+ if (pPage != GetPage(nIndex))
+ return;
+
+ // Check that the pages in the document before and after the given page
+ // are present in this model.
+ if (nIndex>0)
+ if (GetPage(nIndex-1) != GetPageDescriptor(nIndex-1)->GetPage())
+ return;
+ if (nIndex<maPageDescriptors.size()-1)
+ if (GetPage(nIndex+1) != GetPageDescriptor(nIndex)->GetPage())
+ return;
+
+ // Insert the given page at index nIndex
+ maPageDescriptors.insert(
+ maPageDescriptors.begin()+nIndex,
+ SharedPageDescriptor(
+ new PageDescriptor (
+ Reference<drawing::XDrawPage>(mxSlides->getByIndex(nIndex),UNO_QUERY),
+ pPage,
+ nIndex)));
+
+ // Update page indices.
+ UpdateIndices(nIndex+1);
+ OSL_TRACE("page inserted");
+}
+
+
+
+
+void SlideSorterModel::DeleteSlide (const SdPage* pPage)
+{
+ const sal_Int32 nIndex (GetIndex(pPage));
+ if (maPageDescriptors[nIndex])
+ if (maPageDescriptors[nIndex]->GetPage() != pPage)
+ return;
+
+ maPageDescriptors.erase(maPageDescriptors.begin()+nIndex);
+ UpdateIndices(nIndex);
+ OSL_TRACE("page removed");
+}
+
+
+
+
+void SlideSorterModel::UpdateIndices (const sal_Int32 nFirstIndex)
+{
+ for (sal_Int32 nDescriptorIndex=0,nCount=maPageDescriptors.size();
+ nDescriptorIndex<nCount;
+ ++nDescriptorIndex)
+ {
+ SharedPageDescriptor& rpDescriptor (maPageDescriptors[nDescriptorIndex]);
+ if (rpDescriptor)
+ if (nDescriptorIndex < nFirstIndex)
+ {
+ if (rpDescriptor->GetPageIndex()!=nDescriptorIndex)
+ {
+ OSL_ASSERT(rpDescriptor->GetPageIndex()==nDescriptorIndex);
+ }
+ }
+ else
+ {
+ rpDescriptor->SetPageIndex(nDescriptorIndex);
+ }
+ }
+}
+
+
+
+
+SdPage* SlideSorterModel::GetPage (const sal_Int32 nSdIndex) const
+{
+ SdDrawDocument* pModel = const_cast<SlideSorterModel*>(this)->GetDocument();
+ if (pModel != NULL)
+ {
+ if (meEditMode == EM_PAGE)
+ return pModel->GetSdPage ((USHORT)nSdIndex, mePageKind);
+ else
+ return pModel->GetMasterSdPage ((USHORT)nSdIndex, mePageKind);
+ }
+ else
+ return NULL;
+}
+
+
} } } // end of namespace ::sd::slidesorter::model
diff --git a/sd/source/ui/slidesorter/model/SlsPageDescriptor.cxx b/sd/source/ui/slidesorter/model/SlsPageDescriptor.cxx
index 69874abb7f6b..756c486f1e74 100644
--- a/sd/source/ui/slidesorter/model/SlsPageDescriptor.cxx
+++ b/sd/source/ui/slidesorter/model/SlsPageDescriptor.cxx
@@ -52,19 +52,21 @@ PageDescriptor::PageDescriptor (
mxPage(rxPage),
mpMasterPage(NULL),
mnIndex(nIndex),
+ maBoundingBox(),
+ maVisualState(nIndex),
mbIsSelected(false),
mbWasSelected(false),
mbIsVisible(false),
mbIsFocused(false),
mbIsCurrent(false),
- mbIsMouseOver(false),
- maBoundingBox(),
- maVisualState(nIndex)
+ mbIsMouseOver(false)
{
OSL_ASSERT(mpPage);
OSL_ASSERT(mpPage == SdPage::getImplementation(rxPage));
if (mpPage!=NULL && mpPage->TRG_HasMasterPage())
mpMasterPage = &mpPage->TRG_GetMasterPage();
+
+ GetCoreSelection();
}
@@ -101,6 +103,15 @@ sal_Int32 PageDescriptor::GetPageIndex (void) const
+void PageDescriptor::SetPageIndex (const sal_Int32 nNewIndex)
+{
+ mnIndex = nNewIndex;
+ maVisualState.mnPageId = nNewIndex;
+}
+
+
+
+
bool PageDescriptor::UpdateMasterPage (void)
{
const SdrPage* pMaster = NULL;
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 11b03fb3ff15..3212e8f74760 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -40,6 +40,7 @@
#include "controller/SlsCurrentSlideManager.hxx"
#include "controller/SlsSelectionManager.hxx"
#include "controller/SlsSelectionFunction.hxx"
+#include "controller/SlsProperties.hxx"
#include "view/SlideSorterView.hxx"
#include "view/SlsLayouter.hxx"
#include "model/SlideSorterModel.hxx"
@@ -303,12 +304,16 @@ SlideSorter& SlideSorterViewShell::GetSlideSorter (void) const
bool SlideSorterViewShell::RelocateToParentWindow (::Window* pParentWindow)
{
- OSL_ASSERT(mpSlideSorter.get()!=NULL);
+ OSL_ASSERT(mpSlideSorter);
+ if ( ! mpSlideSorter)
+ return false;
+
if (pParentWindow == NULL)
WriteFrameViewData();
const bool bSuccess (mpSlideSorter->RelocateToWindow(pParentWindow));
if (pParentWindow != NULL)
ReadFrameViewData(mpFrameView);
+
return bSuccess;
}
diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
index 41d671353be6..e69090f611b9 100644
--- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx
+++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx
@@ -175,17 +175,21 @@ SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter)
SetPageVisible (FALSE);
- // Register the background painter on level 0
- mpLayeredDevice->RegisterPainter(mpBackgroundPainter, 0);
+ // Register the background painter on level 1 to avoid the creation of a
+ // background buffer.
+ mpLayeredDevice->RegisterPainter(mpBackgroundPainter, 1);
- // Wrap a shared_ptr held wrapper around this view and register it as
+ // Wrap a shared_ptr-held-wrapper around this view and register it as
// painter at the layered device. There is no explicit destruction: in
// the SlideSorterView destructor the layered device is destroyed and
// with it the only reference to the wrapper which therefore is also
// destroyed.
- // The painter is placed on level 0, like the background painter, so
- // that it is buffered.
- mpLayeredDevice->RegisterPainter(SharedILayerPainter(new Painter(*this)), 0);
+ SharedILayerPainter pPainter (new Painter(*this));
+
+ // The painter is placed on level 1 to avoid buffering. This should be
+ // a little faster during animations because the previews are painted
+ // directly into the window, not via the buffer.
+ mpLayeredDevice->RegisterPainter(pPainter, 1);
}
@@ -370,6 +374,7 @@ void SlideSorterView::Resize (void)
if (bRearrangeSuccess)
{
Layout();
+ UpdatePageUnderMouse(false);
RequestRepaint();
}
}
@@ -438,7 +443,9 @@ void SlideSorterView::UpdateOrientation (void)
}
else
{
- OSL_ASSERT(pDockingWindow!=NULL);
+ // We are not placed in a docking window. One possible reason
+ // is that the slide sorter is temporarily into a cache and was
+ // reparented to a non-docking window.
SetOrientation(Layouter::GRID);
}
}
@@ -472,12 +479,20 @@ void SlideSorterView::Layout ()
// Iterate over all page objects and place them relative to the
// containing page.
+ sal_Int32 nIndex (0);
model::PageEnumeration aPageEnumeration (
model::PageEnumerationProvider::CreateAllPagesEnumeration(mrModel));
while (aPageEnumeration.HasMoreElements())
{
model::SharedPageDescriptor pDescriptor (aPageEnumeration.GetNextElement());
pDescriptor->SetBoundingBox(mpLayouter->GetPageObjectBox(pDescriptor->GetPageIndex()));
+ OSL_TRACE("%d %d(%d) : %d %d %d %d",
+ pDescriptor->GetPageIndex(), pDescriptor->GetVisualState().mnPageId, nIndex,
+ pDescriptor->GetBoundingBox().Left(),
+ pDescriptor->GetBoundingBox().Top(),
+ pDescriptor->GetBoundingBox().GetWidth(),
+ pDescriptor->GetBoundingBox().GetHeight());
+ ++nIndex;
}
GetPageObjectPainter()->NotifyResize();
@@ -599,11 +614,11 @@ void SlideSorterView::RequestRepaint (void)
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
- pWindow->Invalidate();
mpLayeredDevice->InvalidateAllLayers(
Rectangle(
pWindow->PixelToLogic(Point(0,0)),
pWindow->PixelToLogic(pWindow->GetSizePixel())));
+ pWindow->Invalidate();
}
}
@@ -623,8 +638,8 @@ void SlideSorterView::RequestRepaint (const Rectangle& rRepaintBox)
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
- pWindow->Invalidate(rRepaintBox);
mpLayeredDevice->InvalidateAllLayers(rRepaintBox);
+ pWindow->Invalidate(rRepaintBox);
}
}
@@ -635,8 +650,8 @@ void SlideSorterView::RequestRepaint (const Region& rRepaintRegion)
SharedSdWindow pWindow (mrSlideSorter.GetContentWindow());
if (pWindow)
{
- pWindow->Invalidate(rRepaintRegion);
mpLayeredDevice->InvalidateAllLayers(rRepaintRegion);
+ pWindow->Invalidate(rRepaintRegion);
}
}
@@ -684,6 +699,8 @@ void SlideSorterView::CompleteRedraw (
if (mnLockRedrawSmph == 0)
{
mrSlideSorter.GetContentWindow()->IncrementLockCount();
+ if (mpLayeredDevice->HandleMapModeChange())
+ DeterminePageObjectVisibilities();
mpLayeredDevice->Repaint(rPaintArea);
mrSlideSorter.GetContentWindow()->DecrementLockCount();
}
@@ -756,6 +773,8 @@ void SlideSorterView::ConfigurationChanged (
cache::PageCacheManager::Instance()->InvalidateAllCaches();
::sd::View::ConfigurationChanged(pBroadcaster, nHint);
+ RequestRepaint();
+
}
@@ -819,10 +838,14 @@ void SlideSorterView::UpdatePageUnderMouse (bool bAnimate)
if (pWindow && ! pWindow->IsMouseCaptured())
{
const Window::PointerState aPointerState (pWindow->GetPointerState());
- UpdatePageUnderMouse (
- aPointerState.maPos,
- (aPointerState.mnState & MOUSE_LEFT)!=0,
- bAnimate);
+ const Rectangle aWindowBox (pWindow->GetPosPixel(), pWindow->GetSizePixel());
+ if (aWindowBox.IsInside(aPointerState.maPos))
+ UpdatePageUnderMouse (
+ aPointerState.maPos,
+ (aPointerState.mnState & MOUSE_LEFT)!=0,
+ bAnimate);
+ else
+ SetPageUnderMouse(SharedPageDescriptor(),false);
}
}
@@ -951,21 +974,15 @@ bool SlideSorterView::SetState (
if ( ! bModified)
return false;
- switch(eState)
- {
- case PageDescriptor::ST_Visible:
- case PageDescriptor::ST_Selected:
- case PageDescriptor::ST_Focused:
- case PageDescriptor::ST_MouseOver:
- case PageDescriptor::ST_Current:
- case PageDescriptor::ST_Excluded:
- RequestRepaint(pDescriptor);
- break;
-
- case PageDescriptor::ST_WasSelected:
- // Ignore.
- break;
- }
+ // When the page object is not visible (i.e. not on the screen then
+ // nothing has to be painted.
+ if ( ! pDescriptor->HasState(PageDescriptor::ST_Visible))
+ return true;
+
+ // For most states a change of that state leads to visible difference
+ // and we have to request a repaint.
+ if (eState != PageDescriptor::ST_WasSelected)
+ RequestRepaint(pDescriptor);
// Fade in or out the buttons.
if (eState == PageDescriptor::ST_MouseOver)
@@ -1083,11 +1100,6 @@ SlideSorterView::DrawLock::~DrawLock (void)
mpWindow->Invalidate(mrView.maRedrawRegion);
mpWindow->Update();
}
- /*
- mrView.CompleteRedraw(
- mpWindow.get(),
- mrView.maRedrawRegion);
- */
}
diff --git a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
index 2ecf8eab6498..aaa8cf5d6d18 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertAnimator.cxx
@@ -77,7 +77,7 @@ public:
void UpdateOffsets(
const InsertPosition& rInsertPosition,
const view::Layouter& GetLayouter);
- void ResetOffsets (void);
+ void ResetOffsets (const controller::Animator::AnimationMode eMode);
/// Index of the row or column that this run represents.
sal_Int32 mnRunIndex;
@@ -134,9 +134,9 @@ public:
Implementation (SlideSorter& rSlideSorter);
virtual ~Implementation (void);
- void SetInsertPosition (const InsertPosition& rInsertPosition);
-
- void Reset (void);
+ void SetInsertPosition (
+ const InsertPosition& rInsertPosition,
+ const controller::Animator::AnimationMode eAnimationMode);
virtual void RemoveRun (PageObjectRun* pRun);
@@ -176,15 +176,15 @@ InsertAnimator::InsertAnimator (SlideSorter& rSlideSorter)
void InsertAnimator::SetInsertPosition (const InsertPosition& rInsertPosition)
{
- mpImplementation->SetInsertPosition(rInsertPosition);
+ mpImplementation->SetInsertPosition(rInsertPosition, controller::Animator::AM_Animated);
}
-void InsertAnimator::Reset (void)
+void InsertAnimator::Reset (const controller::Animator::AnimationMode eMode)
{
- mpImplementation->Reset();
+ mpImplementation->SetInsertPosition(InsertPosition(), eMode);
}
@@ -206,13 +206,15 @@ InsertAnimator::Implementation::Implementation (SlideSorter& rSlideSorter)
InsertAnimator::Implementation::~Implementation (void)
{
- Reset();
+ SetInsertPosition(InsertPosition(), controller::Animator::AM_Immediate);
}
-void InsertAnimator::Implementation::SetInsertPosition (const InsertPosition& rInsertPosition)
+void InsertAnimator::Implementation::SetInsertPosition (
+ const InsertPosition& rInsertPosition,
+ const controller::Animator::AnimationMode eMode)
{
if (maInsertPosition == rInsertPosition)
return;
@@ -227,7 +229,7 @@ void InsertAnimator::Implementation::SetInsertPosition (const InsertPosition& rI
{
if (pOldRun)
{
- pOldRun->ResetOffsets();
+ pOldRun->ResetOffsets(eMode);
maRuns.insert(pOldRun);
}
}
@@ -242,14 +244,6 @@ void InsertAnimator::Implementation::SetInsertPosition (const InsertPosition& rI
-void InsertAnimator::Implementation::Reset (void)
-{
- SetInsertPosition(InsertPosition());
-}
-
-
-
-
SharedPageObjectRun InsertAnimator::Implementation::GetRun (
view::Layouter& rLayouter,
const InsertPosition& rInsertPosition,
@@ -425,7 +419,7 @@ void PageObjectRun::UpdateOffsets(
-void PageObjectRun::ResetOffsets (void)
+void PageObjectRun::ResetOffsets (const controller::Animator::AnimationMode eMode)
{
mnLocalInsertIndex = -1;
const sal_Int32 nRunLength (mnEndIndex - mnStartIndex + 1);
@@ -434,10 +428,14 @@ void PageObjectRun::ResetOffsets (void)
{
model::SharedPageDescriptor pDescriptor(rModel.GetPageDescriptor(nIndex+mnStartIndex));
if (pDescriptor)
- maStartOffset[nIndex] = pDescriptor->GetVisualState().GetLocationOffset();
+ if (eMode == controller::Animator::AM_Animated)
+ maStartOffset[nIndex] = pDescriptor->GetVisualState().GetLocationOffset();
+ else
+ pDescriptor->GetVisualState().SetLocationOffset(Point(0,0));
maEndOffset[nIndex] = Point(0,0);
}
- RestartAnimation();
+ if (eMode == controller::Animator::AM_Animated)
+ RestartAnimation();
}
diff --git a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
index 52f9f915c5b2..3dfde5b0d83b 100644
--- a/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
+++ b/sd/source/ui/slidesorter/view/SlsInsertionIndicatorOverlay.cxx
@@ -79,7 +79,6 @@ namespace sd { namespace slidesorter { namespace view {
const static sal_Int32 gnShadowBorder = 3;
const static sal_Int32 gnSuperScaleFactor = 1;
-const static sal_Int32 gnAngle = 0; // measured in 10th of degrees
InsertionIndicatorOverlay::InsertionIndicatorOverlay (SlideSorter& rSlideSorter)
: mrSlideSorter(rSlideSorter),
@@ -89,7 +88,8 @@ InsertionIndicatorOverlay::InsertionIndicatorOverlay (SlideSorter& rSlideSorter)
maLocation(),
maIcon(),
maIconOffset(),
- mpShadowPainter(new FramePainter(mrSlideSorter.GetTheme()->GetIcon(Theme::RawInsertShadow)))
+ mpShadowPainter(
+ new FramePainter(mrSlideSorter.GetTheme()->GetIcon(Theme::Icon_RawInsertShadow)))
{
}
@@ -160,16 +160,6 @@ void InsertionIndicatorOverlay::Create (
*mrSlideSorter.GetContentWindow(),
0,
0);
- if (gnAngle != 0)
- {
- aIconSize = Size(
- RoundToInt(
- cos(gnAngle/1800.0*M_PI) * aIconSize.Width()
- + sin(gnAngle/1800.0*M_PI) * aIconSize.Height()),
- RoundToInt(
- sin(gnAngle/1800.0*M_PI) * aIconSize.Width()
- + cos(gnAngle/1800.0*M_PI) * aIconSize.Height()));
- }
aContent.SetOutputSizePixel(aIconSize);
aContent.SetFillColor();
@@ -241,16 +231,7 @@ Point InsertionIndicatorOverlay::PaintRepresentatives (
const Size aSuperSampleSize(
aPreviewSize.Width()*gnSuperScaleFactor,
aPreviewSize.Height()*gnSuperScaleFactor);
- if (gnAngle != 0)
- {
- aPreview.Scale(aSuperSampleSize, BMP_SCALE_INTERPOLATE);
- aPreview.Rotate(gnAngle, Color(128,0,0,255));
- aPreview.Scale(1.0/gnSuperScaleFactor,1.0/gnSuperScaleFactor, BMP_SCALE_INTERPOLATE);
- }
- else
- {
- aPreview.Scale(aPreviewSize, BMP_SCALE_INTERPOLATE);
- }
+ aPreview.Scale(aPreviewSize, BMP_SCALE_INTERPOLATE);
rContent.DrawBitmapEx(aPageOffset, aPreview);
// Tone down the bitmap. The further back the darker it becomes.
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
index cf69970bca57..f368dff59555 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.cxx
@@ -138,8 +138,8 @@ typedef ::boost::shared_ptr<Layer> SharedLayer;
class LayeredDevice::LayerContainer : public ::std::vector<SharedLayer>
{
public:
- LayerContainer (void) { OSL_TRACE("created layer container at %x", this); }
- ~LayerContainer (void) { OSL_TRACE("destroyed layer container at %x", this); }
+ LayerContainer (void) {}
+ ~LayerContainer (void) {}
};
@@ -153,7 +153,6 @@ LayeredDevice::LayeredDevice (const SharedSdWindow& rpTargetWindow)
mpBackBuffer(new VirtualDevice(*mpTargetWindow)),
maSavedMapMode(rpTargetWindow->GetMapMode())
{
- OSL_TRACE("layered device created at %x", this);
mpBackBuffer->SetOutputSizePixel(mpTargetWindow->GetSizePixel());
}
@@ -162,7 +161,6 @@ LayeredDevice::LayeredDevice (const SharedSdWindow& rpTargetWindow)
LayeredDevice::~LayeredDevice (void)
{
- OSL_TRACE("layered device destroyed at %x", this);
}
@@ -279,8 +277,6 @@ bool LayeredDevice::HasPainter (const sal_Int32 nLayer)
void LayeredDevice::Repaint (const Region& rRepaintRegion)
{
- HandleMapModeChange();
-
// Validate the contents of all layers (that have their own devices.)
::std::for_each(
mpLayers->begin(),
@@ -339,11 +335,11 @@ void LayeredDevice::Dispose (void)
-void LayeredDevice::HandleMapModeChange (void)
+bool LayeredDevice::HandleMapModeChange (void)
{
const MapMode& rMapMode (mpTargetWindow->GetMapMode());
if (maSavedMapMode == rMapMode)
- return;
+ return false;
const Rectangle aLogicWindowBox (
mpTargetWindow->PixelToLogic(Rectangle(Point(0,0), mpTargetWindow->GetSizePixel())));
@@ -352,10 +348,7 @@ void LayeredDevice::HandleMapModeChange (void)
|| maSavedMapMode.GetMapUnit() != rMapMode.GetMapUnit())
{
// When the scale has changed then we have to paint everything.
- ::std::for_each(
- mpLayers->begin(),
- mpLayers->end(),
- ::boost::bind(&Layer::InvalidateRectangle, _1, ::boost::cref(aLogicWindowBox)));
+ InvalidateAllLayers(aLogicWindowBox);
}
else if (maSavedMapMode.GetOrigin() != rMapMode.GetOrigin())
{
@@ -366,18 +359,34 @@ void LayeredDevice::HandleMapModeChange (void)
aLogicWindowBox.TopLeft(),
mpTargetWindow->PixelToLogic(Point(0,0), maSavedMapMode),
aLogicWindowBox.GetSize());
- InvalidateAllLayers(aLogicWindowBox);
+ OSL_TRACE("scrolling %d %d", aDelta.X(), aDelta.Y());
- /*
+ // Invalidate the area(s) that have been exposed.
const Rectangle aWindowBox (Point(0,0), mpTargetWindow->GetSizePixel());
- if (aDelta.X < 0)
- Invalidate(
- mpTargetWindow->PixelToLogic(
- aWindowBox.TopRight(),
- Point(mpTargetWindow->GetSizePixel().Right()X+aDelta.X,0)),
- mpTargetWindow->PixelToLogic(
- Point(mpTargetWindow->GetSizePixel().X+aDelta.X,0)),
- */
+ if (aDelta.Y() < 0)
+ InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
+ aWindowBox.Left(),
+ aWindowBox.Bottom()+aDelta.Y(),
+ aWindowBox.Right(),
+ aWindowBox.Bottom())));
+ else if (aDelta.Y() > 0)
+ InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
+ aWindowBox.Left(),
+ aWindowBox.Top(),
+ aWindowBox.Right(),
+ aWindowBox.Top()+aDelta.Y())));
+ if (aDelta.X() < 0)
+ InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
+ aWindowBox.Right()+aDelta.X(),
+ aWindowBox.Top(),
+ aWindowBox.Right(),
+ aWindowBox.Bottom())));
+ else if (aDelta.X() > 0)
+ InvalidateAllLayers(mpTargetWindow->PixelToLogic(Rectangle(
+ aWindowBox.Left(),
+ aWindowBox.Top(),
+ aWindowBox.Left()+aDelta.X(),
+ aWindowBox.Bottom())));
}
else
{
@@ -386,6 +395,8 @@ void LayeredDevice::HandleMapModeChange (void)
}
maSavedMapMode = rMapMode;
+
+ return true;
}
@@ -412,11 +423,15 @@ Layer::~Layer (void)
void Layer::Initialize (const SharedSdWindow& rpTargetWindow)
{
+#if 0
+ (void)rpTargetWindow;
+#else
if ( ! mpLayerDevice)
{
mpLayerDevice.reset(new VirtualDevice(*rpTargetWindow));
mpLayerDevice->SetOutputSizePixel(rpTargetWindow->GetSizePixel());
}
+#endif
}
@@ -424,6 +439,13 @@ void Layer::Initialize (const SharedSdWindow& rpTargetWindow)
void Layer::InvalidateRectangle (const Rectangle& rInvalidationBox)
{
+ /*
+ OSL_TRACE("invalidating layer %x %d %d %d %d", this,
+ rInvalidationBox.Left(),
+ rInvalidationBox.Top(),
+ rInvalidationBox.GetWidth(),
+ rInvalidationBox.GetHeight());
+ */
maInvalidationRegion.Union(rInvalidationBox);
}
@@ -442,16 +464,14 @@ void Layer::Validate (const MapMode& rMapMode)
{
if (mpLayerDevice && ! maInvalidationRegion.IsEmpty())
{
- mpLayerDevice->SetMapMode(rMapMode);
+ Region aRegion (maInvalidationRegion);
+ maInvalidationRegion.SetEmpty();
+ mpLayerDevice->SetMapMode(rMapMode);
ForAllRectangles(
- maInvalidationRegion,
+ aRegion,
::boost::bind(&Layer::ValidateRectangle, this, _1));
}
- // else nothing to do now. The painting is done in Repaint() directly
- // into the back buffer.
-
- maInvalidationRegion.SetEmpty();
}
@@ -461,9 +481,15 @@ void Layer::ValidateRectangle (const Rectangle& rBox)
{
if ( ! mpLayerDevice)
return;
-
+ /*
+ OSL_TRACE("validating layer %x %d %d %d %d", this,
+ rBox.Left(),
+ rBox.Top(),
+ rBox.GetWidth(),
+ rBox.GetHeight());
+ */
const Region aSavedClipRegion (mpLayerDevice->GetClipRegion());
- mpLayerDevice->SetClipRegion(Region(rBox));
+ mpLayerDevice->IntersectClipRegion(rBox);
for (::std::vector<SharedILayerPainter>::const_iterator
iPainter(maPainters.begin()),
@@ -508,7 +534,7 @@ void Layer::Resize (const Size& rSize)
if (mpLayerDevice)
{
mpLayerDevice->SetOutputSizePixel(rSize);
- maInvalidationRegion.Union(Rectangle(Point(0,0), rSize));
+ maInvalidationRegion = Rectangle(Point(0,0), rSize);
}
}
diff --git a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
index d67e0e99c473..85941c7b9739 100644
--- a/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
+++ b/sd/source/ui/slidesorter/view/SlsLayeredDevice.hxx
@@ -79,6 +79,7 @@ public:
bool HasPainter (const sal_Int32 nLayer);
+ bool HandleMapModeChange (void);
void Repaint (const Region& rRepaintRegion);
void Resize (void);
@@ -93,7 +94,6 @@ private:
MapMode maSavedMapMode;
void RepaintRectangle (const Rectangle& rRepaintRectangle);
- void HandleMapModeChange (void);
};
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
index 87d6b4b62d5c..ea660062ae5c 100644
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -78,11 +78,17 @@ public:
::boost::shared_ptr<PageObjectLayouter> mpPageObjectLayouter;
+ /** Specify how the gap between two page objects is associated with the
+ page objects.
+ */
enum GapMembership {
- GM_NONE,
- GM_PREVIOUS,
- GM_BOTH,
- GM_NEXT,
+ GM_NONE, // Gap is not associated with any page object.
+ GM_PREVIOUS, // The whole gap is associated with the previous page
+ // object (left or above the gap.)
+ GM_BOTH, // Half of the gap is associated with previous, half
+ // with the next page object.
+ GM_NEXT, // The whole gap is associated with the next page
+ // object (right or below the gap.)
GM_PAGE_BORDER
};
@@ -125,12 +131,7 @@ public:
When this flag is <TRUE/> then the area of borders and gaps are
interpreted as belonging to one of the columns.
@param eGapMembership
- Specifies to what column the gap areas belong. Here GM_NONE
- corresponds to bIncludeBordersAndGaps being <FALSE/>. When
- GM_BOTH is given then the left half is associated with the
- column at the left and the right half with the column to the
- right. Values of GM_PREVIOUS and GM_NEXT associate the whole
- gap area with the column to the left or right respectively.
+ Specifies to what column the gap areas belong.
*/
sal_Int32 GetColumnAtPosition (
sal_Int32 nXPosition,
@@ -192,7 +193,10 @@ public:
Range GetValidHorizontalSizeRange (void) const;
Range GetValidVerticalSizeRange (void) const;
- Rectangle GetPageObjectBox (
+ Range GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) const;
+ sal_Int32 GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const;
+
+ Rectangle GetPageObjectBox (
const sal_Int32 nIndex,
const bool bIncludeBorderAndGap = false) const;
@@ -448,9 +452,7 @@ sal_Int32 Layouter::GetColumn (const sal_Int32 nIndex) const
sal_Int32 Layouter::GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const
{
- const sal_Int32 nIndex (nRow * mpImplementation->mnColumnCount + nColumn);
- OSL_ASSERT(nIndex>=0);
- return ::std::min(nIndex, mpImplementation->mnPageCount-1);
+ return mpImplementation->GetIndex(nRow,nColumn);
}
@@ -528,17 +530,7 @@ Range Layouter::GetValidVerticalSizeRange (void) const
Range Layouter::GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) const
{
- const sal_Int32 nRow0 (mpImplementation->GetRowAtPosition (
- aVisibleArea.Top(),
- true,
- Implementation::GM_BOTH));
- const sal_Int32 nRow1 (mpImplementation->GetRowAtPosition (
- aVisibleArea.Bottom(),
- true,
- Implementation::GM_BOTH));
- return Range(
- ::std::min(nRow0*mpImplementation->mnColumnCount, mpImplementation->mnPageCount-1),
- ::std::min((nRow1+1)*mpImplementation->mnColumnCount-1, mpImplementation->mnPageCount-1));
+ return mpImplementation->GetRangeOfVisiblePageObjects(aVisibleArea);
}
@@ -559,10 +551,7 @@ sal_Int32 Layouter::GetIndexAtPoint (
bIncludePageBorders,
bIncludePageBorders ? Implementation::GM_PAGE_BORDER : Implementation::GM_NONE));
- if (nRow >= 0 && nColumn >= 0)
- return nRow * mpImplementation->mnColumnCount + nColumn;
- else
- return -1;
+ return mpImplementation->GetIndex(nRow,nColumn);
}
@@ -1006,6 +995,21 @@ Range Layouter::Implementation::GetValidVerticalSizeRange (void) const
+Range Layouter::Implementation::GetRangeOfVisiblePageObjects (const Rectangle& aVisibleArea) const
+{
+ const sal_Int32 nRow0 (GetRowAtPosition(aVisibleArea.Top(), true, GM_NEXT));
+ const sal_Int32 nCol0 (GetColumnAtPosition(aVisibleArea.Left(),true, GM_NEXT));
+ const sal_Int32 nRow1 (GetRowAtPosition(aVisibleArea.Bottom(), true, GM_PREVIOUS));
+ const sal_Int32 nCol1 (GetColumnAtPosition(aVisibleArea.Right(), true, GM_PREVIOUS));
+
+ // When start and end lie in different rows then the range may include
+ // slides outside (left or right of) the given area.
+ return Range(GetIndex(nRow0,nCol0), GetIndex(nRow1,nCol1));
+}
+
+
+
+
Size Layouter::Implementation::GetTargetSize (
const Size& rWindowSize,
const Size& rPreviewModelSize,
@@ -1056,6 +1060,20 @@ Size Layouter::Implementation::GetTargetSize (
+sal_Int32 Layouter::Implementation::GetIndex (const sal_Int32 nRow, const sal_Int32 nColumn) const
+{
+ if (nRow >= 0 && nColumn >= 0)
+ {
+ const sal_Int32 nIndex (nRow * mnColumnCount + nColumn);
+ return ::std::min(nIndex, mnPageCount-1);
+ }
+ else
+ return -1;
+}
+
+
+
+
Rectangle Layouter::Implementation::GetPageObjectBox (
const sal_Int32 nIndex,
const bool bIncludeBorderAndGap) const
diff --git a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
index 164613fdf998..b0c1bfc5828b 100644
--- a/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsPageObjectPainter.cxx
@@ -42,7 +42,6 @@
#include "view/SlsPageObjectLayouter.hxx"
#include "view/SlsLayouter.hxx"
#include "view/SlsTheme.hxx"
-#include "SlsIcons.hxx"
#include "SlsFramePainter.hxx"
#include "cache/SlsPageCache.hxx"
#include "controller/SlsProperties.hxx"
@@ -142,24 +141,16 @@ PageObjectPainter::PageObjectPainter (
mpProperties(rSlideSorter.GetProperties()),
mpTheme(rSlideSorter.GetTheme()),
mpPageNumberFont(Theme::GetFont(Theme::PageNumberFont, *rSlideSorter.GetContentWindow())),
- maStartPresentationIcon(),
- maShowSlideIcon(),
- maNewSlideIcon(),
- mpShadowPainter(),
+ maStartPresentationIcon(mpTheme->GetIcon(Theme::Icon_StartPresentation)),
+ maShowSlideIcon(mpTheme->GetIcon(Theme::Icon_ShowSlide)),
+ maNewSlideIcon(mpTheme->GetIcon(Theme::Icon_DuplicateSlide)),
+ mpShadowPainter(new FramePainter(mpTheme->GetIcon(Theme::Icon_RawShadow))),
maNormalBackground(),
maSelectionBackground(),
maFocusedSelectionBackground(),
maMouseOverBackground(),
- msUnhideString()
+ msUnhideString(mpTheme->GetString(Theme::String_Unhide))
{
- LocalResource aResource (IMG_ICONS);
-
- maStartPresentationIcon = Image(SdResId(IMAGE_PRESENTATION)).GetBitmapEx();
- maShowSlideIcon = Image(SdResId(IMAGE_SHOW_SLIDE)).GetBitmapEx();
- maNewSlideIcon = Image(SdResId(IMAGE_NEW_SLIDE)).GetBitmapEx();
- msUnhideString = String(SdResId(STRING_UNHIDE));
-
- mpShadowPainter.reset(new FramePainter(mpTheme->GetIcon(Theme::RawShadow)));
}
@@ -296,7 +287,7 @@ void PageObjectPainter::PaintPreview (
if (rpDescriptor->GetVisualState().GetCurrentVisualState()
== model::VisualState::VS_Excluded)
{
- const BitmapEx aOverlay (mpTheme->GetIcon(Theme::HideSlideOverlay));
+ const BitmapEx aOverlay (mpTheme->GetIcon(Theme::Icon_HideSlideOverlay));
const sal_Int32 nIconWidth (aOverlay.GetSizePixel().Width());
const sal_Int32 nIconHeight (aOverlay.GetSizePixel().Height());
if (nIconWidth>0 && nIconHeight>0)
diff --git a/sd/source/ui/slidesorter/view/SlsIcons.hxx b/sd/source/ui/slidesorter/view/SlsResource.hxx
index 63c4de22584a..5195e3475c0e 100644
--- a/sd/source/ui/slidesorter/view/SlsIcons.hxx
+++ b/sd/source/ui/slidesorter/view/SlsResource.hxx
@@ -29,10 +29,10 @@
*
************************************************************************/
-#ifndef SD_SLIDESORTER_ICONS_HXX
-#define SD_SLIDESORTER_ICONS_HXX
+#ifndef SD_SLIDESORTER_RESOURCE_HXX
+#define SD_SLIDESORTER_RESOURCE_HXX
-#include "SlsIcons.hrc"
+#include "view/SlsResource.hrc"
#include "sdresid.hxx"
#include <tools/rc.hxx>
diff --git a/sd/source/ui/slidesorter/view/SlsIcons.src b/sd/source/ui/slidesorter/view/SlsResource.src
index 4bee98eb0559..87e6c02356f2 100644
--- a/sd/source/ui/slidesorter/view/SlsIcons.src
+++ b/sd/source/ui/slidesorter/view/SlsResource.src
@@ -28,7 +28,7 @@
*
************************************************************************/
-#include "SlsIcons.hrc"
+#include "view/SlsResource.hrc"
Resource IMG_ICONS
{
@@ -66,4 +66,14 @@ Resource IMG_ICONS
{
Text [ en-US ] = "unhide" ;
};
+
+ String STRING_DRAG_AND_DROP_PAGES
+ {
+ Text [ en-US ] = "Drag and Drop Pages" ;
+ };
+
+ String STRING_DRAG_AND_DROP_SLIDES
+ {
+ Text [ en-US ] = "Drag and Drop Slides" ;
+ };
};
diff --git a/sd/source/ui/slidesorter/view/SlsTheme.cxx b/sd/source/ui/slidesorter/view/SlsTheme.cxx
index 173997cea22f..3ffc1bba7230 100644
--- a/sd/source/ui/slidesorter/view/SlsTheme.cxx
+++ b/sd/source/ui/slidesorter/view/SlsTheme.cxx
@@ -30,7 +30,7 @@
************************************************************************/
#include "view/SlsTheme.hxx"
-#include "SlsIcons.hxx"
+#include "SlsResource.hxx"
#include "controller/SlsProperties.hxx"
#include "sdresid.hxx"
#include <tools/color.hxx>
@@ -92,16 +92,30 @@ Theme::Theme (const ::boost::shared_ptr<controller::Properties>& rpProperties)
maMouseOverGradient(),
maRawShadow(),
maRawInsertShadow(),
+ maHideSlideOverlay(),
+ maStartPresentationIcon(),
+ maShowSlideIcon(),
+ maDuplicateSlideIcon(),
maColor(PreviewBorder+1),
mnButtonCornerRadius(3),
mnButtonMaxAlpha(255 * 20/100),
- mnButtonPaintType(0)
+ mnButtonPaintType(0),
+ msUnhide(),
+ msDragAndDropPages(),
+ msDragAndDropSlides()
+
{
LocalResource aResource (IMG_ICONS);
maRawShadow = Image(SdResId(IMAGE_SHADOW)).GetBitmapEx();
maRawInsertShadow = Image(SdResId(IMAGE_INSERT_SHADOW)).GetBitmapEx();
maHideSlideOverlay = Image(SdResId(IMAGE_HIDE_SLIDE_OVERLAY)).GetBitmapEx();
+ maStartPresentationIcon = Image(SdResId(IMAGE_PRESENTATION)).GetBitmapEx();
+ maShowSlideIcon = Image(SdResId(IMAGE_SHOW_SLIDE)).GetBitmapEx();
+ maDuplicateSlideIcon = Image(SdResId(IMAGE_NEW_SLIDE)).GetBitmapEx();
+ msUnhide = String(SdResId(STRING_UNHIDE));
+ msDragAndDropPages = String(SdResId(STRING_DRAG_AND_DROP_PAGES));
+ msDragAndDropSlides = String(SdResId(STRING_DRAG_AND_DROP_SLIDES));
maColor.resize(PreviewBorder+1);
maColor[Background] = maBackgroundColor;
@@ -301,15 +315,24 @@ BitmapEx Theme::GetIcon (const IconType eType)
{
switch (eType)
{
- case RawShadow:
+ case Icon_RawShadow:
return maRawShadow;
- case RawInsertShadow:
+ case Icon_RawInsertShadow:
return maRawInsertShadow;
- case HideSlideOverlay:
+ case Icon_HideSlideOverlay:
return maHideSlideOverlay;
+ case Icon_StartPresentation:
+ return maStartPresentationIcon;
+
+ case Icon_ShowSlide:
+ return maShowSlideIcon;
+
+ case Icon_DuplicateSlide:
+ return maDuplicateSlideIcon;
+
default:
return BitmapEx();
}
@@ -363,6 +386,20 @@ void Theme::SetIntegerValue (const IntegerValueType eType, const sal_Int32 nValu
+::rtl::OUString Theme::GetString (const StringType eType) const
+{
+ switch (eType)
+ {
+ case String_Unhide: return msUnhide;
+ case String_DragAndDropPages: return msDragAndDropPages;
+ case String_DragAndDropSlides: return msDragAndDropSlides;
+ default: return ::rtl::OUString();
+ }
+}
+
+
+
+
Theme::GradientDescriptor& Theme::GetGradient (const GradientColorType eType)
{
switch(eType)
diff --git a/sd/source/ui/slidesorter/view/makefile.mk b/sd/source/ui/slidesorter/view/makefile.mk
index 212817d8410f..cd63b6738801 100644
--- a/sd/source/ui/slidesorter/view/makefile.mk
+++ b/sd/source/ui/slidesorter/view/makefile.mk
@@ -46,7 +46,7 @@ IMGLST_SRS=$(SRS)$/$(TARGET).srs
SRS1NAME=$(TARGET)
SRC1FILES = \
- SlsIcons.src
+ SlsResource.src
SLOFILES = \
$(SLO)$/SlideSorterView.obj \
diff --git a/sd/source/ui/unoidl/SdUnoSlideView.cxx b/sd/source/ui/unoidl/SdUnoSlideView.cxx
index 34121dc5ac4b..ae3a24178396 100644
--- a/sd/source/ui/unoidl/SdUnoSlideView.cxx
+++ b/sd/source/ui/unoidl/SdUnoSlideView.cxx
@@ -32,7 +32,6 @@
#include "SlideSorter.hxx"
#include "controller/SlideSorterController.hxx"
#include "controller/SlsPageSelector.hxx"
-#include "controller/SlsSelectionManager.hxx"
#include "model/SlsPageEnumerationProvider.hxx"
#include "model/SlideSorterModel.hxx"
#include "model/SlsPageDescriptor.hxx"
@@ -99,7 +98,6 @@ sal_Bool SAL_CALL SdUnoSlideView::select (const Any& aSelection)
}
}
}
- rSlideSorterController.GetSelectionManager()->MakeSelectionVisible();
return bOk;
}