summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorPhilippe Jung <phil.jung@free.fr>2015-06-10 16:09:23 +0200
committerPhilippe Jung <phil.jung@free.fr>2015-06-16 15:08:24 +0000
commitd18afcc9125f427c0e6693900d24f894068d7e56 (patch)
treeb3e7e9dd50d08f2d79fedf5d822b0a5c89c1b6ca /sd
parent4fb65441709d02946f4b24da7839dba7ecffff1e (diff)
tdf#91909 Uno commands for slide navigation and sorting
The following change adds the following uno commands to draw and impress. Commands are in standard toolbar and not visible by default. NextPage: go to the next page PreviousPage: go to the previous page FirstPage: go to the first page LastPage: go the the last page MovePageUp: Moves the current selection above the page preceding the selection. MovePageDown: Moves the current selection below the page following the selection. MovePageTop: Moves the selection to the top. MovePageBottom: Moves the current selection to the bottom. Change-Id: I2dbd923f14fd9901fb513c58b51bc7ab91ad0a83 Reviewed-on: https://gerrit.libreoffice.org/16211 Reviewed-by: Philippe Jung <phil.jung@free.fr> Tested-by: Philippe Jung <phil.jung@free.fr>
Diffstat (limited to 'sd')
-rw-r--r--sd/Library_sd.mk1
-rw-r--r--sd/inc/app.hrc10
-rw-r--r--sd/sdi/SlideSorterController.sdi20
-rw-r--r--sd/sdi/_drvwsh.sdi21
-rw-r--r--sd/sdi/sdraw.sdi193
-rw-r--r--sd/source/core/drawdoc2.cxx4
-rw-r--r--sd/source/ui/func/funavig.cxx156
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx14
-rw-r--r--sd/source/ui/inc/SlideSorterViewShell.hxx16
-rw-r--r--sd/source/ui/inc/funavig.hxx50
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx200
-rw-r--r--sd/source/ui/view/drviewsa.cxx61
-rw-r--r--sd/uiconfig/sdraw/toolbar/standardbar.xml10
-rw-r--r--sd/uiconfig/simpress/toolbar/standardbar.xml10
14 files changed, 764 insertions, 2 deletions
diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk
index 2afcf9bd39d7..cf99782cd1da 100644
--- a/sd/Library_sd.mk
+++ b/sd/Library_sd.mk
@@ -283,6 +283,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/func/fulink \
sd/source/ui/func/fumeasur \
sd/source/ui/func/fumorph \
+ sd/source/ui/func/funavig \
sd/source/ui/func/fuoaprms \
sd/source/ui/func/fuolbull \
sd/source/ui/func/fuoltext \
diff --git a/sd/inc/app.hrc b/sd/inc/app.hrc
index 747a95dba19b..4e1306c773aa 100644
--- a/sd/inc/app.hrc
+++ b/sd/inc/app.hrc
@@ -108,6 +108,16 @@
#define SID_DRAW_MEASURELINE (SID_SD_START+48)
#define SID_STARTAPP (SID_SD_START+49)
#define SID_MASTERPAGE (SID_SD_START+50)
+// Navigation between slides
+#define SID_GO_TO_NEXT_PAGE (SID_SD_START+51)
+#define SID_GO_TO_PREVIOUS_PAGE (SID_SD_START+52)
+#define SID_GO_TO_FIRST_PAGE (SID_SD_START+53)
+#define SID_GO_TO_LAST_PAGE (SID_SD_START+54)
+// Slide sorting
+#define SID_MOVE_PAGE_UP (SID_SD_START+55)
+#define SID_MOVE_PAGE_DOWN (SID_SD_START+56)
+#define SID_MOVE_PAGE_FIRST (SID_SD_START+57)
+#define SID_MOVE_PAGE_LAST (SID_SD_START+58)
// FREE
#define SID_TOOL_CONNECTOR (SID_SD_START+61)
#define SID_ANIMATION_OBJECTS (SID_SD_START+62)
diff --git a/sd/sdi/SlideSorterController.sdi b/sd/sdi/SlideSorterController.sdi
index 4c5787a6f2a8..5008e17c1cea 100644
--- a/sd/sdi/SlideSorterController.sdi
+++ b/sd/sdi/SlideSorterController.sdi
@@ -298,6 +298,26 @@ interface SlideSorterView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
+ SID_MOVE_PAGE_UP
+ [
+ ExecMethod = ExecMovePageUp ;
+ StateMethod = GetStateMovePageUp ;
+ ]
+ SID_MOVE_PAGE_DOWN
+ [
+ ExecMethod = ExecMovePageDown ;
+ StateMethod = GetStateMovePageDown ;
+ ]
+ SID_MOVE_PAGE_FIRST
+ [
+ ExecMethod = ExecMovePageFirst ;
+ StateMethod = GetStateMovePageFirst ;
+ ]
+ SID_MOVE_PAGE_LAST
+ [
+ ExecMethod = ExecMovePageLast ;
+ StateMethod = GetStateMovePageLast ;
+ ]
}
shell SlideSorterController
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 263a8ed20e21..0b5469bfc660 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -2776,4 +2776,25 @@ interface DrawView
ExecMethod = FuTemporary ;
StateMethod = GetMenuState ;
]
+ SID_GO_TO_NEXT_PAGE
+ [
+ ExecMethod = ExecGoToNextPage ;
+ StateMethod = GetStateGoToNextPage ;
+ ]
+ SID_GO_TO_PREVIOUS_PAGE
+ [
+ ExecMethod = ExecGoToPreviousPage ;
+ StateMethod = GetStateGoToPreviousPage ;
+ ]
+ SID_GO_TO_FIRST_PAGE
+ [
+ ExecMethod = ExecGoToFirstPage ;
+ StateMethod = GetStateGoToFirstPage ;
+ ]
+ SID_GO_TO_LAST_PAGE
+ [
+ ExecMethod = ExecGoToLastPage ;
+ StateMethod = GetStateGoToLastPage ;
+ ]
+
}
diff --git a/sd/sdi/sdraw.sdi b/sd/sdi/sdraw.sdi
index 7297c1f217aa..34996c0170a5 100644
--- a/sd/sdi/sdraw.sdi
+++ b/sd/sdi/sdraw.sdi
@@ -7016,3 +7016,196 @@ SfxVoidItem ShowNextLevel SID_SHOW_NEXT_LEVEL
ToolBoxConfig = FALSE,
GroupId = GID_OPTIONS;
]
+
+SfxVoidItem NextPage SID_GO_TO_NEXT_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+SfxVoidItem PreviousPage SID_GO_TO_PREVIOUS_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+SfxVoidItem FirstPage SID_GO_TO_FIRST_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+SfxVoidItem LastPage SID_GO_TO_LAST_PAGE
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+SfxVoidItem MovePageUp SID_MOVE_PAGE_UP
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+SfxVoidItem MovePageDown SID_MOVE_PAGE_DOWN
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+SfxVoidItem MovePageFirst SID_MOVE_PAGE_FIRST
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
+SfxVoidItem MovePageLast SID_MOVE_PAGE_LAST
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = TRUE,
+ ReadOnlyDoc = FALSE,
+ Toggle = FALSE,
+ Container = FALSE,
+ RecordAbsolute = FALSE,
+ RecordPerSet;
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_MODIFY;
+]
+
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index eb83adecc860..df354a97740e 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -703,12 +703,14 @@ bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage)
{
pPage = GetSdPage(nPage, PK_STANDARD);
- if (pPage->IsSelected())
+ if (pPage->IsSelected()) {
aPageList.push_back(pPage);
+ }
}
// If necessary, look backwards, until we find a page that wasn't selected
nPage = nTargetPage;
+
if (nPage != (sal_uInt16)-1)
{
pPage = GetSdPage(nPage, PK_STANDARD);
diff --git a/sd/source/ui/func/funavig.cxx b/sd/source/ui/func/funavig.cxx
new file mode 100644
index 000000000000..1c28b93d7bce
--- /dev/null
+++ b/sd/source/ui/func/funavig.cxx
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "funavig.hxx"
+#include <sfx2/viewfrm.hxx>
+
+#include "app.hrc"
+#include "sdpage.hxx"
+#include <sfx2/bindings.hxx>
+#include <sfx2/request.hxx>
+#include "drawdoc.hxx"
+#include "DrawViewShell.hxx"
+#include "ViewShell.hxx"
+#include "slideshow.hxx"
+
+namespace sd {
+
+TYPEINIT1( FuNavigation, FuPoor );
+
+FuNavigation::FuNavigation (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq)
+ : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
+{
+}
+
+rtl::Reference<FuPoor> FuNavigation::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
+{
+ rtl::Reference<FuPoor> xFunc( new FuNavigation( pViewSh, pWin, pView, pDoc, rReq ) );
+ xFunc->DoExecute(rReq);
+ return xFunc;
+}
+
+void FuNavigation::DoExecute( SfxRequest& rReq )
+{
+ bool bSlideShow = SlideShow::IsRunning( mpViewShell->GetViewShellBase() );
+
+ switch ( rReq.GetSlot() )
+ {
+ case SID_GO_TO_FIRST_PAGE:
+ {
+ if (!mpView->IsTextEdit()
+ && mpViewShell->ISA(DrawViewShell)
+ && !bSlideShow)
+ {
+ // jump to first page
+ static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(0);
+ }
+ }
+ break;
+
+ case SID_GO_TO_PREVIOUS_PAGE:
+ {
+ if(mpViewShell->ISA(DrawViewShell) && !bSlideShow)
+ {
+ // With no modifier pressed we move to the previous
+ // slide.
+ mpView->SdrEndTextEdit();
+
+ // Previous page.
+ SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
+
+ if (nSdPage > 0)
+ {
+ // Switch the page and send events regarding
+ // deactivation the old page and activating the new
+ // one.
+ TabControl& rPageTabControl =
+ static_cast<DrawViewShell*>(mpViewShell)
+ ->GetPageTabControl();
+ if (rPageTabControl.IsReallyShown())
+ rPageTabControl.SendDeactivatePageEvent ();
+ static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nSdPage - 1);
+ if (rPageTabControl.IsReallyShown())
+ rPageTabControl.SendActivatePageEvent ();
+ }
+ }
+ }
+ break;
+
+ case SID_GO_TO_NEXT_PAGE:
+ {
+ if(mpViewShell->ISA(DrawViewShell) && !bSlideShow)
+ {
+ // With no modifier pressed we move to the next slide.
+ mpView->SdrEndTextEdit();
+
+ // Next page.
+ SdPage* pPage = static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
+
+ if (nSdPage < mpDoc->GetSdPageCount(pPage->GetPageKind()) - 1)
+ {
+ // Switch the page and send events regarding
+ // deactivation the old page and activating the new
+ // one.
+ TabControl& rPageTabControl =
+ static_cast<DrawViewShell*>(mpViewShell)->GetPageTabControl();
+ if (rPageTabControl.IsReallyShown())
+ rPageTabControl.SendDeactivatePageEvent ();
+ static_cast<DrawViewShell*>(mpViewShell)->SwitchPage(nSdPage + 1);
+ if (rPageTabControl.IsReallyShown())
+ rPageTabControl.SendActivatePageEvent ();
+ }
+ }
+ }
+ break;
+
+ case SID_GO_TO_LAST_PAGE:
+ {
+ if (!mpView->IsTextEdit()
+ && mpViewShell->ISA(DrawViewShell)
+ && !bSlideShow)
+ {
+ // jump to last page
+ SdPage* pPage =
+ static_cast<DrawViewShell*>(mpViewShell)->GetActualPage();
+ static_cast<DrawViewShell*>(mpViewShell)
+ ->SwitchPage(mpDoc->GetSdPageCount(
+ pPage->GetPageKind()) - 1);
+ }
+ }
+ break;
+ }
+ // Refresh toolbar icons
+ SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
+ rBindings.Invalidate(SID_GO_TO_FIRST_PAGE);
+ rBindings.Invalidate(SID_GO_TO_PREVIOUS_PAGE);
+ rBindings.Invalidate(SID_GO_TO_NEXT_PAGE);
+ rBindings.Invalidate(SID_GO_TO_LAST_PAGE);
+}
+
+
+} // end of namespace sd
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 405e7af90876..d706392fb55b 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -226,7 +226,19 @@ public:
void AttrExec (SfxRequest& rReq);
void AttrState (SfxItemSet& rSet);
- void ExecChar(SfxRequest& rReq);
+ void ExecGoToNextPage (SfxRequest& rReq);
+ void GetStateGoToNextPage (SfxItemSet& rSet);
+
+ void ExecGoToPreviousPage (SfxRequest& rReq);
+ void GetStateGoToPreviousPage (SfxItemSet& rSet);
+
+ void ExecGoToFirstPage (SfxRequest& rReq);
+ void GetStateGoToFirstPage (SfxItemSet& rSet);
+
+ void ExecGoToLastPage (SfxRequest& rReq);
+ void GetStateGoToLastPage (SfxItemSet& rSet);
+
+ void ExecChar(SfxRequest& rReq);
void ExecuteAnnotation (SfxRequest& rRequest);
void GetAnnotationState (SfxItemSet& rItemSet);
diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx
index fe039105d026..cd590d8869b9 100644
--- a/sd/source/ui/inc/SlideSorterViewShell.hxx
+++ b/sd/source/ui/inc/SlideSorterViewShell.hxx
@@ -115,6 +115,20 @@ public:
virtual void Activate (bool IsMDIActivate) SAL_OVERRIDE;
virtual void Deactivate (bool IsMDIActivate) SAL_OVERRIDE;
+ /** Move slides up and down. Mainly uno commands. */
+ void ExecMovePageUp (SfxRequest& rReq);
+ void GetStateMovePageUp (SfxItemSet& rSet);
+
+ void ExecMovePageDown (SfxRequest& rReq);
+ void GetStateMovePageDown (SfxItemSet& rSet);
+
+ void ExecMovePageFirst (SfxRequest& rReq);
+ void GetStateMovePageFirst (SfxItemSet& rSet);
+
+ void ExecMovePageLast (SfxRequest& rReq);
+ void GetStateMovePageLast (SfxItemSet& rSet);
+
+
//===== Drag and Drop =====================================================
void StartDrag (
@@ -203,6 +217,8 @@ private:
calls UpdateScrollBars(false).
*/
virtual void UpdateScrollBars() SAL_OVERRIDE;
+
+ void PostMoveSlidesActions(const ::boost::shared_ptr<SlideSorterViewShell::PageSelection> &rpSelection);
};
typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection;
diff --git a/sd/source/ui/inc/funavig.hxx b/sd/source/ui/inc/funavig.hxx
new file mode 100644
index 000000000000..59d04e55f000
--- /dev/null
+++ b/sd/source/ui/inc/funavig.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SD_SOURCE_UI_INC_FUNAVIG_HXX
+#define INCLUDED_SD_SOURCE_UI_INC_FUNAVIG_HXX
+
+#include "fupoor.hxx"
+
+namespace sd {
+
+class FuNavigation
+ : public FuPoor
+{
+public:
+ TYPEINFO_OVERRIDE();
+
+ static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
+
+ virtual void DoExecute( SfxRequest& rReq ) SAL_OVERRIDE;
+
+private:
+ FuNavigation (
+ ViewShell* pViewSh,
+ ::sd::Window* pWin,
+ ::sd::View* pView,
+ SdDrawDocument* pDoc,
+ SfxRequest& rReq);
+};
+
+} // end of namespace sd
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index bd2d1aee49ef..4adcc1ffdcd4 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -706,6 +706,206 @@ void SlideSorterViewShell::RemoveSelectionChangeListener (
mpSlideSorter->GetController().GetSelectionManager()->RemoveSelectionChangeListener(rCallback);
}
+void SlideSorterViewShell::ExecMovePageFirst (SfxRequest& /*rReq*/)
+{
+ // SdDrawDocument MovePages is based on SdPage IsSelected, so
+ // transfer the SlideSorter selection to SdPages (*it)
+ ::boost::shared_ptr<SlideSorterViewShell::PageSelection> pSelection ( GetPageSelection() );
+ for (auto it = pSelection->begin(); it != pSelection->end() ; ++it ) {
+ GetDoc()->SetSelected(*it, true);
+ }
+
+ // Moves selected pages after page -1
+ GetDoc()->MovePages( (sal_uInt16) -1 );
+
+ PostMoveSlidesActions(pSelection);
+}
+
+void SlideSorterViewShell::GetStateMovePageFirst (SfxItemSet& rSet)
+{
+ if ( ! IsMainViewShell())
+ {
+ ::boost::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell();
+ if (pMainViewShell.get() != NULL && pMainViewShell->ISA(DrawViewShell))
+ {
+ DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get());
+ if (pDrawViewShell != NULL && pDrawViewShell->GetPageKind() == PK_HANDOUT)
+ {
+ rSet.DisableItem( SID_MOVE_PAGE_FIRST );
+ rSet.DisableItem( SID_MOVE_PAGE_UP );
+ return;
+ }
+ }
+ }
+
+ sal_uInt16 firstSelectedPageNo = SAL_MAX_UINT16;
+ sal_uInt16 pageNo;
+ ::boost::shared_ptr<SlideSorterViewShell::PageSelection> pSelection ( GetPageSelection() );
+ for (auto it = pSelection->begin(); it != pSelection->end() ; ++it ) {
+ // Check page number
+ pageNo = (*it)->GetPageNum();
+ if (pageNo < firstSelectedPageNo) firstSelectedPageNo = pageNo;
+ }
+ // Now compute human page number from internal page number
+ firstSelectedPageNo = (firstSelectedPageNo - 1) / 2;
+
+ if (firstSelectedPageNo == 0)
+ {
+ rSet.DisableItem( SID_MOVE_PAGE_FIRST );
+ rSet.DisableItem( SID_MOVE_PAGE_UP );
+ }
+}
+
+void SlideSorterViewShell::ExecMovePageUp (SfxRequest& /*rReq*/)
+{
+ sal_uInt16 firstSelectedPageNo = SAL_MAX_UINT16;
+ sal_uInt16 pageNo;
+ // SdDrawDocument MovePages is based on SdPage IsSelected, so
+ // transfer the SlideSorter selection to SdPages (*it)
+ ::boost::shared_ptr<SlideSorterViewShell::PageSelection> pSelection ( GetPageSelection() );
+ for (auto it = pSelection->begin(); it != pSelection->end() ; ++it ) {
+ // Check page number
+ pageNo = (*it)->GetPageNum();
+ if (pageNo < firstSelectedPageNo) firstSelectedPageNo = pageNo;
+ GetDoc()->SetSelected(*it, true);
+
+ }
+ // Now compute human page number from internal page number
+ firstSelectedPageNo = (firstSelectedPageNo - 1) / 2;
+
+ if (firstSelectedPageNo == 0)
+ return;
+
+ // Move pages before firstSelectedPageNo - 1 (so after firstSelectedPageNo - 2),
+ // remembering that -1 means at first, which is good.
+ GetDoc()->MovePages( firstSelectedPageNo - 2 );
+
+ PostMoveSlidesActions(pSelection);
+}
+
+void SlideSorterViewShell::GetStateMovePageUp (SfxItemSet& rSet)
+{
+ GetStateMovePageFirst(rSet);
+}
+
+void SlideSorterViewShell::ExecMovePageDown (SfxRequest& /*rReq*/)
+{
+ sal_uInt16 lastSelectedPageNo = 0;
+ sal_uInt16 pageNo;
+ // SdDrawDocument MovePages is based on SdPage IsSelected, so
+ // transfer the SlideSorter selection to SdPages (*it)
+ ::boost::shared_ptr<SlideSorterViewShell::PageSelection> pSelection ( GetPageSelection() );
+ for (auto it = pSelection->begin(); it != pSelection->end() ; ++it )
+ {
+ // Check page number
+ pageNo = (*it)->GetPageNum();
+ if (pageNo > lastSelectedPageNo) lastSelectedPageNo = pageNo;
+ GetDoc()->SetSelected(*it, true);
+ }
+
+ // Get page number of the last page
+ sal_uInt16 nNoOfPages = GetDoc()->GetSdPageCount(PK_STANDARD);
+
+ // Now compute human page number from internal page number
+ lastSelectedPageNo = (lastSelectedPageNo - 1) / 2;
+ if (lastSelectedPageNo == nNoOfPages - 1)
+ return;
+
+ // Move to position after lastSelectedPageNo
+ GetDoc()->MovePages( lastSelectedPageNo + 1 );
+
+ PostMoveSlidesActions(pSelection);
+}
+
+void SlideSorterViewShell::GetStateMovePageDown (SfxItemSet& rSet)
+{
+ GetStateMovePageLast( rSet );
+}
+
+void SlideSorterViewShell::ExecMovePageLast (SfxRequest& /*rReq*/)
+{
+ // SdDrawDocument MovePages is based on SdPage IsSelected, so
+ // transfer the SlideSorter selection to SdPages (*it)
+ ::boost::shared_ptr<SlideSorterViewShell::PageSelection> pSelection ( GetPageSelection() );
+ for (auto it = pSelection->begin(); it != pSelection->end() ; ++it ) {
+ GetDoc()->SetSelected(*it, true);
+ }
+
+ // Get page number of the last page
+ sal_uInt16 nNoOfPages = GetDoc()->GetSdPageCount(PK_STANDARD);
+
+ // Move to position after last page No (=Number of pages - 1)
+ GetDoc()->MovePages( nNoOfPages - 1 );
+
+ PostMoveSlidesActions(pSelection);
+}
+
+void SlideSorterViewShell::GetStateMovePageLast (SfxItemSet& rSet)
+{
+ ::boost::shared_ptr<ViewShell> pMainViewShell = GetViewShellBase().GetMainViewShell();
+ if (pMainViewShell.get() != NULL && pMainViewShell->ISA(DrawViewShell))
+ {
+ DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>(pMainViewShell.get());
+ if (pDrawViewShell != NULL && pDrawViewShell->GetPageKind() == PK_HANDOUT)
+ {
+ rSet.DisableItem( SID_MOVE_PAGE_LAST );
+ rSet.DisableItem( SID_MOVE_PAGE_DOWN );
+ return;
+ }
+ }
+
+ sal_uInt16 lastSelectedPageNo = 0;
+ sal_uInt16 pageNo;
+ // SdDrawDocument MovePages is based on SdPage IsSelected, so
+ // transfer the SlideSorter selection to SdPages (*it)
+ ::boost::shared_ptr<SlideSorterViewShell::PageSelection> pSelection ( GetPageSelection() );
+ for (auto it = pSelection->begin(); it != pSelection->end() ; ++it )
+ {
+ // Check page number
+ pageNo = (*it)->GetPageNum();
+ if (pageNo > lastSelectedPageNo) lastSelectedPageNo = pageNo;
+ GetDoc()->SetSelected(*it, true);
+ }
+
+ // Get page number of the last page
+ sal_uInt16 nNoOfPages = GetDoc()->GetSdPageCount(PK_STANDARD);
+
+ // Now compute human page number from internal page number
+ lastSelectedPageNo = (lastSelectedPageNo - 1) / 2;
+ if (lastSelectedPageNo == nNoOfPages - 1)
+ {
+ rSet.DisableItem( SID_MOVE_PAGE_LAST );
+ rSet.DisableItem( SID_MOVE_PAGE_DOWN );
+ }
+}
+
+void SlideSorterViewShell::PostMoveSlidesActions(const ::boost::shared_ptr<SlideSorterViewShell::PageSelection> &rpSelection)
+{
+ sal_uInt16 nNoOfPages = GetDoc()->GetSdPageCount(PK_STANDARD);
+ for (sal_uInt16 nPage = 0; nPage < nNoOfPages; nPage++)
+ {
+ SdPage* pPage = GetDoc()->GetSdPage(nPage, PK_STANDARD);
+ GetDoc()->SetSelected(pPage, false);
+ }
+
+ mpSlideSorter->GetController().GetPageSelector().DeselectAllPages();
+ ::std::vector<SdPage*>::iterator iPage;
+ for (iPage=rpSelection->begin();
+ iPage!=rpSelection->end();
+ ++iPage)
+ {
+ mpSlideSorter->GetController().GetPageSelector().SelectPage(*iPage);
+ }
+
+ // Refresh toolbar icons
+ SfxBindings& rBindings = GetViewFrame()->GetBindings();
+ rBindings.Invalidate(SID_MOVE_PAGE_FIRST);
+ rBindings.Invalidate(SID_MOVE_PAGE_UP);
+ rBindings.Invalidate(SID_MOVE_PAGE_DOWN);
+ rBindings.Invalidate(SID_MOVE_PAGE_LAST);
+
+}
+
} } // end of namespace ::sd::slidesorter
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index d7c1a55d1dc1..63853496a2da 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -59,6 +59,7 @@
#include "Window.hxx"
#include "fupoor.hxx"
#include "fusel.hxx"
+#include "funavig.hxx"
#include "drawview.hxx"
#include "SdUnoDrawView.hxx"
#include "ViewShellBase.hxx"
@@ -825,6 +826,66 @@ void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet )
eViewType));
}
+void DrawViewShell::ExecGoToNextPage (SfxRequest& rReq)
+{
+ SetCurrentFunction( FuNavigation::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ Cancel();
+}
+
+void DrawViewShell::GetStateGoToNextPage (SfxItemSet& rSet)
+{
+ SdPage* pPage = GetActualPage();
+ sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
+ sal_uInt16 totalPages = GetDoc()->GetSdPageCount(pPage->GetPageKind());
+ if (nSdPage + 1 >= totalPages)
+ rSet.DisableItem( SID_GO_TO_NEXT_PAGE );
+}
+
+void DrawViewShell::ExecGoToPreviousPage (SfxRequest& rReq)
+{
+ SetCurrentFunction( FuNavigation::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ Cancel();
+}
+
+void DrawViewShell::GetStateGoToPreviousPage (SfxItemSet& rSet)
+{
+ SdPage* pPage = GetActualPage();
+ sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
+ if (nSdPage == 0)
+ rSet.DisableItem( SID_GO_TO_PREVIOUS_PAGE );
+}
+
+
+void DrawViewShell::ExecGoToFirstPage (SfxRequest& rReq)
+{
+ SetCurrentFunction( FuNavigation::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ Cancel();
+}
+
+void DrawViewShell::GetStateGoToFirstPage (SfxItemSet& rSet)
+{
+ SdPage* pPage = GetActualPage();
+ sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
+ if (nSdPage == 0)
+ rSet.DisableItem( SID_GO_TO_FIRST_PAGE );
+}
+
+void DrawViewShell::ExecGoToLastPage (SfxRequest& rReq)
+{
+ SetCurrentFunction( FuNavigation::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq) );
+ Cancel();
+}
+
+void DrawViewShell::GetStateGoToLastPage (SfxItemSet& rSet)
+{
+ SdPage* pPage = GetActualPage();
+ sal_uInt16 nSdPage = (pPage->GetPageNum() - 1) / 2;
+ sal_uInt16 totalPages = GetDoc()->GetSdPageCount(pPage->GetPageKind());
+ if (nSdPage + 1 >= totalPages)
+ rSet.DisableItem( SID_GO_TO_LAST_PAGE );
+}
+
+
} // end of namespace sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/uiconfig/sdraw/toolbar/standardbar.xml b/sd/uiconfig/sdraw/toolbar/standardbar.xml
index 5a6de30926da..4b424b4dd200 100644
--- a/sd/uiconfig/sdraw/toolbar/standardbar.xml
+++ b/sd/uiconfig/sdraw/toolbar/standardbar.xml
@@ -73,4 +73,14 @@
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:HelpIndex" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:ExtendedHelp" toolbar:visible="false"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FirstPage" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:PreviousPage" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:NextPage" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:LastPage" toolbar:visible="false"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:MovePageFirst" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:MovePageUp" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:MovePageDown" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:MovePageLast" toolbar:visible="false"/>
</toolbar:toolbar>
diff --git a/sd/uiconfig/simpress/toolbar/standardbar.xml b/sd/uiconfig/simpress/toolbar/standardbar.xml
index d4d2edc0a0a4..8dbc6ee20cd2 100644
--- a/sd/uiconfig/simpress/toolbar/standardbar.xml
+++ b/sd/uiconfig/simpress/toolbar/standardbar.xml
@@ -63,4 +63,14 @@
<toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:Presentation" toolbar:helpid="10157"/>
<toolbar:toolbaritem xlink:href=".uno:PresentationCurrentSlide"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:FirstPage" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:PreviousPage" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:NextPage" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:LastPage" toolbar:visible="false"/>
+ <toolbar:toolbarseparator/>
+ <toolbar:toolbaritem xlink:href=".uno:MovePageFirst" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:MovePageUp" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:MovePageDown" toolbar:visible="false"/>
+ <toolbar:toolbaritem xlink:href=".uno:MovePageLast" toolbar:visible="false"/>
</toolbar:toolbar>