[PATCH] calc : multiple tabs can be hidden at once

Laurent Godard (via Code Review) gerrit at gerrit.libreoffice.org
Fri Feb 8 09:58:11 PST 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2053

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/53/2053/1

calc : multiple tabs can be hidden at once

Change-Id: I445eccc188f1817006cb425dc9a0e92a25350ec8
---
M sc/source/ui/view/tabvwshf.cxx
1 file changed, 22 insertions(+), 23 deletions(-)



diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 89585dd..3a66768 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -109,33 +109,33 @@
                 ScMarkData& rMark = pViewData->GetMarkData();
                 SCTAB nTabSelCount = rMark.GetSelectCount();
                 sal_uInt16 nVis = 0;
-                for ( SCTAB i=0; i < nTabCount && nVis<2; i++ )
+                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();
-                }
-
-                if (aName.isEmpty())
-                {
-                    pDoc->GetName( nCurrentTab, aName );        // aktuelle Tabelle
-                    rReq.AppendItem( SfxStringItem( FID_TABLE_HIDE, aName ) );
-                }
-
                 SCTAB nHideTab;
-                if (pDoc->GetTable( aName, nHideTab ))
-                    HideTable( nHideTab );
+                ScMarkData::MarkedTabsType selectedTabs = rMark.GetSelectedTabs();
 
-                if( ! rReq.IsAPI() )
-                    rReq.Done();
+                ScMarkData::MarkedTabsType::const_iterator it;
+                it = selectedTabs.begin();
+                while (it != selectedTabs.end())
+                {
+                    nHideTab = *it;
+
+                    pDoc->GetName( nHideTab, aName );
+                    rReq.AppendItem( SfxStringItem( FID_TABLE_HIDE, aName ) );
+
+                    if (pDoc->GetTable( aName, nHideTab ))
+                        HideTable( nHideTab );
+
+                    if( ! rReq.IsAPI() )
+                        rReq.Done();
+
+                    it++;
+                }
             }
             break;
 
@@ -841,11 +841,10 @@
             case FID_TABLE_HIDE:
                 {
                     sal_uInt16 nVis = 0;
-                    for ( SCTAB i=0; i < nTabCount && nVis<2; i++ )
+                    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;

-- 
To view, visit https://gerrit.libreoffice.org/2053
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I445eccc188f1817006cb425dc9a0e92a25350ec8
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Laurent Godard <lgodard.libre at laposte.net>


More information about the LibreOffice mailing list