diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-04-04 14:33:16 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-04-07 17:46:39 +0200 |
commit | c4764345e0d326c7a9d443f5af06f06854806bdc (patch) | |
tree | fa2b95cb454e3db9a683061a6a3b2bdaef11fada /sc | |
parent | 20a35c313496b1ca63d3bb79e0a88a3d862d8747 (diff) |
weld ScLinkedAreaDlg
Change-Id: I427e5abd76f6edfa891c9186d5822173d3fa7f7e
Reviewed-on: https://gerrit.libreoffice.org/52513
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/scabstdlg.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.cxx | 21 | ||||
-rw-r--r-- | sc/source/ui/attrdlg/scdlgfact.hxx | 10 | ||||
-rw-r--r-- | sc/source/ui/docshell/arealink.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/linkarea.hxx | 47 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/linkarea.cxx | 181 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh1.cxx | 2 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/externaldata.ui | 51 |
8 files changed, 162 insertions, 157 deletions
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index d90cc4ed9810..ccdd419f2a69 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -454,7 +454,7 @@ public: virtual VclPtr<AbstractScSelEntryDlg > CreateScSelEntryDlg ( vcl::Window* pParent, const std::vector<OUString> &rEntryList ) = 0; - virtual VclPtr<AbstractScLinkedAreaDlg> CreateScLinkedAreaDlg(vcl::Window* pParent) = 0; + virtual VclPtr<AbstractScLinkedAreaDlg> CreateScLinkedAreaDlg(weld::Window* pParent) = 0; virtual VclPtr<AbstractScMetricInputDlg> CreateScMetricInputDlg ( vcl::Window* pParent, const OString& sDialogName, diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index b263ca09cc94..101ad4c56d96 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -115,7 +115,7 @@ AbstractScLinkedAreaDlg_Impl::~AbstractScLinkedAreaDlg_Impl() } short AbstractScLinkedAreaDlg_Impl::Execute() { - return pDlg->Execute(); + return m_xDlg->run(); } void ScAbstractTabDialog_Impl::SetCurPageId( sal_uInt16 nId ) @@ -393,32 +393,32 @@ void AbstractScLinkedAreaDlg_Impl::InitFromOldLink( const OUString& rFile, const const OUString& rOptions, const OUString& rSource, sal_uLong nRefresh ) { - pDlg->InitFromOldLink( rFile, rFilter, rOptions, rSource, nRefresh); + m_xDlg->InitFromOldLink( rFile, rFilter, rOptions, rSource, nRefresh); } OUString AbstractScLinkedAreaDlg_Impl::GetURL() { - return pDlg->GetURL(); + return m_xDlg->GetURL(); } OUString AbstractScLinkedAreaDlg_Impl::GetFilter() { - return pDlg->GetFilter(); + return m_xDlg->GetFilter(); } OUString AbstractScLinkedAreaDlg_Impl::GetOptions() { - return pDlg->GetOptions(); + return m_xDlg->GetOptions(); } OUString AbstractScLinkedAreaDlg_Impl::GetSource() { - return pDlg->GetSource(); + return m_xDlg->GetSource(); } -sal_uLong AbstractScLinkedAreaDlg_Impl::GetRefresh() +sal_uLong AbstractScLinkedAreaDlg_Impl::GetRefresh() { - return pDlg->GetRefresh(); + return m_xDlg->GetRefresh(); } ScConditionalFormatList* AbstractScCondFormatManagerDlg_Impl::GetConditionalFormatList() @@ -742,10 +742,9 @@ VclPtr<AbstractScSelEntryDlg> ScAbstractDialogFactory_Impl::CreateScSelEntryDlg return VclPtr<AbstractScSelEntryDlg_Impl>::Create( pDlg ); } -VclPtr<AbstractScLinkedAreaDlg> ScAbstractDialogFactory_Impl::CreateScLinkedAreaDlg(vcl::Window* pParent) +VclPtr<AbstractScLinkedAreaDlg> ScAbstractDialogFactory_Impl::CreateScLinkedAreaDlg(weld::Window* pParent) { - VclPtr<ScLinkedAreaDlg> pDlg = VclPtr<ScLinkedAreaDlg>::Create( pParent ); - return VclPtr<AbstractScLinkedAreaDlg_Impl>::Create( pDlg ); + return VclPtr<AbstractScLinkedAreaDlg_Impl>::Create(new ScLinkedAreaDlg(pParent)); } VclPtr<AbstractScMetricInputDlg> ScAbstractDialogFactory_Impl::CreateScMetricInputDlg ( vcl::Window* pParent, diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 33d471fec7af..86cf786de353 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -240,10 +240,12 @@ class AbstractScSelEntryDlg_Impl : public AbstractScSelEntryDlg class AbstractScLinkedAreaDlg_Impl : public AbstractScLinkedAreaDlg { - ScopedVclPtr<ScLinkedAreaDlg> pDlg; + std::unique_ptr<ScLinkedAreaDlg> m_xDlg; public: - explicit AbstractScLinkedAreaDlg_Impl( ScLinkedAreaDlg* p) - : pDlg(p) {} + explicit AbstractScLinkedAreaDlg_Impl(ScLinkedAreaDlg* p) + : m_xDlg(p) + { + } virtual ~AbstractScLinkedAreaDlg_Impl() override; virtual short Execute() override; virtual void InitFromOldLink( const OUString& rFile, const OUString& rFilter, @@ -459,7 +461,7 @@ public: virtual VclPtr<AbstractScSelEntryDlg> CreateScSelEntryDlg ( vcl::Window* pParent, const std::vector<OUString> &rEntryList ) override; - virtual VclPtr<AbstractScLinkedAreaDlg> CreateScLinkedAreaDlg(vcl::Window* pParent) override; + virtual VclPtr<AbstractScLinkedAreaDlg> CreateScLinkedAreaDlg(weld::Window* pParent) override; virtual VclPtr<AbstractScMetricInputDlg> CreateScMetricInputDlg ( vcl::Window* pParent, const OString& sDialogName, diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index 8a75234cc686..c1def55db4d3 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -73,14 +73,13 @@ ScAreaLink::~ScAreaLink() StopRefreshTimer(); } -void ScAreaLink::Edit(weld::Window*, const Link<SvBaseLink&,void>& /* rEndEditHdl */ ) +void ScAreaLink::Edit(weld::Window* pParent, const Link<SvBaseLink&,void>& /* rEndEditHdl */ ) { // use own dialog instead of SvBaseLink::Edit... ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); -//TODO ScopedVclPtr<AbstractScLinkedAreaDlg> pDlg(pFact->CreateScLinkedAreaDlg(pParent)); - ScopedVclPtr<AbstractScLinkedAreaDlg> pDlg(pFact->CreateScLinkedAreaDlg(nullptr)); + ScopedVclPtr<AbstractScLinkedAreaDlg> pDlg(pFact->CreateScLinkedAreaDlg(pParent)); OSL_ENSURE(pDlg, "Dialog create fail!"); pDlg->InitFromOldLink( aFileName, aFilterName, aOptions, aSourceArea, GetRefreshDelay() ); if ( pDlg->Execute() == RET_OK ) diff --git a/sc/source/ui/inc/linkarea.hxx b/sc/source/ui/inc/linkarea.hxx index e0fef1f20f9e..564568419d30 100644 --- a/sc/source/ui/inc/linkarea.hxx +++ b/sc/source/ui/inc/linkarea.hxx @@ -20,12 +20,7 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_LINKAREA_HXX #define INCLUDED_SC_SOURCE_UI_INC_LINKAREA_HXX -#include <vcl/dialog.hxx> - -#include <vcl/button.hxx> -#include <vcl/field.hxx> -#include <vcl/fixed.hxx> -#include <vcl/lstbox.hxx> +#include <vcl/weld.hxx> #include <sfx2/objsh.hxx> #include <svtools/inettbc.hxx> @@ -34,27 +29,26 @@ namespace sfx2 { class FileDialogHelper; } class ScDocShell; -class ScLinkedAreaDlg : public ModalDialog +class ScLinkedAreaDlg : public weld::GenericDialogController { private: - VclPtr<SvtURLBox> m_pCbUrl; - VclPtr<PushButton> m_pBtnBrowse; - VclPtr<ListBox> m_pLbRanges; - VclPtr<CheckBox> m_pBtnReload; - VclPtr<NumericField> m_pNfDelay; - VclPtr<FixedText> m_pFtSeconds; - VclPtr<OKButton> m_pBtnOk; - - ScDocShell* pSourceShell; - std::unique_ptr<sfx2::DocumentInserter> pDocInserter; - + ScDocShell* m_pSourceShell; + std::unique_ptr<sfx2::DocumentInserter> m_xDocInserter; SfxObjectShellRef aSourceRef; - DECL_LINK(FileHdl, ComboBox&, void); - DECL_LINK(BrowseHdl, Button*, void); - DECL_LINK(RangeHdl, ListBox&, void); - DECL_LINK(ReloadHdl, Button*, void); - DECL_LINK( DialogClosedHdl, sfx2::FileDialogHelper*, void ); + std::unique_ptr<URLBox> m_xCbUrl; + std::unique_ptr<weld::Button> m_xBtnBrowse; + std::unique_ptr<weld::TreeView> m_xLbRanges; + std::unique_ptr<weld::CheckButton> m_xBtnReload; + std::unique_ptr<weld::SpinButton> m_xNfDelay; + std::unique_ptr<weld::Label> m_xFtSeconds; + std::unique_ptr<weld::Button> m_xBtnOk; + + DECL_LINK(FileHdl, weld::ComboBoxText&, void); + DECL_LINK(BrowseHdl, weld::Button&, void); + DECL_LINK(RangeHdl, weld::TreeView&, void); + DECL_LINK(ReloadHdl, weld::Button&, void); + DECL_LINK(DialogClosedHdl, sfx2::FileDialogHelper*, void); void UpdateSourceRanges(); void UpdateEnable(); @@ -62,9 +56,8 @@ private: const OUString& rOptions ); public: - ScLinkedAreaDlg( vcl::Window* pParent ); - virtual ~ScLinkedAreaDlg() override; - virtual void dispose() override; + ScLinkedAreaDlg(weld::Window* pParent); + virtual ~ScLinkedAreaDlg() override; void InitFromOldLink( const OUString& rFile, const OUString& rFilter, const OUString& rOptions, const OUString& rSource, @@ -74,7 +67,7 @@ public: OUString GetFilter(); // may be empty OUString GetOptions(); // filter options OUString GetSource(); // separated by ";" - sal_uLong GetRefresh(); // 0 if disabled + sal_uLong GetRefresh(); // 0 if disabled }; #endif diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index 257f07f24747..96cfee9ab2dc 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -37,62 +37,47 @@ #include <docsh.hxx> #include <tablink.hxx> -ScLinkedAreaDlg::ScLinkedAreaDlg(vcl::Window* pParent) - : ModalDialog(pParent, "ExternalDataDialog", "modules/scalc/ui/externaldata.ui") - , pSourceShell(nullptr) - , pDocInserter(nullptr) - +ScLinkedAreaDlg::ScLinkedAreaDlg(weld::Window* pParent) + : GenericDialogController(pParent, "modules/scalc/ui/externaldata.ui", "ExternalDataDialog") + , m_pSourceShell(nullptr) + , m_xCbUrl(new URLBox(m_xBuilder->weld_combo_box_text("url"))) + , m_xBtnBrowse(m_xBuilder->weld_button("browse")) + , m_xLbRanges(m_xBuilder->weld_tree_view("ranges")) + , m_xBtnReload(m_xBuilder->weld_check_button("reload")) + , m_xNfDelay(m_xBuilder->weld_spin_button("delay")) + , m_xFtSeconds(m_xBuilder->weld_label("secondsft")) + , m_xBtnOk(m_xBuilder->weld_button("ok")) { - get(m_pCbUrl, "url"); - get(m_pLbRanges, "ranges"); - m_pLbRanges->EnableMultiSelection(true); - m_pLbRanges->SetDropDownLineCount(8); - get(m_pBtnBrowse, "browse"); - get(m_pBtnReload, "reload"); - get(m_pNfDelay, "delay"); - get(m_pFtSeconds, "secondsft"); - get(m_pBtnOk, "ok"); - - m_pCbUrl->SetSelectHdl( LINK( this, ScLinkedAreaDlg, FileHdl ) ); - m_pBtnBrowse->SetClickHdl( LINK( this, ScLinkedAreaDlg, BrowseHdl ) ); - m_pLbRanges->SetSelectHdl( LINK( this, ScLinkedAreaDlg, RangeHdl ) ); - m_pBtnReload->SetClickHdl( LINK( this, ScLinkedAreaDlg, ReloadHdl ) ); + m_xLbRanges->set_selection_mode(true); + + m_xCbUrl->connect_entry_activate(LINK( this, ScLinkedAreaDlg, FileHdl)); + m_xBtnBrowse->connect_clicked(LINK( this, ScLinkedAreaDlg, BrowseHdl)); + m_xLbRanges->connect_changed(LINK( this, ScLinkedAreaDlg, RangeHdl)); + m_xLbRanges->set_size_request(m_xLbRanges->get_approximate_digit_width() * 54, + m_xLbRanges->get_height_rows(5)); + m_xBtnReload->connect_clicked(LINK( this, ScLinkedAreaDlg, ReloadHdl)); UpdateEnable(); } ScLinkedAreaDlg::~ScLinkedAreaDlg() { - disposeOnce(); -} - -void ScLinkedAreaDlg::dispose() -{ - // pSourceShell is deleted by aSourceRef - m_pCbUrl.clear(); - m_pBtnBrowse.clear(); - m_pLbRanges.clear(); - m_pBtnReload.clear(); - m_pNfDelay.clear(); - m_pFtSeconds.clear(); - m_pBtnOk.clear(); - ModalDialog::dispose(); } #define FILTERNAME_HTML "HTML (StarCalc)" #define FILTERNAME_QUERY "calc_HTML_WebQuery" -IMPL_LINK_NOARG(ScLinkedAreaDlg, BrowseHdl, Button*, void) +IMPL_LINK_NOARG(ScLinkedAreaDlg, BrowseHdl, weld::Button&, void) { - pDocInserter.reset( new sfx2::DocumentInserter(GetFrameWeld(), ScDocShell::Factory().GetFactoryName()) ); - pDocInserter->StartExecuteModal( LINK( this, ScLinkedAreaDlg, DialogClosedHdl ) ); + m_xDocInserter.reset( new sfx2::DocumentInserter(m_xDialog.get(), ScDocShell::Factory().GetFactoryName()) ); + m_xDocInserter->StartExecuteModal( LINK( this, ScLinkedAreaDlg, DialogClosedHdl ) ); } -IMPL_LINK_NOARG(ScLinkedAreaDlg, FileHdl, ComboBox&, void) +IMPL_LINK_NOARG(ScLinkedAreaDlg, FileHdl, weld::ComboBoxText&, void) { - OUString aEntered = m_pCbUrl->GetURL(); - if (pSourceShell) + OUString aEntered = m_xCbUrl->GetURL(); + if (m_pSourceShell) { - SfxMedium* pMed = pSourceShell->GetMedium(); + SfxMedium* pMed = m_pSourceShell->GetMedium(); if ( aEntered == pMed->GetName() ) { // already loaded - nothing to do @@ -104,7 +89,7 @@ IMPL_LINK_NOARG(ScLinkedAreaDlg, FileHdl, ComboBox&, void) OUString aOptions; // get filter name by looking at the file content (bWithContent = true) // Break operation if any error occurred inside. - if (!ScDocumentLoader::GetFilterName( aEntered, aFilter, aOptions, true, true )) + if (!ScDocumentLoader::GetFilterName( aEntered, aFilter, aOptions, true, false )) return; // #i53241# replace HTML filter with DataQuery filter @@ -119,32 +104,32 @@ IMPL_LINK_NOARG(ScLinkedAreaDlg, FileHdl, ComboBox&, void) void ScLinkedAreaDlg::LoadDocument( const OUString& rFile, const OUString& rFilter, const OUString& rOptions ) { - if ( pSourceShell ) + if (m_pSourceShell) { // unload old document - pSourceShell->DoClose(); - pSourceShell = nullptr; + m_pSourceShell->DoClose(); + m_pSourceShell = nullptr; aSourceRef.clear(); } if ( !rFile.isEmpty() ) { - WaitObject aWait( this ); + weld::WaitObject aWait(m_xDialog.get()); OUString aNewFilter = rFilter; OUString aNewOptions = rOptions; SfxErrorContext aEc( ERRCTX_SFX_OPENDOC, rFile ); - ScDocumentLoader aLoader( rFile, aNewFilter, aNewOptions, 0, GetFrameWeld() ); // with interaction - pSourceShell = aLoader.GetDocShell(); - if ( pSourceShell ) + ScDocumentLoader aLoader( rFile, aNewFilter, aNewOptions, 0, m_xDialog.get() ); // with interaction + m_pSourceShell = aLoader.GetDocShell(); + if (m_pSourceShell) { - ErrCode nErr = pSourceShell->GetErrorCode(); + ErrCode nErr = m_pSourceShell->GetErrorCode(); if (nErr) ErrorHandler::HandleError( nErr ); // including warnings - aSourceRef = pSourceShell; + aSourceRef = m_pSourceShell; aLoader.ReleaseDocRef(); // don't call DoClose in DocLoader dtor } } @@ -155,13 +140,13 @@ void ScLinkedAreaDlg::InitFromOldLink( const OUString& rFile, const OUString& rF sal_uLong nRefresh ) { LoadDocument( rFile, rFilter, rOptions ); - if (pSourceShell) + if (m_pSourceShell) { - SfxMedium* pMed = pSourceShell->GetMedium(); - m_pCbUrl->SetText( pMed->GetName() ); + SfxMedium* pMed = m_pSourceShell->GetMedium(); + m_xCbUrl->SetText(pMed->GetName()); } else - m_pCbUrl->SetText( EMPTY_OUSTRING ); + m_xCbUrl->SetText(EMPTY_OUSTRING); UpdateSourceRanges(); @@ -169,23 +154,23 @@ void ScLinkedAreaDlg::InitFromOldLink( const OUString& rFile, const OUString& rF for ( sal_Int32 i=0; i<nRangeCount; i++ ) { OUString aRange = rSource.getToken(i,';'); - m_pLbRanges->SelectEntry( aRange ); + m_xLbRanges->select(aRange); } bool bDoRefresh = (nRefresh != 0); - m_pBtnReload->Check( bDoRefresh ); + m_xBtnReload->set_active(bDoRefresh); if (bDoRefresh) - m_pNfDelay->SetValue( nRefresh ); + m_xNfDelay->set_value(nRefresh); UpdateEnable(); } -IMPL_LINK_NOARG(ScLinkedAreaDlg, RangeHdl, ListBox&, void) +IMPL_LINK_NOARG(ScLinkedAreaDlg, RangeHdl, weld::TreeView&, void) { UpdateEnable(); } -IMPL_LINK_NOARG(ScLinkedAreaDlg, ReloadHdl, Button*, void) +IMPL_LINK_NOARG(ScLinkedAreaDlg, ReloadHdl, weld::Button&, void) { UpdateEnable(); } @@ -195,10 +180,10 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, if ( _pFileDlg->GetError() != ERRCODE_NONE ) return; - SfxMedium* pMed = pDocInserter->CreateMedium(); + SfxMedium* pMed = m_xDocInserter->CreateMedium(); if ( pMed ) { - WaitObject aWait( this ); + weld::WaitObject aWait(m_xDialog.get()); // replace HTML filter with DataQuery filter const OUString aHTMLFilterName( FILTERNAME_HTML ); @@ -216,30 +201,30 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, // ERRCTX_SFX_OPENDOC -> "Error loading document" SfxErrorContext aEc( ERRCTX_SFX_OPENDOC, pMed->GetName() ); - if (pSourceShell) - pSourceShell->DoClose(); // deleted when assigning aSourceRef + if (m_pSourceShell) + m_pSourceShell->DoClose(); // deleted when assigning aSourceRef pMed->UseInteractionHandler( true ); // to enable the filter options dialog - pSourceShell = new ScDocShell; - aSourceRef = pSourceShell; - pSourceShell->DoLoad( pMed ); + m_pSourceShell = new ScDocShell; + aSourceRef = m_pSourceShell; + m_pSourceShell->DoLoad( pMed ); - ErrCode nErr = pSourceShell->GetErrorCode(); + ErrCode nErr = m_pSourceShell->GetErrorCode(); if (nErr) ErrorHandler::HandleError( nErr ); // including warnings - if ( !pSourceShell->GetError() ) // only errors + if (!m_pSourceShell->GetError()) // only errors { - m_pCbUrl->SetText( pMed->GetName() ); + m_xCbUrl->SetText(pMed->GetName()); } else { - pSourceShell->DoClose(); - pSourceShell = nullptr; + m_pSourceShell->DoClose(); + m_pSourceShell = nullptr; aSourceRef.clear(); - m_pCbUrl->SetText( EMPTY_OUSTRING ); + m_xCbUrl->SetText(EMPTY_OUSTRING); } } @@ -252,46 +237,46 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void ScLinkedAreaDlg::UpdateSourceRanges() { - m_pLbRanges->SetUpdateMode(false); + m_xLbRanges->freeze(); - m_pLbRanges->Clear(); - if ( pSourceShell ) + m_xLbRanges->clear(); + if ( m_pSourceShell ) { - std::shared_ptr<const SfxFilter> pFilter = pSourceShell->GetMedium()->GetFilter(); + std::shared_ptr<const SfxFilter> pFilter = m_pSourceShell->GetMedium()->GetFilter(); if (pFilter && pFilter->GetFilterName() == SC_TEXT_CSV_FILTER_NAME) { // Insert dummy All range to have something selectable. - m_pLbRanges->InsertEntry("CSV_all"); + m_xLbRanges->append_text("CSV_all"); } - ScAreaNameIterator aIter( &pSourceShell->GetDocument() ); + ScAreaNameIterator aIter(&m_pSourceShell->GetDocument()); ScRange aDummy; OUString aName; while ( aIter.Next( aName, aDummy ) ) - m_pLbRanges->InsertEntry( aName ); + m_xLbRanges->append_text(aName); } - m_pLbRanges->SetUpdateMode(true); + m_xLbRanges->thaw(); - if ( m_pLbRanges->GetEntryCount() == 1 ) - m_pLbRanges->SelectEntryPos(0); + if (m_xLbRanges->n_children() == 1) + m_xLbRanges->select(0); } void ScLinkedAreaDlg::UpdateEnable() { - bool bEnable = ( pSourceShell && m_pLbRanges->GetSelectedEntryCount() ); - m_pBtnOk->Enable( bEnable ); + bool bEnable = ( m_pSourceShell && m_xLbRanges->count_selected_rows() ); + m_xBtnOk->set_sensitive(bEnable); - bool bReload = m_pBtnReload->IsChecked(); - m_pNfDelay->Enable( bReload ); - m_pFtSeconds->Enable( bReload ); + bool bReload = m_xBtnReload->get_active(); + m_xNfDelay->set_sensitive(bReload); + m_xFtSeconds->set_sensitive(bReload); } OUString ScLinkedAreaDlg::GetURL() { - if (pSourceShell) + if (m_pSourceShell) { - SfxMedium* pMed = pSourceShell->GetMedium(); + SfxMedium* pMed = m_pSourceShell->GetMedium(); return pMed->GetName(); } return EMPTY_OUSTRING; @@ -299,9 +284,9 @@ OUString ScLinkedAreaDlg::GetURL() OUString ScLinkedAreaDlg::GetFilter() { - if (pSourceShell) + if (m_pSourceShell) { - SfxMedium* pMed = pSourceShell->GetMedium(); + SfxMedium* pMed = m_pSourceShell->GetMedium(); return pMed->GetFilter()->GetFilterName(); } return OUString(); @@ -309,9 +294,9 @@ OUString ScLinkedAreaDlg::GetFilter() OUString ScLinkedAreaDlg::GetOptions() { - if (pSourceShell) + if (m_pSourceShell) { - SfxMedium* pMed = pSourceShell->GetMedium(); + SfxMedium* pMed = m_pSourceShell->GetMedium(); return ScDocumentLoader::GetOptions( *pMed ); } return OUString(); @@ -320,20 +305,20 @@ OUString ScLinkedAreaDlg::GetOptions() OUString ScLinkedAreaDlg::GetSource() { OUStringBuffer aBuf; - const sal_Int32 nCount = m_pLbRanges->GetSelectedEntryCount(); - for (sal_Int32 i=0; i<nCount; ++i) + std::vector<OUString> aSelection = m_xLbRanges->get_selected_rows(); + for (size_t i = 0; i < aSelection.size(); ++i) { if (i > 0) aBuf.append(';'); - aBuf.append(m_pLbRanges->GetSelectedEntry(i)); + aBuf.append(aSelection[i]); } return aBuf.makeStringAndClear(); } sal_uLong ScLinkedAreaDlg::GetRefresh() { - if ( m_pBtnReload->IsChecked() ) - return sal::static_int_cast<sal_uLong>( m_pNfDelay->GetValue() ); + if (m_xBtnReload->get_active()) + return sal::static_int_cast<sal_uLong>(m_xNfDelay->get_value()); else return 0; // disabled } diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 80b3ccf6d888..97892de03912 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -2626,7 +2626,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) pImpl->m_pLinkedDlg.disposeAndClear(); pImpl->m_pLinkedDlg = - pFact->CreateScLinkedAreaDlg(pTabViewShell->GetDialogParent()); + pFact->CreateScLinkedAreaDlg(pTabViewShell->GetFrameWeld()); OSL_ENSURE(pImpl->m_pLinkedDlg, "Dialog create fail!"); delete pImpl->m_pRequest; pImpl->m_pRequest = new SfxRequest( rReq ); diff --git a/sc/uiconfig/scalc/ui/externaldata.ui b/sc/uiconfig/scalc/ui/externaldata.ui index 040213842c3a..449cce77cd7e 100644 --- a/sc/uiconfig/scalc/ui/externaldata.ui +++ b/sc/uiconfig/scalc/ui/externaldata.ui @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.20.4 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkAdjustment" id="adjustment1"> <property name="lower">1</property> <property name="upper">99999</property> @@ -10,10 +9,21 @@ <property name="step_increment">1</property> <property name="page_increment">10</property> </object> + <object class="GtkListStore" id="liststore1"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + <!-- column-name id --> + <column type="gchararray"/> + </columns> + </object> <object class="GtkDialog" id="ExternalDataDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="externaldata|ExternalDataDialog">External Data</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> @@ -82,6 +92,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> + <property name="vexpand">True</property> <property name="orientation">vertical</property> <property name="spacing">12</property> <child> @@ -112,21 +123,20 @@ <property name="hexpand">True</property> <property name="spacing">12</property> <child> - <object class="svtlo-SvtURLBox" id="url"> + <object class="GtkComboBoxText" id="url"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="tooltip_text" translatable="yes" context="externaldata|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-entry2"> - <property name="can_focus">False</property> + <object class="GtkEntry"> + <property name="visible">True</property> + <property name="can_focus">True</property> </object> </child> </object> <packing> - <property name="expand">False</property> + <property name="expand">True</property> <property name="fill">True</property> <property name="position">0</property> </packing> @@ -199,21 +209,35 @@ <property name="orientation">vertical</property> <property name="spacing">6</property> <child> - <object class="GtkScrolledWindow" id="scrolledwindow1"> + <object class="GtkScrolledWindow"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> <property name="vexpand">True</property> <property name="shadow_type">in</property> <child> - <object class="GtkTreeView" id="ranges:border"> + <object class="GtkTreeView" id="ranges"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="hexpand">True</property> <property name="vexpand">True</property> + <property name="model">liststore1</property> + <property name="headers_visible">False</property> + <property name="headers_clickable">False</property> + <property name="search_column">0</property> + <property name="show_expanders">False</property> <child internal-child="selection"> <object class="GtkTreeSelection" id="treeview-selection1"/> </child> + <child> + <object class="GtkTreeViewColumn" id="treeviewcolumn1"> + <child> + <object class="GtkCellRendererText" id="cellrenderertext1"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> </object> </child> </object> @@ -302,9 +326,9 @@ <object class="GtkLabel" id="label2"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0.47999998927116394</property> <property name="label" translatable="yes" context="externaldata|label2">_Available Tables/Ranges</property> <property name="use_underline">True</property> + <property name="xalign">0.47999998927116394</property> <attributes> <attribute name="weight" value="bold"/> </attributes> @@ -331,5 +355,8 @@ <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> + <child> + <placeholder/> + </child> </object> </interface> |