[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.2' - sc/sdi sc/source
gokaysatir (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 26 08:58:35 UTC 2020
sc/sdi/scalc.sdi | 2 +-
sc/source/ui/inc/viewfunc.hxx | 2 +-
sc/source/ui/view/tabvwshf.cxx | 20 +++++++++++++++++++-
sc/source/ui/view/viewfun2.cxx | 8 +++++++-
4 files changed, 28 insertions(+), 4 deletions(-)
New commits:
commit fc56c313d19c74ed737a93fbed8eaf3d6c962e5c
Author: gokaysatir <gokaysatir at collabora.com>
AuthorDate: Wed Sep 30 15:48:44 2020 +0300
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Oct 26 09:57:30 2020 +0100
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 at collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104077
Reviewed-by: Andras Timar <andras.timar at collabora.com>
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 87ef5950d333..23b9c72fbe0f 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -2576,7 +2576,7 @@ SfxVoidItem GoUpToStartOfDataSel SID_CURSORBLKUP_SEL
SfxVoidItem Hide FID_TABLE_HIDE
-(SfxStringItem aTableName FID_TABLE_HIDE)
+(SfxInt16Item nTabNumber FID_TABLE_HIDE)
[
AutoUpdate = FALSE,
FastCall = FALSE,
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 85857d5065d7..fb64ff180989 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -273,7 +273,7 @@ public:
const OUString& rSource );
void ShowTable( const std::vector<OUString>& rNames );
- void HideTable( const ScMarkData& rMark );
+ void HideTable( const ScMarkData& rMark, SCTAB nTabToSelect = -1);
void MakeScenario(const OUString& rName, const OUString& rComment,
const Color& rColor, ScScenarioFlags nFlags);
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index e0fbd782619b..0a297c717741 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -109,7 +109,25 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
if ( pDoc->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;
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 1b948b916746..949abf8dbd98 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -3035,7 +3035,7 @@ void ScViewFunc::ShowTable( const std::vector<OUString>& rNames )
}
}
-void ScViewFunc::HideTable( const ScMarkData& rMark )
+void ScViewFunc::HideTable( const ScMarkData& rMark, SCTAB nTabToSelect )
{
ScDocShell* pDocSh = GetViewData().GetDocShell();
ScDocument& rDoc = pDocSh->GetDocument();
@@ -3072,6 +3072,12 @@ void ScViewFunc::HideTable( const ScMarkData& rMark )
undoTabs.push_back(nTab);
}
}
+
+ if (nTabToSelect != -1)
+ {
+ SetTabNo(nTabToSelect);
+ }
+
if (bUndo)
{
pDocSh->GetUndoManager()->AddUndoAction( o3tl::make_unique<ScUndoShowHideTab>( pDocSh, undoTabs, false ) );
More information about the Libreoffice-commits
mailing list