LibreOffice Module vcl (master)  1
jsdialogbuilder.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  */
9 
10 #pragma once
11 
12 #include <vcl/weld.hxx>
14 #include <comphelper/string.hxx>
15 #include <vcl/sysdata.hxx>
16 #include <vcl/virdev.hxx>
17 #include <vcl/builder.hxx>
18 #include <salvtables.hxx>
19 #include <vcl/toolkit/button.hxx>
20 #include <vcl/toolkit/fmtfield.hxx>
21 
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>
25 #include <cppuhelper/compbase.hxx>
26 
27 #include <deque>
28 #include <list>
29 #include <unordered_map>
30 
31 class ToolBox;
32 class ComboBox;
33 class VclMultiLineEdit;
34 class SvTabListBox;
35 class IconView;
36 
37 typedef std::map<OString, weld::Widget*> WidgetMap;
38 typedef std::unordered_map<std::string, OUString> ActionDataMap;
39 
40 namespace jsdialog
41 {
43 {
48 };
49 }
50 
53 {
54 public:
57  std::unique_ptr<ActionDataMap> m_pData;
58 
59 private:
60  void copy(const JSDialogMessageInfo& rInfo)
61  {
62  this->m_eType = rInfo.m_eType;
63  this->m_pWindow = rInfo.m_pWindow;
64  if (rInfo.m_pData)
65  {
66  std::unique_ptr<ActionDataMap> pData(new ActionDataMap(*rInfo.m_pData));
67  this->m_pData = std::move(pData);
68  }
69  }
70 
71 public:
73  std::unique_ptr<ActionDataMap> pData)
74  : m_eType(eType)
75  , m_pWindow(pWindow)
76  , m_pData(std::move(pData))
77  {
78  }
79 
80  JSDialogMessageInfo(const JSDialogMessageInfo& rInfo) { copy(rInfo); }
81 
83  {
84  if (this == &aInfo)
85  return *this;
86 
87  copy(aInfo);
88  return *this;
89  }
90 };
91 
92 class JSDialogNotifyIdle : public Idle
93 {
94  // used to send message
96  // used to generate JSON
98  std::string m_sTypeOfJSON;
100  bool m_bForce;
101 
102  std::deque<JSDialogMessageInfo> m_aMessageQueue;
103 
104 public:
105  JSDialogNotifyIdle(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
106  std::string sTypeOfJSON);
107 
108  void Invoke() override;
109 
110  void clearQueue();
111  void forceUpdate();
113  std::unique_ptr<ActionDataMap> pData = nullptr);
114 
115 private:
116  void send(tools::JsonWriter& aJsonWriter);
117  std::unique_ptr<tools::JsonWriter> generateFullUpdate() const;
118  std::unique_ptr<tools::JsonWriter> generateWidgetUpdate(VclPtr<vcl::Window> pWindow) const;
119  std::unique_ptr<tools::JsonWriter> generateCloseMessage() const;
120  std::unique_ptr<tools::JsonWriter>
121  generateActionMessage(VclPtr<vcl::Window> pWindow, std::unique_ptr<ActionDataMap> pData) const;
122 };
123 
125 {
126  std::unique_ptr<JSDialogNotifyIdle> mpIdleNotify;
127 
128 public:
129  JSDialogSender() = default;
130  JSDialogSender(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
131  std::string sTypeOfJSON)
132  {
133  initializeSender(aNotifierWindow, aContentWindow, sTypeOfJSON);
134  }
135 
136  virtual ~JSDialogSender();
137 
138  virtual void sendFullUpdate(bool bForce = false);
139  void sendClose();
140  void sendUpdate(VclPtr<vcl::Window> pWindow, bool bForce = false);
141  virtual void sendAction(VclPtr<vcl::Window> pWindow, std::unique_ptr<ActionDataMap> pData);
142  void flush() { mpIdleNotify->Invoke(); }
143 
144 protected:
145  void initializeSender(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
146  std::string sTypeOfJSON)
147  {
148  mpIdleNotify.reset(new JSDialogNotifyIdle(aNotifierWindow, aContentWindow, sTypeOfJSON));
149  }
150 };
151 
152 class JSDropTarget final
153  : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDropTarget,
154  css::lang::XInitialization, css::lang::XServiceInfo>
155 {
156  osl::Mutex m_aMutex;
157  std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> m_aListeners;
158 
159 public:
160  JSDropTarget();
161 
162  // XInitialization
163  virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArgs) override;
164 
165  // XDropTarget
166  virtual void SAL_CALL addDropTargetListener(
167  const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override;
168  virtual void SAL_CALL removeDropTargetListener(
169  const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override;
170  virtual sal_Bool SAL_CALL isActive() override;
171  virtual void SAL_CALL setActive(sal_Bool active) override;
172  virtual sal_Int8 SAL_CALL getDefaultActions() override;
173  virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override;
174 
175  OUString SAL_CALL getImplementationName() override;
176 
177  sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override;
178 
179  css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
180 
181  void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde);
182 
183  void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde);
184 };
185 
187 {
188  sal_uInt64 m_nWindowId;
192  std::list<std::string> m_aRememberedWidgets;
193  std::string m_sTypeOfJSON;
196 
197  friend VCL_DLLPUBLIC bool jsdialog::ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget,
198  StringMap& rData);
199  friend VCL_DLLPUBLIC void jsdialog::SendFullUpdate(sal_uInt64 nWindowId,
200  const OString& rWidget);
201 
202  static std::map<sal_uInt64, WidgetMap>& GetLOKWeldWidgetsMap();
203  static void InsertWindowToMap(sal_uInt64 nWindowId);
204  void RememberWidget(const OString& id, weld::Widget* pWidget);
205  static weld::Widget* FindWeldWidgetsMap(sal_uInt64 nWindowId, const OString& rWidget);
206 
208  JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile);
210  JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
211  const css::uno::Reference<css::frame::XFrame>& rFrame,
212  sal_uInt64 nWindowId = 0);
214  JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile);
215 
216 public:
217  static JSInstanceBuilder* CreateDialogBuilder(weld::Widget* pParent, const OUString& rUIRoot,
218  const OUString& rUIFile);
219  static JSInstanceBuilder*
220  CreateNotebookbarBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
221  const css::uno::Reference<css::frame::XFrame>& rFrame,
222  sal_uInt64 nWindowId = 0);
224  const OUString& rUIRoot,
225  const OUString& rUIFile);
226 
227  virtual ~JSInstanceBuilder() override;
228  virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OString& id) override;
229  virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id) override;
230  virtual std::unique_ptr<weld::Label> weld_label(const OString& id) override;
231  virtual std::unique_ptr<weld::Button> weld_button(const OString& id) override;
232  virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id) override;
233  virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id) override;
234  virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id) override;
235  virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString& id) override;
236  virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OString& id) override;
237  virtual std::unique_ptr<weld::DrawingArea>
238  weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
239  FactoryFunction pUITestFactoryFunction = nullptr,
240  void* pUserData = nullptr) override;
241  virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString& id) override;
242  virtual std::unique_ptr<weld::TextView> weld_text_view(const OString& id) override;
243  virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString& id) override;
244  virtual std::unique_ptr<weld::Expander> weld_expander(const OString& id) override;
245  virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString& id) override;
246  virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OString& id) override;
247 
249  VclMessageType eMessageType,
250  VclButtonsType eButtonType,
251  const OUString& rPrimaryMessage);
252 
253  static void AddChildWidget(sal_uInt64 nWindowId, const OString& id, weld::Widget* pWidget);
254  static void RemoveWindowWidget(sal_uInt64 nWindowId);
255 
256 private:
257  const std::string& GetTypeOfJSON();
260 };
261 
263 {
264 public:
265  virtual ~BaseJSWidget() = default;
266 
267  virtual void sendClose() = 0;
268 
269  virtual void sendUpdate(bool bForce = false) = 0;
270 
271  virtual void sendFullUpdate(bool bForce = false) = 0;
272 
273  virtual void sendAction(std::unique_ptr<ActionDataMap> pData) = 0;
274 };
275 
276 template <class BaseInstanceClass, class VclClass>
277 class JSWidget : public BaseInstanceClass, public BaseJSWidget
278 {
279 protected:
282 
284 
285 public:
286  JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder,
287  bool bTakeOwnership)
288  : BaseInstanceClass(pObject, pBuilder, bTakeOwnership)
289  , m_bIsFreezed(false)
290  , m_pSender(pSender)
291  {
292  }
293 
294  JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder,
295  const a11yref& rAlly, FactoryFunction pUITestFactoryFunction, void* pUserData,
296  bool bTakeOwnership)
297  : BaseInstanceClass(pObject, pBuilder, rAlly, pUITestFactoryFunction, pUserData,
298  bTakeOwnership)
299  , m_bIsFreezed(false)
300  , m_pSender(pSender)
301  {
302  }
303 
304  virtual void show() override
305  {
306  BaseInstanceClass::show();
307  sendFullUpdate();
308  }
309 
310  virtual void hide() override
311  {
312  BaseInstanceClass::hide();
313  sendFullUpdate();
314  }
315 
316  using BaseInstanceClass::set_sensitive;
317  virtual void set_sensitive(bool sensitive) override
318  {
319  bool bIsSensitive = BaseInstanceClass::get_sensitive();
320  BaseInstanceClass::set_sensitive(sensitive);
321  if (bIsSensitive != sensitive)
322  sendUpdate();
323  }
324 
325  virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override
326  {
327  if (!m_xDropTarget)
328  m_xDropTarget.set(new JSDropTarget);
329 
330  return m_xDropTarget;
331  }
332 
333  virtual void freeze() override
334  {
335  BaseInstanceClass::freeze();
336  m_bIsFreezed = true;
337  }
338 
339  virtual void thaw() override
340  {
341  BaseInstanceClass::thaw();
342  m_bIsFreezed = false;
343  sendUpdate();
344  }
345 
346  virtual void sendClose() override
347  {
348  if (m_pSender)
349  m_pSender->sendClose();
350  }
351 
352  virtual void sendUpdate(bool bForce = false) override
353  {
354  if (!m_bIsFreezed && m_pSender)
355  m_pSender->sendUpdate(BaseInstanceClass::m_xWidget, bForce);
356  }
357 
358  virtual void sendFullUpdate(bool bForce = false) override
359  {
360  if ((!m_bIsFreezed || bForce) && m_pSender)
361  m_pSender->sendFullUpdate(bForce);
362  }
363 
364  virtual void sendAction(std::unique_ptr<ActionDataMap> pData) override
365  {
366  if (!m_bIsFreezed && m_pSender && pData)
367  m_pSender->sendAction(BaseInstanceClass::m_xWidget, std::move(pData));
368  }
369 };
370 
371 class JSDialog : public JSWidget<SalInstanceDialog, ::Dialog>
372 {
373 public:
374  JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, SalInstanceBuilder* pBuilder,
375  bool bTakeOwnership);
376 
377  virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) override;
378  virtual void undo_collapse() override;
379  virtual void response(int response) override;
380 };
381 
382 class JSLabel : public JSWidget<SalInstanceLabel, FixedText>
383 {
384 public:
385  JSLabel(JSDialogSender* pSender, FixedText* pLabel, SalInstanceBuilder* pBuilder,
386  bool bTakeOwnership);
387  virtual void set_label(const OUString& rText) override;
388 };
389 
390 class JSButton : public JSWidget<SalInstanceButton, ::Button>
391 {
392 public:
393  JSButton(JSDialogSender* pSender, ::Button* pButton, SalInstanceBuilder* pBuilder,
394  bool bTakeOwnership);
395 };
396 
397 class JSEntry : public JSWidget<SalInstanceEntry, ::Edit>
398 {
399 public:
400  JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pBuilder,
401  bool bTakeOwnership);
402  virtual void set_text(const OUString& rText) override;
403  void set_text_without_notify(const OUString& rText);
404 };
405 
406 class JSListBox : public JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>
407 {
408 public:
409  JSListBox(JSDialogSender* pSender, ::ListBox* pListBox, SalInstanceBuilder* pBuilder,
410  bool bTakeOwnership);
411  virtual void insert(int pos, const OUString& rStr, const OUString* pId,
412  const OUString* pIconName, VirtualDevice* pImageSurface) override;
413  virtual void remove(int pos) override;
414  virtual void set_active(int pos) override;
415 };
416 
417 class JSComboBox : public JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>
418 {
419 public:
420  JSComboBox(JSDialogSender* pSender, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder,
421  bool bTakeOwnership);
422  virtual void insert(int pos, const OUString& rStr, const OUString* pId,
423  const OUString* pIconName, VirtualDevice* pImageSurface) override;
424  virtual void remove(int pos) override;
425  virtual void set_entry_text(const OUString& rText) override;
426  virtual void set_active(int pos) override;
427 };
428 
429 class JSNotebook : public JSWidget<SalInstanceNotebook, ::TabControl>
430 {
431 public:
432  JSNotebook(JSDialogSender* pSender, ::TabControl* pControl, SalInstanceBuilder* pBuilder,
433  bool bTakeOwnership);
434 
435  virtual void set_current_page(int nPage) override;
436 
437  virtual void set_current_page(const OString& rIdent) override;
438 
439  virtual void remove_page(const OString& rIdent) override;
440 
441  virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override;
442 };
443 
444 class JSSpinButton : public JSWidget<SalInstanceSpinButton, ::FormattedField>
445 {
446 public:
447  JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder,
448  bool bTakeOwnership);
449 
450  virtual void set_value(int value) override;
451 };
452 
453 class JSMessageDialog : public JSWidget<SalInstanceMessageDialog, ::MessageDialog>
454 {
455  std::unique_ptr<JSDialogSender> m_pOwnedSender;
456  std::unique_ptr<JSButton> m_pOK;
457  std::unique_ptr<JSButton> m_pCancel;
458 
459  DECL_LINK(OKHdl, weld::Button&, void);
460  DECL_LINK(CancelHdl, weld::Button&, void);
461 
462 public:
463  JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog, SalInstanceBuilder* pBuilder,
464  bool bTakeOwnership);
465  JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
466  virtual ~JSMessageDialog();
467 
468  virtual void set_primary_text(const OUString& rText) override;
469 
470  virtual void set_secondary_text(const OUString& rText) override;
471 
472  virtual void response(int response) override;
473 };
474 
475 class JSCheckButton : public JSWidget<SalInstanceCheckButton, ::CheckBox>
476 {
477 public:
478  JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder,
479  bool bTakeOwnership);
480 
481  virtual void set_active(bool active) override;
482 };
483 
484 class JSDrawingArea : public JSWidget<SalInstanceDrawingArea, VclDrawingArea>
485 {
486 public:
487  JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea,
488  SalInstanceBuilder* pBuilder, const a11yref& rAlly,
489  FactoryFunction pUITestFactoryFunction, void* pUserData);
490 
491  virtual void queue_draw() override;
492  virtual void queue_draw_area(int x, int y, int width, int height) override;
493 };
494 
495 class JSToolbar : public JSWidget<SalInstanceToolbar, ::ToolBox>
496 {
497 public:
498  JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder,
499  bool bTakeOwnership);
500 };
501 
502 class JSTextView : public JSWidget<SalInstanceTextView, ::VclMultiLineEdit>
503 {
504 public:
505  JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder,
506  bool bTakeOwnership);
507  virtual void set_text(const OUString& rText) override;
508 };
509 
510 class JSTreeView : public JSWidget<SalInstanceTreeView, ::SvTabListBox>
511 {
512 public:
513  JSTreeView(JSDialogSender* pSender, ::SvTabListBox* pTextView, SalInstanceBuilder* pBuilder,
514  bool bTakeOwnership);
515 
518  virtual void set_toggle(int pos, TriState eState, int col = -1) override;
519  virtual void set_toggle(const weld::TreeIter& rIter, TriState bOn, int col = -1) override;
520 
523  virtual void select(int pos) override;
524 
525  virtual weld::TreeView* get_drag_source() const override;
526 
528  virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
529  const OUString* pId, const OUString* pIconName,
530  VirtualDevice* pImageSurface, bool bChildrenOnDemand,
531  weld::TreeIter* pRet) override;
532 
533  virtual void set_text(int row, const OUString& rText, int col = -1) override;
534  virtual void set_text(const weld::TreeIter& rIter, const OUString& rStr, int col = -1) override;
535 
536  virtual void expand_row(const weld::TreeIter& rIter) override;
537  virtual void collapse_row(const weld::TreeIter& rIter) override;
538 
540  virtual void remove(int pos) override;
541  virtual void remove(const weld::TreeIter& rIter) override;
542 
543  virtual void clear() override;
544 
545  void drag_start();
546  void drag_end();
547 };
548 
549 class JSExpander : public JSWidget<SalInstanceExpander, ::VclExpander>
550 {
551 public:
552  JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander, SalInstanceBuilder* pBuilder,
553  bool bTakeOwnership);
554 
555  virtual void set_expanded(bool bExpand) override;
556 };
557 
558 class JSIconView : public JSWidget<SalInstanceIconView, ::IconView>
559 {
560 public:
561  JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder,
562  bool bTakeOwnership);
563 
564  virtual void insert(int pos, const OUString* pStr, const OUString* pId,
565  const OUString* pIconName, weld::TreeIter* pRet) override;
566 
567  virtual void insert(int pos, const OUString* pStr, const OUString* pId,
568  const VirtualDevice* pIcon, weld::TreeIter* pRet) override;
569  virtual void clear() override;
570  virtual void select(int pos) override;
571  virtual void unselect(int pos) override;
572 };
573 
574 class JSRadioButton : public JSWidget<SalInstanceRadioButton, ::RadioButton>
575 {
576 public:
577  JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButton,
578  SalInstanceBuilder* pBuilder, bool bTakeOwnership);
579 
580  virtual void set_active(bool active) override;
581 };
582 
583 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
virtual void set_value(int value) override
osl::Mutex m_aMutex
std::unique_ptr< JSButton > m_pOK
std::unique_ptr< ActionDataMap > m_pData
JSIconView(JSDialogSender *pSender,::IconView *pIconView, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
void sendUpdate(VclPtr< vcl::Window > pWindow, bool bForce=false)
std::string m_LastNotificationMessage
VclPtr< vcl::Window > m_aNotifierWindow
virtual void clear() override
virtual void sendFullUpdate(bool bForce=false)
VclButtonsType
Definition: vclenum.hxx:244
std::unique_ptr< ContentProperties > pData
static JSInstanceBuilder * CreateAutofilterWindowBuilder(vcl::Window *pParent, const OUString &rUIRoot, const OUString &rUIFile)
virtual void sendUpdate(bool bForce=false)=0
signed char sal_Int8
A widget used to choose from a list of items and which has no entry.
Definition: lstbox.hxx:82
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 ...
virtual ~BaseJSWidget()=default
JSLabel(JSDialogSender *pSender, FixedText *pLabel, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
virtual sal_Bool SAL_CALL isActive() override
css::uno::Reference< css::accessibility::XAccessible > a11yref
Definition: weld.hxx:45
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual void thaw() override
virtual ~JSMessageDialog()
JSCheckButton(JSDialogSender *pSender,::CheckBox *pCheckBox, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
JSRadioButton(JSDialogSender *pSender,::RadioButton *pRadioButton, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual void set_active(int pos) override
VclPtr< vcl::Window > m_pWindow
virtual void sendAction(std::unique_ptr< ActionDataMap > pData)=0
JSNotebook(JSDialogSender *pSender,::TabControl *pControl, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
void initializeSender(VclPtr< vcl::Window > aNotifierWindow, VclPtr< vcl::Window > aContentWindow, std::string sTypeOfJSON)
virtual void hide() override
std::unique_ptr< tools::JsonWriter > generateCloseMessage() const
virtual void sendFullUpdate(bool bForce=false)=0
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)
float x
virtual void set_secondary_text(const OUString &rText) override
VCL_DLLPUBLIC void SendFullUpdate(sal_uInt64 nWindowId, const OString &rWidget)
virtual void set_current_page(int nPage) override
void copy(const JSDialogMessageInfo &rInfo)
virtual sal_Int8 SAL_CALL getDefaultActions() override
void send(tools::JsonWriter &aJsonWriter)
static void RemoveWindowWidget(sal_uInt64 nWindowId)
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()
virtual ~JSDialogSender()
size_t pos
JSTextView(JSDialogSender *pSender,::VclMultiLineEdit *pTextView, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual void remove(int pos) override
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
virtual css::uno::Reference< css::datatransfer::dnd::XDropTarget > get_drop_target() override
virtual void show() 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 void sendAction(VclPtr< vcl::Window > pWindow, std::unique_ptr< ActionDataMap > pData)
VclMessageType
Definition: vclenum.hxx:254
Definition: edit.hxx:55
virtual std::unique_ptr< weld::CheckButton > weld_check_button(const OString &id) override
sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
std::unique_ptr< JSButton > m_pCancel
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 sendFullUpdate(bool bForce=false) override
float y
virtual void set_expanded(bool bExpand) override
std::unordered_map< std::string, OUString > ActionDataMap
virtual void set_label(const OUString &rText) override
JSInstanceBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile)
used for dialogs
JSDialogSender * m_pSender
virtual std::unique_ptr< weld::Expander > weld_expander(const OString &id) override
static weld::Widget * FindWeldWidgetsMap(sal_uInt64 nWindowId, const OString &rWidget)
virtual void sendAction(std::unique_ptr< ActionDataMap > pData) override
std::deque< JSDialogMessageInfo > m_aMessageQueue
JSTreeView(JSDialogSender *pSender,::SvTabListBox *pTextView, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual void remove_page(const OString &rIdent) override
JSWidget(JSDialogSender *pSender, VclClass *pObject, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
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
virtual void sendClose() override
VclPtr< vcl::Window > m_aParentDialog
used in case of tab pages where dialog is not a direct top level
JSToolbar(JSDialogSender *pSender,::ToolBox *pToolbox, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual void sendClose()=0
unsigned char sal_Bool
virtual void queue_draw() override
VclPtr< vcl::Window > m_aContentWindow
JSSpinButton(JSDialogSender *pSender,::FormattedField *pSpin, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual void clear() override
void drag_start()
jsdialog::MessageType m_eType
virtual void undo_collapse() override
virtual std::unique_ptr< weld::Notebook > weld_notebook(const OString &id) override
void sendMessage(jsdialog::MessageType eType, VclPtr< vcl::Window > pWindow, std::unique_ptr< ActionDataMap > pData=nullptr)
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
virtual void set_sensitive(bool sensitive) override
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
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 void set_active(bool active) 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)
void drag_end()
static void AddChildWidget(sal_uInt64 nWindowId, const OString &id, weld::Widget *pWidget)
std::map< OString, weld::Widget * > WidgetMap
Class with the message description for storing in the queue.
virtual void freeze() override
virtual std::unique_ptr< weld::TreeView > weld_tree_view(const OString &id) override
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
DECL_LINK(OKHdl, weld::Button &, void)
JSDialogMessageInfo(jsdialog::MessageType eType, VclPtr< vcl::Window > pWindow, std::unique_ptr< ActionDataMap > pData)
JSEntry(JSDialogSender *pSender,::Edit *pEntry, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
JSDialogMessageInfo(const JSDialogMessageInfo &rInfo)
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::unique_ptr< tools::JsonWriter > generateActionMessage(VclPtr< vcl::Window > pWindow, std::unique_ptr< ActionDataMap > pData) const
virtual void response(int response) override
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 sendUpdate(bool bForce=false) 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
Any value
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.
Definition: combobox.hxx:38
JSDialogSender()=default
rtl::Reference< JSDropTarget > m_xDropTarget
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
JSDialogMessageInfo & operator=(JSDialogMessageInfo aInfo)
virtual void insert(int pos, const OUString &rStr, const OUString *pId, const OUString *pIconName, VirtualDevice *pImageSurface) override
JSWidget(JSDialogSender *pSender, VclClass *pObject, SalInstanceBuilder *pBuilder, const a11yref &rAlly, FactoryFunction pUITestFactoryFunction, void *pUserData, bool bTakeOwnership)
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
JSButton(JSDialogSender *pSender,::Button *pButton, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
TriState
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)
virtual void set_active(bool active) override
std::unique_ptr< tools::JsonWriter > generateFullUpdate() const
An idle is a timer to be scheduled immediately.
Definition: idle.hxx:34
sal_uInt16 nPos
virtual void set_primary_text(const OUString &rText) override