From ed5640d8b587fbcfed7dd7967f3de04b37a76f26 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:06:44 +0200 Subject: Adding upstream version 4:7.4.7. Signed-off-by: Daniel Baumann --- vcl/inc/jsdialog/enabled.hxx | 22 + vcl/inc/jsdialog/jsdialogbuilder.hxx | 749 +++++++++++++++++++++++++++++++++++ 2 files changed, 771 insertions(+) create mode 100644 vcl/inc/jsdialog/enabled.hxx create mode 100644 vcl/inc/jsdialog/jsdialogbuilder.hxx (limited to 'vcl/inc/jsdialog') diff --git a/vcl/inc/jsdialog/enabled.hxx b/vcl/inc/jsdialog/enabled.hxx new file mode 100644 index 000000000..0f37301d0 --- /dev/null +++ b/vcl/inc/jsdialog/enabled.hxx @@ -0,0 +1,22 @@ +/* -*- 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 + +namespace jsdialog +{ +bool isBuilderEnabled(std::u16string_view rUIFile, bool bMobile); +bool isBuilderEnabledForPopup(std::u16string_view rUIFile); +bool isBuilderEnabledForSidebar(std::u16string_view rUIFile); +bool isInterimBuilderEnabledForNotebookbar(std::u16string_view rUIFile); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx new file mode 100644 index 000000000..5e7437b27 --- /dev/null +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -0,0 +1,749 @@ +/* -*- 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#define ACTION_TYPE "action_type" +#define PARENT_ID "parent_id" +#define WINDOW_ID "id" +#define CLOSE_ID "close_id" + +class ToolBox; +class ComboBox; +class VclMultiLineEdit; +class SvTabListBox; +class IconView; + +typedef std::map WidgetMap; + +namespace jsdialog +{ +enum MessageType +{ + FullUpdate, + WidgetUpdate, + Close, + Action, + Popup, + PopupClose +}; +} + +/// Class with the message description for storing in the queue +class JSDialogMessageInfo +{ +public: + jsdialog::MessageType m_eType; + VclPtr m_pWindow; + std::unique_ptr m_pData; + +private: + void copy(const JSDialogMessageInfo& rInfo) + { + this->m_eType = rInfo.m_eType; + this->m_pWindow = rInfo.m_pWindow; + if (rInfo.m_pData) + { + std::unique_ptr pData( + new jsdialog::ActionDataMap(*rInfo.m_pData)); + this->m_pData = std::move(pData); + } + } + +public: + JSDialogMessageInfo(jsdialog::MessageType eType, VclPtr pWindow, + std::unique_ptr pData) + : m_eType(eType) + , m_pWindow(pWindow) + , m_pData(std::move(pData)) + { + } + + JSDialogMessageInfo(const JSDialogMessageInfo& rInfo) { copy(rInfo); } + + JSDialogMessageInfo& operator=(JSDialogMessageInfo aInfo) + { + if (this == &aInfo) + return *this; + + copy(aInfo); + return *this; + } +}; + +class JSDialogNotifyIdle final : public Idle +{ + // used to send message + VclPtr m_aNotifierWindow; + // used to generate JSON + VclPtr m_aContentWindow; + std::string m_sTypeOfJSON; + std::string m_LastNotificationMessage; + bool m_bForce; + + std::deque m_aMessageQueue; + std::mutex m_aQueueMutex; + +public: + JSDialogNotifyIdle(VclPtr aNotifierWindow, VclPtr aContentWindow, + std::string sTypeOfJSON); + + void Invoke() override; + + void clearQueue(); + void forceUpdate(); + void sendMessage(jsdialog::MessageType eType, VclPtr pWindow, + std::unique_ptr pData = nullptr); + +private: + void send(tools::JsonWriter& aJsonWriter); + std::unique_ptr generateFullUpdate() const; + std::unique_ptr generateWidgetUpdate(VclPtr pWindow) const; + std::unique_ptr generateCloseMessage() const; + std::unique_ptr + generateActionMessage(VclPtr pWindow, + std::unique_ptr pData) const; + std::unique_ptr + generatePopupMessage(VclPtr pWindow, OUString sParentId, OUString sCloseId) const; + std::unique_ptr generateClosePopupMessage(OUString sWindowId) const; +}; + +class JSDialogSender +{ + std::unique_ptr mpIdleNotify; + +protected: + bool m_bCanClose; // specifies if can send a close message + +public: + JSDialogSender() + : m_bCanClose(true) + { + } + JSDialogSender(VclPtr aNotifierWindow, VclPtr aContentWindow, + std::string sTypeOfJSON) + : m_bCanClose(true) + { + initializeSender(aNotifierWindow, aContentWindow, sTypeOfJSON); + } + + virtual ~JSDialogSender() COVERITY_NOEXCEPT_FALSE; + + virtual void sendFullUpdate(bool bForce = false); + void sendClose(); + void sendUpdate(VclPtr pWindow, bool bForce = false); + virtual void sendAction(VclPtr pWindow, + std::unique_ptr pData); + virtual void sendPopup(VclPtr pWindow, OUString sParentId, OUString sCloseId); + virtual void sendClosePopup(vcl::LOKWindowId nWindowId); + void flush() { mpIdleNotify->Invoke(); } + +protected: + void initializeSender(VclPtr aNotifierWindow, VclPtr aContentWindow, + std::string sTypeOfJSON) + { + mpIdleNotify.reset(new JSDialogNotifyIdle(aNotifierWindow, aContentWindow, sTypeOfJSON)); + } +}; + +class JSDropTarget final + : public comphelper::WeakComponentImplHelper< + css::datatransfer::dnd::XDropTarget, css::lang::XInitialization, css::lang::XServiceInfo> +{ + std::vector> m_aListeners; + +public: + JSDropTarget(); + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence& rArgs) override; + + // XDropTarget + virtual void SAL_CALL addDropTargetListener( + const css::uno::Reference&) override; + virtual void SAL_CALL removeDropTargetListener( + const css::uno::Reference&) override; + virtual sal_Bool SAL_CALL isActive() override; + virtual void SAL_CALL setActive(sal_Bool active) override; + virtual sal_Int8 SAL_CALL getDefaultActions() override; + virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override; + + OUString SAL_CALL getImplementationName() override; + + sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override; + + css::uno::Sequence SAL_CALL getSupportedServiceNames() override; + + void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde); + + void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde); +}; + +class JSInstanceBuilder final : public SalInstanceBuilder, public JSDialogSender +{ + sal_uInt64 m_nWindowId; + /// used in case of tab pages where dialog is not a direct top level + VclPtr m_aParentDialog; + VclPtr m_aContentWindow; + std::list m_aRememberedWidgets; + std::string m_sTypeOfJSON; + bool m_bHasTopLevelDialog; + bool m_bIsNotebookbar; + /// When LOKNotifier is set by jsdialogs code we need to release it + VclPtr m_aWindowToRelease; + + friend VCL_DLLPUBLIC bool jsdialog::ExecuteAction(const std::string& nWindowId, + const OString& rWidget, StringMap& rData); + friend VCL_DLLPUBLIC void jsdialog::SendFullUpdate(const std::string& nWindowId, + const OString& rWidget); + friend VCL_DLLPUBLIC void jsdialog::SendAction(const std::string& nWindowId, + const OString& rWidget, + std::unique_ptr pData); + + static std::map& GetLOKWeldWidgetsMap(); + static void InsertWindowToMap(const std::string& nWindowId); + void RememberWidget(OString id, weld::Widget* pWidget); + static void RememberWidget(const std::string& nWindowId, const OString& id, + weld::Widget* pWidget); + static weld::Widget* FindWeldWidgetsMap(const std::string& nWindowId, const OString& rWidget); + + std::string getMapIdFromWindowId() const; + +public: + /// used for dialogs or popups + JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile, + bool bPopup = false); + /// used for sidebar panels + JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile, + sal_uInt64 nLOKWindowId); + /// used for notebookbar, optional nWindowId is used if getting parent id failed + JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + const css::uno::Reference& rFrame, + sal_uInt64 nWindowId = 0); + /// used for formulabar + JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + sal_uInt64 nLOKWindowId); + + static std::unique_ptr + CreateDialogBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); + static std::unique_ptr + CreateNotebookbarBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile, + const css::uno::Reference& rFrame, + sal_uInt64 nWindowId = 0); + static std::unique_ptr CreateSidebarBuilder(weld::Widget* pParent, + const OUString& rUIRoot, + const OUString& rUIFile, + sal_uInt64 nLOKWindowId = 0); + static std::unique_ptr + CreatePopupBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); + static std::unique_ptr CreateFormulabarBuilder(vcl::Window* pParent, + const OUString& rUIRoot, + const OUString& rUIFile, + sal_uInt64 nLOKWindowId); + + virtual ~JSInstanceBuilder() override; + virtual std::unique_ptr weld_message_dialog(const OString& id) override; + virtual std::unique_ptr weld_dialog(const OString& id) override; + virtual std::unique_ptr weld_container(const OString& id) override; + virtual std::unique_ptr weld_label(const OString& id) override; + virtual std::unique_ptr weld_button(const OString& id) override; + virtual std::unique_ptr weld_entry(const OString& id) override; + virtual std::unique_ptr weld_combo_box(const OString& id) override; + virtual std::unique_ptr weld_notebook(const OString& id) override; + virtual std::unique_ptr weld_spin_button(const OString& id) override; + virtual std::unique_ptr weld_check_button(const OString& id) override; + virtual std::unique_ptr + weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr, + FactoryFunction pUITestFactoryFunction = nullptr, + void* pUserData = nullptr) override; + virtual std::unique_ptr weld_toolbar(const OString& id) override; + virtual std::unique_ptr weld_text_view(const OString& id) override; + virtual std::unique_ptr weld_tree_view(const OString& id) override; + virtual std::unique_ptr weld_expander(const OString& id) override; + virtual std::unique_ptr weld_icon_view(const OString& id) override; + virtual std::unique_ptr weld_radio_button(const OString& id) override; + virtual std::unique_ptr weld_frame(const OString& id) override; + virtual std::unique_ptr weld_menu_button(const OString& id) override; + virtual std::unique_ptr weld_popover(const OString& id) override; + virtual std::unique_ptr weld_box(const OString& id) override; + virtual std::unique_ptr weld_widget(const OString& id) override; + virtual std::unique_ptr weld_image(const OString& id) override; + + static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent, + VclMessageType eMessageType, + VclButtonsType eButtonType, + const OUString& rPrimaryMessage); + + static void AddChildWidget(const std::string& nWindowId, const OString& id, + weld::Widget* pWidget); + static void RemoveWindowWidget(const std::string& nWindowId); + + // we need to remember original popup window to close it properly (its handled by vcl) + static void RememberPopup(const std::string& nWindowId, VclPtr pWidget); + static void ForgetPopup(const std::string& nWindowId); + static vcl::Window* FindPopup(const std::string& nWindowId); + +private: + const std::string& GetTypeOfJSON() const; + VclPtr& GetContentWindow(); + VclPtr& GetNotifierWindow(); +}; + +class BaseJSWidget +{ +public: + virtual ~BaseJSWidget() = default; + + virtual void sendClose() = 0; + + virtual void sendUpdate(bool bForce = false) = 0; + + virtual void sendFullUpdate(bool bForce = false) = 0; + + virtual void sendAction(std::unique_ptr pData) = 0; + + virtual void sendPopup(vcl::Window* pPopup, OUString sParentId, OUString sCloseId) = 0; + + virtual void sendClosePopup(vcl::LOKWindowId nWindowId) = 0; +}; + +template +class JSWidget : public BaseInstanceClass, public BaseJSWidget +{ +protected: + rtl::Reference m_xDropTarget; + bool m_bIsFreezed; + + JSDialogSender* m_pSender; + +public: + JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder, + bool bTakeOwnership) + : BaseInstanceClass(pObject, pBuilder, bTakeOwnership) + , m_bIsFreezed(false) + , m_pSender(pSender) + { + } + + JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder, + const a11yref& rAlly, FactoryFunction pUITestFactoryFunction, void* pUserData, + bool bTakeOwnership) + : BaseInstanceClass(pObject, pBuilder, rAlly, pUITestFactoryFunction, pUserData, + bTakeOwnership) + , m_bIsFreezed(false) + , m_pSender(pSender) + { + } + + virtual void show() override + { + bool bWasVisible = BaseInstanceClass::get_visible(); + BaseInstanceClass::show(); + if (!bWasVisible) + { + std::unique_ptr pMap + = std::make_unique(); + (*pMap)[ACTION_TYPE] = "show"; + sendAction(std::move(pMap)); + } + } + + virtual void hide() override + { + bool bWasVisible = BaseInstanceClass::get_visible(); + BaseInstanceClass::hide(); + if (bWasVisible) + { + std::unique_ptr pMap + = std::make_unique(); + (*pMap)[ACTION_TYPE] = "hide"; + sendAction(std::move(pMap)); + } + } + + using BaseInstanceClass::set_sensitive; + virtual void set_sensitive(bool sensitive) override + { + bool bIsSensitive = BaseInstanceClass::get_sensitive(); + BaseInstanceClass::set_sensitive(sensitive); + if (bIsSensitive != sensitive) + sendUpdate(); + } + + virtual css::uno::Reference get_drop_target() override + { + if (!m_xDropTarget) + m_xDropTarget.set(new JSDropTarget); + + return m_xDropTarget; + } + + virtual void freeze() override + { + BaseInstanceClass::freeze(); + m_bIsFreezed = true; + } + + virtual void thaw() override + { + BaseInstanceClass::thaw(); + m_bIsFreezed = false; + sendUpdate(); + } + + virtual void sendClose() override + { + if (m_pSender) + m_pSender->sendClose(); + } + + virtual void sendUpdate(bool bForce = false) override + { + if (!m_bIsFreezed && m_pSender) + m_pSender->sendUpdate(BaseInstanceClass::m_xWidget, bForce); + } + + virtual void sendFullUpdate(bool bForce = false) override + { + if ((!m_bIsFreezed || bForce) && m_pSender) + m_pSender->sendFullUpdate(bForce); + } + + virtual void sendAction(std::unique_ptr pData) override + { + if (!m_bIsFreezed && m_pSender && pData) + m_pSender->sendAction(BaseInstanceClass::m_xWidget, std::move(pData)); + } + + virtual void sendPopup(vcl::Window* pPopup, OUString sParentId, OUString sCloseId) override + { + if (!m_bIsFreezed && m_pSender) + m_pSender->sendPopup(pPopup, sParentId, sCloseId); + } + + virtual void sendClosePopup(vcl::LOKWindowId nWindowId) override + { + if (!m_bIsFreezed && m_pSender) + m_pSender->sendClosePopup(nWindowId); + } +}; + +class JSDialog final : public JSWidget +{ +public: + JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) override; + virtual void undo_collapse() override; + virtual void response(int response) override; +}; + +class JSContainer final : public JSWidget +{ +public: + JSContainer(JSDialogSender* pSender, vcl::Window* pContainer, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +class JSLabel final : public JSWidget +{ +public: + JSLabel(JSDialogSender* pSender, Control* pLabel, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void set_label(const OUString& rText) override; +}; + +class JSButton final : public JSWidget +{ +public: + JSButton(JSDialogSender* pSender, ::Button* pButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +class JSEntry final : public JSWidget +{ +public: + JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void set_text(const OUString& rText) override; + void set_text_without_notify(const OUString& rText); +}; + +class JSListBox final : public JSWidget +{ +public: + JSListBox(JSDialogSender* pSender, ::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 JSComboBox final : public JSWidget +{ +public: + JSComboBox(JSDialogSender* pSender, ::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_without_notify(const OUString& rText); + virtual void set_entry_text(const OUString& rText) override; + virtual void set_active(int pos) override; + virtual bool changed_by_direct_pick() const override; +}; + +class JSNotebook final : public JSWidget +{ +public: + JSNotebook(JSDialogSender* pSender, ::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 JSSpinButton final : public JSWidget +{ +public: + JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_value(sal_Int64 value) override; +}; + +class JSMessageDialog final : public JSWidget +{ + std::unique_ptr m_pOwnedSender; + std::unique_ptr m_pOK; + std::unique_ptr m_pCancel; + + // used for message dialogs created using static functions + std::string m_sWindowId; + + DECL_LINK(OKHdl, weld::Button&, void); + DECL_LINK(CancelHdl, weld::Button&, void); + +public: + JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + virtual ~JSMessageDialog(); + + virtual void set_primary_text(const OUString& rText) override; + + virtual void set_secondary_text(const OUString& rText) override; + + virtual void response(int response) override; +}; + +class JSCheckButton final : public JSWidget +{ +public: + JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_active(bool active) override; +}; + +class JSDrawingArea final : public JSWidget +{ +public: + JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea, + SalInstanceBuilder* pBuilder, const a11yref& rAlly, + FactoryFunction pUITestFactoryFunction, void* pUserData); + + virtual void queue_draw() override; + virtual void queue_draw_area(int x, int y, int width, int height) override; +}; + +class JSToolbar final : public JSWidget +{ + std::map m_pPopovers; + +public: + JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_menu_item_active(const OString& rIdent, bool bActive) override; + virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override; + virtual void set_item_icon_name(const OString& rIdent, const OUString& rIconName) override; +}; + +class JSTextView final : public JSWidget +{ +public: + JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + virtual void set_text(const OUString& rText) override; +}; + +class JSTreeView final : public JSWidget +{ +public: + JSTreeView(JSDialogSender* pSender, ::SvTabListBox* pTextView, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + using SalInstanceTreeView::set_toggle; + /// pos is used differently here, it defines how many steps of iterator we need to perform to take entry + virtual void set_toggle(int pos, TriState eState, int col = -1) override; + virtual void set_toggle(const weld::TreeIter& rIter, TriState bOn, int col = -1) override; + + using SalInstanceTreeView::select; + /// pos is used differently here, it defines how many steps of iterator we need to perform to take entry + virtual void select(int pos) override; + + virtual weld::TreeView* get_drag_source() const override; + + using SalInstanceTreeView::insert; + virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr, + const OUString* pId, const OUString* pIconName, + VirtualDevice* pImageSurface, bool bChildrenOnDemand, + weld::TreeIter* pRet) override; + + virtual void set_text(int row, const OUString& rText, int col = -1) override; + virtual void set_text(const weld::TreeIter& rIter, const OUString& rStr, int col = -1) override; + + virtual void expand_row(const weld::TreeIter& rIter) override; + virtual void collapse_row(const weld::TreeIter& rIter) override; + + using SalInstanceTreeView::remove; + virtual void remove(int pos) override; + virtual void remove(const weld::TreeIter& rIter) override; + + virtual void clear() override; + + void drag_start(); + void drag_end(); +}; + +class JSExpander final : public JSWidget +{ +public: + JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_expanded(bool bExpand) override; +}; + +class JSIconView final : public JSWidget +{ +public: + JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void insert(int pos, const OUString* pStr, const OUString* pId, + const OUString* pIconName, weld::TreeIter* pRet) override; + + virtual void insert(int pos, const OUString* pStr, const OUString* pId, + const VirtualDevice* pIcon, weld::TreeIter* pRet) override; + + virtual void insert_separator(int pos, const OUString* pId) override; + + virtual void clear() override; + virtual void select(int pos) override; + virtual void unselect(int pos) override; +}; + +class JSRadioButton final : public JSWidget +{ +public: + JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButton, + SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + virtual void set_active(bool active) override; +}; + +class JSFrame : public JSWidget +{ +public: + JSFrame(JSDialogSender* pSender, ::VclFrame* pFrame, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +class JSMenuButton : public JSWidget +{ +public: + JSMenuButton(JSDialogSender* pSender, ::MenuButton* pMenuButton, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void set_label(const OUString& rText) override; + virtual void set_image(VirtualDevice* pDevice) override; + virtual void set_image(const css::uno::Reference& rImage) override; + virtual void set_active(bool active) override; +}; + +class JSPopover : public JSWidget +{ + vcl::LOKWindowId mnWindowId; + +public: + JSPopover(JSDialogSender* pSender, DockingWindow* pPopover, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); + + virtual void popup_at_rect(weld::Widget* pParent, const tools::Rectangle& rRect, + weld::Placement ePlace = weld::Placement::Under) override; + virtual void popdown() override; + + void set_window_id(vcl::LOKWindowId nWindowId) { mnWindowId = nWindowId; } +}; + +class JSBox : public JSWidget +{ +public: + JSBox(JSDialogSender* pSender, VclBox* pBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership); + + void reorder_child(weld::Widget* pWidget, int nNewPosition) override; +}; + +class JSWidgetInstance : public JSWidget +{ +public: + JSWidgetInstance(JSDialogSender* pSender, vcl::Window* pObject, SalInstanceBuilder* pBuilder, + bool bTakeOwnership) + : JSWidget(pSender, pObject, pBuilder, bTakeOwnership) + { + } +}; + +class JSImage : public JSWidget +{ +public: + JSImage(JSDialogSender* pSender, FixedImage* pImage, SalInstanceBuilder* pBuilder, + bool bTakeOwnership); +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ -- cgit v1.2.3