officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 5 sc/Library_sc.mk | 1 sc/UIConfig_scalc.mk | 1 sc/inc/datamapper.hxx | 11 sc/inc/sc.hrc | 2 sc/sdi/cellsh.sdi | 1 sc/sdi/scalc.sdi | 17 sc/source/filter/xml/xmlmappingi.cxx | 2 sc/source/ui/docshell/dataprovider.cxx | 27 sc/source/ui/inc/dataprovider.hxx | 10 sc/source/ui/inc/dataproviderdlg.hxx | 69 + sc/source/ui/miscdlgs/dataproviderdlg.cxx | 171 +++ sc/source/ui/view/cellsh2.cxx | 17 sc/uiconfig/scalc/menubar/menubar.xml | 1 sc/uiconfig/scalc/toolbar/dataprovider.xml | 14 sc/uiconfig/scalc/ui/dataprovider.ui | 428 ++++++++++ 16 files changed, 757 insertions(+), 20 deletions(-)
New commits: commit 95c25102aeefbc0082ba467755b91a483775e193 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Thu Aug 10 00:56:48 2017 +0200 external data: move the copying to the document to ScDBDataManager Change-Id: Ic97dcc6418176630ceb50c0c6010c848f2302b59 Reviewed-on: https://gerrit.libreoffice.org/40958 Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/inc/datamapper.hxx b/sc/inc/datamapper.hxx index c96c63f942c0..b8216b0de0de 100644 --- a/sc/inc/datamapper.hxx +++ b/sc/inc/datamapper.hxx @@ -67,10 +67,12 @@ private: std::shared_ptr<DataProvider> mpDataProvider; std::shared_ptr<ScDBDataManager> mpDBDataManager; + ScDocument* mpDoc; + public: ExternalDataSource(const OUString& rURL, - const OUString& rProvider); + const OUString& rProvider, ScDocument* pDoc); ~ExternalDataSource(); diff --git a/sc/source/filter/xml/xmlmappingi.cxx b/sc/source/filter/xml/xmlmappingi.cxx index 426de53670e6..b32dbd9c72f7 100644 --- a/sc/source/filter/xml/xmlmappingi.cxx +++ b/sc/source/filter/xml/xmlmappingi.cxx @@ -113,7 +113,7 @@ ScXMLMappingContext::ScXMLMappingContext( ScXMLImport& rImport, if (pDBData) { auto& rDataMapper = pDoc->GetExternalDataMapper(); - sc::ExternalDataSource aSource(aURL, aProvider); + sc::ExternalDataSource aSource(aURL, aProvider, pDoc); aSource.setID(aID); aSource.setDBData(pDBData); rDataMapper.insertDataSource(aSource); diff --git a/sc/source/ui/docshell/dataprovider.cxx b/sc/source/ui/docshell/dataprovider.cxx index 703bf6b363e6..9cafe70e94f5 100644 --- a/sc/source/ui/docshell/dataprovider.cxx +++ b/sc/source/ui/docshell/dataprovider.cxx @@ -58,10 +58,10 @@ std::unique_ptr<SvStream> FetchStreamFromURL(const OUString& rURL, OStringBuffer } ExternalDataSource::ExternalDataSource(const OUString& rURL, - const OUString& rProvider): + const OUString& rProvider, ScDocument* pDoc): maURL(rURL), maProvider(rProvider), - mnUpdateFrequency(0) + mpDoc(pDoc) { } @@ -104,7 +104,7 @@ void ExternalDataSource::setDBData(ScDBData* pDBData) { if (!mpDBDataManager) { - mpDBDataManager.reset(new ScDBDataManager(pDBData, false)); + mpDBDataManager.reset(new ScDBDataManager(pDBData, false, mpDoc)); } else { @@ -352,7 +352,7 @@ void CSVDataProvider::Import() IMPL_LINK_NOARG(CSVDataProvider, ImportFinishedHdl, Timer*, void) { - WriteToDoc(*mpDoc, mpDBDataManager->getDBData()); + mpDBDataManager->WriteToDoc(*mpDoc, mpDBDataManager->getDBData()); mxCSVFetchThread.clear(); mpDoc.reset(); Refresh(); @@ -387,7 +387,7 @@ Line CSVDataProvider::GetLine() } // TODO: why don't we use existing copy functionality -void CSVDataProvider::WriteToDoc(ScDocument& rDoc, ScDBData* pDBData) +void ScDBDataManager::WriteToDoc(ScDocument& rDoc, ScDBData* pDBData) { bool bShrunk = false; SCCOL nStartCol = 0; @@ -409,21 +409,22 @@ void CSVDataProvider::WriteToDoc(ScDocument& rDoc, ScDBData* pDBData) if (pfValue == nullptr) { OUString aString = rDoc.GetString(nCol, nRow, 0); - mpDocument->SetString(aDestRange.aStart.Col() + nCol, aDestRange.aStart.Row() + nRow, aDestRange.aStart.Tab(), aString); + mpDoc->SetString(aDestRange.aStart.Col() + nCol, aDestRange.aStart.Row() + nRow, aDestRange.aStart.Tab(), aString); } else { - mpDocument->SetValue(aDestRange.aStart.Col() + nCol, aDestRange.aStart.Row() + nRow, aDestRange.aStart.Tab(), *pfValue); + mpDoc->SetValue(aDestRange.aStart.Col() + nCol, aDestRange.aStart.Row() + nRow, aDestRange.aStart.Tab(), *pfValue); } } } - ScDocShell* pDocShell = static_cast<ScDocShell*>(mpDocument->GetDocumentShell()); + ScDocShell* pDocShell = static_cast<ScDocShell*>(mpDoc->GetDocumentShell()); pDocShell->PostPaint(aDestRange, PaintPartFlags::All); } -ScDBDataManager::ScDBDataManager(ScDBData* pDBData, bool /*bAllowResize*/): - mpDBData(pDBData) - //mbAllowResize(bAllowResize) +ScDBDataManager::ScDBDataManager(ScDBData* pDBData, bool /*bAllowResize*/, ScDocument* pDoc): + mpDBData(pDBData), + //mbAllowResize(bAllowResize), + mpDoc(pDoc) { } diff --git a/sc/source/ui/inc/dataprovider.hxx b/sc/source/ui/inc/dataprovider.hxx index b0a3b5d58273..6f203889fb37 100644 --- a/sc/source/ui/inc/dataprovider.hxx +++ b/sc/source/ui/inc/dataprovider.hxx @@ -116,7 +116,6 @@ public: virtual ~DataProvider() = 0; virtual void Import() = 0; - virtual void WriteToDoc(ScDocument& rDoc, ScDBData* pDBData) = 0; virtual const OUString& GetURL() const = 0; }; @@ -141,14 +140,10 @@ public: virtual void Import() override; - // TODO: this method should be moved to the ScDBDataManager - virtual void WriteToDoc(ScDocument& rDoc, ScDBData* pDBData) override; const OUString& GetURL() const override { return maURL; } - DECL_LINK( ImportFinishedHdl, Timer*, void ); }; - /** * This class handles the copying of the data from the imported * temporary document to the actual document. Additionally, in the future @@ -162,14 +157,17 @@ public: class ScDBDataManager { ScDBData* mpDBData; + ScDocument* mpDoc; public: - ScDBDataManager(ScDBData* pDBData, bool bAllowResize); + ScDBDataManager(ScDBData* pDBData, bool bAllowResize, ScDocument* pDoc); ~ScDBDataManager(); void SetDatabase(ScDBData* pDBData); ScDBData* getDBData(); + + void WriteToDoc(ScDocument& rDoc, ScDBData* pDBData); }; class DataProviderFactory diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx index ae0427217ed9..eaa830cde2c1 100644 --- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx +++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx @@ -161,7 +161,7 @@ void DataProviderDlg::StartImport() OUString aURL; // TODO : replace those strings with something that is obtained from user - ExternalDataSource aDataSource(aURL, "org.libreoffice.calc.csv"); + ExternalDataSource aDataSource(aURL, "org.libreoffice.calc.csv", &mpDocShell->GetDocument()); //aDataSource.setDBData(pDBData); mpDocShell->GetDocument().GetExternalDataMapper().insertDataSource(aDataSource); } commit 213a83ce46edf1b81f2285fd59f1d04935760caa Author: Jaskaran Singh <jvsg1...@gmail.com> Date: Mon Aug 7 23:39:39 2017 +0530 Add UI for the sc::dataprovider Change-Id: I29acc8903d5694e46e7575133ee852bbaae6eeee Reviewed-on: https://gerrit.libreoffice.org/40851 Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu index 1008af5d8688..f44986cd64e4 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu @@ -1585,6 +1585,11 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:DataProvider" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">Data Provider...</value> + </prop> + </node> <node oor:name=".uno:ManageXMLSource" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~XML Source...</value> diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index e9220df0bd9c..4bc99c5b939d 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -464,6 +464,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/miscdlgs/conflictsdlg \ sc/source/ui/miscdlgs/crnrdlg \ sc/source/ui/miscdlgs/datastreamdlg \ + sc/source/ui/miscdlgs/dataproviderdlg \ sc/source/ui/miscdlgs/highred \ sc/source/ui/miscdlgs/mergecellsdialog \ sc/source/ui/miscdlgs/optsolver \ diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 92d408709022..bd926ac93dd6 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -110,6 +110,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/datafieldoptionsdialog \ sc/uiconfig/scalc/ui/dataform \ sc/uiconfig/scalc/ui/datastreams \ + sc/uiconfig/scalc/ui/dataprovider \ sc/uiconfig/scalc/ui/definedatabaserangedialog \ sc/uiconfig/scalc/ui/definename \ sc/uiconfig/scalc/ui/deletecells \ diff --git a/sc/inc/datamapper.hxx b/sc/inc/datamapper.hxx index 28476df8d8dd..c96c63f942c0 100644 --- a/sc/inc/datamapper.hxx +++ b/sc/inc/datamapper.hxx @@ -11,6 +11,9 @@ #define INCLUDED_SC_INC_EXTERNALDATAMAPPER_HXX #include <memory> +#include <vector> + +#include "scdllapi.h" #include <rtl/ustring.hxx> @@ -23,7 +26,7 @@ class ScDBDataManager; class DataProvider; class ScDBDataManager; -class ExternalDataSource +class SC_DLLPUBLIC ExternalDataSource { private: @@ -69,6 +72,8 @@ public: ExternalDataSource(const OUString& rURL, const OUString& rProvider); + ~ExternalDataSource(); + void setUpdateFrequency(double nUpdateFrequency); void setID(const OUString& rID); diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 7cd95f8d0507..eda54c590d7e 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -84,6 +84,8 @@ #define SID_SCFORMULAOPTIONS (SC_VIEW_START + 20) #define SID_SCDEFAULTSOPTIONS (SC_VIEW_START + 21) + +#define SID_DATA_PROVIDER (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 9958dccc5489..8db89f78171a 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -48,6 +48,7 @@ interface CellSelection SID_DATA_STREAMS [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_DATA_STREAMS_PLAY [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] SID_DATA_STREAMS_STOP [ ExecMethod = ExecuteDB; StateMethod = GetDBState; ] + SID_DATA_PROVIDER [ 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 c149b8739937..b828206cf121 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -4467,6 +4467,23 @@ SfxVoidItem DataStreamsStop SID_DATA_STREAMS_STOP GroupId = SfxGroupId::Data; ] +SfxVoidItem DataProvider SID_DATA_PROVIDER +() +[ + AutoUpdate = FALSE, + FastCall = FALSE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + + AccelConfig = TRUE, + MenuConfig = TRUE, + ToolBoxConfig = FALSE, + GroupId = SfxGroupId::Data; +] + SfxVoidItem ManageXMLSource SID_MANAGE_XML_SOURCE (SfxStringItem DbName SID_MANAGE_XML_SOURCE) [ diff --git a/sc/source/ui/docshell/dataprovider.cxx b/sc/source/ui/docshell/dataprovider.cxx index 2ce549156146..703bf6b363e6 100644 --- a/sc/source/ui/docshell/dataprovider.cxx +++ b/sc/source/ui/docshell/dataprovider.cxx @@ -65,6 +65,10 @@ ExternalDataSource::ExternalDataSource(const OUString& rURL, { } +ExternalDataSource::~ExternalDataSource() +{ +} + void ExternalDataSource::setID(const OUString& rID) { maID = rID; diff --git a/sc/source/ui/inc/dataproviderdlg.hxx b/sc/source/ui/inc/dataproviderdlg.hxx new file mode 100644 index 000000000000..05e607157931 --- /dev/null +++ b/sc/source/ui/inc/dataproviderdlg.hxx @@ -0,0 +1,69 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_SC_SOURCE_UI_INC_DATAPROVIDERDLG_HXX +#define INCLUDED_SC_SOURCE_UI_INC_DATAPROVIDERDLG_HXX + +#include <sal/config.h> + +#include <rtl/ref.hxx> +#include <vcl/dialog.hxx> +#include <vcl/layout.hxx> + +#include "address.hxx" +#include "datamapper.hxx" +#include "dataprovider.hxx" + +class ScDocShell; +class SvtURLBox; +class ScRange; +class ComboBox; + +namespace sc { + +class DataProviderDlg : public ModalDialog +{ + ScDocShell *mpDocShell; + + VclPtr<SvtURLBox> m_pCbUrl; + VclPtr<PushButton> m_pBtnBrowse; + VclPtr<RadioButton> m_pRBAddressValue; + VclPtr<CheckBox> m_pCBRefreshOnEmpty; + VclPtr<RadioButton> m_pRBMaxLimit; + VclPtr<RadioButton> m_pRBUnlimited; + VclPtr<Edit> m_pEdRange; + VclPtr<Edit> m_pEdLimit; + VclPtr<OKButton> m_pBtnOk; + VclPtr<VclFrame> m_pVclFrameLimit; + + DECL_LINK(UpdateClickHdl, Button*, void); + DECL_LINK(UpdateHdl, Edit&, void); + DECL_LINK(UpdateComboBoxHdl, ComboBox&, void); + DECL_LINK(BrowseHdl, Button*, void); + + void UpdateEnable(); + ScRange GetStartRange(); + + std::shared_ptr<ExternalDataSource> mpDataSource; + +public: + DataProviderDlg(ScDocShell *pDocShell, vcl::Window* pParent); + virtual ~DataProviderDlg() override; + virtual void dispose() override; + + void Init(); + + void StartImport(); +}; + +} + +#endif // INCLUDED_SC_SOURCE_UI_INC_DATAPROVIDERDLG_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx new file mode 100644 index 000000000000..ae0427217ed9 --- /dev/null +++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx @@ -0,0 +1,171 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <dataproviderdlg.hxx> + +#include <sfx2/filedlghelper.hxx> +#include <svtools/inettbc.hxx> +#include <vcl/layout.hxx> +#include <address.hxx> +#include <docsh.hxx> +#include <dbdata.hxx> +#include "datamapper.hxx" + +namespace sc { + +DataProviderDlg::DataProviderDlg(ScDocShell *pDocShell, vcl::Window* pParent) + : ModalDialog(pParent, "DataProviderDialog", "modules/scalc/ui/dataprovider.ui") + , mpDocShell(pDocShell) +{ + get(m_pCbUrl, "url"); + get(m_pBtnBrowse, "browse"); + get(m_pRBAddressValue, "addressvalue"); + get(m_pCBRefreshOnEmpty, "refresh_ui"); + //get(m_pRBRangeDown, "rangedown"); + //get(m_pRBNoMove, "nomove"); + get(m_pRBMaxLimit, "maxlimit"); + get(m_pRBUnlimited, "unlimited"); + get(m_pEdRange, "range"); + get(m_pEdLimit, "limit"); + get(m_pBtnOk, "ok"); + get(m_pVclFrameLimit, "framelimit"); + //get(m_pVclFrameMove, "framemove"); + + m_pCbUrl->SetSelectHdl( LINK( this, DataProviderDlg, UpdateComboBoxHdl ) ); + m_pRBAddressValue->SetClickHdl( LINK( this, DataProviderDlg, UpdateClickHdl ) ); + m_pRBAddressValue->Enable(false); + //m_pRBScriptData->Enable(false); + //m_pRBDirectData->Hide(); + //m_pRBScriptData->Hide(); + //m_pRBNoMove->Hide(); + //m_pRBValuesInLine->SetClickHdl( LINK( this, DataProviderDlg, UpdateClickHdl ) ); + m_pEdRange->SetModifyHdl( LINK( this, DataProviderDlg, UpdateHdl ) ); + m_pBtnBrowse->SetClickHdl( LINK( this, DataProviderDlg, BrowseHdl ) ); + UpdateEnable(); +} + +DataProviderDlg::~DataProviderDlg() +{ + disposeOnce(); +} + +void DataProviderDlg::dispose() +{ + m_pCbUrl.clear(); + m_pBtnBrowse.clear(); + //m_pRBDirectData.clear(); + //m_pRBScriptData.clear(); + //m_pRBValuesInLine.clear(); + m_pRBAddressValue.clear(); + m_pCBRefreshOnEmpty.clear(); + //m_pRBDataDown.clear(); + //m_pRBRangeDown.clear(); + //m_pRBNoMove.clear(); + m_pRBMaxLimit.clear(); + m_pRBUnlimited.clear(); + m_pEdRange.clear(); + m_pEdLimit.clear(); + m_pBtnOk.clear(); + m_pVclFrameLimit.clear(); + //m_pVclFrameMove.clear(); + ModalDialog::dispose(); +} + +IMPL_LINK_NOARG(DataProviderDlg, BrowseHdl, Button*, void) +{ + sfx2::FileDialogHelper aFileDialog(0); + if ( aFileDialog.Execute() != ERRCODE_NONE ) + return; + + m_pCbUrl->SetText( aFileDialog.GetPath() ); + UpdateEnable(); +} + +IMPL_LINK_NOARG(DataProviderDlg, UpdateClickHdl, Button*, void) +{ + UpdateEnable(); +} +IMPL_LINK_NOARG(DataProviderDlg, UpdateComboBoxHdl, ComboBox&, void) +{ + UpdateEnable(); +} +IMPL_LINK_NOARG(DataProviderDlg, UpdateHdl, Edit&, void) +{ + UpdateEnable(); +} + +void DataProviderDlg::UpdateEnable() +{ + bool bOk = !m_pCbUrl->GetURL().isEmpty(); + if (m_pRBAddressValue->IsChecked()) + { + m_pVclFrameLimit->Disable(); + //m_pVclFrameMove->Disable(); + m_pEdRange->Disable(); + } + else + { + m_pVclFrameLimit->Enable(); + //m_pVclFrameMove->Enable(); + m_pEdRange->Enable(); + if (bOk) + { + // Check the given range to make sure it's valid. + ScRange aTest = GetStartRange(); + if (!aTest.IsValid()) + bOk = false; + } + } + m_pBtnOk->Enable(bOk); + setOptimalLayoutSize(); +} + +ScRange DataProviderDlg::GetStartRange() +{ + OUString aStr = m_pEdRange->GetText(); + ScDocument& rDoc = mpDocShell->GetDocument(); + ScRange aRange; + ScRefFlags nRes = aRange.Parse(aStr, &rDoc, rDoc.GetAddressConvention()); + if ( ((nRes & ScRefFlags::VALID) == ScRefFlags::ZERO) || !aRange.IsValid()) + { + // Invalid range. + aRange.SetInvalid(); + return aRange; + } + + // Make sure it's only one row tall. + if (aRange.aStart.Row() != aRange.aEnd.Row()) + aRange.SetInvalid(); + + return aRange; +} + +void DataProviderDlg::Init() +{ + // TODO : Get the user specified Url and Range + (void)this; +} + +void DataProviderDlg::StartImport() +{ + ScRange aRange = GetStartRange(); + if (!aRange.IsValid()) + // Don't start the stream without a valid range. + return; + + OUString aURL; + // TODO : replace those strings with something that is obtained from user + ExternalDataSource aDataSource(aURL, "org.libreoffice.calc.csv"); + //aDataSource.setDBData(pDBData); + mpDocShell->GetDocument().GetExternalDataMapper().insertDataSource(aDataSource); +} + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 6b3fd6245ba0..7866f7693e9f 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -62,6 +62,7 @@ #include "asciiopt.hxx" #include "datastream.hxx" #include "datastreamdlg.hxx" +#include "dataproviderdlg.hxx" #include "queryentry.hxx" #include "markdata.hxx" #include <documentlinkmgr.hxx> @@ -778,6 +779,20 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) pStrm->StopImport(); } break; + case SID_DATA_PROVIDER: + { + ScopedVclPtrInstance< sc::DataProviderDlg > aDialog( GetViewData()->GetDocShell(), pTabViewShell->GetDialogParent() ); + //ScDocument *pDoc = GetViewData()->GetDocument(); + //sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager(); + //sc::DataStream* pStrm = rMgr.getDataStream(); + //if (pStrm) + aDialog->Init(/**pStrm*/); + aDialog->Execute(); + + //if (aDialog->Execute() == RET_OK) + //aDialog->StartStream(); + } + break; case SID_MANAGE_XML_SOURCE: ExecuteXMLSourceDialog(); break; @@ -1184,6 +1199,8 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) } } break; + case SID_DATA_PROVIDER: + 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 5ec8e3fc4cbe..e40766848f09 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -630,6 +630,7 @@ <menu:menuseparator/> <menu:menuitem menu:id=".uno:DataStreams"/> <menu:menuitem menu:id=".uno:ManageXMLSource"/> + <menu:menuitem menu:id=".uno:DataProvider"/> <menu:menuseparator/> <menu:menuitem menu:id=".uno:TableOperationDialog"/> <menu:menuitem menu:id=".uno:TextToColumns"/> diff --git a/sc/uiconfig/scalc/toolbar/dataprovider.xml b/sc/uiconfig/scalc/toolbar/dataprovider.xml new file mode 100644 index 000000000000..3bf23017beb4 --- /dev/null +++ b/sc/uiconfig/scalc/toolbar/dataprovider.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE toolbar:toolbar PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "toolbar.dtd"> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. +--> +<toolbar:toolbar xmlns:toolbar="http://openoffice.org/2001/toolbar" xmlns:xlink="http://www.w3.org/1999/xlink" toolbar:id="toolbar"> + <toolbar:toolbaritem xlink:href=".uno:DataProviderPlay"/> + <toolbar:toolbarseparator/> + <toolbar:toolbaritem xlink:href=".uno:DataProviderStop"/> +</toolbar:toolbar> diff --git a/sc/uiconfig/scalc/ui/dataprovider.ui b/sc/uiconfig/scalc/ui/dataprovider.ui new file mode 100644 index 000000000000..d5872e514160 --- /dev/null +++ b/sc/uiconfig/scalc/ui/dataprovider.ui @@ -0,0 +1,428 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface domain="sc"> + <requires lib="gtk+" version="3.0"/> + <requires lib="LibreOffice" version="1.0"/> + <object class="GtkDialog" id="DataProviderDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="title" translatable="yes" context="datastreams|DataStreamDialog">Live Data Streams</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + <property name="secondary">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="dialog-vbox2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkFrame" id="frame"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkBox" id="box12"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="spacing">12</property> + <child> + <object class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="datastreams|label6">URL:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="svtlo-SvtURLBox" id="url"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="has_tooltip">True</property> + <property name="tooltip_text" translatable="yes" context="datastreams|url|tooltip_text">Enter the URL of the source document in the local file system or Internet here.</property> + <property name="hexpand">True</property> + <property name="has_entry">True</property> + <property name="max_width_chars">48</property> + <child internal-child="entry"> + <object class="GtkEntry" id="URLBox-entry"> + <property name="can_focus">False</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="browse"> + <property name="label" translatable="yes" context="datastreams|browse">_Browse...</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box13"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">6</property> + <child> + <object class="GtkFrame" id="frame4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment5"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkRadioButton" id="valuesinline"> + <property name="label" translatable="yes" context="datastreams|valuesinline">value1,value2,...,valueN, and fill into range:</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">addressvalue</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="addressvalue"> + <property name="label" translatable="yes" context="datastreams|addressvalue">address,value</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <property name="group">valuesinline</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="range"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">â</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="datastreams|label4">Interpret stream data as</property> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">6</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <object class="GtkCheckButton" id="refresh_ui"> + <property name="label" translatable="yes" context="datastreams|refresh_ui">Empty lines trigger UI refresh</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">3</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="datastreams|label">Source Stream</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="padding">6</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="spacing">6</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkFrame" id="framelimit"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="left_padding">12</property> + <child> + <object class="GtkGrid" id="grid3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkRadioButton" id="maxlimit"> + <property name="label" translatable="yes" context="datastreams|maxlimit">Limit to:</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + <property name="group">unlimited</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkEntry" id="limit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hexpand">True</property> + <property name="invisible_char">â</property> + <property name="text">1000</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="unlimited"> + <property name="label" translatable="yes" context="datastreams|unlimited">_Unlimited</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="valign">start</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <property name="group">maxlimit</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="datastreams|label3">Maximal Amount of Rows</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + <action-widget response="0">cancel</action-widget> + <action-widget response="0">help</action-widget> + </action-widgets> + </object> + <object class="GtkAdjustment" id="adjustment1"> + <property name="lower">1</property> + <property name="upper">99999</property> + <property name="value">1</property> + <property name="step_increment">1</property> + <property name="page_increment">10</property> + </object> +</interface>
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits