diff options
-rw-r--r-- | include/svtools/inettbc.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/inc/datastreamdlg.hxx | 54 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/datastreamdlg.cxx | 142 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh2.cxx | 8 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/datastreams.ui | 134 |
5 files changed, 161 insertions, 178 deletions
diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx index e7f67bed8a03..18764ec42ce8 100644 --- a/include/svtools/inettbc.hxx +++ b/include/svtools/inettbc.hxx @@ -118,6 +118,7 @@ public: void SetText(const OUString& rStr) { m_xWidget->set_entry_text(rStr); } void Clear() { m_xWidget->clear(); } void connect_entry_activate(const Link<weld::ComboBoxText&, void>& rLink) { m_xWidget->connect_entry_activate(rLink); } + void connect_changed(const Link<weld::ComboBoxText&, void>& rLink) { m_xWidget->connect_changed(rLink); } void append_text(const OUString& rStr) { m_xWidget->append_text(rStr); } OUString get_active_text() const { return m_xWidget->get_active_text(); } void EnableAutocomplete() { m_xWidget->set_entry_completion(true); } diff --git a/sc/source/ui/inc/datastreamdlg.hxx b/sc/source/ui/inc/datastreamdlg.hxx index c728f87402cf..b6b2dd2cbaba 100644 --- a/sc/source/ui/inc/datastreamdlg.hxx +++ b/sc/source/ui/inc/datastreamdlg.hxx @@ -13,50 +13,48 @@ #include <sal/config.h> #include <rtl/ref.hxx> -#include <vcl/dialog.hxx> -#include <vcl/layout.hxx> +#include <vcl/weld.hxx> #include "datastream.hxx" class ScDocShell; -class SvtURLBox; +class URLBox; class ScRange; class ComboBox; namespace sc { -class DataStreamDlg : public ModalDialog +class DataStreamDlg : public weld::GenericDialogController { - ScDocShell *mpDocShell; - - VclPtr<SvtURLBox> m_pCbUrl; - VclPtr<PushButton> m_pBtnBrowse; - VclPtr<RadioButton> m_pRBValuesInLine; - VclPtr<RadioButton> m_pRBAddressValue; - VclPtr<CheckBox> m_pCBRefreshOnEmpty; - VclPtr<RadioButton> m_pRBDataDown; - VclPtr<RadioButton> m_pRBRangeDown; - VclPtr<RadioButton> m_pRBNoMove; - VclPtr<RadioButton> m_pRBMaxLimit; - VclPtr<RadioButton> m_pRBUnlimited; - VclPtr<Edit> m_pEdRange; - VclPtr<Edit> m_pEdLimit; - VclPtr<OKButton> m_pBtnOk; - VclPtr<VclFrame> m_pVclFrameLimit; - VclPtr<VclFrame> m_pVclFrameMove; - - DECL_LINK(UpdateClickHdl, Button*, void); - DECL_LINK(UpdateHdl, Edit&, void); - DECL_LINK(UpdateComboBoxHdl, ComboBox&, void); - DECL_LINK(BrowseHdl, Button*, void); + ScDocShell *m_pDocShell; + + std::unique_ptr<URLBox> m_xCbUrl; + std::unique_ptr<weld::Button> m_xBtnBrowse; + std::unique_ptr<weld::RadioButton> m_xRBValuesInLine; + std::unique_ptr<weld::RadioButton> m_xRBAddressValue; + std::unique_ptr<weld::CheckButton> m_xCBRefreshOnEmpty; + std::unique_ptr<weld::RadioButton> m_xRBDataDown; + std::unique_ptr<weld::RadioButton> m_xRBRangeDown; + std::unique_ptr<weld::RadioButton> m_xRBNoMove; + std::unique_ptr<weld::RadioButton> m_xRBMaxLimit; + std::unique_ptr<weld::RadioButton> m_xRBUnlimited; + std::unique_ptr<weld::Entry> m_xEdRange; + std::unique_ptr<weld::Entry> m_xEdLimit; + std::unique_ptr<weld::Button> m_xBtnOk; + std::unique_ptr<weld::Frame> m_xVclFrameLimit; + std::unique_ptr<weld::Frame> m_xVclFrameMove; + + DECL_LINK(UpdateClickHdl, weld::ToggleButton&, void); + DECL_LINK(UpdateHdl, weld::Entry&, void); + DECL_LINK(UpdateComboBoxHdl, weld::ComboBoxText&, void); + DECL_LINK(BrowseHdl, weld::Button&, void); void UpdateEnable(); ScRange GetStartRange(); public: - DataStreamDlg(ScDocShell *pDocShell, vcl::Window* pParent); + DataStreamDlg(ScDocShell *pDocShell, weld::Window* pParent); virtual ~DataStreamDlg() override; - virtual void dispose() override; void Init( const DataStream& rStrm ); diff --git a/sc/source/ui/miscdlgs/datastreamdlg.cxx b/sc/source/ui/miscdlgs/datastreamdlg.cxx index 6164037b1c34..01c76e994173 100644 --- a/sc/source/ui/miscdlgs/datastreamdlg.cxx +++ b/sc/source/ui/miscdlgs/datastreamdlg.cxx @@ -17,98 +17,78 @@ namespace sc { -DataStreamDlg::DataStreamDlg(ScDocShell *pDocShell, vcl::Window* pParent) - : ModalDialog(pParent, "DataStreamDialog", "modules/scalc/ui/datastreams.ui") - , mpDocShell(pDocShell) +DataStreamDlg::DataStreamDlg(ScDocShell *pDocShell, weld::Window* pParent) + : GenericDialogController(pParent, "modules/scalc/ui/datastreams.ui", "DataStreamDialog") + , m_pDocShell(pDocShell) + , m_xCbUrl(new URLBox(m_xBuilder->weld_combo_box_text("url"))) + , m_xBtnBrowse(m_xBuilder->weld_button("browse")) + , m_xRBValuesInLine(m_xBuilder->weld_radio_button("valuesinline")) + , m_xRBAddressValue(m_xBuilder->weld_radio_button("addressvalue")) + , m_xCBRefreshOnEmpty(m_xBuilder->weld_check_button("refresh_ui")) + , m_xRBDataDown(m_xBuilder->weld_radio_button("datadown")) + , m_xRBRangeDown(m_xBuilder->weld_radio_button("rangedown")) + , m_xRBNoMove(m_xBuilder->weld_radio_button("nomove")) + , m_xRBMaxLimit(m_xBuilder->weld_radio_button("maxlimit")) + , m_xRBUnlimited(m_xBuilder->weld_radio_button("unlimited")) + , m_xEdRange(m_xBuilder->weld_entry("range")) + , m_xEdLimit(m_xBuilder->weld_entry("limit")) + , m_xBtnOk(m_xBuilder->weld_button("ok")) + , m_xVclFrameLimit(m_xBuilder->weld_frame("framelimit")) + , m_xVclFrameMove(m_xBuilder->weld_frame("framemove")) { - get(m_pCbUrl, "url"); - get(m_pBtnBrowse, "browse"); - get(m_pRBValuesInLine, "valuesinline"); - get(m_pRBAddressValue, "addressvalue"); - get(m_pCBRefreshOnEmpty, "refresh_ui"); - get(m_pRBDataDown, "datadown"); - 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, DataStreamDlg, UpdateComboBoxHdl ) ); - m_pRBAddressValue->SetClickHdl( LINK( this, DataStreamDlg, UpdateClickHdl ) ); - m_pRBAddressValue->Enable(false); - m_pRBNoMove->Hide(); - m_pRBValuesInLine->SetClickHdl( LINK( this, DataStreamDlg, UpdateClickHdl ) ); - m_pEdRange->SetModifyHdl( LINK( this, DataStreamDlg, UpdateHdl ) ); - m_pBtnBrowse->SetClickHdl( LINK( this, DataStreamDlg, BrowseHdl ) ); + m_xCbUrl->connect_changed( LINK( this, DataStreamDlg, UpdateComboBoxHdl ) ); + m_xRBAddressValue->connect_toggled( LINK( this, DataStreamDlg, UpdateClickHdl ) ); + m_xRBAddressValue->set_sensitive(false); + m_xRBNoMove->hide(); + m_xRBValuesInLine->connect_toggled( LINK( this, DataStreamDlg, UpdateClickHdl ) ); + m_xEdRange->connect_changed( LINK( this, DataStreamDlg, UpdateHdl ) ); + m_xBtnBrowse->connect_clicked( LINK( this, DataStreamDlg, BrowseHdl ) ); UpdateEnable(); } DataStreamDlg::~DataStreamDlg() { - disposeOnce(); } -void DataStreamDlg::dispose() +IMPL_LINK_NOARG(DataStreamDlg, BrowseHdl, weld::Button&, void) { - m_pCbUrl.clear(); - m_pBtnBrowse.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(DataStreamDlg, BrowseHdl, Button*, void) -{ - sfx2::FileDialogHelper aFileDialog(0, FileDialogFlags::NONE, GetFrameWeld()); + sfx2::FileDialogHelper aFileDialog(0, FileDialogFlags::NONE, m_xDialog.get()); if ( aFileDialog.Execute() != ERRCODE_NONE ) return; - m_pCbUrl->SetText( aFileDialog.GetPath() ); + m_xCbUrl->SetText( aFileDialog.GetPath() ); UpdateEnable(); } -IMPL_LINK_NOARG(DataStreamDlg, UpdateClickHdl, Button*, void) +IMPL_LINK_NOARG(DataStreamDlg, UpdateClickHdl, weld::ToggleButton&, void) { UpdateEnable(); } -IMPL_LINK_NOARG(DataStreamDlg, UpdateComboBoxHdl, ComboBox&, void) + +IMPL_LINK_NOARG(DataStreamDlg, UpdateComboBoxHdl, weld::ComboBoxText&, void) { UpdateEnable(); } -IMPL_LINK_NOARG(DataStreamDlg, UpdateHdl, Edit&, void) + +IMPL_LINK_NOARG(DataStreamDlg, UpdateHdl, weld::Entry&, void) { UpdateEnable(); } void DataStreamDlg::UpdateEnable() { - bool bOk = !m_pCbUrl->GetURL().isEmpty(); - if (m_pRBAddressValue->IsChecked()) + bool bOk = !m_xCbUrl->GetURL().isEmpty(); + if (m_xRBAddressValue->get_active()) { - m_pVclFrameLimit->Disable(); - m_pVclFrameMove->Disable(); - m_pEdRange->Disable(); + m_xVclFrameLimit->set_sensitive(false); + m_xVclFrameMove->set_sensitive(false); + m_xEdRange->set_sensitive(false); } else { - m_pVclFrameLimit->Enable(); - m_pVclFrameMove->Enable(); - m_pEdRange->Enable(); + m_xVclFrameLimit->set_sensitive(true); + m_xVclFrameMove->set_sensitive(true); + m_xEdRange->set_sensitive(true); if (bOk) { // Check the given range to make sure it's valid. @@ -117,14 +97,14 @@ void DataStreamDlg::UpdateEnable() bOk = false; } } - m_pBtnOk->Enable(bOk); - setOptimalLayoutSize(); + m_xBtnOk->set_sensitive(bOk); +// setOptimalLayoutSize(); } ScRange DataStreamDlg::GetStartRange() { - OUString aStr = m_pEdRange->GetText(); - ScDocument& rDoc = mpDocShell->GetDocument(); + OUString aStr = m_xEdRange->get_text(); + ScDocument& rDoc = m_pDocShell->GetDocument(); ScRange aRange; ScRefFlags nRes = aRange.Parse(aStr, &rDoc, rDoc.GetAddressConvention()); if ( ((nRes & ScRefFlags::VALID) == ScRefFlags::ZERO) || !aRange.IsValid()) @@ -143,32 +123,32 @@ ScRange DataStreamDlg::GetStartRange() void DataStreamDlg::Init( const DataStream& rStrm ) { - m_pCbUrl->SetText(rStrm.GetURL()); - ScDocument& rDoc = mpDocShell->GetDocument(); + m_xCbUrl->SetText(rStrm.GetURL()); + ScDocument& rDoc = m_pDocShell->GetDocument(); ScRange aRange = rStrm.GetRange(); ScRange aTopRange = aRange; aTopRange.aEnd.SetRow(aTopRange.aStart.Row()); OUString aStr = aTopRange.Format(ScRefFlags::RANGE_ABS_3D, &rDoc, rDoc.GetAddressConvention()); - m_pEdRange->SetText(aStr); + m_xEdRange->set_text(aStr); SCROW nRows = aRange.aEnd.Row() - aRange.aStart.Row() + 1; if (aRange.aEnd.Row() == MAXROW) - m_pRBUnlimited->Check(); + m_xRBUnlimited->set_active(true); else { - m_pRBMaxLimit->Check(); - m_pEdLimit->SetText(OUString::number(nRows)); + m_xRBMaxLimit->set_active(true); + m_xEdLimit->set_text(OUString::number(nRows)); } DataStream::MoveType eMove = rStrm.GetMove(); switch (eMove) { case DataStream::MOVE_DOWN: - m_pRBDataDown->Check(); + m_xRBDataDown->set_active(true); break; case DataStream::RANGE_DOWN: - m_pRBRangeDown->Check(); + m_xRBRangeDown->set_active(true); break; case DataStream::MOVE_UP: case DataStream::NO_MOVE: @@ -176,7 +156,7 @@ void DataStreamDlg::Init( const DataStream& rStrm ) ; } - m_pCBRefreshOnEmpty->Check(rStrm.IsRefreshOnEmptyLine()); + m_xCBRefreshOnEmpty->set_active(rStrm.IsRefreshOnEmptyLine()); UpdateEnable(); } @@ -189,18 +169,18 @@ void DataStreamDlg::StartStream() return; sal_Int32 nLimit = 0; - if (m_pRBMaxLimit->IsChecked()) - nLimit = m_pEdLimit->GetText().toInt32(); - OUString rURL = m_pCbUrl->GetText(); + if (m_xRBMaxLimit->get_active()) + nLimit = m_xEdLimit->get_text().toInt32(); + OUString rURL = m_xCbUrl->get_active_text(); sal_uInt32 nSettings = 0; - if (m_pRBValuesInLine->IsChecked()) + if (m_xRBValuesInLine->get_active()) nSettings |= DataStream::VALUES_IN_LINE; DataStream::MoveType eMove = - m_pRBRangeDown->IsChecked() ? DataStream::RANGE_DOWN : DataStream::MOVE_DOWN; + m_xRBRangeDown->get_active() ? DataStream::RANGE_DOWN : DataStream::MOVE_DOWN; - DataStream* pStream = DataStream::Set(mpDocShell, rURL, aStartRange, nLimit, eMove, nSettings); - pStream->SetRefreshOnEmptyLine(m_pCBRefreshOnEmpty->IsChecked()); + DataStream* pStream = DataStream::Set(m_pDocShell, rURL, aStartRange, nLimit, eMove, nSettings); + pStream->SetRefreshOnEmptyLine(m_xCBRefreshOnEmpty->get_active()); DataStream::MakeToolbarVisible(); pStream->StartImport(); } diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 8d6c3955f4da..df6497bcc660 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -756,15 +756,15 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) break; case SID_DATA_STREAMS: { - ScopedVclPtrInstance< sc::DataStreamDlg > aDialog( GetViewData()->GetDocShell(), pTabViewShell->GetDialogParent() ); + sc::DataStreamDlg aDialog(GetViewData()->GetDocShell(), pTabViewShell->GetFrameWeld()); ScDocument *pDoc = GetViewData()->GetDocument(); sc::DocumentLinkManager& rMgr = pDoc->GetDocLinkManager(); sc::DataStream* pStrm = rMgr.getDataStream(); if (pStrm) - aDialog->Init(*pStrm); + aDialog.Init(*pStrm); - if (aDialog->Execute() == RET_OK) - aDialog->StartStream(); + if (aDialog.run() == RET_OK) + aDialog.StartStream(); } break; case SID_DATA_STREAMS_PLAY: diff --git a/sc/uiconfig/scalc/ui/datastreams.ui b/sc/uiconfig/scalc/ui/datastreams.ui index 1e21c1c1ed08..b604caa04a9d 100644 --- a/sc/uiconfig/scalc/ui/datastreams.ui +++ b/sc/uiconfig/scalc/ui/datastreams.ui @@ -1,18 +1,80 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> <object class="GtkDialog" id="DataStreamDialog"> <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="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <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> @@ -56,17 +118,17 @@ </packing> </child> <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="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> + <property name="can_focus">True</property> + <property name="activates_default">True</property> </object> </child> </object> @@ -125,7 +187,6 @@ <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> @@ -153,6 +214,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -254,7 +316,6 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">rangedown</property> </object> <packing> <property name="expand">False</property> @@ -347,7 +408,6 @@ <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> @@ -359,6 +419,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> <property name="text">1000</property> </object> <packing> @@ -421,63 +482,6 @@ <property name="position">0</property> </packing> </child> - <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> </object> </child> <action-widgets> |