[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.0' - 3 commits - sc/sdi sc/source

Jan Holesovsky kendy at collabora.com
Wed Jan 20 15:06:33 PST 2016


 sc/sdi/scalc.sdi                 |    4 --
 sc/source/core/data/document.cxx |    9 +++++
 sc/source/ui/view/tabvwshf.cxx   |   65 ++++++++++++++++++++++++++-------------
 sc/source/ui/view/viewdata.cxx   |    1 
 4 files changed, 55 insertions(+), 24 deletions(-)

New commits:
commit cccbc20a9a44350dc48b9280d47b58e4e2a4dc31
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Jan 21 00:02:16 2016 +0100

    sc lok: Fix .uno:Remove (removing sheets) to accept a parameter.
    
    .sdi annouces that, but it was never implemented...
    
    Change-Id: I7abfbdc88f055eeb993617a5a51371af0f825d34

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 79eab8f..dd56015 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -727,6 +727,9 @@ bool ScDocument::DeleteTab( SCTAB nTab )
                 // sheet names of references are not valid until sheet is deleted
                 pChartListenerCollection->UpdateScheduledSeriesRanges();
 
+                if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer())
+                    GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
+
                 bValid = true;
             }
         }
@@ -814,6 +817,9 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
                 // sheet names of references are not valid until sheet is deleted
                 pChartListenerCollection->UpdateScheduledSeriesRanges();
 
+                if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer())
+                    GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
+
                 bValid = true;
             }
         }
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 82a33dc..53fd7c8 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -568,37 +568,60 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
 
         case FID_DELETE_TABLE:
             {
-                //  unnecessary parameter ->  method depends on table
+                bool bHasIndex = (pReqArgs != nullptr);
 
-                bool bDoIt = rReq.IsAPI();
-                if( !bDoIt )
+                // allow removing via the Index/FID_DELETE_TABLE parameter
+                SCTAB nIndexTab = nCurrentTab;
+                if (bHasIndex)
                 {
-                    //  source isn't basic -> ask again
+                    const SfxPoolItem* pItem;
+                    if (pReqArgs->HasItem(FID_DELETE_TABLE, &pItem))
+                        nIndexTab = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
+                }
 
-                        bDoIt = ( RET_YES ==
-                                  ScopedVclPtr<QueryBox>::Create( GetDialogParent(),
-                                            WinBits( WB_YES_NO | WB_DEF_YES ),
-                                            ScGlobal::GetRscString(STR_QUERY_DELTAB)
-                                      )->Execute() );
+                bool bDoIt = bHasIndex;
+                if (!bDoIt)
+                {
+                    // no parameter given, ask for confirmation
+                    bDoIt = ( RET_YES ==
+                              ScopedVclPtr<QueryBox>::Create( GetDialogParent(),
+                                        WinBits( WB_YES_NO | WB_DEF_YES ),
+                                        ScGlobal::GetRscString(STR_QUERY_DELTAB)
+                                  )->Execute() );
                 }
-                if( bDoIt )
+
+                if (bDoIt)
                 {
-                    SCTAB nNewTab   = nCurrentTab;
-                    SCTAB nFirstTab=0;
-                    bool   bTabFlag=false;
-                    ScMarkData& rMark = rViewData.GetMarkData();
+                    SCTAB nNewTab = nCurrentTab;
                     std::vector<SCTAB> TheTabs;
-                    for(SCTAB i=0;i<nTabCount;i++)
+
+                    if (bHasIndex)
                     {
-                        if(rMark.GetTableSelect(i) &&!pDoc->IsTabProtected(i))
+                        // sheet no. provided by the parameter
+                        TheTabs.push_back(nIndexTab);
+                        if (nNewTab > nIndexTab && nNewTab > 0)
+                            --nNewTab;
+                    }
+                    else
+                    {
+                        SCTAB nFirstTab = 0;
+                        bool bTabFlag = false;
+                        ScMarkData& rMark = rViewData.GetMarkData();
+                        for (SCTAB i = 0; i < nTabCount; i++)
                         {
-                            TheTabs.push_back(i);
-                            bTabFlag=true;
-                            if(nNewTab==i) nNewTab++;
+                            if (rMark.GetTableSelect(i) && !pDoc->IsTabProtected(i))
+                            {
+                                TheTabs.push_back(i);
+                                bTabFlag = true;
+                                if (nNewTab == i)
+                                    nNewTab++;
+                            }
+                            if (!bTabFlag)
+                                nFirstTab = i;
                         }
-                        if(!bTabFlag) nFirstTab=i;
+                        if (nNewTab >= nTabCount)
+                            nNewTab = nFirstTab;
                     }
-                    if(nNewTab>=nTabCount) nNewTab=nFirstTab;
 
                     rViewData.SetTabNo(nNewTab);
                     DeleteTables(TheTabs);
commit 59a93573d677c85402b78bf748c7267554cf3ca2
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 20 22:12:33 2016 +0100

    sc lok: Fix .uno:Name (renaming sheets) to really accept parameters.
    
    The code handles them, but they were unusable, because .sdi did not announce
    them.
    
    Change-Id: I35bd3009d092eb48a36aee2ffed3964dc61946e2

diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 7bc2db6..fa51a39 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -4813,7 +4813,7 @@ SfxVoidItem Move FID_TAB_MOVE
 
 
 SfxStringItem Name FID_TAB_RENAME
-
+(SfxStringItem Name FID_TAB_RENAME,SfxUInt16Item Index FN_PARAM_1)
 [
     /* flags: */
     AutoUpdate = FALSE,
@@ -4828,8 +4828,6 @@ SfxStringItem Name FID_TAB_RENAME
     RecordPerSet;
     Synchron;
 
-    Readonly = FALSE,
-
     /* config: */
     AccelConfig = TRUE,
     MenuConfig = TRUE,
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index df19fae..79eab8f 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -855,6 +855,9 @@ bool ScDocument::RenameTab( SCTAB nTab, const OUString& rName, bool /* bUpdateRe
                 for (; it != maTabs.end(); ++it)
                     if ( *it && (*it)->IsStreamValid())
                         (*it)->SetStreamValid( false );
+
+                if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer())
+                    GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
             }
         }
     }
commit 03d10e1ab2a7a97c00edbc07c1fe7c0fc937154b
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 20 22:12:19 2016 +0100

    sc: Fix build.
    
    Change-Id: I496015f119b1e102528ac5ec5d27e896de25e56c

diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 290bb46..0dddea6 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -59,6 +59,7 @@
 #include <gridwin.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <boost/checked_delete.hpp>
+#include <comphelper/lok.hxx>
 #include <comphelper/processfactory.hxx>
 #include <comphelper/string.hxx>
 


More information about the Libreoffice-commits mailing list