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 <comphelper/string.hxx>
13 #include <osl/mutex.hxx>
14 #include <vcl/weld.hxx>
16 #include <vcl/sysdata.hxx>
17 #include <vcl/virdev.hxx>
18 #include <vcl/builder.hxx>
19 #include <salvtables.hxx>
20 #include <vcl/toolkit/button.hxx>
21 #include <vcl/toolkit/fmtfield.hxx>
22 
23 #include <com/sun/star/lang/XInitialization.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
26 #include <cppuhelper/compbase.hxx>
27 
28 #include <deque>
29 #include <list>
30 #include <unordered_map>
31 
32 #define ACTION_TYPE "action_type"
33 #define PARENT_ID "parent_id"
34 #define WINDOW_ID "id"
35 #define CLOSE_ID "close_id"
36 
37 class ToolBox;
38 class ComboBox;
39 class VclMultiLineEdit;
40 class SvTabListBox;
41 class IconView;
42 
43 typedef std::map<OString, weld::Widget*> WidgetMap;
44 typedef std::unordered_map<std::string, OUString> ActionDataMap;
45 
46 namespace jsdialog
47 {
49 {
55 };
56 }
57 
60 {
61 public:
64  std::unique_ptr<ActionDataMap> m_pData;
65 
66 private:
67  void copy(const JSDialogMessageInfo& rInfo)
68  {
69  this->m_eType = rInfo.m_eType;
70  this->m_pWindow = rInfo.m_pWindow;
71  if (rInfo.m_pData)
72  {
73  std::unique_ptr<ActionDataMap> pData(new ActionDataMap(*rInfo.m_pData));
74  this->m_pData = std::move(pData);
75  }
76  }
77 
78 public:
80  std::unique_ptr<ActionDataMap> pData)
81  : m_eType(eType)
82  , m_pWindow(pWindow)
83  , m_pData(std::move(pData))
84  {
85  }
86 
87  JSDialogMessageInfo(const JSDialogMessageInfo& rInfo) { copy(rInfo); }
88 
90  {
91  if (this == &aInfo)
92  return *this;
93 
94  copy(aInfo);
95  return *this;
96  }
97 };
98 
99 class JSDialogNotifyIdle final : public Idle
100 {
101  // used to send message
103  // used to generate JSON
105  std::string m_sTypeOfJSON;
107  bool m_bForce;
108 
109  std::deque<JSDialogMessageInfo> m_aMessageQueue;
110  osl::Mutex m_aQueueMutex;
111 
112 public:
113  JSDialogNotifyIdle(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
114  std::string sTypeOfJSON);
115 
116  void Invoke() override;
117 
118  void clearQueue();
119  void forceUpdate();
121  std::unique_ptr<ActionDataMap> pData = nullptr);
122 
123 private:
124  void send(tools::JsonWriter& aJsonWriter);
125  std::unique_ptr<tools::JsonWriter> generateFullUpdate() const;
126  std::unique_ptr<tools::JsonWriter> generateWidgetUpdate(VclPtr<vcl::Window> pWindow) const;
127  std::unique_ptr<tools::JsonWriter> generateCloseMessage() const;
128  std::unique_ptr<tools::JsonWriter>
129  generateActionMessage(VclPtr<vcl::Window> pWindow, std::unique_ptr<ActionDataMap> pData) const;
130  std::unique_ptr<tools::JsonWriter>
131  generatePopupMessage(VclPtr<vcl::Window> pWindow, OUString sParentId, OUString sCloseId) const;
132  std::unique_ptr<tools::JsonWriter> generateClosePopupMessage(OUString sWindowId) const;
133 };
134 
136 {
137  std::unique_ptr<JSDialogNotifyIdle> mpIdleNotify;
138 
139 public:
140  JSDialogSender() = default;
141  JSDialogSender(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
142  std::string sTypeOfJSON)
143  {
144  initializeSender(aNotifierWindow, aContentWindow, sTypeOfJSON);
145  }
146 
147  virtual ~JSDialogSender() COVERITY_NOEXCEPT_FALSE;
148 
149  virtual void sendFullUpdate(bool bForce = false);
150  void sendClose();
151  void sendUpdate(VclPtr<vcl::Window> pWindow, bool bForce = false);
152  virtual void sendAction(VclPtr<vcl::Window> pWindow, std::unique_ptr<ActionDataMap> pData);
153  virtual void sendPopup(VclPtr<vcl::Window> pWindow, OUString sParentId, OUString sCloseId);
154  virtual void sendClosePopup(vcl::LOKWindowId nWindowId);
155  void flush() { mpIdleNotify->Invoke(); }
156 
157 protected:
158  void initializeSender(VclPtr<vcl::Window> aNotifierWindow, VclPtr<vcl::Window> aContentWindow,
159  std::string sTypeOfJSON)
160  {
161  mpIdleNotify.reset(new JSDialogNotifyIdle(aNotifierWindow, aContentWindow, sTypeOfJSON));
162  }
163 };
164 
165 class JSDropTarget final
166  : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDropTarget,
167  css::lang::XInitialization, css::lang::XServiceInfo>
168 {
169  osl::Mutex m_aMutex;
170  std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> m_aListeners;
171 
172 public:
173  JSDropTarget();
174 
175  // XInitialization
176  virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArgs) override;
177 
178  // XDropTarget
179  virtual void SAL_CALL addDropTargetListener(
180  const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override;
181  virtual void SAL_CALL removeDropTargetListener(
182  const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override;
183  virtual sal_Bool SAL_CALL isActive() override;
184  virtual void SAL_CALL setActive(sal_Bool active) override;
185  virtual sal_Int8 SAL_CALL getDefaultActions() override;
186  virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override;
187 
188  OUString SAL_CALL getImplementationName() override;
189 
190  sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override;
191 
192  css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
193 
194  void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde);
195 
196  void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde);
197 };
198 
200 {
201  sal_uInt64 m_nWindowId;
205  std::list<std::string> m_aRememberedWidgets;
206  std::string m_sTypeOfJSON;
211 
212  friend VCL_DLLPUBLIC bool jsdialog::ExecuteAction(sal_uInt64 nWindowId, const OString& rWidget,
213  StringMap& rData);
214  friend VCL_DLLPUBLIC void jsdialog::SendFullUpdate(sal_uInt64 nWindowId,
215  const OString& rWidget);
216 
217  static std::map<sal_uInt64, WidgetMap>& GetLOKWeldWidgetsMap();
218  static void InsertWindowToMap(sal_uInt64 nWindowId);
219  void RememberWidget(const OString& id, weld::Widget* pWidget);
220  static weld::Widget* FindWeldWidgetsMap(sal_uInt64 nWindowId, const OString& rWidget);
221 
223  JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile,
224  bool bPopup = false);
226  JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile,
227  sal_uInt64 nLOKWindowId);
229  JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
230  const css::uno::Reference<css::frame::XFrame>& rFrame,
231  sal_uInt64 nWindowId = 0);
233  JSInstanceBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile);
234 
235 public:
236  static JSInstanceBuilder* CreateDialogBuilder(weld::Widget* pParent, const OUString& rUIRoot,
237  const OUString& rUIFile);
238  static JSInstanceBuilder*
239  CreateNotebookbarBuilder(vcl::Window* pParent, const OUString& rUIRoot, const OUString& rUIFile,
240  const css::uno::Reference<css::frame::XFrame>& rFrame,
241  sal_uInt64 nWindowId = 0);
243  const OUString& rUIRoot,
244  const OUString& rUIFile);
245  static JSInstanceBuilder* CreateSidebarBuilder(weld::Widget* pParent, const OUString& rUIRoot,
246  const OUString& rUIFile,
247  sal_uInt64 nLOKWindowId = 0);
248  static JSInstanceBuilder* CreatePopupBuilder(weld::Widget* pParent, const OUString& rUIRoot,
249  const OUString& rUIFile);
250 
251  virtual ~JSInstanceBuilder() override;
252  virtual std::unique_ptr<weld::MessageDialog> weld_message_dialog(const OString& id) override;
253  virtual std::unique_ptr<weld::Dialog> weld_dialog(const OString& id) override;
254  virtual std::unique_ptr<weld::Container> weld_container(const OString& id) override;
255  virtual std::unique_ptr<weld::Label> weld_label(const OString& id) override;
256  virtual std::unique_ptr<weld::Button> weld_button(const OString& id) override;
257  virtual std::unique_ptr<weld::Entry> weld_entry(const OString& id) override;
258  virtual std::unique_ptr<weld::ComboBox> weld_combo_box(const OString& id) override;
259  virtual std::unique_ptr<weld::Notebook> weld_notebook(const OString& id) override;
260  virtual std::unique_ptr<weld::SpinButton> weld_spin_button(const OString& id) override;
261  virtual std::unique_ptr<weld::CheckButton> weld_check_button(const OString& id) override;
262  virtual std::unique_ptr<weld::DrawingArea>
263  weld_drawing_area(const OString& id, const a11yref& rA11yImpl = nullptr,
264  FactoryFunction pUITestFactoryFunction = nullptr,
265  void* pUserData = nullptr) override;
266  virtual std::unique_ptr<weld::Toolbar> weld_toolbar(const OString& id) override;
267  virtual std::unique_ptr<weld::TextView> weld_text_view(const OString& id) override;
268  virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString& id) override;
269  virtual std::unique_ptr<weld::Expander> weld_expander(const OString& id) override;
270  virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString& id) override;
271  virtual std::unique_ptr<weld::RadioButton> weld_radio_button(const OString& id) override;
272  virtual std::unique_ptr<weld::Frame> weld_frame(const OString& id) override;
273  virtual std::unique_ptr<weld::MenuButton> weld_menu_button(const OString& id) override;
274  virtual std::unique_ptr<weld::Popover> weld_popover(const OString& id) override;
275 
277  VclMessageType eMessageType,
278  VclButtonsType eButtonType,
279  const OUString& rPrimaryMessage);
280 
281  static void AddChildWidget(sal_uInt64 nWindowId, const OString& id, weld::Widget* pWidget);
282  static void RemoveWindowWidget(sal_uInt64 nWindowId);
283 
284 private:
285  const std::string& GetTypeOfJSON() const;
288 };
289 
291 {
292 public:
293  virtual ~BaseJSWidget() = default;
294 
295  virtual void sendClose() = 0;
296 
297  virtual void sendUpdate(bool bForce = false) = 0;
298 
299  virtual void sendFullUpdate(bool bForce = false) = 0;
300 
301  virtual void sendAction(std::unique_ptr<ActionDataMap> pData) = 0;
302 
303  virtual void sendPopup(vcl::Window* pPopup, OUString sParentId, OUString sCloseId) = 0;
304 
305  virtual void sendClosePopup(vcl::LOKWindowId nWindowId) = 0;
306 };
307 
308 template <class BaseInstanceClass, class VclClass>
309 class JSWidget : public BaseInstanceClass, public BaseJSWidget
310 {
311 protected:
314 
316 
317 public:
318  JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder,
319  bool bTakeOwnership)
320  : BaseInstanceClass(pObject, pBuilder, bTakeOwnership)
321  , m_bIsFreezed(false)
322  , m_pSender(pSender)
323  {
324  }
325 
326  JSWidget(JSDialogSender* pSender, VclClass* pObject, SalInstanceBuilder* pBuilder,
327  const a11yref& rAlly, FactoryFunction pUITestFactoryFunction, void* pUserData,
328  bool bTakeOwnership)
329  : BaseInstanceClass(pObject, pBuilder, rAlly, pUITestFactoryFunction, pUserData,
330  bTakeOwnership)
331  , m_bIsFreezed(false)
332  , m_pSender(pSender)
333  {
334  }
335 
336  virtual void show() override
337  {
338  bool bWasVisible = BaseInstanceClass::get_visible();
339  BaseInstanceClass::show();
340  if (!bWasVisible)
341  {
342  std::unique_ptr<ActionDataMap> pMap = std::make_unique<ActionDataMap>();
343  (*pMap)[ACTION_TYPE] = "show";
344  sendAction(std::move(pMap));
345  }
346  }
347 
348  virtual void hide() override
349  {
350  bool bWasVisible = BaseInstanceClass::get_visible();
351  BaseInstanceClass::hide();
352  if (bWasVisible)
353  {
354  std::unique_ptr<ActionDataMap> pMap = std::make_unique<ActionDataMap>();
355  (*pMap)[ACTION_TYPE] = "hide";
356  sendAction(std::move(pMap));
357  }
358  }
359 
360  using BaseInstanceClass::set_sensitive;
361  virtual void set_sensitive(bool sensitive) override
362  {
363  bool bIsSensitive = BaseInstanceClass::get_sensitive();
364  BaseInstanceClass::set_sensitive(sensitive);
365  if (bIsSensitive != sensitive)
366  sendUpdate();
367  }
368 
369  virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override
370  {
371  if (!m_xDropTarget)
372  m_xDropTarget.set(new JSDropTarget);
373 
374  return m_xDropTarget;
375  }
376 
377  virtual void freeze() override
378  {
379  BaseInstanceClass::freeze();
380  m_bIsFreezed = true;
381  }
382 
383  virtual void thaw() override
384  {
385  BaseInstanceClass::thaw();
386  m_bIsFreezed = false;
387  sendUpdate();
388  }
389 
390  virtual void sendClose() override
391  {
392  if (m_pSender)
393  m_pSender->sendClose();
394  }
395 
396  virtual void sendUpdate(bool bForce = false) override
397  {
398  if (!m_bIsFreezed && m_pSender)
399  m_pSender->sendUpdate(BaseInstanceClass::m_xWidget, bForce);
400  }
401 
402  virtual void sendFullUpdate(bool bForce = false) override
403  {
404  if ((!m_bIsFreezed || bForce) && m_pSender)
405  m_pSender->sendFullUpdate(bForce);
406  }
407 
408  virtual void sendAction(std::unique_ptr<ActionDataMap> pData) override
409  {
410  if (!m_bIsFreezed && m_pSender && pData)
411  m_pSender->sendAction(BaseInstanceClass::m_xWidget, std::move(pData));
412  }
413 
414  virtual void sendPopup(vcl::Window* pPopup, OUString sParentId, OUString sCloseId) override
415  {
416  if (!m_bIsFreezed && m_pSender)
417  m_pSender->sendPopup(pPopup, sParentId, sCloseId);
418  }
419 
420  virtual void sendClosePopup(vcl::LOKWindowId nWindowId) override
421  {
422  if (!m_bIsFreezed && m_pSender)
423  m_pSender->sendClosePopup(nWindowId);
424  }
425 };
426 
427 class JSDialog final : public JSWidget<SalInstanceDialog, ::Dialog>
428 {
429 public:
430  JSDialog(JSDialogSender* pSender, ::Dialog* pDialog, SalInstanceBuilder* pBuilder,
431  bool bTakeOwnership);
432 
433  virtual void collapse(weld::Widget* pEdit, weld::Widget* pButton) override;
434  virtual void undo_collapse() override;
435  virtual void response(int response) override;
436 };
437 
438 class JSContainer final : public JSWidget<SalInstanceContainer, vcl::Window>
439 {
440 public:
441  JSContainer(JSDialogSender* pSender, vcl::Window* pContainer, SalInstanceBuilder* pBuilder,
442  bool bTakeOwnership);
443 };
444 
445 class JSLabel final : public JSWidget<SalInstanceLabel, FixedText>
446 {
447 public:
448  JSLabel(JSDialogSender* pSender, FixedText* pLabel, SalInstanceBuilder* pBuilder,
449  bool bTakeOwnership);
450  virtual void set_label(const OUString& rText) override;
451 };
452 
453 class JSButton final : public JSWidget<SalInstanceButton, ::Button>
454 {
455 public:
456  JSButton(JSDialogSender* pSender, ::Button* pButton, SalInstanceBuilder* pBuilder,
457  bool bTakeOwnership);
458 };
459 
460 class JSEntry final : public JSWidget<SalInstanceEntry, ::Edit>
461 {
462 public:
463  JSEntry(JSDialogSender* pSender, ::Edit* pEntry, SalInstanceBuilder* pBuilder,
464  bool bTakeOwnership);
465  virtual void set_text(const OUString& rText) override;
466  void set_text_without_notify(const OUString& rText);
467 };
468 
469 class JSListBox final : public JSWidget<SalInstanceComboBoxWithoutEdit, ::ListBox>
470 {
471 public:
472  JSListBox(JSDialogSender* pSender, ::ListBox* pListBox, SalInstanceBuilder* pBuilder,
473  bool bTakeOwnership);
474  virtual void insert(int pos, const OUString& rStr, const OUString* pId,
475  const OUString* pIconName, VirtualDevice* pImageSurface) override;
476  virtual void remove(int pos) override;
477  virtual void set_active(int pos) override;
478 };
479 
480 class JSComboBox final : public JSWidget<SalInstanceComboBoxWithEdit, ::ComboBox>
481 {
482 public:
483  JSComboBox(JSDialogSender* pSender, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder,
484  bool bTakeOwnership);
485  virtual void insert(int pos, const OUString& rStr, const OUString* pId,
486  const OUString* pIconName, VirtualDevice* pImageSurface) override;
487  virtual void remove(int pos) override;
488  virtual void set_entry_text(const OUString& rText) override;
489  virtual void set_active(int pos) override;
490  virtual bool changed_by_direct_pick() const override;
491 };
492 
493 class JSNotebook final : public JSWidget<SalInstanceNotebook, ::TabControl>
494 {
495 public:
496  JSNotebook(JSDialogSender* pSender, ::TabControl* pControl, SalInstanceBuilder* pBuilder,
497  bool bTakeOwnership);
498 
499  virtual void set_current_page(int nPage) override;
500 
501  virtual void set_current_page(const OString& rIdent) override;
502 
503  virtual void remove_page(const OString& rIdent) override;
504 
505  virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override;
506 };
507 
508 class JSSpinButton final : public JSWidget<SalInstanceSpinButton, ::FormattedField>
509 {
510 public:
511  JSSpinButton(JSDialogSender* pSender, ::FormattedField* pSpin, SalInstanceBuilder* pBuilder,
512  bool bTakeOwnership);
513 
514  virtual void set_value(int value) override;
515 };
516 
517 class JSMessageDialog final : public JSWidget<SalInstanceMessageDialog, ::MessageDialog>
518 {
519  std::unique_ptr<JSDialogSender> m_pOwnedSender;
520  std::unique_ptr<JSButton> m_pOK;
521  std::unique_ptr<JSButton> m_pCancel;
522 
523  DECL_LINK(OKHdl, weld::Button&, void);
524  DECL_LINK(CancelHdl, weld::Button&, void);
525 
526 public:
527  JSMessageDialog(JSDialogSender* pSender, ::MessageDialog* pDialog, SalInstanceBuilder* pBuilder,
528  bool bTakeOwnership);
529  JSMessageDialog(::MessageDialog* pDialog, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
530  virtual ~JSMessageDialog();
531 
532  virtual void set_primary_text(const OUString& rText) override;
533 
534  virtual void set_secondary_text(const OUString& rText) override;
535 
536  virtual void response(int response) override;
537 };
538 
539 class JSCheckButton final : public JSWidget<SalInstanceCheckButton, ::CheckBox>
540 {
541 public:
542  JSCheckButton(JSDialogSender* pSender, ::CheckBox* pCheckBox, SalInstanceBuilder* pBuilder,
543  bool bTakeOwnership);
544 
545  virtual void set_active(bool active) override;
546 };
547 
548 class JSDrawingArea final : public JSWidget<SalInstanceDrawingArea, VclDrawingArea>
549 {
550 public:
551  JSDrawingArea(JSDialogSender* pSender, VclDrawingArea* pDrawingArea,
552  SalInstanceBuilder* pBuilder, const a11yref& rAlly,
553  FactoryFunction pUITestFactoryFunction, void* pUserData);
554 
555  virtual void queue_draw() override;
556  virtual void queue_draw_area(int x, int y, int width, int height) override;
557 };
558 
559 class JSToolbar final : public JSWidget<SalInstanceToolbar, ::ToolBox>
560 {
561  std::map<sal_uInt16, weld::Widget*> m_pPopovers;
562 
563 public:
564  JSToolbar(JSDialogSender* pSender, ::ToolBox* pToolbox, SalInstanceBuilder* pBuilder,
565  bool bTakeOwnership);
566 
567  virtual void set_menu_item_active(const OString& rIdent, bool bActive) override;
568  virtual void set_item_sensitive(const OString& rIdent, bool bSensitive) override;
569 };
570 
571 class JSTextView final : public JSWidget<SalInstanceTextView, ::VclMultiLineEdit>
572 {
573 public:
574  JSTextView(JSDialogSender* pSender, ::VclMultiLineEdit* pTextView, SalInstanceBuilder* pBuilder,
575  bool bTakeOwnership);
576  virtual void set_text(const OUString& rText) override;
577 };
578 
579 class JSTreeView final : public JSWidget<SalInstanceTreeView, ::SvTabListBox>
580 {
581 public:
582  JSTreeView(JSDialogSender* pSender, ::SvTabListBox* pTextView, SalInstanceBuilder* pBuilder,
583  bool bTakeOwnership);
584 
587  virtual void set_toggle(int pos, TriState eState, int col = -1) override;
588  virtual void set_toggle(const weld::TreeIter& rIter, TriState bOn, int col = -1) override;
589 
592  virtual void select(int pos) override;
593 
594  virtual weld::TreeView* get_drag_source() const override;
595 
597  virtual void insert(const weld::TreeIter* pParent, int pos, const OUString* pStr,
598  const OUString* pId, const OUString* pIconName,
599  VirtualDevice* pImageSurface, bool bChildrenOnDemand,
600  weld::TreeIter* pRet) override;
601 
602  virtual void set_text(int row, const OUString& rText, int col = -1) override;
603  virtual void set_text(const weld::TreeIter& rIter, const OUString& rStr, int col = -1) override;
604 
605  virtual void expand_row(const weld::TreeIter& rIter) override;
606  virtual void collapse_row(const weld::TreeIter& rIter) override;
607 
609  virtual void remove(int pos) override;
610  virtual void remove(const weld::TreeIter& rIter) override;
611 
612  virtual void clear() override;
613 
614  void drag_start();
615  void drag_end();
616 };
617 
618 class JSExpander final : public JSWidget<SalInstanceExpander, ::VclExpander>
619 {
620 public:
621  JSExpander(JSDialogSender* pSender, ::VclExpander* pExpander, SalInstanceBuilder* pBuilder,
622  bool bTakeOwnership);
623 
624  virtual void set_expanded(bool bExpand) override;
625 };
626 
627 class JSIconView final : public JSWidget<SalInstanceIconView, ::IconView>
628 {
629 public:
630  JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder,
631  bool bTakeOwnership);
632 
633  virtual void insert(int pos, const OUString* pStr, const OUString* pId,
634  const OUString* pIconName, weld::TreeIter* pRet) override;
635 
636  virtual void insert(int pos, const OUString* pStr, const OUString* pId,
637  const VirtualDevice* pIcon, weld::TreeIter* pRet) override;
638  virtual void clear() override;
639  virtual void select(int pos) override;
640  virtual void unselect(int pos) override;
641 };
642 
643 class JSRadioButton final : public JSWidget<SalInstanceRadioButton, ::RadioButton>
644 {
645 public:
646  JSRadioButton(JSDialogSender* pSender, ::RadioButton* pRadioButton,
647  SalInstanceBuilder* pBuilder, bool bTakeOwnership);
648 
649  virtual void set_active(bool active) override;
650 };
651 
652 class JSFrame : public JSWidget<SalInstanceFrame, ::VclFrame>
653 {
654 public:
655  JSFrame(JSDialogSender* pSender, ::VclFrame* pFrame, SalInstanceBuilder* pBuilder,
656  bool bTakeOwnership);
657 };
658 
659 class JSMenuButton : public JSWidget<SalInstanceMenuButton, ::MenuButton>
660 {
661 public:
662  JSMenuButton(JSDialogSender* pSender, ::MenuButton* pMenuButton, SalInstanceBuilder* pBuilder,
663  bool bTakeOwnership);
664 
665  virtual void set_label(const OUString& rText) override;
666  virtual void set_image(VirtualDevice* pDevice) override;
667  virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) override;
668  virtual void set_active(bool active) override;
669 };
670 
671 class JSPopover : public JSWidget<SalInstancePopover, DockingWindow>
672 {
673 public:
674  JSPopover(JSDialogSender* pSender, DockingWindow* pPopover, SalInstanceBuilder* pBuilder,
675  bool bTakeOwnership);
676 };
677 
678 /* 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
VclPtr< vcl::Window > m_aWindowToRelease
When LOKNotifier is set by jsdialogs code we need to release it.
virtual void sendClosePopup(vcl::LOKWindowId nWindowId) override
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
static JSInstanceBuilder * CreateSidebarBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile, sal_uInt64 nLOKWindowId=0)
virtual sal_Bool SAL_CALL isActive() override
css::uno::Reference< css::accessibility::XAccessible > a11yref
Definition: weld.hxx:49
std::unique_ptr< tools::JsonWriter > generateClosePopupMessage(OUString sWindowId) const
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual void set_menu_item_active(const OString &rIdent, bool bActive) override
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
JSFrame(JSDialogSender *pSender,::VclFrame *pFrame, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual std::unique_ptr< weld::MenuButton > weld_menu_button(const OString &id) override
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()
size_t pos
JSTextView(JSDialogSender *pSender,::VclMultiLineEdit *pTextView, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual ~JSDialogSender() COVERITY_NOEXCEPT_FALSE
virtual void remove(int pos) override
void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent &dtde)
JSInstanceBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile, bool bPopup=false)
used for dialogs or popups
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 std::unique_ptr< weld::Popover > weld_popover(const OString &id) 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
JSPopover(JSDialogSender *pSender, DockingWindow *pPopover, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual void set_expanded(bool bExpand) override
std::unordered_map< std::string, OUString > ActionDataMap
virtual void set_label(const OUString &rText) override
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 std::unique_ptr< weld::Container > weld_container(const OString &id) override
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
JSMenuButton(JSDialogSender *pSender,::MenuButton *pMenuButton, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
virtual void set_active(bool active) override
std::list< std::string > m_aRememberedWidgets
virtual void set_sensitive(bool sensitive) override
virtual void sendClosePopup(vcl::LOKWindowId nWindowId)=0
virtual void set_image(VirtualDevice *pDevice) 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 bool changed_by_direct_pick() const override
virtual void set_entry_text(const OUString &rText) override
std::unique_ptr< tools::JsonWriter > generatePopupMessage(VclPtr< vcl::Window > pWindow, OUString sParentId, OUString sCloseId) const
sal_uInt32 LOKWindowId
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 sendPopup(VclPtr< vcl::Window > pWindow, OUString sParentId, OUString sCloseId)
virtual void set_active(int pos) override
virtual void set_active(bool active) override
virtual ~JSInstanceBuilder() override
virtual void set_label(const OUString &rText) override
static JSInstanceBuilder * CreatePopupBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile)
JSContainer(JSDialogSender *pSender, vcl::Window *pContainer, SalInstanceBuilder *pBuilder, bool bTakeOwnership)
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()
std::map< sal_uInt16, weld::Widget * > m_pPopovers
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)
virtual void sendPopup(vcl::Window *pPopup, OUString sParentId, OUString sCloseId)=0
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
#define ACTION_TYPE
virtual std::unique_ptr< weld::Frame > weld_frame(const OString &id) override
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_item_sensitive(const OString &rIdent, bool bSensitive) 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
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
virtual void sendPopup(vcl::Window *pPopup, OUString sParentId, OUString sCloseId) 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.
virtual void sendClosePopup(vcl::LOKWindowId nWindowId)
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
const std::string & GetTypeOfJSON() const
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