summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2016-01-13 11:12:12 +0100
committerJan Holesovsky <kendy@collabora.com>2016-01-13 11:13:50 +0100
commit39997d4831fc1ca900d1037b0beec1b8b91b6e83 (patch)
treedec2f455cbdb5e069036dcdcbeedc276d81a5da7 /sc
parent9074fcb3db9653ace243b0fd3373fa9d3956cd0a (diff)
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
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/document.cxx5
-rw-r--r--sc/source/ui/view/tabvwshf.cxx14
2 files changed, 15 insertions, 4 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index bb6431a84783..0e93b8173a54 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -104,6 +104,8 @@
#include <boost/checked_delete.hpp>
#include <boost/scoped_ptr.hpp>
+#include <LibreOfficeKit/LibreOfficeKitEnums.h>
+
#include "mtvelements.hxx"
using ::editeng::SvxBorderLine;
@@ -555,6 +557,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 7fd1fdcaeadd..63adab3350fc 100644
--- a/sc/source/ui/view/tabvwshf.cxx
+++ b/sc/source/ui/view/tabvwshf.cxx
@@ -178,15 +178,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 ) )
{
- // tablenumber from basic: 1-based
+ OUString aName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
+ pDoc->CreateValidTabName(aName);
+
+ // tablenumber from basic is 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 );
}