include/sfx2/sfxsids.hrc | 2 include/svx/dialog/gotodlg.hxx | 32 +-- officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu | 19 + sd/inc/strings.hrc | 2 sd/sdi/_drvwsh.sdi | 5 sd/source/ui/func/funavig.cxx | 27 ++ sd/source/ui/inc/DrawViewShell.hxx | 3 sd/source/ui/inc/SlideSorterViewShell.hxx | 2 sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx | 16 + sd/source/ui/view/drviews3.cxx | 7 sd/source/ui/view/drviewsa.cxx | 11 + sd/uiconfig/sdraw/menubar/menubar.xml | 1 sd/uiconfig/simpress/menubar/menubar.xml | 1 svx/Library_svx.mk | 1 svx/UIConfig_svx.mk | 1 svx/sdi/svx.sdi | 17 + svx/source/dialog/gotodlg.cxx | 66 ++++++ svx/uiconfig/ui/gotopagedialog.ui | 2 sw/Library_sw.mk | 1 sw/UIConfig_swriter.mk | 1 sw/inc/cmdid.h | 2 sw/inc/strings.hrc | 1 sw/sdi/_viewsh.sdi | 2 sw/sdi/swriter.sdi | 17 - sw/source/uibase/uiview/view2.cxx | 13 - sw/source/uibase/utlui/gotodlg.cxx | 105 ---------- 26 files changed, 202 insertions(+), 155 deletions(-)
New commits: commit ace21b4b2537a3cf2301fca2ac6f78d0612e911f Author: AkshayWarrier <[email protected]> AuthorDate: Fri Feb 2 02:18:24 2024 +0530 Commit: Jim Raykowski <[email protected]> CommitDate: Sat Feb 10 02:05:55 2024 +0100 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 <[email protected]> Reviewed-by: Heiko Tietze <[email protected]> Tested-by: Jenkins Reviewed-by: Jim Raykowski <[email protected]> diff --git a/include/sfx2/sfxsids.hrc b/include/sfx2/sfxsids.hrc index 176e500c55b3..e2fafac7321a 100644 --- a/include/sfx2/sfxsids.hrc +++ b/include/sfx2/sfxsids.hrc @@ -228,7 +228,7 @@ class SvxZoomItem; #define SID_UNPACK TypedWhichId<SfxBoolItem>(SID_SFX_START + 1662) // (SID_SFX_START + 1663) used further down #define SID_ATTR_TARGETLANG_STR (SID_SFX_START + 1664) - // FREE +#define SID_GO_TO_PAGE (SID_SFX_START + 1665) #define SID_OUTPUTSTREAM TypedWhichId<SfxUnoAnyItem>(SID_SFX_START + 1666) #define SID_IMAGE_ORIENTATION TypedWhichId<SfxImageItem>(SID_SFX_START + 1667) diff --git a/sw/inc/gotodlg.hxx b/include/svx/dialog/gotodlg.hxx similarity index 64% rename from sw/inc/gotodlg.hxx rename to include/svx/dialog/gotodlg.hxx index 0d10da367f68..304f1352b0db 100644 --- a/sw/inc/gotodlg.hxx +++ b/include/svx/dialog/gotodlg.hxx @@ -17,38 +17,30 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_GOTODLG_HXX -#define INCLUDED_SW_SOURCE_UIBASE_INC_GOTODLG_HXX +#pragma once -#include <sfx2/bindings.hxx> +#include <svx/svxdllapi.h> #include <vcl/weld.hxx> -class SwView; - -class SwGotoPageDlg final : public weld::GenericDialogController +namespace svx +{ +class SVX_DLLPUBLIC GotoPageDlg final : public weld::GenericDialogController { public: - SwGotoPageDlg(weld::Window *parent, SfxBindings& rBindings); + GotoPageDlg(weld::Window* pParent, const OUString& title, const OUString& label, + sal_uInt16 curPagePos, sal_uInt16 pageCnt); - sal_uInt16 GetPageSelection() const - { - return mxMtrPageCtrl->get_text().toUInt32(); - } + sal_uInt16 GetPageSelection() const { return mxMtrPageCtrl->get_text().toUInt32(); } private: - SwView *m_pCreateView; - SfxBindings& m_rBindings; - sal_uInt16 mnMaxPageCnt; + sal_uInt16 mnMaxPageCnt; std::unique_ptr<weld::SpinButton> mxMtrPageCtrl; std::unique_ptr<weld::Label> mxPageNumberLbl; + std::unique_ptr<weld::Label> mxPageLbl; - SwView* GetCreateView() const; - sal_uInt16 GetPageInfo(); - - DECL_LINK( PageModifiedHdl, weld::Entry&, void ); + DECL_LINK(PageModifiedHdl, weld::Entry&, void); }; - -#endif +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu index 6de8e0058a52..e9355220de4a 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/DrawImpressCommands.xcu @@ -2281,6 +2281,25 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:GotoPage" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Go t~o Page...</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> + <node oor:name=".uno:GotoSlide" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Go t~o Slide...</value> + </prop> + <prop oor:name="TargetURL" oor:type="xs:string"> + <value>.uno:GotoPage</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 to Start</value> 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/> diff --git a/svx/Library_svx.mk b/svx/Library_svx.mk index 59d4eaed0bff..54ff74c9568b 100644 --- a/svx/Library_svx.mk +++ b/svx/Library_svx.mk @@ -131,6 +131,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\ svx/source/dialog/connctrl \ svx/source/dialog/_contdlg \ svx/source/dialog/contwnd \ + svx/source/dialog/gotodlg \ svx/source/dialog/compressgraphicdialog \ $(call gb_Helper_optional,BREAKPAD, \ svx/source/dialog/crashreportdlg \ diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index a5fbbe9a6e95..9a1553005a85 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -79,6 +79,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/gallerymenu2 \ svx/uiconfig/ui/genericcheckdialog \ svx/uiconfig/ui/genericcheckentry \ + svx/uiconfig/ui/gotopagedialog \ svx/uiconfig/ui/grafctrlbox \ svx/uiconfig/ui/grafmodebox \ svx/uiconfig/ui/headfootformatpage \ diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index 961f7d9c067c..c91f57bcb448 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -12508,6 +12508,23 @@ SfxVoidItem EditQrCode SID_EDIT_QRCODE GroupId = SfxGroupId::Edit; ] +SfxVoidItem GotoPage SID_GO_TO_PAGE +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = TRUE, + GroupId = SfxGroupId::Navigator; +] + SfxVoidItem SpellCheckIgnore SID_SPELLCHECK_IGNORE (SfxStringItem Type FN_PARAM_1) [ diff --git a/svx/source/dialog/gotodlg.cxx b/svx/source/dialog/gotodlg.cxx new file mode 100644 index 000000000000..fe4533945bde --- /dev/null +++ b/svx/source/dialog/gotodlg.cxx @@ -0,0 +1,66 @@ +/* -*- 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 <svx/dialog/gotodlg.hxx> + +using namespace com::sun::star; + +namespace svx +{ +GotoPageDlg::GotoPageDlg(weld::Window* pParent, const OUString& title, const OUString& label, + sal_uInt16 curPagePos, sal_uInt16 pageCnt) + : GenericDialogController(pParent, "svx/ui/gotopagedialog.ui", "GotoPageDialog") + , mnMaxPageCnt(1) + , mxMtrPageCtrl(m_xBuilder->weld_spin_button("page")) + , mxPageNumberLbl(m_xBuilder->weld_label("page_count")) + , mxPageLbl(m_xBuilder->weld_label("page_label")) +{ + set_title(title); + mxPageLbl->set_label(label); + + mxMtrPageCtrl->set_value(curPagePos); + + sal_uInt16 nTotalPage = pageCnt; + OUString sStr = mxPageNumberLbl->get_label(); + mxPageNumberLbl->set_label(sStr.replaceFirst("$1", OUString::number(nTotalPage))); + mnMaxPageCnt = nTotalPage; + + mxMtrPageCtrl->connect_changed(LINK(this, GotoPageDlg, PageModifiedHdl)); + mxMtrPageCtrl->set_position(-1); + mxMtrPageCtrl->select_region(0, -1); +} + +IMPL_LINK_NOARG(GotoPageDlg, PageModifiedHdl, weld::Entry&, void) +{ + if (mxMtrPageCtrl->get_text().isEmpty()) + return; + + auto page_value = mxMtrPageCtrl->get_text().toInt32(); + + if (page_value <= 0) + mxMtrPageCtrl->set_value(1); + else if (page_value > mnMaxPageCnt) + mxMtrPageCtrl->set_value(mnMaxPageCnt); + else + mxMtrPageCtrl->set_value(page_value); + + mxMtrPageCtrl->set_position(-1); +} +} +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/uiconfig/swriter/ui/gotopagedialog.ui b/svx/uiconfig/ui/gotopagedialog.ui similarity index 99% rename from sw/uiconfig/swriter/ui/gotopagedialog.ui rename to svx/uiconfig/ui/gotopagedialog.ui index b57e88fc5a06..42ac5e2a7de3 100644 --- a/sw/uiconfig/swriter/ui/gotopagedialog.ui +++ b/svx/uiconfig/ui/gotopagedialog.ui @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- Generated with glade 3.20.4 --> -<interface domain="sw"> +<interface domain="svx"> <requires lib="gtk+" version="3.20"/> <object class="GtkDialog" id="GotoPageDialog"> <property name="can_focus">False</property> diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 707f5506d6a6..239e58ffc6a3 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -784,7 +784,6 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/uibase/utlui/initui \ sw/source/uibase/utlui/navicfg \ sw/source/uibase/utlui/navipi \ - sw/source/uibase/utlui/gotodlg \ sw/source/uibase/utlui/numfmtlb \ sw/source/uibase/utlui/prcntfld \ sw/source/uibase/utlui/shdwcrsr \ diff --git a/sw/UIConfig_swriter.mk b/sw/UIConfig_swriter.mk index 43ab167dd197..309eb8666293 100644 --- a/sw/UIConfig_swriter.mk +++ b/sw/UIConfig_swriter.mk @@ -177,7 +177,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/swriter,\ sw/uiconfig/swriter/ui/frmaddpage \ sw/uiconfig/swriter/ui/frmtypepage \ sw/uiconfig/swriter/ui/frmurlpage \ - sw/uiconfig/swriter/ui/gotopagedialog \ sw/uiconfig/swriter/ui/hfmenubutton \ sw/uiconfig/swriter/ui/indexentry \ sw/uiconfig/swriter/ui/inputfielddialog \ diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 165b6aa60a30..4773f173d603 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -545,8 +545,6 @@ class SwUINumRuleItem; #define FN_UPDATE_CUR_TOX (FN_EXTRA + 54) /* update current index */ #define FN_REMOVE_CUR_TOX (FN_EXTRA + 55) /* remove the current TOX*/ -#define FN_GOTO_PAGE (FN_EXTRA + 59 ) /* goto page */ - #define FN_COLL_TYPE (FN_EXTRA + 98) /* type for GlobalDoc-Collection*/ #define FN_COLL_ADD (FN_EXTRA + 99) diff --git a/sw/inc/strings.hrc b/sw/inc/strings.hrc index 9e0cf978aa3b..8f3eadcab6d8 100644 --- a/sw/inc/strings.hrc +++ b/sw/inc/strings.hrc @@ -1247,6 +1247,7 @@ #define STR_IMGBTN_FIELD_DOWN NC_("STR_IMGBTN_FIELD_DOWN", "Next field") #define STR_IMGBTN_FIELD_BYTYPE_UP NC_("STR_IMGBTN_FIELD_BYTYPE_UP", "Previous '%FIELDTYPE' field") #define STR_IMGBTN_FIELD_BYTYPE_DOWN NC_("STR_IMGBTN_FIELD_BYTYPE_DOWN", "Next '%FIELDTYPE' field") +#define STR_GOTO_PAGE_DLG_TITLE NC_("STR_GOTO_PAGE_DLG_TITLE", "Go to Page") #define STR_REDLINE_INSERT NC_("STR_REDLINE_INSERT", "Inserted") #define STR_REDLINE_DELETE NC_("STR_REDLINE_DELETE", "Deleted") diff --git a/sw/sdi/_viewsh.sdi b/sw/sdi/_viewsh.sdi index 0a9e92dea48f..1ec913474a44 100644 --- a/sw/sdi/_viewsh.sdi +++ b/sw/sdi/_viewsh.sdi @@ -93,7 +93,7 @@ interface BaseTextEditView ExecMethod = Execute ; StateMethod = GetState ; ] - FN_GOTO_PAGE // status(final|play) + SID_GO_TO_PAGE // status(final|play) [ ExecMethod = Execute ; StateMethod = NoState ; diff --git a/sw/sdi/swriter.sdi b/sw/sdi/swriter.sdi index 74cbeff51b7d..861d5ccec21a 100644 --- a/sw/sdi/swriter.sdi +++ b/sw/sdi/swriter.sdi @@ -1900,23 +1900,6 @@ SfxVoidItem GotoNextWrongTableFormula FN_NEXT_TBLFML_ERR GroupId = SfxGroupId::Navigator; ] -SfxVoidItem GotoPage FN_GOTO_PAGE -() -[ - AutoUpdate = FALSE, - FastCall = TRUE, - ReadOnlyDoc = TRUE, - Toggle = FALSE, - Container = FALSE, - RecordAbsolute = FALSE, - RecordPerSet; - - AccelConfig = TRUE, - MenuConfig = FALSE, - ToolBoxConfig = FALSE, - GroupId = SfxGroupId::Navigator; -] - SfxVoidItem GotoPrevIndexMark FN_PREV_TOXMARK () [ diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 6c9a17967344..c4d0fea80358 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -78,7 +78,6 @@ #include <swtypes.hxx> #include <swwait.hxx> #include <redlndlg.hxx> -#include <gotodlg.hxx> #include <view.hxx> #include <uivwimp.hxx> #include <docsh.hxx> @@ -162,6 +161,8 @@ #include <svx/srchdlg.hxx> #include <o3tl/string_view.hxx> +#include <svx/dialog/gotodlg.hxx> + const char sStatusDelim[] = " : "; using namespace sfx2; @@ -1285,9 +1286,13 @@ void SwView::Execute(SfxRequest &rReq) } } break; - case FN_GOTO_PAGE: + case SID_GO_TO_PAGE: { - SwGotoPageDlg aDlg(GetViewFrame().GetFrameWeld(), GetViewFrame().GetBindings()); + sal_uInt16 nPhyPage, nVirPage; + GetWrtShell().GetPageNum(nPhyPage, nVirPage); + + svx::GotoPageDlg aDlg(GetViewFrame().GetFrameWeld(), SwResId(STR_GOTO_PAGE_DLG_TITLE), + SwResId(ST_PGE) + ":", nPhyPage, GetWrtShell().GetPageCnt()); if (aDlg.run() == RET_OK) GetWrtShell().GotoPage(aDlg.GetPageSelection(), true); } @@ -2202,7 +2207,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq) { case FN_STAT_PAGE: { - GetViewFrame().GetDispatcher()->Execute( FN_GOTO_PAGE, + GetViewFrame().GetDispatcher()->Execute( SID_GO_TO_PAGE, SfxCallMode::SYNCHRON|SfxCallMode::RECORD ); } break; diff --git a/sw/source/uibase/utlui/gotodlg.cxx b/sw/source/uibase/utlui/gotodlg.cxx deleted file mode 100644 index 711717ee44c1..000000000000 --- a/sw/source/uibase/utlui/gotodlg.cxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- 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 <swmodule.hxx> -#include <view.hxx> -#include <wrtsh.hxx> -#include <gotodlg.hxx> -#include <sfx2/bindings.hxx> -#include <sfx2/viewfrm.hxx> - -using namespace com::sun::star; - -SwGotoPageDlg::SwGotoPageDlg(weld::Window* pParent, SfxBindings& rBindings) - : GenericDialogController(pParent, "modules/swriter/ui/gotopagedialog.ui", "GotoPageDialog") - , m_pCreateView(nullptr) - , m_rBindings(rBindings) - , mnMaxPageCnt(1) - , mxMtrPageCtrl(m_xBuilder->weld_spin_button("page")) - , mxPageNumberLbl(m_xBuilder->weld_label("page_count")) -{ - sal_uInt16 nTotalPage = GetPageInfo(); - - if (nTotalPage) - { - OUString sStr = mxPageNumberLbl->get_label(); - mxPageNumberLbl->set_label(sStr.replaceFirst("$1", OUString::number(nTotalPage))); - mnMaxPageCnt = nTotalPage; - } - mxMtrPageCtrl->connect_changed(LINK(this, SwGotoPageDlg, PageModifiedHdl)); - mxMtrPageCtrl->set_position(-1); - mxMtrPageCtrl->select_region(0, -1); -} - -IMPL_LINK_NOARG(SwGotoPageDlg, PageModifiedHdl, weld::Entry&, void) -{ - if (mxMtrPageCtrl->get_text().isEmpty()) - return; - - int page_value = mxMtrPageCtrl->get_text().toInt32(); - - if (page_value <= 0) - mxMtrPageCtrl->set_value(1); - else if (page_value > mnMaxPageCnt) - mxMtrPageCtrl->set_value(mnMaxPageCnt); - else - mxMtrPageCtrl->set_value(page_value); - - mxMtrPageCtrl->set_position(-1); -} - -SwView* SwGotoPageDlg::GetCreateView() const -{ - if (!m_pCreateView) - { - SwView* pView = SwModule::GetFirstView(); - while (pView) - { - if (&pView->GetViewFrame().GetBindings() == &m_rBindings) - { - const_cast<SwGotoPageDlg*>(this)->m_pCreateView = pView; - break; - } - pView = SwModule::GetNextView(pView); - } - } - - return m_pCreateView; -} - -// If the page can be set here, the maximum is set. - -sal_uInt16 SwGotoPageDlg::GetPageInfo() -{ - SwView* pView = GetCreateView(); - SwWrtShell* pSh = pView ? &pView->GetWrtShell() : nullptr; - mxMtrPageCtrl->set_value(1); - if (pSh) - { - const sal_uInt16 nPageCnt = pSh->GetPageCnt(); - sal_uInt16 nPhyPage, nVirPage; - pSh->GetPageNum(nPhyPage, nVirPage); - mxMtrPageCtrl->set_max(nPageCnt); - mxMtrPageCtrl->set_value(nPhyPage); - return nPageCnt; - } - return 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
