diff options
21 files changed, 664 insertions, 667 deletions
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index c85b86d7a8c7..043803435d43 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -1788,8 +1788,16 @@ public: class VCL_DLLPUBLIC Menu { +protected: + Link<const OString&, void> m_aActivateHdl; + + void signal_activate(const OString& rIdent) { m_aActivateHdl.Call(rIdent); } + public: virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect) = 0; + + void connect_activate(const Link<const OString&, void>& rLink) { m_aActivateHdl = rLink; } + virtual void set_sensitive(const OString& rIdent, bool bSensitive) = 0; virtual void set_label(const OString& rIdent, const OUString& rLabel) = 0; virtual void set_active(const OString& rIdent, bool bActive) = 0; diff --git a/sc/source/ui/inc/dataproviderdlg.hxx b/sc/source/ui/inc/dataproviderdlg.hxx index 441c4929abbb..2cc636973145 100644 --- a/sc/source/ui/inc/dataproviderdlg.hxx +++ b/sc/source/ui/inc/dataproviderdlg.hxx @@ -12,46 +12,48 @@ #include <sal/config.h> -#include <vcl/dialog.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/listctrl.hxx> -#include <vcl/menu.hxx> - +#include <com/sun/star/awt/XWindow.hpp> +#include <vcl/idle.hxx> +#include <vcl/weld.hxx> #include "datatableview.hxx" - #include <memory> class ScDocument; class ScDataProviderBaseControl; +class ScDataTransformationBaseControl; class ScDBData; -class ScDataProviderDlg : public ModalDialog +class ScDataProviderDlg : public weld::GenericDialogController { private: - - std::shared_ptr<ScDocument> mpDoc; - VclPtr<ScDataTableView> mpTable; - VclPtr<ListControl> mpList; - VclPtr<MenuBar> mpBar; - VclPtr<ScDataProviderBaseControl> mpDataProviderCtrl; - VclPtr<ListBox> mpDBRanges; - sal_uInt32 mpIndex; + std::shared_ptr<ScDocument> mxDoc; + std::unique_ptr<weld::Menu> mxStartMenu; + std::unique_ptr<weld::Menu> mxColumnMenu; + std::unique_ptr<weld::Container> mxBox; + css::uno::Reference<css::awt::XWindow> m_xTableParent; + VclPtr<ScDataTableView> mxTable; + std::unique_ptr<weld::ScrolledWindow> mxScroll; + std::unique_ptr<weld::Container> mxList; + std::unique_ptr<ScDataProviderBaseControl> mxDataProviderCtrl; + std::unique_ptr<weld::ComboBox> mxDBRanges; + + std::vector<std::unique_ptr<ScDataTransformationBaseControl>> maControls; + + Idle maIdle; + + sal_uInt32 mnIndex; ScDBData* pDBData; void InitMenu(); - DECL_LINK( StartMenuHdl, Menu*, bool ); - DECL_LINK( ColumnMenuHdl, Menu*, bool ); - DECL_LINK( ImportHdl, Window*, void ); + DECL_LINK( StartMenuHdl, const OString&, void ); + DECL_LINK( ColumnMenuHdl, const OString&, void ); + DECL_LINK( ImportHdl, ScDataProviderBaseControl*, void ); + DECL_LINK( ScrollToEnd, Timer*, void ); public: - - ScDataProviderDlg(vcl::Window* pWindow, std::shared_ptr<ScDocument> pDoc, const ScDocument* pDocument); - + ScDataProviderDlg(weld::Window* pWindow, std::shared_ptr<ScDocument> pDoc, const ScDocument* pDocument); virtual ~ScDataProviderDlg() override; - virtual void dispose() override; - - virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; void applyAndQuit(); void cancelAndQuit(); diff --git a/sc/source/ui/inc/datatableview.hxx b/sc/source/ui/inc/datatableview.hxx index 30d9c0a17c23..690a088368f4 100644 --- a/sc/source/ui/inc/datatableview.hxx +++ b/sc/source/ui/inc/datatableview.hxx @@ -20,8 +20,9 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_DATATABLEVIEW_HXX #define INCLUDED_SC_SOURCE_UI_INC_DATATABLEVIEW_HXX +#include <com/sun/star/awt/XWindow.hpp> #include <vcl/ctrl.hxx> - +#include <vcl/scrbar.hxx> #include <scdllapi.h> #include <types.hxx> #include "hdrcont.hxx" @@ -81,6 +82,7 @@ class SC_DLLPUBLIC ScDataTableView : public Control { std::shared_ptr<ScDocument> mpDoc; std::unique_ptr<SelectionEngine> mpSelectionEngine; + VclPtr<ScrollBarBox> mpTopLeft; VclPtr<ScDataTableColView> mpColView; VclPtr<ScDataTableRowView> mpRowView; VclPtr<ScrollBar> mpVScroll; @@ -93,12 +95,8 @@ class SC_DLLPUBLIC ScDataTableView : public Control DECL_LINK( ScrollHdl, ScrollBar*, void ); -protected: - - virtual Size GetOptimalSize() const override; - public: - ScDataTableView(vcl::Window* pParent); + ScDataTableView(const css::uno::Reference<css::awt::XWindow> &rParent); void Init(std::shared_ptr<ScDocument> pDoc); @@ -110,6 +108,7 @@ public: virtual void MouseButtonUp(const MouseEvent& rMEvt) override; virtual void Resize() override; virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual Size GetOptimalSize() const override; void getColRange(SCCOL& rStartCol, SCCOL& rEndCol) const; void getRowRange(SCROW& rStartRow, SCROW& rEndRow) const; diff --git a/sc/source/ui/miscdlgs/dataproviderdlg.cxx b/sc/source/ui/miscdlgs/dataproviderdlg.cxx index 4868b560b906..ff58fd04ce9c 100644 --- a/sc/source/ui/miscdlgs/dataproviderdlg.cxx +++ b/sc/source/ui/miscdlgs/dataproviderdlg.cxx @@ -18,124 +18,77 @@ #include <comphelper/string.hxx> #include <sal/log.hxx> #include <unotools/charclass.hxx> +#include <vcl/svapp.hxx> #include <utility> -#include <vcl/lstbox.hxx> -#include <vcl/fixed.hxx> -#include <vcl/field.hxx> -#include <vcl/layout.hxx> -constexpr int MENU_START = 0; -constexpr int MENU_COLUMN = 1; - -class ScDataProviderBaseControl : public VclContainer, - public VclBuilderContainer +class ScDataProviderBaseControl { - VclPtr<VclContainer> maGrid; - VclPtr<ListBox> maProviderList; - VclPtr<Edit> maEditURL; - VclPtr<Edit> maEditID; - VclPtr<PushButton> mpApplyBtn; + std::unique_ptr<weld::Builder> mxBuilder; + std::unique_ptr<weld::Container> mxGrid; + std::unique_ptr<weld::ComboBox> mxProviderList; + std::unique_ptr<weld::Entry> mxEditURL; + std::unique_ptr<weld::Entry> mxEditID; + std::unique_ptr<weld::Button> mxApplyBtn; + + OUString msApplyTooltip; - Link<Window*, void> const maImportCallback; + Link<ScDataProviderBaseControl*, void> const maImportCallback; - DECL_LINK(ProviderSelectHdl, ListBox&, void); - DECL_LINK(IDEditHdl, Edit&, void); - DECL_LINK(URLEditHdl, Edit&, void); - DECL_LINK(ApplyBtnHdl, Button*, void); + DECL_LINK(ProviderSelectHdl, weld::ComboBox&, void); + DECL_LINK(IDEditHdl, weld::Entry&, void); + DECL_LINK(URLEditHdl, weld::Entry&, void); + DECL_LINK(ApplyBtnHdl, weld::Button&, void); void updateApplyBtn(bool bValidConfig); public: - ScDataProviderBaseControl(vcl::Window* pParent, const Link<Window*, void>& rImportCallback); - ~ScDataProviderBaseControl() override; - - virtual void dispose() override; - virtual void setAllocation(const Size &rAllocation) override; - virtual Size calculateRequisition() const override; + ScDataProviderBaseControl(weld::Container* pParent, const Link<ScDataProviderBaseControl*, void>& rImportCallback); void isValid(); sc::ExternalDataSource getDataSource(ScDocument* pDoc); }; -ScDataProviderBaseControl::ScDataProviderBaseControl(vcl::Window* pParent, - const Link<Window*, void>& rImportCallback): - VclContainer(pParent, WB_CLIPCHILDREN | WB_BORDER), - maImportCallback(rImportCallback) +ScDataProviderBaseControl::ScDataProviderBaseControl(weld::Container* pParent, + const Link<ScDataProviderBaseControl*, void>& rImportCallback) + : mxBuilder(Application::CreateBuilder(pParent, "modules/scalc/ui/dataproviderentry.ui")) + , mxGrid(mxBuilder->weld_container("grid")) + , mxProviderList(mxBuilder->weld_combo_box("provider_lst")) + , mxEditURL(mxBuilder->weld_entry("ed_url")) + , mxEditID(mxBuilder->weld_entry("ed_id")) + , mxApplyBtn(mxBuilder->weld_button("apply")) + , maImportCallback(rImportCallback) { - m_pUIBuilder.reset(new VclBuilder(this, getUIRootDir(), "modules/scalc/ui/dataproviderentry.ui")); - - get(maGrid, "grid"); - get(maProviderList, "provider_lst"); - get(maEditURL, "ed_url"); - get(maEditID, "ed_id"); - auto aDataProvider = sc::DataProviderFactory::getDataProviders(); for (const auto& rDataProvider : aDataProvider) { - maProviderList->InsertEntry(rDataProvider); + mxProviderList->append_text(rDataProvider); } - maProviderList->SetSelectHdl(LINK(this, ScDataProviderBaseControl, ProviderSelectHdl)); - maEditID->SetModifyHdl(LINK(this, ScDataProviderBaseControl, IDEditHdl)); - maEditURL->SetModifyHdl(LINK(this, ScDataProviderBaseControl, URLEditHdl)); - - mpApplyBtn = VclPtr<PushButton>::Create(maGrid, WB_FLATBUTTON); - mpApplyBtn->set_grid_top_attach(1); - mpApplyBtn->set_grid_left_attach(5); - mpApplyBtn->SetQuickHelpText("Apply Changes"); - mpApplyBtn->SetControlForeground(COL_GREEN); - mpApplyBtn->SetControlBackground(COL_GREEN); - mpApplyBtn->SetBackground(Wallpaper(COL_LIGHTGREEN)); - mpApplyBtn->SetModeImage(Image(StockImage::Yes, "sc/res/xml_element.png")); - mpApplyBtn->Show(); - mpApplyBtn->SetClickHdl(LINK(this, ScDataProviderBaseControl, ApplyBtnHdl)); - SetSizePixel(GetOptimalSize()); - isValid(); -} - -ScDataProviderBaseControl::~ScDataProviderBaseControl() -{ - disposeOnce(); -} - -void ScDataProviderBaseControl::dispose() -{ - maEditID.clear(); - maEditURL.clear(); - maProviderList.clear(); - mpApplyBtn.disposeAndClear(); - maGrid.clear(); - disposeBuilder(); - VclContainer::dispose(); -} - -Size ScDataProviderBaseControl::calculateRequisition() const -{ - return getLayoutRequisition(*maGrid); -} + mxProviderList->connect_changed(LINK(this, ScDataProviderBaseControl, ProviderSelectHdl)); + mxEditID->connect_changed(LINK(this, ScDataProviderBaseControl, IDEditHdl)); + mxEditURL->connect_changed(LINK(this, ScDataProviderBaseControl, URLEditHdl)); -void ScDataProviderBaseControl::setAllocation(const Size &rAllocation) -{ - setLayoutPosSize(*maGrid, Point(0, 0), rAllocation); + msApplyTooltip = mxApplyBtn->get_tooltip_text(); + mxApplyBtn->connect_clicked(LINK(this, ScDataProviderBaseControl, ApplyBtnHdl)); + isValid(); } void ScDataProviderBaseControl::isValid() { - bool bValid = !maProviderList->GetSelectedEntry().isEmpty(); - bValid &= !maEditURL->GetText().isEmpty(); - Invalidate(); + bool bValid = !mxProviderList->get_active_text().isEmpty(); + bValid &= !mxEditURL->get_text().isEmpty(); updateApplyBtn(bValid); } sc::ExternalDataSource ScDataProviderBaseControl::getDataSource(ScDocument* pDoc) { - OUString aURL = maEditURL->GetText(); - OUString aProvider = maProviderList->GetSelectedEntry(); + OUString aURL = mxEditURL->get_text(); + OUString aProvider = mxProviderList->get_active_text(); sc::ExternalDataSource aSource(aURL, aProvider, pDoc); - OUString aID = maEditID->GetText(); + OUString aID = mxEditID->get_text(); aSource.setID(aID); return aSource; } @@ -144,39 +97,67 @@ void ScDataProviderBaseControl::updateApplyBtn(bool bValidConfig) { if (!bValidConfig) { - mpApplyBtn->Disable(); - mpApplyBtn->SetQuickHelpText(""); + mxApplyBtn->set_sensitive(false); + mxApplyBtn->set_tooltip_text(OUString()); return; } - else - { - mpApplyBtn->Enable(); - mpApplyBtn->SetBackground(Wallpaper(COL_YELLOW)); - mpApplyBtn->SetQuickHelpText("Apply Changes"); - } + + mxApplyBtn->set_sensitive(true); + mxApplyBtn->set_tooltip_text(msApplyTooltip); } -IMPL_LINK_NOARG(ScDataProviderBaseControl, ProviderSelectHdl, ListBox&, void) +IMPL_LINK_NOARG(ScDataProviderBaseControl, ProviderSelectHdl, weld::ComboBox&, void) { isValid(); } -IMPL_LINK_NOARG(ScDataProviderBaseControl, IDEditHdl, Edit&, void) +IMPL_LINK_NOARG(ScDataProviderBaseControl, IDEditHdl, weld::Entry&, void) { isValid(); } -IMPL_LINK_NOARG(ScDataProviderBaseControl, URLEditHdl, Edit&, void) +IMPL_LINK_NOARG(ScDataProviderBaseControl, URLEditHdl, weld::Entry&, void) { isValid(); } -IMPL_LINK_NOARG(ScDataProviderBaseControl, ApplyBtnHdl, Button*, void) +IMPL_LINK_NOARG(ScDataProviderBaseControl, ApplyBtnHdl, weld::Button&, void) { updateApplyBtn(true); maImportCallback.Call(this); } +class ScDataTransformationBaseControl +{ +protected: + std::unique_ptr<weld::Builder> mxBuilder; + std::unique_ptr<weld::Container> mxGrid; + weld::Container* mpContainer; + + sal_uInt32 mnIndex; + +public: + ScDataTransformationBaseControl(weld::Container* pParent, const OUString& rUIFile, sal_uInt32 nIndex); + virtual ~ScDataTransformationBaseControl(); + + void updateIndex(sal_uInt32 nIndex) { mnIndex = nIndex; } + + virtual std::shared_ptr<sc::DataTransformation> getTransformation() = 0; +}; + +ScDataTransformationBaseControl::ScDataTransformationBaseControl(weld::Container* pParent, const OUString& rUIFile, sal_uInt32 nIndex) + : mxBuilder(Application::CreateBuilder(pParent, rUIFile)) + , mxGrid(mxBuilder->weld_container("grid")) + , mpContainer(pParent) + , mnIndex(nIndex) +{ +} + +ScDataTransformationBaseControl::~ScDataTransformationBaseControl() +{ + mpContainer->move(mxGrid.get(), nullptr); +} + namespace { struct MenuData @@ -203,98 +184,33 @@ MenuData aColumnData[] = { { 8, "Date & Time Transformations", &ScDataProviderDlg::dateTimeTransformation } }; -class ScDataTransformationBaseControl : public VclContainer, - public VclBuilderContainer -{ - VclPtr<VclContainer> maGrid; - -public: - ScDataTransformationBaseControl(vcl::Window* pParent, const OUString& rUIFile); - ~ScDataTransformationBaseControl() override; - - virtual void dispose() override; - virtual void setAllocation(const Size &rAllocation) override; - virtual Size calculateRequisition() const override; - - virtual std::shared_ptr<sc::DataTransformation> getTransformation() = 0; -}; - -ScDataTransformationBaseControl::ScDataTransformationBaseControl(vcl::Window* pParent, const OUString& rUIFile): - VclContainer(pParent, WB_BORDER | WB_CLIPCHILDREN) -{ - m_pUIBuilder.reset(new VclBuilder(this, getUIRootDir(), rUIFile)); - - get(maGrid, "grid"); - SetSizePixel(GetOptimalSize()); -} - -ScDataTransformationBaseControl::~ScDataTransformationBaseControl() -{ - disposeOnce(); -} - -void ScDataTransformationBaseControl::dispose() -{ - maGrid.clear(); - - VclContainer::dispose(); -} - -Size ScDataTransformationBaseControl::calculateRequisition() const -{ - return getLayoutRequisition(*maGrid); -} - -void ScDataTransformationBaseControl::setAllocation(const Size &rAllocation) -{ - setLayoutPosSize(*maGrid, Point(0, 0), rAllocation); -} - class ScDeleteColumnTransformationControl : public ScDataTransformationBaseControl { private: - VclPtr<Edit> maColumnNums; - VclPtr<PushButton> maDelete; - sal_uInt32 maIndex; + std::unique_ptr<weld::Entry> mxColumnNums; + std::unique_ptr<weld::Button> mxDelete; std::function<void(sal_uInt32&)> maDeleteTransformation; public: - ScDeleteColumnTransformationControl(vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); - ~ScDeleteColumnTransformationControl() override; - - virtual void dispose() override; + ScDeleteColumnTransformationControl(weld::Container* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); virtual std::shared_ptr<sc::DataTransformation> getTransformation() override; - DECL_LINK(DeleteHdl, Button*, void); + DECL_LINK(DeleteHdl, weld::Button&, void); }; ScDeleteColumnTransformationControl::ScDeleteColumnTransformationControl( - vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) - : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/deletecolumnentry.ui") - , maIndex(aIndex) + weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) + : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/deletecolumnentry.ui", nIndex) + , mxColumnNums(mxBuilder->weld_entry("ed_columns")) + , mxDelete(mxBuilder->weld_button("ed_delete")) , maDeleteTransformation(std::move(aDeleteTransformation)) { - get(maColumnNums, "ed_columns"); - get(maDelete, "ed_delete"); - maDelete->SetClickHdl(LINK(this,ScDeleteColumnTransformationControl, DeleteHdl)); -} - -ScDeleteColumnTransformationControl::~ScDeleteColumnTransformationControl() -{ - disposeOnce(); -} - -void ScDeleteColumnTransformationControl::dispose() -{ - maColumnNums.clear(); - maDelete.clear(); - - ScDataTransformationBaseControl::dispose(); + mxDelete->connect_clicked(LINK(this,ScDeleteColumnTransformationControl, DeleteHdl)); } std::shared_ptr<sc::DataTransformation> ScDeleteColumnTransformationControl::getTransformation() { - OUString aColumnString = maColumnNums->GetText(); + OUString aColumnString = mxColumnNums->get_text(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> ColNums; for (const auto& rColStr : aSplitColumns) @@ -316,53 +232,35 @@ std::shared_ptr<sc::DataTransformation> ScDeleteColumnTransformationControl::get class ScSplitColumnTransformationControl : public ScDataTransformationBaseControl { private: - VclPtr<Edit> maSeparator; - VclPtr<NumericField> maNumColumns; + std::unique_ptr<weld::Entry> mxSeparator; + std::unique_ptr<weld::SpinButton> mxNumColumns; + std::unique_ptr<weld::Button> mxDelete; SCCOL mnCol; - VclPtr<PushButton> maDelete; - sal_uInt32 maIndex; std::function<void(sal_uInt32&)> maDeleteTransformation; public: - ScSplitColumnTransformationControl(vcl::Window* pParent, SCCOL nCol, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); - ~ScSplitColumnTransformationControl() override; - - virtual void dispose() override; + ScSplitColumnTransformationControl(weld::Container* pParent, SCCOL nCol, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); virtual std::shared_ptr<sc::DataTransformation> getTransformation() override; - DECL_LINK(DeleteHdl, Button*, void); + DECL_LINK(DeleteHdl, weld::Button&, void); }; ScSplitColumnTransformationControl::ScSplitColumnTransformationControl( - vcl::Window* pParent, SCCOL nCol, sal_uInt32 aIndex, + weld::Container* pParent, SCCOL nCol, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) - : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/splitcolumnentry.ui") + : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/splitcolumnentry.ui", nIndex) + , mxSeparator(mxBuilder->weld_entry("ed_separator")) + , mxNumColumns(mxBuilder->weld_spin_button("num_cols")) + , mxDelete(mxBuilder->weld_button("ed_delete")) , mnCol(nCol) - , maIndex(aIndex) , maDeleteTransformation(std::move(aDeleteTransformation)) { - get(maSeparator, "ed_separator"); - get(maNumColumns, "num_cols"); - get(maDelete, "ed_delete"); - maDelete->SetClickHdl(LINK(this,ScSplitColumnTransformationControl, DeleteHdl)); -} - -ScSplitColumnTransformationControl::~ScSplitColumnTransformationControl() -{ - disposeOnce(); -} - -void ScSplitColumnTransformationControl::dispose() -{ - maSeparator.clear(); - maNumColumns.clear(); - maDelete.clear(); - ScDataTransformationBaseControl::dispose(); + mxDelete->connect_clicked(LINK(this,ScSplitColumnTransformationControl, DeleteHdl)); } std::shared_ptr<sc::DataTransformation> ScSplitColumnTransformationControl::getTransformation() { - OUString aSeparator = maSeparator->GetText(); + OUString aSeparator = mxSeparator->get_text(); sal_Unicode cSeparator = aSeparator.isEmpty() ? ',' : aSeparator[0]; return std::make_shared<sc::SplitColumnTransformation>(mnCol, cSeparator); } @@ -370,34 +268,28 @@ std::shared_ptr<sc::DataTransformation> ScSplitColumnTransformationControl::getT class ScMergeColumnTransformationControl : public ScDataTransformationBaseControl { private: - - VclPtr<Edit> mpSeparator; - VclPtr<Edit> mpEdColumns; - VclPtr<PushButton> maDelete; - sal_uInt32 maIndex; + std::unique_ptr<weld::Entry> mxSeparator; + std::unique_ptr<weld::Entry> mxEdColumns; + std::unique_ptr<weld::Button> mxDelete; std::function<void(sal_uInt32&)> maDeleteTransformation; public: - ScMergeColumnTransformationControl(vcl::Window* pParent, SCCOL nStartCol, SCCOL nEndCol, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); - ~ScMergeColumnTransformationControl() override; - - virtual void dispose() override; + ScMergeColumnTransformationControl(weld::Container* pParent, SCCOL nStartCol, SCCOL nEndCol, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); virtual std::shared_ptr<sc::DataTransformation> getTransformation() override; - DECL_LINK(DeleteHdl, Button*, void); + DECL_LINK(DeleteHdl, weld::Button&, void); }; ScMergeColumnTransformationControl::ScMergeColumnTransformationControl( - vcl::Window* pParent, SCCOL nStartCol, SCCOL nEndCol, sal_uInt32 aIndex, + weld::Container* pParent, SCCOL nStartCol, SCCOL nEndCol, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) - : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/mergecolumnentry.ui") - , maIndex(aIndex) + : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/mergecolumnentry.ui", nIndex) + , mxSeparator(mxBuilder->weld_entry("ed_separator")) + , mxEdColumns(mxBuilder->weld_entry("ed_columns")) + , mxDelete(mxBuilder->weld_button("ed_delete")) , maDeleteTransformation(std::move(aDeleteTransformation)) { - get(mpSeparator, "ed_separator"); - get(mpEdColumns, "ed_columns"); - get(maDelete, "ed_delete"); - maDelete->SetClickHdl(LINK(this,ScMergeColumnTransformationControl, DeleteHdl)); + mxDelete->connect_clicked(LINK(this,ScMergeColumnTransformationControl, DeleteHdl)); OUStringBuffer aBuffer; @@ -408,26 +300,12 @@ ScMergeColumnTransformationControl::ScMergeColumnTransformationControl( aBuffer.append(";").append(OUString::number(nCol + 1)); } - mpEdColumns->SetText(aBuffer.makeStringAndClear()); -} - -ScMergeColumnTransformationControl::~ScMergeColumnTransformationControl() -{ - disposeOnce(); -} - -void ScMergeColumnTransformationControl::dispose() -{ - mpSeparator.clear(); - mpEdColumns.clear(); - maDelete.clear(); - - ScDataTransformationBaseControl::dispose(); + mxEdColumns->set_text(aBuffer.makeStringAndClear()); } std::shared_ptr<sc::DataTransformation> ScMergeColumnTransformationControl::getTransformation() { - OUString aColumnString = mpEdColumns->GetText(); + OUString aColumnString = mxEdColumns->get_text(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aMergedColumns; for (const auto& rColStr : aSplitColumns) @@ -442,59 +320,39 @@ std::shared_ptr<sc::DataTransformation> ScMergeColumnTransformationControl::getT // translate from 1-based column notations to internal Calc one aMergedColumns.insert(nCol - 1); } - return std::make_shared<sc::MergeColumnTransformation>(aMergedColumns, mpSeparator->GetText()); + return std::make_shared<sc::MergeColumnTransformation>(aMergedColumns, mxSeparator->get_text()); } class ScSortTransformationControl : public ScDataTransformationBaseControl { private: - - VclPtr<CheckBox> mpAscending; - VclPtr<Edit> mpEdColumns; - VclPtr<PushButton> maDelete; - sal_uInt32 maIndex; + std::unique_ptr<weld::CheckButton> mxAscending; + std::unique_ptr<weld::Entry> mxEdColumns; + std::unique_ptr<weld::Button> mxDelete; std::function<void(sal_uInt32&)> maDeleteTransformation; public: - ScSortTransformationControl(vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); - ~ScSortTransformationControl() override; - - virtual void dispose() override; + ScSortTransformationControl(weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); virtual std::shared_ptr<sc::DataTransformation> getTransformation() override; - DECL_LINK(DeleteHdl, Button*, void); + DECL_LINK(DeleteHdl, weld::Button&, void); }; ScSortTransformationControl::ScSortTransformationControl( - vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) - : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/sorttransformationentry.ui") - , maIndex(aIndex) + weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) + : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/sorttransformationentry.ui", nIndex) + , mxAscending(mxBuilder->weld_check_button("ed_ascending")) + , mxEdColumns(mxBuilder->weld_entry("ed_columns")) + , mxDelete(mxBuilder->weld_button("ed_delete")) , maDeleteTransformation(std::move(aDeleteTransformation)) { - get(mpAscending, "ed_ascending"); - get(mpEdColumns, "ed_columns"); - get(maDelete, "ed_delete"); - maDelete->SetClickHdl(LINK(this,ScSortTransformationControl, DeleteHdl)); -} - -ScSortTransformationControl::~ScSortTransformationControl() -{ - disposeOnce(); -} - -void ScSortTransformationControl::dispose() -{ - mpAscending.clear(); - mpEdColumns.clear(); - maDelete.clear(); - - ScDataTransformationBaseControl::dispose(); + mxDelete->connect_clicked(LINK(this,ScSortTransformationControl, DeleteHdl)); } std::shared_ptr<sc::DataTransformation> ScSortTransformationControl::getTransformation() { - OUString aColStr = mpEdColumns->GetText(); - bool aIsAscending = mpAscending->IsChecked(); + OUString aColStr = mxEdColumns->get_text(); + bool aIsAscending = mxAscending->get_active(); SCCOL aColumn = 0; sal_Int32 nCol = aColStr.toInt32(); if (nCol > 0 && nCol <= MAXCOL) @@ -512,51 +370,32 @@ std::shared_ptr<sc::DataTransformation> ScSortTransformationControl::getTransfor class ScColumnTextTransformation : public ScDataTransformationBaseControl { private: - VclPtr<Edit> maColumnNums; - VclPtr<ListBox> maType; - VclPtr<PushButton> maDelete; - sal_uInt32 maIndex; + std::unique_ptr<weld::Entry> mxColumnNums; + std::unique_ptr<weld::ComboBox> mxType; + std::unique_ptr<weld::Button> mxDelete; std::function<void(sal_uInt32&)> maDeleteTransformation; public: - - ScColumnTextTransformation(vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); - ~ScColumnTextTransformation() override; - - virtual void dispose() override; + ScColumnTextTransformation(weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); virtual std::shared_ptr<sc::DataTransformation> getTransformation() override; - DECL_LINK(DeleteHdl, Button*, void); + DECL_LINK(DeleteHdl, weld::Button&, void); }; ScColumnTextTransformation::ScColumnTextTransformation( - vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) - : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/texttransformationentry.ui") - , maIndex(aIndex) + weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) + : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/texttransformationentry.ui", nIndex) + , mxColumnNums(mxBuilder->weld_entry("ed_columns")) + , mxType(mxBuilder->weld_combo_box("ed_lst")) + , mxDelete(mxBuilder->weld_button("ed_delete")) , maDeleteTransformation(std::move(aDeleteTransformation)) { - get(maColumnNums, "ed_columns"); - get(maType, "ed_lst"); - get(maDelete, "ed_delete"); - maDelete->SetClickHdl(LINK(this,ScColumnTextTransformation, DeleteHdl)); -} - -ScColumnTextTransformation::~ScColumnTextTransformation() -{ - disposeOnce(); -} - -void ScColumnTextTransformation::dispose() -{ - maColumnNums.clear(); - maType.clear(); - maDelete.clear(); - ScDataTransformationBaseControl::dispose(); + mxDelete->connect_clicked(LINK(this,ScColumnTextTransformation, DeleteHdl)); } std::shared_ptr<sc::DataTransformation> ScColumnTextTransformation::getTransformation() { - OUString aColumnString = maColumnNums->GetText(); + OUString aColumnString = mxColumnNums->get_text(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aColumns; for (const auto& rColStr : aSplitColumns) @@ -572,7 +411,7 @@ std::shared_ptr<sc::DataTransformation> ScColumnTextTransformation::getTransform aColumns.insert(nCol - 1); } - sal_Int32 nPos = maType->GetSelectedEntryPos(); + sal_Int32 nPos = mxType->get_active(); switch (nPos) { case 0: @@ -593,52 +432,33 @@ std::shared_ptr<sc::DataTransformation> ScColumnTextTransformation::getTransform class ScAggregateFunction : public ScDataTransformationBaseControl { private: - VclPtr<Edit> maColumnNums; - VclPtr<ListBox> maType; - VclPtr<PushButton> maDelete; - sal_uInt32 maIndex; + std::unique_ptr<weld::Entry> mxColumnNums; + std::unique_ptr<weld::ComboBox> mxType; + std::unique_ptr<weld::Button> mxDelete; std::function<void(sal_uInt32&)> maDeleteTransformation; public: - - ScAggregateFunction(vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); - ~ScAggregateFunction() override; - - virtual void dispose() override; + ScAggregateFunction(weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); virtual std::shared_ptr<sc::DataTransformation> getTransformation() override; - DECL_LINK(DeleteHdl, Button*, void); + DECL_LINK(DeleteHdl, weld::Button&, void); }; -ScAggregateFunction::ScAggregateFunction(vcl::Window* pParent, sal_uInt32 aIndex, +ScAggregateFunction::ScAggregateFunction(weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) - : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/aggregatefunctionentry.ui") - , maIndex(aIndex) + : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/aggregatefunctionentry.ui", nIndex) + , mxColumnNums(mxBuilder->weld_entry("ed_columns")) + , mxType(mxBuilder->weld_combo_box("ed_lst")) + , mxDelete(mxBuilder->weld_button("ed_delete")) , maDeleteTransformation(std::move(aDeleteTransformation)) { - get(maColumnNums, "ed_columns"); - get(maType, "ed_lst"); - get(maDelete, "ed_delete"); - maDelete->SetClickHdl(LINK(this,ScAggregateFunction, DeleteHdl)); -} - -ScAggregateFunction::~ScAggregateFunction() -{ - disposeOnce(); -} - -void ScAggregateFunction::dispose() -{ - maColumnNums.clear(); - maType.clear(); - maDelete.clear(); - ScDataTransformationBaseControl::dispose(); + mxDelete->connect_clicked(LINK(this,ScAggregateFunction, DeleteHdl)); } std::shared_ptr<sc::DataTransformation> ScAggregateFunction::getTransformation() { - OUString aColumnString = maColumnNums->GetText(); - sal_Int32 nPos = maType->GetSelectedEntryPos(); + OUString aColumnString = mxColumnNums->get_text(); + sal_Int32 nPos = mxType->get_active(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aColumns; for (const auto& rColStr : aSplitColumns) @@ -673,52 +493,33 @@ std::shared_ptr<sc::DataTransformation> ScAggregateFunction::getTransformation() class ScNumberTransformation : public ScDataTransformationBaseControl { private: - VclPtr<Edit> maColumnNums; - VclPtr<ListBox> maType; - VclPtr<PushButton> maDelete; - sal_uInt32 maIndex; + std::unique_ptr<weld::Entry> mxColumnNums; + std::unique_ptr<weld::ComboBox> mxType; + std::unique_ptr<weld::Button> mxDelete; std::function<void(sal_uInt32&)> maDeleteTransformation; public: - - ScNumberTransformation(vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); - ~ScNumberTransformation() override; - - virtual void dispose() override; + ScNumberTransformation(weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); virtual std::shared_ptr<sc::DataTransformation> getTransformation() override; - DECL_LINK(DeleteHdl, Button*, void); + DECL_LINK(DeleteHdl, weld::Button&, void); }; ScNumberTransformation::ScNumberTransformation( - vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) - : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/numbertransformationentry.ui") - , maIndex(aIndex) + weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) + : ScDataTransformationBaseControl(pParent, "modules/scalc/ui/numbertransformationentry.ui", nIndex) + , mxColumnNums(mxBuilder->weld_entry("ed_columns")) + , mxType(mxBuilder->weld_combo_box("ed_lst")) + , mxDelete(mxBuilder->weld_button("ed_delete")) , maDeleteTransformation(std::move(aDeleteTransformation)) { - get(maColumnNums, "ed_columns"); - get(maType, "ed_lst"); - get(maDelete, "ed_delete"); - maDelete->SetClickHdl(LINK(this,ScNumberTransformation, DeleteHdl)); -} - -ScNumberTransformation::~ScNumberTransformation() -{ - disposeOnce(); -} - -void ScNumberTransformation::dispose() -{ - maColumnNums.clear(); - maType.clear(); - maDelete.clear(); - ScDataTransformationBaseControl::dispose(); + mxDelete->connect_clicked(LINK(this,ScNumberTransformation, DeleteHdl)); } std::shared_ptr<sc::DataTransformation> ScNumberTransformation::getTransformation() { - OUString aColumnString = maColumnNums->GetText(); - sal_Int32 nPos = maType->GetSelectedEntryPos(); + OUString aColumnString = mxColumnNums->get_text(); + sal_Int32 nPos = mxType->get_active(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aColumns; for (const auto& rColStr : aSplitColumns) @@ -771,51 +572,34 @@ std::shared_ptr<sc::DataTransformation> ScNumberTransformation::getTransformatio class ScReplaceNullTransformation : public ScDataTransformationBaseControl { private: - VclPtr<Edit> maColumnNums; - VclPtr<Edit> maReplaceString; - VclPtr<PushButton> maDelete; - sal_uInt32 maIndex; + std::unique_ptr<weld::Entry> mxColumnNums; + std::unique_ptr<weld::Entry> mxReplaceString; + std::unique_ptr<weld::Button> mxDelete; std::function<void(sal_uInt32&)> maDeleteTransformation; public: - ScReplaceNullTransformation(vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); - ~ScReplaceNullTransformation() override; - - virtual void dispose() override; + ScReplaceNullTransformation(weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); virtual std::shared_ptr<sc::DataTransformation> getTransformation() override; - DECL_LINK(DeleteHdl, Button*, void); + DECL_LINK(DeleteHdl, weld::Button&, void); }; -ScReplaceNullTransformation::ScReplaceNullTransformation(vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation): - ScDataTransformationBaseControl(pParent,"modules/scalc/ui/replacenulltransformationentry.ui"), - maIndex(aIndex), - maDeleteTransformation(aDeleteTransformation) -{ - get(maColumnNums, "ed_columns"); - get(maReplaceString, "ed_str"); - get(maDelete, "ed_delete"); - maDelete->SetClickHdl(LINK(this,ScReplaceNullTransformation, DeleteHdl)); -} - -ScReplaceNullTransformation::~ScReplaceNullTransformation() +ScReplaceNullTransformation::ScReplaceNullTransformation(weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) + : ScDataTransformationBaseControl(pParent,"modules/scalc/ui/replacenulltransformationentry.ui", nIndex) + , mxColumnNums(mxBuilder->weld_entry("ed_columns")) + , mxReplaceString(mxBuilder->weld_entry("ed_str")) + , mxDelete(mxBuilder->weld_button("ed_delete")) + , maDeleteTransformation(aDeleteTransformation) { - disposeOnce(); + mxDelete->connect_clicked(LINK(this,ScReplaceNullTransformation, DeleteHdl)); } -void ScReplaceNullTransformation::dispose() -{ - maColumnNums.clear(); - maReplaceString.clear(); - maDelete.clear(); - ScDataTransformationBaseControl::dispose(); -} std::shared_ptr<sc::DataTransformation> ScReplaceNullTransformation::getTransformation() { - OUString aColumnString = maColumnNums->GetText(); - OUString aReplaceWithString = maReplaceString->GetText(); + OUString aColumnString = mxColumnNums->get_text(); + OUString aReplaceWithString = mxReplaceString->get_text(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aColumns; for (const auto& rColStr : aSplitColumns) @@ -837,51 +621,33 @@ std::shared_ptr<sc::DataTransformation> ScReplaceNullTransformation::getTransfor class ScDateTimeTransformation : public ScDataTransformationBaseControl { private: - VclPtr<Edit> maColumnNums; - VclPtr<ListBox> maType; - VclPtr<PushButton> maDelete; - sal_uInt32 maIndex; + std::unique_ptr<weld::Entry> mxColumnNums; + std::unique_ptr<weld::ComboBox> mxType; + std::unique_ptr<weld::Button> mxDelete; std::function<void(sal_uInt32&)> maDeleteTransformation; public: - ScDateTimeTransformation(vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); - ~ScDateTimeTransformation() override; - - virtual void dispose() override; + ScDateTimeTransformation(weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation); virtual std::shared_ptr<sc::DataTransformation> getTransformation() override; - DECL_LINK(DeleteHdl, Button*, void); + DECL_LINK(DeleteHdl, weld::Button&, void); }; -ScDateTimeTransformation::ScDateTimeTransformation(vcl::Window* pParent, sal_uInt32 aIndex, std::function<void(sal_uInt32&)> aDeleteTransformation): - ScDataTransformationBaseControl(pParent,"modules/scalc/ui/datetimetransformationentry.ui"), - maIndex(aIndex), - maDeleteTransformation(aDeleteTransformation) -{ - get(maColumnNums, "ed_columns"); - get(maType, "ed_lst"); - get(maDelete, "ed_delete"); - maDelete->SetClickHdl(LINK(this,ScDateTimeTransformation, DeleteHdl)); -} - -ScDateTimeTransformation::~ScDateTimeTransformation() +ScDateTimeTransformation::ScDateTimeTransformation(weld::Container* pParent, sal_uInt32 nIndex, std::function<void(sal_uInt32&)> aDeleteTransformation) + : ScDataTransformationBaseControl(pParent,"modules/scalc/ui/datetimetransformationentry.ui", nIndex) + , mxColumnNums(mxBuilder->weld_entry("ed_columns")) + , mxType(mxBuilder->weld_combo_box("ed_lst")) + , mxDelete(mxBuilder->weld_button("ed_delete")) + , maDeleteTransformation(aDeleteTransformation) { - disposeOnce(); -} - -void ScDateTimeTransformation::dispose() -{ - maColumnNums.clear(); - maType.clear(); - maDelete.clear(); - ScDataTransformationBaseControl::dispose(); + mxDelete->connect_clicked(LINK(this,ScDateTimeTransformation, DeleteHdl)); } std::shared_ptr<sc::DataTransformation> ScDateTimeTransformation::getTransformation() { - OUString aColumnString = maColumnNums->GetText(); - sal_Int32 nPos = maType->GetSelectedEntryPos(); + OUString aColumnString = mxColumnNums->get_text(); + sal_Int32 nPos = mxType->get_active(); std::vector<OUString> aSplitColumns = comphelper::string::split(aColumnString, ';'); std::set<SCCOL> aColumns; for (const auto& rColStr : aSplitColumns) @@ -943,194 +709,170 @@ std::shared_ptr<sc::DataTransformation> ScDateTimeTransformation::getTransformat } -ScDataProviderDlg::ScDataProviderDlg(vcl::Window* pParent, std::shared_ptr<ScDocument> pDoc, +ScDataProviderDlg::ScDataProviderDlg(weld::Window* pParent, std::shared_ptr<ScDocument> pDoc, const ScDocument* pDocument) - : ModalDialog(pParent, "dataproviderdlg", "modules/scalc/ui/dataproviderdlg.ui") - , mpDoc(std::move(pDoc)) - , mpBar(VclPtr<MenuBar>::Create()) -{ - get(mpTable, "data_table"); - get(mpList, "operation_ctrl"); - get(mpDBRanges, "select_db_range"); - mpTable->Init(mpDoc); - mpIndex = 0; + : GenericDialogController(pParent, "modules/scalc/ui/dataproviderdlg.ui", "dataproviderdlg") + , mxDoc(std::move(pDoc)) + , mxStartMenu(m_xBuilder->weld_menu("start")) + , mxColumnMenu(m_xBuilder->weld_menu("column")) + , mxBox(m_xBuilder->weld_container("data_table")) + , m_xTableParent(mxBox->CreateChildFrame()) + , mxTable(VclPtr<ScDataTableView>::Create(m_xTableParent)) + , mxScroll(m_xBuilder->weld_scrolled_window("scroll")) + , mxList(m_xBuilder->weld_container("operation_ctrl")) + , mxDataProviderCtrl(new ScDataProviderBaseControl(mxList.get(), LINK(this, ScDataProviderDlg, ImportHdl))) + , mxDBRanges(m_xBuilder->weld_combo_box("select_db_range")) + , mnIndex(0) +{ + Size aPrefSize = mxTable->GetOptimalSize(); + mxBox->set_size_request(aPrefSize.Width(), aPrefSize.Height()); + mxTable->Show(); + + mxTable->Init(mxDoc); ScDBCollection* pDBCollection = pDocument->GetDBCollection(); auto& rNamedDBs = pDBCollection->getNamedDBs(); for (auto& rNamedDB : rNamedDBs) { - mpDBRanges->InsertEntry(rNamedDB->GetName()); + mxDBRanges->append_text(rNamedDB->GetName()); } - mpDataProviderCtrl = VclPtr<ScDataProviderBaseControl>::Create(mpList, LINK(this, ScDataProviderDlg, ImportHdl)); - mpList->addEntry(mpDataProviderCtrl); - mpIndex++; pDBData = new ScDBData("data", 0, 0, 0, MAXCOL, MAXROW); - bool bSuccess = mpDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData)); + bool bSuccess = mxDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr<ScDBData>(pDBData)); SAL_WARN_IF(!bSuccess, "sc", "temporary warning"); InitMenu(); -} -ScDataProviderDlg::~ScDataProviderDlg() -{ - disposeOnce(); + maIdle.SetPriority( TaskPriority::LOWEST ); + maIdle.SetInvokeHandler( LINK( this, ScDataProviderDlg, ScrollToEnd) ); } -void ScDataProviderDlg::dispose() +ScDataProviderDlg::~ScDataProviderDlg() { - mpDataProviderCtrl.clear(); - mpTable.clear(); - mpList.clear(); - mpDBRanges.clear(); - mpBar.disposeAndClear(); - - ModalDialog::dispose(); + mxTable.disposeAndClear(); + m_xTableParent->dispose(); + m_xTableParent.clear(); } void ScDataProviderDlg::InitMenu() { - mpBar->InsertItem(MENU_START, "Start"); - VclPtrInstance<PopupMenu> pPopup; for (const auto& itrStartData : aStartData) - { - pPopup->InsertItem(itrStartData.nMenuID, OUString::createFromAscii(itrStartData.aMenuName)); - } - - mpBar->SetPopupMenu(MENU_START, pPopup); - pPopup->SetSelectHdl(LINK(this, ScDataProviderDlg, StartMenuHdl)); + mxStartMenu->append(OUString::number(itrStartData.nMenuID), OUString::createFromAscii(itrStartData.aMenuName)); + mxStartMenu->connect_activate(LINK(this, ScDataProviderDlg, StartMenuHdl)); - mpBar->InsertItem(MENU_COLUMN, "Column"); - VclPtrInstance<PopupMenu> pColumnMenu; for (const auto& itrColumnData : aColumnData) - { - pColumnMenu->InsertItem(itrColumnData.nMenuID, OUString::createFromAscii(itrColumnData.aMenuName)); - } - pColumnMenu->SetSelectHdl(LINK(this, ScDataProviderDlg, ColumnMenuHdl)); - - mpBar->SetPopupMenu(MENU_COLUMN, pColumnMenu); - - SetMenuBar(mpBar.get()); + mxColumnMenu->append(OUString::number(itrColumnData.nMenuID), OUString::createFromAscii(itrColumnData.aMenuName)); + mxColumnMenu->connect_activate(LINK(this, ScDataProviderDlg, ColumnMenuHdl)); } -void ScDataProviderDlg::MouseButtonUp(const MouseEvent& rMEvt) -{ - VclPtr<FixedText> mpText = VclPtr<FixedText>::Create(mpList); - mpText->SetText("Some Text " + OUString::number(rMEvt.GetPosPixel().X()) + "x" + OUString::number(rMEvt.GetPosPixel().getY())); - mpText->SetSizePixel(Size(400, 20)); - mpList->addEntry(mpText); - mpIndex++; -} - -IMPL_LINK(ScDataProviderDlg, StartMenuHdl, Menu*, pMenu, bool) +IMPL_LINK(ScDataProviderDlg, StartMenuHdl, const OString&, rIdent, void) { + auto nId = rIdent.toInt32(); for (auto& i: aStartData) { - if (i.nMenuID == pMenu->GetCurItemId()) + if (i.nMenuID == nId) { i.maCallback(this); - return true; + return; } } - return true; } -IMPL_LINK(ScDataProviderDlg, ColumnMenuHdl, Menu*, pMenu, bool) +IMPL_LINK_NOARG(ScDataProviderDlg, ScrollToEnd, Timer*, void) +{ + mxScroll->vadjustment_set_value(mxScroll->vadjustment_get_upper()); +} + +IMPL_LINK(ScDataProviderDlg, ColumnMenuHdl, const OString&, rIdent, void) { + auto nId = rIdent.toInt32(); for (auto& i: aColumnData) { - if (i.nMenuID == pMenu->GetCurItemId()) + if (i.nMenuID == nId) { i.maCallback(this); - return true; + // scroll to bottom when something added to the list + maIdle.Start(); + return; } } - return true; } -IMPL_LINK(ScDataProviderDlg, ImportHdl, Window*, pCtrl, void) +IMPL_LINK(ScDataProviderDlg, ImportHdl, ScDataProviderBaseControl*, pCtrl, void) { - if (pCtrl == mpDataProviderCtrl.get()) + if (pCtrl == mxDataProviderCtrl.get()) { - import(mpDoc.get(), true); + import(mxDoc.get(), true); } } void ScDataProviderDlg::applyAndQuit() { - EndDialog(RET_OK); + m_xDialog->response(RET_OK); } void ScDataProviderDlg::cancelAndQuit() { - EndDialog(RET_CANCEL); + m_xDialog->response(RET_CANCEL); } void ScDataProviderDlg::deleteColumn() -{ std::function<void(sal_uInt32&)> adeleteTransformation = std::bind(&ScDataProviderDlg::deletefromList,this, std::placeholders::_1); - VclPtr<ScDeleteColumnTransformationControl> pDeleteColumnEntry = VclPtr<ScDeleteColumnTransformationControl>::Create(mpList, mpIndex++, adeleteTransformation); - mpList->addEntry(pDeleteColumnEntry); +{ + std::function<void(sal_uInt32&)> adeleteTransformation = std::bind(&ScDataProviderDlg::deletefromList,this, std::placeholders::_1); + maControls.emplace_back(std::make_unique<ScDeleteColumnTransformationControl>(mxList.get(), mnIndex++, adeleteTransformation)); } void ScDataProviderDlg::splitColumn() { SCCOL nStartCol = -1; SCCOL nEndCol = -1; - mpTable->getColRange(nStartCol, nEndCol); + mxTable->getColRange(nStartCol, nEndCol); std::function<void(sal_uInt32&)> adeleteTransformation = std::bind(&ScDataProviderDlg::deletefromList,this, std::placeholders::_1); - VclPtr<ScSplitColumnTransformationControl> pSplitColumnEntry = VclPtr<ScSplitColumnTransformationControl>::Create(mpList, nStartCol, mpIndex++, adeleteTransformation); - mpList->addEntry(pSplitColumnEntry); + maControls.emplace_back(std::make_unique<ScSplitColumnTransformationControl>(mxList.get(), nStartCol, mnIndex++, adeleteTransformation)); } void ScDataProviderDlg::mergeColumns() { SCCOL nStartCol = -1; SCCOL nEndCol = -1; - mpTable->getColRange(nStartCol, nEndCol); + mxTable->getColRange(nStartCol, nEndCol); std::function<void(sal_uInt32&)> adeleteTransformation = std::bind(&ScDataProviderDlg::deletefromList,this, std::placeholders::_1); - VclPtr<ScMergeColumnTransformationControl> pMergeColumnEntry = VclPtr<ScMergeColumnTransformationControl>::Create(mpList, nStartCol, nEndCol, mpIndex++, adeleteTransformation); - mpList->addEntry(pMergeColumnEntry); + maControls.emplace_back(std::make_unique<ScMergeColumnTransformationControl>(mxList.get(), nStartCol, nEndCol, mnIndex++, adeleteTransformation)); } void ScDataProviderDlg::textTransformation() { std::function<void(sal_uInt32&)> adeleteTransformation = std::bind(&ScDataProviderDlg::deletefromList,this, std::placeholders::_1); - VclPtr<ScColumnTextTransformation> pTextTransforamtionEntry = VclPtr<ScColumnTextTransformation>::Create(mpList, mpIndex++, adeleteTransformation); - mpList->addEntry(pTextTransforamtionEntry); + maControls.emplace_back(std::make_unique<ScColumnTextTransformation>(mxList.get(), mnIndex++, adeleteTransformation)); } void ScDataProviderDlg::sortTransformation() { std::function<void(sal_uInt32&)> adeleteTransformation = std::bind(&ScDataProviderDlg::deletefromList,this, std::placeholders::_1); - VclPtr<ScSortTransformationControl> pSortTransforamtionEntry = VclPtr<ScSortTransformationControl>::Create(mpList, mpIndex++, adeleteTransformation); - mpList->addEntry(pSortTransforamtionEntry); + maControls.emplace_back(std::make_unique<ScSortTransformationControl>(mxList.get(), mnIndex++, adeleteTransformation)); } void ScDataProviderDlg::aggregateFunction() { std::function<void(sal_uInt32&)> adeleteTransformation = std::bind(&ScDataProviderDlg::deletefromList,this, std::placeholders::_1); - VclPtr<ScAggregateFunction> pAggregateFuntionEntry = VclPtr<ScAggregateFunction>::Create(mpList, mpIndex++, adeleteTransformation); - mpList->addEntry(pAggregateFuntionEntry); + maControls.emplace_back(std::make_unique<ScAggregateFunction>(mxList.get(), mnIndex++, adeleteTransformation)); } void ScDataProviderDlg::numberTransformation() { std::function<void(sal_uInt32&)> adeleteTransformation = std::bind(&ScDataProviderDlg::deletefromList,this, std::placeholders::_1); - VclPtr<ScNumberTransformation> pNumberTransformationEntry = VclPtr<ScNumberTransformation>::Create(mpList, mpIndex++, adeleteTransformation); - mpList->addEntry(pNumberTransformationEntry); + maControls.emplace_back(std::make_unique<ScNumberTransformation>(mxList.get(), mnIndex++, adeleteTransformation)); } void ScDataProviderDlg::replaceNullTransformation() { std::function<void(sal_uInt32&)> adeleteTransformation = std::bind(&ScDataProviderDlg::deletefromList,this, std::placeholders::_1); - VclPtr<ScReplaceNullTransformation> pReplaceNullTransformationEntry = VclPtr<ScReplaceNullTransformation>::Create(mpList, mpIndex++, adeleteTransformation); - mpList->addEntry(pReplaceNullTransformationEntry); + maControls.emplace_back(std::make_unique<ScReplaceNullTransformation>(mxList.get(), mnIndex++, adeleteTransformation)); } void ScDataProviderDlg::dateTimeTransformation() { std::function<void(sal_uInt32&)> adeleteTransformation = std::bind(&ScDataProviderDlg::deletefromList,this, std::placeholders::_1); - VclPtr<ScDateTimeTransformation> pDateTimeTransformationEntry = VclPtr<ScDateTimeTransformation>::Create(mpList, mpIndex++, adeleteTransformation); - mpList->addEntry(pDateTimeTransformationEntry); + maControls.emplace_back(std::make_unique<ScDateTimeTransformation>(mxList.get(), mnIndex++, adeleteTransformation)); } namespace { @@ -1147,79 +889,79 @@ bool hasDBName(const OUString& rName, ScDBCollection* pDBCollection) void ScDataProviderDlg::import(ScDocument* pDoc, bool bInternal) { - sc::ExternalDataSource aSource = mpDataProviderCtrl->getDataSource(pDoc); + sc::ExternalDataSource aSource = mxDataProviderCtrl->getDataSource(pDoc); - std::vector<VclPtr<vcl::Window>> aListEntries = mpList->getEntries(); - for (size_t i = 1; i < aListEntries.size(); ++i) + for (size_t i = 0; i < maControls.size(); ++i) { - ScDataTransformationBaseControl* pTransformationCtrl = dynamic_cast<ScDataTransformationBaseControl*>(aListEntries[i].get()); - if (!pTransformationCtrl) - { - SAL_WARN("sc", "all children except the provider should inherit from the base control"); - continue; - } + ScDataTransformationBaseControl* pTransformationCtrl = maControls[i].get(); aSource.AddDataTransformation(pTransformationCtrl->getTransformation()); } if (bInternal) aSource.setDBData(pDBData->GetName()); else { - aSource.setDBData(mpDBRanges->GetSelectedEntry()); + aSource.setDBData(mxDBRanges->get_active_text()); if (!hasDBName(aSource.getDBName(), pDoc->GetDBCollection())) return; pDoc->GetExternalDataMapper().insertDataSource(aSource); } aSource.refresh(pDoc, true); - mpTable->Invalidate(); + mxTable->Invalidate(); } void ScDataProviderDlg::deletefromList(sal_uInt32 nIndex) { - mpList->deleteEntry(nIndex); + auto itr = maControls.erase(maControls.begin() + nIndex); + while (itr != maControls.end()) + { + (*itr)->updateIndex(nIndex++); + ++itr; + } + --mnIndex; } -IMPL_LINK_NOARG(ScDeleteColumnTransformationControl, DeleteHdl, Button*, void) +IMPL_LINK_NOARG(ScDeleteColumnTransformationControl, DeleteHdl, weld::Button&, void) { - maDeleteTransformation(maIndex); + maDeleteTransformation(mnIndex); } -IMPL_LINK_NOARG(ScSplitColumnTransformationControl, DeleteHdl, Button*, void) +IMPL_LINK_NOARG(ScSplitColumnTransformationControl, DeleteHdl, weld::Button&, void) { - maDeleteTransformation(maIndex); + maDeleteTransformation(mnIndex); } -IMPL_LINK_NOARG(ScMergeColumnTransformationControl, DeleteHdl, Button*, void) +IMPL_LINK_NOARG(ScMergeColumnTransformationControl, DeleteHdl, weld::Button&, void) { - maDeleteTransformation(maIndex); + maDeleteTransformation(mnIndex); } -IMPL_LINK_NOARG(ScNumberTransformation, DeleteHdl, Button*, void) +IMPL_LINK_NOARG(ScNumberTransformation, DeleteHdl, weld::Button&, void) { - maDeleteTransformation(maIndex); + maDeleteTransformation(mnIndex); } -IMPL_LINK_NOARG(ScAggregateFunction, DeleteHdl, Button*, void) +IMPL_LINK_NOARG(ScAggregateFunction, DeleteHdl, weld::Button&, void) { - maDeleteTransformation(maIndex); + maDeleteTransformation(mnIndex); } -IMPL_LINK_NOARG(ScSortTransformationControl, DeleteHdl, Button*, void) +IMPL_LINK_NOARG(ScSortTransformationControl, DeleteHdl, weld::Button&, void) { - maDeleteTransformation(maIndex); + maDeleteTransformation(mnIndex); } -IMPL_LINK_NOARG(ScColumnTextTransformation, DeleteHdl, Button*, void) +IMPL_LINK_NOARG(ScColumnTextTransformation, DeleteHdl, weld::Button&, void) { - maDeleteTransformation(maIndex); + maDeleteTransformation(mnIndex); } -IMPL_LINK_NOARG(ScReplaceNullTransformation, DeleteHdl, Button*, void) +IMPL_LINK_NOARG(ScReplaceNullTransformation, DeleteHdl, weld::Button&, void) { - maDeleteTransformation(maIndex); + maDeleteTransformation(mnIndex); } -IMPL_LINK_NOARG(ScDateTimeTransformation, DeleteHdl, Button*, void) +IMPL_LINK_NOARG(ScDateTimeTransformation, DeleteHdl, weld::Button&, void) { - maDeleteTransformation(maIndex); + maDeleteTransformation(mnIndex); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/miscdlgs/datatableview.cxx b/sc/source/ui/miscdlgs/datatableview.cxx index 4e8c8bc21cbd..6d08630d009f 100644 --- a/sc/source/ui/miscdlgs/datatableview.cxx +++ b/sc/source/ui/miscdlgs/datatableview.cxx @@ -26,7 +26,7 @@ #include <fillinfo.hxx> #include <table.hxx> -#include <vcl/builderfactory.hxx> +#include <toolkit/helper/vclunohelper.hxx> #include <vcl/scrbar.hxx> #include <vcl/seleng.hxx> #include <sal/log.hxx> @@ -139,9 +139,10 @@ void ScDataTableRowView::HideEntries(SCCOLROW nPos, SCCOLROW nEndPos) } } -ScDataTableView::ScDataTableView(vcl::Window* pParent): - Control(pParent), +ScDataTableView::ScDataTableView(const css::uno::Reference<css::awt::XWindow> &rParent) : + Control(VCLUnoHelper::GetWindow(rParent)), mpSelectionEngine(new SelectionEngine(this)), + mpTopLeft(VclPtr<ScrollBarBox>::Create(this, WB_SIZEABLE)), mpColView(VclPtr<ScDataTableColView>::Create(this, mpSelectionEngine.get())), mpRowView(VclPtr<ScDataTableRowView>::Create(this, mpSelectionEngine.get())), mpVScroll(VclPtr<ScrollBar>::Create(this, WinBits(WB_VSCROLL | WB_DRAG))), @@ -149,6 +150,7 @@ ScDataTableView::ScDataTableView(vcl::Window* pParent): mnFirstVisibleRow(0), mnFirstVisibleCol(0) { + mpTopLeft->setPosSizePixel(0, 0, nRowHeaderWidth, nColHeaderHeight); mpColView->setPosSizePixel(nRowHeaderWidth, 0, nRowHeaderWidth, nColHeaderHeight); mpRowView->setPosSizePixel(0, nColHeaderHeight, nRowHeaderWidth, nColHeaderHeight); @@ -160,6 +162,7 @@ ScDataTableView::ScDataTableView(vcl::Window* pParent): mpHScroll->SetRangeMax(50); mpHScroll->SetEndScrollHdl(LINK(this, ScDataTableView, ScrollHdl)); + mpTopLeft->Show(); mpColView->Show(); mpRowView->Show(); mpVScroll->Show(); @@ -173,8 +176,6 @@ void ScDataTableView::Init(std::shared_ptr<ScDocument> pDoc) mpRowView->Init(mpDoc.get()); } -VCL_BUILDER_FACTORY(ScDataTableView) - ScDataTableView::~ScDataTableView() { disposeOnce(); @@ -182,6 +183,7 @@ ScDataTableView::~ScDataTableView() void ScDataTableView::dispose() { + mpTopLeft.disposeAndClear(); mpColView.disposeAndClear(); mpRowView.disposeAndClear(); mpVScroll.disposeAndClear(); @@ -263,6 +265,7 @@ void ScDataTableView::MouseButtonUp(const MouseEvent& rMEvt) void ScDataTableView::Resize() { Size aSize = GetSizePixel(); + mpTopLeft->setPosSizePixel(0, 0, nRowHeaderWidth, nColHeaderHeight); mpColView->setPosSizePixel(nRowHeaderWidth, 0, aSize.Width() - nScrollBarSize, nColHeaderHeight); mpRowView->setPosSizePixel(0, nColHeaderHeight, nRowHeaderWidth, aSize.Height()); @@ -292,7 +295,7 @@ void ScDataTableView::Paint(vcl::RenderContext& rRenderContext, const tools::Rec Size ScDataTableView::GetOptimalSize() const { - return Size(600, 200); + return Size(600, 400); } void ScDataTableView::getColRange(SCCOL& rStartCol, SCCOL& rEndCol) const diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 3e9cb3d4ae88..1a886fa3e3c0 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -796,10 +796,10 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) std::shared_ptr<ScDocument> xDoc(new ScDocument, o3tl::default_delete<ScDocument>()); xDoc->InsertTab(0, "test"); ScDocument* pDoc = GetViewData()->GetDocument(); - ScopedVclPtrInstance< ScDataProviderDlg > aDialog( pTabViewShell->GetLegacyDialogParent(), xDoc, pDoc); - if (aDialog->Execute() == RET_OK) + ScDataProviderDlg aDialog(pTabViewShell->GetDialogParent(), xDoc, pDoc); + if (aDialog.run() == RET_OK) { - aDialog->import(pDoc); + aDialog.import(pDoc); } } break; diff --git a/sc/uiconfig/scalc/ui/aggregatefunctionentry.ui b/sc/uiconfig/scalc/ui/aggregatefunctionentry.ui index defe0bac76b6..369061d2d051 100644 --- a/sc/uiconfig/scalc/ui/aggregatefunctionentry.ui +++ b/sc/uiconfig/scalc/ui/aggregatefunctionentry.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.2 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="grid"> @@ -101,18 +101,30 @@ </child> <child> <object class="GtkButton" id="ed_delete"> + <property name="label" translatable="yes" context="aggregatefunctionentry|delete">Cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes" context="aggregatefunctionentry|delete">Cancel</property> + <property name="receives_default">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> <property name="top_attach">0</property> </packing> </child> diff --git a/sc/uiconfig/scalc/ui/dataproviderdlg.ui b/sc/uiconfig/scalc/ui/dataproviderdlg.ui index ead166b83cf2..e8774906ed14 100644 --- a/sc/uiconfig/scalc/ui/dataproviderdlg.ui +++ b/sc/uiconfig/scalc/ui/dataproviderdlg.ui @@ -1,60 +1,89 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.2 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> - <object class="GtkWindow" id="dataproviderdlg"> + <object class="GtkDialog" id="dataproviderdlg"> <property name="can_focus">False</property> + <property name="modal">True</property> + <property name="type_hint">dialog</property> <child> + <placeholder/> + </child> + <child internal-child="vbox"> <object class="GtkBox"> - <property name="visible">True</property> <property name="can_focus">False</property> - <child> - <object class="sclo-ScDataTableView" id="data_table"> - <property name="visible">True</property> + <property name="orientation">vertical</property> + <property name="spacing">2</property> + <child internal-child="action_area"> + <object class="GtkButtonBox"> <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> + <property name="fill">False</property> <property name="position">0</property> </packing> </child> <child> - <object class="GtkBox"> + <object class="GtkMenuBar" id="menubar"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="orientation">vertical</property> <child> - <object class="GtkGrid"> + <object class="GtkMenuItem"> <property name="visible">True</property> <property name="can_focus">False</property> - <child> - <object class="GtkLabel" id="label2"> + <property name="label">_Start</property> + <property name="use_underline">True</property> + <child type="submenu"> + <object class="GtkMenu" id="start"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="label" translatable="yes" context="dataproviderdlg|db_name">Database Range: </property> - <accessibility> - <relation type="label-for" target="select_db_range"/> - </accessibility> </object> - <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> - </packing> </child> - <child> - <object class="GtkComboBox" id="select_db_range"> + </object> + </child> + <child> + <object class="GtkMenuItem"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label">_Column</property> + <property name="use_underline">True</property> + <child type="submenu"> + <object class="GtkMenu" id="column"> <property name="visible">True</property> <property name="can_focus">False</property> - <accessibility> - <relation type="labelled-by" target="label2"/> - </accessibility> </object> - <packing> - <property name="left_attach">1</property> - <property name="top_attach">0</property> - </packing> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <object class="GtkBox" id="data_table"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <child> + <placeholder/> </child> </object> <packing> @@ -64,9 +93,93 @@ </packing> </child> <child> - <object class="GtkListBox" id="operation_ctrl"> + <object class="GtkBox"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkGrid"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="dataproviderdlg|db_name">Database Range: </property> + <accessibility> + <relation type="label-for" target="select_db_range"/> + </accessibility> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="select_db_range"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <accessibility> + <relation type="labelled-by" target="label2"/> + </accessibility> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</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="GtkScrolledWindow" id="scroll"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="vexpand">True</property> + <property name="hscrollbar_policy">never</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkViewport"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="vexpand">True</property> + <child> + <object class="GtkBox"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <object class="GtkBox" id="operation_ctrl"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="vexpand">True</property> + <property name="orientation">vertical</property> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + </object> + </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> @@ -74,23 +187,14 @@ <property name="position">1</property> </packing> </child> - <child> - <placeholder/> - </child> </object> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> - <child> - <placeholder/> - </child> </object> </child> - <child type="titlebar"> - <placeholder/> - </child> </object> </interface> diff --git a/sc/uiconfig/scalc/ui/dataproviderentry.ui b/sc/uiconfig/scalc/ui/dataproviderentry.ui index 25257a267a9b..68c523df36b3 100644 --- a/sc/uiconfig/scalc/ui/dataproviderentry.ui +++ b/sc/uiconfig/scalc/ui/dataproviderentry.ui @@ -1,7 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> + <object class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="icon_name">sc/res/xml_element.png</property> + </object> <object class="GtkGrid" id="grid"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -10,7 +15,7 @@ <property name="row_spacing">6</property> <property name="column_spacing">12</property> <child> - <object class="GtkComboBox" id="provider_lst"> + <object class="GtkComboBoxText" id="provider_lst"> <property name="visible">True</property> <property name="can_focus">False</property> </object> @@ -73,7 +78,19 @@ </packing> </child> <child> - <placeholder/> + <object class="GtkButton" id="apply"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_text" translatable="yes" context="dataproviderentry|apply">Apply Changes</property> + <property name="image">image1</property> + <property name="relief">none</property> + <property name="always_show_image">True</property> + </object> + <packing> + <property name="left_attach">4</property> + <property name="top_attach">1</property> + </packing> </child> <child> <placeholder/> diff --git a/sc/uiconfig/scalc/ui/datetimetransformationentry.ui b/sc/uiconfig/scalc/ui/datetimetransformationentry.ui index f32de1922c08..69e206c2ff5c 100644 --- a/sc/uiconfig/scalc/ui/datetimetransformationentry.ui +++ b/sc/uiconfig/scalc/ui/datetimetransformationentry.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.2 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="grid"> @@ -115,18 +115,30 @@ </child> <child> <object class="GtkButton" id="ed_delete"> + <property name="label" translatable="yes" context="datetimetransformationentry|delete">Cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes" context="datetimetransformationentry|delete">Cancel</property> + <property name="receives_default">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> <property name="top_attach">0</property> </packing> </child> diff --git a/sc/uiconfig/scalc/ui/deletecolumnentry.ui b/sc/uiconfig/scalc/ui/deletecolumnentry.ui index b844793b16f6..7b09d558347b 100644 --- a/sc/uiconfig/scalc/ui/deletecolumnentry.ui +++ b/sc/uiconfig/scalc/ui/deletecolumnentry.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="grid"> @@ -60,18 +60,30 @@ </child> <child> <object class="GtkButton" id="ed_delete"> + <property name="label" translatable="yes" context="deletecolumnentry|delete">Cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes" context="deletecolumnentry|delete">Cancel</property> + <property name="receives_default">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> <property name="top_attach">0</property> </packing> </child> diff --git a/sc/uiconfig/scalc/ui/mergecolumnentry.ui b/sc/uiconfig/scalc/ui/mergecolumnentry.ui index 35b0efc1d5bf..c5afab6feb8c 100644 --- a/sc/uiconfig/scalc/ui/mergecolumnentry.ui +++ b/sc/uiconfig/scalc/ui/mergecolumnentry.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.2 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="grid"> @@ -81,18 +81,30 @@ </child> <child> <object class="GtkButton" id="ed_delete"> + <property name="label" translatable="yes" context="mergecolumnentry|delete">Cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes" context="mergecolumnentry|delete">Cancel</property> + <property name="receives_default">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> <property name="top_attach">0</property> </packing> </child> diff --git a/sc/uiconfig/scalc/ui/numbertransformationentry.ui b/sc/uiconfig/scalc/ui/numbertransformationentry.ui index 9e6a9afc44cc..5f0e395dd0bc 100644 --- a/sc/uiconfig/scalc/ui/numbertransformationentry.ui +++ b/sc/uiconfig/scalc/ui/numbertransformationentry.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.2 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="grid"> @@ -110,18 +110,30 @@ </child> <child> <object class="GtkButton" id="ed_delete"> + <property name="label" translatable="yes" context="numbertransformationentry|delete">Cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes" context="numbertransformationentry|delete">Cancel</property> + <property name="receives_default">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> <property name="top_attach">0</property> </packing> </child> diff --git a/sc/uiconfig/scalc/ui/replacenulltransformationentry.ui b/sc/uiconfig/scalc/ui/replacenulltransformationentry.ui index 050e8a602b90..816c711b5c13 100644 --- a/sc/uiconfig/scalc/ui/replacenulltransformationentry.ui +++ b/sc/uiconfig/scalc/ui/replacenulltransformationentry.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.2 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="grid"> @@ -93,18 +93,30 @@ </child> <child> <object class="GtkButton" id="ed_delete"> + <property name="label" translatable="yes" context="replacenulltransformationentry|delete">Cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes" context="replacenulltransformationentry|delete">Cancel</property> + <property name="receives_default">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> <property name="top_attach">0</property> </packing> </child> diff --git a/sc/uiconfig/scalc/ui/sorttransformationentry.ui b/sc/uiconfig/scalc/ui/sorttransformationentry.ui index 7f7d41cf614c..dbf93d6fec58 100644 --- a/sc/uiconfig/scalc/ui/sorttransformationentry.ui +++ b/sc/uiconfig/scalc/ui/sorttransformationentry.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.2 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="grid"> @@ -32,9 +32,11 @@ <property name="can_focus">False</property> <child> <object class="GtkCheckButton" id="ed_ascending"> - <property name="visible">True</property> <property name="label" translatable="yes" context="sorttransformationentry|type">Ascending Order</property> + <property name="visible">True</property> <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">False</property> </object> <packing> <property name="left_attach">1</property> @@ -68,6 +70,9 @@ <property name="top_attach">1</property> </packing> </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="expand">False</property> @@ -77,18 +82,30 @@ </child> <child> <object class="GtkButton" id="ed_delete"> + <property name="label" translatable="yes" context="sorttransformationentry|delete">Cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes" context="sorttransformationentry|delete">Cancel</property> + <property name="receives_default">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> <property name="top_attach">0</property> </packing> </child> diff --git a/sc/uiconfig/scalc/ui/splitcolumnentry.ui b/sc/uiconfig/scalc/ui/splitcolumnentry.ui index c97ff0d9d9ce..137492797c8a 100644 --- a/sc/uiconfig/scalc/ui/splitcolumnentry.ui +++ b/sc/uiconfig/scalc/ui/splitcolumnentry.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="grid"> @@ -85,18 +85,30 @@ </child> <child> <object class="GtkButton" id="ed_delete"> + <property name="label" translatable="yes" context="splitcolumnentry|delete">Cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes" context="splitcolumnentry|delete">Cancel</property> + <property name="receives_default">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> <property name="top_attach">0</property> </packing> </child> diff --git a/sc/uiconfig/scalc/ui/texttransformationentry.ui b/sc/uiconfig/scalc/ui/texttransformationentry.ui index c9ae6b0ddcfe..702196356b0b 100644 --- a/sc/uiconfig/scalc/ui/texttransformationentry.ui +++ b/sc/uiconfig/scalc/ui/texttransformationentry.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.2 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="grid"> @@ -101,18 +101,30 @@ </child> <child> <object class="GtkButton" id="ed_delete"> + <property name="label" translatable="yes" context="texttransformation_type|delete">Cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="label" translatable="yes" context="texttransformation_type|delete">Cancel</property> + <property name="receives_default">False</property> </object> <packing> - <property name="left_attach">1</property> - <property name="top_attach">1</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> </packing> </child> </object> <packing> <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkSeparator"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">0</property> <property name="top_attach">0</property> </packing> </child> diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 9e9640583ce0..2bd039c65a9e 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -491,7 +491,6 @@ custom_widgets = [ 'RecentDocsView', 'RowEdit', 'SameContentListBox', - 'ScDataTableView', 'SdPageObjsTLB', 'SearchBox', 'SearchResultsBox', diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr index 6295b93012d2..1f5c72e6be46 100644 --- a/solenv/sanitizers/ui/modules/scalc.suppr +++ b/solenv/sanitizers/ui/modules/scalc.suppr @@ -58,7 +58,7 @@ sc/uiconfig/scalc/ui/dataform.ui://GtkLabel[@id='label'] orphan-label sc/uiconfig/scalc/ui/datastreams.ui://GtkLabel[@id='label6'] orphan-label sc/uiconfig/scalc/ui/datastreams.ui://GtkEntry[@id='range'] no-labelled-by sc/uiconfig/scalc/ui/datastreams.ui://GtkEntry[@id='limit'] no-labelled-by -sc/uiconfig/scalc/ui/dataproviderentry.ui://GtkComboBox[@id='provider_lst'] no-labelled-by +sc/uiconfig/scalc/ui/dataproviderentry.ui://GtkComboBoxText[@id='provider_lst'] no-labelled-by sc/uiconfig/scalc/ui/dataproviderentry.ui://GtkEntry[@id='ed_url'] no-labelled-by sc/uiconfig/scalc/ui/dataproviderentry.ui://GtkEntry[@id='ed_id'] no-labelled-by sc/uiconfig/scalc/ui/dataproviderentry.ui:GtkGrid[@id='grid']/GtkLabel orphan-label diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 6cf9e010178c..151135eb1f89 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -863,6 +863,7 @@ private: bool const m_bTakeOwnership; sal_uInt16 m_nLastId; + DECL_LINK(SelectMenuHdl, ::Menu*, bool); public: SalInstanceMenu(PopupMenu* pMenu, bool bTakeOwnership) : m_xMenu(pMenu) @@ -870,6 +871,7 @@ public: { const auto nCount = m_xMenu->GetItemCount(); m_nLastId = nCount ? pMenu->GetItemId(nCount-1) : 0; + m_xMenu->SetSelectHdl(LINK(this, SalInstanceMenu, SelectMenuHdl)); } virtual OString popup_at_rect(weld::Widget* pParent, const tools::Rectangle &rRect) override { @@ -914,11 +916,18 @@ public: } virtual ~SalInstanceMenu() override { + m_xMenu->SetSelectHdl(Link<::Menu*, bool>()); if (m_bTakeOwnership) m_xMenu.disposeAndClear(); } }; +IMPL_LINK_NOARG(SalInstanceMenu, SelectMenuHdl, ::Menu*, bool) +{ + signal_activate(m_xMenu->GetCurItemIdent()); + return true; +} + class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolbar { private: diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 79a5ce12d750..5837e008af38 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -6562,6 +6562,7 @@ private: { const gchar* pStr = gtk_buildable_get_name(GTK_BUILDABLE(pItem)); m_sActivated = OString(pStr, pStr ? strlen(pStr) : 0); + weld::Menu::signal_activate(m_sActivated); } void clear_extras() |