diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2023-08-17 09:24:09 +0200 |
---|---|---|
committer | Szymon Kłos <szymon.klos@collabora.com> | 2023-09-18 20:22:39 +0200 |
commit | ba81501e6094d89c18629dc1ad9b7eb6e3837e50 (patch) | |
tree | 298ef6df5d0d0bc352bfd2746afdeb428d79fb65 /vcl | |
parent | fa2e2757f35883f61841c49f53ad5f80979c8a76 (diff) |
jsdialog: vertical notebook
Change-Id: I584509bfd3d367c8b1c4183c8d176ba7b7ad0cfe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155755
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Attila Szűcs <attila.szucs@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157027
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 10 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 51 |
2 files changed, 56 insertions, 5 deletions
diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index f632753d35b1..33f5bdcbe881 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -634,6 +634,16 @@ public: virtual void insert_page(const OUString& 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 OUString& rIdent) override; + virtual void insert_page(const OUString& 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 cd191d15a9d8..fcabfc67bbbc 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -7,10 +7,26 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include <boost/property_tree/json_parser.hpp> - +#include <jsdialog/jsdialogbuilder.hxx> +#include <sal/log.hxx> #include <comphelper/base64.hxx> #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 <messagedialog.hxx> +#include <tools/json_writer.hxx> +#include <o3tl/deleter.hxx> +#include <memory> +#include <boost/property_tree/json_parser.hpp> +#include <vcl/jsdialog/executor.hxx> #include <cppuhelper/supportsservice.hxx> #include <jsdialog/jsdialogbuilder.hxx> @@ -1043,9 +1059,15 @@ std::unique_ptr<weld::ComboBox> JSInstanceBuilder::weld_combo_box(const OUString std::unique_ptr<weld::Notebook> JSInstanceBuilder::weld_notebook(const OUString& 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()); @@ -1711,6 +1733,25 @@ void JSNotebook::insert_page(const OUString& 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 OUString& rIdent) +{ + SalInstanceVerticalNotebook::remove_page(rIdent); + sendFullUpdate(); +} + +void JSVerticalNotebook::insert_page(const OUString& 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) |