Kaydet (Commit) 30862ca4 authored tarafından Laurent Godard's avatar Laurent Godard Kaydeden (comit) Kohei Yoshida

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/2053Reviewed-by: 's avatarKohei Yoshida <kohei.yoshida@gmail.com>
Tested-by: 's avatarKohei Yoshida <kohei.yoshida@gmail.com>
üst 7275f453
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment