Kaydet (Commit) d18afcc9 authored tarafından Philippe Jung's avatar Philippe Jung

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/16211Reviewed-by: 's avatarPhilippe Jung <phil.jung@free.fr>
Tested-by: 's avatarPhilippe Jung <phil.jung@free.fr>
üst 4fb65441
...@@ -1940,6 +1940,94 @@ ...@@ -1940,6 +1940,94 @@
<value>1</value> <value>1</value>
</prop> </prop>
</node> </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>
</node> </node>
</oor:component-data> </oor:component-data>
...@@ -283,6 +283,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\ ...@@ -283,6 +283,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
sd/source/ui/func/fulink \ sd/source/ui/func/fulink \
sd/source/ui/func/fumeasur \ sd/source/ui/func/fumeasur \
sd/source/ui/func/fumorph \ sd/source/ui/func/fumorph \
sd/source/ui/func/funavig \
sd/source/ui/func/fuoaprms \ sd/source/ui/func/fuoaprms \
sd/source/ui/func/fuolbull \ sd/source/ui/func/fuolbull \
sd/source/ui/func/fuoltext \ sd/source/ui/func/fuoltext \
......
...@@ -108,6 +108,16 @@ ...@@ -108,6 +108,16 @@
#define SID_DRAW_MEASURELINE (SID_SD_START+48) #define SID_DRAW_MEASURELINE (SID_SD_START+48)
#define SID_STARTAPP (SID_SD_START+49) #define SID_STARTAPP (SID_SD_START+49)
#define SID_MASTERPAGE (SID_SD_START+50) #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 // FREE
#define SID_TOOL_CONNECTOR (SID_SD_START+61) #define SID_TOOL_CONNECTOR (SID_SD_START+61)
#define SID_ANIMATION_OBJECTS (SID_SD_START+62) #define SID_ANIMATION_OBJECTS (SID_SD_START+62)
......
...@@ -298,6 +298,26 @@ interface SlideSorterView ...@@ -298,6 +298,26 @@ interface SlideSorterView
ExecMethod = FuTemporary ; ExecMethod = FuTemporary ;
StateMethod = GetMenuState ; 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 shell SlideSorterController
......
...@@ -2776,4 +2776,25 @@ interface DrawView ...@@ -2776,4 +2776,25 @@ interface DrawView
ExecMethod = FuTemporary ; ExecMethod = FuTemporary ;
StateMethod = GetMenuState ; 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 ;
]
} }
...@@ -7016,3 +7016,196 @@ SfxVoidItem ShowNextLevel SID_SHOW_NEXT_LEVEL ...@@ -7016,3 +7016,196 @@ SfxVoidItem ShowNextLevel SID_SHOW_NEXT_LEVEL
ToolBoxConfig = FALSE, ToolBoxConfig = FALSE,
GroupId = GID_OPTIONS; 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;
]
...@@ -703,12 +703,14 @@ bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage) ...@@ -703,12 +703,14 @@ bool SdDrawDocument::MovePages(sal_uInt16 nTargetPage)
{ {
pPage = GetSdPage(nPage, PK_STANDARD); pPage = GetSdPage(nPage, PK_STANDARD);
if (pPage->IsSelected()) if (pPage->IsSelected()) {
aPageList.push_back(pPage); aPageList.push_back(pPage);
}
} }
// If necessary, look backwards, until we find a page that wasn't selected // If necessary, look backwards, until we find a page that wasn't selected
nPage = nTargetPage; nPage = nTargetPage;
if (nPage != (sal_uInt16)-1) if (nPage != (sal_uInt16)-1)
{ {
pPage = GetSdPage(nPage, PK_STANDARD); pPage = GetSdPage(nPage, PK_STANDARD);
......
/* -*- 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: */
...@@ -226,7 +226,19 @@ public: ...@@ -226,7 +226,19 @@ public:
void AttrExec (SfxRequest& rReq); void AttrExec (SfxRequest& rReq);
void AttrState (SfxItemSet& rSet); 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 ExecuteAnnotation (SfxRequest& rRequest);
void GetAnnotationState (SfxItemSet& rItemSet); void GetAnnotationState (SfxItemSet& rItemSet);
......
...@@ -115,6 +115,20 @@ public: ...@@ -115,6 +115,20 @@ public:
virtual void Activate (bool IsMDIActivate) SAL_OVERRIDE; virtual void Activate (bool IsMDIActivate) SAL_OVERRIDE;
virtual void Deactivate (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 ===================================================== //===== Drag and Drop =====================================================
void StartDrag ( void StartDrag (
...@@ -203,6 +217,8 @@ private: ...@@ -203,6 +217,8 @@ private:
calls UpdateScrollBars(false). calls UpdateScrollBars(false).
*/ */
virtual void UpdateScrollBars() SAL_OVERRIDE; virtual void UpdateScrollBars() SAL_OVERRIDE;
void PostMoveSlidesActions(const ::boost::shared_ptr<SlideSorterViewShell::PageSelection> &rpSelection);
}; };
typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection; typedef ::boost::shared_ptr<SlideSorterViewShell::PageSelection> SharedPageSelection;
......
/* -*- 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: */
...@@ -706,6 +706,206 @@ void SlideSorterViewShell::RemoveSelectionChangeListener ( ...@@ -706,6 +706,206 @@ void SlideSorterViewShell::RemoveSelectionChangeListener (
mpSlideSorter->GetController().GetSelectionManager()->RemoveSelectionChangeListener(rCallback); 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 } } // end of namespace ::sd::slidesorter
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
#include "Window.hxx" #include "Window.hxx"
#include "fupoor.hxx" #include "fupoor.hxx"
#include "fusel.hxx" #include "fusel.hxx"
#include "funavig.hxx"
#include "drawview.hxx" #include "drawview.hxx"
#include "SdUnoDrawView.hxx" #include "SdUnoDrawView.hxx"
#include "ViewShellBase.hxx" #include "ViewShellBase.hxx"
...@@ -825,6 +826,66 @@ void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet ) ...@@ -825,6 +826,66 @@ void DrawViewShell::GetAnnotationState (SfxItemSet& rItemSet )
eViewType)); 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 } // end of namespace sd
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -73,4 +73,14 @@ ...@@ -73,4 +73,14 @@
<toolbar:toolbarseparator/> <toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:HelpIndex" toolbar:visible="false"/> <toolbar:toolbaritem xlink:href=".uno:HelpIndex" toolbar:visible="false"/>
<toolbar:toolbaritem xlink:href=".uno:ExtendedHelp" 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> </toolbar:toolbar>
...@@ -63,4 +63,14 @@ ...@@ -63,4 +63,14 @@
<toolbar:toolbarseparator/> <toolbar:toolbarseparator/>
<toolbar:toolbaritem xlink:href=".uno:Presentation" toolbar:helpid="10157"/> <toolbar:toolbaritem xlink:href=".uno:Presentation" toolbar:helpid="10157"/>
<toolbar:toolbaritem xlink:href=".uno:PresentationCurrentSlide"/> <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> </toolbar:toolbar>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment