diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-06-20 16:01:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-06-23 12:50:00 +0200 |
commit | 5bbd8aecad3d2cc97c075490ef27aecc9180ef99 (patch) | |
tree | 6c5c2084d81ac5930bddb1668c86a6a1f322072f /include | |
parent | 9d5e36c216d01a2cc0b2aefa801bb96ddb6eb199 (diff) |
most of jsdialogbuilder is not used outside vcl
so split it into the bit that is needed and just include that.
add missing license headers
Change-Id: I875f91176e6881e830fee6a58368d0b28ce9a0f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96774
Tested-by: Jenkins
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/jsdialog/builder.hxx | 21 | ||||
-rw-r--r-- | include/vcl/jsdialog/jsdialogbuilder.hxx | 208 |
2 files changed, 21 insertions, 208 deletions
diff --git a/include/vcl/jsdialog/builder.hxx b/include/vcl/jsdialog/builder.hxx new file mode 100644 index 000000000000..ac4c8925cb87 --- /dev/null +++ b/include/vcl/jsdialog/builder.hxx @@ -0,0 +1,21 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <vcl/dllapi.h> +#include <vcl/IDialogRenderable.hxx> +#include <vcl/weld.hxx> + +namespace jsdialog +{ +VCL_DLLPUBLIC weld::Widget* FindWeldWidgetsMap(vcl::LOKWindowId nWindowId, const OString& rWidget); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/vcl/jsdialog/jsdialogbuilder.hxx b/include/vcl/jsdialog/jsdialogbuilder.hxx deleted file mode 100644 index 62f6d11a2d7a..000000000000 --- a/include/vcl/jsdialog/jsdialogbuilder.hxx +++ /dev/null @@ -1,208 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef INCLUDED_VCL_INC_JSDIALOG_JSDIALOG_HXX -#define INCLUDED_VCL_INC_JSDIALOG_JSDIALOG_HXX - -#include <vcl/weld.hxx> -#include <comphelper/string.hxx> -#include <vcl/sysdata.hxx> -#include <vcl/virdev.hxx> -#include <vcl/builder.hxx> -#include <vcl/salvtables.hxx> -#include <vcl/button.hxx> -#include <vcl/fmtfield.hxx> - -class ComboBox; -typedef std::map<OString, weld::Widget*> WidgetMap; - -class JSDialogNotifyIdle : public Idle -{ - VclPtr<vcl::Window> m_aWindow; - std::string m_LastNotificationMessage; - -public: - JSDialogNotifyIdle(VclPtr<vcl::Window> aWindow); - - void Invoke() override; -}; - -class VCL_DLLPUBLIC JSDialogSender -{ - std::unique_ptr<JSDialogNotifyIdle> mpIdleNotify; - -public: - JSDialogSender(VclPtr<vcl::Window> aOwnedToplevel) - : mpIdleNotify(new JSDialogNotifyIdle(aOwnedToplevel)) - { - } - - void notifyDialogState(); -}; - -class VCL_DLLPUBLIC JSInstanceBuilder : public SalInstanceBuilder -{ - vcl::LOKWindowId m_nWindowId; - /// used in case of tab pages where dialog is not a direct top level - VclPtr<vcl::Window> m_aParentDialog; - bool m_bHasTopLevelDialog; - - static std::map<vcl::LOKWindowId, WidgetMap>& GetLOKWeldWidgetsMap(); - static void InsertWindowToMap(int nWindowId); - void RememberWidget(const OString& id, weld::Widget* pWidget); - -public: - JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); - virtual ~JSInstanceBuilder() override; - virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id, - bool bTakeOwnership = true) override; - virtual std::unique_ptr<weld::Label> weld_label(const OString& id, - bool bTakeOwnership = false) override; - virtual std::unique_ptr<weld::Button> weld_button(const OString& id, - bool bTakeOwnership = false) override; - virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id, - bool bTakeOwnership = false) override; - virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id, - bool bTakeOwnership = false) override; - virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id, - bool bTakeOwnership = false) override; - virtual std::unique_ptr<weld::SpinButton> - weld_spin_button(const OString& id, bool bTakeOwnership = false) override; - virtual std::unique_ptr<weld::CheckButton> - weld_check_button(const OString& id, bool bTakeOwnership = false) override; - - static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, - VclMessageType eMessageType, - VclButtonsType eButtonType, - const OUString& rPrimaryMessage); - static weld::Widget* FindWeldWidgetsMap(vcl::LOKWindowId nWindowId, const OString& rWidget); -}; - -template <class BaseInstanceClass, class VclClass> -class VCL_DLLPUBLIC JSWidget : public BaseInstanceClass, public JSDialogSender -{ -public: - JSWidget(VclPtr<vcl::Window> aOwnedToplevel, VclClass* pObject, SalInstanceBuilder* pBuilder, - bool bTakeOwnership) - : BaseInstanceClass(pObject, pBuilder, bTakeOwnership) - , JSDialogSender(aOwnedToplevel) - { - } - - virtual void show() override - { - BaseInstanceClass::show(); - notifyDialogState(); - } - - virtual void hide() override - { - BaseInstanceClass::hide(); - notifyDialogState(); - } - - virtual void set_sensitive(bool sensitive) override - { - BaseInstanceClass::set_sensitive(sensitive); - notifyDialogState(); - } -}; - -class VCL_DLLPUBLIC JSLabel : public JSWidget<SalInstanceLabel, FixedText> -{ -public: - JSLabel(VclPtr<vcl::Window> aOwnedToplevel, FixedText* pLabel, SalInstanceBuilder* pBuilder, - bool bTakeOwnership); - virtual void set_label(const OUString& rText) override; -}; - -class VCL_DLLPUBLIC JSButton : public JSWidget<SalInstanceButton, ::Button> -{ -public: - JSButton(VclPtr<vcl::Window> aOwnedToplevel, ::Button* pButton, SalInstanceBuilder* pBuilder, - bool bTakeOwnership); -}; - -class VCL_DLLPUBLIC JSEntry : public JSWidget<SalInstanceEntry, ::Edit> -{ -public: - JSEntry(VclPtr<vcl::Window> aOwnedToplevel, ::Edit* pEntry, SalInstanceBuilder* pBuilder, - bool bTakeOwnership); - virtual void set_text(const OUString& rText) override; -}; - -class VCL_DLLPUBLIC JSListBox : public JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox> -{ -public: - JSListBox(VclPtr<vcl::Window> aOwnedToplevel, ::ListBox* pListBox, SalInstanceBuilder* pBuilder, - bool bTakeOwnership); - virtual void insert(int pos, const OUString& rStr, const OUString* pId, - const OUString* pIconName, VirtualDevice* pImageSurface) override; - virtual void remove(int pos) override; - virtual void set_active(int pos) override; -}; - -class VCL_DLLPUBLIC JSComboBox : public JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox> -{ -public: - JSComboBox(VclPtr<vcl::Window> aOwnedToplevel, ::ComboBox* pComboBox, - SalInstanceBuilder* pBuilder, bool bTakeOwnership); - virtual void insert(int pos, const OUString& rStr, const OUString* pId, - const OUString* pIconName, VirtualDevice* pImageSurface) override; - virtual void remove(int pos) override; - virtual void set_entry_text(const OUString& rText) override; - virtual void set_active(int pos) override; -}; - -class VCL_DLLPUBLIC JSNotebook : public JSWidget<SalInstanceNotebook, ::TabControl> -{ -public: - JSNotebook(VclPtr<vcl::Window> aOwnedToplevel, ::TabControl* pControl, - SalInstanceBuilder* pBuilder, bool bTakeOwnership); - - virtual void set_current_page(int nPage) override; - - virtual void set_current_page(const OString& rIdent) override; - - virtual void remove_page(const OString& rIdent) override; - - virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override; -}; - -class VCL_DLLPUBLIC JSSpinButton : public JSWidget<SalInstanceSpinButton, ::FormattedField> -{ -public: - JSSpinButton(VclPtr<vcl::Window> aOwnedToplevel, ::FormattedField* pSpin, - SalInstanceBuilder* pBuilder, bool bTakeOwnership); - - virtual void set_value(int value) override; -}; - -class VCL_DLLPUBLIC JSMessageDialog : public SalInstanceMessageDialog, public JSDialogSender -{ -public: - JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership); - - virtual void set_primary_text(const OUString& rText) override; - - virtual void set_secondary_text(const OUString& rText) override; -}; - -class VCL_DLLPUBLIC JSCheckButton : public JSWidget<SalInstanceCheckButton, ::CheckBox> -{ -public: - JSCheckButton(VclPtr<vcl::Window> aOwnedToplevel, ::CheckBox* pCheckBox, - SalInstanceBuilder* pBuilder, bool bTakeOwnership); - - virtual void set_active(bool active) override; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ |