From 24571d36354c3bb247e4fc2100bdea3c3536ab03 Mon Sep 17 00:00:00 2001 From: Laurent Balland Date: Sat, 3 Oct 2026 10:06:28 +0200 Subject: [PATCH] tdf#173835 Include hidden sheets to show SelectAllSheets command Follow-up commit ccbc8791e125f7d508931bcdf33134b44d393d39 "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 --- sc/source/ui/view/tabvwsha.cxx | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 850b135a710a..315c4f11fde1 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -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(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: