From 447ecc3cfbae6a3db60d5c04360c4fa1f65eb679 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sat, 19 Aug 2017 23:22:57 +0200 Subject: external data: add a menu entry to refresh the data Change-Id: I1942488d518be91c3ad03f91d98834e22bfdfb16 Reviewed-on: https://gerrit.libreoffice.org/41339 Tested-by: Jenkins Reviewed-by: Markus Mohrhard --- sc/inc/sc.hrc | 3 ++- sc/sdi/cellsh.sdi | 1 + sc/sdi/scalc.sdi | 19 ++++++++++++++++++- sc/source/ui/view/cellsh2.cxx | 19 +++++++++++++++++++ sc/uiconfig/scalc/menubar/menubar.xml | 1 + 5 files changed, 41 insertions(+), 2 deletions(-) (limited to 'sc') diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index eda54c590d7e..aca25080d5d6 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -85,7 +85,8 @@ #define SID_SCDEFAULTSOPTIONS (SC_VIEW_START + 21) -#define SID_DATA_PROVIDER (SC_VIEW_START + 32) +#define SID_DATA_PROVIDER (SC_VIEW_START + 31) +#define SID_DATA_PROVIDER_REFRESH (SC_VIEW_START + 32) #define SID_DATA_STREAMS_PLAY (SC_VIEW_START + 33) #define SID_DATA_STREAMS_STOP (SC_VIEW_START + 34) #define SID_DATA_STREAMS (SC_VIEW_START + 35) diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 8db89f78171a..90b62dae89df 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -49,6 +49,7 @@ interface CellSelection SID_DATA_STREAMS_PLAY [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_DATA_STREAMS_STOP [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_DATA_PROVIDER [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] + SID_DATA_PROVIDER_REFRESH [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_MANAGE_XML_SOURCE [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_SORT [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_DATA_FORM [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index b828206cf121..ffb9f3c59e2b 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -4472,7 +4472,24 @@ SfxVoidItem DataProvider SID_DATA_PROVIDER [ AutoUpdate = FALSE, FastCall = FALSE, - ReadOnlyDoc = TRUE, + ReadOnlyDoc = FALSE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = FALSE, + GroupId = SfxGroupId::Data; +] + +SfxVoidItem DataProviderRefresh SID_DATA_PROVIDER_REFRESH +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = FALSE, Toggle = FALSE, Container = FALSE, RecordAbsolute = FALSE, diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 4908f4179136..b03cad6f1fac 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -55,6 +55,7 @@ #include "validat.hxx" #include "validate.hxx" #include "scresid.hxx" +#include "datamapper.hxx" #include "scui_def.hxx" #include "scabstdlg.hxx" @@ -788,6 +789,16 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) } } break; + case SID_DATA_PROVIDER_REFRESH: + { + ScDocument* pDoc = GetViewData()->GetDocument(); + auto& rDataMapper = pDoc->GetExternalDataMapper(); + for (auto& rDataSource : rDataMapper.getDataSources()) + { + rDataSource.refresh(pDoc, false); + } + } + break; case SID_MANAGE_XML_SOURCE: ExecuteXMLSourceDialog(); break; @@ -1196,6 +1207,14 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) break; case SID_DATA_PROVIDER: break; + case SID_DATA_PROVIDER_REFRESH: + { + ScDocument* pDoc = GetViewData()->GetDocument(); + auto& rDataMapper = pDoc->GetExternalDataMapper(); + if (rDataMapper.getDataSources().empty()) + rSet.DisableItem(nWhich); + } + break; case SID_DATA_STREAMS: case SID_DATA_STREAMS_PLAY: case SID_DATA_STREAMS_STOP: diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml index e40766848f09..fd9d62298b52 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -631,6 +631,7 @@ + -- cgit