vcl/inc/jsdialog/jsdialogbuilder.hxx | 10 ++++++++ vcl/jsdialog/jsdialogbuilder.cxx | 40 ++++++++++++++++++++++++++++------- 2 files changed, 43 insertions(+), 7 deletions(-)
New commits: commit d34a7f1637a2345bafcae9a10672aa6008e1f725 Author: Szymon Kłos <szymon.k...@collabora.com> AuthorDate: Thu Aug 17 09:24:09 2023 +0200 Commit: Szymon Kłos <szymon.k...@collabora.com> CommitDate: Mon Aug 21 15:19:08 2023 +0200 jsdialog: vertical notebook Change-Id: I584509bfd3d367c8b1c4183c8d176ba7b7ad0cfe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155755 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Attila Szűcs <attila.sz...@collabora.com> diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 8ed7743c96dd..c2bf8a415ecd 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -637,6 +637,16 @@ public: virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override; }; +class JSVerticalNotebook final : public JSWidget<SalInstanceVerticalNotebook, ::VerticalTabControl> +{ +public: + JSVerticalNotebook(JSDialogSender* pSender, ::VerticalTabControl* pControl, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void remove_page(const OString& rIdent) override; + virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override; +}; + class JSSpinButton final : public JSWidget<SalInstanceSpinButton, ::FormattedField> { public: diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 9d1bc1774165..e147049c6f56 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -12,18 +12,19 @@ #include <comphelper/lok.hxx> #include <utility> #include <vcl/tabpage.hxx> +#include <vcl/toolbox.hxx> #include <vcl/toolkit/button.hxx> +#include <vcl/toolkit/combobox.hxx> #include <vcl/toolkit/dialog.hxx> +#include <vcl/toolkit/treelistentry.hxx> +#include <vcl/toolkit/vclmedit.hxx> +#include <verticaltabctrl.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> -#include <vcl/toolkit/combobox.hxx> #include <messagedialog.hxx> #include <tools/json_writer.hxx> #include <o3tl/deleter.hxx> #include <memory> -#include <vcl/toolbox.hxx> -#include <vcl/toolkit/vclmedit.hxx> #include <boost/property_tree/json_parser.hpp> -#include <vcl/toolkit/treelistentry.hxx> #include <vcl/jsdialog/executor.hxx> #include <cppuhelper/supportsservice.hxx> #include <wizdlg.hxx> @@ -1047,9 +1048,15 @@ std::unique_ptr<weld::ComboBox> JSInstanceBuilder::weld_combo_box(const OString& std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const OString& id) { - TabControl* pNotebook = m_xBuilder->get<TabControl>(id); - auto pWeldWidget - = pNotebook ? std::make_unique<JSNotebook>(this, pNotebook, this, false) : nullptr; + std::unique_ptr<weld::Notebook> pWeldWidget; + vcl::Window* pNotebook = m_xBuilder->get(id); + + if (pNotebook && pNotebook->GetType() == WindowType::TABCONTROL) + pWeldWidget + = std::make_unique<JSNotebook>(this, static_cast<TabControl*>(pNotebook), this, false); + else if (pNotebook->GetType() == WindowType::VERTICALTABCONTROL) + pWeldWidget = std::make_unique<JSVerticalNotebook>( + this, static_cast<VerticalTabControl*>(pNotebook), this, false); if (pWeldWidget) RememberWidget(id, pWeldWidget.get()); @@ -1691,6 +1698,25 @@ void JSNotebook::insert_page(const OString& rIdent, const OUString& rLabel, int sendFullUpdate(); } +JSVerticalNotebook::JSVerticalNotebook(JSDialogSender* pSender, ::VerticalTabControl* pControl, + SalInstanceBuilder* pBuilder, bool bTakeOwnership) + : JSWidget<SalInstanceVerticalNotebook, ::VerticalTabControl>(pSender, pControl, pBuilder, + bTakeOwnership) +{ +} + +void JSVerticalNotebook::remove_page(const OString& rIdent) +{ + SalInstanceVerticalNotebook::remove_page(rIdent); + sendFullUpdate(); +} + +void JSVerticalNotebook::insert_page(const OString& rIdent, const OUString& rLabel, int nPos) +{ + SalInstanceVerticalNotebook::insert_page(rIdent, rLabel, nPos); + sendFullUpdate(); +} + JSSpinButton::JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : JSWidget<SalInstanceSpinButton, ::FormattedField>(pSender, pSpin, pBuilder, bTakeOwnership)