summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/tabvwsh3.cxx
diff options
context:
space:
mode:
authorLaurent BP <laurent.balland-poirier@laposte.net>2022-05-16 22:47:25 +0200
committerLaurent Balland-Poirier <laurent.balland@mailo.fr>2022-06-07 13:43:20 +0200
commitd93e9430bfbf6fa8a679ea2d4d98f955774026f6 (patch)
tree6d6e6a4f48cd9fb1134989fbf9f3b879e67e8d77 /sc/source/ui/view/tabvwsh3.cxx
parent19a6adddec0f5a6ee771939a17f85bdde4a44ce3 (diff)
tdf#129674 Add GoTo Sheet command
Insert command in menu Sheet > Navigate (alongs with To Previous/Next Sheet) Use .uno:JumpToTable command from Navigator Use its own Go To Sheet dialog Add a Search entry to type partial name of sheet Menu translation missing? Change-Id: I16b8b56a688c8396159617f04a2a7e034721ce31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134714 Tested-by: Jenkins Reviewed-by: Laurent Balland-Poirier <laurent.balland@mailo.fr>
Diffstat (limited to 'sc/source/ui/view/tabvwsh3.cxx')
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx48
1 files changed, 43 insertions, 5 deletions
diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx
index 8a65b1c7b917..766f6c7621d4 100644
--- a/sc/source/ui/view/tabvwsh3.cxx
+++ b/sc/source/ui/view/tabvwsh3.cxx
@@ -516,12 +516,50 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
break;
case SID_CURRENTTAB:
- if ( pReqArgs )
{
- // sheet for basic is one-based
- SCTAB nTab = static_cast<const SfxUInt16Item&>(pReqArgs->Get(nSlot)).GetValue() - 1;
- ScDocument& rDoc = GetViewData().GetDocument();
- if ( nTab < rDoc.GetTableCount() )
+ SCTAB nTab;
+ ScViewData& rViewData = GetViewData();
+ ScDocument& rDoc = rViewData.GetDocument();
+ SCTAB nTabCount = rDoc.GetTableCount();
+ if ( pReqArgs ) // command from Navigator with nTab
+ {
+ // sheet for basic is one-based
+ nTab = static_cast<const SfxUInt16Item&>(pReqArgs->Get(nSlot)).GetValue() - 1;
+ }
+ else // command from Menu: ask for nTab
+ {
+ ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
+
+ ScopedVclPtr<AbstractScGoToTabDlg> pDlg(pFact->CreateScGoToTabDlg(GetFrameWeld()));
+ pDlg->SetDescription(
+ ScResId( STR_DLG_SELECTTABLE_TITLE ),
+ ScResId( STR_DLG_SELECTTABLE_MASK ),
+ ScResId( STR_DLG_SELECTTABLE_LBNAME ),
+ GetStaticInterface()->GetSlot(SID_CURRENTTAB)->GetCommand(), HID_GOTOTABLEMASK, HID_GOTOTABLE );
+
+ // fill all table names and select current tab
+ OUString aTabName;
+ for( nTab = 0; nTab < nTabCount; ++nTab )
+ {
+ if( rDoc.IsVisible( nTab ) )
+ {
+ rDoc.GetName( nTab, aTabName );
+ pDlg->Insert( aTabName, rViewData.GetTabNo() == nTab );
+ }
+ }
+
+ if( pDlg->Execute() == RET_OK )
+ {
+ if( !rDoc.GetTable( pDlg->GetSelectedEntry(), nTab ) )
+ nTab = nTabCount;
+ pDlg.disposeAndClear();
+ }
+ else
+ {
+ rReq.Ignore();
+ }
+ }
+ if ( nTab < nTabCount )
{
SetTabNo( nTab );
rBindings.Update( nSlot );