[Libreoffice-commits] core.git: sc/source
Jan Holesovsky
kendy at collabora.com
Wed Jan 13 02:48:09 PST 2016
sc/source/core/data/document.cxx | 5 +++++
sc/source/ui/view/tabvwshf.cxx | 12 +++++++++---
2 files changed, 14 insertions(+), 3 deletions(-)
New commits:
commit b908497aaff0ec48340f24df33182430b32a4023
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