sc/source/ui/view/tabvwshf.cxx | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-)
New commits: commit 30862ca42c6b548a2dce99c0f2a0c2886f059dfa Author: Laurent Godard <lgodard.li...@laposte.net> Date: Fri Feb 8 18:49:05 2013 +0100 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.yosh...@gmail.com> Tested-by: Kohei Yoshida <kohei.yosh...@gmail.com> diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 89585dd..c8320ba 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; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits