22 #include <com/sun/star/lang/XInitialization.hpp>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
24 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
35 typedef std::map<OString, weld::Widget*>
WidgetMap;
57 std::deque<std::pair<jsdialog::MessageType, VclPtr<vcl::Window>>>
m_aMessageQueue;
61 std::string sTypeOfJSON);
82 std::string sTypeOfJSON)
92 void flush() { mpIdleNotify->Invoke(); }
96 std::string sTypeOfJSON)
98 mpIdleNotify.reset(
new JSDialogNotifyIdle(aNotifierWindow, aContentWindow, sTypeOfJSON));
103 :
public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDropTarget,
104 css::lang::XInitialization, css::lang::XServiceInfo>
107 std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>>
m_aListeners;
113 virtual void SAL_CALL
initialize(
const css::uno::Sequence<css::uno::Any>& rArgs)
override;
117 const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&)
override;
119 const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&)
override;
131 void fire_drop(
const css::datatransfer::dnd::DropTargetDropEvent& dtde);
133 void fire_dragEnter(
const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde);
159 const css::uno::Reference<css::frame::XFrame>& rFrame,
160 sal_uInt64 nWindowId = 0);
166 const OUString& rUIFile);
169 const css::uno::Reference<css::frame::XFrame>& rFrame,
170 sal_uInt64 nWindowId = 0);
172 const OUString& rUIRoot,
173 const OUString& rUIFile);
176 virtual std::unique_ptr<weld::MessageDialog>
weld_message_dialog(
const OString&
id)
override;
177 virtual std::unique_ptr<weld::Dialog>
weld_dialog(
const OString&
id)
override;
178 virtual std::unique_ptr<weld::Label>
weld_label(
const OString&
id)
override;
179 virtual std::unique_ptr<weld::Button>
weld_button(
const OString&
id)
override;
180 virtual std::unique_ptr<weld::Entry>
weld_entry(
const OString&
id)
override;
181 virtual std::unique_ptr<weld::ComboBox>
weld_combo_box(
const OString&
id)
override;
182 virtual std::unique_ptr<weld::Notebook>
weld_notebook(
const OString&
id)
override;
183 virtual std::unique_ptr<weld::SpinButton>
weld_spin_button(
const OString&
id)
override;
184 virtual std::unique_ptr<weld::CheckButton>
weld_check_button(
const OString&
id)
override;
185 virtual std::unique_ptr<weld::DrawingArea>
188 void* pUserData =
nullptr)
override;
189 virtual std::unique_ptr<weld::Toolbar>
weld_toolbar(
const OString&
id)
override;
190 virtual std::unique_ptr<weld::TextView>
weld_text_view(
const OString&
id)
override;
191 virtual std::unique_ptr<weld::TreeView>
weld_tree_view(
const OString&
id)
override;
192 virtual std::unique_ptr<weld::Expander>
weld_expander(
const OString&
id)
override;
193 virtual std::unique_ptr<weld::IconView>
weld_icon_view(
const OString&
id)
override;
194 virtual std::unique_ptr<weld::RadioButton>
weld_radio_button(
const OString&
id)
override;
199 const OUString& rPrimaryMessage);
207 template <
class BaseInstanceClass,
class VclClass>
class JSWidget :
public BaseInstanceClass
218 : BaseInstanceClass(pObject, pBuilder, bTakeOwnership)
219 , m_bIsFreezed(false)
227 : BaseInstanceClass(pObject, pBuilder, rAlly, pUITestFactoryFunction, pUserData,
229 , m_bIsFreezed(false)
236 BaseInstanceClass::show();
242 BaseInstanceClass::hide();
246 using BaseInstanceClass::set_sensitive;
249 bool bIsSensitive = BaseInstanceClass::get_sensitive();
250 BaseInstanceClass::set_sensitive(sensitive);
251 if (bIsSensitive != sensitive)
255 virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget>
get_drop_target()
override
260 return m_xDropTarget.get();
265 BaseInstanceClass::freeze();
271 BaseInstanceClass::thaw();
272 m_bIsFreezed =
false;
283 if (!m_bIsFreezed && m_pSender)
284 m_pSender->
sendUpdate(BaseInstanceClass::m_xWidget);
289 if ((!m_bIsFreezed || bForce) && m_pSender)
298 bool bTakeOwnership);
309 bool bTakeOwnership);
310 virtual void set_label(
const OUString& rText)
override;
317 bool bTakeOwnership);
324 bool bTakeOwnership);
325 virtual void set_text(
const OUString& rText)
override;
333 bool bTakeOwnership);
334 virtual void insert(
int pos,
const OUString& rStr,
const OUString* pId,
335 const OUString* pIconName,
VirtualDevice* pImageSurface)
override;
336 virtual void remove(
int pos)
override;
344 bool bTakeOwnership);
345 virtual void insert(
int pos,
const OUString& rStr,
const OUString* pId,
346 const OUString* pIconName,
VirtualDevice* pImageSurface)
override;
347 virtual void remove(
int pos)
override;
356 bool bTakeOwnership);
362 virtual void remove_page(
const OString& rIdent)
override;
364 virtual void insert_page(
const OString& rIdent,
const OUString& rLabel,
int nPos)
override;
371 bool bTakeOwnership);
382 bool bTakeOwnership);
394 bool bTakeOwnership);
396 virtual void set_active(
bool active)
override;
414 bool bTakeOwnership);
421 bool bTakeOwnership);
422 virtual void set_text(
const OUString& rText)
override;
429 bool bTakeOwnership);
437 virtual void select(
int pos)
override;
443 const OUString* pId,
const OUString* pIconName,
447 virtual void set_text(
int row,
const OUString& rText,
int col = -1)
override;
461 bool bTakeOwnership);
470 bool bTakeOwnership);
472 virtual void insert(
int pos,
const OUString* pStr,
const OUString* pId,
475 virtual void insert(
int pos,
const OUString* pStr,
const OUString* pId,
477 virtual void clear()
override;
478 virtual void select(
int pos)
override;
479 virtual void unselect(
int pos)
override;
488 virtual void set_active(
bool active)
override;
JSIconView(JSDialogSender *pSender,::IconView *pIconView, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
std::string m_LastNotificationMessage
VclPtr< vcl::Window > m_aNotifierWindow
virtual void sendFullUpdate(bool bForce=false)
static JSInstanceBuilder * CreateAutofilterWindowBuilder(vcl::Window *pParent, const OUString &rUIRoot, const OUString &rUIFile)
A widget used to choose from a list of items and which has no entry.
virtual std::unique_ptr< weld::Button > weld_button(const OString &id) override
virtual void set_toggle(int pos, TriState eState, int col=-1) override
pos is used differently here, it defines how many steps of iterator we need to perform to take entry ...
JSLabel(JSDialogSender *pSender, FixedText *pLabel, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual sal_Bool SAL_CALL isActive() override
css::uno::Reference< css::accessibility::XAccessible > a11yref
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual void set_active(int pos) override
virtual void sendUpdate(VclPtr< vcl::Window > pWindow)
JSNotebook(JSDialogSender *pSender,::TabControl *pControl, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
void initializeSender(VclPtr< vcl::Window > aNotifierWindow, VclPtr< vcl::Window > aContentWindow, std::string sTypeOfJSON)
std::unique_ptr< tools::JsonWriter > generateCloseMessage() const
std::unique_ptr< tools::JsonWriter > generateWidgetUpdate(VclPtr< vcl::Window > pWindow) const
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage)
virtual void set_secondary_text(const OUString &rText) override
virtual void set_current_page(int nPage) override
virtual sal_Int8 SAL_CALL getDefaultActions() override
void send(tools::JsonWriter &aJsonWriter)
VclPtr< vcl::Window > m_aContentWindow
virtual std::unique_ptr< weld::RadioButton > weld_radio_button(const OString &id) override
virtual std::unique_ptr< weld::Entry > weld_entry(const OString &id) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArgs) override
static void InsertWindowToMap(sal_uInt64 nWindowId)
virtual std::unique_ptr< weld::Dialog > weld_dialog(const OString &id) override
static std::map< sal_uInt64, WidgetMap > & GetLOKWeldWidgetsMap()
JSTextView(JSDialogSender *pSender,::VclMultiLineEdit *pTextView, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent &dtde)
VCL_DLLPUBLIC bool ExecuteAction(sal_uInt64 nWindowId, const OString &rWidget, StringMap &rData)
virtual std::unique_ptr< weld::TextView > weld_text_view(const OString &id) override
void set_toggle(SvTreeListEntry *pEntry, TriState eState, int col)
OUString SAL_CALL getImplementationName() override
JSDialog(JSDialogSender *pSender,::Dialog *pDialog, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
JSExpander(JSDialogSender *pSender,::VclExpander *pExpander, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual std::unique_ptr< weld::DrawingArea > weld_drawing_area(const OString &id, const a11yref &rA11yImpl=nullptr, FactoryFunction pUITestFactoryFunction=nullptr, void *pUserData=nullptr) override
virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override
virtual std::unique_ptr< weld::CheckButton > weld_check_button(const OString &id) override
std::deque< std::pair< jsdialog::MessageType, VclPtr< vcl::Window > > > m_aMessageQueue
sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
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 select(int pos) override
virtual void collapse(weld::Widget *pEdit, weld::Widget *pButton) override
VclPtr< vcl::Window > & GetContentWindow()
virtual void set_expanded(bool bExpand) override
virtual ~JSDialogSender()=default
virtual void set_label(const OUString &rText) override
JSInstanceBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile)
used for dialogs
virtual std::unique_ptr< weld::Expander > weld_expander(const OString &id) override
static weld::Widget * FindWeldWidgetsMap(sal_uInt64 nWindowId, const OString &rWidget)
JSTreeView(JSDialogSender *pSender,::SvTabListBox *pTextView, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual void remove_page(const OString &rIdent) override
void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent &dtde)
JSDialogNotifyIdle(VclPtr< vcl::Window > aNotifierWindow, VclPtr< vcl::Window > aContentWindow, std::string sTypeOfJSON)
virtual std::unique_ptr< weld::IconView > weld_icon_view(const OString &id) override
JSDrawingArea(JSDialogSender *pSender, VclDrawingArea *pDrawingArea, SalInstanceBuilder *pBuilder, const a11yref &rAlly, FactoryFunction pUITestFactoryFunction, void *pUserData)
std::string m_sTypeOfJSON
virtual void insert_page(const OString &rIdent, const OUString &rLabel, int nPos) override
VclPtr< vcl::Window > m_aParentDialog
used in case of tab pages where dialog is not a direct top level
virtual void queue_draw() override
VclPtr< vcl::Window > m_aContentWindow
virtual void clear() override
virtual void undo_collapse() override
virtual std::unique_ptr< weld::Notebook > weld_notebook(const OString &id) override
virtual void select(int pos) override
pos is used differently here, it defines how many steps of iterator we need to perform to take entry ...
VclPtr< vcl::Window > & GetNotifierWindow()
std::unique_ptr< JSDialogNotifyIdle > mpIdleNotify
std::list< std::string > m_aRememberedWidgets
void sendMessage(jsdialog::MessageType eType, VclPtr< vcl::Window > pWindow)
virtual std::unique_ptr< weld::ComboBox > weld_combo_box(const OString &id) override
virtual void set_text(int row, const OUString &rText, int col=-1) override
bool m_bHasTopLevelDialog
virtual void set_entry_text(const OUString &rText) override
JSComboBox(JSDialogSender *pSender,::ComboBox *pComboBox, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual void response(int response) override
virtual void SAL_CALL setActive(sal_Bool active) override
void set_text_without_notify(const OUString &rText)
virtual void set_active(int pos) override
virtual ~JSInstanceBuilder() override
virtual void SAL_CALL removeDropTargetListener(const css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > &) override
JSMessageDialog(JSDialogSender *pSender,::MessageDialog *pDialog, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
std::map< OString, weld::Widget * > WidgetMap
virtual std::unique_ptr< weld::TreeView > weld_tree_view(const OString &id) override
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
JSEntry(JSDialogSender *pSender,::Edit *pEntry, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual void queue_draw_area(int x, int y, int width, int height) override
virtual std::unique_ptr< weld::Toolbar > weld_toolbar(const OString &id) override
std::string m_sTypeOfJSON
std::vector< css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > > m_aListeners
std::map< OUString, OUString > StringMap
void RememberWidget(const OString &id, weld::Widget *pWidget)
std::unique_ptr< JSDialogSender > m_pOwnedSender
JSDialogSender(VclPtr< vcl::Window > aNotifierWindow, VclPtr< vcl::Window > aContentWindow, std::string sTypeOfJSON)
virtual std::unique_ptr< weld::MessageDialog > weld_message_dialog(const OString &id) override
virtual void set_text(const OUString &rText) override
virtual void collapse_row(const weld::TreeIter &rIter) override
virtual void SAL_CALL addDropTargetListener(const css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > &) override
virtual void set_text(const OUString &rText) override
virtual void select(int pos) override
virtual void unselect(int pos) override
const std::string & GetTypeOfJSON()
static JSInstanceBuilder * CreateDialogBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile)
A widget used to choose from a list of items and which has an entry.
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 insert(int pos, const OUString &rStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface) override
virtual void insert(int pos, const OUString &rStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface) override
virtual std::unique_ptr< weld::SpinButton > weld_spin_button(const OString &id) override
virtual weld::TreeView * get_drag_source() const override
virtual void expand_row(const weld::TreeIter &rIter) override
void Invoke() override
Calls the maInvokeHandler with the parameter this.
static JSInstanceBuilder * CreateNotebookbarBuilder(vcl::Window *pParent, const OUString &rUIRoot, const OUString &rUIFile, const css::uno::Reference< css::frame::XFrame > &rFrame, sal_uInt64 nWindowId=0)
virtual std::unique_ptr< weld::Label > weld_label(const OString &id) override
virtual void insert(int pos, const OUString *pStr, const OUString *pId, const OUString *pIconName, weld::TreeIter *pRet) override
JSListBox(JSDialogSender *pSender,::ListBox *pListBox, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
std::unique_ptr< tools::JsonWriter > generateFullUpdate() const
An idle is a timer to be scheduled immediately.
virtual void set_primary_text(const OUString &rText) override