diff options
author | gokaysatir <gokaysatir@collabora.com> | 2020-09-30 15:48:44 +0300 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2020-10-12 09:12:49 +0200 |
commit | 53bd76e8f193baf667077eb52d06e3c244964819 (patch) | |
tree | f6be3a7f86aaa573ed025c93156cbceb04f46764 /sc/source/ui/view/tabvwshf.cxx | |
parent | b47a8eda6ecd2b508054a68b4879c769cce87363 (diff) |
Online: Hide right clicked sheet.
On core side, if user clicks on a tab with right mouse button, clicked tab is selected.
So, for core side, if this feature will be desired, some more modification will be needed.
Change-Id: Ic4755b27b8ba98d3a6aa086b2e0a3566d095ba16
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103685
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104078
Tested-by: Jenkins
Diffstat (limited to 'sc/source/ui/view/tabvwshf.cxx')
-rw-r--r-- | sc/source/ui/view/tabvwshf.cxx | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 95e566267ae1..98ce2db58fa7 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -107,7 +107,25 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) if ( rDoc.IsDocEditable() ) { ScMarkData& rMark = rViewData.GetMarkData(); - HideTable( rMark ); + SCTAB nActiveTab = -1; + // For the cases when user right clicks on a non-active tab and hides it. This case is possible for Online. + if (pReqArgs) + { + const SfxPoolItem *pItem; + if( pReqArgs->HasItem( FID_TABLE_HIDE, &pItem ) ) + { + SCTAB nTabNumber = static_cast<const SfxInt16Item*>(pItem)->GetValue(); + // Does selected sheets (tabs) list include the sheet to be hidden? + std::set<SCTAB>::iterator it = rMark.GetSelectedTabs().find(nTabNumber); + if (it == rMark.GetSelectedTabs().end()) + { + // No it doesn't, so we won't shift the selected tab. Let's remember its position. + nActiveTab = GetViewData().GetTabNo(); + } + rMark.SelectOneTable(nTabNumber); + } + } + HideTable( rMark, nActiveTab ); } } break; |