[Libreoffice-commits] core.git: 3 commits - sc/source

Jan Holesovsky kendy at collabora.com
Wed Jan 13 06:11:01 PST 2016


 sc/source/core/data/document.cxx |    6 ++++++
 sc/source/ui/view/tabvwshf.cxx   |   18 +++++++++++++-----
 2 files changed, 19 insertions(+), 5 deletions(-)

New commits:
commit ba3dd2fe5e74337c538205e5be0daf399ee51943
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 13 15:03:37 2016 +0100

    sc: Fix the unit tests.
    
    Change-Id: I1d5ea5835115bca3c8d24dc1f2e43c14d5d7b47a

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index e878815..b8206422 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -105,6 +105,7 @@
 #include <memory>
 #include <boost/checked_delete.hpp>
 
+#include <comphelper/lok.hxx>
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 
 #include "mtvelements.hxx"
@@ -569,7 +570,7 @@ bool ScDocument::InsertTab(
         aCxt.mnTabDeletedEnd = nPos;
         SetAllFormulasDirty(aCxt);
 
-        if (GetDrawLayer()->isTiledRendering())
+        if (comphelper::LibreOfficeKit::isActive() && GetDrawLayer())
             GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
     }
 
commit 19ef189f3bebe46a412d22fb6205b0e4c1aa377f
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 13 11:56:34 2016 +0100

    sc: Further .uno:Insert (inserting a new sheet) tweak.
    
    Change-Id: I5437e173009be2b21594abfa133c1b48e53a2ff3

diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 2b838bf..8ed4937 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -192,8 +192,10 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                         else
                             --nTabNr;
 
-                        if ( nTabNr <= nTabCount )
-                            bOk = InsertTable( aName, nTabNr );
+                        if (nTabNr > nTabCount)
+                            nTabNr = nTabCount;
+
+                        bOk = InsertTable(aName, nTabNr);
                     }
 
                     if (bOk)
commit b70b579b7cc27a6bd2a348acf474b2c2e3fd7e9a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Jan 13 11:12:12 2016 +0100

    sc: Make .uno:Insert (inserting a new sheet) always succeed.
    
    Also, when provided with '0' as the sheet number, treat it as adding at the
    end - which I think is the usual use case one wants to target.
    
    Change-Id: I9e1a1733c2310b8c6bb7ff239351e88bbef09ac7

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index deaddf4..e878815 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -105,6 +105,8 @@
 #include <memory>
 #include <boost/checked_delete.hpp>
 
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+
 #include "mtvelements.hxx"
 
 using ::editeng::SvxBorderLine;
@@ -566,6 +568,9 @@ bool ScDocument::InsertTab(
         aCxt.mnTabDeletedStart = nPos;
         aCxt.mnTabDeletedEnd = nPos;
         SetAllFormulasDirty(aCxt);
+
+        if (GetDrawLayer()->isTiledRendering())
+            GetDrawLayer()->libreOfficeKitCallback(LOK_CALLBACK_DOCUMENT_SIZE_CHANGED, "");
     }
 
     return bValid;
diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx
index 0f31469..2b838bf 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -177,15 +177,21 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
                     bool bOk = false;
                     const SfxPoolItem*  pTabItem;
                     const SfxPoolItem*  pNameItem;
-                    OUString            aName;
 
                     if ( pReqArgs->HasItem( FN_PARAM_1, &pTabItem ) &&
                          pReqArgs->HasItem( nSlot, &pNameItem ) )
                     {
+                        OUString aName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
+                        pDoc->CreateValidTabName(aName);
+
                         // sheet number from basic: 1-based
+                        // 0 is special, means adding at the end
+                        nTabNr = static_cast<const SfxUInt16Item*>(pTabItem)->GetValue();
+                        if (nTabNr == 0)
+                            nTabNr = nTabCount;
+                        else
+                            --nTabNr;
 
-                        aName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
-                        nTabNr = static_cast<const SfxUInt16Item*>(pTabItem)->GetValue() - 1;
                         if ( nTabNr <= nTabCount )
                             bOk = InsertTable( aName, nTabNr );
                     }


More information about the Libreoffice-commits mailing list