tdf#173835 Include hidden sheets to show SelectAllSheets command
Follow-up commit ccbc8791e1
"Select All Sheets" command select visible and hidden sheets.
So the command should also be available when there are
some hidden sheets not selected
Change-Id: I3115385853e115d63eff91a800a2bf52c4157dc8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211774
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
This commit is contained in:
@@ -198,14 +198,8 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
|
||||
SfxViewFrame& rThisFrame = GetViewFrame();
|
||||
bool bOle = GetViewFrame().GetFrame().IsInPlace();
|
||||
|
||||
SCTAB nTabSelCount = rMark.GetSelectCount();
|
||||
SCTAB nCountVisible = 0;
|
||||
const SCTAB nTabCount = rDoc.GetTableCount();
|
||||
for ( SCTAB i = 0; nCountVisible < 2 && i < nTabCount ; i++ )
|
||||
if ( rDoc.IsVisible( i ) )
|
||||
++nCountVisible;
|
||||
const bool bOnlyOneVisibleSheet = nCountVisible < 2;
|
||||
bool bAllSelected = true;
|
||||
|
||||
SfxWhichIter aIter(rSet);
|
||||
sal_uInt16 nWhich = aIter.FirstWhich();
|
||||
@@ -284,7 +278,10 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
|
||||
rSet.Put( SfxUInt16Item( nWhich, static_cast<sal_uInt16>(GetViewData().GetTabNumber()) + 1 ) );
|
||||
|
||||
// enabled only if several sheets are visible
|
||||
if ( bOnlyOneVisibleSheet )
|
||||
for ( SCTAB i = 0; nCountVisible < 2 && i < nTabCount ; i++ )
|
||||
if ( rDoc.IsVisible( i ) )
|
||||
++nCountVisible;
|
||||
if ( nCountVisible < 2 )
|
||||
rSet.DisableItem( nWhich );
|
||||
break;
|
||||
|
||||
@@ -555,20 +552,14 @@ void ScTabViewShell::GetState( SfxItemSet& rSet )
|
||||
break;
|
||||
|
||||
case FID_TAB_DESELECTALL:
|
||||
if ( nTabSelCount == 1 )
|
||||
if ( rMark.GetSelectCount() == 1 )
|
||||
rSet.DisableItem( nWhich ); // enabled only if several sheets are selected
|
||||
break;
|
||||
|
||||
case FID_TAB_SELECTALL:
|
||||
if ( bOnlyOneVisibleSheet )
|
||||
rSet.DisableItem( nWhich ); // enabled only if several sheets are visible
|
||||
else
|
||||
{
|
||||
for ( SCTAB i = 0; i < nTabCount && bAllSelected; i++ )
|
||||
bAllSelected = !( rDoc.IsVisible(i) && !rMark.GetTableSelect(i) );
|
||||
if ( bAllSelected )
|
||||
rSet.DisableItem( nWhich ); // disabled if all sheets are already selected
|
||||
}
|
||||
// tdf#173835 count visible and hidden sheets
|
||||
if ( rDoc.GetTableCount() == rMark.GetSelectCount() )
|
||||
rSet.DisableItem( nWhich ); // disabled if all sheets are already selected
|
||||
break;
|
||||
|
||||
case FID_TOGGLEHIDDENCOLROW:
|
||||
|
||||
Reference in New Issue
Block a user