summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorAkshayWarrier <aksmen121@gmail.com>2024-02-02 02:18:24 +0530
committerJim Raykowski <raykowj@gmail.com>2024-02-10 02:05:55 +0100
commitace21b4b2537a3cf2301fca2ac6f78d0612e911f (patch)
tree487ea76fce8226574fa97f587b2e798df15db155 /sd
parent9af4b5254cbe6a6770ebe78ba14074266b05471e (diff)
tdf#159372 svx: Add goto dialog
Adds a goto page/slide dialog for Impress and Draw similar to Writer. To avoid duplicating code and ui, the dialog is created in svx/ and used in other modules. The old goto dialog in Writer has now been replaced with this dialog. Change-Id: I28f819f0d0734fb2bb08a7b99a628217ef66dba9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162913 Tested-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org> Tested-by: Jenkins Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/strings.hrc2
-rw-r--r--sd/sdi/_drvwsh.sdi5
-rw-r--r--sd/source/ui/func/funavig.cxx27
-rw-r--r--sd/source/ui/inc/DrawViewShell.hxx3
-rw-r--r--sd/source/ui/inc/SlideSorterViewShell.hxx2
-rw-r--r--sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx16
-rw-r--r--sd/source/ui/view/drviews3.cxx7
-rw-r--r--sd/source/ui/view/drviewsa.cxx11
-rw-r--r--sd/uiconfig/sdraw/menubar/menubar.xml1
-rw-r--r--sd/uiconfig/simpress/menubar/menubar.xml1
10 files changed, 73 insertions, 2 deletions
diff --git a/sd/inc/strings.hrc b/sd/inc/strings.hrc
index d449ccf01cbe..08a5bb7cc8ce 100644
--- a/sd/inc/strings.hrc
+++ b/sd/inc/strings.hrc
@@ -138,6 +138,8 @@
#define STR_CLICK_ACTION_NEXTPAGE NC_("STR_CLICK_ACTION_NEXTPAGE", "Go to next slide")
#define STR_CLICK_ACTION_FIRSTPAGE NC_("STR_CLICK_ACTION_FIRSTPAGE", "Go to first slide")
#define STR_CLICK_ACTION_LASTPAGE NC_("STR_CLICK_ACTION_LASTPAGE", "Go to last slide")
+#define STR_GOTO_PAGE_DLG_TITLE NC_("STR_GOTO_PAGE_DLG_TITLE", "Go to Page")
+#define STR_GOTO_SLIDE_DLG_TITLE NC_("STR_GOTO_SLIDE_DLG_TITLE", "Go to Slide")
#define STR_CLICK_ACTION_BOOKMARK NC_("STR_CLICK_ACTION_BOOKMARK", "Go to page or object")
#define STR_CLICK_ACTION_DOCUMENT NC_("STR_CLICK_ACTION_DOCUMENT", "Go to document")
#define STR_CLICK_ACTION_SOUND NC_("STR_CLICK_ACTION_SOUND", "Play audio")
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi
index 9f9272f2ef6e..d5e1a5f51e8d 100644
--- a/sd/sdi/_drvwsh.sdi
+++ b/sd/sdi/_drvwsh.sdi
@@ -2885,6 +2885,11 @@ interface DrawView
ExecMethod = ExecGoToLastPage ;
StateMethod = GetStateGoToLastPage ;
]
+ SID_GO_TO_PAGE
+ [
+ ExecMethod = ExecGoToPage ;
+ StateMethod = GetStateGoToPage ;
+ ]
SID_CLASSIFICATION_APPLY
[
ExecMethod = FuTemporary ;
diff --git a/sd/source/ui/func/funavig.cxx b/sd/source/ui/func/funavig.cxx
index bd0cdb7c3336..f36ce34b22ad 100644
--- a/sd/source/ui/func/funavig.cxx
+++ b/sd/source/ui/func/funavig.cxx
@@ -29,6 +29,11 @@
#include <ViewShell.hxx>
#include <slideshow.hxx>
+#include <svx/svxids.hrc>
+#include <svx/dialog/gotodlg.hxx>
+#include <strings.hrc>
+#include <sdresid.hxx>
+
namespace sd {
@@ -139,6 +144,28 @@ void FuNavigation::DoExecute( SfxRequest& rReq )
}
}
break;
+
+ case SID_GO_TO_PAGE:
+ {
+ if( !bSlideShow)
+ if(auto pDrawViewShell = dynamic_cast<DrawViewShell *>( mpViewShell ))
+ {
+ OUString sTitle = SdResId(STR_GOTO_PAGE_DLG_TITLE);
+ OUString sLabel = SdResId(STR_PAGE_NAME) + ":";
+
+ if (mpDoc->GetDocumentType() == DocumentType::Impress)
+ {
+ sTitle = SdResId(STR_GOTO_SLIDE_DLG_TITLE);
+ sLabel = SdResId(STR_SLIDE_NAME) + ":";
+ }
+ svx::GotoPageDlg aDlg(pDrawViewShell->GetFrameWeld(), sTitle, sLabel,
+ pDrawViewShell->GetCurPagePos() + 1,
+ mpDoc->GetSdPageCount(PageKind::Standard));
+ if (aDlg.run() == RET_OK)
+ pDrawViewShell->SwitchPage(aDlg.GetPageSelection() - 1);
+ }
+ }
+ break;
}
// Refresh toolbar icons
SfxBindings& rBindings = mpViewShell->GetViewFrame()->GetBindings();
diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx
index 3043ba007bf2..e19e39d3d71b 100644
--- a/sd/source/ui/inc/DrawViewShell.hxx
+++ b/sd/source/ui/inc/DrawViewShell.hxx
@@ -222,6 +222,9 @@ public:
void ExecGoToLastPage (SfxRequest& rReq);
void GetStateGoToLastPage (SfxItemSet& rSet);
+ void ExecGoToPage (SfxRequest& rReq);
+ void GetStateGoToPage (SfxItemSet& rSet);
+
SD_DLLPUBLIC void ExecChar(SfxRequest& rReq);
void ExecuteAnnotation (SfxRequest const & rRequest);
diff --git a/sd/source/ui/inc/SlideSorterViewShell.hxx b/sd/source/ui/inc/SlideSorterViewShell.hxx
index 64808d4343a7..797c44a8e8d0 100644
--- a/sd/source/ui/inc/SlideSorterViewShell.hxx
+++ b/sd/source/ui/inc/SlideSorterViewShell.hxx
@@ -80,7 +80,7 @@ public:
void GetStatusBarState (SfxItemSet& rSet);
void FuPermanent (SfxRequest& rRequest);
void GetAttrState (SfxItemSet& rSet);
- static void ExecStatusBar (SfxRequest& rRequest);
+ void ExecStatusBar (SfxRequest& rRequest);
virtual void Command (const CommandEvent& rEvent, ::sd::Window* pWindow) override;
void GetMenuState (SfxItemSet &rSet);
void GetClipboardState (SfxItemSet &rSet);
diff --git a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 6df53600e31b..d17332b57176 100644
--- a/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -50,6 +50,7 @@
#include <sfx2/viewfrm.hxx>
#include <sfx2/bindings.hxx>
#include <sfx2/request.hxx>
+#include <sfx2/dispatch.hxx>
#include <sfx2/sidebar/SidebarChildWindow.hxx>
#include <sfx2/devtools/DevelopmentToolChildWindow.hxx>
#include <svx/svxids.hrc>
@@ -430,8 +431,21 @@ void SlideSorterViewShell::GetAttrState (SfxItemSet& rSet)
mpSlideSorter->GetController().GetAttrState(rSet);
}
-void SlideSorterViewShell::ExecStatusBar (SfxRequest& )
+void SlideSorterViewShell::ExecStatusBar (SfxRequest& rReq)
{
+ // nothing is executed during a slide show!
+ if(HasCurrentFunction(SID_PRESENTATION))
+ return;
+
+ switch (rReq.GetSlot())
+ {
+ case SID_STATUS_PAGE:
+ {
+ GetViewFrame()->GetDispatcher()->Execute(SID_GO_TO_PAGE,
+ SfxCallMode::SYNCHRON | SfxCallMode::RECORD);
+ }
+ break;
+ }
}
void SlideSorterViewShell::Paint (
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 73edca29dd5e..607504fe3732 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -1071,6 +1071,13 @@ void DrawViewShell::ExecStatusBar(SfxRequest& rReq)
GetViewFrame()->GetDispatcher()->Execute( SID_PRESENTATION_LAYOUT, SfxCallMode::ASYNCHRON );
}
break;
+
+ case SID_STATUS_PAGE:
+ {
+ GetViewFrame()->GetDispatcher()->Execute(SID_GO_TO_PAGE,
+ SfxCallMode::SYNCHRON | SfxCallMode::RECORD);
+ }
+ break;
}
}
diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx
index 5d5cfe613245..c1e5955b118f 100644
--- a/sd/source/ui/view/drviewsa.cxx
+++ b/sd/source/ui/view/drviewsa.cxx
@@ -867,6 +867,17 @@ void DrawViewShell::GetStateGoToLastPage (SfxItemSet& rSet)
rSet.DisableItem( SID_GO_TO_LAST_PAGE );
}
+void DrawViewShell::ExecGoToPage (SfxRequest& rReq)
+{
+ SetCurrentFunction( FuNavigation::Create( this, GetActiveWindow(), mpDrawView.get(), GetDoc(), rReq) );
+ Cancel();
+}
+
+void DrawViewShell::GetStateGoToPage (SfxItemSet& rSet)
+{
+ if (meEditMode == EditMode::MasterPage)
+ rSet.DisableItem( SID_GO_TO_PAGE );
+}
} // end of namespace sd
diff --git a/sd/uiconfig/sdraw/menubar/menubar.xml b/sd/uiconfig/sdraw/menubar/menubar.xml
index a905b056929f..b1058bbda973 100644
--- a/sd/uiconfig/sdraw/menubar/menubar.xml
+++ b/sd/uiconfig/sdraw/menubar/menubar.xml
@@ -463,6 +463,7 @@
<menu:menuitem menu:id=".uno:PreviousPage"/>
<menu:menuitem menu:id=".uno:NextPage"/>
<menu:menuitem menu:id=".uno:LastPage"/>
+ <menu:menuitem menu:id=".uno:GotoPage"/>
</menu:menupopup>
</menu:menu>
</menu:menupopup>
diff --git a/sd/uiconfig/simpress/menubar/menubar.xml b/sd/uiconfig/simpress/menubar/menubar.xml
index 6cc13819bde1..d0155ba626bf 100644
--- a/sd/uiconfig/simpress/menubar/menubar.xml
+++ b/sd/uiconfig/simpress/menubar/menubar.xml
@@ -569,6 +569,7 @@
<menu:menuitem menu:id=".uno:PreviousSlide"/>
<menu:menuitem menu:id=".uno:NextSlide"/>
<menu:menuitem menu:id=".uno:LastSlide"/>
+ <menu:menuitem menu:id=".uno:GotoSlide"/>
</menu:menupopup>
</menu:menu>
<menu:menuseparator/>