icon-themes/galaxy/cmd/lc_movepagedown.png |binary icon-themes/galaxy/cmd/lc_movepagefirst.png |binary icon-themes/galaxy/cmd/lc_movepagelast.png |binary icon-themes/galaxy/cmd/lc_movepageup.png |binary icon-themes/galaxy/cmd/sc_movepagedown.png |binary icon-themes/galaxy/cmd/sc_movepagefirst.png |binary icon-themes/galaxy/cmd/sc_movepagelast.png |binary icon-themes/galaxy/cmd/sc_movepageup.png |binary icon-themes/tango/cmd/lc_movepagedown.png |binary icon-themes/tango/cmd/lc_movepagefirst.png |binary icon-themes/tango/cmd/lc_movepagelast.png |binary icon-themes/tango/cmd/lc_movepageup.png |binary icon-themes/tango/cmd/sc_movepagedown.png |binary icon-themes/tango/cmd/sc_movepagefirst.png |binary icon-themes/tango/cmd/sc_movepagelast.png |binary icon-themes/tango/cmd/sc_movepageup.png |binary officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu | 88 ++++ sd/Library_sd.mk | 1 sd/inc/app.hrc | 10 sd/sdi/SlideSorterController.sdi | 20 + sd/sdi/_drvwsh.sdi | 21 + sd/sdi/sdraw.sdi | 193 +++++++++ sd/source/core/drawdoc2.cxx | 4 sd/source/ui/func/funavig.cxx | 156 +++++++ sd/source/ui/inc/DrawViewShell.hxx | 14 sd/source/ui/inc/SlideSorterViewShell.hxx | 16 sd/source/ui/inc/funavig.hxx | 50 ++ sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 200 ++++++++++ sd/source/ui/view/drviewsa.cxx | 61 +++ sd/uiconfig/sdraw/toolbar/standardbar.xml | 10 sd/uiconfig/simpress/toolbar/standardbar.xml | 10 31 files changed, 852 insertions(+), 2 deletions(-)
New commits: commit d18afcc9125f427c0e6693900d24f894068d7e56 Author: Philippe Jung <phil.j...@free.fr> Date: Wed Jun 10 16:09:23 2015 +0200 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.j...@free.fr> Tested-by: Philippe Jung <phil.j...@free.fr> diff --git a/icon-themes/galaxy/cmd/lc_movepagedown.png b/icon-themes/galaxy/cmd/lc_movepagedown.png new file mode 100644 index 0000000..e7b6799 Binary files /dev/null and b/icon-themes/galaxy/cmd/lc_movepagedown.png differ diff --git a/icon-themes/galaxy/cmd/lc_movepagefirst.png b/icon-themes/galaxy/cmd/lc_movepagefirst.png new file mode 100644 index 0000000..8fbb73b Binary files /dev/null and b/icon-themes/galaxy/cmd/lc_movepagefirst.png differ diff --git a/icon-themes/galaxy/cmd/lc_movepagelast.png b/icon-themes/galaxy/cmd/lc_movepagelast.png new file mode 100644 index 0000000..28559a9 Binary files /dev/null and b/icon-themes/galaxy/cmd/lc_movepagelast.png differ diff --git a/icon-themes/galaxy/cmd/lc_movepageup.png b/icon-themes/galaxy/cmd/lc_movepageup.png new file mode 100644 index 0000000..c241105 Binary files /dev/null and b/icon-themes/galaxy/cmd/lc_movepageup.png differ diff --git a/icon-themes/galaxy/cmd/sc_movepagedown.png b/icon-themes/galaxy/cmd/sc_movepagedown.png new file mode 100644 index 0000000..b8b13e3 Binary files /dev/null and b/icon-themes/galaxy/cmd/sc_movepagedown.png differ diff --git a/icon-themes/galaxy/cmd/sc_movepagefirst.png b/icon-themes/galaxy/cmd/sc_movepagefirst.png new file mode 100644 index 0000000..13e5a53 Binary files /dev/null and b/icon-themes/galaxy/cmd/sc_movepagefirst.png differ diff --git a/icon-themes/galaxy/cmd/sc_movepagelast.png b/icon-themes/galaxy/cmd/sc_movepagelast.png new file mode 100644 index 0000000..892b67c Binary files /dev/null and b/icon-themes/galaxy/cmd/sc_movepagelast.png differ diff --git a/icon-themes/galaxy/cmd/sc_movepageup.png b/icon-themes/galaxy/cmd/sc_movepageup.png new file mode 100644 index 0000000..11218f7 Binary files /dev/null and b/icon-themes/galaxy/cmd/sc_movepageup.png differ diff --git a/icon-themes/tango/cmd/lc_movepagedown.png b/icon-themes/tango/cmd/lc_movepagedown.png new file mode 100644 index 0000000..e7b6799 Binary files /dev/null and b/icon-themes/tango/cmd/lc_movepagedown.png differ diff --git a/icon-themes/tango/cmd/lc_movepagefirst.png b/icon-themes/tango/cmd/lc_movepagefirst.png new file mode 100644 index 0000000..8fbb73b Binary files /dev/null and b/icon-themes/tango/cmd/lc_movepagefirst.png differ diff --git a/icon-themes/tango/cmd/lc_movepagelast.png b/icon-themes/tango/cmd/lc_movepagelast.png new file mode 100644 index 0000000..28559a9 Binary files /dev/null and b/icon-themes/tango/cmd/lc_movepagelast.png differ diff --git a/icon-themes/tango/cmd/lc_movepageup.png b/icon-themes/tango/cmd/lc_movepageup.png new file mode 100644 index 0000000..c241105 Binary files /dev/null and b/icon-themes/tango/cmd/lc_movepageup.png differ diff --git a/icon-themes/tango/cmd/sc_movepagedown.png b/icon-themes/tango/cmd/sc_movepagedown.png new file mode 100644 index 0000000..b8b13e3 Binary files /dev/null and b/icon-themes/tango/cmd/sc_movepagedown.png differ diff --git a/icon-themes/tango/cmd/sc_movepagefirst.png b/icon-themes/tango/cmd/sc_movepagefirst.png new file mode 100644 index 0000000..13e5a53 Binary files /dev/null and b/icon-themes/tango/cmd/sc_movepagefirst.png differ diff --git a/icon-themes/tango/cmd/sc_movepagelast.png b/icon-themes/tango/cmd/sc_movepagelast.png new file mode 100644 index 0000000..892b67c Binary files /dev/null and b/icon-themes/tango/cmd/sc_movepagelast.png differ diff --git a/icon-themes/tango/cmd/sc_movepageup.png b/icon-themes/tango/cmd/sc_movepageup.png new file mode 100644 index 0000000..11218f7 Binary files /dev/null and b/icon-themes/tango/cmd/sc_movepageup.png differ diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu index 523b3d4..7e6b005 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu @@ -1940,6 +1940,94 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:FirstPage" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">First Page</value> + </prop> + <prop oor:name="ContextLabel" oor:type="xs:string"> + <value xml:lang="en-US">Go to the first page</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:PreviousPage" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Previous Page</value> + </prop> + <prop oor:name="ContextLabel" oor:type="xs:string"> + <value xml:lang="en-US">Go to the previous page</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:NextPage" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Next Page</value> + </prop> + <prop oor:name="ContextLabel" oor:type="xs:string"> + <value xml:lang="en-US">Go to the next page</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:LastPage" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Last Page</value> + </prop> + <prop oor:name="ContextLabel" oor:type="xs:string"> + <value xml:lang="en-US">Go to the last page</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:MovePageFirst" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Move Page First</value> + </prop> + <prop oor:name="ContextLabel" oor:type="xs:string"> + <value xml:lang="en-US">Move the selected pages to the first position</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:MovePageUp" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Move Page Up</value> + </prop> + <prop oor:name="ContextLabel" oor:type="xs:string"> + <value xml:lang="en-US">Move the selected pages up</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:MovePageDown" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Move Page Down</value> + </prop> + <prop oor:name="ContextLabel" oor:type="xs:string"> + <value xml:lang="en-US">Move the selected pages down</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:MovePageLast" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Move Page Last</value> + </prop> + <prop oor:name="ContextLabel" oor:type="xs:string"> + <value xml:lang="en-US">Move the selected pages to the last position</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> </node> </node> </oor:component-data> diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index 2afcf9b..cf99782 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 747a95d..4e1306c 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 4c5787a..5008e17 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 263a8ed..0b5469bf 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 7297c1f..34996c0 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 eb83ade..df354a9 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 0000000..1c28b93 --- /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 405e7af..d706392 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 fe03910..cd590d8 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 0000000..59d04e5 --- /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 bd2d1ae..4adcc1f 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 d7c1a55..6385349 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 5a6de30..4b424b4 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 d4d2edc..8dbc6ee 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> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits