summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2016-01-21 00:02:16 +0100
committerJan Holesovsky <kendy@collabora.com>2016-01-21 00:04:50 +0100
commitcccbc20a9a44350dc48b9280d47b58e4e2a4dc31 (patch)
treef8a96dbc3a9a0ec1f4329d72e5a7af9888144453 /sc
parent59a93573d677c85402b78bf748c7267554cf3ca2 (diff)
sc lok: Fix .uno:Remove (removing sheets) to accept a parameter.
.sdi annouces that, but it was never implemented... Change-Id: I7abfbdc88f055eeb993617a5a51371af0f825d34
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/document.cxx6
-rw-r--r--sc/source/ui/view/tabvwshf.cxx65
2 files changed, 50 insertions, 21 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 79eab8f80e89..dd56015bc71f 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 82a33dc7caec..53fd7c83e966 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);