summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/tabvwshf.cxx
diff options
context:
space:
mode:
authorLaurent Godard <lgodard.libre@laposte.net>2013-02-08 18:49:05 +0100
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-02-13 16:47:23 +0000
commit30862ca42c6b548a2dce99c0f2a0c2886f059dfa (patch)
tree02648e5060802157817c39a3542d43bf2988a104 /sc/source/ui/view/tabvwshf.cxx
parent7275f45369ac50ae1eec2688147126052cf27889 (diff)
calc : multiple tabs can be hidden at once
- enables the "Format > Sheet > Hide" menu when mutiple tabs are selected provided there remain one tab at least at the end - loops over selected tabs to hide them - does nothing if the command leads to no visible tabs. Change-Id: I445eccc188f1817006cb425dc9a0e92a25350ec8 Reviewed-on: https://gerrit.libreoffice.org/2053 Reviewed-by: Kohei Yoshida <kohei.yoshida@gmail.com> Tested-by: Kohei Yoshida <kohei.yoshida@gmail.com>
Diffstat (limited to 'sc/source/ui/view/tabvwshf.cxx')
-rw-r--r--sc/source/ui/view/tabvwshf.cxx37
1 files changed, 15 insertions, 22 deletions
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 89585dd96f54..c8320baefa76 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -109,33 +109,26 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
ScMarkData& rMark = pViewData->GetMarkData();
SCTAB nTabSelCount = rMark.GetSelectCount();
sal_uInt16 nVis = 0;
- for ( SCTAB i=0; i < nTabCount && nVis<2; i++ )
+
+ // check to make sure we won't hide all sheets. we need at least one visible at all times.
+ for ( SCTAB i=0; i < nTabCount && nVis<nTabSelCount + 1; i++ )
if (pDoc->IsVisible(i))
++nVis;
- if ( nVis<2 || !pDoc->IsDocEditable() || nTabSelCount > 1 )
+ if ( nVis<=nTabSelCount || !pDoc->IsDocEditable() )
break;
-
rtl::OUString aName;
- if( pReqArgs != NULL )
- {
- const SfxPoolItem* pItem;
- if( pReqArgs->HasItem( FID_TABLE_HIDE, &pItem ) )
- aName = ((const SfxStringItem*)pItem)->GetValue();
- }
+ SCTAB nHideTab;
+ ScMarkData::MarkedTabsType::const_iterator it;
+
+ ScMarkData::MarkedTabsType selectedTabs = rMark.GetSelectedTabs();
- if (aName.isEmpty())
+ for (it=selectedTabs.begin(); it!=selectedTabs.end(); ++it)
{
- pDoc->GetName( nCurrentTab, aName ); // aktuelle Tabelle
- rReq.AppendItem( SfxStringItem( FID_TABLE_HIDE, aName ) );
+ nHideTab = *it;
+ if (pDoc->IsVisible( nHideTab ))
+ HideTable( nHideTab );
}
-
- SCTAB nHideTab;
- if (pDoc->GetTable( aName, nHideTab ))
- HideTable( nHideTab );
-
- if( ! rReq.IsAPI() )
- rReq.Done();
}
break;
@@ -841,11 +834,11 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
case FID_TABLE_HIDE:
{
sal_uInt16 nVis = 0;
- for ( SCTAB i=0; i < nTabCount && nVis<2; i++ )
+ // enable menu : check to make sure we won't hide all sheets. we need at least one visible at all times.
+ for ( SCTAB i=0; i < nTabCount && nVis<nTabSelCount + 1; i++ )
if (pDoc->IsVisible(i))
++nVis;
-
- if ( nVis<2 || !pDoc->IsDocEditable() || nTabSelCount > 1 )
+ if ( nVis<=nTabSelCount || !pDoc->IsDocEditable() )
rSet.DisableItem( nWhich );
}
break;