2020-02-18 15:41:56 +01:00
|
|
|
#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>
|
2020-03-05 12:18:38 +01:00
|
|
|
#include <vcl/salvtables.hxx>
|
2020-02-28 15:10:24 +01:00
|
|
|
#include <vcl/button.hxx>
|
2020-02-18 15:41:56 +01:00
|
|
|
|
2020-03-05 12:24:27 +01:00
|
|
|
class ComboBox;
|
2020-03-06 11:11:57 +01:00
|
|
|
typedef std::map<OString, weld::Widget*> WidgetMap;
|
2020-03-05 12:24:27 +01:00
|
|
|
|
2020-02-24 18:35:18 +01:00
|
|
|
class JSDialogSender
|
|
|
|
{
|
|
|
|
VclPtr<vcl::Window> m_aOwnedToplevel;
|
|
|
|
|
|
|
|
public:
|
|
|
|
JSDialogSender(VclPtr<vcl::Window> aOwnedToplevel)
|
|
|
|
: m_aOwnedToplevel(aOwnedToplevel)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void notifyDialogState();
|
|
|
|
};
|
|
|
|
|
2020-02-18 15:41:56 +01:00
|
|
|
class VCL_DLLPUBLIC JSInstanceBuilder : public SalInstanceBuilder
|
|
|
|
{
|
2020-03-05 12:18:38 +01:00
|
|
|
vcl::LOKWindowId m_nWindowId;
|
2020-03-09 14:11:06 +01:00
|
|
|
/// used in case of tab pages where dialog is not a direct top level
|
|
|
|
VclPtr<vcl::Window> m_aParentDialog;
|
|
|
|
bool m_bHasTopLevelDialog;
|
2020-03-05 12:18:38 +01:00
|
|
|
|
2020-03-06 11:11:57 +01:00
|
|
|
static std::map<vcl::LOKWindowId, WidgetMap>& GetLOKWeldWidgetsMap();
|
2020-03-09 14:11:06 +01:00
|
|
|
static void InsertWindowToMap(int nWindowId);
|
2020-03-06 11:11:57 +01:00
|
|
|
void RememberWidget(const OString& id, weld::Widget* pWidget);
|
|
|
|
|
2020-02-18 15:41:56 +01:00
|
|
|
public:
|
|
|
|
JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile);
|
2020-03-05 12:18:38 +01:00
|
|
|
virtual ~JSInstanceBuilder() override;
|
2020-02-18 15:41:56 +01:00
|
|
|
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;
|
2020-02-28 15:10:24 +01:00
|
|
|
virtual std::unique_ptr<weld::Button> weld_button(const OString& id,
|
|
|
|
bool bTakeOwnership = false) override;
|
2020-02-24 18:35:18 +01:00
|
|
|
virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id,
|
|
|
|
bool bTakeOwnership = false) override;
|
2020-02-25 13:03:34 +01:00
|
|
|
virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id,
|
|
|
|
bool bTakeOwnership = false) override;
|
2020-03-04 16:05:10 +01:00
|
|
|
virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id,
|
|
|
|
bool bTakeOwnership = false) override;
|
2020-03-05 12:18:38 +01:00
|
|
|
|
2020-03-06 11:11:57 +01:00
|
|
|
static weld::Widget* FindWeldWidgetsMap(vcl::LOKWindowId nWindowId, const OString& rWidget);
|
2020-02-18 15:41:56 +01:00
|
|
|
};
|
|
|
|
|
2020-02-28 13:47:22 +01:00
|
|
|
template <class BaseInstanceClass, class VclClass>
|
2020-03-05 12:18:38 +01:00
|
|
|
class VCL_DLLPUBLIC JSWidget : public BaseInstanceClass, public JSDialogSender
|
2020-02-28 13:47:22 +01:00
|
|
|
{
|
|
|
|
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();
|
|
|
|
}
|
2020-02-28 15:10:24 +01:00
|
|
|
|
|
|
|
virtual void set_sensitive(bool sensitive) override
|
|
|
|
{
|
|
|
|
BaseInstanceClass::set_sensitive(sensitive);
|
|
|
|
notifyDialogState();
|
|
|
|
}
|
2020-02-28 13:47:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class VCL_DLLPUBLIC JSLabel : public JSWidget<SalInstanceLabel, FixedText>
|
2020-02-18 15:41:56 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
JSLabel(VclPtr<vcl::Window> aOwnedToplevel, FixedText* pLabel, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership);
|
|
|
|
virtual void set_label(const OUString& rText) override;
|
|
|
|
};
|
|
|
|
|
2020-02-28 15:10:24 +01:00
|
|
|
class VCL_DLLPUBLIC JSButton : public JSWidget<SalInstanceButton, ::Button>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
JSButton(VclPtr<vcl::Window> aOwnedToplevel, ::Button* pButton, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership);
|
|
|
|
};
|
|
|
|
|
2020-02-28 13:47:22 +01:00
|
|
|
class VCL_DLLPUBLIC JSEntry : public JSWidget<SalInstanceEntry, ::Edit>
|
2020-02-24 18:35:18 +01:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
JSEntry(VclPtr<vcl::Window> aOwnedToplevel, ::Edit* pEntry, SalInstanceBuilder* pBuilder,
|
|
|
|
bool bTakeOwnership);
|
|
|
|
virtual void set_text(const OUString& rText) override;
|
|
|
|
};
|
|
|
|
|
2020-02-28 13:47:22 +01:00
|
|
|
class VCL_DLLPUBLIC JSListBox : public JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>
|
2020-02-25 13:03:34 +01:00
|
|
|
{
|
|
|
|
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;
|
2020-03-09 14:11:06 +01:00
|
|
|
virtual void set_active(int pos) override;
|
2020-02-25 13:03:34 +01:00
|
|
|
};
|
|
|
|
|
2020-02-28 13:47:22 +01:00
|
|
|
class VCL_DLLPUBLIC JSComboBox : public JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>
|
2020-02-25 13:03:34 +01:00
|
|
|
{
|
|
|
|
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;
|
2020-03-05 14:42:44 +01:00
|
|
|
virtual void set_active(int pos) override;
|
2020-02-25 13:03:34 +01:00
|
|
|
};
|
|
|
|
|
2020-03-04 16:05:10 +01:00
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2020-05-13 15:58:03 +01:00
|
|
|
#endif
|